Révision | 03b4b300c94127cce4b68923be7346d0e01b1c24 (tree) |
---|---|
l'heure | 2022-05-15 00:32:56 |
Auteur | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
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.
@@ -3951,10 +3951,10 @@ | ||
3951 | 3951 | { |
3952 | 3952 | // Display a large "You were fragged by <name>." message in the middle of the screen. |
3953 | 3953 | if ( player == &players[consoleplayer] ) |
3954 | - HUD_DrawFragMessage( &players[ulSourcePlayer], true ); | |
3954 | + HUD_PrepareToDrawFragMessage( &players[ulSourcePlayer], true ); | |
3955 | 3955 | // Display a large "You fragged <name>!" message in the middle of the screen. |
3956 | 3956 | else if ( ulSourcePlayer == static_cast<ULONG>(consoleplayer) ) |
3957 | - HUD_DrawFragMessage( player, false ); | |
3957 | + HUD_PrepareToDrawFragMessage( player, false ); | |
3958 | 3958 | } |
3959 | 3959 | } |
3960 | 3960 |
@@ -103,6 +103,12 @@ | ||
103 | 103 | // [AK] Who are the two duelers? |
104 | 104 | static player_t *g_pDuelers[2]; |
105 | 105 | |
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 | + | |
106 | 112 | // [AK] How long we have to wait until we can respawn, used for displaying on the screen. |
107 | 113 | static float g_fRespawnDelay = -1.0f; |
108 | 114 |
@@ -121,6 +127,7 @@ | ||
121 | 127 | static void HUD_RenderRankAndSpread( void ); |
122 | 128 | static void HUD_RenderInvasionStats( void ); |
123 | 129 | static void HUD_RenderCountdown( ULONG ulTimeLeft ); |
130 | +static void HUD_DrawFragMessage( void ); | |
124 | 131 | |
125 | 132 | //***************************************************************************** |
126 | 133 | // CONSOLE VARIABLES |
@@ -247,6 +254,14 @@ | ||
247 | 254 | CALLVOTE_Render( ); |
248 | 255 | } |
249 | 256 | |
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 | + | |
250 | 265 | // [AK] Render the countdown screen when we're in the countdown. |
251 | 266 | if ( GAMEMODE_GetState( ) == GAMESTATE_COUNTDOWN ) |
252 | 267 | HUD_RenderCountdown( GAMEMODE_GetCountdownTicks( ) + TICRATE ); |
@@ -857,9 +872,9 @@ | ||
857 | 872 | |
858 | 873 | //***************************************************************************** |
859 | 874 | // |
860 | -void HUD_DrawFragMessage( player_t *pPlayer, bool bFraggedBy ) | |
875 | +static void HUD_DrawFragMessage( void ) | |
861 | 876 | { |
862 | - FString message = GStrings( bFraggedBy ? "GM_YOUWEREFRAGGED" : "GM_YOUFRAGGED" ); | |
877 | + FString message = GStrings( g_bFraggedBy ? "GM_YOUWEREFRAGGED" : "GM_YOUFRAGGED" ); | |
863 | 878 | message.StripLeftRight( ); |
864 | 879 | |
865 | 880 | // [AK] Don't print the message if the string is empty. |
@@ -867,7 +882,7 @@ | ||
867 | 882 | return; |
868 | 883 | |
869 | 884 | // [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( )); | |
871 | 886 | |
872 | 887 | // Print the frag message out in the console. |
873 | 888 | Printf( "%s\n", message.GetChars( )); |
@@ -878,7 +893,7 @@ | ||
878 | 893 | // [AK] Build the place string. |
879 | 894 | message = HUD_BuildPlaceString( consoleplayer ); |
880 | 895 | |
881 | - if ( bFraggedBy == false ) | |
896 | + if ( g_bFraggedBy == false ) | |
882 | 897 | { |
883 | 898 | ULONG ulMenLeftStanding = 0; |
884 | 899 |
@@ -971,6 +986,14 @@ | ||
971 | 986 | |
972 | 987 | //***************************************************************************** |
973 | 988 | // |
989 | +void HUD_PrepareToDrawFragMessage( player_t *pPlayer, bool bFraggedBy ) | |
990 | +{ | |
991 | + g_pFragMessagePlayer = pPlayer; | |
992 | + g_bFraggedBy = bFraggedBy; | |
993 | +} | |
994 | + | |
995 | +//***************************************************************************** | |
996 | +// | |
974 | 997 | void HUD_ClearFragAndPlaceMessages( const bool bInformClients ) |
975 | 998 | { |
976 | 999 | const LONG lFragId = MAKE_ID( 'F', 'R', 'A', 'G' ); |
@@ -74,10 +74,10 @@ | ||
74 | 74 | void HUD_Refresh( void ); |
75 | 75 | void HUD_ShouldRefreshBeforeRendering( void ); |
76 | 76 | void HUD_DrawCoopInfo( void ); |
77 | -void HUD_DrawFragMessage( player_t *pFraggedPlayer, bool bFraggedBy ); | |
78 | 77 | void HUD_DrawStandardMessage( const char *pszMessage, EColorRange color, const bool bClearScreen = false, float fHoldTime = 3.0f, float fOutTime = 2.0f, const bool bInformClients = false ); |
79 | 78 | 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 ); |
80 | 79 | 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 ); | |
81 | 81 | void HUD_ClearFragAndPlaceMessages( const bool bInformClients ); |
82 | 82 | bool HUD_ShouldDrawRank( ULONG ulPlayer ); |
83 | 83 | bool HUD_IsTied( ULONG ulPlayerNum ); |
@@ -918,7 +918,7 @@ | ||
918 | 918 | if (( player - players ) == consoleplayer ) |
919 | 919 | { |
920 | 920 | if ( cl_showlargefragmessages ) |
921 | - HUD_DrawFragMessage( source->player, true ); | |
921 | + HUD_PrepareToDrawFragMessage( source->player, true ); | |
922 | 922 | |
923 | 923 | if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled). |
924 | 924 | G15_ShowLargeFragMessage( source->player->userinfo.GetName(), false ); |
@@ -928,7 +928,7 @@ | ||
928 | 928 | else if (( source->player - players ) == consoleplayer ) |
929 | 929 | { |
930 | 930 | if ( cl_showlargefragmessages ) |
931 | - HUD_DrawFragMessage( player, false ); | |
931 | + HUD_PrepareToDrawFragMessage( player, false ); | |
932 | 932 | |
933 | 933 | if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled). |
934 | 934 | G15_ShowLargeFragMessage( player->userinfo.GetName(), true ); |