Commit MetaInfo

Revision3ded1da6e188b3e8b3f05e15ce6b2554c3cfe335 (tree)
Time2021-06-02 13:23:17
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

- The stop watch on the intermission screen now decrements instead of incrementing for up to 15 seconds. Clients now also update the stop watch time on their end.
- Added "cl_autoready" to automatically set a client as ready to go and "cl_intermissiontimer" to show the intermission countdown and the next map, based on features from ZCC.

Change Summary

Incremental Difference

diff -r 2986505a6255 -r 3ded1da6e188 docs/zandronum-history.txt
--- a/docs/zandronum-history.txt Wed Jun 02 00:22:31 2021 -0400
+++ b/docs/zandronum-history.txt Wed Jun 02 00:23:17 2021 -0400
@@ -37,6 +37,7 @@
3737 + - Added new parameters to the "addmap" and "insertmap" CCMDs that specify the minimum and maximum number of players required to enter a map. [Kaminsky]
3838 + - Added ACS functions: GetMapRotationSize and GetMapRotationInfo to get information about the server's map rotation. [Kaminsky]
3939 + - Added new console command "weapswap" which swaps the player's weapon to the one they were using before. [Kaminsky]
40++ - Added "cl_autoready" to automatically set a client as ready to go and "cl_intermissiontimer" to show the intermission countdown and the next map. [DoomJoshuaBoy/Kaminsky]
4041 - - Fixed: Bots tries to jump to reach item when sv_nojump is true. [sleep]
4142 - - Fixed: ACS function SetSkyScrollSpeed didn't work online. [Edward-san]
4243 - - Fixed: color codes in callvote reasons weren't terminated properly. [Dusk]
diff -r 2986505a6255 -r 3ded1da6e188 src/cl_main.cpp
--- a/src/cl_main.cpp Wed Jun 02 00:22:31 2021 -0400
+++ b/src/cl_main.cpp Wed Jun 02 00:23:17 2021 -0400
@@ -164,6 +164,9 @@
164164 // [Leo] Show how many packets we missed when we experience packet loss.
165165 CVAR( Bool, cl_showpacketloss, false, CVAR_ARCHIVE )
166166
167+// [JS] Always makes us ready when we are in intermission.
168+CVAR( Bool, cl_autoready, false, CVAR_ARCHIVE )
169+
167170 //*****************************************************************************
168171 // PROTOTYPES
169172
@@ -2460,11 +2463,12 @@
24602463 // If we're at intermission, and toggling our "ready to go" status, tell the server.
24612464 if ( gamestate == GS_INTERMISSION )
24622465 {
2463- if (( players[consoleplayer].cmd.ucmd.buttons ^ players[consoleplayer].oldbuttons ) &&
2464- (( players[consoleplayer].cmd.ucmd.buttons & players[consoleplayer].oldbuttons ) == players[consoleplayer].oldbuttons ))
2465- {
2466+ DWORD buttons = players[consoleplayer].cmd.ucmd.buttons;
2467+ DWORD oldButtons = players[consoleplayer].oldbuttons;
2468+
2469+ // [AK] Also toggle our "ready to go" status if we have auto-ready enabled, but do this only once.
2470+ if (( players[consoleplayer].bReadyToGoOn == false ) && (( cl_autoready ) || (( buttons ^ oldButtons ) && ( buttons & oldButtons ) == oldButtons )))
24662471 CLIENTCOMMANDS_ReadyToGoOn( );
2467- }
24682472
24692473 players[consoleplayer].oldbuttons = players[consoleplayer].cmd.ucmd.buttons;
24702474 return;
@@ -7013,6 +7017,8 @@
70137017 return;
70147018 }
70157019
7020+ // [AK] Display the next level on the scoreboard.
7021+ SCOREBOARD_SetNextLevel( nextMap );
70167022 G_ChangeLevel( nextMap, position, true );
70177023 }
70187024
diff -r 2986505a6255 -r 3ded1da6e188 src/scoreboard.cpp
--- a/src/scoreboard.cpp Wed Jun 02 00:22:31 2021 -0400
+++ b/src/scoreboard.cpp Wed Jun 02 00:23:17 2021 -0400
@@ -77,6 +77,7 @@
7777 #include "c_bind.h" // [RC] To tell user what key to press to vote.
7878 #include "domination.h"
7979 #include "st_hud.h"
80+#include "wi_stuff.h"
8081
8182 //*****************************************************************************
8283 // VARIABLES
@@ -108,6 +109,9 @@
108109 // [AK] Who are the two duelers?
109110 static player_t *g_pDuelers[2];
110111
112+// [AK] The level we are entering, to be shown on the intermission screen.
113+static level_info_t *g_pNextLevel;
114+
111115 // Current position of our "pen".
112116 static ULONG g_ulCurYPos;
113117
@@ -183,6 +187,9 @@
183187 // CONSOLE VARIABLES
184188
185189 CVAR (Bool, r_drawspectatingstring, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG );
190+// [JS] Display the amount of time left on the intermission screen.
191+CVAR( Bool, cl_intermissiontimer, false, CVAR_ARCHIVE );
192+
186193 EXTERN_CVAR( Int, screenblocks );
187194 EXTERN_CVAR( Bool, st_scale );
188195
@@ -1605,6 +1612,12 @@
16051612 }
16061613
16071614 //*****************************************************************************
1615+void SCOREBOARD_SetNextLevel( const char *pszMapName )
1616+{
1617+ g_pNextLevel = ( pszMapName != NULL ) ? FindLevelInfo( pszMapName ) : NULL;
1618+}
1619+
1620+//*****************************************************************************
16081621 //
16091622 static void scoreboard_DrawHeader( ULONG ulPlayer )
16101623 {
@@ -1646,6 +1659,22 @@
16461659 HUD_DrawTextCentered( SmallFont, CR_GREY, g_ulCurYPos, SCOREBOARD_BuildPlaceString( ulPlayer ), g_bScale );
16471660 g_ulCurYPos += 10;
16481661 }
1662+
1663+ // [JS] Intermission countdown display.
1664+ if (( gamestate == GS_INTERMISSION ) && ( NETWORK_GetState( ) == NETSTATE_CLIENT ) && ( cl_intermissiontimer ))
1665+ {
1666+ FString countdownMessage = "Entering ";
1667+
1668+ // [AK] Display the name of the level we're entering if possible.
1669+ if ( g_pNextLevel != NULL )
1670+ countdownMessage.AppendFormat( "%s: %s", g_pNextLevel->mapname, g_pNextLevel->LookupLevelName( ));
1671+ else
1672+ countdownMessage += "next map";
1673+
1674+ countdownMessage.AppendFormat( " in %d seconds", MAX( static_cast<int>( WI_GetStopWatch( )) / TICRATE + 1, 1 ));
1675+ HUD_DrawTextCentered( SmallFont, CR_GREEN, g_ulCurYPos, countdownMessage, HUD_IsScaled( ));
1676+ g_ulCurYPos += 10;
1677+ }
16491678 }
16501679
16511680 //*****************************************************************************
diff -r 2986505a6255 -r 3ded1da6e188 src/scoreboard.h
--- a/src/scoreboard.h Wed Jun 02 00:22:31 2021 -0400
+++ b/src/scoreboard.h Wed Jun 02 00:23:17 2021 -0400
@@ -112,6 +112,7 @@
112112 LONG SCOREBOARD_GetSpread( void );
113113 LONG SCOREBOARD_GetLeftToLimit( void );
114114 bool SCOREBOARD_IsTied( void );
115+void SCOREBOARD_SetNextLevel( const char *pszMapName );
115116 FString SCOREBOARD_SpellOrdinal( int ranknum, bool bColored = false );
116117
117118 #endif // __SCOREBOARD_H__
diff -r 2986505a6255 -r 3ded1da6e188 src/wi_stuff.cpp
--- a/src/wi_stuff.cpp Wed Jun 02 00:22:31 2021 -0400
+++ b/src/wi_stuff.cpp Wed Jun 02 00:23:17 2021 -0400
@@ -202,6 +202,9 @@
202202
203203 #define SHOWNEXTLOCDELAY 4 // in seconds
204204
205+// [AK] How much time the server stays on the intermission screen.
206+#define SERVERSTOPWATCHDELAY 15
207+
205208 static int acceleratestage; // used to accelerate or skip a stage
206209 static int me; // wbs->pnum
207210 static stateenum_t state; // specifies current state
@@ -2498,6 +2501,10 @@
24982501 // [BC] Clients can't check for accelerate.
24992502 if ( NETWORK_InClientMode() )
25002503 {
2504+ // [AK] Let them still count down the intermission timer.
2505+ if ( g_lStopWatch > 0 )
2506+ g_lStopWatch--;
2507+
25012508 return;
25022509 }
25032510
@@ -2505,10 +2512,9 @@
25052512 // it's been 15 or more seconds, end intermission.
25062513 if ( NETWORK_GetState( ) == NETSTATE_SERVER )
25072514 {
2508- g_lStopWatch++;
2509- if ( g_lStopWatch >= ( 15 * TICRATE ))
2515+ if ( --g_lStopWatch <= 0 )
25102516 {
2511- g_lStopWatch = 0;
2517+ g_lStopWatch = SERVERSTOPWATCHDELAY * TICRATE;
25122518 acceleratestage = 1;
25132519 }
25142520
@@ -2730,7 +2736,11 @@
27302736 plrs = wbs->plyr;
27312737
27322738 // [BC] Initialize the stopwatch.
2733- g_lStopWatch = 0;
2739+ g_lStopWatch = SERVERSTOPWATCHDELAY * TICRATE;
2740+
2741+ // [AK] Add a few extra seconds to the stopwatch for clients.
2742+ if ( NETWORK_InClientMode( ))
2743+ g_lStopWatch += ( SHOWNEXTLOCDELAY + 1 ) * TICRATE;
27342744 }
27352745
27362746 void WI_Start (wbstartstruct_t *wbstartstruct)
@@ -2771,3 +2781,9 @@
27712781 players[ulIdx].pSkullBot->PostEvent( BOTEVENT_INTERMISSION );
27722782 }
27732783 }
2784+
2785+// [AK]
2786+LONG WI_GetStopWatch( void )
2787+{
2788+ return ( g_lStopWatch );
2789+}
diff -r 2986505a6255 -r 3ded1da6e188 src/wi_stuff.h
--- a/src/wi_stuff.h Wed Jun 02 00:22:31 2021 -0400
+++ b/src/wi_stuff.h Wed Jun 02 00:23:17 2021 -0400
@@ -88,4 +88,7 @@
8888 // Setup for an intermission screen.
8989 void WI_Start (wbstartstruct_t *wbstartstruct);
9090
91+// [AK] Get the amount of tics left to still display the intermission in online games.
92+LONG WI_GetStopWatch( void );
93+
9194 #endif
diff -r 2986505a6255 -r 3ded1da6e188 wadsrc/static/menudef.za
--- a/wadsrc/static/menudef.za Wed Jun 02 00:22:31 2021 -0400
+++ b/wadsrc/static/menudef.za Wed Jun 02 00:23:17 2021 -0400
@@ -51,6 +51,9 @@
5151 Option "Reset frags at join", "cl_dontrestorefrags", "YesNo"
5252 Option "Hide country", "cl_hidecountry", "YesNo"
5353 Option "Respawn using attack key", "cl_respawnonfire", "YesNo"
54+ Option "Show intermission timer", "cl_intermissiontimer", "YesNo"
55+ Option "Intermission auto-ready", "cl_autoready", "YesNo"
56+
5457 StaticText " "
5558 Option "Skins", "cl_skins", "ZA_AllowSkins"
5659 Option "Taunts", "cl_taunts", "OnOff"
Show on old repository browser