aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hugo/hugo.cpp4
-rw-r--r--engines/hugo/hugo.h3
-rw-r--r--engines/hugo/menu.cpp95
-rw-r--r--engines/hugo/menu.h63
-rw-r--r--engines/hugo/module.mk1
-rw-r--r--engines/hugo/mouse.cpp8
6 files changed, 173 insertions, 1 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index c7bc3fe313..6166bdced1 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -159,6 +159,8 @@ HugoEngine::~HugoEngine() {
_screen->freeFonts();
+ delete _topMenu;
+
delete _object;
delete _sound;
delete _route;
@@ -196,6 +198,8 @@ Common::Error HugoEngine::run() {
_route = new Route(this);
_sound = new SoundHandler(this);
+ _topMenu = new TopMenu(this);
+
switch (_gameVariant) {
case 0: // H1 Win
_file = new FileManager_v1w(this);
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 633867b10b..401af19166 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -29,6 +29,7 @@
#include "engines/engine.h"
#include "common/file.h"
#include "hugo/console.h"
+#include "hugo/menu.h"
// This include is here temporarily while the engine is being refactored.
#include "hugo/game.h"
@@ -280,6 +281,8 @@ public:
IntroHandler *_intro;
ObjectHandler *_object;
+ TopMenu *_topMenu;
+
protected:
// Engine APIs
diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp
new file mode 100644
index 0000000000..310be2bb7e
--- /dev/null
+++ b/engines/hugo/menu.cpp
@@ -0,0 +1,95 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "hugo/hugo.h"
+
+namespace Hugo {
+
+enum {
+ kMenuX = 5,
+ kMenuY = 1,
+ kButtonWidth = 18,
+ kButtonHeight = 18,
+ kButtonPad = 1,
+ kButtonSpace = 5
+};
+
+enum {
+ kCmdWhat = 'WHAT',
+ kCmdMusic = 'MUZK',
+ kCmdVolume = 'VOLM',
+ kCmdLoad = 'LOAD',
+ kCmdSave = 'SAVE',
+ kCmdUndo = 'UNDO',
+ kCmdText = 'TEXT',
+ kCmdLook = 'LOOK',
+ kCmdBomb = 'BOMB'
+};
+
+TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, 320, 20),
+ _vm(vm) {
+ init();
+}
+
+void TopMenu::init() {
+ int x = kMenuX;
+ int y = kMenuY;
+
+ _whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "What is it?", kCmdWhat);
+ x += kButtonWidth + kButtonPad;
+
+ _musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Music", kCmdMusic);
+ x += kButtonWidth + kButtonPad;
+
+ _volumeButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Volume", kCmdVolume);
+ x += kButtonWidth + kButtonPad;
+
+ x += kButtonSpace;
+
+ _loadButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Load game", kCmdLoad);
+ x += kButtonWidth + kButtonPad;
+
+ _saveButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Save game", kCmdSave);
+ x += kButtonWidth + kButtonPad;
+
+ x += kButtonSpace;
+
+ _undoButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Undo", kCmdUndo);
+ x += kButtonWidth + kButtonPad;
+
+ _textButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Text", kCmdText);
+ x += kButtonWidth + kButtonPad;
+
+ x += kButtonSpace;
+
+ _lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Look", kCmdLook);
+ x += kButtonWidth + kButtonPad;
+
+ _bombButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Bomb", kCmdBomb);
+ x += kButtonWidth + kButtonPad;
+
+}
+
+} // End of namespace Hugo
diff --git a/engines/hugo/menu.h b/engines/hugo/menu.h
new file mode 100644
index 0000000000..fa565c3a5e
--- /dev/null
+++ b/engines/hugo/menu.h
@@ -0,0 +1,63 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef HUGO_TOPMENU_H
+#define HUGO_TOPMENU_H
+
+#include "gui/dialog.h"
+
+namespace Hugo {
+
+class TopMenu : public GUI::Dialog {
+public:
+ TopMenu(HugoEngine *vm);
+
+ /*
+ void handleTickle();
+ void reflowLayout();
+ void handleMouseWheel(int x, int y, int direction);
+ void handleKeyDown(Common::KeyState state);
+ void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+ */
+
+protected:
+ void init();
+
+ HugoEngine *_vm;
+
+ GUI::PicButtonWidget *_whatButton;
+ GUI::PicButtonWidget *_musicButton;
+ GUI::PicButtonWidget *_volumeButton;
+ GUI::PicButtonWidget *_loadButton;
+ GUI::PicButtonWidget *_saveButton;
+ GUI::PicButtonWidget *_undoButton;
+ GUI::PicButtonWidget *_textButton;
+ GUI::PicButtonWidget *_lookButton;
+ GUI::PicButtonWidget *_bombButton;
+};
+
+}
+
+#endif // HUGO_TOPMENU_H
diff --git a/engines/hugo/module.mk b/engines/hugo/module.mk
index 703a70ec1f..0cfe19a680 100644
--- a/engines/hugo/module.mk
+++ b/engines/hugo/module.mk
@@ -20,6 +20,7 @@ MODULE_OBJS := \
intro_v2w.o \
intro_v3w.o \
inventory.o \
+ menu.o \
mouse.o \
object.o \
object_v1d.o \
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index 14ac1d7843..4ed6384b2a 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -276,8 +276,14 @@ void MouseHandler::mouseHandler() {
int16 objId = -1; // Current source object
// Process cursor over an object or icon
- if (gameStatus.inventoryState == I_ACTIVE) // Check inventory icon bar first
+ if (gameStatus.inventoryState == I_ACTIVE) { // Check inventory icon bar first
objId = _vm->_inventory->processInventory(INV_GET, cx, cy);
+ } else {
+ if (cy < 5 && cy > 0) {
+ _vm->_topMenu->runModal();
+ }
+ }
+
if (objId == -1) // No match, check rest of view
objId = _vm->_object->findObject(cx, cy);
if (objId >= 0) { // Got a match