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
This commit is contained in:
Nicola Mettifogo 2009-02-21 04:44:20 +00:00
parent fa75bd23e6
commit e088f680a6
4 changed files with 40 additions and 4 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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) {

View File

@ -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;