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