From c03c6d4829ad1ee077b2a50856d9585335047500 Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Thu, 26 Sep 2019 13:24:02 +0000 Subject: [PATCH] Fixed entities mysteriously teleporting to another location --- src/g_phys.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/g_phys.c b/src/g_phys.c index bae1744..bfaef61 100644 --- a/src/g_phys.c +++ b/src/g_phys.c @@ -1205,6 +1205,7 @@ G_RunEntity(edict_t *ent) { trace_t trace; vec3_t previous_origin; + qboolean saved_origin; if (!ent) { @@ -1214,6 +1215,11 @@ G_RunEntity(edict_t *ent) if (ent->movetype == MOVETYPE_STEP) { VectorCopy(ent->s.origin, previous_origin); + saved_origin = true; + } + else + { + saved_origin = false; } if (ent->prethink) @@ -1249,7 +1255,7 @@ G_RunEntity(edict_t *ent) gi.error("SV_Physics: bad movetype %i", (int)ent->movetype); } - if (ent->movetype == MOVETYPE_STEP) + if (saved_origin) { /* if we moved, check and fix origin if needed */ if (!VectorCompare(ent->s.origin, previous_origin))