]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_impulse.qc
Remove .move_* fields and MOVETYPE_PUSH logic (doesn't work)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_impulse.qc
index c29c10f26bf5ac8f5f8390352011c6125cc472e2..517ee3796100c028220a10e0842d64d9f675e7ce 100644 (file)
@@ -1,3 +1,4 @@
+#include "cl_impulse.qh"
 #include "round_handler.qh"
 
 #include "bot/waypoints.qh"
@@ -10,6 +11,8 @@
 #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; \
-               W_NextWeaponOnImpulse(slot); \
+               if (IS_DEAD(this)) \
+               { \
+                       this.impulse = IMP_weapon_group_##slot.impulse; \
+                       return; \
+               } \
+               W_NextWeaponOnImpulse(this, slot); \
        }
 X(1)
 X(2)
@@ -74,11 +81,15 @@ X(0)
        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; \
-               W_CycleWeapon(this.cvar_cl_weaponpriorities[slot], dir); \
+               W_CycleWeapon(this, this.cvar_cl_weaponpriorities[slot], dir); \
        }
 X(0, prev)
 X(1, prev)
@@ -120,8 +131,12 @@ X(9, next)
        IMPULSE(weapon_byid_##i) \
        { \
                if (this.vehicle) return; \
-               if (this.deadflag != DEAD_NO) return; \
-               W_SwitchWeapon(Weapons_from(WEP_FIRST + i)); \
+               if (IS_DEAD(this)) \
+               { \
+                       this.impulse = IMP_weapon_byid_##i.impulse; \
+                       return; \
+               } \
+               W_SwitchWeapon(this, Weapons_from(WEP_FIRST + i)); \
        }
 X(0)
 X(1)
@@ -152,70 +167,94 @@ X(23)
 IMPULSE(weapon_next_byid)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_NextWeapon(0);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_next_byid.impulse;
+               return;
+       }
+       W_NextWeapon(this, 0);
 }
 
 IMPULSE(weapon_prev_byid)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_PreviousWeapon(0);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_prev_byid.impulse;
+               return;
+       }
+       W_PreviousWeapon(this, 0);
 }
 
 IMPULSE(weapon_next_bygroup)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_NextWeapon(1);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_next_bygroup.impulse;
+               return;
+       }
+       W_NextWeapon(this, 1);
 }
 
 IMPULSE(weapon_prev_bygroup)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_PreviousWeapon(1);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_prev_bygroup.impulse;
+               return;
+       }
+       W_PreviousWeapon(this, 1);
 }
 
 IMPULSE(weapon_next_bypriority)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_NextWeapon(2);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_next_bypriority.impulse;
+               return;
+       }
+       W_NextWeapon(this, 2);
 }
 
 IMPULSE(weapon_prev_bypriority)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_PreviousWeapon(2);
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_prev_bypriority.impulse;
+               return;
+       }
+       W_PreviousWeapon(this, 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;
-       W_SwitchWeapon(w_getbestweapon(this));
+       if (IS_DEAD(this)) return;
+       W_SwitchWeapon(this, w_getbestweapon(this));
 }
 
 IMPULSE(weapon_drop)
 {
        if (this.vehicle) return;
-       if (this.deadflag != DEAD_NO) return;
-       W_ThrowWeapon(W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
+       if (IS_DEAD(this)) return;
+       W_ThrowWeapon(this, W_CalculateProjectileVelocity(this, 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;
@@ -322,7 +361,7 @@ void ImpulseCommands(entity this)
 
        if (vehicle_impulse(this, imp)) return;
 
-       if (CheatImpulse(imp)) return;
+       if (CheatImpulse(this, imp)) return;
 
        FOREACH(IMPULSES, it.impulse == imp, {
                void(entity) f = it.impulse_handle;
@@ -334,12 +373,12 @@ void ImpulseCommands(entity this)
 
 IMPULSE(use)
 {
-       PlayerUseKey();
+       PlayerUseKey(this);
 }
 
 IMPULSE(waypoint_personal_here)
 {
-       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.origin, RADARICON_WAYPOINT);
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this, this.origin, RADARICON_WAYPOINT);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "personal waypoint spawned at location\n");
 }
@@ -347,7 +386,7 @@ IMPULSE(waypoint_personal_here)
 IMPULSE(waypoint_personal_crosshair)
 {
        WarpZone_crosshair_trace(this);
-       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this, trace_endpos, RADARICON_WAYPOINT);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "personal waypoint spawned at crosshair\n");
 }
@@ -355,7 +394,7 @@ IMPULSE(waypoint_personal_crosshair)
 IMPULSE(waypoint_personal_death)
 {
        if (!this.death_origin) return;
-       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.death_origin, RADARICON_WAYPOINT);
+       entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this, this.death_origin, RADARICON_WAYPOINT);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "personal waypoint spawned at death location\n");
 }
@@ -363,10 +402,10 @@ IMPULSE(waypoint_personal_death)
 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);
+               entity wp = WaypointSprite_Attach(WP_Helpme, this, true, RADARICON_HELPME);
                if (!wp) WaypointSprite_HelpMePing(this.waypointsprite_attachedforcarrier);
                else WaypointSprite_Ping(wp);
        }
@@ -375,7 +414,7 @@ IMPULSE(waypoint_here_follow)
 
 IMPULSE(waypoint_here_here)
 {
-       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.origin, RADARICON_HERE);
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this, this.origin, RADARICON_HERE);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "HERE spawned at location\n");
 }
@@ -383,7 +422,7 @@ IMPULSE(waypoint_here_here)
 IMPULSE(waypoint_here_crosshair)
 {
        WarpZone_crosshair_trace(this);
-       entity wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this, trace_endpos, RADARICON_HERE);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "HERE spawned at crosshair\n");
 }
@@ -391,14 +430,14 @@ IMPULSE(waypoint_here_crosshair)
 IMPULSE(waypoint_here_death)
 {
        if (!this.death_origin) return;
-       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.death_origin, RADARICON_HERE);
+       entity wp = WaypointSprite_DeployFixed(WP_Here, false, this, this.death_origin, RADARICON_HERE);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "HERE spawned at death location\n");
 }
 
 IMPULSE(waypoint_danger_here)
 {
-       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.origin, RADARICON_DANGER);
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this, this.origin, RADARICON_DANGER);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "DANGER spawned at location\n");
 }
@@ -406,7 +445,7 @@ IMPULSE(waypoint_danger_here)
 IMPULSE(waypoint_danger_crosshair)
 {
        WarpZone_crosshair_trace(this);
-       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this, trace_endpos, RADARICON_DANGER);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "DANGER spawned at crosshair\n");
 }
@@ -414,14 +453,14 @@ IMPULSE(waypoint_danger_crosshair)
 IMPULSE(waypoint_danger_death)
 {
        if (!this.death_origin) return;
-       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.death_origin, RADARICON_DANGER);
+       entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this, this.death_origin, RADARICON_DANGER);
        if (wp) WaypointSprite_Ping(wp);
        sprint(this, "DANGER spawned at death location\n");
 }
 
 IMPULSE(waypoint_clear_personal)
 {
-       WaypointSprite_ClearPersonal();
+       WaypointSprite_ClearPersonal(this);
        if (this.personal)
        {
                remove(this.personal);
@@ -432,7 +471,7 @@ IMPULSE(waypoint_clear_personal)
 
 IMPULSE(waypoint_clear)
 {
-       WaypointSprite_ClearOwned();
+       WaypointSprite_ClearOwned(this);
        if (this.personal)
        {
                remove(this.personal);
@@ -479,7 +518,7 @@ IMPULSE(navwaypoint_unreachable)
                e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
        }
        entity e2 = navigation_findnearestwaypoint(this, false);
-       navigation_markroutes(e2);
+       navigation_markroutes(this, e2);
 
        int i, m;
 
@@ -515,7 +554,7 @@ IMPULSE(navwaypoint_unreachable)
        for (entity e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
        {
                vector org = e.origin;
-               tracebox(e.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), e.origin - '0 0 512', MOVE_NOMONSTERS, world);
+               tracebox(e.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), e.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
                setorigin(e, trace_endpos);
                if (navigation_findnearestwaypoint(e, false))
                {