From c8e99cc18bc65c8020231e82c671d40154fd3bac Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 12 Dec 2011 22:13:32 -0600 Subject: [PATCH] [LifeMeterBattery] Fixed various issues (lives not fully disappearing on fail, P2 lose life animation having the wrong x zoom, hide the lives number if it falls below 0). --- Docs/Changelog_sm5.txt | 3 +++ .../Graphics/LifeMeterBattery lives/default.lua | 8 ++++++-- Themes/default/metrics.ini | 1 + src/LifeMeterBattery.cpp | 10 +++++----- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 06c2e0177a..3594673dfb 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -13,6 +13,9 @@ StepMania 5.0 $next | 20111xxx * [ScreenEdit] Add the GAMESTATE:InStepEditor LUA binding. [Wolfman2000] * [Player, ScreenGameplay] Allow failing on Oni without crashing. This one took awhile. [Wolfman2000] +* [LifeMeterBattery] Fixed various issues (lives not fully disappearing on fail, + P2 lose life animation having the wrong x zoom, hide the lives number if it + falls below 0). [AJ] 2011/12/11 ---------- diff --git a/Themes/default/Graphics/LifeMeterBattery lives/default.lua b/Themes/default/Graphics/LifeMeterBattery lives/default.lua index adcc839a62..8a5f507f38 100644 --- a/Themes/default/Graphics/LifeMeterBattery lives/default.lua +++ b/Themes/default/Graphics/LifeMeterBattery lives/default.lua @@ -3,14 +3,18 @@ local blinkTime = 1.2 local t = Def.ActorFrame{ LoadActor("_lives")..{ - -- xxx: assumes course is 4lives + -- xxx: assumes course is 4lives (or more) InitCommand=cmd(pause;setstate,3); LifeChangedMessageCommand=function(self,param) if param.Player == player then - if param.LivesLeft <= 4 then + if param.LivesLeft == 0 then + self:visible(false) + elseif param.LivesLeft <= 4 then self:setstate( math.max(param.LivesLeft-1,0) ) + self:visible(true) else self:setstate(3) + self:visible(true) end end end; diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 0d246b3dce..1cebb985be 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -136,6 +136,7 @@ BatteryP2X=0 BatteryP2Y=0 # NumLivesP2OnCommand=zoomx,-1 +NumLivesP2LoseLifeCommand=zoomx,-1.5;zoomy,1.5;linear,0.15;zoomx,-1;zoomy,1 [LifeMeterBattery Percent] # still asking for this even though it's in fallback... -aj diff --git a/src/LifeMeterBattery.cpp b/src/LifeMeterBattery.cpp index 75f22fd569..d880343fab 100644 --- a/src/LifeMeterBattery.cpp +++ b/src/LifeMeterBattery.cpp @@ -49,11 +49,6 @@ void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats * m_textNumLives.LoadFromFont( THEME->GetPathF(sType, "lives") ); m_textNumLives.SetName( ssprintf("NumLivesP%i",int(pn+1)) ); - // old hardcoded commands: - /* - m_textNumLives.SetDiffuse( RageColor(1,1,1,1) ); - m_textNumLives.SetShadowLength( 0 ); - */ if( bPlayerEnabled ) { ActorUtil::LoadAllCommandsAndSetXY( m_textNumLives, sType ); @@ -232,6 +227,11 @@ int LifeMeterBattery::GetRemainingLives() const void LifeMeterBattery::Refresh() { m_textNumLives.SetText( ssprintf(LIVES_FORMAT.GetValue(), m_iLivesLeft-1) ); + if( m_iLivesLeft-1 < 0 ) + { + // hide text to avoid showing -1 + m_textNumLives.SetVisible(false); + } //update m_sprBattery }