Browse Source

Fix missing sounds in menu

Fixes #392
pull/897/head
Anders Jenbo 6 years ago
parent
commit
1ebeaa7cd7
  1. 27
      SourceX/DiabloUI/diabloui.cpp

27
SourceX/DiabloUI/diabloui.cpp

@ -107,18 +107,6 @@ void UiInitScrollBar(UiScrollBar *ui_sb, std::size_t viewport_size, const std::s
} }
} }
void UiPlayMoveSound()
{
if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlemov.wav");
}
void UiPlaySelectSound()
{
if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlslct.wav");
}
void UiFocus(int itemIndex, bool wrap = false) void UiFocus(int itemIndex, bool wrap = false)
{ {
if (!wrap) { if (!wrap) {
@ -138,9 +126,10 @@ void UiFocus(int itemIndex, bool wrap = false)
if (SelectedItem == itemIndex) if (SelectedItem == itemIndex)
return; return;
SelectedItem = itemIndex; if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlemov.wav");
UiPlayMoveSound(); SelectedItem = itemIndex;
if (gfnListFocus) if (gfnListFocus)
gfnListFocus(itemIndex); gfnListFocus(itemIndex);
@ -313,7 +302,8 @@ void UiHandleEvents(SDL_Event *event)
void UiFocusNavigationSelect() void UiFocusNavigationSelect()
{ {
UiPlaySelectSound(); if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlslct.wav");
if (SDL_IsTextInputActive()) { if (SDL_IsTextInputActive()) {
if (strlen(UiTextInput) == 0) { if (strlen(UiTextInput) == 0) {
return; return;
@ -328,7 +318,8 @@ void UiFocusNavigationSelect()
void UiFocusNavigationEsc() void UiFocusNavigationEsc()
{ {
UiPlaySelectSound(); if (gfnSoundFunction)
gfnSoundFunction("sfx\\items\\titlslct.wav");
if (SDL_IsTextInputActive()) { if (SDL_IsTextInputActive()) {
SDL_StopTextInput(); SDL_StopTextInput();
UiTextInput = NULL; UiTextInput = NULL;
@ -343,8 +334,8 @@ void UiFocusNavigationYesNo()
if (gfnListYesNo == NULL) if (gfnListYesNo == NULL)
return; return;
if (gfnListYesNo()) if (gfnListYesNo() && gfnSoundFunction)
UiPlaySelectSound(); gfnSoundFunction("sfx\\items\\titlslct.wav");
} }
bool IsInsideRect(const SDL_Event &event, const SDL_Rect &rect) bool IsInsideRect(const SDL_Event &event, const SDL_Rect &rect)

Loading…
Cancel
Save