From cb64014494292b12047de0a559285099dca2527f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 19 Apr 2013 02:24:20 +0000 Subject: [PATCH] - Added CROUCHABLEMORPH flag for the PlayerPawn class. Use this to indicate that a morphed player class can crouch. (Regular players can always crouch, hence the name CROUCHABLEMORPH and not CANMORPH or ALLOWMORPH.) SVN r4221 (trunk) --- src/d_player.h | 1 + src/p_user.cpp | 7 ++++--- src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 48c387444d..96fb1399f5 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -163,6 +163,7 @@ enum { PPF_NOTHRUSTWHENINVUL = 1, // Attacks do not thrust the player if they are invulnerable. PPF_CANSUPERMORPH = 2, // Being remorphed into this class can give you a Tome of Power + PPF_CROUCHABLEMORPH = 4, // This morphed player can crouch }; // diff --git a/src/p_user.cpp b/src/p_user.cpp index 3763cbe44c..42031d296c 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2204,7 +2204,8 @@ void P_PlayerThink (player_t *player) { player->cmd.ucmd.buttons &= ~BT_CROUCH; } - if (player->morphTics == 0 && player->health > 0 && level.IsCrouchingAllowed()) + if ((player->morphTics == 0 || player->mo->PlayerFlags & PPF_CROUCHABLEMORPH) + && player->health > 0 && level.IsCrouchingAllowed()) { if (!totallyfrozen) { @@ -2212,11 +2213,11 @@ void P_PlayerThink (player_t *player) if (crouchdir == 0) { - crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH)? -1 : 1; + crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH) ? -1 : 1; } else if (player->cmd.ucmd.buttons & BT_CROUCH) { - player->crouching=0; + player->crouching = 0; } if (crouchdir == 1 && player->crouchfactor < FRACUNIT && player->mo->z + player->mo->height < player->mo->ceilingz) diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 68a17241bd..c542c895dc 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -336,6 +336,7 @@ static FFlagDef PlayerPawnFlags[] = // PlayerPawn flags DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags), DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags), + DEFINE_FLAG(PPF, CROUCHABLEMORPH, APlayerPawn, PlayerFlags), }; static FFlagDef PowerSpeedFlags[] =