diff options
Diffstat (limited to 'engines/tony/mpal/mpal.cpp')
-rw-r--r-- | engines/tony/mpal/mpal.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index da18b538d5..8d83363c24 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -642,6 +642,9 @@ void ScriptThread(CORO_PARAM, const void *param) { CORO_KILL_SELF(); return; } + + // WORKAROUND: Wait for events to pulse. + CORO_SLEEP(1); } } @@ -710,6 +713,9 @@ void ActionThread(CORO_PARAM, const void *param) { GLOBALS._mpalError = 1; break; } + + // WORKAROUND: Wait for events to pulse. + CORO_SLEEP(1); } globalDestroy(_ctx->item); @@ -1121,6 +1127,9 @@ void GroupThread(CORO_PARAM, const void *param) { CORO_KILL_SELF(); return; } + + // WORKAROUND: Wait for events to pulse. + CORO_SLEEP(1); } // The gruop is finished, so we can return to the calling function. @@ -1386,11 +1395,7 @@ bool doSelection(uint32 i, uint32 dwData) { */ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings) { - Common::File hMpc; byte buf[5]; - uint32 nBytesRead; - bool bCompress; - uint32 dwSizeDecomp, dwSizeComp; byte *cmpbuf; // Save the array of custom functions @@ -1398,21 +1403,22 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, GLOBALS._lplpFunctionStrings = lpcfStrings; // OPen the MPC file for reading + Common::File hMpc; if (!hMpc.open(lpszMpcFileName)) return false; // Read and check the header - nBytesRead = hMpc.read(buf, 5); + uint32 nBytesRead = hMpc.read(buf, 5); if (nBytesRead != 5) return false; if (buf[0] != 'M' || buf[1] != 'P' || buf[2] != 'C' || buf[3] != 0x20) return false; - bCompress = buf[4]; + bool bCompress = buf[4]; // Reads the size of the uncompressed file, and allocate memory - dwSizeDecomp = hMpc.readUint32LE(); + uint32 dwSizeDecomp = hMpc.readUint32LE(); if (hMpc.err()) return false; @@ -1422,7 +1428,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, if (bCompress) { // Get the compressed size and read the data in - dwSizeComp = hMpc.readUint32LE(); + uint32 dwSizeComp = hMpc.readUint32LE(); if (hMpc.err()) return false; @@ -1463,7 +1469,7 @@ bool mpalInit(const char *lpszMpcFileName, const char *lpszMprFileName, // Seek to the end of the file to read overall information GLOBALS._hMpr.seek(-12, SEEK_END); - dwSizeComp = GLOBALS._hMpr.readUint32LE(); + uint32 dwSizeComp = GLOBALS._hMpr.readUint32LE(); if (GLOBALS._hMpr.err()) return false; @@ -1941,11 +1947,9 @@ uint32 mpalGetError() { * @returns TRUE if the script 'was launched, FALSE on failure */ bool mpalExecuteScript(int nScript) { - LpMpalScript s; - LockScripts(); int n = scriptGetOrderFromNum(nScript); - s = (LpMpalScript)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalScript)); + LpMpalScript s = (LpMpalScript)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalScript)); if (s == NULL) return false; |