Map emblem type flags

As per toaster's request
This commit is contained in:
TehRealSalt 2017-03-22 14:45:26 -04:00
parent b418ac0acb
commit 92e785a9f2
3 changed files with 26 additions and 19 deletions

View file

@ -7427,6 +7427,11 @@ struct {
{"SF_NOINTERRUPT",SF_NOINTERRUPT}, {"SF_NOINTERRUPT",SF_NOINTERRUPT},
{"SF_X2AWAYSOUND",SF_X2AWAYSOUND}, {"SF_X2AWAYSOUND",SF_X2AWAYSOUND},
// Map emblem var flags
{"ME_ALLEMERALDS",ME_ALLEMERALDS},
{"ME_ULTIMATE",ME_ULTIMATE},
{"ME_PERFECT",ME_PERFECT},
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
// p_local.h constants // p_local.h constants
{"FLOATSPEED",FLOATSPEED}, {"FLOATSPEED",FLOATSPEED},

View file

@ -963,7 +963,7 @@ UINT8 M_CheckLevelEmblems(void)
return somethingUnlocked; return somethingUnlocked;
} }
UINT8 M_CompletionEmblems(void) // Bah! Duplication! :/ UINT8 M_CompletionEmblems(void) // Bah! Duplication sucks, but it's for a separate print when awarding emblems and it's sorta different enough.
{ {
INT32 i; INT32 i;
INT32 embtype; INT32 embtype;
@ -979,21 +979,18 @@ UINT8 M_CompletionEmblems(void) // Bah! Duplication! :/
levelnum = emblemlocations[i].level; levelnum = emblemlocations[i].level;
embtype = emblemlocations[i].var; embtype = emblemlocations[i].var;
switch (embtype) UINT8 flags = MV_BEATEN;
{
case 1: // Requires map to be beaten with all emeralds if (embtype & ME_ALLEMERALDS)
res = ((mapvisited[levelnum - 1] & MV_ALLEMERALDS) == MV_ALLEMERALDS); flags |= MV_ALLEMERALDS;
break;
case 2: // Requires map to be beaten in Ultimate mode if (embtype & ME_ULTIMATE)
res = ((mapvisited[levelnum - 1] & MV_ULTIMATE) == MV_ULTIMATE); flags |= MV_ULTIMATE;
break;
case 3: // Requires map to be beaten with a perfect bonus if (embtype & ME_PERFECT)
res = ((mapvisited[levelnum - 1] & MV_PERFECT) == MV_PERFECT); flags |= MV_PERFECT;
break;
default: // Requires map to be beaten, no special requirements res = ((mapvisited[levelnum - 1] & flags) == flags);
res = ((mapvisited[levelnum - 1] & MV_BEATEN) == MV_BEATEN);
break;
}
emblemlocations[i].collected = res; emblemlocations[i].collected = res;
if (res) if (res)

View file

@ -75,6 +75,11 @@ typedef struct
#define ET_NTIME 6 #define ET_NTIME 6
#define ET_MAP 7 #define ET_MAP 7
// Map emblem flags
#define ME_ALLEMERALDS 1
#define ME_ULTIMATE 2
#define ME_PERFECT 4
typedef struct typedef struct
{ {
UINT8 type; ///< Emblem type UINT8 type; ///< Emblem type