menu_t, M_PlayMenuJam: const char *music parameter

If Playing(), does nothing.
- If NULL, cycle between Cascade Cave as is traditional.
- If ".", stop music. (will one day be used for sound test)
- Any other case, call S_ChangeMusicInternal on the string directly

Notable menu sets:
- All Extra menus, excepting the Replay Hut, use "EXTRAS"
- Replay Hut uses "REPLAY"
- All online menus use "NETMD2".
    - I know we wanted to do something with switching between "NETMDE" and "NETMD2". I would prefer a more consistent API for transferring song position across between tracks be implemented before implementing this.
    - Known bug: Music restarts when exiting from failed connection screen
    - Known bug: Music goes back to Cascade Cave when selecting "GO" for server creation
        - Wontfix as we want that button to go directly to the voting screen, which we can do in a voting revamp branch
- Data Erase, Profile Erase: "SHWDN2"
    - Not in the spec but I think it's both funny and a valuable tell for the most "dangerous" menu to play with.
    - Also shifts the background to SKINCOLOR_BLACK
This commit is contained in:
toaster 2023-02-01 23:15:51 +00:00
parent f46fbf0418
commit 03d422560d
41 changed files with 73 additions and 4 deletions

View file

@ -2513,7 +2513,10 @@ static void Command_connect(void)
SplitScreen_OnChange();
}
// Menu restore state.
restoreMenu = &PLAY_MP_OptSelectDef;
S_ChangeMusicInternal("NETMD2", true);
CL_ConnectToServer();
}

View file

@ -154,6 +154,7 @@ struct menu_t
INT16 x, y; // x, y of menu
INT16 extra1, extra2; // Can be whatever really! Options menu uses extra1 for bg colour.
const char *music; // Track to play in M_PlayMenuJam. NULL for default, "." to stop
INT16 transitionID; // only transition if IDs match
INT16 transitionTics; // tics for transitions out
@ -1185,6 +1186,7 @@ boolean M_StatisticsInputs(INT32 ch);
0,\
source,\
x, y,\
NULL,\
0, 0,\
M_DrawGenericMenu,\
NULL,\
@ -1201,7 +1203,8 @@ boolean M_StatisticsInputs(INT32 ch);
0,\
source,\
0, 0,\
0, 0, \
0, 0,\
NULL,\
1, 5,\
M_DrawKartGamemodeMenu,\
NULL,\
@ -1217,7 +1220,8 @@ boolean M_StatisticsInputs(INT32 ch);
0,\
source,\
0, 0,\
0, 0, \
0, 0,\
"EXTRAS",\
1, 5,\
M_DrawImageDef,\
NULL,\

View file

@ -358,9 +358,27 @@ boolean M_Responder(event_t *ev)
void M_PlayMenuJam(void)
{
menu_t *refMenu = (menuactive ? currentMenu : restoreMenu);
if (challengesmenu.pending)
return;
if (Playing())
return;
if (refMenu != NULL && refMenu->music != NULL)
{
if (refMenu->music[0] == '.' && refMenu->music[1] == '\0')
{
S_StopMusic();
}
else
{
S_ChangeMusicInternal(refMenu->music, true);
}
return;
}
if (cv_menujam_update.value)
{
CV_AddValue(&cv_menujam, 1);
@ -630,6 +648,7 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition)
}
M_UpdateMenuBGImage(false);
M_PlayMenuJam();
}
void M_GoBack(INT32 choice)

View file

@ -28,6 +28,7 @@ menu_t EXTRAS_MainDef = {
EXTRAS_Main,
0, 0,
0, 0,
"EXTRAS",
2, 5,
M_DrawExtras,
M_ExtrasTick,

View file

@ -23,6 +23,7 @@ menu_t MISC_AddonsDef = {
MISC_AddonsMenu,
50, 28,
0, 0,
"EXTRAS",
0, 0,
M_DrawAddons,
M_AddonsRefresh,

View file

@ -20,6 +20,7 @@ menu_t MISC_ChallengesDef = {
MISC_ChallengesStatsDummyMenu,
BASEVIDWIDTH/2, 32,
0, 0,
"EXTRAS",
98, 0,
M_DrawChallenges,
M_ChallengesTick,
@ -37,6 +38,7 @@ menu_t MISC_StatisticsDef = {
MISC_ChallengesStatsDummyMenu,
280, 185,
0, 0,
"EXTRAS",
98, 0,
M_DrawStatistics,
NULL,

View file

@ -26,6 +26,7 @@ menu_t EXTRAS_ReplayHutDef =
EXTRAS_ReplayHut,
30, 80,
0, 0,
"REPLAY",
41, 1,
M_DrawReplayHut,
NULL,
@ -58,6 +59,7 @@ menu_t EXTRAS_ReplayStartDef =
EXTRAS_ReplayStart,
27, 80,
0, 0,
"REPLAY",
41, 1,
M_DrawReplayStartMenu,
NULL,

View file

@ -15,6 +15,7 @@ menu_t MAIN_ProfilesDef = {
MAIN_Profiles,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
NULL,
2, 5,
M_DrawProfileSelect,
M_OptionsTick,

View file

@ -43,6 +43,7 @@ menu_t OPTIONS_MainDef = {
OPTIONS_Main,
0, 0,
SKINCOLOR_SLATE, 0,
NULL,
2, 5,
M_DrawOptions,
M_OptionsTick,

View file

@ -36,6 +36,7 @@ menu_t OPTIONS_DataDef = {
OPTIONS_Data,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -43,6 +43,7 @@ menu_t OPTIONS_DataAddonDef = {
OPTIONS_DataAddon,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -33,6 +33,7 @@ menu_t OPTIONS_DataDiscordDef = {
OPTIONS_DataDiscord,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -35,7 +35,8 @@ menu_t OPTIONS_DataEraseDef = {
0,
OPTIONS_DataErase,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
SKINCOLOR_BLACK, 0,
"SHWDN2", // Danger.
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -16,7 +16,8 @@ menu_t OPTIONS_DataProfileEraseDef = {
0,
OPTIONS_DataProfileErase,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
SKINCOLOR_BLACK, 0,
"SHWDN2", // Danger.
2, 5,
M_DrawProfileErase,
M_OptionsTick,

View file

@ -19,6 +19,7 @@ menu_t OPTIONS_DataReplayDef = {
OPTIONS_DataReplay,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -37,6 +37,7 @@ menu_t OPTIONS_DataScreenshotDef = {
OPTIONS_DataScreenshot,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -51,6 +51,7 @@ menu_t OPTIONS_GameplayDef = {
OPTIONS_Gameplay,
48, 80,
SKINCOLOR_SCARLET, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -54,6 +54,7 @@ menu_t OPTIONS_GameplayItemsDef = {
OPTIONS_GameplayItems,
14, 40,
SKINCOLOR_SCARLET, 0,
NULL,
2, 5,
M_DrawItemToggles,
M_OptionsTick,

View file

@ -48,6 +48,7 @@ menu_t OPTIONS_HUDDef = {
OPTIONS_HUD,
48, 80,
SKINCOLOR_SUNSLAM, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -45,6 +45,7 @@ menu_t OPTIONS_HUDOnlineDef = {
OPTIONS_HUDOnline,
48, 80,
SKINCOLOR_SUNSLAM, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -17,6 +17,7 @@ menu_t OPTIONS_ProfilesDef = {
OPTIONS_Profiles,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
NULL,
2, 5,
M_DrawProfileSelect,
M_OptionsTick,

View file

@ -29,6 +29,7 @@ menu_t OPTIONS_EditProfileDef = {
OPTIONS_EditProfile,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
NULL,
2, 5,
M_DrawEditProfile,
M_HandleProfileEdit,

View file

@ -103,6 +103,7 @@ menu_t OPTIONS_ProfileControlsDef = {
OPTIONS_ProfileControls,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
NULL,
3, 5,
M_DrawProfileControls,
M_HandleProfileControls,

View file

@ -55,6 +55,7 @@ menu_t OPTIONS_ServerDef = {
OPTIONS_Server,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -53,6 +53,7 @@ menu_t OPTIONS_ServerAdvancedDef = {
OPTIONS_ServerAdvanced,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -57,6 +57,7 @@ menu_t OPTIONS_SoundDef = {
OPTIONS_Sound,
48, 80,
SKINCOLOR_THUNDER, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -59,6 +59,7 @@ menu_t OPTIONS_VideoDef = {
OPTIONS_Video,
32, 80,
SKINCOLOR_PLAGUE, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -51,6 +51,7 @@ menu_t OPTIONS_VideoOGLDef = {
OPTIONS_VideoOGL,
32, 80,
SKINCOLOR_PLAGUE, 0,
NULL,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,

View file

@ -19,6 +19,7 @@ menu_t OPTIONS_VideoModesDef = {
OPTIONS_VideoModes,
48, 80,
SKINCOLOR_PLAGUE, 0,
NULL,
2, 5,
M_DrawVideoModes,
M_OptionsTick,

View file

@ -17,6 +17,7 @@ menu_t PLAY_CharSelectDef = {
PLAY_CharSelect,
0, 0,
0, 0,
NULL,
0, 0,
M_DrawCharacterSelect,
M_CharacterSelectTick,

View file

@ -39,6 +39,7 @@ menu_t PLAY_RaceDifficultyDef = {
PLAY_RaceDifficulty,
0, 0,
0, 0,
NULL,
1, 5,
M_DrawRaceDifficulty,
NULL,

View file

@ -27,6 +27,7 @@ menu_t PLAY_TimeAttackDef = {
PLAY_TimeAttack,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawTimeAttack,
NULL,
@ -68,6 +69,7 @@ menu_t PLAY_TAReplayDef = {
PLAY_TAReplay,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawTimeAttack,
NULL,
@ -111,6 +113,7 @@ menu_t PLAY_TAReplayGuestDef = {
PLAY_TAReplayGuest,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawTimeAttack,
NULL,
@ -149,6 +152,7 @@ menu_t PLAY_TAGhostsDef = {
PLAY_TAGhosts,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawTimeAttack,
NULL,

View file

@ -23,6 +23,7 @@ menu_t PLAY_MP_OptSelectDef = {
PLAY_MP_OptSelect,
0, 0,
0, 0,
"NETMD2",
-1, 1,
M_DrawMPOptSelect,
M_MPOptSelectTick,

View file

@ -33,6 +33,7 @@ menu_t PLAY_MP_HostDef = {
PLAY_MP_Host,
0, 0,
0, 0,
"NETMD2",
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
M_DrawMPHost,
M_MPOptSelectTick, // This handles the unfolding options

View file

@ -38,6 +38,7 @@ menu_t PLAY_MP_JoinIPDef = {
PLAY_MP_JoinIP,
0, 0,
0, 0,
"NETMD2",
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
M_DrawMPJoinIP,
M_MPOptSelectTick, // This handles the unfolding options

View file

@ -16,6 +16,7 @@ menu_t PLAY_MP_RoomSelectDef = {
PLAY_MP_RoomSelect,
0, 0,
0, 0,
"NETMD2",
0, 0,
M_DrawMPRoomSelect,
M_MPRoomSelectTick,

View file

@ -29,6 +29,7 @@ menu_t PLAY_MP_ServerBrowserDef = {
PLAY_MP_ServerBrowser,
32, 36,
0, 0,
"NETMD2",
0, 0,
M_DrawMPServerBrowser,
M_MPServerBrowserTick,

View file

@ -20,6 +20,7 @@ menu_t PLAY_CupSelectDef = {
PLAY_CupSelect,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawCupSelect,
M_CupSelectTick,

View file

@ -21,6 +21,7 @@ menu_t PLAY_LevelSelectDef = {
PLAY_LevelSelect,
0, 0,
0, 0,
NULL,
2, 5,
M_DrawLevelSelect,
M_LevelSelectTick,

View file

@ -63,6 +63,7 @@ menu_t PAUSE_MainDef = {
PAUSE_Main,
0, 0,
0, 0,
NULL,
1, 10, // For transition with some menus!
M_DrawPause,
M_PauseTick,

View file

@ -39,6 +39,7 @@ menu_t PAUSE_PlaybackMenuDef = {
PAUSE_PlaybackMenu,
BASEVIDWIDTH/2 - 88, 2,
0, 0,
NULL,
0, 0,
M_DrawPlaybackMenu,
M_PlaybackTick,