UC_ALLCHAOS, UC_ALLSUPER, and UC_ALLEMERALDS

Measures whether you have all 7 Chaos Emeralds, 7 Super Emeralds, or 14 Emeralds
- Hidden if you haven't entered a special stage yet
- Checks all cups and all relevant difficulties outside of GS_LEVEL
    - You can specify a difficulty of Normal, Hard, or Master
This commit is contained in:
toaster 2023-03-10 22:50:08 +00:00
parent b3aa2520bc
commit 6129d810cc
3 changed files with 99 additions and 0 deletions

View file

@ -2477,6 +2477,28 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return;
}
}
else if ((offset=0) || fastcmp(params[0], "ALLCHAOS")
|| (++offset && fastcmp(params[0], "ALLSUPER"))
|| (++offset && fastcmp(params[0], "ALLEMERALDS")))
{
//PARAMCHECK(1);
ty = UC_ALLCHAOS + offset;
re = 1;
if (params[1])
{
if (fastcmp(params[1], "NORMAL"))
;
else if (fastcmp(params[1], "HARD"))
x1 = 2;
else if (fastcmp(params[1], "MASTER"))
x1 = 3;
else
{
deh_warning("gamespeed requirement \"%s\" invalid for condition ID %d", params[1], id+1);
return;
}
}
}
else if (fastcmp(params[0], "TOTALMEDALS"))
{
PARAMCHECK(1);

View file

@ -712,6 +712,43 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
}
case UC_MAPTIME: // Requires time on map <= x
return (G_GetBestTime(cn->extrainfo1) <= (unsigned)cn->requirement);
case UC_ALLCHAOS:
case UC_ALLSUPER:
case UC_ALLEMERALDS:
{
cupheader_t *cup;
UINT16 ret = 0;
UINT8 i;
if (gamestate == GS_LEVEL)
return false; // this one could be laggy with many cups available
for (cup = kartcupheaders; cup; cup = cup->next)
{
if (cup->emeraldnum == 0)
continue;
i = cn->requirement;
for (i = cn->requirement; i < KARTGP_MAX; i++)
{
if (cup->windata[i].got_emerald == true)
break;
}
if (i == KARTGP_MAX)
continue;
ret |= 1<<(cup->emeraldnum-1);
}
if (cn->type == UC_ALLCHAOS)
return ALLCHAOSEMERALDS(ret);
if (cn->type == UC_ALLSUPER)
return ALLSUPEREMERALDS(ret);
return ALLEMERALDS(ret);
}
case UC_TOTALMEDALS: // Requires number of emblems >= x
return (M_GotEnoughMedals(cn->requirement));
case UC_EMBLEM: // Requires emblem x to be obtained
@ -1026,6 +1063,42 @@ static const char *M_GetConditionString(condition_t *cn)
return work;
}
case UC_ALLCHAOS:
case UC_ALLSUPER:
case UC_ALLEMERALDS:
{
const char *chaostext, *speedtext = "", *orbetter = "";
if (!gamedata->everseenspecial)
return NULL;
if (cn->type == UC_ALLCHAOS)
chaostext = "7 Chaos";
else if (cn->type == UC_ALLSUPER)
chaostext = "7 Super";
else
chaostext = "14";
if (cn->requirement == 1)
{
speedtext = " on Normal difficulty";
//if (M_SecretUnlocked(SECRET_HARDSPEED, true))
orbetter = " or better";
}
else if (cn->requirement == 2)
{
speedtext = " on Hard difficulty";
if (M_SecretUnlocked(SECRET_MASTERMODE, true))
orbetter = " or better";
}
else if (cn->requirement == 3)
{
speedtext = " on Master difficulty";
}
return va("collect all %s Emeralds%s%s", chaostext, speedtext, orbetter);
}
case UC_TOTALMEDALS: // Requires number of emblems >= x
return va("get %d medals", cn->requirement);

View file

@ -43,6 +43,10 @@ typedef enum
UC_MAPSPBATTACK, // MAPSPBATTACK [map]
UC_MAPTIME, // MAPTIME [map] [time to beat, tics]
UC_ALLCHAOS, // ALLCHAOS [minimum difficulty]
UC_ALLSUPER, // ALLSUPER [minimum difficulty]
UC_ALLEMERALDS, // ALLEMERALDS [minimum difficulty]
UC_TOTALMEDALS, // TOTALMEDALS [number of emblems]
UC_EMBLEM, // EMBLEM [emblem number]