diff --git a/src/deh_soc.c b/src/deh_soc.c index 8621b495e..52d2e7501 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2261,32 +2261,30 @@ void readunlockable(MYFILE *f, INT32 num) { if (fastcmp(word2, "NONE")) unlockables[num].type = SECRET_NONE; - else if (fastcmp(word2, "HEADER")) - unlockables[num].type = SECRET_HEADER; + else if (fastcmp(word2, "EXTRAMEDAL")) + unlockables[num].type = SECRET_EXTRAMEDAL; + else if (fastcmp(word2, "CUP")) + unlockables[num].type = SECRET_CUP; + else if (fastcmp(word2, "MAP")) + unlockables[num].type = SECRET_MAP; else if (fastcmp(word2, "SKIN")) unlockables[num].type = SECRET_SKIN; else if (fastcmp(word2, "FOLLOWER")) unlockables[num].type = SECRET_FOLLOWER; + else if (fastcmp(word2, "HARDSPEED")) + unlockables[num].type = SECRET_HARDSPEED; + else if (fastcmp(word2, "ENCORE")) + unlockables[num].type = SECRET_ENCORE; + else if (fastcmp(word2, "LEGACYBOXRUMMAGE")) + unlockables[num].type = SECRET_LEGACYBOXRUMMAGE; else if (fastcmp(word2, "TIMEATTACK")) unlockables[num].type = SECRET_TIMEATTACK; else if (fastcmp(word2, "BREAKTHECAPSULES")) unlockables[num].type = SECRET_BREAKTHECAPSULES; else if (fastcmp(word2, "SOUNDTEST")) unlockables[num].type = SECRET_SOUNDTEST; - else if (fastcmp(word2, "CREDITS")) - unlockables[num].type = SECRET_CREDITS; else if (fastcmp(word2, "ITEMFINDER")) unlockables[num].type = SECRET_ITEMFINDER; - else if (fastcmp(word2, "EMBLEMHINTS")) - unlockables[num].type = SECRET_EMBLEMHINTS; - else if (fastcmp(word2, "ENCORE")) - unlockables[num].type = SECRET_ENCORE; - else if (fastcmp(word2, "HARDSPEED")) - unlockables[num].type = SECRET_HARDSPEED; - else if (fastcmp(word2, "HELLATTACK")) - unlockables[num].type = SECRET_HELLATTACK; - else if (fastcmp(word2, "PANDORA")) - unlockables[num].type = SECRET_PANDORA; else unlockables[num].type = (INT16)i; } @@ -2422,10 +2420,10 @@ static void readcondition(UINT8 set, UINT32 id, char *word2) return; } } - else if (fastcmp(params[0], "TOTALEMBLEMS")) + else if (fastcmp(params[0], "TOTALMEDALS")) { PARAMCHECK(1); - ty = UC_TOTALEMBLEMS; + ty = UC_TOTALMEDALS; re = atoi(params[1]); } else if (fastcmp(params[0], "EMBLEM")) diff --git a/src/m_cond.c b/src/m_cond.c index 7e8845815..1bd2c13ac 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -527,8 +527,8 @@ UINT8 M_CheckCondition(condition_t *cn) return (G_GetBestTime(cn->extrainfo1) <= (unsigned)cn->requirement); case UC_TRIGGER: // requires map trigger set return !!(unlocktriggers & (1 << cn->requirement)); - case UC_TOTALEMBLEMS: // Requires number of emblems >= x - return (M_GotEnoughEmblems(cn->requirement)); + case UC_TOTALMEDALS: // Requires number of emblems >= x + return (M_GotEnoughMedals(cn->requirement)); case UC_EMBLEM: // Requires emblem x to be obtained return gamedata->collected[cn->requirement-1]; case UC_UNLOCKABLE: // Requires unlockable x to be obtained @@ -628,7 +628,7 @@ static const char *M_GetConditionString(condition_t *cn) Z_Free(title); return work; } - case UC_TOTALEMBLEMS: // Requires number of emblems >= x + case UC_TOTALMEDALS: // Requires number of emblems >= x return va("Get %d medals", cn->requirement); case UC_EMBLEM: // Requires emblem x to be obtained { @@ -1024,20 +1024,20 @@ boolean M_MapLocked(INT32 mapnum) return !M_CheckNetUnlockByID(mapheaderinfo[mapnum-1]->unlockrequired); } -INT32 M_CountEmblems(void) +INT32 M_CountMedals(boolean all) { INT32 found = 0, i; for (i = 0; i < numemblems; ++i) { - if (!gamedata->collected[i]) + if (!all && !gamedata->collected[i]) continue; found++; } for (i = 0; i < MAXUNLOCKABLES; ++i) { - if (unlockables[i].type != SECRET_EXTRAEMBLEM) + if (unlockables[i].type != SECRET_EXTRAMEDAL) continue; - if (!gamedata->unlocked[i]) + if (!all && !gamedata->unlocked[i]) continue; found++; } @@ -1048,26 +1048,26 @@ INT32 M_CountEmblems(void) // Quick functions for calculating things // -------------------------------------- -// Theoretically faster than using M_CountEmblems() -// Stops when it reaches the target number of emblems. -UINT8 M_GotEnoughEmblems(INT32 number) +// Theoretically faster than using M_CountMedals() +// Stops when it reaches the target number of medals. +UINT8 M_GotEnoughMedals(INT32 number) { - INT32 i, gottenemblems = 0; + INT32 i, gottenmedals = 0; for (i = 0; i < numemblems; ++i) { if (!gamedata->collected[i]) continue; - if (++gottenemblems < number) + if (++gottenmedals < number) continue; return true; } for (i = 0; i < MAXUNLOCKABLES; ++i) { - if (unlockables[i].type != SECRET_EXTRAEMBLEM) + if (unlockables[i].type != SECRET_EXTRAMEDAL) continue; if (!gamedata->unlocked[i]) continue; - if (++gottenemblems < number) + if (++gottenmedals < number) continue; return true; } diff --git a/src/m_cond.h b/src/m_cond.h index e3b1c568d..8932805d4 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -30,7 +30,7 @@ typedef enum UC_MAPENCORE, // MAPENCORE [map number] UC_MAPTIME, // MAPTIME [map number] [time to beat, tics] UC_TRIGGER, // TRIGGER [trigger number] - UC_TOTALEMBLEMS, // TOTALEMBLEMS [number of emblems] + UC_TOTALMEDALS, // TOTALMEDALS [number of emblems] UC_EMBLEM, // EMBLEM [emblem number] UC_UNLOCKABLE, // UNLOCKABLE [unlockable number] UC_CONDITIONSET, // CONDITIONSET [condition set number] @@ -92,27 +92,34 @@ struct unlockable_t UINT8 majorunlock; }; -#define SECRET_NONE 0 // Does nil. Use with levels locked by UnlockRequired -#define SECRET_HEADER 1 // Does nothing on its own, just serves as a header for the menu +typedef enum +{ + SECRET_NONE = 0, // Does nil, useful as a default only -#define SECRET_SKIN 2 // Allow this character to be selected -#define SECRET_FOLLOWER 3 // Allow this follower to be selected + // One step above bragging rights + SECRET_EXTRAMEDAL, // Extra medal for your counter -#define SECRET_EXTRAEMBLEM 4 // Extra Emblems (formerly extraemblem_t) + // Level restrictions (TODO) + SECRET_CUP, // Permit access to entire cup (overrides SECRET_MAP) + SECRET_MAP, // Permit access to single map -#define SECRET_TIMEATTACK 5 // Enables Time Attack on the main menu -#define SECRET_BREAKTHECAPSULES 6 // Enables Break the Capsules on the main menu -#define SECRET_SOUNDTEST 7 // Sound Test -#define SECRET_CREDITS 8 // Enables Credits + // Player restrictions + SECRET_SKIN, // Permit this character + SECRET_FOLLOWER, // Permit this follower -#define SECRET_ITEMFINDER 9 // Enables Item Finder/Emblem Radar -#define SECRET_EMBLEMHINTS 10 // Enables Emblem Hints + // Difficulty restrictions + SECRET_HARDSPEED, // Permit Hard gamespeed + SECRET_ENCORE, // Permit Encore option + SECRET_LEGACYBOXRUMMAGE, // Permit the Legacy Box for record attack, etc -#define SECRET_ENCORE 11 // Enables Encore mode cvar -#define SECRET_HARDSPEED 12 // Enables Hard gamespeed -#define SECRET_HELLATTACK 13 // Map Hell in record attack + // Menu restrictions + SECRET_TIMEATTACK, // Permit Time attack + SECRET_BREAKTHECAPSULES, // Permit SP Capsules + SECRET_SOUNDTEST, // Permit Sound Test -#define SECRET_PANDORA 14 // Enables Pandora's Box + // Assist restrictions + SECRET_ITEMFINDER, // Permit locating in-level secrets +} secrettype_t; // If you have more secrets than these variables allow in your game, // you seriously need to get a life. @@ -201,7 +208,7 @@ UINT8 M_CompletionEmblems(void); boolean M_CheckNetUnlockByID(UINT8 unlockid); boolean M_SecretUnlocked(INT32 type, boolean local); boolean M_MapLocked(INT32 mapnum); -INT32 M_CountEmblems(void); +INT32 M_CountMedals(boolean all); // Emblem shit emblem_t *M_GetLevelEmblems(INT32 mapnum); @@ -211,7 +218,7 @@ const char *M_GetEmblemPatch(emblem_t *em, boolean big); // If you're looking to compare stats for unlocks or what not, use these // They stop checking upon reaching the target number so they // should be (theoretically?) slightly faster. -UINT8 M_GotEnoughEmblems(INT32 number); +UINT8 M_GotEnoughMedals(INT32 number); UINT8 M_GotLowEnoughTime(INT32 tictime); INT32 M_UnlockableSkinNum(unlockable_t *unlock);