diff options
author | Paul Gilbert | 2015-06-28 13:29:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-28 13:29:32 -0400 |
commit | d5c1f8b8d645136cf72981186db6e81b2082b773 (patch) | |
tree | fbf461f7cb4650ee7d003b8d94ea976ad02d916f /engines/sherlock/tattoo | |
parent | 631be5b6585e28b5e60aa0ff3be9f8e35d4316a2 (diff) | |
download | scummvm-rg350-d5c1f8b8d645136cf72981186db6e81b2082b773.tar.gz scummvm-rg350-d5c1f8b8d645136cf72981186db6e81b2082b773.tar.bz2 scummvm-rg350-d5c1f8b8d645136cf72981186db6e81b2082b773.zip |
SHERLOCK: RT: Implement initial inventory
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 39 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_fixed_text.cpp | 21 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_fixed_text.h | 19 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_inventory.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_verbs.cpp | 2 |
6 files changed, 87 insertions, 7 deletions
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); |