From 745a2141cb890e89a76de5e87fdab82212cdd2f8 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 1 Apr 2005 08:34:23 +0000 Subject: [PATCH] update textInfo max once every 0.5 secs --- stepmania/src/ScreenEdit.cpp | 31 ++++++++++++++++++++++--------- stepmania/src/ScreenEdit.h | 5 ++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 840a727311..770b8009b3 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -48,6 +48,7 @@ const float RECORD_HOLD_SECONDS = 0.3f; #define PLAY_RECORD_HELP_TEXT THEME->GetMetric(m_sName,"PlayRecordHelpText") +AutoScreenMessage( SM_UpdateTextInfo ) AutoScreenMessage( SM_BackFromMainMenu ) AutoScreenMessage( SM_BackFromAreaMenu ) AutoScreenMessage( SM_BackFromStepsInformation ) @@ -59,7 +60,6 @@ AutoScreenMessage( SM_BackFromInsertAttackPlayerOptions ) AutoScreenMessage( SM_BackFromPrefs ) AutoScreenMessage( SM_BackFromCourseModeMenu ) AutoScreenMessage( SM_DoRevertToLastSave ) - AutoScreenMessage( SM_BackFromBPMChange ) AutoScreenMessage( SM_BackFromStopChange ) AutoScreenMessage( SM_DoSaveAndExit ) @@ -596,6 +596,9 @@ void ScreenEdit::Init() m_soundMusic.Load( m_pSong->GetMusicPath() ); m_soundAssistTick.Load( THEME->GetPathS("ScreenEdit","assist tick"), true ); + + this->HandleScreenMessage( SM_UpdateTextInfo ); + m_bTextInfoNeedsUpdate = true; } ScreenEdit::~ScreenEdit() @@ -725,6 +728,15 @@ void ScreenEdit::UpdateTextInfo() if( m_pSteps == NULL ) return; + // Don't update the text during playback or record. It causes skips. + if( m_EditMode != MODE_EDITING ) + return; + + if( !m_bTextInfoNeedsUpdate ) + return; + + m_bTextInfoNeedsUpdate = false; + int iNumTaps = m_NoteDataEdit.GetNumTapNotes(); int iNumJumps = m_NoteDataEdit.GetNumJumps(); int iNumHands = m_NoteDataEdit.GetNumHands(); @@ -787,9 +799,7 @@ void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, c { case MODE_EDITING: InputEdit( di, type, GameI, MenuI, StyleI, EditB ); - /* Make sure the displayed time is up-to-date after possibly changing something, - * so it doesn't feel lagged. */ - UpdateTextInfo(); + m_bTextInfoNeedsUpdate = true; break; case MODE_RECORDING: InputRecord( di, type, GameI, MenuI, StyleI, EditB ); @@ -1503,12 +1513,15 @@ void ScreenEdit::TransitionEditMode( EditMode em ) void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) { - // There are lots of different messages that signal information changed. - // Rather than picking out those specific messages, just UpdateTextInfo - // on all messages. - UpdateTextInfo(); + if( SM != SM_UpdateTextInfo ) + m_bTextInfoNeedsUpdate = true; - if( SM == SM_GoToNextScreen ) + if( SM == SM_UpdateTextInfo ) + { + UpdateTextInfo(); + this->PostScreenMessage( SM_UpdateTextInfo, 0.5f ); + } + else if( SM == SM_GoToNextScreen ) { SCREENMAN->SetNewScreen( PREV_SCREEN ); GAMESTATE->m_bEditing = false; diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 2a62cff327..daaf957b48 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -142,7 +142,6 @@ protected: void TransitionEditMode( EditMode em ); void PlayTicks(); void PlayPreviewMusic(); - void UpdateTextInfo(); // Call this before modifying m_NoteDataEdit. void SaveUndo(); @@ -169,7 +168,11 @@ protected: SnapDisplay m_SnapDisplay; BitmapText m_textInputTips; + + void UpdateTextInfo(); BitmapText m_textInfo; // status information that changes + bool m_bTextInfoNeedsUpdate; + BitmapText m_textPlayRecordHelp; // keep track of where we are and what we're doing