options cleanup
This commit is contained in:
@@ -36,13 +36,14 @@ GameState::GameState()
|
|||||||
/* Don't reset yet; let the first screen do it, so we can
|
/* Don't reset yet; let the first screen do it, so we can
|
||||||
* use PREFSMAN. */
|
* use PREFSMAN. */
|
||||||
// Reset();
|
// Reset();
|
||||||
|
m_pPosition = NULL;
|
||||||
|
|
||||||
ResetLastRanking();
|
ResetLastRanking();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameState::~GameState()
|
GameState::~GameState()
|
||||||
{
|
{
|
||||||
delete m_Position;
|
SAFE_DELETE( m_pPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::Reset()
|
void GameState::Reset()
|
||||||
@@ -85,14 +86,12 @@ void GameState::Reset()
|
|||||||
}
|
}
|
||||||
m_SongOptions.Init();
|
m_SongOptions.Init();
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
m_sPositioning[p] = "";
|
||||||
m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
|
SAFE_DELETE( m_pPosition );
|
||||||
}
|
m_pPosition = new NoteFieldPositioning("Positioning.ini");
|
||||||
m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
|
||||||
NOTESKIN->SwitchNoteSkin( PlayerNumber(p), PREFSMAN->m_sDefaultNoteSkin );
|
|
||||||
|
|
||||||
m_Position = new NoteFieldPositioning("Positioning.ini");
|
// apply defaults
|
||||||
|
this->ApplyModifiers( PREFSMAN->m_sDefaultModifiers );
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
@@ -417,6 +416,45 @@ void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GameState::ApplyModifiers( CString sModifiers )
|
||||||
|
{
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
m_PlayerOptions[p].FromString( sModifiers );
|
||||||
|
m_SongOptions.FromString( sModifiers );
|
||||||
|
|
||||||
|
|
||||||
|
sModifiers.MakeLower();
|
||||||
|
CStringArray asBits;
|
||||||
|
split( sModifiers, ",", asBits, true );
|
||||||
|
|
||||||
|
for( unsigned i=0; i<asBits.size(); i++ )
|
||||||
|
{
|
||||||
|
CString& sBit = asBits[i];
|
||||||
|
TrimLeft(sBit);
|
||||||
|
TrimRight(sBit);
|
||||||
|
|
||||||
|
// change NoteSkin
|
||||||
|
if( NOTESKIN->DoesNoteSkinExist(sBit) )
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
NOTESKIN->SwitchNoteSkin( (PlayerNumber)p, sBit );
|
||||||
|
if( m_pPosition->IsValidModeForCurrentGame(sBit) )
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
m_sPositioning[p] = sBit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CString GameState::GetModifiers()
|
||||||
|
{
|
||||||
|
// This is really PLAYER_1's modifiers string!
|
||||||
|
CStringArray as;
|
||||||
|
#define PUSH_IF_NOT_EMPTY( s ) if( !s.empty() ) as.push_back( s );
|
||||||
|
|
||||||
|
PUSH_IF_NOT_EMPTY( m_PlayerOptions[PLAYER_1].GetString() );
|
||||||
|
PUSH_IF_NOT_EMPTY( m_SongOptions.GetString() );
|
||||||
|
PUSH_IF_NOT_EMPTY( m_sPositioning[PLAYER_1] );
|
||||||
|
return join( ",", as );
|
||||||
|
}
|
||||||
|
|
||||||
/* Store the player's preferred options. This is called at the very beginning
|
/* Store the player's preferred options. This is called at the very beginning
|
||||||
* of gameplay. */
|
* of gameplay. */
|
||||||
void GameState::StoreSelectedOptions()
|
void GameState::StoreSelectedOptions()
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ public:
|
|||||||
SongOptions m_SongOptions;
|
SongOptions m_SongOptions;
|
||||||
SongOptions m_StoredSongOptions;
|
SongOptions m_StoredSongOptions;
|
||||||
|
|
||||||
|
void ApplyModifiers( CString sModifiers );
|
||||||
|
CString GetModifiers();
|
||||||
void StoreSelectedOptions();
|
void StoreSelectedOptions();
|
||||||
void RestoreSelectedOptions();
|
void RestoreSelectedOptions();
|
||||||
|
|
||||||
@@ -200,7 +202,8 @@ public:
|
|||||||
//
|
//
|
||||||
// Arrow positioning
|
// Arrow positioning
|
||||||
//
|
//
|
||||||
NoteFieldPositioning *m_Position;
|
CString m_sPositioning[NUM_PLAYERS]; /* The current positioning mode, or empty to use the normal positions. */
|
||||||
|
NoteFieldPositioning *m_pPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void NoteFieldPositioning::Load(PlayerNumber pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a custom mode with the current name that fits the current game? */
|
/* Is there a custom mode with the current name that fits the current game? */
|
||||||
const int ModeNum = GetID(GAMESTATE->m_PlayerOptions[pn].m_sPositioning);
|
const int ModeNum = GetID(GAMESTATE->m_sPositioning[pn]);
|
||||||
if(ModeNum == -1)
|
if(ModeNum == -1)
|
||||||
return; /* No, only use the style table settings. */
|
return; /* No, only use the style table settings. */
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
|
|||||||
m_pScoreKeeper = pScoreKeeper;
|
m_pScoreKeeper = pScoreKeeper;
|
||||||
|
|
||||||
/* Ensure that this is up-to-date. */
|
/* Ensure that this is up-to-date. */
|
||||||
GAMESTATE->m_Position->Load(pn);
|
GAMESTATE->m_pPosition->Load(pn);
|
||||||
|
|
||||||
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ void Player::Step( int col )
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
score==TNS_NONE;
|
score=TNS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming )
|
if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming )
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ void PlayerOptions::Init()
|
|||||||
m_bTimingAssist = false;
|
m_bTimingAssist = false;
|
||||||
m_fPerspectiveTilt = 0;
|
m_fPerspectiveTilt = 0;
|
||||||
m_bTimeSpacing = false;
|
m_bTimeSpacing = false;
|
||||||
m_sPositioning = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
|
void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
|
||||||
@@ -127,7 +126,6 @@ CString PlayerOptions::GetString()
|
|||||||
if( !m_bHoldNotes ) sReturn += "NoHolds, ";
|
if( !m_bHoldNotes ) sReturn += "NoHolds, ";
|
||||||
if( m_bTimingAssist ) sReturn += "TimingAssist, ";
|
if( m_bTimingAssist ) sReturn += "TimingAssist, ";
|
||||||
|
|
||||||
if( m_sPositioning != "" ) sReturn += m_sPositioning + ", ";
|
|
||||||
switch( (int)m_fPerspectiveTilt )
|
switch( (int)m_fPerspectiveTilt )
|
||||||
{
|
{
|
||||||
case -1: sReturn += "Incoming, "; break;
|
case -1: sReturn += "Incoming, "; break;
|
||||||
@@ -198,8 +196,6 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
else if( sBit == "timingassist")m_bTimingAssist = true;
|
else if( sBit == "timingassist")m_bTimingAssist = true;
|
||||||
else if( sBit == "incoming" ) m_fPerspectiveTilt = -1;
|
else if( sBit == "incoming" ) m_fPerspectiveTilt = -1;
|
||||||
else if( sBit == "space" ) m_fPerspectiveTilt = +1;
|
else if( sBit == "space" ) m_fPerspectiveTilt = +1;
|
||||||
else if( GAMESTATE->m_Position->IsValidModeForCurrentGame(sBit) )
|
|
||||||
m_sPositioning = sBit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ struct PlayerOptions
|
|||||||
float m_fPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space
|
float m_fPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space
|
||||||
bool m_bTimeSpacing; // instead of Beat spacing
|
bool m_bTimeSpacing; // instead of Beat spacing
|
||||||
|
|
||||||
/* The current positioning mode, or empty to use the normal positions. */
|
|
||||||
CString m_sPositioning;
|
|
||||||
|
|
||||||
void NextAccel();
|
void NextAccel();
|
||||||
void NextEffect();
|
void NextEffect();
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void ScreenPlayerOptions::ImportOptions()
|
|||||||
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "SPACE" );
|
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "SPACE" );
|
||||||
|
|
||||||
CStringArray arrayPosNames;
|
CStringArray arrayPosNames;
|
||||||
GAMESTATE->m_Position->GetNamesForCurrentGame(arrayPosNames);
|
GAMESTATE->m_pPosition->GetNamesForCurrentGame(arrayPosNames);
|
||||||
for( i=0; i<arrayPosNames.size(); i++ )
|
for( i=0; i<arrayPosNames.size(); i++ )
|
||||||
{
|
{
|
||||||
arrayPosNames[i].MakeUpper();
|
arrayPosNames[i].MakeUpper();
|
||||||
@@ -177,7 +177,7 @@ void ScreenPlayerOptions::ImportOptions()
|
|||||||
{
|
{
|
||||||
vector<CString> &choices = m_OptionRow[PO_PERSPECTIVE].choices;
|
vector<CString> &choices = m_OptionRow[PO_PERSPECTIVE].choices;
|
||||||
for(unsigned n = 3; n < choices.size(); ++n)
|
for(unsigned n = 3; n < choices.size(); ++n)
|
||||||
if(!choices[n].CompareNoCase(po.m_sPositioning))
|
if(!choices[n].CompareNoCase(GAMESTATE->m_sPositioning[p]))
|
||||||
m_iSelectedOption[p][PO_PERSPECTIVE] = n;
|
m_iSelectedOption[p][PO_PERSPECTIVE] = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ void ScreenPlayerOptions::ExportOptions()
|
|||||||
if(m_iSelectedOption[p][PO_PERSPECTIVE] > 2)
|
if(m_iSelectedOption[p][PO_PERSPECTIVE] > 2)
|
||||||
{
|
{
|
||||||
const int choice = m_iSelectedOption[p][PO_PERSPECTIVE];
|
const int choice = m_iSelectedOption[p][PO_PERSPECTIVE];
|
||||||
po.m_sPositioning = m_OptionRow[PO_PERSPECTIVE].choices[choice];
|
GAMESTATE->m_sPositioning[p] = m_OptionRow[PO_PERSPECTIVE].choices[choice];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ void ScreenSelectMusic::TweenOffScreen()
|
|||||||
OFF_COMMAND( m_MusicSortDisplay );
|
OFF_COMMAND( m_MusicSortDisplay );
|
||||||
m_MusicWheel.TweenOffScreen();
|
m_MusicWheel.TweenOffScreen();
|
||||||
OFF_COMMAND( m_MusicWheel );
|
OFF_COMMAND( m_MusicWheel );
|
||||||
|
OFF_COMMAND( m_sprBalloon );
|
||||||
|
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ void ResetGame()
|
|||||||
PREFSMAN->ReadGamePrefsFromDisk();
|
PREFSMAN->ReadGamePrefsFromDisk();
|
||||||
INPUTMAPPER->ReadMappingsFromDisk();
|
INPUTMAPPER->ReadMappingsFromDisk();
|
||||||
|
|
||||||
|
/*
|
||||||
|
GameState::Reset() will switch the NoteSkin
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
PlayerNumber pn = (PlayerNumber)p;
|
PlayerNumber pn = (PlayerNumber)p;
|
||||||
@@ -126,6 +128,7 @@ void ResetGame()
|
|||||||
NOTESKIN->SwitchNoteSkin( pn, asNoteSkinNames[0] );
|
NOTESKIN->SwitchNoteSkin( pn, asNoteSkinNames[0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
|
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
|
||||||
{
|
{
|
||||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||||
|
|||||||
Reference in New Issue
Block a user