diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/engine.cpp | 9 | ||||
-rw-r--r-- | engines/lab/interface.cpp | 1 | ||||
-rw-r--r-- | engines/lab/intro.cpp | 9 | ||||
-rw-r--r-- | engines/lab/lab.h | 12 | ||||
-rw-r--r-- | engines/lab/labmusic.cpp | 1 | ||||
-rw-r--r-- | engines/lab/mouse.cpp | 1 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 9 | ||||
-rw-r--r-- | engines/lab/readdiff.cpp | 7 | ||||
-rw-r--r-- | engines/lab/special.cpp | 3 | ||||
-rw-r--r-- | engines/lab/timing.cpp | 15 | ||||
-rw-r--r-- | engines/lab/timing.h | 47 |
11 files changed, 35 insertions, 79 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c93509a481..c2ab4673c8 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -33,7 +33,6 @@ #include "lab/labfun.h" #include "lab/diff.h" #include "lab/vga.h" -#include "lab/timing.h" #include "lab/text.h" #include "lab/parsefun.h" #include "lab/interface.h" @@ -829,7 +828,7 @@ from_crumbs: FollowCrumbsFast = (Code == 'r' || Code == 'R'); IsCrumbTurning = false; IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + g_lab->getTime(&CrumbSecs, &CrumbMicros); if (Alternate) { eatMessages(); @@ -1158,7 +1157,7 @@ from_crumbs: FollowCrumbsFast = false; IsCrumbTurning = false; IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + g_lab->getTime(&CrumbSecs, &CrumbMicros); eatMessages(); Alternate = false; @@ -1417,7 +1416,7 @@ int followCrumbs() { uint32 Secs; uint32 Micros; - timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); + g_lab->timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); if (Secs != 0 || Micros != 0) return 0; @@ -1460,7 +1459,7 @@ int followCrumbs() { IsCrumbTurning = (MoveDir != VKEY_UPARROW); IsCrumbWaiting = true; - addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); + g_lab->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); } return MoveDir; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index e2f7401114..8d05e4174d 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -31,7 +31,6 @@ #include "lab/labfun.h" #include "lab/stddefines.h" #include "lab/interface.h" -#include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" #include "common/util.h" diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 2ffddf7dc5..16ed20b88a 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/resource.h" -#include "lab/timing.h" #include "lab/diff.h" #include "lab/text.h" #include "lab/interface.h" @@ -142,7 +141,7 @@ static void doPictText(const char *Filename, bool isscreen) { return; } - getTime(&lastsecs, &lastmicros); + g_lab->getTime(&lastsecs, &lastmicros); } Msg = getMsg(); @@ -151,8 +150,8 @@ static void doPictText(const char *Filename, bool isscreen) { g_music->updateMusic(); diffNextFrame(); - getTime(&secs, µs); - anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); + g_lab->getTime(&secs, µs); + g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); if (secs > timedelay) { if (End) { @@ -258,7 +257,7 @@ static void NReadPict(const char *Filename, bool PlayOnce) { /*****************************************************************************/ void introSequence() { uint16 counter, counter1; - + uint16 Palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index c1bf4337b9..989def2e1c 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -45,6 +45,8 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; +#define ONESECOND 1000 + class LabEngine : public Engine { public: LabEngine(OSystem *syst, const ADGameDescription *gameDesc); @@ -64,8 +66,18 @@ public: LargeSet *_conditions, *_roomsFound; + // timing.cpp + void getTime(uint32 *secs, uint32 *micros); + void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); + void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); + void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); + void waitForTime(uint32 sec, uint32 micros); + private: uint32 _extraGameFeatures; + + // timing.cpp + void microDelay(uint32 secs, uint32 micros); }; extern LabEngine *g_lab; diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index e169c968fe..50ba48dbb8 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" -#include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" #include "lab/lab.h" diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 553b6654a2..c45ab5cd60 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -31,7 +31,6 @@ #include "lab/mouse.h" #include "lab/vga.h" #include "lab/stddefines.h" -#include "lab/timing.h" #include "lab/interface.h" namespace Lab { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0ef844cfae..d48a4ca807 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -36,7 +36,6 @@ #include "lab/parsetypes.h" #include "lab/parsefun.h" #include "lab/resource.h" -#include "lab/timing.h" #include "lab/diff.h" #include "lab/vga.h" #include "lab/interface.h" @@ -63,7 +62,7 @@ extern CloseDataPtr CPtr; uint16 getRandom(uint16 max) { uint32 secs, micros; - getTime(&secs, µs); + g_lab->getTime(&secs, µs); return ((micros + secs) % max); } @@ -483,14 +482,14 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case WAITSECS: - addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); + g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); WSDL_UpdateScreen(); while (1) { g_music->updateMusic(); diffNextFrame(); - getTime(&CurSecs, &CurMicros); + g_lab->getTime(&CurSecs, &CurMicros); if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && (CurMicros >= StartMicros))) @@ -615,7 +614,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo if (LCPtr) { RuleList *rules = Rooms[RoomNum].rules; - + if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); rules = Rooms[roomNum].rules; diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 15b55e52bb..727a3394a2 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -28,8 +28,7 @@ * */ -#include "lab/stddefines.h" -#include "lab/timing.h" +#include "lab/lab.h" #include "lab/diff.h" #include "lab/labfun.h" #include "lab/vga.h" @@ -137,8 +136,8 @@ void diffNextFrame() { if (!IsBM) { if (headerdata.fps) { - waitForTime(WaitSec, WaitMicros); - addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + g_lab->waitForTime(WaitSec, WaitMicros); + g_lab->addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); } if (IsPal && !nopalchange) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 978ce11c98..377f8dbece 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -41,7 +41,6 @@ #include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" -#include "lab/timing.h" #include "lab/stddefines.h" #include "lab/parsetypes.h" #include "lab/resource.h" @@ -855,7 +854,7 @@ bool saveRestoreGame() { } WSDL_UpdateScreen(); - + return isOK; } diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index a9f593e668..ca767550dc 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -28,8 +28,7 @@ * */ -#include "lab/stddefines.h" -#include "lab/timing.h" +#include "lab/lab.h" #include "lab/vga.h" namespace Lab { @@ -37,7 +36,7 @@ namespace Lab { /*****************************************************************************/ /* Waits for for Secs seconds and Micros microseconds to pass. */ /*****************************************************************************/ -void microDelay(uint32 secs, uint32 micros) { +void LabEngine::microDelay(uint32 secs, uint32 micros) { uint32 waitSecs, waitMicros; addCurTime(secs, micros, &waitSecs, &waitMicros); @@ -55,7 +54,7 @@ void microDelay(uint32 secs, uint32 micros) { /*****************************************************************************/ /* Gets the current system time. */ /*****************************************************************************/ -void getTime(uint32 *secs, uint32 *micros) { +void LabEngine::getTime(uint32 *secs, uint32 *micros) { uint32 t = g_system->getMillis(); *secs = t / 1000; @@ -65,7 +64,7 @@ void getTime(uint32 *secs, uint32 *micros) { /*****************************************************************************/ /* Adds seconds and microseconds to current time to get a new time. */ /*****************************************************************************/ -void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { +void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { getTime(timeSec, timeMicros); (*timeSec) += sec; @@ -81,7 +80,7 @@ void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) /* Finds the difference between time1 and time2. If time1 is later than */ /* time2, returns 0. */ /*****************************************************************************/ -void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { +void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { *diffSecs = 0; *diffMicros = 0; @@ -103,7 +102,7 @@ void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint3 /* Finds the difference between the current time, and a future time. Returns */ /* 0 if the future time is actually before the current time. */ /*****************************************************************************/ -void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { +void LabEngine::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { uint32 curSec, curMicros; getTime(&curSec, &curMicros); anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); @@ -112,7 +111,7 @@ void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { /*****************************************************************************/ /* Waits for a specified time to occur. */ /*****************************************************************************/ -void waitForTime(uint32 sec, uint32 micros) { +void LabEngine::waitForTime(uint32 sec, uint32 micros) { uint32 curSec, curMicros; getTime(&curSec, &curMicros); diff --git a/engines/lab/timing.h b/engines/lab/timing.h deleted file mode 100644 index adbaf950d8..0000000000 --- a/engines/lab/timing.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_TIMING_H -#define LAB_TIMING_H - -namespace Lab { - -#define ONESECOND 1000 - -void microDelay(uint32 secs, uint32 micros); -void getTime(uint32 *secs, uint32 *micros); -void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); -void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); -void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); -void waitForTime(uint32 sec, uint32 micros); - -} // End of namespace Lab - -#endif /* LAB_TIMING_H */ |