From 791d2b3ba2aea96c45c3221c1ce84a06b4f1f6e3 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Tue, 22 Jul 2008 09:00:39 +0000 Subject: Changed comment display code so that input polling is integrated into the main loop, instead of being performed in a blocking way from a separate routine. svn-id: r33188 --- engines/parallaction/exec_ns.cpp | 33 ++++++++++++++++++++++++++++++--- engines/parallaction/input.cpp | 6 +++--- engines/parallaction/parallaction.cpp | 7 ++++--- engines/parallaction/parallaction.h | 5 +++++ 4 files changed, 42 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 9cde27a853..e596f2e971 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -481,7 +481,15 @@ CommandExec_ns::~CommandExec_ns() { // ZONE TYPE: EXAMINE // -void Parallaction::displayComment(ExamineData *data) { +void Parallaction::enterCommentMode(ZonePtr z) { + if (z == nullZonePtr) { + return; + } + + _commentZone = z; + + ExamineData *data = _commentZone->u.examine; + if (!data->_description) { return; } @@ -510,6 +518,25 @@ void Parallaction::displayComment(ExamineData *data) { _input->_inputMode = Input::kInputModeComment; } +void Parallaction::exitCommentMode() { + _input->_inputMode = Input::kInputModeGame; + + hideDialogueStuff(); + _gfx->setHalfbriteMode(false); + + _cmdExec->run(_commentZone->_commands, _commentZone); + _commentZone = nullZonePtr; +} + +void Parallaction::runCommentFrame() { + if (_input->_inputMode != Input::kInputModeComment) { + return; + } + + if (_input->getLastButtonEvent() == kMouseLeftUp) { + exitCommentMode(); + } +} uint16 Parallaction::runZone(ZonePtr z) { @@ -521,8 +548,8 @@ uint16 Parallaction::runZone(ZonePtr z) { switch(subtype) { case kZoneExamine: - displayComment(z->u.examine); - break; + enterCommentMode(z); + return 0; case kZoneGet: if (z->_flags & kFlagsFixed) break; diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 9601ae3b36..63ab01438d 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -179,13 +179,13 @@ void Input::updateGameInput() { } void Input::updateCommentInput() { - waitUntilLeftClick(); +/* waitUntilLeftClick(); _vm->hideDialogueStuff(); _vm->_gfx->setHalfbriteMode(false); _inputMode = kInputModeGame; -} +*/} InputData* Input::updateInput() { @@ -193,7 +193,7 @@ InputData* Input::updateInput() { switch (_inputMode) { case kInputModeComment: - updateCommentInput(); + readInput(); break; case kInputModeGame: diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cd852f7c84..f7a6fbf260 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -360,9 +360,10 @@ void Parallaction::runGame() { if (_engineFlags & kEngineQuit) return; - if (_input->_inputMode == Input::kInputModeDialogue) { - runDialogueFrame(); - } else { + runDialogueFrame(); + runCommentFrame(); + + if (_input->_inputMode == Input::kInputModeGame) { if (data->_event != kEvNone) { processInput(data); } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index c45d32b013..20d0d90d68 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -422,6 +422,11 @@ public: void exitDialogueMode(); void runDialogueFrame(); + ZonePtr _commentZone; + void enterCommentMode(ZonePtr z); + void exitCommentMode(); + void runCommentFrame(); + }; -- cgit v1.2.3