]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix c/s consistency of sv_gameplayfix_nogravityonground and sv_gameplayfix_gravityuna...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Jan 2012 15:12:09 +0000 (15:12 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Jan 2012 15:12:09 +0000 (15:12 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11643 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
sv_phys.c

index 51a5f8dd701630509a2c7f4f2e95edbc9b2a8b99..bda394187e524b44c8be3caeffb586edc6b1d1dc 100644 (file)
@@ -972,8 +972,12 @@ static void CL_ClientMovement_Move(cl_clientmovement_state_t *s)
                if (trace.fraction == 1)
                        break;
 
-               //if (trace.plane.normal[2] > 0.7)
-               //      s->onground = true;
+               // this is only really needed for nogravityonground combined with gravityunaffectedbyticrate
+               // <LordHavoc> I'm pretty sure I commented it out solely because it seemed redundant
+               // this got commented out in a change that supposedly makes the code match QW better
+               // so if this is broken, maybe put it in an if(cls.protocol != PROTOCOL_QUAKEWORLD) block
+               if (trace.plane.normal[2] > 0.7)
+                       s->onground = true;
 
                t -= t * trace.fraction;
 
@@ -1366,20 +1370,23 @@ static void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
                        accelspeed = min(cl.movevars_accelerate * s->cmd.frametime * wishspeed, addspeed);
                        VectorMA(s->velocity, accelspeed, wishdir, s->velocity);
                }
-               if(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND)
-                       gravity = 0;
-               else
-                       gravity = cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
-               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
-                       s->velocity[2] -= gravity * 0.5f;
-               else
-                       s->velocity[2] -= gravity;
+               gravity = cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
+               if(!(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND))
+               {
+                       if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                               s->velocity[2] -= gravity * 0.5f;
+                       else
+                               s->velocity[2] -= gravity;
+               }
                if (cls.protocol == PROTOCOL_QUAKEWORLD)
                        s->velocity[2] = 0;
                if (VectorLength2(s->velocity))
                        CL_ClientMovement_Move(s);
-               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
-                       s->velocity[2] -= gravity * 0.5f;
+               if(!(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND) || !s->onground)
+               {
+                       if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                               s->velocity[2] -= gravity * 0.5f;
+               }
        }
        else
        {
@@ -1435,8 +1442,11 @@ static void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
                else
                        s->velocity[2] -= gravity;
                CL_ClientMovement_Move(s);
-               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
-                       s->velocity[2] -= gravity * 0.5f;
+               if(!(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND) || !s->onground)
+               {
+                       if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                               s->velocity[2] -= gravity * 0.5f;
+               }
        }
 }
 
index c88ff4c452193c721fa782bb2844169c824ff836..e063526fbcbe26968947ec2c517c6dc634f28221 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1235,23 +1235,19 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
                return 0;
        gravity = 0;
 
-       if(sv_gameplayfix_nogravityonground.integer)
-               if((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND)
-                       applygravity = false;
-
-       if (applygravity)
+       if(applygravity)
        {
-               if (sv_gameplayfix_gravityunaffectedbyticrate.integer)
-               {
-                       gravity = SV_Gravity(ent) * 0.5f;
-                       PRVM_serveredictvector(ent, velocity)[2] -= gravity;
-               }
-               else
+               gravity = SV_Gravity(ent);
+
+               if(!sv_gameplayfix_nogravityonground.integer || !((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND))
                {
-                       applygravity = false;
-                       PRVM_serveredictvector(ent, velocity)[2] -= SV_Gravity(ent);
+                       if (sv_gameplayfix_gravityunaffectedbyticrate.integer)
+                               PRVM_serveredictvector(ent, velocity)[2] -= gravity * 0.5f;
+                       else
+                               PRVM_serveredictvector(ent, velocity)[2] -= gravity;
                }
        }
+
        blocked = 0;
        VectorCopy(PRVM_serveredictvector(ent, velocity), original_velocity);
        VectorCopy(PRVM_serveredictvector(ent, velocity), primal_velocity);
@@ -1437,8 +1433,16 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
        // LordHavoc: this came from QW and allows you to get out of water more easily
        if (sv_gameplayfix_easierwaterjump.integer && ((int)PRVM_serveredictfloat(ent, flags) & FL_WATERJUMP) && !(blocked & 8))
                VectorCopy(primal_velocity, PRVM_serveredictvector(ent, velocity));
-       if (applygravity && !((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND))
-               PRVM_serveredictvector(ent, velocity)[2] -= gravity;
+
+       if(applygravity)
+       {
+               if(!sv_gameplayfix_nogravityonground.integer || !((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND))
+               {
+                       if (sv_gameplayfix_gravityunaffectedbyticrate.integer)
+                               PRVM_serveredictvector(ent, velocity)[2] -= gravity * 0.5f;
+               }
+       }
+
        return blocked;
 }