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