mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#1171 - Safe get variables if settings not defined
This commit is contained in:
parent
03130ab3c9
commit
2158f467f4
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_textColor", "_textSize"];
|
private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_textColor", "_textSize", "_colorShadowMax", "_colorShadowMin", "_colorTextMax", "_colorTextMin", "_shadowSetting"];
|
||||||
|
|
||||||
//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text
|
//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text
|
||||||
_mixColor = {
|
_mixColor = {
|
||||||
@ -30,9 +30,16 @@ _mixColor = {
|
|||||||
_return
|
_return
|
||||||
};
|
};
|
||||||
|
|
||||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), 1] call _mixColor;
|
_colorTextMin = missionNamespace getVariable [QGVAR(colorTextMin), [1,1,1,0.25]];
|
||||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), 1] call _mixColor;
|
_colorTextMax = missionNamespace getVariable [QGVAR(colorTextMax), [1,1,1,1]];
|
||||||
_textSize = switch (GVAR(textSize)) do {
|
_colorShadowMin = missionNamespace getVariable [QGVAR(colorShadowMin), [0,0,0,0.25]];
|
||||||
|
_colorShadowMax = missionNamespace getVariable [QGVAR(colorShadowMax), [0,0,0,1]];
|
||||||
|
_shadowSetting = missionNamespace getVariable [QGVAR(shadowSetting), 2];
|
||||||
|
_textSize = missionNamespace getVariable [QGVAR(textSize), 2];
|
||||||
|
|
||||||
|
_textColor = [_colorTextMin, _colorTextMax, 1] call _mixColor;
|
||||||
|
_shadowColor = [_colorShadowMin, _colorShadowMax, 1] call _mixColor;
|
||||||
|
_textSize = switch (_textSize) do {
|
||||||
case (0): {0.4};
|
case (0): {0.4};
|
||||||
case (1): {0.6};
|
case (1): {0.6};
|
||||||
case (2): {0.8};
|
case (2): {0.8};
|
||||||
@ -40,20 +47,20 @@ _textSize = switch (GVAR(textSize)) do {
|
|||||||
case (4): {1.2};
|
case (4): {1.2};
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(colorSelectedSettings) = format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, GVAR(shadowSetting), _shadowColor];
|
GVAR(colorSelectedSettings) = format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, _shadowSetting, _shadowColor];
|
||||||
|
|
||||||
GVAR(textSettingsMatrix) = [];
|
GVAR(textSettingsMatrix) = [];
|
||||||
for "_pathCount" from 0 to 15 do {
|
for "_pathCount" from 0 to 15 do {
|
||||||
_row = [];
|
_row = [];
|
||||||
for "_menuDepth" from 0 to 15 do {
|
for "_menuDepth" from 0 to 15 do {
|
||||||
if (_menuDepth > 0) then {
|
if (_menuDepth > 0) then {
|
||||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
_textColor = [_colorTextMin, _colorTextMax, (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
||||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
_shadowColor = [_colorShadowMin, _colorShadowMax, (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
||||||
} else {
|
} else {
|
||||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), 0] call _mixColor;
|
_textColor = [_colorTextMin, _colorTextMax, 0] call _mixColor;
|
||||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), 0] call _mixColor;
|
_shadowColor = [_colorShadowMin, _colorShadowMax, 0] call _mixColor;
|
||||||
};
|
};
|
||||||
_row pushBack format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, GVAR(shadowSetting), _shadowColor];
|
_row pushBack format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, _shadowSetting, _shadowColor];
|
||||||
};
|
};
|
||||||
GVAR(textSettingsMatrix) pushBack _row;
|
GVAR(textSettingsMatrix) pushBack _row;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user