Added an option to specify the game data path

svn-id: r3636
This commit is contained in:
Vincent Hamm 2002-02-27 22:48:55 +00:00
parent 9a6ac48c0f
commit 71a97abfc2
4 changed files with 21 additions and 8 deletions

View File

@ -64,9 +64,9 @@ void Scumm::openRoom(int room) {
}
if (!(_features & GF_SMALL_HEADER)) {
if(_features & GF_AFTER_V7)
sprintf(buf, "%s.la%d", _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
sprintf(buf, "%s%s.la%d", _gameDataPath, _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
else
sprintf(buf, "%s.%.3d", _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
sprintf(buf, "%s%s.%.3d", _gameDataPath, _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
_encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
} else if(!(_features & GF_SMALL_NAMES)) {
if(room==0 || room>=900) {
@ -78,11 +78,11 @@ void Scumm::openRoom(int room) {
askForDisk(buf);
} else {
sprintf(buf, "%s//disk%.2d.lec",_exe_name,res.roomno[rtRoom][room]);
sprintf(buf, "%sdisk%.2d.lec",_gameDataPath,res.roomno[rtRoom][room]);
_encbyte = 0x69;
}
} else {
sprintf(buf, "%s//%.2d.lfl",_exe_name,room);
sprintf(buf, "%s%.2d.lfl",_gameDataPath,room);
if(_features & GF_OLD_BUNDLE)
_encbyte = 0xFF;
else

View File

@ -806,6 +806,7 @@ struct Scumm {
void *_fileHandle;
void *_sfxFile;
char *_exe_name;
char *_gameDataPath;
byte _saveLoadFlag;
byte _saveLoadSlot;

View File

@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "gui.h"
#include "string.h"
void Scumm::initRandSeeds() {
_randSeed1 = 0xA943DE35;
@ -192,6 +193,8 @@ void Scumm::scummMain(int argc, char **argv) {
_maxHeapThreshold = 450000;
_minHeapThreshold = 400000;
_gameDataPath = NULL;
parseCommandLine(argc, argv);
@ -203,6 +206,10 @@ void Scumm::scummMain(int argc, char **argv) {
_features = GF_DEFAULT;
}
if (!_gameDataPath) {
warning("No path was provided. Assuming that data file are in the current directory");
}
if(_features & GF_AFTER_V7)
setupScummVarsNew();
else
@ -401,12 +408,15 @@ void Scumm::parseCommandLine(int argc, char **argv) {
case 'v':
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
exit(1);
case 'p':
_gameDataPath = argv[++i];
break;
default:
ShowHelpAndExit:;
printf(
"ScummVM - Scumm Interpreter\n"
"Syntax:\n"
"\tscummvm [-b<num>] game\n"
"\tscummvm [-b<num>] [-p path] game\n"
"Flags:\n"
"\tb<num> - start in that room\n"
"\tf - fullscreen mode\n");

View File

@ -376,10 +376,12 @@ void *Scumm::openSfxFile() {
* That way, you can keep .sou files for multiple games in the
* same directory */
sprintf(buf, "%s.sou", _exe_name);
sprintf(buf, "%s%s.sou", _gameDataPath, _exe_name);
file = fopen(buf, "rb");
if (!file)
file = fopen("monster.sou", "rb");
if (!file) {
sprintf(buf, "%smonster.sou", _gameDataPath, _exe_name);
file = fopen(buf, "rb");
}
return file;
}