aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-19 19:45:06 -0400
committerPaul Gilbert2015-06-19 19:45:06 -0400
commit4ce4431c61092ed58e072f3f01f785cad796ab87 (patch)
treecc3faccec5df9d34025454708d404353ae14dbf0
parent5446df8e6161b4066d5447e35f8803143018d404 (diff)
downloadscummvm-rg350-4ce4431c61092ed58e072f3f01f785cad796ab87.tar.gz
scummvm-rg350-4ce4431c61092ed58e072f3f01f785cad796ab87.tar.bz2
scummvm-rg350-4ce4431c61092ed58e072f3f01f785cad796ab87.zip
SHERLOCK: RT: Beginnings of inventory menu widget
-rw-r--r--engines/sherlock/module.mk1
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp30
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h12
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp5
-rw-r--r--engines/sherlock/tattoo/widget_base.h1
-rw-r--r--engines/sherlock/tattoo/widget_inventory.cpp86
-rw-r--r--engines/sherlock/tattoo/widget_inventory.h56
-rw-r--r--engines/sherlock/tattoo/widget_text.cpp2
8 files changed, 170 insertions, 23 deletions
diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk
index cb1c32485b..663fc51922 100644
--- a/engines/sherlock/module.mk
+++ b/engines/sherlock/module.mk
@@ -22,6 +22,7 @@ MODULE_OBJS = \
tattoo/tattoo_talk.o \
tattoo/tattoo_user_interface.o \
tattoo/widget_base.o \
+ tattoo/widget_inventory.o \
tattoo/widget_text.o \
tattoo/widget_tooltip.o \
tattoo/widget_verbs.o \
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 4dd8513967..09cd1575b5 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -29,7 +29,7 @@ namespace Sherlock {
namespace Tattoo {
TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
- _tooltipWidget(vm), _verbsWidget(vm), _textWidget(vm) {
+ _inventoryWidget(vm), _tooltipWidget(vm), _verbsWidget(vm), _textWidget(vm) {
_menuBuffer = nullptr;
_invMenuBuffer = nullptr;
_invGraphic = nullptr;
@@ -423,7 +423,7 @@ void TattooUserInterface::doStandardControl() {
switch (_keyState.keycode) {
case Common::KEYCODE_F5:
// Save game
- turnTextOff();
+ freeMenu();
_fileMode = SAVEMODE_SAVE;
_menuBounds = Common::Rect(0, 0, 0, 0);
initFileMenu();
@@ -431,7 +431,7 @@ void TattooUserInterface::doStandardControl() {
case Common::KEYCODE_F7:
// Load game
- turnTextOff();
+ freeMenu();
_fileMode = SAVEMODE_LOAD;
_menuBounds = Common::Rect(0, 0, 0, 0);
initFileMenu();
@@ -440,7 +440,7 @@ void TattooUserInterface::doStandardControl() {
case Common::KEYCODE_F1:
// Display journal
if (vm.readFlags(76)) {
- turnTextOff();
+ freeMenu();
doJournal();
// See if we're in a Lab Table Room
@@ -452,19 +452,19 @@ void TattooUserInterface::doStandardControl() {
case Common::KEYCODE_TAB:
case Common::KEYCODE_F3:
// Display inventory
- turnTextOff();
+ freeMenu();
doInventory(2);
return;
case Common::KEYCODE_F4:
// Display options
- turnTextOff();
+ freeMenu();
doControls();
return;
case Common::KEYCODE_F10:
// Quit menu
- turnTextOff();
+ freeMenu();
_menuBounds = Common::Rect(-1, -1, -1, -1);
doQuitMenu();
return;
@@ -483,7 +483,7 @@ void TattooUserInterface::doStandardControl() {
// Turn any Text display off
if (_arrowZone == -1 || events._rightReleased)
- turnTextOff();
+ freeMenu();
if (_personFound) {
if (people[_bgFound - 1000]._description.empty() || people[_bgFound - 1000]._description.hasPrefix(" "))
@@ -560,8 +560,7 @@ void TattooUserInterface::doLookControl() {
// We were looking at a Inventory object
// Erase the text window, and then redraw the inventory window
_textWidget.banishWindow();
-
- warning("TODO: re-show inventory");
+ doInventory(0);
_invLookFlag = false;
_key = -1;
@@ -619,12 +618,13 @@ void TattooUserInterface::initFileMenu() {
// TODO
}
-void TattooUserInterface::turnTextOff() {
- // TODO
-}
-
void TattooUserInterface::doInventory(int mode) {
- // TODO
+ People &people = *_vm->_people;
+ people[HOLMES].gotoStand();
+
+ _inventoryWidget.load(mode);
+
+ _menuMode = INV_MODE;
}
void TattooUserInterface::doControls() {
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 0ccdc6701f..39939c4aea 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "sherlock/saveload.h"
#include "sherlock/user_interface.h"
+#include "sherlock/tattoo/widget_inventory.h"
#include "sherlock/tattoo/widget_text.h"
#include "sherlock/tattoo/widget_tooltip.h"
#include "sherlock/tattoo/widget_verbs.h"
@@ -34,7 +35,10 @@ namespace Sherlock {
namespace Tattoo {
+class WidgetBase;
+
class TattooUserInterface : public UserInterface {
+ friend class WidgetBase;
private:
Common::Rect _menuBounds;
Common::Rect _oldMenuBounds;
@@ -51,9 +55,10 @@ private:
int _exitZone;
int _scriptZone;
int _cAnimFramePause;
+ WidgetInventory _inventoryWidget;
+ WidgetText _textWidget;
WidgetTooltip _tooltipWidget;
WidgetVerbs _verbsWidget;
- WidgetText _textWidget;
WidgetBase *_widget;
private:
/**
@@ -114,11 +119,6 @@ private:
void initFileMenu();
/**
- * Turn off any active object description text
- */
- void turnTextOff();
-
- /**
* Handle displaying the quit menu
*/
void doQuitMenu();
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 4046168fd8..2294961ca7 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -23,6 +23,7 @@
#include "sherlock/tattoo/widget_base.h"
#include "sherlock/tattoo/tattoo.h"
#include "sherlock/tattoo/tattoo_talk.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
namespace Sherlock {
@@ -33,7 +34,9 @@ WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) {
}
void WidgetBase::summonWindow() {
-
+ TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+ ui._widget = this;
+ _outsideMenu = false;
}
void WidgetBase::banishWindow() {
diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h
index 38b6d04b20..5a16ab612d 100644
--- a/engines/sherlock/tattoo/widget_base.h
+++ b/engines/sherlock/tattoo/widget_base.h
@@ -41,6 +41,7 @@ protected:
Common::Rect _bounds, _oldBounds;
Surface _surface;
ImageFile *_images;
+ bool _outsideMenu;
/**
* Used by descendent classes to split up long text for display across multiple lines
diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp
new file mode 100644
index 0000000000..d3caa8002d
--- /dev/null
+++ b/engines/sherlock/tattoo/widget_inventory.cpp
@@ -0,0 +1,86 @@
+/* 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/widget_inventory.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
+#include "sherlock/tattoo/tattoo.h"
+
+namespace Sherlock {
+
+namespace Tattoo {
+
+#define INVENTORY_XSIZE 70 // Width of the box that surrounds inventory items
+#define INVENTORY_YSIZE 70 // Width of the box that surrounds inventory items
+#define NUM_INVENTORY_SHOWN 8 // Number of Inventory Items Shown
+#define BUTTON_XSIZE 15 // Button width
+
+WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm) {
+ _invMode = 0;
+ _invVerbMode = 0;
+ _invSelect = _oldInvSelect = 0;
+ _selector = _oldSelector = 0;
+ _dialogTimer = -1;
+}
+
+void WidgetInventory::load(int mode) {
+ Events &events = *_vm->_events;
+ Inventory &inv = *_vm->_inventory;
+ Common::Point mousePos = events.mousePos();
+
+ if (mode != 0)
+ _invMode = mode;
+ _invVerbMode = 0;
+ _invSelect = _oldInvSelect = -1;
+ _selector = _oldSelector = -1;
+ _dialogTimer = -1;
+
+ if (mode == 0) {
+ banishWindow();
+ } else {
+ _bounds = Common::Rect((INVENTORY_XSIZE + 3) * NUM_INVENTORY_SHOWN / 2 + BUTTON_XSIZE + 6,
+ (INVENTORY_YSIZE + 3) * 2 + 3);
+ _bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);
+ }
+
+ // Ensure menu will be on-screen
+ checkMenuPosition();
+
+ // Load the inventory data
+ inv.loadInv();
+
+ // Redraw the inventory menu on the widget surface
+ _surface.create(_bounds.width(), _bounds.height());
+ _surface.fill(TRANSPARENCY);
+
+ // Draw the window background and then the inventory on top of it
+ makeInfoArea();
+ //putInv(0);
+}
+
+void WidgetInventory::loadInv() {
+ // TODO
+}
+
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/widget_inventory.h b/engines/sherlock/tattoo/widget_inventory.h
new file mode 100644
index 0000000000..b2096f63e3
--- /dev/null
+++ b/engines/sherlock/tattoo/widget_inventory.h
@@ -0,0 +1,56 @@
+/* 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_WIDGET_INVENTORY_H
+#define SHERLOCK_TATTOO_WIDGET_INVENTORY_H
+
+#include "common/scummsys.h"
+#include "sherlock/tattoo/widget_base.h"
+
+namespace Sherlock {
+
+class SherlockEngine;
+
+namespace Tattoo {
+
+class WidgetInventory: public WidgetBase {
+private:
+ int _invVerbMode;
+ int _invSelect, _oldInvSelect;
+ int _selector, _oldSelector;
+ int _dialogTimer;
+
+ void loadInv();
+public:
+ int _invMode;
+public:
+ WidgetInventory(SherlockEngine *vm);
+ virtual ~WidgetInventory() {}
+
+ void load(int mode);
+};
+
+} // End of namespace Tattoo
+
+} // End of namespace Sherlock
+
+#endif
diff --git a/engines/sherlock/tattoo/widget_text.cpp b/engines/sherlock/tattoo/widget_text.cpp
index 9e99643807..58eade17b0 100644
--- a/engines/sherlock/tattoo/widget_text.cpp
+++ b/engines/sherlock/tattoo/widget_text.cpp
@@ -74,9 +74,9 @@ void WidgetText::load(const Common::String &str) {
// Allocate a surface for the window
_surface.create(_bounds.width(), _bounds.height());
+ _surface.fill(TRANSPARENCY);
// Form the background for the new window
- _surface.fillRect(Common::Rect(0, 0, _surface.w(), _surface.h()), TRANSPARENCY);
makeInfoArea();
int yp = 5;