Fixed some subtle sync issues
This commit is contained in:
@@ -421,6 +421,13 @@ void RageDisplay::Flip()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float RageDisplay::PredictedSecondsUntilNextFlip() const
|
||||||
|
{
|
||||||
|
float fps = max( 30.f, GetFPS() );
|
||||||
|
return 1.f/fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RageDisplay::ResetStats()
|
void RageDisplay::ResetStats()
|
||||||
{
|
{
|
||||||
g_iFPS = g_iVPF = 0;
|
g_iFPS = g_iVPF = 0;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void Flip();
|
void Flip();
|
||||||
|
float PredictedSecondsUntilNextFlip() const;
|
||||||
bool IsWindowed() const;
|
bool IsWindowed() const;
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
|
|||||||
@@ -372,7 +372,6 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
|
|
||||||
// update the global music statistics for other classes to access
|
// update the global music statistics for other classes to access
|
||||||
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
|
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
|
||||||
// GAMESTATE->m_fSongBeat = fSongBeat;
|
|
||||||
GAMESTATE->m_fCurBPS = fBPS;
|
GAMESTATE->m_fCurBPS = fBPS;
|
||||||
GAMESTATE->m_bFreeze = bFreeze;
|
GAMESTATE->m_bFreeze = bFreeze;
|
||||||
|
|
||||||
|
|||||||
@@ -722,10 +722,10 @@ bool ScreenGameplay::IsTimeToPlayTicks() const
|
|||||||
|
|
||||||
void ScreenGameplay::Update( float fDeltaTime )
|
void ScreenGameplay::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Screen::Update( fDeltaTime );
|
/* Very important: Update GAMESTATE's song beat information
|
||||||
|
* -before- calling update on all the classes that depend on it.
|
||||||
if( GAMESTATE->m_pCurSong == NULL )
|
* If you don't do this first, the classes are all acting on old
|
||||||
return;
|
* information and will lag. -Chris */
|
||||||
|
|
||||||
// update the global music statistics for other classes to access
|
// update the global music statistics for other classes to access
|
||||||
/* If ScreenJukebox is changing screens, it'll stop m_soundMusic to tell
|
/* 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())
|
if(m_soundMusic.IsPlaying())
|
||||||
GAMESTATE->UpdateSongPosition(m_soundMusic.GetPositionSeconds());
|
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! */
|
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() );
|
//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;
|
int pn;
|
||||||
switch( m_DancingState )
|
switch( m_DancingState )
|
||||||
{
|
{
|
||||||
@@ -847,7 +858,9 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// Send crossed row messages to Player
|
// 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 )
|
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
|
for( int r=m_iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
|
||||||
|
|||||||
@@ -526,9 +526,11 @@ static void GameLoop()
|
|||||||
|
|
||||||
TEXTUREMAN->Update( fDeltaTime );
|
TEXTUREMAN->Update( fDeltaTime );
|
||||||
|
|
||||||
|
/* Important: Process input before updaing game logic, or else game logic will lag for one frame */
|
||||||
|
HandleInputEvents( fDeltaTime );
|
||||||
|
|
||||||
SCREENMAN->Update( fDeltaTime );
|
SCREENMAN->Update( fDeltaTime );
|
||||||
SOUNDMAN->Update( fDeltaTime );
|
SOUNDMAN->Update( fDeltaTime );
|
||||||
HandleInputEvents( fDeltaTime );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Render
|
* Render
|
||||||
|
|||||||
Reference in New Issue
Block a user