aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/input.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-05-15 01:18:26 +0000
committerNicola Mettifogo2008-05-15 01:18:26 +0000
commit765f976008d2021cc53ce714cbec3e2160d5ef74 (patch)
tree6cff7e43c36f9b34714cfeec502fd780d196019b /engines/parallaction/input.cpp
parente4c11fa635b11e221bd93c666ec34ea96c3ae423 (diff)
downloadscummvm-rg350-765f976008d2021cc53ce714cbec3e2160d5ef74.tar.gz
scummvm-rg350-765f976008d2021cc53ce714cbec3e2160d5ef74.tar.bz2
scummvm-rg350-765f976008d2021cc53ce714cbec3e2160d5ef74.zip
* Cleanup of input code.
* Removed old timer routines. svn-id: r32135
Diffstat (limited to 'engines/parallaction/input.cpp')
-rw-r--r--engines/parallaction/input.cpp49
1 files changed, 16 insertions, 33 deletions
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index dc26debba7..28d0ad888d 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -83,7 +83,7 @@ uint16 Input::readInput() {
// TODO: don't quit() here, just have caller routines to check
// on kEngineQuit and exit gracefully to allow the engine to shut down
_engineFlags |= kEngineQuit;
- g_system->quit();
+ _vm->_system->quit();
break;
default:
@@ -101,17 +101,26 @@ uint16 Input::readInput() {
}
// FIXME: see comment for readInput()
-void Input::waitForButtonEvent(uint32 buttonEventMask) {
+void Input::waitForButtonEvent(uint32 buttonEventMask, int32 timeout) {
if (buttonEventMask == kMouseNone) {
_mouseButtons = kMouseNone; // don't wait on nothing
return;
}
- do {
- readInput();
- g_system->delayMillis(30);
- } while ((_mouseButtons & buttonEventMask) == 0);
+ const int32 LOOP_RESOLUTION = 30;
+ if (timeout <= 0) {
+ do {
+ readInput();
+ _vm->_system->delayMillis(LOOP_RESOLUTION);
+ } while ((_mouseButtons & buttonEventMask) == 0);
+ } else {
+ do {
+ readInput();
+ _vm->_system->delayMillis(LOOP_RESOLUTION);
+ timeout -= LOOP_RESOLUTION;
+ } while ((timeout > 0) && (_mouseButtons & buttonEventMask) == 0);
+ }
}
@@ -121,38 +130,12 @@ void Input::waitUntilLeftClick() {
do {
readInput();
_vm->_gfx->updateScreen();
- g_system->delayMillis(30);
+ _vm->_system->delayMillis(30);
} while (_mouseButtons != kMouseLeftUp);
return;
}
-void Parallaction::runGame() {
-
- InputData *data = _input->updateInput();
- if (data->_event != kEvNone) {
- processInput(data);
- }
-
- runPendingZones();
-
- if (_engineFlags & kEngineChangeLocation) {
- changeLocation(_location._name);
- }
-
-
- _gfx->beginFrame();
-
- if (_input->_inputMode == Input::kInputModeGame) {
- runScripts();
- walk();
- drawAnimations();
- }
-
- // change this to endFrame?
- updateView();
-
-}
void Input::updateGameInput() {