From 692c098bf083c08fce3a76d3d6aa2e63fc7c539e Mon Sep 17 00:00:00 2001 From: emb <> Date: Fri, 6 Mar 2015 16:19:41 -0600 Subject: [PATCH] Having "highlight" sound effect play as soon as you press the button instead of when the item is highlighed. --- RetroFE/Source/Graphics/Page.cpp | 22 +++++++--------------- RetroFE/Source/Graphics/Page.h | 2 -- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index ec5dabb..c5ec03d 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -38,8 +38,6 @@ Page::Page(Configuration &config) , UnloadSoundChunk(NULL) , HighlightSoundChunk(NULL) , SelectSoundChunk(NULL) - , HasSoundedWhenActive(false) - , FirstSoundPlayed(false) , MinShowTime(0) { } @@ -324,6 +322,7 @@ void Page::Highlight() void Page::SetScrolling(ScrollDirection direction) { ScrollingList::ScrollDirection menuDirection; + bool prevScrollActive = ScrollActive; switch(direction) { @@ -342,6 +341,12 @@ void Page::SetScrolling(ScrollDirection direction) break; } + if(!prevScrollActive && ScrollActive && HighlightSoundChunk) + { + HighlightSoundChunk->Play(); + } + + ActiveMenu->SetScrollDirection(menuDirection); } @@ -486,22 +491,10 @@ void Page::Update(float dt) menu->Update(dt); } - if(SelectedItemChanged && !HasSoundedWhenActive && HighlightSoundChunk) - { - // skip the first sound being played (as it is part of the on-enter) - if(FirstSoundPlayed) - { - HighlightSoundChunk->Play(); - HasSoundedWhenActive = true; - } - FirstSoundPlayed = true; - } - if(SelectedItemChanged && !ScrollActive) { Highlight(); SelectedItemChanged = false; - HasSoundedWhenActive = false; } if(TextStatusComponent) @@ -572,7 +565,6 @@ void Page::FreeGraphicsMemory() void Page::AllocateGraphicsMemory() { - FirstSoundPlayed = false; Logger::Write(Logger::ZONE_DEBUG, "Page", "Allocating graphics memory"); for(MenuVector_T::iterator it = Menus.begin(); it != Menus.end(); it++) diff --git a/RetroFE/Source/Graphics/Page.h b/RetroFE/Source/Graphics/Page.h index 86282bc..1c1123c 100644 --- a/RetroFE/Source/Graphics/Page.h +++ b/RetroFE/Source/Graphics/Page.h @@ -100,8 +100,6 @@ private: Sound *UnloadSoundChunk; Sound *HighlightSoundChunk; Sound *SelectSoundChunk; - bool HasSoundedWhenActive; - bool FirstSoundPlayed; float MinShowTime; float ElapsedTime;