From 07e5fe95467926520faa54365ae961c1e8625c93 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 10 Nov 2016 22:35:33 +0000 Subject: [PATCH] Swapped around in an attempt to streamline. --- src/p_mobj.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e21b93014..82a923279 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -127,18 +127,20 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj) mobj->anim_duration = (UINT16)mobj->state->var2; - if (mobj->sprite == SPR_PLAY) + if (mobj->sprite != SPR_PLAY) { - if (mobj->skin && (((++mobj->frame) & FF_FRAMEMASK) >= (UINT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes))) - mobj->frame &= ~FF_FRAMEMASK; + // compare the current sprite frame to the one we started from + // if more than var1 away from it, swap back to the original + // else just advance by one + if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1) + mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK); + return; } - // compare the current sprite frame to the one we started from - // if more than var1 away from it, swap back to the original - // else just advance by one - if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1) - mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK); + // sprite2 version of above + if (mobj->skin && (((++mobj->frame) & FF_FRAMEMASK) >= (UINT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes))) + mobj->frame &= ~FF_FRAMEMASK; } //