[LifeMeterBattery] Added some metrics that allow anyone to change how the battery meter handles lives.

* MinScoreToKeepLife='TapNoteScore_*' - any score below this = loss of life.
 * SubtractLives=1 - how many lives are lost when going below MinScoreToKeepLife.
 * MinesSubtractLives=1 - how many lives are lost when hitting a mine.
 * HeldAddLives=0 - how many lives are gained when a hold is completed.
 * LetGoSubtractLives=1 - how many lives are lost on a dropped hold.
This commit is contained in:
AJ Kelly
2011-06-13 01:39:23 -05:00
parent a070fc4c3e
commit 38ea269a10
4 changed files with 77 additions and 43 deletions
+9
View File
@@ -8,6 +8,15 @@ ________________________________________________________________________________
StepMania 5.0 Preview 2 | 20110??? StepMania 5.0 Preview 2 | 20110???
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2011/06/13
----------
* [LifeMeterBattery] Added some important metrics. [AJ]
* MinScoreToKeepLife='TapNoteScore_*' - any score below this = loss of life.
* SubtractLives=1 - how many lives are lost when going below MinScoreToKeepLife.
* MinesSubtractLives=1 - how many lives are lost when hitting a mine.
* HeldAddLives=0 - how many lives are gained when a hold is completed.
* LetGoSubtractLives=1 - how many lives are lost on a dropped hold.
2011/06/12 2011/06/12
---------- ----------
* [ScreenNetSelectMusic] Add PlayerOptionsScreen metric. [AJ] * [ScreenNetSelectMusic] Add PlayerOptionsScreen metric. [AJ]
+12 -1
View File
@@ -606,6 +606,16 @@ OverY=0
[LifeMeterBattery] [LifeMeterBattery]
# The bar that shows up in Oni mode. # The bar that shows up in Oni mode.
# any score below this one will cause you to lose a life.
MinScoreToKeepLife='TapNoteScore_W3'
# how many lives you'll lose upon doing so.
SubtractLives=1
# how many lives you'll lose hitting a mine
MinesSubtractLives=1
# how many lives a successful hold will net you.
HeldAddLives=0
# how many lives an unsuccessful hold will cost you.
LetGoSubtractLives=1
# How long it flashes when you lose a life. # How long it flashes when you lose a life.
BatteryBlinkTime=1.2 BatteryBlinkTime=1.2
@@ -614,7 +624,8 @@ BatteryP1X=-92
BatteryP1Y=2 BatteryP1Y=2
BatteryP2X=92 BatteryP2X=92
BatteryP2Y=2 BatteryP2Y=2
# Where your live count is # Where your life count is
NumLivesFormat="x%d"
NumLivesP1X=-92 NumLivesP1X=-92
NumLivesP1Y=0 NumLivesP1Y=0
NumLivesP2X=92 NumLivesP2X=92
+40 -34
View File
@@ -26,6 +26,13 @@ void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats *
const RString sType = "LifeMeterBattery"; const RString sType = "LifeMeterBattery";
PlayerNumber pn = pPlayerState->m_PlayerNumber; PlayerNumber pn = pPlayerState->m_PlayerNumber;
MIN_SCORE_TO_KEEP_LIFE.Load(sType, "MinScoreToKeepLife");
SUBTRACT_LIVES.Load(sType, "SubtractLives");
MINES_SUBTRACT_LIVES.Load(sType, "MinesSubtractLives");
HELD_ADD_LIVES.Load(sType, "HeldAddLives");
LET_GO_SUBTRACT_LIVES.Load(sType, "LetGoSubtractLives");
LIVES_FORMAT.Load(sType, "NumLivesFormat");
BATTERY_BLINK_TIME.Load(sType, "BatteryBlinkTime"); // 1.2f by default BATTERY_BLINK_TIME.Load(sType, "BatteryBlinkTime"); // 1.2f by default
bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled( pPlayerState ); bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled( pPlayerState );
@@ -101,24 +108,10 @@ void LifeMeterBattery::OnSongEnded()
Refresh(); Refresh();
} }
void LifeMeterBattery::ChangeLife( TapNoteScore score ) void LifeMeterBattery::SubtractLives( int iLives )
{ {
if( m_iLivesLeft == 0 )
return;
// todo: let the themer decide how this is handled. -aj
switch( score )
{
case TNS_W1:
case TNS_W2:
case TNS_W3:
break;
case TNS_W4:
case TNS_W5:
case TNS_Miss:
case TNS_HitMine:
m_iTrailingLivesLeft = m_iLivesLeft; m_iTrailingLivesLeft = m_iLivesLeft;
m_iLivesLeft--; m_iLivesLeft -= iLives;
m_soundLoseLife.Play(); m_soundLoseLife.Play();
m_textNumLives.PlayCommand("LoseLife"); m_textNumLives.PlayCommand("LoseLife");
@@ -130,13 +123,31 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
Refresh(); Refresh();
m_fBatteryBlinkTime = BATTERY_BLINK_TIME; m_fBatteryBlinkTime = BATTERY_BLINK_TIME;
break; }
default:
break; void LifeMeterBattery::AddLives( int iLives )
/* {
// xxx: this doesn't handle hold checkpoints. m_iTrailingLivesLeft = m_iLivesLeft;
ASSERT(0); m_iLivesLeft += iLives;
*/ m_soundGainLife.Play();
m_textNumLives.PlayCommand("GainLife");
Refresh();
m_fBatteryBlinkTime = 0;
}
void LifeMeterBattery::ChangeLife( TapNoteScore score )
{
if( m_iLivesLeft == 0 )
return;
// this probably doesn't handle hold checkpoints. -aj
if( score == TNS_HitMine && MINES_SUBTRACT_LIVES > 0 )
SubtractLives(MINES_SUBTRACT_LIVES);
else
{
if( score < MIN_SCORE_TO_KEEP_LIFE && SUBTRACT_LIVES > 0 )
SubtractLives(SUBTRACT_LIVES);
} }
Message msg( "LifeChanged" ); Message msg( "LifeChanged" );
@@ -148,16 +159,10 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore ) void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
{ {
switch( score ) if( score == HNS_Held && HELD_ADD_LIVES > 0 )
{ AddLives(HELD_ADD_LIVES);
case HNS_Held: if( score == HNS_LetGo && LET_GO_SUBTRACT_LIVES > 0 )
break; SubtractLives(LET_GO_SUBTRACT_LIVES);
case HNS_LetGo:
ChangeLife( TNS_Miss ); // LetGo is the same as a miss
break;
default:
ASSERT(0);
}
} }
void LifeMeterBattery::HandleTapScoreNone() void LifeMeterBattery::HandleTapScoreNone()
@@ -208,7 +213,8 @@ void LifeMeterBattery::Refresh()
} }
else else
{ {
m_textNumLives.SetText( ssprintf("x%d", m_iLivesLeft-1) ); //m_textNumLives.SetText( ssprintf("x%d", m_iLivesLeft-1) );
m_textNumLives.SetText( ssprintf(LIVES_FORMAT.GetValue(), m_iLivesLeft-1) );
m_sprBattery.SetState( 3 ); m_sprBattery.SetState( 3 );
} }
} }
+9 -1
View File
@@ -37,13 +37,21 @@ public:
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
private: private:
void SubtractLives( int iLives );
void AddLives( int iLives );
int m_iLivesLeft; // dead when 0 int m_iLivesLeft; // dead when 0
int m_iTrailingLivesLeft; // lags m_iLivesLeft int m_iTrailingLivesLeft; // lags m_iLivesLeft
float m_fBatteryBlinkTime; // if > 0 battery is blinking float m_fBatteryBlinkTime; // if > 0 battery is blinking
// theme metrics added for sm-ssc
ThemeMetric<float> BATTERY_BLINK_TIME; ThemeMetric<float> BATTERY_BLINK_TIME;
ThemeMetric<TapNoteScore> MIN_SCORE_TO_KEEP_LIFE;
ThemeMetric<int> SUBTRACT_LIVES;
ThemeMetric<int> MINES_SUBTRACT_LIVES;
ThemeMetric<int> HELD_ADD_LIVES;
ThemeMetric<int> LET_GO_SUBTRACT_LIVES;
ThemeMetric<RString> LIVES_FORMAT;
AutoActor m_sprFrame; AutoActor m_sprFrame;
Sprite m_sprBattery; Sprite m_sprBattery;