fix "course attacks that start at 0 never turn off"

This commit is contained in:
Chris Danford
2004-03-21 18:27:25 +00:00
parent c18f114161
commit ee6e113d13
2 changed files with 15 additions and 11 deletions
+8 -3
View File
@@ -340,10 +340,15 @@ void GameState::Update( float fDelta )
for( unsigned s=0; s<m_ActiveAttacks[p].size(); s++ )
{
Attack &attack = m_ActiveAttacks[p][s];
// -1 is the "starts now" sentinel value. You must add the attack
// by calling GameState::LaunchAttack, or else the -1 won't be
// converted into the current music time.
ASSERT( attack.fStartSecond != -1 );
const bool bCurrentlyEnabled =
attack.fStartSecond == -1 ||
(attack.fStartSecond < this->m_fMusicSeconds &&
m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining);
attack.fStartSecond < this->m_fMusicSeconds &&
m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining;
if( m_ActiveAttacks[p][s].bOn == bCurrentlyEnabled )
continue; /* OK */
+7 -8
View File
@@ -787,16 +787,15 @@ void ScreenGameplay::SetupSong( int p, int iSongIndex )
GAMESTATE->m_ModsToApply[p].clear();
for( unsigned i=0; i<m_asModifiersQueue[p][iSongIndex].size(); ++i )
{
GAMESTATE->LaunchAttack( (PlayerNumber)p, m_asModifiersQueue[p][iSongIndex][i] );
GAMESTATE->m_SongOptions.FromString( m_asModifiersQueue[p][iSongIndex][i].sModifier );
/* Hack: Course modifiers that are set to start immediately shouldn't tween on. */
Attack a = m_asModifiersQueue[p][iSongIndex][i];
if( a.fStartSecond == 0 )
a.fStartSecond = -1; // now
GAMESTATE->LaunchAttack( (PlayerNumber)p, a );
GAMESTATE->m_SongOptions.FromString( a.sModifier );
}
/* Hack: Course modifiers that are set to start immediately shouldn't tween on. */
for( unsigned s=0; s<GAMESTATE->m_ActiveAttacks[p].size(); s++ )
{
if( GAMESTATE->m_ActiveAttacks[p][s].fStartSecond == 0 )
GAMESTATE->m_ActiveAttacks[p][s].fStartSecond = -1;
}
/* Update attack bOn flags. */
GAMESTATE->Update(0);
GAMESTATE->RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)p );