Putting the swim animation checks in one place.

This commit is contained in:
toasterbabe 2016-07-16 14:45:22 +01:00
parent cc35a5e1c1
commit 226785dcd6
2 changed files with 7 additions and 12 deletions

View File

@ -167,6 +167,12 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
if ((state == S_PLAY_JUMP) && (player->charflags & SF_NOJUMPSPIN) && (P_MobjFlip(mobj)*mobj->momz < 0 || player->pflags & PF_THOKKED))
return P_SetPlayerMobjState(mobj, S_PLAY_FALL);
// Catch swimming versus flying
if (state == S_PLAY_FLY && player->mo->eflags & MFE_UNDERWATER)
return P_SetPlayerMobjState(player->mo, S_PLAY_SWIM);
else if (state == S_PLAY_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
return P_SetPlayerMobjState(player->mo, S_PLAY_FLY);
// Catch state changes for Super Sonic
if (player->powers[pw_super] && (player->charflags & SF_SUPERANIMS))
{

View File

@ -4111,10 +4111,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]))
{
if (player->mo->eflags & MFE_UNDERWATER)
P_SetPlayerMobjState(player->mo, S_PLAY_SWIM); // Change to the swimming animation
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
@ -6737,14 +6734,6 @@ static void P_MovePlayer(player_t *player)
if (player->panim != PA_ABILITY)
player->powers[pw_tailsfly] = 0;
if (player->charability == CA_FLY || player->charability == CA_SWIM) // Frustratingly has to remain seperate from the below block.
{
if (player->mo->state-states == S_PLAY_FLY && player->mo->eflags & MFE_UNDERWATER)
P_SetPlayerMobjState(player->mo, S_PLAY_SWIM); // Change to the swimming animation
else if (player->mo->state-states == S_PLAY_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
}
if (player->charability == CA_FLY || (player->charability == CA_SWIM && player->mo->eflags & MFE_UNDERWATER))
{
// Fly counter for Tails.