From c3f1d5bc125447a4536775380a7a0879632f706a Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Thu, 31 Jul 2003 15:07:48 +0000 Subject: [PATCH] Added "progressive stages lifebar" support Fixed bug where final stage wasn't really at full difficulty --- stepmania/src/LifeMeterBar.cpp | 8 ++++++-- stepmania/src/PrefsManager.cpp | 3 +++ stepmania/src/PrefsManager.h | 1 + stepmania/src/ScreenGameplay.cpp | 16 ++++++++++++++-- stepmania/src/ScreenMachineOptions.cpp | 14 +++++++++----- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 6a74e798e8..672f555bda 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -467,12 +467,16 @@ void LifeMeterBar::DrawPrimitives() ActorFrame::DrawPrimitives(); } -void LifeMeterBar::UpdateNonstopLifebar(const int cleared, const int total, int ProgressiveLifebarDifficulty) +void LifeMeterBar::UpdateNonstopLifebar(const int cleared, + const int total, int ProgressiveLifebarDifficulty) { // if (cleared > total) cleared = total; // clear/total <= 1 // if (total == 0) total = 1; // no division by 0 - m_fLifeDifficulty = m_fBaseLifeDifficulty - 0.2f * ProgressiveLifebarDifficulty * cleared / total; + if (total > 1) + m_fLifeDifficulty = m_fBaseLifeDifficulty - 0.2f * (int)(ProgressiveLifebarDifficulty * cleared / (total - 1)); + else + m_fLifeDifficulty = m_fBaseLifeDifficulty - 0.2f * ProgressiveLifebarDifficulty; if (m_fLifeDifficulty >= 0.4) return; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index dbdcc55d42..117ff88225 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -107,6 +107,7 @@ PrefsManager::PrefsManager() // set to 0 so people aren't shocked at first m_iProgressiveLifebar = 0; m_iProgressiveNonstopLifebar = 0; + m_iProgressiveStageLifebar = 0; /* DDR Extreme-style extra stage support. * Default off so people used to the current behavior (or those with extra @@ -224,6 +225,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueI( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder ); ini.GetValueI( "Options", "ProgressiveLifebar", (int&)m_iProgressiveLifebar ); ini.GetValueI( "Options", "ProgressiveNonstopLifebar", (int&)m_iProgressiveNonstopLifebar ); + ini.GetValueI( "Options", "ProgressiveStageLifebar", (int&)m_iProgressiveStageLifebar ); ini.GetValueB( "Options", "UseUnlockSystem", m_bUseUnlockSystem ); @@ -337,6 +339,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed ); ini.SetValueI( "Options", "CourseSortOrder", m_iCourseSortOrder ); ini.SetValueI( "Options", "ProgressiveLifebar", m_iProgressiveLifebar ); + ini.SetValueI( "Options", "ProgressiveStageLifebar", m_iProgressiveStageLifebar ); ini.SetValueI( "Options", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar ); /* Only write these if they aren't the default. This ensures that we can change diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 382b359343..ecf6be5d20 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -84,6 +84,7 @@ public: bool m_bDebugMode; bool m_bTenFooterInRed; int m_iProgressiveLifebar; + int m_iProgressiveStageLifebar; int m_iProgressiveNonstopLifebar; // course ranking diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index b16e3a1530..07ab675880 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -710,10 +710,22 @@ void ScreenGameplay::LoadNextSong() if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[p] ) // already failed ShowOniGameOver((PlayerNumber)p); + if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE && !PREFSMAN->m_bEventMode ) + { + m_pLifeMeter[p]->UpdateNonstopLifebar( + GAMESTATE->GetStageIndex(), + PREFSMAN->m_iNumArcadeStages, + PREFSMAN->m_iProgressiveStageLifebar); + } if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP ) { - LOG->Trace("Song %d of %d", GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurCourse->GetEstimatedNumStages() ); - m_pLifeMeter[p]->UpdateNonstopLifebar(GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurCourse->GetEstimatedNumStages(), PREFSMAN->m_iProgressiveNonstopLifebar); + LOG->Trace("Song %d of %d", + GAMESTATE->GetCourseSongIndex(), + GAMESTATE->m_pCurCourse->GetEstimatedNumStages() ); + m_pLifeMeter[p]->UpdateNonstopLifebar( + GAMESTATE->GetCourseSongIndex(), + GAMESTATE->m_pCurCourse->GetEstimatedNumStages(), + PREFSMAN->m_iProgressiveNonstopLifebar); } m_DifficultyIcon[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] ); diff --git a/stepmania/src/ScreenMachineOptions.cpp b/stepmania/src/ScreenMachineOptions.cpp index db003aa5db..413628fa2e 100644 --- a/stepmania/src/ScreenMachineOptions.cpp +++ b/stepmania/src/ScreenMachineOptions.cpp @@ -31,6 +31,7 @@ enum { MO_JUDGE_DIFFICULTY, MO_LIFE_DIFFICULTY, MO_PROGRESSIVE_LIFEBAR, + MO_PROG_STAGE_LIFEBAR, MO_PROG_NONSTOP_LIFEBAR, MO_FAIL, MO_SHOWSTATS, @@ -47,6 +48,7 @@ OptionRow g_MachineOptionsLines[NUM_MACHINE_OPTIONS_LINES] = { OptionRow( "Judge\nDifficulty", "1","2","3","4","5","6","7","8","JUSTICE" ), OptionRow( "Life\nDifficulty", "1","2","3","4","5","6","7" ), OptionRow( "Progressive\nLifebar", "OFF","1","2","3","4","5","6","7","8"), + OptionRow( "Progressive\nStage Lifebar", "OFF","1","2","3","4"), OptionRow( "Progressive\nNonstop Lifebar", "OFF","1","2","3","4"), OptionRow( "Default\nFail Type", "ARCADE","END OF SONG","OFF" ), OptionRow( "Show\nStats", "OFF","ON" ), @@ -108,6 +110,7 @@ void ScreenMachineOptions::ImportOptions() so.FromString( PREFSMAN->m_sDefaultModifiers ); m_iSelectedOption[0][MO_PROGRESSIVE_LIFEBAR] = PREFSMAN->m_iProgressiveLifebar; m_iSelectedOption[0][MO_PROG_NONSTOP_LIFEBAR] = PREFSMAN->m_iProgressiveNonstopLifebar; + m_iSelectedOption[0][MO_PROG_STAGE_LIFEBAR] = PREFSMAN->m_iProgressiveStageLifebar; m_iSelectedOption[0][MO_FAIL] = so.m_FailType; m_iSelectedOption[0][MO_SHOWSTATS] = PREFSMAN->m_bShowStats ? 1:0; m_iSelectedOption[0][MO_COINS_PER_CREDIT] = PREFSMAN->m_iCoinsPerCredit - 1; @@ -123,11 +126,12 @@ void ScreenMachineOptions::ImportOptions() void ScreenMachineOptions::ExportOptions() { - PREFSMAN->m_iCoinMode = m_iSelectedOption[0][MO_COIN_MODE]; - PREFSMAN->m_bMenuTimer = m_iSelectedOption[0][MO_MENU_TIMER] == 1; - PREFSMAN->m_iNumArcadeStages = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] + 1; - PREFSMAN->m_bEventMode = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] == 7; - PREFSMAN->m_iProgressiveNonstopLifebar = m_iSelectedOption[0][MO_PROG_NONSTOP_LIFEBAR]; + PREFSMAN->m_iCoinMode = m_iSelectedOption[0][MO_COIN_MODE]; + PREFSMAN->m_bMenuTimer = m_iSelectedOption[0][MO_MENU_TIMER] == 1; + PREFSMAN->m_iNumArcadeStages = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] + 1; + PREFSMAN->m_bEventMode = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] == 7; + PREFSMAN->m_iProgressiveNonstopLifebar = m_iSelectedOption[0][MO_PROG_NONSTOP_LIFEBAR]; + PREFSMAN->m_iProgressiveStageLifebar = m_iSelectedOption[0][MO_PROG_STAGE_LIFEBAR]; switch( m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] ) {