aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/cycle.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-03 02:21:07 +0100
committerMartin Kiewitz2016-02-03 02:21:07 +0100
commit778c1ddb69bb45b6992fdc9b8fff6b2c8d3e22ac (patch)
tree51c8437a6c8eab0bd70ef313d71a562f20fca22e /engines/agi/cycle.cpp
parentc2038e00d001c93a37028864ad661b89377686c9 (diff)
downloadscummvm-rg350-778c1ddb69bb45b6992fdc9b8fff6b2c8d3e22ac.tar.gz
scummvm-rg350-778c1ddb69bb45b6992fdc9b8fff6b2c8d3e22ac.tar.bz2
scummvm-rg350-778c1ddb69bb45b6992fdc9b8fff6b2c8d3e22ac.zip
AGI: Cycle event processing changed
processEvents() renamed to processScummVMEvents() mainCycle() renamed to processAGIEvents() have.key now sets up an inner loop and calls processAGIEvents() to avoid any further cycle work processing
Diffstat (limited to 'engines/agi/cycle.cpp')
-rw-r--r--engines/agi/cycle.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 3887999580..4d870d9ccf 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -173,12 +173,12 @@ void AgiEngine::interpretCycle() {
//_gfx->doUpdate();
}
-// If main_cycle returns false, don't process more events!
-int AgiEngine::mainCycle(bool onlyCheckForEvents) {
+// We return the current key, or 0 if no key was pressed
+uint16 AgiEngine::processAGIEvents(bool doDelay) {
uint16 key;
ScreenObjEntry *screenObjEgo = &_game.screenObjTable[SCREENOBJECTS_EGO_ENTRY];
- if (!onlyCheckForEvents) {
+ if (doDelay) {
pollTimer();
}
@@ -188,10 +188,8 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
// vars in every interpreter cycle.
//
// We run AGIMOUSE always as a side effect
- //if (getFeatures() & GF_AGIMOUSE) {
- setVar(VM_VAR_MOUSE_X, _mouse.pos.x / 2);
- setVar(VM_VAR_MOUSE_Y, _mouse.pos.y);
- //}
+ setVar(VM_VAR_MOUSE_X, _mouse.pos.x / 2);
+ setVar(VM_VAR_MOUSE_Y, _mouse.pos.y);
if (!cycleInnerLoopIsActive()) {
// Click-to-walk mouse interface
@@ -234,6 +232,10 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
}
}
+ if (_menu->delayedExecuteActive()) {
+ _menu->execute();
+ }
+
} else {
// inner loop active
// call specific workers
@@ -255,11 +257,11 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
if (key) {
_menu->keyPress(key);
}
- return false;
+ break;
case CYCLE_INNERLOOP_MENU_VIA_MOUSE:
_menu->mouseEvent(key);
- return false;
+ break;
case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT:
if (key) {
@@ -278,15 +280,9 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
}
}
- if (!onlyCheckForEvents) {
- if (_menu->delayedExecuteActive()) {
- _menu->execute();
- }
- }
-
_gfx->updateScreen();
- return true;
+ return key;
}
int AgiEngine::playGame() {
@@ -341,9 +337,7 @@ int AgiEngine::playGame() {
nonBlockingText_Forget();
do {
-
- if (!mainCycle())
- continue;
+ processAGIEvents();
inGameTimerUpdate();