[splittiming] ArrowEffects, BPMDisplay, Inventory, MeterDisplay
This commit is contained in:
+17
-13
@@ -67,13 +67,13 @@ static float GetNoteFieldHeight( const PlayerState* pPlayerState )
|
||||
|
||||
namespace
|
||||
{
|
||||
float g_fExpandSeconds = 0;
|
||||
struct PerPlayerData
|
||||
{
|
||||
float m_fMinTornadoX[MAX_COLS_PER_PLAYER];
|
||||
float m_fMaxTornadoX[MAX_COLS_PER_PLAYER];
|
||||
float m_fInvertDistance[MAX_COLS_PER_PLAYER];
|
||||
float m_fBeatFactor;
|
||||
float m_fExpandSeconds;
|
||||
};
|
||||
PerPlayerData g_EffectData[NUM_PLAYERS];
|
||||
};
|
||||
@@ -82,22 +82,23 @@ void ArrowEffects::Update()
|
||||
{
|
||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||
|
||||
{
|
||||
static float fLastTime = 0;
|
||||
float fTime = RageTimer::GetTimeSinceStartFast();
|
||||
if( !GAMESTATE->m_bFreeze || !GAMESTATE->m_bDelay )
|
||||
{
|
||||
g_fExpandSeconds += fTime - fLastTime;
|
||||
g_fExpandSeconds = fmodf( g_fExpandSeconds, PI*2 );
|
||||
}
|
||||
fLastTime = fTime;
|
||||
}
|
||||
|
||||
FOREACH_PlayerNumber( pn )
|
||||
{
|
||||
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn];
|
||||
|
||||
PerPlayerData &data = g_EffectData[pn];
|
||||
|
||||
{
|
||||
static float fLastTime = 0;
|
||||
float fTime = RageTimer::GetTimeSinceStartFast();
|
||||
if( !GAMESTATE->m_pPlayerState[pn]->m_Position.m_bFreeze || !GAMESTATE->m_pPlayerState[pn]->m_Position.m_bDelay )
|
||||
{
|
||||
data.m_fExpandSeconds += fTime - fLastTime;
|
||||
data.m_fExpandSeconds = fmodf( data.m_fExpandSeconds, PI*2 );
|
||||
}
|
||||
fLastTime = fTime;
|
||||
}
|
||||
|
||||
// Update Tornado
|
||||
for( int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum )
|
||||
{
|
||||
@@ -307,7 +308,10 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float
|
||||
|
||||
if( fAccels[PlayerOptions::ACCEL_EXPAND] != 0 )
|
||||
{
|
||||
float fExpandMultiplier = SCALE( RageFastCos(g_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY),
|
||||
// TODO: Don't index by PlayerNumber.
|
||||
PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber];
|
||||
|
||||
float fExpandMultiplier = SCALE( RageFastCos(data.m_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY),
|
||||
EXPAND_MULTIPLIER_SCALE_FROM_LOW, EXPAND_MULTIPLIER_SCALE_FROM_HIGH,
|
||||
EXPAND_MULTIPLIER_SCALE_TO_LOW, EXPAND_MULTIPLIER_SCALE_TO_HIGH );
|
||||
fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND],
|
||||
|
||||
+1
-1
@@ -276,7 +276,7 @@ SongBPMDisplay::SongBPMDisplay()
|
||||
|
||||
void SongBPMDisplay::Update( float fDeltaTime )
|
||||
{
|
||||
float fGameStateBPM = GAMESTATE->m_fCurBPS * 60.0f;
|
||||
float fGameStateBPM = GAMESTATE->m_Position.m_fCurBPS * 60.0f;
|
||||
if( m_fLastGameStateBPM != fGameStateBPM )
|
||||
{
|
||||
m_fLastGameStateBPM = fGameStateBPM;
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ void Inventory::Update( float fDelta )
|
||||
|
||||
// use items if this player is CPU-controlled
|
||||
if( m_pPlayerState->m_PlayerController != PC_HUMAN &&
|
||||
GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
|
||||
GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
|
||||
{
|
||||
// every 1 seconds, try to use an item
|
||||
int iLastSecond = (int)(RageTimer::GetTimeSinceStartFast() - fDelta);
|
||||
|
||||
@@ -75,7 +75,7 @@ void SongMeterDisplay::Update( float fDeltaTime )
|
||||
{
|
||||
float fSongStartSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fFirstBeat );
|
||||
float fSongEndSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fLastBeat );
|
||||
float fPercentPositionSong = SCALE( GAMESTATE->m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f );
|
||||
float fPercentPositionSong = SCALE( GAMESTATE->m_Position.m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f );
|
||||
CLAMP( fPercentPositionSong, 0, 1 );
|
||||
|
||||
SetPercent( fPercentPositionSong );
|
||||
|
||||
Reference in New Issue
Block a user