mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
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
This commit is contained in:
parent
f46ee2b70c
commit
d83c6d7d68
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user