]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bring back an old hack to fix spectator speed
authorMario <zacjardine@y7mail.com>
Fri, 24 Apr 2015 10:18:06 +0000 (20:18 +1000)
committerMario <zacjardine@y7mail.com>
Fri, 24 Apr 2015 10:18:06 +0000 (20:18 +1000)
qcsrc/common/physics.qc

index 442a9939b8e75f98d54dea33c854175016bc473b..8740fc9c5c4d7dff372c43301d0212979bf163ec 100644 (file)
@@ -1635,11 +1635,6 @@ bool IsFlying(entity a)
        return true;
 }
 
-#ifdef CSQC
-float autocvar_cl_forwardspeed;
-float autocvar_cl_sidespeed;
-#endif
-
 void PM_Main()
 {
        float buttons = PHYS_INPUT_BUTTON_MASK(self);
@@ -1651,12 +1646,6 @@ void PM_Main()
        self.v_angle = PHYS_INPUT_ANGLES(self);
        self.angles = PHYS_WORLD_ANGLES(self);
 
-       if(PHYS_MAXSPEED(self) != autocvar_cl_forwardspeed || PHYS_MAXSPEED(self) != autocvar_cl_sidespeed)
-       {
-               cvar_set("cl_forwardspeed", ftos(PHYS_MAXSPEED(self)));
-               cvar_set("cl_sidespeed", ftos(PHYS_MAXSPEED(self)));
-       }
-
        self.team = myteam + 1; // is this correct?
        if (!(PHYS_INPUT_BUTTON_JUMP(self))) // !jump
                UNSET_JUMP_HELD(self); // canjump = true
@@ -1823,6 +1812,17 @@ void PM_Main()
                }
                maxspeed_mod = self.spectatorspeed;
        }
+
+       float spd = max(PHYS_MAXSPEED(self), PHYS_MAXAIRSPEED) * maxspeed_mod;
+       if(self.speed != spd)
+       {
+               self.speed = spd;
+               string temps = ftos(spd);
+               stuffcmd(self, strcat("cl_forwardspeed ", temps, "\n"));
+               stuffcmd(self, strcat("cl_backspeed ", temps, "\n"));
+               stuffcmd(self, strcat("cl_sidespeed ", temps, "\n"));
+               stuffcmd(self, strcat("cl_upspeed ", temps, "\n"));
+       }
 #endif
 
        if(PHYS_DEAD(self))