mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Groundwork for later commits
- Make the `SECRET_` constants an easily reshuffable `enum` instead of a series of byzantine `#define`s
- Includes SECRET_CUP and SECRET_MAP in preperation
- Begin the conceptual seperation between Emblems (special in-level objects) and Medals (specific type of emblem that adds to the counter)
- Rename UC_TOTALMEDALS and M_GotEnoughMedals, since the count is a Medals only thing
- M_CountMedals, in addition to being renamed, now has an `all` boolean parameter since getting the total is no longer as easy as `emblems + extraemblems`
This commit is contained in:
parent
bd5d51ac7b
commit
76e290678f
3 changed files with 53 additions and 48 deletions
|
|
@ -2261,32 +2261,30 @@ void readunlockable(MYFILE *f, INT32 num)
|
||||||
{
|
{
|
||||||
if (fastcmp(word2, "NONE"))
|
if (fastcmp(word2, "NONE"))
|
||||||
unlockables[num].type = SECRET_NONE;
|
unlockables[num].type = SECRET_NONE;
|
||||||
else if (fastcmp(word2, "HEADER"))
|
else if (fastcmp(word2, "EXTRAMEDAL"))
|
||||||
unlockables[num].type = SECRET_HEADER;
|
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"))
|
else if (fastcmp(word2, "SKIN"))
|
||||||
unlockables[num].type = SECRET_SKIN;
|
unlockables[num].type = SECRET_SKIN;
|
||||||
else if (fastcmp(word2, "FOLLOWER"))
|
else if (fastcmp(word2, "FOLLOWER"))
|
||||||
unlockables[num].type = SECRET_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"))
|
else if (fastcmp(word2, "TIMEATTACK"))
|
||||||
unlockables[num].type = SECRET_TIMEATTACK;
|
unlockables[num].type = SECRET_TIMEATTACK;
|
||||||
else if (fastcmp(word2, "BREAKTHECAPSULES"))
|
else if (fastcmp(word2, "BREAKTHECAPSULES"))
|
||||||
unlockables[num].type = SECRET_BREAKTHECAPSULES;
|
unlockables[num].type = SECRET_BREAKTHECAPSULES;
|
||||||
else if (fastcmp(word2, "SOUNDTEST"))
|
else if (fastcmp(word2, "SOUNDTEST"))
|
||||||
unlockables[num].type = SECRET_SOUNDTEST;
|
unlockables[num].type = SECRET_SOUNDTEST;
|
||||||
else if (fastcmp(word2, "CREDITS"))
|
|
||||||
unlockables[num].type = SECRET_CREDITS;
|
|
||||||
else if (fastcmp(word2, "ITEMFINDER"))
|
else if (fastcmp(word2, "ITEMFINDER"))
|
||||||
unlockables[num].type = SECRET_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
|
else
|
||||||
unlockables[num].type = (INT16)i;
|
unlockables[num].type = (INT16)i;
|
||||||
}
|
}
|
||||||
|
|
@ -2422,10 +2420,10 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fastcmp(params[0], "TOTALEMBLEMS"))
|
else if (fastcmp(params[0], "TOTALMEDALS"))
|
||||||
{
|
{
|
||||||
PARAMCHECK(1);
|
PARAMCHECK(1);
|
||||||
ty = UC_TOTALEMBLEMS;
|
ty = UC_TOTALMEDALS;
|
||||||
re = atoi(params[1]);
|
re = atoi(params[1]);
|
||||||
}
|
}
|
||||||
else if (fastcmp(params[0], "EMBLEM"))
|
else if (fastcmp(params[0], "EMBLEM"))
|
||||||
|
|
|
||||||
28
src/m_cond.c
28
src/m_cond.c
|
|
@ -527,8 +527,8 @@ UINT8 M_CheckCondition(condition_t *cn)
|
||||||
return (G_GetBestTime(cn->extrainfo1) <= (unsigned)cn->requirement);
|
return (G_GetBestTime(cn->extrainfo1) <= (unsigned)cn->requirement);
|
||||||
case UC_TRIGGER: // requires map trigger set
|
case UC_TRIGGER: // requires map trigger set
|
||||||
return !!(unlocktriggers & (1 << cn->requirement));
|
return !!(unlocktriggers & (1 << cn->requirement));
|
||||||
case UC_TOTALEMBLEMS: // Requires number of emblems >= x
|
case UC_TOTALMEDALS: // Requires number of emblems >= x
|
||||||
return (M_GotEnoughEmblems(cn->requirement));
|
return (M_GotEnoughMedals(cn->requirement));
|
||||||
case UC_EMBLEM: // Requires emblem x to be obtained
|
case UC_EMBLEM: // Requires emblem x to be obtained
|
||||||
return gamedata->collected[cn->requirement-1];
|
return gamedata->collected[cn->requirement-1];
|
||||||
case UC_UNLOCKABLE: // Requires unlockable x to be obtained
|
case UC_UNLOCKABLE: // Requires unlockable x to be obtained
|
||||||
|
|
@ -628,7 +628,7 @@ static const char *M_GetConditionString(condition_t *cn)
|
||||||
Z_Free(title);
|
Z_Free(title);
|
||||||
return work;
|
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);
|
return va("Get %d medals", cn->requirement);
|
||||||
case UC_EMBLEM: // Requires emblem x to be obtained
|
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);
|
return !M_CheckNetUnlockByID(mapheaderinfo[mapnum-1]->unlockrequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 M_CountEmblems(void)
|
INT32 M_CountMedals(boolean all)
|
||||||
{
|
{
|
||||||
INT32 found = 0, i;
|
INT32 found = 0, i;
|
||||||
for (i = 0; i < numemblems; ++i)
|
for (i = 0; i < numemblems; ++i)
|
||||||
{
|
{
|
||||||
if (!gamedata->collected[i])
|
if (!all && !gamedata->collected[i])
|
||||||
continue;
|
continue;
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAXUNLOCKABLES; ++i)
|
for (i = 0; i < MAXUNLOCKABLES; ++i)
|
||||||
{
|
{
|
||||||
if (unlockables[i].type != SECRET_EXTRAEMBLEM)
|
if (unlockables[i].type != SECRET_EXTRAMEDAL)
|
||||||
continue;
|
continue;
|
||||||
if (!gamedata->unlocked[i])
|
if (!all && !gamedata->unlocked[i])
|
||||||
continue;
|
continue;
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
|
|
@ -1048,26 +1048,26 @@ INT32 M_CountEmblems(void)
|
||||||
// Quick functions for calculating things
|
// Quick functions for calculating things
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
// Theoretically faster than using M_CountEmblems()
|
// Theoretically faster than using M_CountMedals()
|
||||||
// Stops when it reaches the target number of emblems.
|
// Stops when it reaches the target number of medals.
|
||||||
UINT8 M_GotEnoughEmblems(INT32 number)
|
UINT8 M_GotEnoughMedals(INT32 number)
|
||||||
{
|
{
|
||||||
INT32 i, gottenemblems = 0;
|
INT32 i, gottenmedals = 0;
|
||||||
for (i = 0; i < numemblems; ++i)
|
for (i = 0; i < numemblems; ++i)
|
||||||
{
|
{
|
||||||
if (!gamedata->collected[i])
|
if (!gamedata->collected[i])
|
||||||
continue;
|
continue;
|
||||||
if (++gottenemblems < number)
|
if (++gottenmedals < number)
|
||||||
continue;
|
continue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAXUNLOCKABLES; ++i)
|
for (i = 0; i < MAXUNLOCKABLES; ++i)
|
||||||
{
|
{
|
||||||
if (unlockables[i].type != SECRET_EXTRAEMBLEM)
|
if (unlockables[i].type != SECRET_EXTRAMEDAL)
|
||||||
continue;
|
continue;
|
||||||
if (!gamedata->unlocked[i])
|
if (!gamedata->unlocked[i])
|
||||||
continue;
|
continue;
|
||||||
if (++gottenemblems < number)
|
if (++gottenmedals < number)
|
||||||
continue;
|
continue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
43
src/m_cond.h
43
src/m_cond.h
|
|
@ -30,7 +30,7 @@ typedef enum
|
||||||
UC_MAPENCORE, // MAPENCORE [map number]
|
UC_MAPENCORE, // MAPENCORE [map number]
|
||||||
UC_MAPTIME, // MAPTIME [map number] [time to beat, tics]
|
UC_MAPTIME, // MAPTIME [map number] [time to beat, tics]
|
||||||
UC_TRIGGER, // TRIGGER [trigger number]
|
UC_TRIGGER, // TRIGGER [trigger number]
|
||||||
UC_TOTALEMBLEMS, // TOTALEMBLEMS [number of emblems]
|
UC_TOTALMEDALS, // TOTALMEDALS [number of emblems]
|
||||||
UC_EMBLEM, // EMBLEM [emblem number]
|
UC_EMBLEM, // EMBLEM [emblem number]
|
||||||
UC_UNLOCKABLE, // UNLOCKABLE [unlockable number]
|
UC_UNLOCKABLE, // UNLOCKABLE [unlockable number]
|
||||||
UC_CONDITIONSET, // CONDITIONSET [condition set number]
|
UC_CONDITIONSET, // CONDITIONSET [condition set number]
|
||||||
|
|
@ -92,27 +92,34 @@ struct unlockable_t
|
||||||
UINT8 majorunlock;
|
UINT8 majorunlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SECRET_NONE 0 // Does nil. Use with levels locked by UnlockRequired
|
typedef enum
|
||||||
#define SECRET_HEADER 1 // Does nothing on its own, just serves as a header for the menu
|
{
|
||||||
|
SECRET_NONE = 0, // Does nil, useful as a default only
|
||||||
|
|
||||||
#define SECRET_SKIN 2 // Allow this character to be selected
|
// One step above bragging rights
|
||||||
#define SECRET_FOLLOWER 3 // Allow this follower to be selected
|
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
|
// Player restrictions
|
||||||
#define SECRET_BREAKTHECAPSULES 6 // Enables Break the Capsules on the main menu
|
SECRET_SKIN, // Permit this character
|
||||||
#define SECRET_SOUNDTEST 7 // Sound Test
|
SECRET_FOLLOWER, // Permit this follower
|
||||||
#define SECRET_CREDITS 8 // Enables Credits
|
|
||||||
|
|
||||||
#define SECRET_ITEMFINDER 9 // Enables Item Finder/Emblem Radar
|
// Difficulty restrictions
|
||||||
#define SECRET_EMBLEMHINTS 10 // Enables Emblem Hints
|
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
|
// Menu restrictions
|
||||||
#define SECRET_HARDSPEED 12 // Enables Hard gamespeed
|
SECRET_TIMEATTACK, // Permit Time attack
|
||||||
#define SECRET_HELLATTACK 13 // Map Hell in record 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,
|
// If you have more secrets than these variables allow in your game,
|
||||||
// you seriously need to get a life.
|
// you seriously need to get a life.
|
||||||
|
|
@ -201,7 +208,7 @@ UINT8 M_CompletionEmblems(void);
|
||||||
boolean M_CheckNetUnlockByID(UINT8 unlockid);
|
boolean M_CheckNetUnlockByID(UINT8 unlockid);
|
||||||
boolean M_SecretUnlocked(INT32 type, boolean local);
|
boolean M_SecretUnlocked(INT32 type, boolean local);
|
||||||
boolean M_MapLocked(INT32 mapnum);
|
boolean M_MapLocked(INT32 mapnum);
|
||||||
INT32 M_CountEmblems(void);
|
INT32 M_CountMedals(boolean all);
|
||||||
|
|
||||||
// Emblem shit
|
// Emblem shit
|
||||||
emblem_t *M_GetLevelEmblems(INT32 mapnum);
|
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
|
// If you're looking to compare stats for unlocks or what not, use these
|
||||||
// They stop checking upon reaching the target number so they
|
// They stop checking upon reaching the target number so they
|
||||||
// should be (theoretically?) slightly faster.
|
// should be (theoretically?) slightly faster.
|
||||||
UINT8 M_GotEnoughEmblems(INT32 number);
|
UINT8 M_GotEnoughMedals(INT32 number);
|
||||||
UINT8 M_GotLowEnoughTime(INT32 tictime);
|
UINT8 M_GotLowEnoughTime(INT32 tictime);
|
||||||
|
|
||||||
INT32 M_UnlockableSkinNum(unlockable_t *unlock);
|
INT32 M_UnlockableSkinNum(unlockable_t *unlock);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue