reduce MenuTimer dependencies

This commit is contained in:
Glenn Maynard
2003-11-07 20:10:38 +00:00
parent a5f53bcd44
commit 884488732d
11 changed files with 44 additions and 26 deletions
+21 -9
View File
@@ -16,10 +16,10 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "RageLog.h"
#include "GameManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "MenuTimer.h"
#define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds")
@@ -28,6 +28,12 @@
MenuElements::MenuElements()
{
m_MenuTimer = new MenuTimer;
}
MenuElements::~MenuElements()
{
delete m_MenuTimer;
}
void MenuElements::Load( CString sClassName )
@@ -59,13 +65,13 @@ void MenuElements::Load( CString sClassName )
m_bTimerEnabled = (TIMER_SECONDS != -1);
if( m_bTimerEnabled )
{
m_MenuTimer.SetName( "Timer" );
m_MenuTimer->SetName( "Timer" );
UtilOnCommand( m_MenuTimer, "MenuElements" );
if( TIMER_SECONDS > 0 && PREFSMAN->m_bMenuTimer && !GAMESTATE->m_bEditing )
m_MenuTimer.SetSeconds( TIMER_SECONDS );
m_MenuTimer->SetSeconds( TIMER_SECONDS );
else
m_MenuTimer.Disable();
this->AddChild( &m_MenuTimer );
m_MenuTimer->Disable();
this->AddChild( m_MenuTimer );
}
m_autoFooter.Load( THEME->GetPathToG(m_sName+" footer") );
@@ -105,8 +111,8 @@ void MenuElements::StartTransitioning( ScreenMessage smSendWhenDone )
{
if( m_bTimerEnabled )
{
m_MenuTimer.SetSeconds( 0 );
m_MenuTimer.Stop();
m_MenuTimer->SetSeconds( 0 );
m_MenuTimer->Stop();
UtilOffCommand( m_MenuTimer, "MenuElements" );
}
@@ -137,7 +143,7 @@ void MenuElements::Back( ScreenMessage smSendWhenDone )
if( m_Back.IsTransitioning() )
return; // ignore
m_MenuTimer.Stop();
m_MenuTimer->Stop();
m_Back.StartTransitioning( smSendWhenDone );
m_soundBack.Play();
}
@@ -154,7 +160,7 @@ void MenuElements::DrawTopLayer()
m_autoHeader->Draw();
m_sprStyleIcon.Draw();
if( m_bTimerEnabled )
m_MenuTimer.Draw();
m_MenuTimer->Draw();
m_autoFooter->Draw();
m_textHelp.Draw();
m_In.Draw();
@@ -177,3 +183,9 @@ bool MenuElements::IsTransitioning()
{
return m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Back.IsTransitioning();
}
void MenuElements::StopTimer()
{
m_MenuTimer->Stop();
}
+6 -3
View File
@@ -14,17 +14,18 @@
#include "Screen.h"
#include "Sprite.h"
#include "MenuTimer.h"
#include "Transition.h"
#include "HelpDisplay.h"
#include "BGAnimation.h"
#include "ActorUtil.h"
#include "RageSound.h"
class MenuTimer;
class MenuElements : public ActorFrame
{
public:
MenuElements();
virtual ~MenuElements();
virtual void DrawPrimitives();
@@ -39,6 +40,8 @@ public:
bool IsTransitioning();
bool m_bTimerEnabled;
void StopTimer();
public: // let owner tinker with these objects
CString m_sName;
@@ -47,7 +50,7 @@ public: // let owner tinker with these objects
AutoActor m_autoHeader;
Sprite m_sprStyleIcon;
MenuTimer m_MenuTimer;
MenuTimer *m_MenuTimer;
AutoActor m_autoFooter;
HelpDisplay m_textHelp;
+3 -2
View File
@@ -27,6 +27,7 @@
#include "ActorUtil.h"
#include "RageTextureManager.h"
#include "AnnouncerManager.h"
#include "MenuTimer.h"
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
@@ -399,7 +400,7 @@ void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM )
void ScreenEz2SelectMusic::MenuRight( PlayerNumber pn, const InputEventType type )
{
m_Menu.m_MenuTimer.Stall();
m_Menu.m_MenuTimer->Stall();
m_MusicBannerWheel.BannersRight();
for(int i=i_SkipAheadOffset; i>0; i--)
m_MusicBannerWheel.BannersRight();
@@ -437,7 +438,7 @@ void ScreenEz2SelectMusic::TweenOffScreen()
void ScreenEz2SelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type )
{
m_Menu.m_MenuTimer.Stall();
m_Menu.m_MenuTimer->Stall();
m_MusicBannerWheel.BannersLeft();
for(int i=i_SkipAheadOffset; i>0; i--)
m_MusicBannerWheel.BannersLeft();
+4 -3
View File
@@ -21,6 +21,7 @@ Andrew Livy
#include "RageException.h"
#include "RageTimer.h"
#include "ThemeManager.h"
#include "MenuTimer.h"
/* Constants */
@@ -237,9 +238,9 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber pn )
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_Menu.m_MenuTimer->SetSeconds( 1 );
m_Menu.m_MenuTimer->Start();
m_Menu.m_MenuTimer->EnableStealth( SILENT_WAIT ); // do we wanna make the timer 'quiet' ?
}
}
-1
View File
@@ -81,7 +81,6 @@ ScreenProfileOptions::ScreenProfileOptions( CString sClassName ) : ScreenOptions
INPUTMODE_TOGETHER,
g_ProfileOptionsLines,
NUM_PROFILE_OPTIONS_LINES );
m_Menu.m_MenuTimer.Disable();
SOUND->PlayMusic( THEME->GetPathToS("ScreenMachineOptions music") );
}
+1 -1
View File
@@ -379,7 +379,7 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn )
GAMESTATE->m_pCurCharacters[p] = pChar;
}
m_Menu.m_MenuTimer.Stop();
m_Menu.StopTimer();
TweenOffScreen();
this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_TWEEN_OFF_SECONDS );
}
+1 -1
View File
@@ -140,7 +140,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.m_MenuTimer.Stop();
m_Menu.StopTimer();
break;
}
}
+1 -1
View File
@@ -166,7 +166,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.m_MenuTimer.Stop();
m_Menu.StopTimer();
break;
}
}
+2 -1
View File
@@ -26,6 +26,7 @@
#include "ActorUtil.h"
#include "GameState.h"
#include "UnlockSystem.h"
#include "MenuTimer.h"
#define BANNER_WIDTH THEME->GetMetricF("ScreenSelectGroup","BannerWidth")
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectGroup","BannerHeight")
@@ -263,7 +264,7 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn )
return;
m_soundSelect.PlayRandom();
m_Menu.m_MenuTimer.Stop();
m_Menu.m_MenuTimer->Stop();
m_bChosen = true;
GAMESTATE->m_pCurSong = NULL;
+1 -1
View File
@@ -189,7 +189,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
case SM_BeginFadingOut:
float fSecs = TweenOffScreen();
SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, fSecs ); // nofify parent that we're finished
m_Menu.m_MenuTimer.Stop();
m_Menu.StopTimer();
break;
}
}
+4 -3
View File
@@ -35,6 +35,7 @@
#include "RageTextureManager.h"
#include "Course.h"
#include "ProfileManager.h"
#include "MenuTimer.h"
const int NUM_SCORE_DIGITS = 9;
@@ -695,12 +696,12 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM )
if( m_MusicWheel.IsRouletting() )
{
MenuStart(PLAYER_INVALID);
m_Menu.m_MenuTimer.SetSeconds( 15 );
m_Menu.m_MenuTimer->SetSeconds( 15 );
}
else if( m_MusicWheel.GetSelectedType() != TYPE_SONG )
{
m_MusicWheel.StartRoulette();
m_Menu.m_MenuTimer.SetSeconds( 15 );
m_Menu.m_MenuTimer->SetSeconds( 15 );
}
else
{
@@ -961,7 +962,7 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty()
void ScreenSelectMusic::AfterMusicChange()
{
if( !m_MusicWheel.IsRouletting() )
m_Menu.m_MenuTimer.Stall();
m_Menu.m_MenuTimer->Stall();
Song* pSong = m_MusicWheel.GetSelectedSong();
if( pSong )