aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scalpel/scalpel_inventory.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-28 20:10:02 -0400
committerPaul Gilbert2015-06-28 20:10:02 -0400
commita041aec839911793bc34a74f6e88fd37fe8adf3c (patch)
tree7b0cf988c7fb495ac66eaa57d0e9c657c9618922 /engines/sherlock/scalpel/scalpel_inventory.cpp
parent144aa6483b23e422d458af3a12bed1af6e5e0b33 (diff)
downloadscummvm-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/scalpel/scalpel_inventory.cpp')
-rw-r--r--engines/sherlock/scalpel/scalpel_inventory.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/engines/sherlock/scalpel/scalpel_inventory.cpp b/engines/sherlock/scalpel/scalpel_inventory.cpp
index 95ca67336a..11f2b33eac 100644
--- a/engines/sherlock/scalpel/scalpel_inventory.cpp
+++ b/engines/sherlock/scalpel/scalpel_inventory.cpp
@@ -30,7 +30,8 @@ namespace Sherlock {
namespace Scalpel {
-ScalpelInventory::ScalpelInventory(SherlockEngine *vm) : Inventory(vm), _invIndex(0) {
+ScalpelInventory::ScalpelInventory(SherlockEngine *vm) : Inventory(vm) {
+ _invShapes.resize(6);
}
ScalpelInventory::~ScalpelInventory() {
@@ -216,7 +217,7 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) {
// If an inventory item has disappeared (due to using it or giving it),
// a blank space slot may have appeared. If so, adjust the inventory
- if (_invIndex > 0 && _invIndex > (_holdings - 6)) {
+ if (_invIndex > 0 && _invIndex > (_holdings - (int)_invShapes.size())) {
--_invIndex;
freeGraphics();
loadGraphics();
@@ -232,7 +233,7 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) {
}
// Iterate through displaying up to 6 objects at a time
- for (int idx = _invIndex; idx < _holdings && (idx - _invIndex) < MAX_VISIBLE_INVENTORY; ++idx) {
+ for (int idx = _invIndex; idx < _holdings && (idx - _invIndex) < (int)_invShapes.size(); ++idx) {
int itemNum = idx - _invIndex;
Surface &bb = slamIt == SLAM_SECONDARY_BUFFER ? screen._backBuffer2 : screen._backBuffer1;
Common::Rect r(8 + itemNum * 52, 165, 51 + itemNum * 52, 194);
@@ -267,6 +268,29 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) {
}
}
+void ScalpelInventory::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 streamSize = stream->size();
+ while (stream->pos() < streamSize) {
+ Common::String name;
+ char c;
+ while ((c = stream->readByte()) != 0)
+ name += c;
+
+ _names.push_back(name);
+ }
+
+ delete stream;
+
+ loadGraphics();
+}
+
} // End of namespace Scalpel
} // End of namespace Sherlock