diff options
author | Paul Gilbert | 2015-08-08 07:00:05 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-08 07:00:05 -0400 |
commit | ee54396126a7b631d682e0cc147088a6bc1b97c9 (patch) | |
tree | 41442cfc08457fff8a236e3501a95d04cb515de5 | |
parent | 0b53820dd91175ff639dd56b4a5e45c99a869dc5 (diff) | |
download | scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.tar.gz scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.tar.bz2 scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.zip |
SHERLOCK: RT: Implemented pickUpObject
-rw-r--r-- | engines/sherlock/tattoo/tattoo_fixed_text.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_fixed_text.h | 1 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 56 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_verbs.cpp | 1 |
4 files changed, 58 insertions, 1 deletions
diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.cpp b/engines/sherlock/tattoo/tattoo_fixed_text.cpp index 5d6e1b7e42..76e7b38052 100644 --- a/engines/sherlock/tattoo/tattoo_fixed_text.cpp +++ b/engines/sherlock/tattoo/tattoo_fixed_text.cpp @@ -57,6 +57,7 @@ static const char *const FIXED_TEXT_ENGLISH[] = { "with", "No effect...", "This person has nothing to say at the moment", + "Picked up", "Page %d", "Close Journal", diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.h b/engines/sherlock/tattoo/tattoo_fixed_text.h index 7ba56c5c97..2052b34cd7 100644 --- a/engines/sherlock/tattoo/tattoo_fixed_text.h +++ b/engines/sherlock/tattoo/tattoo_fixed_text.h @@ -57,6 +57,7 @@ enum FixedTextId { kFixedText_With, kFixedText_NoEffect, kFixedText_NothingToSay, + kFixedText_PickedUp, kFixedText_Page, kFixedText_CloseJournal, diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index dda46deb54..71471970a9 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -21,6 +21,7 @@ */ #include "sherlock/tattoo/tattoo_user_interface.h" +#include "sherlock/tattoo/tattoo_fixed_text.h" #include "sherlock/tattoo/tattoo_journal.h" #include "sherlock/tattoo/tattoo_scene.h" #include "sherlock/tattoo/tattoo.h" @@ -567,7 +568,60 @@ void TattooUserInterface::doControls() { } void TattooUserInterface::pickUpObject(int objNum) { - // TOOD + Inventory &inv = *_vm->_inventory; + Scene &scene = *_vm->_scene; + Talk &talk = *_vm->_talk; + Object &obj = scene._bgShapes[objNum]; + bool printed = false; + int verbField = -1; + + // Find which Verb field to use for pick up data + for (int idx = 0; idx < 6; ++idx) { + if (!scumm_stricmp(obj._use[idx]._target.c_str(), "*PICKUP")) + verbField = idx; + } + + if (verbField != -1) { + if (obj._use[verbField]._cAnimNum) + scene.startCAnim(obj._use[verbField]._cAnimNum - 1); + } + + if (!talk._talkToAbort) { + if (obj._type == NO_SHAPE) + obj._type = INVALID; + else + // Erase shape + obj._type = REMOVE; + } else { + return; + } + + if (verbField != -1) { + for (int idx = 0; idx < 4 && !talk._talkToAbort; ++idx) { + if (obj.checkNameForCodes(obj._use[verbField]._names[idx])) { + if (!talk._talkToAbort) + printed = true; + } + } + } + + if (talk._talkToAbort) + return; + + // Add the item to the player's inventory + inv.putItemInInventory(obj); + + if (!printed) { + Common::String desc = obj._description; + desc.setChar(tolower(desc[0]), 0); + + putMessage("%s %s", FIXED(PickedUp), desc.c_str()); + } + + if (_menuMode != TALK_MODE && _menuMode != MESSAGE_MODE) { + _menuMode = STD_MODE; + _keyState.keycode = Common::KEYCODE_INVALID; + } } void TattooUserInterface::doQuitMenu() { diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp index fd9d1ed6b9..0d83cde6c7 100644 --- a/engines/sherlock/tattoo/widget_verbs.cpp +++ b/engines/sherlock/tattoo/widget_verbs.cpp @@ -209,6 +209,7 @@ void WidgetVerbs::handleEvents() { // Mouse is within the menu // Erase the menu banishWindow(); + events.clearEvents(); // See if they are activating the Look Command if (!_verbCommands[_selector].compareToIgnoreCase(strLook)) { |