- 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)
This commit is contained in:
Randy Heit 2013-04-19 02:24:20 +00:00
parent a50e670c0c
commit cb64014494
3 changed files with 6 additions and 3 deletions

View file

@ -163,6 +163,7 @@ enum
{ {
PPF_NOTHRUSTWHENINVUL = 1, // Attacks do not thrust the player if they are invulnerable. 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_CANSUPERMORPH = 2, // Being remorphed into this class can give you a Tome of Power
PPF_CROUCHABLEMORPH = 4, // This morphed player can crouch
}; };
// //

View file

@ -2204,7 +2204,8 @@ void P_PlayerThink (player_t *player)
{ {
player->cmd.ucmd.buttons &= ~BT_CROUCH; 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) if (!totallyfrozen)
{ {
@ -2212,11 +2213,11 @@ void P_PlayerThink (player_t *player)
if (crouchdir == 0) 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) else if (player->cmd.ucmd.buttons & BT_CROUCH)
{ {
player->crouching=0; player->crouching = 0;
} }
if (crouchdir == 1 && player->crouchfactor < FRACUNIT && if (crouchdir == 1 && player->crouchfactor < FRACUNIT &&
player->mo->z + player->mo->height < player->mo->ceilingz) player->mo->z + player->mo->height < player->mo->ceilingz)

View file

@ -336,6 +336,7 @@ static FFlagDef PlayerPawnFlags[] =
// PlayerPawn flags // PlayerPawn flags
DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags), DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags),
DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags), DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags),
DEFINE_FLAG(PPF, CROUCHABLEMORPH, APlayerPawn, PlayerFlags),
}; };
static FFlagDef PowerSpeedFlags[] = static FFlagDef PowerSpeedFlags[] =