aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/inventory.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-28 22:31:18 -0400
committerPaul Gilbert2015-03-28 22:31:18 -0400
commit7fec58a57d9c45f7b899f67042af57b54ca80252 (patch)
tree16eca932733be1edb5b040af5f6ad5a8544811bf /engines/sherlock/inventory.cpp
parentc28416f38ef77eef0858756d0b3265c44ad90216 (diff)
downloadscummvm-rg350-7fec58a57d9c45f7b899f67042af57b54ca80252.tar.gz
scummvm-rg350-7fec58a57d9c45f7b899f67042af57b54ca80252.tar.bz2
scummvm-rg350-7fec58a57d9c45f7b899f67042af57b54ca80252.zip
SHERLOCK: Beginnings of inventory display
Diffstat (limited to 'engines/sherlock/inventory.cpp')
-rw-r--r--engines/sherlock/inventory.cpp65
1 files changed, 63 insertions, 2 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 8eb7ecc1a1..c39bba4f5b 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -31,6 +31,7 @@ Inventory::Inventory(SherlockEngine *vm) : Common::Array<InventoryItem>(), _vm(v
_invIndex = 0;
_holdings = 0;
_oldFlag = 0;
+ _invFlag = 0;
}
Inventory::~Inventory() {
@@ -129,8 +130,11 @@ void Inventory::putInv(int slamit) {
* 3 = give inventory mode
* 128 = Draw window in the back buffer, but don't display it
*/
-void Inventory::invent(int flag) {
+void Inventory::drawInventory(int flag) {
Screen &screen = *_vm->_screen;
+ UserInterface &ui = *_vm->_ui;
+ int tempFlag = flag;
+
_oldFlag = 7;
loadInv();
@@ -138,7 +142,64 @@ void Inventory::invent(int flag) {
screen._backBuffer = &screen._backBuffer2;
}
-
+ // Draw the window background
+ Surface &bb = *screen._backBuffer;
+ bb.fillRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR);
+ bb.fillRect(Common::Rect(0, CONTROLS_Y1 + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y1 + 10,
+ SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 2, SHERLOCK_SCREEN_WIDTH,
+ SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
+ bb.fillRect(Common::Rect(2, CONTROLS_Y1 + 10, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT - 2),
+ INV_BACKGROUND);
+
+ // Draw the buttons
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[0][0], CONTROLS_Y1, INVENTORY_POINTS[0][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[0][2] - screen.stringWidth("Exit") / 2, "Exit");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[1][0], CONTROLS_Y1, INVENTORY_POINTS[1][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[1][2] - screen.stringWidth("Look") / 2, "Look");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[2][0], CONTROLS_Y1, INVENTORY_POINTS[2][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[2][2] - screen.stringWidth("Use") / 2, "Use");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[3][0], CONTROLS_Y1, INVENTORY_POINTS[3][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[3][2] - screen.stringWidth("Give") / 2, "Give");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[4][0], CONTROLS_Y1, INVENTORY_POINTS[4][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[4][2], "^^");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[5][0], CONTROLS_Y1, INVENTORY_POINTS[5][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[5][2], "^");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[6][0], CONTROLS_Y1, INVENTORY_POINTS[6][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[6][2], "_");
+ screen.makeButton(Common::Rect(INVENTORY_POINTS[7][0], CONTROLS_Y1, INVENTORY_POINTS[7][1],
+ CONTROLS_Y1 + 9), INVENTORY_POINTS[7][2], "__");
+
+ if (tempFlag == 128)
+ flag = 1;
+ ui._invMode = flag;
+
+ if (flag) {
+ ui._oldKey = INVENTORY_COMMANDS[flag];
+ _oldFlag = flag;
+ } else {
+ ui._oldKey = -1;
+ _invFlag = 6;
+ }
+
+ invCommands(0);
+ putInv(0);
+
+ if (tempFlag != 128) {
+ if (!ui._windowStyle) {
+ screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
+ } else {
+ ui.summonWindow(false, CONTROLS_Y1);
+ }
+
+ ui._windowOpen = true;
+ } else {
+ // Reset the screen back buffer to the first buffer now that drawing is done
+ screen._backBuffer = &screen._backBuffer1;
+ }
+
+ ui._oldUse = -1;
}
void Inventory::invCommands(bool slamIt) {