Intentfully permit gaps between Emblem IDs

Introduces ET_NONE, to match SECRET_NONE for Challenges
This commit is contained in:
toaster 2024-01-05 20:50:54 +00:00
parent 1b2cad90e7
commit e9b7ed8101
3 changed files with 15 additions and 7 deletions

View file

@ -45,7 +45,7 @@ emblem_t emblemlocations[MAXEMBLEMS];
// Unlockables
unlockable_t unlockables[MAXUNLOCKABLES];
// Number of emblems
// Highest used emblem ID
INT32 numemblems = 0;
// The challenge that will truly let the games begin.
@ -2271,7 +2271,7 @@ static const char *M_GetConditionString(condition_t *cn)
i = cn->requirement-1;
checkLevel = M_EmblemMapNum(&emblemlocations[i]);
if (checkLevel >= nummapheaders || !mapheaderinfo[checkLevel])
if (checkLevel >= nummapheaders || !mapheaderinfo[checkLevel] || emblemlocations[i].type == ET_NONE)
return va("INVALID MEDAL MAP \"%d:%d\"", cn->requirement, checkLevel);
title = M_BuildConditionTitle(checkLevel);
@ -3402,6 +3402,8 @@ INT32 M_CountMedals(boolean all, boolean extraonly)
{
for (i = 0; i < numemblems; ++i)
{
if (emblemlocations[i].type == ET_NONE)
continue;
if ((emblemlocations[i].type == ET_GLOBAL)
&& (emblemlocations[i].flags & GE_NOTMEDAL))
continue;
@ -3432,6 +3434,8 @@ boolean M_GotEnoughMedals(INT32 number)
INT32 i, gottenmedals = 0;
for (i = 0; i < numemblems; ++i)
{
if (emblemlocations[i].type == ET_NONE)
continue;
if (!gamedata->collected[i])
continue;
if (++gottenmedals < number)
@ -3701,6 +3705,9 @@ emblem_t *M_GetLevelEmblems(INT32 mapnum)
while (--i >= 0)
{
if (emblemlocations[i].type == ET_NONE)
continue;
INT32 checkLevel = M_EmblemMapNum(&emblemlocations[i]);
if (checkLevel >= nummapheaders || !mapheaderinfo[checkLevel])

View file

@ -171,10 +171,10 @@ struct conditionset_t
};
// Emblem information
#define ET_GLOBAL 0 // Emblem with a position in space
#define ET_MAP 1 // Beat the map
#define ET_TIME 2 // Get the time
//#define ET_DEVTIME 3 // Time, but the value is tied to a Time Trial demo, not pre-defined
#define ET_NONE 0 // Empty slot
#define ET_GLOBAL 1 // Emblem with a position in space
#define ET_MAP 2 // Beat the map
#define ET_TIME 3 // Get the time
// Global emblem flags
#define GE_NOTMEDAL 1 // Doesn't count towards number of medals

View file

@ -229,7 +229,8 @@ boolean P_CanPickupEmblem(player_t *player, INT32 emblemID)
boolean P_EmblemWasCollected(INT32 emblemID)
{
if (emblemID < 0 || emblemID >= numemblems)
if (emblemID < 0 || emblemID >= numemblems
|| emblemlocations[emblemID].type == ET_NONE)
{
// Invalid emblem ID, can't pickup.
return true;