Right, late night merge.

This commit is contained in:
Jason Felds
2011-06-13 03:43:54 -04:00
4 changed files with 91 additions and 45 deletions
+10
View File
@@ -8,6 +8,16 @@ ________________________________________________________________________________
StepMania 5.0 Preview 2 | 20110???
--------------------------------------------------------------------------------
2011/06/13
----------
* [LifeMeterBattery] Added DangerThreshold metric. [AJ]
* [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
----------
* [ScreenNetSelectMusic] Add PlayerOptionsScreen metric. [AJ]
+18 -1
View File
@@ -606,7 +606,19 @@ OverY=0
[LifeMeterBattery]
# 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 many lives trigger the "Danger" state.
DangerThreshold=1
# How long it flashes when you lose a life.
BatteryBlinkTime=1.2
# Where the batteries are
@@ -614,11 +626,16 @@ BatteryP1X=-92
BatteryP1Y=2
BatteryP2X=92
BatteryP2Y=2
# Where your live count is
# Where your life count is
NumLivesFormat="x%d"
NumLivesP1X=-92
NumLivesP1Y=0
NumLivesP1GainLifeCommand=
NumLivesP1LoseLifeCommand=zoom,1.5;linear,0.15;zoom,1
NumLivesP2X=92
NumLivesP2Y=0
NumLivesP2GainLifeCommand=
NumLivesP2LoseLifeCommand=zoom,1.5;linear,0.15;zoom,1
[LifeMeterBattery Percent]
# The percentage on the bar. I wouldn't even bother changing this, because I
+53 -43
View File
@@ -26,6 +26,14 @@ void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats *
const RString sType = "LifeMeterBattery";
PlayerNumber pn = pPlayerState->m_PlayerNumber;
MIN_SCORE_TO_KEEP_LIFE.Load(sType, "MinScoreToKeepLife");
DANGER_THRESHOLD.Load(sType, "DangerThreshold");
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
bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled( pPlayerState );
@@ -101,42 +109,46 @@ void LifeMeterBattery::OnSongEnded()
Refresh();
}
void LifeMeterBattery::SubtractLives( int iLives )
{
if( iLives <= 0 )
return;
m_iTrailingLivesLeft = m_iLivesLeft;
m_iLivesLeft -= iLives;
m_soundLoseLife.Play();
m_textNumLives.PlayCommand("LoseLife");
Refresh();
m_fBatteryBlinkTime = BATTERY_BLINK_TIME;
}
void LifeMeterBattery::AddLives( int iLives )
{
if( iLives <= 0 )
return;
m_iTrailingLivesLeft = m_iLivesLeft;
m_iLivesLeft += iLives;
m_soundGainLife.Play();
m_textNumLives.PlayCommand("GainLife");
Refresh();
m_fBatteryBlinkTime = 0;
}
void LifeMeterBattery::ChangeLife( TapNoteScore score )
{
if( m_iLivesLeft == 0 )
return;
// todo: let the themer decide how this is handled. -aj
switch( score )
// this probably doesn't handle hold checkpoints. -aj
if( score == TNS_HitMine && MINES_SUBTRACT_LIVES > 0 )
SubtractLives(MINES_SUBTRACT_LIVES);
else
{
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_iLivesLeft--;
m_soundLoseLife.Play();
m_textNumLives.PlayCommand("LoseLife");
/*
m_textNumLives.SetZoom( 1.5f );
m_textNumLives.BeginTweening( 0.15f );
m_textNumLives.SetZoom( 1.0f );
*/
Refresh();
m_fBatteryBlinkTime = BATTERY_BLINK_TIME;
break;
default:
break;
/*
// xxx: this doesn't handle hold checkpoints.
ASSERT(0);
*/
if( score < MIN_SCORE_TO_KEEP_LIFE && SUBTRACT_LIVES > 0 )
SubtractLives(SUBTRACT_LIVES);
}
Message msg( "LifeChanged" );
@@ -148,16 +160,13 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
{
switch( score )
{
case HNS_Held:
break;
case HNS_LetGo:
ChangeLife( TNS_Miss ); // LetGo is the same as a miss
break;
default:
ASSERT(0);
}
if( m_iLivesLeft == 0 )
return;
if( score == HNS_Held && HELD_ADD_LIVES > 0 )
AddLives(HELD_ADD_LIVES);
if( score == HNS_LetGo && LET_GO_SUBTRACT_LIVES > 0 )
SubtractLives(LET_GO_SUBTRACT_LIVES);
}
void LifeMeterBattery::HandleTapScoreNone()
@@ -171,12 +180,12 @@ void LifeMeterBattery::ChangeLife( float fDeltaLifePercent )
bool LifeMeterBattery::IsInDanger() const
{
return false;
return m_iLivesLeft < DANGER_THRESHOLD;
}
bool LifeMeterBattery::IsHot() const
{
return false;
return m_iLivesLeft == GAMESTATE->m_SongOptions.GetSong().m_iBatteryLives;
}
bool LifeMeterBattery::IsFailing() const
@@ -208,7 +217,8 @@ void LifeMeterBattery::Refresh()
}
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 );
}
}
+10 -1
View File
@@ -37,13 +37,22 @@ public:
virtual void PushSelf( lua_State *L );
private:
void SubtractLives( int iLives );
void AddLives( int iLives );
int m_iLivesLeft; // dead when 0
int m_iTrailingLivesLeft; // lags m_iLivesLeft
float m_fBatteryBlinkTime; // if > 0 battery is blinking
// theme metrics added for sm-ssc
ThemeMetric<float> BATTERY_BLINK_TIME;
ThemeMetric<TapNoteScore> MIN_SCORE_TO_KEEP_LIFE;
ThemeMetric<int> DANGER_THRESHOLD;
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;
Sprite m_sprBattery;