From 35869118d9a576e1b9d70b414a026353622fdd53 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 31 Jul 2004 19:14:53 +0000 Subject: [PATCH] add FAIL_COMBO_OF_30_MISSES --- stepmania/src/GameState.cpp | 29 +++++++++++++--------- stepmania/src/GameState.h | 1 + stepmania/src/ScreenGameplay.cpp | 17 ++++++++++++- stepmania/src/ScreenOptionsMasterPrefs.cpp | 9 ++++--- stepmania/src/SongOptions.cpp | 8 +++--- stepmania/src/SongOptions.h | 6 ++++- 6 files changed, 49 insertions(+), 21 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 5cdd5c0fdc..bac2ce7dbc 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1621,28 +1621,33 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name ) bool GameState::AllAreInDangerOrWorse() const { - FOREACH_PlayerNumber( p ) - if( this->IsPlayerEnabled(p) ) - if( m_HealthState[p] < DANGER ) - return false; + FOREACH_EnabledPlayer( p ) + if( m_HealthState[p] < DANGER ) + return false; return true; } bool GameState::AllAreDead() const { - FOREACH_PlayerNumber( p ) - if( this->IsPlayerEnabled(p) ) - if( m_HealthState[p] < DEAD ) - return false; + FOREACH_EnabledPlayer( p ) + if( m_HealthState[p] < DEAD ) + return false; + return true; +} + +bool GameState::AllHaveComboOf30OrMoreMisses() const +{ + FOREACH_EnabledPlayer( p ) + if( g_CurStageStats.iCurMissCombo[p] < 30 ) + return false; return true; } bool GameState::OneIsHot() const { - FOREACH_PlayerNumber( p ) - if( this->IsPlayerEnabled(PlayerNumber(p)) ) - if( m_HealthState[p] == HOT ) - return true; + FOREACH_EnabledPlayer( p ) + if( m_HealthState[p] == HOT ) + return true; return false; } diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 574a5a2f0a..7ac6ffaee0 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -175,6 +175,7 @@ public: HealthState m_HealthState[NUM_PLAYERS]; bool AllAreInDangerOrWorse() const; bool AllAreDead() const; + bool AllHaveComboOf30OrMoreMisses() const; bool OneIsHot() const; // used in PLAY_MODE_BATTLE and PLAY_MODE_RAVE diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 16d3549ed2..4a192a268d 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1320,7 +1320,21 @@ void ScreenGameplay::Update( float fDeltaTime ) } /* If FAIL_IMMEDIATE and everyone is failing, start SM_BeginFailed. */ - if( GAMESTATE->AllAreDead() && GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_IMMEDIATE ) + bool bBeginFailed = false; + switch( GAMESTATE->m_SongOptions.m_FailType ) + { + case SongOptions::FAIL_IMMEDIATE: + if( GAMESTATE->AllAreDead() ) + bBeginFailed = true; + break; + case SongOptions::FAIL_COMBO_OF_30_MISSES: + if( GAMESTATE->AllHaveComboOf30OrMoreMisses() ) + bBeginFailed = true; + break; + default: + } + + if( bBeginFailed ) { if( PREFSMAN->m_bMinimum1FullSongInCourses && GAMESTATE->GetCourseSongIndex()==0 ) ; // do nothing @@ -1424,6 +1438,7 @@ void ScreenGameplay::Update( float fDeltaTime ) switch( GAMESTATE->m_SongOptions.m_FailType ) { case SongOptions::FAIL_IMMEDIATE: + case SongOptions::FAIL_COMBO_OF_30_MISSES: case SongOptions::FAIL_END_OF_SONG: FOREACH_EnabledPlayer(pn) g_CurStageStats.bFailed[pn] = true; // fail diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index e98b77d6e8..c6e82ad967 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -324,9 +324,10 @@ static void DefaultFailType( int &sel, bool ToSel, const CStringArray &choices ) switch( sel ) { - case 0: so.m_FailType = SongOptions::FAIL_IMMEDIATE; break; - case 1: so.m_FailType = SongOptions::FAIL_END_OF_SONG; break; - case 2: so.m_FailType = SongOptions::FAIL_OFF; break; + case 0: so.m_FailType = SongOptions::FAIL_IMMEDIATE; break; + case 1: so.m_FailType = SongOptions::FAIL_COMBO_OF_30_MISSES; break; + case 2: so.m_FailType = SongOptions::FAIL_END_OF_SONG; break; + case 3: so.m_FailType = SongOptions::FAIL_OFF; break; default: ASSERT(0); } @@ -459,7 +460,7 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Progressive\nLifebar", ProgressiveLifebar, "OFF","1","2","3","4","5","6","7","8"), ConfOption( "Progressive\nStage Lifebar",ProgressiveStageLifebar, "OFF","1","2","3","4","5","6","7","8","INSANITY"), ConfOption( "Progressive\nNonstop Lifebar",ProgressiveNonstopLifebar,"OFF","1","2","3","4","5","6","7","8","INSANITY"), - ConfOption( "Default\nFail Type", DefaultFailType, "IMMEDIATE","END OF SONG","OFF" ), + ConfOption( "Default\nFail Type", DefaultFailType, "IMMEDIATE","COMBO OF 30 MISSES","END OF SONG","OFF" ), ConfOption( "Coins Per\nCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ), ConfOption( "Premium", Premium, "OFF","DOUBLE FOR 1 CREDIT","JOINT PREMIUM" ), ConfOption( "Show Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ), diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp index 58167066aa..a136612208 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -36,9 +36,10 @@ CString SongOptions::GetString() const switch( m_FailType ) { - case FAIL_IMMEDIATE: break; - case FAIL_END_OF_SONG: sReturn += "FailEndOfSong, "; break; - case FAIL_OFF: sReturn += "FailOff, "; break; + case FAIL_IMMEDIATE: break; + case FAIL_COMBO_OF_30_MISSES: sReturn += "Fail30Misses, "; break; + case FAIL_END_OF_SONG: sReturn += "FailEndOfSong, "; break; + case FAIL_OFF: sReturn += "FailOff, "; break; } if( m_fMusicRate != 1 ) @@ -106,6 +107,7 @@ void SongOptions::FromString( CString sOptions ) else if( sBit == "normal-drain" ) m_DrainType = DRAIN_NORMAL; else if( sBit == "failarcade" || sBit == "failimmediate" ) m_FailType = FAIL_IMMEDIATE; + else if( sBit == "fail30misses" ) m_FailType = FAIL_COMBO_OF_30_MISSES; else if( sBit == "failendofsong" ) m_FailType = FAIL_END_OF_SONG; else if( sBit == "failoff" ) m_FailType = FAIL_OFF; else if( sBit == "assisttick" ) m_bAssistTick = on; diff --git a/stepmania/src/SongOptions.h b/stepmania/src/SongOptions.h index d3aca8d79b..05ee7f6f26 100644 --- a/stepmania/src/SongOptions.h +++ b/stepmania/src/SongOptions.h @@ -10,7 +10,11 @@ struct SongOptions enum DrainType { DRAIN_NORMAL, DRAIN_NO_RECOVER, DRAIN_SUDDEN_DEATH }; DrainType m_DrainType; // only used with LifeBar int m_iBatteryLives; - enum FailType { FAIL_IMMEDIATE=0, FAIL_END_OF_SONG, FAIL_OFF }; + enum FailType { + FAIL_IMMEDIATE=0, // fail when life touches 0 + FAIL_COMBO_OF_30_MISSES, // fail when 30 misses in a row, or on end of song if life touched 0 + FAIL_END_OF_SONG, // fail on end of song if life touched 0 + FAIL_OFF }; // never fail FailType m_FailType; float m_fMusicRate; bool m_bAssistTick, m_bAutoSync, m_bSaveScore;