diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index ea4a971563..b8a8fc899b 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -3,6 +3,15 @@ if (!hasInterface) exitWith {}; +//Setup text/shadow color matrix +[] call FUNC(setupTextColors); +["SettingChanged", { + PARAMS_2(_name,_value); + if ((_name == QGVAR(colorTextMax)) || {_name == QGVAR(colorTextMin)} || {_name == QGVAR(colorShadowMax)} || {_name == QGVAR(colorShadowMin)}) then { + [] call FUNC(setupTextColors); + }; +}] call EFUNC(common,addEventhandler); + // Install the render EH on the main display addMissionEventHandler ["Draw3D", DFUNC(render)]; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 747da7083e..65d5dd4305 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -21,6 +21,7 @@ PREP(renderBaseMenu); PREP(renderIcon); PREP(renderMenu); PREP(renderSelector); +PREP(setupTextColors); PREP(splitPath); GVAR(keyDown) = false; diff --git a/addons/interact_menu/config.cpp b/addons/interact_menu/config.cpp index eeff688a1a..433c2388c2 100644 --- a/addons/interact_menu/config.cpp +++ b/addons/interact_menu/config.cpp @@ -37,6 +37,30 @@ class ACE_Settings { isClientSettable = 1; displayName = "$STR_ACE_Interact_Menu_UseListMenu"; }; + class GVAR(colorTextMax) { + value[] = {1, 1, 1, 1}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorTextMax"; + }; + class GVAR(colorTextMin) { + value[] = {1, 1, 1, 0.25}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorTextMin"; + }; + class GVAR(colorShadowMax) { + value[] = {1, 1, 1, 1}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorShadowMax"; + }; + class GVAR(colorShadowMin) { + value[] = {1, 1, 1, 0.25}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorShadowMin"; + }; }; class ACE_Extensions { diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 3da1777bed..9107b6d998 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -4,12 +4,11 @@ * * Argument: * 0: Text - * 1: Color + * 1: Icon * 2: 2d position - * 3: ? - * 4: ? - * 5: ? - * 6: Icon + * 3: Color + * 4: Shadow Color + * 5: Icon Color * * Return value: * None @@ -18,11 +17,8 @@ */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) -private ["_color", "_sPos", "_ctrl", "_icon"]; -_text = _this select 0; -_color = _this select 1; -_sPos = _this select 2; -_icon = _this select 6; +private ["_ctrl"]; +PARAMS_6(_text,_icon,_sPos,_textColor,_shadowColor,_iconColor); //systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; @@ -37,16 +33,15 @@ if(_icon == "") then { }; _text = if (GVAR(UseListMenu)) then { - format ["%4", _icon, _color, _color, _text] + format ["%5", _icon, _iconColor, _textColor, _shadowColor, _text] } else { - format ["
%4", _icon, _color, _color, "ace_breakLine" callExtension _text]; + format ["
%5", _icon, _iconColor, _textColor, _shadowColor, "ace_breakLine" callExtension _text]; }; _ctrl ctrlSetStructuredText (parseText _text); _text = if (GVAR(UseListMenu)) then { - _ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]; + _ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]; } else { - _ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]; + _ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]; }; -//_ctrl ctrlSetBackgroundColor [0, 1, 0, 0.1]; _ctrl ctrlCommit 0; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index b46740921e..e80e9d41ab 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -45,19 +45,17 @@ _menuInSelectedPath = true; // Render icon // ARGB Color (First Hex Pair is transparancy) -_color = "#FFFFFFFF"; +_textColor = GVAR(colorSelected); +_shadowColor = GVAR(colorSelectedShadow); if(!_menuInSelectedPath) then { - if (_menuDepth > 0) then { - _color = format ["#%1FFFFFF", [255 * ((((count _path) - 1)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; - } else { - _color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)]; - }; + _textColor = (GVAR(colorNotSelectedMatrix) select (count _path)) select _menuDepth; + _shadowColor = (GVAR(colorShadowNotSelectedMatrix) select (count _path)) select _menuDepth; }; //END_COUNTER(constructing_colors); //BEGIN_COUNTER(fnc_renderIcons); -[_actionData select 1, _color, _sPos, 1, 1, 0, _actionData select 2, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); +[_actionData select 1, _actionData select 2, _sPos, _textColor, _shadowColor, "#FFFFFFFF"] call FUNC(renderIcon); //END_COUNTER(fnc_renderIcons); diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf new file mode 100644 index 0000000000..5df9c589da --- /dev/null +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -0,0 +1,52 @@ +/* + * Author: PabstMirror + * Builds color strings needed for displaying interaction text + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private ["_mixColor", "_rowT", "_rowS", "_menuDepth", "_pathCount", "_menuInSelectedPath", "_color", "_path"]; + +//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text +_mixColor = { + PARAMS_3(_color1,_color2,_ratio); + private ["_return", "_mix", "_index"]; + _return = ""; + for "_index" from 0 to 3 do { + _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; + if (_index != 3) then { + _return = _return + ([255 * _mix] call EFUNC(common,toHex)); + } else { + _return = "#" + ([255 * _mix] call EFUNC(common,toHex)) + _return; + }; + }; + _return +}; + +GVAR(colorSelected) = [GVAR(colorTextMin), GVAR(colorTextMax), 1] call _mixColor; +GVAR(colorSelectedShadow) = [GVAR(colorShadowMin), GVAR(colorShadowMax), 1] call _mixColor; +GVAR(colorNotSelectedMatrix) = []; +GVAR(colorShadowNotSelectedMatrix) = []; + +for "_pathCount" from 0 to 15 do { + _rowT = []; + _rowS = []; + for "_menuDepth" from 0 to 15 do { + if (_menuDepth > 0) then { + _rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor); + _rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor); + } else { + _rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), 0] call _mixColor); + _rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), 0] call _mixColor); + }; + }; + GVAR(colorNotSelectedMatrix) pushBack _rowT; + GVAR(colorShadowNotSelectedMatrix) pushBack _rowS; +}; diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 0b37f40f5e..55d67788f4 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -71,5 +71,17 @@ Járműves cselekvések Interazioni con veicoli + + Interaction - Text Max + + + Interaction - Text Min + + + Interaction - Shadow Max + + + Interaction - Shadow Min + - + \ No newline at end of file