From 8cbdc999f4dac7dfc687b2ccd40e5e4138fa80b6 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:19:04 -0700 Subject: [PATCH 1/8] Block playing by yourself in TESTERS build with le funni message SV_SpawnServer is called in instances other than joining a server or watching a replay. How convenient, huh? --- src/d_clisrv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4d61194c4..024194155 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3623,6 +3623,11 @@ boolean Playing(void) boolean SV_SpawnServer(void) { +#ifdef TESTERS + /* Just don't let the testers play. Easy. */ + I_Error("What do you think you're doing?"); + return 0; +#else if (demo.playback) G_StopDemo(); // reset engine parameter if (metalplayback) @@ -3649,6 +3654,7 @@ boolean SV_SpawnServer(void) } return SV_AddWaitingPlayers(); +#endif } void SV_StopServer(void) From 246280045cb1291d3bf1f2bb043e87388c6787b8 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:20:55 -0700 Subject: [PATCH 2/8] Fix crash in TESTERS build if you try to record demo anyway --- src/sdl/i_system.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index d24bd5ade..76fdab684 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3177,11 +3177,14 @@ void I_Error(const char *error, ...) #endif G_SaveGameData(false); // Tails 12-08-2002 + /* Prevent segmentation fault if testers go to Record Attack... */ +#ifndef TESTERS // Shutdown. Here might be other errors. if (demo.recording) G_CheckDemoStatus(); if (metalrecording) G_StopMetalRecording(); +#endif D_QuitNetGame(); I_ShutdownMusic(); From 03b3d61fd1d37993d23451d6337f1ac1855ee787 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:21:18 -0700 Subject: [PATCH 3/8] Add TESTERS build flag to Makefile --- src/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Makefile b/src/Makefile index f4a77aedd..3d997eacb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -60,6 +60,7 @@ # Compile with GCC 4.6x version, add 'GCC46=1' # Compile a profile version, add 'PROFILEMODE=1' # Compile a debug version, add 'DEBUGMODE=1' +# Compile for the testers group (they don't get to play unless we're watching *wink*), add 'TESTERS=1' # Compile with extra warnings, add 'WARNINGMODE=1' # Compile without NASM's tmap.nas, add 'NOASM=1' # Compile without 3D hardware support, add 'NOHW=1' @@ -434,6 +435,10 @@ else endif CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS) +ifdef TESTERS + OPTS+=-DTESTERS +endif + ifdef YASM ifdef STABS NASMOPTS?= -g stabs From b64dccd498d1bc4a977672b64e8d37194793b3fa Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:56:18 -0700 Subject: [PATCH 4/8] Hide Record Attack in TESTERS build --- src/m_menu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 166b115d6..ab13fdd8d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -474,9 +474,14 @@ static menuitem_t MainMenu[] = { {IT_SUBMENU|IT_STRING, NULL, "Extras", &SR_MainDef, 76}, //{IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 84}, +#ifdef TESTERS + {IT_GRAYEDOUT, NULL, "Time Attack", NULL, 84}, +#else {IT_CALL |IT_STRING, NULL, "Time Attack", M_TimeAttack, 84}, +#endif {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 92}, {IT_CALL |IT_STRING, NULL, "Options", M_Options, 100}, + /* I don't think is useful at all... */ {IT_CALL |IT_STRING, NULL, "Addons", M_Addons, 108}, {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, }; @@ -3029,7 +3034,11 @@ void M_StartControlPanel(void) //MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); currentMenu = &MainDef; +#ifdef TESTERS + itemOn = multiplr; +#else itemOn = singleplr; +#endif } else if (modeattacking) { @@ -4092,6 +4101,14 @@ static void M_DrawCenteredMenu(void) W_CachePatchName(currentMenu->menuitems[i].patch,PU_CACHE), graymap); y += LINEHEIGHT; break; + case IT_TRANSTEXT: + if (currentMenu->menuitems[i].alphaKey) + y = currentMenu->y+currentMenu->menuitems[i].alphaKey; + /* FALLTHRU */ + case IT_TRANSTEXT2: + V_DrawCenteredString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text); + y += SMALLLINEHEIGHT; + break; } } From 7a201ea993d355f6b448548c4f1987bec50bccc7 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:56:41 -0700 Subject: [PATCH 5/8] Hide Unlockables --- src/m_menu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index ab13fdd8d..c971654fb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -732,7 +732,9 @@ static menuitem_t SR_PandorasBox[] = // Sky Room Custom Unlocks static menuitem_t SR_MainMenu[] = { +#ifndef TESTERS {IT_STRING|IT_SUBMENU, NULL, "Unlockables", &SR_UnlockChecklistDef, 100}, +#endif {IT_CALL|IT_STRING|IT_CALL_NOTMODIFIED, NULL, "Statistics", M_Statistics, 108}, {IT_CALL|IT_STRING, NULL, "Replay Hut", M_ReplayHut, 116}, {IT_DISABLED, NULL, "", NULL, 0}, // Custom1 From 5ceff36ac1445b64bd16224acb3ce30e3ccdc024 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 19:58:55 -0700 Subject: [PATCH 6/8] Hide Multiplayer hosting options and Offline Mode --- src/m_menu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index c971654fb..ec5161cc6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -89,6 +89,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #define SLIDER_WIDTH (8*SLIDER_RANGE+6) #define SERVERS_PER_PAGE 11 +#if defined (NONET) || defined (TESTERS) +#define NOMENUHOST +#endif + typedef enum { QUITMSG = 0, @@ -968,12 +972,16 @@ static menuitem_t MP_MainMenu[] = {IT_STRING|IT_KEYHANDLER,NULL, "Player setup...", M_SetupMultiHandler,18}, {IT_HEADER, NULL, "Host a game", NULL, 100-24}, -#ifndef NONET +#ifndef NOMENUHOST {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 110-24}, #else {IT_GRAYEDOUT, NULL, "Internet/LAN...", NULL, 110-24}, #endif +#ifdef TESTERS + {IT_GRAYEDOUT, NULL, "Offline...", NULL, 118-24}, +#else {IT_STRING|IT_CALL, NULL, "Offline...", M_StartOfflineServerMenu, 118-24}, +#endif {IT_HEADER, NULL, "Join a game", NULL, 132-24}, #ifndef NONET @@ -8830,7 +8838,7 @@ static void M_DrawMPMainMenu(void) // use generic drawer for cursor, items and title M_DrawGenericMenu(); -#ifndef NONET +#ifndef NOMENUHOST #if MAXPLAYERS != 16 Update the maxplayers label... #endif @@ -8838,10 +8846,12 @@ Update the maxplayers label... ((itemOn == 4) ? highlightflags : 0), "(2-16 players)"); #endif +#ifndef TESTERS V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[5].alphaKey, ((itemOn == 5) ? highlightflags : 0), "(2-4 players)" ); +#endif #ifndef NONET y += MP_MainMenu[8].alphaKey; From e5b6ebaa4ede0c507872d5b1865d9f8786b1481c Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 27 Sep 2019 20:00:46 -0700 Subject: [PATCH 7/8] Disable unused functions in TESTERS build --- src/m_menu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index ec5161cc6..3cab1e76c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -245,14 +245,18 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; // Multiplayer #ifndef NONET +#ifndef TESTERS static void M_StartServerMenu(INT32 choice); +#endif static void M_ConnectMenu(INT32 choice); static void M_ConnectMenuModChecks(INT32 choice); static void M_Refresh(INT32 choice); static void M_Connect(INT32 choice); static void M_ChooseRoom(INT32 choice); #endif +#ifndef TESTERS static void M_StartOfflineServerMenu(INT32 choice); +#endif static void M_StartServer(INT32 choice); static void M_SetupMultiPlayer(INT32 choice); static void M_SetupMultiPlayer2(INT32 choice); @@ -8801,6 +8805,7 @@ static void M_MapChange(INT32 choice) M_SetupNextMenu(&MISC_ChangeLevelDef); } +#ifndef TESTERS static void M_StartOfflineServerMenu(INT32 choice) { (void)choice; @@ -8808,8 +8813,10 @@ static void M_StartOfflineServerMenu(INT32 choice) M_PrepareLevelSelect(); M_SetupNextMenu(&MP_OfflineServerDef); } +#endif #ifndef NONET +#ifndef TESTERS static void M_StartServerMenu(INT32 choice) { (void)choice; @@ -8819,6 +8826,7 @@ static void M_StartServerMenu(INT32 choice) M_SetupNextMenu(&MP_ServerDef); } +#endif // ============== // CONNECT VIA IP From 1b0ba7768c2a80c03e794ec50e79039c31e5f380 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 2 Oct 2019 13:57:14 -0700 Subject: [PATCH 8/8] False instead of 0, a little clearer --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 024194155..3c7712c5a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3626,7 +3626,7 @@ boolean SV_SpawnServer(void) #ifdef TESTERS /* Just don't let the testers play. Easy. */ I_Error("What do you think you're doing?"); - return 0; + return false; #else if (demo.playback) G_StopDemo(); // reset engine parameter