fix privates in Map module

This commit is contained in:
jokoho48 2015-10-14 19:56:54 +02:00
parent 733c695c41
commit 2dcdd224bd
9 changed files with 36 additions and 35 deletions

View File

@ -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) = "";
};

View File

@ -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);

View File

@ -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
_actions

View File

@ -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]
[true, [_lightTint, _lightLevel] call _fnc_calcColor]

View File

@ -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 {

View File

@ -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;
GVAR(glow) = _light;

View File

@ -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
_flashlights

View File

@ -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
};
};

View File

@ -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;
};
};
};