Fix unintended rounding issue with hexen2's movechain stuff that was preventing origin changes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5774 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-10-01 01:27:00 +00:00
parent 155ef1f460
commit 524fdb3dfd

View file

@ -2104,18 +2104,19 @@ static void WPhys_WalkMove (world_t *w, wedict_t *ent, const float *gravitydir)
#ifdef HEXEN2 #ifdef HEXEN2
void WPhys_MoveChain(world_t *w, wedict_t *ent, wedict_t *movechain, float *initial_origin, float *initial_angle) void WPhys_MoveChain(world_t *w, wedict_t *ent, wedict_t *movechain, float *initial_origin, float *initial_angle)
{ {
qboolean orgchanged; qboolean orgunchanged;
vec3_t moveorg, moveang; vec3_t moveorg, moveang;
VectorSubtract(ent->v->origin, initial_origin, moveorg); VectorSubtract(ent->v->origin, initial_origin, moveorg);
VectorSubtract(ent->v->angles, initial_angle, moveang); VectorSubtract(ent->v->angles, initial_angle, moveang);
if ((orgchanged=DotProduct(moveorg,moveorg)) || DotProduct(moveang,moveang)) orgunchanged=!DotProduct(moveorg,moveorg);
if (!orgunchanged || DotProduct(moveang,moveang))
{ {
int i; int i;
for(i=16; i && movechain != w->edicts && !ED_ISFREE(movechain); i--, movechain = PROG_TO_WEDICT(w->progs, movechain->xv->movechain)) for(i=16; i && movechain != w->edicts && !ED_ISFREE(movechain); i--, movechain = PROG_TO_WEDICT(w->progs, movechain->xv->movechain))
{ {
if ((int)movechain->v->flags & FL_MOVECHAIN_ANGLE) if ((int)movechain->v->flags & FL_MOVECHAIN_ANGLE)
VectorAdd(movechain->v->angles, moveang, movechain->v->angles); //FIXME: axial only VectorAdd(movechain->v->angles, moveang, movechain->v->angles); //FIXME: axial only
if (orgchanged) if (!orgunchanged)
{ {
VectorAdd(movechain->v->origin, moveorg, movechain->v->origin); VectorAdd(movechain->v->origin, moveorg, movechain->v->origin);
World_LinkEdict(w, movechain, false); World_LinkEdict(w, movechain, false);