Adds metric options to flash the lifebar when a note is hit and a function for sprite to set all the delays in all of the states in one shot.

This commit is contained in:
Andrew Livy
2009-05-18 20:14:33 +00:00
parent 89e81956d0
commit e27e971b94
6 changed files with 32 additions and 2 deletions
+2
View File
@@ -1792,6 +1792,8 @@ InitialValue=0.5
HotValue=1.0
LifeMultiplier=1.0
MinStayAlive="TapNoteScore_W3"
FlashHotOnNoteHit=false
MinScoreToFlash="TapNoteScore_W3"
LifePercentChangeW1=0.008
LifePercentChangeW2=0.008
LifePercentChangeW3=0.004
+9
View File
@@ -27,8 +27,12 @@ LifeMeterBar::LifeMeterBar()
MIN_STAY_ALIVE.Load ("LifeMeterBar","MinStayAlive");
m_fLifePercentChange.Load( "LifeMeterBar", LIFE_PERCENT_CHANGE_NAME, NUM_ScoreEvent );
FLASH_HOT_ON_NOTE_HIT.Load("LifeMeterBar","FlashHotOnNoteHit");
MIN_SCORE_TO_FLASH.Load("LifeMeterBar","MinScoreToFlash");
m_pPlayerState = NULL;
switch( GAMESTATE->m_SongOptions.GetStage().m_DrainType )
{
case SongOptions::DRAIN_NORMAL:
@@ -125,6 +129,11 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
case TNS_CheckpointHit: fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointHit); break;
case TNS_CheckpointMiss:fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointMiss); break;
}
if(FLASH_HOT_ON_NOTE_HIT)
if(score >= MIN_SCORE_TO_FLASH)
m_fHotAlpha = 1.0f; // flash the hot temporarily
if( IsHot() && fDeltaLife < 0 )
fDeltaLife = min( fDeltaLife, -0.10f ); // make it take a while to get back to "hot"
+3
View File
@@ -59,6 +59,9 @@ private:
int m_iMissCombo; // current number of progressive W5/miss
int m_iComboToRegainLife; // combo needed before lifebar starts filling up after fail
ThemeMetric<TapNoteScore> MIN_SCORE_TO_FLASH;
ThemeMetric<bool> FLASH_HOT_ON_NOTE_HIT;
};
#endif
+8
View File
@@ -70,6 +70,14 @@ void Sprite::InitState()
m_bSkipNextUpdate = true;
}
void Sprite::SetAllStateDelays(float fDelay)
{
for(unsigned int i=0;i<m_States.size();i++)
{
m_States[i].fDelay = fDelay;
}
}
RageTextureID Sprite::SongBGTexture( RageTextureID ID )
{
ID.bMipMaps = true;
+2
View File
@@ -70,6 +70,8 @@ public:
//
virtual void PushSelf( lua_State *L );
void SetAllStateDelays(float fDelay);
protected:
void LoadFromTexture( RageTextureID ID );
+8 -2
View File
@@ -49,7 +49,14 @@ void StreamDisplay::Load( const RString &_sMetricsGroup )
Sprite *pSpr = new Sprite;
if(m_bUsingThreePart)
{
pSpr->Load( THEME->GetPathG(sMetricsGroup,ssprintf("%s part%d",StreamTypeToString(st).c_str(),i) ) );
if(pSpr->GetNumStates() > 1)
{
pSpr->SetAllStateDelays(THEME->GetMetricF(sMetricsGroup,ssprintf("%spart%ddelay",StreamTypeToString(st).c_str(),i)));
}
}
else
pSpr->Load( THEME->GetPathG(sMetricsGroup,StreamTypeToString(st)) );
m_vpSprPill[st].push_back( pSpr );
@@ -67,9 +74,8 @@ void StreamDisplay::Load( const RString &_sMetricsGroup )
if(m_bUsingThreePart)
{
m_fThreePartWidth = THEME->GetMetricF(sMetricsGroup,"ThreePartWidth");
float fCroppedWidthRight = (1-m_vpSprPill[st][0]->GetCropRight())*m_vpSprPill[st][0]->GetZoomedWidth();
// first element positioned depending on metric width specified
m_vpSprPill[st][0]->AddX(-(m_fThreePartWidth/2 + m_vpSprPill[st][0]->GetZoomedWidth()/2) + fCroppedWidthRight);
m_vpSprPill[st][0]->AddX(-(m_fThreePartWidth/2 + m_vpSprPill[st][0]->GetZoomedWidth()/2));
}
}
}