aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/actor.cpp2
-rw-r--r--engines/illusions/bbdou/bbdou_menukeys.cpp60
-rw-r--r--engines/illusions/bbdou/bbdou_menukeys.h53
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.cpp16
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.h5
-rw-r--r--engines/illusions/bbdou/menusystem_bbdou.cpp172
-rw-r--r--engines/illusions/bbdou/menusystem_bbdou.h74
-rw-r--r--engines/illusions/bbdou/scriptopcodes_bbdou.cpp40
-rw-r--r--engines/illusions/input.h2
-rw-r--r--engines/illusions/menusystem.cpp35
-rw-r--r--engines/illusions/module.mk2
-rw-r--r--engines/illusions/screen.cpp8
-rw-r--r--engines/illusions/screen.h3
-rw-r--r--engines/illusions/screentext.cpp6
14 files changed, 455 insertions, 23 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp
index a5276db06a..a38814c3dc 100644
--- a/engines/illusions/actor.cpp
+++ b/engines/illusions/actor.cpp
@@ -935,7 +935,7 @@ void Control::getActorFrameDimensions(WidthHeight &dimensions) {
}
void Control::drawActorRect(const Common::Rect r, byte color) {
- _actor->_surface->fillRect(r, color);
+ _vm->_screen->fillSurfaceRect(_actor->_surface, r, color);
_actor->_flags |= Illusions::ACTOR_FLAG_4000;
}
diff --git a/engines/illusions/bbdou/bbdou_menukeys.cpp b/engines/illusions/bbdou/bbdou_menukeys.cpp
new file mode 100644
index 0000000000..aadd9fec35
--- /dev/null
+++ b/engines/illusions/bbdou/bbdou_menukeys.cpp
@@ -0,0 +1,60 @@
+/* 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 "illusions/bbdou/illusions_bbdou.h"
+#include "illusions/bbdou/bbdou_menukeys.h"
+#include "illusions/bbdou/menusystem_bbdou.h"
+#include "illusions/input.h"
+#include "illusions/screen.h"
+
+namespace Illusions {
+
+// BBDOUMenuKeys
+
+BBDOUMenuKeys::BBDOUMenuKeys(IllusionsEngine_BBDOU *vm)
+ : _vm(vm) {
+}
+
+BBDOUMenuKeys::~BBDOUMenuKeys() {
+
+}
+
+void BBDOUMenuKeys::addMenuKey(uint bitMask, uint32 threadId) {
+ MenuKey menuKey;
+ menuKey.bitMask = bitMask;
+ menuKey.threadId = threadId;
+ _menuKeys.push_back(menuKey);
+}
+
+void BBDOUMenuKeys::update() {
+ if (_vm->_screen->isDisplayOn() && !_vm->_menuSystem->isActive()) {
+ for (MenuKeys::iterator it = _menuKeys.begin(); it != _menuKeys.end(); ++it) {
+ const MenuKey &menuKey = *it;
+ if (_vm->_input->pollButton(menuKey.bitMask)) {
+ _vm->startScriptThread(menuKey.threadId, 0, 0, 0, 0);
+ break;
+ }
+ }
+ }
+}
+
+} // End of namespace Illusions
diff --git a/engines/illusions/bbdou/bbdou_menukeys.h b/engines/illusions/bbdou/bbdou_menukeys.h
new file mode 100644
index 0000000000..e26f1f0261
--- /dev/null
+++ b/engines/illusions/bbdou/bbdou_menukeys.h
@@ -0,0 +1,53 @@
+/* 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 ILLUSIONS_BBDOU_BBDOU_MENUKEYS_H
+#define ILLUSIONS_BBDOU_BBDOU_MENUKEYS_H
+
+#include "illusions/specialcode.h"
+#include "illusions/thread.h"
+#include "common/array.h"
+
+namespace Illusions {
+
+class IllusionsEngine_BBDOU;
+
+struct MenuKey {
+ uint bitMask;
+ uint32 threadId;
+};
+
+class BBDOUMenuKeys {
+public:
+ BBDOUMenuKeys(IllusionsEngine_BBDOU *vm);
+ ~BBDOUMenuKeys();
+ void addMenuKey(uint bitMask, uint32 threadId);
+ void update();
+protected:
+ typedef Common::Array<MenuKey> MenuKeys;
+ IllusionsEngine_BBDOU *_vm;
+ MenuKeys _menuKeys;
+};
+
+} // End of namespace Illusions
+
+#endif // ILLUSIONS_BBDOU_BBDOU_MENUKEYS_H
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 247a00fbed..7c129f12b6 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -21,7 +21,9 @@
*/
#include "illusions/bbdou/illusions_bbdou.h"
+#include "illusions/bbdou/bbdou_menukeys.h"
#include "illusions/bbdou/bbdou_videoplayer.h"
+#include "illusions/bbdou/menusystem_bbdou.h"
#include "illusions/actor.h"
#include "illusions/camera.h"
#include "illusions/cursor.h"
@@ -167,7 +169,9 @@ Common::Error IllusionsEngine_BBDOU::run() {
_threads = new ThreadList(this);
_updateFunctions = new UpdateFunctions();
_soundMan = new SoundMan(this);
+ _menuSystem = new BBDOUMenuSystem(this);
_videoPlayer = new BBDOUVideoPlayer(this);
+ _menuKeys = new BBDOUMenuKeys(this);
_screen->setColorKey1(0xF81F);
@@ -217,7 +221,9 @@ Common::Error IllusionsEngine_BBDOU::run() {
delete _stack;
delete _scriptOpcodes;
+ delete _menuKeys;
delete _videoPlayer;
+ delete _menuSystem;
delete _soundMan;
delete _updateFunctions;
delete _threads;
@@ -280,6 +286,7 @@ void IllusionsEngine_BBDOU::initInput() {
void IllusionsEngine_BBDOU::initUpdateFunctions() {
UPDATEFUNCTION(30, 0, updateScript);
UPDATEFUNCTION(50, 0, updateActors);
+ UPDATEFUNCTION(60, 0, updateMenuKeys);
UPDATEFUNCTION(60, 0, updateSequences);
UPDATEFUNCTION(70, 0, updateGraphics);
UPDATEFUNCTION(70, 0, updateVideoPlayer);
@@ -291,7 +298,12 @@ void IllusionsEngine_BBDOU::initUpdateFunctions() {
int IllusionsEngine_BBDOU::updateScript(uint flags) {
_threads->updateThreads();
- return 1;
+ return kUFNext;
+}
+
+int IllusionsEngine_BBDOU::updateMenuKeys(uint flags) {
+ _menuKeys->update();
+ return kUFNext;
}
bool IllusionsEngine_BBDOU::causeIsDeclared(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId) {
@@ -436,7 +448,7 @@ void IllusionsEngine_BBDOU::cursorControlRoutine(Control *control, uint32 deltaT
// Unused nullsub_1(control);
break;
case 3:
- // TODO _vm->_shellMgr->handleMouse(control);
+ _menuSystem->update(control);
break;
}
}
diff --git a/engines/illusions/bbdou/illusions_bbdou.h b/engines/illusions/bbdou/illusions_bbdou.h
index 9bdfc6d2b1..2bad993041 100644
--- a/engines/illusions/bbdou/illusions_bbdou.h
+++ b/engines/illusions/bbdou/illusions_bbdou.h
@@ -34,6 +34,8 @@ class Dictionary;
class ScriptMan;
class ScriptStack;
class BBDOUVideoPlayer;
+class BBDOUMenuKeys;
+class BBDOUMenuSystem;
struct ActiveScene {
uint32 _sceneId;
@@ -73,7 +75,9 @@ public:
uint32 _theThreadId;
uint32 _globalSceneId;
+ BBDOUMenuSystem *_menuSystem;
BBDOUVideoPlayer *_videoPlayer;
+ BBDOUMenuKeys *_menuKeys;
bool _walkthroughStarted;
@@ -81,6 +85,7 @@ public:
void initUpdateFunctions();
int updateScript(uint flags);
+ int updateMenuKeys(uint flags);
bool causeIsDeclared(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId);
void causeDeclare(uint32 verbId, uint32 objectId2, uint32 objectId, TriggerFunctionCallback *callback);
diff --git a/engines/illusions/bbdou/menusystem_bbdou.cpp b/engines/illusions/bbdou/menusystem_bbdou.cpp
new file mode 100644
index 0000000000..9d1b7188db
--- /dev/null
+++ b/engines/illusions/bbdou/menusystem_bbdou.cpp
@@ -0,0 +1,172 @@
+/* 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 "illusions/illusions.h"
+#include "illusions/actor.h"
+#include "illusions/cursor.h"
+#include "illusions/bbdou/illusions_bbdou.h"
+#include "illusions/bbdou/menusystem_bbdou.h"
+
+namespace Illusions {
+
+// BBDOUMenuSystem
+
+BBDOUMenuSystem::BBDOUMenuSystem(IllusionsEngine_BBDOU *vm)
+ : BaseMenuSystem(vm), _vm(vm) {
+ clearMenus();
+}
+
+BBDOUMenuSystem::~BBDOUMenuSystem() {
+ freeMenus();
+}
+
+void BBDOUMenuSystem::runMenu(MenuChoiceOffsets menuChoiceOffsets, int16 *menuChoiceOffset,
+ uint32 menuId, uint32 duration, uint timeOutMenuChoiceIndex, uint32 menuCallerThreadId) {
+
+ debug(0, "BBDOUMenuSystem::runMenu(%08X)", menuId);
+
+ setTimeOutDuration(duration, timeOutMenuChoiceIndex);
+ setMenuCallerThreadId(menuCallerThreadId);
+ setMenuChoiceOffsets(menuChoiceOffsets, menuChoiceOffset);
+
+ int rootMenuId = convertRootMenuId(menuId);
+ BaseMenu *rootMenu = getMenuById(rootMenuId);
+ openMenu(rootMenu);
+
+}
+
+void BBDOUMenuSystem::clearMenus() {
+ for (int i = 0; i < kBBDOULastMenuIndex; ++i)
+ _menus[i] = 0;
+}
+
+void BBDOUMenuSystem::freeMenus() {
+ for (int i = 0; i < kBBDOULastMenuIndex; ++i)
+ delete _menus[i];
+}
+
+BaseMenu *BBDOUMenuSystem::getMenuById(int menuId) {
+ if (!_menus[menuId])
+ _menus[menuId] = createMenuById(menuId);
+ return _menus[menuId];
+}
+
+BaseMenu *BBDOUMenuSystem::createMenuById(int menuId) {
+ switch (menuId) {
+ case kBBDOUMainMenu:
+ return createMainMenu();
+ case kBBDOUPauseMenu:
+ return createPauseMenu();
+ // TODO Other menus
+ default:
+ error("BBDOUMenuSystem::createMenuById() Invalid menu id %d", menuId);
+ }
+}
+
+BaseMenu *BBDOUMenuSystem::createMainMenu() {
+ return 0; // TODO
+}
+
+BaseMenu *BBDOUMenuSystem::createLoadGameMenu() {
+ return 0; // TODO
+}
+
+BaseMenu *BBDOUMenuSystem::createOptionsMenu() {
+ return 0; // TODO
+}
+
+BaseMenu *BBDOUMenuSystem::createPauseMenu() {
+ BaseMenu *menu = new BaseMenu(this, 0x00120003, 218, 150, 80, 20, 1);
+ menu->addText(" Game Paused");
+ menu->addText("-------------------");
+ menu->addMenuItem(new MenuItem("Resume", new MenuActionReturnChoice(this, 1)));
+ // menu->addMenuItem(new MenuItem("Load Game", new MenuActionLoadGame(this, 1)));
+ // TODO menu->addMenuItem(new MenuItem("Save Game", new MenuActionSaveGame(this, 11)));
+ // TODO menu->addMenuItem(new MenuItem("Restart Game", new MenuActionEnterQueryMenu(this, kDuckmanQueryRestartMenu, 2)));
+ // TODO menu->addMenuItem(new MenuItem("Options", new MenuActionEnterMenu(this, kDuckmanOptionsMenu)));
+ // menu->addMenuItem(new MenuItem("Quit Game", new MenuActionEnterQueryMenu(this, kDuckmanQueryQuitMenu, 23)));
+ return menu;
+}
+
+int BBDOUMenuSystem::convertRootMenuId(uint32 menuId) {
+ switch (menuId) {
+ case 0x1C0001:
+ return kBBDOUMainMenu;
+ case 0x1C0002:
+ return kBBDOUPauseMenu;
+ case 0x1C0006:
+ return kBBDOULoadGameMenu;
+ case 0x1C0007:
+ return kBBDOUSaveGameMenu;
+ case 0x1C0008:
+ return kBBDOUGameSavedMenu;
+ case 0x1C0009:
+ return kBBDOUSaveFailedMenu;
+ case 0x1C000A:
+ return kBBDOULoadFailedMenu;
+ /* Unused/unimplemented debug menus
+ case 0x1C0003: debugStartMenu
+ case 0x1C0004: debugPauseMenu
+ case 0x1C0005: unitTestsMenu
+ */
+ default:
+ error("BBDOUMenuSystem() Menu ID %08X not found", menuId);
+ }
+}
+
+bool BBDOUMenuSystem::initMenuCursor() {
+ bool cursorInitialVisibleFlag = false;
+ Control *cursorControl = _vm->getObjectControl(0x40004);
+ if (cursorControl) {
+ if (cursorControl->_flags & 1) {
+ cursorInitialVisibleFlag = false;
+ } else {
+ cursorInitialVisibleFlag = true;
+ cursorControl->appearActor();
+ }
+ } else {
+ Common::Point pos = _vm->getNamedPointPosition(0x70023);
+ _vm->_controls->placeActor(0x50001, pos, 0x60001, 0x40004, 0);
+ cursorControl = _vm->getObjectControl(0x40004);
+ }
+ return cursorInitialVisibleFlag;
+}
+
+int BBDOUMenuSystem::getGameState() {
+ return _vm->_cursor->_status;
+}
+
+void BBDOUMenuSystem::setMenuCursorNum(int cursorNum) {
+ Control *mouseCursor = _vm->getObjectControl(0x40004);
+ _vm->_cursor->setActorIndex(5, cursorNum, 0);
+ mouseCursor->startSequenceActor(0x60001, 2, 0);
+}
+
+void BBDOUMenuSystem::setGameState(int gameState) {
+ _vm->_cursor->_status = gameState;
+}
+
+void BBDOUMenuSystem::playSoundEffect(int sfxId) {
+ // TODO
+}
+
+} // End of namespace Illusions
diff --git a/engines/illusions/bbdou/menusystem_bbdou.h b/engines/illusions/bbdou/menusystem_bbdou.h
new file mode 100644
index 0000000000..1c98b28b2f
--- /dev/null
+++ b/engines/illusions/bbdou/menusystem_bbdou.h
@@ -0,0 +1,74 @@
+/* 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 ILLUSIONS_BBDOU_MENUSYSTEM_BBDOU_H
+#define ILLUSIONS_BBDOU_MENUSYSTEM_BBDOU_H
+
+#include "illusions/menusystem.h"
+
+namespace Illusions {
+
+enum {
+ kBBDOUMainMenu,
+ kBBDOUPauseMenu,
+ kBBDOULoadGameMenu,
+ kBBDOUSaveGameMenu,
+ kBBDOUGameSavedMenu,
+ kBBDOUSaveFailedMenu,
+ kBBDOULoadFailedMenu,
+ kBBDOULastMenuIndex
+};
+
+class IllusionsEngine_BBDOU;
+
+class BBDOUMenuSystem : public BaseMenuSystem {
+public:
+ BBDOUMenuSystem(IllusionsEngine_BBDOU *vm);
+ ~BBDOUMenuSystem();
+ void runMenu(MenuChoiceOffsets menuChoiceOffsets, int16 *menuChoiceOffset,
+ uint32 menuId, uint32 duration, uint timeOutMenuChoiceIndex, uint32 menuCallerThreadId);
+public://protected:
+ IllusionsEngine_BBDOU *_vm;
+ BaseMenu *_menus[kBBDOULastMenuIndex];
+ void clearMenus();
+ void freeMenus();
+ BaseMenu *getMenuById(int menuId);
+ BaseMenu *createMenuById(int menuId);
+ BaseMenu *createMainMenu();
+ BaseMenu *createPauseMenu();
+ BaseMenu *createLoadGameMenu();
+ BaseMenu *createSaveGameMenu();
+ BaseMenu *createGameSavedMenu();
+ BaseMenu *createSaveFailedMenu();
+ BaseMenu *createLoadFailedMenu();
+ BaseMenu *createOptionsMenu();
+ int convertRootMenuId(uint32 menuId);
+ virtual bool initMenuCursor();
+ virtual int getGameState();
+ virtual void setGameState(int gameState);
+ virtual void setMenuCursorNum(int cursorNum);
+ virtual void playSoundEffect(int sfxId);
+};
+
+} // End of namespace Illusions
+
+#endif // ILLUSIONS_BBDOU_MENUSYSTEM_BBDOU_H
diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
index f0e406ed19..1c8d4009dd 100644
--- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
+++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
@@ -22,6 +22,8 @@
#include "illusions/bbdou/illusions_bbdou.h"
#include "illusions/bbdou/scriptopcodes_bbdou.h"
+#include "illusions/bbdou/bbdou_menukeys.h"
+#include "illusions/bbdou/menusystem_bbdou.h"
#include "illusions/actor.h"
#include "illusions/camera.h"
#include "illusions/dictionary.h"
@@ -311,12 +313,12 @@ void ScriptOpcodes_BBDOU::opUnloadActiveScenes(ScriptThread *scriptThread, OpCal
//uint32 dsceneId = 0x00010017, dthreadId = 0x0002001C;//Dorms int
//uint32 dsceneId = 0x0001000D, dthreadId = 0x00020012;//Food minigame
//uint32 dsceneId = 0x00010067, dthreadId = 0x0002022A;
-//uint32 dsceneId = 0x0001000C, dthreadId = 0x00020011;//Cafeteria
+uint32 dsceneId = 0x0001000C, dthreadId = 0x00020011;//Cafeteria
//uint32 dsceneId = 0x0001000B, dthreadId = 0x00020010;
//uint32 dsceneId = 0x0001001A, dthreadId = 0x0002001F;
//uint32 dsceneId = 0x00010047, dthreadId = 0x0002005F;
//uint32 dsceneId = 0x0001007D, dthreadId = 0x000203B9;
-uint32 dsceneId = 0x0001000D, dthreadId = 0x00020012;
+// uint32 dsceneId = 0x0001000D, dthreadId = 0x00020012; // Food minigame
void ScriptOpcodes_BBDOU::opChangeScene(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
@@ -691,17 +693,34 @@ void ScriptOpcodes_BBDOU::opAddMenuChoice(ScriptThread *scriptThread, OpCall &op
}
void ScriptOpcodes_BBDOU::opDisplayMenu(ScriptThread *scriptThread, OpCall &opCall) {
- ARG_INT16(unk1);
+ ARG_INT16(timeoutChoiceOfs);
ARG_UINT32(menuId);
- ARG_UINT32(unk2);
- // TODO _vm->_shellMgr->displayMenu(_vm->_stack->topPtr(), &_vm->_menuChoiceOfs, menuId, unk1, unk2, opCall._callerThreadId);
- // Remove menu choices from the stack
+ ARG_UINT32(timeOutDuration);
+
+ MenuChoiceOffsets menuChoiceOffsets;
+
+ // Load menu choices from the stack
do {
- _vm->_stack->pop();
+ int16 choiceOffs = _vm->_stack->pop();
+ menuChoiceOffsets.push_back(choiceOffs);
} while (_vm->_stack->pop() == 0);
- //DEBUG Resume calling thread, later done by the video player
- _vm->notifyThreadId(opCall._callerThreadId);
+ // TODO DBEUG Start menu not yet implemented, fake selection of "Start game"
+ if (menuId == 0x001C0001) {
+ _vm->_menuChoiceOfs = 88;
+ _vm->notifyThreadId(opCall._callerThreadId);
+ return;
+ }
+
+ // Duckman has the timeout choice offset on the stack and the index as parameter
+ // BBDOU instead has only the choice offset as parameter
+ // So we just add the timeout choice offset and use its index.
+ menuChoiceOffsets.push_back(timeoutChoiceOfs);
+ uint timeOutMenuChoiceIndex = menuChoiceOffsets.size() - 1;
+
+ _vm->_menuSystem->runMenu(menuChoiceOffsets, &_vm->_menuChoiceOfs,
+ menuId, timeOutDuration, timeOutMenuChoiceIndex,
+ opCall._callerThreadId);
}
@@ -918,7 +937,8 @@ void ScriptOpcodes_BBDOU::opAddMenuKey(ScriptThread *scriptThread, OpCall &opCal
ARG_SKIP(2);
ARG_UINT32(key);
ARG_UINT32(threadId);
- // TODO _vm->addMenuKey(key, threadId);
+ debug("addMenuKey(%08X; %08X)", key, threadId);
+ _vm->_menuKeys->addMenuKey(key, threadId);
}
void ScriptOpcodes_BBDOU::opChangeSceneAll(ScriptThread *scriptThread, OpCall &opCall) {
diff --git a/engines/illusions/input.h b/engines/illusions/input.h
index 77a1bda2fd..3b554bd622 100644
--- a/engines/illusions/input.h
+++ b/engines/illusions/input.h
@@ -83,6 +83,7 @@ public:
bool hasNewEvents();
void discardEvent(uint evt);
void discardAllEvents();
+ bool pollButton(uint bitMask);
void activateButton(uint bitMask);
void deactivateButton(uint bitMask);
Common::Point getCursorPosition();
@@ -99,7 +100,6 @@ protected:
InputEvent _inputEvents[kEventMax];
void handleKey(Common::KeyCode key, int mouseButton, bool down);
void handleMouseButton(int mouseButton, bool down);
- bool pollButton(uint bitMask);
void discardButtons(uint bitMask);
bool lookButtonStates(uint bitMask);
bool lookNewButtons(uint bitMask);
diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp
index 6d8359199d..149070d7a7 100644
--- a/engines/illusions/menusystem.cpp
+++ b/engines/illusions/menusystem.cpp
@@ -243,7 +243,11 @@ void BaseMenuSystem::initActorHoverBackground() {
WidthHeight dimensions;
dimensions._width = 300;
dimensions._height = 15;
- _vm->_controls->placeSequenceLessActor(0x4013E, Common::Point(0, 0), dimensions, 18);
+ if (_vm->getGameId() == kGameIdBBDOU) {
+ _vm->_controls->placeSequenceLessActor(0x4013E, Common::Point(0, 0), dimensions, 91);
+ } else {
+ _vm->_controls->placeSequenceLessActor(0x4013E, Common::Point(0, 0), dimensions, 18);
+ }
v0 = _vm->getObjectControl(0x4013E);
v0->_flags |= 8;
}
@@ -291,9 +295,15 @@ void BaseMenuSystem::initActorTextColorRect() {
Control *v0 = _vm->getObjectControl(0x40143);
if (!v0) {
WidthHeight dimensions;
- dimensions._width = 300;
- dimensions._height = 180;
- _vm->_controls->placeSequenceLessActor(0x40143, Common::Point(0, 0), dimensions, 17);
+ if (_vm->getGameId() == kGameIdBBDOU) {
+ dimensions._width = 420;
+ dimensions._height = 180;
+ _vm->_controls->placeSequenceLessActor(0x40143, Common::Point(0, 0), dimensions, 90);
+ } else {
+ dimensions._width = 300;
+ dimensions._height = 180;
+ _vm->_controls->placeSequenceLessActor(0x40143, Common::Point(0, 0), dimensions, 17);
+ }
v0 = _vm->getObjectControl(0x40143);
v0->_flags |= 8;
}
@@ -317,7 +327,6 @@ void BaseMenuSystem::placeActorTextColorRect() {
v0->setActorPosition(textInfoPosition);
v0->drawActorRect(Common::Rect(textInfoDimensions._width - 1, textInfoDimensions._height - 1), _activeMenu->_textColor);
-
}
void BaseMenuSystem::hideActorTextColorRect() {
@@ -340,7 +349,11 @@ void BaseMenuSystem::openMenu(BaseMenu *menu) {
setMenuCursorNum(1);
- setGameState(4);
+ if (_vm->getGameId() == kGameIdDuckman) {
+ setGameState(4);
+ } else if (_vm->getGameId() == kGameIdBBDOU) {
+ setGameState(3);
+ }
activateMenu(menu);
@@ -417,8 +430,14 @@ uint BaseMenuSystem::drawMenuText(BaseMenu *menu) {
flags |= TEXT_FLAG_BORDER_DECORATION;
WidthHeight dimensions;
- dimensions._width = 300;
- dimensions._height = 180;
+
+ if (_vm->getGameId() == kGameIdDuckman) {
+ dimensions._width = 300;
+ dimensions._height = 180;
+ } else if (_vm->getGameId() == kGameIdBBDOU) {
+ dimensions._width = 580;
+ dimensions._height = 420;
+ }
uint16 *outTextPtr;
if (!_vm->_screenText->insertText(text, menu->_fontId, dimensions, textPt, flags, menu->_backgroundColor, menu->_borderColor, 0xFF, 0xFF, 0xFF, outTextPtr)) {
diff --git a/engines/illusions/module.mk b/engines/illusions/module.mk
index dc915c3cb1..cb68485218 100644
--- a/engines/illusions/module.mk
+++ b/engines/illusions/module.mk
@@ -8,10 +8,12 @@ MODULE_OBJS := \
bbdou/bbdou_credits_staticdata.o \
bbdou/bbdou_foodctl.o \
bbdou/bbdou_inventory.o \
+ bbdou/bbdou_menukeys.o \
bbdou/bbdou_specialcode.o \
bbdou/bbdou_videoplayer.o \
bbdou/bbdou_triggerfunctions.o \
bbdou/illusions_bbdou.o \
+ bbdou/menusystem_bbdou.o \
bbdou/scriptopcodes_bbdou.o \
camera.o \
cursor.o \
diff --git a/engines/illusions/screen.cpp b/engines/illusions/screen.cpp
index 9979cd1fa8..b6cbd2dba4 100644
--- a/engines/illusions/screen.cpp
+++ b/engines/illusions/screen.cpp
@@ -542,6 +542,10 @@ void Screen8Bit::fillSurface(Graphics::Surface *surface, byte color) {
surface->fillRect(Common::Rect(surface->w, surface->h), color);
}
+void Screen8Bit::fillSurfaceRect(Graphics::Surface *surface, Common::Rect r, byte color) {
+ surface->fillRect(r, color);
+}
+
bool Screen8Bit::isSpritePixelSolid(Common::Point &testPt, Common::Point &drawPosition, Common::Point &drawOffset,
const SurfInfo &surfInfo, int16 scale, uint flags, byte *compressedPixels) {
// Unused in Duckman
@@ -742,6 +746,10 @@ void Screen16Bit::fillSurface(Graphics::Surface *surface, byte color) {
surface->fillRect(Common::Rect(surface->w, surface->h), convertColor(color));
}
+void Screen16Bit::fillSurfaceRect(Graphics::Surface *surface, Common::Rect r, byte color) {
+ surface->fillRect(r, convertColor(color));
+}
+
bool Screen16Bit::isSpritePixelSolid(Common::Point &testPt, Common::Point &drawPosition, Common::Point &drawOffset,
const SurfInfo &surfInfo, int16 scale, uint flags, byte *compressedPixels) {
diff --git a/engines/illusions/screen.h b/engines/illusions/screen.h
index 63750ce635..7025e29e64 100644
--- a/engines/illusions/screen.h
+++ b/engines/illusions/screen.h
@@ -173,6 +173,7 @@ public:
virtual void drawSurface(Common::Rect &dstRect, Graphics::Surface *surface, Common::Rect &srcRect, int16 scale, uint32 flags) = 0;
virtual void drawText(FontResource *font, Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint count) = 0;
virtual void fillSurface(Graphics::Surface *surface, byte color) = 0;
+ virtual void fillSurfaceRect(Graphics::Surface *surface, Common::Rect r, byte color) = 0;
virtual bool isSpritePixelSolid(Common::Point &testPt, Common::Point &drawPosition, Common::Point &drawOffset,
const SurfInfo &surfInfo, int16 scale, uint flags, byte *compressedPixels) = 0;
public:
@@ -194,6 +195,7 @@ public:
void drawSurface(Common::Rect &dstRect, Graphics::Surface *surface, Common::Rect &srcRect, int16 scale, uint32 flags);
void drawText(FontResource *font, Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint count);
void fillSurface(Graphics::Surface *surface, byte color);
+ void fillSurfaceRect(Graphics::Surface *surface, Common::Rect r, byte color);
bool isSpritePixelSolid(Common::Point &testPt, Common::Point &drawPosition, Common::Point &drawOffset,
const SurfInfo &surfInfo, int16 scale, uint flags, byte *compressedPixels);
public:
@@ -209,6 +211,7 @@ public:
void drawSurface(Common::Rect &dstRect, Graphics::Surface *surface, Common::Rect &srcRect, int16 scale, uint32 flags);
void drawText(FontResource *font, Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint count);
void fillSurface(Graphics::Surface *surface, byte color);
+ void fillSurfaceRect(Graphics::Surface *surface, Common::Rect r, byte color);
bool isSpritePixelSolid(Common::Point &testPt, Common::Point &drawPosition, Common::Point &drawOffset,
const SurfInfo &surfInfo, int16 scale, uint flags, byte *compressedPixels);
public:
diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp
index a7e97eaa51..fd2ef51bc2 100644
--- a/engines/illusions/screentext.cpp
+++ b/engines/illusions/screentext.cpp
@@ -151,7 +151,11 @@ bool ScreenText::insertText(uint16 *text, uint32 fontId, WidthHeight dimensions,
}
*textPart = 0;
- updateTextInfoPosition(Common::Point(160, 100));
+ if (_vm->getGameId() == kGameIdBBDOU) {
+ updateTextInfoPosition(Common::Point(320, 240));
+ } else {
+ updateTextInfoPosition(Common::Point(160, 100));
+ }
return done;
}