From 001e2aa42cb090ae9d1aeb395892c2acd246a7b0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 13 Oct 2018 17:54:53 -0400 Subject: [PATCH 1/2] Hard Mode is an unlockable Unlocks at 30 emblems, or 100 matches played --- src/command.c | 25 +++++++++++++++++++++++++ src/d_netcmd.c | 7 +++++++ src/dehacked.c | 2 ++ src/m_cond.c | 33 +++++++++++++++++++-------------- src/m_cond.h | 7 ++++--- 5 files changed, 57 insertions(+), 17 deletions(-) diff --git a/src/command.c b/src/command.c index df5ffa4f..3ca7cb3a 100644 --- a/src/command.c +++ b/src/command.c @@ -1600,6 +1600,31 @@ void CV_AddValue(consvar_t *var, INT32 increment) return; } } + else if (var == &cv_kartspeed) + { + INT32 maxspeed = (M_SecretUnlocked(SECRET_HARDSPEED) ? 2 : 1); + // Special case for the kartspeed variable, used only directly from the menu to prevent selecting hard mode + if (increment > 0) // Going up! + { + newvalue = var->value + 1; + if (newvalue > maxspeed) + newvalue = 0; + var->value = newvalue; + var->string = var->PossibleValue[var->value].strvalue; + var->func(); + return; + } + else if (increment < 0) // Going down! + { + newvalue = var->value - 1; + if (newvalue < 0) + newvalue = maxspeed; + var->value = newvalue; + var->string = var->PossibleValue[var->value].strvalue; + var->func(); + return; + } + } #ifdef PARANOIA if (currentindice == -1) I_Error("CV_AddValue: current value %d not found in possible value\n", diff --git a/src/d_netcmd.c b/src/d_netcmd.c index da303f26..b45322c8 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5233,6 +5233,13 @@ static void KartFrantic_OnChange(void) static void KartSpeed_OnChange(void) { + if (!M_SecretUnlocked(SECRET_HARDSPEED) && cv_kartspeed.value == 2) + { + CONS_Printf(M_GetText("You haven't earned this yet.\n")); + CV_StealthSetValue(&cv_kartspeed, 1); + return; + } + if (G_RaceGametype()) { if ((UINT8)cv_kartspeed.value != gamespeed && gamestate == GS_LEVEL && leveltime > starttime) diff --git a/src/dehacked.c b/src/dehacked.c index 4a7599b9..0082775b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2430,6 +2430,8 @@ static void readunlockable(MYFILE *f, INT32 num) unlockables[num].type = SECRET_ENCORE; else if (fastcmp(word2, "HELLATTACK")) unlockables[num].type = SECRET_HELLATTACK; + else if (fastcmp(word2, "HARDSPEED")) + unlockables[num].type = SECRET_HARDSPEED; else unlockables[num].type = (INT16)i; } diff --git a/src/m_cond.c b/src/m_cond.c index 80b86331..7387a804 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -101,10 +101,11 @@ unlockable_t unlockables[MAXUNLOCKABLES] = /* 02 */ {"SMK Cup", "", -1, 2, SECRET_NONE, 0, false, false, 0}, /* 03 */ {"Chao Cup", "", -1, 3, SECRET_NONE, 0, false, false, 0}, - /* 04 */ {"Encore Mode", "", 3, 4, SECRET_ENCORE, 0, false, false, 0}, - /* 05 */ {"Hell Attack", "", 5, 5, SECRET_HELLATTACK, 0, false, false, 0}, + /* 04 */ {"Hard Game Speed", "", -1, 4, SECRET_HARDSPEED, 0, false, false, 0}, + /* 05 */ {"Encore Mode", "", 4, 5, SECRET_ENCORE, 0, false, false, 0}, + /* 06 */ {"Hell Attack", "", 6, 6, SECRET_HELLATTACK, 0, false, false, 0}, - /* 06 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, + /* 07 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, }; // Default number of emblems and extra emblems @@ -120,23 +121,27 @@ void M_SetupDefaultConditionSets(void) M_AddRawCondition(1, 1, UC_TOTALEMBLEMS, 5, 0, 0); M_AddRawCondition(1, 2, UC_MATCHESPLAYED, 10, 0, 0); - // -- 2: Collect 15 emblems OR play 25 matches - M_AddRawCondition(2, 1, UC_TOTALEMBLEMS, 15, 0, 0); + // -- 2: Collect 10 emblems OR play 25 matches + M_AddRawCondition(2, 1, UC_TOTALEMBLEMS, 10, 0, 0); M_AddRawCondition(2, 2, UC_MATCHESPLAYED, 25, 0, 0); - // -- 3: Collect 30 emblems OR play 50 matches - M_AddRawCondition(3, 1, UC_TOTALEMBLEMS, 30, 0, 0); + // -- 3: Collect 20 emblems OR play 50 matches + M_AddRawCondition(3, 1, UC_TOTALEMBLEMS, 20, 0, 0); M_AddRawCondition(3, 2, UC_MATCHESPLAYED, 50, 0, 0); - // -- 4: Collect 40 emblems OR play 150 matches - M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 40, 0, 0); - M_AddRawCondition(4, 2, UC_MATCHESPLAYED, 150, 0, 0); + // -- 4: Collect 30 emblems OR play 100 matches + M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 30, 0, 0); + M_AddRawCondition(4, 2, UC_MATCHESPLAYED, 100, 0, 0); - // -- 5: Collect 50 emblems ONLY - M_AddRawCondition(5, 1, UC_TOTALEMBLEMS, 50, 0, 0); + // -- 5: Collect 40 emblems OR play 150 matches + M_AddRawCondition(5, 1, UC_TOTALEMBLEMS, 40, 0, 0); + M_AddRawCondition(5, 2, UC_MATCHESPLAYED, 150, 0, 0); - // -- 10: Play 100 matches - M_AddRawCondition(10, 1, UC_MATCHESPLAYED, 100, 0, 0); + // -- 6: Collect 50 emblems ONLY + M_AddRawCondition(6, 1, UC_TOTALEMBLEMS, 50, 0, 0); + + // -- 10: Play 300 matches + M_AddRawCondition(10, 1, UC_MATCHESPLAYED, 300, 0, 0); } void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2) diff --git a/src/m_cond.h b/src/m_cond.h index 81b6803c..f48e6fbe 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -113,7 +113,7 @@ typedef struct } unlockable_t; // I have NO idea why these are going negative, but whatever. -#define SECRET_NONE -6 // Does nil. Use with levels locked by UnlockRequired +#define SECRET_NONE -6 // Does nil. Use with levels locked by UnlockRequired #define SECRET_ITEMFINDER -5 // Enables Item Finder/Emblem Radar #define SECRET_EMBLEMHINTS -4 // Enables Emblem Hints #define SECRET_PANDORA -3 // Enables Pandora's Box @@ -124,8 +124,9 @@ typedef struct #define SECRET_WARP 2 // Selectable warp #define SECRET_SOUNDTEST 3 // Sound Test #define SECRET_CREDITS 4 // Enables Credits -#define SECRET_ENCORE 5 // Enables Encore mode cvar -#define SECRET_HELLATTACK 6 // Map Hell in record attack +#define SECRET_ENCORE 5 // Enables Encore mode cvar +#define SECRET_HELLATTACK 6 // Map Hell in record attack +#define SECRET_HARDSPEED 7 // Enables Hard gamespeed // If you have more secrets than these variables allow in your game, // you seriously need to get a life. From 8024ad74b53676d5e41d8c299008d0c13a73bd3d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 22:02:10 -0400 Subject: [PATCH 2/2] Quick fix for banana cheat not showing all unlockables Plus, this is generally better, as a mod could let you unlock stuff "out-of-order" --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 03e74a9a..c3d431b5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5096,7 +5096,7 @@ static void M_DrawChecklist(void) { if (unlockables[i].name[0] == 0 || unlockables[i].nochecklist || !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS - || !M_Achieved(unlockables[i].showconditionset - 1)) + || (!M_Achieved(unlockables[i].showconditionset - 1) && !unlockables[i].unlocked)) continue; ++line;