[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.209,1.210

Max Horn fingolfin at users.sourceforge.net
Thu Mar 24 16:41:52 CET 2005


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

Modified Files:
	script.cpp 
Log Message:
cleanup

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- script.cpp	12 Mar 2005 06:45:27 -0000	1.209
+++ script.cpp	25 Mar 2005 00:40:58 -0000	1.210
@@ -1122,12 +1122,12 @@
 	ScriptSlot *ss = &vm.slot[_currentScript];
 	int args[16];
 
-	memset(args, 0, sizeof(args));
-
 	if (ss->cutsceneOverride > 0)	// Only terminate if active
 		ss->cutsceneOverride--;
 
+	memset(args, 0, sizeof(args));
 	args[0] = vm.cutSceneData[vm.cutSceneStackPointer];
+
 	VAR(VAR_OVERRIDE) = 0;
 
 	if (vm.cutScenePtr[vm.cutSceneStackPointer] && (ss->cutsceneOverride > 0))	// Only terminate if active
@@ -1142,9 +1142,12 @@
 }
 
 void ScummEngine::abortCutscene() {
-	uint32 offs = vm.cutScenePtr[vm.cutSceneStackPointer];
+	const int idx = vm.cutSceneStackPointer;
+	assert(0 <= idx && idx < 5);
+
+	uint32 offs = vm.cutScenePtr[idx];
 	if (offs) {
-		ScriptSlot *ss = &vm.slot[vm.cutSceneScript[vm.cutSceneStackPointer]];
+		ScriptSlot *ss = &vm.slot[vm.cutSceneScript[idx]];
 		ss->offs = offs;
 		ss->status = ssRunning;
 		ss->freezeCount = 0;
@@ -1153,7 +1156,7 @@
 			ss->cutsceneOverride--;
 
 		VAR(VAR_OVERRIDE) = 1;
-		vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
+		vm.cutScenePtr[idx] = 0;
 
 		// HACK to fix issues with SMUSH and the way it does keyboard handling.
 		// In particular, normally abortCutscene() is being called while no
@@ -1169,10 +1172,8 @@
 }
 
 void ScummEngine::beginOverride() {
-	int idx;
-
-	idx = vm.cutSceneStackPointer;
-	assert(idx < 5);
+	const int idx = vm.cutSceneStackPointer;
+	assert(0 <= idx && idx < 5);
 
 	vm.cutScenePtr[idx] = _scriptPointer - _scriptOrgPointer;
 	vm.cutSceneScript[idx] = _currentScript;
@@ -1188,10 +1189,8 @@
 }
 
 void ScummEngine::endOverride() {
-	int idx;
-
-	idx = vm.cutSceneStackPointer;
-	assert(idx < 5);
+	const int idx = vm.cutSceneStackPointer;
+	assert(0 <= idx && idx < 5);
 
 	vm.cutScenePtr[idx] = 0;
 	vm.cutSceneScript[idx] = 0;





More information about the Scummvm-git-logs mailing list