PRINCE: Background interpreter during dialog boxes

This commit is contained in:
lukaslw 2014-08-02 16:03:54 +02:00
parent 54a78d6341
commit 51bc133c43
3 changed files with 11 additions and 4 deletions

View File

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

View File

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

View File

@ -189,7 +189,8 @@ public:
void stopBg() { _bgOpcodePC = 0; }
void step();
void stepBg();
void stepFg();
void storeNewPC(int opcodePC);
int getLastOPCode();
int getFgOpcodePC();