fix GainLife command playing on wrong element
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "StatsManager.h"
|
#include "StatsManager.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include "Course.h"
|
||||||
|
|
||||||
static const CString GAIN_LIFE_COMMAND_NAME = "GainLife";
|
static const CString GAIN_LIFE_COMMAND_NAME = "GainLife";
|
||||||
|
|
||||||
@@ -73,7 +74,14 @@ void ScoreDisplayLifeTime::Update( float fDelta )
|
|||||||
|
|
||||||
void ScoreDisplayLifeTime::OnLoadSong()
|
void ScoreDisplayLifeTime::OnLoadSong()
|
||||||
{
|
{
|
||||||
m_textTimeRemaining.PlayCommand( GAIN_LIFE_COMMAND_NAME );
|
if( STATSMAN->m_CurStageStats.m_player[m_pPlayerState->m_PlayerNumber].bFailedEarlier )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
ASSERT( pCourse );
|
||||||
|
const CourseEntry *pEntry = &pCourse->m_entries[GAMESTATE->GetCourseSongIndex()];
|
||||||
|
|
||||||
|
PlayGainLoss( GAIN_LIFE_COMMAND_NAME, pEntry->fGainSeconds );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayLifeTime::OnSongEnded()
|
void ScoreDisplayLifeTime::OnSongEnded()
|
||||||
@@ -98,12 +106,7 @@ void ScoreDisplayLifeTime::OnJudgment( TapNoteScore tns )
|
|||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fMeterChange != 0 )
|
PlayGainLoss( TapNoteScoreToString(tns), fMeterChange );
|
||||||
{
|
|
||||||
CString s = ssprintf( fMeterChange>0 ? "%.0fms" : "-%.0fms",fMeterChange*1000);
|
|
||||||
m_textDeltaSeconds.SetText( s );
|
|
||||||
m_textDeltaSeconds.PlayCommand( TapNoteScoreToString(tns) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayLifeTime::OnJudgment( HoldNoteScore hns, TapNoteScore tns )
|
void ScoreDisplayLifeTime::OnJudgment( HoldNoteScore hns, TapNoteScore tns )
|
||||||
@@ -119,12 +122,22 @@ void ScoreDisplayLifeTime::OnJudgment( HoldNoteScore hns, TapNoteScore tns )
|
|||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fMeterChange != 0 )
|
PlayGainLoss( HoldNoteScoreToString(hns), fMeterChange );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScoreDisplayLifeTime::PlayGainLoss( const CString &sCommand, float fDeltaLifeSecs )
|
||||||
|
{
|
||||||
|
if( fDeltaLifeSecs != 0 )
|
||||||
{
|
{
|
||||||
CString s = ssprintf( fMeterChange>0 ? "%.0fms" : "-%.0fms",fMeterChange*1000);
|
CString s;
|
||||||
|
if( fabs(fDeltaLifeSecs) >= 1 )
|
||||||
|
s = ssprintf( fDeltaLifeSecs>0 ? "+%.0fsecs" : "-%.0fs",fDeltaLifeSecs);
|
||||||
|
else
|
||||||
|
s = ssprintf( fDeltaLifeSecs>0 ? "+%.0fms" : "-%.0fms",fDeltaLifeSecs*1000);
|
||||||
m_textDeltaSeconds.SetText( s );
|
m_textDeltaSeconds.SetText( s );
|
||||||
m_textDeltaSeconds.PlayCommand( HoldNoteScoreToString(hns) );
|
m_textDeltaSeconds.PlayCommand( sCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public:
|
|||||||
virtual void OnJudgment( HoldNoteScore score, TapNoteScore tscore );
|
virtual void OnJudgment( HoldNoteScore score, TapNoteScore tscore );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void PlayGainLoss( const CString &sCommand, float fDeltaLifeSecs );
|
||||||
|
|
||||||
AutoActor m_sprFrame;
|
AutoActor m_sprFrame;
|
||||||
BitmapText m_textTimeRemaining;
|
BitmapText m_textTimeRemaining;
|
||||||
BitmapText m_textDeltaSeconds;
|
BitmapText m_textDeltaSeconds;
|
||||||
|
|||||||
Reference in New Issue
Block a user