Fixed some subtle sync issues

This commit is contained in:
Chris Danford
2003-02-10 22:08:10 +00:00
parent d80d8a3c70
commit d7b2f341da
5 changed files with 29 additions and 7 deletions
+7
View File
@@ -421,6 +421,13 @@ void RageDisplay::Flip()
}
}
float RageDisplay::PredictedSecondsUntilNextFlip() const
{
float fps = max( 30.f, GetFPS() );
return 1.f/fps;
}
void RageDisplay::ResetStats()
{
g_iFPS = g_iVPF = 0;
+1
View File
@@ -38,6 +38,7 @@ public:
void Clear();
void Flip();
float PredictedSecondsUntilNextFlip() const;
bool IsWindowed() const;
int GetWidth() const;
int GetHeight() const;
-1
View File
@@ -372,7 +372,6 @@ void ScreenEdit::Update( float fDeltaTime )
// update the global music statistics for other classes to access
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
// GAMESTATE->m_fSongBeat = fSongBeat;
GAMESTATE->m_fCurBPS = fBPS;
GAMESTATE->m_bFreeze = bFreeze;
+18 -5
View File
@@ -722,10 +722,10 @@ bool ScreenGameplay::IsTimeToPlayTicks() const
void ScreenGameplay::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
if( GAMESTATE->m_pCurSong == NULL )
return;
/* Very important: Update GAMESTATE's song beat information
* -before- calling update on all the classes that depend on it.
* If you don't do this first, the classes are all acting on old
* information and will lag. -Chris */
// update the global music statistics for other classes to access
/* If ScreenJukebox is changing screens, it'll stop m_soundMusic to tell
@@ -735,9 +735,20 @@ void ScreenGameplay::Update( float fDeltaTime )
if(m_soundMusic.IsPlaying())
GAMESTATE->UpdateSongPosition(m_soundMusic.GetPositionSeconds());
Screen::Update( fDeltaTime );
m_MaxCombo.SetText( ssprintf("%d", m_Player[GAMESTATE->m_MasterPlayerNumber].GetPlayersMaxCombo()) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */
//LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );
if( GAMESTATE->m_pCurSong == NULL )
return;
int pn;
switch( m_DancingState )
{
@@ -847,7 +858,9 @@ void ScreenGameplay::Update( float fDeltaTime )
//
// Send crossed row messages to Player
//
int iRowNow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat );
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
int iRowNow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
if( iRowNow >= 0 && iRowNow < MAX_TAP_NOTE_ROWS )
{
for( int r=m_iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
+3 -1
View File
@@ -526,9 +526,11 @@ static void GameLoop()
TEXTUREMAN->Update( fDeltaTime );
/* Important: Process input before updaing game logic, or else game logic will lag for one frame */
HandleInputEvents( fDeltaTime );
SCREENMAN->Update( fDeltaTime );
SOUNDMAN->Update( fDeltaTime );
HandleInputEvents( fDeltaTime );
/*
* Render