diff options
author | yinsimei | 2017-07-12 21:17:55 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-13 18:27:45 +0200 |
commit | 6b794d3da775726930f096493bcc9bfbef71d198 (patch) | |
tree | 738e12316d32faa258751f90d971327c253ad588 /engines | |
parent | 3c84965724e246da984b2521a17ab23b5f55f4ec (diff) | |
download | scummvm-rg350-6b794d3da775726930f096493bcc9bfbef71d198.tar.gz scummvm-rg350-6b794d3da775726930f096493bcc9bfbef71d198.tar.bz2 scummvm-rg350-6b794d3da775726930f096493bcc9bfbef71d198.zip |
SLUDGE: remove game settings from Sludge code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/language.cpp | 116 | ||||
-rw-r--r-- | engines/sludge/language.h | 8 |
2 files changed, 2 insertions, 122 deletions
diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp index 2f37eb35c4..5b7adeee3a 100644 --- a/engines/sludge/language.cpp +++ b/engines/sludge/language.cpp @@ -20,6 +20,8 @@ * */ +#include "common/debug.h" + #include "sludge/allfiles.h" #include "sludge/newfatal.h" #include "sludge/moreio.h" @@ -27,126 +29,12 @@ #include "sludge/sludge.h" #include "sludge/CommonCode/version.h" -#include "common/debug.h" - namespace Sludge { int *languageTable; Common::String *languageName; settingsStruct gameSettings; -Common::String getPrefsFilename(Common::String filename) { - // Yes, this trashes the original string, but - // we also free it at the end (warning!)... - - int n = filename.size(); - - if (n > 4 && filename[n - 4] == '.') { - filename.setChar(0, n - 4); - } - - // get file name from dir - int pos = 0; - for (int i = 0; i < n; i++) { - if (filename[i] == '/') - pos = i + 1; - } - - Common::String f = filename.c_str() + pos; - Common::String joined = f + ".ini"; - - return joined; -} - -void readIniFile(const Common::String &filename) { - - Common::String langName = getPrefsFilename(filename); - - Common::File fd; - if (!fd.open(langName)) { - debug(kSludgeDebugDataLoad, "Fail to open language file : %s", langName.c_str()); - return; - } - - gameSettings.languageID = 0; - gameSettings.userFullScreen = false; //defaultUserFullScreen(); TODO: false value - gameSettings.refreshRate = 0; - gameSettings.antiAlias = 1; - gameSettings.fixedPixels = false; - gameSettings.noStartWindow = false; - gameSettings.debugMode = false; - - Common::String lineSoFar = ""; - Common::String secondSoFar = ""; - char readChar = ' '; - bool keepGoing = true; - bool doingSecond = false; - - do { - readChar = fd.readByte(); - if (fd.eos()) { - readChar = '\n'; - keepGoing = false; - } - switch (readChar) { - case '\n': - case '\r': - if (doingSecond) { - if (lineSoFar == "LANGUAGE") { - gameSettings.languageID = (uint)secondSoFar.asUint64(); - } else if (lineSoFar == "WINDOW") { - gameSettings.userFullScreen = !secondSoFar.asUint64(); - } else if (lineSoFar == "REFRESH") { - gameSettings.refreshRate = (uint)secondSoFar.asUint64(); - } else if (lineSoFar == "ANTIALIAS") { - gameSettings.antiAlias = (int)secondSoFar.asUint64(); - } else if (lineSoFar == "FIXEDPIXELS") { - gameSettings.fixedPixels = secondSoFar.asUint64(); - } else if (lineSoFar == "NOSTARTWINDOW") { - gameSettings.noStartWindow = secondSoFar.asUint64(); - } else if (lineSoFar == "DEBUGMODE") { - gameSettings.debugMode = secondSoFar.asUint64(); - } - } - doingSecond = false; - lineSoFar.clear(); - secondSoFar.clear(); - break; - - case '=': - doingSecond = true; - break; - - default: - if (doingSecond) { - secondSoFar += readChar; - } else { - lineSoFar += readChar; - } - break; - } - } while (keepGoing); - - fd.close(); -} - -void saveIniFile(const Common::String &filename) { -#if 0 - char *langName = getPrefsFilename(copyString(filename)); - FILE *fp = fopen(langName, "wt"); - delete langName; - - fprintf(fp, "LANGUAGE=%d\n", gameSettings.languageID); - fprintf(fp, "WINDOW=%d\n", ! gameSettings.userFullScreen); - fprintf(fp, "ANTIALIAS=%d\n", gameSettings.antiAlias); - fprintf(fp, "FIXEDPIXELS=%d\n", gameSettings.fixedPixels); - fprintf(fp, "NOSTARTWINDOW=%d\n", gameSettings.noStartWindow); - fprintf(fp, "DEBUGMODE=%d\n", gameSettings.debugMode); - - fclose(fp); -#endif -} - void makeLanguageTable(Common::File *table) { languageTable = new int[gameSettings.numLanguages + 1]; if (!checkNew(languageTable)) diff --git a/engines/sludge/language.h b/engines/sludge/language.h index 5c2774fae4..2f8d6c0799 100644 --- a/engines/sludge/language.h +++ b/engines/sludge/language.h @@ -31,18 +31,10 @@ namespace Sludge { struct settingsStruct { uint languageID; uint numLanguages; - bool userFullScreen; - uint refreshRate; - int antiAlias; - bool fixedPixels; - bool noStartWindow; - bool debugMode; }; extern settingsStruct gameSettings; -void readIniFile(const Common::String &filename); -void saveIniFile(const Common::String &filename); int getLanguageForFileB(); void makeLanguageTable(Common::File *table); |