diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index 9816604..5cb951f 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -186,8 +186,7 @@ typedef struct menu_s #define M_SKIP -1,0 // Skippable, cursor can't get here. #define M_SWTC 1,0 // On/off type or entering function. #define M_LFRT 2,0 // Multichoice function. -#define M_SLD1 3,0 // Slider 1st line. -#define M_SLD2 4,0 // Slider 2st line. +#define M_SLDR 3,0 // Slider line. // [JN] Small cursor timer for glowing effect. static short cursor_tics = 0; @@ -250,6 +249,7 @@ static int M_StringHeight(const char *string); static void M_StartMessage(const char *string, void (*routine)(int), boolean input); static void M_ClearMenus (void); +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max); // ============================================================================= // DOOM MENU @@ -431,10 +431,10 @@ enum static menuitem_t SoundMenu[]= { - { M_LFRT, "M_SFXVOL", M_SfxVol, 's' }, - { M_SLD1, "", 0, '\0' }, - { M_LFRT, "M_MUSVOL", M_MusicVol, 'm' }, - { M_SLD1, "", 0, '\0' } + { M_SLDR, "M_SFXVOL", M_SfxVol, 's' }, + { M_SKIP, "", 0, '\0' }, + { M_SLDR, "M_MUSVOL", M_MusicVol, 'm' }, + { M_SKIP, "", 0, '\0' } }; static menu_t SoundDef = @@ -1188,7 +1188,8 @@ static byte *M_SaveLoad_Glow (int itemSetOn, int tics, int type) static const int M_INT_Slider (int val, int min, int max, int direction, boolean capped) { // [PN] Adjust the slider value based on direction and handle min/max limits - val += (direction == 0) ? -1 : 1; + val += (direction == -1) ? 0 : // [JN] Routine "-1" just reintializes value. + (direction == 0) ? -1 : 1; // Otherwise, move either left "0" or right "1". if (val < min) val = capped ? min : max; @@ -1875,12 +1876,12 @@ static void M_ID_LocalTime (int choice) static menuitem_t ID_Menu_Sound[]= { - { M_LFRT, "SFX VOLUME", M_SfxVol, 's' }, - { M_SLD1, "", 0, '\0' }, - { M_SLD2, "", 0, '\0' }, - { M_LFRT, "MUSIC VOLUME", M_MusicVol, 'm' }, - { M_SLD1, "", 0, '\0' }, - { M_SLD2, "", 0, '\0' }, + { M_SLDR, "SFX VOLUME", M_SfxVol, 's' }, + { M_SKIP, "", 0, '\0' }, + { M_SKIP, "", 0, '\0' }, + { M_SLDR, "MUSIC VOLUME", M_MusicVol, 'm' }, + { M_SKIP, "", 0, '\0' }, + { M_SKIP, "", 0, '\0' }, { M_SKIP, "", 0, '\0' }, { M_LFRT, "SFX PLAYBACK", M_ID_SFXSystem, 's' }, { M_LFRT, "MUSIC PLAYBACK", M_ID_MusicSystem, 'm' }, @@ -1915,10 +1916,12 @@ static void M_Draw_ID_Sound (void) M_WriteTextCentered(9, "VOLUME", cr[CR_YELLOW]); M_DrawThermo(46, 27, 16, sfxVolume, 0); + M_ID_HandleSliderMouseControl(52, 27, 132, &sfxVolume, false, 0, 15); sprintf(str,"%d", sfxVolume); M_WriteText (192, 30, str, M_Item_Glow(0, GLOW_UNCOLORED)); M_DrawThermo(46, 54, 16, musicVolume, 3); + M_ID_HandleSliderMouseControl(52, 54, 132, &musicVolume, false, 0, 15); sprintf(str,"%d", musicVolume); M_WriteText (192, 57, str, M_Item_Glow(3, GLOW_UNCOLORED)); @@ -2168,15 +2171,15 @@ static menuitem_t ID_Menu_Controls[]= { M_SWTC, "KEYBOARD BINDINGS", M_Choose_ID_Keybinds, 'k' }, { M_SWTC, "MOUSE BINDINGS", M_Choose_ID_MouseBinds, 'm' }, { M_SKIP, "", 0, '\0' }, - { M_LFRT, "SENSIVITY", M_ID_Controls_Sensivity, 's' }, - { M_SLD1, "", 0, '\0' }, - { M_SLD2, "", 0, '\0' }, - { M_LFRT, "ACCELERATION", M_ID_Controls_Acceleration, 'a' }, - { M_SLD1, "", 0, '\0' }, - { M_SLD2, "", 0, '\0' }, - { M_LFRT, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 'a' }, - { M_SLD1, "", 0, '\0' }, - { M_SLD2, "", 0, '\0' }, + { M_SLDR, "SENSIVITY", M_ID_Controls_Sensivity, 's' }, + { M_SKIP, "", 0, '\0' }, + { M_SKIP, "", 0, '\0' }, + { M_SLDR, "ACCELERATION", M_ID_Controls_Acceleration, 'a' }, + { M_SKIP, "", 0, '\0' }, + { M_SKIP, "", 0, '\0' }, + { M_SLDR, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 'a' }, + { M_SKIP, "", 0, '\0' }, + { M_SKIP, "", 0, '\0' }, { M_LFRT, "MOUSE LOOK", M_ID_Controls_MLook, 'm' }, { M_LFRT, "VERTICAL MOUSE MOVEMENT", M_ID_Controls_NoVert, 'v' }, { M_LFRT, "INVERT VERTICAL AXIS", M_ID_Controls_InvertY, 'v' }, @@ -2207,16 +2210,19 @@ static void M_Draw_ID_Controls (void) M_WriteTextCentered(36, "MOUSE CONFIGURATION", cr[CR_YELLOW]); - M_DrawThermo(46, 54, 10, mouseSensitivity, 3); + M_DrawThermo(46, 54, 15, mouseSensitivity, 3); + M_ID_HandleSliderMouseControl(52, 54, 124, &mouseSensitivity, false, 0, 14); sprintf(str,"%d", mouseSensitivity); - M_WriteText (144, 57, str, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : - mouseSensitivity > 9 ? GLOW_GREEN : GLOW_UNCOLORED)); + M_WriteText (184, 57, str, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : + mouseSensitivity > 14 ? GLOW_GREEN : GLOW_UNCOLORED)); - M_DrawThermo(46, 81, 12, (mouse_acceleration * 3) - 3, 6); + M_DrawThermo(46, 81, 8, (mouse_acceleration * 1.8f) - 2, 6); + M_ID_HandleSliderMouseControl(52, 81, 100, &mouse_acceleration, true, 0, 9); sprintf(str,"%.1f", mouse_acceleration); - M_WriteText (160, 84, str, M_Item_Glow(6, GLOW_UNCOLORED)); + M_WriteText (128, 84, str, M_Item_Glow(6, GLOW_UNCOLORED)); - M_DrawThermo(46, 108, 15, mouse_threshold / 2, 9); + M_DrawThermo(46, 108, 15, mouse_threshold / 2.2f, 9); + M_ID_HandleSliderMouseControl(52, 108, 124, &mouse_threshold, false, 0, 32); sprintf(str,"%d", mouse_threshold); M_WriteText (184, 111, str, M_Item_Glow(9, GLOW_UNCOLORED)); @@ -5222,10 +5228,12 @@ static void M_DrawSound(void) V_DrawShadowedPatchOptional(60, 38, 0, W_CacheLumpName(DEH_String("M_SVOL"), PU_CACHE)); M_DrawThermo(SoundDef.x, SoundDef.y + LINEHEIGHT * (sfx_vol + 1), 16, sfxVolume, 0); + M_ID_HandleSliderMouseControl(86, 80, 132, &sfxVolume, false, 0, 15); sprintf(str,"%d", sfxVolume); M_WriteText (226, 83, str, M_Item_Glow(0, sfxVolume ? GLOW_UNCOLORED : GLOW_DARKRED)); M_DrawThermo(SoundDef.x, SoundDef.y + LINEHEIGHT * (music_vol + 1), 16, musicVolume, 2); + M_ID_HandleSliderMouseControl(86, 112, 132, &musicVolume, false, 0, 15); sprintf(str,"%d", musicVolume); M_WriteText (226, 115, str, M_Item_Glow(2, musicVolume ? GLOW_UNCOLORED : GLOW_DARKRED)); } @@ -5996,10 +6004,12 @@ boolean M_Responder (event_t* ev) { // [JN] Shows the mouse cursor when moved. if (ev->data2 || ev->data3) + { menu_mouse_allow = true; + menu_mouse_allow_click = false; + } - if (ev->type == ev_mouse && mousewait < I_GetTime() - && !ev->data2 && !ev->data3) // [JN] Do not consider movement as pressing. + if (ev->type == ev_mouse && mousewait < I_GetTime()) { // [crispy] mouse_novert disables controlling the menus with the mouse // [JN] Not needed, as menu is fully controllable by mouse wheel and buttons. @@ -6053,6 +6063,14 @@ boolean M_Responder (event_t* ev) if (ev->data1&1) { + if (menuactive && currentMenu->menuitems[itemOn].status == 3) + { + // [JN] Allow repetitive on sliders to move it while mouse movement. + menu_mouse_allow_click = true; + } + else + if (!ev->data2 && !ev->data3) // [JN] Do not consider movement as pressing. + { if (!menuactive && !usergame) { M_StartControlPanel(); // [JN] Open the main menu if the game is not active. @@ -6068,8 +6086,10 @@ boolean M_Responder (event_t* ev) } mousewait = I_GetTime() + 1; } + } - if (ev->data1&2) + if (ev->data1&2 + && !ev->data2 && !ev->data3) // [JN] Do not consider movement as pressing. { if (!menuactive && !usergame) { @@ -6097,7 +6117,7 @@ boolean M_Responder (event_t* ev) // [JN] Scrolls through menu item values or navigates between pages. if (ev->data1 & (1 << 4) && menuactive) { - if (currentMenu->menuitems[itemOn].status == 2) + if (currentMenu->menuitems[itemOn].status > 1) { // Scroll menu item backward currentMenu->menuitems[itemOn].routine(0); @@ -6113,7 +6133,7 @@ boolean M_Responder (event_t* ev) else if (ev->data1 & (1 << 3) && menuactive) { - if (currentMenu->menuitems[itemOn].status == 2) + if (currentMenu->menuitems[itemOn].status > 1) { // Scroll menu item forward currentMenu->menuitems[itemOn].routine(1); @@ -6463,9 +6483,7 @@ boolean M_Responder (event_t* ev) do { itemOn = (itemOn + 1) % currentMenu->numitems; - } while (currentMenu->menuitems[itemOn].status == -1 || - currentMenu->menuitems[itemOn].status == 3 || // [JN] Skip sliders - currentMenu->menuitems[itemOn].status == 4); + } while (currentMenu->menuitems[itemOn].status == -1); S_StartSound(NULL, sfx_pstop); return true; @@ -6476,9 +6494,7 @@ boolean M_Responder (event_t* ev) do { itemOn = (itemOn == 0) ? currentMenu->numitems - 1 : itemOn - 1; - } while (currentMenu->menuitems[itemOn].status == -1 || - currentMenu->menuitems[itemOn].status == 3 || // [JN] Skip sliders - currentMenu->menuitems[itemOn].status == 4); + } while (currentMenu->menuitems[itemOn].status == -1); S_StartSound(NULL, sfx_pstop); return true; @@ -6493,7 +6509,7 @@ boolean M_Responder (event_t* ev) // Slide slider left if (currentMenu->menuitems[itemOn].routine - && currentMenu->menuitems[itemOn].status == 2) + && currentMenu->menuitems[itemOn].status > 1) { S_StartSound(NULL,sfx_stnmov); currentMenu->menuitems[itemOn].routine(0); @@ -6510,7 +6526,7 @@ boolean M_Responder (event_t* ev) // Slide slider right if (currentMenu->menuitems[itemOn].routine - && currentMenu->menuitems[itemOn].status == 2) + && currentMenu->menuitems[itemOn].status > 1) { S_StartSound(NULL,sfx_stnmov); currentMenu->menuitems[itemOn].routine(1); @@ -6689,25 +6705,55 @@ static void M_ID_MenuMouseControl (void) // [PN] Check if the cursor is hovering over a menu item for (int i = 0; i < currentMenu->numitems; i++) { + // [JN] Slider takes three lines. + const int line_item = currentMenu->menuitems[i].status == 3 ? 3 : 1; + if (menu_mouse_x >= (currentMenu->x + WIDESCREENDELTA) * vid_resolution && menu_mouse_x <= (ORIGWIDTH + WIDESCREENDELTA - currentMenu->x) * vid_resolution && menu_mouse_y >= (currentMenu->y + i * line_height) * vid_resolution - && menu_mouse_y <= (currentMenu->y + (i + 1) * line_height) * vid_resolution + && menu_mouse_y <= (currentMenu->y + (i + line_item) * line_height) * vid_resolution && currentMenu->menuitems[i].status != -1) { // [PN] Highlight the current menu item itemOn = i; - - // [JN] Move menu cursor higher when hovering slider lines. - if (currentMenu->menuitems[itemOn].status == 3) - itemOn -= 1; - if (currentMenu->menuitems[itemOn].status == 4) - itemOn -= 2; } } } } +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max) +{ + if (!menu_mouse_allow_click) + return; + + // [JN/PN] Adjust slider boundaries + const int adj_x = (x + WIDESCREENDELTA) * vid_resolution; + const int adj_y = y * vid_resolution; + const int adj_width = width * vid_resolution; + const int adj_height = LINEHEIGHT * vid_resolution; + + // [PN] Check cursor position and item status + if (menu_mouse_x < adj_x || menu_mouse_x > adj_x + adj_width + || menu_mouse_y < adj_y || menu_mouse_y > adj_y + adj_height + || currentMenu->menuitems[itemOn].status != 3) + return; + + // [PN] Calculate and update slider value + const float normalized = (float)(menu_mouse_x - adj_x + 5) / adj_width; + const float newValue = min + normalized * (max - min); + if (is_float) + *((float *)value) = newValue; + else + *((int *)value) = (int)newValue; + + // [JN/PN] Call related routine and reset mouse click allowance + currentMenu->menuitems[itemOn].routine(-1); + menu_mouse_allow_click = false; + + // Play sound + S_StartSound(NULL, sfx_stnmov); +} + // // M_Drawer // Called after the view has been rendered, diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 7c0e831..cab28a6 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -61,8 +61,7 @@ typedef enum ITT_EFUNC, ITT_LRFUNC, ITT_SETMENU, - ITT_SLDR1, // Slider 1st line. - ITT_SLDR2, // Slider 2st line. + ITT_SLDR, // Slider line. ITT_INERT } ItemType_t; @@ -170,6 +169,7 @@ static void DrawLoadMenu(void); static void DrawSaveMenu(void); static void DrawSlider(Menu_t * menu, int item, int width, int slot, boolean bigspacing, int itemPos); void MN_LoadSlotText(void); +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max); // Public Data @@ -370,12 +370,12 @@ static Menu_t OptionsMenu = { }; static MenuItem_t Options2Items[] = { - { ITT_LRFUNC, "SFX VOLUME", SCSfxVolume, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "MUSIC VOLUME", SCMusicVolume, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "SCREEN SIZE", SCScreenSize, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SFX VOLUME", SCSfxVolume, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "MUSIC VOLUME", SCMusicVolume, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SCREEN SIZE", SCScreenSize, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, }; static Menu_t Options2Menu = { @@ -1058,7 +1058,8 @@ static byte *M_SaveLoad_Glow (int itemSetOn, int tics, int type) static const int M_INT_Slider (int val, int min, int max, int direction, boolean capped) { // [PN] Adjust the slider value based on direction and handle min/max limits - val += (direction == 0) ? -1 : 1; + val += (direction == -1) ? 0 : // [JN] Routine "-1" just reintializes value. + (direction == 0) ? -1 : 1; // Otherwise, move either left "0" or right "1". if (val < min) val = capped ? min : max; @@ -1701,12 +1702,12 @@ static void M_ID_LocalTime (int choice) // ----------------------------------------------------------------------------- static MenuItem_t ID_Menu_Sound[] = { - { ITT_LRFUNC, "SFX VOLUME", SCSfxVolume, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "MUSIC VOLUME", SCMusicVolume, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SFX VOLUME", SCSfxVolume, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "MUSIC VOLUME", SCMusicVolume, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_LRFUNC, "MUSIC PLAYBACK", M_ID_MusicSystem, 0, MENU_NONE }, { ITT_LRFUNC, "SOUND EFFECTS MODE", M_ID_SFXMode, 0, MENU_NONE }, @@ -1731,10 +1732,12 @@ static void M_Draw_ID_Sound (void) MN_DrTextACentered("SOUND OPTIONS", 10, cr[CR_YELLOW]); DrawSlider(&ID_Def_Sound, 1, 16, snd_MaxVolume, false, 0); + M_ID_HandleSliderMouseControl(70, 30, 134, &snd_MaxVolume, false, 0, 15); sprintf(str,"%d", snd_MaxVolume); MN_DrTextA(str, 228, 35, M_Item_Glow(0, GLOW_LIGHTGRAY)); DrawSlider(&ID_Def_Sound, 4, 16, snd_MusicVolume, false, 3); + M_ID_HandleSliderMouseControl(70, 60, 134, &snd_MusicVolume, false, 0, 15); sprintf(str,"%d", snd_MusicVolume); MN_DrTextA(str, 228, 65, M_Item_Glow(3, GLOW_LIGHTGRAY)); @@ -1892,15 +1895,15 @@ static MenuItem_t ID_Menu_Controls[] = { { ITT_EFUNC, "KEYBOARD BINDINGS", M_Choose_ID_Keybinds, 0, MENU_NONE }, { ITT_SETMENU, "MOUSE BINDINGS", NULL, 0, MENU_ID_MOUSEBINDS }, { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "SENSIVITY", SCMouseSensi, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "ACCELERATION", M_ID_Controls_Acceleration, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SENSIVITY", SCMouseSensi, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "ACCELERATION", M_ID_Controls_Acceleration, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_LRFUNC, "MOUSE LOOK", M_ID_Controls_MLook, 0, MENU_NONE }, { ITT_LRFUNC, "VERTICAL MOUSE MOVEMENT", M_ID_Controls_NoVert, 0, MENU_NONE }, { ITT_LRFUNC, "INVERT VERTICAL AXIS", M_ID_Controls_InvertY, 0, MENU_NONE }, @@ -1927,18 +1930,21 @@ static void M_Draw_ID_Controls (void) MN_DrTextACentered("MOUSE CONFIGURATION", 40, cr[CR_YELLOW]); - DrawSlider(&ID_Def_Controls, 4, 10, mouseSensitivity, false, 3); + DrawSlider(&ID_Def_Controls, 4, 16, mouseSensitivity, false, 3); + M_ID_HandleSliderMouseControl(66, 60, 132, &mouseSensitivity, false, 0, 15); sprintf(str,"%d", mouseSensitivity); - MN_DrTextA(str, 180, 65, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : - mouseSensitivity > 9 ? GLOW_GREEN : GLOW_LIGHTGRAY)); + MN_DrTextA(str, 227, 65, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : + mouseSensitivity > 15 ? GLOW_GREEN : GLOW_LIGHTGRAY)); - DrawSlider(&ID_Def_Controls, 7, 12, (mouse_acceleration * 3) - 3, false, 6); + DrawSlider(&ID_Def_Controls, 7, 7, (mouse_acceleration * 1.8f) - 2, false, 6); + M_ID_HandleSliderMouseControl(66, 90, 60, &mouse_acceleration, true, 0, 6); sprintf(str,"%.1f", mouse_acceleration); - MN_DrTextA(str, 196, 95, M_Item_Glow(6, GLOW_LIGHTGRAY)); + MN_DrTextA(str, 155, 95, M_Item_Glow(6, GLOW_LIGHTGRAY)); - DrawSlider(&ID_Def_Controls, 10, 14, mouse_threshold / 2, false, 9); + DrawSlider(&ID_Def_Controls, 10, 15, mouse_threshold / 2.2f, false, 9); + M_ID_HandleSliderMouseControl(66, 120, 124, &mouse_threshold, false, 0, 32); sprintf(str,"%d", mouse_threshold); - MN_DrTextA(str, 212, 125, M_Item_Glow(9, GLOW_LIGHTGRAY)); + MN_DrTextA(str, 219, 125, M_Item_Glow(9, GLOW_LIGHTGRAY)); // Mouse look sprintf(str, mouse_look ? "ON" : "OFF"); @@ -4986,25 +4992,55 @@ static void M_ID_MenuMouseControl (void) // [PN] Check if the cursor is hovering over a menu item for (int i = 0; i < CurrentMenu->itemCount; i++) { + // [JN] Slider takes three lines. + const int line_item = CurrentMenu->items[i].type == ITT_SLDR ? 3 : 1; + if (menu_mouse_x >= (CurrentMenu->x + WIDESCREENDELTA) * vid_resolution && menu_mouse_x <= (ORIGWIDTH + WIDESCREENDELTA - CurrentMenu->x) * vid_resolution && menu_mouse_y >= (CurrentMenu->y + i * line_height) * vid_resolution - && menu_mouse_y <= (CurrentMenu->y + (i + 1) * line_height) * vid_resolution + && menu_mouse_y <= (CurrentMenu->y + (i + line_item) * line_height) * vid_resolution && CurrentMenu->items[i].type != ITT_EMPTY) { // [PN] Highlight the current menu item CurrentItPos = i; - - // [JN] Move menu cursor higher when hovering slider lines. - if (CurrentMenu->items[i].type == ITT_SLDR1) - CurrentItPos -= 1; - if (CurrentMenu->items[i].type == ITT_SLDR2) - CurrentItPos -= 2; } } } } +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max) +{ + if (!menu_mouse_allow_click) + return; + + // [JN/PN] Adjust slider boundaries + const int adj_x = (x + WIDESCREENDELTA) * vid_resolution; + const int adj_y = y * vid_resolution; + const int adj_width = width * vid_resolution; + const int adj_height = ITEM_HEIGHT * vid_resolution; + + // [PN] Check cursor position and item status + if (menu_mouse_x < adj_x || menu_mouse_x > adj_x + adj_width + || menu_mouse_y < adj_y || menu_mouse_y > adj_y + adj_height + || CurrentMenu->items[CurrentItPos].type != ITT_SLDR) + return; + + // [PN] Calculate and update slider value + const float normalized = (float)(menu_mouse_x - adj_x + 5) / adj_width; + const float newValue = min + normalized * (max - min); + if (is_float) + *((float *)value) = newValue; + else + *((int *)value) = (int)newValue; + + // [JN/PN] Call related routine and reset mouse click allowance + CurrentMenu->items[CurrentItPos].func(-1); + menu_mouse_allow_click = false; + + // Play sound + S_StartSound(NULL, sfx_keyup); +} + //--------------------------------------------------------------------------- // // PROC MN_Drawer @@ -5379,16 +5415,19 @@ static void DrawOptions2Menu(void) // SFX Volume sprintf(str, "%d", snd_MaxVolume); DrawSlider(&Options2Menu, 1, 16, snd_MaxVolume, true, 0); + M_ID_HandleSliderMouseControl(94, 40, 132, &snd_MaxVolume, false, 0, 15); MN_DrTextA(str, 252, 45, M_Item_Glow(0, snd_MaxVolume ? GLOW_LIGHTGRAY : GLOW_DARKGRAY)); // Music Volume sprintf(str, "%d", snd_MusicVolume); DrawSlider(&Options2Menu, 3, 16, snd_MusicVolume, true, 2); + M_ID_HandleSliderMouseControl(94, 80, 132, &snd_MusicVolume, false, 0, 15); MN_DrTextA(str, 252, 85, M_Item_Glow(2, snd_MusicVolume ? GLOW_LIGHTGRAY : GLOW_DARKGRAY)); // Screen Size sprintf(str, "%d", dp_screen_size); DrawSlider(&Options2Menu, 5, 11, dp_screen_size - 3, true, 4); + M_ID_HandleSliderMouseControl(94, 120, 92, &dp_screen_size, false, 3, 13); MN_DrTextA(str, 212, 125, M_Item_Glow(4, GLOW_LIGHTGRAY)); } @@ -5927,11 +5966,13 @@ boolean MN_Responder(event_t * event) { // [JN] Shows the mouse cursor when moved. if (event->data2 || event->data3) + { menu_mouse_allow = true; + menu_mouse_allow_click = false; + } // [JN] Allow menu control by mouse. - if (event->type == ev_mouse && mousewait < I_GetTime() - && !event->data2 && !event->data3) // [JN] Do not consider movement as pressing. + if (event->type == ev_mouse && mousewait < I_GetTime()) { // [crispy] mouse_novert disables controlling the menus with the mouse // [JN] Not needed, as menu is fully controllable by mouse wheel and buttons. @@ -5969,6 +6010,14 @@ boolean MN_Responder(event_t * event) if (event->data1 & 1) { + if (MenuActive && CurrentMenu->items[CurrentItPos].type == ITT_SLDR) + { + // [JN] Allow repetitive on sliders to move it while mouse movement. + menu_mouse_allow_click = true; + } + else + if (!event->data2 && !event->data3) // [JN] Do not consider movement as pressing. + { if (!MenuActive && !usergame) { // [JN] Open the main menu if the game is not active. @@ -5979,6 +6028,7 @@ boolean MN_Responder(event_t * event) key = key_menu_forward; mousewait = I_GetTime() + 1; } + } if (typeofask) { @@ -5986,7 +6036,8 @@ boolean MN_Responder(event_t * event) } } - if (event->data1 & 2) + if (event->data1 & 2 + && !event->data2 && !event->data3) // [JN] Do not consider movement as pressing. { if (!MenuActive && !usergame) { @@ -6021,7 +6072,8 @@ boolean MN_Responder(event_t * event) // [JN] Scrolls through menu item values or navigates between pages. if (event->data1 & (1 << 4) && MenuActive) { - if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC) + if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC + || CurrentMenu->items[CurrentItPos].type == ITT_SLDR) { // Scroll menu item backward CurrentMenu->items[CurrentItPos].func(LEFT_DIR); @@ -6037,7 +6089,8 @@ boolean MN_Responder(event_t * event) else if (event->data1 & (1 << 3) && MenuActive) { - if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC) + if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC + || CurrentMenu->items[CurrentItPos].type == ITT_SLDR) { // Scroll menu item forward CurrentMenu->items[CurrentItPos].func(RIGHT_DIR); @@ -6444,9 +6497,7 @@ boolean MN_Responder(event_t * event) CurrentItPos++; } } - while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY || - CurrentMenu->items[CurrentItPos].type == ITT_SLDR1 || // [JN] Skip sliders - CurrentMenu->items[CurrentItPos].type == ITT_SLDR2); + while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY); S_StartSound(NULL, sfx_switch); return (true); } @@ -6463,15 +6514,13 @@ boolean MN_Responder(event_t * event) CurrentItPos--; } } - while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY || - CurrentMenu->items[CurrentItPos].type == ITT_SLDR1 || // [JN] Skip sliders - CurrentMenu->items[CurrentItPos].type == ITT_SLDR2); + while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY); S_StartSound(NULL, sfx_switch); return (true); } else if (key == key_menu_left) // Slider left { - if (item->type == ITT_LRFUNC && item->func != NULL) + if ((item->type == ITT_LRFUNC || item->type == ITT_SLDR) && item->func != NULL) { item->func(LEFT_DIR); S_StartSound(NULL, sfx_keyup); @@ -6485,7 +6534,7 @@ boolean MN_Responder(event_t * event) } else if (key == key_menu_right) // Slider right { - if (item->type == ITT_LRFUNC && item->func != NULL) + if ((item->type == ITT_LRFUNC || item->type == ITT_SLDR) && item->func != NULL) { item->func(RIGHT_DIR); S_StartSound(NULL, sfx_keyup); diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c index c4c4772..00f8a32 100644 --- a/src/hexen/mn_menu.c +++ b/src/hexen/mn_menu.c @@ -61,8 +61,7 @@ typedef enum ITT_EFUNC, ITT_LRFUNC, ITT_SETMENU, - ITT_SLDR1, // Slider 1st line. - ITT_SLDR2, // Slider 2st line. + ITT_SLDR, // Slider line. ITT_INERT } ItemType_t; @@ -171,6 +170,7 @@ static void DrawLoadMenu(void); static void DrawSaveMenu(void); static void DrawSlider(Menu_t * menu, int item, int width, int slot, boolean bigspacing, int itemPos); void MN_LoadSlotText(void); +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -378,12 +378,12 @@ static Menu_t OptionsMenu = { }; static MenuItem_t Options2Items[] = { - { ITT_LRFUNC, "SFX VOLUME", SCSfxVolume, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "MUSIC VOLUME", SCMusicVolume, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "SCREEN SIZE", SCScreenSize, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SFX VOLUME", SCSfxVolume, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "MUSIC VOLUME", SCMusicVolume, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SCREEN SIZE", SCScreenSize, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, }; static Menu_t Options2Menu = { @@ -1011,7 +1011,8 @@ static byte *M_SaveLoad_Glow (int itemSetOn, int tics, int type) static const int M_INT_Slider (int val, int min, int max, int direction, boolean capped) { // [PN] Adjust the slider value based on direction and handle min/max limits - val += (direction == 0) ? -1 : 1; + val += (direction == -1) ? 0 : // [JN] Routine "-1" just reintializes value. + (direction == 0) ? -1 : 1; // Otherwise, move either left "0" or right "1". if (val < min) val = capped ? min : max; @@ -1658,12 +1659,12 @@ static void M_ID_LocalTime (int choice) // ----------------------------------------------------------------------------- static MenuItem_t ID_Menu_Sound[] = { - { ITT_LRFUNC, "SFX VOLUME", SCSfxVolume, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "MUSIC VOLUME", SCMusicVolume, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SFX VOLUME", SCSfxVolume, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "MUSIC VOLUME", SCMusicVolume, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_LRFUNC, "MUSIC PLAYBACK", M_ID_MusicSystem, 0, MENU_NONE }, { ITT_LRFUNC, "SOUND EFFECTS MODE", M_ID_SFXMode, 0, MENU_NONE }, @@ -1688,10 +1689,12 @@ static void M_Draw_ID_Sound (void) MN_DrTextACentered("SOUND OPTIONS", 10, cr[CR_YELLOW]); DrawSlider(&ID_Def_Sound, 1, 16, snd_MaxVolume, false, 0); + M_ID_HandleSliderMouseControl(70, 30, 134, &snd_MaxVolume, false, 0, 15); sprintf(str,"%d", snd_MaxVolume); MN_DrTextA(str, 228, 35, M_Item_Glow(0, GLOW_LIGHTGRAY)); DrawSlider(&ID_Def_Sound, 4, 16, snd_MusicVolume, false, 3); + M_ID_HandleSliderMouseControl(70, 60, 134, &snd_MusicVolume, false, 0, 15); sprintf(str,"%d", snd_MusicVolume); MN_DrTextA(str, 228, 65, M_Item_Glow(3, GLOW_LIGHTGRAY)); @@ -1849,15 +1852,15 @@ static MenuItem_t ID_Menu_Controls[] = { { ITT_EFUNC, "KEYBOARD BINDINGS", M_Choose_ID_Keybinds, 0, MENU_NONE }, { ITT_SETMENU, "MOUSE BINDINGS", NULL, 0, MENU_ID_MOUSEBINDS }, { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "SENSIVITY", SCMouseSensi, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "ACCELERATION", M_ID_Controls_Acceleration, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, - { ITT_LRFUNC, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 0, MENU_NONE }, - { ITT_SLDR1, NULL, NULL, 0, MENU_NONE }, - { ITT_SLDR2, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "SENSIVITY", SCMouseSensi, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "ACCELERATION", M_ID_Controls_Acceleration, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_SLDR, "ACCELERATION THRESHOLD", M_ID_Controls_Threshold, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, + { ITT_EMPTY, NULL, NULL, 0, MENU_NONE }, { ITT_LRFUNC, "MOUSE LOOK", M_ID_Controls_MLook, 0, MENU_NONE }, { ITT_LRFUNC, "VERTICAL MOUSE MOVEMENT", M_ID_Controls_NoVert, 0, MENU_NONE }, { ITT_LRFUNC, "INVERT VERTICAL AXIS", M_ID_Controls_InvertY, 0, MENU_NONE }, @@ -1884,18 +1887,21 @@ static void M_Draw_ID_Controls (void) MN_DrTextACentered("MOUSE CONFIGURATION", 40, cr[CR_YELLOW]); - DrawSlider(&ID_Def_Controls, 4, 10, mouseSensitivity, false, 3); + DrawSlider(&ID_Def_Controls, 4, 16, mouseSensitivity, false, 3); + M_ID_HandleSliderMouseControl(66, 60, 132, &mouseSensitivity, false, 0, 15); sprintf(str,"%d", mouseSensitivity); - MN_DrTextA(str, 180, 65, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : - mouseSensitivity > 9 ? GLOW_GREEN : GLOW_LIGHTGRAY)); + MN_DrTextA(str, 227, 65, M_Item_Glow(3, mouseSensitivity == 255 ? GLOW_YELLOW : + mouseSensitivity > 15 ? GLOW_GREEN : GLOW_LIGHTGRAY)); - DrawSlider(&ID_Def_Controls, 7, 12, (mouse_acceleration * 3) - 3, false, 6); + DrawSlider(&ID_Def_Controls, 7, 7, (mouse_acceleration * 1.8f) - 2, false, 6); + M_ID_HandleSliderMouseControl(66, 90, 60, &mouse_acceleration, true, 0, 6); sprintf(str,"%.1f", mouse_acceleration); - MN_DrTextA(str, 196, 95, M_Item_Glow(6, GLOW_LIGHTGRAY)); + MN_DrTextA(str, 155, 95, M_Item_Glow(6, GLOW_LIGHTGRAY)); - DrawSlider(&ID_Def_Controls, 10, 14, mouse_threshold / 2, false, 9); + DrawSlider(&ID_Def_Controls, 10, 15, mouse_threshold / 2.2f, false, 9); + M_ID_HandleSliderMouseControl(66, 120, 124, &mouse_threshold, false, 0, 32); sprintf(str,"%d", mouse_threshold); - MN_DrTextA(str, 212, 125, M_Item_Glow(9, GLOW_LIGHTGRAY)); + MN_DrTextA(str, 219, 125, M_Item_Glow(9, GLOW_LIGHTGRAY)); // Mouse look sprintf(str, mouse_look ? "ON" : "OFF"); @@ -4309,25 +4315,55 @@ static void M_ID_MenuMouseControl (void) // [PN] Check if the cursor is hovering over a menu item for (int i = 0; i < CurrentMenu->itemCount; i++) { + // [JN] Slider takes three lines. + const int line_item = CurrentMenu->items[i].type == ITT_SLDR ? 3 : 1; + if (menu_mouse_x >= (CurrentMenu->x + WIDESCREENDELTA) * vid_resolution && menu_mouse_x <= (ORIGWIDTH + WIDESCREENDELTA - CurrentMenu->x) * vid_resolution && menu_mouse_y >= (CurrentMenu->y + i * line_height) * vid_resolution - && menu_mouse_y <= (CurrentMenu->y + (i + 1) * line_height) * vid_resolution + && menu_mouse_y <= (CurrentMenu->y + (i + line_item) * line_height) * vid_resolution && CurrentMenu->items[i].type != ITT_EMPTY) { // [PN] Highlight the current menu item CurrentItPos = i; - - // [JN] Move menu cursor higher when hovering slider lines. - if (CurrentMenu->items[i].type == ITT_SLDR1) - CurrentItPos -= 1; - if (CurrentMenu->items[i].type == ITT_SLDR2) - CurrentItPos -= 2; } } } } +static void M_ID_HandleSliderMouseControl (int x, int y, int width, void *value, boolean is_float, float min, float max) +{ + if (!menu_mouse_allow_click) + return; + + // [JN/PN] Adjust slider boundaries + const int adj_x = (x + WIDESCREENDELTA) * vid_resolution; + const int adj_y = y * vid_resolution; + const int adj_width = width * vid_resolution; + const int adj_height = ITEM_HEIGHT * vid_resolution; + + // [PN] Check cursor position and item status + if (menu_mouse_x < adj_x || menu_mouse_x > adj_x + adj_width + || menu_mouse_y < adj_y || menu_mouse_y > adj_y + adj_height + || CurrentMenu->items[CurrentItPos].type != ITT_SLDR) + return; + + // [PN] Calculate and update slider value + const float normalized = (float)(menu_mouse_x - adj_x + 5) / adj_width; + const float newValue = min + normalized * (max - min); + if (is_float) + *((float *)value) = newValue; + else + *((int *)value) = (int)newValue; + + // [JN/PN] Call related routine and reset mouse click allowance + CurrentMenu->items[CurrentItPos].func(-1); + menu_mouse_allow_click = false; + + // Play sound + S_StartSound(NULL, SFX_PICKUP_KEY); +} + //--------------------------------------------------------------------------- // // PROC MN_Drawer @@ -4752,16 +4788,19 @@ static void DrawOptions2Menu(void) // SFX Volume sprintf(str, "%d", snd_MaxVolume); DrawSlider(&Options2Menu, 1, 16, snd_MaxVolume, true, 0); + M_ID_HandleSliderMouseControl(94, 40, 132, &snd_MaxVolume, false, 0, 15); MN_DrTextA(str, 252, 45, M_Item_Glow(0, snd_MaxVolume ? GLOW_LIGHTGRAY : GLOW_DARKGRAY)); // Music Volume sprintf(str, "%d", snd_MusicVolume); DrawSlider(&Options2Menu, 3, 16, snd_MusicVolume, true, 2); + M_ID_HandleSliderMouseControl(94, 80, 132, &snd_MusicVolume, false, 0, 15); MN_DrTextA(str, 252, 85, M_Item_Glow(2, snd_MusicVolume ? GLOW_LIGHTGRAY : GLOW_DARKGRAY)); // Screen Size sprintf(str, "%d", dp_screen_size); DrawSlider(&Options2Menu, 5, 11, dp_screen_size - 3, true, 4); + M_ID_HandleSliderMouseControl(94, 120, 92, &dp_screen_size, false, 3, 13); MN_DrTextA(str, 212, 125, M_Item_Glow(4, GLOW_LIGHTGRAY)); } @@ -5348,11 +5387,13 @@ boolean MN_Responder(event_t * event) { // [JN] Shows the mouse cursor when moved. if (event->data2 || event->data3) + { menu_mouse_allow = true; + menu_mouse_allow_click = false; + } // [JN] Allow menu control by mouse. - if (event->type == ev_mouse && mousewait < I_GetTime() - && !event->data2 && !event->data3) // [JN] Do not consider movement as pressing. + if (event->type == ev_mouse && mousewait < I_GetTime()) { // [crispy] mouse_novert disables controlling the menus with the mouse // [JN] Not needed, as menu is fully controllable by mouse wheel and buttons. @@ -5390,6 +5431,14 @@ boolean MN_Responder(event_t * event) if (event->data1 & 1) { + if (MenuActive && CurrentMenu->items[CurrentItPos].type == ITT_SLDR) + { + // [JN] Allow repetitive on sliders to move it while mouse movement. + menu_mouse_allow_click = true; + } + else + if (!event->data2 && !event->data3) // [JN] Do not consider movement as pressing. + { if (!MenuActive && !usergame) { // [JN] Open the main menu if the game is not active. @@ -5400,6 +5449,7 @@ boolean MN_Responder(event_t * event) key = key_menu_forward; mousewait = I_GetTime() + 1; } + } if (typeofask) { @@ -5407,7 +5457,8 @@ boolean MN_Responder(event_t * event) } } - if (event->data1 & 2) + if (event->data1 & 2 + && !event->data2 && !event->data3) // [JN] Do not consider movement as pressing. { if (!MenuActive && !usergame) { @@ -5442,7 +5493,8 @@ boolean MN_Responder(event_t * event) // [JN] Scrolls through menu item values or navigates between pages. if (event->data1 & (1 << 4) && MenuActive) { - if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC) + if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC + || CurrentMenu->items[CurrentItPos].type == ITT_SLDR) { // Scroll menu item backward CurrentMenu->items[CurrentItPos].func(LEFT_DIR); @@ -5458,7 +5510,8 @@ boolean MN_Responder(event_t * event) else if (event->data1 & (1 << 3) && MenuActive) { - if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC) + if (CurrentMenu->items[CurrentItPos].type == ITT_LRFUNC + || CurrentMenu->items[CurrentItPos].type == ITT_SLDR) { // Scroll menu item forward CurrentMenu->items[CurrentItPos].func(RIGHT_DIR); @@ -5905,9 +5958,7 @@ boolean MN_Responder(event_t * event) CurrentItPos++; } } - while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY || - CurrentMenu->items[CurrentItPos].type == ITT_SLDR1 || // [JN] Skip sliders - CurrentMenu->items[CurrentItPos].type == ITT_SLDR2); + while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY); S_StartSound(NULL, SFX_FIGHTER_HAMMER_HITWALL); return (true); } @@ -5924,15 +5975,13 @@ boolean MN_Responder(event_t * event) CurrentItPos--; } } - while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY || - CurrentMenu->items[CurrentItPos].type == ITT_SLDR1 || // [JN] Skip sliders - CurrentMenu->items[CurrentItPos].type == ITT_SLDR2); + while (CurrentMenu->items[CurrentItPos].type == ITT_EMPTY); S_StartSound(NULL, SFX_FIGHTER_HAMMER_HITWALL); return (true); } else if (key == key_menu_left) // Slider left { - if (item->type == ITT_LRFUNC && item->func != NULL) + if ((item->type == ITT_LRFUNC || item->type == ITT_SLDR) && item->func != NULL) { item->func(LEFT_DIR); S_StartSound(NULL, SFX_PICKUP_KEY); @@ -5946,7 +5995,7 @@ boolean MN_Responder(event_t * event) } else if (key == key_menu_right) // Slider right { - if (item->type == ITT_LRFUNC && item->func != NULL) + if ((item->type == ITT_LRFUNC || item->type == ITT_SLDR) && item->func != NULL) { item->func(RIGHT_DIR); S_StartSound(NULL, SFX_PICKUP_KEY); diff --git a/src/i_video.c b/src/i_video.c index 2fadcd3..c1e32ad 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -138,7 +138,7 @@ int usemouse = 1; int menu_mouse_x, menu_mouse_y; // Used by SDL cursor for position saving and resoring static int menu_mouse_x_sdl, menu_mouse_y_sdl; -boolean menu_mouse_allow; +boolean menu_mouse_allow, menu_mouse_allow_click; // SDL video driver name diff --git a/src/i_video.h b/src/i_video.h index 9f7dd43..d5f2f40 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -168,7 +168,7 @@ extern int usemouse; extern int menu_mouse_x; extern int menu_mouse_y; -extern boolean menu_mouse_allow; +extern boolean menu_mouse_allow, menu_mouse_allow_click; extern void I_ReInitCursorPosition (void); extern boolean endoom_screen_active;