"haste" mod

This commit is contained in:
Glenn Maynard
2006-11-30 08:22:30 +00:00
parent 0bfa90b5be
commit ed07cf213a
3 changed files with 47 additions and 0 deletions
+29
View File
@@ -1588,6 +1588,35 @@ void ScreenGameplay::Update( float fDeltaTime )
}
}
if( GAMESTATE->m_SongOptions.GetCurrent().m_fHaste != 0.0f )
{
float fLife = 0;
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
if( !GAMESTATE->IsHumanPlayer(pi->m_pn) )
continue;
fLife = max( fLife, pi->m_pLifeMeter->GetLife() );
}
/* Scale the music nonlinearly. Only slow the song down below 0.25, so we
* don't drag the music out too long. Stick at 1x up to 0.5, so we start
* at 1x if the life meter defaults to 0.5. Increase gradually up to 0.9.
* Accelerate sharply above 0.9. */
float fSpeed = 1.0f;
if( fLife < 0.25f )
fSpeed = SCALE( fLife, 0.0f, 0.25f, 0.5f, 1.0f );
else if( fLife > 0.5f && fLife < 0.9f )
fSpeed = SCALE( fLife, 0.5f, 0.9f, 1.0f, 1.25f );
else if( fLife >= 0.9f )
fSpeed = SCALE( fLife, 0.9f, 1.0f, 1.25f, 2.5f );
fSpeed *= GAMESTATE->m_SongOptions.GetCurrent().m_fHaste;
fSpeed *= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
RageSoundParams p = m_pSoundMusic->GetParams();
p.m_fSpeed = fSpeed;
m_pSoundMusic->SetParams( p );
}
switch( m_DancingState )
{