[Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.192,1.193 saveload.h,1.49,1.50 script.cpp,1.206,1.207 script.h,2.5,2.6 script_v90he.cpp,2.169,2.170 scumm.cpp,1.340,1.341 scumm.h,1.535,1.536 vars.cpp,1.114,1.115

kirben kirben at users.sourceforge.net
Mon Feb 28 05:24:36 CET 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5057/scumm

Modified Files:
	saveload.cpp saveload.h script.cpp script.h script_v90he.cpp 
	scumm.cpp scumm.h vars.cpp 
Log Message:

Add support for script cycles used by HE90+ games.


Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- saveload.cpp	29 Jan 2005 15:49:55 -0000	1.192
+++ saveload.cpp	28 Feb 2005 13:23:10 -0000	1.193
@@ -404,8 +404,7 @@
 		MKLINE(ObjectData, parent, sleByte, VER(8)),
 		MKLINE(ObjectData, state, sleByte, VER(8)),
 		MKLINE(ObjectData, fl_object_index, sleByte, VER(8)),
-		// TODO
-		//MKLINE(ObjectData, flag, sleByte, VER(XXX)),
+		MKLINE(ObjectData, flags, sleByte, VER(46)),
 		MKEND()
 	};
 
@@ -609,6 +608,7 @@
 		MKLINE(ScriptSlot, freezeCount, sleByte, VER(8)),
 		MKLINE(ScriptSlot, didexec, sleByte, VER(8)),
 		MKLINE(ScriptSlot, cutsceneOverride, sleByte, VER(8)),
+		MKLINE(ScriptSlot, cycle, sleByte, VER(46)),
 		MK_OBSOLETE(ScriptSlot, unk5, sleByte, VER(8), VER(10)),
 		MKEND()
 	};

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- saveload.h	25 Jan 2005 22:20:46 -0000	1.49
+++ saveload.h	28 Feb 2005 13:23:10 -0000	1.50
@@ -32,7 +32,7 @@
 // Can be useful for other ports too :)
 
 #define VER(x) x
-#define CURRENT_VER 45
+#define CURRENT_VER 46
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
 // we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- script.cpp	29 Jan 2005 15:49:56 -0000	1.206
+++ script.cpp	28 Feb 2005 13:23:10 -0000	1.207
@@ -33,7 +33,7 @@
 namespace Scumm {
 
 /* Start executing script 'script' with the given parameters */
-void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr) {
+void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle) {
 	ScriptSlot *s;
 	byte *scriptPtr;
 	uint32 scriptOffs;
@@ -63,6 +63,9 @@
 				       vm.slot[_currentScript].number, _roomResource);
 	}
 
+	if (cycle == 0)
+		cycle = (_heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1;
+
 	slot = getScriptSlot();
 
 	s = &vm.slot[slot];
@@ -74,13 +77,14 @@
 	s->recursive = recursive;
 	s->freezeCount = 0;
 	s->delayFrameCount = 0;
+	s->cycle = cycle;
 
 	initializeLocals(slot, lvarptr);
 
 	runScriptNested(slot);
 }
 
-void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, bool recursive, int *vars, int slot) {
+void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, bool recursive, int *vars, int slot, int cycle) {
 	ScriptSlot *s;
 	uint32 obcd;
 	int where, offs;
@@ -108,6 +112,9 @@
 	if (offs == 0)
 		return;
 
+	if (cycle == 0)
+		cycle = (_heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1;
+
 	s = &vm.slot[slot];
 	s->number = object;
 	s->offs = obcd + offs;
@@ -117,6 +124,7 @@
 	s->recursive = recursive;
 	s->freezeCount = 0;
 	s->delayFrameCount = 0;
+	s->cycle = cycle;
 
 	initializeLocals(slot, vars);
 
@@ -781,12 +789,16 @@
 	// for loop. But in that case, _curExecScript will be equal to _currentScript. Hence
 	// it would seem we can replace all occurances of _curExecScript by _currentScript.
 	_currentScript = 0xFF;
-	for (_curExecScript = 0; _curExecScript < NUM_SCRIPT_SLOT; _curExecScript++) {
-		if (vm.slot[_curExecScript].status == ssRunning && vm.slot[_curExecScript].didexec == 0) {
-			_currentScript = (byte)_curExecScript;
-			getScriptBaseAddress();
-			getScriptEntryPoint();
-			executeScript();
+	int numCycles = (_heversion >= 90) ? VAR(VAR_NUM_SCRIPT_CYCLES) : 1;
+
+	for (int cycle = 1; cycle <= numCycles; cycle++) {
+		for (_curExecScript = 0; _curExecScript < NUM_SCRIPT_SLOT; _curExecScript++) {
+			if (vm.slot[_curExecScript].status == ssRunning && vm.slot[_curExecScript].didexec == 0) {
+				_currentScript = (byte)_curExecScript;
+				getScriptBaseAddress();
+				getScriptEntryPoint();
+				executeScript();
+			}
 		}
 	}
 }

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.h,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- script.h	1 Jan 2005 16:09:15 -0000	2.5
+++ script.h	28 Feb 2005 13:23:10 -0000	2.6
@@ -50,6 +50,7 @@
 	byte where;
 	byte freezeCount;
 	byte cutsceneOverride;
+	byte cycle;
 };
 
 struct NestedScript {

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.169
retrieving revision 2.170
diff -u -d -r2.169 -r2.170
--- script_v90he.cpp	28 Feb 2005 04:17:17 -0000	2.169
+++ script_v90he.cpp	28 Feb 2005 13:23:10 -0000	2.170
@@ -457,7 +457,7 @@
 	cycle = pop();
 	script = pop();
 	flags = fetchScriptByte();
-	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
+	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args, cycle);
 }
 
 void ScummEngine_v90he::o90_jumpToScriptUnk() {
@@ -470,7 +470,7 @@
 	script = pop();
 	flags = fetchScriptByte();
 	stopObjectCode();
-	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
+	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args, cycle);
 }
 
 void ScummEngine_v90he::o90_wizImageOps() {

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -d -r1.340 -r1.341
--- scumm.cpp	26 Feb 2005 11:02:27 -0000	1.340
+++ scumm.cpp	28 Feb 2005 13:23:10 -0000	1.341
@@ -965,6 +965,9 @@
 	VAR_MUSIC_CHANNEL = 0xFF;
 	VAR_SOUND_CHANNEL = 0xFF;
 
+	VAR_NUM_SCRIPT_CYCLES = 0xFF;
+	VAR_SCRIPT_CYCLE = 0xFF;
+
 	VAR_NUM_ROOMS = 0xFF;
 	VAR_NUM_SCRIPTS = 0xFF;
 	VAR_NUM_SOUNDS = 0xFF;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.535
retrieving revision 1.536
diff -u -d -r1.535 -r1.536
--- scumm.h	20 Feb 2005 13:07:56 -0000	1.535
+++ scumm.h	28 Feb 2005 13:23:10 -0000	1.536
@@ -560,12 +560,12 @@
 	void startManiac();
 
 public:
-	void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr);
+	void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle = 0);
 	void stopScript(int script);
 	void nukeArrays(byte script);
 
 protected:
-	void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1);
+	void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1, int cycle = 0);
 	void runScriptNested(int script);
 	void executeScript();
 	void updateScriptPtr();
@@ -1297,6 +1297,9 @@
 	byte VAR_MUSIC_CHANNEL;
 	byte VAR_SOUND_CHANNEL;
 
+	byte VAR_SCRIPT_CYCLE;
+	byte VAR_NUM_SCRIPT_CYCLES;
+
 	byte VAR_NUM_ROOMS;
 	byte VAR_NUM_SCRIPTS;
 	byte VAR_NUM_SOUNDS;

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- vars.cpp	20 Feb 2005 00:17:22 -0000	1.114
+++ vars.cpp	28 Feb 2005 13:23:10 -0000	1.115
@@ -265,6 +265,9 @@
 		VAR_WINDOWS_VERSION = 79;
 		VAR_KEY_STATE = 86;
 	if (_heversion >= 90) {
+		VAR_SCRIPT_CYCLE = 103;
+		VAR_NUM_SCRIPT_CYCLES = 104;
+
 		VAR_NUM_SPRITES = 106;
 		VAR_WIZ_TCOLOR = 117;
 	}
@@ -508,6 +511,8 @@
 		if (_heversion >= 80)
 			VAR(VAR_WINDOWS_VERSION) = 40;
 		if (_heversion >= 90) {
+			VAR(VAR_SCRIPT_CYCLE) = 1;
+			VAR(VAR_NUM_SCRIPT_CYCLES) = 1;
 			VAR(VAR_WIZ_TCOLOR) = 5;
 			VAR(VAR_NUM_SPRITES) = _numSprites - 1;
 		}





More information about the Scummvm-git-logs mailing list