progressive lifebar for nonstop courses (4th stage harder than 1st stage, etc)
This commit is contained in:
@@ -36,6 +36,8 @@ public:
|
||||
virtual bool IsFailing() = 0;
|
||||
virtual bool FailedEarlier() = 0;
|
||||
|
||||
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) = 0;
|
||||
|
||||
protected:
|
||||
PlayerNumber m_PlayerNumber;
|
||||
};
|
||||
|
||||
@@ -247,6 +247,10 @@ LifeMeterBar::LifeMeterBar()
|
||||
m_fHotAlpha = 0;
|
||||
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.SetZoomX( (float)g_iMeterWidth );
|
||||
m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight );
|
||||
@@ -344,9 +348,9 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
|
||||
}
|
||||
|
||||
if( fDeltaLife > 0 )
|
||||
fDeltaLife *= PREFSMAN->m_fLifeDifficultyScale;
|
||||
fDeltaLife *= m_fLifeDifficulty;
|
||||
else
|
||||
fDeltaLife /= PREFSMAN->m_fLifeDifficultyScale;
|
||||
fDeltaLife /= m_fLifeDifficulty;
|
||||
|
||||
m_fLifePercentage += fDeltaLife;
|
||||
CLAMP( m_fLifePercentage, 0, 1 );
|
||||
@@ -463,6 +467,43 @@ void LifeMeterBar::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
|
||||
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
virtual bool IsFailing();
|
||||
virtual bool FailedEarlier();
|
||||
|
||||
void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty);
|
||||
|
||||
private:
|
||||
void ResetBarVelocity();
|
||||
|
||||
@@ -50,6 +52,9 @@ private:
|
||||
float m_fHotAlpha;
|
||||
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_iMissCombo; // current number of progressive boo/miss
|
||||
};
|
||||
|
||||
@@ -36,6 +36,8 @@ public:
|
||||
virtual bool IsFailing();
|
||||
virtual bool FailedEarlier();
|
||||
|
||||
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { };
|
||||
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
|
||||
@@ -106,6 +106,7 @@ PrefsManager::PrefsManager()
|
||||
|
||||
// set to 0 so people aren't shocked at first
|
||||
m_iProgressiveLifebar = 0;
|
||||
m_iProgressiveNonstopLifebar = 0;
|
||||
|
||||
/* DDR Extreme-style extra stage support.
|
||||
* 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.GetValueI( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder );
|
||||
ini.GetValueI( "Options", "ProgressiveLifebar", (int&)m_iProgressiveLifebar );
|
||||
ini.GetValueI( "Options", "ProgressiveNonstopLifebar", (int&)m_iProgressiveNonstopLifebar );
|
||||
|
||||
ini.GetValueB( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
|
||||
|
||||
@@ -335,6 +337,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", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar );
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
bool m_bDebugMode;
|
||||
bool m_bTenFooterInRed;
|
||||
int m_iProgressiveLifebar;
|
||||
int m_iProgressiveNonstopLifebar;
|
||||
|
||||
// course ranking
|
||||
enum { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder;
|
||||
|
||||
@@ -710,6 +710,11 @@ 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_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] );
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ enum {
|
||||
MO_JUDGE_DIFFICULTY,
|
||||
MO_LIFE_DIFFICULTY,
|
||||
MO_PROGRESSIVE_LIFEBAR,
|
||||
MO_PROG_NONSTOP_LIFEBAR,
|
||||
MO_FAIL,
|
||||
MO_SHOWSTATS,
|
||||
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( "Life\nDifficulty", "1","2","3","4","5","6","7" ),
|
||||
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( "Show\nStats", "OFF","ON" ),
|
||||
OptionRow( "Coins Per\nCredit", "1","2","3","4","5","6","7","8" ),
|
||||
@@ -104,6 +106,7 @@ void ScreenMachineOptions::ImportOptions()
|
||||
SongOptions so;
|
||||
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_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,6 +126,7 @@ void ScreenMachineOptions::ExportOptions()
|
||||
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];
|
||||
|
||||
switch( m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user