Skip to content

Commit

Permalink
Common - Update showHud function for new elements (#6459)
Browse files Browse the repository at this point in the history
Showhud command has been updated to 10 elements
  • Loading branch information
PabstMirror committed Jul 21, 2018
1 parent 8a37b60 commit 2203cb7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_onArsenalClose.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ GVAR(statsInfo) = nil;
GVAR(center) = nil;
GVAR(centerNotPlayer) = nil;

showHUD true;
[QUOTE(ADDON), []] call EFUNC(common,showHud);
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_onArsenalOpen.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ showCommandingMenu "";

GVAR(cameraView) = cameraView;
GVAR(center) switchCamera "internal";
showHUD false;
[QUOTE(ADDON), [false, true, true, true, true, true, true, false, true, true]] call EFUNC(common,showHud);

private _mouseAreaCtrl = _display displayCtrl IDC_mouseArea;
ctrlSetFocus _mouseAreaCtrl;
Expand Down
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_handlePlayerChanged.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params ["_newUnit","_oldUnit"];
//set showHUD based on new unit status:
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",_newUnit);
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
["captive", [false, false, false, false, false, false, false, false, false, true]] call EFUNC(common,showHud);
} else {
TRACE_1("Player Change (showHUD true)",_newUnit);
["captive", []] call EFUNC(common,showHud); //same as showHud true;
Expand Down
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_handleZeusDisplayChanged.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if ((ACE_player getVariable [QGVAR(isHandcuffed), false]) || {ACE_player getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",ACE_player);
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
["captive", [false, false, false, false, false, false, false, false, false, true]] call EFUNC(common,showHud);
} else {
TRACE_1("Player Change (showHUD true)",ACE_player);
["captive", []] call EFUNC(common,showHud); //same as showHud true;
Expand Down
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_setHandcuffed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (_state) then {
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];

if (_unit == ACE_player) then {
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
["captive", [false, false, false, false, false, false, false, false, false, true]] call EFUNC(common,showHud);
};

// fix anim on mission start (should work on dedicated servers)
Expand Down
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_setSurrendered.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (_state) then {
[_unit, "setCaptive", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set);

if (_unit == ACE_player) then {
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
["captive", [false, false, false, false, false, false, false, false, false, true]] call EFUNC(common,showHud);
};

[_unit] call EFUNC(common,fixLoweredRifleAnimation);
Expand Down
13 changes: 8 additions & 5 deletions addons/common/functions/fnc_showHud.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
* - 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)
* - panels: Boolean - show vehicle panels / GPS
* - ???: Boolean - Possibly related to changelog entry `Added: A new showKillConfirmations parameter for the showHud command`
*
* Return Value:
* Resulting ShowHud Array <ARRAY>
*
* Example:
* ["hideHud", [false, true, true, true, true, true, true, false]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false
* ["hideHud", [false, true, true, true, true, true, true, false, true, true]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false
* [] call ace_common_fnc_showHud; //sets `showHud` and returns the result array used
*
* Public: Yes
Expand All @@ -29,7 +31,7 @@

if (!hasInterface) exitWith {[-1]};

params [["_reason", "", [""]], ["_mask", [], [[]], [0,8]]];
params [["_reason", "", [""]], ["_mask", [], [[]]]];

if (isArray (missionConfigFile >> "showHUD")) then {
//(showHud = 0;) is fine - the array is the problem
Expand All @@ -39,18 +41,19 @@ if (isArray (missionConfigFile >> "showHUD")) then {
if (_reason != "") then {
_reason = toLower _reason;
if (_mask isEqualTo []) then {
TRACE_2("Setting", _reason, _mask);
TRACE_2("Removing", _reason, _mask);
[GVAR(showHudHash), _reason] call CBA_fnc_hashRem;
} else {
TRACE_2("Removing", _reason, _mask);
while {(count _mask) < 10} do { _mask pushBack true; };
TRACE_2("Setting", _reason, _mask);
[GVAR(showHudHash), _reason, _mask] call CBA_fnc_hashSet;
};
};

GVAR(showHudHash) params ["", "_reasons", "_masks"];
private _resultMask = [];

for "_index" from 0 to 7 do {
for "_index" from 0 to 9 do {
private _set = true; //Default to true
{
if (!(_x select _index)) exitWith {
Expand Down
2 changes: 2 additions & 0 deletions addons/ui/functions/fnc_setElements.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ if (isArray (missionConfigFile >> "showHUD")) exitWith {
true,
GVAR(commandMenu),
GVAR(groupBar),
true,
true,
true
]] call EFUNC(common,showHud);

0 comments on commit 2203cb7

Please sign in to comment.