aboutsummaryrefslogtreecommitdiff
path: root/engines/lilliput
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lilliput')
-rw-r--r--engines/lilliput/lilliput.cpp16
-rw-r--r--engines/lilliput/lilliput.h9
-rw-r--r--engines/lilliput/script.cpp12
3 files changed, 28 insertions, 9 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index f68c920a66..7d1ff65aab 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -111,6 +111,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_console = new LilliputConsole(this);
_rnd = 0;
+ _mouseX = 0;
+ _mouseY = 0;
+ _mouseButton = 0;
_scriptHandler = new LilliputScript(this);
_byte1714E = 0;
@@ -153,6 +156,18 @@ Common::Platform LilliputEngine::getPlatform() const {
return _platform;
}
+void LilliputEngine::getMouseEvent() {
+ Common::EventManager *_event = _system->getEventManager();
+
+ Common::Event event;
+ while (_event->pollEvent(event) && !_shouldQuit)
+ ;
+
+ _mouseX = _event->getMousePos().x;
+ _mouseY = _event->getMousePos().y;
+ _mouseButton = _event->getButtonState();
+}
+
byte *LilliputEngine::loadVGA(Common::String filename, bool loadPal) {
Common::File f;
@@ -445,6 +460,7 @@ void LilliputEngine::initialize() {
_rnd = new Common::RandomSource("robin");
_rnd->setSeed(42); // Kick random number generator
+ _shouldQuit = false;
for (int i = 0; i < 4; i++) {
_arr18560[i]._field0 = 0;
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 8eddeb806f..92ef2fb1ee 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -176,12 +176,19 @@ public:
Common::String getSavegameFilename(int slot);
void syncSoundSettings();
+ int _mouseX;
+ int _mouseY;
+ int _mouseButton;
+
+ void getMouseEvent();
+
// Temporary stubs
- byte _mouse_byte1299A;
byte _mouse_savedMousePosDivided;
byte _keyboard_getch();
protected:
+ Common::EventManager *_eventMan;
+ bool _shouldQuit;
// Engine APIs
Common::Error run();
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 6ab8b71afe..7108f9da8b 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -1307,30 +1307,26 @@ void LilliputScript::OC_sub184F5() {
_vm->_word12D3D = 0;
_vm->_word12D3F = 0;
//
- _vm->_mouse_byte1299A = 0;
+ _vm->_mouseButton = 0;
_vm->_byte16F09 = 0;
- // TODO: Remove when the sound and the events are hooked
-// _vm->_mouse_byte1299A = 1;
- //
-
for (;;) {
sub185B4_display();
-
+ _vm->getMouseEvent();
if (_vm->_keyboard_nextIndex != _vm->_keyboard_oldIndex) {
_vm->_byte16F09 = _vm->_keyboard_getch();
_vm->_keyboard_getch();
break;
}
- if (_vm->_mouse_byte1299A == 1)
+ if (_vm->_mouseButton & 1)
break;
if ((_vm->_byte184F4 != 0) && (_vm->_sound_byte16F06 == 0))
break;
}
- _vm->_mouse_byte1299A = 0;
+ _vm->_mouseButton = 0;
}
void LilliputScript::OC_sub1853B() {