Merge branch 'testers' into 'master'

TESTERS macro and compile flag to disable playing by yourself

See merge request KartKrew/Kart!179
This commit is contained in:
Sal 2019-10-02 17:00:29 -04:00
commit 93f9a9e62c
4 changed files with 53 additions and 2 deletions

View file

@ -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

View file

@ -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 false;
#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)

View file

@ -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,
@ -241,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);
@ -474,9 +482,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},
};
@ -727,7 +740,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
@ -961,12 +976,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
@ -3029,7 +3048,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 +4115,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;
}
}
@ -8774,6 +8805,7 @@ static void M_MapChange(INT32 choice)
M_SetupNextMenu(&MISC_ChangeLevelDef);
}
#ifndef TESTERS
static void M_StartOfflineServerMenu(INT32 choice)
{
(void)choice;
@ -8781,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;
@ -8792,6 +8826,7 @@ static void M_StartServerMenu(INT32 choice)
M_SetupNextMenu(&MP_ServerDef);
}
#endif
// ==============
// CONNECT VIA IP
@ -8811,7 +8846,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
@ -8819,10 +8854,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;

View file

@ -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();