fix [Common] DefaultModifers not being applied in most places
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "PrefsManager.h"
|
|
||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
|
|
||||||
const CString CodeNames[] = {
|
const CString CodeNames[] = {
|
||||||
@@ -252,13 +251,10 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
|||||||
case CODE_HOLDS: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break;
|
case CODE_HOLDS: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break;
|
||||||
case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break;
|
case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break;
|
||||||
case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break;
|
case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break;
|
||||||
case CODE_CANCEL_ALL: po.Init();
|
case CODE_CANCEL_ALL: GAMESTATE->GetDefaultPlayerOptions( po ); break;
|
||||||
po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); break;
|
|
||||||
case CODE_HIDDEN: TOGGLE_HIDDEN; break;
|
case CODE_HIDDEN: TOGGLE_HIDDEN; break;
|
||||||
case CODE_RANDOMVANISH: TOGGLE_RANDOMVANISH; break;
|
case CODE_RANDOMVANISH: TOGGLE_RANDOMVANISH; break;
|
||||||
|
default: break;
|
||||||
// po.SetOneAppearance(po.GetFirstAppearance()); break;
|
|
||||||
default: ;
|
|
||||||
}
|
}
|
||||||
return true; // don't check any more
|
return true; // don't check any more
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1103,8 +1103,8 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
|
|||||||
if( m_bApplyDefaultOptions )
|
if( m_bApplyDefaultOptions )
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
GAMESTATE->GetDefaultPlayerOptions( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions );
|
||||||
GAMESTATE->m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
GAMESTATE->GetDefaultSongOptions( GAMESTATE->m_SongOptions );
|
||||||
}
|
}
|
||||||
// HACK: Set life type to BATTERY just once here so it happens once and
|
// HACK: Set life type to BATTERY just once here so it happens once and
|
||||||
// we don't override the user's changes if they back out.
|
// we don't override the user's changes if they back out.
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ void GameState::Reset()
|
|||||||
|
|
||||||
STATSMAN->Reset();
|
STATSMAN->Reset();
|
||||||
|
|
||||||
m_SongOptions.Init();
|
GAMESTATE->GetDefaultSongOptions( m_SongOptions );
|
||||||
|
|
||||||
FOREACH_PlayerNumber(p)
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
@@ -243,8 +243,8 @@ void GameState::Reset()
|
|||||||
// The theme setting is for eg. BM being reverse by default. (This
|
// The theme setting is for eg. BM being reverse by default. (This
|
||||||
// could be done in the title menu GameCommand, but then it wouldn't
|
// could be done in the title menu GameCommand, but then it wouldn't
|
||||||
// affect demo, and other non-gameplay things ...) -glenn
|
// affect demo, and other non-gameplay things ...) -glenn
|
||||||
ApplyModifiers( p, CommonMetrics::DEFAULT_MODIFIERS );
|
|
||||||
ApplyModifiers( p, PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
GAMESTATE->GetDefaultPlayerOptions( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions );
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_PlayerNumber(p)
|
FOREACH_PlayerNumber(p)
|
||||||
@@ -1005,6 +1005,20 @@ StageResult GameState::GetStageResult( PlayerNumber pn ) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GameState::GetDefaultPlayerOptions( PlayerOptions &po )
|
||||||
|
{
|
||||||
|
po.Init();
|
||||||
|
po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
||||||
|
po.FromString( CommonMetrics::DEFAULT_MODIFIERS );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameState::GetDefaultSongOptions( SongOptions &so )
|
||||||
|
{
|
||||||
|
so.Init();
|
||||||
|
so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
||||||
|
so.FromString( CommonMetrics::DEFAULT_MODIFIERS );
|
||||||
|
}
|
||||||
|
|
||||||
void GameState::ApplyModifiers( PlayerNumber pn, CString sModifiers )
|
void GameState::ApplyModifiers( PlayerNumber pn, CString sModifiers )
|
||||||
{
|
{
|
||||||
m_pPlayerState[pn]->m_PlayerOptions.FromString( sModifiers );
|
m_pPlayerState[pn]->m_PlayerOptions.FromString( sModifiers );
|
||||||
@@ -1034,12 +1048,8 @@ void GameState::RestoreSelectedOptions()
|
|||||||
void GameState::ResetCurrentOptions()
|
void GameState::ResetCurrentOptions()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
GetDefaultPlayerOptions( m_pPlayerState[p]->m_PlayerOptions );
|
||||||
m_pPlayerState[p]->m_PlayerOptions.Init();
|
GetDefaultSongOptions( m_SongOptions );
|
||||||
m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
}
|
|
||||||
m_SongOptions.Init();
|
|
||||||
m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::IsDisqualified( PlayerNumber pn )
|
bool GameState::IsDisqualified( PlayerNumber pn )
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class PlayerState;
|
|||||||
struct lua_State;
|
struct lua_State;
|
||||||
class LuaTable;
|
class LuaTable;
|
||||||
class Profile;
|
class Profile;
|
||||||
|
struct PlayerOptions;
|
||||||
|
|
||||||
class GameState
|
class GameState
|
||||||
{
|
{
|
||||||
@@ -215,6 +216,8 @@ public:
|
|||||||
SongOptions m_SongOptions;
|
SongOptions m_SongOptions;
|
||||||
SongOptions m_StoredSongOptions;
|
SongOptions m_StoredSongOptions;
|
||||||
|
|
||||||
|
void GetDefaultPlayerOptions( PlayerOptions &po );
|
||||||
|
void GetDefaultSongOptions( SongOptions &so );
|
||||||
void ApplyModifiers( PlayerNumber pn, CString sModifiers );
|
void ApplyModifiers( PlayerNumber pn, CString sModifiers );
|
||||||
void StoreSelectedOptions();
|
void StoreSelectedOptions();
|
||||||
void RestoreSelectedOptions();
|
void RestoreSelectedOptions();
|
||||||
|
|||||||
@@ -213,14 +213,12 @@ void ScreenJukebox::Init()
|
|||||||
|
|
||||||
if( GAMESTATE->m_bJukeboxUsesModifiers )
|
if( GAMESTATE->m_bJukeboxUsesModifiers )
|
||||||
{
|
{
|
||||||
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Init();
|
GAMESTATE->GetDefaultPlayerOptions( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions );
|
||||||
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.ChooseRandomModifiers();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.ChooseRandomModifiers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GAMESTATE->m_SongOptions.Init();
|
GAMESTATE->GetDefaultSongOptions( GAMESTATE->m_SongOptions );
|
||||||
GAMESTATE->m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
|
|
||||||
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
|
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so )
|
static void GetPrefsDefaultModifiers( PlayerOptions &po, SongOptions &so )
|
||||||
{
|
{
|
||||||
po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
||||||
so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetDefaultModifiers( const PlayerOptions &po, const SongOptions &so )
|
static void SetPrefsDefaultModifiers( const PlayerOptions &po, const SongOptions &so )
|
||||||
{
|
{
|
||||||
CStringArray as;
|
CStringArray as;
|
||||||
if( po.GetString() != "" )
|
if( po.GetString() != "" )
|
||||||
@@ -246,9 +246,9 @@ static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
} else {
|
} else {
|
||||||
PlayerOptions po;
|
PlayerOptions po;
|
||||||
SongOptions so;
|
SongOptions so;
|
||||||
GetDefaultModifiers( po, so );
|
GetPrefsDefaultModifiers( po, so );
|
||||||
po.m_sNoteSkin = choices[sel];
|
po.m_sNoteSkin = choices[sel];
|
||||||
SetDefaultModifiers( po, so );
|
SetPrefsDefaultModifiers( po, so );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +404,7 @@ static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
{
|
{
|
||||||
PlayerOptions po;
|
PlayerOptions po;
|
||||||
SongOptions so;
|
SongOptions so;
|
||||||
GetDefaultModifiers( po, so );
|
GetPrefsDefaultModifiers( po, so );
|
||||||
|
|
||||||
switch( sel )
|
switch( sel )
|
||||||
{
|
{
|
||||||
@@ -415,7 +415,7 @@ static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDefaultModifiers( po, so );
|
SetPrefsDefaultModifiers( po, so );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
|
|||||||
m_CancelAll.Play();
|
m_CancelAll.Play();
|
||||||
|
|
||||||
// apply the game default mods, but not the Profile saved mods
|
// apply the game default mods, but not the Profile saved mods
|
||||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init();
|
GAMESTATE->GetDefaultPlayerOptions( GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions );
|
||||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( ssprintf("CancelAllP%i", pn+1) );
|
MESSAGEMAN->Broadcast( ssprintf("CancelAllP%i", pn+1) );
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "SongOptions.h"
|
#include "SongOptions.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "PrefsManager.h"
|
#include "GameState.h"
|
||||||
|
|
||||||
void SongOptions::Init()
|
void SongOptions::Init()
|
||||||
{
|
{
|
||||||
@@ -124,8 +124,7 @@ void SongOptions::FromString( CString sOptions )
|
|||||||
else if( sBit == "faildefault" )
|
else if( sBit == "faildefault" )
|
||||||
{
|
{
|
||||||
SongOptions so;
|
SongOptions so;
|
||||||
// TODO: Fix this so that SongOptions don't depend on PrefsManager
|
GAMESTATE->GetDefaultSongOptions( so );
|
||||||
so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers );
|
|
||||||
m_FailType = so.m_FailType;
|
m_FailType = so.m_FailType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user