diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index aa5c6c3dee..8d8584a4b2 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -830,7 +830,7 @@ void BackgroundImpl::Update( float fDeltaTime ) FOREACH_PlayerNumber( p ) { - if( g_bShowDanger && GAMESTATE->m_pPlayerState[p]->m_HealthState == PlayerState::DANGER ) + if( g_bShowDanger && GAMESTATE->m_pPlayerState[p]->m_HealthState == HealthState_Danger ) m_DangerPlayer[p]->Update( fDeltaTime ); } diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 69e08ad074..5d13db3f49 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -93,6 +93,16 @@ XToLocalizedString( PlayerController ); LuaXType( PlayerController ); +static const char *HealthStateNames[] = { + "Hot", + "Alive", + "Danger", + "Dead", +}; +XToString( HealthState ); +LuaXType( HealthState ); + + static const char *CoinModeNames[] = { "Home", "Pay", diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index f1f8735974..c48ab028cd 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -271,6 +271,17 @@ enum PlayerController const RString& PlayerControllerToString( PlayerController pc ); +enum HealthState +{ + HealthState_Hot, + HealthState_Alive, + HealthState_Danger, + HealthState_Dead, + NUM_HealthState, + HealthState_Invalid +}; +LuaDeclareType( HealthState ); + enum StageResult { RESULT_WIN, diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 9aadd45fab..26f9d0395e 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -737,7 +737,7 @@ void GameState::ResetStageStatistics() FOREACH_PlayerNumber( p ) { m_pPlayerState[p]->m_fSuperMeter = 0; - m_pPlayerState[p]->m_HealthState = PlayerState::ALIVE; + m_pPlayerState[p]->m_HealthState = HealthState_Alive; m_pPlayerState[p]->m_iLastPositiveSumOfAttackLevels = 0; m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected @@ -1643,7 +1643,7 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName ) bool GameState::AllAreInDangerOrWorse() const { FOREACH_EnabledPlayer( p ) - if( m_pPlayerState[p]->m_HealthState < PlayerState::DANGER ) + if( m_pPlayerState[p]->m_HealthState < HealthState_Danger ) return false; return true; } @@ -1659,7 +1659,7 @@ bool GameState::AllHumanHaveComboOf30OrMoreMisses() const bool GameState::OneIsHot() const { FOREACH_EnabledPlayer( p ) - if( m_pPlayerState[p]->m_HealthState == PlayerState::HOT ) + if( m_pPlayerState[p]->m_HealthState == HealthState_Hot ) return true; return false; } diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index dc93ba7190..209230dca9 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -287,7 +287,7 @@ void LifeMeterBar::Update( float fDeltaTime ) m_pStream->SetPassingAlpha( m_fPassingAlpha ); m_pStream->SetHotAlpha( m_fHotAlpha ); - if( m_pPlayerState->m_HealthState == PlayerState::DANGER ) + if( m_pPlayerState->m_HealthState == HealthState_Danger ) m_quadDangerGlow.SetDiffuseAlpha( 1 ); else m_quadDangerGlow.SetDiffuseAlpha( 0 ); diff --git a/stepmania/src/LifeMeterTime.cpp b/stepmania/src/LifeMeterTime.cpp index ce07fd9d54..a05d65588d 100644 --- a/stepmania/src/LifeMeterTime.cpp +++ b/stepmania/src/LifeMeterTime.cpp @@ -199,7 +199,7 @@ void LifeMeterTime::Update( float fDeltaTime ) m_pStream->SetPassingAlpha( 0 ); m_pStream->SetHotAlpha( 0 ); - if( m_pPlayerState->m_HealthState == PlayerState::DANGER ) + if( m_pPlayerState->m_HealthState == HealthState_Danger ) m_quadDangerGlow.SetDiffuseAlpha( 1 ); else m_quadDangerGlow.SetDiffuseAlpha( 0 ); diff --git a/stepmania/src/PlayerState.cpp b/stepmania/src/PlayerState.cpp index e5226c352c..aa3bda7032 100644 --- a/stepmania/src/PlayerState.cpp +++ b/stepmania/src/PlayerState.cpp @@ -17,7 +17,7 @@ void PlayerState::Reset() m_fLastDrawnBeat = -100; - m_HealthState = ALIVE; + m_HealthState = HealthState_Alive; m_fLastHopoNoteMusicSeconds = -1; m_iLastHopoNoteCol = -1; diff --git a/stepmania/src/PlayerState.h b/stepmania/src/PlayerState.h index b76ee3a9ad..415ba99ee3 100644 --- a/stepmania/src/PlayerState.h +++ b/stepmania/src/PlayerState.h @@ -32,7 +32,6 @@ public: // mutable float m_fLastDrawnBeat; // Set by NoteField. Used to push note-changing modifers back so that notes doesn't pop. - enum HealthState { HOT, ALIVE, DANGER, DEAD }; HealthState m_HealthState; float m_fLastStrumMusicSeconds; // Set to the MusicSeconds of when the a strum button was pressed. If -1, the strum window has passed. diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index a668cafb2a..cc8e4577c3 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1530,23 +1530,24 @@ void ScreenGameplay::Update( float fDeltaTime ) // FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) { + HealthState &hs = pi->GetPlayerState()->m_HealthState; if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != SongOptions::FAIL_OFF && pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing() ) { - pi->GetPlayerState()->m_HealthState = PlayerState::DEAD; + hs = HealthState_Dead; } else if( pi->m_pLifeMeter && pi->m_pLifeMeter->IsHot() ) { - pi->GetPlayerState()->m_HealthState = PlayerState::HOT; + hs = HealthState_Hot; } else if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != SongOptions::FAIL_OFF && pi->m_pLifeMeter && pi->m_pLifeMeter->IsInDanger() ) { - pi->GetPlayerState()->m_HealthState = PlayerState::DANGER; + hs = HealthState_Danger; } else { - pi->GetPlayerState()->m_HealthState = PlayerState::ALIVE; + hs = HealthState_Alive; } pi->m_SoundEffectControl.Update( fDeltaTime ); @@ -1710,7 +1711,7 @@ void ScreenGameplay::Update( float fDeltaTime ) break; } - if( state == AS2D_GREAT && pi->GetPlayerState()->m_HealthState == PlayerState::HOT ) + if( state == AS2D_GREAT && pi->GetPlayerState()->m_HealthState == HealthState_Hot ) state = AS2D_FEVER; pCharacter->Change2DAnimState( pi->m_pn, state ); @@ -2349,7 +2350,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) /* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */ if( pi->GetPlayerStageStats()->m_bFailed ) pDancers->Change2DAnimState( pi->m_pn, AS2D_FAIL ); // fail anim - else if( pi->m_pLifeMeter && pi->GetPlayerState()->m_HealthState == PlayerState::HOT ) + else if( pi->m_pLifeMeter && pi->GetPlayerState()->m_HealthState == HealthState_Hot ) pDancers->Change2DAnimState( pi->m_pn, AS2D_WINFEVER ); // full life pass anim else pDancers->Change2DAnimState( pi->m_pn, AS2D_WIN ); // pass anim