added more SV_CheckVelocity calls on players for safety sake
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 21 Mar 2003 21:54:43 +0000 (21:54 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 21 Mar 2003 21:54:43 +0000 (21:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2846 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_phys.c
sv_user.c

index 459a0ec..3843e38 100644 (file)
--- a/server.h
+++ b/server.h
@@ -305,5 +305,7 @@ void SV_SpawnServer (const char *server);
 
 void SV_SetMaxClients(int n);
 
+void SV_CheckVelocity (edict_t *ent);
+
 #endif
 
index 4b2f1a1..5847ad5 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1074,6 +1074,8 @@ void SV_Physics_Client (edict_t *ent, int num)
        if (!svs.clients[num-1].active)
                return;         // unconnected slot
 
+       SV_CheckVelocity (ent);
+
        // call standard client pre-think
        pr_global_struct->time = sv.time;
        pr_global_struct->self = EDICT_TO_PROG(ent);
@@ -1124,9 +1126,13 @@ void SV_Physics_Client (edict_t *ent, int num)
                Host_Error ("SV_Physics_client: bad movetype %i", (int)ent->v->movetype);
        }
 
+       SV_CheckVelocity (ent);
+
        // call standard player post-think
        SV_LinkEdict (ent, true);
 
+       SV_CheckVelocity (ent);
+
        pr_global_struct->time = sv.time;
        pr_global_struct->self = EDICT_TO_PROG(ent);
        PR_ExecuteProgram (pr_global_struct->PlayerPostThink, "QC function PlayerPostThink is missing");
index 06ef02e..cc0a412 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -665,6 +665,15 @@ void SV_RunClients (void)
                        }
                        else
                                SV_ClientThink ();
+
+                       SV_CheckVelocity (sv_player);
+
+                       // LordHavoc: a hack to ensure that the (rather silly) id1 quakec
+                       // player_run/player_stand1 does not horribly malfunction if the
+                       // velocity becomes a number that is both == 0 and != 0
+                       // (sounds to me like NaN but to be absolutely safe...)
+                       if (DotProduct(sv_player->v->velocity, sv_player->v->velocity) < 0.0001)
+                               VectorClear(sv_player->v->velocity);
                }
        }
 }