From 1e033bfff562712363c628612c5b00721d063bf8 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 24 Aug 2005 21:24:29 +0000 Subject: [PATCH] auto-update MusicSortDisplay --- stepmania/src/MusicSortDisplay.cpp | 18 ++++++++++++++++-- stepmania/src/MusicSortDisplay.h | 5 +++-- stepmania/src/ScreenSelectMusic.cpp | 6 ------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/stepmania/src/MusicSortDisplay.cpp b/stepmania/src/MusicSortDisplay.cpp index bcef545dfd..7f68b38ea1 100644 --- a/stepmania/src/MusicSortDisplay.cpp +++ b/stepmania/src/MusicSortDisplay.cpp @@ -2,15 +2,29 @@ #include "MusicSortDisplay.h" #include "ThemeManager.h" #include "RageUtil.h" - +#include "GameState.h" MusicSortDisplay::MusicSortDisplay() { + this->SubscribeToMessage( Message_SortOrderChanged ); + + Set( GAMESTATE->m_SortOrder ); } void MusicSortDisplay::Set( SortOrder so ) { - Load( THEME->GetPathG("MusicSortDisplay",SortOrderToString(so)) ); + if( so == SORT_INVALID ) + this->UnloadTexture(); + else + Load( THEME->GetPathG("MusicSortDisplay",SortOrderToString(so)) ); +} + +void MusicSortDisplay::HandleMessage( const CString& sMessage ) +{ + if( sMessage == "SortOrderChanged" ) + Set( GAMESTATE->m_SortOrder ); + + Sprite::HandleMessage( sMessage ); } /* diff --git a/stepmania/src/MusicSortDisplay.h b/stepmania/src/MusicSortDisplay.h index 5be2059f3e..87b673ecb5 100644 --- a/stepmania/src/MusicSortDisplay.h +++ b/stepmania/src/MusicSortDisplay.h @@ -1,5 +1,5 @@ -#ifndef MUSICSORTDISPLAY_H -#define MUSICSORTDISPLAY_H +#ifndef MUSIC_SORT_DISPLAY_H +#define MUSIC_SORT_DISPLAY_H #include "Sprite.h" #include "GameConstantsAndTypes.h" @@ -11,6 +11,7 @@ class MusicSortDisplay : public Sprite public: MusicSortDisplay(); void Set( SortOrder so ); + virtual void HandleMessage( const CString& sMessage ); protected: diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index c0283e5fdc..752d5a5ab0 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -269,7 +269,6 @@ void ScreenSelectMusic::Init() } m_MusicSortDisplay.SetName( "SortIcon" ); - m_MusicSortDisplay.Set( GAMESTATE->m_SortOrder ); SET_XY( m_MusicSortDisplay ); this->AddChild( &m_MusicSortDisplay ); @@ -1121,7 +1120,6 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM ) } else if( SM == SM_SortOrderChanging ) /* happens immediately */ { -// m_MusicSortDisplay.FadeOff( 0, "fade", TWEEN_TIME ); TweenScoreOnAndOffAfterChangeSort(); } else if( SM == SM_SortOrderChanged ) /* happens after the wheel is off and the new song is selected */ @@ -1813,7 +1811,6 @@ void ScreenSelectMusic::AfterMusicChange() void ScreenSelectMusic::SortOrderChanged() { - m_MusicSortDisplay.Set( GAMESTATE->m_SortOrder ); if( SHOW_PANES ) FOREACH_HumanPlayer(pn) m_PaneDisplay[pn].SetFromGameState( GAMESTATE->m_SortOrder ); @@ -1832,9 +1829,6 @@ void ScreenSelectMusic::SortOrderChanged() m_DifficultyList.Show(); break; } - - // tween music sort on screen -// m_MusicSortDisplay.FadeOn( 0, "fade", TWEEN_TIME ); } // lua start