[Scummvm-cvs-logs] SF.net SVN: scummvm: [32790] scummvm/trunk/engines/cine

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Wed Jun 25 23:57:09 CEST 2008


Revision: 32790
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32790&view=rev
Author:   buddha_
Date:     2008-06-25 14:57:08 -0700 (Wed, 25 Jun 2008)

Log Message:
-----------
Implemented support for zoneQuery (Operation Stealth specific).
Fixed opcodes (related to zoneQuery):
- 0x08: o1_checkCollision
- 0x9A: o2_wasZoneChecked
NOTE: Savegame support for the zoneQuery data is broken

Modified Paths:
--------------
    scummvm/trunk/engines/cine/main_loop.cpp
    scummvm/trunk/engines/cine/script_fw.cpp
    scummvm/trunk/engines/cine/script_os.cpp
    scummvm/trunk/engines/cine/various.cpp
    scummvm/trunk/engines/cine/various.h

Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp	2008-06-25 18:51:44 UTC (rev 32789)
+++ scummvm/trunk/engines/cine/main_loop.cpp	2008-06-25 21:57:08 UTC (rev 32790)
@@ -235,6 +235,13 @@
 	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();

Modified: scummvm/trunk/engines/cine/script_fw.cpp
===================================================================
--- scummvm/trunk/engines/cine/script_fw.cpp	2008-06-25 18:51:44 UTC (rev 32789)
+++ scummvm/trunk/engines/cine/script_fw.cpp	2008-06-25 21:57:08 UTC (rev 32790)
@@ -1764,18 +1764,32 @@
 	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) {

Modified: scummvm/trunk/engines/cine/script_os.cpp
===================================================================
--- scummvm/trunk/engines/cine/script_os.cpp	2008-06-25 18:51:44 UTC (rev 32789)
+++ scummvm/trunk/engines/cine/script_os.cpp	2008-06-25 21:57:08 UTC (rev 32790)
@@ -654,8 +654,7 @@
  */
 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;
 }

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2008-06-25 18:51:44 UTC (rev 32789)
+++ scummvm/trunk/engines/cine/various.cpp	2008-06-25 21:57:08 UTC (rev 32790)
@@ -112,6 +112,7 @@
 
 uint16 exitEngine;
 uint16 zoneData[NUM_MAX_ZONE];
+uint16 zoneQuery[NUM_MAX_ZONE]; //!< Only exists in Operation Stealth
 
 
 void stopMusicAfterFadeOut(void) {
@@ -391,6 +392,7 @@
 }
 
 /*! \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 @@
 	return true;
 }
 
+/*! \todo Add support for saving the zoneQuery table (Operation Stealth specific)
+ */
 void makeSave(char *saveFileName) {
 	int16 i;
 	Common::OutSaveFile *fHandle;

Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h	2008-06-25 18:51:44 UTC (rev 32789)
+++ scummvm/trunk/engines/cine/various.h	2008-06-25 21:57:08 UTC (rev 32790)
@@ -130,6 +130,7 @@
 
 #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);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list