[Scummvm-cvs-logs] scummvm master -> ee54396126a7b631d682e0cc147088a6bc1b97c9

dreammaster dreammaster at scummvm.org
Sat Aug 8 13:00:54 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ee54396126 SHERLOCK: RT: Implemented pickUpObject


Commit: ee54396126a7b631d682e0cc147088a6bc1b97c9
    https://github.com/scummvm/scummvm/commit/ee54396126a7b631d682e0cc147088a6bc1b97c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-08T07:00:05-04:00

Commit Message:
SHERLOCK: RT: Implemented pickUpObject

Changed paths:
    engines/sherlock/tattoo/tattoo_fixed_text.cpp
    engines/sherlock/tattoo/tattoo_fixed_text.h
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/widget_verbs.cpp



diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.cpp b/engines/sherlock/tattoo/tattoo_fixed_text.cpp
index 5d6e1b7..76e7b38 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 7ba56c5..2052b34 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 dda46de..7147197 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 fd9d1ed..0d83cde 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)) {






More information about the Scummvm-git-logs mailing list