fix Actor depending on GAMESTATE
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "arch/Dialog/Dialog.h"
|
#include "arch/Dialog/Dialog.h"
|
||||||
|
|
||||||
#include "GameState.h" /* XXX: ugly dependency */
|
static float g_fCurrentBGMTime = 0;
|
||||||
|
|
||||||
/* 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. */
|
||||||
@@ -59,6 +59,11 @@ Actor::Actor()
|
|||||||
m_bFirstUpdate = true;
|
m_bFirstUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::SetBGMTime( float fTime )
|
||||||
|
{
|
||||||
|
g_fCurrentBGMTime = fTime;
|
||||||
|
}
|
||||||
|
|
||||||
void Actor::Draw()
|
void Actor::Draw()
|
||||||
{
|
{
|
||||||
if( m_bHidden )
|
if( m_bHidden )
|
||||||
@@ -324,7 +329,7 @@ void Actor::Update( float fDeltaTime )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_BGM:
|
case CLOCK_BGM:
|
||||||
m_fSecsIntoEffect = GAMESTATE->m_fSongBeat;
|
m_fSecsIntoEffect = g_fCurrentBGMTime;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public:
|
|||||||
virtual ~Actor() {}
|
virtual ~Actor() {}
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
|
static void SetBGMTime( float fTime );
|
||||||
|
|
||||||
enum TweenType {
|
enum TweenType {
|
||||||
TWEEN_LINEAR,
|
TWEEN_LINEAR,
|
||||||
TWEEN_ACCELERATE,
|
TWEEN_ACCELERATE,
|
||||||
@@ -53,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 };
|
enum EffectClock { CLOCK_TIMER, CLOCK_BGM, 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
|
||||||
|
|||||||
@@ -499,6 +499,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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::ResetStageStatistics()
|
void GameState::ResetStageStatistics()
|
||||||
@@ -555,6 +556,9 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti
|
|||||||
ASSERT_M( m_fSongBeat > -2000, ssprintf("%f %f", m_fSongBeat, fPositionSeconds) );
|
ASSERT_M( m_fSongBeat > -2000, ssprintf("%f %f", m_fSongBeat, fPositionSeconds) );
|
||||||
|
|
||||||
m_fMusicSeconds = fPositionSeconds;
|
m_fMusicSeconds = fPositionSeconds;
|
||||||
|
|
||||||
|
Actor::SetBGMTime( 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user