2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2020-10-29 16:36:59 +00:00
|
|
|
/*
|
2024-01-07 18:26:10 +00:00
|
|
|
* Author: Freddo, Daniël H., johnb43
|
2020-10-29 16:36:59 +00:00
|
|
|
* When the confirm button is pressed.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Confirm button <CONTROL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_buttonOk] call ACE_markers_fnc_onButtonClickConfirm
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2024-01-07 18:26:10 +00:00
|
|
|
|
2020-10-29 16:36:59 +00:00
|
|
|
params ["_buttonOk"];
|
|
|
|
|
|
|
|
private _display = ctrlParent _buttonOk;
|
2024-01-07 18:06:35 +00:00
|
|
|
private _description = _display displayCtrl IDC_INSERT_MARKER;
|
2020-10-29 16:36:59 +00:00
|
|
|
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;
|
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
// Handle timestamp
|
2021-02-26 23:17:00 +00:00
|
|
|
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
|
2024-01-07 18:26:10 +00:00
|
|
|
// Determine marker timestamp based on time settings
|
2024-01-07 18:06:35 +00:00
|
|
|
private _time = switch (GVAR(timestampTimezone)) do {
|
|
|
|
case 1: {
|
2024-01-07 18:26:10 +00:00
|
|
|
systemTime select [3]
|
2024-01-07 18:06:35 +00:00
|
|
|
};
|
|
|
|
case 2: {
|
2024-01-07 18:26:10 +00:00
|
|
|
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec", "_msec"];
|
|
|
|
|
|
|
|
private _hourOffset = round GVAR(timestampUTCOffset);
|
2024-01-07 18:06:35 +00:00
|
|
|
_hour = _hour + _hourOffset;
|
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
// Add or subtract minutes offset based on the negative or positive timezone
|
|
|
|
if (GVAR(timestampUTCMinutesOffset) != 0) then {
|
|
|
|
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
|
2024-01-07 18:06:35 +00:00
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
// Add/remove extra hours from minutes
|
|
|
|
_hour = _hour + floor (_min / 60);
|
|
|
|
_min = (_min % 60 + 60) % 60; // ensure that minutes are between 0 and 59 (included)
|
|
|
|
};
|
|
|
|
|
|
|
|
[(_hour % 24 + 24) % 24, _min, _sec, _msec] // ensure that hours are between 0 and 23 (included)
|
2024-01-07 18:06:35 +00:00
|
|
|
};
|
|
|
|
default {
|
2024-01-07 18:26:10 +00:00
|
|
|
private _daytime = dayTime;
|
|
|
|
|
|
|
|
private _hour = floor _daytime;
|
|
|
|
private _min = floor ((_daytime - _hour) * 60);
|
|
|
|
private _sec = floor ((((_daytime - _hour) * 60) - _min) * 60);
|
|
|
|
private _msec = floor ((((((_daytime - _hour) * 60) - _min) * 60) - _sec) * 1000);
|
|
|
|
|
|
|
|
[_hour, _min, _sec, _msec]
|
2024-01-07 18:06:35 +00:00
|
|
|
};
|
|
|
|
};
|
2021-02-26 23:17:00 +00:00
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
_time params ["_hour", "_min", "_sec", "_msec"];
|
|
|
|
|
|
|
|
// Add timestamp suffix
|
2021-02-26 23:17:00 +00:00
|
|
|
private _periodPostfix = "";
|
2024-01-07 18:26:10 +00:00
|
|
|
|
2021-02-26 23:17:00 +00:00
|
|
|
if (GVAR(timestampHourFormat) == 12) then {
|
2024-01-07 18:26:10 +00:00
|
|
|
if (_hour == 0) exitWith {
|
|
|
|
_hour = _hour + 12;
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix = " am";
|
|
|
|
};
|
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
if (_hour == 12) exitWith {
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix = " pm";
|
|
|
|
};
|
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
if (_hour < 12) then {
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix = " am";
|
|
|
|
} else {
|
2024-01-07 18:26:10 +00:00
|
|
|
_hour = _hour - 12;
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix = " pm";
|
|
|
|
};
|
2020-10-29 16:36:59 +00:00
|
|
|
};
|
|
|
|
|
2024-01-07 18:26:10 +00:00
|
|
|
private _format = switch (GVAR(timestampFormat)) do {
|
|
|
|
case "HH": {"%1"};
|
|
|
|
case "HH:MM": {"%1:%2"};
|
|
|
|
case "HH:MM:SS": {"%1:%2:%3"};
|
|
|
|
case "HH:MM:SS:MM": { // milliseconds are displayed as 0 to 59
|
|
|
|
_msec = [_msec * 60 / 1000, 2] call CBA_fnc_formatNumber;
|
|
|
|
|
|
|
|
"%1:%2:%3:%4"
|
|
|
|
};
|
|
|
|
case "HH:MM:SS.mmm": { // milliseconds are displayed as 0 to 999
|
|
|
|
_msec = [_msec, 3] call CBA_fnc_formatNumber;
|
|
|
|
|
|
|
|
"%1:%2:%3.%4"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_time = format [
|
|
|
|
_format,
|
|
|
|
[_hour, 2] call CBA_fnc_formatNumber,
|
|
|
|
[_min, 2] call CBA_fnc_formatNumber,
|
|
|
|
[_sec, 2] call CBA_fnc_formatNumber,
|
|
|
|
_msec
|
|
|
|
];
|
|
|
|
|
2021-02-26 23:17:00 +00:00
|
|
|
_description ctrlSetText format [
|
|
|
|
"%1 [%2%3]",
|
2020-10-29 16:36:59 +00:00
|
|
|
ctrlText _description,
|
2024-01-07 18:26:10 +00:00
|
|
|
_time,
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix
|
2020-10-29 16:36:59 +00:00
|
|
|
];
|
|
|
|
};
|