From 51bc133c43227d3bf5a9fb167afcc13c911ec20e Mon Sep 17 00:00:00 2001 From: lukaslw Date: Sat, 2 Aug 2014 16:03:54 +0200 Subject: PRINCE: Background interpreter during dialog boxes --- engines/prince/prince.cpp | 5 +++-- engines/prince/script.cpp | 7 ++++++- engines/prince/script.h | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'engines/prince') diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 33750d50c7..9f01796270 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -2664,8 +2664,8 @@ void PrinceEngine::runDialog() { while (!shouldQuit()) { + _interpreter->stepBg(); drawScreen(); - // TODO - background iterpreter? int dialogX = (640 - _dialogWidth) / 2; int dialogY = 460 - _dialogHeight; @@ -4431,7 +4431,8 @@ void PrinceEngine::mainLoop() { return; } - _interpreter->step(); + _interpreter->stepBg(); + _interpreter->stepFg(); drawScreen(); diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 9b49b749a4..e0fdff1e31 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -429,11 +429,14 @@ void Interpreter::debugInterpreter(const char *s, ...) { //debug("Prince::Script mode %s %s %s", _mode, str.c_str(), buf); } -void Interpreter::step() { +void Interpreter::stepBg() { if (_bgOpcodePC) { _mode = "bg"; _bgOpcodePC = step(_bgOpcodePC); } +} + +void Interpreter::stepFg() { if (_fgOpcodePC) { _mode = "fg"; _fgOpcodePC = step(_fgOpcodePC); @@ -1530,6 +1533,7 @@ void Interpreter::O_DISABLEDIALOGOPT() { void Interpreter::O_SHOWDIALOGBOX() { uint16 box = readScriptFlagValue(); + uint32 currInstr = _currentInstruction; _vm->createDialogBox(box); _flags->setFlagValue(Flags::DIALINES, _vm->_dialogLines); if (_vm->_dialogLines) { @@ -1537,6 +1541,7 @@ void Interpreter::O_SHOWDIALOGBOX() { _vm->runDialog(); _vm->changeCursor(0); } + _currentInstruction = currInstr; debugInterpreter("O_SHOWDIALOGBOX box %d", box); } diff --git a/engines/prince/script.h b/engines/prince/script.h index f033128e97..9c397b0d1f 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -189,7 +189,8 @@ public: void stopBg() { _bgOpcodePC = 0; } - void step(); + void stepBg(); + void stepFg(); void storeNewPC(int opcodePC); int getLastOPCode(); int getFgOpcodePC(); -- cgit v1.2.3