aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/bg.cpp12
-rw-r--r--engines/cine/cine.cpp8
-rw-r--r--engines/cine/cine.h7
-rw-r--r--engines/cine/script_fw.cpp1
4 files changed, 21 insertions, 7 deletions
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index 449e254021..1c6a55c270 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -38,6 +38,7 @@ byte *additionalBgTable[9];
int16 currentAdditionalBgIdx = 0, currentAdditionalBgIdx2 = 0;
byte loadCtFW(const char *ctName) {
+ debugC(1, kCineDebugCollision, "loadCtFW(\"%s\")", ctName);
uint16 header[32];
byte *ptr, *dataPtr;
@@ -71,12 +72,21 @@ byte loadCtFW(const char *ctName) {
}
byte loadCtOS(const char *ctName) {
+ debugC(1, kCineDebugCollision, "loadCtOS(\"%s\")", ctName);
byte *ptr, *dataPtr;
+ int16 foundFileIdx = findFileInBundle(ctName);
+ if (foundFileIdx == -1) {
+ warning("loadCtOS: Unable to find collision data file '%s'", ctName);
+ // FIXME: Rework this function's return value policy and return an appropriate value here.
+ // The return value isn't yet used for anything so currently it doesn't really matter.
+ return 0;
+ }
+
if (currentCtName != ctName)
strcpy(currentCtName, ctName);
- ptr = dataPtr = readBundleFile(findFileInBundle(ctName));
+ ptr = dataPtr = readBundleFile(foundFileIdx);
uint16 bpp = READ_BE_UINT16(ptr);
ptr += 2;
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 38a0eda13e..5498b0f977 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -53,9 +53,10 @@ Sound *g_sound = 0;
CineEngine *g_cine = 0;
CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
- DebugMan.addDebugChannel(kCineDebugScript, "Script", "Script debug level");
- DebugMan.addDebugChannel(kCineDebugPart, "Part", "Part debug level");
- DebugMan.addDebugChannel(kCineDebugSound, "Sound", "Sound debug level");
+ DebugMan.addDebugChannel(kCineDebugScript, "Script", "Script debug level");
+ DebugMan.addDebugChannel(kCineDebugPart, "Part", "Part debug level");
+ DebugMan.addDebugChannel(kCineDebugSound, "Sound", "Sound debug level");
+ DebugMan.addDebugChannel(kCineDebugCollision, "Collision", "Collision debug level");
_console = new CineConsole(this);
// Setup mixer
@@ -161,6 +162,7 @@ void CineEngine::initialize() {
renderer->initialize();
collisionPage = new byte[320 * 200];
+ memset(collisionPage, 0, 320 * 200);
// Clear part buffer as there's nothing loaded into it yet.
// Its size will change when loading data into it with the loadPart function.
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index dd00d9b206..5f49a2907f 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -217,9 +217,10 @@ enum {
};
enum {
- kCineDebugScript = 1 << 0,
- kCineDebugPart = 1 << 1,
- kCineDebugSound = 1 << 2
+ kCineDebugScript = 1 << 0,
+ kCineDebugPart = 1 << 1,
+ kCineDebugSound = 1 << 2,
+ kCineDebugCollision = 1 << 3
};
enum {
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index 7bd0d99e46..3574a1b73a 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -1915,6 +1915,7 @@ int16 getZoneFromPositionRaw(byte *page, int16 x, int16 y, int16 width) {
}
int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneIdx) {
+ debugC(1, kCineDebugCollision, "checkCollision(objIdx: %d x: %d y:%d numZones:%d zoneIdx: %d)", objIdx, x, y, numZones, zoneIdx);
int16 lx = g_cine->_objectTable[objIdx].x + x;
int16 ly = g_cine->_objectTable[objIdx].y + y;
int16 idx;