Merge pull request #37 from BjossiAlfreds/mysterymove

Fixed entities mysteriously teleporting to another location
This commit is contained in:
Yamagi 2019-09-27 11:10:08 +02:00 committed by GitHub
commit f24de8d323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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))