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

dreammaster dreammaster at scummvm.org
Sun Jun 28 19:31:03 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:
d5c1f8b8d6 SHERLOCK: RT: Implement initial inventory


Commit: d5c1f8b8d645136cf72981186db6e81b2082b773
    https://github.com/scummvm/scummvm/commit/d5c1f8b8d645136cf72981186db6e81b2082b773
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-28T13:29:32-04:00

Commit Message:
SHERLOCK: RT: Implement initial inventory

Changed paths:
    engines/sherlock/inventory.cpp
    engines/sherlock/inventory.h
    engines/sherlock/scalpel/scalpel_inventory.h
    engines/sherlock/tattoo/tattoo.cpp
    engines/sherlock/tattoo/tattoo.h
    engines/sherlock/tattoo/tattoo_fixed_text.cpp
    engines/sherlock/tattoo/tattoo_fixed_text.h
    engines/sherlock/tattoo/widget_inventory.cpp
    engines/sherlock/tattoo/widget_verbs.cpp



diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 492ac73..5614775 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -33,6 +33,13 @@ InventoryItem::InventoryItem(int requiredFlag, const Common::String &name,
 		_examine(examine), _lookFlag(0) {
 }
 
+InventoryItem::InventoryItem(int requiredFlag, const Common::String &name,
+		const Common::String &description, const Common::String &examine, const Common::String &verbName) :
+		_requiredFlag(requiredFlag), _name(name), _description(description),
+		_examine(examine), _lookFlag(0) {
+	_verb._verb = verbName;
+}
+
 void InventoryItem::synchronize(Serializer &s) {
 	s.syncAsSint16LE(_requiredFlag);
 	s.syncAsSint16LE(_lookFlag);
diff --git a/engines/sherlock/inventory.h b/engines/sherlock/inventory.h
index 20eb6c0..9d5e2c4 100644
--- a/engines/sherlock/inventory.h
+++ b/engines/sherlock/inventory.h
@@ -69,6 +69,8 @@ struct InventoryItem {
 	InventoryItem() : _requiredFlag(0), _lookFlag(0), _requiredFlag1(0) {}
 	InventoryItem(int requiredFlag, const Common::String &name,
 		const Common::String &description, const Common::String &examine);
+	InventoryItem(int requiredFlag, const Common::String &name,
+		const Common::String &description, const Common::String &examine, const Common::String &verbName);
 
 	/**
 	 * Synchronize the data for an inventory item
diff --git a/engines/sherlock/scalpel/scalpel_inventory.h b/engines/sherlock/scalpel/scalpel_inventory.h
index 953e024..1a26fab 100644
--- a/engines/sherlock/scalpel/scalpel_inventory.h
+++ b/engines/sherlock/scalpel/scalpel_inventory.h
@@ -31,6 +31,8 @@ namespace Scalpel {
 
 class ScalpelInventory : public Inventory {
 public:
+	int _invIndex;
+public:
 	ScalpelInventory(SherlockEngine *vm);
 	~ScalpelInventory();
 
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index c6df994..151d177 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -22,6 +22,7 @@
 
 #include "engines/util.h"
 #include "sherlock/tattoo/tattoo.h"
+#include "sherlock/tattoo/tattoo_fixed_text.h"
 #include "sherlock/tattoo/tattoo_resources.h"
 #include "sherlock/tattoo/tattoo_scene.h"
 #include "sherlock/tattoo/widget_base.h"
@@ -68,6 +69,9 @@ void TattooEngine::initialize() {
 			PORTRAITS[idx], nullptr, nullptr));
 	}
 
+	// Load the inventory
+	loadInventory();
+
 	// Starting scene
 	_scene->_goToScene = STARTING_INTRO_SCENE;
 
@@ -98,6 +102,41 @@ void TattooEngine::loadInitialPalette() {
 	delete stream;
 }
 
+void TattooEngine::loadInventory() {
+	Inventory &inv = *_inventory;
+
+	Common::String inv1 = _fixedText->getText(kFixedText_Inv1);
+	Common::String inv2 = _fixedText->getText(kFixedText_Inv2);
+	Common::String inv3 = _fixedText->getText(kFixedText_Inv3);
+	Common::String inv4 = _fixedText->getText(kFixedText_Inv4);
+	Common::String inv5 = _fixedText->getText(kFixedText_Inv5);
+	Common::String inv6 = _fixedText->getText(kFixedText_Inv6);
+	Common::String inv7 = _fixedText->getText(kFixedText_Inv7);
+	Common::String inv8 = _fixedText->getText(kFixedText_Inv8);
+	Common::String invDesc1 = _fixedText->getText(kFixedText_InvDesc1);
+	Common::String invDesc2 = _fixedText->getText(kFixedText_InvDesc2);
+	Common::String invDesc3 = _fixedText->getText(kFixedText_InvDesc3);
+	Common::String invDesc4 = _fixedText->getText(kFixedText_InvDesc4);
+	Common::String invDesc5 = _fixedText->getText(kFixedText_InvDesc5);
+	Common::String invDesc6 = _fixedText->getText(kFixedText_InvDesc6);
+	Common::String invDesc7 = _fixedText->getText(kFixedText_InvDesc7);
+	Common::String invDesc8 = _fixedText->getText(kFixedText_InvDesc8);
+	Common::String solve = _fixedText->getText(kFixedText_Solve);
+
+	// Initial inventory
+	inv._holdings = 5;
+	inv.push_back(InventoryItem(0, inv1, invDesc1, "_ITEM01A"));
+	inv.push_back(InventoryItem(0, inv2, invDesc2, "_ITEM02A"));
+	inv.push_back(InventoryItem(0, inv3, invDesc3, "_ITEM03A"));
+	inv.push_back(InventoryItem(0, inv4, invDesc4, "_ITEM04A"));
+	inv.push_back(InventoryItem(0, inv5, invDesc5, "_ITEM05A"));
+
+	// Hidden items
+	inv.push_back(InventoryItem(0, inv6, invDesc6, "_PAP212D", solve));
+	inv.push_back(InventoryItem(0, inv7, invDesc7, "_PAP212I"));
+	inv.push_back(InventoryItem(0, inv8, invDesc8, "_LANT02I"));
+}
+
 void TattooEngine::drawCredits() {
 	// TODO
 }
diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h
index cd985d4..0b6a661 100644
--- a/engines/sherlock/tattoo/tattoo.h
+++ b/engines/sherlock/tattoo/tattoo.h
@@ -51,6 +51,11 @@ private:
 	 * Loads the initial palette for the game
 	 */
 	void loadInitialPalette();
+
+	/**
+	 * Load the initial inventory
+	 */
+	void loadInventory();
 protected:
 	/**
 	 * Initialize the engine
diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.cpp b/engines/sherlock/tattoo/tattoo_fixed_text.cpp
index 6232ce4..b444009 100644
--- a/engines/sherlock/tattoo/tattoo_fixed_text.cpp
+++ b/engines/sherlock/tattoo/tattoo_fixed_text.cpp
@@ -28,12 +28,31 @@ namespace Sherlock {
 namespace Tattoo {
 
 static const char *const FIXED_TEXT_ENGLISH[] = {
+	"Money",
+	"Card",
+	"Tobacco",
+	"Timetable",
+	"Summons",
+	"Foolscap",
+	"Damp Paper",
+	"Bull's Eye",
+
+	"Money",
+	"Card",
+	"Tobacco",
+	"Timetable",
+	"Summons",
+	"Foolscap",
+	"Foolscap",
+	"Bull's Eye Lantern",
+
 	"Open",
 	"Look",
 	"Talk",
 	"Journal",
 	"Inventory",
-	"Options"
+	"Options",
+	"Solve"
 };
 
 TattooFixedText::TattooFixedText(SherlockEngine *vm) : FixedText(vm) {
diff --git a/engines/sherlock/tattoo/tattoo_fixed_text.h b/engines/sherlock/tattoo/tattoo_fixed_text.h
index 729b707..845d798 100644
--- a/engines/sherlock/tattoo/tattoo_fixed_text.h
+++ b/engines/sherlock/tattoo/tattoo_fixed_text.h
@@ -30,12 +30,29 @@ namespace Sherlock {
 namespace Tattoo {
 
 enum FixedTextId {
+	kFixedText_Inv1,
+	kFixedText_Inv2,
+	kFixedText_Inv3,
+	kFixedText_Inv4,
+	kFixedText_Inv5,
+	kFixedText_Inv6,
+	kFixedText_Inv7,
+	kFixedText_Inv8,
+	kFixedText_InvDesc1,
+	kFixedText_InvDesc2,
+	kFixedText_InvDesc3,
+	kFixedText_InvDesc4,
+	kFixedText_InvDesc5,
+	kFixedText_InvDesc6,
+	kFixedText_InvDesc7,
+	kFixedText_InvDesc8,
 	kFixedText_Open,
 	kFixedText_Look,
 	kFixedText_Talk,
 	kFixedText_Journal,
 	kFixedText_Inventory,
-	kFixedText_Options
+	kFixedText_Options,
+	kFixedText_Solve
 };
 
 class TattooFixedText: public FixedText {
diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp
index fe6fa09..ea07793 100644
--- a/engines/sherlock/tattoo/widget_inventory.cpp
+++ b/engines/sherlock/tattoo/widget_inventory.cpp
@@ -90,7 +90,7 @@ void WidgetInventory::load(int mode) {
 void WidgetInventory::drawInventory() {
 	Inventory &inv = *_vm->_inventory;
 
-	// TODO: Refactor _invIndexinto this widget class
+	// TODO: Refactor _invIndex into this widget class
 	for (int idx= 0, itemId = inv._invIndex; idx < NUM_INVENTORY_SHOWN; ++idx) {
 		// Figure out the drawing position
 		Common::Point pt(3 + (INVENTORY_XSIZE + 3) * (idx % (NUM_INVENTORY_SHOWN / 2)),
@@ -151,9 +151,9 @@ void WidgetInventory::drawScrollBar() {
 		r.right / 2, r.bottom - 1 - BUTTON_SIZE + 3 + BUTTON_SIZE / 2), color);
 
 	// Draw the scroll position bar
-	int idx= inv._holdings;
-	if (idx% (NUM_INVENTORY_SHOWN / 2))
-		idx= (idx + (NUM_INVENTORY_SHOWN / 2)) / (NUM_INVENTORY_SHOWN / 2)*(NUM_INVENTORY_SHOWN / 2);
+	int idx = inv._holdings;
+	if (idx % (NUM_INVENTORY_SHOWN / 2))
+		idx = (idx + (NUM_INVENTORY_SHOWN / 2)) / (NUM_INVENTORY_SHOWN / 2) * (NUM_INVENTORY_SHOWN / 2);
 	int barHeight = NUM_INVENTORY_SHOWN * (_bounds.height() - BUTTON_SIZE * 2) / idx;
 	barHeight = CLIP(barHeight, BUTTON_SIZE, _bounds.height() - BUTTON_SIZE * 2);
 
diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index 1599658..2eaa70b 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -136,7 +136,7 @@ void WidgetVerbs::render() {
 		_surface.writeString(_verbCommands[idx], Common::Point((_bounds.width() - _surface.stringWidth(_verbCommands[idx])) / 2, 
 			(_surface.fontHeight() + 7) * idx + 5), INFO_TOP);
 
-		if (idx < ((int)_verbCommands.size() - 1)) {
+		if (idx < (_verbCommands.size() - 1)) {
 			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1), _bounds.width() - 4, INFO_TOP);
 			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.width() - 4, INFO_MIDDLE);
 			_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.width() - 4, INFO_BOTTOM);






More information about the Scummvm-git-logs mailing list