SCI: Stop EngineState::wait mutating r_acc
This wait function is used by kernel calls other than kWait, and those other functions do not mutate r_acc in SSCI.
This commit is contained in:
parent
0a44b54ee2
commit
2f9967524f
3 changed files with 6 additions and 5 deletions
|
@ -397,13 +397,13 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
|
||||||
reg_t kWait(EngineState *s, int argc, reg_t *argv) {
|
reg_t kWait(EngineState *s, int argc, reg_t *argv) {
|
||||||
int sleep_time = argv[0].toUint16();
|
int sleep_time = argv[0].toUint16();
|
||||||
|
|
||||||
s->wait(sleep_time);
|
const int delta = s->wait(sleep_time);
|
||||||
|
|
||||||
if (g_sci->_guestAdditions->kWaitHook()) {
|
if (g_sci->_guestAdditions->kWaitHook()) {
|
||||||
return NULL_REG;
|
return NULL_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s->r_acc;
|
return make_reg(0, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
|
reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
|
|
@ -136,13 +136,14 @@ void EngineState::speedThrottler(uint32 neededSleep) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineState::wait(int16 ticks) {
|
int EngineState::wait(int16 ticks) {
|
||||||
uint32 time = g_system->getMillis();
|
uint32 time = g_system->getMillis();
|
||||||
r_acc = make_reg(0, ((long)time - (long)lastWaitTime) * 60 / 1000);
|
const int tickDelta = ((long)time - (long)lastWaitTime) * 60 / 1000;
|
||||||
lastWaitTime = time;
|
lastWaitTime = time;
|
||||||
|
|
||||||
ticks *= g_debug_sleeptime_factor;
|
ticks *= g_debug_sleeptime_factor;
|
||||||
g_sci->sleep(ticks * 1000 / 60);
|
g_sci->sleep(ticks * 1000 / 60);
|
||||||
|
return tickDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineState::initGlobals() {
|
void EngineState::initGlobals() {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
uint32 _screenUpdateTime; /**< The last time the game updated the screen */
|
uint32 _screenUpdateTime; /**< The last time the game updated the screen */
|
||||||
|
|
||||||
void speedThrottler(uint32 neededSleep);
|
void speedThrottler(uint32 neededSleep);
|
||||||
void wait(int16 ticks);
|
int wait(int16 ticks);
|
||||||
|
|
||||||
#ifdef ENABLE_SCI32
|
#ifdef ENABLE_SCI32
|
||||||
uint32 _eventCounter; /**< total times kGetEvent was invoked since the last call to kFrameOut */
|
uint32 _eventCounter; /**< total times kGetEvent was invoked since the last call to kFrameOut */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue