r2284 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Apr 3 17:29:51 EDT 2007


Author: div0
Date: 2007-04-03 17:29:51 -0400 (Tue, 03 Apr 2007)
New Revision: 2284

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_physics.qc
Log:
moved jump to SV_PlayerPhysics (please test) - needed for current engine


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2007-04-02 16:04:37 UTC (rev 2283)
+++ trunk/data/qcsrc/server/cl_client.qc	2007-04-03 21:29:51 UTC (rev 2284)
@@ -945,94 +945,6 @@
 	else self.colormod = '1 1 1';
 };*/
 
-/*
-=============
-PlayerJump
-
-When you press the jump key
-=============
-*/
-void PlayerJump (void)
-{
-	float mjumpheight;
-
-	mjumpheight = cvar("g_balance_jumpheight");
-	if (self.waterlevel >= 2)
-	{
-		if (self.watertype == CONTENT_WATER)
-			self.velocity_z = 200;
-		else if (self.watertype == CONTENT_SLIME)
-			self.velocity_z = 80;
-		else
-			self.velocity_z = 50;
-
-		return;
-	}
-
-
-	if (!(self.flags & FL_ONGROUND))
-		return;
-
-	if (!(self.flags & FL_JUMPRELEASED))
-		return;
-
-	if(cvar("g_runematch"))
-	{
-		if(self.runes & RUNE_SPEED)
-		{
-			if(self.runes & CURSE_SLOW)
-				mjumpheight = mjumpheight * cvar("g_balance_rune_speed_combo_jumpheight");
-			else
-				mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight");
-		}
-		else if(self.runes & CURSE_SLOW)
-		{
-			mjumpheight = mjumpheight * cvar("g_balance_curse_slow_jumpheight");
-		}
-	}
-
-	if(cvar("g_minstagib") && (self.items & IT_INVINCIBLE))
-	{
-		mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight");
-	}
-
-	self.velocity_z = self.velocity_z + mjumpheight;
-	self.oldvelocity_z = self.velocity_z;
-
-	self.flags = self.flags - FL_ONGROUND;
-	self.flags = self.flags - FL_JUMPRELEASED;
-}
-
-void() CheckWaterJump =
-{
-	local vector start, end;
-
-// check for a jump-out-of-water
-	makevectors (self.angles);
-	start = self.origin;
-	start_z = start_z + 8;
-	v_forward_z = 0;
-	normalize(v_forward);
-	end = start + v_forward*24;
-	traceline (start, end, TRUE, self);
-	if (trace_fraction < 1)
-	{	// solid at waist
-		start_z = start_z + self.maxs_z - 8;
-		end = start + v_forward*24;
-		self.movedir = trace_plane_normal * -50;
-		traceline (start, end, TRUE, self);
-		if (trace_fraction == 1)
-		{	// open at eye level
-			self.flags = self.flags | FL_WATERJUMP;
-			self.velocity_z = 225;
-			self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
-			self.teleport_time = time + 2;	// safety net
-			return;
-		}
-	}
-};
-
-
 void respawn(void)
 {
 	CopyBody(1);
@@ -1537,12 +1449,6 @@
 		else if (self.viewzoom < 1.0)
 			self.viewzoom = min (1.0, self.viewzoom + frametime);
 
-
-		if (self.button2)
-			PlayerJump ();
-		else
-			self.flags = self.flags | FL_JUMPRELEASED;
-
 		player_powerups();
 		player_regen();
 		player_anim();

Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc	2007-04-02 16:04:37 UTC (rev 2283)
+++ trunk/data/qcsrc/server/cl_physics.qc	2007-04-03 21:29:51 UTC (rev 2284)
@@ -14,6 +14,94 @@
 .float lastflags;
 .float lastground;
 
+/*
+=============
+PlayerJump
+
+When you press the jump key
+=============
+*/
+void PlayerJump (void)
+{
+	float mjumpheight;
+
+	mjumpheight = cvar("g_balance_jumpheight");
+	if (self.waterlevel >= 2)
+	{
+		if (self.watertype == CONTENT_WATER)
+			self.velocity_z = 200;
+		else if (self.watertype == CONTENT_SLIME)
+			self.velocity_z = 80;
+		else
+			self.velocity_z = 50;
+
+		return;
+	}
+
+
+	if (!(self.flags & FL_ONGROUND))
+		return;
+
+	if (!(self.flags & FL_JUMPRELEASED))
+		return;
+
+	if(cvar("g_runematch"))
+	{
+		if(self.runes & RUNE_SPEED)
+		{
+			if(self.runes & CURSE_SLOW)
+				mjumpheight = mjumpheight * cvar("g_balance_rune_speed_combo_jumpheight");
+			else
+				mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight");
+		}
+		else if(self.runes & CURSE_SLOW)
+		{
+			mjumpheight = mjumpheight * cvar("g_balance_curse_slow_jumpheight");
+		}
+	}
+
+	if(cvar("g_minstagib") && (self.items & IT_INVINCIBLE))
+	{
+		mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight");
+	}
+
+	self.velocity_z = self.velocity_z + mjumpheight;
+	self.oldvelocity_z = self.velocity_z;
+
+	self.flags = self.flags - FL_ONGROUND;
+	self.flags = self.flags - FL_JUMPRELEASED;
+}
+
+void() CheckWaterJump =
+{
+	local vector start, end;
+
+// check for a jump-out-of-water
+	makevectors (self.angles);
+	start = self.origin;
+	start_z = start_z + 8;
+	v_forward_z = 0;
+	normalize(v_forward);
+	end = start + v_forward*24;
+	traceline (start, end, TRUE, self);
+	if (trace_fraction < 1)
+	{	// solid at waist
+		start_z = start_z + self.maxs_z - 8;
+		end = start + v_forward*24;
+		self.movedir = trace_plane_normal * -50;
+		traceline (start, end, TRUE, self);
+		if (trace_fraction == 1)
+		{	// open at eye level
+			self.flags = self.flags | FL_WATERJUMP;
+			self.velocity_z = 225;
+			self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+			self.teleport_time = time + 2;	// safety net
+			return;
+		}
+	}
+};
+
+
 void Nixnex_GiveCurrentWeapon();
 void SV_PlayerPhysics()
 {
@@ -103,6 +191,14 @@
 		self.angles_z = 0;
 	}
 
+	if(self.classname == "player")
+	{
+		if (self.button2)
+			PlayerJump ();
+		else
+			self.flags = self.flags | FL_JUMPRELEASED;
+	}
+
 	if (self.flags & FL_WATERJUMP )
 	{
 		self.velocity_x = self.movedir_x;




More information about the nexuiz-commits mailing list