From b845fdb5d5052e9e52eb2e799dc781ac888338db Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 28 Apr 2013 02:31:34 +0000 Subject: [PATCH] - Fixed: There's more than one place where the CROUCHABLEMORPH flag needs to be checked. SVN r4228 (trunk) --- src/d_player.h | 5 +++++ src/p_user.cpp | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 96fb1399f..3467328f4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -426,6 +426,11 @@ public: crouching = 0; crouchviewdelta = 0; } + + bool CanCrouch() const + { + return morphTics == 0 || mo->PlayerFlags & PPF_CROUCHABLEMORPH; + } int GetSpawnClass(); }; diff --git a/src/p_user.cpp b/src/p_user.cpp index 42031d296..0816d753b 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -539,7 +539,7 @@ void APlayerPawn::BeginPlay () void APlayerPawn::Tick() { - if (player != NULL && player->mo == this && player->morphTics == 0 && player->playerstate != PST_DEAD) + if (player != NULL && player->mo == this && player->CanCrouch() && player->playerstate != PST_DEAD) { height = FixedMul(GetDefault()->height, player->crouchfactor); } @@ -1788,7 +1788,7 @@ void P_MovePlayer (player_t *player) sm = FixedMul (sm, player->mo->Speed); // When crouching, speed and bobbing have to be reduced - if (player->morphTics == 0 && player->crouchfactor != FRACUNIT) + if (player->CanCrouch() && player->crouchfactor != FRACUNIT) { fm = FixedMul(fm, player->crouchfactor); sm = FixedMul(sm, player->crouchfactor); @@ -2204,8 +2204,7 @@ void P_PlayerThink (player_t *player) { player->cmd.ucmd.buttons &= ~BT_CROUCH; } - if ((player->morphTics == 0 || player->mo->PlayerFlags & PPF_CROUCHABLEMORPH) - && player->health > 0 && level.IsCrouchingAllowed()) + if (player->CanCrouch() && player->health > 0 && level.IsCrouchingAllowed()) { if (!totallyfrozen) {