Merge pull request #1362 from acemod/timeHasComeToday

Fix Time Calc
This commit is contained in:
PabstMirror 2015-05-22 14:32:56 -05:00
commit f785fcc0d4
2 changed files with 7 additions and 4 deletions

View File

@ -321,6 +321,8 @@ ACE_realTime = diag_tickTime;
ACE_virtualTime = diag_tickTime;
ACE_diagTime = diag_tickTime;
ACE_gameTime = time;
ACE_pausedTime = 0;
ACE_virtualPausedTime = 0;
PREP(timePFH);
[FUNC(timePFH), 0, []] call cba_fnc_addPerFrameHandler;

View File

@ -1,25 +1,26 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_lastRealTime", "_lastGameTime", "_delta"];
private["_lastTickTime", "_lastGameTime", "_delta"];
_lastRealTime = ACE_realTime;
_lastTickTime = ACE_diagTime;
_lastGameTime = ACE_gameTime;
ACE_gameTime = time;
ACE_diagTime = diag_tickTime;
_delta = ACE_diagTime - _lastRealTime;
_delta = ACE_diagTime - _lastTickTime;
if(ACE_gameTime <= _lastGameTime) then {
TRACE_1("paused",_delta);
ACE_paused = true;
// Game is paused or not running
ACE_pausedTime = ACE_pausedTime + _delta;
ACE_virtualPausedTime = ACE_pausedTime + (_delta * accTime);
} else {
TRACE_1("live",_delta);
ACE_paused = false;
// Time is updating
ACE_realTime = ACE_realTime + _delta;
ACE_virtualTime = ACE_virtualTime + (_delta * accTime);
ACE_time = ACE_virtualTime;
};