eb57807: use MercifulDrain logic for MercifulBeginner [Chris Danford]

This commit is contained in:
AJ Kelly
2010-07-02 10:49:36 -05:00
parent b28c1a3556
commit 2930461611
2 changed files with 21 additions and 27 deletions
+13 -20
View File
@@ -94,16 +94,11 @@ void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPla
PlayerNumber pn = pPlayerState->m_PlayerNumber; PlayerNumber pn = pPlayerState->m_PlayerNumber;
// Change life difficulty to really easy if merciful beginner on // Change life difficulty to really easy if merciful beginner on
bool bMercifulBeginnerInEffect = bMercifulBeginnerInEffect =
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
GAMESTATE->IsPlayerEnabled( pPlayerState ) && GAMESTATE->IsPlayerEnabled( pPlayerState ) &&
GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == Difficulty_Beginner && GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == Difficulty_Beginner &&
PREFSMAN->m_bMercifulBeginner; PREFSMAN->m_bMercifulBeginner;
if( bMercifulBeginnerInEffect )
{
m_fBaseLifeDifficulty = 1.5f;
m_fLifeDifficulty = m_fBaseLifeDifficulty;
}
AfterLifeChanged(); AfterLifeChanged();
} }
@@ -156,7 +151,7 @@ void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
case SongOptions::DRAIN_NORMAL: case SongOptions::DRAIN_NORMAL:
switch( score ) switch( score )
{ {
case HNS_Held: fDeltaLife = m_fLifePercentChange.GetValue(SE_Held); break; case HNS_Held: fDeltaLife = m_fLifePercentChange.GetValue(SE_Held); break;
case HNS_LetGo: fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo); break; case HNS_LetGo: fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo); break;
default: default:
ASSERT(0); ASSERT(0);
@@ -167,7 +162,7 @@ void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
case SongOptions::DRAIN_NO_RECOVER: case SongOptions::DRAIN_NO_RECOVER:
switch( score ) switch( score )
{ {
case HNS_Held: fDeltaLife = +0.000f; break; case HNS_Held: fDeltaLife = +0.000f; break;
case HNS_LetGo: fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo); break; case HNS_LetGo: fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo); break;
default: default:
ASSERT(0); ASSERT(0);
@@ -177,7 +172,7 @@ void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
switch( score ) switch( score )
{ {
case HNS_Held: fDeltaLife = +0; break; case HNS_Held: fDeltaLife = +0; break;
case HNS_LetGo: fDeltaLife = -1.0; break; case HNS_LetGo: fDeltaLife = -1.0; break;
default: default:
ASSERT(0); ASSERT(0);
} }
@@ -191,8 +186,9 @@ void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
void LifeMeterBar::ChangeLife( float fDeltaLife ) void LifeMeterBar::ChangeLife( float fDeltaLife )
{ {
if( PREFSMAN->m_bMercifulDrain && fDeltaLife < 0 ) bool bUseMercifulDrain = m_bMercifulBeginnerInEffect || PREFSMAN->m_bMercifulDrain;
fDeltaLife *= SCALE( m_fLifePercentage, 0.f, 1.f, 0.5f, 1.f); if( bUseMercifulDrain && fDeltaLife < 0 )
fDeltaLife *= 0.4f;
// handle progressiveness and ComboToRegainLife here // handle progressiveness and ComboToRegainLife here
if( fDeltaLife >= 0 ) if( fDeltaLife >= 0 )
@@ -205,13 +201,12 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
else else
{ {
fDeltaLife *= 1 + (float)m_iProgressiveLifebar/8 * m_iMissCombo; fDeltaLife *= 1 + (float)m_iProgressiveLifebar/8 * m_iMissCombo;
// do this after; only successive W5/miss will // do this after; only successive W5/miss will increase the amount of life lost.
// increase the amount of life lost.
m_iMissCombo++; m_iMissCombo++;
m_iComboToRegainLife = PREFSMAN->m_iRegenComboAfterMiss; m_iComboToRegainLife = PREFSMAN->m_iRegenComboAfterMiss;
} }
/* If we've already failed, there's no point in letting them fill up the bar again. */ // If we've already failed, there's no point in letting them fill up the bar again.
if( m_pPlayerStageStats->m_bFailed ) if( m_pPlayerStageStats->m_bFailed )
return; return;
@@ -311,8 +306,9 @@ void LifeMeterBar::UpdateNonstopLifebar()
// if (iTotal == 0) iTotal = 1; // no division by 0 // if (iTotal == 0) iTotal = 1; // no division by 0
if( GAMESTATE->IsAnExtraStage() ) if( GAMESTATE->IsAnExtraStage() )
{ // extra stage is its own thing, should not be progressive {
// and it should be as difficult as life 4 // extra stage is its own thing, should not be progressive
// and it should be as difficult as life 4
// (e.g. it should not depend on life settings) // (e.g. it should not depend on life settings)
m_iProgressiveLifebar = 0; m_iProgressiveLifebar = 0;
@@ -328,8 +324,7 @@ void LifeMeterBar::UpdateNonstopLifebar()
if( m_fLifeDifficulty >= 0.4f ) if( m_fLifeDifficulty >= 0.4f )
return; return;
/* /* Approximate deductions for a miss
* Approximate deductions for a miss
* Life 1 : 5 % * Life 1 : 5 %
* Life 2 : 5.7 % * Life 2 : 5.7 %
* Life 3 : 6.6 % * Life 3 : 6.6 %
@@ -353,11 +348,9 @@ void LifeMeterBar::UpdateNonstopLifebar()
* Everything past 7 is intended mainly for nonstop mode. * Everything past 7 is intended mainly for nonstop mode.
*/ */
// the lifebar is pretty harsh at 0.4 already (you lose // the lifebar is pretty harsh at 0.4 already (you lose
// about 20% of your lifebar); at 0.2 it would be 40%, which // about 20% of your lifebar); at 0.2 it would be 40%, which
// is too harsh at one difficulty level higher. Override. // is too harsh at one difficulty level higher. Override.
int iLifeDifficulty = int( (1.8f - m_fLifeDifficulty)/0.2f ); int iLifeDifficulty = int( (1.8f - m_fLifeDifficulty)/0.2f );
// first eight values don't matter // first eight values don't matter
+7 -6
View File
@@ -44,16 +44,17 @@ private:
AutoActor m_sprUnder; AutoActor m_sprUnder;
AutoActor m_sprDanger; AutoActor m_sprDanger;
StreamDisplay* m_pStream; StreamDisplay* m_pStream;
AutoActor m_sprOver; AutoActor m_sprOver;
float m_fLifePercentage; float m_fLifePercentage;
float m_fPassingAlpha; float m_fPassingAlpha;
float m_fHotAlpha; float m_fHotAlpha;
float m_fBaseLifeDifficulty; bool m_bMercifulBeginnerInEffect;
float m_fLifeDifficulty; // essentially same as pref 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 W5/miss int m_iMissCombo; // current number of progressive W5/miss