• 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 TSPG.


Commit MetaInfo

Revisiónecc88581f00108c8ab14dcb06fba78789ad0f268 (tree)
Tiempo2021-11-22 04:41:20
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Show how long a player must wait before respawning on the bottom of the screen if sv_respawndelaytime is greater than 1.

Cambiar Resumen

Diferencia incremental

diff -r dc274d71c36b -r ecc88581f001 src/cl_main.cpp
--- a/src/cl_main.cpp Sun Nov 21 17:33:34 2021 +0100
+++ b/src/cl_main.cpp Sun Nov 21 14:41:20 2021 -0500
@@ -3980,6 +3980,17 @@
39803980 ClientObituary( players[ulPlayer].mo, pInflictor, NULL, MOD );
39813981 */
39823982
3983+ // [AK] If we died, show how long we must wait before we can respawn if it's more than one second.
3984+ if ( player - players == consoleplayer )
3985+ {
3986+ bool bNoMoreLivesLeft = ( GAMEMODE_AreLivesLimited( ) && GAMEMODE_IsGameInProgress( ) && ( player->ulLivesLeft == 0 ));
3987+
3988+ if (( sv_respawndelaytime > 1 ) && ( player->mo->DamageType != NAME_SpawnTelefrag ) && ( bNoMoreLivesLeft == false ))
3989+ HUD_SetRespawnTimeLeft( sv_respawndelaytime );
3990+ else
3991+ HUD_SetRespawnTimeLeft( -1 );
3992+ }
3993+
39833994 // Refresh the HUD, since this could affect the number of players left in an LMS game.
39843995 HUD_Refresh( );
39853996 }
@@ -5902,6 +5913,10 @@
59025913 // [AK] Read in, and set the value for sv_allowprivatechat.
59035914 Value.Int = pByteStream->ReadByte();
59045915 sv_allowprivatechat.ForceSet( Value, CVAR_Int );
5916+
5917+ // [AK] Read in, and set the value for sv_respawndelaytime.
5918+ Value.Int = pByteStream->ReadByte();
5919+ sv_respawndelaytime.ForceSet( Value, CVAR_Int );
59055920 }
59065921
59075922 //*****************************************************************************
diff -r dc274d71c36b -r ecc88581f001 src/g_shared/st_hud.cpp
--- a/src/g_shared/st_hud.cpp Sun Nov 21 17:33:34 2021 +0100
+++ b/src/g_shared/st_hud.cpp Sun Nov 21 14:41:20 2021 -0500
@@ -103,6 +103,12 @@
103103 // [AK] Who are the two duelers?
104104 static player_t *g_pDuelers[2];
105105
106+// [AK] How long we have to wait until we can respawn, used for displaying on the screen if sv_respawndelaytime is greater than 1.
107+static LONG g_lRespawnDelay = -1;
108+
109+// [AK] At what tic will we be able to respawn?
110+static LONG g_lRespawnGametic = 0;
111+
106112 //*****************************************************************************
107113 // PROTOTYPES
108114
@@ -529,6 +535,18 @@
529535 }
530536 }
531537
538+ // [AK] Show how much time is left before we can respawn if we had to wait for more than one second.
539+ if (( players[consoleplayer].bSpectating == false ) && ( players[consoleplayer].playerstate == PST_DEAD ))
540+ {
541+ if ( g_lRespawnGametic > level.time )
542+ {
543+ ULONG ulTimeLeft = MIN( g_lRespawnDelay, 1 + ( g_lRespawnGametic - level.time ) / TICRATE );
544+
545+ bottomString += "\n" TEXTCOLOR_GREEN;
546+ bottomString.AppendFormat( "Ready to respawn in %d second%s", ulTimeLeft, ulTimeLeft != 1 ? "s" : "" );
547+ }
548+ }
549+
532550 // If the console player is spectating, draw the spectator message.
533551 // [BB] Only when not in free spectate mode.
534552 if (( r_drawspectatingstring ) && ( players[consoleplayer].bSpectating ) && ( CLIENTDEMO_IsInFreeSpectateMode( ) == false ))
@@ -953,6 +971,18 @@
953971
954972 //*****************************************************************************
955973 //
974+void HUD_SetRespawnTimeLeft( LONG lRespawnTime )
975+{
976+ // [AK] The server shouldn't execute this.
977+ if ( NETWORK_GetState( ) == NETSTATE_SERVER )
978+ return;
979+
980+ g_lRespawnDelay = lRespawnTime;
981+ g_lRespawnGametic = level.time + g_lRespawnDelay * TICRATE;
982+}
983+
984+//*****************************************************************************
985+//
956986 // [TP] Now in a function
957987 //
958988 FString HUD_SpellOrdinal( int ranknum, bool bColored )
diff -r dc274d71c36b -r ecc88581f001 src/g_shared/st_hud.h
--- a/src/g_shared/st_hud.h Sun Nov 21 17:33:34 2021 +0100
+++ b/src/g_shared/st_hud.h Sun Nov 21 14:41:20 2021 -0500
@@ -82,6 +82,7 @@
8282 ULONG HUD_GetNumSpectators( void );
8383 ULONG HUD_GetRank( void );
8484 LONG HUD_GetSpread( void );
85+void HUD_SetRespawnTimeLeft( LONG lRespawnTime );
8586 FString HUD_SpellOrdinal( int ranknum, bool bColored = false );
8687 FString HUD_BuildPointString( void );
8788 FString HUD_BuildPlaceString( ULONG ulPlayer );
diff -r dc274d71c36b -r ecc88581f001 src/p_interaction.cpp
--- a/src/p_interaction.cpp Sun Nov 21 17:33:34 2021 +0100
+++ b/src/p_interaction.cpp Sun Nov 21 14:41:20 2021 -0500
@@ -758,9 +758,21 @@
758758 // [AK] The respawn delay can be adjusted, but the minimum is one second. This only works if
759759 // the player wasn't spawn telefragged and still has lives left.
760760 if (( sv_respawndelaytime > 1 ) && ( player->bSpawnTelefragged == false ) && ( bNoMoreLivesLeft == false ))
761+ {
761762 player->respawn_time = level.time + sv_respawndelaytime * TICRATE;
763+
764+ // [AK] Show how long we must wait until we can respawn on the screen.
765+ if ( player - players == consoleplayer )
766+ HUD_SetRespawnTimeLeft( sv_respawndelaytime );
767+ }
762768 else
769+ {
763770 player->respawn_time = level.time + TICRATE;
771+
772+ // [AK] We don't need to show how long to wait before we can respawn here.
773+ if ( player - players == consoleplayer )
774+ HUD_SetRespawnTimeLeft( -1 );
775+ }
764776
765777 // [BC] Don't respawn quite so fast on forced respawn. It sounds weird when your
766778 // scream isn't completed.
diff -r dc274d71c36b -r ecc88581f001 src/sv_commands.cpp
--- a/src/sv_commands.cpp Sun Nov 21 17:33:34 2021 +0100
+++ b/src/sv_commands.cpp Sun Nov 21 14:41:20 2021 -0500
@@ -2336,6 +2336,8 @@
23362336 command.addByte( sv_limitcommands );
23372337 // [AK] Send sv_allowprivatechat.
23382338 command.addByte( sv_allowprivatechat );
2339+ // [AK] Send sv_respawndelaytime.
2340+ command.addByte( sv_respawndelaytime );
23392341 command.sendCommandToClients( ulPlayerExtra, flags );
23402342 }
23412343
diff -r dc274d71c36b -r ecc88581f001 src/sv_main.cpp
--- a/src/sv_main.cpp Sun Nov 21 17:33:34 2021 +0100
+++ b/src/sv_main.cpp Sun Nov 21 14:41:20 2021 -0500
@@ -273,7 +273,6 @@
273273 CVAR( Bool, sv_forcepassword, false, CVAR_ARCHIVE|CVAR_NOSETBYACS|CVAR_SERVERINFO )
274274 CVAR( Bool, sv_forcejoinpassword, false, CVAR_ARCHIVE|CVAR_NOSETBYACS|CVAR_SERVERINFO )
275275 CVAR( Int, sv_forcerespawntime, 0, CVAR_ARCHIVE|CVAR_SERVERINFO ) // [RK]
276-CVAR( Int, sv_respawndelaytime, 1, CVAR_ARCHIVE|CVAR_SERVERINFO ) // [AK]
277276 CVAR( Bool, sv_showlauncherqueries, false, CVAR_ARCHIVE )
278277 CVAR( Bool, sv_timestamp, false, CVAR_ARCHIVE|CVAR_NOSETBYACS )
279278 CVAR( Int, sv_timestampformat, 0, CVAR_ARCHIVE|CVAR_NOSETBYACS )
@@ -470,6 +469,29 @@
470469 }
471470
472471 //*****************************************************************************
472+//
473+CUSTOM_CVAR( Int, sv_respawndelaytime, 1, CVAR_ARCHIVE | CVAR_SERVERINFO )
474+{
475+ if ( self < 1 )
476+ {
477+ self = 1;
478+ return;
479+ }
480+ else if ( self > 255 )
481+ {
482+ self = 255;
483+ return;
484+ }
485+
486+ // [AK] Notify the clients about the change.
487+ if (( NETWORK_GetState( ) == NETSTATE_SERVER ) && ( gamestate != GS_STARTUP ))
488+ {
489+ SERVER_Printf( "%s changed to: %d\n", self.GetName( ), self.GetGenericRep( CVAR_Int ).Int );
490+ SERVERCOMMANDS_SetGameModeLimits( );
491+ }
492+}
493+
494+//*****************************************************************************
473495 // FUNCTIONS
474496
475497 void SERVER_Construct( void )