aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-13 20:27:34 +0200
committerWillem Jan Palenstijn2015-12-23 21:34:03 +0100
commite994c90d9bb68f8be6de5238f1e8192b4d5424f6 (patch)
tree306b166060a8f622907e7daeef2e6ab5d140364a /engines/lab
parentf0e345a1a2d3963974888007d1b86221ba2ee64d (diff)
downloadscummvm-rg350-e994c90d9bb68f8be6de5238f1e8192b4d5424f6.tar.gz
scummvm-rg350-e994c90d9bb68f8be6de5238f1e8192b4d5424f6.tar.bz2
scummvm-rg350-e994c90d9bb68f8be6de5238f1e8192b4d5424f6.zip
LAB: Simplify the crumb wait time code
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/anim.cpp2
-rw-r--r--engines/lab/engine.cpp16
-rw-r--r--engines/lab/lab.cpp3
-rw-r--r--engines/lab/lab.h4
4 files changed, 8 insertions, 17 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 842d3d6432..04da59e1b7 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -348,7 +348,7 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) {
_rawDiffBM._planes[_header] = NULL;
if (_headerdata._fps)
- _delayMicros = ONESECOND / _headerdata._fps;
+ _delayMicros = 1000 / _headerdata._fps;
if (_playOnce) {
while (_header != 65535)
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index ed08d85665..3d71d94b8b 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -630,9 +630,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo
_followCrumbsFast = (codeLower == 'r');
_isCrumbTurning = false;
_isCrumbWaiting = false;
- uint32 t = g_system->getMillis();
- _crumbSecs = t / 1000;
- _crumbMicros = t % 1000;
+ _crumbTimestamp = g_system->getMillis();
if (_alternate) {
eatMessages();
@@ -948,9 +946,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo
_followCrumbsFast = false;
_isCrumbTurning = false;
_isCrumbWaiting = false;
- uint32 t = g_system->getMillis();
- _crumbSecs = t / 1000;
- _crumbMicros = t % 1000;
+ _crumbTimestamp = g_system->getMillis();
eatMessages();
_alternate = false;
@@ -1140,7 +1136,7 @@ int LabEngine::followCrumbs() {
};
if (_isCrumbWaiting) {
- if (g_system->getMillis() <= _crumbSecs * 1000 + _crumbMicros)
+ if (g_system->getMillis() <= _crumbTimestamp)
return 0;
_isCrumbWaiting = false;
@@ -1178,13 +1174,11 @@ int LabEngine::followCrumbs() {
_droppingCrumbs = false;
_followingCrumbs = false;
} else {
- int theDelay = (_followCrumbsFast ? ONESECOND / 4 : ONESECOND);
-
_isCrumbTurning = (moveDir != VKEY_UPARROW);
_isCrumbWaiting = true;
- _crumbSecs = (theDelay + g_system->getMillis()) / 1000;
- _crumbMicros = (theDelay + g_system->getMillis()) % 1000;
+ int theDelay = (_followCrumbsFast ? 1000 / 4 : 1000);
+ _crumbTimestamp = theDelay + g_system->getMillis();
}
return moveDir;
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 06ab61d3f7..1b62147463 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -77,8 +77,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_manyRooms = 0;
_direction = 0;
_highestCondition = 0;
- _crumbSecs = 0;
- _crumbMicros = 0;
+ _crumbTimestamp = 0;
_maxRooms = 0;
_event = nullptr;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 770e1ea4d2..0f6fbacb07 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -69,8 +69,6 @@ enum GameFeatures {
GF_WINDOWS_TRIAL = 1 << 1
};
-#define ONESECOND 1000
-
typedef Common::List<Button *> ButtonList;
struct CrumbData {
@@ -148,7 +146,7 @@ public:
uint16 _numCrumbs;
uint16 _numInv;
- uint32 _crumbSecs, _crumbMicros;
+ uint32 _crumbTimestamp;
const char *_curFileName;