diff options
author | Kari Salminen | 2010-01-24 17:46:37 +0000 |
---|---|---|
committer | Kari Salminen | 2010-01-24 17:46:37 +0000 |
commit | 414eadfb2aec530b21f0773ed6657017b650876f (patch) | |
tree | 147643d966e540e197c3abe3ea72a62dec2f79a5 | |
parent | 45cbc7b265708129b77543c89555edcd28555ad7 (diff) | |
download | scummvm-rg350-414eadfb2aec530b21f0773ed6657017b650876f.tar.gz scummvm-rg350-414eadfb2aec530b21f0773ed6657017b650876f.tar.bz2 scummvm-rg350-414eadfb2aec530b21f0773ed6657017b650876f.zip |
Cine: executePlayerInput: Combine mouse handling plus a few other things.
- Combines mouse position and button state fetching
from two branches (allowPlayerInput / !allowPlayerInput)
into a single loop with a little more exotic while-clause.
NOTE! Added manageEvents-call into the unified version although
there was no manageEvents-call in one of the versions that was
combined. Tested a little and didn't seem to matter, but hopefully
won't cause any regressions!
- Limit first possible 'renderer->setCommand(commandBuffer)' call
to Future Wars only (Checked with FW & OS disassembly).
- Combined all cases of 'left and right mouse buttons are down'
into a single if-clause (All those cases call makeSystemMenu).
svn-id: r47505
-rw-r--r-- | engines/cine/various.cpp | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 8b3001e143..c70062ca4c 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -838,6 +838,7 @@ uint16 executePlayerInput() { uint16 mouseX, mouseY, mouseButton; uint16 currentEntry = 0; uint16 di = 0; + bool limitMouseCheckCount = false; canUseOnObject = 0; @@ -848,29 +849,36 @@ uint16 executePlayerInput() { } if (allowPlayerInput) { // Player input is allowed - if (isDrawCommandEnabled) { + if (g_cine->getGameType() == Cine::GType_FW && isDrawCommandEnabled) { renderer->setCommand(commandBuffer); - isDrawCommandEnabled = 0; } + isDrawCommandEnabled = 0; + limitMouseCheckCount = true; + } - getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); + // Get mouse position and button states + di = 0; + currentEntry = 0; + getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); - while (mouseButton && currentEntry < 200) { - di |= (mouseButton & (kLeftMouseButton | kRightMouseButton)); - getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); - currentEntry++; - } + while (mouseButton && (!limitMouseCheckCount || currentEntry < 200) && !g_cine->shouldQuit()) { + di |= (mouseButton & (kLeftMouseButton | kRightMouseButton)); + manageEvents(); + getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); + currentEntry++; + } - if (di) { - mouseButton = di; - } + if (di) { + mouseButton = di; + } + if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) { + // Left and right mouse buttons are down + g_cine->makeSystemMenu(); + } else if (allowPlayerInput) { // Player input is allowed if (playerCommand != -1) { // A player command is given if (mouseButton & kLeftMouseButton) { // Left mouse button is down - if (mouseButton & kRightMouseButton) { // Right mouse button is down - // A player command is given, left and right mouse buttons are down - g_cine->makeSystemMenu(); - } else { // Right mouse button is up + if (!(mouseButton & kRightMouseButton)) { // Right mouse button is up // A player command is given, left mouse button is down, right mouse button is up int16 si; do { @@ -953,9 +961,6 @@ uint16 executePlayerInput() { } makeCommandLine(); - } else { // Left mouse button is down - // No player command is given, left and right mouse buttons are down - g_cine->makeSystemMenu(); } } else { // Right mouse button is up if (mouseButton & kLeftMouseButton) { // Left mouse button is down @@ -985,24 +990,6 @@ uint16 executePlayerInput() { } } } - } else { // Player input is not allowed - di = 0; - getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); - - while (mouseButton && !g_cine->shouldQuit()) { - di |= (mouseButton & (kLeftMouseButton | kRightMouseButton)); - manageEvents(); - getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); - } - - if (di) { - mouseButton = di; - } - - if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) { - // Player input is not allowed, left and right mouse buttons are down - g_cine->makeSystemMenu(); - } } var_2 = menuVar & 0x7F; |