Browse Source

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 :(
pull/3298/head
Anders Jenbo 4 years ago
parent
commit
fdd5d2c0d6
  1. 6
      Source/DiabloUI/diabloui.cpp
  2. 2
      Source/DiabloUI/diabloui.h
  3. 21
      Source/DiabloUI/selstart.cpp

6
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();

2
Source/DiabloUI/diabloui.h

@ -116,7 +116,7 @@ bool UiItemMouseEvents(SDL_Event *event, const std::vector<std::unique_ptr<UiIte
Sint16 GetCenterOffset(Sint16 w, Sint16 bw = 0);
void LoadPalInMem(const SDL_Color *pPal);
void DrawMouse();
void LoadBackgroundArt(const char *pszFile, int frames = 1, bool withFading = true);
void LoadBackgroundArt(const char *pszFile, int frames = 1);
void UiAddBackground(std::vector<std::unique_ptr<UiItemBase>> *vecDialog);
void UiAddLogo(std::vector<std::unique_ptr<UiItemBase>> *vecDialog, int size = LOGO_MED, int y = 0);
void UiFocusNavigationSelect();

21
Source/DiabloUI/selstart.cpp

@ -28,30 +28,13 @@ void EscPressed()
endMenu = true;
}
void FocusChanged(int value)
{
auto option = static_cast<StartUpGameOption>(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<UiListItem>(_("Switch to Diablo"), static_cast<int>(StartUpGameOption::Diablo)));
vecDialog.push_back(std::make_unique<UiList>(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) {

Loading…
Cancel
Save