[nexuiz-commits] r6694 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 9 11:34:29 EDT 2009


Author: div0
Date: 2009-05-09 11:34:28 -0400 (Sat, 09 May 2009)
New Revision: 6694

Modified:
   trunk/data/qcsrc/server/cl_physics.qc
Log:
make sv_doublejump safer by blocking jumping for up to 0.1s after jumping


Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc	2009-05-09 10:04:27 UTC (rev 6693)
+++ trunk/data/qcsrc/server/cl_physics.qc	2009-05-09 15:34:28 UTC (rev 6694)
@@ -30,6 +30,7 @@
 #define SHTEST_THRESHOLD 1.1
 .float shtest_next;
 .float shtest_accumulator;
+.float doublejump_nextjumptime;
 
 /*
 =============
@@ -55,7 +56,6 @@
 		return;
 	}
 
-
 	if (!(self.flags & FL_ONGROUND))
 		return;
 
@@ -65,6 +65,10 @@
 			
 	if(self.health <= g_bloodloss)
 		return;
+	
+	if(sv_doublejump)
+		if(time < self.doublejump_nextjumptime)
+			return;
 
 	if(g_runematch)
 	{
@@ -99,6 +103,17 @@
 
 	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 3 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 4 units, and constant velocity
+		self.doublejump_nextjumptime = time + 4 / max(40, self.velocity_z); // max 0.1s blocking of jumps
+	}
 }
 
 void CheckWaterJump()



More information about the nexuiz-commits mailing list