pull stuff out from GameState

This commit is contained in:
Glenn Maynard
2005-07-12 03:49:19 +00:00
parent 8256cf3b4c
commit 13e1d04d24
2 changed files with 42 additions and 41 deletions
-41
View File
@@ -560,47 +560,6 @@ void GameState::Update( float fDelta )
{
m_pPlayerState[p]->Update( fDelta );
// TRICKY: GAMESTATE->Update is run before any of the Screen update's,
// so we'll clear these flags here and let them get turned on later
m_pPlayerState[p]->m_bAttackBeganThisUpdate = false;
m_pPlayerState[p]->m_bAttackEndedThisUpdate = false;
bool bRebuildPlayerOptions = false;
/* See if any delayed attacks are starting or ending. */
for( unsigned s=0; s<m_pPlayerState[p]->m_ActiveAttacks.size(); s++ )
{
Attack &attack = m_pPlayerState[p]->m_ActiveAttacks[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 );
bool bCurrentlyEnabled =
attack.bGlobal ||
( attack.fStartSecond < this->m_fMusicSeconds &&
m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining );
if( m_pPlayerState[p]->m_ActiveAttacks[s].bOn == bCurrentlyEnabled )
continue; /* OK */
if( m_pPlayerState[p]->m_ActiveAttacks[s].bOn && !bCurrentlyEnabled )
m_pPlayerState[p]->m_bAttackEndedThisUpdate = true;
else if( !m_pPlayerState[p]->m_ActiveAttacks[s].bOn && bCurrentlyEnabled )
m_pPlayerState[p]->m_bAttackBeganThisUpdate = true;
bRebuildPlayerOptions = true;
m_pPlayerState[p]->m_ActiveAttacks[s].bOn = bCurrentlyEnabled;
}
if( bRebuildPlayerOptions )
m_pPlayerState[p]->RebuildPlayerOptionsFromActiveAttacks();
if( m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut > 0 )
m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = max( 0, m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut - fDelta );
if( !m_bGoalComplete[p] && IsGoalComplete(p) )
{
m_bGoalComplete[p] = true;