From df5cd5e81356adb2c4698deabbd4753981082db5 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 1 May 2004 23:19:33 +0000 Subject: [PATCH] move MenuElements into a base ScreenWithMenuElements so that metrics can be overridden using the Fallback mechanism --- stepmania/Themes/default/metrics.ini | 48 +++---- stepmania/src/ScreenAward.cpp | 13 +- stepmania/src/ScreenAward.h | 7 +- stepmania/src/ScreenBookkeeping.cpp | 15 +-- stepmania/src/ScreenBookkeeping.h | 7 +- stepmania/src/ScreenBranch.h | 2 - stepmania/src/ScreenCenterImage.cpp | 19 +-- stepmania/src/ScreenCenterImage.h | 8 +- stepmania/src/ScreenEditCoursesMenu.cpp | 13 +- stepmania/src/ScreenEditCoursesMenu.h | 8 +- stepmania/src/ScreenEditMenu.cpp | 15 +-- stepmania/src/ScreenEditMenu.h | 8 +- stepmania/src/ScreenEvaluation.cpp | 14 +- stepmania/src/ScreenEvaluation.h | 8 +- stepmania/src/ScreenEz2SelectMusic.cpp | 16 +-- stepmania/src/ScreenEz2SelectMusic.h | 7 +- stepmania/src/ScreenEz2SelectPlayer.cpp | 21 ++- stepmania/src/ScreenEz2SelectPlayer.h | 8 +- stepmania/src/ScreenInstructions.cpp | 13 +- stepmania/src/ScreenInstructions.h | 7 +- stepmania/src/ScreenJukeboxMenu.cpp | 15 +-- stepmania/src/ScreenJukeboxMenu.h | 8 +- stepmania/src/ScreenManager.cpp | 8 ++ stepmania/src/ScreenManager.h | 2 + stepmania/src/ScreenMapControllers.cpp | 11 +- stepmania/src/ScreenMapControllers.h | 8 +- stepmania/src/ScreenNameEntryTraditional.cpp | 19 +-- stepmania/src/ScreenNameEntryTraditional.h | 6 +- stepmania/src/ScreenOptions.cpp | 17 +-- stepmania/src/ScreenOptions.h | 7 +- stepmania/src/ScreenPlayerOptions.cpp | 8 +- stepmania/src/ScreenSelect.cpp | 15 +-- stepmania/src/ScreenSelect.h | 6 +- stepmania/src/ScreenSelectCharacter.cpp | 18 +-- stepmania/src/ScreenSelectCharacter.h | 7 +- stepmania/src/ScreenSelectCourse.cpp | 15 +-- stepmania/src/ScreenSelectCourse.h | 7 +- stepmania/src/ScreenSelectDifficulty.cpp | 2 +- stepmania/src/ScreenSelectDifficultyEX.cpp | 2 +- stepmania/src/ScreenSelectGroup.cpp | 17 +-- stepmania/src/ScreenSelectGroup.h | 7 +- stepmania/src/ScreenSelectMaster.cpp | 2 +- stepmania/src/ScreenSelectMode.h | 1 - stepmania/src/ScreenSelectMusic.cpp | 27 ++-- stepmania/src/ScreenSelectMusic.h | 7 +- stepmania/src/ScreenSetTime.cpp | 13 +- stepmania/src/ScreenSetTime.h | 7 +- stepmania/src/ScreenSongOptions.cpp | 4 +- stepmania/src/ScreenStyleSplash.cpp | 19 +-- stepmania/src/ScreenStyleSplash.h | 6 +- stepmania/src/ScreenTestInput.cpp | 11 +- stepmania/src/ScreenTestInput.h | 7 +- stepmania/src/ScreenTestLights.cpp | 11 +- stepmania/src/ScreenTestLights.h | 7 +- stepmania/src/ScreenTitleMenu.cpp | 14 +- ...lements.cpp => ScreenWithMenuElements.cpp} | 125 ++++++------------ ...enuElements.h => ScreenWithMenuElements.h} | 32 ++--- 57 files changed, 262 insertions(+), 493 deletions(-) rename stepmania/src/{MenuElements.cpp => ScreenWithMenuElements.cpp} (63%) rename stepmania/src/{MenuElements.h => ScreenWithMenuElements.h} (63%) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 2072fdb08c..362f0e5e0c 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -39,6 +39,7 @@ CurrentModeZoom=1 # Note that we don't use the "name" parameter to Choices here. Name1 is # the displayed text, which might be translated or otherwise changed. The "name,foo" # parameter to ModeChoices is an asset name, which is used in filenames. +Fallback=ScreenWithMenuElements ChoiceNames=1,2,3,4,5,6,7 //,8 Choice1=screen,ScreenCaution @@ -104,6 +105,7 @@ BounceJoinMessage=1 FoldOnJoin=1 [ScreenSelectStyle] +Fallback=ScreenWithMenuElements ChoiceNames=1,2,3,4,5 # The "name" here affects the announcer, eg. "ScreenSelectStyle comment single". Choice1=Style,single;name,single @@ -264,6 +266,7 @@ MemoryCardIcons=0 TimerSeconds=0 [ScreenSelectDifficulty] +Fallback=ScreenWithMenuElements ChoiceNames=1,2,3,4,5,6,7,8 Choice1=PlayMode,arcade;Difficulty,beginner;name,beginner Choice2=PlayMode,arcade;Difficulty,easy;name,easy @@ -501,6 +504,7 @@ StyleIcon=1 MemoryCardIcons=1 [ScreenSelectGroup] +Fallback=ScreenWithMenuElements FrameX=180 FrameY=160 FrameOnCommand=addx,-400;bounceend,0.5;addx,400 @@ -562,12 +566,14 @@ CropWidth=146 InitCommand=horizalign,left;vertalign,top;shadowlength,2;zoom,0.5; [ScreenInstructions] +Fallback=ScreenWithMenuElements NextScreen=ScreenSelectCharacter TimerSeconds=15 StyleIcon=1 MemoryCardIcons=1 [ScreenSelectMusic] +Fallback=ScreenWithMenuElements NonPresenceP1X=-128 NonPresenceP1Y=240 NonPresenceP1OnCommand=x,-128;sleep,0.5;linear,1.0;x,32;sleep,999; @@ -2779,34 +2785,34 @@ FeetPerDifficulty=0 StopMusicOnNext=0 KeepAliveType=0 // 0 for MAX, 1 for 5th -[MenuElements] +[ScreenWithMenuElements] HeaderX=320 HeaderY=22 -HeaderOnCommand=addx,640;spring,0.5;addx,-640 +HeaderOnCommand=z,-1000;addx,640;spring,0.5;addx,-640 HeaderOffCommand=bouncebegin,0.5;addx,640; FooterX=320 FooterY=464 -FooterOnCommand= +FooterOnCommand=z,-1000; FooterOffCommand= HelpX=320 HelpY=456 -HelpOnCommand=zoom,0.5;zoomy,0;linear,0.5;zoomy,0.5 +HelpOnCommand=z,-1000;zoom,0.5;zoomy,0;linear,0.5;zoomy,0.5 HelpOffCommand=linear,0.5;zoomy,0 StyleIconX=440 StyleIconY=26 -StyleIconOnCommand=addx,640;spring,0.5;addx,-640 +StyleIconOnCommand=z,-1000;addx,640;spring,0.5;addx,-640 StyleIconOffCommand=bouncebegin,0.5;addx,640; MemoryCardDisplayP1X=460 MemoryCardDisplayP1Y=20 -MemoryCardDisplayP1OnCommand=addx,640;spring,0.5;addx,-640 +MemoryCardDisplayP1OnCommand=z,-1000;addx,640;spring,0.5;addx,-640 MemoryCardDisplayP1OffCommand=bouncebegin,0.5;addx,640; MemoryCardDisplayP2X=480 MemoryCardDisplayP2Y=20 -MemoryCardDisplayP2OnCommand=addx,640;spring,0.5;addx,-640 +MemoryCardDisplayP2OnCommand=z,-1000;addx,640;spring,0.5;addx,-640 MemoryCardDisplayP2OffCommand=bouncebegin,0.5;addx,640; TimerX=590 TimerY=22 -TimerOnCommand=addx,640;spring,0.5;addx,-640 +TimerOnCommand=z,-1000;addx,640;spring,0.5;addx,-640 TimerOffCommand=bouncebegin,0.5;addx,640; [MenuTimer] @@ -2884,34 +2890,23 @@ MoreExitUnselectedP1Command= MoreExitUnselectedP2Command= [ScreenMapControllers] +Fallback=ScreenOperatorMenu EvenLineIn=addx,-640;decelerate,0.5;addx,640; OddLineIn=addx,640;decelerate,0.5;addx,-640; EvenLineOut=stoptweening;accelerate,0.3;addx,-640; OddLineOut=stoptweening;accelerate,0.3;addx,640; -StyleIcon=0 -MemoryCardIcons=0 -TimerSeconds=0 [ScreenCenterImage] -StyleIcon=0 -MemoryCardIcons=0 -TimerSeconds=0 +Fallback=ScreenOperatorMenu [ScreenTestInput] -StyleIcon=0 -MemoryCardIcons=0 -TimerSeconds=0 +Fallback=ScreenOperatorMenu [ScreenTestLights] -StyleIcon=0 -MemoryCardIcons=0 -TimerSeconds=0 -Fallback=ScreenTestInput +Fallback=ScreenOperatorMenu [ScreenBookkeeping] -StyleIcon=0 -MemoryCardIcons=0 -TimerSeconds=0 +Fallback=ScreenOperatorMenu [HoldGhostArrow] WarmUpSeconds=0.25 @@ -3237,6 +3232,10 @@ MemoryCardIcons=1 [ScreenOptionsSubmenu] Class=ScreenOptionsMaster +Fallback=ScreenOperatorMenu + +[ScreenOperatorMenu] +Fallback=ScreenWithMenuElements StyleIcon=0 MemoryCardIcons=0 TimerSeconds=0 @@ -3980,6 +3979,7 @@ NextScreen=ScreenRanking NextScreen=ScreenCompany [ScreenSelectCharacter] +Fallback=ScreenWithMenuElements TitleP1OnCommand=x,140;y,80;addx,-400;bounceend,0.5;addx,400 TitleP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-400 TitleP2OnCommand=x,500;y,80;addx,400;bounceend,0.5;addx,-400 diff --git a/stepmania/src/ScreenAward.cpp b/stepmania/src/ScreenAward.cpp index 5357c897a3..089dfb5d2f 100644 --- a/stepmania/src/ScreenAward.cpp +++ b/stepmania/src/ScreenAward.cpp @@ -28,7 +28,7 @@ #define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen") -ScreenAward::ScreenAward( CString sName ) : Screen( sName ) +ScreenAward::ScreenAward( CString sName ) : ScreenWithMenuElements( sName ) { bool bEitherPlayerHasAward = false; ZERO( m_bSavedScreenshot ); @@ -85,26 +85,19 @@ ScreenAward::ScreenAward( CString sName ) : Screen( sName ) return; } - m_Menu.Load( m_sName ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathToS( m_sName + " music") ); } void ScreenAward::DrawPrimitives() { - m_Menu.DrawBottomLayer(); - Screen::DrawPrimitives(); - - m_Menu.DrawTopLayer(); } void ScreenAward::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { // LOG->Trace( "ScreenAward::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; @@ -183,5 +176,5 @@ void ScreenAward::MenuStart( PlayerNumber pn ) OFF_COMMAND( m_textDescription[p] ); } - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } diff --git a/stepmania/src/ScreenAward.h b/stepmania/src/ScreenAward.h index e3aba7c3bd..c832a30175 100644 --- a/stepmania/src/ScreenAward.h +++ b/stepmania/src/ScreenAward.h @@ -9,13 +9,12 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" -#include "MenuElements.h" +#include "ScreenWithMenuElements.h" #include "BitmapText.h" #include "ActorUtil.h" -class ScreenAward : public Screen +class ScreenAward : public ScreenWithMenuElements { public: ScreenAward( CString sName ); @@ -32,8 +31,6 @@ private: AutoActor m_Received[NUM_PLAYERS]; AutoActor m_Trophy[NUM_PLAYERS]; BitmapText m_textDescription[NUM_PLAYERS]; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenBookkeeping.cpp b/stepmania/src/ScreenBookkeeping.cpp index 7206a6e040..3563eb69e8 100644 --- a/stepmania/src/ScreenBookkeeping.cpp +++ b/stepmania/src/ScreenBookkeeping.cpp @@ -25,7 +25,7 @@ #include "Bookkeeper.h" -ScreenBookkeeping::ScreenBookkeeping( CString sClassName ) : Screen( sClassName ) +ScreenBookkeeping::ScreenBookkeeping( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenBookkeeping::ScreenBookkeeping()" ); @@ -48,9 +48,6 @@ ScreenBookkeeping::ScreenBookkeeping( CString sClassName ) : Screen( sClassName this->AddChild( &m_textCols[i] ); } - m_Menu.Load( "ScreenBookkeeping" ); - this->AddChild( &m_Menu ); - ChangeView( (View)0 ); SOUND->PlayMusic( THEME->GetPathToS("ScreenBookkeeping music") ); @@ -63,9 +60,7 @@ ScreenBookkeeping::~ScreenBookkeeping() void ScreenBookkeeping::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenBookkeeping::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -103,19 +98,19 @@ void ScreenBookkeeping::MenuRight( PlayerNumber pn ) void ScreenBookkeeping::MenuStart( PlayerNumber pn ) { - if( !m_Menu.IsTransitioning() ) + if( !IsTransitioning() ) { SCREENMAN->PlayStartSound(); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } } void ScreenBookkeeping::MenuBack( PlayerNumber pn ) { - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SCREENMAN->PlayStartSound(); - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); } } diff --git a/stepmania/src/ScreenBookkeeping.h b/stepmania/src/ScreenBookkeeping.h index 4d5b170037..55aec739fd 100644 --- a/stepmania/src/ScreenBookkeeping.h +++ b/stepmania/src/ScreenBookkeeping.h @@ -9,17 +9,16 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" const int NUM_BOOKKEEPING_COLS = 4; -class ScreenBookkeeping : public Screen +class ScreenBookkeeping : public ScreenWithMenuElements { public: ScreenBookkeeping( CString sName ); @@ -42,7 +41,5 @@ private: View m_View; BitmapText m_textTitle; BitmapText m_textCols[NUM_BOOKKEEPING_COLS]; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenBranch.h b/stepmania/src/ScreenBranch.h index a8c413e6f7..de3eed51e9 100644 --- a/stepmania/src/ScreenBranch.h +++ b/stepmania/src/ScreenBranch.h @@ -10,8 +10,6 @@ */ #include "Screen.h" -#include "MenuElements.h" - class ScreenBranch : public Screen { diff --git a/stepmania/src/ScreenCenterImage.cpp b/stepmania/src/ScreenCenterImage.cpp index 2000ba16b5..40ee943018 100644 --- a/stepmania/src/ScreenCenterImage.cpp +++ b/stepmania/src/ScreenCenterImage.cpp @@ -23,9 +23,7 @@ #include "RageDisplay.h" - - -ScreenCenterImage::ScreenCenterImage( CString sClassName ) : Screen( sClassName ) +ScreenCenterImage::ScreenCenterImage( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenCenterImage::ScreenCenterImage()" ); @@ -36,9 +34,6 @@ ScreenCenterImage::ScreenCenterImage( CString sClassName ) : Screen( sClassName m_textInstructions.SetZoom( 0.8f ); this->AddChild( &m_textInstructions ); - m_Menu.Load( "ScreenCenterImage" ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathToS("ScreenCenterImage music") ); } @@ -53,14 +48,12 @@ ScreenCenterImage::~ScreenCenterImage() void ScreenCenterImage::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; if( type == IET_RELEASE ) @@ -131,17 +124,17 @@ void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType switch( DeviceI.button ) { case SDLK_ESCAPE: - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SOUND->PlayOnce( THEME->GetPathToS("Common back") ); - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); } case SDLK_RETURN: case SDLK_KP_ENTER: - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SOUND->PlayOnce( THEME->GetPathToS("Common start") ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } } } diff --git a/stepmania/src/ScreenCenterImage.h b/stepmania/src/ScreenCenterImage.h index de133c53f9..6af89bacec 100644 --- a/stepmania/src/ScreenCenterImage.h +++ b/stepmania/src/ScreenCenterImage.h @@ -9,16 +9,15 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" -class ScreenCenterImage : public Screen +class ScreenCenterImage : public ScreenWithMenuElements { public: ScreenCenterImage( CString sName ); @@ -31,8 +30,5 @@ public: private: BitmapText m_textInstructions; - - MenuElements m_Menu; - }; diff --git a/stepmania/src/ScreenEditCoursesMenu.cpp b/stepmania/src/ScreenEditCoursesMenu.cpp index e4a00ec6ce..3c502c07fb 100644 --- a/stepmania/src/ScreenEditCoursesMenu.cpp +++ b/stepmania/src/ScreenEditCoursesMenu.cpp @@ -34,7 +34,7 @@ const ScreenMessage SM_RefreshSelector = (ScreenMessage)(SM_User+1); -ScreenEditCoursesMenu::ScreenEditCoursesMenu( CString sName ) : Screen( sName ) +ScreenEditCoursesMenu::ScreenEditCoursesMenu( CString sName ) : ScreenWithMenuElements( sName ) { LOG->Trace( "ScreenEditCoursesMenu::ScreenEditCoursesMenu()" ); @@ -48,10 +48,7 @@ ScreenEditCoursesMenu::ScreenEditCoursesMenu( CString sName ) : Screen( sName ) // m_Selector.AllowNewNotes(); this->AddChild( &m_Selector ); - m_Menu.Load( "ScreenEditCoursesMenu" ); - this->AddChild( &m_Menu ); - - + m_textExplanation.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); m_textExplanation.SetText( EXPLANATION_TEXT ); @@ -69,9 +66,7 @@ ScreenEditCoursesMenu::~ScreenEditCoursesMenu() void ScreenEditCoursesMenu::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenEditCoursesMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -116,7 +111,7 @@ void ScreenEditCoursesMenu::MenuRight( PlayerNumber pn, const InputEventType typ void ScreenEditCoursesMenu::MenuStart( PlayerNumber pn ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; m_Selector.Start(); @@ -124,7 +119,7 @@ void ScreenEditCoursesMenu::MenuStart( PlayerNumber pn ) void ScreenEditCoursesMenu::MenuBack( PlayerNumber pn ) { - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); SOUND->StopMusic(); } diff --git a/stepmania/src/ScreenEditCoursesMenu.h b/stepmania/src/ScreenEditCoursesMenu.h index 7d5e7da0e7..6d74ab2c86 100644 --- a/stepmania/src/ScreenEditCoursesMenu.h +++ b/stepmania/src/ScreenEditCoursesMenu.h @@ -9,13 +9,11 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "EditCoursesMenu.h" #include "BitmapText.h" -#include "MenuElements.h" - -class ScreenEditCoursesMenu : public Screen +class ScreenEditCoursesMenu : public ScreenWithMenuElements { public: ScreenEditCoursesMenu( CString sName ); @@ -37,8 +35,6 @@ private: EditCoursesMenu m_Selector; BitmapText m_textExplanation; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index 29106c25ab..66736ac0e0 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -35,7 +35,7 @@ const ScreenMessage SM_RefreshSelector = (ScreenMessage)(SM_User+1); -ScreenEditMenu::ScreenEditMenu( CString sName ) : Screen( sName ) +ScreenEditMenu::ScreenEditMenu( CString sName ) : ScreenWithMenuElements( sName ) { LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" ); @@ -45,9 +45,6 @@ ScreenEditMenu::ScreenEditMenu( CString sName ) : Screen( sName ) // m_Selector.AllowNewNotes(); this->AddChild( &m_Selector ); - m_Menu.Load( "ScreenEditMenu" ); - this->AddChild( &m_Menu ); - m_textExplanation.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); @@ -66,9 +63,7 @@ ScreenEditMenu::~ScreenEditMenu() void ScreenEditMenu::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenEditMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -127,7 +122,7 @@ void DeleteCurNotes( void* pThrowAway ) void ScreenEditMenu::MenuStart( PlayerNumber pn ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Song* pSong = m_Selector.GetSelectedSong(); @@ -159,8 +154,8 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn ) // Prepare prepare for ScreenEdit ASSERT( pNotes ); SOUND->StopMusic(); - SOUND->PlayOnce( THEME->GetPathToS("Common start") ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + SCREENMAN->PlayStartSound(); + StartTransitioning( SM_GoToNextScreen ); break; case EditMenu::ACTION_DELETE: ASSERT( pNotes ); @@ -226,7 +221,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn ) void ScreenEditMenu::MenuBack( PlayerNumber pn ) { - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); SOUND->StopMusic(); } diff --git a/stepmania/src/ScreenEditMenu.h b/stepmania/src/ScreenEditMenu.h index c9ab1338fb..acdfe5f8a1 100644 --- a/stepmania/src/ScreenEditMenu.h +++ b/stepmania/src/ScreenEditMenu.h @@ -12,13 +12,11 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "EditMenu.h" #include "BitmapText.h" -#include "MenuElements.h" - -class ScreenEditMenu : public Screen +class ScreenEditMenu : public ScreenWithMenuElements { public: ScreenEditMenu( CString sName ); @@ -40,8 +38,6 @@ private: EditMenu m_Selector; BitmapText m_textExplanation; - - MenuElements m_Menu; }; #endif diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index c3165bc57d..248d252cb8 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -93,7 +93,7 @@ static const int NUM_SHOWN_RADAR_CATEGORIES = 5; const ScreenMessage SM_PlayCheer = ScreenMessage(SM_User+6); -ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) +ScreenEvaluation::ScreenEvaluation( CString sClassName ) : ScreenWithMenuElements(sClassName) { LOG->Trace( "ScreenEvaluation::ScreenEvaluation" ); Init(); // work around horrible gcc bug 3187 @@ -252,10 +252,6 @@ void ScreenEvaluation::Init() m_Type==stage; - - m_Menu.Load( m_sName ); - this->AddChild( &m_Menu ); - // // load pass/fail sound // @@ -1417,20 +1413,16 @@ void ScreenEvaluation::Update( float fDeltaTime ) void ScreenEvaluation::DrawPrimitives() { - m_Menu.DrawBottomLayer(); - m_bgCondBga.DrawPrimitives(); Screen::DrawPrimitives(); - - m_Menu.DrawTopLayer(); } void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { // LOG->Trace( "ScreenEvaluation::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; if( GameI.IsValid() ) @@ -1570,6 +1562,6 @@ void ScreenEvaluation::EndScreen() break; } } - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index 8284545516..710d9a6701 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -13,11 +13,10 @@ */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "GradeDisplay.h" -#include "MenuElements.h" #include "Banner.h" #include "ScoreDisplayNormal.h" #include "Banner.h" @@ -29,6 +28,7 @@ #include "ActorUtil.h" #include "ConditionalBGA.h" #include "HighScore.h" +#include "RageSound.h" const int MAX_SONGS_TO_SHOW = 5; // In summary, we show last 3 stages, plus extra stages if passed enum JudgeLine { marvelous, perfect, great, good, boo, miss, ok, max_combo, error, NUM_JUDGE_LINES }; @@ -41,7 +41,7 @@ struct EvalSoundSequence RageSound sSound; }; -class ScreenEvaluation : public Screen +class ScreenEvaluation : public ScreenWithMenuElements { public: enum Type { stage, summary, course }; @@ -76,8 +76,6 @@ protected: BGAnimation m_bgOverlay; ConditionalBGA m_bgCondBga; - MenuElements m_Menu; - // banner area Banner m_LargeBanner; Sprite m_sprLargeBannerFrame; diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 5d66694383..4151b64563 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -73,7 +73,7 @@ const float TWEEN_TIME = 0.5f; const ScreenMessage SM_NoSongs = ScreenMessage(SM_User+3); -ScreenEz2SelectMusic::ScreenEz2SelectMusic( CString sName ) : Screen( sName ) +ScreenEz2SelectMusic::ScreenEz2SelectMusic( CString sName ) : ScreenWithMenuElements( sName ) { /* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */ GAMESTATE->FinishStage(); @@ -100,8 +100,6 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic( CString sName ) : Screen( sName ) } - m_Menu.Load("ScreenEz2SelectMusic"); - this->AddChild( &m_Menu ); m_soundButtonPress.Load( THEME->GetPathToS("ScreenEz2SelectMusic buttonpress")); m_soundMusicChange.Load( THEME->GetPathToS("ScreenEz2SelectMusic change")); @@ -248,7 +246,7 @@ void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy if( type == IET_RELEASE ) return; // don't care - if( m_Menu.IsTransitioning() ) return; // ignore + if( IsTransitioning() ) return; // ignore if( !GameI.IsValid() ) return; // don't care @@ -408,7 +406,7 @@ void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM ) void ScreenEz2SelectMusic::MenuRight( PlayerNumber pn, const InputEventType type ) { - m_Menu.m_MenuTimer->Stall(); + m_MenuTimer->Stall(); m_MusicBannerWheel.BannersRight(); for(int i=i_SkipAheadOffset; i>0; i--) m_MusicBannerWheel.BannersRight(); @@ -419,7 +417,7 @@ void ScreenEz2SelectMusic::MenuBack( PlayerNumber pn ) { SOUND->StopMusic(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } @@ -446,7 +444,7 @@ void ScreenEz2SelectMusic::TweenOffScreen() void ScreenEz2SelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type ) { - m_Menu.m_MenuTimer->Stall(); + m_MenuTimer->Stall(); m_MusicBannerWheel.BannersLeft(); for(int i=i_SkipAheadOffset; i>0; i--) m_MusicBannerWheel.BannersLeft(); @@ -511,7 +509,7 @@ void ScreenEz2SelectMusic::Update( float fDeltaTime ) if(m_bMadeChoice && RageTimer::GetTimeSinceStart() > m_fRemainingWaitTime + 2 && !m_bTransitioning) { m_bTransitioning = true; - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } Screen::Update( fDeltaTime ); @@ -519,9 +517,7 @@ void ScreenEz2SelectMusic::Update( float fDeltaTime ) void ScreenEz2SelectMusic::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn ) diff --git a/stepmania/src/ScreenEz2SelectMusic.h b/stepmania/src/ScreenEz2SelectMusic.h index eb17241fef..b766b2b316 100644 --- a/stepmania/src/ScreenEz2SelectMusic.h +++ b/stepmania/src/ScreenEz2SelectMusic.h @@ -11,16 +11,14 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" -#include "MenuElements.h" #include "MusicBannerWheel.h" -#include "MenuElements.h" #include "DifficultyRating.h" #include "ModeSwitcher.h" -class ScreenEz2SelectMusic : public Screen +class ScreenEz2SelectMusic : public ScreenWithMenuElements { public: ScreenEz2SelectMusic( CString sName ); @@ -76,7 +74,6 @@ protected: float m_fRemainingWaitTime; MusicBannerWheel m_MusicBannerWheel; - MenuElements m_Menu; DifficultyRating m_DifficultyRating; vector m_arrayNotes[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index c72ea8f8fe..844a69327a 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -46,7 +46,7 @@ ScreenEz2SelectPlayer (Constructor) Desc: Sets up the screen display ************************************/ -ScreenEz2SelectPlayer::ScreenEz2SelectPlayer( CString sName ) : Screen( sName ) +ScreenEz2SelectPlayer::ScreenEz2SelectPlayer( CString sName ) : ScreenWithMenuElements( sName ) { // Unjoin the players, then let them join back in on this screen // GAMESTATE->m_bPlayersCanJoin = true; @@ -56,9 +56,6 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer( CString sName ) : Screen( sName ) LOG->Trace( "ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()" ); - m_Menu.Load( "ScreenEz2SelectPlayer" ); - this->AddChild( &m_Menu ); - m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenEz2SelectPlayer background") ); this->AddChild( &m_Background ); // animated background =) @@ -128,9 +125,7 @@ Desc: Draws the screen =P void ScreenEz2SelectPlayer::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } /************************************ @@ -141,7 +136,7 @@ void ScreenEz2SelectPlayer::Input( const DeviceInput& DeviceI, const InputEventT { LOG->Trace( "ScreenEz2SelectPlayer::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler @@ -165,7 +160,7 @@ void ScreenEz2SelectPlayer::HandleScreenMessage( const ScreenMessage SM ) } TweenOffScreen(); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); break; case SM_GoToPrevScreen: SOUND->StopMusic(); @@ -188,7 +183,7 @@ void ScreenEz2SelectPlayer::MenuBack( PlayerNumber pn ) { SOUND->StopMusic(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } @@ -233,14 +228,14 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber pn ) if( bBothSidesJoined ) { TweenOffScreen(); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } else { // give the other player a little time to join - m_Menu.m_MenuTimer->SetSeconds( 1 ); - m_Menu.m_MenuTimer->Start(); - m_Menu.m_MenuTimer->EnableStealth( SILENT_WAIT ); // do we wanna make the timer 'quiet' ? + m_MenuTimer->SetSeconds( 1 ); + m_MenuTimer->Start(); + m_MenuTimer->EnableStealth( SILENT_WAIT ); // do we wanna make the timer 'quiet' ? } } diff --git a/stepmania/src/ScreenEz2SelectPlayer.h b/stepmania/src/ScreenEz2SelectPlayer.h index 4d7efe51a5..b20fbd115d 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.h +++ b/stepmania/src/ScreenEz2SelectPlayer.h @@ -7,13 +7,11 @@ Frieza /* Includes */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "RageSound.h" -#include "MenuElements.h" - -class ScreenEz2SelectPlayer : public Screen +class ScreenEz2SelectPlayer : public ScreenWithMenuElements { public: ScreenEz2SelectPlayer( CString sName ); @@ -35,8 +33,6 @@ private: Sprite m_sprJoinMessage[NUM_PLAYERS]; Sprite m_sprJoinFrame[NUM_PLAYERS]; - MenuElements m_Menu; - RageSound m_soundSelect; BGAnimation m_Background; }; diff --git a/stepmania/src/ScreenInstructions.cpp b/stepmania/src/ScreenInstructions.cpp index 2cce6e6c81..c932ae060a 100644 --- a/stepmania/src/ScreenInstructions.cpp +++ b/stepmania/src/ScreenInstructions.cpp @@ -26,7 +26,7 @@ #define NEXT_SCREEN THEME->GetMetric("ScreenInstructions","NextScreen") -ScreenInstructions::ScreenInstructions( CString sName ) : Screen( sName ) +ScreenInstructions::ScreenInstructions( CString sName ) : ScreenWithMenuElements( sName ) { LOG->Trace( "ScreenInstructions::ScreenInstructions()" ); @@ -54,9 +54,6 @@ ScreenInstructions::ScreenInstructions( CString sName ) : Screen( sName ) } } - m_Menu.Load("ScreenInstructions"); - this->AddChild( &m_Menu ); - CString sHowToPlayPath; if( GAMESTATE->m_PlayMode != PLAY_MODE_INVALID ) sHowToPlayPath = THEME->GetPathToG("ScreenInstructions "+PlayModeToString(GAMESTATE->m_PlayMode)) ; @@ -89,14 +86,12 @@ void ScreenInstructions::Update( float fDeltaTime ) void ScreenInstructions::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenInstructions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; // default input handler @@ -121,12 +116,12 @@ void ScreenInstructions::HandleScreenMessage( const ScreenMessage SM ) void ScreenInstructions::MenuBack( PlayerNumber pn ) { - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } void ScreenInstructions::MenuStart( PlayerNumber pn ) { - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); m_sprHowToPlay.StopTweening(); m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_ACCELERATE ); diff --git a/stepmania/src/ScreenInstructions.h b/stepmania/src/ScreenInstructions.h index d4eab55549..2e2e36f650 100644 --- a/stepmania/src/ScreenInstructions.h +++ b/stepmania/src/ScreenInstructions.h @@ -12,13 +12,11 @@ */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "RandomSample.h" -#include "MenuElements.h" - -class ScreenInstructions : public Screen +class ScreenInstructions : public ScreenWithMenuElements { public: ScreenInstructions( CString sName ); @@ -34,7 +32,6 @@ public: protected: Sprite m_sprHowToPlay; - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenJukeboxMenu.cpp b/stepmania/src/ScreenJukeboxMenu.cpp index d6cd3ab966..fb2e0346b1 100644 --- a/stepmania/src/ScreenJukeboxMenu.cpp +++ b/stepmania/src/ScreenJukeboxMenu.cpp @@ -33,7 +33,7 @@ #define HELP_TEXT THEME->GetMetric("ScreenJukeboxMenu","HelpText") -ScreenJukeboxMenu::ScreenJukeboxMenu( CString sClassName ) : Screen( sClassName ) +ScreenJukeboxMenu::ScreenJukeboxMenu( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" ); @@ -46,9 +46,6 @@ ScreenJukeboxMenu::ScreenJukeboxMenu( CString sClassName ) : Screen( sClassName // m_Selector.AllowNewNotes(); this->AddChild( &m_Selector ); - m_Menu.Load( "ScreenJukeboxMenu" ); - this->AddChild( &m_Menu ); - m_textExplanation.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); @@ -69,16 +66,14 @@ ScreenJukeboxMenu::~ScreenJukeboxMenu() void ScreenJukeboxMenu::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenJukeboxMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { LOG->Trace( "ScreenJukeboxMenu::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); @@ -119,7 +114,7 @@ void ScreenJukeboxMenu::MenuRight( PlayerNumber pn, const InputEventType type ) void ScreenJukeboxMenu::MenuStart( PlayerNumber pn ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Style style = m_Selector.GetSelectedStyle(); @@ -145,12 +140,12 @@ void ScreenJukeboxMenu::MenuStart( PlayerNumber pn ) SOUND->StopMusic(); SOUND->PlayOnce( THEME->GetPathToS("Common start") ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } void ScreenJukeboxMenu::MenuBack( PlayerNumber pn ) { - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); SOUND->StopMusic(); } diff --git a/stepmania/src/ScreenJukeboxMenu.h b/stepmania/src/ScreenJukeboxMenu.h index 6c3228ce9e..940f58a5e1 100644 --- a/stepmania/src/ScreenJukeboxMenu.h +++ b/stepmania/src/ScreenJukeboxMenu.h @@ -9,14 +9,12 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "JukeboxMenu.h" #include "BitmapText.h" -#include "MenuElements.h" #include "RageSound.h" - -class ScreenJukeboxMenu : public Screen +class ScreenJukeboxMenu : public ScreenWithMenuElements { public: ScreenJukeboxMenu( CString sName ); @@ -39,8 +37,6 @@ private: BitmapText m_textExplanation; - MenuElements m_Menu; - RageSound m_soundInvalid; }; diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 144add0991..6f17264a82 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -367,6 +367,7 @@ ScreenManager::ScreenManager() m_soundCoin.Load( THEME->GetPathS("Common","coin") ); m_soundInvalid.Load( THEME->GetPathS("Common","invalid") ); m_soundScreenshot.Load( THEME->GetPathS("Common","screenshot") ); + m_soundBack.Load( THEME->GetPathS("Common","back") ); } @@ -773,3 +774,10 @@ void ScreenManager::PlayScreenshotSound() p.m_Volume = PREFSMAN->m_fSoundVolume; m_soundScreenshot.Play( &p ); } + +void ScreenManager::PlayBackSound() +{ + RageSoundParams p; + p.m_Volume = PREFSMAN->m_fSoundVolume; + m_soundBack.Play( &p ); +} diff --git a/stepmania/src/ScreenManager.h b/stepmania/src/ScreenManager.h index 07e6390239..a4d49acf6f 100644 --- a/stepmania/src/ScreenManager.h +++ b/stepmania/src/ScreenManager.h @@ -81,11 +81,13 @@ public: void PlayCoinSound(); void PlayInvalidSound(); void PlayScreenshotSound(); + void PlayBackSound(); private: RageSound m_soundStart; RageSound m_soundCoin; RageSound m_soundInvalid; RageSound m_soundScreenshot; + RageSound m_soundBack; }; diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp index c3635610e9..6e7d6d2e89 100644 --- a/stepmania/src/ScreenMapControllers.cpp +++ b/stepmania/src/ScreenMapControllers.cpp @@ -43,7 +43,7 @@ const float BUTTON_COLUMN_X[NUM_GAME_TO_DEVICE_SLOTS*MAX_GAME_CONTROLLERS] = }; -ScreenMapControllers::ScreenMapControllers( CString sClassName ) : Screen( sClassName ) +ScreenMapControllers::ScreenMapControllers( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenMapControllers::ScreenMapControllers()" ); @@ -97,9 +97,6 @@ ScreenMapControllers::ScreenMapControllers( CString sClassName ) : Screen( sClas m_iWaitingForPress = 0; - m_Menu.Load( "ScreenMapControllers" ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathToS("ScreenMapControllers music") ); Refresh(); @@ -139,9 +136,7 @@ void ScreenMapControllers::Update( float fDeltaTime ) void ScreenMapControllers::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } static bool IsAxis( const DeviceInput& DeviceI ) @@ -266,10 +261,10 @@ void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventTy m_iCurButton++; break; case SDLK_ESCAPE: /* Quit the screen. */ - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SOUND->PlayOnce( THEME->GetPathToS("Common start") ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); for( int b=0; bGetCurrentGameDef()->m_iButtonsPerController; b++ ) m_Line[b].Command( (b%2)? ODD_LINE_OUT:EVEN_LINE_OUT ); } diff --git a/stepmania/src/ScreenMapControllers.h b/stepmania/src/ScreenMapControllers.h index 42fd2d091c..e801cf32f8 100644 --- a/stepmania/src/ScreenMapControllers.h +++ b/stepmania/src/ScreenMapControllers.h @@ -9,16 +9,15 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" -class ScreenMapControllers : public Screen +class ScreenMapControllers : public ScreenWithMenuElements { public: ScreenMapControllers( CString sName ); @@ -53,8 +52,5 @@ private: BitmapText m_textMappedTo[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS]; ActorFrame m_Line[MAX_GAME_BUTTONS]; - - MenuElements m_Menu; - }; diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 43d29bf32c..53bd541021 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -133,7 +133,7 @@ float HighScoreWheel::Scroll() return GetTweenTimeLeft(); } -ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : Screen( sClassName ) +ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenNameEntryTraditional::ScreenNameEntryTraditional()" ); @@ -192,9 +192,6 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S m_CurFeat[p] = 0; } - m_Menu.Load( m_sName ); - this->AddChild( &m_Menu ); - // // init keyboards // @@ -482,16 +479,14 @@ void ScreenNameEntryTraditional::DrawPrimitives() DISPLAY->CameraPushMatrix(); DISPLAY->LoadMenuPerspective( FOV, CENTER_X, CENTER_Y ); - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); DISPLAY->CameraPopMatrix(); } void ScreenNameEntryTraditional::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); @@ -537,7 +532,7 @@ void ScreenNameEntryTraditional::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_MenuTimer: - if( !m_Menu.m_Out.IsTransitioning() ) + if( !m_Out.IsTransitioning() ) { for( int p=0; pTrace( "ScreenOptions::ScreenOptions()" ); @@ -106,9 +106,6 @@ ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName) m_SoundToggleOn.Load( THEME->GetPathToS("ScreenOptions toggle on") ); m_SoundToggleOff.Load( THEME->GetPathToS("ScreenOptions toggle off") ); - m_Menu.Load( sClassName ); - this->AddChild( &m_Menu ); - // add everything to m_framePage so we can animate everything at once this->AddChild( &m_framePage ); @@ -500,6 +497,8 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti } m_sprMore->FinishTweening(); + + this->SortByZ(); } ScreenOptions::~ScreenOptions() @@ -911,16 +910,14 @@ void ScreenOptions::Update( float fDeltaTime ) void ScreenOptions::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { /* Allow input when transitioning in (m_In.IsTransitioning()), but ignore it * when we're transitioning out. */ - if( m_Menu.m_Back.IsTransitioning() || m_Menu.m_Out.IsTransitioning() ) + if( m_Back.IsTransitioning() || m_Out.IsTransitioning() ) return; if( type == IET_RELEASE ) @@ -956,9 +953,9 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) this->GoToNextState(); break; case SM_BeginFadingOut: - if(m_Menu.IsTransitioning()) + if(IsTransitioning()) return; /* already transitioning */ - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); m_SoundStart.Play(); @@ -1161,7 +1158,7 @@ void ScreenOptions::MenuBack( PlayerNumber pn ) { Screen::MenuBack( pn ); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } void ScreenOptions::StartGoToNextState() diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 4349a1fc70..bc329732f3 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -12,12 +12,11 @@ */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "RandomSample.h" #include "Quad.h" -#include "MenuElements.h" #include "OptionsCursor.h" #include "OptionIcon.h" #include "DualScrollBar.h" @@ -50,7 +49,7 @@ enum InputMode }; -class ScreenOptions : public Screen +class ScreenOptions : public ScreenWithMenuElements { public: ScreenOptions( CString sClassName ); @@ -97,8 +96,6 @@ protected: /* Returns -1 if on a row with no OptionRowData (eg. EXIT). */ int GetCurrentRow(PlayerNumber pn = PLAYER_1) const; - MenuElements m_Menu; - protected: // derived classes need access to these void LoadOptionIcon( PlayerNumber pn, int iRow, CString sText ); enum Navigation { NAV_THREE_KEY, NAV_THREE_KEY_MENU, NAV_FIVE_KEY, NAV_FIRST_CHOICE_GOES_DOWN }; diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 4851ae9f8f..518c084838 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -34,10 +34,10 @@ ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) : /* If we're going to "press start for more options" or skipping options * entirely, we need a different fade out. XXX: this is a hack */ if( PREFSMAN->m_ShowSongOptions == PrefsManager::NO || GAMESTATE->m_bEditing ) - m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions direct out") ); /* direct to stage */ + m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions direct out") ); /* direct to stage */ else if( m_bAskOptionsMessage ) { - m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions option out") ); /* optional song options */ + m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions option out") ); /* optional song options */ m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenPlayerOptions options") ); m_sprOptionsMessage.StopAnimating(); @@ -106,7 +106,7 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp { if( m_bAskOptionsMessage && type == IET_FIRST_PRESS && - !m_Menu.m_In.IsTransitioning() && + !m_In.IsTransitioning() && MenuI.IsValid() && MenuI.button == MENU_BUTTON_START ) { @@ -152,7 +152,7 @@ void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) { m_bAcceptedChoices = true; - float fShowSeconds = m_Menu.m_Out.GetLengthSeconds(); + float fShowSeconds = m_Out.GetLengthSeconds(); // show "hold START for options" m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index 6d6d5b1a6c..67e23b01b3 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -39,7 +39,7 @@ #define HELP_TEXT THEME->GetMetric (m_sName,"HelpText") #define NEXT_SCREEN( c ) THEME->GetMetric (m_sName,ssprintf("NextScreen%d",c+1)) -ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName) +ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClassName) { LOG->Trace( "ScreenSelect::ScreenSelect()" ); @@ -74,9 +74,6 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName) } } - m_Menu.Load( sClassName ); - this->AddChild( &m_Menu ); - // // Load codes // @@ -140,9 +137,7 @@ void ScreenSelect::DrawPrimitives() int iSelection = this->GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); m_vpBGAnimations[iSelection]->Draw(); } - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -155,7 +150,7 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, return; // don't let the screen handle the MENU_START press } - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; for( unsigned i = 0; i < m_aCodes.size(); ++i ) @@ -213,8 +208,8 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM ) /* It's our turn to tween out. */ case SM_AllDoneChoosing: FinalizeChoices(); - if( !m_Menu.IsTransitioning() ) - m_Menu.StartTransitioning( SM_GoToNextScreen ); + if( !IsTransitioning() ) + StartTransitioning( SM_GoToNextScreen ); break; case SM_MenuTimer: { @@ -250,5 +245,5 @@ void ScreenSelect::MenuBack( PlayerNumber pn ) { SOUND->StopMusic(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } diff --git a/stepmania/src/ScreenSelect.h b/stepmania/src/ScreenSelect.h index 9523f73876..6323756915 100644 --- a/stepmania/src/ScreenSelect.h +++ b/stepmania/src/ScreenSelect.h @@ -11,8 +11,7 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" -#include "MenuElements.h" +#include "ScreenWithMenuElements.h" #include "BGAnimation.h" #include "ModeChoice.h" #include "CodeDetector.h" @@ -22,7 +21,7 @@ const ScreenMessage SM_AllDoneChoosing = (ScreenMessage)(SM_User+123); // unique #define MAX_CHOICES 30 -class ScreenSelect : public Screen +class ScreenSelect : public ScreenWithMenuElements { public: ScreenSelect( CString sClassName ); @@ -41,7 +40,6 @@ protected: virtual void UpdateSelectableChoices() = 0; // derived screens must handle this void FinalizeChoices(); - MenuElements m_Menu; vector m_vpBGAnimations; vector m_aModeChoices; // derived classes should look here for what choices are available diff --git a/stepmania/src/ScreenSelectCharacter.cpp b/stepmania/src/ScreenSelectCharacter.cpp index 0d116e689f..291a30053b 100644 --- a/stepmania/src/ScreenSelectCharacter.cpp +++ b/stepmania/src/ScreenSelectCharacter.cpp @@ -59,7 +59,7 @@ const PlayerNumber CPU_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 }; -ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : Screen( sClassName ) +ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenSelectCharacter::ScreenSelectCharacter()" ); @@ -89,14 +89,8 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : Screen( sCl } - - m_Menu.Load( "ScreenSelectCharacter" ); - this->AddChild( &m_Menu ); - - int p; - for( p=0; pTrace( "ScreenSelectCharacter::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler @@ -198,9 +192,7 @@ void ScreenSelectCharacter::Input( const DeviceInput& DeviceI, const InputEventT void ScreenSelectCharacter::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM ) @@ -208,7 +200,7 @@ void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_BeginFadingOut: - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); break; case SM_MenuTimer: MenuStart(PLAYER_1); @@ -381,7 +373,7 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn ) GAMESTATE->m_pCurCharacters[p] = pChar; } - m_Menu.StopTimer(); + StopTimer(); TweenOffScreen(); this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_TWEEN_OFF_SECONDS ); } @@ -389,7 +381,7 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn ) void ScreenSelectCharacter::MenuBack( PlayerNumber pn ) { - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } void ScreenSelectCharacter::TweenOffScreen() diff --git a/stepmania/src/ScreenSelectCharacter.h b/stepmania/src/ScreenSelectCharacter.h index a38c95b422..08c1987f26 100644 --- a/stepmania/src/ScreenSelectCharacter.h +++ b/stepmania/src/ScreenSelectCharacter.h @@ -9,18 +9,17 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "RandomSample.h" #include "GameConstantsAndTypes.h" -#include "MenuElements.h" #include "OptionIcon.h" #include "Banner.h" #define MAX_CHAR_ICONS_TO_SHOW 11 -class ScreenSelectCharacter : public Screen +class ScreenSelectCharacter : public ScreenWithMenuElements { public: ScreenSelectCharacter( CString sName ); @@ -58,8 +57,6 @@ private: } m_SelectionRow[NUM_PLAYERS]; PlayerNumber GetAffectedPlayerNumber( PlayerNumber pn ); // returns the number of the player that pn is selecting for - MenuElements m_Menu; - Sprite m_sprTitle[NUM_PLAYERS]; Banner m_sprIcons[NUM_PLAYERS][MAX_CHAR_ICONS_TO_SHOW]; diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 0609ca9557..117b162195 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -56,7 +56,7 @@ static const ScreenMessage SM_AllowOptionsMenuRepeat = ScreenMessage(SM_User+1); -ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : Screen( sClassName ) +ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenSelectCourse::ScreenSelectCourse()" ); @@ -71,9 +71,6 @@ ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : Screen( sClassNam m_bGoToOptions = false; m_bAllowOptionsMenuRepeat = false; - m_Menu.Load( "ScreenSelectCourse" ); - this->AddChild( &m_Menu ); - m_sprExplanation.Load( THEME->GetPathToG("ScreenSelectCourse explanation") ); m_sprExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); this->AddChild( &m_sprExplanation ); @@ -159,9 +156,7 @@ ScreenSelectCourse::~ScreenSelectCourse() void ScreenSelectCourse::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); m_sprOptionsMessage.Draw(); } @@ -257,7 +252,7 @@ void ScreenSelectCourse::Input( const DeviceInput& DeviceI, InputEventType type, return; } - if( m_Menu.IsTransitioning() ) return; // ignore + if( IsTransitioning() ) return; // ignore if( m_bMadeChoice ) return; @@ -347,7 +342,7 @@ void ScreenSelectCourse::MenuStart( PlayerNumber pn ) m_bMadeChoice = true; - float fShowSeconds = m_Menu.m_Out.GetLengthSeconds(); + float fShowSeconds = m_Out.GetLengthSeconds(); // show "hold START for options" m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); @@ -366,7 +361,7 @@ void ScreenSelectCourse::MenuStart( PlayerNumber pn ) this->PostScreenMessage( SM_AllowOptionsMenuRepeat, 0.5f ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); Course* pCourse = m_MusicWheel.GetSelectedCourse(); GAMESTATE->m_pCurCourse = pCourse; @@ -387,7 +382,7 @@ void ScreenSelectCourse::MenuBack( PlayerNumber pn ) { SOUND->StopMusic(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } diff --git a/stepmania/src/ScreenSelectCourse.h b/stepmania/src/ScreenSelectCourse.h index a8c4101421..6183488128 100644 --- a/stepmania/src/ScreenSelectCourse.h +++ b/stepmania/src/ScreenSelectCourse.h @@ -9,18 +9,17 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "RageSound.h" #include "GameConstantsAndTypes.h" #include "MusicWheel.h" #include "CourseContentsList.h" -#include "MenuElements.h" #include "FadingBanner.h" -class ScreenSelectCourse : public Screen +class ScreenSelectCourse : public ScreenWithMenuElements { public: ScreenSelectCourse( CString sName ); @@ -42,8 +41,6 @@ protected: void AfterCourseChange(); void UpdateOptionsDisplays(); - MenuElements m_Menu; - Sprite m_sprExplanation; Sprite m_sprBannerFrame; FadingBanner m_Banner; diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 6acd4269b7..7ca5c61f50 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -143,7 +143,7 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) case SM_BeginFadingOut: TweenOffScreen(); SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, SLEEP_AFTER_TWEEN_OFF_SECONDS ); // nofify parent that we're finished - m_Menu.StopTimer(); + StopTimer(); break; } } diff --git a/stepmania/src/ScreenSelectDifficultyEX.cpp b/stepmania/src/ScreenSelectDifficultyEX.cpp index c80f117f0a..6b454af9e4 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.cpp +++ b/stepmania/src/ScreenSelectDifficultyEX.cpp @@ -174,7 +174,7 @@ void ScreenSelectDifficultyEX::HandleScreenMessage( const ScreenMessage SM ) case SM_BeginFadingOut: TweenOffScreen(); SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, SLEEP_AFTER_TWEEN_OFF_SECONDS ); // nofify parent that we're finished - m_Menu.StopTimer(); + StopTimer(); break; } } diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index b50e77d725..9fd46fa815 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -35,7 +35,7 @@ #define NEXT_SCREEN THEME->GetMetric ("ScreenSelectGroup","NextScreen") -ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : Screen( sClassName ) +ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenSelectGroup::ScreenSelectGroup()" ); @@ -47,11 +47,6 @@ ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : Screen( sClassName } - - m_Menu.Load( "ScreenSelectGroup" ); - this->AddChild( &m_Menu ); - - unsigned i; int j; @@ -165,7 +160,7 @@ void ScreenSelectGroup::Input( const DeviceInput& DeviceI, const InputEventType { LOG->Trace( "ScreenSelectGroup::Input()" ); - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler @@ -173,9 +168,7 @@ void ScreenSelectGroup::Input( const DeviceInput& DeviceI, const InputEventType void ScreenSelectGroup::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM ) @@ -183,7 +176,7 @@ void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_BeginFadingOut: - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); break; case SM_MenuTimer: MenuStart(PLAYER_1); @@ -254,7 +247,7 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn ) return; m_soundSelect.PlayRandom(); - m_Menu.m_MenuTimer->Stop(); + m_MenuTimer->Stop(); m_bChosen = true; GAMESTATE->m_pCurSong = NULL; @@ -272,7 +265,7 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn ) void ScreenSelectGroup::MenuBack( PlayerNumber pn ) { - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } void ScreenSelectGroup::TweenOffScreen() diff --git a/stepmania/src/ScreenSelectGroup.h b/stepmania/src/ScreenSelectGroup.h index c8533fed08..9b3c6b7694 100644 --- a/stepmania/src/ScreenSelectGroup.h +++ b/stepmania/src/ScreenSelectGroup.h @@ -9,16 +9,15 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "RandomSample.h" -#include "MenuElements.h" #include "FadingBanner.h" #include "MusicList.h" #include "GroupList.h" -class ScreenSelectGroup : public Screen +class ScreenSelectGroup : public ScreenWithMenuElements { public: ScreenSelectGroup( CString sName ); @@ -42,8 +41,6 @@ public: private: - MenuElements m_Menu; - Sprite m_sprExplanation; Sprite m_sprFrame; FadingBanner m_Banner; diff --git a/stepmania/src/ScreenSelectMaster.cpp b/stepmania/src/ScreenSelectMaster.cpp index 116a085aee..67c13ed42c 100644 --- a/stepmania/src/ScreenSelectMaster.cpp +++ b/stepmania/src/ScreenSelectMaster.cpp @@ -321,7 +321,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM ) fSecs += EXTRA_SLEEP_AFTER_TWEEN_OFF_SECONDS; fSecs = max( fSecs, 0 ); SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, fSecs ); // nofify parent that we're finished - m_Menu.StopTimer(); + StopTimer(); } break; } diff --git a/stepmania/src/ScreenSelectMode.h b/stepmania/src/ScreenSelectMode.h index e4046a6dda..1ef357ab85 100644 --- a/stepmania/src/ScreenSelectMode.h +++ b/stepmania/src/ScreenSelectMode.h @@ -13,7 +13,6 @@ Frieza #include "Screen.h" #include "Sprite.h" #include "Quad.h" -#include "MenuElements.h" #include "ScrollingList.h" #include "GameConstantsAndTypes.h" #include "ModeChoice.h" diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 21479f9fac..ca60259dd5 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -76,7 +76,7 @@ static void FlipSpriteHorizontally(Sprite &s) s.SetCustomTextureCoords(Coords); } -ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName ) +ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenSelectMusic::ScreenSelectMusic()" ); @@ -101,9 +101,6 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName int p; - m_Menu.Load( "ScreenSelectMusic" ); - this->AddChild( &m_Menu ); - // pop'n music has this under the songwheel... for( p=0; pCameraPushMatrix(); DISPLAY->LoadMenuPerspective( FOV, FOV_CENTER_X, FOV_CENTER_Y ); - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); m_sprOptionsMessage.Draw(); m_bgOptionsOut.Draw(); m_bgNoOptionsOut.Draw(); @@ -714,7 +709,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type, MenuI.IsValid() && MenuI.button == MENU_BUTTON_START && type != IET_RELEASE && - m_Menu.IsTransitioning() && + IsTransitioning() && !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() ) { @@ -731,7 +726,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type, return; } - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; // ignore if( m_bMadeChoice ) return; // ignore @@ -963,16 +958,16 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM ) if( m_MusicWheel.IsRouletting() ) { MenuStart(PLAYER_INVALID); - m_Menu.m_MenuTimer->SetSeconds( 15 ); - m_Menu.m_MenuTimer->Start(); + m_MenuTimer->SetSeconds( 15 ); + m_MenuTimer->Start(); } else if( DO_ROULETTE_ON_MENU_TIMER ) { if( m_MusicWheel.GetSelectedType() != TYPE_SONG ) { m_MusicWheel.StartRoulette(); - m_Menu.m_MenuTimer->SetSeconds( 15 ); - m_Menu.m_MenuTimer->Start(); + m_MenuTimer->SetSeconds( 15 ); + m_MenuTimer->Start(); } else { @@ -1113,7 +1108,7 @@ void ScreenSelectMusic::MenuStart( PlayerNumber pn ) if( !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() ) { -// float fShowSeconds = m_Menu.m_Out.GetLengthSeconds(); +// float fShowSeconds = m_Out.GetLengthSeconds(); // show "hold START for options" m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,1) ); // visible @@ -1127,7 +1122,7 @@ void ScreenSelectMusic::MenuStart( PlayerNumber pn ) this->PostScreenMessage( SM_AllowOptionsMenuRepeat, 0.5f ); } - m_Menu.StartTransitioning( SM_BeginFadingOut ); + StartTransitioning( SM_BeginFadingOut ); } if( GAMESTATE->IsExtraStage() && PREFSMAN->m_bPickExtraStage ) @@ -1153,7 +1148,7 @@ void ScreenSelectMusic::MenuBack( PlayerNumber pn ) { SOUND->StopMusic(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); } void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn ) @@ -1251,7 +1246,7 @@ int FindCourseIndexOfSameMode( T begin, T end, const Course *p ) void ScreenSelectMusic::AfterMusicChange() { if( !m_MusicWheel.IsRouletting() ) - m_Menu.m_MenuTimer->Stall(); + m_MenuTimer->Stall(); Song* pSong = m_MusicWheel.GetSelectedSong(); if( pSong ) diff --git a/stepmania/src/ScreenSelectMusic.h b/stepmania/src/ScreenSelectMusic.h index 555901f5ff..cf76c18473 100644 --- a/stepmania/src/ScreenSelectMusic.h +++ b/stepmania/src/ScreenSelectMusic.h @@ -9,7 +9,7 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "GameConstantsAndTypes.h" @@ -17,7 +17,6 @@ #include "Banner.h" #include "FadingBanner.h" #include "BPMDisplay.h" -#include "MenuElements.h" #include "GrooveRadar.h" #include "GrooveGraph.h" #include "DifficultyIcon.h" @@ -31,7 +30,7 @@ #include "Character.h" #include "BGAnimation.h" -class ScreenSelectMusic : public Screen +class ScreenSelectMusic : public ScreenWithMenuElements { public: ScreenSelectMusic( CString sName ); @@ -73,8 +72,6 @@ protected: vector m_arrayNotes; int m_iSelection[NUM_PLAYERS]; - MenuElements m_Menu; - Sprite m_sprCharacterIcon[NUM_PLAYERS]; Sprite m_sprBannerMask; FadingBanner m_Banner; diff --git a/stepmania/src/ScreenSetTime.cpp b/stepmania/src/ScreenSetTime.cpp index c53d48a1a1..3f378c2a3e 100644 --- a/stepmania/src/ScreenSetTime.cpp +++ b/stepmania/src/ScreenSetTime.cpp @@ -51,7 +51,7 @@ static float GetTitleY( SetTimeSelection s ) { return g_Y[s]; } static float GetValueX( SetTimeSelection s ) { return g_X[s] + 80; } static float GetValueY( SetTimeSelection s ) { return g_Y[s]; } -ScreenSetTime::ScreenSetTime( CString sClassName ) : Screen( sClassName ) +ScreenSetTime::ScreenSetTime( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenSetTime::ScreenSetTime()" ); @@ -77,9 +77,6 @@ ScreenSetTime::ScreenSetTime( CString sClassName ) : Screen( sClassName ) m_Selection = (SetTimeSelection)0; ChangeSelection( 0 ); - m_Menu.Load( m_sName ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") ); } @@ -98,9 +95,7 @@ void ScreenSetTime::Update( float fDelta ) void ScreenSetTime::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenSetTime::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -108,7 +103,7 @@ void ScreenSetTime::Input( const DeviceInput& DeviceI, const InputEventType type if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT ) return; // ignore - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler @@ -192,7 +187,7 @@ void ScreenSetTime::MenuStart( PlayerNumber pn ) else if( m_Selection == NUM_SET_TIME_SELECTIONS -1 ) // last row { SOUND->PlayOnce( THEME->GetPathS("Common","start") ); - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } else ChangeSelection( +1 ); @@ -200,6 +195,6 @@ void ScreenSetTime::MenuStart( PlayerNumber pn ) void ScreenSetTime::MenuBack( PlayerNumber pn ) { - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); } diff --git a/stepmania/src/ScreenSetTime.h b/stepmania/src/ScreenSetTime.h index 5ca5f3073a..5330b077fe 100644 --- a/stepmania/src/ScreenSetTime.h +++ b/stepmania/src/ScreenSetTime.h @@ -9,12 +9,11 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" enum SetTimeSelection @@ -28,7 +27,7 @@ enum SetTimeSelection NUM_SET_TIME_SELECTIONS }; -class ScreenSetTime : public Screen +class ScreenSetTime : public ScreenWithMenuElements { public: ScreenSetTime( CString sName ); @@ -53,7 +52,5 @@ private: BitmapText m_textTitle[NUM_SET_TIME_SELECTIONS]; BitmapText m_textValue[NUM_SET_TIME_SELECTIONS]; BitmapText m_textDayOfWeek; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index f0df67d14f..dd2bcde820 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -32,8 +32,8 @@ ScreenSongOptions::ScreenSongOptions( CString sClassName ) : * fade in. */ if(PREFSMAN->m_ShowSongOptions == PrefsManager::ASK) { - m_Menu.m_In.Load( THEME->GetPathToB("ScreenSongOptions option in") ); - m_Menu.m_In.StartTransitioning(); + m_In.Load( THEME->GetPathToB("ScreenSongOptions option in") ); + m_In.StartTransitioning(); } } diff --git a/stepmania/src/ScreenStyleSplash.cpp b/stepmania/src/ScreenStyleSplash.cpp index 1df781a73f..68fdfafdb4 100644 --- a/stepmania/src/ScreenStyleSplash.cpp +++ b/stepmania/src/ScreenStyleSplash.cpp @@ -28,7 +28,7 @@ const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User-7); const ScreenMessage SM_StartClosing = ScreenMessage(SM_User-8); -ScreenStyleSplash::ScreenStyleSplash( CString sName ) : Screen( sName ) +ScreenStyleSplash::ScreenStyleSplash( CString sName ) : ScreenWithMenuElements( sName ) { SOUND->StopMusic(); @@ -50,16 +50,13 @@ ScreenStyleSplash::ScreenStyleSplash( CString sName ) : Screen( sName ) m_Background.LoadFromAniDir( THEME->GetPathToB(ssprintf("ScreenStyleSplash-%s-%s-%d",sGameName.c_str(),sStyleName.c_str(),iDifficulty) ) ); this->AddChild( &m_Background ); - m_Menu.Load( "ScreenStyleSplash" ); - this->AddChild( &m_Menu ); - this->PostScreenMessage( SM_StartClosing, 2 ); } void ScreenStyleSplash::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { - if( m_Menu.IsTransitioning() ) + if( IsTransitioning() ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); @@ -71,8 +68,8 @@ void ScreenStyleSplash::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_StartClosing: - if( !m_Menu.IsTransitioning() ) - m_Menu.StartTransitioning( SM_GoToNextScreen ); + if( !IsTransitioning() ) + StartTransitioning( SM_GoToNextScreen ); break; case SM_DoneOpening: @@ -88,22 +85,20 @@ void ScreenStyleSplash::HandleScreenMessage( const ScreenMessage SM ) void ScreenStyleSplash::MenuStart( PlayerNumber pn ) { - m_Menu.StartTransitioning( SM_GoToNextScreen ); + StartTransitioning( SM_GoToNextScreen ); } void ScreenStyleSplash::MenuBack( PlayerNumber pn ) { - if(m_Menu.IsTransitioning()) + if(IsTransitioning()) return; this->ClearMessageQueue(); - m_Menu.Back( SM_GoToPrevScreen ); + Back( SM_GoToPrevScreen ); SOUND->PlayOnce( THEME->GetPathToS("menu back") ); } void ScreenStyleSplash::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } diff --git a/stepmania/src/ScreenStyleSplash.h b/stepmania/src/ScreenStyleSplash.h index 04aaee6e0d..9f6d45558d 100644 --- a/stepmania/src/ScreenStyleSplash.h +++ b/stepmania/src/ScreenStyleSplash.h @@ -13,12 +13,11 @@ */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "BGAnimation.h" -#include "MenuElements.h" -class ScreenStyleSplash : public Screen +class ScreenStyleSplash : public ScreenWithMenuElements { public: ScreenStyleSplash( CString sName ); @@ -31,7 +30,6 @@ protected: void MenuStart( PlayerNumber pn ); void MenuBack( PlayerNumber pn ); - MenuElements m_Menu; BGAnimation m_Background; }; diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp index 1102523d12..a88bdafae0 100644 --- a/stepmania/src/ScreenTestInput.cpp +++ b/stepmania/src/ScreenTestInput.cpp @@ -25,7 +25,7 @@ -ScreenTestInput::ScreenTestInput( CString sClassName ) : Screen( sClassName ) +ScreenTestInput::ScreenTestInput( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenTestInput::ScreenTestInput()" ); @@ -37,9 +37,6 @@ ScreenTestInput::ScreenTestInput( CString sClassName ) : Screen( sClassName ) m_textInputs.SetZoom( 0.8f ); this->AddChild( &m_textInputs ); - m_Menu.Load( "ScreenTestInput" ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathToS("ScreenTestInput music") ); } @@ -95,9 +92,7 @@ void ScreenTestInput::Update( float fDeltaTime ) void ScreenTestInput::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenTestInput::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -126,9 +121,9 @@ void ScreenTestInput::MenuStart( PlayerNumber pn ) void ScreenTestInput::MenuBack( PlayerNumber pn ) { - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SCREENMAN->PlayStartSound(); - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); } } diff --git a/stepmania/src/ScreenTestInput.h b/stepmania/src/ScreenTestInput.h index b122fc6ee8..87a0de461f 100644 --- a/stepmania/src/ScreenTestInput.h +++ b/stepmania/src/ScreenTestInput.h @@ -9,16 +9,15 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" -class ScreenTestInput : public Screen +class ScreenTestInput : public ScreenWithMenuElements { public: ScreenTestInput( CString sName ); @@ -34,7 +33,5 @@ public: private: BitmapText m_textInputs; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenTestLights.cpp b/stepmania/src/ScreenTestLights.cpp index 120701c86c..afe09e626b 100644 --- a/stepmania/src/ScreenTestLights.cpp +++ b/stepmania/src/ScreenTestLights.cpp @@ -25,7 +25,7 @@ #include "LightsManager.h" -ScreenTestLights::ScreenTestLights( CString sClassName ) : Screen( sClassName ) +ScreenTestLights::ScreenTestLights( CString sClassName ) : ScreenWithMenuElements( sClassName ) { LOG->Trace( "ScreenTestLights::ScreenTestLights()" ); @@ -37,9 +37,6 @@ ScreenTestLights::ScreenTestLights( CString sClassName ) : Screen( sClassName ) m_textInputs.SetZoom( 0.8f ); this->AddChild( &m_textInputs ); - m_Menu.Load( "ScreenTestLights" ); - this->AddChild( &m_Menu ); - SOUND->PlayMusic( THEME->GetPathToS("ScreenTestLights music") ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST ); @@ -76,9 +73,7 @@ void ScreenTestLights::Update( float fDeltaTime ) void ScreenTestLights::DrawPrimitives() { - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); } void ScreenTestLights::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -107,9 +102,9 @@ void ScreenTestLights::MenuStart( PlayerNumber pn ) void ScreenTestLights::MenuBack( PlayerNumber pn ) { - if(!m_Menu.IsTransitioning()) + if(!IsTransitioning()) { SCREENMAN->PlayStartSound(); - m_Menu.StartTransitioning( SM_GoToPrevScreen ); + StartTransitioning( SM_GoToPrevScreen ); } } diff --git a/stepmania/src/ScreenTestLights.h b/stepmania/src/ScreenTestLights.h index 1c63e159a7..bdb5ca218a 100644 --- a/stepmania/src/ScreenTestLights.h +++ b/stepmania/src/ScreenTestLights.h @@ -9,16 +9,15 @@ ----------------------------------------------------------------------------- */ -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "Sprite.h" #include "BitmapText.h" #include "PrefsManager.h" #include "InputMapper.h" -#include "MenuElements.h" #include "RageInputDevice.h" -class ScreenTestLights : public Screen +class ScreenTestLights : public ScreenWithMenuElements { public: ScreenTestLights( CString sName ); @@ -34,7 +33,5 @@ public: private: BitmapText m_textInputs; - - MenuElements m_Menu; }; diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index b08690ffea..39f31df458 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -191,6 +191,8 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS); + this->SortByZ(); + // this->MoveToTail( &m_AttractOut ); // put it in the back so it covers up the stuff we just added } @@ -237,7 +239,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty if( !MenuI.IsValid() ) return; - if( m_Menu.m_In.IsTransitioning() || m_Menu.m_Back.IsTransitioning() ) /* not m_Menu.m_Out */ + if( m_In.IsTransitioning() || m_Back.IsTransitioning() ) /* not m_Out */ return; switch( MenuI.button ) @@ -249,9 +251,9 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty MoveCursor( false ); break; case MENU_BUTTON_BACK: - if( m_Menu.m_Out.IsTransitioning() ) + if( m_Out.IsTransitioning() ) break; - m_Menu.Back( SM_GoToAttractLoop ); + Back( SM_GoToAttractLoop ); break; case MENU_BUTTON_START: /* return if the choice is invalid */ @@ -268,8 +270,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty if( !Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) ) return; - if( !m_Menu.m_Out.IsTransitioning() ) - m_Menu.StartTransitioning( SM_GoToNextScreen ); + if( !m_Out.IsTransitioning() ) + StartTransitioning( SM_GoToNextScreen ); } // detect codes @@ -315,7 +317,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty void ScreenTitleMenu::Update( float fDelta ) { // time out on this screen and go to the attract sequence - if( !m_Menu.IsTransitioning() && TimeToDemonstration.PeekDeltaTime() >= SECONDS_BEFORE_ATTRACT) + if( !IsTransitioning() && TimeToDemonstration.PeekDeltaTime() >= SECONDS_BEFORE_ATTRACT) { // don't time out on this screen is coin mode is pay. // If we're here, then there's a credit in the machine. diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/ScreenWithMenuElements.cpp similarity index 63% rename from stepmania/src/MenuElements.cpp rename to stepmania/src/ScreenWithMenuElements.cpp index b85d5a2049..f54170a601 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/ScreenWithMenuElements.cpp @@ -1,47 +1,37 @@ #include "global.h" /* ----------------------------------------------------------------------------- - File: MenuElements.h + Class: ScreenWithMenuElements - Desc: Base class for menu Screens. + Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#include "MenuElements.h" -#include "RageUtil.h" -#include "ScreenManager.h" -#include "GameConstantsAndTypes.h" -#include "PrefsManager.h" -#include "RageLog.h" -#include "GameManager.h" -#include "GameState.h" -#include "ThemeManager.h" +#include "ScreenWithMenuElements.h" #include "MenuTimer.h" #include "HelpDisplay.h" - +#include "RageLog.h" +#include "ThemeManager.h" +#include "GameState.h" +#include "StyleDef.h" +#include "PrefsManager.h" +#include "ScreenManager.h" #define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds") #define STYLE_ICON THEME->GetMetricB(m_sName,"StyleIcon") #define MEMORY_CARD_ICONS THEME->GetMetricB(m_sName,"MemoryCardIcons") - -MenuElements::MenuElements() +ScreenWithMenuElements::ScreenWithMenuElements( CString sClassName ) : Screen( sClassName ) { + LOG->Trace( "ScreenWithMenuElements::ScreenWithMenuElements()" ); + m_MenuTimer = new MenuTimer; m_textHelp = new HelpDisplay; -} -MenuElements::~MenuElements() -{ - delete m_MenuTimer; - delete m_textHelp; -} -void MenuElements::Load( CString sClassName ) -{ LOG->Trace( "MenuElements::MenuElements()" ); ASSERT( this->m_SubActors.empty() ); // don't call Load twice! @@ -53,8 +43,8 @@ void MenuElements::Load( CString sClassName ) m_autoHeader.Load( THEME->GetPathToG(m_sName+" header") ); m_autoHeader->SetName("Header"); - UtilSetXY( m_autoHeader, "MenuElements" ); - UtilOnCommand( m_autoHeader, "MenuElements" ); + UtilSetXY( m_autoHeader, m_sName ); + UtilOnCommand( m_autoHeader, m_sName ); this->AddChild( m_autoHeader ); if( STYLE_ICON && GAMESTATE->m_CurStyle != STYLE_INVALID ) @@ -63,8 +53,8 @@ void MenuElements::Load( CString sClassName ) m_sprStyleIcon.SetName( "StyleIcon" ); m_sprStyleIcon.Load( THEME->GetPathToG(sIconFileName) ); m_sprStyleIcon.StopAnimating(); - UtilSetXY( m_sprStyleIcon, "MenuElements" ); - UtilOnCommand( m_sprStyleIcon, "MenuElements" ); + UtilSetXY( m_sprStyleIcon, m_sName ); + UtilOnCommand( m_sprStyleIcon, m_sName ); this->AddChild( &m_sprStyleIcon ); } @@ -74,8 +64,8 @@ void MenuElements::Load( CString sClassName ) { m_MemoryCardDisplay[p].Load( (PlayerNumber)p ); m_MemoryCardDisplay[p].SetName( ssprintf("MemoryCardDisplayP%d",p+1) ); - UtilSetXY( m_MemoryCardDisplay[p], "MenuElements" ); - UtilOnCommand( m_MemoryCardDisplay[p], "MenuElements" ); + UtilSetXY( m_MemoryCardDisplay[p], m_sName ); + UtilOnCommand( m_MemoryCardDisplay[p], m_sName ); this->AddChild( &m_MemoryCardDisplay[p] ); } } @@ -84,8 +74,8 @@ void MenuElements::Load( CString sClassName ) if( m_bTimerEnabled ) { m_MenuTimer->SetName( "Timer" ); - UtilSetXY( m_MenuTimer, "MenuElements" ); - UtilOnCommand( m_MenuTimer, "MenuElements" ); + UtilSetXY( m_MenuTimer, m_sName ); + UtilOnCommand( m_MenuTimer, m_sName ); if( TIMER_SECONDS > 0 && PREFSMAN->m_bMenuTimer && !GAMESTATE->m_bEditing ) m_MenuTimer->SetSeconds( TIMER_SECONDS ); else @@ -95,14 +85,14 @@ void MenuElements::Load( CString sClassName ) m_autoFooter.Load( THEME->GetPathToG(m_sName+" footer") ); m_autoFooter->SetName("Footer"); - UtilSetXY( m_autoFooter, "MenuElements" ); - UtilOnCommand( m_autoFooter, "MenuElements" ); + UtilSetXY( m_autoFooter, m_sName ); + UtilOnCommand( m_autoFooter, m_sName ); this->AddChild( m_autoFooter ); m_textHelp->SetName( "HelpDisplay", "Help" ); m_textHelp->Load(); - UtilSetXY( m_textHelp, "MenuElements" ); - UtilOnCommand( m_textHelp, "MenuElements" ); + UtilSetXY( m_textHelp, m_sName ); + UtilOnCommand( m_textHelp, m_sName ); CStringArray asHelpTips; split( THEME->GetMetric(m_sName,"HelpText"), "\n", asHelpTips ); m_textHelp->SetTips( asHelpTips ); @@ -110,40 +100,41 @@ void MenuElements::Load( CString sClassName ) m_In.Load( THEME->GetPathToB(m_sName+" in") ); + m_In.SetZ( -1000 ); // always on top this->AddChild( &m_In ); m_Out.Load( THEME->GetPathToB(m_sName+" out") ); + m_Out.SetZ( -1000 ); // always on top this->AddChild( &m_Out ); m_Back.Load( THEME->GetPathToB("Common back") ); + m_Back.SetZ( -1000 ); // always on top this->AddChild( &m_Back ); - - m_soundBack.Load( THEME->GetPathToS("Common back") ); - m_In.StartTransitioning(); } -void MenuElements::Update( float fDeltaTime ) +ScreenWithMenuElements::~ScreenWithMenuElements() { - ActorFrame::Update(fDeltaTime); + SAFE_DELETE( m_MenuTimer ); + SAFE_DELETE( m_textHelp ); } -void MenuElements::StartTransitioning( ScreenMessage smSendWhenDone ) +void ScreenWithMenuElements::StartTransitioning( ScreenMessage smSendWhenDone ) { if( m_bTimerEnabled ) { m_MenuTimer->SetSeconds( 0 ); m_MenuTimer->Stop(); - UtilOffCommand( m_MenuTimer, "MenuElements" ); + UtilOffCommand( m_MenuTimer, m_sName ); } - UtilOffCommand( m_autoHeader, "MenuElements" ); - UtilOffCommand( m_sprStyleIcon, "MenuElements" ); + UtilOffCommand( m_autoHeader, m_sName ); + UtilOffCommand( m_sprStyleIcon, m_sName ); for( int p=0; pPostMessageToTopScreen( smSendWhenDone, TimeUntilFinished ); } -void MenuElements::Back( ScreenMessage smSendWhenDone ) +void ScreenWithMenuElements::Back( ScreenMessage smSendWhenDone ) { if( m_Back.IsTransitioning() ) return; // ignore m_MenuTimer->Stop(); m_Back.StartTransitioning( smSendWhenDone ); - m_soundBack.Play(); + SCREENMAN->PlayBackSound(); } -void MenuElements::DrawPrimitives() -{ - // do nothing. Call DrawBottomLayer() and DrawTopLayer() instead. -} - -void MenuElements::DrawTopLayer() -{ - ASSERT( !this->m_SubActors.empty() ); // Load first - BeginDraw(); - - m_autoHeader->Draw(); - m_sprStyleIcon.Draw(); - m_autoFooter->Draw(); - for( int p=0; pDraw(); - m_textHelp->Draw(); - m_In.Draw(); - m_Out.Draw(); - m_Back.Draw(); - - EndDraw(); -} - -void MenuElements::DrawBottomLayer() -{ - BeginDraw(); - - m_Background.Draw(); - - EndDraw(); -} - -bool MenuElements::IsTransitioning() +bool ScreenWithMenuElements::IsTransitioning() { return m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Back.IsTransitioning(); } -void MenuElements::StopTimer() +void ScreenWithMenuElements::StopTimer() { m_MenuTimer->Stop(); } diff --git a/stepmania/src/MenuElements.h b/stepmania/src/ScreenWithMenuElements.h similarity index 63% rename from stepmania/src/MenuElements.h rename to stepmania/src/ScreenWithMenuElements.h index dbbad62062..ef4a11bb96 100644 --- a/stepmania/src/MenuElements.h +++ b/stepmania/src/ScreenWithMenuElements.h @@ -1,14 +1,13 @@ -#ifndef MENUELEMENTS_H -#define MENUELEMENTS_H +#ifndef ScreenWithMenuElements_H +#define ScreenWithMenuElements_H /* ----------------------------------------------------------------------------- - File: MenuElements.h + Class: ScreenWithMenuElements - Desc: Displays common components of menu screens: - Background, Top Bar, Bottom Bar, help message, credits or PlayerOptions, style icon, - Menu Timer + Desc: Load one of several screens. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -22,28 +21,21 @@ class MenuTimer; class HelpDisplay; -class MenuElements : public ActorFrame + +class ScreenWithMenuElements : public Screen { public: - MenuElements(); - virtual ~MenuElements(); - - virtual void DrawPrimitives(); - - void Load( CString sClassName ); - - void DrawTopLayer(); - void DrawBottomLayer(); + ScreenWithMenuElements( CString sName ); + virtual ~ScreenWithMenuElements(); void StartTransitioning( ScreenMessage smSendWhenDone ); void Back( ScreenMessage smSendWhenDone ); - void Update( float fDeltaTime ); bool IsTransitioning(); bool m_bTimerEnabled; void StopTimer(); -public: // let owner tinker with these objects +protected: BGAnimation m_Background; AutoActor m_autoHeader; @@ -56,8 +48,6 @@ public: // let owner tinker with these objects Transition m_In; Transition m_Out; Transition m_Back; - - RageSound m_soundBack; }; -#endif +#endif \ No newline at end of file