Further work on saving profile and directory listing.

dev-ui
Zaba999 2012-10-02 21:44:14 +02:00
parent ac1472621a
commit 4b7ca3f262
5 changed files with 160 additions and 291 deletions

View File

@ -327,24 +327,24 @@ bool CApplication::Create()
m_deviceConfig.fullScreen = false; m_deviceConfig.fullScreen = false;
//Create the sound instance. //Create the sound instance.
if (!GetProfile()->InitCurrentDirectory()) { if (!GetProfile().InitCurrentDirectory()) {
GetLogger()->Warn("Config not found. Default values will be used!\n"); GetLogger()->Warn("Config not found. Default values will be used!\n");
m_sound = new CSoundInterface(); m_sound = new CSoundInterface();
} else { } else {
std::string path; std::string path;
if (GetProfile()->GetLocalProfileString("Resources", "Data", path)) if (GetProfile().GetLocalProfileString("Resources", "Data", path))
m_dataPath = path; m_dataPath = path;
m_pluginManager->LoadFromProfile(); m_pluginManager->LoadFromProfile();
m_sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND)); m_sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
if (!m_sound) { if (!m_sound) {
GetLogger()->Error("Sound not loaded!\n"); GetLogger()->Error("Sound not loaded, falling back to fake sound!\n");
return false; m_sound = new CSoundInterface();
} }
m_sound->Create(true); m_sound->Create(true);
if (GetProfile()->GetLocalProfileString("Resources", "Sound", path)) if (GetProfile().GetLocalProfileString("Resources", "Sound", path))
m_sound->CacheAll(path); m_sound->CacheAll(path);
else else
m_sound->CacheAll(m_dataPath); m_sound->CacheAll(m_dataPath);

View File

@ -107,6 +107,6 @@ class CProfile : public CSingleton<CProfile>
}; };
//! Global function to get profile instance //! Global function to get profile instance
inline CProfile* GetProfile() { inline CProfile & GetProfile() {
return CProfile::GetInstancePointer(); return *CProfile::GetInstancePointer();
} }

View File

@ -40,8 +40,8 @@ CPluginManager::~CPluginManager()
void CPluginManager::LoadFromProfile() void CPluginManager::LoadFromProfile()
{ {
GetLogger()->Info("Trying to load from profile...\n"); GetLogger()->Info("Trying to load from profile...\n");
std::vector< std::string > dirs = GetProfile()->GetLocalProfileSection("Plugins", "Path"); std::vector< std::string > dirs = GetProfile().GetLocalProfileSection("Plugins", "Path");
std::vector< std::string > plugins = GetProfile()->GetLocalProfileSection("Plugins", "File"); std::vector< std::string > plugins = GetProfile().GetLocalProfileSection("Plugins", "File");
GetLogger()->Info("Path %d, files %d\n", dirs.size(), plugins.size()); GetLogger()->Info("Path %d, files %d\n", dirs.size(), plugins.size());
for (std::string dir : dirs) for (std::string dir : dirs)

View File

@ -3575,12 +3575,12 @@ void CMainDialog::NiceParticle(Math::Point mouse, bool bPress)
void CMainDialog::SetUserDir(char *base, int rank) void CMainDialog::SetUserDir(char *base, int rank)
{ {
char dir[100]; std::string dir;
if ( strcmp(base, "user") == 0 && rank >= 100 ) if ( strcmp(base, "user") == 0 && rank >= 100 )
{ {
sprintf(dir, "%s/%s", m_userDir.c_str(), m_userList[rank/100-1]); dir = m_userDir + "/" + m_userList.at(rank/100-1);
UserDir(true, dir); UserDir(true, dir.c_str());
} }
else else
{ {
@ -3628,14 +3628,10 @@ void CMainDialog::ReadNameList()
{ {
CWindow* pw; CWindow* pw;
CList* pl; CList* pl;
long hFile;
//struct _finddata_t fBuffer; //struct _finddata_t fBuffer;
bool bDo;
char dir[MAX_FNAME]; char dir[MAX_FNAME];
char temp[MAX_FNAME];
// char filenames[MAX_FNAME][100]; // char filenames[MAX_FNAME][100];
std::vector<std::string> fileNames; std::vector<std::string> fileNames;
int nbFilenames, i;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return; if ( pw == 0 ) return;
@ -3643,7 +3639,6 @@ void CMainDialog::ReadNameList()
if ( pl == 0 ) return; if ( pl == 0 ) return;
pl->Flush(); pl->Flush();
nbFilenames = 0;
try try
{ {
@ -3671,8 +3666,7 @@ void CMainDialog::ReadNameList()
} }
fileNames.push_back("Test"); for (size_t i=0 ; i<fileNames.size() ; ++i )
for ( i=0 ; i<fileNames.size() ; ++i )
{ {
pl->SetName(i, fileNames.at(i).c_str()); pl->SetName(i, fileNames.at(i).c_str());
} }
@ -3847,7 +3841,7 @@ void CMainDialog::NameSelect()
GetGamerFace(m_main->GetGamerName()); GetGamerFace(m_main->GetGamerName());
GetProfile()->SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName()); GetProfile().SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName());
} }
// Creates a new player. // Creates a new player.
@ -4283,12 +4277,10 @@ void CMainDialog::DefPerso()
bool CMainDialog::IsIOReadScene() bool CMainDialog::IsIOReadScene()
{ {
FILE* file; FILE* file;
// char filename[100];
std::string filename; std::string filename;
//TODO: Change this to point user dir acocrding to operating system //TODO: Change this to point user dir acocrding to operating system
filename = m_savegameDir + "/" + m_main->GetGamerName() + "/" + "save" + m_sceneName[0] + "000/data.sav"; filename = m_savegameDir + "/" + m_main->GetGamerName() + "/" + "save" + m_sceneName[0] + "000/data.sav";
// sprintf(filename, "%s\\%s\\save%c%.3d\\data.sav", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], 0);
file = fopen(filename.c_str(), "r"); file = fopen(filename.c_str(), "r");
if ( file == NULL ) return false; if ( file == NULL ) return false;
fclose(file); fclose(file);
@ -4419,7 +4411,6 @@ void CMainDialog::IOReadList()
void CMainDialog::IOUpdateList() void CMainDialog::IOUpdateList()
{ {
FILE* file = NULL;
CWindow* pw; CWindow* pw;
CList* pl; CList* pl;
CButton* pb; CButton* pb;
@ -4440,7 +4431,6 @@ void CMainDialog::IOUpdateList()
std::ostringstream rankStream; std::ostringstream rankStream;
rankStream << std::setfill('0') << std::setw(3) << sel; rankStream << std::setfill('0') << std::setw(3) << sel;
filename = m_savegameDir + "/" + m_main->GetGamerName() + "/save" + m_sceneName[0] + rankStream.str()+ "/screen.png"; filename = m_savegameDir + "/" + m_main->GetGamerName() + "/save" + m_sceneName[0] + rankStream.str()+ "/screen.png";
// sprintf(filename, "%s\\%s\\save%c%.3d\\screen.png", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
if ( m_phase == PHASE_WRITE || if ( m_phase == PHASE_WRITE ||
m_phase == PHASE_WRITEs ) m_phase == PHASE_WRITEs )
@ -4470,13 +4460,9 @@ void CMainDialog::IOUpdateList()
void CMainDialog::IODeleteScene() void CMainDialog::IODeleteScene()
{ {
CWindow* pw; CWindow* pw;
CList* pl; CList* pl;
char dir[100]; int sel;
char old[100];
long hFile;
//struct _finddata_t fBuffer;
int sel, max, i;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return; if ( pw == 0 ) return;
@ -4506,38 +4492,7 @@ void CMainDialog::IODeleteScene()
{ {
GetLogger()->Error("Error on removing directory %s : %s\n", e.what()); GetLogger()->Error("Error on removing directory %s : %s\n", e.what());
} }
/* TODO: remove files
// Deletes all the contents of the file.
sprintf(dir, "%s/%s/save%c%.3d/*", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
hFile = _findfirst(dir, &fBuffer);
if ( hFile != -1 )
{
do
{
if ( fBuffer.name[0] != '.' )
{
sprintf(dir, "%s/%s/save%c%.3d/%s", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel, fBuffer.name);
remove(dir);
}
}
while ( _findnext(hFile, &fBuffer) == 0 );
}
sprintf(dir, "%s/%s/save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
if ( _rmdir(dir) != 0 )
{
m_sound->Play(SOUND_TZOING);
return;
}*/
/* TODO: rename
max = pl->GetTotal();
for ( i=sel+1 ; i<max ; i++ )
{
sprintf(old, "%s/%s/save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], i);
sprintf(dir, "%s/%s/save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], i-1);
rename(old, dir);
}*/
IOReadList(); IOReadList();
} }
@ -4567,7 +4522,6 @@ bool CMainDialog::IOWriteScene()
std::ostringstream selectStream; std::ostringstream selectStream;
//TODO: Change this to point user dir according to operating system //TODO: Change this to point user dir according to operating system
// sprintf(filename, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
GetLogger()->Debug("Creating save directory\n"); GetLogger()->Debug("Creating save directory\n");
selectStream << std::setfill('0') << std::setw(3) << sel; selectStream << std::setfill('0') << std::setw(3) << sel;
directoryName = m_savegameDir + "/" + m_main->GetGamerName() + "/" + "save" + m_sceneName[0] + selectStream.str(); directoryName = m_savegameDir + "/" + m_main->GetGamerName() + "/" + "save" + m_sceneName[0] + selectStream.str();
@ -4607,7 +4561,6 @@ bool CMainDialog::IOReadScene()
if ( sel == -1 ) return false; if ( sel == -1 ) return false;
//TODO: Change this to point user dir according to operating system //TODO: Change this to point user dir according to operating system
// sprintf(filename, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
std::string fileName; std::string fileName;
std::string fileCbot; std::string fileCbot;
std::string directoryName; std::string directoryName;
@ -4644,7 +4597,7 @@ bool CMainDialog::IOReadScene()
OpString(line, "dir", dir); OpString(line, "dir", dir);
for ( i=0 ; i<m_userTotal ; i++ ) for ( i=0 ; i<m_userTotal ; i++ )
{ {
if ( strcmp(m_userList[i], dir) == 0 ) if ( strcmp(m_userList[i].c_str(), dir) == 0 )
{ {
m_sceneRank += (i+1)*100; m_sceneRank += (i+1)*100;
break; break;
@ -4711,14 +4664,13 @@ void CMainDialog::UpdateSceneChap(int &chap)
FILE* file = NULL; FILE* file = NULL;
CWindow* pw; CWindow* pw;
CList* pl; CList* pl;
long hFile;
//struct _finddata_t fileBuffer; //struct _finddata_t fileBuffer;
std::string fileName; std::string fileName;
char op[100]; char op[100];
char line[500]; char line[500];
char name[100]; char name[100];
int i, j; int i, j;
bool bPassed, bDo; bool bPassed;
memset(op, 0, 100); memset(op, 0, 100);
memset(line, 0, 500); memset(line, 0, 500);
@ -4734,37 +4686,16 @@ void CMainDialog::UpdateSceneChap(int &chap)
if ( m_phase == PHASE_USER ) if ( m_phase == PHASE_USER )
{ {
j = 0; j = 0;
/* TODO: list files fs::directory_iterator dirIt(m_savegameDir), dirEndIt;
hFile = _findfirst("user/*", &fileBuffer);
if ( hFile != -1 )
{
do
{
if ( (fileBuffer.attrib & _A_SUBDIR) != 0 &&
fileBuffer.name[0] != '.' )
{
strcpy(m_userList[j++], fileBuffer.name);
}
}
while ( _findnext(hFile, &fileBuffer) == 0 && j < 100 );
}*/
m_userTotal = j;
do // sorts all names: BOOST_FOREACH (const fs::path & p, std::make_pair(dirIt, dirEndIt))
{ {
bDo = false; if (fs::is_directory(p))
for ( i=0 ; i<m_userTotal-1 ; i++ )
{ {
if ( strcmp(m_userList[i], m_userList[i+1]) > 0 ) m_userList.push_back(p.leaf().string());
{
strcpy(name, m_userList[i]);
strcpy(m_userList[i], m_userList[i+1]);
strcpy(m_userList[i+1], name);
bDo = true;
}
} }
} }
while ( bDo ); m_userTotal = m_userList.size();
for ( j=0 ; j<m_userTotal ; j++ ) for ( j=0 ; j<m_userTotal ; j++ )
{ {
@ -4772,7 +4703,7 @@ void CMainDialog::UpdateSceneChap(int &chap)
file = fopen(fileName.c_str(), "r"); file = fopen(fileName.c_str(), "r");
if ( file == NULL ) if ( file == NULL )
{ {
strcpy(name, m_userList[j]); strcpy(name, m_userList[j].c_str());
} }
else else
{ {
@ -5543,123 +5474,62 @@ void CMainDialog::SetupMemorize()
char key[500]; char key[500];
char num[10]; char num[10];
/* TODO: profile GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir);
SetLocalProfileString("Directory", "scene", m_sceneDir); GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir);
SetLocalProfileString("Directory", "savegame", m_savegameDir); GetProfile().SetLocalProfileString("Directory", "public", m_publicDir);
SetLocalProfileString("Directory", "public", m_publicDir); GetProfile().SetLocalProfileString("Directory", "user", m_userDir);
SetLocalProfileString("Directory", "user", m_userDir); GetProfile().SetLocalProfileString("Directory", "files", m_filesDir);
SetLocalProfileString("Directory", "files", m_filesDir); GetProfile().SetLocalProfileInt("Setup", "Tooltips", m_bTooltip);
GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bGlint);
GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bRain);
GetProfile().SetLocalProfileInt("Setup", "Soluce4", m_bSoluce4);
GetProfile().SetLocalProfileInt("Setup", "Movies", m_bMovies);
GetProfile().SetLocalProfileInt("Setup", "NiceReset", m_bNiceReset);
GetProfile().SetLocalProfileInt("Setup", "HimselfDamage", m_bHimselfDamage);
GetProfile().SetLocalProfileInt("Setup", "CameraScroll", m_bCameraScroll);
GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX);
GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect);
GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow());
GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot());
GetProfile().SetLocalProfileInt("Setup", "ObjectDirty", m_engine->GetDirty());
GetProfile().SetLocalProfileInt("Setup", "FogMode", m_engine->GetFog());
GetProfile().SetLocalProfileInt("Setup", "LensMode", m_engine->GetLensMode());
GetProfile().SetLocalProfileInt("Setup", "SkyMode", m_engine->GetSkyMode());
GetProfile().SetLocalProfileInt("Setup", "PlanetMode", m_engine->GetPlanetMode());
GetProfile().SetLocalProfileInt("Setup", "LightMode", m_engine->GetLightMode());
GetProfile().SetLocalProfileFloat("Setup", "ParticleDensity", m_engine->GetParticleDensity());
GetProfile().SetLocalProfileFloat("Setup", "ClippingDistance", m_engine->GetClippingDistance());
GetProfile().SetLocalProfileFloat("Setup", "ObjectDetail", m_engine->GetObjectDetail());
GetProfile().SetLocalProfileFloat("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality());
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
iValue = m_engine->GetTotoMode();
SetLocalProfileInt("Setup", "TotoMode", iValue);
iValue = m_bTooltip; // GetProfile()->SetLocalProfileInt("Setup", "NiceMouse", m_engine->GetNiceMouse());
SetLocalProfileInt("Setup", "Tooltips", iValue); // GetProfile()->SetLocalProfileInt("Setup", "UseJoystick", m_engine->GetJoystick());
// GetProfile()->SetLocalProfileInt("Setup", "MidiVolume", m_sound->GetMidiVolume());
iValue = m_bGlint; // key[0] = 0;
SetLocalProfileInt("Setup", "InterfaceGlint", iValue); // for ( i=0 ; i<100 ; i++ )
// {
// if ( m_engine->GetKey(i, 0) == 0 ) break;
iValue = m_bRain; // for ( j=0 ; j<2 ; j++ )
SetLocalProfileInt("Setup", "InterfaceGlint", iValue); // {
// iValue = m_engine->GetKey(i, j);
iValue = m_engine->GetNiceMouse(); // sprintf(num, "%d%c", iValue, j==0?'+':' ');
SetLocalProfileInt("Setup", "NiceMouse", iValue); // strcat(key, num);
// }
iValue = m_bSoluce4; // }
SetLocalProfileInt("Setup", "Soluce4", iValue);
iValue = m_bMovies;
SetLocalProfileInt("Setup", "Movies", iValue);
iValue = m_bNiceReset;
SetLocalProfileInt("Setup", "NiceReset", iValue);
iValue = m_bHimselfDamage;
SetLocalProfileInt("Setup", "HimselfDamage", iValue);
iValue = m_bCameraScroll;
SetLocalProfileInt("Setup", "CameraScroll", iValue);
iValue = m_bCameraInvertX;
SetLocalProfileInt("Setup", "CameraInvertX", iValue);
iValue = m_bEffect;
SetLocalProfileInt("Setup", "InterfaceEffect", iValue);
iValue = m_engine->GetShadow();
SetLocalProfileInt("Setup", "GroundShadow", iValue);
iValue = m_engine->GetGroundSpot();
SetLocalProfileInt("Setup", "GroundSpot", iValue);
iValue = m_engine->GetDirty();
SetLocalProfileInt("Setup", "ObjectDirty", iValue);
iValue = m_engine->GetFog();
SetLocalProfileInt("Setup", "FogMode", iValue);
iValue = m_engine->GetLensMode();
SetLocalProfileInt("Setup", "LensMode", iValue);
iValue = m_engine->GetSkyMode();
SetLocalProfileInt("Setup", "SkyMode", iValue);
iValue = m_engine->GetPlanetMode();
SetLocalProfileInt("Setup", "PlanetMode", iValue);
iValue = m_engine->GetLightMode();
SetLocalProfileInt("Setup", "LightMode", iValue);
iValue = m_engine->GetJoystick();
SetLocalProfileInt("Setup", "UseJoystick", iValue);
fValue = m_engine->GetParticleDensity();
SetLocalProfileFloat("Setup", "ParticleDensity", fValue);
fValue = m_engine->GetClippingDistance();
SetLocalProfileFloat("Setup", "ClippingDistance", fValue);
fValue = m_engine->GetObjectDetail();
SetLocalProfileFloat("Setup", "ObjectDetail", fValue);
fValue = m_engine->GetGadgetQuantity();
SetLocalProfileFloat("Setup", "GadgetQuantity", fValue);
iValue = m_engine->GetTextureQuality();
SetLocalProfileInt("Setup", "TextureQuality", iValue);
iValue = m_sound->GetAudioVolume();
SetLocalProfileInt("Setup", "AudioVolume", iValue);
iValue = m_sound->GetMidiVolume();
SetLocalProfileInt("Setup", "MidiVolume", iValue);
iValue = m_sound->GetSound3D();
SetLocalProfileInt("Setup", "Sound3D", iValue);
iValue = m_engine->GetEditIndentMode();
SetLocalProfileInt("Setup", "EditIndentMode", iValue);
iValue = m_engine->GetEditIndentValue();
SetLocalProfileInt("Setup", "EditIndentValue", iValue);*/
/* key[0] = 0;
for ( i=0 ; i<100 ; i++ )
{
if ( m_engine->GetKey(i, 0) == 0 ) break;
for ( j=0 ; j<2 ; j++ )
{
iValue = m_engine->GetKey(i, j);
sprintf(num, "%d%c", iValue, j==0?'+':' ');
strcat(key, num);
}
}*/
/* TODO: profile /* TODO: profile
SetLocalProfileString("Setup", "KeyMap", key); */ SetLocalProfileString("Setup", "KeyMap", key); */
/* TODO: #if _NET #if _NET
if ( m_accessEnable ) if ( m_accessEnable )
{ {
iValue = m_accessMission; iValue = m_accessMission;
@ -5668,13 +5538,11 @@ void CMainDialog::SetupMemorize()
iValue = m_accessUser; iValue = m_accessUser;
SetLocalProfileInt("Setup", "AccessUser", iValue); SetLocalProfileInt("Setup", "AccessUser", iValue);
} }
#endif */ #endif
/* TODO: profile GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer);
iValue = m_bDeleteGamer;
SetLocalProfileInt("Setup", "DeleteGamer", iValue); */
// TODO: write profile // TODO: write graphic engine profile
//m_engine->WriteProfile(); //m_engine->WriteProfile();
} }
@ -5682,234 +5550,234 @@ void CMainDialog::SetupMemorize()
void CMainDialog::SetupRecall() void CMainDialog::SetupRecall()
{ {
float fValue; float fValue;
int iValue, i, j; int iValue, i, j;
char key[500]; std::string key;
char* p; char* p;
/* TODO: profile if ( GetProfile().GetLocalProfileString("Directory", "scene", key) )
if ( GetLocalProfileString("Directory", "scene", key, MAX_FNAME) )
{ {
strcpy(m_sceneDir, key); m_sceneDir = key;
} }
if ( GetLocalProfileString("Directory", "savegame", key, MAX_FNAME) ) if ( GetProfile().GetLocalProfileString("Directory", "savegame", key) )
{ {
strcpy(m_savegameDir, key); m_savegameDir = key;
} }
if ( GetLocalProfileString("Directory", "public", key, MAX_FNAME) ) if ( GetProfile().GetLocalProfileString("Directory", "public", key) )
{ {
strcpy(m_publicDir, key); m_publicDir = key;
} }
if ( GetLocalProfileString("Directory", "user", key, MAX_FNAME) ) if ( GetProfile().GetLocalProfileString("Directory", "user", key) )
{ {
strcpy(m_userDir, key); m_userDir = key;
} }
if ( GetLocalProfileString("Directory", "files", key, MAX_FNAME) ) if ( GetProfile().GetLocalProfileString("Directory", "files", key) )
{ {
strcpy(m_filesDir, key); m_filesDir = key;
} }
if ( GetLocalProfileInt("Setup", "TotoMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "TotoMode", iValue) )
{ {
m_engine->SetTotoMode(iValue); m_engine->SetTotoMode(iValue);
} }
if ( GetLocalProfileInt("Setup", "Tooltips", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "Tooltips", iValue) )
{ {
m_bTooltip = iValue; m_bTooltip = iValue;
} }
if ( GetLocalProfileInt("Setup", "InterfaceGlint", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
{ {
m_bGlint = iValue; m_bGlint = iValue;
} }
if ( GetLocalProfileInt("Setup", "InterfaceGlint", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
{ {
m_bRain = iValue; m_bRain = iValue;
} }
if ( GetLocalProfileInt("Setup", "NiceMouse", iValue) ) // TODO
{ // if ( GetProfile().GetLocalProfileInt("Setup", "NiceMouse", iValue) )
m_engine->SetNiceMouse(iValue); // {
} // m_engine->SetNiceMouse(iValue);
// }
if ( GetLocalProfileInt("Setup", "Soluce4", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "Soluce4", iValue) )
{ {
m_bSoluce4 = iValue; m_bSoluce4 = iValue;
} }
if ( GetLocalProfileInt("Setup", "Movies", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "Movies", iValue) )
{ {
m_bMovies = iValue; m_bMovies = iValue;
} }
if ( GetLocalProfileInt("Setup", "NiceReset", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "NiceReset", iValue) )
{ {
m_bNiceReset = iValue; m_bNiceReset = iValue;
} }
if ( GetLocalProfileInt("Setup", "HimselfDamage", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "HimselfDamage", iValue) )
{ {
m_bHimselfDamage = iValue; m_bHimselfDamage = iValue;
} }
if ( GetLocalProfileInt("Setup", "CameraScroll", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "CameraScroll", iValue) )
{ {
m_bCameraScroll = iValue; m_bCameraScroll = iValue;
m_camera->SetCameraScroll(m_bCameraScroll); m_camera->SetCameraScroll(m_bCameraScroll);
} }
if ( GetLocalProfileInt("Setup", "CameraInvertX", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertX", iValue) )
{ {
m_bCameraInvertX = iValue; m_bCameraInvertX = iValue;
m_camera->SetCameraInvertX(m_bCameraInvertX); m_camera->SetCameraInvertX(m_bCameraInvertX);
} }
if ( GetLocalProfileInt("Setup", "CameraInvertY", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertY", iValue) )
{ {
m_bCameraInvertY = iValue; m_bCameraInvertY = iValue;
m_camera->SetCameraInvertY(m_bCameraInvertY); m_camera->SetCameraInvertY(m_bCameraInvertY);
} }
if ( GetLocalProfileInt("Setup", "InterfaceEffect", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceEffect", iValue) )
{ {
m_bEffect = iValue; m_bEffect = iValue;
} }
if ( GetLocalProfileInt("Setup", "GroundShadow", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "GroundShadow", iValue) )
{ {
m_engine->SetShadow(iValue); m_engine->SetShadow(iValue);
} }
if ( GetLocalProfileInt("Setup", "GroundSpot", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "GroundSpot", iValue) )
{ {
m_engine->SetGroundSpot(iValue); m_engine->SetGroundSpot(iValue);
} }
if ( GetLocalProfileInt("Setup", "ObjectDirty", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "ObjectDirty", iValue) )
{ {
m_engine->SetDirty(iValue); m_engine->SetDirty(iValue);
} }
if ( GetLocalProfileInt("Setup", "FogMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "FogMode", iValue) )
{ {
m_engine->SetFog(iValue); m_engine->SetFog(iValue);
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f))); // TODO: color ok? m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
} }
if ( GetLocalProfileInt("Setup", "LensMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "LensMode", iValue) )
{ {
m_engine->SetLensMode(iValue); m_engine->SetLensMode(iValue);
} }
if ( GetLocalProfileInt("Setup", "SkyMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "SkyMode", iValue) )
{ {
m_engine->SetSkyMode(iValue); m_engine->SetSkyMode(iValue);
} }
if ( GetLocalProfileInt("Setup", "PlanetMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "PlanetMode", iValue) )
{ {
m_engine->SetPlanetMode(iValue); m_engine->SetPlanetMode(iValue);
} }
if ( GetLocalProfileInt("Setup", "LightMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "LightMode", iValue) )
{ {
m_engine->SetLightMode(iValue); m_engine->SetLightMode(iValue);
} }
// TODO
// if ( GetProfile().GetLocalProfileInt("Setup", "UseJoystick", iValue) )
// {
// m_engine->SetJoystick(iValue);
// }
if ( GetLocalProfileInt("Setup", "UseJoystick", iValue) ) if ( GetProfile().GetLocalProfileFloat("Setup", "ParticleDensity", fValue) )
{
m_engine->SetJoystick(iValue);
}
if ( GetLocalProfileFloat("Setup", "ParticleDensity", fValue) )
{ {
m_engine->SetParticleDensity(fValue); m_engine->SetParticleDensity(fValue);
} }
if ( GetLocalProfileFloat("Setup", "ClippingDistance", fValue) ) if ( GetProfile().GetLocalProfileFloat("Setup", "ClippingDistance", fValue) )
{ {
m_engine->SetClippingDistance(fValue); m_engine->SetClippingDistance(fValue);
} }
if ( GetLocalProfileFloat("Setup", "ObjectDetail", fValue) ) if ( GetProfile().GetLocalProfileFloat("Setup", "ObjectDetail", fValue) )
{ {
m_engine->SetObjectDetail(fValue); m_engine->SetObjectDetail(fValue);
} }
if ( GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) ) if ( GetProfile().GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) )
{ {
m_engine->SetGadgetQuantity(fValue); m_engine->SetGadgetQuantity(fValue);
} }
if ( GetLocalProfileInt("Setup", "TextureQuality", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "TextureQuality", iValue) )
{ {
m_engine->SetTextureQuality(iValue); m_engine->SetTextureQuality(iValue);
} }
if ( GetLocalProfileInt("Setup", "AudioVolume", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "AudioVolume", iValue) )
{ {
m_sound->SetAudioVolume(iValue); m_sound->SetAudioVolume(iValue);
} }
if ( GetLocalProfileInt("Setup", "MidiVolume", iValue) ) // TODO
{ // if ( GetLocalProfileInt("Setup", "MidiVolume", iValue) )
m_sound->SetMidiVolume(iValue); // {
} // m_sound->SetMidiVolume(iValue);
// }
if ( GetLocalProfileInt("Setup", "EditIndentMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
{ {
m_engine->SetEditIndentMode(iValue); m_engine->SetEditIndentMode(iValue);
} }
if ( GetLocalProfileInt("Setup", "EditIndentValue", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentValue", iValue) )
{ {
m_engine->SetEditIndentValue(iValue); m_engine->SetEditIndentValue(iValue);
} }
if ( GetLocalProfileString("Setup", "KeyMap", key, 500) ) // if ( GetLocalProfileString("Setup", "KeyMap", key, 500) )
{ // {
p = key; // p = key;
for ( i=0 ; i<100 ; i++ ) // for ( i=0 ; i<100 ; i++ )
{ // {
if ( p[0] == 0 ) break; // if ( p[0] == 0 ) break;
for ( j=0 ; j<2 ; j++ ) // for ( j=0 ; j<2 ; j++ )
{ // {
sscanf(p, "%d", &iValue); // sscanf(p, "%d", &iValue);
m_engine->SetKey(i, j, iValue); // m_engine->SetKey(i, j, iValue);
while ( *p >= '0' && *p <= '9' ) p++; // while ( *p >= '0' && *p <= '9' ) p++;
while ( *p == ' ' || *p == '+' ) p++; // while ( *p == ' ' || *p == '+' ) p++;
} // }
} // }
} */ // }
/* TODO: #if _NET #if _NET
if ( m_accessEnable ) if ( m_accessEnable )
{ {
if ( GetLocalProfileInt("Setup", "AccessMission", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "AccessMission", iValue) )
{ {
m_accessMission = iValue; m_accessMission = iValue;
} }
if ( GetLocalProfileInt("Setup", "AccessUser", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "AccessUser", iValue) )
{ {
m_accessUser = iValue; m_accessUser = iValue;
} }
} }
#endif */ #endif
/* TODO: profile if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
if ( GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
{ {
m_bDeleteGamer = iValue; m_bDeleteGamer = iValue;
} */ }
} }
@ -6604,14 +6472,14 @@ int CMainDialog::GetSceneRank()
// Returns folder name of the scene that user selected to play. // Returns folder name of the scene that user selected to play.
char* CMainDialog::GetSceneDir() const char* CMainDialog::GetSceneDir()
{ {
int i; int i;
i = (m_sceneRank/100)-1; i = (m_sceneRank/100)-1;
if ( i < 0 || i >= m_userTotal ) return 0; if ( i < 0 || i >= m_userTotal ) return 0;
return m_userList[i]; return m_userList[i].c_str();
} }
// Whether to show the solution. // Whether to show the solution.

View File

@ -78,7 +78,7 @@ public:
std::string & GetStackRead(); std::string & GetStackRead();
char* GetSceneName(); char* GetSceneName();
int GetSceneRank(); int GetSceneRank();
char* GetSceneDir(); const char* GetSceneDir();
bool GetSceneSoluce(); bool GetSceneSoluce();
std::string & GetSavegameDir(); std::string & GetSavegameDir();
std::string & GetPublicDir(); std::string & GetPublicDir();
@ -215,7 +215,8 @@ protected:
bool m_bDeleteGamer; bool m_bDeleteGamer;
int m_userTotal; int m_userTotal;
char m_userList[USERLISTMAX][100];
std::vector<std::string> m_userList;
int m_shotDelay; // number of frames before copy int m_shotDelay; // number of frames before copy
std::string m_shotName; // generate a file name std::string m_shotName; // generate a file name