diff options
| author | Gregory Montoir | 2003-12-29 13:18:24 +0000 |
|---|---|---|
| committer | Gregory Montoir | 2003-12-29 13:18:24 +0000 |
| commit | 14cfaf88520e45205689d35ce14aaa40d2a4368a (patch) | |
| tree | c4fd27b609c0686c329c8ce51031257b35ebf532 /queen/talk.cpp | |
| parent | 7e388f2237a9ad22214374bac3ffbb2a9d14f21a (diff) | |
| download | scummvm-rg350-14cfaf88520e45205689d35ce14aaa40d2a4368a.tar.gz scummvm-rg350-14cfaf88520e45205689d35ce14aaa40d2a4368a.tar.bz2 scummvm-rg350-14cfaf88520e45205689d35ce14aaa40d2a4368a.zip | |
- hack to read patched .dog files (french & italian versions) from game data path instead of data file
- cleanup Resource a bit (add an accessor for ResourceEntry in order to avoid multiple calls to resourceIndex)
svn-id: r12006
Diffstat (limited to 'queen/talk.cpp')
| -rw-r--r-- | queen/talk.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/queen/talk.cpp b/queen/talk.cpp index e531c31e09..4830343b9f 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -31,6 +31,8 @@ #include "queen/sound.h" #include "queen/state.h" +#include "common/file.h" + namespace Queen { /* @@ -378,10 +380,37 @@ void Talk::findDialogueString(byte *ptr, int16 id, int16 max, char *str) { warning("Failed to find string with ID %i", id); } +byte *Talk::loadDialogFile(const char *filename) { + static const struct { + const char *filename; + Language lang; + } dogFiles[] = { + { "chief1.dog", FRENCH }, + { "chief2.dog", FRENCH }, + { "bud1.dog", ITALIAN } + }; + for (int i = 0; i < ARRAYSIZE(dogFiles); ++i) { + if (!scumm_stricmp(filename, dogFiles[i].filename) && + _vm->resource()->getLanguage() == dogFiles[i].lang) { + File fdog; + fdog.open(filename, _vm->getGameDataPath()); + if (fdog.isOpen()) { + debug(0, "Loading dog file '%s' from game data path", filename); + uint32 size = fdog.size() - DOG_HEADER_SIZE; + byte *buf = new byte[size]; + fdog.seek(DOG_HEADER_SIZE); + fdog.read(buf, size); + return buf; + } + } + } + return _vm->resource()->loadFile(filename, DOG_HEADER_SIZE); +} + void Talk::load(const char *filename) { int i; - byte *ptr = _fileData = _vm->resource()->loadFile(filename, 20); + byte *ptr = _fileData = loadDialogFile(filename); if (!_fileData) { error("Failed to load resource data file '%s'", filename); } |
