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

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