Cleanup use of different filenames in different versions

svn-id: r22078
This commit is contained in:
Travis Howell 2006-04-22 02:14:42 +00:00
parent 76ba8122a6
commit 1a605b2760
5 changed files with 23 additions and 78 deletions

View File

@ -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();

View File

@ -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
};

View File

@ -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();

View File

@ -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();

View File

@ -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);