.entity queuenext;
.entity queueprev;
-// weapon load persistence, for weapons that support reloading
-.float crylink_load;
-
void W_Crylink_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.crylink_load;
+ self.clip_load = self.weapon_load[WEP_CRYLINK];
self.clip_size = autocvar_g_balance_crylink_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_crylink_reload_ammo)
{
self.clip_load -= autocvar_g_balance_crylink_primary_ammo;
- self.crylink_load = self.clip_load;
+ self.weapon_load[WEP_CRYLINK] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_crylink_primary_ammo;
if(autocvar_g_balance_crylink_reload_ammo)
{
self.clip_load -= autocvar_g_balance_crylink_secondary_ammo;
- self.crylink_load = self.clip_load;
+ self.weapon_load[WEP_CRYLINK] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_crylink_secondary_ammo;
return TRUE;
ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo;
- ammo_amount += self.crylink_load >= autocvar_g_balance_crylink_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_CRYLINK] >= autocvar_g_balance_crylink_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
return TRUE;
ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo;
- ammo_amount += self.crylink_load >= autocvar_g_balance_crylink_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_CRYLINK] >= autocvar_g_balance_crylink_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.crylink_load = autocvar_g_balance_crylink_reload_ammo;
+ self.weapon_load[WEP_CRYLINK] = autocvar_g_balance_crylink_reload_ammo;
}
else if (req == WR_RELOAD)
{
.float electro_count;
.float electro_secondarytime;
-// weapon load persistence, for weapons that support reloading
-.float electro_load;
-
void W_Electro_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.electro_load;
+ self.clip_load = self.weapon_load[WEP_ELECTRO];
self.clip_size = autocvar_g_balance_electro_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_electro_reload_ammo)
{
self.clip_load -= autocvar_g_balance_electro_primary_ammo;
- self.electro_load = self.clip_load;
+ self.weapon_load[WEP_ELECTRO] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_electro_primary_ammo;
if(autocvar_g_balance_electro_reload_ammo)
{
self.clip_load -= autocvar_g_balance_electro_secondary_ammo;
- self.electro_load = self.clip_load;
+ self.weapon_load[WEP_ELECTRO] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_electro_secondary_ammo;
void lgbeam_think()
{
- self.owner.prevlgfire = time;
- if (self != self.owner.lgbeam)
+ entity owner_player;
+ owner_player = self.owner;
+
+ owner_player.prevlgfire = time;
+ if (self != owner_player.lgbeam)
{
remove(self);
return;
}
- if (self.owner.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK || self.owner.freezetag_frozen)
+ if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.freezetag_frozen)
{
- if(self == self.owner.lgbeam)
- self.owner.lgbeam = world;
+ if(self == owner_player.lgbeam)
+ owner_player.lgbeam = world;
remove(self);
return;
}
self.nextthink = time;
- makevectors(self.owner.v_angle);
+ makevectors(owner_player.v_angle);
float dt, f;
dt = frametime;
+
// if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if not(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)
+ if not(owner_player.items & IT_UNLIMITED_WEAPON_AMMO)
{
if(autocvar_g_balance_electro_primary_ammo)
{
if(autocvar_g_balance_electro_reload_ammo)
{
- dt = min(dt, self.owner.clip_load / autocvar_g_balance_electro_primary_ammo);
- self.owner.clip_load = max(0, self.owner.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
- self.owner.electro_load = self.owner.clip_load;
+ dt = min(dt, owner_player.clip_load / autocvar_g_balance_electro_primary_ammo);
+ owner_player.clip_load = max(0, owner_player.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
+ owner_player.weapon_load[WEP_ELECTRO] = owner_player.clip_load;
}
else
{
- dt = min(dt, self.owner.ammo_cells / autocvar_g_balance_electro_primary_ammo);
- self.owner.ammo_cells = max(0, self.owner.ammo_cells - autocvar_g_balance_electro_primary_ammo * frametime);
+ dt = min(dt, owner_player.ammo_cells / autocvar_g_balance_electro_primary_ammo);
+ owner_player.ammo_cells = max(0, owner_player.ammo_cells - autocvar_g_balance_electro_primary_ammo * frametime);
}
}
}
- W_SetupShot_Range(self.owner, TRUE, 0, "", 0, autocvar_g_balance_electro_primary_damage * dt, autocvar_g_balance_electro_primary_range);
- WarpZone_traceline_antilag(self.owner, w_shotorg, w_shotend, MOVE_NORMAL, self.owner, ANTILAG_LATENCY(self.owner));
+ W_SetupShot_Range(owner_player, TRUE, 0, "", 0, autocvar_g_balance_electro_primary_damage * dt, autocvar_g_balance_electro_primary_range);
+ WarpZone_traceline_antilag(owner_player, w_shotorg, w_shotend, MOVE_NORMAL, owner_player, ANTILAG_LATENCY(owner_player));
// apply the damage
if(trace_ent)
f = ExponentialFalloff(autocvar_g_balance_electro_primary_falloff_mindist, autocvar_g_balance_electro_primary_falloff_maxdist, autocvar_g_balance_electro_primary_falloff_halflifedist, vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - w_shotorg));
- if(accuracy_isgooddamage(self.owner, trace_ent))
- accuracy_add(self.owner, WEP_ELECTRO, 0, autocvar_g_balance_electro_primary_damage * dt * f);
- Damage (trace_ent, self.owner, self.owner, autocvar_g_balance_electro_primary_damage * dt * f, WEP_ELECTRO, trace_endpos, force * dt);
+ if(accuracy_isgooddamage(owner_player, trace_ent))
+ accuracy_add(owner_player, WEP_ELECTRO, 0, autocvar_g_balance_electro_primary_damage * dt * f);
+ Damage (trace_ent, owner_player, owner_player, autocvar_g_balance_electro_primary_damage * dt * f, WEP_ELECTRO, trace_endpos, force * dt);
}
- W_Plasma_TriggerCombo(trace_endpos, autocvar_g_balance_electro_primary_comboradius, self.owner);
+ W_Plasma_TriggerCombo(trace_endpos, autocvar_g_balance_electro_primary_comboradius, owner_player);
// draw effect
if(w_shotorg != self.hook_start)
{
ammo_amount = !autocvar_g_balance_electro_primary_ammo || (self.ammo_cells > 0);
if(autocvar_g_balance_electro_lightning)
- ammo_amount += self.electro_load > 0;
+ ammo_amount += self.weapon_load[WEP_ELECTRO] > 0;
}
else
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
if(autocvar_g_balance_electro_lightning)
- ammo_amount += self.electro_load >= autocvar_g_balance_electro_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_primary_ammo;
}
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
- ammo_amount += self.electro_load >= autocvar_g_balance_electro_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
self.electro_secondarytime = time;
// all weapons must be fully loaded when we spawn
- self.electro_load = autocvar_g_balance_electro_reload_ammo;
+ self.weapon_load[WEP_ELECTRO] = autocvar_g_balance_electro_reload_ammo;
}
else if (req == WR_RELOAD)
{
.vector fireball_impactvec;
.float fireball_primarytime;
-// weapon load persistence, for weapons that support reloading
-.float fireball_load;
-
void W_Fireball_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.fireball_load;
+ self.clip_load = self.weapon_load[WEP_FIREBALL];
self.clip_size = autocvar_g_balance_fireball_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_fireball_reload_ammo)
{
self.clip_load -= autocvar_g_balance_fireball_primary_ammo;
- self.fireball_load = self.clip_load;
+ self.weapon_load[WEP_FIREBALL] = self.clip_load;
}
else
self.ammo_fuel -= autocvar_g_balance_fireball_primary_ammo;
if(autocvar_g_balance_fireball_reload_ammo)
{
self.clip_load -= autocvar_g_balance_fireball_secondary_ammo;
- self.fireball_load = self.clip_load;
+ self.weapon_load[WEP_FIREBALL] = self.clip_load;
}
else
self.ammo_fuel -= autocvar_g_balance_fireball_secondary_ammo;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_fuel >= autocvar_g_balance_fireball_primary_ammo;
- ammo_amount += self.fireball_load >= autocvar_g_balance_fireball_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_FIREBALL] >= autocvar_g_balance_fireball_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_fuel >= autocvar_g_balance_fireball_secondary_ammo;
- ammo_amount += self.fireball_load >= autocvar_g_balance_fireball_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_FIREBALL] >= autocvar_g_balance_fireball_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
self.fireball_primarytime = time;
// all weapons must be fully loaded when we spawn
- self.fireball_load = autocvar_g_balance_fireball_reload_ammo;
+ self.weapon_load[WEP_FIREBALL] = autocvar_g_balance_fireball_reload_ammo;
}
else if (req == WR_RELOAD)
{
.float gl_detonate_later;
.float gl_bouncecnt;
-// weapon load persistence, for weapons that support reloading
-.float grenadelauncher_load;
-
void W_GrenadeLauncher_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.grenadelauncher_load;
+ self.clip_load = self.weapon_load[WEP_GRENADE_LAUNCHER];
self.clip_size = autocvar_g_balance_grenadelauncher_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_grenadelauncher_reload_ammo)
{
self.clip_load -= autocvar_g_balance_grenadelauncher_primary_ammo;
- self.grenadelauncher_load = self.clip_load;
+ self.weapon_load[WEP_GRENADE_LAUNCHER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_grenadelauncher_primary_ammo;
if(autocvar_g_balance_grenadelauncher_reload_ammo)
{
self.clip_load -= autocvar_g_balance_grenadelauncher_secondary_ammo;
- self.grenadelauncher_load = self.clip_load;
+ self.weapon_load[WEP_GRENADE_LAUNCHER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_grenadelauncher_secondary_ammo;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_primary_ammo;
- ammo_amount += self.grenadelauncher_load >= autocvar_g_balance_grenadelauncher_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_GRENADE_LAUNCHER] >= autocvar_g_balance_grenadelauncher_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_rockets >= autocvar_g_balance_grenadelauncher_secondary_ammo;
- ammo_amount += self.grenadelauncher_load >= autocvar_g_balance_grenadelauncher_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_GRENADE_LAUNCHER] >= autocvar_g_balance_grenadelauncher_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.grenadelauncher_load = autocvar_g_balance_grenadelauncher_reload_ammo;
+ self.weapon_load[WEP_GRENADE_LAUNCHER] = autocvar_g_balance_grenadelauncher_reload_ammo;
}
else if (req == WR_RELOAD)
{
#else
#ifdef SVQC
-// weapon load persistence, for weapons that support reloading
-.float hlac_load;
-
void W_HLAC_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.hlac_load;
+ self.clip_load = self.weapon_load[WEP_HLAC];
self.clip_size = autocvar_g_balance_hlac_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_hlac_reload_ammo)
{
self.clip_load -= autocvar_g_balance_hlac_primary_ammo;
- self.hlac_load = self.clip_load;
+ self.weapon_load[WEP_HLAC] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_hlac_primary_ammo;
if(autocvar_g_balance_hlac_reload_ammo)
{
self.clip_load -= autocvar_g_balance_hlac_secondary_ammo;
- self.hlac_load = self.clip_load;
+ self.weapon_load[WEP_HLAC] = self.clip_load;
}
else
self.ammo_cells -= autocvar_g_balance_hlac_secondary_ammo;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_primary_ammo;
- ammo_amount += self.hlac_load >= autocvar_g_balance_hlac_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_hlac_secondary_ammo;
- ammo_amount += self.hlac_load >= autocvar_g_balance_hlac_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_HLAC] >= autocvar_g_balance_hlac_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.hlac_load = autocvar_g_balance_hlac_reload_ammo;
+ self.weapon_load[WEP_HLAC] = autocvar_g_balance_hlac_reload_ammo;
}
else if (req == WR_RELOAD)
{
.float minelayer_detonate, minelayer_mines;
.float mine_time;
-// weapon load persistence, for weapons that support reloading
-.float minelayer_load;
-
void W_MineLayer_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.minelayer_load;
+ self.clip_load = self.weapon_load[WEP_MINE_LAYER];
self.clip_size = autocvar_g_balance_minelayer_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_minelayer_reload_ammo)
{
self.clip_load -= autocvar_g_balance_minelayer_ammo;
- self.minelayer_load = self.clip_load;
+ self.weapon_load[WEP_MINE_LAYER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_minelayer_ammo;
{
if(autocvar_g_balance_minelayer_reload_ammo)
{
- if(self.ammo_rockets < autocvar_g_balance_minelayer_ammo && self.minelayer_load < autocvar_g_balance_minelayer_ammo)
+ if(self.ammo_rockets < autocvar_g_balance_minelayer_ammo && self.weapon_load[WEP_MINE_LAYER] < autocvar_g_balance_minelayer_ammo)
ammo_amount = TRUE;
}
else if(self.ammo_rockets < autocvar_g_balance_minelayer_ammo)
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.minelayer_load = autocvar_g_balance_minelayer_reload_ammo;
+ self.weapon_load[WEP_MINE_LAYER] = autocvar_g_balance_minelayer_reload_ammo;
}
else if (req == WR_RELOAD)
{
#ifdef SVQC
.float minstanex_lasthit;
-// weapon load persistence, for weapons that support reloading
-.float minstanex_load;
-
void W_Minstanex_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.minstanex_load;
+ self.clip_load = self.weapon_load[WEP_MINSTANEX];
self.clip_size = autocvar_g_balance_minstanex_reload_ammo; // for the crosshair ammo display
}
}
self.clip_load -= - 1;
else
self.clip_load -= autocvar_g_balance_minstanex_ammo;
- self.minstanex_load = self.clip_load;
+ self.weapon_load[WEP_MINSTANEX] = self.clip_load;
}
else
{
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_ammo;
- ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_ammo;
+ ammo_amount += self.weapon_load[WEP_MINSTANEX] >= autocvar_g_balance_minstanex_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
if(!autocvar_g_balance_minstanex_laser_ammo)
return TRUE;
ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
- ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_laser_ammo;
+ ammo_amount += self.weapon_load[WEP_MINSTANEX] >= autocvar_g_balance_minstanex_laser_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
self.minstanex_lasthit = 0;
// all weapons must be fully loaded when we spawn
- self.minstanex_load = autocvar_g_balance_minstanex_reload_ammo;
+ self.weapon_load[WEP_MINSTANEX] = autocvar_g_balance_minstanex_reload_ammo;
}
else if (req == WR_RELOAD)
{
#else
#ifdef SVQC
-// weapon load persistence, for weapons that support reloading
-.float nex_load;
-
void W_Nex_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.nex_load;
+ self.clip_load = self.weapon_load[WEP_NEX];
self.clip_size = autocvar_g_balance_nex_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_nex_reload_ammo)
{
self.clip_load -= myammo;
- self.nex_load = self.clip_load;
+ self.weapon_load[WEP_NEX] = self.clip_load;
}
else
self.ammo_cells -= myammo;
{
self.clip_load = max(autocvar_g_balance_nex_secondary_ammo, self.clip_load - autocvar_g_balance_nex_secondary_ammo * dt);
}
- self.nex_load = self.clip_load;
+ self.weapon_load[WEP_NEX] = self.clip_load;
}
else
{
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_primary_ammo;
- ammo_amount += (autocvar_g_balance_nex_reload_ammo && self.nex_load >= autocvar_g_balance_nex_primary_ammo);
+ ammo_amount += (autocvar_g_balance_nex_reload_ammo && self.weapon_load[WEP_NEX] >= autocvar_g_balance_nex_primary_ammo);
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
// don't allow charging if we don't have enough ammo
ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo;
- ammo_amount += self.nex_load >= autocvar_g_balance_nex_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_NEX] >= autocvar_g_balance_nex_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.nex_load = autocvar_g_balance_nex_reload_ammo;
+ self.weapon_load[WEP_NEX] = autocvar_g_balance_nex_reload_ammo;
}
else if (req == WR_RELOAD)
{
.float rl_release;
.float rl_detonate_later;
-// weapon load persistence, for weapons that support reloading
-.float rocketlauncher_load;
-
void W_RocketLauncher_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.rocketlauncher_load;
+ self.clip_load = self.weapon_load[WEP_ROCKET_LAUNCHER];
self.clip_size = autocvar_g_balance_rocketlauncher_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_rocketlauncher_reload_ammo)
{
self.clip_load -= autocvar_g_balance_rocketlauncher_ammo;
- self.rocketlauncher_load = self.clip_load;
+ self.weapon_load[WEP_ROCKET_LAUNCHER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_rocketlauncher_ammo;
{
if(autocvar_g_balance_rocketlauncher_reload_ammo)
{
- if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo && self.rocketlauncher_load < autocvar_g_balance_rocketlauncher_ammo)
+ if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo && self.weapon_load[WEP_ROCKET_LAUNCHER] < autocvar_g_balance_rocketlauncher_ammo)
ammo_amount = TRUE;
}
else if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo)
self.rl_release = 0;
// all weapons must be fully loaded when we spawn
- self.rocketlauncher_load = autocvar_g_balance_rocketlauncher_reload_ammo;
+ self.weapon_load[WEP_ROCKET_LAUNCHER] = autocvar_g_balance_rocketlauncher_reload_ammo;
}
else if (req == WR_RELOAD)
{
//.float proxytime; = autoswitch
//.float tl; = wait
-// weapon load persistence, for weapons that support reloading
-.float seeker_load;
-
void W_Seeker_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.seeker_load;
+ self.clip_load = self.weapon_load[WEP_SEEKER];
self.clip_size = autocvar_g_balance_seeker_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_seeker_reload_ammo)
{
self.clip_load -= autocvar_g_balance_seeker_missile_ammo;
- self.seeker_load = self.clip_load;
+ self.weapon_load[WEP_SEEKER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_seeker_missile_ammo;
if(autocvar_g_balance_seeker_reload_ammo)
{
self.clip_load -= autocvar_g_balance_seeker_tag_ammo;
- self.seeker_load = self.clip_load;
+ self.weapon_load[WEP_SEEKER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_seeker_tag_ammo;
if(autocvar_g_balance_seeker_reload_ammo)
{
self.clip_load -= autocvar_g_balance_seeker_flac_ammo;
- self.seeker_load = self.clip_load;
+ self.weapon_load[WEP_SEEKER] = self.clip_load;
}
else
self.ammo_rockets -= autocvar_g_balance_seeker_flac_ammo;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_seeker_missile_ammo;
- ammo_amount += self.seeker_load >= autocvar_g_balance_seeker_missile_ammo;
+ ammo_amount += self.weapon_load[WEP_SEEKER] >= autocvar_g_balance_seeker_missile_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_seeker_flac_ammo;
- ammo_amount += self.seeker_load >= autocvar_g_balance_seeker_flac_ammo;
+ ammo_amount += self.weapon_load[WEP_SEEKER] >= autocvar_g_balance_seeker_flac_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.seeker_load = autocvar_g_balance_seeker_reload_ammo;
+ self.weapon_load[WEP_SEEKER] = autocvar_g_balance_seeker_reload_ammo;
}
else if (req == WR_RELOAD)
{
#else
#ifdef SVQC
-// weapon load persistence, for weapons that support reloading
-.float shotgun_load;
-
void W_Shotgun_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.shotgun_load;
+ self.clip_load = self.weapon_load[WEP_SHOTGUN];
self.clip_size = autocvar_g_balance_shotgun_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_shotgun_reload_ammo)
{
self.clip_load -= ammoamount;
- self.shotgun_load = self.clip_load;
+ self.weapon_load[WEP_SHOTGUN] = self.clip_load;
}
else
self.ammo_shells -= ammoamount;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo;
- ammo_amount += self.shotgun_load >= autocvar_g_balance_shotgun_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_SHOTGUN] >= autocvar_g_balance_shotgun_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.shotgun_load = autocvar_g_balance_shotgun_reload_ammo;
+ self.weapon_load[WEP_SHOTGUN] = autocvar_g_balance_shotgun_reload_ammo;
}
else if (req == WR_RELOAD)
{
.float sniperrifle_accumulator;
-// weapon load persistence, for weapons that support reloading
-.float sniperrifle_load;
-
void W_SniperRifle_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.sniperrifle_load;
+ self.clip_load = self.weapon_load[WEP_SNIPERRIFLE];
self.clip_size = autocvar_g_balance_sniperrifle_reload_ammo; // for the crosshair ammo display
}
}
if(autocvar_g_balance_sniperrifle_reload_ammo)
{
self.clip_load -= pAmmo;
- self.sniperrifle_load = self.clip_load;
+ self.weapon_load[WEP_SNIPERRIFLE] = self.clip_load;
}
else
self.ammo_nails -= pAmmo;
else if (req == WR_CHECKAMMO1)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_sniperrifle_primary_ammo;
- ammo_amount += self.sniperrifle_load >= autocvar_g_balance_sniperrifle_primary_ammo;
+ ammo_amount += self.weapon_load[WEP_SNIPERRIFLE] >= autocvar_g_balance_sniperrifle_primary_ammo;
return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
{
ammo_amount = self.ammo_cells >= autocvar_g_balance_sniperrifle_secondary_ammo;
- ammo_amount += self.sniperrifle_load >= autocvar_g_balance_sniperrifle_secondary_ammo;
+ ammo_amount += self.weapon_load[WEP_SNIPERRIFLE] >= autocvar_g_balance_sniperrifle_secondary_ammo;
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
self.sniperrifle_accumulator = time - autocvar_g_balance_sniperrifle_bursttime;
// all weapons must be fully loaded when we spawn
- self.sniperrifle_load = autocvar_g_balance_sniperrifle_reload_ammo;
+ self.weapon_load[WEP_SNIPERRIFLE] = autocvar_g_balance_sniperrifle_reload_ammo;
}
else if (req == WR_RELOAD)
{
#else
#ifdef SVQC
-// weapon load persistence, for weapons that support reloading
-.float uzi_load;
-
void W_UZI_SetAmmoCounter()
{
// set clip_load to the weapon we have switched to, if the gun uses reloading
self.clip_load = 0; // also keeps crosshair ammo from displaying
else
{
- self.clip_load = self.uzi_load;
+ self.clip_load = self.weapon_load[WEP_UZI];
self.clip_size = autocvar_g_balance_uzi_reload_ammo; // for the crosshair ammo display
}
}
self.clip_load -= autocvar_g_balance_uzi_first_ammo;
else
self.clip_load -= autocvar_g_balance_uzi_sustained_ammo;
- self.uzi_load = self.clip_load;
+ self.weapon_load[WEP_UZI] = self.clip_load;
}
else
{
if(autocvar_g_balance_uzi_reload_ammo)
{
self.clip_load -= autocvar_g_balance_uzi_sustained_ammo;
- self.uzi_load = self.clip_load;
+ self.weapon_load[WEP_UZI] = self.clip_load;
}
else
self.ammo_nails -= autocvar_g_balance_uzi_sustained_ammo;
if(autocvar_g_balance_uzi_reload_ammo)
{
self.clip_load -= autocvar_g_balance_uzi_burst_ammo;
- self.uzi_load = self.clip_load;
+ self.weapon_load[WEP_UZI] = self.clip_load;
}
else
self.ammo_nails -= autocvar_g_balance_uzi_burst_ammo;
if(autocvar_g_balance_uzi_reload_ammo)
{
if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount += self.uzi_load >= autocvar_g_balance_uzi_sustained_ammo;
+ ammo_amount += self.weapon_load[WEP_UZI] >= autocvar_g_balance_uzi_sustained_ammo;
else
- ammo_amount += self.uzi_load >= autocvar_g_balance_uzi_first_ammo;
+ ammo_amount += self.weapon_load[WEP_UZI] >= autocvar_g_balance_uzi_first_ammo;
}
return ammo_amount;
}
if(autocvar_g_balance_uzi_reload_ammo)
{
if(autocvar_g_balance_uzi_mode == 1)
- ammo_amount += self.uzi_load >= autocvar_g_balance_uzi_burst_ammo;
+ ammo_amount += self.weapon_load[WEP_UZI] >= autocvar_g_balance_uzi_burst_ammo;
else
- ammo_amount += self.uzi_load >= autocvar_g_balance_uzi_first_ammo;
+ ammo_amount += self.weapon_load[WEP_UZI] >= autocvar_g_balance_uzi_first_ammo;
}
return ammo_amount;
}
else if (req == WR_RESETPLAYER)
{
// all weapons must be fully loaded when we spawn
- self.uzi_load = autocvar_g_balance_uzi_reload_ammo;
+ self.weapon_load[WEP_UZI] = autocvar_g_balance_uzi_reload_ammo;
}
else if (req == WR_RELOAD)
{