From 18ad948dac2284dee2eb78e04ed9db039c08807e Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Fri, 20 Oct 2006 07:08:36 +0000 Subject: [PATCH] Simplify by inheriting from SWME. --- stepmania/src/ScreenNameEntry.cpp | 50 ++++++------------------------- stepmania/src/ScreenNameEntry.h | 13 ++------ 2 files changed, 11 insertions(+), 52 deletions(-) diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 670f0c422d..937568a4d7 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -27,8 +27,6 @@ // // Defines specific to ScreenNameEntry // -#define TIMER_X THEME->GetMetricF(m_sName,"TimerX") -#define TIMER_Y THEME->GetMetricF(m_sName,"TimerY") #define CATEGORY_Y THEME->GetMetricF(m_sName,"CategoryY") #define CATEGORY_ZOOM THEME->GetMetricF(m_sName,"CategoryZoom") #define CHARS_ZOOM_SMALL THEME->GetMetricF(m_sName,"CharsZoomSmall") @@ -120,7 +118,7 @@ float ScreenNameEntry::ScrollingText::GetClosestCharYOffset( float fFakeBeat ) c REGISTER_SCREEN_CLASS( ScreenNameEntry ); ScreenNameEntry::ScreenNameEntry() { -#if 0 +#if 1 // DEBUGGING STUFF GAMESTATE->m_pCurGame.Set( GAMEMAN->GetDefaultGame() ); GAMESTATE->m_pCurStyle.Set( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) ); @@ -132,7 +130,7 @@ ScreenNameEntry::ScreenNameEntry() void ScreenNameEntry::Init() { - Screen::Init(); + ScreenWithMenuElements::Init(); // update cache g_fCharsZoomSmall = CHARS_ZOOM_SMALL; @@ -158,7 +156,7 @@ void ScreenNameEntry::Init() GAMESTATE->GetRankingFeats( p, aFeats[p] ); GAMESTATE->JoinPlayer( p ); m_bStillEnteringName[p] = aFeats[p].size()>0; -#if 0 // Debugging. +#if 1 // Debugging. m_bStillEnteringName[p] = p == PLAYER_1; #endif } @@ -268,42 +266,12 @@ void ScreenNameEntry::Init() } - m_Timer.Load(); - if( !PREFSMAN->m_bMenuTimer ) - m_Timer.Disable(); - else - m_Timer.SetSeconds(TIMER_SECONDS); - m_Timer.SetXY( TIMER_X, TIMER_Y ); - this->AddChild( &m_Timer ); - - m_In.Load( THEME->GetPathB(m_sName,"in") ); - m_In.StartTransitioning(); - m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS ); - this->AddChild( &m_In ); - - m_Out.Load( THEME->GetPathB(m_sName,"out") ); - m_Out.SetDrawOrder( DRAW_ORDER_TRANSITIONS ); - this->AddChild( &m_Out ); - this->SortByDrawOrder(); m_soundStep.Load( THEME->GetPathS(m_sName,"step") ); - m_sPathToMusic = THEME->GetPathS( m_sName, "music" ); m_fFakeBeat = 0; } -void ScreenNameEntry::BeginScreen() -{ - Screen::BeginScreen(); - SOUND->PlayMusic( m_sPathToMusic ); -} - -void ScreenNameEntry::EndScreen() -{ - SOUND->StopMusic(); - Screen::EndScreen(); -} - bool ScreenNameEntry::AnyStillEntering() const { FOREACH_PlayerNumber( p ) @@ -325,14 +293,14 @@ void ScreenNameEntry::Update( float fDelta ) m_fFakeBeat += fDelta * FAKE_BEATS_PER_SEC; GAMESTATE->m_fSongBeat = m_fFakeBeat; - Screen::Update(fDelta); + ScreenWithMenuElements::Update(fDelta); } void ScreenNameEntry::Input( const InputEventPlus &input ) { LOG->Trace( "ScreenNameEntry::Input()" ); - if( m_In.IsTransitioning() || m_Out.IsTransitioning() ) + if( IsTransitioning() ) return; if( input.type != IET_FIRST_PRESS || !input.GameI.IsValid() ) @@ -352,14 +320,14 @@ void ScreenNameEntry::Input( const InputEventPlus &input ) } } - Screen::Input( input ); + ScreenWithMenuElements::Input( input ); } void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_MenuTimer ) { - if( !m_Out.IsTransitioning() ) + if( !IsTransitioning() ) { InputEventPlus iep; FOREACH_PlayerNumber( p ) @@ -370,7 +338,7 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM ) } } - Screen::HandleScreenMessage( SM ); + ScreenWithMenuElements::HandleScreenMessage( SM ); } @@ -395,7 +363,7 @@ void ScreenNameEntry::MenuStart( const InputEventPlus &input ) GAMESTATE->StoreRankingName( pn, m_sSelectedName[pn] ); if( !AnyStillEntering() && !m_Out.IsTransitioning() ) - m_Out.StartTransitioning( SM_GoToNextScreen ); + StartTransitioningScreen( SM_GoToNextScreen ); } /* diff --git a/stepmania/src/ScreenNameEntry.h b/stepmania/src/ScreenNameEntry.h index ee24745773..8a7801e2c2 100644 --- a/stepmania/src/ScreenNameEntry.h +++ b/stepmania/src/ScreenNameEntry.h @@ -3,13 +3,13 @@ #ifndef SCREEN_NAME_ENTRY_H #define SCREEN_NAME_ENTRY_H -#include "Screen.h" +#include "ScreenWithMenuElements.h" #include "BitmapText.h" #include "Transition.h" #include "ReceptorArrowRow.h" #include "MenuTimer.h" -class ScreenNameEntry : public Screen +class ScreenNameEntry : public ScreenWithMenuElements { public: ScreenNameEntry(); @@ -17,13 +17,10 @@ public: virtual ~ScreenNameEntry(); virtual void Update( float fDeltaTime ); - //virtual void DrawPrimitives(); virtual void Input( const InputEventPlus &input ); virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void MenuStart( const InputEventPlus &input ); - virtual void BeginScreen(); - virtual void EndScreen(); enum { ABS_MAX_RANKING_NAME_LENGTH = 10 }; private: @@ -52,11 +49,6 @@ private: ReceptorArrowRow m_ReceptorArrowRow[NUM_PLAYERS]; BitmapText m_textSelectedChars[NUM_PLAYERS][ABS_MAX_RANKING_NAME_LENGTH]; BitmapText m_textCategory[NUM_PLAYERS]; - MenuTimer m_Timer; - - Transition m_In; - Transition m_Out; - RageSound m_soundStep; float m_fFakeBeat; @@ -65,7 +57,6 @@ private: ScrollingText m_Text[NUM_PLAYERS]; vector m_ColToStringIndex[NUM_PLAYERS]; - RString m_sPathToMusic; }; #endif