]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
Change key handling, er, quite a bit.
[xonotic/darkplaces.git] / sv_phys.c
index 6cfa187eb309eb91b1466ee978484eec52750ff7..37b1ae5ffaafbb877b2fe352b07855f3aed1cfc3 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -966,6 +966,8 @@ void SV_WalkMove (edict_t *ent)
        vec3_t upmove, downmove, oldorg, oldvel, nosteporg, nostepvel, stepnormal;
        trace_t downtrace;
 
+       SV_CheckVelocity(ent);
+
        // do a regular slide move unless it looks like you ran into a step
        oldonground = (int)ent->v->flags & FL_ONGROUND;
        ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
@@ -975,6 +977,8 @@ void SV_WalkMove (edict_t *ent)
 
        clip = SV_FlyMove (ent, sv.frametime, NULL);
 
+       SV_CheckVelocity(ent);
+
        // if move didn't block on a step, return
        if ( !(clip & 2) )
                return;
@@ -990,10 +994,9 @@ void SV_WalkMove (edict_t *ent)
                        return;
        }
 
-       if (sv_nostep.integer)
-               return;
+       SV_CheckVelocity(ent);
 
-       if ( (int)ent->v->flags & FL_WATERJUMP )
+       if (sv_nostep.integer || (int)ent->v->flags & FL_WATERJUMP )
                return;
 
        VectorCopy (ent->v->origin, nosteporg);
@@ -1052,6 +1055,8 @@ void SV_WalkMove (edict_t *ent)
                VectorCopy (nosteporg, ent->v->origin);
                VectorCopy (nostepvel, ent->v->velocity);
        }
+
+       SV_CheckVelocity(ent);
 }
 
 //============================================================================
@@ -1126,21 +1131,17 @@ void SV_CheckWaterTransition (edict_t *ent)
                return;
        }
 
+       // check if the entity crossed into or out of water
+       if ((ent->v->watertype == CONTENTS_WATER || ent->v->watertype == CONTENTS_SLIME) != (cont == CONTENTS_WATER || cont == CONTENTS_SLIME))
+               SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
+
        if (cont <= CONTENTS_WATER)
        {
-               if (ent->v->watertype == CONTENTS_EMPTY && cont != CONTENTS_LAVA)
-                       // just crossed into water
-                       SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
-
                ent->v->watertype = cont;
                ent->v->waterlevel = 1;
        }
        else
        {
-               if (ent->v->watertype != CONTENTS_EMPTY && ent->v->watertype != CONTENTS_LAVA)
-                       // just crossed into water
-                       SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
-
                ent->v->watertype = CONTENTS_EMPTY;
                ent->v->waterlevel = 0;
        }
@@ -1314,9 +1315,9 @@ void SV_Physics (void)
                if (pr_global_struct->force_retouch)
                        SV_LinkEdict (ent, true);       // force retouch even for stationary
 
-               if (i > 0 && i <= MAX_SCOREBOARD)
+               if (i > 0 && i <= svs.maxclients)
                {
-                       if (!svs.connectedclients[i-1] || !svs.connectedclients[i-1]->spawned)
+                       if (!svs.clients[i-1].spawned)
                                continue;
                        // connected slot
                        // call standard client pre-think
@@ -1349,7 +1350,7 @@ void SV_Physics (void)
                                VectorMA(ent->v->angles, sv.frametime, ent->v->avelocity, ent->v->angles);
                        }
                        // relink normal entities here, players always get relinked so don't relink twice
-                       if (!(i > 0 && i <= MAX_SCOREBOARD))
+                       if (!(i > 0 && i <= svs.maxclients))
                                SV_LinkEdict(ent, false);
                        break;
                case MOVETYPE_STEP:
@@ -1372,7 +1373,7 @@ void SV_Physics (void)
                        SV_Physics_Toss (ent);
                        break;
                case MOVETYPE_FLY:
-                       if (i > 0 && i <= MAX_SCOREBOARD)
+                       if (i > 0 && i <= svs.maxclients)
                        {
                                if (SV_RunThink (ent))
                                {
@@ -1388,7 +1389,7 @@ void SV_Physics (void)
                        break;
                }
 
-               if (i > 0 && i <= MAX_SCOREBOARD && !ent->e->free)
+               if (i > 0 && i <= svs.maxclients && !ent->e->free)
                {
                        SV_CheckVelocity (ent);