diff options
author | Kari Salminen | 2008-07-29 13:44:14 +0000 |
---|---|---|
committer | Kari Salminen | 2008-07-29 13:44:14 +0000 |
commit | d83c6d7d68027d3a174ad305720ed3c5de7cb0c7 (patch) | |
tree | 97251b26608b5c5c2c06819e5f01c6c05d9a0420 /engines/cine | |
parent | f46ee2b70c3722b59e8a95e89e9cba649d87d58b (diff) | |
download | scummvm-rg350-d83c6d7d68027d3a174ad305720ed3c5de7cb0c7.tar.gz scummvm-rg350-d83c6d7d68027d3a174ad305720ed3c5de7cb0c7.tar.bz2 scummvm-rg350-d83c6d7d68027d3a174ad305720ed3c5de7cb0c7.zip |
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)
svn-id: r33409
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/main_loop.cpp | 25 | ||||
-rw-r--r-- | engines/cine/script.h | 10 | ||||
-rw-r--r-- | engines/cine/script_fw.cpp | 18 | ||||
-rw-r--r-- | engines/cine/various.cpp | 2 |
4 files changed, 37 insertions, 18 deletions
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 6aa1ec1737..ffaa1b49b4 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -179,6 +179,20 @@ int getKeyData() { 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 @@ void CineEngine::mainLoop(int bootScriptIdx) { errorVar = 0; - addScriptToList0(bootScriptIdx); + addScriptToGlobalScripts(bootScriptIdx); menuVar = 0; @@ -244,11 +258,12 @@ void CineEngine::mainLoop(int bootScriptIdx) { } processSeqList(); - executeList1(); - executeList0(); + executeObjectScripts(); + executeGlobalScripts(); - purgeList1(); - purgeList0(); + purgeObjectScripts(); + purgeGlobalScripts(); + purgeSeqList(); if (playerCommand == -1) { setMouseCursor(MOUSE_CURSOR_NORMAL); diff --git a/engines/cine/script.h b/engines/cine/script.h index c14b7c70d1..19576e4c1a 100644 --- a/engines/cine/script.h +++ b/engines/cine/script.h @@ -371,16 +371,16 @@ void dumpScript(char *dumpName); #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 diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 6b4ec2790f..84dde264d9 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -1279,7 +1279,7 @@ int FWScript::o1_startGlobalScript() { assert(param < NUM_MAX_SCRIPT); debugC(5, kCineDebugScript, "Line: %d: startScript(%d)", _line, param); - addScriptToList0(param); + addScriptToGlobalScripts(param); return 0; } @@ -1754,7 +1754,7 @@ int FWScript::o1_unloadMask5() { //----------------------------------------------------------------------- -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 @@ uint16 compareVars(int16 a, int16 b) { 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 executeList1(void) { } } -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 @@ void executeList0(void) { } } -/*! \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) { } //////////////////////////////////// diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 9ff0d54f67..14f75efe29 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -2013,7 +2013,7 @@ void checkForPendingDataLoad(void) { // 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). |