aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/celobj32.cpp
diff options
context:
space:
mode:
authorColin Snover2016-09-26 10:33:52 -0500
committerColin Snover2016-09-29 19:39:16 -0500
commit2035e21667b746c346e9f95658109904a86597d3 (patch)
tree2971c7dc7b162cc167db21e59ab4ec4a8971c019 /engines/sci/graphics/celobj32.cpp
parent07e1dc3ca5c51130d44fb1f54ceb399ee9039957 (diff)
downloadscummvm-rg350-2035e21667b746c346e9f95658109904a86597d3.tar.gz
scummvm-rg350-2035e21667b746c346e9f95658109904a86597d3.tar.bz2
scummvm-rg350-2035e21667b746c346e9f95658109904a86597d3.zip
SCI32: Add workaround for kNumCels
This workaround may be able to be vastly simplified in the future since, so far, simply returning the number of cels in loop 0 is enough to make all the scripts with this bug work as expected.
Diffstat (limited to 'engines/sci/graphics/celobj32.cpp')
-rw-r--r--engines/sci/graphics/celobj32.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 5d2d5dd6a6..e5149246e4 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -28,6 +28,7 @@
#include "sci/graphics/palette32.h"
#include "sci/graphics/remap32.h"
#include "sci/graphics/text32.h"
+#include "sci/engine/workarounds.h"
namespace Sci {
#pragma mark CelScaler
@@ -819,8 +820,18 @@ int16 CelObjView::getNumCels(const GuiResourceId viewId, const int16 loopNo) {
// explicitly trap the bad condition here and report it so that any other
// game scripts relying on this broken behavior can be fixed as well
if (loopNo == loopCount) {
- const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
- error("[CelObjView::getNumCels]: loop number is equal to loop count in method %s::%s (room %d, script %d, localCall %x)", origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ SciCallOrigin origin;
+ SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kNumCels_workarounds, &origin);
+ switch (solution.type) {
+ case WORKAROUND_NONE:
+ error("[CelObjView::getNumCels]: loop number is equal to loop count in method %s::%s (room %d, script %d, localCall %x)", origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ case WORKAROUND_FAKE:
+ return (int16)solution.value;
+ case WORKAROUND_IGNORE:
+ return 0;
+ case WORKAROUND_STILLCALL:
+ break;
+ }
}
if (loopNo > loopCount || loopNo < 0) {