separate Load() call to give queues to ScoreKeepers (do expensive init in ctor)
This commit is contained in:
@@ -12,9 +12,11 @@
|
||||
*/
|
||||
|
||||
#include "Actor.h"
|
||||
#include "Attack.h"
|
||||
#include "GameConstantsAndTypes.h" // for TapNoteScore and HoldNoteScore
|
||||
class NoteData;
|
||||
class Inventory;
|
||||
class Song;
|
||||
class Steps;
|
||||
struct PlayerState;
|
||||
struct PlayerStageStats;
|
||||
@@ -34,6 +36,11 @@ protected:
|
||||
|
||||
public:
|
||||
ScoreKeeper(PlayerState* pPlayerState,PlayerStageStats* pPlayerStageStats) { m_pPlayerState=pPlayerState; m_pPlayerStageStats=pPlayerStageStats; }
|
||||
virtual void Load(
|
||||
const vector<Song*>& apSongs,
|
||||
const vector<Steps*>& apSteps,
|
||||
const vector<AttackArray> &asModifiers ) { }
|
||||
|
||||
virtual void DrawPrimitives() { }
|
||||
virtual void Update( float fDelta ) { }
|
||||
|
||||
|
||||
@@ -19,15 +19,21 @@
|
||||
#include "song.h"
|
||||
|
||||
ScoreKeeperMAX2::ScoreKeeperMAX2(
|
||||
const vector<Song*>& apSongs,
|
||||
const vector<Steps*>& apSteps_,
|
||||
const vector<AttackArray> &asModifiers,
|
||||
PlayerState* pPlayerState,
|
||||
PlayerStageStats* pPlayerStageStats ):
|
||||
ScoreKeeper(pPlayerState,pPlayerStageStats), apSteps(apSteps_)
|
||||
ScoreKeeper(pPlayerState,pPlayerStageStats)
|
||||
{
|
||||
ASSERT( apSongs.size() == apSteps_.size() );
|
||||
}
|
||||
|
||||
void ScoreKeeperMAX2::Load(
|
||||
const vector<Song*>& apSongs,
|
||||
const vector<Steps*>& apSteps,
|
||||
const vector<AttackArray> &asModifiers )
|
||||
{
|
||||
m_apSteps = apSteps;
|
||||
ASSERT( apSongs.size() == apSteps.size() );
|
||||
ASSERT( apSongs.size() == asModifiers.size() );
|
||||
|
||||
//
|
||||
// Fill in STATSMAN->m_CurStageStats, calculate multiplier
|
||||
//
|
||||
@@ -47,7 +53,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2(
|
||||
|
||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||
NoteData nd;
|
||||
pStyle->GetTransformedNoteDataForStyle( pPlayerState->m_PlayerNumber, ndTemp, nd );
|
||||
pStyle->GetTransformedNoteDataForStyle( m_pPlayerState->m_PlayerNumber, ndTemp, nd );
|
||||
|
||||
/* Compute RadarValues before applying any user-selected mods. Apply
|
||||
* Course mods and count them in the "pre" RadarValues because they're
|
||||
@@ -64,7 +70,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2(
|
||||
* have eg. GAMESTATE->GetOptionsForCourse(po,so,pn) to get options based on
|
||||
* the last call to StoreSelectedOptions and the modifiers list, but that'd
|
||||
* mean moving the queues in ScreenGameplay to GameState ... */
|
||||
NoteDataUtil::TransformNoteData( nd, pPlayerState->m_PlayerOptions, pSteps->m_StepsType );
|
||||
NoteDataUtil::TransformNoteData( nd, m_pPlayerState->m_PlayerOptions, pSteps->m_StepsType );
|
||||
RadarValues rvPost;
|
||||
NoteDataUtil::GetRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
|
||||
|
||||
@@ -126,7 +132,7 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, c
|
||||
m_iMaxPossiblePoints = 0;
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
{
|
||||
const int numSongsInCourse = apSteps.size();
|
||||
const int numSongsInCourse = m_apSteps.size();
|
||||
ASSERT( numSongsInCourse != 0 );
|
||||
|
||||
const int iIndex = iSongInCourseIndex % numSongsInCourse;
|
||||
|
||||
@@ -21,7 +21,7 @@ class ScoreKeeperMAX2: public ScoreKeeper
|
||||
int m_iCurToastyCombo;
|
||||
bool m_bIsLastSongInCourse;
|
||||
|
||||
const vector<Steps*>& apSteps;
|
||||
vector<Steps*> m_apSteps;
|
||||
|
||||
void AddScore( TapNoteScore score );
|
||||
|
||||
@@ -32,12 +32,14 @@ class ScoreKeeperMAX2: public ScoreKeeper
|
||||
|
||||
public:
|
||||
ScoreKeeperMAX2(
|
||||
const vector<Song*>& apSongs,
|
||||
const vector<Steps*>& apSteps,
|
||||
const vector<AttackArray> &asModifiers,
|
||||
PlayerState* pPlayerState,
|
||||
PlayerStageStats* pPlayerStageStats );
|
||||
|
||||
void Load(
|
||||
const vector<Song*>& apSongs,
|
||||
const vector<Steps*>& apSteps,
|
||||
const vector<AttackArray> &asModifiers );
|
||||
|
||||
// before a song plays (called multiple times if course)
|
||||
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
|
||||
|
||||
|
||||
@@ -199,9 +199,6 @@ void ScreenGameplay::Init()
|
||||
case PrefsManager::SCORING_MAX2:
|
||||
case PrefsManager::SCORING_5TH:
|
||||
m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2(
|
||||
m_apSongsQueue,
|
||||
m_vpStepsQueue[p],
|
||||
m_asModifiersQueue[p],
|
||||
GAMESTATE->m_pPlayerState[p],
|
||||
&STATSMAN->m_CurStageStats.m_player[p] );
|
||||
break;
|
||||
@@ -218,6 +215,14 @@ void ScreenGameplay::Init()
|
||||
}
|
||||
}
|
||||
|
||||
FOREACH_EnabledPlayer(pn)
|
||||
{
|
||||
if( m_pPrimaryScoreKeeper[pn] )
|
||||
m_pPrimaryScoreKeeper[pn]->Load( m_apSongsQueue, m_vpStepsQueue[pn], m_asModifiersQueue[pn] );
|
||||
if( m_pSecondaryScoreKeeper[pn] )
|
||||
m_pSecondaryScoreKeeper[pn]->Load( m_apSongsQueue, m_vpStepsQueue[pn], m_asModifiersQueue[pn] );
|
||||
}
|
||||
|
||||
m_bChangedOffsetOrBPM = GAMESTATE->m_SongOptions.m_bAutoSync;
|
||||
|
||||
m_DancingState = STATE_INTRO;
|
||||
|
||||
Reference in New Issue
Block a user