]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
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 459a0ec58c042d71ce755cb45b6010ff50093bd5..3843e38d8ec35c64bfc29fc8060b32bde54808e1 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 4b2f1a1b9add0f34dc4df16c9f85edca30a80a5d..5847ad5219ac144e77fa01b105918a9a2acca626 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 06ef02ead23551ec2911446549cb3ca1189c06b2..cc0a412ab6bb2ea54c91d991b0dd9b83ede62dd6 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);
                }
        }
 }