aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kmisc.cpp29
-rw-r--r--engines/sci/engine/state.cpp5
-rw-r--r--engines/sci/engine/state.h5
-rw-r--r--engines/sci/graphics/animate.h2
-rw-r--r--engines/sci/graphics/gui.cpp3
5 files changed, 27 insertions, 17 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 4327957ebb..7f1572d671 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -58,20 +58,23 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
// Some games seem to get the duration of main loop initially and then switch of animations for the whole game
// based on that (qfg2, iceman). We are now running full speed initially to avoid that.
- if (s->_lastAnimateCounter < 50) {
- s->_lastAnimateCounter++;
- return s->r_acc;
- }
+ if (s->_throttleTrigger) {
+ //if (s->_throttleCounter < 50) {
+ // s->_throttleCounter++;
+ // return s->r_acc;
+ //}
- uint32 curTime = g_system->getMillis();
- uint32 duration = curTime - s->_lastAnimateTime;
- uint32 neededSleep = 30;
-
- if (duration < neededSleep) {
- kernel_sleep(s->_event, neededSleep - duration);
- s->_lastAnimateTime = g_system->getMillis();
- } else {
- s->_lastAnimateTime = curTime;
+ uint32 curTime = g_system->getMillis();
+ uint32 duration = curTime - s->_throttleLastTime;
+ uint32 neededSleep = 30;
+
+ if (duration < neededSleep) {
+ kernel_sleep(s->_event, neededSleep - duration);
+ s->_throttleLastTime = g_system->getMillis();
+ } else {
+ s->_throttleLastTime = curTime;
+ }
+ s->_throttleTrigger = false;
}
return s->r_acc;
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index f9330e424e..e61f61f9bf 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -71,8 +71,9 @@ EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc,
successor = 0;
- _lastAnimateCounter = 0;
- _lastAnimateTime = 0;
+ _throttleCounter = 0;
+ _throttleLastTime = 0;
+ _throttleTrigger = false;
_setCursorType = SCI_VERSION_NONE;
_doSoundType = SCI_VERSION_NONE;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 3d6178b07e..a0b77adc8d 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -158,8 +158,9 @@ public:
uint32 game_start_time; /**< The time at which the interpreter was started */
uint32 last_wait_time; /**< The last time the game invoked Wait() */
- uint32 _lastAnimateCounter; /**< total times kAnimate was invoked */
- uint32 _lastAnimateTime; /**< last time kAnimate was invoked */
+ uint32 _throttleCounter; /**< total times kAnimate was invoked */
+ uint32 _throttleLastTime; /**< last time kAnimate was invoked */
+ bool _throttleTrigger;
/* Kernel File IO stuff */
diff --git a/engines/sci/graphics/animate.h b/engines/sci/graphics/animate.h
index 146893faf5..db09342d4b 100644
--- a/engines/sci/graphics/animate.h
+++ b/engines/sci/graphics/animate.h
@@ -80,6 +80,8 @@ public:
void addToPicDrawCels();
void addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
+ uint16 getLastCastCount() { return _lastCastCount; };
+
private:
void init();
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 1c418cbed7..af405807be 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -675,6 +675,9 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
_animate->updateScreen(old_picNotValid);
_animate->restoreAndDelete(argc, argv);
+ if (_animate->getLastCastCount() > 1)
+ _s->_throttleTrigger = true;
+
_gfx->SetPort(oldPort);
}