diff options
author | Paul Gilbert | 2015-06-28 20:10:02 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-28 20:10:02 -0400 |
commit | a041aec839911793bc34a74f6e88fd37fe8adf3c (patch) | |
tree | 7b0cf988c7fb495ac66eaa57d0e9c657c9618922 /engines/sherlock/tattoo | |
parent | 144aa6483b23e422d458af3a12bed1af6e5e0b33 (diff) | |
download | scummvm-rg350-a041aec839911793bc34a74f6e88fd37fe8adf3c.tar.gz scummvm-rg350-a041aec839911793bc34a74f6e88fd37fe8adf3c.tar.bz2 scummvm-rg350-a041aec839911793bc34a74f6e88fd37fe8adf3c.zip |
SHERLOCK: RT: Inventory window now partially showing
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_inventory.cpp | 63 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_inventory.h | 48 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_inventory.cpp | 2 |
4 files changed, 113 insertions, 1 deletions
diff --git a/engines/sherlock/tattoo/tattoo_inventory.cpp b/engines/sherlock/tattoo/tattoo_inventory.cpp new file mode 100644 index 0000000000..6bd1822c10 --- /dev/null +++ b/engines/sherlock/tattoo/tattoo_inventory.cpp @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "sherlock/tattoo/tattoo_inventory.h" +#include "sherlock/tattoo/tattoo.h" + +namespace Sherlock { + +namespace Tattoo { + +TattooInventory::TattooInventory(SherlockEngine *vm) : Inventory(vm) { + _invShapes.resize(8); +} + +TattooInventory::~TattooInventory() { +} + +void TattooInventory::loadInv() { + // Exit if the inventory names are already loaded + if (_names.size() > 0) + return; + + // Load the inventory names + Common::SeekableReadStream *stream = _vm->_res->load("invent.txt"); + + int count = stream->readByte(); + char c; + + for (int idx = 0; idx < count; ++idx) { + Common::String name; + while ((c = stream->readByte()) != 0) + name += c; + + _names.push_back(name); + } + + delete stream; + + loadGraphics(); +} + +} // End of namespace Tattoo + +} // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo_inventory.h b/engines/sherlock/tattoo/tattoo_inventory.h new file mode 100644 index 0000000000..a18324b785 --- /dev/null +++ b/engines/sherlock/tattoo/tattoo_inventory.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SHERLOCK_TATTOO_INVENTORY_H +#define SHERLOCK_TATTOO_INVENTORY_H + +#include "sherlock/inventory.h" + +namespace Sherlock { + +namespace Tattoo { + +class TattooInventory : public Inventory { +public: + TattooInventory(SherlockEngine *vm); + ~TattooInventory(); + + /** + * Load the list of names the inventory items correspond to, if not already loaded, + * and then calls loadGraphics to load the associated graphics + */ + virtual void loadInv(); +}; + +} // End of namespace Tattoo + +} // End of namespace Sherlock + +#endif diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 51dd4d1f7c..5f9aec89bf 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -568,6 +568,7 @@ void TattooUserInterface::doInventory(int mode) { people[HOLMES].gotoStand(); _inventoryWidget.load(mode); + _inventoryWidget.summonWindow(); _menuMode = INV_MODE; } diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp index ea07793e10..2d5e0c3746 100644 --- a/engines/sherlock/tattoo/widget_inventory.cpp +++ b/engines/sherlock/tattoo/widget_inventory.cpp @@ -91,7 +91,7 @@ void WidgetInventory::drawInventory() { Inventory &inv = *_vm->_inventory; // TODO: Refactor _invIndex into this widget class - for (int idx= 0, itemId = inv._invIndex; idx < NUM_INVENTORY_SHOWN; ++idx) { + for (int idx = 0, itemId = inv._invIndex; idx < NUM_INVENTORY_SHOWN; ++idx, ++itemId) { // Figure out the drawing position Common::Point pt(3 + (INVENTORY_XSIZE + 3) * (idx % (NUM_INVENTORY_SHOWN / 2)), 3 + (INVENTORY_YSIZE + 3) * idx / (NUM_INVENTORY_SHOWN / 2)); |