From 6c3550588c372b016ccc80296c8f8c618c72c1f1 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 21 Mar 2003 21:54:43 +0000 Subject: [PATCH] added more SV_CheckVelocity calls on players for safety sake git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2846 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 2 ++ sv_phys.c | 6 ++++++ sv_user.c | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/server.h b/server.h index 459a0ec5..3843e38d 100644 --- 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 diff --git a/sv_phys.c b/sv_phys.c index 4b2f1a1b..5847ad52 100644 --- 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"); diff --git a/sv_user.c b/sv_user.c index 06ef02ea..cc0a412a 100644 --- 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); } } } -- 2.39.2