aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2009-02-21 04:44:20 +0000
committerNicola Mettifogo2009-02-21 04:44:20 +0000
commite088f680a689a2bd5fc51e1986af51a51bf14548 (patch)
tree7bad19b41fe608ba22f9b5824c7c77af0a1e7545
parentfa75bd23e6b710d2f225c9162ca651e7e518ce75 (diff)
downloadscummvm-rg350-e088f680a689a2bd5fc51e1986af51a51bf14548.tar.gz
scummvm-rg350-e088f680a689a2bd5fc51e1986af51a51bf14548.tar.bz2
scummvm-rg350-e088f680a689a2bd5fc51e1986af51a51bf14548.zip
Fix for bug #2619824. Command list execution is now paused when showing credits. This fixes the Amiga demo of Nippon Safes, which would otherwise quit without displaying the credits.
svn-id: r38662
-rw-r--r--engines/parallaction/callables_ns.cpp21
-rw-r--r--engines/parallaction/exec.h7
-rw-r--r--engines/parallaction/exec_br.cpp2
-rw-r--r--engines/parallaction/exec_ns.cpp14
4 files changed, 40 insertions, 4 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index d40f028941..517d33a8e2 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -298,6 +298,19 @@ void Parallaction_ns::_c_setMask(void *parm) {
}
void Parallaction_ns::_c_endComment(void *param) {
+ /*
+ NOTE: this routine is only run when the full game
+ is over. The following command in the scripts is
+ QUIT, which causes the engine to exit and return
+ to system.
+ Since this routine is still *blocking*, QUIT is
+ not executed until the user presses a mouse
+ button. If the input is reconciled with the main
+ loop then the command sequence must be suspended
+ to avoid executing QUIT before this actual
+ routine gets a chance to be run. See bug #2619824
+ for a similar situation.
+ */
showLocationComment(_location._endComment, true);
@@ -416,6 +429,14 @@ void Parallaction_ns::_c_startIntro(void *parm) {
}
void Parallaction_ns::_c_endIntro(void *parm) {
+ // NOTE: suspend command execution queue, to
+ // avoid running the QUIT command before
+ // credits are displayed. This solves bug
+ // #2619824.
+ // Execution of the command list will resume
+ // as soon as runGameFrame is run.
+ _cmdExec->suspend();
+
startCreditSequence();
_intro = false;
}
diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h
index 9e8a803d52..2fd141c414 100644
--- a/engines/parallaction/exec.h
+++ b/engines/parallaction/exec.h
@@ -49,7 +49,6 @@ protected:
struct ParallactionStruct1 {
CommandPtr cmd;
ZonePtr z;
- bool suspend;
} _ctxt;
OpcodeSet _opcodes;
@@ -66,13 +65,19 @@ protected:
void createSuspendList(CommandList::iterator first, CommandList::iterator last);
void cleanSuspendedList();
+ bool _running;
+ bool _suspend;
+
public:
virtual void init() = 0;
virtual void run(CommandList &list, ZonePtr z = nullZonePtr);
void runSuspended();
+ void suspend();
CommandExec(Parallaction *vm) : _vm(vm) {
_suspendedCtxt.valid = false;
+ _suspend = false;
+ _running = false;
}
virtual ~CommandExec() {
for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 40c9de8cda..5ed47dc010 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -155,7 +155,7 @@ DECLARE_COMMAND_OPCODE(drop) {
DECLARE_COMMAND_OPCODE(move) {
_vm->_char.scheduleWalk(_ctxt.cmd->u._move.x, _ctxt.cmd->u._move.y);
- _ctxt.suspend = true;
+ suspend();
}
DECLARE_COMMAND_OPCODE(start) {
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 9bfbd81705..4f7db7749e 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -356,7 +356,8 @@ void CommandExec::runList(CommandList::iterator first, CommandList::iterator las
uint32 useFlags = 0;
bool useLocalFlags;
- _ctxt.suspend = false;
+ _suspend = false;
+ _running = true;
for ( ; first != last; first++) {
if (_vm->shouldQuit())
@@ -385,12 +386,14 @@ void CommandExec::runList(CommandList::iterator first, CommandList::iterator las
(*_opcodes[cmd->_id])();
- if (_ctxt.suspend) {
+ if (_suspend) {
createSuspendList(++first, last);
return;
}
}
+ _running = false;
+
}
void CommandExec::run(CommandList& list, ZonePtr z) {
@@ -427,6 +430,13 @@ void CommandExec::cleanSuspendedList() {
_suspendedCtxt.zone = nullZonePtr;
}
+void CommandExec::suspend() {
+ if (!_running)
+ return;
+
+ _suspend = true;
+}
+
void CommandExec::runSuspended() {
if (_engineFlags & kEngineWalking) {
return;