Skip to content

Commit

Permalink
Added a +NOMORPHLIMITATIONS flag
Browse files Browse the repository at this point in the history
  • Loading branch information
IgeNiaI committed Nov 29, 2022
1 parent 94aa27e commit 88d8360
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cl_main.cpp
Expand Up @@ -6109,7 +6109,7 @@ void ServerCommands::GiveInventory::Execute()
}
*/
// [BB] Prevent the client from trying to switch to a different weapon while morphed.
if ( player->morphTics )
if ( player->morphTics && !( player->mo && (player->mo->PlayerFlags & PPF_NOMORPHLIMITATIONS) ) )
player->PendingWeapon = WP_NOCHANGE;

// Since an item displayed on the HUD may have been given, refresh the HUD.
Expand Down
2 changes: 2 additions & 0 deletions src/d_player.h
Expand Up @@ -302,6 +302,8 @@ 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
// [geNia] Removes morph limitations, like not playing land sounds, or not switching weapons, or not being affected by speed powerup
PPF_NOMORPHLIMITATIONS = 8,
};

//
Expand Down
2 changes: 1 addition & 1 deletion src/p_enemy.cpp
Expand Up @@ -3554,7 +3554,7 @@ void P_TossItem (AActor *item)
DEFINE_ACTION_FUNCTION(AActor, A_Pain)
{
// [RH] Vary player pain sounds depending on health (ala Quake2)
if (self->player && self->player->morphTics == 0)
if ( self->player && ( ( self->player->morphTics == 0 ) || ( self->player->mo && self->player->mo->PlayerFlags & PPF_NOMORPHLIMITATIONS ) ) )
{
const char *pain_amount;
FSoundID sfx_id;
Expand Down
3 changes: 2 additions & 1 deletion src/p_mobj.cpp
Expand Up @@ -3509,7 +3509,8 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)

// [RH] only make noise if alive
// [WS/BB] As client only play the sound for the consoleplayer.
if (!mo->player->morphTics && mo->health > 0 && NETWORK_IsConsolePlayerOrNotInClientMode( mo->player ))
bool canPlayLandSound = ( !mo->player->morphTics || (mo->player->mo && mo->player->mo->PlayerFlags & PPF_NOMORPHLIMITATIONS) );
if ( canPlayLandSound && mo->health > 0 && NETWORK_IsConsolePlayerOrNotInClientMode( mo->player ))
{
grunted = false;
// Why should this number vary by gravity?
Expand Down
4 changes: 2 additions & 2 deletions src/p_pspr.cpp
Expand Up @@ -765,7 +765,7 @@ void P_CheckWeaponSwitch (player_t *player)
return;
}
if ((player->WeaponState & WF_DISABLESWITCH) || // Weapon changing has been disabled.
player->morphTics != 0) // Morphed classes cannot change weapons.
( player->morphTics != 0 && !( player->mo && (player->mo->PlayerFlags & PPF_NOMORPHLIMITATIONS) ) )) // Morphed classes cannot change weapons.
{ // ...so throw away any pending weapon requests.
player->PendingWeapon = WP_NOCHANGE;
}
Expand Down Expand Up @@ -923,7 +923,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
return;
}

if (player->morphTics || player->cheats & CF_INSTANTWEAPSWITCH)
if ( ( player->morphTics && !( player->mo && (player->mo->PlayerFlags & PPF_NOMORPHLIMITATIONS) ) ) || player->cheats & CF_INSTANTWEAPSWITCH)
{
psp->sy = WEAPONBOTTOM;
}
Expand Down
4 changes: 2 additions & 2 deletions src/p_user.cpp
Expand Up @@ -2684,7 +2684,7 @@ void APlayerPawn::TweakSpeeds (ticcmd_t *cmd, int &forward, int &side)
}

// [BC] This comes out to 50%, so we can use this for the turbosphere.
if (!player->morphTics && Inventory != NULL)
if (( !player->morphTics || ( PlayerFlags & PPF_NOMORPHLIMITATIONS ) ) && Inventory != NULL)
{
fixed_t factor;
if ( CLIENT_PREDICT_IsPredicting( ))
Expand Down Expand Up @@ -3378,7 +3378,7 @@ float APlayerPawn::QTweakSpeed()
{
float speedFactor = 1.0;
// Powerup speed multi
if (!player->morphTics && Inventory != NULL)
if (( !player->morphTics || ( PlayerFlags & PPF_NOMORPHLIMITATIONS ) ) && Inventory != NULL)
{
if ( CLIENT_PREDICT_IsPredicting( ))
{
Expand Down
2 changes: 1 addition & 1 deletion src/sv_main.cpp
Expand Up @@ -5602,7 +5602,7 @@ bool ClientWeaponSelectCommand::process( const ULONG ulClient ) const
}

// [BB] Morph workaround: If the player is morphed, he can't change his weapon.
if ( players[ulClient].morphTics )
if ( players[ulClient].morphTics && !( players[ulClient].mo && (players[ulClient].mo->PlayerFlags & PPF_NOMORPHLIMITATIONS) ) )
return false;

// [BB] Since the server is not giving the player a weapon while spawning, P_BringUpWeapon doesn't call A_Raise for
Expand Down
1 change: 1 addition & 0 deletions src/thingdef/thingdef_data.cpp
Expand Up @@ -405,6 +405,7 @@ static FFlagDef PlayerPawnFlags[] =
DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags),
DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags),
DEFINE_FLAG(PPF, CROUCHABLEMORPH, APlayerPawn, PlayerFlags),
DEFINE_FLAG(PPF, NOMORPHLIMITATIONS, APlayerPawn, PlayerFlags),
};

static FFlagDef PowerSpeedFlags[] =
Expand Down

0 comments on commit 88d8360

Please sign in to comment.