diff options
author | Nicola Mettifogo | 2007-03-02 22:02:19 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-02 22:02:19 +0000 |
commit | f124c22bc5aef464e6e3db7ef6b22cf3cd1ae05e (patch) | |
tree | eba34b07fc3ebf7b10fe73aaaffb94e004d297e6 /engines/parallaction | |
parent | 43f802ef5f36dd2e2c4cf7e23d58242a758489f7 (diff) | |
download | scummvm-rg350-f124c22bc5aef464e6e3db7ef6b22cf3cd1ae05e.tar.gz scummvm-rg350-f124c22bc5aef464e6e3db7ef6b22cf3cd1ae05e.tar.bz2 scummvm-rg350-f124c22bc5aef464e6e3db7ef6b22cf3cd1ae05e.zip |
added openLocation as loader for location scripts resources
svn-id: r25933
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/disk.cpp | 34 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 1 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 35 |
3 files changed, 37 insertions, 33 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 840b9827c7..9bc9f0f8cf 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -55,5 +55,39 @@ void openTalk(const char *name, Cnv *cnv) { } +void openLocation(const char *name, char* script) { + + char archivefile[PATH_LEN]; + + if (_vm->_characterName[0] == 'm') { + sprintf(archivefile, "%s%s", _vm->_characterName+4, _vm->_languageDir); + } else { + if (_vm->_characterName[0] == 'D') strcpy(archivefile, _vm->_languageDir); + else { + sprintf(archivefile, "%s%s", _vm->_characterName, _vm->_languageDir); + } + } + strcat(archivefile, name); + strcat(archivefile, ".loc"); + + _vm->_archive.close(); + + _vm->_languageDir[2] = '\0'; + _vm->_archive.open(_vm->_languageDir); + _vm->_languageDir[2] = '/'; + + if (!_vm->_archive.openArchivedFile(archivefile)) { + sprintf(archivefile, "%s%s.loc", _vm->_languageDir, name); + if (!_vm->_archive.openArchivedFile(archivefile)) + error("can't find location file '%s'", name); + } + + uint32 count = _vm->_archive.size(); + _vm->_archive.read(script, count); + _vm->_archive.closeArchivedFile(); + _vm->_archive.close(); + +} + } // namespace Parallaction diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index ad19a8468f..f35f9dd6ff 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -72,6 +72,7 @@ public: uint32 read(void *dataPtr, uint32 dataSize); }; +void openLocation(const char *name, char* script); void openTalk(const char *name, Cnv *cnv); } // namespace Parallaction diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index 32fbd14d64..8a88ddd1b5 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -48,40 +48,10 @@ void Parallaction::parseLocation(const char *filename) { _vm->_graphics->_proportionalFont = false; _vm->_graphics->setFont("topazcnv"); - char archivefile[PATH_LEN]; - - if (_characterName[0] == 'm') { - sprintf(archivefile, "%s%s", _characterName+4, _languageDir); - } else { - if (_characterName[0] == 'D') strcpy(archivefile, _languageDir); - else { - sprintf(archivefile, "%s%s", _characterName, _languageDir); - } - } - strcat(archivefile, filename); - strcat(archivefile, ".loc"); - - if (strcmp(_disk, "null")) _archive.close(); - - _languageDir[2] = '\0'; - _archive.open(_languageDir); - _languageDir[2] = '/'; - - if (!_archive.openArchivedFile(archivefile)) { - sprintf(archivefile, "%s%s.loc", _languageDir, filename); - if (!_archive.openArchivedFile(archivefile)) - errorFileNotFound(filename); - } - - uint32 count = _archive.size(); location_src = (char*)memAlloc(0x4000); - + openLocation(filename, location_src); _locationScript = new Script(location_src); - _archive.read(location_src, count); - _archive.closeArchivedFile(); - _archive.close(); - fillBuffers(*_locationScript, true); while (scumm_stricmp(_tokens[0], "ENDLOCATION")) { // printf("token[0] = %s", _tokens[0]); @@ -133,8 +103,7 @@ void Parallaction::parseLocation(const char *filename) { } if (!scumm_stricmp(_tokens[0], "DISK")) { strcpy(_disk, _tokens[1]); - strcpy(archivefile, _disk); - _archive.open(archivefile); + _archive.open(_disk); } if (!scumm_stricmp(_tokens[0], "LOCALFLAGS")) { _si = 1; // _localFlagNames[0] = 'visited' |