]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_impulse.qc
Merge branch 'TimePath/waypointsprites' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_impulse.qc
index 350fcf6f4e89301a850e1540326b3d67231b8074..45174f2c6008e2c8f914088b8bd9b83090f4c0a5 100644 (file)
@@ -1,12 +1,19 @@
+#include "_all.qh"
 #include "round_handler.qh"
 
 #include "bot/waypoints.qh"
 
 #include "weapons/throwing.qh"
+#include "command/common.qh"
+#include "cheats.qh"
+#include "bot/navigation.qh"
+#include "weapons/selection.qh"
+#include "weapons/tracing.qh"
+#include "weapons/weaponsystem.qh"
 
 #include "../common/minigames/sv_minigames.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 /*
  * Impulse map:
@@ -68,11 +75,15 @@ void ImpulseCommands (void)
        if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
                return;
 
-    if(self.vehicle)
-        if(self.vehicle.deadflag == DEAD_NO)
-            if(self.vehicle.vehicles_impulse)
-                if(self.vehicle.vehicles_impulse(imp))
-                    return;
+       if(self.vehicle)
+       if(self.vehicle.deadflag == DEAD_NO)
+       {
+               if(self.vehicle.vehicles_impulse)
+               if(self.vehicle.vehicles_impulse(imp))
+                       return;
+               if(vehicle_impulse(imp))
+                       return;
+       }
 
        if(CheatImpulse(imp))
        {
@@ -87,6 +98,7 @@ void ImpulseCommands (void)
        }
        else if(imp >= 10 && imp <= 20)
        {
+               if(!self.vehicle)
                if(self.deadflag == DEAD_NO)
                {
                        switch(imp)
@@ -122,7 +134,7 @@ void ImpulseCommands (void)
                                        W_PreviousWeapon(1);
                                        break;
                                case 20:
-                                       if(!forbidWeaponUse()) { WEP_ACTION(self.weapon, WR_RELOAD); }
+                                       if(!forbidWeaponUse(self)) { WEP_ACTION(self.weapon, WR_RELOAD); }
                                        break;
                        }
                }
@@ -135,10 +147,11 @@ void ImpulseCommands (void)
        }
        else if(imp >= 200 && imp <= 229)
        {
+               if(!self.vehicle)
                if(self.deadflag == DEAD_NO)
                {
                        // custom order weapon cycling
-                       i = imp % 10;
+                       int i = imp % 10;
                        m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
                        W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
                }
@@ -147,6 +160,7 @@ void ImpulseCommands (void)
        }
        else if(imp >= 230 && imp <= 253)
        {
+               if(!self.vehicle)
                if(self.deadflag == DEAD_NO)
                        W_SwitchWeapon (imp - 230 + WEP_FIRST);
                else
@@ -159,14 +173,14 @@ void ImpulseCommands (void)
                switch(imp)
                {
                        case 30:
-                               wp = WaypointSprite_DeployPersonal("waypoint", self.origin, RADARICON_WAYPOINT, '0 1 1');
+                               wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.origin, RADARICON_WAYPOINT);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "personal waypoint spawned at location\n");
                                break;
                        case 31:
                                WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos, RADARICON_WAYPOINT, '0 1 1');
+                               wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "personal waypoint spawned at crosshair\n");
@@ -174,7 +188,7 @@ void ImpulseCommands (void)
                        case 32:
                                if(vlen(self.death_origin))
                                {
-                                       wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin, RADARICON_WAYPOINT, '0 1 1');
+                                       wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.death_origin, RADARICON_WAYPOINT);
                                        if(wp)
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "personal waypoint spawned at death location\n");
@@ -183,9 +197,9 @@ void ImpulseCommands (void)
                        case 33:
                                if(self.deadflag == DEAD_NO && teamplay)
                                {
-                                       if (!MUTATOR_CALLHOOK(HelpMePing))
+                                       if (!MUTATOR_CALLHOOK(HelpMePing, self))
                                        {
-                                               wp = WaypointSprite_Attach("helpme", true, RADARICON_HELPME, '1 0.5 0');
+                                               wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);
                                                if(!wp)
                                                        WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
                                                else
@@ -195,14 +209,14 @@ void ImpulseCommands (void)
                                }
                                break;
                        case 34:
-                               wp = WaypointSprite_DeployFixed("here", false, self.origin, RADARICON_HERE, '0 1 0');
+                               wp = WaypointSprite_DeployFixed(WP_Here, false, self.origin, RADARICON_HERE);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "HERE spawned at location\n");
                                break;
                        case 35:
                                WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed("here", false, trace_endpos, RADARICON_HERE, '0 1 0');
+                               wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "HERE spawned at crosshair\n");
@@ -210,21 +224,21 @@ void ImpulseCommands (void)
                        case 36:
                                if(vlen(self.death_origin))
                                {
-                                       wp = WaypointSprite_DeployFixed("here", false, self.death_origin, RADARICON_HERE, '0 1 0');
+                                       wp = WaypointSprite_DeployFixed(WP_Here, false, self.death_origin, RADARICON_HERE);
                                        if(wp)
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "HERE spawned at death location\n");
                                }
                                break;
                        case 37:
-                               wp = WaypointSprite_DeployFixed("danger", false, self.origin, RADARICON_DANGER, '1 0.5 0');
+                               wp = WaypointSprite_DeployFixed(WP_Danger, false, self.origin, RADARICON_DANGER);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "DANGER spawned at location\n");
                                break;
                        case 38:
                                WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed("danger", false, trace_endpos, RADARICON_DANGER, '1 0.5 0');
+                               wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "DANGER spawned at crosshair\n");
@@ -232,7 +246,7 @@ void ImpulseCommands (void)
                        case 39:
                                if(vlen(self.death_origin))
                                {
-                                       wp = WaypointSprite_DeployFixed("danger", false, self.death_origin, RADARICON_DANGER, '1 0.5 0');
+                                       wp = WaypointSprite_DeployFixed(WP_Danger, false, self.death_origin, RADARICON_DANGER);
                                        if(wp)
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "DANGER spawned at death location\n");