aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-29 09:52:23 -0400
committerPaul Gilbert2015-03-29 09:52:23 -0400
commit3149ce0204f658e7420f16a151710f43052506f2 (patch)
treeab1482c5510d956d259873127d2acd893a2b41ed /engines
parent7fec58a57d9c45f7b899f67042af57b54ca80252 (diff)
downloadscummvm-rg350-3149ce0204f658e7420f16a151710f43052506f2.tar.gz
scummvm-rg350-3149ce0204f658e7420f16a151710f43052506f2.tar.bz2
scummvm-rg350-3149ce0204f658e7420f16a151710f43052506f2.zip
SHERLOCK: Added inventory list and display images in inventory mode
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/inventory.cpp149
-rw-r--r--engines/sherlock/inventory.h6
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp25
-rw-r--r--engines/sherlock/scalpel/scalpel.h2
-rw-r--r--engines/sherlock/screen.cpp47
-rw-r--r--engines/sherlock/screen.h12
-rw-r--r--engines/sherlock/user_interface.cpp86
-rw-r--r--engines/sherlock/user_interface.h4
8 files changed, 262 insertions, 69 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index c39bba4f5b..a7691fc866 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -25,6 +25,14 @@
namespace Sherlock {
+InventoryItem::InventoryItem(int requiredFlag, const Common::String &name,
+ const Common::String &description, const Common::String &examine) :
+ _requiredFlag(requiredFlag), _name(name), _description(description),
+ _examine(examine), _lookFlag(0) {
+}
+
+/*----------------------------------------------------------------*/
+
Inventory::Inventory(SherlockEngine *vm) : Common::Array<InventoryItem>(), _vm(vm) {
Common::fill(&_invShapes[0], &_invShapes[MAX_VISIBLE_INVENTORY], (ImageFile *)nullptr);
_invGraphicsLoaded = false;
@@ -32,6 +40,7 @@ Inventory::Inventory(SherlockEngine *vm) : Common::Array<InventoryItem>(), _vm(v
_holdings = 0;
_oldFlag = 0;
_invFlag = 0;
+ _invMode = 0;
}
Inventory::~Inventory() {
@@ -77,6 +86,8 @@ void Inventory::loadInv() {
}
delete stream;
+
+ loadGraphics();
}
/**
@@ -89,11 +100,11 @@ void Inventory::loadGraphics() {
// Default all inventory slots to empty
Common::fill(&_invShapes[0], &_invShapes[MAX_VISIBLE_INVENTORY], (ImageFile *)nullptr);
- for (int idx = _invIndex; (idx < _holdings) && (idx - _invIndex) < 6; ++idx) {
+ for (int idx = _invIndex; (idx < _holdings) && (idx - _invIndex) < MAX_VISIBLE_INVENTORY; ++idx) {
// Get the name of the item to be dispalyed, figure out it's accompanying
// .VGS file with it's picture, and then load it
int invNum = findInv((*this)[idx]._name);
- Common::String fName = Common::String::format("item%02d.vgs", invNum);
+ Common::String fName = Common::String::format("item%02d.vgs", invNum + 1);
_invShapes[idx] = new ImageFile(fName);
}
@@ -106,20 +117,73 @@ void Inventory::loadGraphics() {
* and returns the numer that matches the passed name
*/
int Inventory::findInv(const Common::String &name) {
- int result = -1;
-
- for (int idx = 0; (idx < _holdings) && result == -1; ++idx) {
+ for (int idx = 0; idx < size(); ++idx) {
if (scumm_stricmp(name.c_str(), _names[idx].c_str()) == 0)
- result = idx;
+ return idx;
}
- if (result == -1)
- result = 1;
- return result;
+ return 1;
}
-void Inventory::putInv(int slamit) {
- // TODO
+/**
+ * Display the character's inventory. The slamIt parameter specifies:
+ * 0 = Draw it on the back buffer, and don't display it
+ * 1 = Draw it on the back buffer, and then display it
+ * 2 = Draw it on the secondary back buffer, and don't display it
+ */
+void Inventory::putInv(int slamIt) {
+ Screen &screen = *_vm->_screen;
+ UserInterface &ui = *_vm->_ui;
+
+ // If an inventory item has disappeared (due to using it or giving it),
+ // a blank space slot may haave appeared. If so, adjust the inventory
+ if (_invIndex > 0 && _invIndex > (_holdings - 6)) {
+ --_invIndex;
+ freeGraphics();
+ loadGraphics();
+ }
+
+ if (slamIt != 2) {
+ screen.makePanel(Common::Rect(6, 163, 54, 197));
+ screen.makePanel(Common::Rect(58, 163, 106, 197));
+ screen.makePanel(Common::Rect(110, 163, 158, 197));
+ screen.makePanel(Common::Rect(162, 163, 210, 197));
+ screen.makePanel(Common::Rect(214, 163, 262, 197));
+ screen.makePanel(Common::Rect(266, 163, 314, 197));
+ }
+
+ // Iterate through displaying up to 6 objects at a time
+ for (int idx = _invIndex; idx < _holdings && (idx - _invIndex) < MAX_VISIBLE_INVENTORY; ++idx) {
+ int itemNum = idx - _invIndex;
+ Surface &bb = slamIt == 2 ? screen._backBuffer2 : screen._backBuffer1;
+ Common::Rect r(8 + itemNum * 52, 165, 51 + itemNum * 52, 194);
+
+ // Draw the background
+ if (idx == ui._selector) {
+ bb.fillRect(r, 235);
+ } else if (slamIt == 2) {
+ bb.fillRect(r, BUTTON_MIDDLE);
+ }
+
+ // Draw the item image
+ Graphics::Surface &img = (*_invShapes[itemNum])[0]._frame;
+ bb.transBlitFrom(img, Common::Point(6 + itemNum * 52 + ((47 - img.w) / 2),
+ 163 + ((33 - img.h) / 2)));
+ }
+
+ if (slamIt == 1)
+ screen.slamArea(6, 163, 308, 34);
+
+ if (slamIt != 2)
+ ui.clearInfo();
+
+ if (slamIt == 0) {
+ invCommands(0);
+ } else if (slamIt == 2) {
+ screen._backBuffer = &screen._backBuffer2;
+ invCommands(0);
+ screen._backBuffer = &screen._backBuffer1;
+ }
}
/**
@@ -173,7 +237,7 @@ void Inventory::drawInventory(int flag) {
if (tempFlag == 128)
flag = 1;
- ui._invMode = flag;
+ _invMode = flag;
if (flag) {
ui._oldKey = INVENTORY_COMMANDS[flag];
@@ -202,8 +266,67 @@ void Inventory::drawInventory(int flag) {
ui._oldUse = -1;
}
+/**
+ * Prints the line of inventory commands at the top of an inventory window with
+ * the correct highlighting
+ */
void Inventory::invCommands(bool slamIt) {
- // TODO
+ Screen &screen = *_vm->_screen;
+ UserInterface &ui = *_vm->_ui;
+
+ if (slamIt) {
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1),
+ _invMode == 0 ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND,
+ true, "Exit");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1),
+ _invMode == 1 ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND,
+ true, "Look");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1),
+ _invMode == 2 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND,
+ true, "Use");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1),
+ _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,
+ "^^");
+ screen.print(Common::Point(INVENTORY_POINTS[5][2], CONTROLS_Y1 + 1),
+ _invMode == 0 ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "^");
+ screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1 + 1),
+ (_holdings - _invIndex <= 6) ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "_");
+ screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1 + 1),
+ (_holdings - _invIndex <= 6) ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "__");
+ if (_invMode != 1)
+ ui.clearInfo();
+ } else {
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1),
+ _invMode == 0 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND,
+ false, "Exit");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1),
+ _invMode == 1 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND,
+ false, "Look");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1),
+ _invMode == 2 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND,
+ false, "Use");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1),
+ _invMode == 3 ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND,
+ false, "Give");
+ screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1),
+ _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "^^");
+ screen.print(Common::Point(INVENTORY_POINTS[5][2], CONTROLS_Y1),
+ _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "^");
+ screen.print(Common::Point(INVENTORY_POINTS[6][2], CONTROLS_Y1),
+ (_holdings - _invIndex < 7) ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "_");
+ screen.print(Common::Point(INVENTORY_POINTS[7][2], CONTROLS_Y1),
+ (_holdings - _invIndex < 7) ? COMMAND_NULL : COMMAND_FOREGROUND,
+ "__");
+ }
}
void Inventory::doInvLite(int index, byte color) {
diff --git a/engines/sherlock/inventory.h b/engines/sherlock/inventory.h
index 7785250e8c..e9a4ba5548 100644
--- a/engines/sherlock/inventory.h
+++ b/engines/sherlock/inventory.h
@@ -38,6 +38,9 @@ struct InventoryItem {
Common::String _description;;
Common::String _examine;
int _lookFlag;
+
+ InventoryItem(int requiredFlag, const Common::String &name,
+ const Common::String &description, const Common::String &examine);
};
class Inventory : public Common::Array<InventoryItem> {
@@ -47,6 +50,7 @@ public:
ImageFile *_invShapes[MAX_VISIBLE_INVENTORY];
Common::StringArray _names;
bool _invGraphicsLoaded;
+ int _invMode;
int _invIndex;
int _holdings;
void freeGraphics();
@@ -64,7 +68,7 @@ public:
int findInv(const Common::String &name);
- void putInv(int slamit);
+ void putInv(int slamIt);
void drawInventory(int flag);
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index db59434f85..d226c2e82a 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -68,6 +68,9 @@ void ScalpelEngine::initialize() {
for (int idx = 0; idx < NUM_PLACES; ++idx)
_map.push_back(Common::Point(MAP_X[idx], MAP_Y[idx]));
+ // Load the inventory
+ loadInventory();
+
// Starting scene
_scene->_goToScene = 4;
}
@@ -176,6 +179,28 @@ bool ScalpelEngine::showOfficeCutscene() {
return true;
}
+void ScalpelEngine::loadInventory() {
+ Inventory &inv = *_inventory;
+
+ // Initial inventory
+ inv._holdings = 2;
+ inv.push_back(InventoryItem(0, "Message", "A message requesting help", "_ITEM03A"));
+ inv.push_back(InventoryItem(0, "Holmes Card", "A number of business cards", "_ITEM07A"));
+
+ // Potential items
+ inv.push_back(InventoryItem(95, "Tickets", "Opera Tickets", "_ITEM10A"));
+ inv.push_back(InventoryItem(138, "Cuff Link", "Cuff Link", "_ITEM04A"));
+ inv.push_back(InventoryItem(138, "Wire Hook", "Wire Hook", "_ITEM06A"));
+ inv.push_back(InventoryItem(150, "Note", "Note", "_ITEM13A"));
+ inv.push_back(InventoryItem(481, "Open Watch", "An open pocket watch", "_ITEM62A"));
+ inv.push_back(InventoryItem(481, "Paper", "A piece of paper with numbers on it", "_ITEM44A"));
+ inv.push_back(InventoryItem(532, "Letter", "A letter folded many times", "_ITEM68A"));
+ inv.push_back(InventoryItem(544, "Tarot", "Tarot Cards", "_ITEM71A"));
+ inv.push_back(InventoryItem(544, "Ornate Key", "An ornate key", "_ITEM70A"));
+ inv.push_back(InventoryItem(586, "Pawn ticket", "A pawn ticket", "_ITEM16A"));
+};
+
+
/**
* Starting a scene within the game
*/
diff --git a/engines/sherlock/scalpel/scalpel.h b/engines/sherlock/scalpel/scalpel.h
index caf33052aa..34d017e757 100644
--- a/engines/sherlock/scalpel/scalpel.h
+++ b/engines/sherlock/scalpel/scalpel.h
@@ -41,6 +41,8 @@ private:
bool showAlleyCutscene();
bool showStreetCutscene();
bool showOfficeCutscene();
+
+ void loadInventory();
protected:
virtual void initialize();
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 16d590c0f4..a3705b54da 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -310,7 +310,7 @@ void Screen::flushImage(ImageFrame *frame, const Common::Point &pt,
* Prints the text passed onto the back buffer at the given position and color.
* The string is then blitted to the screen
*/
-void Screen::print(const Common::Point &pt, int color, const char *format, ...) {
+void Screen::print(const Common::Point &pt, byte color, const char *format, ...) {
// Create the string to display
char buffer[100];
va_list args;
@@ -344,7 +344,7 @@ void Screen::print(const Common::Point &pt, int color, const char *format, ...)
/**
* Print a strings onto the back buffer without blitting it to the screen
*/
-void Screen::gPrint(const Common::Point &pt, int color, const char *format, ...) {
+void Screen::gPrint(const Common::Point &pt, byte color, const char *format, ...) {
// Create the string to display
char buffer[100];
va_list args;
@@ -386,7 +386,7 @@ int Screen::charWidth(char c) {
/**
* Draws the given string into the back buffer using the images stored in _font
*/
-void Screen::writeString(const Common::String &str, const Common::Point &pt, int color) {
+void Screen::writeString(const Common::String &str, const Common::Point &pt, byte color) {
Common::Point charPos = pt;
for (const char *c = str.c_str(); *c; ++c) {
@@ -427,4 +427,45 @@ void Screen::makeButton(const Common::Rect &bounds, int textX,
COMMAND_FOREGROUND, "%s", str.c_str() + 1);
}
+/**
+ * Prints an interface command with the first letter highlighted to indicate
+ * what keyboard shortcut is associated with it
+ */
+void Screen::buttonPrint(const Common::Point &pt, byte color, bool slamIt,
+ const Common::String &str) {
+ int xStart = pt.x - stringWidth(str) / 2;
+
+ if (color == COMMAND_FOREGROUND) {
+ // First character needs to be highlighted
+ if (slamIt) {
+ print(Common::Point(xStart, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", str[0]);
+ print(Common::Point(xStart + charWidth(str[0]), pt.y + 1),
+ color, "%s", str.c_str() + 1);
+ } else {
+ print(Common::Point(xStart, pt.y), COMMAND_HIGHLIGHTED, "%c", str[0]);
+ print(Common::Point(xStart + charWidth(str[0]), pt.y),
+ color, "%s", str.c_str() + 1);
+ }
+ } else {
+ print(Common::Point(xStart, slamIt ? pt.y + 1 : pt.y), COMMAND_HIGHLIGHTED,
+ "%s", str.c_str());
+ }
+}
+
+/**
+ * Draw a panel in th eback buffer with a raised area effect around the edges
+ */
+void Screen::makePanel(const Common::Rect &r) {
+ _backBuffer->fillRect(r, BUTTON_MIDDLE);
+ _backBuffer->hLine(r.left, r.top, r.right - 2, BUTTON_TOP);
+ _backBuffer->hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP);
+ _backBuffer->vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP);
+ _backBuffer->vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
+
+ _backBuffer->vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM);
+ _backBuffer->vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM);
+ _backBuffer->hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM);
+ _backBuffer->hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM);
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index f33bbfceab..5047d40216 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -44,6 +44,8 @@ enum {
INV_BACKGROUND = 1,
COMMAND_HIGHLIGHTED = 10,
COMMAND_FOREGROUND = 15,
+ COMMAND_BACKGROUND = 4,
+ COMMAND_NULL = 248,
BUTTON_TOP = 233,
BUTTON_MIDDLE = 244,
BUTTON_BOTTOM = 248,
@@ -65,7 +67,7 @@ private:
bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2);
- void writeString(const Common::String &str, const Common::Point &pt, int color);
+ void writeString(const Common::String &str, const Common::Point &pt, byte color);
protected:
virtual void addDirtyRect(const Common::Rect &r);
public:
@@ -96,8 +98,8 @@ public:
void verticalTransition();
- void print(const Common::Point &pt, int color, const char *format, ...);
- void gPrint(const Common::Point &pt, int color, const char *format, ...);
+ void print(const Common::Point &pt, byte color, const char *format, ...);
+ void gPrint(const Common::Point &pt, byte color, const char *format, ...);
void restoreBackground(const Common::Rect &r);
@@ -114,6 +116,10 @@ public:
void vgaBar(const Common::Rect &r, int color);
void makeButton(const Common::Rect &bounds, int textX, const Common::String &str);
+
+ void buttonPrint(const Common::Point &pt, byte color, bool slamIt, const Common::String &str);
+
+ void makePanel(const Common::Rect &r);
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index a993965429..5e8b3287f0 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -77,8 +77,6 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
_windowOpen = false;
_oldLook = false;
_keyboardInput = false;
- _invMode = 0;
- _invIndex = 0;
_pause = false;
_cNum = 0;
_selector = _oldSelector = -1;
@@ -116,6 +114,7 @@ void UserInterface::drawInterface() {
*/
void UserInterface::handleInput() {
Events &events = *_vm->_events;
+ Inventory &inv = *_vm->_inventory;
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
Screen &screen = *_vm->_screen;
@@ -276,7 +275,7 @@ void UserInterface::handleInput() {
case USE_MODE:
case GIVE_MODE:
case INV_MODE:
- if (_invMode == 1 || _invMode == 2 || _invMode == 3) {
+ if (inv._invMode == 1 || inv._invMode == 2 || inv._invMode == 3) {
if (pt.y < CONTROLS_Y)
lookInv();
else
@@ -455,11 +454,6 @@ void UserInterface::toggleButton(int num) {
}
}
-void UserInterface::buttonPrint(const Common::Point &pt, int color, bool slamIt,
- const Common::String &str) {
- // TODO
-}
-
/**
* Clears the info line of the screen
*/
@@ -566,10 +560,10 @@ void UserInterface::lookScreen(const Common::Point &pt) {
if (!tempStr.empty() && tempStr[0] != ' ') {
// If inventory is active and an item is selected for a Use or Give action
if ((_menuMode == INV_MODE || _menuMode == USE_MODE || _menuMode == GIVE_MODE) &&
- (_invMode == 2 || _invMode == 3)) {
+ (inv._invMode == 2 || inv._invMode == 3)) {
width1 = screen.stringWidth(inv[_selector]._name);
- if (_invMode == 2) {
+ if (inv._invMode == 2) {
// Using an object
x = width = screen.stringWidth("Use ");
@@ -658,7 +652,7 @@ void UserInterface::lookInv() {
if (mousePos.x > 15 && mousePos.x < 314 && mousePos.y > (CONTROLS_Y1 + 11)
&& mousePos.y < (SHERLOCK_SCREEN_HEIGHT - 2)) {
- int temp = (mousePos.x - 6) / 52 + _invIndex;
+ int temp = (mousePos.x - 6) / 52 + inv._invIndex;
if (temp < inv._holdings) {
if (temp < inv._holdings) {
clearInfo();
@@ -712,25 +706,25 @@ void UserInterface::doInvControl() {
if (found != -1)
// If a slot highlighted, set it's color
colors[found] = COMMAND_HIGHLIGHTED;
- buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1),
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1),
colors[0], true, "Exit");
if (found >= 0 && found <= 3) {
- buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, "Look");
- buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[1], true, "Use");
- buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[1], true, "Give");
- _invMode = found;
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, "Look");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[1], true, "Use");
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[1], true, "Give");
+ inv._invMode = found;
_selector = -1;
}
- if (_invIndex) {
+ 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], "^");
}
- if ((inv._holdings - _invIndex) > 6) {
+ 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),
@@ -738,7 +732,7 @@ void UserInterface::doInvControl() {
}
bool flag = false;
- if (_invMode == 1 || _invMode == 2 || _invMode == 3) {
+ if (inv._invMode == 1 || inv._invMode == 2 || inv._invMode == 3) {
Common::Rect r(15, CONTROLS_Y1 + 11, 314, SHERLOCK_SCREEN_HEIGHT - 2);
flag = (_selector < inv._holdings);
}
@@ -756,16 +750,16 @@ void UserInterface::doInvControl() {
if (_key == 'E' || _key == 'L' || _key == 'U' || _key == 'G'
|| _key == '-' || _key == '+') {
- int temp = _invMode;
+ int temp = inv._invMode;
const char *chP = strchr(INVENTORY_COMMANDS, _key);
- _invMode = !chP ? 8 : chP - INVENTORY_COMMANDS;
+ inv._invMode = !chP ? 8 : chP - INVENTORY_COMMANDS;
inv.invCommands(true);
- _invMode = temp;
+ inv._invMode = temp;
_keyboardInput = true;
if (_key == 'E')
- _invMode = STD_MODE;
+ inv._invMode = STD_MODE;
_selector = -1;
} else {
_selector = -1;
@@ -775,7 +769,7 @@ void UserInterface::doInvControl() {
if (_selector != _oldSelector) {
if (_oldSelector != -1) {
// Un-highlight
- if (_oldSelector >= _invIndex && _oldSelector < (_invIndex + 6))
+ if (_oldSelector >= inv._invIndex && _oldSelector < (inv._invIndex + 6))
inv.doInvLite(_oldSelector, BUTTON_MIDDLE);
}
@@ -795,16 +789,16 @@ void UserInterface::doInvControl() {
events.clearEvents();
events.setCursor(ARROW);
} else if ((found == 1 && events._released) || (_key == 'L')) {
- _invMode = 1;
+ inv._invMode = 1;
} else if ((found == 2 && events._released) || (_key == 'U')) {
- _invMode = 2;
+ inv._invMode = 2;
} else if ((found == 3 && events._released) || (_key == 'G')) {
- _invMode = 3;
- } else if (((found == 4 && events._released) || _key == ',') && _invIndex) {
- if (_invIndex >= 6)
- _invIndex -= 6;
+ inv._invMode = 3;
+ } else if (((found == 4 && events._released) || _key == ',') && inv._invIndex) {
+ if (inv._invIndex >= 6)
+ inv._invIndex -= 6;
else
- _invIndex = 0;
+ inv._invIndex = 0;
screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1),
COMMAND_HIGHLIGHTED, "^^");
@@ -812,26 +806,28 @@ void UserInterface::doInvControl() {
inv.loadGraphics();
inv.putInv(1);
inv.invCommands(true);
- } else if (((found == 5 && events._released) || _key == '-') && _invIndex) {
- --_invIndex;
+ } else if (((found == 5 && events._released) || _key == '-') && inv._invIndex) {
+ --inv._invIndex;
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 - _invIndex) > 6) {
- ++_invIndex;
+ } else if (((found == 6 && events._released) || _key == '+') &&
+ (inv._holdings - inv._invIndex) > 6) {
+ ++inv._invIndex;
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 - _invIndex) > 6) {
- _invIndex += 6;
- if ((inv._holdings - 6) < _invIndex)
- _invIndex = inv._holdings - 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, "_");
@@ -841,7 +837,7 @@ void UserInterface::doInvControl() {
inv.invCommands(true);
} else {
// If something is being given, make sure it's to a person
- if (_invMode == 3) {
+ if (inv._invMode == 3) {
if (_bgFound != -1 && scene._bgShapes[_bgFound]._aType == PERSON)
_find = _bgFound;
else
@@ -850,7 +846,7 @@ void UserInterface::doInvControl() {
_find = _bgFound;
}
- if ((mousePos.y < CONTROLS_Y1) && (_invMode == 1) && (_find >= 0) && (_find < 1000)) {
+ if ((mousePos.y < CONTROLS_Y1) && (inv._invMode == 1) && (_find >= 0) && (_find < 1000)) {
if (!scene._bgShapes[_find]._examine.empty() &&
scene._bgShapes[_find]._examine[0] >= ' ')
inv.doInvJF();
@@ -859,7 +855,7 @@ void UserInterface::doInvControl() {
// If it's -1, then no inventory item is highlighted yet. Otherwise,
// an object in the scene has been clicked.
- if (_selector != -1 && _invMode == 1 && mousePos.y >(CONTROLS_Y1 + 11))
+ if (_selector != -1 && inv._invMode == 1 && mousePos.y >(CONTROLS_Y1 + 11))
inv.doInvJF();
if (talk._talkToAbort)
@@ -872,7 +868,7 @@ void UserInterface::doInvControl() {
// is being tried on an object in the scene without an inventory
// object being highlighted first.
- if ((_invMode == 2 || (_selector != -1 && _invMode == 3)) && _find >= 0) {
+ if ((inv._invMode == 2 || (_selector != -1 && inv._invMode == 3)) && _find >= 0) {
events._pressed = events._released = false;
_infoFlag = true;
clearInfo();
@@ -882,8 +878,8 @@ void UserInterface::doInvControl() {
inv.putInv(1);
_selector = temp; // Restore it
- temp = _invMode;
- _invMode = -1;
+ temp = inv._invMode;
+ inv._invMode = -1;
inv.invCommands(true);
_infoFlag = true;
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index 87fd4a5e99..14462d6a34 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -75,8 +75,6 @@ private:
int _invLookFlag;
int _oldLook;
bool _keyboardInput;
- int _invMode;
- int _invIndex;
bool _pause;
int _cNum;
int _selector, _oldSelector;
@@ -97,8 +95,6 @@ private:
void toggleButton(int num);
- void buttonPrint(const Common::Point &pt, int color, bool slamIt, const Common::String &str);
-
void examine();
void lookScreen(const Common::Point &pt);