From 79036c5a1dc6e280b0f1454a6b640e546bb36b4b Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 24 Aug 2003 01:47:45 +0000 Subject: Handle hiding of verbs/inventory in v1-v2 games correctly. According to diasm. the verbs areas is only enabled and shown when (_userState & 128) is true and verbs/inventory area is cleared/redrawn on each state change. svn-id: r9837 --- scumm/script.cpp | 5 ----- scumm/script_v2.cpp | 30 ++++++++++++------------------ scumm/verbs.cpp | 15 +++++++-------- 3 files changed, 19 insertions(+), 31 deletions(-) (limited to 'scumm') diff --git a/scumm/script.cpp b/scumm/script.cpp index e599ae456e..18367dbe4a 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -659,11 +659,6 @@ void Scumm::stopObjectCode() { } void Scumm::runInventoryScript(int i) { - // FIXME demo mode in V1 Maniac Mansion shows quotes in this area - // during the introduction - if (_gameId == GID_MANIAC && _version == 1 && _demo_mode) - return; - if (_version <= 2) { redrawV2Inventory(); } else { diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 2562ccd88a..59b8ec7adb 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -1489,7 +1489,6 @@ void Scumm_v2::o2_cursorCommand() { // TODO: Define the magic numbers void Scumm_v2::setUserState(byte state) { if (state & 4) { // Userface _userState = state & (32 | 64 | 128); - runInventoryScript(0); } if (state & 1) { // Freeze @@ -1500,31 +1499,26 @@ void Scumm_v2::setUserState(byte state) { } if (state & 2) { // Cursor Show/Hide - - // Mark verbs as hidden/visible - for (int i = 0; i < _maxVerbs; i++) { - _verbs[i].saveid = !(state & 16); - } - if (state & 16) { _userPut = 1; _cursor.state = 1; - - // Draw all verbs - redrawVerbs(); } else { _userPut = 0; _cursor.state = 0; - - // Hide all verbs - ScummVM::Rect rect; - rect.top = virtscr[2].topline; - rect.bottom = virtscr[2].topline + 6*88; - rect.left = 0; - rect.right = 319; - restoreBG(rect); } } + + // Hide all verbs and inventory + ScummVM::Rect rect; + rect.top = virtscr[2].topline; + rect.bottom = virtscr[2].topline + 8*88; + rect.left = 0; + rect.right = 319; + restoreBG(rect); + + // Draw all verbs and inventory + redrawVerbs(); + runInventoryScript(1); } void Scumm_v2::o2_getActorWalkBox() { diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 4f00d159f5..4922bdc435 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -197,17 +197,9 @@ void Scumm::checkV2Inventory(int x, int y) { void Scumm::redrawV2Inventory() { int i; int max_inv; - ScummVM::Rect inventoryBox; v2_mouseover_box = -1; - // Clear on all invocations, so hiding works properly - inventoryBox.top = virtscr[2].topline + 32; - inventoryBox.bottom = virtscr[2].topline + virtscr[2].height; - inventoryBox.left = 0; - inventoryBox.right = virtscr[2].width; - restoreBG(inventoryBox); - if (!(_userState & 64)) // Don't draw inventory unless active return; @@ -260,6 +252,9 @@ void Scumm::redrawV2Inventory() { } void Scumm::redrawVerbs() { + if (_version <= 2 && !(_userState & 128)) // Don't draw verbs unless active + return; + int i; int verb = (_cursor.state > 0 ? checkMouseOver(_mouse.x, _mouse.y) : 0); for (i = _maxVerbs-1; i >= 0; i--) { @@ -315,6 +310,10 @@ void Scumm::checkExecVerbs() { } void Scumm::verbMouseOver(int verb) { + // Don't do anything unless verbs are active + if (_version <= 2 && !(_userState & 128)) + return; + if (_verbMouseOver == verb) return; -- cgit v1.2.3