From aabb0604467675400bc3cfb497fe77a5507a9c8e Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 28 Nov 2011 22:13:30 -0600 Subject: [PATCH] [LifeMeterBattery] Added MaxLives metric, which limits the maximum amount of lives. Setting this to 0 will remove the limit. --- Docs/Changelog_sm5.txt | 2 ++ Themes/_fallback/metrics.ini | 2 ++ src/LifeMeterBattery.cpp | 3 +++ src/LifeMeterBattery.h | 1 + 4 files changed, 8 insertions(+) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 0f25708e2d..1b3eb9096f 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -14,6 +14,8 @@ StepMania 5.0 $next | 20111xxx if mods should be overridden on survival or not. Funny enough, this used to be true for the old Oni style mode, but...well, we'll cross that bridge later. [Wolfman2000] +* [LifeMeterBattery] Added MaxLives metric, which limits the maximum amount of + lives. Setting this to 0 will remove the limit. [AJ] 2011/11/27 ---------- diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 43774a6577..bceb348f49 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -573,6 +573,8 @@ OverY=0 # The bar that shows up in Oni mode. # any score below this one will cause you to lose a life. MinScoreToKeepLife='TapNoteScore_W3' +# Defines the maximum number of lives in the meter. (0 means no limit) +MaxLives=0 # how many lives you'll lose upon doing so. SubtractLives=1 # how many lives you'll lose hitting a mine diff --git a/src/LifeMeterBattery.cpp b/src/LifeMeterBattery.cpp index 34f63575e7..75f22fd569 100644 --- a/src/LifeMeterBattery.cpp +++ b/src/LifeMeterBattery.cpp @@ -24,6 +24,7 @@ void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats * PlayerNumber pn = pPlayerState->m_PlayerNumber; MIN_SCORE_TO_KEEP_LIFE.Load(sType, "MinScoreToKeepLife"); + MAX_LIVES.Load(sType, "MaxLives"); DANGER_THRESHOLD.Load(sType, "DangerThreshold"); SUBTRACT_LIVES.Load(sType, "SubtractLives"); MINES_SUBTRACT_LIVES.Load(sType, "MinesSubtractLives"); @@ -120,6 +121,8 @@ void LifeMeterBattery::AddLives( int iLives ) { if( iLives <= 0 ) return; + if( MAX_LIVES != 0 && m_iLivesLeft >= MAX_LIVES ) + return; m_iTrailingLivesLeft = m_iLivesLeft; m_iLivesLeft += iLives; diff --git a/src/LifeMeterBattery.h b/src/LifeMeterBattery.h index ebe96b83cb..34279924a1 100644 --- a/src/LifeMeterBattery.h +++ b/src/LifeMeterBattery.h @@ -47,6 +47,7 @@ private: ThemeMetric BATTERY_BLINK_TIME; ThemeMetric MIN_SCORE_TO_KEEP_LIFE; ThemeMetric DANGER_THRESHOLD; + ThemeMetric MAX_LIVES; ThemeMetric SUBTRACT_LIVES; ThemeMetric MINES_SUBTRACT_LIVES; ThemeMetric HELD_ADD_LIVES;