Added CourseSongRewardLives metric to LifeMeterBattery.

This commit is contained in:
Kyzentun
2014-08-06 15:26:54 -06:00
parent 6be879f06d
commit 6aad3c8f75
4 changed files with 16 additions and 1 deletions
+1
View File
@@ -13,6 +13,7 @@ StepMania current development
* [ScreenGameplay] LifeMeterChangedP1 message is no longer broadcast for for * [ScreenGameplay] LifeMeterChangedP1 message is no longer broadcast for for
P2's lifemeter. Use LifeMeterChangedP2. "Life" and "StepsSecond" are passed P2's lifemeter. Use LifeMeterChangedP2. "Life" and "StepsSecond" are passed
in the params table for the message. in the params table for the message.
* [LifeMeterBattery] CourseSongRewardLives metric added.
2013/10/09 2013/10/09
---------- ----------
+2
View File
@@ -672,6 +672,8 @@ MinesSubtractLives=1
HeldAddLives=0 HeldAddLives=0
# how many lives an unsuccessful hold will cost you. # how many lives an unsuccessful hold will cost you.
LetGoSubtractLives=1 LetGoSubtractLives=1
# this function returns how many lives to add when a song ends in course mode.
CourseSongRewardLives=function(life_meter, pn) if GAMESTATE:GetCurrentSteps(pn):GetMeter() >= 8 then return 2 end return 1 end
# How many lives trigger the "Danger" state. # How many lives trigger the "Danger" state.
DangerThreshold=1 DangerThreshold=1
+12 -1
View File
@@ -30,6 +30,7 @@ void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats *
MINES_SUBTRACT_LIVES.Load(sType, "MinesSubtractLives"); MINES_SUBTRACT_LIVES.Load(sType, "MinesSubtractLives");
HELD_ADD_LIVES.Load(sType, "HeldAddLives"); HELD_ADD_LIVES.Load(sType, "HeldAddLives");
LET_GO_SUBTRACT_LIVES.Load(sType, "LetGoSubtractLives"); LET_GO_SUBTRACT_LIVES.Load(sType, "LetGoSubtractLives");
COURSE_SONG_REWARD_LIVES.Load(sType, "CourseSongRewardLives");
LIVES_FORMAT.Load(sType, "NumLivesFormat"); LIVES_FORMAT.Load(sType, "NumLivesFormat");
@@ -89,7 +90,17 @@ void LifeMeterBattery::OnSongEnded()
if( pCourse && pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].iGainLives > -1 ) if( pCourse && pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].iGainLives > -1 )
m_iLivesLeft += pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].iGainLives; m_iLivesLeft += pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].iGainLives;
else else
m_iLivesLeft += ( GAMESTATE->m_pCurSteps[pn]->GetMeter()>=8 ? 2 : 1 ); {
Lua *L= LUA->Get();
COURSE_SONG_REWARD_LIVES.PushSelf(L);
PushSelf(L);
LuaHelpers::Push(L, pn);
RString error= "Error running CourseSongRewardLives callback: ";
LuaHelpers::RunScriptOnStack(L, error, 1, 1, true);
m_iLivesLeft += luaL_optnumber(L, -1, 0);
lua_settop(L, 0);
LUA->Release(L);
}
m_iLivesLeft = min( m_iLivesLeft, GAMESTATE->m_SongOptions.GetSong().m_iBatteryLives ); m_iLivesLeft = min( m_iLivesLeft, GAMESTATE->m_SongOptions.GetSong().m_iBatteryLives );
if( m_iTrailingLivesLeft < m_iLivesLeft ) if( m_iTrailingLivesLeft < m_iLivesLeft )
+1
View File
@@ -52,6 +52,7 @@ private:
ThemeMetric<int> MINES_SUBTRACT_LIVES; ThemeMetric<int> MINES_SUBTRACT_LIVES;
ThemeMetric<int> HELD_ADD_LIVES; ThemeMetric<int> HELD_ADD_LIVES;
ThemeMetric<int> LET_GO_SUBTRACT_LIVES; ThemeMetric<int> LET_GO_SUBTRACT_LIVES;
ThemeMetric<LuaReference> COURSE_SONG_REWARD_LIVES;
ThemeMetric<RString> LIVES_FORMAT; ThemeMetric<RString> LIVES_FORMAT;
AutoActor m_sprFrame; AutoActor m_sprFrame;