diff options
author | Matthew Hoops | 2011-07-20 09:27:39 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-07-20 09:27:39 -0400 |
commit | ad293b249e74dd1cfbdbd721d02145efbdaf9eca (patch) | |
tree | e568d96f6d7f64c5e58b4c7cd1c4fda7e649bfc7 /engines/tinsel | |
parent | d7411acc2b1c7702280dbff1c3e1bafee528184b (diff) | |
parent | e25e85fbb047fef895ede97c3c2c73451631052c (diff) | |
download | scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.gz scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.bz2 scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/coroutine.h | 17 | ||||
-rw-r--r-- | engines/tinsel/detection_tables.h | 6 | ||||
-rw-r--r-- | engines/tinsel/pcode.cpp | 8 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/sched.cpp | 9 | ||||
-rw-r--r-- | engines/tinsel/tinlib.cpp | 42 |
6 files changed, 51 insertions, 33 deletions
diff --git a/engines/tinsel/coroutine.h b/engines/tinsel/coroutine.h index b62c40b4e5..5bcf1149d9 100644 --- a/engines/tinsel/coroutine.h +++ b/engines/tinsel/coroutine.h @@ -178,10 +178,15 @@ public: #define CORO_RESCHEDULE do { g_scheduler->reschedule(); CORO_SLEEP(1); } while (0) /** - * Stop the currently running coroutine. + * Stop the currently running coroutine and all calling coroutines. + * + * This sets _sleep to -1 rather than 0 so that the context doesn't get + * deleted by CoroContextHolder, since we want CORO_INVOKE_ARGS to + * propogate the _sleep value and return immediately (the scheduler will + * then delete the entire coroutine's state, including all subcontexts). */ #define CORO_KILL_SELF() \ - do { if (&coroParam != &nullContext) { coroParam->_sleep = 0; } return; } while (0) + do { if (&coroParam != &nullContext) { coroParam->_sleep = -1; } return; } while (0) /** @@ -193,8 +198,12 @@ public: /** * Invoke another coroutine. * - * What makes this tricky is that the coroutine we called my yield/sleep, - * and we need to deal with this adequately. + * If the subcontext still exists after the coroutine is invoked, it has + * either yielded/slept or killed itself, and so we copy the _sleep value + * to our own context and return (execution will continue at the case + * statement below, where we loop and call the coroutine again). + * If the subcontext is null, the coroutine ended normally, and we can + * simply break out of the loop and continue execution. * * @param subCoro name of the coroutine-enabled function to invoke * @param ARGS list of arguments to pass to subCoro diff --git a/engines/tinsel/detection_tables.h b/engines/tinsel/detection_tables.h index c86db9e438..116322aa89 100644 --- a/engines/tinsel/detection_tables.h +++ b/engines/tinsel/detection_tables.h @@ -119,7 +119,7 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, - { + { { "dw", "Floppy", @@ -142,7 +142,7 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, - { + { { "dw", "Floppy", @@ -165,7 +165,7 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, - { + { { "dw", "Floppy", diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 0834e7df24..2ab1e653d4 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -140,11 +140,11 @@ static const byte fragment7[] = {OP_IMM | OPSIZE16, FRAGMENT_WORD(908), OP_JUMP static const byte fragment8[] = {OP_IMM | OPSIZE16, FRAGMENT_WORD(910), OP_JUMP | OPSIZE16, FRAGMENT_WORD(644)}; static const byte fragment9[] = {OP_JUMP | OPSIZE8, 123}; static const byte fragment10[] = {OP_IMM | OPSIZE16, FRAGMENT_WORD(160), OP_JUMP | OPSIZE16, FRAGMENT_WORD(136)}; -static const byte fragment11[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1572), +static const byte fragment11[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1572), OP_ONE, OP_LIBCALL | OPSIZE8, 14, // Re-show the cursor OP_IMM | OPSIZE16, FRAGMENT_WORD(322), OP_LIBCALL | OPSIZE8, 46, // Give back the whistle OP_JUMP | OPSIZE16, FRAGMENT_WORD(1661)}; -static const byte fragment12[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1491), +static const byte fragment12[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1491), OP_ONE, OP_LIBCALL | OPSIZE8, 14, // Re-show the cursor OP_IMM | OPSIZE16, FRAGMENT_WORD(322), OP_LIBCALL | OPSIZE8, 46, // Give back the whistle OP_JUMP | OPSIZE16, FRAGMENT_WORD(1568)}; @@ -208,10 +208,10 @@ const WorkaroundEntry workaroundList[] = { // See bug report #2934211. {TINSEL_V1, true, 352601285, 1569, sizeof(fragment11), fragment11}, {TINSEL_V1, false, 352602304, 1488, sizeof(fragment12), fragment12}, - + // DW2: Corrects a bug with global 306 not being cleared if you leave // the marketplace scene whilst D'Blah is talking (even if it's not - // actually audible); returning to the scene and clicking on him multiple + // actually audible); returning to the scene and clicking on him multiple // times would cause the game to crash {TINSEL_V2, true, 1109294728, 0, sizeof(fragment13), fragment13}, diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 1244168a21..7a973ba4be 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -483,7 +483,7 @@ static void DoSave() { NeedLoad = true; if (SaveSceneName == NULL) { - // Generate a new unique save name + // Generate a new unique save name int i; int ano = 1; // Allocated number diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp index b24d6bf9b8..d6cd806eb2 100644 --- a/engines/tinsel/sched.cpp +++ b/engines/tinsel/sched.cpp @@ -70,6 +70,7 @@ Scheduler::Scheduler() { active = new PROCESS; active->pPrevious = NULL; + active->pNext = NULL; g_scheduler = this; // FIXME HACK } @@ -113,6 +114,14 @@ void Scheduler::reset() { memset(processList, 'S', MAX_PROCESSES * sizeof(PROCESS)); } + // Kill all running processes (i.e. free memory allocated for their state). + PROCESS *pProc = active->pNext; + while (pProc != NULL) { + delete pProc->state; + pProc->state = 0; + pProc = pProc->pNext; + } + // no active processes pCurrent = active->pNext = NULL; diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 7613c1a897..7fbec69cbf 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -214,39 +214,39 @@ static const MASTER_LIB_CODES DW1_CODES[] = { }; static const MASTER_LIB_CODES DW2DEMO_CODES[] = { - ACTORBRIGHTNESS, ACTORDIRECTION, ACTORPALETTE, ACTORPRIORITY, + ACTORBRIGHTNESS, ACTORDIRECTION, ACTORPALETTE, ACTORPRIORITY, ACTORREF, ACTORRGB, ACTORSCALE, ACTORXPOS, ACTORYPOS, ADDHIGHLIGHT, ADDINV, ADDINV1, ADDINV2, ADDOPENINV, ADDTOPIC, - BACKGROUND, CALLACTOR, CALLGLOBALPROCESS, CALLOBJECT, + BACKGROUND, CALLACTOR, CALLGLOBALPROCESS, CALLOBJECT, CALLPROCESS, CALLSCENE, CALLTAG, CAMERA, CDCHANGESCENE, CDDOCHANGE, CDLOAD, CDPLAY, CLEARHOOKSCENE, CLOSEINVENTORY, - CONTROL, CONVERSATION, CURSOR, CURSORXPOS, CURSORYPOS, - DECCONVW, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, + CONTROL, CONVERSATION, CURSOR, CURSORXPOS, CURSORYPOS, + DECCONVW, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, DECLEAD, DECSCALE, DECTAGFONT, DECTALKFONT, DELTOPIC, DIMMUSIC, DROP, DROPOUT, EFFECTACTOR, ENABLEMENU, ENDACTOR, - ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEOUT, FRAMEGRAB, - FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, HASRESTARTED, - HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, + ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEOUT, FRAMEGRAB, + FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, HASRESTARTED, + HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, HIDEREFER, HIDETAG, HOLD, HOOKSCENE, IDLETIME, INSTANTSCROLL, - INVENTORY, INVPLAY, INWHICHINV, KILLACTOR, KILLGLOBALPROCESS, - KILLPROCESS, LOCALVAR, MOVECURSOR, MOVETAG, MOVETAGTO, NEWSCENE, - NOBLOCKING, NOPAUSE, NOSCROLL, OFFSET, OTHEROBJECT, PAUSE, PLAY, - PLAYMUSIC, PLAYRTF, PLAYSAMPLE, POINTACTOR, POINTTAG, POSTACTOR, + INVENTORY, INVPLAY, INWHICHINV, KILLACTOR, KILLGLOBALPROCESS, + KILLPROCESS, LOCALVAR, MOVECURSOR, MOVETAG, MOVETAGTO, NEWSCENE, + NOBLOCKING, NOPAUSE, NOSCROLL, OFFSET, OTHEROBJECT, PAUSE, PLAY, + PLAYMUSIC, PLAYRTF, PLAYSAMPLE, POINTACTOR, POINTTAG, POSTACTOR, POSTGLOBALPROCESS, POSTOBJECT, POSTPROCESS, POSTTAG, PRINT, PRINTCURSOR, PRINTOBJ, PRINTTAG, QUITGAME, RANDOM, RESETIDLETIME, - RESTARTGAME, RESTORESCENE, RUNMODE, SAVESCENE, SAY, SAYAT, - SCALINGREELS, SCREENXPOS, SCREENYPOS, SCROLL, SCROLLPARAMETERS, + RESTARTGAME, RESTORESCENE, RUNMODE, SAVESCENE, SAY, SAYAT, + SCALINGREELS, SCREENXPOS, SCREENYPOS, SCROLL, SCROLLPARAMETERS, SENDACTOR, SENDGLOBALPROCESS, SENDOBJECT, SENDPROCESS, SENDTAG, - SETBRIGHTNESS, SETINVLIMIT, SETINVSIZE, SETLANGUAGE, SETPALETTE, - SETSYSTEMSTRING, SETSYSTEMVAR, SHELL, SHOWACTOR, SHOWBLOCK, + SETBRIGHTNESS, SETINVLIMIT, SETINVSIZE, SETLANGUAGE, SETPALETTE, + SETSYSTEMSTRING, SETSYSTEMVAR, SHELL, SHOWACTOR, SHOWBLOCK, SHOWEFFECT, SHOWPATH, SHOWREFER, SHOWTAG, STAND, STANDTAG, - STARTGLOBALPROCESS, STARTPROCESS, STARTTIMER, STOPWALK, SUBTITLES, - SWALK, SYSTEMVAR, TAGTAGXPOS, TAGTAGYPOS, TAGWALKXPOS, TAGWALKYPOS, + STARTGLOBALPROCESS, STARTPROCESS, STARTTIMER, STOPWALK, SUBTITLES, + SWALK, SYSTEMVAR, TAGTAGXPOS, TAGTAGYPOS, TAGWALKXPOS, TAGWALKYPOS, TALK, TALKAT, TALKPALETTEINDEX, TALKRGB, TALKVIA, THISOBJECT, - THISTAG, TIMER, TOPIC, TOPPLAY, TOPWINDOW, TRANSLUCENTINDEX, - UNDIMMUSIC, UNHOOKSCENE, WAITFRAME, WAITKEY, WAITSCROLL, WAITTIME, - WALK, WALKED, WALKEDPOLY, WALKEDTAG, WALKINGACTOR, WALKPOLY, - WALKTAG, WALKXPOS, WALKYPOS, WHICHCD, WHICHINVENTORY, + THISTAG, TIMER, TOPIC, TOPPLAY, TOPWINDOW, TRANSLUCENTINDEX, + UNDIMMUSIC, UNHOOKSCENE, WAITFRAME, WAITKEY, WAITSCROLL, WAITTIME, + WALK, WALKED, WALKEDPOLY, WALKEDTAG, WALKINGACTOR, WALKPOLY, + WALKTAG, WALKXPOS, WALKYPOS, WHICHCD, WHICHINVENTORY, HIGHEST_LIBCODE }; |