From 854e351e5b68e2d5f4189c80c22050d589f6ad9d Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 4 Feb 2007 11:16:40 +0000 Subject: Implemented workaround to avoid crashes on location switches, using knowledge from Big Red Adventure. svn-id: r25378 --- engines/parallaction/parallaction.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index a437010c54..31c1dc19f2 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -421,9 +421,20 @@ void Parallaction::runGame() { while ((_engineFlags & kEngineQuit) == 0) { _keyDown = updateInput(); - if ((_mouseHidden == 0) && ((_engineFlags & kEngineMouse) == 0) && ((_engineFlags & kEngineWalking) == 0)) { - debugC(1, kDebugLocation, "runGame: checking input"); - + debugC(1, kDebugLocation, "runGame: input flags (%i, %i, %i, %i)", + _mouseHidden == 0, + (_engineFlags & kEngineMouse) == 0, + (_engineFlags & kEngineWalking) == 0, + (_engineFlags & kEngineChangeLocation) == 0 + ); + + // WORKAROUND: the engine doesn't check for displayed labels before performing a location + // switch, thus crashing whenever a jobDisplayLabel/jEraseLabel pair is left into the + // queue after the character enters a door. + // Skipping input processing when kEngineChangeLocation is set solves the issue. It's + // noteworthy that the programmers added this very check in Big Red Adventure's engine, + // so it should be ok here in Nippon Safes too. + if ((_mouseHidden == 0) && ((_engineFlags & kEngineMouse) == 0) && ((_engineFlags & kEngineWalking) == 0) && ((_engineFlags & kEngineChangeLocation) == 0)) { InputData *v8 = translateInput(); if (v8) processInput(v8); } @@ -969,12 +980,12 @@ void runJobs() { // and is in fact only used to remove jEraseLabel jobs // void jobWaitRemoveJob(void *parm, Job *j) { -// printf("jobWaitRemoveJob(%x)\n", parm); - Job *arg = (Job*)parm; static uint16 count = 0; + debugC(1, kDebugLocation, "jobWaitRemoveJob: count = %i", count); + _engineFlags |= kEngineMouse; count++; -- cgit v1.2.3