AUTOMEDAL_MAX for range checks

Comments have also been updated to acknowledge the AUTOMEDAL_ constants
This commit is contained in:
toaster 2024-01-05 12:03:18 +00:00
parent 7521e42e62
commit 6feb8370f6
3 changed files with 5 additions and 4 deletions

View file

@ -482,9 +482,9 @@ bademblem:
else
stickermedalinfo.timetoreach = mapheaderinfo[map]->ghostBrief[emblem->tag-1]->time;
}
else if (emblem->tag < 0 && emblem->tag >= -4)
else if (emblem->tag < 0 && emblem->tag > AUTOMEDAL_MAX)
{
// Use auto medal times for emblem tags from -4 to -1
// Use auto medal times for emblem tags, see AUTOMEDAL_ in m_cond.h
int index = -emblem->tag - 1; // 0 is Platinum, 3 is Bronze
stickermedalinfo.timetoreach = mapheaderinfo[map]->automedaltime[index];
}

View file

@ -3160,9 +3160,9 @@ UINT16 M_CheckLevelEmblems(void)
res = (G_GetBestTime(levelnum) <= mapheaderinfo[checkLevel]->ghostBrief[tag-1]->time);
}
else if (tag < 0 && tag >= -4)
else if (tag < 0 && tag > AUTOMEDAL_MAX)
{
// Use auto medal times for emblem tags from -4 to -1
// Use auto medal times for emblem tags, see AUTOMEDAL_ in m_cond.h
int index = -tag - 1; // 0 is Platinum, 3 is Bronze
tic_t time = mapheaderinfo[checkLevel]->automedaltime[index];

View file

@ -186,6 +186,7 @@ struct conditionset_t
#define ME_SPBATTACK 2 // Achieve in SPB Attack
// Automedal SOC tags
#define AUTOMEDAL_MAX -5 // just in case any more are ever added
#define AUTOMEDAL_BRONZE -4
#define AUTOMEDAL_SILVER -3
#define AUTOMEDAL_GOLD -2