ACE3/addons/common/functions/fnc_timePFH.sqf

27 lines
755 B
Plaintext
Raw Normal View History

2015-05-10 05:53:20 +00:00
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
2015-05-22 19:29:56 +00:00
private["_lastTickTime", "_lastGameTime", "_delta"];
2015-05-10 05:53:20 +00:00
2015-05-22 19:29:56 +00:00
_lastTickTime = ACE_diagTime;
2015-05-10 05:53:20 +00:00
_lastGameTime = ACE_gameTime;
ACE_gameTime = time;
ACE_diagTime = diag_tickTime;
2015-05-10 05:53:20 +00:00
2015-05-22 19:29:56 +00:00
_delta = ACE_diagTime - _lastTickTime;
if(ACE_gameTime <= _lastGameTime) then {
2015-05-22 19:29:56 +00:00
TRACE_1("paused",_delta);
2015-05-10 06:09:33 +00:00
ACE_paused = true;
2015-05-10 05:53:20 +00:00
// Game is paused or not running
ACE_pausedTime = ACE_pausedTime + _delta;
ACE_virtualPausedTime = ACE_pausedTime + (_delta * accTime);
} else {
2015-05-22 19:29:56 +00:00
TRACE_1("live",_delta);
2015-05-10 06:09:33 +00:00
ACE_paused = false;
2015-05-10 05:53:20 +00:00
// Time is updating
ACE_realTime = ACE_realTime + _delta;
2015-05-10 06:09:33 +00:00
ACE_virtualTime = ACE_virtualTime + (_delta * accTime);
ACE_time = ACE_virtualTime;
2015-05-10 05:53:20 +00:00
};