Commit Graph
13 Commits
Author SHA1 Message Date
PushmePullyu 7b2924b83e TINSEL: Fix token function calls from non-coroutines
Add extra bools to track token status. This allows setting
the owner to nullptr when a token is acquired from a
non-coroutine context / nullContext without marking it as free.

Fixes the following assert in Discworld 1 (see #13220):

After using the matches on the drainpipe to get the golden chimney
brush, the game switches to non-interactive scenes twice.
When changing back to the original scene, player control should be
disabled while a short animation plays, but this is not the case.
A mouse click by the player during this animation will then initiate
a walk action and cause a failed assert:

engines/tinsel/events.cpp:280:
 void Tinsel::WalkProcess(Common::CoroBaseContext*&, const void*):
 Assertion `_ctx->pMover->hCpath != NOPOLY' failed.

The game attempts to disable user control via the following call chain:
Tinsel::TinselEngine::NextGameCycle()
  Tinsel::ChangeScene()
    Tinsel::DoRestoreSceneFrame()
      Tinsel::Background::StartupBackground()
        Tinsel::ControlStartOff()
	  Tinsel::Control()
            Tinsel::GetControlToken()

This will set the owner of the control token to the current coroutine:
g_tokens[TOKEN_CONTROL].proc = CoroScheduler.getCurrentProcess()

However, since StartupBackground() is called from a non-coroutine
with a nullContext, getCurrentProcess() will return nullptr,
thereby marking the control token as free and allowing player actions.
2023-08-06 14:49:30 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Filippos Karapetis efb0acb24f TINSEL: Clear some global vars upon engine destruction 2020-10-04 01:15:20 +03:00
Filippos Karapetis 63ae50e790 TINSEL: Replace usage of NULL with nullptr 2020-02-29 02:21:41 +02:00
Johannes Schickel 9b138f4eb4 TINSEL: Make GPL headers consistent in themselves. 2014-02-18 02:39:39 +01:00
Paul Gilbert 41692ef48a TINSEL: Refactored Tinsel engine to use the Common coroutine scheduler 2012-05-17 20:42:23 +10:00
Alyssa Milburn be35baddc7 TINSEL: Rename globals to add g_ prefix. 2012-02-22 23:14:29 +01:00
strangerke 69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Max Horn 1dbf8d73d5 TINSEL: Mark all (?) global vars with a FIXME comment
Use of global vars is what prevents RTL from working in Tinsel (and
probably in other engines). More specifically, the fact that many
global vars are not explicitly inited when the engine is (re)launched.

svn-id: r54262
2010-11-16 09:53:55 +00:00
Max Horn 51933629d1 Changed foo(void) to foo() in almost all non-backend source files
svn-id: r45616
2009-11-02 21:54:57 +00:00
Max Horn f242266f6d Change a couple places from 'end of namespace' to 'End of namespace', for consistency
svn-id: r44634
2009-10-04 21:26:33 +00:00
Max Horn 69dac1d4f2 Moved scheduler / process managment code into a new class Scheduler
svn-id: r33259
2008-07-24 08:59:17 +00:00
Max Horn c441c5261f Added Tinsel engine to main repos (no news item for it ON PURPOSE)
svn-id: r33230
2008-07-23 09:02:47 +00:00