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 /engines/sherlock/tattoo/tattoo_user_interface.cpp | |
parent | 0b53820dd91175ff639dd56b4a5e45c99a869dc5 (diff) | |
download | scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.tar.gz scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.tar.bz2 scummvm-rg350-ee54396126a7b631d682e0cc147088a6bc1b97c9.zip |
SHERLOCK: RT: Implemented pickUpObject
Diffstat (limited to 'engines/sherlock/tattoo/tattoo_user_interface.cpp')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
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() { |