only save life and combo for the range of time between the first and last step
This commit is contained in:
@@ -17,7 +17,7 @@ void ComboGraph::Load( const CString& sScreen, const CString& sElement, const St
|
|||||||
ASSERT( m_SubActors.size() == 0 );
|
ASSERT( m_SubActors.size() == 0 );
|
||||||
|
|
||||||
const float fFirstSecond = 0;
|
const float fFirstSecond = 0;
|
||||||
const float fLastSecond = s.GetTotalPossibleMusicLengthSeconds();
|
const float fLastSecond = s.GetTotalPossibleStepsSeconds();
|
||||||
|
|
||||||
/* Find the largest combo. */
|
/* Find the largest combo. */
|
||||||
int MaxComboSize = 0;
|
int MaxComboSize = 0;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void GraphDisplay::LoadFromStageStats( const StageStats &ss, const PlayerStageSt
|
|||||||
{
|
{
|
||||||
memcpy( m_LastValues, m_CurValues, sizeof(m_CurValues) );
|
memcpy( m_LastValues, m_CurValues, sizeof(m_CurValues) );
|
||||||
m_Position = 0;
|
m_Position = 0;
|
||||||
pss.GetLifeRecord( m_DestValues, VALUE_RESOLUTION, ss.GetTotalPossibleMusicLengthSeconds() );
|
pss.GetLifeRecord( m_DestValues, VALUE_RESOLUTION, ss.GetTotalPossibleStepsSeconds() );
|
||||||
for( unsigned i=0; i<ARRAYSIZE(m_DestValues); i++ )
|
for( unsigned i=0; i<ARRAYSIZE(m_DestValues); i++ )
|
||||||
CLAMP( m_DestValues[i], 0.f, 1.f );
|
CLAMP( m_DestValues[i], 0.f, 1.f );
|
||||||
UpdateVerts();
|
UpdateVerts();
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ void LifeMeterTime::ForceFail()
|
|||||||
|
|
||||||
float LifeMeterTime::GetLifeSeconds() const
|
float LifeMeterTime::GetLifeSeconds() const
|
||||||
{
|
{
|
||||||
float fSecs = m_fLifeTotalGainedSeconds - (m_fLifeTotalLostSeconds + STATSMAN->m_CurStageStats.fGameplaySeconds);
|
float fSecs = m_fLifeTotalGainedSeconds - (m_fLifeTotalLostSeconds + STATSMAN->m_CurStageStats.fStepsSeconds);
|
||||||
return fSecs;
|
return fSecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1458,7 +1458,7 @@ void Player::HandleTapRowScore( unsigned row )
|
|||||||
* GAMESTATE->m_fMusicSeconds. Use fGameplaySeconds instead.
|
* GAMESTATE->m_fMusicSeconds. Use fGameplaySeconds instead.
|
||||||
*/
|
*/
|
||||||
if( m_pPlayerStageStats )
|
if( m_pPlayerStageStats )
|
||||||
m_pPlayerStageStats->UpdateComboList( STATSMAN->m_CurStageStats.fGameplaySeconds, false );
|
m_pPlayerStageStats->UpdateComboList( STATSMAN->m_CurStageStats.fStepsSeconds, false );
|
||||||
|
|
||||||
// TODO: Remove use of PlayerNumber.
|
// TODO: Remove use of PlayerNumber.
|
||||||
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
@@ -1476,7 +1476,7 @@ void Player::HandleTapRowScore( unsigned row )
|
|||||||
}
|
}
|
||||||
if( life != -1 )
|
if( life != -1 )
|
||||||
if( m_pPlayerStageStats )
|
if( m_pPlayerStageStats )
|
||||||
m_pPlayerStageStats->SetLifeRecordAt( life, STATSMAN->m_CurStageStats.fGameplaySeconds );
|
m_pPlayerStageStats->SetLifeRecordAt( life, STATSMAN->m_CurStageStats.fStepsSeconds );
|
||||||
|
|
||||||
if( m_pScoreDisplay )
|
if( m_pScoreDisplay )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -229,21 +229,21 @@ float PlayerStageStats::GetCurMaxPercentDancePoints() const
|
|||||||
return fCurMaxPercentDancePoints;
|
return fCurMaxPercentDancePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerStageStats::SetLifeRecordAt( float fLife, float fSecond )
|
void PlayerStageStats::SetLifeRecordAt( float fLife, float fStepsSecond )
|
||||||
{
|
{
|
||||||
// Don't save life stats in endless courses, or could run OOM in a few hours.
|
// Don't save life stats in endless courses, or could run OOM in a few hours.
|
||||||
if( GAMESTATE->m_pCurCourse && GAMESTATE->m_pCurCourse->IsEndless() )
|
if( GAMESTATE->m_pCurCourse && GAMESTATE->m_pCurCourse->IsEndless() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( fSecond < 0 )
|
if( fStepsSecond < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fFirstSecond = min( fSecond, fFirstSecond );
|
fFirstSecond = min( fStepsSecond, fFirstSecond );
|
||||||
fLastSecond = max( fSecond, fLastSecond );
|
fLastSecond = max( fStepsSecond, fLastSecond );
|
||||||
//LOG->Trace( "fLastSecond = %f", fLastSecond );
|
//LOG->Trace( "fLastSecond = %f", fLastSecond );
|
||||||
|
|
||||||
// fSecond will always be greater than any value already in the map.
|
// fSecond will always be greater than any value already in the map.
|
||||||
fLifeRecord[fSecond] = fLife;
|
fLifeRecord[fStepsSecond] = fLife;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Memory optimization:
|
// Memory optimization:
|
||||||
@@ -269,13 +269,13 @@ void PlayerStageStats::SetLifeRecordAt( float fLife, float fSecond )
|
|||||||
fLifeRecord.erase(B);
|
fLifeRecord.erase(B);
|
||||||
}
|
}
|
||||||
|
|
||||||
float PlayerStageStats::GetLifeRecordAt( float fSecond ) const
|
float PlayerStageStats::GetLifeRecordAt( float fStepsSecond ) const
|
||||||
{
|
{
|
||||||
if( fLifeRecord.empty() )
|
if( fLifeRecord.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Find the first element whose key is greater than k. */
|
/* Find the first element whose key is greater than k. */
|
||||||
map<float,float>::const_iterator it = fLifeRecord.upper_bound( fSecond );
|
map<float,float>::const_iterator it = fLifeRecord.upper_bound( fStepsSecond );
|
||||||
|
|
||||||
/* Find the last element whose key is less than or equal to k. */
|
/* Find the last element whose key is less than or equal to k. */
|
||||||
if( it != fLifeRecord.begin() )
|
if( it != fLifeRecord.begin() )
|
||||||
@@ -285,13 +285,13 @@ float PlayerStageStats::GetLifeRecordAt( float fSecond ) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PlayerStageStats::GetLifeRecordLerpAt( float fSecond ) const
|
float PlayerStageStats::GetLifeRecordLerpAt( float fStepsSecond ) const
|
||||||
{
|
{
|
||||||
if( fLifeRecord.empty() )
|
if( fLifeRecord.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Find the first element whose key is greater than k. */
|
/* Find the first element whose key is greater than k. */
|
||||||
map<float,float>::const_iterator later = fLifeRecord.upper_bound( fSecond );
|
map<float,float>::const_iterator later = fLifeRecord.upper_bound( fStepsSecond );
|
||||||
|
|
||||||
/* Find the last element whose key is less than or equal to k. */
|
/* Find the last element whose key is less than or equal to k. */
|
||||||
map<float,float>::const_iterator earlier = later;
|
map<float,float>::const_iterator earlier = later;
|
||||||
@@ -305,15 +305,15 @@ float PlayerStageStats::GetLifeRecordLerpAt( float fSecond ) const
|
|||||||
return earlier->second;
|
return earlier->second;
|
||||||
|
|
||||||
/* earlier <= pos <= later */
|
/* earlier <= pos <= later */
|
||||||
return SCALE( fSecond, earlier->first, later->first, earlier->second, later->second );
|
return SCALE( fStepsSecond, earlier->first, later->first, earlier->second, later->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlayerStageStats::GetLifeRecord( float *fLifeOut, int iNumSamples, float fEndSecond ) const
|
void PlayerStageStats::GetLifeRecord( float *fLifeOut, int iNumSamples, float fStepsEndSecond ) const
|
||||||
{
|
{
|
||||||
for( int i = 0; i < iNumSamples; ++i )
|
for( int i = 0; i < iNumSamples; ++i )
|
||||||
{
|
{
|
||||||
float from = SCALE( i, 0, (float)iNumSamples, 0.0f, fEndSecond );
|
float from = SCALE( i, 0, (float)iNumSamples, 0.0f, fStepsEndSecond );
|
||||||
fLifeOut[i] = GetLifeRecordLerpAt( from );
|
fLifeOut[i] = GetLifeRecordLerpAt( from );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ struct PlayerStageStats
|
|||||||
float fCaloriesBurned;
|
float fCaloriesBurned;
|
||||||
|
|
||||||
map<float,float> fLifeRecord;
|
map<float,float> fLifeRecord;
|
||||||
void SetLifeRecordAt( float fLife, float fSecond );
|
void SetLifeRecordAt( float fLife, float fStepsSecond );
|
||||||
void GetLifeRecord( float *fLifeOut, int iNumSamples, float fEndSecond ) const;
|
void GetLifeRecord( float *fLifeOut, int iNumSamples, float fStepsEndSecond ) const;
|
||||||
float GetLifeRecordAt( float fSecond ) const;
|
float GetLifeRecordAt( float fStepsSecond ) const;
|
||||||
float GetLifeRecordLerpAt( float fSecond ) const;
|
float GetLifeRecordLerpAt( float fStepsSecond ) const;
|
||||||
|
|
||||||
struct Combo_t
|
struct Combo_t
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1447,6 +1447,8 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
// update fGameplaySeconds
|
// update fGameplaySeconds
|
||||||
STATSMAN->m_CurStageStats.fGameplaySeconds += fDeltaTime;
|
STATSMAN->m_CurStageStats.fGameplaySeconds += fDeltaTime;
|
||||||
|
if( GAMESTATE->m_fSongBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat && GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
|
||||||
|
STATSMAN->m_CurStageStats.fStepsSeconds += fDeltaTime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for end of song
|
// Check for end of song
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ StageStats::StageStats()
|
|||||||
vpPossibleSongs.clear();
|
vpPossibleSongs.clear();
|
||||||
StageType = STAGE_INVALID;
|
StageType = STAGE_INVALID;
|
||||||
fGameplaySeconds = 0;
|
fGameplaySeconds = 0;
|
||||||
|
fStepsSeconds = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StageStats::Init()
|
void StageStats::Init()
|
||||||
@@ -62,6 +63,7 @@ void StageStats::AddStats( const StageStats& other )
|
|||||||
StageType = STAGE_INVALID; // meaningless
|
StageType = STAGE_INVALID; // meaningless
|
||||||
|
|
||||||
fGameplaySeconds += other.fGameplaySeconds;
|
fGameplaySeconds += other.fGameplaySeconds;
|
||||||
|
fStepsSeconds += other.fStepsSeconds;
|
||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
m_player[p].AddStats( other.m_player[p] );
|
m_player[p].AddStats( other.m_player[p] );
|
||||||
@@ -91,12 +93,11 @@ bool StageStats::AllFailedEarlier() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float StageStats::GetTotalPossibleMusicLengthSeconds() const
|
float StageStats::GetTotalPossibleStepsSeconds() const
|
||||||
{
|
{
|
||||||
float fSecs = 0;
|
float fSecs = 0;
|
||||||
FOREACH_CONST( Song*, vpPossibleSongs, s )
|
FOREACH_CONST( Song*, vpPossibleSongs, s )
|
||||||
fSecs += (*s)->m_fMusicLengthSeconds;
|
fSecs += (*s)->GetElapsedTimeFromBeat( (*s)->m_fLastBeat ) - (*s)->GetElapsedTimeFromBeat( (*s)->m_fFirstBeat );
|
||||||
|
|
||||||
return fSecs;
|
return fSecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,14 @@ struct StageStats
|
|||||||
vector<Song*> vpPlayedSongs;
|
vector<Song*> vpPlayedSongs;
|
||||||
vector<Song*> vpPossibleSongs;
|
vector<Song*> vpPossibleSongs;
|
||||||
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
|
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
|
||||||
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
|
|
||||||
|
|
||||||
float GetTotalPossibleMusicLengthSeconds() const; // TODO: Scale this by the music rate
|
// TODO: These are updated in ScreenGameplay::Update based on fDelta.
|
||||||
|
// They should be made more accurate.
|
||||||
|
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
|
||||||
|
float fStepsSeconds; // this is <= fGameplaySeconds unless the song has steps past the end
|
||||||
|
|
||||||
|
// Total number of seconds between first beat and last beat for every song.
|
||||||
|
float GetTotalPossibleStepsSeconds() const; // TODO: Scale this by the music rate
|
||||||
|
|
||||||
PlayerStageStats m_player[NUM_PLAYERS];
|
PlayerStageStats m_player[NUM_PLAYERS];
|
||||||
|
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ public:
|
|||||||
|
|
||||||
CString m_sMusicFile;
|
CString m_sMusicFile;
|
||||||
float m_fMusicLengthSeconds;
|
float m_fMusicLengthSeconds;
|
||||||
float m_fFirstBeat;
|
float m_fFirstBeat; // beat of first note
|
||||||
float m_fLastBeat;
|
float m_fLastBeat; // beat of last note
|
||||||
float m_fMusicSampleStartSeconds;
|
float m_fMusicSampleStartSeconds;
|
||||||
float m_fMusicSampleLengthSeconds;
|
float m_fMusicSampleLengthSeconds;
|
||||||
enum { DISPLAY_ACTUAL, DISPLAY_SPECIFIED, DISPLAY_RANDOM } m_DisplayBPMType;
|
enum { DISPLAY_ACTUAL, DISPLAY_SPECIFIED, DISPLAY_RANDOM } m_DisplayBPMType;
|
||||||
|
|||||||
Reference in New Issue
Block a user