- If you add a file (and you've unlocked Addons on non-DEVELOP builds) this gets achieved
- Also, Custom # of Rounds Played conditions will show "Custom" only if Addons are loaded
This commit is contained in:
toaster 2023-03-04 21:36:58 +00:00
parent f7617e7530
commit 1ae5df651d
5 changed files with 36 additions and 7 deletions

View file

@ -2525,10 +2525,11 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return; return;
} }
} }
else if (fastcmp(params[0], "CRASH")) else if ((offset=0) || fastcmp(params[0], "ADDON")
|| (++offset && fastcmp(params[0], "CRASH")))
{ {
//PARAMCHECK(1); //PARAMCHECK(1);
ty = UC_CRASH; ty = UC_ADDON + offset;
} }
else if ((offset=0) || fastcmp(params[0], "AND") else if ((offset=0) || fastcmp(params[0], "AND")
|| (++offset && fastcmp(params[0], "COMMA"))) || (++offset && fastcmp(params[0], "COMMA")))

View file

@ -4425,6 +4425,8 @@ void G_LoadGameData(void)
gamedata->crashflags = READUINT8(save.p); gamedata->crashflags = READUINT8(save.p);
if (gamedata->crashflags & GDCRASH_LAST) if (gamedata->crashflags & GDCRASH_LAST)
gamedata->crashflags |= GDCRASH_ANY; gamedata->crashflags |= GDCRASH_ANY;
gamedata->everloadedaddon = (boolean)READUINT8(save.p);
} }
else else
{ {
@ -4598,7 +4600,7 @@ void G_SaveGameData(boolean dirty)
return; return;
} }
length = (4+1+4+4+(4*GDGT_MAX)+1+4+(MAXEMBLEMS+(MAXUNLOCKABLES*2)+MAXCONDITIONSETS)+4+4+2); length = (4+1+4+4+(4*GDGT_MAX)+1+1+4+(MAXEMBLEMS+(MAXUNLOCKABLES*2)+MAXCONDITIONSETS)+4+4+2);
if (gamedata->challengegrid) if (gamedata->challengegrid)
{ {
length += gamedata->challengegridwidth * CHALLENGEGRIDHEIGHT; length += gamedata->challengegridwidth * CHALLENGEGRIDHEIGHT;
@ -4630,6 +4632,8 @@ void G_SaveGameData(boolean dirty)
WRITEUINT8(save.p, crashflags); // 1 WRITEUINT8(save.p, crashflags); // 1
} }
WRITEUINT8(save.p, gamedata->everloadedaddon); // 1
WRITEUINT32(save.p, quickncasehash(timeattackfolder, 64)); WRITEUINT32(save.p, quickncasehash(timeattackfolder, 64));
// To save space, use one bit per collected/achieved/unlocked flag // To save space, use one bit per collected/achieved/unlocked flag

View file

@ -532,6 +532,8 @@ void M_ClearStats(void)
for (i = 0; i < GDGT_MAX; ++i) for (i = 0; i < GDGT_MAX; ++i)
gamedata->roundsplayed[i] = 0; gamedata->roundsplayed[i] = 0;
gamedata->timesBeaten = 0; gamedata->timesBeaten = 0;
gamedata->everloadedaddon = false;
gamedata->crashflags = 0; gamedata->crashflags = 0;
} }
@ -695,6 +697,13 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
return gamedata->unlocked[cn->requirement-1]; return gamedata->unlocked[cn->requirement-1];
case UC_CONDITIONSET: // requires condition set x to already be achieved case UC_CONDITIONSET: // requires condition set x to already be achieved
return M_Achieved(cn->requirement-1); return M_Achieved(cn->requirement-1);
case UC_ADDON:
return (
#ifndef DEVELOP
M_SecretUnlocked(SECRET_ADDONS, true) &&
#endif
(gamedata->everloadedaddon == true));
case UC_CRASH: case UC_CRASH:
if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY)) if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY))
{ {
@ -863,9 +872,8 @@ static const char *M_GetConditionString(condition_t *cn)
if (cn->extrainfo1 == GDGT_MAX) if (cn->extrainfo1 == GDGT_MAX)
work = ""; work = "";
else if (cn->extrainfo1 != GDGT_RACE else if (cn->extrainfo1 != GDGT_RACE && cn->extrainfo1 != GDGT_BATTLE // Base gametypes
&& cn->extrainfo1 != GDGT_BATTLE && (cn->extrainfo1 != GDGT_CUSTOM || M_SecretUnlocked(SECRET_ADDONS, true) == false) // Custom is visible at 0 if addons are unlocked
&& cn->extrainfo1 != GDGT_CUSTOM
&& gamedata->roundsplayed[cn->extrainfo1] == 0) && gamedata->roundsplayed[cn->extrainfo1] == 0)
work = " ???"; work = " ???";
else switch (cn->extrainfo1) else switch (cn->extrainfo1)
@ -1025,6 +1033,11 @@ static const char *M_GetConditionString(condition_t *cn)
gamedata->unlocked[cn->requirement-1] gamedata->unlocked[cn->requirement-1]
? unlockables[cn->requirement-1].name ? unlockables[cn->requirement-1].name
: "???"); : "???");
case UC_ADDON:
if (!M_SecretUnlocked(SECRET_ADDONS, true) && !gamedata->everloadedaddon)
return NULL;
return "Load a custom addon into \"Dr. Robotnik's Ring Racers\"";
case UC_CRASH: case UC_CRASH:
if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY)) if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY))
return "Launch \"Dr. Robotnik's Ring Racers\" again after a game crash"; return "Launch \"Dr. Robotnik's Ring Racers\" again after a game crash";

View file

@ -44,6 +44,7 @@ typedef enum
UC_UNLOCKABLE, // UNLOCKABLE [unlockable number] UC_UNLOCKABLE, // UNLOCKABLE [unlockable number]
UC_CONDITIONSET, // CONDITIONSET [condition set number] UC_CONDITIONSET, // CONDITIONSET [condition set number]
UC_ADDON, // Ever loaded a custom file?
UC_CRASH, // Hee ho ! UC_CRASH, // Hee ho !
// Just for string building // Just for string building
@ -230,7 +231,8 @@ struct gamedata_t
UINT32 roundsplayed[GDGT_MAX]; UINT32 roundsplayed[GDGT_MAX];
UINT32 totalrings; UINT32 totalrings;
// Funny // SPECIFIC SPECIAL EVENTS
boolean everloadedaddon;
UINT8 crashflags; UINT8 crashflags;
}; };

View file

@ -49,6 +49,7 @@
#include "fastcmp.h" #include "fastcmp.h"
#include "g_game.h" // G_LoadGameData #include "g_game.h" // G_LoadGameData
#include "m_cond.h" // gamedata itself
#include "filesrch.h" #include "filesrch.h"
#include "i_video.h" // rendermode #include "i_video.h" // rendermode
@ -813,6 +814,14 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
} }
#endif #endif
// Do this immediately before anything of consequence that invalidates gamedata can happen.
if ((mainfile == false) && (gamedata != NULL) && (gamedata->everloadedaddon == false))
{
gamedata->everloadedaddon = true;
M_UpdateUnlockablesAndExtraEmblems(true);
G_SaveGameData(true);
}
switch(type = ResourceFileDetect(filename)) switch(type = ResourceFileDetect(filename))
{ {
case RET_SOC: case RET_SOC: