From 0c68c0a53ac2ffb5837ca2eada00af7f371bc7c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Apr 2015 04:33:24 -0500 Subject: SHERLOCK: Fix inventory display when player has more than 6 items --- engines/sherlock/inventory.cpp | 6 +++--- engines/sherlock/user_interface.cpp | 31 ++++++++++++------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp index 808429f643..798531ea14 100644 --- a/engines/sherlock/inventory.cpp +++ b/engines/sherlock/inventory.cpp @@ -120,7 +120,7 @@ void Inventory::loadGraphics() { int invNum = findInv((*this)[idx]._name); Common::String fName = Common::String::format("item%02d.vgs", invNum + 1); - _invShapes[idx] = new ImageFile(fName); + _invShapes[idx - _invIndex] = new ImageFile(fName); } _invGraphicsLoaded = true; @@ -302,10 +302,10 @@ void Inventory::invCommands(bool slamIt) { _invMode == 3 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, true, "Give"); screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), - _invMode == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, + _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^^"); screen.print(Common::Point(INVENTORY_POINTS[5][2], CONTROLS_Y1 + 1), - _invMode == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, + _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^"); screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1), (_holdings - _invIndex <= 6) ? COMMAND_NULL : COMMAND_FOREGROUND, diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index c623896c85..7a581ca63b 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -1247,17 +1247,13 @@ void UserInterface::doInvControl() { } if (inv._invIndex) { - screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), - colors[4], "^^"); - screen.print(Common::Point(INVENTORY_POINTS[5][2], CONTROLS_Y1 + 1), - colors[5], "^"); + screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), colors[4], "^^"); + screen.print(Common::Point(INVENTORY_POINTS[5][2], CONTROLS_Y1 + 1), colors[5], "^"); } if ((inv._holdings - inv._invIndex) > 6) { - screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1), - colors[6], "^^"); - screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1 + 1), - colors[7], "^"); + screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1), colors[6], "_"); + screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1 + 1), colors[7], "__"); } bool flag = false; @@ -1339,31 +1335,28 @@ void UserInterface::doInvControl() { inv.loadGraphics(); inv.putInv(1); inv.invCommands(true); - } else if (((found == 5 && events._released) || _key == '-') && inv._invIndex) { + } else if (((found == 5 && events._released) || _key == Common::KEYCODE_MINUS + || _key == Common::KEYCODE_KP_MINUS) && inv._invIndex > 0) { --inv._invIndex; - screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), - COMMAND_HIGHLIGHTED, "^"); + screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), COMMAND_HIGHLIGHTED, "^"); inv.freeGraphics(); inv.loadGraphics(); inv.putInv(1); inv.invCommands(true); - } else if (((found == 6 && events._released) || _key == '+') && - (inv._holdings - inv._invIndex) > 6) { + } else if (((found == 6 && events._released) || _key == Common::KEYCODE_PLUS + || _key == Common::KEYCODE_KP_PLUS) && (inv._holdings - inv._invIndex) > 6) { ++inv._invIndex; - screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1), - COMMAND_HIGHLIGHTED, "_"); + screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1), COMMAND_HIGHLIGHTED, "_"); inv.freeGraphics(); inv.loadGraphics(); inv.putInv(1); inv.invCommands(true); - } else if (((found == 7 && events._released) || _key == '.') && - (inv._holdings - inv._invIndex) > 6) { + } else if (((found == 7 && events._released) || _key == '.') && (inv._holdings - inv._invIndex) > 6) { inv._invIndex += 6; if ((inv._holdings - 6) < inv._invIndex) inv._invIndex = inv._holdings - 6; - screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1 + 1), - COMMAND_HIGHLIGHTED, "_"); + screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1 + 1), COMMAND_HIGHLIGHTED, "_"); inv.freeGraphics(); inv.loadGraphics(); inv.putInv(1); -- cgit v1.2.3