sv_doublejump: trace only 0.01 units down instead of 1, this fixes the
authorfruitiex <fruitiex@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Wed, 10 Feb 2010 16:38:49 +0000 (16:38 +0000)
committerfruitiex <fruitiex@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Wed, 10 Feb 2010 16:38:49 +0000 (16:38 +0000)
"doublejump off flat ground bug". If this causes problems with
inaccuracies we can just ramp it up a bit... so far I haven't spotted
any problems even on looves_insane :)

git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8628 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/server/cl_physics.qc

index 32fecc6..c8786ab 100644 (file)
@@ -29,9 +29,6 @@ float sv_warsowbunny_backtosideratio;
 .float wasFlying;
 .float spectatorspeed;
 
-.float doublejump_nextjumptime;
-.float wasinair;
-
 /*
 =============
 PlayerJump
@@ -66,10 +63,6 @@ void PlayerJump (void)
        if(self.health <= g_bloodloss)
                return;
 
-       if(sv_doublejump)
-               if(time < self.doublejump_nextjumptime || !self.wasinair)
-                       return;
-
        if(g_runematch)
        {
                if(self.runes & RUNE_SPEED)
@@ -123,21 +116,6 @@ void PlayerJump (void)
        if(g_jump_grunt)
                PlayerSound(playersound_jump, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);
 
-       if(sv_doublejump)
-       {
-               // we're moving upwards at self.velocity_z
-               // only allow jumping after we got 2 units upwards
-               // so we for sure leave the FL_ONGROUND check
-               //
-               // but as this sucks because of factoring in gravity, we'll just do it
-               // for 3 units, and constant velocity
-               if(self.velocity_z >= mjumpheight * 0.5) // only do this when we won't INTENTIONALLY jump a second time... TODO make a better check for this
-               {
-                       self.doublejump_nextjumptime = time + 3 / max(30, self.velocity_z); // max 0.1s blocking of jumps, typically just one frame
-                       //print(sprintf("blocking jumps for next %f seconds (vel: %f to %f)\n", self.doublejump_nextjumptime - time, self.velocity_z - mjumpheight, self.velocity_z));
-               }
-       }
-
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
 }
@@ -845,7 +823,7 @@ void SV_PlayerPhysics()
                if(sv_doublejump)
                {
                        self.flags &~= FL_ONGROUND;
-                       tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 1', MOVE_NORMAL, self);
+                       tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
                        if(trace_fraction < 1 && trace_plane_normal_z > 0.7)
                                self.flags |= FL_ONGROUND;
                }
@@ -855,9 +833,6 @@ void SV_PlayerPhysics()
                else
                        self.flags |= FL_JUMPRELEASED;
 
-               if (!self.wasinair)
-                       self.wasinair = !(self.flags & FL_ONGROUND);
-
                if (self.waterlevel == WATERLEVEL_SWIMMING)
                        CheckWaterJump ();
        }