Commit MetaInfo

Revisión03b4b300c94127cce4b68923be7346d0e01b1c24 (tree)
Tiempo2022-05-15 00:32:56
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Now that the HUD is updated just before it's rendered, the large frag message needs to be handled differently. This message is now drawn only once per tic, while the rest of the HUD is being rendered.

Cambiar Resumen

Diferencia incremental

diff -r 62958217f245 -r 03b4b300c941 src/cl_main.cpp
--- a/src/cl_main.cpp Sat May 14 10:23:28 2022 -0400
+++ b/src/cl_main.cpp Sat May 14 11:32:56 2022 -0400
@@ -3951,10 +3951,10 @@
39513951 {
39523952 // Display a large "You were fragged by <name>." message in the middle of the screen.
39533953 if ( player == &players[consoleplayer] )
3954- HUD_DrawFragMessage( &players[ulSourcePlayer], true );
3954+ HUD_PrepareToDrawFragMessage( &players[ulSourcePlayer], true );
39553955 // Display a large "You fragged <name>!" message in the middle of the screen.
39563956 else if ( ulSourcePlayer == static_cast<ULONG>(consoleplayer) )
3957- HUD_DrawFragMessage( player, false );
3957+ HUD_PrepareToDrawFragMessage( player, false );
39583958 }
39593959 }
39603960
diff -r 62958217f245 -r 03b4b300c941 src/g_shared/st_hud.cpp
--- a/src/g_shared/st_hud.cpp Sat May 14 10:23:28 2022 -0400
+++ b/src/g_shared/st_hud.cpp Sat May 14 11:32:56 2022 -0400
@@ -103,6 +103,12 @@
103103 // [AK] Who are the two duelers?
104104 static player_t *g_pDuelers[2];
105105
106+// [AK] The player whose name is drawn in the large frag message. If this is NULL, no message is drawn.
107+static player_t *g_pFragMessagePlayer = NULL;
108+
109+// [AK] Did this player frag us, or did we frag them?
110+static bool g_bFraggedBy = false;
111+
106112 // [AK] How long we have to wait until we can respawn, used for displaying on the screen.
107113 static float g_fRespawnDelay = -1.0f;
108114
@@ -121,6 +127,7 @@
121127 static void HUD_RenderRankAndSpread( void );
122128 static void HUD_RenderInvasionStats( void );
123129 static void HUD_RenderCountdown( ULONG ulTimeLeft );
130+static void HUD_DrawFragMessage( void );
124131
125132 //*****************************************************************************
126133 // CONSOLE VARIABLES
@@ -247,6 +254,14 @@
247254 CALLVOTE_Render( );
248255 }
249256
257+ // [AK] Draw the frag message if we have to.
258+ if ( g_pFragMessagePlayer != NULL )
259+ {
260+ HUD_DrawFragMessage( );
261+ g_pFragMessagePlayer = NULL;
262+ g_bFraggedBy = false;
263+ }
264+
250265 // [AK] Render the countdown screen when we're in the countdown.
251266 if ( GAMEMODE_GetState( ) == GAMESTATE_COUNTDOWN )
252267 HUD_RenderCountdown( GAMEMODE_GetCountdownTicks( ) + TICRATE );
@@ -857,9 +872,9 @@
857872
858873 //*****************************************************************************
859874 //
860-void HUD_DrawFragMessage( player_t *pPlayer, bool bFraggedBy )
875+static void HUD_DrawFragMessage( void )
861876 {
862- FString message = GStrings( bFraggedBy ? "GM_YOUWEREFRAGGED" : "GM_YOUFRAGGED" );
877+ FString message = GStrings( g_bFraggedBy ? "GM_YOUWEREFRAGGED" : "GM_YOUFRAGGED" );
863878 message.StripLeftRight( );
864879
865880 // [AK] Don't print the message if the string is empty.
@@ -867,7 +882,7 @@
867882 return;
868883
869884 // [AK] Substitute the fragged/fragging player's name into the message if we can.
870- message.Substitute( "%s", pPlayer->userinfo.GetName( ));
885+ message.Substitute( "%s", g_pFragMessagePlayer->userinfo.GetName( ));
871886
872887 // Print the frag message out in the console.
873888 Printf( "%s\n", message.GetChars( ));
@@ -878,7 +893,7 @@
878893 // [AK] Build the place string.
879894 message = HUD_BuildPlaceString( consoleplayer );
880895
881- if ( bFraggedBy == false )
896+ if ( g_bFraggedBy == false )
882897 {
883898 ULONG ulMenLeftStanding = 0;
884899
@@ -971,6 +986,14 @@
971986
972987 //*****************************************************************************
973988 //
989+void HUD_PrepareToDrawFragMessage( player_t *pPlayer, bool bFraggedBy )
990+{
991+ g_pFragMessagePlayer = pPlayer;
992+ g_bFraggedBy = bFraggedBy;
993+}
994+
995+//*****************************************************************************
996+//
974997 void HUD_ClearFragAndPlaceMessages( const bool bInformClients )
975998 {
976999 const LONG lFragId = MAKE_ID( 'F', 'R', 'A', 'G' );
diff -r 62958217f245 -r 03b4b300c941 src/g_shared/st_hud.h
--- a/src/g_shared/st_hud.h Sat May 14 10:23:28 2022 -0400
+++ b/src/g_shared/st_hud.h Sat May 14 11:32:56 2022 -0400
@@ -74,10 +74,10 @@
7474 void HUD_Refresh( void );
7575 void HUD_ShouldRefreshBeforeRendering( void );
7676 void HUD_DrawCoopInfo( void );
77-void HUD_DrawFragMessage( player_t *pFraggedPlayer, bool bFraggedBy );
7877 void HUD_DrawStandardMessage( const char *pszMessage, EColorRange color, const bool bClearScreen = false, float fHoldTime = 3.0f, float fOutTime = 2.0f, const bool bInformClients = false );
7978 void HUD_DrawCNTRMessage( const char *pszMessage, EColorRange color, float fHoldTime = 3.0f, float fOutTime = 0.25f, const bool bInformClients = false, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 );
8079 void HUD_DrawSUBSMessage( const char *pszMessage, EColorRange color, float fHoldTime = 3.0f, float fOutTime = 0.25f, const bool bInformClients = false, const ULONG ulPlayerExtra = MAXPLAYERS, const ULONG ulFlags = 0 );
80+void HUD_PrepareToDrawFragMessage( player_t *pFraggedPlayer, bool bFraggedBy );
8181 void HUD_ClearFragAndPlaceMessages( const bool bInformClients );
8282 bool HUD_ShouldDrawRank( ULONG ulPlayer );
8383 bool HUD_IsTied( ULONG ulPlayerNum );
diff -r 62958217f245 -r 03b4b300c941 src/p_interaction.cpp
--- a/src/p_interaction.cpp Sat May 14 10:23:28 2022 -0400
+++ b/src/p_interaction.cpp Sat May 14 11:32:56 2022 -0400
@@ -918,7 +918,7 @@
918918 if (( player - players ) == consoleplayer )
919919 {
920920 if ( cl_showlargefragmessages )
921- HUD_DrawFragMessage( source->player, true );
921+ HUD_PrepareToDrawFragMessage( source->player, true );
922922
923923 if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled).
924924 G15_ShowLargeFragMessage( source->player->userinfo.GetName(), false );
@@ -928,7 +928,7 @@
928928 else if (( source->player - players ) == consoleplayer )
929929 {
930930 if ( cl_showlargefragmessages )
931- HUD_DrawFragMessage( player, false );
931+ HUD_PrepareToDrawFragMessage( player, false );
932932
933933 if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled).
934934 G15_ShowLargeFragMessage( player->userinfo.GetName(), true );
Show on old repository browser