simplify demo/jukebox setup

This commit is contained in:
Glenn Maynard
2005-01-03 23:20:11 +00:00
parent 7af6018618
commit 5de58766e9
4 changed files with 24 additions and 30 deletions
+12 -13
View File
@@ -86,16 +86,15 @@ const ScreenMessage SM_StopHereWeGo = ScreenMessage(SM_User+41);
REGISTER_SCREEN_CLASS( ScreenGameplay );
ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen(sName)
ScreenGameplay::ScreenGameplay( CString sName ) : Screen(sName)
{
m_bDemonstration = bDemonstration;
}
void ScreenGameplay::Init()
{
Screen::Init();
if( m_bDemonstration )
if( GAMESTATE->m_bDemonstrationOrJukebox )
LIGHTSMAN->SetLightsMode( LIGHTSMODE_DEMONSTRATION );
else
LIGHTSMAN->SetLightsMode( LIGHTSMODE_GAMEPLAY );
@@ -184,7 +183,7 @@ void ScreenGameplay::Init()
ASSERT( pCourse );
/* Increment the play count. */
if( !m_bDemonstration )
if( !GAMESTATE->m_bDemonstrationOrJukebox )
{
FOREACH_EnabledPlayer(p)
PROFILEMAN->IncrementCoursePlayCount( pCourse, GAMESTATE->m_pCurTrail[p], p );
@@ -306,7 +305,7 @@ void ScreenGameplay::Init()
m_sprStaticBackground.SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING ); // behind everything else
this->AddChild(&m_sprStaticBackground);
if( !m_bDemonstration ) // only load if we're going to use it
if( !GAMESTATE->m_bDemonstrationOrJukebox ) // only load if we're going to use it
{
m_Toasty.Load( THEME->GetPathB(m_sName,"toasty") );
this->AddChild( &m_Toasty );
@@ -642,7 +641,7 @@ void ScreenGameplay::Init()
m_textAutoPlay.LoadFromFont( THEME->GetPathF(m_sName,"autoplay") );
m_textAutoPlay.SetName( "AutoPlay" );
SET_XY( m_textAutoPlay );
if( !m_bDemonstration ) // only load if we're not in demonstration of jukebox
if( !GAMESTATE->m_bDemonstrationOrJukebox ) // only load if we're not in demonstration or jukebox
this->AddChild( &m_textAutoPlay );
UpdateAutoPlayText();
@@ -667,7 +666,7 @@ void ScreenGameplay::Init()
}
if( !m_bDemonstration ) // only load if we're going to use it
if( !GAMESTATE->m_bDemonstrationOrJukebox ) // only load if we're going to use it
{
m_Ready.Load( THEME->GetPathB(m_sName,"ready") );
this->AddChild( &m_Ready );
@@ -743,7 +742,7 @@ void ScreenGameplay::Init()
this->SortByDrawOrder();
if( !m_bDemonstration ) // only load if we're going to use it
if( !GAMESTATE->m_bDemonstrationOrJukebox ) // only load if we're going to use it
{
m_soundAssistTick.Load( THEME->GetPathS(m_sName,"assist tick"), true );
@@ -935,7 +934,7 @@ void ScreenGameplay::LoadNextSong()
/* Increment the play count even if the player fails. (It's still popular,
* even if the people playing it aren't good at it.) */
if( !m_bDemonstration )
if( !GAMESTATE->m_bDemonstrationOrJukebox )
PROFILEMAN->IncrementStepsPlayCount( pSong, pSteps, p );
m_textPlayerOptions[p].SetText( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString() );
@@ -948,7 +947,7 @@ void ScreenGameplay::LoadNextSong()
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && g_CurStageStats.m_player[p].bFailed ) // already failed
ShowOniGameOver(p);
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && !PREFSMAN->m_bEventMode && !m_bDemonstration)
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && !PREFSMAN->m_bEventMode && !GAMESTATE->m_bDemonstrationOrJukebox)
{
m_pLifeMeter[p]->UpdateNonstopLifebar(
GAMESTATE->GetStageIndex(),
@@ -974,7 +973,7 @@ void ScreenGameplay::LoadNextSong()
if( m_pSecondaryScoreKeeper[p] )
m_pSecondaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurSteps[p], &m_Player[p].m_NoteData );
if( m_bDemonstration )
if( GAMESTATE->m_bDemonstrationOrJukebox )
{
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PC_CPU;
GAMESTATE->m_pPlayerState[p]->m_iCpuSkill = 5;
@@ -1065,7 +1064,7 @@ void ScreenGameplay::LoadNextSong()
{
/* BeginnerHelper disabled/failed to load. */
m_Background.LoadFromSong( GAMESTATE->m_pCurSong );
if( !m_bDemonstration )
if( !GAMESTATE->m_bDemonstrationOrJukebox )
{
/* This will fade from a preset brightness to the actual brightness (based
* on prefs and "cover"). The preset brightness may be 0 (to fade from
@@ -1254,7 +1253,7 @@ void ScreenGameplay::Update( float fDeltaTime )
//
// Get the transitions rolling
//
if( m_bDemonstration )
if( GAMESTATE->m_bDemonstrationOrJukebox )
{
StartPlayingSong( 0, 0 ); // *kick* (no transitions)
}
+1 -2
View File
@@ -55,7 +55,7 @@ class LyricsLoader;
class ScreenGameplay : public Screen
{
public:
ScreenGameplay( CString sName, bool bDemonstration = false );
ScreenGameplay( CString sName );
virtual void Init();
virtual ~ScreenGameplay();
@@ -177,7 +177,6 @@ protected:
RageSound m_soundBattleTrickLevel3;
bool m_bZeroDeltaOnNextUpdate;
bool m_bDemonstration;
RageSound m_soundAssistTick;
RageSound *m_pSoundMusic;
+9 -12
View File
@@ -107,13 +107,19 @@ bool ScreenJukebox::SetSong( bool bDemonstration )
return false;
}
bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return true.
ScreenJukebox::ScreenJukebox( CString sName ) : ScreenGameplay( "ScreenGameplay" )
{
LOG->Trace( "ScreenJukebox::ScreenJukebox()" );
m_bDemonstration = false;
}
void ScreenJukebox::Init()
{
// ScreeJukeboxMenu must set this
ASSERT( GAMESTATE->m_pCurStyle );
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
SetSong( bDemonstration );
SetSong( m_bDemonstration );
// ASSERT( GAMESTATE->m_pCurSong );
@@ -161,16 +167,7 @@ bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return t
GAMESTATE->m_bDemonstrationOrJukebox = true;
return true;
}
ScreenJukebox::ScreenJukebox( CString sName, bool bDemonstration ) : ScreenGameplay( "ScreenGameplay", PrepareForJukebox(bDemonstration) ) // this is a hack to get some code to execute before the ScreenGameplay constructor
{
LOG->Trace( "ScreenJukebox::ScreenJukebox()" );
}
void ScreenJukebox::Init()
{
/* Now that we've set up, init the base class. */
ScreenGameplay::Init();
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
+2 -3
View File
@@ -10,7 +10,7 @@
class ScreenJukebox : public ScreenGameplay
{
public:
ScreenJukebox( CString sName, bool bDemonstration = false );
ScreenJukebox( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
@@ -20,10 +20,9 @@ public:
static bool SetSong( bool bDemonstration );
protected:
bool m_bDemonstration;
Transition m_In;
Transition m_Out;
static bool PrepareForJukebox( bool bDemonstration );
};
#endif