Having "highlight" sound effect play as soon as you press the button instead of when the item is highlighed.

This commit is contained in:
emb 2015-03-06 16:19:41 -06:00
parent e07b00f707
commit 692c098bf0
2 changed files with 7 additions and 17 deletions

View File

@ -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++)

View File

@ -100,8 +100,6 @@ private:
Sound *UnloadSoundChunk;
Sound *HighlightSoundChunk;
Sound *SelectSoundChunk;
bool HasSoundedWhenActive;
bool FirstSoundPlayed;
float MinShowTime;
float ElapsedTime;