From 1fb529668c5827218e047ea7fd2e9091d2f7b57a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 6 Feb 2006 06:50:10 +0000 Subject: [PATCH] autosync screen cleanup --- stepmania/src/AdjustSync.cpp | 2 +- stepmania/src/ScreenGameplaySyncMachine.cpp | 30 +++++++++++++++++++++ stepmania/src/ScreenGameplaySyncMachine.h | 8 ++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/stepmania/src/AdjustSync.cpp b/stepmania/src/AdjustSync.cpp index cd490ea991..a2140efb17 100644 --- a/stepmania/src/AdjustSync.cpp +++ b/stepmania/src/AdjustSync.cpp @@ -89,7 +89,7 @@ void AdjustSync::HandleAutosync( float fNoteOffBySeconds ) ASSERT(0); } - if( stddev < .03 && stddev < fabsf(mean) ) // If they stepped with less than .03 error + if( stddev < .03 ) // If they stepped with less than .03 error { switch( GAMESTATE->m_SongOptions.m_AutosyncType ) { diff --git a/stepmania/src/ScreenGameplaySyncMachine.cpp b/stepmania/src/ScreenGameplaySyncMachine.cpp index f441b3b96b..02b625490a 100644 --- a/stepmania/src/ScreenGameplaySyncMachine.cpp +++ b/stepmania/src/ScreenGameplaySyncMachine.cpp @@ -5,6 +5,7 @@ #include "GameManager.h" #include "PrefsManager.h" #include "AdjustSync.h" +#include "ScreenDimensions.h" REGISTER_SCREEN_CLASS( ScreenGameplaySyncMachine ); @@ -35,6 +36,22 @@ void ScreenGameplaySyncMachine::Init() GAMESTATE->m_bGameplayLeadIn.Set( false ); m_DancingState = STATE_DANCING; + + m_textSyncInfo.LoadFromFont( THEME->GetPathF("Common","normal") ); + m_textSyncInfo.SetXY( SCREEN_CENTER_X+160, SCREEN_CENTER_Y ); + m_textSyncInfo.SetDiffuse( RageColor(1,1,1,1) ); + m_textSyncInfo.SetZoom( 0.6f ); + this->AddChild( &m_textSyncInfo ); + + this->SubscribeToMessage( Message_AutosyncChanged ); + + RefreshText(); +} + +void ScreenGameplaySyncMachine::Update( float fDelta ) +{ + ScreenGameplayNormal::Update( fDelta ); + RefreshText(); } void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM ) @@ -64,6 +81,19 @@ void ScreenGameplaySyncMachine::ResetAndRestartCurrentSong() StartPlayingSong( 4, 0 ); } +void ScreenGameplaySyncMachine::RefreshText() +{ + float fNew = PREFSMAN->m_fGlobalOffsetSeconds; + float fOld = AdjustSync::s_fGlobalOffsetSecondsOriginal; + RString s; + s += ssprintf( "Old offset: %0.3f\n", fOld ); + s += ssprintf( "New offset: %0.3f\n", fNew ); + s += ssprintf( "Collecting sample: %d / %d", AdjustSync::s_iAutosyncOffsetSample+1, SAMPLE_COUNT ); + + m_textSyncInfo.SetText( s ); +} + + /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/ScreenGameplaySyncMachine.h b/stepmania/src/ScreenGameplaySyncMachine.h index 69049e6a86..5e956aa022 100644 --- a/stepmania/src/ScreenGameplaySyncMachine.h +++ b/stepmania/src/ScreenGameplaySyncMachine.h @@ -10,11 +10,19 @@ class ScreenGameplaySyncMachine : public ScreenGameplayNormal public: virtual void Init(); + virtual void Update( float fDelta ); + + virtual ScreenType GetScreenType() const { return system_menu; } + void HandleScreenMessage( const ScreenMessage SM ); void ResetAndRestartCurrentSong(); protected: + void RefreshText(); + Song m_Song; const Steps *m_pSteps; + + BitmapText m_textSyncInfo; }; #endif