move "first update" stuff into ScreenGameplay::BeginScreen

This commit is contained in:
Glenn Maynard
2006-01-18 20:45:05 +00:00
parent b8ed7366c7
commit 48e9ff0f22
2 changed files with 58 additions and 57 deletions
+57 -57
View File
@@ -806,10 +806,6 @@ void ScreenGameplay::Init()
this->SortByDrawOrder();
m_GiveUpTimer.SetZero();
// Get the transitions rolling on the first update.
// We can't do this in the constructor because ScreenGameplay is constructed
// in the middle of ScreenStage.
}
//
@@ -1470,6 +1466,63 @@ void ScreenGameplay::UpdateSongPosition( float fDeltaTime )
GAMESTATE->UpdateSongPosition( fSeconds+fAdjust, GAMESTATE->m_pCurSong->m_Timing, tm+fAdjust );
}
void ScreenGameplay::BeginScreen()
{
ScreenWithMenuElements::BeginScreen();
if( GAMESTATE->m_pCurSong == NULL )
return;
SOUND->PlayOnceFromAnnouncer( "gameplay intro" ); // crowd cheer
//
// Get the transitions rolling
//
if( GAMESTATE->m_bDemonstrationOrJukebox )
{
StartPlayingSong( 0, 0 ); // *kick* (no transitions)
}
else if( NSMAN->useSMserver )
{
//If we're using networking, we must not have any
//delay. If we do this can cause inconsistancy
//on different computers and differet themes
StartPlayingSong( 0, 0 );
m_pSoundMusic->Stop();
float startOffset = g_fNetStartOffset;
NSMAN->StartRequest(1);
RageSoundParams p;
p.m_bAccurateSync = true;
p.SetPlaybackRate( 1.0 ); //Force 1.0 playback speed
p.StopMode = RageSoundParams::M_CONTINUE;
p.m_StartSecond = startOffset;
m_pSoundMusic->Play( &p );
UpdateSongPosition(0);
}
else
{
float fMinTimeToMusic = m_In.GetLengthSeconds(); // start of m_Ready
float fMinTimeToNotes = fMinTimeToMusic + m_Ready.GetLengthSeconds() + m_Go.GetLengthSeconds()+2; // end of Go
/*
* Tell the music to start, but don't actually make any noise for
* at least 2.5 (or 1.5) seconds. (This is so we scroll on screen smoothly.)
*
* This is only a minimum: the music might be started later, to meet
* the minimum-time-to-notes value. If you're writing song data,
* and you want to make sure we get ideal timing here, make sure there's
* a bit of space at the beginning of the music with no steps.
*/
/*float delay =*/ StartPlayingSong( fMinTimeToNotes, fMinTimeToMusic );
}
}
void ScreenGameplay::Update( float fDeltaTime )
{
if( GAMESTATE->m_pCurSong == NULL )
@@ -1481,59 +1534,6 @@ void ScreenGameplay::Update( float fDeltaTime )
return;
}
if( m_bFirstUpdate )
{
SOUND->PlayOnceFromAnnouncer( "gameplay intro" ); // crowd cheer
//
// Get the transitions rolling
//
if( GAMESTATE->m_bDemonstrationOrJukebox )
{
StartPlayingSong( 0, 0 ); // *kick* (no transitions)
}
else if ( NSMAN->useSMserver )
{
//If we're using networking, we must not have any
//delay. If we do this can cause inconsistancy
//on different computers and differet themes
StartPlayingSong( 0, 0 );
m_pSoundMusic->Stop();
float startOffset = g_fNetStartOffset;
NSMAN->StartRequest(1);
RageSoundParams p;
p.m_bAccurateSync = true;
p.SetPlaybackRate( 1.0 ); //Force 1.0 playback speed
p.StopMode = RageSoundParams::M_CONTINUE;
p.m_StartSecond = startOffset;
m_pSoundMusic->Play( &p );
UpdateSongPosition(0);
}
else
{
float fMinTimeToMusic = m_In.GetLengthSeconds(); // start of m_Ready
float fMinTimeToNotes = fMinTimeToMusic + m_Ready.GetLengthSeconds() + m_Go.GetLengthSeconds()+2; // end of Go
/*
* Tell the music to start, but don't actually make any noise for
* at least 2.5 (or 1.5) seconds. (This is so we scroll on screen smoothly.)
*
* This is only a minimum: the music might be started later, to meet
* the minimum-time-to-notes value. If you're writing song data,
* and you want to make sure we get ideal timing here, make sure there's
* a bit of space at the beginning of the music with no steps.
*/
/*float delay =*/ StartPlayingSong( fMinTimeToNotes, fMinTimeToMusic );
}
}
UpdateSongPosition( fDeltaTime );
if( m_bZeroDeltaOnNextUpdate )
+1
View File
@@ -100,6 +100,7 @@ public:
ScreenGameplay();
virtual void Init();
virtual ~ScreenGameplay();
virtual void BeginScreen();
virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input );