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

@ -7426,7 +7426,12 @@ struct {
{"SF_X8AWAYSOUND",SF_X8AWAYSOUND},
{"SF_NOINTERRUPT",SF_NOINTERRUPT},
{"SF_X2AWAYSOUND",SF_X2AWAYSOUND},
// Map emblem var flags
{"ME_ALLEMERALDS",ME_ALLEMERALDS},
{"ME_ULTIMATE",ME_ULTIMATE},
{"ME_PERFECT",ME_PERFECT},
#ifdef HAVE_BLUA
// p_local.h constants
{"FLOATSPEED",FLOATSPEED},

View File

@ -963,7 +963,7 @@ UINT8 M_CheckLevelEmblems(void)
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 embtype;
@ -978,23 +978,20 @@ UINT8 M_CompletionEmblems(void) // Bah! Duplication! :/
levelnum = emblemlocations[i].level;
embtype = emblemlocations[i].var;
switch (embtype)
{
case 1: // Requires map to be beaten with all emeralds
res = ((mapvisited[levelnum - 1] & MV_ALLEMERALDS) == MV_ALLEMERALDS);
break;
case 2: // Requires map to be beaten in Ultimate mode
res = ((mapvisited[levelnum - 1] & MV_ULTIMATE) == MV_ULTIMATE);
break;
case 3: // Requires map to be beaten with a perfect bonus
res = ((mapvisited[levelnum - 1] & MV_PERFECT) == MV_PERFECT);
break;
default: // Requires map to be beaten, no special requirements
res = ((mapvisited[levelnum - 1] & MV_BEATEN) == MV_BEATEN);
break;
}
UINT8 flags = MV_BEATEN;
if (embtype & ME_ALLEMERALDS)
flags |= MV_ALLEMERALDS;
if (embtype & ME_ULTIMATE)
flags |= MV_ULTIMATE;
if (embtype & ME_PERFECT)
flags |= MV_PERFECT;
res = ((mapvisited[levelnum - 1] & flags) == flags);
emblemlocations[i].collected = res;
if (res)
++somethingUnlocked;

View File

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