ACE3/addons/common/functions/fnc_timePFH.sqf

41 lines
896 B
Plaintext
Raw Normal View History

2015-09-19 22:55:58 +00:00
/*
2015-10-04 04:05:46 +00:00
* Author: jaynus
* PFEH to set all Ace Time Variables
2015-09-19 22:55:58 +00:00
*
* Arguments:
2015-10-04 04:05:46 +00:00
* None
2015-09-19 22:55:58 +00:00
*
* Return Value:
2015-10-04 04:05:46 +00:00
* None
2015-09-19 22:55:58 +00:00
*
2015-10-04 04:05:46 +00:00
* Public: No
2015-09-19 22:55:58 +00:00
*/
2015-05-10 05:53:20 +00:00
#include "script_component.hpp"
2015-10-04 04:05:46 +00:00
BEGIN_COUNTER(timePFH);
2015-05-10 05:53:20 +00:00
2015-11-17 16:43:07 +00:00
private _lastTickTime = ACE_diagTime;
private _lastGameTime = ACE_gameTime;
2015-05-10 05:53:20 +00:00
ACE_gameTime = time;
ACE_diagTime = diag_tickTime;
2015-05-10 05:53:20 +00:00
2015-11-17 16:43:07 +00:00
private _delta = ACE_diagTime - _lastTickTime;
2015-09-20 13:52:40 +00:00
2015-09-19 22:55:58 +00:00
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
};
2015-10-04 04:05:46 +00:00
END_COUNTER(timePFH);