aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2016-08-24 15:21:42 -0500
committerColin Snover2016-08-24 15:21:42 -0500
commit1b6ea7821696355cb116516834c9caa068b5fc02 (patch)
treeff1d22eb8e500af81731a0b06f13745167e21d18 /engines
parente228b088c687f36eac0dbcbd4478737aeb04f79f (diff)
downloadscummvm-rg350-1b6ea7821696355cb116516834c9caa068b5fc02.tar.gz
scummvm-rg350-1b6ea7821696355cb116516834c9caa068b5fc02.tar.bz2
scummvm-rg350-1b6ea7821696355cb116516834c9caa068b5fc02.zip
SCI32: Remove error check for negative celNo
Negative cel numbers are exploited by at least the hi-res mode of PQ4CD.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/celobj32.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index d053fa2eef..7ca510d2ac 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -916,8 +916,17 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_info.celNo = celCount - 1;
}
- if (_info.celNo < 0) {
- error("Cel is less than 0!");
+ // A celNo can be negative and still valid. At least PQ4CD uses this strange
+ // arrangement to load its high-resolution main menu resource. In PQ4CD, the
+ // low-resolution menu is at view 23, loop 9, cel 0, and the high-resolution
+ // menu is at view 2300, loop 0, cel 0. View 2300 is specially crafted to
+ // have 2 loops, with the second loop having 0 cels. When in high-resolution
+ // mode, the game scripts only change the view resource ID from 23 to 2300,
+ // leaving loop 9 and cel 0 the same. The code in CelObjView constructor
+ // auto-corrects loop 9 to loop 1, and then auto-corrects the cel number
+ // from 0 to -1, which effectively causes loop 0, cel 0 to be read.
+ if (_info.celNo < 0 && _info.loopNo == 0) {
+ error("Cel is less than 0 on loop 0");
}
_hunkPaletteOffset = READ_SCI11ENDIAN_UINT32(data + 8);