diff --git a/src/deh_soc.c b/src/deh_soc.c index 0fed9db9f..c787437c9 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -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); diff --git a/src/m_cond.c b/src/m_cond.c index 84c0472f6..7fce4101c 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -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); diff --git a/src/m_cond.h b/src/m_cond.h index 693a285e3..4cbe8a678 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -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]