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:
@@ -8,7 +8,7 @@
|
||||
#include "RageLog.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
|
||||
* 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 );
|
||||
break;
|
||||
|
||||
case CLOCK_BGM:
|
||||
case CLOCK_BGM_BEAT:
|
||||
m_fSecsIntoEffect = g_fCurrentBGMBeat;
|
||||
break;
|
||||
|
||||
case CLOCK_BGM_TIME:
|
||||
m_fSecsIntoEffect = g_fCurrentBGMTime;
|
||||
break;
|
||||
}
|
||||
@@ -458,7 +462,9 @@ void Actor::SetEffectClock( CString s )
|
||||
{
|
||||
s.MakeLower();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@ public:
|
||||
virtual ~Actor() {}
|
||||
virtual void Reset();
|
||||
|
||||
static void SetBGMTime( float fTime ) { g_fCurrentBGMTime = fTime; }
|
||||
static float GetBGMTime() { return g_fCurrentBGMTime; }
|
||||
static void SetBGMTime( float fTime, float fBeat ) { g_fCurrentBGMTime = fTime; g_fCurrentBGMBeat = fBeat; }
|
||||
|
||||
enum TweenType {
|
||||
TWEEN_LINEAR,
|
||||
@@ -56,7 +55,7 @@ public:
|
||||
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
|
||||
virtual bool EarlyAbortDraw() { return false; } // return true to early abort drawing of this Actor
|
||||
@@ -395,8 +394,8 @@ protected:
|
||||
|
||||
//
|
||||
// global state
|
||||
///
|
||||
static float g_fCurrentBGMTime;
|
||||
//
|
||||
static float g_fCurrentBGMTime, g_fCurrentBGMBeat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -496,7 +496,7 @@ void GameState::ResetMusicStatistics()
|
||||
m_fCurBPS = 10;
|
||||
m_bFreeze = false;
|
||||
m_bPastHereWeGo = false;
|
||||
Actor::SetBGMTime( 0 );
|
||||
Actor::SetBGMTime( 0, 0 );
|
||||
}
|
||||
|
||||
void GameState::ResetStageStatistics()
|
||||
@@ -552,7 +552,7 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user