mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Add FF_REVERSEANIM frame flag
- Animate from state frame backwards by var1
This commit is contained in:
parent
b6e2609873
commit
8c4502ff5b
2 changed files with 10 additions and 2 deletions
10
src/p_mobj.c
10
src/p_mobj.c
|
|
@ -154,11 +154,17 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
|
||||||
|
|
||||||
if (mobj->sprite != SPR_PLAY)
|
if (mobj->sprite != SPR_PLAY)
|
||||||
{
|
{
|
||||||
|
const UINT8 start = mobj->state->frame & FF_FRAMEMASK;
|
||||||
|
|
||||||
|
UINT8 frame = mobj->frame & FF_FRAMEMASK;
|
||||||
|
|
||||||
// compare the current sprite frame to the one we started from
|
// compare the current sprite frame to the one we started from
|
||||||
// if more than var1 away from it, swap back to the original
|
// if more than var1 away from it, swap back to the original
|
||||||
// else just advance by one
|
// else just advance by one
|
||||||
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1)
|
if ((mobj->frame & FF_REVERSEANIM ? (start - (--frame)) : ((++frame) - start)) > mobj->state->var1)
|
||||||
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK);
|
frame = start;
|
||||||
|
|
||||||
|
mobj->frame = frame | (mobj->frame & ~FF_FRAMEMASK);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,8 @@ extern "C" {
|
||||||
#define FF_GLOBALANIM 0x20000000
|
#define FF_GLOBALANIM 0x20000000
|
||||||
/// \brief Frame flags - Animate: Start at a random place in the animation (mutually exclusive with above)
|
/// \brief Frame flags - Animate: Start at a random place in the animation (mutually exclusive with above)
|
||||||
#define FF_RANDOMANIM 0x40000000
|
#define FF_RANDOMANIM 0x40000000
|
||||||
|
/// \brief Frame flags - Animate: Animate in reverse
|
||||||
|
#define FF_REVERSEANIM 0x80000000
|
||||||
|
|
||||||
/** \brief translucency tables
|
/** \brief translucency tables
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue