aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/main_loop.cpp7
-rw-r--r--engines/cine/script_fw.cpp20
-rw-r--r--engines/cine/script_os.cpp3
-rw-r--r--engines/cine/various.cpp4
-rw-r--r--engines/cine/various.h1
5 files changed, 30 insertions, 5 deletions
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index 0c5096c0d6..6aa1ec1737 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -235,6 +235,13 @@ void CineEngine::mainLoop(int bootScriptIdx) {
do {
stopMusicAfterFadeOut();
di = executePlayerInput();
+
+ // Clear the zoneQuery table (Operation Stealth specific)
+ if (g_cine->getGameType() == Cine::GType_OS) {
+ for (uint i = 0; i < NUM_MAX_ZONE; i++) {
+ zoneQuery[i] = 0;
+ }
+ }
processSeqList();
executeList1();
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index 845120c99e..b9dcad9877 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -1764,18 +1764,32 @@ int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneI
int16 lx = objectTable[objIdx].x + x;
int16 ly = objectTable[objIdx].y + y;
int16 idx;
+ int16 result = 0;
for (int16 i = 0; i < numZones; i++) {
idx = getZoneFromPositionRaw(page3Raw, lx + i, ly, 320);
- assert(idx >= 0 && idx <= NUM_MAX_ZONE);
+ assert(idx >= 0 && idx < NUM_MAX_ZONE);
+
+ // The zoneQuery table is updated here only in Operation Stealth
+ if (g_cine->getGameType() == Cine::GType_OS) {
+ if (zoneData[idx] >= 0 && zoneData[idx] < NUM_MAX_ZONE) {
+ zoneQuery[zoneData[idx]]++;
+ }
+ }
if (zoneData[idx] == zoneIdx) {
- return 1;
+ result = 1;
+ // Future Wars breaks out early on the first match, but
+ // Operation Stealth doesn't because it needs to update
+ // the zoneQuery table for the whole loop's period.
+ if (g_cine->getGameType() == Cine::GType_FW) {
+ break;
+ }
}
}
- return 0;
+ return result;
}
uint16 compareVars(int16 a, int16 b) {
diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp
index c79da0e230..f958c66fad 100644
--- a/engines/cine/script_os.cpp
+++ b/engines/cine/script_os.cpp
@@ -654,8 +654,7 @@ int FWScript::o2_loadBg() {
*/
int FWScript::o2_wasZoneChecked() {
byte param = getNextByte();
- // FIXME: Using a wrong table here, it's not zoneData we want, but something else (zoneQuery)
- _compare = (param < 16 && zoneData[param]);
+ _compare = (param < NUM_MAX_ZONE && zoneQuery[param]) ? 1 : 0;
debugC(5, kCineDebugScript, "Line: %d: o2_wasZoneChecked(%d)", _line, param);
return 0;
}
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index f39ae4fb35..640ca8a169 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -112,6 +112,7 @@ int16 objListTab[20];
uint16 exitEngine;
uint16 zoneData[NUM_MAX_ZONE];
+uint16 zoneQuery[NUM_MAX_ZONE]; //!< Only exists in Operation Stealth
void stopMusicAfterFadeOut(void) {
@@ -391,6 +392,7 @@ bool brokenSave(Common::InSaveFile &fHandle) {
}
/*! \todo Implement Operation Stealth loading, this is obviously Future Wars only
+ * \todo Add support for loading the zoneQuery table (Operation Stealth specific)
*/
bool CineEngine::makeLoad(char *saveName) {
int16 i;
@@ -588,6 +590,8 @@ bool CineEngine::makeLoad(char *saveName) {
return true;
}
+/*! \todo Add support for saving the zoneQuery table (Operation Stealth specific)
+ */
void makeSave(char *saveFileName) {
int16 i;
Common::OutSaveFile *fHandle;
diff --git a/engines/cine/various.h b/engines/cine/various.h
index 17b11bf72a..c17138e487 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -130,6 +130,7 @@ struct SelectedObjStruct {
#define NUM_MAX_ZONE 16
extern uint16 zoneData[NUM_MAX_ZONE];
+extern uint16 zoneQuery[NUM_MAX_ZONE];
void addMessage(byte param1, int16 param2, int16 param3, int16 param4, int16 param5);