Commit MetaInfo

Revisión9e3a99054db8eb5a9dcb35de6a23b8220d536e04 (tree)
Tiempo2022-05-14 23:09:45
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Call PLAYER_SetDeaths any time a player's death count increments. Some code had to be refactored to make this work. Most notably, clients now increment a player's death count on their own when they didn't before.

Cambiar Resumen

Diferencia incremental

diff -r 70919e31790e -r 9e3a99054db8 src/d_player.h
--- a/src/d_player.h Sat May 14 09:51:33 2022 -0400
+++ b/src/d_player.h Sat May 14 10:09:45 2022 -0400
@@ -781,7 +781,7 @@
781781 void PLAYER_SetPoints( player_t *pPlayer, ULONG ulPoints );
782782 void PLAYER_SetWins( player_t *pPlayer, ULONG ulWins );
783783 void PLAYER_SetKills( player_t *pPlayer, ULONG ulKills );
784-void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths );
784+void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths, bool bInformClients = true );
785785 // [BB] PLAYER_GetHealth and PLAYER_GetLivesLeft are helper functions for PLAYER_GetPlayerWithSingleHighestValue.
786786 LONG PLAYER_GetHealth( ULONG ulPlayer );
787787 LONG PLAYER_GetLivesLeft( ULONG ulPlayer );
diff -r 70919e31790e -r 9e3a99054db8 src/medal.cpp
--- a/src/medal.cpp Sat May 14 09:51:33 2022 -0400
+++ b/src/medal.cpp Sat May 14 10:09:45 2022 -0400
@@ -568,7 +568,6 @@
568568 players[ulSourcePlayer].ulLastFragTick = level.time;
569569 }
570570
571- players[ulPlayer].ulDeathCount++;
572571 players[ulPlayer].ulFragsWithoutDeath = 0;
573572
574573 // [BB] Don't punish being killed by a teammate (except if a player kills himself).
diff -r 70919e31790e -r 9e3a99054db8 src/p_interaction.cpp
--- a/src/p_interaction.cpp Sat May 14 09:51:33 2022 -0400
+++ b/src/p_interaction.cpp Sat May 14 10:09:45 2022 -0400
@@ -441,17 +441,17 @@
441441 // that we died, check for it before doing so.
442442 bPossessedTerminatorArtifact = !!(( player ) && ( player->cheats2 & CF2_TERMINATORARTIFACT ));
443443
444- // [BC] Check to see if any medals need to be awarded.
445- if (( player ) &&
446- ( NETWORK_InClientMode() == false ))
444+ // [AK] Some stuff to do if the actor that died is a player.
445+ if ( player )
447446 {
448- if (( source ) &&
449- ( source->player ))
450- {
451- MEDAL_PlayerDied( ULONG( player - players ), ULONG( source->player - players ));
452- }
453- else
454- MEDAL_PlayerDied( ULONG( player - players ), MAXPLAYERS );
447+ const ULONG ulPlayer = player - players;
448+
449+ // [BC] Check to see if any medals need to be awarded.
450+ if ( NETWORK_InClientMode( ) == false )
451+ MEDAL_PlayerDied( ulPlayer, (( source ) && ( source->player )) ? static_cast<ULONG>( source->player - players ) : MAXPLAYERS );
452+
453+ // [AK] Increment this player's death count.
454+ PLAYER_SetDeaths( &players[ulPlayer], players[ulPlayer].ulDeathCount + 1, false );
455455 }
456456
457457 // [RH] Notify this actor's items.
@@ -2819,7 +2819,7 @@
28192819
28202820 //*****************************************************************************
28212821 //
2822-void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths )
2822+void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths, bool bInformClients )
28232823 {
28242824 // Set the player's death count.
28252825 pPlayer->ulDeathCount = ulDeaths;
@@ -2828,7 +2828,7 @@
28282828 HUD_Refresh( );
28292829
28302830 // If we're the server, notify the clients of the death count change.
2831- if ( NETWORK_GetState( ) == NETSTATE_SERVER )
2831+ if (( NETWORK_GetState( ) == NETSTATE_SERVER ) && ( bInformClients ))
28322832 SERVERCOMMANDS_SetPlayerDeaths( pPlayer - players );
28332833 }
28342834
Show on old repository browser