void ArcInit()
{
- weapon_action(WEP_ARC, WR_PRECACHE);
+ WEP_ACTION(WEP_ARC, WR_PRECACHE);
arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 1);
arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 2);
arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 3);
case WR_THINK:
{
if(autocvar_g_balance_laser_reload_ammo && self.clip_load < 1) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if(self.BUTTON_ATCK)
{
if(weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire))
case WR_THINK:
{
if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
if (self.BUTTON_ATCK)
{
case WR_THINK:
{
if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else
{
if (self.BUTTON_ATCK)
void ElectroInit()
{
- weapon_action(WEP_ELECTRO, WR_PRECACHE);
+ WEP_ACTION(WEP_ELECTRO, WR_PRECACHE);
electro_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 1);
electro_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 2);
electro_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 3);
if(!ammo_amount)
{
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
return FALSE;
}
}
// we aren't checking ammo during an attack, so we must do it here
- if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2))
+ if not(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2))
{
// note: this doesn't force the switch
W_SwitchToOtherWeapon(self);
if (loadable_secondary)
W_Hagar_Attack2_Load(); // must always run each frame
if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if (self.BUTTON_ATCK && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
{
if (weapon_prepareattack(0, autocvar_g_balance_hagar_primary_refire))
if (self.BUTTON_ATCK)
{
- if (!weapon_action(self.weapon, WR_CHECKAMMO1))
+ if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
W_SwitchWeapon_Force(self, w_getbestweapon(self));
case WR_THINK:
{
if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if (self.BUTTON_ATCK)
{
if (weapon_prepareattack(0, autocvar_g_balance_hlac_primary_refire))
}
if (self.BUTTON_ATCK)
{
- if (!weapon_action(self.weapon, WR_CHECKAMMO2))
+ if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
W_SwitchWeapon_Force(self, w_getbestweapon(self));
return;
}
- if (!weapon_action(self.weapon, WR_CHECKAMMO1))
+ if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
W_SwitchWeapon_Force(self, w_getbestweapon(self));
case WR_THINK:
{
if(autocvar_g_balance_uzi_reload_ammo && self.clip_load < min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if(autocvar_g_balance_uzi_mode == 1)
{
if (self.BUTTON_ATCK)
if(self.BUTTON_ATCK2)
if(weapon_prepareattack(1, 0))
{
- if (!weapon_action(self.weapon, WR_CHECKAMMO2))
+ if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
W_SwitchWeapon_Force(self, w_getbestweapon(self));
entity oldself;
oldself = self;
self = self.realowner;
- if (!weapon_action(WEP_MINE_LAYER, WR_CHECKAMMO1))
+ if (!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
{
self.cnt = WEP_MINE_LAYER;
ATTACK_FINISHED(self) = time;
entity oldself;
oldself = self;
self = self.realowner;
- if (!weapon_action(WEP_MINE_LAYER, WR_CHECKAMMO1))
+ if (!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
{
self.cnt = WEP_MINE_LAYER;
ATTACK_FINISHED(self) = time;
{
// not if we're holding the minelayer without enough ammo, but can detonate existing mines
if not (W_PlacedMines(FALSE) && self.ammo_rockets < autocvar_g_balance_minelayer_ammo)
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
}
else if (self.BUTTON_ATCK)
{
{
// if the laser uses load, we also consider its ammo for reloading
if(autocvar_g_balance_minstanex_reload_ammo && autocvar_g_balance_minstanex_laser_ammo && self.clip_load < min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if (self.BUTTON_ATCK)
{
if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
case WR_THINK:
{
if(autocvar_g_balance_mortar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if (self.BUTTON_ATCK)
{
if (weapon_prepareattack(0, WEP_CVAR_PRI(mortar, refire)))
}
if(autocvar_g_balance_nex_reload_ammo && self.clip_load < min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else
{
if (self.BUTTON_ATCK)
case WR_THINK:
{
if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(autocvar_g_balance_rifle_primary_ammo, autocvar_g_balance_rifle_secondary_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else
{
self.rifle_accumulator = bound(time - autocvar_g_balance_rifle_bursttime, self.rifle_accumulator, time);
if (autocvar_g_balance_rifle_secondary)
{
if(autocvar_g_balance_rifle_secondary_reload)
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else
{
if (weapon_prepareattack_check(1, autocvar_g_balance_rifle_secondary_refire))
case WR_THINK:
{
if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
else if (self.BUTTON_ATCK)
{
{
// don't force reload an empty shotgun if its melee attack is active
if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo)
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
}
else
{
// other useful macros
#define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
-#define weapon_action(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
-
// =====================
// Weapon Registration
if(!WEPSET_EMPTY_E(self))
{
- weapon_action(self.weapon, WR_AIM);
+ WEP_ACTION(self.weapon, WR_AIM);
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
{
self.BUTTON_ATCK = FALSE;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
// if we are out of ammo for all other weapons, it's an emergency to switch to anything else
- if (weapon_action(i, WR_CHECKAMMO1) + weapon_action(i, WR_CHECKAMMO2))
+ if (WEP_ACTION(i, WR_CHECKAMMO1) + WEP_ACTION(i, WR_CHECKAMMO2))
other_weapon_available = TRUE;
}
if(other_weapon_available)
// reset fields the weapons may use
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- weapon_action(j, WR_RESETPLAYER);
+ WEP_ACTION(j, WR_RESETPLAYER);
// all weapons must be fully loaded when we spawn
entity e;
frag_deathtype = deathtype;
MUTATOR_CALLHOOK(PlayerDies);
- weapon_action(self.weapon, WR_PLAYERDEATH);
+ WEP_ACTION(self.weapon, WR_PLAYERDEATH);
RemoveGrapplingHook(self);
// reset fields the weapons may use just in case
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- weapon_action(j, WR_RESETPLAYER);
+ WEP_ACTION(j, WR_RESETPLAYER);
ATTACK_FINISHED_FOR(self, j) = 0;
}
}
// WEAPONTODO
.float autoswitch;
-//float weapon_action(float wpn, float wrequest);
+//float WEP_ACTION(float wpn, float wrequest);
float client_hasweapon(entity cl, float wpn, float andammo, float complain);
void w_clear();
void w_ready();
if(death_weapon)
{
w_deathtype = deathtype;
- float death_message = weapon_action(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
+ float death_message = WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
w_deathtype = FALSE;
if(death_message)
}
else
{
- weapon_action(WEP_HOOK, WR_PRECACHE);
+ WEP_ACTION(WEP_HOOK, WR_PRECACHE);
hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 1);
hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 2);
hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 3);
{
e = get_weaponinfo(i);
if(WEPSET_CONTAINS_AW(start_weapons, i) || WEPSET_CONTAINS_AW(warmup_start_weapons, i))
- weapon_action(i, WR_PRECACHE);
+ WEP_ACTION(i, WR_PRECACHE);
}
start_ammo_shells = max(0, start_ammo_shells);
WEPSET_COPY_EE(self.weaponentity, self);
self.weaponentity.switchweapon = self.weapon;
WEPSET_COPY_EW(self, WEP_PORTO);
- weapon_action(WEP_PORTO, WR_RESETPLAYER);
+ WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
self.switchweapon = WEP_PORTO;
W_SwitchWeapon(WEP_PORTO);
self = ownr;
if(!WEPSET_EMPTY_E(self.weaponentity))
{
WEPSET_COPY_EE(self, self.weaponentity);
- weapon_action(WEP_PORTO, WR_RESETPLAYER);
+ WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
self.switchweapon = self.weaponentity.switchweapon;
W_SwitchWeapon(self.switchweapon);
nix_nextchange = time; // start the first round now!
else
nix_nextchange = time + autocvar_g_balance_nix_roundtime;
- //weapon_action(nix_weapon, WR_PRECACHE); // forget it, too slow
+ //WEP_ACTION(nix_weapon, WR_PRECACHE); // forget it, too slow
}
if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
else
Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
- weapon_action(nix_weapon, WR_RESETPLAYER);
+ WEP_ACTION(nix_weapon, WR_RESETPLAYER);
// all weapons must be fully loaded when we spawn
entity e;
float i;
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
if (NIX_CanChooseWeapon(i))
- weapon_action(i, WR_PRECACHE);
+ WEP_ACTION(i, WR_PRECACHE);
}
MUTATOR_HOOKFUNCTION(nix_ForbidThrowCurrentWeapon)
{
WEPSET_OR_EW(self, j);
if(self.spawnflags == 0 || self.spawnflags == 2)
- weapon_action(e.weapon, WR_PRECACHE);
+ WEP_ACTION(e.weapon, WR_PRECACHE);
break;
}
}
e = get_weaponinfo(j);
if(argv(i) == e.netname)
{
- weapon_action(e.weapon, WR_PRECACHE);
+ WEP_ACTION(e.weapon, WR_PRECACHE);
break;
}
}
POSTGIVE_WEAPON(e, j, "weapons/weaponpickup.wav", string_null);
if not(WEPSET_CONTAINS_AW(save_weapons, j))
if(WEPSET_CONTAINS_EW(e, j))
- weapon_action(wi.weapon, WR_PRECACHE);
+ WEP_ACTION(wi.weapon, WR_PRECACHE);
}
}
POSTGIVE_VALUE(e, strength_finished, 1, "misc/powerup.wav", "misc/poweroff.wav");
void W_TriggerReload()
{
- weapon_action(self.weapon, WR_RELOAD);
+ WEP_ACTION(self.weapon, WR_RELOAD);
}
// switch between weapons
// generic weapons table
// TODO should they be macros instead?
-//float weapon_action(float wpn, float wrequest)
+//float WEP_ACTION(float wpn, float wrequest)
//{
// return (get_weaponinfo(wpn)).weapon_func(wrequest);
//}
//setanim(self, self.anim_draw, FALSE, TRUE, TRUE);
self.weaponentity.state = WS_RAISE;
- weapon_action(self.switchweapon, WR_SETUP);
+ WEP_ACTION(self.switchweapon, WR_SETUP);
// set our clip load to the load of the weapon we switched to, if it's reloadable
if(newwep.spawnflags & WEP_FLAG_RELOADABLE && cvar(strcat("g_balance_", newwep.netname, "_reload_ammo"))) // prevent accessing undefined cvars
v_up = up;
if(w)
- weapon_action(self.weapon, WR_THINK);
+ WEP_ACTION(self.weapon, WR_THINK);
else
- weapon_action(self.weapon, WR_GONETHINK);
+ WEP_ACTION(self.weapon, WR_GONETHINK);
if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
{
StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
if (self.modelindex) // don't precache if self was removed
- weapon_action(e.weapon, WR_PRECACHE);
+ WEP_ACTION(e.weapon, WR_PRECACHE);
}
{
oldself = self;
self = cl;
- f = weapon_action(wpn, WR_CHECKAMMO1);
- f = f + weapon_action(wpn, WR_CHECKAMMO2);
+ f = WEP_ACTION(wpn, WR_CHECKAMMO1);
+ f = f + WEP_ACTION(wpn, WR_CHECKAMMO2);
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
entity mine;
float weapon_prepareattack_checkammo(float secondary)
{
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- if (!weapon_action(self.weapon, WR_CHECKAMMO1 + secondary))
+ if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary))
{
// always keep the Mine Layer if we placed mines, so that we can detonate them
entity mine;
self.prevdryfire = time;
}
- if(weapon_action(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo
+ if(WEP_ACTION(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo
{
if(time - self.prevwarntime > 1)
{
self.reload_complain = time + 1;
}
// switch away if the amount of ammo is not enough to keep using this weapon
- if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2))
+ if not(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2))
{
self.clip_load = -1; // reload later
W_SwitchToOtherWeapon(self);