m_HealthState is confusing; it's updated from other stats, and then the
original stats as well as m_HealthState are used for control logic. Simplify; remove AllAreFailing, and figure it out directly.
This commit is contained in:
@@ -1556,14 +1556,6 @@ bool GameState::AllAreInDangerOrWorse() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::AllAreDead() const
|
|
||||||
{
|
|
||||||
FOREACH_EnabledPlayer( p )
|
|
||||||
if( m_pPlayerState[p]->m_HealthState < PlayerState::DEAD )
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GameState::AllHumanHaveComboOf30OrMoreMisses() const
|
bool GameState::AllHumanHaveComboOf30OrMoreMisses() const
|
||||||
{
|
{
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ public:
|
|||||||
bool IsPlayerInDanger( const PlayerState *pPlayerState ) const;
|
bool IsPlayerInDanger( const PlayerState *pPlayerState ) const;
|
||||||
bool IsPlayerDead( const PlayerState *pPlayerState ) const;
|
bool IsPlayerDead( const PlayerState *pPlayerState ) const;
|
||||||
bool AllAreInDangerOrWorse() const;
|
bool AllAreInDangerOrWorse() const;
|
||||||
bool AllAreDead() const;
|
|
||||||
bool AllHumanHaveComboOf30OrMoreMisses() const;
|
bool AllHumanHaveComboOf30OrMoreMisses() const;
|
||||||
bool OneIsHot() const;
|
bool OneIsHot() const;
|
||||||
|
|
||||||
|
|||||||
@@ -1513,6 +1513,16 @@ void ScreenGameplay::BeginScreen()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScreenGameplay::AllAreFailing()
|
||||||
|
{
|
||||||
|
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
||||||
|
{
|
||||||
|
if( pi->m_pLifeMeter && !pi->m_pLifeMeter->IsFailing() )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenGameplay::Update( float fDeltaTime )
|
void ScreenGameplay::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_pCurSong == NULL )
|
if( GAMESTATE->m_pCurSong == NULL )
|
||||||
@@ -1562,8 +1572,6 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
||||||
{
|
{
|
||||||
PlayerNumber pn = pi->GetStepsAndTrailIndex();
|
|
||||||
|
|
||||||
if( pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing() )
|
if( pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing() )
|
||||||
{
|
{
|
||||||
pi->GetPlayerState()->m_HealthState = PlayerState::DEAD;
|
pi->GetPlayerState()->m_HealthState = PlayerState::DEAD;
|
||||||
@@ -1606,8 +1614,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
/* If recovery is enabled, only set fail if both are failing.
|
/* If recovery is enabled, only set fail if both are failing.
|
||||||
* There's no way to recover mid-song in battery mode. */
|
* There's no way to recover mid-song in battery mode. */
|
||||||
if( lt != SongOptions::LIFE_BATTERY &&
|
if( lt != SongOptions::LIFE_BATTERY && g_bTwoPlayerRecovery && !AllAreFailing() )
|
||||||
g_bTwoPlayerRecovery && !GAMESTATE->AllAreDead() )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LOG->Trace("Player %d failed", (int)pn);
|
LOG->Trace("Player %d failed", (int)pn);
|
||||||
@@ -1643,7 +1650,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
switch( ft )
|
switch( ft )
|
||||||
{
|
{
|
||||||
case SongOptions::FAIL_IMMEDIATE:
|
case SongOptions::FAIL_IMMEDIATE:
|
||||||
if( pi->GetPlayerState()->m_HealthState < PlayerState::DEAD )
|
if( pi->m_pLifeMeter && !pi->m_pLifeMeter->IsFailing() )
|
||||||
bAllFailed = false;
|
bAllFailed = false;
|
||||||
break;
|
break;
|
||||||
case SongOptions::FAIL_END_OF_SONG:
|
case SongOptions::FAIL_END_OF_SONG:
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ protected:
|
|||||||
virtual void SaveStats();
|
virtual void SaveStats();
|
||||||
void StageFinished( bool bBackedOut );
|
void StageFinished( bool bBackedOut );
|
||||||
void SaveReplay();
|
void SaveReplay();
|
||||||
|
bool AllAreFailing();
|
||||||
|
|
||||||
virtual void InitSongQueues();
|
virtual void InitSongQueues();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user