Handle player state is P_MobjSetState

This commit is contained in:
Gustaf Alhäll 2023-12-23 13:45:16 +01:00
parent 7893d08407
commit ddba6e80f7
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD
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

@ -9780,7 +9780,7 @@ void A_SetObjectState(mobj_t *actor)
if (!target->player)
P_SetMobjState(target, locvar1);
else
P_SetPlayerMobjState(target, locvar1);
P_SetMobjState(target, locvar1);
}
}
@ -13609,7 +13609,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)
{
@ -13632,7 +13632,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

@ -526,7 +526,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;
@ -1246,7 +1246,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;
@ -1553,7 +1553,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;
@ -1604,7 +1604,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;
@ -1640,7 +1640,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;
@ -1719,7 +1719,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;
@ -1780,7 +1780,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);
}
@ -1847,7 +1847,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);
@ -3059,9 +3059,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
@ -3115,7 +3115,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;
@ -3336,7 +3336,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);
@ -3410,7 +3410,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

@ -296,7 +296,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

@ -177,7 +177,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
}
}
@ -188,7 +188,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;
@ -514,10 +514,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
P_SetPlayerMobjState(mobj, state);
if (recursion++) // if recursion detected,
memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table
@ -1648,7 +1646,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;
}
@ -2974,7 +2972,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
@ -3957,7 +3955,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;
@ -7549,7 +7547,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;
}
@ -11771,9 +11769,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

@ -694,7 +694,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))
@ -948,7 +948,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)
@ -994,7 +994,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--;
@ -1345,7 +1345,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;
@ -1398,7 +1398,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())
@ -2265,12 +2265,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;
@ -2359,7 +2359,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);
}
}
@ -2368,7 +2368,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;
}
@ -2381,7 +2381,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;
@ -2402,7 +2402,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;
@ -2465,28 +2465,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);
}
}
@ -2516,7 +2516,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;
}
@ -3648,9 +3648,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)
{
@ -3665,14 +3665,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);
}
}
@ -3683,15 +3683,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));
}
@ -3707,12 +3707,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);
}
}
@ -4074,10 +4074,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);
}
//
@ -4602,7 +4602,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);
}
}
@ -4672,7 +4672,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!
}
@ -4682,7 +4682,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;
}
@ -4715,7 +4715,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);
}
@ -4731,12 +4731,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;
}
@ -4768,7 +4768,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)
@ -4812,7 +4812,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
@ -4838,7 +4838,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);
}
@ -4862,7 +4862,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;
}
@ -4911,13 +4911,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);
}
}
@ -4934,9 +4934,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;
@ -4973,7 +4973,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;
}
@ -5086,7 +5086,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;
}
@ -5160,7 +5160,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;
}
@ -5184,7 +5184,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;
@ -5197,7 +5197,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;
@ -5259,9 +5259,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;
@ -5392,13 +5392,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);
}
@ -5435,7 +5435,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
@ -5468,7 +5468,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);
@ -5489,11 +5489,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;
@ -5529,7 +5529,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;
@ -5619,7 +5619,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;
}
}
@ -5667,7 +5667,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.
@ -5787,7 +5787,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;
}
}
@ -5796,7 +5796,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);
}
}
@ -5960,7 +5960,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;
}
}
@ -5969,7 +5969,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);
}
}
@ -6011,7 +6011,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;
@ -6816,12 +6816,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
@ -6829,7 +6829,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))
@ -7308,14 +7308,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;
}
@ -7639,7 +7639,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;
@ -7905,13 +7905,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;
@ -7956,7 +7956,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);
}
@ -8188,63 +8188,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//
@ -8256,18 +8256,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;
@ -8278,11 +8278,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;
}
@ -8399,18 +8399,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);
}
}
}
@ -8427,23 +8427,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
@ -8487,11 +8487,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;
@ -8525,7 +8525,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--;
}
@ -8553,7 +8553,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
@ -8670,7 +8670,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)
@ -8736,7 +8736,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)
{
@ -8917,7 +8917,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;
@ -8926,7 +8926,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)
@ -8982,7 +8982,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);
@ -11180,7 +11180,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;
}
@ -11958,7 +11958,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);
@ -12117,7 +12117,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++;
}
@ -12144,7 +12144,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...
@ -12321,7 +12321,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;
}
@ -12682,7 +12682,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);
@ -12743,7 +12743,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;
}
@ -12768,7 +12768,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)
@ -12889,7 +12889,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)
@ -12945,7 +12945,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;
}
@ -12966,7 +12966,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
}
}