+#include "cl_impulse.qh"
#include "round_handler.qh"
#include "bot/waypoints.qh"
#include "weapons/tracing.qh"
#include "weapons/weaponsystem.qh"
+#include <common/state.qh>
+
#include "../common/minigames/sv_minigames.qh"
#include "../common/weapons/all.qh"
#define X(slot) \
IMPULSE(weapon_group_##slot) \
{ \
- if (this.deadflag != DEAD_NO) return; \
+ if (IS_DEAD(this)) \
+ { \
+ this.impulse = IMP_weapon_group_##slot.impulse; \
+ return; \
+ } \
W_NextWeaponOnImpulse(slot); \
}
X(1)
IMPULSE(weapon_priority_##slot##_##dir) \
{ \
if (this.vehicle) return; \
- if (this.deadflag != DEAD_NO) return; \
+ if (IS_DEAD(this)) \
+ { \
+ this.impulse = IMP_weapon_priority_##slot##_##dir.impulse; \
+ return; \
+ } \
noref int prev = -1; \
noref int best = 0; \
noref int next = +1; \
IMPULSE(weapon_byid_##i) \
{ \
if (this.vehicle) return; \
- if (this.deadflag != DEAD_NO) return; \
+ if (IS_DEAD(this)) \
+ { \
+ this.impulse = IMP_weapon_byid_##i.impulse; \
+ return; \
+ } \
W_SwitchWeapon(Weapons_from(WEP_FIRST + i)); \
}
X(0)
IMPULSE(weapon_next_byid)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_next_byid.impulse;
+ return;
+ }
W_NextWeapon(0);
}
IMPULSE(weapon_prev_byid)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_prev_byid.impulse;
+ return;
+ }
W_PreviousWeapon(0);
}
IMPULSE(weapon_next_bygroup)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_next_bygroup.impulse;
+ return;
+ }
W_NextWeapon(1);
}
IMPULSE(weapon_prev_bygroup)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_prev_bygroup.impulse;
+ return;
+ }
W_PreviousWeapon(1);
}
IMPULSE(weapon_next_bypriority)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_next_bypriority.impulse;
+ return;
+ }
W_NextWeapon(2);
}
IMPULSE(weapon_prev_bypriority)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this))
+ {
+ this.impulse = IMP_weapon_prev_bypriority.impulse;
+ return;
+ }
W_PreviousWeapon(2);
}
IMPULSE(weapon_last)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this)) return;
W_LastWeapon(this);
}
IMPULSE(weapon_best)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this)) return;
W_SwitchWeapon(w_getbestweapon(this));
}
IMPULSE(weapon_drop)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this)) return;
W_ThrowWeapon(W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
}
IMPULSE(weapon_reload)
{
if (this.vehicle) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this)) return;
if (forbidWeaponUse(this)) return;
Weapon w = PS(this).m_weapon;
entity actor = this;
IMPULSE(waypoint_here_follow)
{
if (!teamplay) return;
- if (this.deadflag != DEAD_NO) return;
+ if (IS_DEAD(this)) return;
if (!MUTATOR_CALLHOOK(HelpMePing, this))
{
entity wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);