diff options
author | Nicola Mettifogo | 2007-03-11 16:53:20 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-11 16:53:20 +0000 |
commit | 63ae591e5ffcb49986853b257b0ac24d6ade12c9 (patch) | |
tree | fa4ea9cbae1225e5121e5196b85a4eb68925aafa | |
parent | 319a1c9b657b46cd7b79a6669939ec59ce352281 (diff) | |
download | scummvm-rg350-63ae591e5ffcb49986853b257b0ac24d6ade12c9.tar.gz scummvm-rg350-63ae591e5ffcb49986853b257b0ac24d6ade12c9.tar.bz2 scummvm-rg350-63ae591e5ffcb49986853b257b0ac24d6ade12c9.zip |
Disk is now completely responsible for retrieving localized location scripts
svn-id: r26094
-rw-r--r-- | engines/parallaction/disk.cpp | 40 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 8 | ||||
-rw-r--r-- | engines/parallaction/menu.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 1 |
4 files changed, 39 insertions, 28 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 1ef02797d9..250b948ca8 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -34,6 +34,32 @@ Disk::Disk(Parallaction* vm) : _vm(vm) { Disk::~Disk() { } +void Disk::setLanguage(uint16 language) { + + switch (language) { + case 0: + strcpy(_languageDir, "it/"); + break; + + case 1: + strcpy(_languageDir, "fr/"); + break; + + case 2: + strcpy(_languageDir, "en/"); + break; + + case 3: + strcpy(_languageDir, "ge/"); + break; + + default: + error("unknown language"); + + } + + return; +} // // decompress a graphics block @@ -208,22 +234,22 @@ Script* Disk::loadLocation(const char *name) { char archivefile[PATH_LEN]; if (IS_MINI_CHARACTER(_vm->_characterName)) { - sprintf(archivefile, "%s%s", _vm->_characterName+4, _vm->_languageDir); + sprintf(archivefile, "%s%s", _vm->_characterName+4, _languageDir); } else { - if (IS_DUMMY_CHARACTER(_vm->_characterName)) strcpy(archivefile, _vm->_languageDir); + if (IS_DUMMY_CHARACTER(_vm->_characterName)) strcpy(archivefile, _languageDir); else { - sprintf(archivefile, "%s%s", _vm->_characterName, _vm->_languageDir); + sprintf(archivefile, "%s%s", _vm->_characterName, _languageDir); } } strcat(archivefile, name); strcat(archivefile, ".loc"); - _vm->_languageDir[2] = '\0'; - _archive.open(_vm->_languageDir); - _vm->_languageDir[2] = '/'; + _languageDir[2] = '\0'; + _archive.open(_languageDir); + _languageDir[2] = '/'; if (!_archive.openArchivedFile(archivefile)) { - sprintf(archivefile, "%s%s.loc", _vm->_languageDir, name); + sprintf(archivefile, "%s%s.loc", _languageDir, name); if (!_archive.openArchivedFile(archivefile)) error("can't find location file '%s'", name); } diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 66c4c6598a..614cf80069 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -88,16 +88,18 @@ private: void loadMaskAndPath(const char *name); protected: - Archive _archive; + Archive _archive; + char _languageDir[3]; - Parallaction *_vm; - Graphics *_gfx; + Parallaction *_vm; + Graphics *_gfx; public: Disk(Parallaction *vm); virtual ~Disk(); void selectArchive(const char *name); + void setLanguage(uint16 language); Script* loadLocation(const char *name); Script* loadScript(const char* name); diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp index 178eec0fb5..283dc886b1 100644 --- a/engines/parallaction/menu.cpp +++ b/engines/parallaction/menu.cpp @@ -128,23 +128,7 @@ void Menu::start() { _vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2); _language = chooseLanguage(); - switch (_language) { - case 0: - strcpy(_engine->_languageDir, "it/"); - break; - - case 1: - strcpy(_engine->_languageDir, "fr/"); - break; - - case 2: - strcpy(_engine->_languageDir, "en/"); - break; - - case 3: - strcpy(_engine->_languageDir, "ge/"); - break; - } + _vm->_disk->setLanguage(_language); _vm->_disk->loadSlide("restore"); _vm->_graphics->palUnk0(_palette); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 4914f3f33e..61cd91424d 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -299,7 +299,6 @@ public: Graphics* _graphics; Menu* _menu; char _characterName[30]; - char _languageDir[6]; Disk* _disk; char _locationNames[120][32]; |