This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).
修訂 | ecc88581f00108c8ab14dcb06fba78789ad0f268 (tree) |
---|---|
時間 | 2021-11-22 04:41:20 |
作者 | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Show how long a player must wait before respawning on the bottom of the screen if sv_respawndelaytime is greater than 1.
@@ -3980,6 +3980,17 @@ | ||
3980 | 3980 | ClientObituary( players[ulPlayer].mo, pInflictor, NULL, MOD ); |
3981 | 3981 | */ |
3982 | 3982 | |
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 | + | |
3983 | 3994 | // Refresh the HUD, since this could affect the number of players left in an LMS game. |
3984 | 3995 | HUD_Refresh( ); |
3985 | 3996 | } |
@@ -5902,6 +5913,10 @@ | ||
5902 | 5913 | // [AK] Read in, and set the value for sv_allowprivatechat. |
5903 | 5914 | Value.Int = pByteStream->ReadByte(); |
5904 | 5915 | 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 ); | |
5905 | 5920 | } |
5906 | 5921 | |
5907 | 5922 | //***************************************************************************** |
@@ -103,6 +103,12 @@ | ||
103 | 103 | // [AK] Who are the two duelers? |
104 | 104 | static player_t *g_pDuelers[2]; |
105 | 105 | |
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 | + | |
106 | 112 | //***************************************************************************** |
107 | 113 | // PROTOTYPES |
108 | 114 |
@@ -529,6 +535,18 @@ | ||
529 | 535 | } |
530 | 536 | } |
531 | 537 | |
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 | + | |
532 | 550 | // If the console player is spectating, draw the spectator message. |
533 | 551 | // [BB] Only when not in free spectate mode. |
534 | 552 | if (( r_drawspectatingstring ) && ( players[consoleplayer].bSpectating ) && ( CLIENTDEMO_IsInFreeSpectateMode( ) == false )) |
@@ -953,6 +971,18 @@ | ||
953 | 971 | |
954 | 972 | //***************************************************************************** |
955 | 973 | // |
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 | +// | |
956 | 986 | // [TP] Now in a function |
957 | 987 | // |
958 | 988 | FString HUD_SpellOrdinal( int ranknum, bool bColored ) |
@@ -82,6 +82,7 @@ | ||
82 | 82 | ULONG HUD_GetNumSpectators( void ); |
83 | 83 | ULONG HUD_GetRank( void ); |
84 | 84 | LONG HUD_GetSpread( void ); |
85 | +void HUD_SetRespawnTimeLeft( LONG lRespawnTime ); | |
85 | 86 | FString HUD_SpellOrdinal( int ranknum, bool bColored = false ); |
86 | 87 | FString HUD_BuildPointString( void ); |
87 | 88 | FString HUD_BuildPlaceString( ULONG ulPlayer ); |
@@ -758,9 +758,21 @@ | ||
758 | 758 | // [AK] The respawn delay can be adjusted, but the minimum is one second. This only works if |
759 | 759 | // the player wasn't spawn telefragged and still has lives left. |
760 | 760 | if (( sv_respawndelaytime > 1 ) && ( player->bSpawnTelefragged == false ) && ( bNoMoreLivesLeft == false )) |
761 | + { | |
761 | 762 | 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 | + } | |
762 | 768 | else |
769 | + { | |
763 | 770 | 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 | + } | |
764 | 776 | |
765 | 777 | // [BC] Don't respawn quite so fast on forced respawn. It sounds weird when your |
766 | 778 | // scream isn't completed. |
@@ -2336,6 +2336,8 @@ | ||
2336 | 2336 | command.addByte( sv_limitcommands ); |
2337 | 2337 | // [AK] Send sv_allowprivatechat. |
2338 | 2338 | command.addByte( sv_allowprivatechat ); |
2339 | + // [AK] Send sv_respawndelaytime. | |
2340 | + command.addByte( sv_respawndelaytime ); | |
2339 | 2341 | command.sendCommandToClients( ulPlayerExtra, flags ); |
2340 | 2342 | } |
2341 | 2343 |
@@ -273,7 +273,6 @@ | ||
273 | 273 | CVAR( Bool, sv_forcepassword, false, CVAR_ARCHIVE|CVAR_NOSETBYACS|CVAR_SERVERINFO ) |
274 | 274 | CVAR( Bool, sv_forcejoinpassword, false, CVAR_ARCHIVE|CVAR_NOSETBYACS|CVAR_SERVERINFO ) |
275 | 275 | CVAR( Int, sv_forcerespawntime, 0, CVAR_ARCHIVE|CVAR_SERVERINFO ) // [RK] |
276 | -CVAR( Int, sv_respawndelaytime, 1, CVAR_ARCHIVE|CVAR_SERVERINFO ) // [AK] | |
277 | 276 | CVAR( Bool, sv_showlauncherqueries, false, CVAR_ARCHIVE ) |
278 | 277 | CVAR( Bool, sv_timestamp, false, CVAR_ARCHIVE|CVAR_NOSETBYACS ) |
279 | 278 | CVAR( Int, sv_timestampformat, 0, CVAR_ARCHIVE|CVAR_NOSETBYACS ) |
@@ -470,6 +469,29 @@ | ||
470 | 469 | } |
471 | 470 | |
472 | 471 | //***************************************************************************** |
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 | +//***************************************************************************** | |
473 | 495 | // FUNCTIONS |
474 | 496 | |
475 | 497 | void SERVER_Construct( void ) |