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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Tue Jul 29 15:44:15 CEST 2008


Revision: 33409
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33409&view=rev
Author:   buddha_
Date:     2008-07-29 13:44:14 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
Added purgeSeqList function (Used in mainloop now). Let's see if this helps any...
Renamed functions:
* addScriptToList0 -> addScriptToGlobalScripts
* executeList0     -> executeGlobalScripts
* executeList1     -> executeObjectScripts
* purgeList1       -> purgeObjectScripts (Also added a clarifying TODO to this function)
* purgeList0       -> purgeGlobalScripts (Also added a clarifying TODO to this function)

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

Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp	2008-07-29 12:59:55 UTC (rev 33408)
+++ scummvm/trunk/engines/cine/main_loop.cpp	2008-07-29 13:44:14 UTC (rev 33409)
@@ -179,6 +179,20 @@
 	return k;
 }
 
+/** Removes elements from seqList that have their member variable var4 set to value -1. */
+void purgeSeqList() {
+	Common::List<SeqListElement>::iterator it = seqList.begin();
+	while (it != seqList.end()) {
+		if (it->var4 == -1) {
+			// Erase the element and jump to the next element
+			it = seqList.erase(it);
+		} else {
+			// Let the element be and jump to the next element
+			it++;
+		}
+	}
+}
+
 void CineEngine::mainLoop(int bootScriptIdx) {
 	bool playerAction;
 	uint16 quitFlag;
@@ -195,7 +209,7 @@
 
 		errorVar = 0;
 
-		addScriptToList0(bootScriptIdx);
+		addScriptToGlobalScripts(bootScriptIdx);	
 
 		menuVar = 0;
 
@@ -244,11 +258,12 @@
 		}
 
 		processSeqList();
-		executeList1();
-		executeList0();
+		executeObjectScripts();
+		executeGlobalScripts();
 
-		purgeList1();
-		purgeList0();
+		purgeObjectScripts();
+		purgeGlobalScripts();
+		purgeSeqList();
 
 		if (playerCommand == -1) {
 			setMouseCursor(MOUSE_CURSOR_NORMAL);

Modified: scummvm/trunk/engines/cine/script.h
===================================================================
--- scummvm/trunk/engines/cine/script.h	2008-07-29 12:59:55 UTC (rev 33408)
+++ scummvm/trunk/engines/cine/script.h	2008-07-29 13:44:14 UTC (rev 33409)
@@ -371,16 +371,16 @@
 #define OP_requestCheckPendingDataLoad  0x42
 #define OP_endScript                    0x50
 
-void addScriptToList0(uint16 idx);
+void addScriptToGlobalScripts(uint16 idx);
 int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneIdx);
 
 void runObjectScript(int16 entryIdx);
 
-void executeList1(void);
-void executeList0(void);
+void executeObjectScripts(void);
+void executeGlobalScripts(void);
 
-void purgeList1(void);
-void purgeList0(void);
+void purgeObjectScripts(void);
+void purgeGlobalScripts(void);
 
 } // End of namespace Cine
 

Modified: scummvm/trunk/engines/cine/script_fw.cpp
===================================================================
--- scummvm/trunk/engines/cine/script_fw.cpp	2008-07-29 12:59:55 UTC (rev 33408)
+++ scummvm/trunk/engines/cine/script_fw.cpp	2008-07-29 13:44:14 UTC (rev 33409)
@@ -1279,7 +1279,7 @@
 	assert(param < NUM_MAX_SCRIPT);
 
 	debugC(5, kCineDebugScript, "Line: %d: startScript(%d)", _line, param);
-	addScriptToList0(param);
+	addScriptToGlobalScripts(param);
 	return 0;
 }
 
@@ -1754,7 +1754,7 @@
 
 //-----------------------------------------------------------------------
 
-void addScriptToList0(uint16 idx) {
+void addScriptToGlobalScripts(uint16 idx) {
 	ScriptPtr tmp(scriptInfo->create(*scriptTable[idx], idx));
 	assert(tmp);
 	globalScripts.push_back(tmp);
@@ -1828,7 +1828,7 @@
 	return flag;
 }
 
-void executeList1(void) {
+void executeObjectScripts(void) {
 	ScriptList::iterator it = objectScripts.begin();
 	for (; it != objectScripts.end();) {
 		if ((*it)->_index < 0 || (*it)->execute() < 0) {
@@ -1839,7 +1839,7 @@
 	}
 }
 
-void executeList0(void) {
+void executeGlobalScripts(void) {
 	ScriptList::iterator it = globalScripts.begin();
 	for (; it != globalScripts.end();) {
 		if ((*it)->_index < 0 || (*it)->execute() < 0) {
@@ -1850,12 +1850,16 @@
 	}
 }
 
-/*! \todo objectScripts.clear()?
+/*! \todo Remove object scripts with script index of -1 (Not script position, but script index!).
+ *        This would seem to be valid for both Future Wars and Operation Stealth.
  */
-void purgeList1(void) {
+void purgeObjectScripts(void) {
 }
 
-void purgeList0(void) {
+/*! \todo Remove global scripts with script index of -1 (Not script position, but script index!).
+ *        This would seem to be valid for both Future Wars and Operation Stealth.
+ */
+void purgeGlobalScripts(void) {
 }
 
 ////////////////////////////////////

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2008-07-29 12:59:55 UTC (rev 33408)
+++ scummvm/trunk/engines/cine/various.cpp	2008-07-29 13:44:14 UTC (rev 33409)
@@ -2013,7 +2013,7 @@
 		// fixes a crash when failing copy protection in Amiga or Atari ST
 		// versions of Future Wars.
 		if (loadPrcOk) {
-			addScriptToList0(1);
+			addScriptToGlobalScripts(1);
 		} else if (scumm_stricmp(currentPrcName, COPY_PROT_FAIL_PRC_NAME)) {
 			// We only show an error here for other files than the file that
 			// is loaded if copy protection fails (i.e. L201.ANI).


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