Challenges Tutorial messages

Currently exists for:
- Generating a Chao Key
- Attempting to use a Chao Key on a Major Challenge
    - Only shows after Generating a Chao Key just so it doesn't fire before you know what's going on
Text is preliminary
This commit is contained in:
toaster 2023-09-29 00:25:51 +01:00
parent 07afe6cb06
commit 911588a5fe
6 changed files with 88 additions and 3 deletions

View file

@ -4390,12 +4390,15 @@ void G_LoadGameSettings(void)
#define GD_VERSIONCHECK 0xBA5ED123 // Change every major version, as usual #define GD_VERSIONCHECK 0xBA5ED123 // Change every major version, as usual
#define GD_VERSIONMINOR 7 // Change every format update #define GD_VERSIONMINOR 7 // Change every format update
// You can't rearrange these without a special format update
typedef enum typedef enum
{ {
GDEVER_ADDON = 1, GDEVER_ADDON = 1,
GDEVER_CREDITS = 1<<1, GDEVER_CREDITS = 1<<1,
GDEVER_REPLAY = 1<<2, GDEVER_REPLAY = 1<<2,
GDEVER_SPECIAL = 1<<3, GDEVER_SPECIAL = 1<<3,
GDEVER_KEYTUTORIAL = 1<<4,
GDEVER_KEYMAJORSKIP = 1<<5,
} gdeverdone_t; } gdeverdone_t;
static const char *G_GameDataFolder(void) static const char *G_GameDataFolder(void)
@ -4528,6 +4531,8 @@ void G_LoadGameData(void)
gamedata->everfinishedcredits = !!(everflags & GDEVER_CREDITS); gamedata->everfinishedcredits = !!(everflags & GDEVER_CREDITS);
gamedata->eversavedreplay = !!(everflags & GDEVER_REPLAY); gamedata->eversavedreplay = !!(everflags & GDEVER_REPLAY);
gamedata->everseenspecial = !!(everflags & GDEVER_SPECIAL); gamedata->everseenspecial = !!(everflags & GDEVER_SPECIAL);
gamedata->chaokeytutorial = !!(everflags & GDEVER_KEYTUTORIAL);
gamedata->majorkeyskipattempted = !!(everflags & GDEVER_KEYMAJORSKIP);
} }
else else
{ {
@ -5206,6 +5211,10 @@ void G_SaveGameData(void)
everflags |= GDEVER_REPLAY; everflags |= GDEVER_REPLAY;
if (gamedata->everseenspecial) if (gamedata->everseenspecial)
everflags |= GDEVER_SPECIAL; everflags |= GDEVER_SPECIAL;
if (gamedata->chaokeytutorial)
everflags |= GDEVER_KEYTUTORIAL;
if (gamedata->majorkeyskipattempted)
everflags |= GDEVER_KEYMAJORSKIP;
WRITEUINT32(save.p, everflags); // 4 WRITEUINT32(save.p, everflags); // 4
} }

View file

@ -1259,7 +1259,7 @@ extern struct challengesmenu_s {
boolean pending; boolean pending;
boolean requestnew; boolean requestnew;
boolean chaokeyadd; boolean chaokeyadd, keywasadded;
UINT8 chaokeyhold; UINT8 chaokeyhold;
boolean requestflip; boolean requestflip;

View file

@ -5914,7 +5914,7 @@ static void M_DrawChallengeKeys(INT32 tilex, INT32 tiley)
24 << FRACBITS, 24 << FRACBITS,
16 << FRACBITS, 16 << FRACBITS,
0, kp_button_c[1], 0, kp_button_c[1],
M_MenuExtraHeld(pid) menumessage.active == false && M_MenuExtraHeld(pid) == true
); );
// Metyr of rounds played that contribute to Chao Key generation // Metyr of rounds played that contribute to Chao Key generation

View file

@ -658,6 +658,8 @@ void M_ClearStats(void)
gamedata->eversavedreplay = false; gamedata->eversavedreplay = false;
gamedata->everseenspecial = false; gamedata->everseenspecial = false;
gamedata->evercrashed = false; gamedata->evercrashed = false;
gamedata->chaokeytutorial = false;
gamedata->majorkeyskipattempted = false;
gamedata->musicstate = GDMUSIC_NONE; gamedata->musicstate = GDMUSIC_NONE;
gamedata->importprofilewins = false; gamedata->importprofilewins = false;

View file

@ -311,6 +311,8 @@ struct gamedata_t
boolean eversavedreplay; boolean eversavedreplay;
boolean everseenspecial; boolean everseenspecial;
boolean evercrashed; boolean evercrashed;
boolean chaokeytutorial;
boolean majorkeyskipattempted;
gdmusic_t musicstate; gdmusic_t musicstate;
// BACKWARDS COMPAT ASSIST // BACKWARDS COMPAT ASSIST

View file

@ -308,6 +308,7 @@ menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu)
challengesmenu.requestflip = false; challengesmenu.requestflip = false;
challengesmenu.requestnew = false; challengesmenu.requestnew = false;
challengesmenu.chaokeyadd = false; challengesmenu.chaokeyadd = false;
challengesmenu.keywasadded = false;
challengesmenu.chaokeyhold = 0; challengesmenu.chaokeyhold = 0;
challengesmenu.currentunlock = MAXUNLOCKABLES; challengesmenu.currentunlock = MAXUNLOCKABLES;
challengesmenu.unlockcondition = NULL; challengesmenu.unlockcondition = NULL;
@ -392,6 +393,55 @@ static boolean M_CanKeyHiliTile(void)
return true; return true;
} }
enum {
CCTUTORIAL_KEYGEN = 0,
CCTUTORIAL_MAJORSKIP,
} cctutorial_e;
static void M_ChallengesTutorial(UINT8 option)
{
switch (option)
{
case CCTUTORIAL_KEYGEN:
{
M_StartMessage("Challenges & Chao Keys",
va(M_GetText(
"You just generated a Chao Key!\n"
"\n"
"They can be used to skip your way past\n"
"any Challenges you can see a hint for.\n"
"\n"
"But use them wisely - it'll take\n"
"%u rounds to pick up another.\n"
), GDCONVERT_ROUNDSTOKEY
), NULL, MM_NOTHING, NULL, NULL);
gamedata->chaokeytutorial = true;
break;
}
case CCTUTORIAL_MAJORSKIP:
{
M_StartMessage("Major Challenges & Chao Keys",
M_GetText(
"The larger tiles are Major Challenges.\n"
"They are significant tests of skill.\n"
"\n"
"If you're struggling and need to skip one,\n"
"not only will it cost you 10 Chao Keys, but\n"
"every nearby Challenge must be unlocked!\n"
), NULL, MM_NOTHING, NULL, "Wow, that's a lot");
gamedata->majorkeyskipattempted = true;
break;
}
default:
{
M_StartMessage("M_ChallengesTutorial ERROR",
"Invalid argument!?\n",
NULL, MM_NOTHING, NULL, NULL);
break;
}
}
}
void M_ChallengesTick(void) void M_ChallengesTick(void)
{ {
const UINT8 pid = 0; const UINT8 pid = 0;
@ -536,6 +586,8 @@ void M_ChallengesTick(void)
if (gamedata->musicstate < GDMUSIC_KEYG) if (gamedata->musicstate < GDMUSIC_KEYG)
gamedata->musicstate = GDMUSIC_KEYG; gamedata->musicstate = GDMUSIC_KEYG;
challengesmenu.keywasadded = true;
} }
} }
} }
@ -652,6 +704,12 @@ void M_ChallengesTick(void)
{ {
// Play music the moment control returns. // Play music the moment control returns.
M_PlayMenuJam(); M_PlayMenuJam();
if (gamedata->chaokeytutorial == false
&& challengesmenu.keywasadded == true)
{
M_ChallengesTutorial(CCTUTORIAL_KEYGEN);
}
} }
} }
} }
@ -671,7 +729,15 @@ boolean M_ChallengesInputs(INT32 ch)
} }
else if (M_MenuExtraPressed(pid)) else if (M_MenuExtraPressed(pid))
{ {
if (M_CanKeyHiliTile()) if (gamedata->chaokeytutorial == true
&& gamedata->majorkeyskipattempted == false
&& challengesmenu.currentunlock < MAXUNLOCKABLES
&& gamedata->unlocked[challengesmenu.currentunlock] == false
&& unlockables[challengesmenu.currentunlock].majorunlock == true)
{
M_ChallengesTutorial(CCTUTORIAL_MAJORSKIP);
}
else if (M_CanKeyHiliTile())
{ {
challengesmenu.chaokeyhold = 1; challengesmenu.chaokeyhold = 1;
} }
@ -696,6 +762,12 @@ boolean M_ChallengesInputs(INT32 ch)
{ {
gamedata->chaokeys++; gamedata->chaokeys++;
challengesmenu.unlockcount[CMC_CHAOANIM]++; challengesmenu.unlockcount[CMC_CHAOANIM]++;
if (gamedata->chaokeytutorial == false)
{
M_ChallengesTutorial(CCTUTORIAL_KEYGEN);
}
S_StartSound(NULL, sfx_dbgsal); S_StartSound(NULL, sfx_dbgsal);
return true; return true;
} }