From fdd5d2c0d6b31a43dbd2b41cb45cb98ed5b0cbb1 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 27 Oct 2021 00:24:26 +0200 Subject: [PATCH] Make start screen behave more in line with other similar menus Double clicking a menu list was not intuitive and could leave some people confused about how to progress from the very first screen. This is unfortunatly more important then having a nice preview when using arrow keys to high light the other option :( --- Source/DiabloUI/diabloui.cpp | 6 +++--- Source/DiabloUI/diabloui.h | 2 +- Source/DiabloUI/selstart.cpp | 21 ++------------------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/Source/DiabloUI/diabloui.cpp b/Source/DiabloUI/diabloui.cpp index 583311407..5caa87648 100644 --- a/Source/DiabloUI/diabloui.cpp +++ b/Source/DiabloUI/diabloui.cpp @@ -614,7 +614,7 @@ Sint16 GetCenterOffset(Sint16 w, Sint16 bw) return (bw - w) / 2; } -void LoadBackgroundArt(const char *pszFile, int frames, bool withFading) +void LoadBackgroundArt(const char *pszFile, int frames) { SDL_Color pPal[256]; LoadArt(pszFile, &ArtBackground, frames, pPal); @@ -625,7 +625,7 @@ void LoadBackgroundArt(const char *pszFile, int frames, bool withFading) ApplyGamma(logical_palette, orig_palette, 256); fadeTc = 0; - fadeValue = withFading ? 0 : 256; + fadeValue = 0; if (IsHardwareCursorEnabled() && ArtCursor.surface != nullptr && GetCurrentCursorInfo().type() != CursorType::UserInterface) { #if SDL_VERSION_ATLEAST(2, 0, 0) @@ -880,7 +880,7 @@ bool HandleMouseEventList(const SDL_Event &event, UiList *uiList) dbClickTimer = SDL_GetTicks(); } else if (gfnListFocus == NULL || dbClickTimer + 500 >= SDL_GetTicks()) { #else - } else if (gfnListFocus == nullptr || (sgbTouchActive && SelectedItem == index) || event.button.clicks >= 2 || (sgbTouchActive && SelectedItem == index)) { + } else if (gfnListFocus == nullptr || event.button.clicks >= 2) { #endif SelectedItem = index; UiFocusNavigationSelect(); diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index 00ab2416b..75f7b5e4c 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -116,7 +116,7 @@ bool UiItemMouseEvents(SDL_Event *event, const std::vector> *vecDialog); void UiAddLogo(std::vector> *vecDialog, int size = LOGO_MED, int y = 0); void UiFocusNavigationSelect(); diff --git a/Source/DiabloUI/selstart.cpp b/Source/DiabloUI/selstart.cpp index a8883c442..8c821425c 100644 --- a/Source/DiabloUI/selstart.cpp +++ b/Source/DiabloUI/selstart.cpp @@ -28,30 +28,13 @@ void EscPressed() endMenu = true; } -void FocusChanged(int value) -{ - auto option = static_cast(vecDialogItems[value]->m_value); - gbIsHellfire = option == StartUpGameOption::Hellfire; - ArtBackground.Unload(); - ArtBackgroundWidescreen.Unload(); - LoadBackgroundArt("ui_art\\mainmenu.pcx", 1, false); - SetFadeLevel(256); - artLogo.Unload(); - if (gbIsHellfire) { - LoadArt("ui_art\\mainmenuw.pcx", &ArtBackgroundWidescreen); - LoadMaskedArt("ui_art\\hf_logo2.pcx", &artLogo, 16); - } else { - LoadMaskedArt("ui_art\\smlogo.pcx", &artLogo, 15); - } - gbIsHellfire = true; -} - } // namespace void UiSelStartUpGameOption() { LoadArt("ui_art\\mainmenuw.pcx", &ArtBackgroundWidescreen); LoadBackgroundArt("ui_art\\mainmenu.pcx"); + LoadMaskedArt("ui_art\\hf_logo2.pcx", &artLogo, 16); UiAddBackground(&vecDialog); SDL_Rect rect = { 0, (Sint16)(UI_OFFSET_Y), 0, 0 }; @@ -61,7 +44,7 @@ void UiSelStartUpGameOption() vecDialogItems.push_back(std::make_unique(_("Switch to Diablo"), static_cast(StartUpGameOption::Diablo))); vecDialog.push_back(std::make_unique(vecDialogItems, PANEL_LEFT + 64, (UI_OFFSET_Y + 240), 510, 43, UiFlags::AlignCenter | UiFlags::FontSize42 | UiFlags::ColorUiGold, 5)); - UiInitList(vecDialogItems.size(), FocusChanged, ItemSelected, EscPressed, vecDialog, true); + UiInitList(vecDialogItems.size(), nullptr, ItemSelected, EscPressed, vecDialog, true); endMenu = false; while (!endMenu) {