]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mirceakitsune/multijump
authorFruitieX <rasse@rasse-lappy.localdomain>
Mon, 9 Aug 2010 11:27:26 +0000 (14:27 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Mon, 9 Aug 2010 11:27:26 +0000 (14:27 +0300)
Conflicts:
qcsrc/server/cl_physics.qc

defaultXonotic.cfg
qcsrc/server/cl_physics.qc

index 3b585d723760ee39c2901578aae1f2e3f5b093b5..5944d7e71299b1479c58a83886e8a07e849371db 100644 (file)
@@ -846,6 +846,11 @@ set g_footsteps 1  "serverside footstep sounds"
 
 set g_deathglow 1.25 "when enabled, players stop glowing after they die (the value specifies glow fading speed)"
 
+set g_multijump 1      "Number of multiple jumps to allow (jumping again in the air), -1 allows for infinite jumps"
+set g_multijump_add 0  "0 = make the current z velocity equal to jumpvelocity, 1 = add jumpvelocity to the current z velocity"
+set g_multijump_delay 0                "Delay between multiple jumps"
+set g_multijump_speed -999999  "Minimum vertical speed a player must have in order to jump again"
+
 // effects
 r_picmipsprites 0 // Xonotic uses sprites that should never be picmipped (team mate, typing, waypoints)
 r_picmipworld 1
index 70e702505cd2d5d9c482d968552b8f377619e4b9..83b2abd4f708afca64ecdf29a76604680312a671 100644 (file)
@@ -33,6 +33,10 @@ float sv_airspeedlimit_nonqw;
 .float wasFlying;
 .float spectatorspeed;
 
+.float multijump_count;
+.float multijump_delay;
+.float multijump_ready;
+
 /*
 =============
 PlayerJump
@@ -66,9 +70,33 @@ void PlayerJump (void)
                return;
        }
 
-       if (!doublejump)
-       if (!(self.flags & FL_ONGROUND))
-               return;
+       if (cvar("g_multijump"))
+       {
+               if ((self.flags & FL_JUMPRELEASED) && !(self.flags & FL_ONGROUND))
+                       self.multijump_ready = TRUE;  // this is necessary to check that we released the jump button and pressed it again
+               else if (self.flags & FL_ONGROUND)
+               {
+                       if (cvar("g_multijump") > 0)
+                               self.multijump_count = 0;
+                       else
+                               self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
+                       self.multijump_ready = FALSE;
+               }
+       }
+
+       if(self.multijump_ready && time > self.multijump_delay && self.multijump_count < cvar("g_multijump") && self.velocity_z > cvar("g_multijump_speed"))
+       {
+               if (cvar("g_multijump") > 0)
+               {
+                       if (cvar("g_multijump_add") == 0) // in this case we make the z velocity == jumpvelocity
+                               self.velocity_z = 0;
+                       self.multijump_count += 1;
+               }
+               self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
+       }
+       else if (!doublejump)
+               if (!(self.flags & FL_ONGROUND))
+                       return;
 
        if(!sv_pogostick)
                if (!(self.flags & FL_JUMPRELEASED))
@@ -147,6 +175,9 @@ void PlayerJump (void)
        self.flags &~= FL_ONGROUND;
        self.flags &~= FL_JUMPRELEASED;
 
+       if (cvar("g_multijump"))
+               self.multijump_delay = time + cvar("g_multijump_delay");
+
        if (self.crouch)
                setanim(self, self.anim_duckjump, FALSE, TRUE, TRUE);
        else