Merge branch 'handle-player-mobjsetstate' into 'next'

Handle player state is P_SetMobjState

See merge request STJr/SRB2!2239
This commit is contained in:
Logan Aerl Arias 2023-12-26 00:00:39 +00:00
commit 64da1fada1
13 changed files with 177 additions and 183 deletions

View file

@ -584,11 +584,11 @@ void B_RespawnBot(INT32 playernum)
P_SetOrigin(tails, x, y, z);
if (player->charability == CA_FLY)
{
P_SetPlayerMobjState(tails, S_PLAY_FLY);
P_SetMobjState(tails, S_PLAY_FLY);
tails->player->powers[pw_tailsfly] = (UINT16)-1;
}
else
P_SetPlayerMobjState(tails, S_PLAY_FALL);
P_SetMobjState(tails, S_PLAY_FALL);
P_SetScale(tails, sonic->scale);
tails->destscale = sonic->destscale;
}

View file

@ -4524,7 +4524,7 @@ void F_TextPromptDrawer(void)
if (players[j].mo->state == states+S_PLAY_STND && players[j].mo->tics != -1)\
players[j].mo->tics++;\
else if (players[j].mo->state == states+S_PLAY_WAIT)\
P_SetPlayerMobjState(players[j].mo, S_PLAY_STND);\
P_SetMobjState(players[j].mo, S_PLAY_STND);\
}\
}

View file

@ -641,10 +641,7 @@ static int mobj_set(lua_State *L)
mo->tics = luaL_checkinteger(L, 3);
break;
case mobj_state: // set state by enum
if (mo->player)
P_SetPlayerMobjState(mo, luaL_checkinteger(L, 3));
else
P_SetMobjState(mo, luaL_checkinteger(L, 3));
P_SetMobjState(mo, luaL_checkinteger(L, 3));
break;
case mobj_flags: // special handling for MF_NOBLOCKMAP and MF_NOSECTOR
{

View file

@ -1019,7 +1019,7 @@ static void OP_CycleThings(INT32 amt)
if (players[0].mo->eflags & MFE_VERTICALFLIP) // correct z when flipped
players[0].mo->z += players[0].mo->height - FixedMul(mobjinfo[op_currentthing].height, players[0].mo->scale);
players[0].mo->height = FixedMul(mobjinfo[op_currentthing].height, players[0].mo->scale);
P_SetPlayerMobjState(players[0].mo, S_OBJPLACE_DUMMY);
P_SetMobjState(players[0].mo, S_OBJPLACE_DUMMY);
op_currentdoomednum = mobjinfo[op_currentthing].doomednum;
}
@ -1528,7 +1528,7 @@ void Command_ObjectPlace_f(void)
else
OP_CycleThings(0); // sets all necessary height values without cycling op_currentthing
P_SetPlayerMobjState(players[0].mo, S_OBJPLACE_DUMMY);
P_SetMobjState(players[0].mo, S_OBJPLACE_DUMMY);
}
// Or are we leaving it instead?
else
@ -1542,7 +1542,7 @@ void Command_ObjectPlace_f(void)
// If still in dummy state, get out of it.
if (players[0].mo->state == &states[S_OBJPLACE_DUMMY])
P_SetPlayerMobjState(players[0].mo, op_oldstate);
P_SetMobjState(players[0].mo, op_oldstate);
// Reset everything back to how it was before we entered objectplace.
P_UnsetThingPosition(players[0].mo);

View file

@ -9945,7 +9945,7 @@ void A_SetObjectState(mobj_t *actor)
if (!target->player)
P_SetMobjState(target, locvar1);
else
P_SetPlayerMobjState(target, locvar1);
P_SetMobjState(target, locvar1);
}
}
@ -13824,7 +13824,7 @@ static boolean PIT_DustDevilLaunch(mobj_t *thing)
player->powers[pw_carry] = CR_DUSTDEVIL;
player->powers[pw_nocontrol] = 2;
P_SetTarget(&thing->tracer, dustdevil);
P_SetPlayerMobjState(thing, S_PLAY_PAIN);
P_SetMobjState(thing, S_PLAY_PAIN);
if (dist > dragamount)
{
@ -13847,7 +13847,7 @@ static boolean PIT_DustDevilLaunch(mobj_t *thing)
player->powers[pw_nocontrol] = 0;
P_SetTarget(&thing->tracer, NULL);
S_StartSound(thing, sfx_wdjump);
P_SetPlayerMobjState(thing, S_PLAY_FALL);
P_SetMobjState(thing, S_PLAY_FALL);
}
thing->momz = thrust;

View file

@ -529,7 +529,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
else if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
P_SetMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
@ -1249,7 +1249,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_ResetPlayer(player);
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
P_SetMobjState(toucher, S_PLAY_FALL);
}
}
return;
@ -1558,7 +1558,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
P_SetMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
@ -1609,7 +1609,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
P_SetMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
@ -1645,7 +1645,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
special->momx = special->momy = 0;
// Buenos Dias Mandy
P_SetPlayerMobjState(toucher, S_PLAY_STUN);
P_SetMobjState(toucher, S_PLAY_STUN);
player->pflags &= ~PF_APPLYAUTOBRAKE;
P_ResetPlayer(player);
player->drawangle = special->angle + ANGLE_180;
@ -1724,7 +1724,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{
player->powers[pw_carry] = CR_MACESPIN;
S_StartSound(toucher, sfx_spin);
P_SetPlayerMobjState(toucher, S_PLAY_ROLL);
P_SetMobjState(toucher, S_PLAY_ROLL);
}
else
player->powers[pw_carry] = CR_GENERIC;
@ -1785,7 +1785,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{
if (player->bot && player->bot != BOT_MPAI && toucher->state-states != S_PLAY_GASP)
S_StartSound(toucher, special->info->deathsound); // Force it to play a sound for bots
P_SetPlayerMobjState(toucher, S_PLAY_GASP);
P_SetMobjState(toucher, S_PLAY_GASP);
P_ResetPlayer(player);
}
@ -1855,7 +1855,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momz = toucher->tracer->momz + P_AproxDistance(toucher->tracer->momx, toucher->tracer->momy)/2;
P_ResetPlayer(player);
player->pflags &= ~PF_APPLYAUTOBRAKE;
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
P_SetMobjState(toucher, S_PLAY_FALL);
P_SetTarget(&toucher->tracer->target, NULL);
P_KillMobj(toucher->tracer, toucher, special, 0);
P_SetTarget(&toucher->tracer, NULL);
@ -3089,9 +3089,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
else if (target->player)
{
if (damagetype == DMG_DROWNED || damagetype == DMG_SPACEDROWN)
P_SetPlayerMobjState(target, target->info->xdeathstate);
P_SetMobjState(target, target->info->xdeathstate);
else
P_SetPlayerMobjState(target, target->info->deathstate);
P_SetMobjState(target, target->info->deathstate);
}
else
#ifdef DEBUG_NULL_DEATHSTATE
@ -3145,7 +3145,7 @@ static void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
}
player->powers[pw_flashing] = flashingtics;
P_SetPlayerMobjState(target, S_PLAY_NIGHTS_STUN);
P_SetMobjState(target, S_PLAY_NIGHTS_STUN);
S_StartSound(target, sfx_nghurt);
player->mo->spriteroll = 0;
@ -3366,7 +3366,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
if (!player->spectator)
player->mo->flags2 &= ~MF2_DONTDRAW;
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
P_SetMobjState(player->mo, player->mo->info->deathstate);
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
{
P_PlayerFlagBurst(player, false);
@ -3440,7 +3440,7 @@ static void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, I
P_InstaThrust(player->mo, ang, fallbackspeed);
P_SetPlayerMobjState(player->mo, S_PLAY_STUN);
P_SetMobjState(player->mo, S_PLAY_STUN);
P_ResetPlayer(player);

View file

@ -297,7 +297,6 @@ void P_PrecipitationEffects(void);
void P_RemoveMobj(mobj_t *th);
boolean P_MobjWasRemoved(mobj_t *th);
void P_RemoveSavegameMobj(mobj_t *th);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_RunShields(void);
void P_RunOverlays(void);

View file

@ -264,7 +264,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
UINT8 secondjump = object->player->secondjump;
UINT16 tailsfly = object->player->powers[pw_tailsfly];
if (object->player->pflags & PF_GLIDING)
P_SetPlayerMobjState(object, S_PLAY_FALL);
P_SetMobjState(object, S_PLAY_FALL);
P_ResetPlayer(object->player);
object->player->pflags |= pflags;
object->player->secondjump = secondjump;
@ -403,7 +403,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
}
if (object->player->pflags & PF_GLIDING)
P_SetPlayerMobjState(object, S_PLAY_FALL);
P_SetMobjState(object, S_PLAY_FALL);
if ((spring->info->painchance == 3))
{
if (!(pflags = (object->player->pflags & PF_SPINNING)) &&
@ -411,11 +411,11 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|| (spring->flags2 & MF2_AMBUSH)))
{
pflags = PF_SPINNING;
P_SetPlayerMobjState(object, S_PLAY_ROLL);
P_SetMobjState(object, S_PLAY_ROLL);
S_StartSound(object, sfx_spin);
}
else
P_SetPlayerMobjState(object, S_PLAY_ROLL);
P_SetMobjState(object, S_PLAY_ROLL);
}
else
{
@ -424,7 +424,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
pflags = object->player->pflags & (PF_STARTJUMP | PF_JUMPED | PF_NOJUMPDAMAGE | PF_SPINNING | PF_THOKKED | PF_BOUNCING); // I still need these.
if (wasSpindashing) // Ensure we're in the rolling state, and not spindash.
P_SetPlayerMobjState(object, S_PLAY_ROLL);
P_SetMobjState(object, S_PLAY_ROLL);
if (object->player->charability == CA_GLIDEANDCLIMB && object->player->skidtime && (pflags & PF_JUMPED))
{
@ -439,7 +439,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
if (spring->info->painchance == 1) // For all those ancient, SOC'd abilities.
{
object->player->pflags |= P_GetJumpFlags(object->player);
P_SetPlayerMobjState(object, S_PLAY_JUMP);
P_SetMobjState(object, S_PLAY_JUMP);
}
else if ((spring->info->painchance == 2) || ((spring->info->painchance != 3) && (pflags & PF_BOUNCING))) // Adding momentum only.
{
@ -456,16 +456,16 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
object->player->secondjump = secondjump;
}
else if (object->player->dashmode >= DASHMODE_THRESHOLD)
P_SetPlayerMobjState(object, S_PLAY_DASH);
P_SetMobjState(object, S_PLAY_DASH);
else if (P_IsObjectOnGround(object))
P_SetPlayerMobjState(object, (horizspeed >= FixedMul(object->player->runspeed, object->scale)) ? S_PLAY_RUN : S_PLAY_WALK);
P_SetMobjState(object, (horizspeed >= FixedMul(object->player->runspeed, object->scale)) ? S_PLAY_RUN : S_PLAY_WALK);
else
P_SetPlayerMobjState(object, (object->momz > 0) ? S_PLAY_SPRING : S_PLAY_FALL);
P_SetMobjState(object, (object->momz > 0) ? S_PLAY_SPRING : S_PLAY_FALL);
}
else if (P_MobjFlip(object)*vertispeed > 0)
P_SetPlayerMobjState(object, S_PLAY_SPRING);
P_SetMobjState(object, S_PLAY_SPRING);
else
P_SetPlayerMobjState(object, S_PLAY_FALL);
P_SetMobjState(object, S_PLAY_FALL);
}
else if (horizspeed
&& object->tracer
@ -547,7 +547,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
if (p && !p->powers[pw_tailsfly] && !p->powers[pw_carry]) // doesn't reset anim for Tails' flight
{
P_ResetPlayer(p);
P_SetPlayerMobjState(object, S_PLAY_FALL);
P_SetMobjState(object, S_PLAY_FALL);
P_SetTarget(&object->tracer, spring);
p->powers[pw_carry] = CR_FAN;
}
@ -565,7 +565,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
{
P_ResetPlayer(p);
if (p->panim != PA_FALL)
P_SetPlayerMobjState(object, S_PLAY_FALL);
P_SetMobjState(object, S_PLAY_FALL);
}
break;
default:
@ -1047,7 +1047,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
thing->flags2 &= ~MF2_DONTDRAW; // don't leave the rock invisible if it was flashing prior to boarding
P_SetTarget(&thing->tracer, tmthing);
P_ResetPlayer(tmthing->player);
P_SetPlayerMobjState(tmthing, S_PLAY_WALK);
P_SetMobjState(tmthing, S_PLAY_WALK);
tmthing->player->powers[pw_carry] = CR_ROLLOUT;
P_SetTarget(&tmthing->tracer, thing);
if (!P_IsObjectOnGround(thing))

View file

@ -179,7 +179,7 @@ static void P_CyclePlayerMobjState(mobj_t *mobj)
// you can cycle through multiple states in a tic
if (!mobj->tics && mobj->state)
if (!P_SetPlayerMobjState(mobj, mobj->state->nextstate))
if (!P_SetMobjState(mobj, mobj->state->nextstate))
return; // freed itself
}
}
@ -190,7 +190,7 @@ static void P_CyclePlayerMobjState(mobj_t *mobj)
//
// Separate from P_SetMobjState because of the pw_flashing check and Super states
//
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{
state_t *st;
player_t *player = mobj->player;
@ -516,10 +516,8 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
statenum_t i = state; // initial state
statenum_t tempstate[NUMSTATES]; // for use with recursion
#ifdef PARANOIA
if (mobj->player != NULL)
I_Error("P_SetMobjState used for player mobj. Use P_SetPlayerMobjState instead!\n(State called: %d)", state);
#endif
return P_SetPlayerMobjState(mobj, state);
if (recursion++) // if recursion detected,
memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table
@ -1662,7 +1660,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
{
// if in a walking frame, stop moving
if (player->panim == PA_WALK)
P_SetPlayerMobjState(mo, S_PLAY_STND);
P_SetMobjState(mo, S_PLAY_STND);
mo->momx = player->cmomx;
mo->momy = player->cmomy;
}
@ -2988,7 +2986,7 @@ void P_PlayerZMovement(mobj_t *mo)
}
// Get up if you fell.
if (mo->player->panim == PA_PAIN)
P_SetPlayerMobjState(mo, S_PLAY_WALK);
P_SetMobjState(mo, S_PLAY_WALK);
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
// Handle landing on slope during Z movement
@ -3985,7 +3983,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{
mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_WALK);
P_SetMobjState(mobj, S_PLAY_WALK);
}
#endif
mobj->eflags &= ~MFE_JUSTHITFLOOR;
@ -7641,7 +7639,7 @@ static void P_RosySceneryThink(mobj_t *mobj)
if (stat == S_ROSY_HUG)
{
if (player->panim != PA_IDLE)
P_SetPlayerMobjState(mobj->target, S_PLAY_STND);
P_SetMobjState(mobj->target, S_PLAY_STND);
player->pflags |= PF_STASIS;
}
@ -11973,9 +11971,9 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
mobj->flags2 |= MF2_OBJECTFLIP;
}
if (mthing->args[0])
P_SetPlayerMobjState(mobj, S_PLAY_FALL);
P_SetMobjState(mobj, S_PLAY_FALL);
else if (metalrecording)
P_SetPlayerMobjState(mobj, S_PLAY_WAIT);
P_SetMobjState(mobj, S_PLAY_WAIT);
}
else
z = floor;

View file

@ -2735,7 +2735,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->player->rmomx = mo->player->rmomy = 1;
mo->player->cmomx = mo->player->cmomy = 0;
P_ResetPlayer(mo->player);
P_SetPlayerMobjState(mo, S_PLAY_STND);
P_SetMobjState(mo, S_PLAY_STND);
// Reset bot too.
if (bot) {
@ -2746,7 +2746,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
bot->player->rmomx = bot->player->rmomy = 1;
bot->player->cmomx = bot->player->cmomy = 0;
P_ResetPlayer(bot->player);
P_SetPlayerMobjState(bot, S_PLAY_STND);
P_SetMobjState(bot, S_PLAY_STND);
}
}
break;
@ -4566,7 +4566,7 @@ static void P_ProcessSpeedPad(player_t *player, sector_t *sector, sector_t *rove
if (!(player->pflags & PF_SPINNING))
player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
}
player->powers[pw_flashing] = TICRATE/3;
@ -4744,7 +4744,7 @@ static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end)
if (player->mo->state-states != S_PLAY_ROLL)
{
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_spin);
}
}
@ -4958,7 +4958,7 @@ static void P_ProcessRopeHang(player_t *player, mtag_t sectag)
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY);
player->climbing = 0;
P_SetThingPosition(player->mo);
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
P_SetMobjState(player->mo, S_PLAY_RIDE);
}
static boolean P_SectorHasSpecial(sector_t *sec)
@ -5017,7 +5017,7 @@ static void P_EvaluateSpecialFlags(player_t *player, sector_t *sector, sector_t
if (!player->powers[pw_carry])
{
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
P_SetTarget(&player->mo->tracer, player->mo);
player->powers[pw_carry] = CR_FAN;
}
@ -5032,7 +5032,7 @@ static void P_EvaluateSpecialFlags(player_t *player, sector_t *sector, sector_t
if (!(player->pflags & PF_SPINNING))
{
player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartAttackSound(player->mo, sfx_spin);
if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale)

View file

@ -96,7 +96,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
P_ClearStarPost(starpostnum);
P_ResetPlayer(thing->player);
P_SetPlayerMobjState(thing, S_PLAY_STND);
P_SetMobjState(thing, S_PLAY_STND);
P_FlashPal(thing->player, PAL_MIXUP, 10);
}
@ -153,7 +153,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
thing->player->rmomx = thing->player->rmomy = 0;
thing->player->speed = 0;
P_ResetPlayer(thing->player);
P_SetPlayerMobjState(thing, S_PLAY_STND);
P_SetMobjState(thing, S_PLAY_STND);
thing->reactiontime = TICRATE/2; // don't move for about half a second
thing->player->drawangle = angle;

View file

@ -696,7 +696,7 @@ static void P_DeNightserizePlayer(player_t *player)
else if (player == &players[secondarydisplayplayer])
localaiming2 = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
// If in a special stage, add some preliminary exit time.
if (G_IsSpecialStage(gamemap))
@ -950,7 +950,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
P_RunNightserizeExecutors(player->mo);
player->powers[pw_carry] = CR_NIGHTSMODE;
P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_TRANS1);
P_SetMobjState(player->mo, S_PLAY_NIGHTS_TRANS1);
}
pflags_t P_GetJumpFlags(player_t *player)
@ -996,7 +996,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
fixed_t fallbackspeed;
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
P_SetMobjState(player->mo, player->mo->info->painstate);
if (player->mo->eflags & MFE_VERTICALFLIP)
player->mo->z--;
@ -1347,7 +1347,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
player->mo->momx = player->mo->momy = player->mo->momz = player->cmomx = player->cmomy = player->rmomx = player->rmomy = 0;
// Transformation animation
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1);
P_SetMobjState(player->mo, S_PLAY_SUPER_TRANS1);
if (giverings && player->rings < 50)
player->rings = 50;
@ -1400,7 +1400,7 @@ static void P_DoSuperDetransformation(player_t *player)
player->powers[pw_flashing] = flashingtics-1;
if (player->mo->sprite2 & FF_SPR2SUPER)
P_SetPlayerMobjState(player->mo, player->mo->state-states);
P_SetMobjState(player->mo, player->mo->state-states);
// Inform the netgame that the champion has fallen in the heat of battle.
if (!G_CoopGametype())
@ -2290,12 +2290,12 @@ void P_DoPlayerExit(player_t *player)
{
player->climbing = 0;
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
else if (player->pflags & PF_STARTDASH)
{
player->pflags &= ~PF_STARTDASH;
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
player->powers[pw_underwater] = 0;
player->powers[pw_spacetime] = 0;
@ -2384,7 +2384,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (!(player->pflags & PF_STARTDASH) && player->panim != PA_ROLL && player->panim != PA_ETC
&& player->panim != PA_ABILITY && player->panim != PA_ABILITY2)
{
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_spin);
}
}
@ -2393,7 +2393,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (dorollstuff)
{
player->skidtime = TICRATE;
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
P_SetMobjState(player->mo, S_PLAY_GLIDE);
P_SpawnSkidDust(player, player->mo->radius, true); // make sure the player knows they landed
player->mo->tics = -1;
}
@ -2406,7 +2406,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (player->mo->state-states != S_PLAY_GLIDE_LANDING)
{
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING);
P_SetMobjState(player->mo, S_PLAY_GLIDE_LANDING);
player->pflags |= PF_STASIS;
if (player->speed > FixedMul(player->runspeed, player->mo->scale))
player->skidtime += player->mo->tics;
@ -2427,7 +2427,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (player->mo->state-states != S_PLAY_MELEE_LANDING)
{
mobjtype_t type = player->revitem;
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING);
P_SetMobjState(player->mo, S_PLAY_MELEE_LANDING);
player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
S_StartSound(player->mo, sfx_s3k8b);
player->pflags |= PF_FULLSTASIS;
@ -2493,28 +2493,28 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (player->cmomx || player->cmomy)
{
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD && player->panim != PA_DASH)
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
P_SetMobjState(player->mo, S_PLAY_DASH);
else if (player->speed >= runspd
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
P_SetMobjState(player->mo, S_PLAY_RUN);
else if ((player->rmomx || player->rmomy)
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
else
{
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD && player->panim != PA_DASH)
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
P_SetMobjState(player->mo, S_PLAY_DASH);
else if (player->speed >= runspd
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
P_SetMobjState(player->mo, S_PLAY_RUN);
else if ((player->mo->momx || player->mo->momy)
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
}
@ -2544,7 +2544,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
? 6*FRACUNIT/5
: 5*FRACUNIT/2,
false);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
player->mo->momx = player->mo->momy = 0;
clipmomz = false;
}
@ -3697,9 +3697,9 @@ static void P_DoClimbing(player_t *player)
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
&& player->mo->state-states != S_PLAY_CLIMB)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB);
P_SetMobjState(player->mo, S_PLAY_CLIMB);
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state-states != S_PLAY_CLING)
P_SetPlayerMobjState(player->mo, S_PLAY_CLING);
P_SetMobjState(player->mo, S_PLAY_CLING);
if (!floorclimb)
{
@ -3714,14 +3714,14 @@ static void P_DoClimbing(player_t *player)
player->climbing = 0;
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
if (skyclimber)
{
player->climbing = 0;
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
}
@ -3732,15 +3732,15 @@ static void P_DoClimbing(player_t *player)
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
&& player->mo->state-states != S_PLAY_CLIMB)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB);
P_SetMobjState(player->mo, S_PLAY_CLIMB);
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state-states != S_PLAY_CLING)
P_SetPlayerMobjState(player->mo, S_PLAY_CLING);
P_SetMobjState(player->mo, S_PLAY_CLING);
if (cmd->buttons & BT_SPIN && !(player->pflags & PF_JUMPSTASIS))
{
player->climbing = 0;
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
P_SetObjectMomZ(player->mo, 4*FRACUNIT, false);
P_Thrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale));
}
@ -3756,12 +3756,12 @@ static void P_DoClimbing(player_t *player)
}
if (player->climbing == 0)
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
if (player->climbing && P_IsObjectOnGround(player->mo))
{
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
}
@ -4123,10 +4123,10 @@ teeterdone:
if (teeter)
{
if (player->panim == PA_IDLE)
P_SetPlayerMobjState(player->mo, S_PLAY_EDGE);
P_SetMobjState(player->mo, S_PLAY_EDGE);
}
else if (player->panim == PA_EDGE)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
//
@ -4654,7 +4654,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
if (!player->spectator)
S_StartSound(player->mo, sfx_jump); // Play jump sound!
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
}
@ -4726,7 +4726,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
player->mo->momy = player->cmomy;
player->pflags |= (PF_SPINDOWN|PF_STARTDASH|PF_SPINNING);
player->dashspeed = player->mindash;
P_SetPlayerMobjState(player->mo, S_PLAY_SPINDASH);
P_SetMobjState(player->mo, S_PLAY_SPINDASH);
if (!player->spectator)
S_StartSound(player->mo, sfx_spndsh); // Make the rev sound!
}
@ -4736,7 +4736,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
if (player->speed > 5*player->mo->scale)
{
player->pflags &= ~PF_STARTDASH;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_spin);
break;
}
@ -4769,7 +4769,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|| !canstand) && !(player->pflags & (PF_SPINDOWN|PF_SPINNING)))
{
player->pflags |= (PF_SPINDOWN|PF_SPINNING);
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
if (!player->spectator)
S_StartSound(player->mo, sfx_spin);
}
@ -4785,12 +4785,12 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{
if (player->dashspeed)
{
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
P_InstaThrust(player->mo, player->mo->angle, (player->speed = FixedMul(player->dashspeed, player->mo->scale))); // catapult forward ho!!
}
else
{
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
player->pflags &= ~PF_SPINNING;
}
@ -4823,7 +4823,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{
mobj_t *bullet;
P_SetPlayerMobjState(player->mo, S_PLAY_FIRE);
P_SetMobjState(player->mo, S_PLAY_FIRE);
#define zpos(posmo) (posmo->z + (posmo->height - mobjinfo[player->revitem].height)/2)
if (lockon)
@ -4867,7 +4867,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
P_DoJump(player, false);
player->pflags &= ~PF_STARTJUMP;
player->mo->momz = FixedMul(player->mo->momz, 3*FRACUNIT/2); // NOT 1.5 times the jump height, but 2.25 times.
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
P_SetMobjState(player->mo, S_PLAY_TWINSPIN);
S_StartSound(player->mo, sfx_s3k8b);
}
else
@ -4893,7 +4893,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
}
player->mo->momx += player->cmomx;
player->mo->momy += player->cmomy;
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE);
P_SetMobjState(player->mo, S_PLAY_MELEE);
player->powers[pw_strong] = STR_MELEE;
S_StartSound(player->mo, sfx_s3k42);
}
@ -4917,7 +4917,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{
player->skidtime = 0;
player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
player->mo->momx = player->cmomx;
player->mo->momy = player->cmomy;
}
@ -4969,13 +4969,13 @@ void P_DoJumpShield(player_t *player)
#undef limitangle
#undef numangles
player->pflags &= ~PF_NOJUMPDAMAGE;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_s3k45);
}
else
{
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
S_StartSound(player->mo, sfx_wdjump);
}
}
@ -4992,9 +4992,9 @@ void P_DoBubbleBounce(player_t *player)
P_MobjCheckWater(player->mo);
P_DoJump(player, false);
if (player->charflags & SF_NOJUMPSPIN)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
else
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
player->pflags |= PF_THOKKED;
player->pflags &= ~PF_STARTJUMP;
player->secondjump = UINT8_MAX;
@ -5031,7 +5031,7 @@ void P_DoAbilityBounce(player_t *player, boolean changemomz)
}
S_StartSound(player->mo, sfx_boingf);
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE_LANDING);
P_SetMobjState(player->mo, S_PLAY_BOUNCE_LANDING);
player->pflags |= PF_BOUNCING|PF_THOKKED;
}
@ -5147,7 +5147,7 @@ static void P_DoTwinSpin(player_t *player)
player->pflags |= P_GetJumpFlags(player) | PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
P_SetMobjState(player->mo, S_PLAY_TWINSPIN);
player->powers[pw_strong] = STR_TWINSPIN;
}
@ -5224,7 +5224,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock
{
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonshield->x, lockonshield->y);
player->pflags &= ~PF_NOJUMPDAMAGE;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_s3k40);
player->homing = 3*TICRATE;
}
@ -5248,7 +5248,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock
player->mo->momx -= (player->mo->momx/3);
player->mo->momy -= (player->mo->momy/3);
player->pflags &= ~PF_NOJUMPDAMAGE;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_s3k44);
}
player->secondjump = 0;
@ -5261,7 +5261,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock
P_Thrust(player->mo, player->mo->angle, FixedMul(30*FRACUNIT - FixedSqrt(FixedDiv(player->speed, player->mo->scale)), player->mo->scale));
player->drawangle = player->mo->angle;
player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING);
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_s3k43);
default:
break;
@ -5324,9 +5324,9 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (player->panim != PA_RUN && player->panim != PA_WALK)
{
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
P_SetMobjState(player->mo, S_PLAY_FLOAT);
}
player->mo->momz = 0;
@ -5457,13 +5457,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok));
if (lockonthok)
{
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y);
player->homing = 3*TICRATE;
}
else
{
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
player->pflags &= ~PF_JUMPED;
player->mo->height = P_GetPlayerHeight(player);
}
@ -5500,7 +5500,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
; // Can't do anything if you're a fish out of water!
else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly]))
{
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
P_SetMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
@ -5533,7 +5533,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags |= PF_GLIDING|PF_THOKKED;
player->glidetime = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
P_SetMobjState(player->mo, S_PLAY_GLIDE);
if (playerspeed < glidespeed)
P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed);
player->pflags &= ~(PF_JUMPED|PF_SPINNING|PF_STARTDASH);
@ -5554,11 +5554,11 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
{
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD)
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
P_SetMobjState(player->mo, S_PLAY_DASH);
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
P_SetMobjState(player->mo, S_PLAY_FLOAT);
player->pflags |= PF_THOKKED;
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING);
player->secondjump = 1;
@ -5594,7 +5594,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
case CA_BOUNCE:
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
{
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE);
P_SetMobjState(player->mo, S_PLAY_BOUNCE);
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING);
player->pflags |= PF_THOKKED|PF_BOUNCING;
player->powers[pw_strong] = STR_BOUNCE;
@ -5684,7 +5684,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (!(player->mo->tracer->flags & MF_BOSS))
player->pflags &= ~PF_THOKKED;
P_SetPlayerMobjState(player->mo, S_PLAY_SPRING);
P_SetMobjState(player->mo, S_PLAY_SPRING);
player->pflags |= PF_NOJUMPDAMAGE;
}
}
@ -5732,7 +5732,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
else
player->secondjump = 2;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
}
// If letting go of the jump button while still on ascent, cut the jump height.
@ -5852,7 +5852,7 @@ static void P_2dMovement(player_t *player)
else if (player->exiting)
{
player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
player->skidtime = 0;
}
}
@ -5861,7 +5861,7 @@ static void P_2dMovement(player_t *player)
if (player->pflags & PF_SPINNING && !player->exiting)
{
player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
}
@ -6025,7 +6025,7 @@ static void P_3dMovement(player_t *player)
else if (player->exiting)
{
player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
player->skidtime = 0;
}
}
@ -6034,7 +6034,7 @@ static void P_3dMovement(player_t *player)
if (player->pflags & PF_SPINNING && !player->exiting)
{
player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
}
@ -6076,7 +6076,7 @@ static void P_3dMovement(player_t *player)
if (player->pflags & PF_SLIDING)
cmd->forwardmove = 0;
else if (onground && player->mo->state == states+S_PLAY_PAIN)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
player->aiming = cmd->aiming<<FRACBITS;
@ -6881,12 +6881,12 @@ static void P_DoNiGHTSCapsule(player_t *player)
if (player->mo->momx || player->mo->momy || player->mo->momz)
{
if (player->mo->state != &states[S_PLAY_NIGHTS_PULL])
P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_PULL);
P_SetMobjState(player->mo, S_PLAY_NIGHTS_PULL);
}
else if (player->mo->state != &states[S_PLAY_NIGHTS_ATTACK])
{
S_StartSound(player->mo, sfx_spin);
P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_ATTACK);
P_SetMobjState(player->mo, S_PLAY_NIGHTS_ATTACK);
}
}
else
@ -6894,7 +6894,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
if (!(player->pflags & PF_JUMPED) && !(player->pflags & PF_SPINNING))
player->pflags |= PF_JUMPED;
if (player->panim != PA_ROLL)
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
}
if (!(player->charflags & SF_NONIGHTSROTATION))
@ -7383,14 +7383,14 @@ static void P_NiGHTSMovement(player_t *player)
if (!(player->charflags & SF_NONIGHTSROTATION) && player->mo->momz)
{
if (player->mo->state != &states[S_PLAY_NIGHTS_DRILL])
P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_DRILL);
P_SetMobjState(player->mo, S_PLAY_NIGHTS_DRILL);
player->mo->spriteroll = ANGLE_90;
}
else
#endif
{
if (player->mo->state != &states[S_PLAY_NIGHTS_FLOAT])
P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_FLOAT);
P_SetMobjState(player->mo, S_PLAY_NIGHTS_FLOAT);
player->drawangle += ANGLE_22h;
}
@ -7726,7 +7726,7 @@ static void P_NiGHTSMovement(player_t *player)
}
if (player->mo->state != &states[flystate])
P_SetPlayerMobjState(player->mo, flystate);
P_SetMobjState(player->mo, flystate);
if (player->charflags & SF_NONIGHTSROTATION)
player->mo->spriteroll = 0;
@ -7998,13 +7998,13 @@ static void P_SkidStuff(player_t *player)
player->skidtime = 0;
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
player->pflags |= PF_THOKKED;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
}
// Get up and brush yourself off, idiot.
else if (player->glidetime > 15 || !(player->cmd.buttons & BT_JUMP))
{
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING);
P_SetMobjState(player->mo, S_PLAY_GLIDE_LANDING);
player->pflags |= PF_STASIS;
if (player->speed > FixedMul(player->runspeed, player->mo->scale))
player->skidtime += player->mo->tics;
@ -8049,7 +8049,7 @@ static void P_SkidStuff(player_t *player)
if (dang > ANGLE_157h)
{
if (player->mo->state-states != S_PLAY_SKID)
P_SetPlayerMobjState(player->mo, S_PLAY_SKID);
P_SetMobjState(player->mo, S_PLAY_SKID);
player->mo->tics = player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
S_StartSound(player->mo, sfx_skid);
}
@ -8281,63 +8281,63 @@ void P_MovePlayer(player_t *player)
{
// If the player is in dashmode, here's their peelout.
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD && player->panim == PA_RUN && !player->skidtime && (onground || ((player->charability == CA_FLOAT || player->charability == CA_SLOWFALL) && player->secondjump == 1) || player->powers[pw_super]))
P_SetPlayerMobjState (player->mo, S_PLAY_DASH);
P_SetMobjState (player->mo, S_PLAY_DASH);
// If the player is moving fast enough,
// break into a run!
else if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime
&& (onground || ((player->charability == CA_FLOAT || player->charability == CA_SLOWFALL) && player->secondjump == 1) || player->powers[pw_super]))
{
if (!onground)
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
P_SetMobjState(player->mo, S_PLAY_RUN);
}
// Floating at slow speeds has its own special animation.
else if ((((player->charability == CA_FLOAT || player->charability == CA_SLOWFALL) && player->secondjump == 1) || player->powers[pw_super]) && player->panim == PA_IDLE && !onground)
P_SetPlayerMobjState (player->mo, S_PLAY_FLOAT);
P_SetMobjState (player->mo, S_PLAY_FLOAT);
// Otherwise, just walk.
else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE)
P_SetPlayerMobjState (player->mo, S_PLAY_WALK);
P_SetMobjState (player->mo, S_PLAY_WALK);
}
// If your peelout animation is playing, and you're
// going too slow, switch back to the run.
if (player->charflags & SF_DASHMODE && player->panim == PA_DASH && player->dashmode < DASHMODE_THRESHOLD)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
P_SetMobjState(player->mo, S_PLAY_RUN);
// If your running animation is playing, and you're
// going too slow, switch back to the walking frames.
if (player->panim == PA_RUN && player->speed < runspd)
{
if (!onground && (((player->charability == CA_FLOAT || player->charability == CA_SLOWFALL) && player->secondjump == 1) || player->powers[pw_super]))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
P_SetMobjState(player->mo, S_PLAY_FLOAT);
else
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
}
// Correct floating when ending up on the ground.
if (onground)
{
if (player->mo->state-states == S_PLAY_FLOAT)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else if (player->mo->state-states == S_PLAY_FLOAT_RUN)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
P_SetMobjState(player->mo, S_PLAY_RUN);
}
// If Springing (or nojumpspinning), but travelling DOWNWARD, change back!
if ((player->panim == PA_SPRING && P_MobjFlip(player->mo)*player->mo->momz < 0)
|| ((((player->charflags & SF_NOJUMPSPIN) && (player->pflags & PF_JUMPED) && player->panim == PA_JUMP))
&& (P_MobjFlip(player->mo)*player->mo->momz < 0)))
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
// If doing an air animation but on the ground, change back!
else if (onground && (player->panim == PA_SPRING || player->panim == PA_FALL || player->panim == PA_RIDE || player->panim == PA_JUMP) && !player->mo->momz)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
// If you are stopped and are still walking, stand still!
if (!player->mo->momx && !player->mo->momy && !player->mo->momz && player->panim == PA_WALK)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
//////////////////
//GAMEPLAY STUFF//
@ -8349,18 +8349,18 @@ void P_MovePlayer(player_t *player)
{
player->pflags &= ~(PF_STARTJUMP|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY);
player->secondjump = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
}
if ((!(player->charability == CA_GLIDEANDCLIMB) || player->gotflag) // If you can't glide, then why the heck would you be gliding?
&& (player->pflags & PF_GLIDING || player->climbing))
{
if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
player->pflags &= ~PF_GLIDING;
player->glidetime = 0;
@ -8371,11 +8371,11 @@ void P_MovePlayer(player_t *player)
&& (player->pflags & PF_BOUNCING))
{
if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
player->pflags &= ~PF_BOUNCING;
}
@ -8492,18 +8492,18 @@ void P_MovePlayer(player_t *player)
{
P_ResetPlayer(player); // down, stop gliding.
if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else if (player->charflags & SF_MULTIABILITY)
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
else
{
player->pflags |= PF_THOKKED;
player->mo->momx >>= 1;
player->mo->momy >>= 1;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
}
}
}
@ -8520,23 +8520,23 @@ void P_MovePlayer(player_t *player)
P_ResetPlayer(player); // down, stop bouncing.
player->pflags |= PF_THOKKED;
if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else if (player->charflags & SF_MULTIABILITY)
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
else
{
player->mo->momx >>= 1;
player->mo->momy >>= 1;
player->mo->momz >>= 1;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
}
}
}
else if (player->mo->state-states == S_PLAY_BOUNCE)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
// If you're running fast enough, you can create splashes as you run in shallow water.
if (!player->climbing
@ -8583,11 +8583,11 @@ void P_MovePlayer(player_t *player)
|| player->mo->state-states == S_PLAY_FLY_TIRED)
{
if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
else
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
}
player->powers[pw_tailsfly] = 0;
@ -8621,7 +8621,7 @@ void P_MovePlayer(player_t *player)
if (P_MobjFlip(player->mo)*player->mo->momz < FixedMul(5*actionspd, player->mo->scale))
P_SetObjectMomZ(player->mo, actionspd/2, true);
P_SetPlayerMobjState(player->mo, player->mo->state->nextstate);
P_SetMobjState(player->mo, player->mo->state->nextstate);
player->fly1--;
}
@ -8649,7 +8649,7 @@ void P_MovePlayer(player_t *player)
{
// Tails-gets-tired Stuff
if (player->panim == PA_ABILITY && player->mo->state-states != S_PLAY_FLY_TIRED)
P_SetPlayerMobjState(player->mo, S_PLAY_FLY_TIRED);
P_SetMobjState(player->mo, S_PLAY_FLY_TIRED);
if (player->charability == CA_FLY && (leveltime % 10 == 0)
&& player->mo->state-states == S_PLAY_FLY_TIRED
@ -8766,7 +8766,7 @@ void P_MovePlayer(player_t *player)
// Make sure you're not teetering when you shouldn't be.
if (player->panim == PA_EDGE
&& (player->mo->momx || player->mo->momy || player->mo->momz))
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
// Check for teeter!
if (!(player->mo->momz || player->mo->momx || player->mo->momy) && !(player->mo->eflags & MFE_GOOWATER)
@ -8832,7 +8832,7 @@ void P_MovePlayer(player_t *player)
if (!atspinheight)
{
player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
}
else if (player->mo->ceilingz - player->mo->floorz < player->mo->height)
{
@ -9013,7 +9013,7 @@ static void P_DoRopeHang(player_t *player)
if (player->cmd.buttons & BT_SPIN && !(player->pflags & PF_STASIS)) // Drop off of the rope
{
player->pflags |= (P_GetJumpFlags(player)|PF_SPINDOWN);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
P_SetTarget(&player->mo->tracer, NULL);
player->powers[pw_carry] = CR_NONE;
@ -9022,7 +9022,7 @@ static void P_DoRopeHang(player_t *player)
}
if (player->mo->state-states != S_PLAY_RIDE)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
P_SetMobjState(player->mo, S_PLAY_RIDE);
// If not allowed to move, we're done here.
if (!speed)
@ -9078,7 +9078,7 @@ static void P_DoRopeHang(player_t *player)
if (player->mo->tracer->flags & MF_SLIDEME)
{
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetMobjState(player->mo, S_PLAY_JUMP);
}
P_SetTarget(&player->mo->tracer, NULL);
@ -11278,7 +11278,7 @@ static void P_MinecartThink(player_t *player)
if (player->mo->state-states != S_PLAY_STND)
{
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
player->mo->tics = -1;
}
@ -12056,7 +12056,7 @@ void P_PlayerThink(player_t *player)
{
P_DoZoomTube(player);
if (!(player->panim == PA_ROLL))
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
}
player->rmomx = player->rmomy = 0; // no actual momentum from your controls
P_ResetScore(player);
@ -12215,7 +12215,7 @@ void P_PlayerThink(player_t *player)
{
statenum_t stat = player->mo->state-states;
if (stat == S_PLAY_WAIT)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
else if (stat == S_PLAY_STND && player->mo->tics != -1)
player->mo->tics++;
}
@ -12242,7 +12242,7 @@ void P_PlayerThink(player_t *player)
else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && P_AproxDistance(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed, player->mo->scale)) // modified from player->runspeed/2 'cuz the skid was just TOO frequent ngl
{
if (player->mo->state-states != S_PLAY_SKID)
P_SetPlayerMobjState(player->mo, S_PLAY_SKID);
P_SetMobjState(player->mo, S_PLAY_SKID);
player->mo->tics = player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
if (P_IsLocalPlayer(player)) // the sound happens way more frequently now, so give co-op players' ears a brake...
@ -12422,7 +12422,7 @@ void P_PlayerThink(player_t *player)
if (!player->powers[pw_flashing])
{
if (player->mo->state != &states[S_PLAY_STND])
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
P_SetMobjState(player->mo, S_PLAY_STND);
else
player->mo->tics = 2;
}
@ -12786,7 +12786,7 @@ void P_PlayerAfterThink(player_t *player)
S_StartSound(NULL, sfx_wepchg);
if ((player->pflags & PF_SLIDING) && ((player->pflags & (PF_JUMPED|PF_NOJUMPDAMAGE)) != PF_JUMPED))
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
P_SetMobjState(player->mo, player->mo->info->painstate);
/* if (player->powers[pw_carry] == CR_NONE && player->mo->tracer && !player->homing)
P_SetTarget(&player->mo->tracer, NULL);
@ -12847,7 +12847,7 @@ void P_PlayerAfterThink(player_t *player)
if (player->powers[pw_carry] == CR_PLAYER)
{
if (player->mo->state-states != S_PLAY_RIDE)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
P_SetMobjState(player->mo, S_PLAY_RIDE);
if (tails->player && (tails->skin && ((skin_t *)(tails->skin))->sprites[SPR2_SWIM].numframes) && (tails->eflags & MFE_UNDERWATER))
tails->player->powers[pw_tailsfly] = 0;
}
@ -12872,7 +12872,7 @@ void P_PlayerAfterThink(player_t *player)
player->mo->momx = player->mo->momy = player->mo->momz = 0;
P_SetThingPosition(player->mo);
if (player->mo->state-states != S_PLAY_RIDE)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
P_SetMobjState(player->mo, S_PLAY_RIDE);
// Controllable missile
if (item->type == MT_BLACKEGGMAN_MISSILE)
@ -12993,7 +12993,7 @@ void P_PlayerAfterThink(player_t *player)
if (player->panim == PA_IDLE && (mo->momx || mo->momy))
{
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
P_SetMobjState(player->mo, S_PLAY_WALK);
}
if (player->panim == PA_WALK && mo->tics > walktics)
@ -13049,7 +13049,7 @@ void P_PlayerAfterThink(player_t *player)
P_KillMobj(ptera, player->mo, player->mo, 0);
P_SetObjectMomZ(player->mo, 12*FRACUNIT, false);
player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED;
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
P_SetMobjState(player->mo, S_PLAY_ROLL);
break;
}
@ -13070,7 +13070,7 @@ void P_PlayerAfterThink(player_t *player)
ptera->cvmem >>= 1;
if (player->mo->state-states != S_PLAY_FALL)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
P_SetMobjState(player->mo, S_PLAY_FALL);
break;
dropoff:

View file

@ -392,7 +392,7 @@ static void SetSkin(player_t *player, INT32 skinnum)
P_SetScale(player->mo, player->mo->scale);
player->mo->radius = radius;
P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
P_SetMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
}
}