diff options
author | Max Horn | 2010-02-23 22:44:46 +0000 |
---|---|---|
committer | Max Horn | 2010-02-23 22:44:46 +0000 |
commit | 02201e937ab7a5d408b4804225affb7ce0251cce (patch) | |
tree | 44c83f861944c4137c44e33c7c4f066f51843bc7 /engines/sci | |
parent | da95a9820362f50477b35f9f95fd299eacfd04b2 (diff) | |
download | scummvm-rg350-02201e937ab7a5d408b4804225affb7ce0251cce.tar.gz scummvm-rg350-02201e937ab7a5d408b4804225affb7ce0251cce.tar.bz2 scummvm-rg350-02201e937ab7a5d408b4804225affb7ce0251cce.zip |
SCI: Move SciGui::wait to EngineState::wait
svn-id: r48118
Diffstat (limited to 'engines/sci')
-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 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 9 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 1 |
6 files changed, 20 insertions, 24 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; diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index c5ce6672a1..3316fadb56 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -97,14 +97,7 @@ void SciGui::init(bool usesOldGfxFunctions) { } void SciGui::wait(int16 ticks) { - 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; - - ticks *= g_debug_sleeptime_factor; - kernel_sleep(_s->_event, ticks * 1000 / 60); + _s->wait(ticks); } void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 13bf062efb..4b72050d0b 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -27,7 +27,6 @@ #include "common/util.h" #include "sci/sci.h" -#include "sci/debug.h" // for g_debug_sleeptime_factor #include "sci/event.h" #include "sci/engine/state.h" #include "sci/engine/selector.h" |