aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2017-05-06 16:34:42 -0500
committerColin Snover2017-09-19 19:54:29 -0500
commit2f9967524f610f277c9c5109d1339e3e87957804 (patch)
tree4d3a2d305c97f813f5079078d2f6e7cdfabf829c /engines/sci
parent0a44b54ee27a93d6609070d9ae3fa68ff419da85 (diff)
downloadscummvm-rg350-2f9967524f610f277c9c5109d1339e3e87957804.tar.gz
scummvm-rg350-2f9967524f610f277c9c5109d1339e3e87957804.tar.bz2
scummvm-rg350-2f9967524f610f277c9c5109d1339e3e87957804.zip
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.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp4
-rw-r--r--engines/sci/engine/state.cpp5
-rw-r--r--engines/sci/engine/state.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 9bfeb9ab01..28e054bea9 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -397,13 +397,13 @@ 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();
- s->wait(sleep_time);
+ const int delta = s->wait(sleep_time);
if (g_sci->_guestAdditions->kWaitHook()) {
return NULL_REG;
}
- return s->r_acc;
+ return make_reg(0, delta);
}
reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 731f6b7e07..343a9496b3 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -136,13 +136,14 @@ void EngineState::speedThrottler(uint32 neededSleep) {
}
}
-void EngineState::wait(int16 ticks) {
+int EngineState::wait(int16 ticks) {
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;
ticks *= g_debug_sleeptime_factor;
g_sci->sleep(ticks * 1000 / 60);
+ return tickDelta;
}
void EngineState::initGlobals() {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index b02ace8aaf..21c9a1fe9a 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -126,7 +126,7 @@ public:
uint32 _screenUpdateTime; /**< The last time the game updated the screen */
void speedThrottler(uint32 neededSleep);
- void wait(int16 ticks);
+ int wait(int16 ticks);
#ifdef ENABLE_SCI32
uint32 _eventCounter; /**< total times kGetEvent was invoked since the last call to kFrameOut */