Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===============================================================================
- // Time
- // by grim001
- //===============================================================================
- //
- // fixed GetTime(int timeType)
- // Returns the amount of the specified time type that has elapsed.
- // The timeType parameter may be either c_timeGame or c_timeReal.
- //
- // fixed GetTickDuration(int timeType)
- // Returns the tick duration of the current game speed. The timeType
- // parameter may be either c_timeGame or c_timeReal.
- //
- //===============================================================================
- fixed [2] Time_CurrentTime;
- fixed [5] Time_TickDuration;
- fixed GetTime(int timeType)
- {
- return Time_CurrentTime[timeType];
- }
- fixed GetTickDuration(int timeType)
- {
- if (timeType == c_timeGame) { return Time_TickDuration[c_gameSpeedNormal]; }
- return Time_TickDuration[GameGetSpeedValue()];
- }
- bool Time_Thread (bool testConditions, bool runActions)
- {
- Time_TickDuration[c_gameSpeedSlower] = 1.0 / 19.2;
- Time_TickDuration[c_gameSpeedSlow] = 1.0 / 25.6;
- Time_TickDuration[c_gameSpeedNormal] = 1.0 / 32.0;
- Time_TickDuration[c_gameSpeedFast] = 1.0 / 38.4;
- Time_TickDuration[c_gameSpeedFaster] = 1.0 / 44.8;
- while (true)
- {
- Wait(0, 0);
- Time_CurrentTime[c_timeGame] += Time_TickDuration[c_gameSpeedNormal];
- Time_CurrentTime[c_timeReal] += Time_TickDuration[GameGetSpeedValue()];
- }
- return true;
- }
- void Time_Init ()
- {
- TriggerExecute(TriggerCreate("Time_Thread"),false,false);
- }
Advertisement
Add Comment
Please, Sign In to add comment