aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/groovie/groovie.cpp13
-rw-r--r--engines/groovie/script.cpp4
-rw-r--r--engines/groovie/script.h2
3 files changed, 18 insertions, 1 deletions
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index e54023aac6..bbae45da3a 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -165,6 +165,9 @@ Common::Error GroovieEngine::go() {
checkCD();
+ // Game timer counter
+ uint16 tmr = 0;
+
// Initialize the CD
int cd_num = ConfMan.getInt("cdrom");
if (cd_num >= 0)
@@ -217,9 +220,17 @@ Common::Error GroovieEngine::go() {
}
if (_waitingForInput) {
- // Still waiting for input, just update the mouse and wait a bit more
+ // Still waiting for input, just update the mouse, game timer and then wait a bit more
_cursorMan->animate();
_system->updateScreen();
+ tmr++;
+ // Wait a little bit between increments. While mouse is moving, this triggers
+ // only negligably slower.
+ if (tmr > 4) {
+ _script.timerTick();
+ tmr = 0;
+ }
+
_system->delayMillis(50);
} else if (_graphicsMan->isFading()) {
// We're waiting for a fading to end, let the CPU rest
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 1105de0128..0799ea913d 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -108,6 +108,10 @@ void Script::setDebugger(Debugger *debugger) {
_debugger = debugger;
}
+void Script::timerTick() {
+ setVariable(0x103, _variables[0x103] + 1);
+}
+
bool Script::loadScript(Common::String filename) {
// Try to open the script file
Common::File scriptfile;
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index 0a14dac4c4..3df5674ae4 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -46,6 +46,8 @@ public:
void setDebugger(Debugger *debugger);
void setVariable(uint16 varnum, byte value);
+ void timerTick();
+
bool loadScript(Common::String scriptfile);
void directGameLoad(int slot);
void step();