mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-05 23:52:53 +00:00
Merge branch 'gacha-prep' into 'master'
Add FF_REVERSEANIM and FF_INVERT, extern P_InstaScale See merge request KartKrew/Kart!1285
This commit is contained in:
commit
0f909bdb46
5 changed files with 25 additions and 9 deletions
|
|
@ -6,13 +6,6 @@
|
||||||
#include "../p_local.h"
|
#include "../p_local.h"
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
|
||||||
// TODO: generic function
|
|
||||||
static void P_InstaScale(mobj_t *thing, fixed_t scale)
|
|
||||||
{
|
|
||||||
P_SetScale(thing, scale);
|
|
||||||
thing->destscale = scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* An object may not be visible on the same tic:
|
/* An object may not be visible on the same tic:
|
||||||
1) that it spawned
|
1) that it spawned
|
||||||
2) that it cycles to the next state */
|
2) that it cycles to the next state */
|
||||||
|
|
|
||||||
21
src/p_mobj.c
21
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;
|
||||||
}
|
}
|
||||||
|
|
@ -4948,6 +4954,17 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_InstaScale
|
||||||
|
//
|
||||||
|
// Set the object's current scale and destscale together
|
||||||
|
//
|
||||||
|
void P_InstaScale(mobj_t *thing, fixed_t scale)
|
||||||
|
{
|
||||||
|
P_SetScale(thing, scale);
|
||||||
|
thing->destscale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on your target
|
void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on your target
|
||||||
{
|
{
|
||||||
fixed_t dist, ndist, speedmul;
|
fixed_t dist, ndist, speedmul;
|
||||||
|
|
|
||||||
|
|
@ -552,6 +552,7 @@ boolean P_PrecipThinker(precipmobj_t *mobj);
|
||||||
void P_NullPrecipThinker(precipmobj_t *mobj);
|
void P_NullPrecipThinker(precipmobj_t *mobj);
|
||||||
void P_FreePrecipMobj(precipmobj_t *mobj);
|
void P_FreePrecipMobj(precipmobj_t *mobj);
|
||||||
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||||
|
void P_InstaScale(mobj_t *mobj, fixed_t newscale);
|
||||||
void P_XYMovement(mobj_t *mo);
|
void P_XYMovement(mobj_t *mo);
|
||||||
void P_RingXYMovement(mobj_t *mo);
|
void P_RingXYMovement(mobj_t *mo);
|
||||||
void P_SceneryXYMovement(mobj_t *mo);
|
void P_SceneryXYMovement(mobj_t *mo);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ extern "C" {
|
||||||
#define FF_REVERSESUBTRACT ((AST_REVERSESUBTRACT-1)<<FF_BLENDSHIFT)
|
#define FF_REVERSESUBTRACT ((AST_REVERSESUBTRACT-1)<<FF_BLENDSHIFT)
|
||||||
#define FF_MODULATE ((AST_MODULATE-1)<<FF_BLENDSHIFT)
|
#define FF_MODULATE ((AST_MODULATE-1)<<FF_BLENDSHIFT)
|
||||||
#define FF_OVERLAY ((AST_OVERLAY-1)<<FF_BLENDSHIFT)
|
#define FF_OVERLAY ((AST_OVERLAY-1)<<FF_BLENDSHIFT)
|
||||||
|
/// \brief Frame flags: B/W inverted colors (hitlag flashing)
|
||||||
|
#define FF_INVERT 0x8000
|
||||||
|
|
||||||
/// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table
|
/// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table
|
||||||
#define FF_TRANSMASK 0xf0000
|
#define FF_TRANSMASK 0xf0000
|
||||||
|
|
@ -100,6 +102,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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -815,6 +815,7 @@ static boolean baddie_is_flashing(mobj_t *thing)
|
||||||
boolean R_ThingIsFlashing(mobj_t *thing)
|
boolean R_ThingIsFlashing(mobj_t *thing)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
(thing->frame & FF_INVERT) ||
|
||||||
hitlag_is_flashing(thing) ||
|
hitlag_is_flashing(thing) ||
|
||||||
baddie_is_flashing(thing);
|
baddie_is_flashing(thing);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue