Skip to content

Commit

Permalink
Fix disabling enemy blips would also disable player map icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorAU committed Apr 3, 2020
1 parent 8ebc555 commit 2b93586
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions mission/functions/ui/fn_miniMap.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#define VAR_UNITS_INFO FUNC_SUBVAR(units_info)
#define VAR_UPDATE_TICK FUNC_SUBVAR(update_tick)
#define VAR_UPDATE_BLIPS FUNC_SUBVAR(update_blips_enabled)
#define VAL_UPDATE_FREQ 8
#define VAL_ICON_SIZE 16

Expand All @@ -30,6 +31,7 @@ switch _mode do {

VAR_UNITS_INFO = [];
VAR_UPDATE_TICK = 0;
VAR_UPDATE_BLIPS = (["get","EnemyMapBlips"] call GG_system_fnc_params) isEqualTo 1;

USE_DISPLAY(THIS_DISPLAY);
USE_CTRL(_ctrlTitle,1);
Expand All @@ -38,11 +40,8 @@ switch _mode do {
_ctrlTitle ctrlSetText format["Location: %1",missionNameSpace getVariable ["GG_s_votedMapName",""]];
["modifyZoom"] call THIS_FUNC;

private _blipsEnabled = ["get","EnemyMapBlips"] call GG_system_fnc_params;
if (_blipsEnabled isEqualTo 1) then {
_ctrlMap ctrlAddEventHandler ["Draw",{["drawBlips",_this] call THIS_FUNC}];
(findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",{["drawBlips",_this] call THIS_FUNC}];
};
_ctrlMap ctrlAddEventHandler ["Draw",{["drawBlips",_this] call THIS_FUNC}];
(findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",{["drawBlips",_this] call THIS_FUNC}];
};
};
case "modifyZoom":{
Expand All @@ -63,17 +62,20 @@ switch _mode do {

if !COMBAT_ZONE_EXISTS exitWith {};

if (diag_tickTime > VAR_UPDATE_TICK) then {
VAR_UPDATE_TICK = diag_tickTime + VAL_UPDATE_FREQ;
VAR_UNITS_INFO = allUnits select {
alive _x && {_x != player && {_x distance (markerPos "respawn") > 50}}
} apply {getPos _x};
};
// Enable/disable enemy blips without disabling the drawn player icon
if VAR_UPDATE_BLIPS then {
if (diag_tickTime > VAR_UPDATE_TICK) then {
VAR_UPDATE_TICK = diag_tickTime + VAL_UPDATE_FREQ;
VAR_UNITS_INFO = allUnits select {
alive _x && {_x != player && {_x distance (markerPos "respawn") > 50}}
} apply {getPos _x};
};

private _size = VAL_ICON_SIZE*(1 min((VAR_UPDATE_TICK-3)-diag_tickTime)max 0);
{
_ctrlMap drawIcon ["\a3\ui_f\data\map\markers\military\dot_ca.paa",[1,0,0,1],_x,_size,_size,0];
} foreach VAR_UNITS_INFO;
private _size = VAL_ICON_SIZE*(1 min((VAR_UPDATE_TICK-3)-diag_tickTime)max 0);
{
_ctrlMap drawIcon ["\a3\ui_f\data\map\markers\military\dot_ca.paa",[1,0,0,1],_x,_size,_size,0];
} foreach VAR_UNITS_INFO;
};

_ctrlMap drawIcon ["\A3\ui_f\data\map\vehicleicons\iconman_ca.paa",[0.8,1,0.8,1],getPos player,24,24,getDirVisual player];
};
Expand Down

0 comments on commit 2b93586

Please sign in to comment.