# HG changeset patch # User Adam Kaminski # Date 1644504628 18000 # Thu Feb 10 09:50:28 2022 -0500 # Node ID d2c744b2ad50fe848c672c79fa6f2ef571e3f42f # Parent f4be71348dd702914e4db5ad14f6c51a30b5ab91 Moved and renamed all HUD message-related functions from gamemode.cpp to st_hud.cpp. diff -r f4be71348dd7 -r d2c744b2ad50 src/g_shared/a_flags.cpp --- a/src/g_shared/a_flags.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/g_shared/a_flags.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -298,7 +298,7 @@ else message += "skull"; message += "\nof a team with no players!"; - GAMEMODE_DisplaySUBSMessage( message.GetChars(), true, static_cast(pToucher->player - players), SVCF_ONLYTHISCLIENT ); + HUD_DrawSUBSMessage( message.GetChars(), true, static_cast(pToucher->player - players), SVCF_ONLYTHISCLIENT ); return ( DENY_PICKUP ); } @@ -769,7 +769,7 @@ } V_ColorizeString( szString ); - GAMEMODE_DisplaySUBSMessage( szString, true ); + HUD_DrawSUBSMessage( szString, true ); if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { @@ -817,7 +817,7 @@ V_ColorizeString( szString ); - GAMEMODE_DisplayCNTRMessage( szString, false ); + HUD_DrawCNTRMessage( szString, false ); } // White flag --------------------------------------------------------------- @@ -1176,7 +1176,7 @@ sprintf( szString, "\\cCWhite flag returned" ); V_ColorizeString( szString ); - GAMEMODE_DisplayCNTRMessage( szString, false ); + HUD_DrawCNTRMessage( szString, false ); } // Skulltag skull ----------------------------------------------------------- @@ -1386,7 +1386,7 @@ } V_ColorizeString( szString ); - GAMEMODE_DisplaySUBSMessage( szString, true ); + HUD_DrawSUBSMessage( szString, true ); if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { @@ -1434,5 +1434,5 @@ V_ColorizeString( szString ); - GAMEMODE_DisplayCNTRMessage( szString, false ); + HUD_DrawCNTRMessage( szString, false ); } diff -r f4be71348dd7 -r d2c744b2ad50 src/g_shared/st_hud.cpp --- a/src/g_shared/st_hud.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/g_shared/st_hud.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -888,6 +888,63 @@ //***************************************************************************** // +void HUD_DrawStandardMessage( const char *pszMessage, const bool bInformClients ) +{ + const LONG lId = MAKE_ID( 'C', 'N', 'T', 'R' ); + + if ( NETWORK_GetState( ) != NETSTATE_SERVER ) + { + // Display the HUD message. + DHUDMessageFadeOut *pMsg = new DHUDMessageFadeOut( BigFont, pszMessage, 160.4f, 75.0f, 320, 200, CR_RED, 3.0f, 2.0f ); + StatusBar->AttachMessage( pMsg, lId ); + } + // If necessary, send it to clients. + else if ( bInformClients ) + { + SERVERCOMMANDS_PrintHUDMessage( pszMessage, 160.4f, 75.0f, 320, 200, HUDMESSAGETYPE_FADEOUT, CR_RED, 3.0f, 0.0f, 2.0f, "BigFont", lId ); + } +} + +//***************************************************************************** +// [BB] Expects pszMessage already to be colorized with V_ColorizeString. +void HUD_DrawCNTRMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra, const ULONG ulFlags ) +{ + const LONG lId = MAKE_ID( 'C', 'N', 'T', 'R' ); + + if ( NETWORK_GetState( ) != NETSTATE_SERVER ) + { + // Display the HUD message. + DHUDMessageFadeOut *pMsg = new DHUDMessageFadeOut( BigFont, pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, CR_UNTRANSLATED, 3.0f, 0.25f ); + StatusBar->AttachMessage( pMsg, lId ); + } + // If necessary, send it to clients. + else if ( bInformClients ) + { + SERVERCOMMANDS_PrintHUDMessage( pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", lId, ulPlayerExtra, ServerCommandFlags::FromInt( ulFlags )); + } +} + +//***************************************************************************** +// [BB] Expects pszMessage already to be colorized with V_ColorizeString. +void HUD_DrawSUBSMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra, const ULONG ulFlags ) +{ + const LONG lId = MAKE_ID( 'S', 'U', 'B', 'S' ); + + if ( NETWORK_GetState( ) != NETSTATE_SERVER ) + { + // Display the HUD message. + DHUDMessageFadeOut *pMsg = new DHUDMessageFadeOut( SmallFont, pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, CR_UNTRANSLATED, 3.0f, 0.25f ); + StatusBar->AttachMessage( pMsg, lId ); + } + // If necessary, send it to clients. + else if ( bInformClients ) + { + SERVERCOMMANDS_PrintHUDMessage( pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "SmallFont", lId, ulPlayerExtra, ServerCommandFlags::FromInt( ulFlags )); + } +} + +//***************************************************************************** +// // [TP] // bool HUD_ShouldDrawRank( ULONG ulPlayer ) diff -r f4be71348dd7 -r d2c744b2ad50 src/g_shared/st_hud.h --- a/src/g_shared/st_hud.h Sun Feb 13 11:39:00 2022 -0500 +++ b/src/g_shared/st_hud.h Thu Feb 10 09:50:28 2022 -0500 @@ -74,6 +74,9 @@ void HUD_Refresh( void ); void HUD_DrawCoopInfo( void ); void HUD_DrawFragMessage( player_t *pFraggedPlayer, bool bFraggedBy ); +void HUD_DrawStandardMessage( const char *pszMessage, const bool bInformClients = false ); +void HUD_DrawCNTRMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 ); +void HUD_DrawSUBSMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 ); bool HUD_ShouldDrawRank( ULONG ulPlayer ); bool HUD_IsTied( ULONG ulPlayerNum ); bool HUD_IsTied( void ); diff -r f4be71348dd7 -r d2c744b2ad50 src/gamemode.cpp --- a/src/gamemode.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/gamemode.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -68,9 +68,6 @@ #include "p_lnspec.h" #include "p_acs.h" #include "gi.h" -// [BB] The next includes are only needed for GAMEMODE_DisplayStandardMessage -#include "sbar.h" -#include "v_video.h" //***************************************************************************** // CONSOLE VARIABLES @@ -1162,79 +1159,6 @@ //***************************************************************************** // -void GAMEMODE_DisplayStandardMessage( const char *pszMessage, const bool bInformClients ) -{ - if ( NETWORK_GetState( ) != NETSTATE_SERVER ) - { - DHUDMessageFadeOut *pMsg; - - // Display the HUD message. - pMsg = new DHUDMessageFadeOut( BigFont, pszMessage, - 160.4f, - 75.0f, - 320, - 200, - CR_RED, - 3.0f, - 2.0f ); - - StatusBar->AttachMessage( pMsg, MAKE_ID('C','N','T','R') ); - } - // If necessary, send it to clients. - else if ( bInformClients ) - { - SERVERCOMMANDS_PrintHUDMessage( pszMessage, 160.4f, 75.0f, 320, 200, HUDMESSAGETYPE_FADEOUT, CR_RED, 3.0f, 0.0f, 2.0f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ) ); - } -} - -//***************************************************************************** -// [BB] Expects pszMessage already to be colorized with V_ColorizeString. -void GAMEMODE_DisplayCNTRMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra, const ULONG ulFlags ) -{ - if ( NETWORK_GetState( ) != NETSTATE_SERVER ) - { - DHUDMessageFadeOut *pMsg = new DHUDMessageFadeOut( BigFont, pszMessage, - 1.5f, - TEAM_MESSAGE_Y_AXIS, - 0, - 0, - CR_UNTRANSLATED, - 3.0f, - 0.25f ); - StatusBar->AttachMessage( pMsg, MAKE_ID( 'C','N','T','R' )); - } - // If necessary, send it to clients. - else if ( bInformClients ) - { - SERVERCOMMANDS_PrintHUDMessage( pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ), ulPlayerExtra, ServerCommandFlags::FromInt( ulFlags ) ); - } -} - -//***************************************************************************** -// [BB] Expects pszMessage already to be colorized with V_ColorizeString. -void GAMEMODE_DisplaySUBSMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra, const ULONG ulFlags ) -{ - if ( NETWORK_GetState( ) != NETSTATE_SERVER ) - { - DHUDMessageFadeOut *pMsg = new DHUDMessageFadeOut( SmallFont, pszMessage, - 1.5f, - TEAM_MESSAGE_Y_AXIS_SUB, - 0, - 0, - CR_UNTRANSLATED, - 3.0f, - 0.25f ); - StatusBar->AttachMessage( pMsg, MAKE_ID( 'S','U','B','S' )); - } - // If necessary, send it to clients. - else if ( bInformClients ) - { - SERVERCOMMANDS_PrintHUDMessage( pszMessage, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "SmallFont", MAKE_ID( 'S', 'U', 'B', 'S' ), ulPlayerExtra, ServerCommandFlags::FromInt( ulFlags ) ); - } -} - -//***************************************************************************** -// GAMEMODE_e GAMEMODE_GetCurrentMode( void ) { return ( g_CurrentGameMode ); diff -r f4be71348dd7 -r d2c744b2ad50 src/gamemode.h --- a/src/gamemode.h Sun Feb 13 11:39:00 2022 -0500 +++ b/src/gamemode.h Thu Feb 10 09:50:28 2022 -0500 @@ -217,12 +217,6 @@ bool GAMEMODE_HandleDamageEvent ( AActor *target, AActor *inflictor, AActor *source, int &damage, FName mod, bool bBeforeArmor = false ); LONG GAMEMODE_GetEventResult ( void ); void GAMEMODE_SetEventResult ( LONG lResult ); - -// [BB] This function doesn't really belong here. Find a better place for it. -void GAMEMODE_DisplayStandardMessage( const char *pszMessage, const bool bInformClients = false ); -void GAMEMODE_DisplayCNTRMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 ); -void GAMEMODE_DisplaySUBSMessage( const char *pszMessage, const bool bInformClients, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 ); - GAMEMODE_e GAMEMODE_GetCurrentMode( void ); void GAMEMODE_SetCurrentMode( GAMEMODE_e GameMode ); MODIFIER_e GAMEMODE_GetModifier( void ); diff -r f4be71348dd7 -r d2c744b2ad50 src/invasion.cpp --- a/src/invasion.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/invasion.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -77,6 +77,7 @@ #include "survival.h" #include "gamemode.h" #include "farchive.h" +#include "st_hud.h" void SERVERCONSOLE_UpdateScoreboard( ); @@ -1281,7 +1282,7 @@ break; case IS_MISSIONFAILED: - GAMEMODE_DisplayStandardMessage ( "MISSION FAILED!" ); + HUD_DrawStandardMessage( "MISSION FAILED!" ); break; default: break; diff -r f4be71348dd7 -r d2c744b2ad50 src/p_spec.cpp --- a/src/p_spec.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/p_spec.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -88,6 +88,7 @@ #include "invasion.h" #include "unlagged.h" #include "network_enums.h" +#include "st_hud.h" static FRandom pr_playerinspecialsector ("PlayerInSpecialSector"); void P_SetupPortals(); @@ -970,7 +971,7 @@ V_ColorizeString( szString ); // Display "%s WINS!" HUD message. - GAMEMODE_DisplayStandardMessage ( szString, true ); + HUD_DrawStandardMessage( szString, true ); GAME_SetEndLevelDelay( 5 * TICRATE ); } diff -r f4be71348dd7 -r d2c744b2ad50 src/possession.cpp --- a/src/possession.cpp Sun Feb 13 11:39:00 2022 -0500 +++ b/src/possession.cpp Thu Feb 10 09:50:28 2022 -0500 @@ -622,7 +622,7 @@ { sprintf( szString, "\\cdSUDDEN DEATH!" ); V_ColorizeString( szString ); - GAMEMODE_DisplayStandardMessage ( szString, true ); + HUD_DrawStandardMessage( szString, true ); } return;