diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index 02800c2540..41f7155bd0 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -68,7 +68,7 @@ call FUNC(determineZoom); GVAR(glow) = objNull; ["playerInventoryChanged", { - _flashlights = [ACE_player] call FUNC(getUnitFlashlights); + local _flashlights = [ACE_player] call FUNC(getUnitFlashlights); if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then { GVAR(flashlightInUse) = ""; }; diff --git a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf index 71e4e8c818..9654f94701 100644 --- a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf +++ b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" // BEGIN_COUNTER(blueForceTrackingUpdate); -private ["_groupsToDrawMarkers", "_playerSide", "_anyPlayers", "_markerType", "_colour", "_marker"]; +private ["_groupsToDrawMarkers", "_playerSide", "_anyPlayers", "_colour", "_marker"]; // Delete last set of markers (always) { @@ -28,12 +28,12 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then { }; { - _markerType = [_x] call EFUNC(common,getMarkerType); + local _markerType = [_x] call EFUNC(common,getMarkerType); - _colour = format ["Color%1", side _x]; + local _colour = format ["Color%1", side _x]; - _marker = createMarkerLocal [format ["ACE_BFT_%1", _forEachIndex], [(getPos leader _x) select 0, (getPos leader _x) select 1]]; + local _marker = createMarkerLocal [format ["ACE_BFT_%1", _forEachIndex], [(getPos leader _x) select 0, (getPos leader _x) select 1]]; _marker setMarkerTypeLocal _markerType; _marker setMarkerColorLocal _colour; _marker setMarkerTextLocal (groupID _x); diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf index 0d081bb57c..90f446f63d 100644 --- a/addons/map/functions/fnc_compileFlashlightMenu.sqf +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -25,12 +25,14 @@ _flashlights = [_player] call FUNC(getUnitFlashlights); //add all carried flashlight menus and on/off submenu actions { - _displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName"); - _icon = getText (configFile >> "CfgWeapons" >> _x >> "picture"); + private ["_cfg", "_displayName"," _icon", "_children", "_parentAction"]; + _cfg = (configFile >> "CfgWeapons" >> _x); + _displayName = getText (_cfg >> "displayName"); + _icon = getText (_cfg >> "picture"); _children = { + private ["_onAction", "_offAction"]; params ["_vehicle", "_player", "_flashlight"]; - _actions = []; _onAction = [ (_flashlight + "_On"), @@ -52,14 +54,11 @@ _flashlights = [_player] call FUNC(getUnitFlashlights); _flashlight ] call EFUNC(interact_menu,createAction); - _actions pushBack [_onAction, [], _player]; - _actions pushBack [_offAction, [], _player]; - - _actions + [[_onAction, [], _player], [_offAction, [], _player]] }; _parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction); _actions pushBack [_parentAction, [], _player]; } forEach _flashlights; -_actions \ No newline at end of file +_actions diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 8204b4b7f8..f91dbeec05 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -12,14 +12,13 @@ * Public: No */ #include "script_component.hpp" +params ["_unit"]; -EXPLODE_1_PVT(_this,_unit); - -private ["_isEnclosed","_nearObjects","_light","_ll","_flashlight", "_flareTint", "_lightTint", "_l"]; +private ["_fnc_blendColor", "_lightTint", "_fnc_calcColor", "_l", "_lightLevel", "_vehicle", "_isEnclosed", "_nearObjects", "_light", "_ll", "_flashlight", "_flareTint"]; // Blend two colors _fnc_blendColor = { - EXPLODE_3_PVT(_this,_c1,_c2,_alpha); + params ["_c1", "_c2", "_alpha"]; [(_c1 select 0) * (1 - _alpha) + (_c2 select 0) * _alpha, (_c1 select 1) * (1 - _alpha) + (_c2 select 1) * _alpha, (_c1 select 2) * (1 - _alpha) + (_c2 select 2) * _alpha, @@ -27,16 +26,17 @@ _fnc_blendColor = { }; // Ambient light tint depending on ACE_time of day -_lightTint = switch (true) do { - case (sunOrMoon == 1.0) : { [0.5,0.5,0.5,1] }; - case (sunOrMoon > 0.80) : {[[1.0 - overcast,0.2,0,1], [1,1,1,1], (sunOrMoon - 0.8)/0.2] call _fnc_blendColor}; - case (sunOrMoon > 0.50) : {[[0,0,0.1,1], [1.0 - overcast,0.2,0,1], (sunOrMoon - 0.5)/0.3] call _fnc_blendColor}; - case (sunOrMoon <= 0.5) : { [0,0,0.1,1] }; +_lightTint = call { + if (sunOrMoon == 1.0) exitWith { [0.5,0.5,0.5,1] }; + if (sunOrMoon > 0.80) exitWith { [[1.0 - overcast,0.2,0,1], [1,1,1,1], (sunOrMoon - 0.8)/0.2] call _fnc_blendColor }; + if (sunOrMoon > 0.50) exitWith { [[0,0,0.1,1], [1.0 - overcast,0.2,0,1], (sunOrMoon - 0.5)/0.3] call _fnc_blendColor }; + if (sunOrMoon <= 0.5) exitWith { [0,0,0.1,1] }; + [0,0,0,0] }; // Calculates overlay color from tint and light level _fnc_calcColor = { - EXPLODE_2_PVT(_this,_c1,_lightLevel); + params ["_c1", "_lightLevel"]; if (_lightLevel < 0.5) then { _l = _lightLevel / 0.5; @@ -68,7 +68,6 @@ if (_lightLevel > 0.95) exitWith { [false, [0.5,0.5,0.5,0]] }; -private "_vehicle"; _vehicle = vehicle _unit; // Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination) @@ -124,4 +123,4 @@ if (_lightLevel > 0.95) exitWith { }; // Calculate resulting map color -[true, [_lightTint, _lightLevel] call _fnc_calcColor] \ No newline at end of file +[true, [_lightTint, _lightLevel] call _fnc_calcColor] diff --git a/addons/map/functions/fnc_determineZoom.sqf b/addons/map/functions/fnc_determineZoom.sqf index 345fc68583..bdfc9a866b 100644 --- a/addons/map/functions/fnc_determineZoom.sqf +++ b/addons/map/functions/fnc_determineZoom.sqf @@ -13,7 +13,7 @@ #include "script_component.hpp" private ["_grids", "_fourSize", "_sixSize", "_continue", "_size", "_i"]; -_grids = configFile >> "CfgWorlds" >> worldName >> "Grid"; +_grids = (configFile >> "CfgWorlds" >> worldName >> "Grid"); _fourSize = -1; _sixSize = -1; for "_i" from 1 to 10 do { diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf index 5e72a6c183..011489f321 100644 --- a/addons/map/functions/fnc_flashlightGlow.sqf +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -16,15 +16,16 @@ #include "script_component.hpp" +private ["_light", "_color", "_class"]; params ["_flashlight"]; _light = GVAR(glow); if (!isNull _light) then {deleteVehicle _light}; if (_flashlight != "") then { - _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); - if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"}; - _class = format["ACE_FlashlightProxy_%1", _colour]; + _color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"}; + _class = format["ACE_FlashlightProxy_%1", _color]; _light = _class createVehicle [0,0,0]; _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; @@ -32,4 +33,4 @@ if (_flashlight != "") then { _light = objNull; }; -GVAR(glow) = _light; \ No newline at end of file +GVAR(glow) = _light; diff --git a/addons/map/functions/fnc_getUnitFlashlights.sqf b/addons/map/functions/fnc_getUnitFlashlights.sqf index 8fb8066374..c4cdf2f91f 100644 --- a/addons/map/functions/fnc_getUnitFlashlights.sqf +++ b/addons/map/functions/fnc_getUnitFlashlights.sqf @@ -18,7 +18,7 @@ params ["_unit"]; -_flashlights = []; +local _flashlights = []; { if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then { @@ -26,4 +26,4 @@ _flashlights = []; }; } forEach (items _unit); -_flashlights \ No newline at end of file +_flashlights diff --git a/addons/map/functions/fnc_simulateMapLight.sqf b/addons/map/functions/fnc_simulateMapLight.sqf index ec08f14d4c..84fcc32773 100644 --- a/addons/map/functions/fnc_simulateMapLight.sqf +++ b/addons/map/functions/fnc_simulateMapLight.sqf @@ -16,6 +16,7 @@ #include "script_component.hpp" +private ["_hmd", "_flashlight", "_screenSize", "_realViewPortY", "_realViewPortX", "_fillTex", "_colourAlpha", "_shadeAlpha", "_colourList", "_maxColour"]; params ["_mapCtrl", "_mapScale", "_mapCentre", "_lightLevel"]; _hmd = hmd ACE_player; @@ -50,6 +51,7 @@ if (_flashlight == "") then { //ambient shade fill _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; } else { + private ["_mousePos", "_colour", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"]; //mouse pos _mousePos = GVAR(mousePos); @@ -86,4 +88,4 @@ if (_flashlight == "") then { _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) + _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //right _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) - _offsetYDown], _screenSize * 4, _screenSize, 0, "", 0]; //down _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) + _offsetYUp], _screenSize * 4, _screenSize * 4, 0, "", 0]; //up -}; \ No newline at end of file +}; diff --git a/addons/map/functions/fnc_updateMapEffects.sqf b/addons/map/functions/fnc_updateMapEffects.sqf index 72f5d0cec1..0e36a6fdd6 100644 --- a/addons/map/functions/fnc_updateMapEffects.sqf +++ b/addons/map/functions/fnc_updateMapEffects.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" - +private ["_mapCtrl", "_mapScale", "_mapCentre", "_light"]; _mapCtrl = findDisplay 12 displayCtrl 51; _mapScale = ctrlMapScale _mapCtrl; _mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; @@ -73,4 +73,4 @@ if (GVAR(mapLimitZoom)) then { _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre]; ctrlMapAnimCommit _mapCtrl; }; -}; \ No newline at end of file +};