menubehaviourflags_t / (menu_t).behaviourflags

- MBF_UD_LR_FLIPPED
    - Genericisation of the control flip for PAUSE_PlaybackMenuDef
- MBF_SOUNDLESS
    - Do not create sound for default menu actions
This commit is contained in:
toaster 2023-03-25 22:39:07 +00:00
parent a0fa45bcec
commit 42cc95f6ed
40 changed files with 65 additions and 8 deletions

View file

@ -129,6 +129,12 @@ void M_HandlePauseMenuGametype(INT32 choice);
// MENU TYPEDEFS
//
typedef enum
{
MBF_UD_LR_FLIPPED = 1, // flip up-down and left-right axes
MBF_SOUNDLESS = 2, // do not play base menu sounds
} menubehaviourflags_t;
struct menuitem_t
{
UINT16 status; // show IT_xxx
@ -154,6 +160,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.
INT16 behaviourflags; // menubehaviourflags_t
const char *music; // Track to play in M_PlayMenuJam. NULL for default, "." to stop
INT16 transitionID; // only transition if IDs match
@ -1204,6 +1211,8 @@ boolean M_StatisticsInputs(INT32 ch);
0,\
source,\
x, y,\
0, 0,\
0,\
NULL,\
0, 0,\
M_DrawGenericMenu,\
@ -1222,6 +1231,7 @@ boolean M_StatisticsInputs(INT32 ch);
source,\
0, 0,\
0, 0,\
0,\
NULL,\
1, 5,\
M_DrawKartGamemodeMenu,\
@ -1239,6 +1249,7 @@ boolean M_StatisticsInputs(INT32 ch);
source,\
0, 0,\
0, 0,\
0,\
"EXTRAS",\
1, 5,\
M_DrawImageDef,\

View file

@ -902,8 +902,7 @@ static void M_HandleMenuInput(void)
lr = menucmd[pid].dpad_lr;
ud = menucmd[pid].dpad_ud;
// If we ever add a second horizontal menu, make it a menu_t property, not an extra check.
if (currentMenu == &PAUSE_PlaybackMenuDef)
if (currentMenu->behaviourflags & MBF_UD_LR_FLIPPED)
{
ud = menucmd[pid].dpad_lr;
lr = -menucmd[pid].dpad_ud;
@ -916,14 +915,14 @@ static void M_HandleMenuInput(void)
// Keys usable within menu
if (ud > 0)
{
if (M_NextOpt())
if (M_NextOpt() && !(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(pid);
return;
}
else if (ud < 0)
{
if (M_PrevOpt())
if (M_PrevOpt() && !(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(pid);
return;
@ -933,7 +932,8 @@ static void M_HandleMenuInput(void)
if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS
|| (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR))
{
S_StartSound(NULL, sfx_s3k5b);
if (!(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
routine(0);
M_SetMenuDelay(pid);
}
@ -945,7 +945,8 @@ static void M_HandleMenuInput(void)
if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS
|| (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR))
{
S_StartSound(NULL, sfx_s3k5b);
if (!(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
routine(1);
M_SetMenuDelay(pid);
}
@ -959,7 +960,8 @@ static void M_HandleMenuInput(void)
if (routine)
{
S_StartSound(NULL, sfx_s3k5b);
if (!(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
if (((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CALL
|| (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SUBMENU)
@ -1014,7 +1016,8 @@ static void M_HandleMenuInput(void)
return;
}*/
S_StartSound(NULL, sfx_s3k5b);
if (!(currentMenu->behaviourflags & MBF_SOUNDLESS))
S_StartSound(NULL, sfx_s3k5b);
routine(-1);
M_SetMenuDelay(pid);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,6 +40,7 @@ menu_t OPTIONS_DataEraseDef = {
OPTIONS_DataErase,
48, 80,
SKINCOLOR_BLACK, 0,
0,
"SHWDN2", // Danger.
2, 5,
M_DrawGenericOptions,

View file

@ -17,6 +17,7 @@ menu_t OPTIONS_DataProfileEraseDef = {
OPTIONS_DataProfileErase,
48, 80,
SKINCOLOR_BLACK, 0,
0,
"SHWDN2", // Danger.
2, 5,
M_DrawProfileErase,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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,
0,
NULL,
2, 5,
M_DrawGenericOptions,

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,
0,
NULL,
2, 5,
M_DrawGenericOptions,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -73,6 +73,7 @@ menu_t PLAY_TimeAttackDef = {
PLAY_TimeAttack,
0, 0,
0, 0,
0,
NULL,
2, 5,
M_DrawTimeAttack,
@ -115,6 +116,7 @@ menu_t PLAY_TAReplayDef = {
PLAY_TAReplay,
0, 0,
0, 0,
0,
NULL,
2, 5,
M_DrawTimeAttack,
@ -159,6 +161,7 @@ menu_t PLAY_TAReplayGuestDef = {
PLAY_TAReplayGuest,
0, 0,
0, 0,
0,
NULL,
2, 5,
M_DrawTimeAttack,
@ -198,6 +201,7 @@ menu_t PLAY_TAGhostsDef = {
PLAY_TAGhosts,
0, 0,
0, 0,
0,
NULL,
2, 5,
M_DrawTimeAttack,

View file

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

View file

@ -33,6 +33,7 @@ menu_t PLAY_MP_HostDef = {
PLAY_MP_Host,
0, 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,

View file

@ -38,6 +38,7 @@ menu_t PLAY_MP_JoinIPDef = {
PLAY_MP_JoinIP,
0, 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,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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