progressive lifebar for nonstop courses (4th stage harder than 1st stage, etc)

This commit is contained in:
Andrew Wong
2003-07-30 17:01:04 +00:00
parent 2a793de751
commit 3adec8251c
8 changed files with 65 additions and 2 deletions
+2
View File
@@ -36,6 +36,8 @@ public:
virtual bool IsFailing() = 0; virtual bool IsFailing() = 0;
virtual bool FailedEarlier() = 0; virtual bool FailedEarlier() = 0;
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) = 0;
protected: protected:
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
}; };
+43 -2
View File
@@ -247,6 +247,10 @@ LifeMeterBar::LifeMeterBar()
m_fHotAlpha = 0; m_fHotAlpha = 0;
m_bFailedEarlier = false; m_bFailedEarlier = false;
// set up lifebar
m_fBaseLifeDifficulty = PREFSMAN->m_fLifeDifficultyScale;
m_fLifeDifficulty = m_fBaseLifeDifficulty;
m_quadBlackBackground.SetDiffuse( RageColor(0,0,0,1) ); m_quadBlackBackground.SetDiffuse( RageColor(0,0,0,1) );
m_quadBlackBackground.SetZoomX( (float)g_iMeterWidth ); m_quadBlackBackground.SetZoomX( (float)g_iMeterWidth );
m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight ); m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight );
@@ -344,9 +348,9 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
} }
if( fDeltaLife > 0 ) if( fDeltaLife > 0 )
fDeltaLife *= PREFSMAN->m_fLifeDifficultyScale; fDeltaLife *= m_fLifeDifficulty;
else else
fDeltaLife /= PREFSMAN->m_fLifeDifficultyScale; fDeltaLife /= m_fLifeDifficulty;
m_fLifePercentage += fDeltaLife; m_fLifePercentage += fDeltaLife;
CLAMP( m_fLifePercentage, 0, 1 ); CLAMP( m_fLifePercentage, 0, 1 );
@@ -463,6 +467,43 @@ void LifeMeterBar::DrawPrimitives()
ActorFrame::DrawPrimitives(); ActorFrame::DrawPrimitives();
} }
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 (m_fLifeDifficulty >= 0.4) return;
// the lifebar is pretty harsh at 0.4 already (you lose
// about 20% of your lifebar); at 0.2 it would be 40%, which
// is too harsh at one difficulty level higher. Override.
if (m_fLifeDifficulty >= 0.2)
{
m_fLifeDifficulty = 0.3f;
return;
}
if (m_fLifeDifficulty >= 0)
{
m_fLifeDifficulty = 0.25f;
return;
}
if (m_fLifeDifficulty >= -0.2)
{
m_fLifeDifficulty = 0.2f;
return;
}
if (m_fLifeDifficulty >= -0.4)
{
m_fLifeDifficulty = 0.16f;
return;
}
m_fLifeDifficulty = 0.1f;
}
/* /*
Chris: I'm making the coloring of the lifemeter a property Chris: I'm making the coloring of the lifemeter a property
+5
View File
@@ -37,6 +37,8 @@ public:
virtual bool IsFailing(); virtual bool IsFailing();
virtual bool FailedEarlier(); virtual bool FailedEarlier();
void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty);
private: private:
void ResetBarVelocity(); void ResetBarVelocity();
@@ -50,6 +52,9 @@ private:
float m_fHotAlpha; float m_fHotAlpha;
bool m_bFailedEarlier; // set this to true when life dips below 0 bool m_bFailedEarlier; // set this to true when life dips below 0
float m_fBaseLifeDifficulty;
float m_fLifeDifficulty; // essentially same as pref
int m_iProgressiveLifebar; // cached from prefs int m_iProgressiveLifebar; // cached from prefs
int m_iMissCombo; // current number of progressive boo/miss int m_iMissCombo; // current number of progressive boo/miss
}; };
+2
View File
@@ -36,6 +36,8 @@ public:
virtual bool IsFailing(); virtual bool IsFailing();
virtual bool FailedEarlier(); virtual bool FailedEarlier();
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { };
void Refresh(); void Refresh();
private: private:
+3
View File
@@ -106,6 +106,7 @@ PrefsManager::PrefsManager()
// set to 0 so people aren't shocked at first // set to 0 so people aren't shocked at first
m_iProgressiveLifebar = 0; m_iProgressiveLifebar = 0;
m_iProgressiveNonstopLifebar = 0;
/* DDR Extreme-style extra stage support. /* DDR Extreme-style extra stage support.
* Default off so people used to the current behavior (or those with extra * Default off so people used to the current behavior (or those with extra
@@ -222,6 +223,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed ); ini.GetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed );
ini.GetValueI( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder ); ini.GetValueI( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder );
ini.GetValueI( "Options", "ProgressiveLifebar", (int&)m_iProgressiveLifebar ); ini.GetValueI( "Options", "ProgressiveLifebar", (int&)m_iProgressiveLifebar );
ini.GetValueI( "Options", "ProgressiveNonstopLifebar", (int&)m_iProgressiveNonstopLifebar );
ini.GetValueB( "Options", "UseUnlockSystem", m_bUseUnlockSystem ); ini.GetValueB( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
@@ -335,6 +337,7 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed ); ini.SetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed );
ini.SetValueI( "Options", "CourseSortOrder", m_iCourseSortOrder ); ini.SetValueI( "Options", "CourseSortOrder", m_iCourseSortOrder );
ini.SetValueI( "Options", "ProgressiveLifebar", m_iProgressiveLifebar ); ini.SetValueI( "Options", "ProgressiveLifebar", m_iProgressiveLifebar );
ini.SetValueI( "Options", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar );
/* Only write these if they aren't the default. This ensures that we can change /* Only write these if they aren't the default. This ensures that we can change
* the default and have it take effect for everyone (except people who * the default and have it take effect for everyone (except people who
+1
View File
@@ -84,6 +84,7 @@ public:
bool m_bDebugMode; bool m_bDebugMode;
bool m_bTenFooterInRed; bool m_bTenFooterInRed;
int m_iProgressiveLifebar; int m_iProgressiveLifebar;
int m_iProgressiveNonstopLifebar;
// course ranking // course ranking
enum { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder; enum { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder;
+5
View File
@@ -710,6 +710,11 @@ void ScreenGameplay::LoadNextSong()
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[p] ) // already failed if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[p] ) // already failed
ShowOniGameOver((PlayerNumber)p); ShowOniGameOver((PlayerNumber)p);
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);
}
m_DifficultyIcon[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] ); m_DifficultyIcon[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] );
+4
View File
@@ -31,6 +31,7 @@ enum {
MO_JUDGE_DIFFICULTY, MO_JUDGE_DIFFICULTY,
MO_LIFE_DIFFICULTY, MO_LIFE_DIFFICULTY,
MO_PROGRESSIVE_LIFEBAR, MO_PROGRESSIVE_LIFEBAR,
MO_PROG_NONSTOP_LIFEBAR,
MO_FAIL, MO_FAIL,
MO_SHOWSTATS, MO_SHOWSTATS,
MO_COINS_PER_CREDIT, MO_COINS_PER_CREDIT,
@@ -46,6 +47,7 @@ OptionRow g_MachineOptionsLines[NUM_MACHINE_OPTIONS_LINES] = {
OptionRow( "Judge\nDifficulty", "1","2","3","4","5","6","7","8" ), OptionRow( "Judge\nDifficulty", "1","2","3","4","5","6","7","8" ),
OptionRow( "Life\nDifficulty", "1","2","3","4","5","6","7" ), OptionRow( "Life\nDifficulty", "1","2","3","4","5","6","7" ),
OptionRow( "Progressive\nLifebar", "OFF","1","2","3","4","5","6","7","8"), OptionRow( "Progressive\nLifebar", "OFF","1","2","3","4","5","6","7","8"),
OptionRow( "Progressive\nNonstop Lifebar", "OFF","1","2","3","4"),
OptionRow( "Default\nFail Type", "ARCADE","END OF SONG","OFF" ), OptionRow( "Default\nFail Type", "ARCADE","END OF SONG","OFF" ),
OptionRow( "Show\nStats", "OFF","ON" ), OptionRow( "Show\nStats", "OFF","ON" ),
OptionRow( "Coins Per\nCredit", "1","2","3","4","5","6","7","8" ), OptionRow( "Coins Per\nCredit", "1","2","3","4","5","6","7","8" ),
@@ -104,6 +106,7 @@ void ScreenMachineOptions::ImportOptions()
SongOptions so; SongOptions so;
so.FromString( PREFSMAN->m_sDefaultModifiers ); so.FromString( PREFSMAN->m_sDefaultModifiers );
m_iSelectedOption[0][MO_PROGRESSIVE_LIFEBAR] = PREFSMAN->m_iProgressiveLifebar; m_iSelectedOption[0][MO_PROGRESSIVE_LIFEBAR] = PREFSMAN->m_iProgressiveLifebar;
m_iSelectedOption[0][MO_PROG_NONSTOP_LIFEBAR] = PREFSMAN->m_iProgressiveNonstopLifebar;
m_iSelectedOption[0][MO_FAIL] = so.m_FailType; m_iSelectedOption[0][MO_FAIL] = so.m_FailType;
m_iSelectedOption[0][MO_SHOWSTATS] = PREFSMAN->m_bShowStats ? 1:0; m_iSelectedOption[0][MO_SHOWSTATS] = PREFSMAN->m_bShowStats ? 1:0;
m_iSelectedOption[0][MO_COINS_PER_CREDIT] = PREFSMAN->m_iCoinsPerCredit - 1; m_iSelectedOption[0][MO_COINS_PER_CREDIT] = PREFSMAN->m_iCoinsPerCredit - 1;
@@ -123,6 +126,7 @@ void ScreenMachineOptions::ExportOptions()
PREFSMAN->m_bMenuTimer = m_iSelectedOption[0][MO_MENU_TIMER] == 1; PREFSMAN->m_bMenuTimer = m_iSelectedOption[0][MO_MENU_TIMER] == 1;
PREFSMAN->m_iNumArcadeStages = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] + 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_bEventMode = m_iSelectedOption[0][MO_NUM_ARCADE_STAGES] == 7;
PREFSMAN->m_iProgressiveNonstopLifebar = m_iSelectedOption[0][MO_PROG_NONSTOP_LIFEBAR];
switch( m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] ) switch( m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] )
{ {