[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.35,1.36 logic.h,1.13,1.14

Oliver Kiehl olki at users.sourceforge.net
Sun May 25 08:42:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv23680

Modified Files:
	logic.cpp logic.h 
Log Message:
cleanup/prevent _compact from being overwritten by possible recalls of the interpreter


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- logic.cpp	25 May 2003 14:36:33 -0000	1.35
+++ logic.cpp	25 May 2003 15:41:48 -0000	1.36
@@ -29,7 +29,7 @@
 
 typedef void (SkyLogic::*LogicTable) ();
 static const LogicTable logicTable[] = {
-	&SkyLogic::lreturn,
+	&SkyLogic::nop,
 	&SkyLogic::logicScript,	 // 1  script processor
 	&SkyLogic::autoRoute,	 // 2  Make a route
 	&SkyLogic::arAnim,	 // 3  Follow a route
@@ -100,10 +100,7 @@
 	}
 }
 
-void SkyLogic::lreturn() {
-	// WTF???
-	return;
-}
+void SkyLogic::nop() {}
 
 void SkyLogic::logicScript() {
 	// Process the current mega's script
@@ -915,7 +912,7 @@
 		scriptData += READ_LE_UINT16(scriptData + (scriptNo & 0x0fff));
 
 	uint32 a, b, c;
-	uint16 command, mcode, s;
+	uint16 command, s;
 	uint16 *tmp;
 	int16 t;
 
@@ -989,29 +986,32 @@
 				push(0);
 			break;
 		case 11: // call_mcode
-			s = READ_LE_UINT16(scriptData++);
+			{
+				s = READ_LE_UINT16(scriptData++);
 
-			a = s;
-			b = c = 0;
-			assert(s <= 3);
-			// No, I did not forget the "break"s
-			switch (s) {
-			case 3:
-				c = pop();
-			case 2:
-				b = pop();
-			case 1:
-				a = pop();
-			}
+				a = s;
+				b = c = 0;
+				assert(s <= 3);
+				// No, I did not forget the "break"s
+				switch (s) {
+				case 3:
+					c = pop();
+				case 2:
+					b = pop();
+				case 1:
+					a = pop();
+				}
 
-			// TODO: save stuff (compare asm code)
-			mcode = READ_LE_UINT16(scriptData++)/4; // get mcode number
-			SkyDebug::mcode(mcode, a, b, c);
+				uint16 mcode = READ_LE_UINT16(scriptData++)/4; // get mcode number
+				SkyDebug::mcode(mcode, a, b, c);
 
-			a = (this->*mcodeTable[mcode]) (a, b, c);
+				Compact *saveCpt = _compact;
+				uint32 ret = (this->*mcodeTable[mcode]) (a, b, c);
+				_compact = saveCpt;
 
-			if (!a)
-				return (((scriptData - moduleStart) << 16) | scriptNo);
+				if (!ret)
+					return (((scriptData - moduleStart) << 16) | scriptNo);
+			}
 			break;
 		case 12: // more_than
 			a = pop();

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- logic.h	25 May 2003 14:36:33 -0000	1.13
+++ logic.h	25 May 2003 15:41:48 -0000	1.14
@@ -34,7 +34,7 @@
 	SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound, uint32 gameVersion);
 	void engine();
 
-	void lreturn();
+	void nop();
 	void logicScript();
 	void autoRoute();
 	void arAnim();





More information about the Scummvm-git-logs mailing list