add option to save modifiers to profile
This commit is contained in:
@@ -1993,7 +1993,7 @@ BannerWidth=564
|
||||
BannerHeight=184
|
||||
|
||||
[LyricDisplay]
|
||||
InCommand=shadowlength,0;diffusealpha,0;linear,0.2;diffusealpha,0.5
|
||||
InCommand=shadowlength,0;diffusealpha,0;linear,0.2;diffusealpha,0.6
|
||||
OutCommand=linear,0.2;diffusealpha,0
|
||||
WipeDimFactor=0.5,0.5,0.5,0.5
|
||||
|
||||
@@ -2725,7 +2725,7 @@ StyleIcon=0
|
||||
PrevScreen=
|
||||
NextScreen=
|
||||
|
||||
OptionMenuFlags=rows,14
|
||||
OptionMenuFlags=rows,15
|
||||
|
||||
Line1=list,Speed
|
||||
Line2=list,Accel
|
||||
@@ -2741,6 +2741,7 @@ Line11=list,Hide
|
||||
Line12=list,Persp
|
||||
Line13=Steps
|
||||
Line14=Characters
|
||||
Line15=SaveToProfile
|
||||
|
||||
[ScreenRaveOptions]
|
||||
PrevScreen=ScreenSelectMusic
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "IniFile.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -76,12 +77,17 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Load scores into SONGMAN
|
||||
//
|
||||
SONGMAN->ReadStepsMemCardDataFromFile( m_sProfileDir[pn]+STEPS_MEM_CARD_DATA_FILE, (MemoryCard)pn );
|
||||
SONGMAN->ReadCourseMemCardDataFromFile( m_sProfileDir[pn]+COURSE_MEM_CARD_DATA_FILE, (MemoryCard)pn );
|
||||
|
||||
// apply saved default modifiers if any
|
||||
if( m_Profile[pn].m_bUsingProfileDefaultModifiers )
|
||||
{
|
||||
GAMESTATE->m_PlayerOptions[pn].Init();
|
||||
GAMESTATE->ApplyModifiers( pn, m_Profile[pn].m_sDefaultModifiers );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -272,6 +278,8 @@ bool Profile::LoadFromIni( CString sIniPath )
|
||||
|
||||
ini.GetValue( "Profile", "DisplayName", m_sName );
|
||||
ini.GetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName );
|
||||
ini.GetValue( "Profile", "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
ini.GetValue( "Profile", "DefaultModifiers", m_sDefaultModifiers );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -280,6 +288,8 @@ bool Profile::SaveToIni( CString sIniPath )
|
||||
IniFile ini( sIniPath );
|
||||
ini.SetValue( "Profile", "DisplayName", m_sName );
|
||||
ini.SetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName );
|
||||
ini.SetValue( "Profile", "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
ini.SetValue( "Profile", "DefaultModifiers", m_sDefaultModifiers );
|
||||
ini.WriteFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,12 +22,16 @@ struct Profile
|
||||
{
|
||||
m_sName = "";
|
||||
m_sLastUsedHighScoreName = "";
|
||||
m_bUsingProfileDefaultModifiers = false;
|
||||
m_sDefaultModifiers = "";
|
||||
}
|
||||
|
||||
bool LoadFromIni( CString sIniPath );
|
||||
bool SaveToIni( CString sIniPath );
|
||||
CString m_sName;
|
||||
CString m_sLastUsedHighScoreName;
|
||||
bool m_bUsingProfileDefaultModifiers;
|
||||
CString m_sDefaultModifiers;
|
||||
};
|
||||
|
||||
class ProfileManager
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RageSounds.h"
|
||||
#include "StepMania.h"
|
||||
#include "RageSoundManager.h"
|
||||
#include "ProfileManager.h"
|
||||
|
||||
#define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags")
|
||||
#define ROW_LINE(i) THEME->GetMetric (m_sName,ssprintf("Line%i",(i+1)))
|
||||
@@ -39,6 +40,7 @@
|
||||
#define HARD_DESCRIPTION THEME->GetMetric ("ScreenOptionsMaster","Hard")
|
||||
#define CHALLENGE_DESCRIPTION THEME->GetMetric ("ScreenOptionsMaster","Challenge")
|
||||
|
||||
|
||||
CString ScreenOptionsMaster::ConvertParamToThemeDifficulty( const CString &in ) const
|
||||
{
|
||||
switch( StringToDifficulty(in) )
|
||||
@@ -176,6 +178,15 @@ void ScreenOptionsMaster::SetCharacter( OptionRow &row, OptionRowHandler &hand )
|
||||
}
|
||||
}
|
||||
|
||||
/* Add a list of available characters to the given row/handler. */
|
||||
void ScreenOptionsMaster::SetSaveToProfile( OptionRow &row, OptionRowHandler &hand )
|
||||
{
|
||||
hand.type = ROW_SAVE_TO_PROFILE;
|
||||
row.bOneChoiceForAllPlayers = false;
|
||||
row.choices.push_back( "DON'T SAVE" );
|
||||
row.choices.push_back( "SAVE TO PROFILE" );
|
||||
}
|
||||
|
||||
ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
|
||||
ScreenOptions( sClassName )
|
||||
{
|
||||
@@ -257,6 +268,11 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
|
||||
SetCharacter( row, hand );
|
||||
row.name = "Characters";
|
||||
}
|
||||
else if( !name.CompareNoCase("SaveToProfile") )
|
||||
{
|
||||
SetSaveToProfile( row, hand );
|
||||
row.name = "Save To\nProfile";
|
||||
}
|
||||
else
|
||||
RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i );
|
||||
}
|
||||
@@ -350,6 +366,9 @@ int ScreenOptionsMaster::ImportOption( const OptionRow &row, const OptionRowHand
|
||||
case ROW_CONFIG:
|
||||
return hand.opt->Get( row.choices );
|
||||
|
||||
case ROW_SAVE_TO_PROFILE:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
@@ -451,6 +470,19 @@ int ScreenOptionsMaster::ExportOption( const OptionRow &row, const OptionRowHand
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ROW_SAVE_TO_PROFILE:
|
||||
if( sel == 1 )
|
||||
{
|
||||
if( PROFILEMAN->IsUsingProfile((PlayerNumber)pn) )
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)pn);
|
||||
pProfile->m_bUsingProfileDefaultModifiers = true;
|
||||
pProfile->m_sDefaultModifiers = GAMESTATE->m_PlayerOptions[pn].GetString();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
@@ -527,6 +559,11 @@ void ScreenOptionsMaster::ExportOptions()
|
||||
{
|
||||
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
|
||||
}
|
||||
|
||||
if( ChangeMask & OPT_SAVE_MODIFIERS_TO_PROFILE )
|
||||
{
|
||||
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsMaster::MenuStart( PlayerNumber pn )
|
||||
|
||||
@@ -19,7 +19,8 @@ private:
|
||||
ROW_LIST, /* list of custom settings */
|
||||
ROW_STEP, /* list of steps for the current song or course */
|
||||
ROW_CHARACTER, /* list of characters */
|
||||
ROW_CONFIG,
|
||||
ROW_CONFIG, /* global pref */
|
||||
ROW_SAVE_TO_PROFILE, /* save new options to profile? */
|
||||
NUM_OPTION_ROW_TYPES
|
||||
};
|
||||
|
||||
@@ -48,6 +49,7 @@ private:
|
||||
void SetStep( OptionRow &row, OptionRowHandler &hand );
|
||||
void SetConf( OptionRow &row, OptionRowHandler &hand, CString param, CString &TitleOut );
|
||||
void SetCharacter( OptionRow &row, OptionRowHandler &hand );
|
||||
void SetSaveToProfile( OptionRow &row, OptionRowHandler &hand );
|
||||
|
||||
protected:
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
#define SCREEN_OPTIONS_MASTER_PREFS_H
|
||||
|
||||
static const int MAX_OPTIONS=16;
|
||||
#define OPT_SAVE_PREFERENCES 0x1
|
||||
#define OPT_APPLY_GRAPHICS 0x2
|
||||
#define OPT_APPLY_THEME 0x4
|
||||
#define OPT_RESET_GAME 0x8
|
||||
#define OPT_APPLY_SOUND 0x16
|
||||
#define OPT_SAVE_PREFERENCES 0x1
|
||||
#define OPT_APPLY_GRAPHICS 0x2
|
||||
#define OPT_APPLY_THEME 0x4
|
||||
#define OPT_RESET_GAME 0x8
|
||||
#define OPT_APPLY_SOUND 0x16
|
||||
#define OPT_SAVE_MODIFIERS_TO_PROFILE 0x32
|
||||
|
||||
struct ConfOption
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user