mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-16 09:02:06 +00:00
Add helper functions for player state checks
This commit is contained in:
parent
0ef2685b6d
commit
f3af152aa6
7 changed files with 92 additions and 83 deletions
|
@ -4578,9 +4578,9 @@ void F_TextPromptDrawer(void)
|
|||
players[j].powers[pw_nocontrol] = 1;\
|
||||
if (players[j].mo)\
|
||||
{\
|
||||
if (players[j].mo->state == states+S_PLAY_STND && players[j].mo->tics != -1)\
|
||||
if (P_IsPlayerInState(&players[j], S_PLAY_STND) && players[j].mo->tics != -1)\
|
||||
players[j].mo->tics++;\
|
||||
else if (players[j].mo->state == states+S_PLAY_WAIT)\
|
||||
else if (P_IsPlayerInState(&players[j], S_PLAY_WAIT))\
|
||||
P_SetMobjState(players[j].mo, S_PLAY_STND);\
|
||||
}\
|
||||
}
|
||||
|
|
|
@ -1819,7 +1819,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
if (!player->climbing)
|
||||
{
|
||||
if (player->bot && player->bot != BOT_MPAI && toucher->state-states != S_PLAY_GASP)
|
||||
if (player->bot && player->bot != BOT_MPAI && !P_IsPlayerInState(player, S_PLAY_GASP))
|
||||
S_StartSound(toucher, special->info->deathsound); // Force it to play a sound for bots
|
||||
P_SetMobjState(toucher, S_PLAY_GASP);
|
||||
P_ResetPlayer(player);
|
||||
|
|
|
@ -135,6 +135,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
|
|||
void P_SlideCameraMove(camera_t *thiscam);
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
pflags_t P_GetJumpFlags(player_t *player);
|
||||
boolean P_IsPlayerInState(player_t *player, statenum_t state);
|
||||
boolean P_IsPlayerInSuperTransformationState(player_t *player);
|
||||
boolean P_IsPlayerInNightsTransformationState(player_t *player);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
|
|
|
@ -3040,7 +3040,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
|||
if (tmfloorz > oldfloorz+thing->height)
|
||||
return true;
|
||||
|
||||
bouncing = thing->player && thing->state-states == S_PLAY_BOUNCE_LANDING && P_IsObjectOnGround(thing);
|
||||
bouncing = thing->player && P_IsPlayerInState(thing->player, S_PLAY_BOUNCE_LANDING) && P_IsObjectOnGround(thing);
|
||||
|
||||
if ((onfloor || bouncing) && !(thing->flags & MF_NOGRAVITY) && floormoved)
|
||||
{
|
||||
|
|
|
@ -294,11 +294,11 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
if (state == S_PLAY_JUMP)
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_WALK)
|
||||
if (P_IsPlayerInState(player, S_PLAY_WALK))
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_FLOAT);
|
||||
return true;
|
||||
}
|
||||
else if (player->mo->state-states == S_PLAY_FLOAT && state == S_PLAY_STND)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_FLOAT) && state == S_PLAY_STND)
|
||||
return true;
|
||||
}
|
||||
// You were in pain state after taking a hit, and you're moving out of pain state now?
|
||||
|
@ -3720,7 +3720,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
// momentum movement
|
||||
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
|
||||
|
||||
if (mobj->state-states == S_PLAY_BOUNCE_LANDING)
|
||||
if (P_IsPlayerInState(mobj->player, S_PLAY_BOUNCE_LANDING))
|
||||
goto animonly; // no need for checkposition - doesn't move at ALL
|
||||
|
||||
// Zoom tube
|
||||
|
|
|
@ -4677,7 +4677,7 @@ static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end)
|
|||
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY);
|
||||
player->climbing = 0;
|
||||
|
||||
if (player->mo->state-states != S_PLAY_ROLL)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_ROLL))
|
||||
{
|
||||
P_SetMobjState(player->mo, S_PLAY_ROLL);
|
||||
S_StartSound(player->mo, sfx_spin);
|
||||
|
|
156
src/p_user.c
156
src/p_user.c
|
@ -967,6 +967,22 @@ pflags_t P_GetJumpFlags(player_t *player)
|
|||
return (PF_JUMPED|PF_NOJUMPDAMAGE);
|
||||
return PF_JUMPED;
|
||||
}
|
||||
boolean P_IsPlayerInState(player_t *player, statenum_t state)
|
||||
{
|
||||
return (player->mo->state == &states[state]);
|
||||
}
|
||||
|
||||
boolean P_IsPlayerInSuperTransformationState(player_t *player)
|
||||
{
|
||||
statenum_t state = player->mo->state - states;
|
||||
return (state >= S_PLAY_SUPER_TRANS1 && state <= S_PLAY_SUPER_TRANS6);
|
||||
}
|
||||
|
||||
boolean P_IsPlayerInNightsTransformationState(player_t *player)
|
||||
{
|
||||
statenum_t state = player->mo->state - states;
|
||||
return (state >= S_PLAY_NIGHTS_TRANS1 && state <= S_PLAY_NIGHTS_TRANS6);
|
||||
}
|
||||
|
||||
//
|
||||
// P_PlayerInPain
|
||||
|
@ -980,7 +996,7 @@ boolean P_PlayerInPain(player_t *player)
|
|||
if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing])
|
||||
return true;
|
||||
|
||||
if (player->mo->state == &states[S_PLAY_STUN])
|
||||
if (P_IsPlayerInState(player, S_PLAY_STUN))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -2380,7 +2396,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
|
||||
if (player->pflags & PF_BOUNCING)
|
||||
{
|
||||
if (dorollstuff && player->mo->state-states != S_PLAY_BOUNCE_LANDING)
|
||||
if (dorollstuff && !P_IsPlayerInState(player, S_PLAY_BOUNCE_LANDING))
|
||||
{
|
||||
P_MobjCheckWater(player->mo);
|
||||
player->mo->momz *= -1;
|
||||
|
@ -2417,9 +2433,9 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
player->pflags &= ~PF_GLIDING;
|
||||
}
|
||||
else if (player->charability == CA_GLIDEANDCLIMB && player->pflags & PF_THOKKED && !(player->pflags & (PF_JUMPED|PF_SHIELDABILITY))
|
||||
&& (player->mo->floorz != player->mo->watertop) && player->mo->state-states == S_PLAY_FALL)
|
||||
&& (player->mo->floorz != player->mo->watertop) && P_IsPlayerInState(player, S_PLAY_FALL))
|
||||
{
|
||||
if (player->mo->state-states != S_PLAY_GLIDE_LANDING)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING))
|
||||
{
|
||||
P_ResetPlayer(player);
|
||||
P_SetMobjState(player->mo, S_PLAY_GLIDE_LANDING);
|
||||
|
@ -2440,7 +2456,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
else if (player->charability2 == CA2_MELEE
|
||||
&& ((player->panim == PA_ABILITY2) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY && player->cmd.buttons & (BT_JUMP|BT_SPIN))))
|
||||
{
|
||||
if (player->mo->state-states != S_PLAY_MELEE_LANDING)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_MELEE_LANDING))
|
||||
{
|
||||
mobjtype_t type = player->revitem;
|
||||
P_SetMobjState(player->mo, S_PLAY_MELEE_LANDING);
|
||||
|
@ -2488,7 +2504,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (player->charability == CA_GLIDEANDCLIMB && (player->mo->state-states == S_PLAY_GLIDE_LANDING))
|
||||
else if (player->charability == CA_GLIDEANDCLIMB && (P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING)))
|
||||
;
|
||||
else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2)
|
||||
;
|
||||
|
@ -2511,10 +2527,10 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD && player->panim != PA_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))
|
||||
&& (player->panim != PA_RUN || P_IsPlayerInState(player, S_PLAY_FLOAT_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))
|
||||
&& (player->panim != PA_WALK || P_IsPlayerInState(player, S_PLAY_FLOAT)))
|
||||
P_SetMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
|
||||
P_SetMobjState(player->mo, S_PLAY_STND);
|
||||
|
@ -2524,10 +2540,10 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
|||
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD && player->panim != PA_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))
|
||||
&& (player->panim != PA_RUN || P_IsPlayerInState(player, S_PLAY_FLOAT_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))
|
||||
&& (player->panim != PA_WALK || P_IsPlayerInState(player, S_PLAY_FLOAT)))
|
||||
P_SetMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
|
||||
P_SetMobjState(player->mo, S_PLAY_STND);
|
||||
|
@ -3701,9 +3717,9 @@ static void P_DoClimbing(player_t *player)
|
|||
climb = false;
|
||||
|
||||
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
|
||||
&& player->mo->state-states != S_PLAY_CLIMB)
|
||||
&& !P_IsPlayerInState(player, 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)
|
||||
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && !P_IsPlayerInState(player, S_PLAY_CLING))
|
||||
P_SetMobjState(player->mo, S_PLAY_CLING);
|
||||
|
||||
if (!floorclimb)
|
||||
|
@ -3736,9 +3752,9 @@ static void P_DoClimbing(player_t *player)
|
|||
climb = false;
|
||||
|
||||
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
|
||||
&& player->mo->state-states != S_PLAY_CLIMB)
|
||||
&& !P_IsPlayerInState(player, 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)
|
||||
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && !P_IsPlayerInState(player, S_PLAY_CLING))
|
||||
P_SetMobjState(player->mo, S_PLAY_CLING);
|
||||
|
||||
if (cmd->buttons & BT_SPIN && !(player->pflags & PF_JUMPSTASIS))
|
||||
|
@ -4401,7 +4417,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
|
||||
G_GhostAddColor(GHC_SUPER);
|
||||
|
||||
if (player->mo->state == &states[S_PLAY_SUPER_TRANS6]) // stop here for now
|
||||
if (P_IsPlayerInState(player, S_PLAY_SUPER_TRANS6)) // stop here for now
|
||||
return;
|
||||
|
||||
// Deplete one ring every second while super
|
||||
|
@ -4686,7 +4702,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
boolean canstand = true; // can we stand on the ground? (mostly relevant for slopes)
|
||||
if (player->pflags & PF_STASIS
|
||||
&& (player->pflags & PF_JUMPSTASIS || player->mo->state-states != S_PLAY_GLIDE_LANDING))
|
||||
&& (player->pflags & PF_JUMPSTASIS || !P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING)))
|
||||
return;
|
||||
|
||||
if (cmd->buttons & BT_SPIN)
|
||||
|
@ -4706,7 +4722,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
case CA2_SPINDASH: // Spinning and Spindashing
|
||||
// Start revving
|
||||
if ((cmd->buttons & BT_SPIN) && (player->speed < FixedMul(5<<FRACBITS, player->mo->scale) || player->mo->state - states == S_PLAY_GLIDE_LANDING)
|
||||
if ((cmd->buttons & BT_SPIN) && (player->speed < FixedMul(5<<FRACBITS, player->mo->scale) || P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING))
|
||||
&& !player->mo->momz && onground && !(player->pflags & (PF_SPINDOWN|PF_SPINNING))
|
||||
&& canstand)
|
||||
{
|
||||
|
@ -4996,7 +5012,7 @@ void P_DoBubbleBounce(player_t *player)
|
|||
//
|
||||
void P_DoAbilityBounce(player_t *player, boolean changemomz)
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_BOUNCE_LANDING)
|
||||
if (P_IsPlayerInState(player, S_PLAY_BOUNCE_LANDING))
|
||||
return;
|
||||
|
||||
if (changemomz)
|
||||
|
@ -6072,7 +6088,7 @@ static void P_3dMovement(player_t *player)
|
|||
// When sliding, don't allow forward/back
|
||||
if (player->pflags & PF_SLIDING)
|
||||
cmd->forwardmove = 0;
|
||||
else if (onground && player->mo->state == states+S_PLAY_PAIN)
|
||||
else if (onground && P_IsPlayerInState(player, S_PLAY_PAIN))
|
||||
P_SetMobjState(player->mo, S_PLAY_WALK);
|
||||
|
||||
player->aiming = cmd->aiming<<FRACBITS;
|
||||
|
@ -6125,7 +6141,7 @@ static void P_3dMovement(player_t *player)
|
|||
{
|
||||
if (player->pflags & PF_BOUNCING)
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_BOUNCE_LANDING)
|
||||
if (P_IsPlayerInState(player, S_PLAY_BOUNCE_LANDING))
|
||||
{
|
||||
thrustfactor = player->thrustfactor*8;
|
||||
acceleration = player->accelstart/8 + (FixedDiv(player->speed, player->mo->scale)>>FRACBITS) * player->acceleration/8;
|
||||
|
@ -6878,10 +6894,10 @@ 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])
|
||||
if (!P_IsPlayerInState(player, S_PLAY_NIGHTS_PULL))
|
||||
P_SetMobjState(player->mo, S_PLAY_NIGHTS_PULL);
|
||||
}
|
||||
else if (player->mo->state != &states[S_PLAY_NIGHTS_ATTACK])
|
||||
else if (!P_IsPlayerInState(player, S_PLAY_NIGHTS_ATTACK))
|
||||
{
|
||||
S_StartSound(player->mo, sfx_spin);
|
||||
P_SetMobjState(player->mo, S_PLAY_NIGHTS_ATTACK);
|
||||
|
@ -6897,7 +6913,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
|
||||
if (!(player->charflags & SF_NONIGHTSROTATION))
|
||||
{
|
||||
if ((player->mo->state == &states[S_PLAY_NIGHTS_PULL])
|
||||
if ((P_IsPlayerInState(player, S_PLAY_NIGHTS_PULL))
|
||||
&& (player->mo->sprite2 == SPR2_NPUL))
|
||||
player->mo->spriteroll -= ANG30;
|
||||
else
|
||||
|
@ -7212,15 +7228,11 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
if (playeringame[i] /*&& players[i].powers[pw_carry] == CR_NIGHTSMODE*/
|
||||
&& (players[i].capsule && players[i].capsule->reactiontime))
|
||||
capsule = true;
|
||||
if (!capsule
|
||||
&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
&& !player->exiting)
|
||||
if (!capsule && !P_IsPlayerInNightsTransformationState(player) && !player->exiting)
|
||||
player->nightstime--;
|
||||
}
|
||||
else if (!(gametyperules & GTR_RACE)
|
||||
&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
&& !P_IsPlayerInNightsTransformationState(player)
|
||||
&& !(player->capsule && player->capsule->reactiontime)
|
||||
&& !player->exiting)
|
||||
player->nightstime--;
|
||||
|
@ -7360,8 +7372,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
if (P_IsPlayerInNightsTransformationState(player))
|
||||
{
|
||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||
player->mo->spriteroll = 0;
|
||||
|
@ -7380,14 +7391,14 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
#if 0//def ROTSPRITE
|
||||
if (!(player->charflags & SF_NONIGHTSROTATION) && player->mo->momz)
|
||||
{
|
||||
if (player->mo->state != &states[S_PLAY_NIGHTS_DRILL])
|
||||
if (!P_IsPlayerInState(player, 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])
|
||||
if (!P_IsPlayerInState(player, S_PLAY_NIGHTS_FLOAT))
|
||||
P_SetMobjState(player->mo, S_PLAY_NIGHTS_FLOAT);
|
||||
player->drawangle += ANGLE_22h;
|
||||
}
|
||||
|
@ -8019,7 +8030,7 @@ static void P_SkidStuff(player_t *player)
|
|||
// Spawn a particle every 3 tics.
|
||||
if (!(player->skidtime % 3))
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_GLIDE_LANDING)
|
||||
if (P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING))
|
||||
P_SpawnSkidDust(player, player->mo->radius, true);
|
||||
else
|
||||
P_SpawnSkidDust(player, 0, false);
|
||||
|
@ -8039,7 +8050,7 @@ static void P_SkidStuff(player_t *player)
|
|||
// If your push angle is more than this close to a full 180 degrees, trigger a skid.
|
||||
if (dang > ANGLE_157h)
|
||||
{
|
||||
if (player->mo->state-states != S_PLAY_SKID)
|
||||
if (!P_IsPlayerInState(player, 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);
|
||||
|
@ -8064,7 +8075,7 @@ void P_MovePlayer(player_t *player)
|
|||
|
||||
fixed_t runspd;
|
||||
|
||||
if (player->mo->state >= &states[S_PLAY_SUPER_TRANS1] && player->mo->state <= &states[S_PLAY_SUPER_TRANS6])
|
||||
if (P_IsPlayerInSuperTransformationState(player))
|
||||
{
|
||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||
return;
|
||||
|
@ -8085,7 +8096,7 @@ void P_MovePlayer(player_t *player)
|
|||
if ((player->powers[pw_carry] == CR_BRAKGOOP)
|
||||
|| (player->pflags & PF_GLIDING && player->skidtime)
|
||||
|| (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2)
|
||||
|| (player->charability2 == CA2_MELEE && player->mo->state-states == S_PLAY_MELEE_LANDING))
|
||||
|| (player->charability2 == CA2_MELEE && P_IsPlayerInState(player, S_PLAY_MELEE_LANDING)))
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
else if (player->powers[pw_nocontrol])
|
||||
{
|
||||
|
@ -8094,7 +8105,7 @@ void P_MovePlayer(player_t *player)
|
|||
player->pflags |= PF_JUMPSTASIS;
|
||||
}
|
||||
|
||||
if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)
|
||||
if (player->charability == CA_GLIDEANDCLIMB && P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING))
|
||||
{
|
||||
player->pflags |= PF_STASIS;
|
||||
}
|
||||
|
@ -8312,9 +8323,9 @@ void P_MovePlayer(player_t *player)
|
|||
// Correct floating when ending up on the ground.
|
||||
if (onground)
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_FLOAT)
|
||||
if (P_IsPlayerInState(player, S_PLAY_FLOAT))
|
||||
P_SetMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (player->mo->state-states == S_PLAY_FLOAT_RUN)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_FLOAT_RUN))
|
||||
P_SetMobjState(player->mo, S_PLAY_RUN);
|
||||
}
|
||||
|
||||
|
@ -8380,7 +8391,7 @@ void P_MovePlayer(player_t *player)
|
|||
fixed_t glidespeed = player->actionspd;
|
||||
fixed_t momx = mo->momx - player->cmomx, momy = mo->momy - player->cmomy;
|
||||
angle_t angle, moveangle = R_PointToAngle2(0, 0, momx, momy);
|
||||
boolean swimming = mo->state - states == S_PLAY_SWIM;
|
||||
boolean swimming = P_IsPlayerInState(player, S_PLAY_SWIM);
|
||||
boolean in2d = mo->flags2 & MF2_TWOD || twodlevel;
|
||||
|
||||
if (player->powers[pw_super] || player->powers[pw_sneakers])
|
||||
|
@ -8527,7 +8538,7 @@ void P_MovePlayer(player_t *player)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (player->mo->state-states == S_PLAY_BOUNCE)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_BOUNCE))
|
||||
P_SetMobjState(player->mo, S_PLAY_FALL);
|
||||
|
||||
// If you're running fast enough, you can create splashes as you run in shallow water.
|
||||
|
@ -8571,7 +8582,7 @@ void P_MovePlayer(player_t *player)
|
|||
if (!(player->charability == CA_FLY || player->charability == CA_SWIM)) // why are you flying when you cannot fly?!
|
||||
{
|
||||
if (player->powers[pw_tailsfly]
|
||||
|| player->mo->state-states == S_PLAY_FLY_TIRED)
|
||||
|| P_IsPlayerInState(player, S_PLAY_FLY_TIRED))
|
||||
{
|
||||
if (onground)
|
||||
P_SetMobjState(player->mo, S_PLAY_WALK);
|
||||
|
@ -8639,11 +8650,11 @@ void P_MovePlayer(player_t *player)
|
|||
else
|
||||
{
|
||||
// Tails-gets-tired Stuff
|
||||
if (player->panim == PA_ABILITY && player->mo->state-states != S_PLAY_FLY_TIRED)
|
||||
if (player->panim == PA_ABILITY && !P_IsPlayerInState(player, 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
|
||||
&& P_IsPlayerInState(player, S_PLAY_FLY_TIRED)
|
||||
&& !(player->mo->eflags & MFE_UNDERWATER)
|
||||
&& !player->spectator)
|
||||
S_StartSound(player->mo, sfx_pudpud);
|
||||
|
@ -8741,7 +8752,7 @@ void P_MovePlayer(player_t *player)
|
|||
}
|
||||
// Otherwise, face the direction you're travelling.
|
||||
else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_DASH || player->panim == PA_ROLL || player->panim == PA_JUMP
|
||||
|| (player->panim == PA_ABILITY && player->mo->state-states == S_PLAY_GLIDE))
|
||||
|| (player->panim == PA_ABILITY && P_IsPlayerInState(player, S_PLAY_GLIDE)))
|
||||
player->mo->angle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy);
|
||||
|
||||
// Update the local angle control.
|
||||
|
@ -9015,7 +9026,7 @@ static void P_DoRopeHang(player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->mo->state-states != S_PLAY_RIDE)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_RIDE))
|
||||
P_SetMobjState(player->mo, S_PLAY_RIDE);
|
||||
|
||||
// If not allowed to move, we're done here.
|
||||
|
@ -9952,9 +9963,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
&& !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)
|
||||
&& !(twodlevel || (mo->flags2 & MF2_TWOD)))
|
||||
sign = mo->target;
|
||||
else if ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6]))
|
||||
else if (player->powers[pw_carry] == CR_NIGHTSMODE && !P_IsPlayerInNightsTransformationState(player))
|
||||
{
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
return true;
|
||||
|
@ -11271,7 +11280,7 @@ static void P_MinecartThink(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->mo->state-states != S_PLAY_STND)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_STND))
|
||||
{
|
||||
P_SetMobjState(player->mo, S_PLAY_STND);
|
||||
player->mo->tics = -1;
|
||||
|
@ -11349,12 +11358,12 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
}
|
||||
else if (player->panim == PA_PAIN)
|
||||
backwards /= 16;
|
||||
else if (player->mo->state-states == S_PLAY_GASP)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_GASP))
|
||||
{
|
||||
backwards /= 16;
|
||||
zoffs += 12*FRACUNIT;
|
||||
}
|
||||
else if (player->mo->state-states == S_PLAY_EDGE)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_EDGE))
|
||||
{
|
||||
backwards /= 16;
|
||||
zoffs = 3*FRACUNIT;
|
||||
|
@ -11383,13 +11392,13 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
}
|
||||
else if (player->panim == PA_SPRING || player->panim == PA_JUMP)
|
||||
chosenstate = S_TAILSOVERLAY_MINUS60DEGREES;
|
||||
else if (player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
|
||||
else if (player->panim == PA_FALL || P_IsPlayerInState(player, S_PLAY_RIDE))
|
||||
chosenstate = S_TAILSOVERLAY_PLUS60DEGREES;
|
||||
else if (player->panim == PA_PAIN)
|
||||
chosenstate = S_TAILSOVERLAY_PAIN;
|
||||
else if (player->mo->state-states == S_PLAY_GASP)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_GASP))
|
||||
chosenstate = S_TAILSOVERLAY_GASP;
|
||||
else if (player->mo->state-states == S_PLAY_EDGE)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_EDGE))
|
||||
chosenstate = S_TAILSOVERLAY_EDGE;
|
||||
else if (player->panim == PA_DASH)
|
||||
chosenstate = S_TAILSOVERLAY_DASH;
|
||||
|
@ -11397,7 +11406,7 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
chosenstate = S_TAILSOVERLAY_RUN;
|
||||
else if (player->panim == PA_WALK)
|
||||
{
|
||||
if (!smilesonground || player->mo->state-states == S_PLAY_SKID)
|
||||
if (!smilesonground || P_IsPlayerInState(player, S_PLAY_SKID))
|
||||
chosenstate = S_TAILSOVERLAY_PLUS30DEGREES;
|
||||
else if (player->speed >= FixedMul(player->runspeed/2, player->mo->scale))
|
||||
chosenstate = S_TAILSOVERLAY_0DEGREES;
|
||||
|
@ -11439,7 +11448,7 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
#endif
|
||||
|
||||
// animation...
|
||||
if (player->panim == PA_SPRING || player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
|
||||
if (player->panim == PA_SPRING || player->panim == PA_FALL || P_IsPlayerInState(player, S_PLAY_RIDE))
|
||||
{
|
||||
if (FixedDiv(abs(player->mo->momz), player->mo->scale) < 20<<FRACBITS)
|
||||
ticnum = 2;
|
||||
|
@ -11448,7 +11457,7 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
}
|
||||
else if (player->panim == PA_PAIN)
|
||||
ticnum = 2;
|
||||
else if (player->mo->state-states == S_PLAY_GASP)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_GASP))
|
||||
tails->tics = -1;
|
||||
else if (player->mo->sprite2 == SPR2_TIRE)
|
||||
ticnum = (doswim ? 2 : 4);
|
||||
|
@ -12211,10 +12220,9 @@ void P_PlayerThink(player_t *player)
|
|||
diff = InvAngle(diff);
|
||||
if (diff > ANG10/2)
|
||||
{
|
||||
statenum_t stat = player->mo->state-states;
|
||||
if (stat == S_PLAY_WAIT)
|
||||
if (P_IsPlayerInState(player, S_PLAY_WAIT))
|
||||
P_SetMobjState(player->mo, S_PLAY_STND);
|
||||
else if (stat == S_PLAY_STND && player->mo->tics != -1)
|
||||
else if (P_IsPlayerInState(player, S_PLAY_STND) && player->mo->tics != -1)
|
||||
player->mo->tics++;
|
||||
}
|
||||
}
|
||||
|
@ -12239,7 +12247,7 @@ void P_PlayerThink(player_t *player)
|
|||
// fake skidding! see P_SkidStuff for reference on conditionals
|
||||
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)
|
||||
if (!P_IsPlayerInState(player, 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;
|
||||
|
||||
|
@ -12416,16 +12424,14 @@ void P_PlayerThink(player_t *player)
|
|||
player->stronganim = 0;
|
||||
|
||||
//pw_super acts as a timer now
|
||||
if (player->powers[pw_super]
|
||||
&& (player->mo->state < &states[S_PLAY_SUPER_TRANS1]
|
||||
|| player->mo->state > &states[S_PLAY_SUPER_TRANS6]))
|
||||
if (player->powers[pw_super] && !P_IsPlayerInSuperTransformationState(player))
|
||||
player->powers[pw_super]++;
|
||||
|
||||
if (player->powers[pw_carry] == CR_BRAKGOOP)
|
||||
{
|
||||
if (!player->powers[pw_flashing])
|
||||
{
|
||||
if (player->mo->state != &states[S_PLAY_STND])
|
||||
if (!P_IsPlayerInState(player, S_PLAY_STND))
|
||||
P_SetMobjState(player->mo, S_PLAY_STND);
|
||||
else
|
||||
player->mo->tics = 2;
|
||||
|
@ -12850,7 +12856,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
|
||||
if (player->powers[pw_carry] == CR_PLAYER)
|
||||
{
|
||||
if (player->mo->state-states != S_PLAY_RIDE)
|
||||
if (!P_IsPlayerInState(player, 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;
|
||||
|
@ -12875,7 +12881,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
player->mo->z = item->z - FixedDiv(player->mo->height, 3*FRACUNIT/2);
|
||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||
P_SetThingPosition(player->mo);
|
||||
if (player->mo->state-states != S_PLAY_RIDE)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_RIDE))
|
||||
P_SetMobjState(player->mo, S_PLAY_RIDE);
|
||||
|
||||
// Controllable missile
|
||||
|
@ -13073,7 +13079,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
ptera->waterbottom >>= 1;
|
||||
ptera->cvmem >>= 1;
|
||||
|
||||
if (player->mo->state-states != S_PLAY_FALL)
|
||||
if (!P_IsPlayerInState(player, S_PLAY_FALL))
|
||||
P_SetMobjState(player->mo, S_PLAY_FALL);
|
||||
break;
|
||||
|
||||
|
@ -13219,9 +13225,9 @@ boolean P_PlayerCanEnterSpinGaps(player_t *player)
|
|||
return false;
|
||||
|
||||
return ((player->pflags & (PF_SPINNING|PF_SLIDING|PF_GLIDING)) // players who are spinning, sliding, or gliding
|
||||
|| (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) // players who are landing from a glide
|
||||
|| (player->charability == CA_GLIDEANDCLIMB && P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING)) // players who are landing from a glide
|
||||
|| ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)
|
||||
&& player->dashmode >= DASHMODE_THRESHOLD && player->mo->state-states == S_PLAY_DASH) // machine players in dashmode
|
||||
&& player->dashmode >= DASHMODE_THRESHOLD && P_IsPlayerInState(player, S_PLAY_DASH)) // machine players in dashmode
|
||||
|| JUMPCURLED(player)); // players who are jumpcurled, but only if they would normally jump that way
|
||||
}
|
||||
|
||||
|
@ -13231,11 +13237,11 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player)
|
|||
return ((player->pflags & (PF_SPINNING|PF_SLIDING|PF_GLIDING))
|
||||
|| (player->mo->state == &states[player->mo->info->painstate])
|
||||
|| (player->panim == PA_ROLL)
|
||||
|| ((player->powers[pw_tailsfly] || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED))
|
||||
|| ((player->powers[pw_tailsfly] || (player->charability == CA_FLY && P_IsPlayerInState(player, S_PLAY_FLY_TIRED)))
|
||||
&& !(player->charflags & SF_NOJUMPSPIN))
|
||||
|| (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)
|
||||
|| (player->charability == CA_GLIDEANDCLIMB && P_IsPlayerInState(player, S_PLAY_GLIDE_LANDING))
|
||||
|| ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)
|
||||
&& player->dashmode >= DASHMODE_THRESHOLD && player->mo->state-states == S_PLAY_DASH)
|
||||
&& player->dashmode >= DASHMODE_THRESHOLD && P_IsPlayerInState(player, S_PLAY_DASH))
|
||||
|| JUMPCURLED(player));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue