W_PreviousWeapon (1);
break;
case 20:
- W_Reload ();
+ W_WepReload ();
break;
}
}
-void W_Reload()
+void W_WepReload()
{
self.wish_reload = 1;
}
}
else
{
- W_Reload();
+ W_WepReload();
}
};
float ammo_amount;
-float W_SniperRifle_CheckMaxBullets(float checkammo)
+float W_CheckMaxBullets(float checkammo)
{
float maxbulls;
maxbulls = autocvar_g_balance_sniperrifle_magazinecapacity;
if(checkammo)
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
maxbulls = min(maxbulls, floor(ammo_amount / min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)));
- if(self.sniperrifle_bulletcounter > maxbulls || !autocvar_g_balance_sniperrifle_magazinecapacity)
- self.sniperrifle_bulletcounter = maxbulls;
- return (self.sniperrifle_bulletcounter == maxbulls);
+ if(self.ammo_counter > maxbulls || !autocvar_g_balance_sniperrifle_magazinecapacity)
+ self.ammo_counter = maxbulls;
+ return (self.ammo_counter == maxbulls);
}
-void W_SniperRifle_ReloadedAndReady()
+void W_ReloadedAndReady()
{
float t;
- self.sniperrifle_bulletcounter = autocvar_g_balance_sniperrifle_magazinecapacity;
- W_SniperRifle_CheckMaxBullets(TRUE);
+ self.ammo_counter = autocvar_g_balance_sniperrifle_magazinecapacity;
+ W_CheckMaxBullets(TRUE);
t = ATTACK_FINISHED(self) - autocvar_g_balance_sniperrifle_reloadtime - 1;
ATTACK_FINISHED(self) = t;
w_ready();
}
-float W_SniperRifle_Reload(float ammo_value)
+float W_Reload(float ammo_value)
{
float t;
- W_SniperRifle_CheckMaxBullets(TRUE);
+ W_CheckMaxBullets(TRUE);
ammo_amount = ammo_value; // save ammo to a global float
if(ammo_amount < min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)) // when we get here, bulletcounter must be 0 or -1
{
print("cannot reload... not enough bullets\n");
- self.sniperrifle_bulletcounter = -1; // reload later
+ self.ammo_counter = -1; // reload later
W_SwitchToOtherWeapon(self);
return 0;
}
- if (self.sniperrifle_bulletcounter >= autocvar_g_balance_sniperrifle_magazinecapacity)
+ if (self.ammo_counter >= autocvar_g_balance_sniperrifle_magazinecapacity)
return 0;
if (self.weaponentity)
t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_sniperrifle_reloadtime + 1;
ATTACK_FINISHED(self) = t;
- weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_sniperrifle_reloadtime, W_SniperRifle_ReloadedAndReady);
+ weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_sniperrifle_reloadtime, W_ReloadedAndReady);
- self.sniperrifle_bulletcounter = -1;
+ self.ammo_counter = -1;
return 1;
}
float client_cefc_accumulatortime;
#endif
-.float sniperrifle_bulletcounter;
+.float ammo_counter;
.float wish_reload;
#define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
addstat(STAT_FUEL, AS_INT, ammo_fuel);
addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);
- addstat(STAT_BULLETS_LOADED, AS_INT, sniperrifle_bulletcounter);
+ addstat(STAT_BULLETS_LOADED, AS_INT, ammo_counter);
addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
void W_Shotgun_DoReload()
{
w_ready();
- if(W_SniperRifle_Reload(self.ammo_shells))
+ if(W_Reload(self.ammo_shells))
return;
}
float bulletconstant;
local entity flash;
- if(self.sniperrifle_bulletcounter <= 0)
+ if(self.ammo_counter <= 0)
W_Shotgun_DoReload();
- if(self.sniperrifle_bulletcounter < 0)
+ if(self.ammo_counter < 0)
return; // reloading, so we are done
ammoamount = autocvar_g_balance_shotgun_primary_ammo;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
W_AttachToShotorg(flash, '5 0 0');
- self.sniperrifle_bulletcounter = self.sniperrifle_bulletcounter - 1;
+ self.ammo_counter = self.ammo_counter - 1;
}
void shotgun_meleethink (void)
self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
else if (req == WR_THINK)
{
- if(self.sniperrifle_bulletcounter < 0) // forced reload (e.g. because interrupted)
+ if(self.ammo_counter < 0) // forced reload (e.g. because interrupted)
self.wish_reload = 1;
else
{
if(self.weaponentity.state == WS_READY)
{
self.wish_reload = 0;
- W_SniperRifle_Reload(self.ammo_shells);
+ W_Reload(self.ammo_shells);
}
}
}
void W_SniperRifle_DoReload()
{
w_ready();
- if(W_SniperRifle_Reload(self.ammo_nails))
+ if(W_Reload(self.ammo_nails))
return;
}
if (autocvar_g_casings >= 2)
SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
- self.sniperrifle_bulletcounter = self.sniperrifle_bulletcounter - 1;
+ self.ammo_counter = self.ammo_counter - 1;
}
void W_SniperRifle_Attack()
void W_SniperRifle_BulletHail_Continue()
{
float r, sw, af;
- if(self.sniperrifle_bulletcounter <= 0)
+ if(self.ammo_counter <= 0)
W_SniperRifle_DoReload();
- if(self.sniperrifle_bulletcounter < 0)
+ if(self.ammo_counter < 0)
return; // reloading, so we are done
sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing
af = ATTACK_FINISHED(self);
}
else if (req == WR_THINK)
{
- if(self.sniperrifle_bulletcounter < 0) // forced reload (e.g. because interrupted)
+ if(self.ammo_counter < 0) // forced reload (e.g. because interrupted)
{
self.wish_reload = 1;
}
if(self.weaponentity.state == WS_READY)
{
self.wish_reload = 0;
- W_SniperRifle_Reload(self.ammo_nails);
+ W_Reload(self.ammo_nails);
}
}
}
{
weapon_setup(WEP_SNIPERRIFLE);
- full = W_SniperRifle_CheckMaxBullets(TRUE);
+ full = W_CheckMaxBullets(TRUE);
if(autocvar_g_balance_sniperrifle_auto_reload_on_switch)
if(!full)
- self.sniperrifle_bulletcounter = -1;
+ self.ammo_counter = -1;
}
else if (req == WR_CHECKAMMO1)
return self.ammo_nails >= autocvar_g_balance_sniperrifle_primary_ammo;
else if (req == WR_RESETPLAYER)
{
self.sniperrifle_accumulator = time - autocvar_g_balance_sniperrifle_bursttime;
- self.sniperrifle_bulletcounter = autocvar_g_balance_sniperrifle_magazinecapacity;
- W_SniperRifle_CheckMaxBullets(FALSE);
+ self.ammo_counter = autocvar_g_balance_sniperrifle_magazinecapacity;
+ W_CheckMaxBullets(FALSE);
}
return TRUE;
};