diff options
-rw-r--r-- | engines/simon/icons.cpp | 9 | ||||
-rw-r--r-- | engines/simon/intern.h | 4 | ||||
-rw-r--r-- | engines/simon/res.cpp | 21 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 59 | ||||
-rw-r--r-- | engines/simon/simon.h | 8 |
5 files changed, 23 insertions, 78 deletions
diff --git a/engines/simon/icons.cpp b/engines/simon/icons.cpp index 8bb28258a7..dbaf3ff146 100644 --- a/engines/simon/icons.cpp +++ b/engines/simon/icons.cpp @@ -31,16 +31,11 @@ namespace Simon { void SimonEngine::loadIconFile() { Common::File in; - if (getPlatform() == Common::kPlatformAcorn) - in.open("ICONDATA"); - else if (getPlatform() == Common::kPlatformAmiga) - in.open("icon.pkd"); - else - in.open("ICON.DAT"); uint size; + in.open(getFileName(GAME_ICONFILE)); if (in.isOpen() == false) - error("Can't open icons file 'ICON.DAT'"); + error("Can't open icons file '%s'", getFileName(GAME_ICONFILE)); size = in.size(); diff --git a/engines/simon/intern.h b/engines/simon/intern.h index a1fb7094f7..7cc53f4ca9 100644 --- a/engines/simon/intern.h +++ b/engines/simon/intern.h @@ -145,15 +145,11 @@ struct TimeEvent { struct GameSpecificSettings { #ifndef PALMOS_68K - const char *gme_filename; const char *effects_filename; const char *speech_filename; - const char *gamepc_filename; #else - const char gme_filename[12]; const char effects_filename[12]; const char speech_filename[12]; - const char gamepc_filename[12]; #endif }; diff --git a/engines/simon/res.cpp b/engines/simon/res.cpp index a65b862b7e..67fa3501c2 100644 --- a/engines/simon/res.cpp +++ b/engines/simon/res.cpp @@ -193,15 +193,15 @@ void SimonEngine::loadOffsets(const char *filename, int number, uint32 &file, ui in.close(); } -void SimonEngine::loadGamePcFile(const char *filename) { +void SimonEngine::loadGamePcFile() { Common::File in; int num_inited_objects; int i, file_size; /* read main gamepc file */ - in.open(filename); + in.open(getFileName(GAME_BASEFILE)); if (in.isOpen() == false) { - error("Can't open gamepc file '%s'", gss->gamepc_filename); + error("Can't open gamepc file '%s'", getFileName(GAME_BASEFILE)); } num_inited_objects = allocGamePcVars(&in); @@ -218,9 +218,9 @@ void SimonEngine::loadGamePcFile(const char *filename) { in.close(); /* Read list of TABLE resources */ - in.open("TBLLIST"); + in.open(getFileName(GAME_TBLFILE)); if (in.isOpen() == false) { - error("Can't open table resources file 'TBLLIST'"); + error("Can't open table resources file '%s'", getFileName(GAME_TBLFILE)); } file_size = in.size(); @@ -240,12 +240,9 @@ void SimonEngine::loadGamePcFile(const char *filename) { return; /* Read list of TEXT resources */ - if (getPlatform() == Common::kPlatformAcorn) - in.open("STRIPPED"); - else - in.open("STRIPPED.TXT"); + in.open(getFileName(GAME_STRFILE)); if (in.isOpen() == false) - error("Can't open text resources file 'STRIPPED.TXT'"); + error("Can't open text resources file '%s'", getFileName(GAME_STRFILE)); file_size = in.size(); _strippedTxtMem = (byte *)malloc(file_size); @@ -442,10 +439,10 @@ byte *SimonEngine::readSingleOpcode(Common::File *in, byte *ptr) { void SimonEngine::openGameFile() { if (!(getFeatures() & GF_OLD_BUNDLE)) { _gameFile = new File(); - _gameFile->open(gss->gme_filename); + _gameFile->open(getFileName(GAME_GMEFILE)); if (_gameFile->isOpen() == false) - error("Can't open game file '%s'", gss->gme_filename); + error("Can't open game file '%s'", getFileName(GAME_GMEFILE)); uint32 size = _gameFile->readUint32LE(); diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 9adff9ef75..4245846ec5 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -54,61 +54,23 @@ namespace Simon { #ifdef PALMOS_68K #define PTR(a) a static const GameSpecificSettings *simon1_settings; -static const GameSpecificSettings *simon1acorn_settings; -static const GameSpecificSettings *simon1amiga_settings; -static const GameSpecificSettings *simon1demo_settings; -static const GameSpecificSettings *simon2win_settings; -static const GameSpecificSettings *simon2dos_settings; +static const GameSpecificSettings *simon2_settings; static const GameSpecificSettings *feeblefiles_settings; #else #define PTR(a) &a static const GameSpecificSettings simon1_settings = { - "SIMON.GME", // gme_filename "EFFECTS", // effects_filename "SIMON", // speech_filename - "GAMEPC", // gamepc_filename }; -static const GameSpecificSettings simon1acorn_settings = { - "DATA", // gme_filename - "EFFECTS", // effects_filename - "SIMON", // speech_filename - "GAMEBASE", // gamepc_filename -}; - -static const GameSpecificSettings simon1amiga_settings = { - "", // gme_filename - "", // effects_filename - "", // speech_filename - "gameamiga", // gamepc_filename -}; - -static const GameSpecificSettings simon1demo_settings = { - "", // gme_filename - "", // effects_filename - "", // speech_filename - "GDEMO", // gamepc_filename -}; - -static const GameSpecificSettings simon2win_settings = { - "SIMON2.GME", // gme_filename +static const GameSpecificSettings simon2_settings = { "", // effects_filename "SIMON2", // speech_filename - "GSPTR30", // gamepc_filename -}; - -static const GameSpecificSettings simon2dos_settings = { - "SIMON2.GME", // gme_filename - "", // effects_filename - "", // speech_filename - "GAME32", // gamepc_filename }; static const GameSpecificSettings feeblefiles_settings = { - "", // gme_filename "", // effects_filename "VOICES", // speech_filename - "GAME22", // gamepc_filename }; #endif @@ -570,24 +532,13 @@ int SimonEngine::init() { gss = PTR(feeblefiles_settings); } else if (getGameType() == GType_SIMON2) { if (getFeatures() & GF_TALKIE) { - gss = PTR(simon2win_settings); - // Add default file directories File::addDefaultDirectory(_gameDataPath + "voices/"); File::addDefaultDirectory(_gameDataPath + "VOICES/"); - } else { - gss = PTR(simon2dos_settings); } + gss = PTR(simon2_settings); } else if (getGameType() == GType_SIMON1) { - if (getPlatform() == Common::kPlatformAcorn) { - gss = PTR(simon1acorn_settings); - } else if (getPlatform() == Common::kPlatformAmiga) { - gss = PTR(simon1amiga_settings); - } else if (getGameId() == GID_SIMON1DEMO) { - gss = PTR(simon1demo_settings); - } else { - gss = PTR(simon1_settings); - } + gss = PTR(simon1_settings); } if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) { @@ -3568,7 +3519,7 @@ int SimonEngine::go() { _sound->effectsPause(_effectsPaused ^= 1); } - loadGamePcFile(gss->gamepc_filename); + loadGamePcFile(); addTimeEvent(0, 1); openGameFile(); diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 23679fd852..c29e8e7b1f 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -164,6 +164,12 @@ public: uint32 getFeatures() const { return _gameDescription->features; } Common::Language getLanguage() const { return _gameDescription->language; } Common::Platform getPlatform() const { return _gameDescription->platform; } + const char *getFileName(int type) const { + for (int i = 0; i < _gameDescription->filesCount; i++) { + if (_gameDescription->filesDescriptions[i].fileType == type) + return _gameDescription->filesDescriptions[i].fileName; + } + } protected: void playSting(uint a); @@ -486,7 +492,7 @@ protected: void readGamePcText(Common::File *in); void readItemChildren(Common::File *in, Item *item, uint tmp); void readItemFromGamePc(Common::File *in, Item *item); - void loadGamePcFile(const char *filename); + void loadGamePcFile(); void decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize); void loadOffsets(const char *filename, int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size); void loadSound(uint sound, uint pan, uint vol, uint type); |