From ee732892c6e3ca467914c77944199f479321190f Mon Sep 17 00:00:00 2001
From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Wed, 6 May 2009 06:54:24 +0000
Subject: [PATCH] cl_movement: move crouch handling so that sv_maxairspeed*0.5
 is maximum crouching speed, not sv_maxspeed*0.5 (matches Nexuiz)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8947 d7cf8633-e32d-0410-b094-e92efae38249
---
 cl_input.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/cl_input.c b/cl_input.c
index a9da42cc..cea4cab2 100644
--- a/cl_input.c
+++ b/cl_input.c
@@ -1028,13 +1028,13 @@ void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
 		VectorScale(wishvel, 1 / wishspeed, wishdir);
 	else
 		VectorSet( wishdir, 0.0, 0.0, 0.0 );
-	wishspeed = min(wishspeed, cl.movevars_maxspeed);
-	if (s->crouched)
-		wishspeed *= 0.5;
-
 	// check if onground
 	if (s->onground)
 	{
+		wishspeed = min(wishspeed, cl.movevars_maxspeed);
+		if (s->crouched)
+			wishspeed *= 0.5;
+
 		// apply edge friction
 		f = sqrt(s->velocity[0] * s->velocity[0] + s->velocity[1] * s->velocity[1]);
 		if (f > 0)
@@ -1085,6 +1085,9 @@ void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
 
 			// apply air speed limit
 			wishspeed = min(wishspeed, cl.movevars_maxairspeed);
+			if (s->crouched)
+				wishspeed *= 0.5;
+
 			accel = cl.movevars_airaccelerate;
 			
 			// CPM: air control
-- 
2.39.5