diff options
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 15 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 15 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 2 |
4 files changed, 19 insertions, 15 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 77ba15cbd5..eaeb048353 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -721,7 +721,7 @@ bool kernel_matches_signature(SegManager *segMan, const char *sig, int argc, con return false; } -void kernel_sleep(SciEvent *event, uint32 msecs ) { +void kernel_sleep(SciEvent *event, uint32 msecs) { uint32 time; const uint32 wakeup_time = g_system->getMillis() + msecs; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 67b03138ee..75aa4b4ecd 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -351,21 +351,8 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { reg_t kWait(EngineState *s, int argc, reg_t *argv) { int sleep_time = argv[0].toUint16(); -#if 0 - uint32 time; - time = g_system->getMillis(); - s->r_acc = make_reg(0, ((long)time - (long)s->last_wait_time) * 60 / 1000); - s->last_wait_time = time; - - sleep_time *= g_debug_sleeptime_factor; - gfxop_sleep(s->gfx_state, sleep_time * 1000 / 60); - -#endif - - // FIXME: we should not be asking from the GUI to wait. The kernel sounds - // like a better place - g_sci->_gui->wait(sleep_time); + s->wait(sleep_time); return s->r_acc; } diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 01e7cdf76f..94ff57b330 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -23,7 +23,11 @@ * */ +#include "common/system.h" + #include "sci/sci.h" // for INCLUDE_OLDGFX +#include "sci/debug.h" // for g_debug_sleeptime_factor +#include "sci/event.h" // for kernel_sleep #include "sci/engine/state.h" #include "sci/engine/selector.h" @@ -81,6 +85,17 @@ EngineState::~EngineState() { delete _msgState; } +void EngineState::wait(int16 ticks) { + uint32 time; + + time = g_system->getMillis(); + r_acc = make_reg(0, ((long)time - (long)last_wait_time) * 60 / 1000); + last_wait_time = time; + + ticks *= g_debug_sleeptime_factor; + kernel_sleep(_event, ticks * 1000 / 60); +} + uint16 EngineState::currentRoomNumber() const { return script_000->_localsBlock->_locals[13].toUint16(); } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 7284f83319..f638f78d03 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -121,6 +121,8 @@ public: uint32 game_start_time; /**< The time at which the interpreter was started */ uint32 last_wait_time; /**< The last time the game invoked Wait() */ + void wait(int16 ticks); + uint32 _throttleCounter; /**< total times kAnimate was invoked */ uint32 _throttleLastTime; /**< last time kAnimate was invoked */ bool _throttleTrigger; |