• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

This is a fork of Zandronum Beta for Mac Os (Silicon and Intel)


Commit MetaInfo

Revisión4cfb3337055305dc0c9c3679304bc943c99befe7 (tree)
Tiempo2022-11-27 12:56:59
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Added the helper function PLAYER_SetTime.

Cambiar Resumen

Diferencia incremental

diff -r 850eeed37215 -r 4cfb33370553 src/cl_main.cpp
--- a/src/cl_main.cpp Mon Nov 21 10:56:35 2022 -0500
+++ b/src/cl_main.cpp Sat Nov 26 22:56:59 2022 -0500
@@ -4416,7 +4416,7 @@
44164416 //
44174417 void ServerCommands::UpdatePlayerTime::Execute()
44184418 {
4419- player->ulTime = time * ( TICRATE * 60 );
4419+ PLAYER_SetTime( player, time * ( TICRATE * 60 ));
44204420 }
44214421
44224422 //*****************************************************************************
diff -r 850eeed37215 -r 4cfb33370553 src/d_player.h
--- a/src/d_player.h Mon Nov 21 10:56:35 2022 -0500
+++ b/src/d_player.h Sat Nov 26 22:56:59 2022 -0500
@@ -798,6 +798,7 @@
798798 void PLAYER_SetWins( player_t *pPlayer, ULONG ulWins );
799799 void PLAYER_SetKills( player_t *pPlayer, ULONG ulKills );
800800 void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths, bool bInformClients = true );
801+void PLAYER_SetTime( player_t *pPlayer, ULONG ulTime );
801802 void PLAYER_SetStatus( player_t *pPlayer, ULONG ulType, bool bEnable, ULONG ulFlags = 0 );
802803 // [BB] PLAYER_GetHealth and PLAYER_GetLivesLeft are helper functions for PLAYER_GetPlayerWithSingleHighestValue.
803804 LONG PLAYER_GetHealth( ULONG ulPlayer );
diff -r 850eeed37215 -r 4cfb33370553 src/p_interaction.cpp
--- a/src/p_interaction.cpp Mon Nov 21 10:56:35 2022 -0500
+++ b/src/p_interaction.cpp Sat Nov 26 22:56:59 2022 -0500
@@ -2821,6 +2821,30 @@
28212821
28222822 //*****************************************************************************
28232823 //
2824+void PLAYER_SetTime( player_t *pPlayer, ULONG ulTime )
2825+{
2826+ if ( pPlayer == NULL )
2827+ return;
2828+
2829+ // Set the player's time.
2830+ pPlayer->ulTime = ulTime;
2831+
2832+ // Potentially update the scoreboard or send out an update.
2833+ if ( NETWORK_GetState( ) == NETSTATE_SERVER )
2834+ {
2835+ if (( pPlayer->ulTime % ( TICRATE * 60 )) == 0 )
2836+ {
2837+ // Send out the updated time field to all clients.
2838+ SERVERCOMMANDS_UpdatePlayerTime( pPlayer - players );
2839+
2840+ // Update the console as well.
2841+ SERVERCONSOLE_UpdatePlayerInfo( pPlayer - players, UDF_TIME );
2842+ }
2843+ }
2844+}
2845+
2846+//*****************************************************************************
2847+//
28242848 void PLAYER_SetStatus( player_t *pPlayer, ULONG ulType, bool bEnable, ULONG ulFlags )
28252849 {
28262850 if ( pPlayer == NULL )
diff -r 850eeed37215 -r 4cfb33370553 src/p_tick.cpp
--- a/src/p_tick.cpp Mon Nov 21 10:56:35 2022 -0500
+++ b/src/p_tick.cpp Sat Nov 26 22:56:59 2022 -0500
@@ -357,26 +357,8 @@
357357 for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
358358 {
359359 // Increment individual player time.
360- if ( NETWORK_InClientMode() == false )
361- {
362- if ( playeringame[ulIdx] )
363- {
364- players[ulIdx].ulTime++;
365-
366- // Potentially update the scoreboard or send out an update.
367- if ( NETWORK_GetState( ) == NETSTATE_SERVER )
368- {
369- if (( players[ulIdx].ulTime % ( TICRATE * 60 )) == 0 )
370- {
371- // Send out the updated time field to all clients.
372- SERVERCOMMANDS_UpdatePlayerTime( ulIdx );
373-
374- // Update the console as well.
375- SERVERCONSOLE_UpdatePlayerInfo( ulIdx, UDF_TIME );
376- }
377- }
378- }
379- }
360+ if (( NETWORK_InClientMode( ) == false ) && ( playeringame[ulIdx] ))
361+ PLAYER_SetTime( &players[ulIdx], players[ulIdx].ulTime + 1 );
380362
381363 // Clients "think" every time we process a movement command.
382364 // [BB] The server has to think for lagging clients, otherwise they aren't affected by things like sector damage.