]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_impulse.qc
Client: Type check
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_impulse.qc
index 917a95f178ef8ed23bbb653f427c287ce01db4d3..bfd24892ef26655daf0e856e37e3fb454f227944 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 (IS_DEAD(this)) return; \
+               if (IS_DEAD(this)) \
+               { \
+                       this.impulse = IMP_weapon_group_##slot.impulse; \
+                       return; \
+               } \
                W_NextWeaponOnImpulse(slot); \
        }
 X(1)
@@ -74,7 +81,11 @@ X(0)
        IMPULSE(weapon_priority_##slot##_##dir) \
        { \
                if (this.vehicle) return; \
-               if (IS_DEAD(this)) 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; \
@@ -120,7 +131,11 @@ X(9, next)
        IMPULSE(weapon_byid_##i) \
        { \
                if (this.vehicle) return; \
-               if (IS_DEAD(this)) return; \
+               if (IS_DEAD(this)) \
+               { \
+                       this.impulse = IMP_weapon_byid_##i.impulse; \
+                       return; \
+               } \
                W_SwitchWeapon(Weapons_from(WEP_FIRST + i)); \
        }
 X(0)
@@ -152,42 +167,66 @@ X(23)
 IMPULSE(weapon_next_byid)
 {
        if (this.vehicle) return;
-       if (IS_DEAD(this)) 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 (IS_DEAD(this)) 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 (IS_DEAD(this)) 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 (IS_DEAD(this)) 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 (IS_DEAD(this)) 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 (IS_DEAD(this)) return;
+       if (IS_DEAD(this))
+       {
+               this.impulse = IMP_weapon_prev_bypriority.impulse;
+               return;
+       }
        W_PreviousWeapon(2);
 }