From d99e7b5c5b80a6358b369455642fea82b3ca2c8e Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 15 May 2011 00:57:35 -0400 Subject: [PATCH] [splittiming] Re-establish Actor code. --- src/Actor.cpp | 21 +++++++++++++++++++-- src/Actor.h | 6 ++++++ src/GameState.cpp | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index 72a3ee3856..3191d98d56 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -34,6 +34,8 @@ REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor ); float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0; +vector Actor::g_vfCurrentBGMBeatPlayer(NUM_PlayerNumber, 0); +vector Actor::g_vfCurrentBGMBeatPlayerNoOffset(NUM_PlayerNumber, 0); Actor *Actor::Copy() const { return new Actor(*this); } @@ -68,6 +70,12 @@ void Actor::SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBe g_fCurrentBGMBeatNoOffset = fBeatNoOffset; } +void Actor::SetPlayerBGMBeat( PlayerNumber pn, float fBeat, float fBeatNoOffset ) +{ + g_vfCurrentBGMBeatPlayer[pn] = fBeat; + g_vfCurrentBGMBeatPlayerNoOffset[pn] = fBeatNoOffset; +} + void Actor::SetBGMLight( int iLightNumber, float fCabinetLights ) { ASSERT( iLightNumber < NUM_CabinetLight ); @@ -150,8 +158,7 @@ Actor::Actor() lua_setfield( L, -2, "ctx" ); lua_pop( L, 1 ); LUA->Release( L ); - - + m_size = RageVector2( 1, 1 ); InitState(); m_pParent = NULL; @@ -676,6 +683,16 @@ void Actor::UpdateInternal( float fDeltaTime ) m_fSecsIntoEffect = g_fCurrentBGMBeat; break; + case CLOCK_BGM_BEAT_PLAYER1: + m_fEffectDelta = g_vfCurrentBGMBeatPlayer[PLAYER_1] - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_vfCurrentBGMBeatPlayerNoOffset[PLAYER_1]; + break; + + case CLOCK_BGM_BEAT_PLAYER2: + m_fEffectDelta = g_vfCurrentBGMBeatPlayer[PLAYER_2] - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_vfCurrentBGMBeatPlayerNoOffset[PLAYER_2]; + break; + case CLOCK_BGM_TIME: m_fEffectDelta = g_fCurrentBGMTime - m_fSecsIntoEffect; m_fSecsIntoEffect = g_fCurrentBGMTime; diff --git a/src/Actor.h b/src/Actor.h index 45d080dabe..919d4994f7 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -1,6 +1,7 @@ #ifndef ACTOR_H #define ACTOR_H +#include "PlayerNumber.h" #include "RageTypes.h" #include "RageUtil_AutoPtr.h" #include "LuaReference.h" @@ -109,6 +110,7 @@ public: virtual void LoadFromNode( const XNode* pNode ); static void SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBeatNoOffset ); + static void SetPlayerBGMBeat( PlayerNumber pn, float fBeat, float fBeatNoOffset ); static void SetBGMLight( int iLightNumber, float fCabinetLights ); /** @@ -131,6 +133,8 @@ public: CLOCK_BGM_BEAT, CLOCK_BGM_TIME_NO_OFFSET, CLOCK_BGM_BEAT_NO_OFFSET, + CLOCK_BGM_BEAT_PLAYER1, + CLOCK_BGM_BEAT_PLAYER2, CLOCK_LIGHT_1 = 1000, CLOCK_LIGHT_LAST = 1100, NUM_CLOCKS @@ -713,6 +717,8 @@ protected: // global state static float g_fCurrentBGMTime, g_fCurrentBGMBeat; static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset; + static vector g_vfCurrentBGMBeatPlayer; + static vector g_vfCurrentBGMBeatPlayerNoOffset; private: // commands diff --git a/src/GameState.cpp b/src/GameState.cpp index abb3c63552..8205d4143f 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -953,7 +953,7 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti if( m_pCurSteps[pn] ) { m_pPlayerState[pn]->m_Position.UpdateSongPosition( fPositionSeconds, m_pCurSteps[pn]->m_Timing, timestamp ); - // Actor::SetPlayerBGMBeat( pn, m_pPlayerState[pn]->m_Position.m_fSongBeatVisible, m_pPlayerState[pn]->m_Position.m_fSongBeatNoOffset ); + Actor::SetPlayerBGMBeat( pn, m_pPlayerState[pn]->m_Position.m_fSongBeatVisible, m_pPlayerState[pn]->m_Position.m_fSongBeatNoOffset ); } } }