aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2012-04-10 10:06:50 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit47b9c1f6a7032c858a7ff1145d23493d03a40797 (patch)
tree6cb1178c860b699acf1a08abc71905a55f0341ef /engines
parentcabc7a375d2a3617a4059472e70cdb519b3900e2 (diff)
downloadscummvm-rg350-47b9c1f6a7032c858a7ff1145d23493d03a40797.tar.gz
scummvm-rg350-47b9c1f6a7032c858a7ff1145d23493d03a40797.tar.bz2
scummvm-rg350-47b9c1f6a7032c858a7ff1145d23493d03a40797.zip
LILLIPUT: Modify event polling
Diffstat (limited to 'engines')
-rw-r--r--engines/lilliput/lilliput.cpp33
-rw-r--r--engines/lilliput/lilliput.h4
-rw-r--r--engines/lilliput/script.cpp15
-rw-r--r--engines/lilliput/script.h2
4 files changed, 33 insertions, 21 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 7d1ff65aab..d1cab057cf 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -23,11 +23,12 @@
#include "common/system.h"
#include "common/random.h"
#include "common/error.h"
-#include "common/events.h"
#include "common/debug-channels.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
#include "common/memstream.h"
+#include "common/events.h"
+#include "engines/util.h"
#include "lilliput/lilliput.h"
#include "engines/util.h"
@@ -156,16 +157,28 @@ Common::Platform LilliputEngine::getPlatform() const {
return _platform;
}
-void LilliputEngine::getMouseEvent() {
- Common::EventManager *_event = _system->getEventManager();
-
+void LilliputEngine::pollEvent() {
Common::Event event;
- while (_event->pollEvent(event) && !_shouldQuit)
- ;
-
- _mouseX = _event->getMousePos().x;
- _mouseY = _event->getMousePos().y;
- _mouseButton = _event->getButtonState();
+ while (_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ break;
+ case Common::EVENT_LBUTTONUP:
+ _mouseButton |= 1;
+ break;
+ case Common::EVENT_RBUTTONUP:
+ _mouseButton |= 2;
+ break;
+ case Common::EVENT_QUIT:
+ _shouldQuit = true;
+ break;
+ // TODO: handle keyboard
+ default:
+ break;
+ }
+ }
}
byte *LilliputEngine::loadVGA(Common::String filename, bool loadPal) {
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 92ef2fb1ee..72839cc064 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -105,8 +105,6 @@ public:
int _word10800_ERULES;
int _word10807_ERULES;
- int _word12D3D;
- int _word12D3F;
int _word16EFA;
byte *_rulesChunk1;
@@ -180,7 +178,7 @@ public:
int _mouseY;
int _mouseButton;
- void getMouseEvent();
+ void pollEvent();
// Temporary stubs
byte _mouse_savedMousePosDivided;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 7108f9da8b..e93608ed39 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -476,7 +476,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub184D7();
break;
case 0x55:
- OC_sub184F5();
+ OC_displayTitleScreen();
break;
case 0x56:
OC_sub1853B();
@@ -1298,21 +1298,22 @@ void LilliputScript::OC_displayVGAFile() {
void LilliputScript::OC_sub184D7() {
warning("OC_sub184D7");
}
-void LilliputScript::OC_sub184F5() {
- debugC(1, kDebugScript, "OC_sub184F5()");
+void LilliputScript::OC_displayTitleScreen() {
+ debugC(1, kDebugScript, "OC_displayTitleScreen()");
_vm->_byte184F4 = (_currScript->readUint16LE() & 0xFF);
_vm->_sound_byte16F06 = _vm->_byte184F4;
- // TODO: use a separated function when properly identified
- _vm->_word12D3D = 0;
- _vm->_word12D3F = 0;
+
+ // TODO: Rewrite keyboard handling (this code was in a separated function)
+ _vm->_keyboard_nextIndex = 0;
+ _vm->_keyboard_oldIndex = 0;
//
_vm->_mouseButton = 0;
_vm->_byte16F09 = 0;
for (;;) {
sub185B4_display();
- _vm->getMouseEvent();
+ _vm->pollEvent();
if (_vm->_keyboard_nextIndex != _vm->_keyboard_oldIndex) {
_vm->_byte16F09 = _vm->_keyboard_getch();
_vm->_keyboard_getch();
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index aff8ca0bd8..75ab5ca1ef 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -219,7 +219,7 @@ private:
void OC_sub1847F();
void OC_displayVGAFile();
void OC_sub184D7();
- void OC_sub184F5();
+ void OC_displayTitleScreen();
void OC_sub1853B();
void OC_sub1864D();
void OC_initArr18560();