From 88d8360f94e64e19edf5b5eb828e866acce3ff68 Mon Sep 17 00:00:00 2001 From: Evghenii Olenciuc <9607628+igeniai@users.noreply.github.com> Date: Mon, 30 May 2022 15:52:30 -0400 Subject: [PATCH] Added a `+NOMORPHLIMITATIONS` flag --- src/cl_main.cpp | 2 +- src/d_player.h | 2 ++ src/p_enemy.cpp | 2 +- src/p_mobj.cpp | 3 ++- src/p_pspr.cpp | 4 ++-- src/p_user.cpp | 4 ++-- src/sv_main.cpp | 2 +- src/thingdef/thingdef_data.cpp | 1 + 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/cl_main.cpp b/src/cl_main.cpp index 8a4624c9f..39355d233 100644 --- a/src/cl_main.cpp +++ b/src/cl_main.cpp @@ -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. diff --git a/src/d_player.h b/src/d_player.h index 414f5fb65..9c018694c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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, }; // diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index d05a371fc..2978bccff 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 538f26641..d54622fc1 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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? diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index f2b83318d..029e5b80d 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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; } @@ -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; } diff --git a/src/p_user.cpp b/src/p_user.cpp index 0d959cc5b..51a581ebc 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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( )) @@ -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( )) { diff --git a/src/sv_main.cpp b/src/sv_main.cpp index fd9977597..6c0bd1750 100644 --- a/src/sv_main.cpp +++ b/src/sv_main.cpp @@ -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 diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index f72cdd69e..82b8e39c2 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -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[] =