- Fixed: There's more than one place where the CROUCHABLEMORPH flag needs to be checked.

SVN r4228 (trunk)
This commit is contained in:
Randy Heit 2013-04-28 02:31:34 +00:00
parent 3bbd255b73
commit b845fdb5d5
2 changed files with 8 additions and 4 deletions

View file

@ -426,6 +426,11 @@ public:
crouching = 0;
crouchviewdelta = 0;
}
bool CanCrouch() const
{
return morphTics == 0 || mo->PlayerFlags & PPF_CROUCHABLEMORPH;
}
int GetSpawnClass();
};

View file

@ -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)
{