aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-09-28 18:15:25 +0000
committerTorbjörn Andersson2010-09-28 18:15:25 +0000
commit2d82cc385ddc87c9be0f3799e9d06e60640e6ac2 (patch)
tree45f6f8b8ce0fd6f3a5f6c97f31ab2487e480ed1d /engines
parent5d1e26d804dd11ec35f6c96f1ab8fe1378d8ede9 (diff)
downloadscummvm-rg350-2d82cc385ddc87c9be0f3799e9d06e60640e6ac2.tar.gz
scummvm-rg350-2d82cc385ddc87c9be0f3799e9d06e60640e6ac2.tar.bz2
scummvm-rg350-2d82cc385ddc87c9be0f3799e9d06e60640e6ac2.zip
SAGA: Fix an ITE intro regression
(Possibly related to bug #3076822 - ITE: Dialog repeats in intro.) The p2_a.voc patch file wasn't played. This was because the engine first loaded p2_a.voc as a replacement for voice resource 4. Then it tried to load p2_a.iaf and, when it failed, removed the patch data for the very same resource. Now it only tries to read a patch if it hasn't already found a patch for the resource. (There may have been a similar bug in the end credits as well.) svn-id: r52928
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/resource.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index cf7474adc1..646ee1d629 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -165,18 +165,21 @@ bool ResourceContext::load(SagaEngine *vm, Resource *resource) {
if ((patchDescription->fileType & _fileType) != 0) {
if (patchDescription->resourceId < _table.size()) {
resourceData = &_table[patchDescription->resourceId];
- resourceData->patchData = new PatchData(patchDescription->fileName);
- if (resourceData->patchData->_patchFile->open(patchDescription->fileName)) {
- resourceData->offset = 0;
- resourceData->size = resourceData->patchData->_patchFile->size();
- // ITE uses several patch files which are loaded and then not needed
- // anymore (as they're in memory), so close them here. IHNM uses only
- // 1 patch file, which is reused, so don't close it
- if (vm->getGameId() == GID_ITE)
- resourceData->patchData->_patchFile->close();
- } else {
- delete resourceData->patchData;
- resourceData->patchData = NULL;
+ // Check if we've already found a patch for this resource. One is enough.
+ if (!resourceData->patchData) {
+ resourceData->patchData = new PatchData(patchDescription->fileName);
+ if (resourceData->patchData->_patchFile->open(patchDescription->fileName)) {
+ resourceData->offset = 0;
+ resourceData->size = resourceData->patchData->_patchFile->size();
+ // ITE uses several patch files which are loaded and then not needed
+ // anymore (as they're in memory), so close them here. IHNM uses only
+ // 1 patch file, which is reused, so don't close it
+ if (vm->getGameId() == GID_ITE)
+ resourceData->patchData->_patchFile->close();
+ } else {
+ delete resourceData->patchData;
+ resourceData->patchData = NULL;
+ }
}
}
}