aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/bbdou
diff options
context:
space:
mode:
authorjohndoe1232014-12-11 14:14:52 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit36ec0fafdb186ad55a0d6c08e38b96ef84fa60a8 (patch)
tree60c9d7eb972d42f7e6cdaf5d6cb169906f4e1c28 /engines/illusions/bbdou
parenta078073e88c094c23e4eb51e5fb85e2cecc3ae9a (diff)
downloadscummvm-rg350-36ec0fafdb186ad55a0d6c08e38b96ef84fa60a8.tar.gz
scummvm-rg350-36ec0fafdb186ad55a0d6c08e38b96ef84fa60a8.tar.bz2
scummvm-rg350-36ec0fafdb186ad55a0d6c08e38b96ef84fa60a8.zip
ILLUSIONS: Refactor the input system
Diffstat (limited to 'engines/illusions/bbdou')
-rw-r--r--engines/illusions/bbdou/bbdou_cursor.cpp4
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp12
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.cpp24
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.h2
-rw-r--r--engines/illusions/bbdou/scriptopcodes_bbdou.cpp10
5 files changed, 39 insertions, 13 deletions
diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp
index 88f0fac0c3..4b9230b77b 100644
--- a/engines/illusions/bbdou/bbdou_cursor.cpp
+++ b/engines/illusions/bbdou/bbdou_cursor.cpp
@@ -89,7 +89,7 @@ void BbdouCursor::enable(uint32 objectId) {
_vm->_camera->panEdgeFollow(objectId, 360);
_data._idleCtr = 0;
}
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
}
void BbdouCursor::disable(uint32 objectId) {
@@ -354,7 +354,7 @@ void BbdouCursor::hide(uint32 objectId) {
_bbdou->resetItem10(objectId, &_data._item10);
_vm->_camera->popCameraMode();
}
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
}
} // End of namespace Illusions
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index 5369bbb6c0..a7054841ac 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -331,7 +331,7 @@ void BbdouSpecialCode::resetItem10(uint32 objectId, Item10 *item10) {
item10->_objectIds[0] = 0;
item10->_objectIds[1] = 0;
}
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
}
bool BbdouSpecialCode::testValueRange(int value) {
@@ -407,7 +407,7 @@ void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, ui
control3->deactivateObject();
item10->_playSound48 = 1;
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
}
@@ -540,14 +540,14 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint
}
cursorData._currOverlappedObjectId = 0;
} else if (cursorData._currOverlappedObjectId) {
- if (_vm->_input->pollButton(1)) {
+ if (_vm->_input->pollEvent(kEventLeftClick)) {
cursorData._idleCtr = 0;
if (runCause(cursorControl, cursorData, cursorData._item10._verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, 1)) {
resetItem10(cursorControl->_objectId, &cursorData._item10);
cursorData._currOverlappedObjectId = 0;
cursorControl->setActorIndexTo1();
}
- } else if (_vm->_input->pollButton(2)) {
+ } else if (_vm->_input->pollEvent(kEventRightClick)) {
uint32 verbId;
cursorData._idleCtr = 0;
if (cursorData._holdingObjectId) {
@@ -561,10 +561,10 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint
}
}
} else {
- if (_vm->_input->pollButton(1)) {
+ if (_vm->_input->pollEvent(kEventLeftClick)) {
cursorData._idleCtr = 0;
runCause(cursorControl, cursorData, 0x1B0002, 0, 0x40003, 0);
- } else if (_vm->_input->pollButton(4)) {
+ } else if (_vm->_input->pollEvent(kEventInventory)) {
cursorData._idleCtr = 0;
if (cursorData._item10._field58 <= 1)
runCause(cursorControl, cursorData, cursorData._holdingObjectId != 0 ? 0x1B000B : 0x1B0004, 0, 0x40003, 0);
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 339b61d3f8..112aa3f1d0 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -216,6 +216,8 @@ Common::Error IllusionsEngine_BBDOU::run() {
_updateFunctions = new UpdateFunctions();
_soundMan = new SoundMan(this);
+ initInput();
+
initUpdateFunctions();
_fader = 0;
@@ -283,6 +285,28 @@ bool IllusionsEngine_BBDOU::hasFeature(EngineFeature f) const {
*/
}
+void IllusionsEngine_BBDOU::initInput() {
+ _input->setInputEvent(kEventLeftClick, 0x01)
+ .addMouseButton(MOUSE_LEFT_BUTTON)
+ .addKey(Common::KEYCODE_RETURN);
+ _input->setInputEvent(kEventRightClick, 0x02)
+ .addMouseButton(MOUSE_RIGHT_BUTTON);
+ _input->setInputEvent(kEventInventory, 0x04)
+ .addMouseButton(MOUSE_RIGHT_BUTTON)
+ .addKey(Common::KEYCODE_TAB);
+ _input->setInputEvent(kEventAbort, 0x08)
+ .addKey(Common::KEYCODE_ESCAPE);
+ _input->setInputEvent(kEventSkip, 0x10)
+ .addKey(Common::KEYCODE_SPACE);
+ _input->setInputEvent(kEventF1, 0x20)
+ .addKey(Common::KEYCODE_F1);
+ _input->setInputEvent(kEventUp, 0x40)
+ .addKey(Common::KEYCODE_UP);
+ _input->setInputEvent(kEventDown, 0x80)
+ .addMouseButton(MOUSE_RIGHT_BUTTON)
+ .addKey(Common::KEYCODE_DOWN);
+}
+
#define UPDATEFUNCTION(priority, tag, callback) \
_updateFunctions->add(priority, tag, new Common::Functor1Mem<uint, int, IllusionsEngine_BBDOU> \
(this, &IllusionsEngine_BBDOU::callback));
diff --git a/engines/illusions/bbdou/illusions_bbdou.h b/engines/illusions/bbdou/illusions_bbdou.h
index fccfb59bf5..5317809907 100644
--- a/engines/illusions/bbdou/illusions_bbdou.h
+++ b/engines/illusions/bbdou/illusions_bbdou.h
@@ -98,6 +98,8 @@ public:
uint32 _theThreadId;
uint32 _globalSceneId;
+ void initInput();
+
void initUpdateFunctions();
int updateScript(uint flags);
diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
index 2f1c705595..efdc289c9b 100644
--- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
+++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
@@ -263,7 +263,7 @@ void ScriptOpcodes_BBDOU::opChangeScene(ScriptThread *scriptThread, OpCall &opCa
}
// NOTE Skipped checking for stalled resources
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
_vm->_prevSceneId = _vm->getCurrentScene();
_vm->exitScene(opCall._callerThreadId);
_vm->enterScene(sceneId, opCall._callerThreadId);
@@ -277,7 +277,7 @@ void ScriptOpcodes_BBDOU::opStartModalScene(ScriptThread *scriptThread, OpCall &
ARG_UINT32(sceneId);
ARG_UINT32(threadId);
// NOTE Skipped checking for stalled resources
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
_vm->enterPause(opCall._callerThreadId);
_vm->_talkItems->pauseByTag(_vm->getCurrentScene());
_vm->enterScene(sceneId, opCall._callerThreadId);
@@ -288,7 +288,7 @@ void ScriptOpcodes_BBDOU::opStartModalScene(ScriptThread *scriptThread, OpCall &
void ScriptOpcodes_BBDOU::opExitModalScene(ScriptThread *scriptThread, OpCall &opCall) {
// NOTE Skipped checking for stalled resources
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
_vm->exitScene(opCall._callerThreadId);
_vm->leavePause(opCall._callerThreadId);
_vm->_talkItems->unpauseByTag(_vm->getCurrentScene());
@@ -298,7 +298,7 @@ void ScriptOpcodes_BBDOU::opEnterCloseUpScene(ScriptThread *scriptThread, OpCall
ARG_SKIP(2);
ARG_UINT32(sceneId);
// NOTE Skipped checking for stalled resources
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
_vm->enterPause(opCall._callerThreadId);
_vm->enterScene(sceneId, opCall._callerThreadId);
}
@@ -768,7 +768,7 @@ void ScriptOpcodes_BBDOU::opChangeSceneAll(ScriptThread *scriptThread, OpCall &o
ARG_UINT32(sceneId);
ARG_UINT32(threadId);
// NOTE Skipped checking for stalled resources
- _vm->_input->discardButtons(0xFFFF);
+ _vm->_input->discardAllEvents();
_vm->_prevSceneId = _vm->getCurrentScene();
_vm->dumpActiveScenes(_vm->_globalSceneId, opCall._callerThreadId);
_vm->enterScene(sceneId, opCall._callerThreadId);