SCI: Move SciGui::wait to EngineState::wait

svn-id: r48118
This commit is contained in:
Max Horn 2010-02-23 22:44:46 +00:00
parent da95a98203
commit 02201e937a
6 changed files with 20 additions and 24 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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) {

View File

@ -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"