• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revision17192f5db27c0e9402c425d6208574e52aba5d7d (tree)
Time2022-10-02 01:01:38
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

- Cleaned up duplicate code for printing large frag messages. This should also fix Logitech G15 keyboards not printing large frag messages in online games.
- Moved the definition of the cl_showlargefragmessages CVar from deathmatch.cpp to st_hud.cpp.

Change Summary

Incremental Difference

diff -r 84b6c58c6f4d -r 17192f5db27c src/cl_main.cpp
--- a/src/cl_main.cpp Fri Sep 30 20:06:20 2022 -0400
+++ b/src/cl_main.cpp Sat Oct 01 12:01:38 2022 -0400
@@ -3944,25 +3944,8 @@
39443944 }
39453945 }
39463946
3947- if (( (GAMEMODE_GetCurrentFlags() & GMF_COOPERATIVE) == false ) &&
3948- ( cl_showlargefragmessages ) &&
3949- ( ulSourcePlayer < MAXPLAYERS ) &&
3950- ( static_cast<ULONG>( player - players ) != ulSourcePlayer ) &&
3951- ( MOD != NAME_SpawnTelefrag ) &&
3952- ( GAMEMODE_IsGameInProgress() ))
3953- {
3954- if ((( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNFRAGS ) == false ) || (( fraglimit == 0 ) || ( players[ulSourcePlayer].fragcount < fraglimit ))) &&
3955- (( ( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNWINS ) && !( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) ) == false ) || (( winlimit == 0 ) || ( players[ulSourcePlayer].ulWins < static_cast<ULONG>(winlimit) ))) &&
3956- (( ( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNWINS ) && ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) ) == false ) || (( winlimit == 0 ) || ( TEAM_GetWinCount( players[ulSourcePlayer].Team ) < winlimit ))))
3957- {
3958- // Display a large "You were fragged by <name>." message in the middle of the screen.
3959- if ( player == &players[consoleplayer] )
3960- HUD_PrepareToDrawFragMessage( &players[ulSourcePlayer], true );
3961- // Display a large "You fragged <name>!" message in the middle of the screen.
3962- else if ( ulSourcePlayer == static_cast<ULONG>(consoleplayer) )
3963- HUD_PrepareToDrawFragMessage( player, false );
3964- }
3965- }
3947+ // [AK] Try to draw a large frag message if we (the consoleplayer) were fragged (by) another player.
3948+ HUD_PrepareToDrawFragMessage( player, source, MOD );
39663949
39673950 // [BB] Temporarily change the ReadyWeapon of ulSourcePlayer to the one the server told us.
39683951 AWeapon *pSavedReadyWeapon = ( ulSourcePlayer < MAXPLAYERS ) ? players[ulSourcePlayer].ReadyWeapon : NULL;
diff -r 84b6c58c6f4d -r 17192f5db27c src/deathmatch.cpp
--- a/src/deathmatch.cpp Fri Sep 30 20:06:20 2022 -0400
+++ b/src/deathmatch.cpp Sat Oct 01 12:01:38 2022 -0400
@@ -400,9 +400,6 @@
400400 CVAR( Bool, cl_noammoswitch, true, CVAR_ARCHIVE );
401401 CVAR( Bool, cl_useoriginalweaponorder, false, CVAR_ARCHIVE );
402402
403-// Allow the display of large frag messages.
404-CVAR( Bool, cl_showlargefragmessages, true, CVAR_ARCHIVE );
405-
406403 /*
407404 CCMD( showweaponstates )
408405 {
diff -r 84b6c58c6f4d -r 17192f5db27c src/deathmatch.h
--- a/src/deathmatch.h Fri Sep 30 20:06:20 2022 -0400
+++ b/src/deathmatch.h Sat Oct 01 12:01:38 2022 -0400
@@ -90,7 +90,6 @@
9090
9191 EXTERN_CVAR( Bool, cl_noammoswitch )
9292 EXTERN_CVAR( Bool, cl_useoriginalweaponorder )
93-EXTERN_CVAR( Bool, cl_showlargefragmessages )
9493
9594 EXTERN_CVAR( Bool, sv_cheats )
9695 EXTERN_CVAR( Int, sv_fastweapons )
diff -r 84b6c58c6f4d -r 17192f5db27c src/g_shared/st_hud.cpp
--- a/src/g_shared/st_hud.cpp Fri Sep 30 20:06:20 2022 -0400
+++ b/src/g_shared/st_hud.cpp Sat Oct 01 12:01:38 2022 -0400
@@ -72,6 +72,7 @@
7272 #include "lastmanstanding.h"
7373 #include "sbar.h"
7474 #include "p_trace.h"
75+#include "win32/g15/g15.h"
7576
7677 // [AK] Message levels used for cl_identifytarget.
7778 enum
@@ -156,6 +157,7 @@
156157
157158 CVAR( Int, cl_identifytarget, IDENTIFY_TARGET_NAME, CVAR_ARCHIVE )
158159 CVAR( Int, cl_identifymonsters, IDENTIFY_MONSTERS_OFF, CVAR_ARCHIVE )
160+CVAR( Bool, cl_showlargefragmessages, true, CVAR_ARCHIVE )
159161 CVAR( Bool, cl_drawcoopinfo, true, CVAR_ARCHIVE )
160162 CVAR( Bool, r_drawspectatingstring, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG )
161163 CVAR( Bool, r_drawrespawnstring, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG )
@@ -1272,10 +1274,54 @@
12721274
12731275 //*****************************************************************************
12741276 //
1275-void HUD_PrepareToDrawFragMessage( player_t *pPlayer, bool bFraggedBy )
1277+void HUD_PrepareToDrawFragMessage( player_t *pPlayer, AActor *pSource, int MeansOfDeath )
12761278 {
1277- g_pFragMessagePlayer = pPlayer;
1278- g_bFraggedBy = bFraggedBy;
1279+ // [AK] Don't display large frag messages in a cooperative games.
1280+ if ( GAMEMODE_GetCurrentFlags( ) & GMF_COOPERATIVE )
1281+ return;
1282+
1283+ // [AK] Make sure that the target and source are valid players, who aren't the same player either.
1284+ // Large frag messages also don't display when the player dies from a spawn telefrag.
1285+ if (( pPlayer == NULL ) || ( pSource == NULL ) || ( pSource->player == NULL ) || ( pPlayer == pSource->player ) || ( MeansOfDeath == NAME_SpawnTelefrag ))
1286+ return;
1287+
1288+ // [AK] Large frag messages should only be displayed when the game's in progress.
1289+ if ( GAMEMODE_IsGameInProgress( ) == false )
1290+ return;
1291+
1292+ const ULONG ulGameModeFlags = GAMEMODE_GetCurrentFlags( );
1293+
1294+ if (((( ulGameModeFlags & GMF_PLAYERSEARNFRAGS ) == false ) || (( fraglimit == 0 ) || ( pSource->player->fragcount < fraglimit ))) &&
1295+ (((( ulGameModeFlags & GMF_PLAYERSEARNWINS ) && !( ulGameModeFlags & GMF_PLAYERSONTEAMS )) == false ) || (( winlimit == 0 ) || ( pSource->player->ulWins < static_cast<ULONG>( winlimit )))) &&
1296+ (((( ulGameModeFlags & GMF_PLAYERSEARNWINS ) && ( ulGameModeFlags & GMF_PLAYERSONTEAMS )) == false ) || (( winlimit == 0 ) || ( TEAM_GetWinCount( pSource->player->Team ) < winlimit ))))
1297+ {
1298+ // Prepare a large "You were fragged by <name>." message in the middle of the screen.
1299+ if ( pPlayer == &players[consoleplayer] )
1300+ {
1301+ if ( cl_showlargefragmessages )
1302+ {
1303+ g_pFragMessagePlayer = pSource->player;
1304+ g_bFraggedBy = true;
1305+ }
1306+
1307+ // [RC] Also show the message on the Logitech G15 (if enabled).
1308+ if ( G15_IsReady( ))
1309+ G15_ShowLargeFragMessage( pSource->player->userinfo.GetName( ), false );
1310+ }
1311+ // Prepare a large "You fragged <name>!" message in the middle of the screen.
1312+ else if ( static_cast<int>( pSource->player - players ) == consoleplayer )
1313+ {
1314+ if ( cl_showlargefragmessages )
1315+ {
1316+ g_pFragMessagePlayer = pPlayer;
1317+ g_bFraggedBy = false;
1318+ }
1319+
1320+ // [RC] Also show the message on the Logitech G15 (if enabled).
1321+ if ( G15_IsReady( ))
1322+ G15_ShowLargeFragMessage( pPlayer->userinfo.GetName( ), true );
1323+ }
1324+ }
12791325 }
12801326
12811327 //*****************************************************************************
diff -r 84b6c58c6f4d -r 17192f5db27c src/g_shared/st_hud.h
--- a/src/g_shared/st_hud.h Fri Sep 30 20:06:20 2022 -0400
+++ b/src/g_shared/st_hud.h Sat Oct 01 12:01:38 2022 -0400
@@ -78,7 +78,7 @@
7878 void HUD_DrawStandardMessage( const char *pszMessage, EColorRange color, const bool bClearScreen = false, float fHoldTime = 3.0f, float fOutTime = 2.0f, const bool bInformClients = false );
7979 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 );
8080 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 );
81-void HUD_PrepareToDrawFragMessage( player_t *pFraggedPlayer, bool bFraggedBy );
81+void HUD_PrepareToDrawFragMessage( player_t *pPlayer, AActor *pSource, int MeansOfDeath );
8282 void HUD_ClearFragAndPlaceMessages( const bool bInformClients );
8383 bool HUD_ShouldDrawRank( ULONG ulPlayer );
8484 bool HUD_IsTied( ULONG ulPlayerNum );
diff -r 84b6c58c6f4d -r 17192f5db27c src/p_interaction.cpp
--- a/src/p_interaction.cpp Fri Sep 30 20:06:20 2022 -0400
+++ b/src/p_interaction.cpp Sat Oct 01 12:01:38 2022 -0400
@@ -75,7 +75,6 @@
7575 #include "team.h"
7676 #include "cl_commands.h"
7777 #include "cl_demo.h"
78-#include "win32/g15/g15.h"
7978 #include "r_data/r_translate.h"
8079 #include "p_enemy.h"
8180 #include "r_data/colormaps.h"
@@ -926,39 +925,8 @@
926925 Destroy();
927926 }
928927
929- if (( (GAMEMODE_GetCurrentFlags() & GMF_COOPERATIVE) == false ) &&
930- ( NETWORK_GetState( ) != NETSTATE_SERVER ) &&
931- ( NETWORK_InClientMode() == false ) &&
932- ( GAMEMODE_IsGameInProgress() ))
933- {
934- if (( player ) && ( source ) && ( source->player ) && ( player != source->player ) && ( MeansOfDeath != NAME_SpawnTelefrag ))
935- {
936- if ((( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNFRAGS ) == false ) || (( fraglimit == 0 ) || ( source->player->fragcount < fraglimit ))) &&
937- (( ( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNWINS ) && !( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) ) == false ) || (( winlimit == 0 ) || ( source->player->ulWins < static_cast<ULONG>(winlimit) ))) &&
938- (( ( ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSEARNWINS ) && ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) ) == false ) || (( winlimit == 0 ) || ( TEAM_GetWinCount( source->player->Team ) < winlimit ))))
939- {
940- // Display a large "You were fragged by <name>." message in the middle of the screen.
941- if (( player - players ) == consoleplayer )
942- {
943- if ( cl_showlargefragmessages )
944- HUD_PrepareToDrawFragMessage( source->player, true );
945-
946- if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled).
947- G15_ShowLargeFragMessage( source->player->userinfo.GetName(), false );
948- }
949-
950- // Display a large "You fragged <name>!" message in the middle of the screen.
951- else if (( source->player - players ) == consoleplayer )
952- {
953- if ( cl_showlargefragmessages )
954- HUD_PrepareToDrawFragMessage( player, false );
955-
956- if ( G15_IsReady() ) // [RC] Also show the message on the Logitech G15 (if enabled).
957- G15_ShowLargeFragMessage( player->userinfo.GetName(), true );
958- }
959- }
960- }
961- }
928+ // [AK] Try to draw a large frag message if we (the consoleplayer) were fragged (by) another player.
929+ HUD_PrepareToDrawFragMessage( player, source, MeansOfDeath );
962930
963931 // [RH] Death messages
964932 if (( player ) && ( NETWORK_InClientMode() == false ))
Show on old repository browser