fix mods stored in profile cause DQ in Survival even though they're overridden

This commit is contained in:
Chris Danford
2005-11-02 20:02:47 +00:00
parent 4a37f2ecdc
commit e12e28d904
5 changed files with 34 additions and 13 deletions
+13 -1
View File
@@ -519,6 +519,8 @@ void GameState::FinishStage()
if( !m_bMultiplayer ) // no saved stats in multiplayer
CommitStageStats();
RestoreSelectedOptions();
m_bStatsCommitted = false;
// Increment the stage counter.
@@ -1039,7 +1041,10 @@ void GameState::ApplyModifiers( PlayerNumber pn, CString sModifiers )
void GameState::StoreSelectedOptions()
{
FOREACH_PlayerNumber( pn )
{
m_pPlayerState[pn]->m_StoredPlayerOptions = m_pPlayerState[pn]->m_PlayerOptions;
m_pPlayerState[pn]->m_StagePlayerOptions = m_pPlayerState[pn]->m_PlayerOptions;
}
m_StoredSongOptions = m_SongOptions;
}
@@ -1054,6 +1059,13 @@ void GameState::RestoreSelectedOptions()
m_SongOptions = m_StoredSongOptions;
}
void GameState::RestoreStageOptions()
{
FOREACH_PlayerNumber( pn )
m_pPlayerState[pn]->m_PlayerOptions = m_pPlayerState[pn]->m_StagePlayerOptions;
m_SongOptions = m_StoredSongOptions;
}
void GameState::ResetCurrentOptions()
{
FOREACH_PlayerNumber( p )
@@ -1191,7 +1203,7 @@ void GameState::SetNoteSkinForBeatRange( PlayerState* pPlayerState, const CStrin
BeatToNoteSkin[StartBeat] = sNoteSkin;
/* Return to the default note skin after the duration. */
BeatToNoteSkin[EndBeat] = pPlayerState->m_StoredPlayerOptions.m_sNoteSkin;
BeatToNoteSkin[EndBeat] = pPlayerState->m_StagePlayerOptions.m_sNoteSkin;
++m_BeatToNoteSkinRev;
}
+1
View File
@@ -222,6 +222,7 @@ public:
void ApplyModifiers( PlayerNumber pn, CString sModifiers );
void StoreSelectedOptions();
void RestoreSelectedOptions();
void RestoreStageOptions();
void ResetCurrentOptions();
bool IsDisqualified( PlayerNumber pn );
+1 -1
View File
@@ -57,7 +57,7 @@ void PlayerState::Update( float fDelta )
void PlayerState::RebuildPlayerOptionsFromActiveAttacks()
{
// rebuild player options
PlayerOptions po = m_StoredPlayerOptions;
PlayerOptions po = m_StagePlayerOptions;
for( unsigned s=0; s<m_ActiveAttacks.size(); s++ )
{
if( !m_ActiveAttacks[s].bOn )
+2
View File
@@ -22,6 +22,7 @@ public:
{
m_CurrentPlayerOptions.Init();
m_PlayerOptions.Init();
m_StagePlayerOptions.Init();
m_StoredPlayerOptions.Init();
m_BeatToNoteSkin.clear();
@@ -59,6 +60,7 @@ public:
PlayerOptions m_CurrentPlayerOptions; // current approaches destination
PlayerOptions m_PlayerOptions; // change this, and current will move gradually toward it
PlayerOptions m_StagePlayerOptions; // options that are in effect for this stage. May be different from m_StoredPlayerOptions if using forced beginner or forced Survial mods
PlayerOptions m_StoredPlayerOptions; // user's choices on the PlayerOptions screen
//
+17 -11
View File
@@ -190,6 +190,7 @@ void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField )
{
GetPlayerState()->m_CurrentPlayerOptions = GAMESTATE->m_pPlayerState[PLAYER_1]->m_CurrentPlayerOptions;
GetPlayerState()->m_PlayerOptions = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
GetPlayerState()->m_StagePlayerOptions = GAMESTATE->m_pPlayerState[PLAYER_1]->m_StagePlayerOptions;
GetPlayerState()->m_StoredPlayerOptions = GAMESTATE->m_pPlayerState[PLAYER_1]->m_StoredPlayerOptions;
}
}
@@ -855,6 +856,7 @@ void ScreenGameplay::Init()
void ScreenGameplay::InitSongQueues()
{
LOG->Trace("InitSongQueues");
if( GAMESTATE->IsCourseMode() )
{
Course* pCourse = GAMESTATE->m_pCurCourse;
@@ -882,14 +884,16 @@ void ScreenGameplay::InitSongQueues()
ASSERT( e->pSteps );
pi->m_vpStepsQueue.push_back( e->pSteps );
AttackArray a;
// In a survuval course, override stored mods
if( pCourse->GetCourseType() == COURSE_TYPE_SURVIVAL )
a.push_back( Attack(ATTACK_LEVEL_1, 0, 0, "clearall,"+CommonMetrics::DEFAULT_MODIFIERS.GetValue(), false, true, false) ); // don't show in AttackList
e->GetAttackArray( a );
pi->m_asModifiersQueue.push_back( a );
}
// In a survuval course, override stored mods
if( pCourse->GetCourseType() == COURSE_TYPE_SURVIVAL )
{
pi->GetPlayerState()->m_StagePlayerOptions.FromString( "clearall,"+CommonMetrics::DEFAULT_MODIFIERS.GetValue(), true );
pi->GetPlayerState()->RebuildPlayerOptionsFromActiveAttacks();
}
}
}
else
@@ -901,10 +905,13 @@ void ScreenGameplay::InitSongQueues()
pi->m_vpStepsQueue.push_back( pSteps );
AttackArray aa;
if( pSteps->GetDifficulty() == DIFFICULTY_BEGINNER && (bool)USE_FORCED_MODIFIERS_IN_BEGINNER )
aa.push_back( Attack(ATTACK_LEVEL_1, 0, 0, FORCED_MODIFIERS_IN_BEGINNER, false, true, false) ); // don't show in AttackList
pi->m_asModifiersQueue.push_back( aa );
if( pSteps->GetDifficulty() == DIFFICULTY_BEGINNER && (bool)USE_FORCED_MODIFIERS_IN_BEGINNER )
{
pi->GetPlayerState()->m_StagePlayerOptions.FromString( FORCED_MODIFIERS_IN_BEGINNER, true );
pi->GetPlayerState()->RebuildPlayerOptionsFromActiveAttacks();
}
}
}
@@ -1055,8 +1062,7 @@ void ScreenGameplay::LoadNextSong()
// No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks();
// Restore the player's originally selected options.
GAMESTATE->RestoreSelectedOptions();
GAMESTATE->RestoreStageOptions();
/* If we're in battery mode, force FailImmediate. We assume in PlayerMinus::Step that
* failed players can't step. */
@@ -2271,7 +2277,7 @@ void ScreenGameplay::StageFinished( bool bBackedOut )
STATSMAN->m_vPlayedStageStats.push_back( STATSMAN->m_CurStageStats );
/* Reset options. */
GAMESTATE->RestoreSelectedOptions();
GAMESTATE->RestoreStageOptions();
}
void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )