diff options
author | Paul Gilbert | 2009-07-17 05:10:24 +0000 |
---|---|---|
committer | Paul Gilbert | 2009-07-17 05:10:24 +0000 |
commit | db81b0a1853fa8212bedda90429d180f0fe34297 (patch) | |
tree | 80fdb64bca3e52fe2330a5e5a4379c4f7d6b87c9 /engines/cruise | |
parent | 6c4e87a1d889ffdb6c97393d6d31db3138c291c8 (diff) | |
download | scummvm-rg350-db81b0a1853fa8212bedda90429d180f0fe34297.tar.gz scummvm-rg350-db81b0a1853fa8212bedda90429d180f0fe34297.tar.bz2 scummvm-rg350-db81b0a1853fa8212bedda90429d180f0fe34297.zip |
Added an explicit break out of the event processing loop for mouse buttons and/or key-presses - this should allow stylus-based systems to properly process 'mouse down' events before the 'mouse up' is processed
svn-id: r42558
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/cruise_main.cpp | 91 | ||||
-rw-r--r-- | engines/cruise/menu.cpp | 2 |
2 files changed, 14 insertions, 79 deletions
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 862cda592e..e5864ebb31 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1626,11 +1626,14 @@ int currentMouseButton = 0; bool bFastMode = false; -void manageEvents() { +bool manageEvents() { Common::Event event; + bool result = false; Common::EventManager * eventMan = g_system->getEventManager(); - while (eventMan->pollEvent(event)) { + while (eventMan->pollEvent(event) && !result) { + result = true; + switch (event.type) { case Common::EVENT_LBUTTONDOWN: currentMouseButton |= MB_LEFT; @@ -1647,11 +1650,12 @@ void manageEvents() { case Common::EVENT_MOUSEMOVE: currentMouseX = event.mouse.x; currentMouseY = event.mouse.y; + result = false; break; case Common::EVENT_QUIT: case Common::EVENT_RTL: playerDontAskQuit = 1; - return; + break; case Common::EVENT_KEYUP: switch (event.kbd.keycode) { case Common::KEYCODE_ESCAPE: @@ -1671,72 +1675,6 @@ void manageEvents() { break; } - /* - * switch (event.kbd.keycode) { - * case '\n': - * case '\r': - * case 261: // Keypad 5 - * if (allowPlayerInput) { - * mouseLeft = 1; - * } - * break; - * case 27: // ESC - * if (allowPlayerInput) { - * mouseRight = 1; - * } - * break; - * case 282: // F1 - * if (allowPlayerInput) { - * playerCommand = 0; // EXAMINE - * makeCommandLine(); - * } - * break; - * case 283: // F2 - * if (allowPlayerInput) { - * playerCommand = 1; // TAKE - * makeCommandLine(); - * } - * break; - * case 284: // F3 - * if (allowPlayerInput) { - * playerCommand = 2; // INVENTORY - * makeCommandLine(); - * } - * break; - * case 285: // F4 - * if (allowPlayerInput) { - * playerCommand = 3; // USE - * makeCommandLine(); - * } - * break; - * case 286: // F5 - * if (allowPlayerInput) { - * playerCommand = 4; // ACTIVATE - * makeCommandLine(); - * } - * break; - * case 287: // F6 - * if (allowPlayerInput) { - * playerCommand = 5; // SPEAK - * makeCommandLine(); - * } - * break; - * case 290: // F9 - * if (allowPlayerInput && !inMenu) { - * makeActionMenu(); - * makeCommandLine(); - * } - * break; - * case 291: // F10 - * if (!disableSystemMenu && !inMenu) { - * g_cine->makeSystemMenu(); - * } - * break; - * default: - * //lastKeyStroke = event.kbd.keycode; - * break; - * } - * break; */ if (event.kbd.flags == Common::KBD_CTRL) { if (event.kbd.keycode == Common::KEYCODE_d) { // Start the debugger @@ -1753,17 +1691,10 @@ void manageEvents() { } } - /*if (count) { - * mouseData.left = mouseLeft; - * mouseData.right = mouseRight; - * mouseLeft = 0; - * mouseRight = 0; - * } - */ + return result; } void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) { - manageEvents(); *pMouseX = currentMouseX; *pMouseY = currentMouseY; *pMouseButton = currentMouseButton; @@ -1806,11 +1737,15 @@ void CruiseEngine::mainLoop(void) { if (!bFastMode) { // Delay for the specified amount of time, but still respond to events + bool skipEvents = false; + while (currentTick < lastTick + _gameSpeed) { g_system->delayMillis(10); currentTick = g_system->getMillis(); - manageEvents(); + if (!skipEvents) + skipEvents = manageEvents(); + if (playerDontAskQuit) break; if (_vm->getDebugger()->isAttached()) diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp index 0e9ab55c82..54f686f32a 100644 --- a/engines/cruise/menu.cpp +++ b/engines/cruise/menu.cpp @@ -146,7 +146,7 @@ void updateMenuMouse(int mouseX, int mouseY, menuStruct *pMenu) { } } -void manageEvents(); +bool manageEvents(); int processMenu(menuStruct *pMenu) { int16 mouseX; |