aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorDavid Fioramonti2018-08-07 18:36:58 -0700
committerBastien Bouclet2018-08-11 10:47:37 +0200
commit535c47fced43bf98eded5e401cb7ea78ebaae66e (patch)
tree248561869044431dfea80b1501c004e800d7ca39 /engines/mohawk
parent56389b1a5d3adb2a836e63ae1d530a8866e833e6 (diff)
downloadscummvm-rg350-535c47fced43bf98eded5e401cb7ea78ebaae66e.tar.gz
scummvm-rg350-535c47fced43bf98eded5e401cb7ea78ebaae66e.tar.bz2
scummvm-rg350-535c47fced43bf98eded5e401cb7ea78ebaae66e.zip
MOHAWK: RIVEN: Delay less for slower systems
Some systems may take longer to process the game loop than others so we delay by a variable amount so faster and slower system execute the game loop the same number of times per second (the fps is capped at 100). Slower systems that take longer than 10ms to process the game loop won't have any delay.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/riven.cpp5
-rw-r--r--engines/mohawk/riven.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 37a7745d34..057102260d 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -209,6 +209,7 @@ Common::Error MohawkEngine_Riven::run() {
void MohawkEngine_Riven::doFrame() {
// Update background running things
+ uint32 loopStart = _system->getMillis();
_sound->updateSLST();
_video->updateMovies();
@@ -234,9 +235,11 @@ void MohawkEngine_Riven::doFrame() {
// Update the screen once per frame
_system->updateScreen();
+ uint32 loopElapsed = _system->getMillis() - loopStart;
// Cut down on CPU usage
- _system->delayMillis(10);
+ if (loopElapsed < 10)
+ _system->delayMillis(10 - loopElapsed);
}
void MohawkEngine_Riven::processInput() {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index b887fc1184..e938d2711c 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -106,6 +106,7 @@ public:
bool hasFeature(EngineFeature f) const override;
void doFrame();
+ void processInput();
private:
// Datafiles