Add bgm-time effect mode. This is roughly equivalent to the default, except

it's tightly synced with the music; it stays synced over music skips, and follows
the music rate, like everything else that uses GAMESTATE->m_fMusicSeconds.
This commit is contained in:
Glenn Maynard
2004-10-16 01:29:25 +00:00
parent e1ae2d4f4b
commit 799a5898dd
3 changed files with 15 additions and 10 deletions
+9 -3
View File
@@ -8,7 +8,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "arch/Dialog/Dialog.h" #include "arch/Dialog/Dialog.h"
float Actor::g_fCurrentBGMTime = 0; float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat;
/* This is Reset instead of Init since many derived classes have Init() functions /* This is Reset instead of Init since many derived classes have Init() functions
* that shouldn't change the position of the actor. */ * that shouldn't change the position of the actor. */
@@ -326,7 +326,11 @@ void Actor::Update( float fDeltaTime )
m_fSecsIntoEffect = fmodfp( m_fSecsIntoEffect, m_fEffectPeriodSeconds + m_fEffectDelay ); m_fSecsIntoEffect = fmodfp( m_fSecsIntoEffect, m_fEffectPeriodSeconds + m_fEffectDelay );
break; break;
case CLOCK_BGM: case CLOCK_BGM_BEAT:
m_fSecsIntoEffect = g_fCurrentBGMBeat;
break;
case CLOCK_BGM_TIME:
m_fSecsIntoEffect = g_fCurrentBGMTime; m_fSecsIntoEffect = g_fCurrentBGMTime;
break; break;
} }
@@ -458,7 +462,9 @@ void Actor::SetEffectClock( CString s )
{ {
s.MakeLower(); s.MakeLower();
if (s=="timer") SetEffectClock( CLOCK_TIMER ); if (s=="timer") SetEffectClock( CLOCK_TIMER );
else if(s=="bgm") SetEffectClock( CLOCK_BGM ); else if(s=="beat") SetEffectClock( CLOCK_BGM_BEAT );
else if(s=="music") SetEffectClock( CLOCK_BGM_TIME );
else if(s=="bgm") SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated
else ASSERT(0); else ASSERT(0);
} }
+4 -5
View File
@@ -18,8 +18,7 @@ public:
virtual ~Actor() {} virtual ~Actor() {}
virtual void Reset(); virtual void Reset();
static void SetBGMTime( float fTime ) { g_fCurrentBGMTime = fTime; } static void SetBGMTime( float fTime, float fBeat ) { g_fCurrentBGMTime = fTime; g_fCurrentBGMBeat = fBeat; }
static float GetBGMTime() { return g_fCurrentBGMTime; }
enum TweenType { enum TweenType {
TWEEN_LINEAR, TWEEN_LINEAR,
@@ -56,7 +55,7 @@ public:
static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ); static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween );
}; };
enum EffectClock { CLOCK_TIMER, CLOCK_BGM, NUM_CLOCKS }; enum EffectClock { CLOCK_TIMER, CLOCK_BGM_TIME, CLOCK_BGM_BEAT, NUM_CLOCKS };
void Draw(); // calls, NeedsDraw, BeginDraw, DrawPrimitives, EndDraw void Draw(); // calls, NeedsDraw, BeginDraw, DrawPrimitives, EndDraw
virtual bool EarlyAbortDraw() { return false; } // return true to early abort drawing of this Actor virtual bool EarlyAbortDraw() { return false; } // return true to early abort drawing of this Actor
@@ -395,8 +394,8 @@ protected:
// //
// global state // global state
/// //
static float g_fCurrentBGMTime; static float g_fCurrentBGMTime, g_fCurrentBGMBeat;
}; };
#endif #endif
+2 -2
View File
@@ -496,7 +496,7 @@ void GameState::ResetMusicStatistics()
m_fCurBPS = 10; m_fCurBPS = 10;
m_bFreeze = false; m_bFreeze = false;
m_bPastHereWeGo = false; m_bPastHereWeGo = false;
Actor::SetBGMTime( 0 ); Actor::SetBGMTime( 0, 0 );
} }
void GameState::ResetStageStatistics() void GameState::ResetStageStatistics()
@@ -552,7 +552,7 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti
m_fMusicSeconds = fPositionSeconds; m_fMusicSeconds = fPositionSeconds;
Actor::SetBGMTime( m_fSongBeat ); Actor::SetBGMTime( fPositionSeconds, m_fSongBeat );
// LOG->Trace( "m_fMusicSeconds = %f, m_fSongBeat = %f, m_fCurBPS = %f, m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze ); // LOG->Trace( "m_fMusicSeconds = %f, m_fSongBeat = %f, m_fCurBPS = %f, m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze );
} }