2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-10-16 03:33:05 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2017-09-22 15:33:08 +00:00
|
|
|
* Allows multiple sources to not overwrite showHud command.
|
|
|
|
* Bitwise AND Logic (a single false in a mask will make it false).
|
2015-10-16 03:33:05 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2017-09-22 15:33:08 +00:00
|
|
|
* 0: Source ID <STRING> (default: "")
|
2024-08-22 17:13:54 +00:00
|
|
|
* 1: Show Hud Bool Array (10 to set, empty to remove) <ARRAY> (default: [])
|
|
|
|
* - [hud, info, radar, compass, direction, menu, group, cursors, panels, kills]
|
2015-11-25 17:07:56 +00:00
|
|
|
* - hud: Boolean - show scripted HUD (same as normal showHUD true/false)
|
|
|
|
* - info: Boolean - show vehicle + soldier info (hides weapon info from the HUD as well)
|
|
|
|
* - radar: Boolean - show vehicle radar
|
|
|
|
* - compass: Boolean - show vehicle compass
|
|
|
|
* - direction: Boolean - show tank direction indicator (not present in vanilla Arma 3)
|
|
|
|
* - menu: Boolean - show commanding menu (hides HC related menus)
|
|
|
|
* - group: Boolean - show group info bar (hides squad leader info bar)
|
|
|
|
* - cursors: Boolean - show HUD weapon cursors (connected with scripted HUD)
|
2018-07-21 23:03:00 +00:00
|
|
|
* - panels: Boolean - show vehicle panels / GPS
|
2024-08-22 17:13:54 +00:00
|
|
|
* - kills: Boolean - show "x killed by y" systemChat messages
|
|
|
|
* - showIcon3D: is unsupported as it has inverted logic
|
2015-10-16 03:33:05 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Resulting ShowHud Array <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
2018-07-21 23:03:00 +00:00
|
|
|
* ["hideHud", [false, true, true, true, true, true, true, false, true, true]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false
|
2015-11-25 17:07:56 +00:00
|
|
|
* [] call ace_common_fnc_showHud; //sets `showHud` and returns the result array used
|
2015-10-16 03:33:05 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {[-1]};
|
|
|
|
|
2018-07-21 23:03:00 +00:00
|
|
|
params [["_reason", "", [""]], ["_mask", [], [[]]]];
|
2015-10-16 03:33:05 +00:00
|
|
|
|
|
|
|
if (isArray (missionConfigFile >> "showHUD")) then {
|
|
|
|
//(showHud = 0;) is fine - the array is the problem
|
2016-10-02 10:55:31 +00:00
|
|
|
WARNING("showHUD[] in Description.ext breaks the showHud command");
|
2015-10-16 03:33:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_reason != "") then {
|
|
|
|
_reason = toLower _reason;
|
|
|
|
if (_mask isEqualTo []) then {
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_2("Removing",_reason,_mask);
|
2021-10-10 16:55:14 +00:00
|
|
|
GVAR(showHudHash) deleteAt _reason;
|
2015-10-16 03:33:05 +00:00
|
|
|
} else {
|
2018-07-21 23:03:00 +00:00
|
|
|
while {(count _mask) < 10} do { _mask pushBack true; };
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_2("Setting",_reason,_mask);
|
2021-10-10 16:55:14 +00:00
|
|
|
GVAR(showHudHash) set [_reason, _mask];
|
2015-10-16 03:33:05 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
private _masks = values GVAR(showHudHash);
|
2015-11-17 19:56:55 +00:00
|
|
|
private _resultMask = [];
|
2015-10-16 03:33:05 +00:00
|
|
|
|
2018-07-21 23:03:00 +00:00
|
|
|
for "_index" from 0 to 9 do {
|
2015-11-17 19:56:55 +00:00
|
|
|
private _set = true; //Default to true
|
2015-10-16 03:33:05 +00:00
|
|
|
{
|
2024-06-18 14:08:03 +00:00
|
|
|
if !(_x select _index) exitWith {
|
2015-10-16 03:33:05 +00:00
|
|
|
_set = false; //Any false will make it false
|
|
|
|
};
|
|
|
|
} forEach _masks;
|
|
|
|
_resultMask pushBack _set;
|
|
|
|
};
|
|
|
|
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_2("showHud",_resultMask,keys GVAR(showHudHash));
|
2015-10-16 03:33:05 +00:00
|
|
|
showHud _resultMask;
|
|
|
|
|
|
|
|
_resultMask
|