From 89ebeb720e27015d795189b51745e1cd7ec5bdb0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 3 Jan 2011 18:50:56 +0100 Subject: [PATCH] Add velocity_len to reduce calls of vlen Remove maxspeed and use directly autocvar_g_maxspeed; --- qcsrc/server/sv_main.qc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index c73f0355f..aebea7523 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -2,7 +2,7 @@ void CreatureFrame (void) { local entity oldself; - local float dm, maxspeed; + local float dm; oldself = self; self = findfloat(world, iscreature, TRUE); while (self) @@ -67,9 +67,10 @@ void CreatureFrame (void) self.dmg = 2; } // check for falling damage + float velocity_len = vlen(self.velocity); if(!self.hook.state && !g_ca && !(g_cts && !autocvar_g_cts_selfdamage)) { - dm = vlen(self.oldvelocity) - vlen(self.velocity); // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. + dm = vlen(self.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (self.deadflag) dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor; else @@ -78,15 +79,14 @@ void CreatureFrame (void) Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); } - maxspeed = autocvar_g_maxspeed; - if(maxspeed > 0 && vlen(self.velocity) > maxspeed) + if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed) Damage (self, world, world, 100000, DEATH_SHOOTING_STAR, self.origin, '0 0 0'); // play stupid sounds if (g_footsteps) if (!gameover) if (self.flags & FL_ONGROUND) - if (vlen(self.velocity) > autocvar_sv_maxspeed * 0.6) + if (velocity_len > autocvar_sv_maxspeed * 0.6) if (!self.deadflag) if (time < self.lastground + 0.2) { -- 2.39.2