bind HealthState

This commit is contained in:
Glenn Maynard
2007-02-25 08:23:50 +00:00
parent 2afb681aea
commit e30b6fe6c2
9 changed files with 35 additions and 14 deletions
+1 -1
View File
@@ -830,7 +830,7 @@ void BackgroundImpl::Update( float fDeltaTime )
FOREACH_PlayerNumber( p ) 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 ); m_DangerPlayer[p]->Update( fDeltaTime );
} }
+10
View File
@@ -93,6 +93,16 @@ XToLocalizedString( PlayerController );
LuaXType( PlayerController ); LuaXType( PlayerController );
static const char *HealthStateNames[] = {
"Hot",
"Alive",
"Danger",
"Dead",
};
XToString( HealthState );
LuaXType( HealthState );
static const char *CoinModeNames[] = { static const char *CoinModeNames[] = {
"Home", "Home",
"Pay", "Pay",
+11
View File
@@ -271,6 +271,17 @@ enum PlayerController
const RString& PlayerControllerToString( PlayerController pc ); const RString& PlayerControllerToString( PlayerController pc );
enum HealthState
{
HealthState_Hot,
HealthState_Alive,
HealthState_Danger,
HealthState_Dead,
NUM_HealthState,
HealthState_Invalid
};
LuaDeclareType( HealthState );
enum StageResult enum StageResult
{ {
RESULT_WIN, RESULT_WIN,
+3 -3
View File
@@ -737,7 +737,7 @@ void GameState::ResetStageStatistics()
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
m_pPlayerState[p]->m_fSuperMeter = 0; 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_iLastPositiveSumOfAttackLevels = 0;
m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected
@@ -1643,7 +1643,7 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName )
bool GameState::AllAreInDangerOrWorse() const bool GameState::AllAreInDangerOrWorse() const
{ {
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
if( m_pPlayerState[p]->m_HealthState < PlayerState::DANGER ) if( m_pPlayerState[p]->m_HealthState < HealthState_Danger )
return false; return false;
return true; return true;
} }
@@ -1659,7 +1659,7 @@ bool GameState::AllHumanHaveComboOf30OrMoreMisses() const
bool GameState::OneIsHot() const bool GameState::OneIsHot() const
{ {
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
if( m_pPlayerState[p]->m_HealthState == PlayerState::HOT ) if( m_pPlayerState[p]->m_HealthState == HealthState_Hot )
return true; return true;
return false; return false;
} }
+1 -1
View File
@@ -287,7 +287,7 @@ void LifeMeterBar::Update( float fDeltaTime )
m_pStream->SetPassingAlpha( m_fPassingAlpha ); m_pStream->SetPassingAlpha( m_fPassingAlpha );
m_pStream->SetHotAlpha( m_fHotAlpha ); m_pStream->SetHotAlpha( m_fHotAlpha );
if( m_pPlayerState->m_HealthState == PlayerState::DANGER ) if( m_pPlayerState->m_HealthState == HealthState_Danger )
m_quadDangerGlow.SetDiffuseAlpha( 1 ); m_quadDangerGlow.SetDiffuseAlpha( 1 );
else else
m_quadDangerGlow.SetDiffuseAlpha( 0 ); m_quadDangerGlow.SetDiffuseAlpha( 0 );
+1 -1
View File
@@ -199,7 +199,7 @@ void LifeMeterTime::Update( float fDeltaTime )
m_pStream->SetPassingAlpha( 0 ); m_pStream->SetPassingAlpha( 0 );
m_pStream->SetHotAlpha( 0 ); m_pStream->SetHotAlpha( 0 );
if( m_pPlayerState->m_HealthState == PlayerState::DANGER ) if( m_pPlayerState->m_HealthState == HealthState_Danger )
m_quadDangerGlow.SetDiffuseAlpha( 1 ); m_quadDangerGlow.SetDiffuseAlpha( 1 );
else else
m_quadDangerGlow.SetDiffuseAlpha( 0 ); m_quadDangerGlow.SetDiffuseAlpha( 0 );
+1 -1
View File
@@ -17,7 +17,7 @@ void PlayerState::Reset()
m_fLastDrawnBeat = -100; m_fLastDrawnBeat = -100;
m_HealthState = ALIVE; m_HealthState = HealthState_Alive;
m_fLastHopoNoteMusicSeconds = -1; m_fLastHopoNoteMusicSeconds = -1;
m_iLastHopoNoteCol = -1; m_iLastHopoNoteCol = -1;
-1
View File
@@ -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. 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; 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. float m_fLastStrumMusicSeconds; // Set to the MusicSeconds of when the a strum button was pressed. If -1, the strum window has passed.
+7 -6
View File
@@ -1530,23 +1530,24 @@ void ScreenGameplay::Update( float fDeltaTime )
// //
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{ {
HealthState &hs = pi->GetPlayerState()->m_HealthState;
if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != SongOptions::FAIL_OFF && if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != SongOptions::FAIL_OFF &&
pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing() ) 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() ) 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 && else if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != SongOptions::FAIL_OFF &&
pi->m_pLifeMeter && pi->m_pLifeMeter->IsInDanger() ) pi->m_pLifeMeter && pi->m_pLifeMeter->IsInDanger() )
{ {
pi->GetPlayerState()->m_HealthState = PlayerState::DANGER; hs = HealthState_Danger;
} }
else else
{ {
pi->GetPlayerState()->m_HealthState = PlayerState::ALIVE; hs = HealthState_Alive;
} }
pi->m_SoundEffectControl.Update( fDeltaTime ); pi->m_SoundEffectControl.Update( fDeltaTime );
@@ -1710,7 +1711,7 @@ void ScreenGameplay::Update( float fDeltaTime )
break; break;
} }
if( state == AS2D_GREAT && pi->GetPlayerState()->m_HealthState == PlayerState::HOT ) if( state == AS2D_GREAT && pi->GetPlayerState()->m_HealthState == HealthState_Hot )
state = AS2D_FEVER; state = AS2D_FEVER;
pCharacter->Change2DAnimState( pi->m_pn, state ); pCharacter->Change2DAnimState( pi->m_pn, state );
@@ -2349,7 +2350,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
/* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */ /* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */
if( pi->GetPlayerStageStats()->m_bFailed ) if( pi->GetPlayerStageStats()->m_bFailed )
pDancers->Change2DAnimState( pi->m_pn, AS2D_FAIL ); // fail anim 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 pDancers->Change2DAnimState( pi->m_pn, AS2D_WINFEVER ); // full life pass anim
else else
pDancers->Change2DAnimState( pi->m_pn, AS2D_WIN ); // pass anim pDancers->Change2DAnimState( pi->m_pn, AS2D_WIN ); // pass anim