Dedicated server -spoilers startup parameter

Servers should get enough free for a healthy launch ecosystem, but not everything.
We'll give the relevant password out after, like, the first week probably? Please be patient, commit-diver
This commit is contained in:
toaster 2024-04-12 14:17:33 +01:00
parent 54d6914b50
commit 2caa5ff018
5 changed files with 97 additions and 35 deletions

View file

@ -3382,8 +3382,7 @@ void SV_ResetServer(void)
// Copy our unlocks to a place where net material can grab at/overwrite them safely.
// (permits all unlocks in dedicated)
for (i = 0; i < MAXUNLOCKABLES; i++)
netUnlocked[i] = (dedicated || gamedata->unlocked[i]);
M_SetNetUnlocked();
expectChallenge = false;

View file

@ -1538,6 +1538,19 @@ void D_SRB2Main(void)
// for dedicated server
dedicated = M_CheckParm("-dedicated") != 0;
if (dedicated)
{
p = M_CheckParm("-spoilers");
if (p && M_IsNextParm())
{
usedTourney = M_TryExactPassword(M_GetNextParm(), "XpsOixVTZSW0cwbiYAVgzokAmWfeYNq5mEckVsktheq4GOUWQecF5lWTkGNBJtoYX9vUMprFzraSovOSCeQ96Q==");
if (usedTourney)
{
CONS_Printf(M_GetText("Spoiler mode ON.\n"));
}
}
}
if (devparm)
CONS_Printf(M_GetText("Development mode ON.\n"));
@ -1932,7 +1945,7 @@ void D_SRB2Main(void)
}
{
if (!M_CheckParm("-server") && !M_CheckParm("-dedicated"))
if (!M_CheckParm("-server") && !dedicated)
{
G_SetUsedCheats();

View file

@ -3640,13 +3640,13 @@ static INT32 TOLMaps(UINT8 pgametype)
// Not completed
continue;
}
}
if (M_MapLocked(i + 1) == true)
{
// We haven't earned this one.
continue;
}
}
num++;
}
@ -3753,13 +3753,13 @@ tryAgain:
// Not completed
continue;
}
}
if (M_MapLocked(i + 1) == true)
{
// We haven't earned this one.
continue;
}
}
if (ignoreBuffers == false)
{
@ -4331,13 +4331,13 @@ void G_GetNextMap(void)
// Not completed
continue;
}
}
if (M_MapLocked(cm + 1) == true)
{
// We haven't earned this one.
continue;
}
}
// If the map is in multiple cups, only consider the first one valid.
if (mapheaderinfo[cm]->cup != cup)
@ -4416,13 +4416,13 @@ void G_GetNextMap(void)
// Not completed
continue;
}
}
if (M_MapLocked(cm + 1) == true)
{
// We haven't earned this one.
continue;
}
}
break;
} while (cm != prevmap);

View file

@ -734,7 +734,6 @@ void M_ClearSecrets(void)
memset(gamedata->collected, 0, sizeof(gamedata->collected));
memset(gamedata->unlocked, 0, sizeof(gamedata->unlocked));
memset(gamedata->unlockpending, 0, sizeof(gamedata->unlockpending));
if (!dedicated)
memset(netUnlocked, 0, sizeof(netUnlocked));
memset(gamedata->achieved, 0, sizeof(gamedata->achieved));
@ -1281,6 +1280,66 @@ void M_FinaliseGameData(void)
M_UpdateUnlockablesAndExtraEmblems(false, true);
}
void M_SetNetUnlocked(void)
{
UINT16 i;
// Use your gamedata as baseline
for (i = 0; i < MAXUNLOCKABLES; i++)
{
netUnlocked[i] = gamedata->unlocked[i];
}
if (!dedicated)
{
return;
}
// Dedicated spoiler password - tournament mode equivalent.
if (usedTourney)
{
for (i = 0; i < MAXUNLOCKABLES; i++)
{
if (unlockables[i].conditionset == 55)
continue;
netUnlocked[i] = true;
}
return;
}
// Okay, now it's dedicated first-week spoilerless behaviour.
for (i = 0; i < MAXUNLOCKABLES; i++)
{
if (netUnlocked[i])
continue;
switch (unlockables[i].type)
{
case SECRET_CUP:
{
// Give the first seven Cups for free.
cupheader_t *cup = M_UnlockableCup(&unlockables[i]);
if (cup && cup->id < 7)
netUnlocked[i] = true;
break;
}
case SECRET_ADDONS:
{
netUnlocked[i] = true;
break;
}
default:
{
// Most stuff isn't given to dedis for free
break;
}
}
}
}
// ----------------------
// Condition set checking
// ----------------------
@ -3404,11 +3463,6 @@ boolean M_SecretUnlocked(INT32 type, boolean local)
boolean M_CupLocked(cupheader_t *cup)
{
// Don't lock maps in dedicated servers.
// That just makes hosts' lives hell.
if (dedicated)
return false;
// No skipping over any part of your marathon.
if (marathonmode)
return false;
@ -3464,11 +3518,6 @@ boolean M_CupSecondRowLocked(void)
boolean M_MapLocked(UINT16 mapnum)
{
// Don't lock maps in dedicated servers.
// That just makes hosts' lives hell.
if (dedicated)
return false;
// No skipping over any part of your marathon.
if (marathonmode)
return false;

View file

@ -443,6 +443,7 @@ void M_ClearConditionSet(UINT16 set);
void M_ClearSecrets(void);
void M_ClearStats(void);
void M_FinaliseGameData(void);
void M_SetNetUnlocked(void);
boolean M_NotFreePlay(void);
UINT16 M_CheckCupEmeralds(UINT8 difficulty);