weapon_clipload = STAT(WEAPON_CLIPLOAD);
weapon_clipsize = STAT(WEAPON_CLIPSIZE);
- float vortex_charge, vortex_chargepool;
- vortex_charge = STAT(VORTEX_CHARGE);
- vortex_chargepool = STAT(VORTEX_CHARGEPOOL);
+ entity wepent = viewmodels[0]; // TODO: unhardcode
- float arc_heat = STAT(ARC_HEAT);
+ float arc_heat = wepent.arc_heat_percent;
+ float vcharge = wepent.vortex_charge;
+ float vchargepool = wepent.vortex_chargepool_ammo;
if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
- vortex_charge_movingavg = vortex_charge;
-
- entity wepent = viewmodels[0]; // TODO: unhardcode
+ vortex_charge_movingavg = vcharge;
// handle the values
- if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+ if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vcharge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
{
- if (vortex_chargepool || use_vortex_chargepool) {
+ if (vchargepool || use_vortex_chargepool) {
use_vortex_chargepool = 1;
- ring_inner_value = vortex_chargepool;
+ ring_inner_value = vchargepool;
} else {
- vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vortex_charge;
- ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vortex_charge - vortex_charge_movingavg), 1);
+ vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vcharge;
+ ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vcharge - vortex_charge_movingavg), 1);
}
ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
ring_inner_image = "gfx/crosshair_ring_inner.tga";
// draw the outer ring to show the current charge of the weapon
- ring_value = vortex_charge;
+ ring_value = vcharge;
ring_alpha = autocvar_crosshair_ring_vortex_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring_nexgun.tga";
}
else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer)
{
- ring_value = bound(0, STAT(LAYED_MINES) / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+ ring_value = bound(0, wepent.minelayer_mines / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring.tga";
}
- else if (wepent.activeweapon == WEP_HAGAR && STAT(HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
+ else if (wepent.activeweapon == WEP_HAGAR && wepent.hagar_load && autocvar_crosshair_ring_hagar)
{
- ring_value = bound(0, STAT(HAGAR_LOAD) / WEP_CVAR_SEC(hagar, load_max), 1);
+ ring_value = bound(0, wepent.hagar_load / WEP_CVAR_SEC(hagar, load_max), 1);
ring_alpha = autocvar_crosshair_ring_hagar_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring.tga";
REGISTER_STAT(STRENGTH_FINISHED, float)
REGISTER_STAT(INVINCIBLE_FINISHED, float)
/** arc heat in [0,1] */
-REGISTER_STAT(ARC_HEAT, float)
REGISTER_STAT(PRESSED_KEYS, int)
/** this stat could later contain some other bits of info, like, more server-side particle config */
REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool, autocvar_g_allow_oldvortexbeam)
REGISTER_STAT(WEAPON_CLIPLOAD, int)
REGISTER_STAT(WEAPON_CLIPSIZE, int)
-REGISTER_STAT(VORTEX_CHARGE, float)
REGISTER_STAT(LAST_PICKUP, float)
REGISTER_STAT(HUD, int)
-REGISTER_STAT(VORTEX_CHARGEPOOL, float)
REGISTER_STAT(HIT_TIME, float)
REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
REGISTER_STAT(TYPEHIT_TIME, float)
-REGISTER_STAT(LAYED_MINES, int)
-REGISTER_STAT(HAGAR_LOAD, int)
REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
REGISTER_STAT(VEHICLESTAT_HEALTH, int)
REGISTER_STAT(VEHICLESTAT_SHIELD, int)
}
void Arc_Player_SetHeat(entity player, .entity weaponentity)
{
- player.arc_heat_percent = Arc_GetHeat_Percent(player, weaponentity);
+ player.(weaponentity).arc_heat_percent = Arc_GetHeat_Percent(player, weaponentity);
//dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
}
vector smoke_origin = w_shotorg + actor.velocity*frametime;
if ( actor.arc_overheat > time )
{
- if ( random() < actor.arc_heat_percent )
+ if ( random() < actor.(weaponentity).arc_heat_percent )
Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
if ( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) )
{
.float beam_heat; // (beam) amount of heat produced
.float arc_overheat; // (dropped arc/player) time during which it's too hot
.float arc_cooldown; // (dropped arc/player) cooling speed
-.float arc_heat_percent = _STAT(ARC_HEAT);
+.float arc_heat_percent;
.float arc_smoke_sound;
#endif
#ifdef CSQC
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
actor.(weaponentity).hagar_load = 0;
-
- if(weaponslot(weaponentity) == 0)
- actor.hagar_load = 0;
}
void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
actor.(weaponentity).state = WS_READY;
W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo
actor.(weaponentity).hagar_load = 0;
- if(weaponslot(weaponentity) == 0)
- actor.hagar_load = 0;
sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
// pause until we can load rockets again, once we re-press the alt fire button
{
float loadable_secondary;
loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
- if(weaponslot(weaponentity) == 0)
- actor.hagar_load = actor.(weaponentity).hagar_load;
if(loadable_secondary)
W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame
}
METHOD(Hagar, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
{
- actor.hagar_load = 0;
actor.(weaponentity).hagar_loadblock = false;
if(actor.(weaponentity).hagar_load)
{
}
METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
{
- actor.hagar_load = 0;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
}
METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
- if(weaponslot(weaponentity) == 0)
- actor.minelayer_mines = actor.(weaponentity).minelayer_mines;
-
if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
{
// not if we're holding the minelayer without enough ammo, but can detonate existing mines
}
METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor))
{
- actor.minelayer_mines = 0;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(WEP_CVAR(vortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(vortex, charge_limit))
actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
- if(weaponslot(weaponentity) == 0)
- actor.vortex_charge = actor.(weaponentity).vortex_charge;
-
if(WEP_CVAR_SEC(vortex, chargepool))
if(actor.(weaponentity).vortex_chargepool_ammo < 1)
{
actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
}
- if(weaponslot(weaponentity) == 0)
- actor.vortex_chargepool_ammo = actor.(weaponentity).vortex_chargepool_ammo;
-
if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
thiswep.wr_reload(thiswep, actor, weaponentity);
} else
METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor))
{
if (WEP_CVAR(vortex, charge)) {
- if (WEP_CVAR_SEC(vortex, chargepool)) {
- actor.vortex_chargepool_ammo = 1;
- }
- actor.vortex_charge = WEP_CVAR(vortex, charge_start);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
PROP(false, tuba_instrument, WEPENT_SET_NORMAL, \
{ WriteByte(chan, this.tuba_instrument); }, \
{ (viewmodels[this.m_wepent_slot]).tuba_instrument = ReadByte(); }) \
+ \
+ PROP(false, hagar_load, WEPENT_SET_NORMAL, \
+ { WriteByte(chan, this.hagar_load); }, \
+ { (viewmodels[this.m_wepent_slot]).hagar_load = ReadByte(); }) \
+ \
+ PROP(false, minelayer_mines, WEPENT_SET_NORMAL, \
+ { WriteByte(chan, this.minelayer_mines); }, \
+ { (viewmodels[this.m_wepent_slot]).minelayer_mines = ReadByte(); }) \
+ \
+ PROP(false, arc_heat_percent, WEPENT_SET_NORMAL, \
+ { WriteByte(chan, this.arc_heat_percent * 16); }, \
+ { (viewmodels[this.m_wepent_slot]).arc_heat_percent = ReadByte() / 16; }) \
+ \
+ PROP(false, vortex_chargepool_ammo, WEPENT_SET_NORMAL, \
+ { WriteByte(chan, this.vortex_chargepool_ammo * 16); }, \
+ { (viewmodels[this.m_wepent_slot]).vortex_chargepool_ammo = ReadByte() / 16; }) \
\
/**/
bool wepent_customize(entity this, entity client)
{
- //entity e = WaypointSprite_getviewentity(client);
+ entity e = WaypointSprite_getviewentity(client);
.entity weaponentity = this.owner.weaponentity_fld;
- return client.(weaponentity) == this.owner;
+ return e.(weaponentity) == this.owner;
}
void wepent_link(entity wep)
REGISTER_NET_TEMP(CLIENT_WEPENT)
.float vortex_charge;
+.float vortex_chargepool_ammo;
.int tuba_instrument;
+.int minelayer_mines;
+.float arc_heat_percent;
+.int hagar_load;
#ifdef SVQC
this.superweapons_finished = spectatee.superweapons_finished;
STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
this.weapons = spectatee.weapons;
- this.vortex_charge = spectatee.vortex_charge;
- this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
- this.hagar_load = spectatee.hagar_load;
- this.arc_heat_percent = spectatee.arc_heat_percent;
- this.minelayer_mines = spectatee.minelayer_mines;
this.punchangle = spectatee.punchangle;
this.view_ofs = spectatee.view_ofs;
this.velocity = spectatee.velocity;
setsize(this, spectatee.mins, spectatee.maxs);
SetZoomState(this, CS(spectatee).zoomstate);
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- this.(weaponentity) = spectatee.(weaponentity);
- }
-
anticheat_spectatecopy(this, spectatee);
this.hud = spectatee.hud;
if(spectatee.vehicle)
.float old_clip_load;
.float clip_size = _STAT(WEAPON_CLIPSIZE);
-.float minelayer_mines = _STAT(LAYED_MINES);
-.float vortex_charge = _STAT(VORTEX_CHARGE);
+.int minelayer_mines;
+.float vortex_charge;
.float vortex_charge_rottime;
-.float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
-.float hagar_load = _STAT(HAGAR_LOAD);
+.float vortex_chargepool_ammo;
+.int hagar_load;
.int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab