LAB: Simplify the crumb wait time code
This commit is contained in:
parent
f0e345a1a2
commit
e994c90d9b
4 changed files with 8 additions and 17 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue