diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 377a5bced8..b12e70c5e2 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -302,7 +302,7 @@ void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNum if( !ss.bFailed[p] ) { pProfile->m_iNumSongsPassedByPlayMode[ss.playMode]++; - pProfile->m_iNumSongsPassedByGrade[ss.GetGrade((PlayerNumber)p)]++; + pProfile->m_iNumSongsPassedByGrade[ss.GetGrade(p)]++; } } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 2c90a1a376..b3361232b3 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -91,6 +91,7 @@ void PrefsManager::Init() m_iMaxRegenComboAfterMiss = 10; m_bTwoPlayerRecovery = true; m_bMercifulDrain = true; + m_bMin1FullSongInCourses = false; m_iPercentScoreWeightMarvelous = 3; m_iPercentScoreWeightPerfect = 2; @@ -382,6 +383,7 @@ void PrefsManager::ReadPrefsFromFile( CString sIni ) ini.GetValue( "Options", "MaxRegenComboAfterMiss", m_iMaxRegenComboAfterMiss ); ini.GetValue( "Options", "TwoPlayerRecovery", m_bTwoPlayerRecovery ); ini.GetValue( "Options", "MercifulDrain", m_bMercifulDrain ); + ini.GetValue( "Options", "Min1FullSongInCourses", m_bMin1FullSongInCourses ); ini.GetValue( "Options", "PercentScoreWeightMarvelous", m_iPercentScoreWeightMarvelous ); ini.GetValue( "Options", "PercentScoreWeightPerfect", m_iPercentScoreWeightPerfect ); @@ -612,6 +614,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "MaxRegenComboAfterMiss", m_iMaxRegenComboAfterMiss ); ini.SetValue( "Options", "TwoPlayerRecovery", m_bTwoPlayerRecovery ); ini.SetValue( "Options", "MercifulDrain", m_bMercifulDrain ); + ini.SetValue( "Options", "Min1FullSongInCourses", m_bMin1FullSongInCourses ); ini.SetValue( "Options", "PercentScoreWeightMarvelous", m_iPercentScoreWeightMarvelous ); ini.SetValue( "Options", "PercentScoreWeightPerfect", m_iPercentScoreWeightPerfect ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index ed6cf7f2f9..4a984a32b0 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -91,6 +91,7 @@ public: int m_iMaxRegenComboAfterMiss; bool m_bTwoPlayerRecovery; bool m_bMercifulDrain; // negative life deltas are scaled by the players life percentage + bool m_bMin1FullSongInCourses; // FEoS for 1st song, FailImmediate thereafter // percent score (the number that is shown on the screen and saved to memory card) int m_iPercentScoreWeightMarvelous; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index f571bde8e2..a4b35cffa7 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -870,7 +870,7 @@ void ScreenGameplay::LoadNextSong() m_sprOniGameOver[p].SetDiffuse( RageColor(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[p] ) // already failed - ShowOniGameOver((PlayerNumber)p); + ShowOniGameOver(p); if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE && !PREFSMAN->m_bEventMode && !m_bDemonstration) { @@ -1220,26 +1220,72 @@ void ScreenGameplay::Update( float fDeltaTime ) m_BeginnerHelper.Update(fDeltaTime); + + /* Set g_CurStageStats.bFailed for failed players. In, FAIL_IMMEDIATE, send + * SM_BeginFailed if all players failed, and kill dead Oni players. */ + if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_OFF ) + return; + + // check for individual fail + FOREACH_EnabledPlayer( pn ) + { + if( (m_pLifeMeter[pn] && !m_pLifeMeter[pn]->IsFailing()) || + (m_pCombinedLifeMeter && !m_pCombinedLifeMeter->IsFailing(pn)) ) + continue; /* isn't failing */ + if( g_CurStageStats.bFailed[pn] ) + continue; /* failed and is already dead */ + + /* If recovery is enabled, only set fail if both are failing. + * There's no way to recover mid-song in battery mode. */ + if( GAMESTATE->m_SongOptions.m_LifeType != SongOptions::LIFE_BATTERY && + PREFSMAN->m_bTwoPlayerRecovery && !GAMESTATE->AllAreDead() ) + continue; + + LOG->Trace("Player %d failed", (int)pn); + g_CurStageStats.bFailed[pn] = true; // fail + + if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && + GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_IMMEDIATE ) + { + if( !g_CurStageStats.AllFailedEarlier() ) // if not the last one to fail + { + // kill them! + SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") ); + ShowOniGameOver(pn); + m_Player[pn].Init(); // remove all notes and scoring + m_Player[pn].FadeToFail(); // tell the NoteField to fade to white + } + } + } + + /* If FAIL_IMMEDIATE and everyone is failing, start SM_BeginFailed. */ + if( GAMESTATE->AllAreDead() && GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_IMMEDIATE ) + { + if( PREFSMAN->m_bMin1FullSongInCourses && GAMESTATE->GetCourseSongIndex()==0 ) + ; // do nothing + else + SCREENMAN->PostMessageToTopScreen( SM_BeginFailed, 0 ); + } + + // // update GameState HealthState // FOREACH_EnabledPlayer(p) { - if( + if( g_CurStageStats.bFailed[p] ) + { + GAMESTATE->m_HealthState[p] = GameState::DEAD; + } + else if( (m_pLifeMeter[p] && m_pLifeMeter[p]->IsHot()) || - (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsHot((PlayerNumber)p)) ) + (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsHot(p)) ) { GAMESTATE->m_HealthState[p] = GameState::HOT; } - else if( - (m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) || - (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing((PlayerNumber)p)) ) - { - GAMESTATE->m_HealthState[p] = GameState::DEAD; - } else if( (m_pLifeMeter[p] && m_pLifeMeter[p]->IsInDanger()) || - (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsInDanger((PlayerNumber)p)) ) + (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsInDanger(p)) ) { GAMESTATE->m_HealthState[p] = GameState::DANGER; } @@ -1249,6 +1295,7 @@ void ScreenGameplay::Update( float fDeltaTime ) } } + switch( m_DancingState ) { case STATE_DANCING: @@ -1272,16 +1319,10 @@ void ScreenGameplay::Update( float fDeltaTime ) if( GAMESTATE->m_fMusicSeconds > fSecondsToStop && !m_SongFinished.IsTransitioning() && !m_NextSongOut.IsTransitioning() ) m_SongFinished.StartTransitioning( SM_NotesEnded ); - - // - // check for fail - // - UpdateCheckFail(); // // update 2d dancing characters // - FOREACH_EnabledPlayer(p) { if(m_Background.GetDancingCharacters() != NULL) @@ -1353,7 +1394,7 @@ void ScreenGameplay::Update( float fDeltaTime ) /* Unless we're in FailOff, giving up means failing the song. */ switch( GAMESTATE->m_SongOptions.m_FailType ) { - case SongOptions::FAIL_ARCADE: + case SongOptions::FAIL_IMMEDIATE: case SongOptions::FAIL_END_OF_SONG: FOREACH_EnabledPlayer(pn) g_CurStageStats.bFailed[pn] = true; // fail @@ -1482,51 +1523,6 @@ void ScreenGameplay::Update( float fDeltaTime ) } -/* Set g_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send - * SM_BeginFailed if all players failed, and kill dead Oni players. */ -void ScreenGameplay::UpdateCheckFail() -{ - if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_OFF ) - return; - - // check for individual fail - FOREACH_EnabledPlayer( pn ) - { - if( (m_pLifeMeter[pn] && !m_pLifeMeter[pn]->IsFailing()) || - (m_pCombinedLifeMeter && !m_pCombinedLifeMeter->IsFailing((PlayerNumber)pn)) ) - continue; /* isn't failing */ - if( g_CurStageStats.bFailed[pn] ) - continue; /* failed and is already dead */ - - /* If recovery is enabled, only set fail if both are failing. - * There's no way to recover mid-song in battery mode. */ - if( GAMESTATE->m_SongOptions.m_LifeType != SongOptions::LIFE_BATTERY && - PREFSMAN->m_bTwoPlayerRecovery && !GAMESTATE->AllAreDead() ) - continue; - - LOG->Trace("Player %d failed", (int)pn); - g_CurStageStats.bFailed[pn] = true; // fail - - if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && - GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) - { - if( !g_CurStageStats.AllFailedEarlier() ) // if not the last one to fail - { - // kill them! - SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") ); - ShowOniGameOver((PlayerNumber)pn); - m_Player[pn].Init(); // remove all notes and scoring - m_Player[pn].FadeToFail(); // tell the NoteField to fade to white - } - } - } - - /* If FAIL_ARCADE and everyone is failing, start SM_BeginFailed. */ - if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE && - GAMESTATE->AllAreDead() ) - SCREENMAN->PostMessageToTopScreen( SM_BeginFailed, 0 ); -} - void ScreenGameplay::AbortGiveUp() { if( m_GiveUpTimer.IsZero() ) diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index cdeba4c54e..b9d0a6f3f1 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -78,7 +78,6 @@ protected: void PlayTicks(); void UpdateSongPosition( float fDeltaTime ); void UpdateLyrics( float fDeltaTime ); - void UpdateCheckFail(); void SongFinished(); void StageFinished( bool bBackedOut ); diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 3758e1bc92..12db8f0bb5 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -339,7 +339,7 @@ static void DefaultFailType( int &sel, bool ToSel, const CStringArray &choices ) switch( sel ) { - case 0: so.m_FailType = SongOptions::FAIL_ARCADE; break; + 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; default: @@ -473,7 +473,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, "ARCADE","END OF SONG","OFF" ), + ConfOption( "Default\nFail Type", DefaultFailType, "IMMEDIATE","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 86ad66ea2a..2b9b7dbdd5 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -7,7 +7,7 @@ void SongOptions::Init() m_LifeType = LIFE_BAR; m_DrainType = DRAIN_NORMAL; m_iBatteryLives = 4; - m_FailType = FAIL_ARCADE; + m_FailType = FAIL_IMMEDIATE; m_bAssistTick = false; m_fMusicRate = 1.0f; m_bAutoSync = false; @@ -36,7 +36,7 @@ CString SongOptions::GetString() const switch( m_FailType ) { - case FAIL_ARCADE: break; + case FAIL_IMMEDIATE: break; case FAIL_END_OF_SONG: sReturn += "FailEndOfSong, "; break; case FAIL_OFF: sReturn += "FailOff, "; break; } @@ -104,7 +104,7 @@ void SongOptions::FromString( CString sOptions ) else if( sBit == "power-drop" ) m_DrainType = DRAIN_NO_RECOVER; else if( sBit == "death" ) m_DrainType = DRAIN_SUDDEN_DEATH; else if( sBit == "normal-drain" ) m_DrainType = DRAIN_NORMAL; - else if( sBit == "failarcade" ) m_FailType = FAIL_ARCADE; + else if( sBit == "failarcade" ) m_FailType = FAIL_IMMEDIATE; 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 1ecc90b45b..d3aca8d79b 100644 --- a/stepmania/src/SongOptions.h +++ b/stepmania/src/SongOptions.h @@ -10,7 +10,7 @@ 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_ARCADE=0, FAIL_END_OF_SONG, FAIL_OFF }; + enum FailType { FAIL_IMMEDIATE=0, FAIL_END_OF_SONG, FAIL_OFF }; FailType m_FailType; float m_fMusicRate; bool m_bAssistTick, m_bAutoSync, m_bSaveScore;