try to simplify this UpdateNonstopLifebar stuff (which seems to have

nothing to do with Nonstop).  This stuff is very tweaky and should
probably be broken out into Lua or something.
This commit is contained in:
Glenn Maynard
2006-11-09 04:58:03 +00:00
parent c865444202
commit 133344a15f
6 changed files with 27 additions and 24 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ public:
virtual bool IsHot() const = 0;
virtual bool IsFailing() const = 0;
virtual float GetLife() const { return 0; } // for cosmetic use only
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) = 0;
virtual void UpdateNonstopLifebar() { }
static LifeMeter *MakeLifeMeter( SongOptions::LifeType t );
+23 -1
View File
@@ -329,8 +329,30 @@ void LifeMeterBar::DrawPrimitives()
ActorFrame::DrawPrimitives();
}
#include "RageLog.h"
void LifeMeterBar::UpdateNonstopLifebar( const int cleared, const int total, int ProgressiveLifebarDifficulty )
#include "Course.h"
void LifeMeterBar::UpdateNonstopLifebar()
{
int cleared, total, ProgressiveLifebarDifficulty;
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_REGULAR:
if( GAMESTATE->IsEventMode() || GAMESTATE->m_bDemonstrationOrJukebox )
return;
cleared = GAMESTATE->GetStageIndex();
total = PREFSMAN->m_iSongsPerPlay;
ProgressiveLifebarDifficulty = PREFSMAN->m_iProgressiveStageLifebar;
break;
case PLAY_MODE_NONSTOP:
cleared = GAMESTATE->GetCourseSongIndex();
total = GAMESTATE->m_pCurCourse->GetEstimatedNumStages();
ProgressiveLifebarDifficulty = PREFSMAN->m_iProgressiveNonstopLifebar;
break;
default:
return;
}
// if (cleared > total) cleared = total; // clear/total <= 1
// if (total == 0) total = 1; // no division by 0
+1 -1
View File
@@ -30,7 +30,7 @@ public:
virtual bool IsFailing() const;
virtual float GetLife() const { return m_fLifePercentage; }
void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty);
void UpdateNonstopLifebar();
void FillForHowToPlay(int NumT2s, int NumMisses);
// this function is solely for HowToPlay
-1
View File
@@ -28,7 +28,6 @@ public:
virtual bool IsHot() const;
virtual bool IsFailing() const;
virtual float GetLife() const;
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { };
void Refresh();
-1
View File
@@ -30,7 +30,6 @@ public:
virtual bool IsHot() const;
virtual bool IsFailing() const;
virtual float GetLife() const;
virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { };
private:
float GetLifeSeconds() const;
+2 -19
View File
@@ -1086,25 +1086,8 @@ void ScreenGameplay::LoadNextSong()
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BATTERY && pi->GetPlayerStageStats()->bFailed ) // already failed
pi->ShowOniGameOver();
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR &&
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
!GAMESTATE->IsEventMode() &&
!GAMESTATE->m_bDemonstrationOrJukebox )
{
if( pi->m_pLifeMeter )
pi->m_pLifeMeter->UpdateNonstopLifebar(
GAMESTATE->GetStageIndex(),
PREFSMAN->m_iSongsPerPlay,
PREFSMAN->m_iProgressiveStageLifebar);
}
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP )
{
if( pi->m_pLifeMeter )
pi->m_pLifeMeter->UpdateNonstopLifebar(
GAMESTATE->GetCourseSongIndex(),
GAMESTATE->m_pCurCourse->GetEstimatedNumStages(),
PREFSMAN->m_iProgressiveNonstopLifebar);
}
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR && pi->m_pLifeMeter )
pi->m_pLifeMeter->UpdateNonstopLifebar();
if( pi->m_pDifficultyIcon )
pi->m_pDifficultyIcon->SetFromSteps( pi->GetStepsAndTrailIndex(), pSteps );