aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/inventory.cpp7
-rw-r--r--engines/sherlock/inventory.h2
-rw-r--r--engines/sherlock/scalpel/scalpel_inventory.h2
-rw-r--r--engines/sherlock/tattoo/tattoo.cpp39
-rw-r--r--engines/sherlock/tattoo/tattoo.h5
-rw-r--r--engines/sherlock/tattoo/tattoo_fixed_text.cpp21
-rw-r--r--engines/sherlock/tattoo/tattoo_fixed_text.h19
-rw-r--r--engines/sherlock/tattoo/widget_inventory.cpp8
-rw-r--r--engines/sherlock/tattoo/widget_verbs.cpp2
9 files changed, 98 insertions, 7 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 492ac736b1..5614775e02 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 20eb6c067b..9d5e2c42a7 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 953e02452f..1a26fabb50 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 c6df9942a7..151d1773fe 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 cd985d433a..0b6a661a3f 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 6232ce4a9b..b444009c3d 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 729b7073de..845d798440 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 fe6fa09bff..ea07793e10 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 159965865a..2eaa70b8ef 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);