From fec932e153f234209004065533e1cbfb3cbdc1ff Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Wed, 8 Jun 2011 15:02:54 -0400 Subject: [PATCH] More prep work for better radar calculations. --- src/GameState.cpp | 4 ++-- src/GameState.h | 2 +- src/ScoreKeeperNormal.cpp | 2 ++ src/ScreenGameplay.cpp | 4 +++- src/Steps.cpp | 3 +++ src/Trail.cpp | 3 +++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/GameState.cpp b/src/GameState.cpp index 9b030ff98d..825d051fda 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -206,9 +206,9 @@ TimingData * GameState::GetProcessedTimingData() const return this->processedTiming; } -void GameState::SetProcessedTimingData(TimingData t) +void GameState::SetProcessedTimingData(TimingData * t) { - this->processedTiming = &t; + this->processedTiming = t; } void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn ) diff --git a/src/GameState.h b/src/GameState.h index 463cc8c2ca..0b2463f3c7 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -160,7 +160,7 @@ public: /** * @brief Set the timing data to be used with processing. * @param t the timing data. */ - void SetProcessedTimingData(TimingData t); + void SetProcessedTimingData(TimingData * t); bool IsCourseMode() const; bool IsBattleMode() const; // not Rave diff --git a/src/ScoreKeeperNormal.cpp b/src/ScoreKeeperNormal.cpp index ce3874aa5a..e3872b8c83 100644 --- a/src/ScoreKeeperNormal.cpp +++ b/src/ScoreKeeperNormal.cpp @@ -120,6 +120,7 @@ void ScoreKeeperNormal::Load( * forced and not chosen by the user. */ NoteDataUtil::TransformNoteData( nd, aa, pSteps->m_StepsType, pSong ); RadarValues rvPre; + GAMESTATE->SetProcessedTimingData(&pSteps->m_Timing); NoteDataUtil::CalculateRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPre ); /* Apply user transforms to find out how the notes will really look. @@ -132,6 +133,7 @@ void ScoreKeeperNormal::Load( NoteDataUtil::TransformNoteData( nd, m_pPlayerState->m_PlayerOptions.GetStage(), pSteps->m_StepsType ); RadarValues rvPost; NoteDataUtil::CalculateRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost ); + GAMESTATE->SetProcessedTimingData(NULL); iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost ); iTotalPossibleGradePoints += this->GetPossibleGradePoints( rvPre, rvPost ); diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index c4a6ccaeca..e29d45fa63 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -2294,10 +2294,12 @@ void ScreenGameplay::SaveStats() RadarValues rv; PlayerStageStats &pss = *pi->GetPlayerStageStats(); const NoteData &nd = pi->m_pPlayer->GetNoteData(); + PlayerNumber pn = pi->m_pn; + GAMESTATE->SetProcessedTimingData(&GAMESTATE->m_pCurSteps[pn]->m_Timing); NoteDataUtil::CalculateRadarValues( nd, fMusicLen, rv ); pss.m_radarPossible += rv; - + GAMESTATE->SetProcessedTimingData(NULL); NoteDataWithScoring::GetActualRadarValues( nd, pss, fMusicLen, rv ); pss.m_radarActual += rv; } diff --git a/src/Steps.cpp b/src/Steps.cpp index c1a79064f5..c09ebe49a6 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -14,6 +14,7 @@ #include "global.h" #include "Steps.h" #include "StepsUtil.h" +#include "GameState.h" #include "Song.h" #include "RageUtil.h" #include "RageLog.h" @@ -192,6 +193,7 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds ) FOREACH_PlayerNumber( pn ) m_CachedRadarValues[pn].Zero(); + GAMESTATE->SetProcessedTimingData(&this->m_Timing); if( tempNoteData.IsComposite() ) { vector vParts; @@ -205,6 +207,7 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds ) NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] ); fill_n( m_CachedRadarValues + 1, NUM_PLAYERS-1, m_CachedRadarValues[0] ); } + GAMESTATE->SetProcessedTimingData(NULL); } void Steps::Decompress() const diff --git a/src/Trail.cpp b/src/Trail.cpp index 073d266c93..25ece2abd3 100644 --- a/src/Trail.cpp +++ b/src/Trail.cpp @@ -1,6 +1,7 @@ #include "global.h" #include "Trail.h" #include "Foreach.h" +#include "GameState.h" #include "Steps.h" #include "Song.h" #include "PlayerOptions.h" @@ -116,6 +117,7 @@ const RadarValues &Trail::GetRadarValues() const NoteData nd; pSteps->GetNoteData( nd ); RadarValues rv_orig; + GAMESTATE->SetProcessedTimingData(const_cast(&pSteps->m_Timing)); NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig ); PlayerOptions po; po.FromString( e->Modifiers ); @@ -124,6 +126,7 @@ const RadarValues &Trail::GetRadarValues() const NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong ); RadarValues transformed_rv; NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, transformed_rv ); + GAMESTATE->SetProcessedTimingData(NULL); rv += transformed_rv; } else