Goner setup music: Change behaviour

- Hook into M_PlayMenuJam, to reduce bespoke behaviour
- Use the finalised track string
- Play on the Sound Options menu
Also, use MAIN_Goner as reference for the password field's presence, because I lost like 30 minutes to a related bug
This commit is contained in:
toaster 2023-12-17 13:18:35 +00:00
parent a4c91f66ec
commit 647a9d0a0e
3 changed files with 32 additions and 21 deletions

View file

@ -212,6 +212,7 @@ void M_GonerTutorial(INT32 choice);
void M_GonerResetLooking(int type);
void M_GonerCheckLooking(void);
void M_GonerGDQ(boolean opinion);
boolean M_GonerMusicPlayable(void);
extern menuitem_t PLAY_CharSelect[];
extern menu_t PLAY_CharSelectDef;

View file

@ -357,11 +357,6 @@ void M_PlayMenuJam(void)
menu_t *refMenu = (menuactive ? currentMenu : restoreMenu);
static boolean musicstatepermitted = false;
if (M_GameTrulyStarted() == false)
{
return;
}
if (challengesmenu.pending)
{
Music_StopAll();
@ -375,6 +370,17 @@ void M_PlayMenuJam(void)
if (Playing() || soundtest.playing)
return;
if (M_GameTrulyStarted() == false)
{
if (M_GonerMusicPlayable() && NotCurrentlyPlaying("_GONER"))
{
Music_Remap("menu", "_GONER");
Music_Play("menu");
}
return;
}
if (refMenu != NULL && refMenu->music != NULL)
{
if (refMenu->music[0] == '.' && refMenu->music[1] == '\0')
@ -582,6 +588,7 @@ void M_StartControlPanel(void)
// Are you ready for the First Boot Experience?
M_ResetOptions();
currentMenu = &MAIN_GonerDef;
M_PlayMenuJam();
}
else if (cv_currprofile.value == -1) // Only ask once per session.
{

View file

@ -187,7 +187,7 @@ void M_AddGonerLines(void)
// This one always plays, so it checks the levelworking instead of gamedata.
if (goner_levelworking == GDGONER_INTRO)
{
if (!currentMenu->menuitems[0].mvar2)
if (!MAIN_Goner[0].mvar2)
{
LinesToDigest.emplace_front(GONERSPEAKER_EGGMAN, 0,
"Metal Sonic. Are you online?");
@ -406,28 +406,19 @@ void M_GonerRailroad(bool set)
S_StartSound(NULL, sfx_s3k63);
}
void M_GonerPlayMusic(void)
{
if (gamedata->gonerlevel <= GDGONER_SOUND || Music_Playing("menu"))
return;
Music_Remap("menu", "_OCEAN"); //"_GONER");
Music_Play("menu");
}
void M_GonerHidePassword(void)
{
if (currentMenu->menuitems[0].mvar2)
if (MAIN_Goner[0].mvar2)
return;
currentMenu->menuitems[0] =
MAIN_Goner[0] =
{IT_STRING | IT_CALL, "EXIT PROGRAM",
"CONCLUDE OBSERVATIONS NOW.", NULL,
{.routine = M_QuitSRB2}, 0, 1};
S_StartSound(NULL, sfx_s3k5b);
M_GonerPlayMusic();
M_PlayMenuJam();
}
}; // namespace
@ -451,6 +442,20 @@ void M_GonerResetLooking(int type)
goner_youactuallylooked = 0;
}
boolean M_GonerMusicPlayable(void)
{
if (!MAIN_Goner[0].mvar2)
return false;
if (currentMenu == &OPTIONS_SoundDef)
return true;
if (gamedata->gonerlevel <= GDGONER_SOUND)
return false;
return true;
}
void M_GonerCheckLooking(void)
{
if (goner_lasttypelooking != gamedata->gonerlevel)
@ -487,7 +492,7 @@ void M_GonerTick(void)
{
first = goner_gdq = false;
currentMenu->menuitems[0] =
MAIN_Goner[0] =
{IT_STRING | IT_CVAR | IT_CV_STRING, ". . .",
"ATTEMPT ADMINISTRATOR ACCESS.", NULL,
{.cvar = &cv_dummyextraspassword}, 0, 0};
@ -508,8 +513,6 @@ void M_GonerTick(void)
goner_levelworking--;
}
M_GonerPlayMusic();
lastseenlevel = gamedata->gonerlevel;
}