aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2013-05-11 17:08:21 +0300
committerFilippos Karapetis2013-05-11 17:09:59 +0300
commit5fadff59f9b15936bd903d5e0bd51f225d243b82 (patch)
tree993778d4051673e7fa90923ee2030d564cc1a83b /engines
parentc75480bf2f4936c202d32c96a2b8331184963087 (diff)
downloadscummvm-rg350-5fadff59f9b15936bd903d5e0bd51f225d243b82.tar.gz
scummvm-rg350-5fadff59f9b15936bd903d5e0bd51f225d243b82.tar.bz2
scummvm-rg350-5fadff59f9b15936bd903d5e0bd51f225d243b82.zip
AGI: Fix bug #3600733 - "AGI FANMADE: function slowing down game"
We now only test for events in testKeypressed() without updating the game cycle at all (NAGI doesn't update the game cycle either). This fixes the slowdowns in some animations where have.key() is issued, like Manannan's lightnings in the intro of KQ3 and the bullets in the intro of PQ1
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.h2
-rw-r--r--engines/agi/cycle.cpp33
-rw-r--r--engines/agi/op_test.cpp7
3 files changed, 26 insertions, 16 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 520b0aae59..93a456b9a6 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -942,7 +942,7 @@ public:
void setvar(int, int);
void decrypt(uint8 *mem, int len);
void releaseSprites();
- int mainCycle();
+ int mainCycle(bool onlyCheckForEvents = false);
int viewPictures();
int runGame();
void inventory();
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 86f0b9e9db..702ca907d7 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -187,12 +187,14 @@ void AgiEngine::oldInputMode() {
}
// If main_cycle returns false, don't process more events!
-int AgiEngine::mainCycle() {
+int AgiEngine::mainCycle(bool onlyCheckForEvents) {
unsigned int key, kascii;
VtEntry *v = &_game.viewTable[0];
- pollTimer();
- updateTimer();
+ if (!onlyCheckForEvents) {
+ pollTimer();
+ updateTimer();
+ }
key = doPollKeyboard();
@@ -205,7 +207,13 @@ int AgiEngine::mainCycle() {
_game.vars[29] = _mouse.y;
//}
- if (key == KEY_PRIORITY) {
+ if (key == KEY_STATUSLN) { // F11
+ _debug.statusline = !_debug.statusline;
+ writeStatus();
+ key = 0;
+ }
+
+ if (key == KEY_PRIORITY) { // F12
_sprites->eraseBoth();
_debug.priority = !_debug.priority;
_picture->showPic();
@@ -214,14 +222,8 @@ int AgiEngine::mainCycle() {
key = 0;
}
- if (key == KEY_STATUSLN) {
- _debug.statusline = !_debug.statusline;
- writeStatus();
- key = 0;
- }
-
// Click-to-walk mouse interface
- if (_game.playerControl && v->flags & fAdjEgoXY) {
+ if (_game.playerControl && (v->flags & fAdjEgoXY)) {
int toX = v->parm1;
int toY = v->parm2;
@@ -289,10 +291,13 @@ int AgiEngine::mainCycle() {
break;
}
} while (restartProcessKey);
- _gfx->doUpdate();
- if (_game.msgBoxTicks > 0)
- _game.msgBoxTicks--;
+ if (!onlyCheckForEvents) {
+ _gfx->doUpdate();
+
+ if (_game.msgBoxTicks > 0)
+ _game.msgBoxTicks--;
+ }
return true;
}
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index 124a1cfcb7..18861a2190 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -259,7 +259,12 @@ uint8 AgiEngine::testKeypressed() {
InputMode mode = _game.inputMode;
_game.inputMode = INPUT_NONE;
- mainCycle();
+ // Only check for events here, without updating the game cycle,
+ // otherwise the animations in some games are drawn too quickly
+ // like, for example, Manannan's lightnings in the intro of KQ3
+ // and the bullets opened in the logo of PQ1, during its intro.
+ // Fixes bug #3600733
+ mainCycle(true);
_game.inputMode = mode;
}