From 98b22c0c6e552a718beb40f472a0cdcb24bde3ec Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 22 Nov 2023 11:40:10 +0000 Subject: [PATCH] Self-review now that I'm not dead tired - Fixes for UC_ALLCUPRECORDS - Actually use the capped difficulty variable - For the "every Cup" case, don't permit modded Cups to affect the result - M_CheckCupEmeralds (referenced for the above) - Also do not permit modded Cups to affect the result --- src/m_cond.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/m_cond.c b/src/m_cond.c index 4928f0407..7815eae6f 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1302,6 +1302,10 @@ UINT16 M_CheckCupEmeralds(UINT8 difficulty) for (cup = kartcupheaders; cup; cup = cup->next) { + // Don't use custom material + if (cup->id >= basenumkartcupheaders) + break; + // Does it not *have* an emerald? if (cup->emeraldnum == 0 || cup->emeraldnum > 14) continue; @@ -1390,22 +1394,25 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) case UC_ALLCUPRECORDS: { - cupheader_t *cup; - UINT8 difficulty = cn->extrainfo2; - if (gamestate == GS_LEVEL) return false; // this one could be laggy with many cups available + INT32 requiredid = cn->requirement; + if (requiredid == -1) // stop at all basegame cup + requiredid = basenumkartcupheaders; + + UINT8 difficulty = cn->extrainfo2; if (difficulty > KARTGP_MASTER) difficulty = KARTGP_MASTER; - + + cupheader_t *cup; for (cup = kartcupheaders; cup; cup = cup->next) { // Ok, achieved up to the desired cup. - if (cn->requirement == cup->id) + if (cup->id == requiredid) return true; - cupwindata_t *windata = &cup->windata[cn->extrainfo2]; + cupwindata_t *windata = &cup->windata[difficulty]; // Did you actually get it? if (windata->best_placement == 0) @@ -1417,7 +1424,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) } // If we ended up here, check we were looking for all cups achieved. - return (cn->requirement == -1); + return (requiredid == basenumkartcupheaders); }