From a81c1fbef5cc637276325830e8f1e3ffe2c84876 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Thu, 19 Feb 2015 21:38:51 +0100 Subject: [PATCH] Overhauled AGM hint. --- addons/common/HintConfig.hpp | 6 ++-- addons/common/config.cpp | 29 ++++++++++++++++++- .../functions/fnc_displayTextPicture.sqf | 2 +- .../functions/fnc_displayTextStructured.sqf | 29 ++++++++++--------- .../functions/fnc_setSettingFromConfig.sqf | 3 +- addons/common/stringtable.xml | 8 ++++- 6 files changed, 56 insertions(+), 21 deletions(-) diff --git a/addons/common/HintConfig.hpp b/addons/common/HintConfig.hpp index 8c8dc38abb..28346c3da3 100644 --- a/addons/common/HintConfig.hpp +++ b/addons/common/HintConfig.hpp @@ -25,6 +25,7 @@ class RscTitles { y = safeZoneY + 0.2 * safezoneH; w = 0.2 * safeZoneW; h = 0.1 * SafeZoneH; + font = "PuristaMedium"; }; }; }; @@ -36,7 +37,6 @@ class RscTitles { fadeIn = 0.2; fadeOut = 0.2; name = "ACE_RscErrorHint"; - class controls { class HintBox: RscStructuredText { idc = 1; @@ -56,7 +56,7 @@ class RscTitles { duration = 7; idd = 86411; movingenable = 0; - onLoad = "uiNamespace setVariable ['ACE_RscDisplayMessage', _this select 0];" + onLoad = "uiNamespace setVariable ['ACE_RscDisplayMessage', _this select 0];"; fadein = 0; class controlsBackground { class header: ACE_gui_staticBase { @@ -88,7 +88,7 @@ class RscTitles { duration = 15; idd = 86412; movingenable = 0; - onLoad = "uiNamespace setVariable ['ACE_RscDisplayInformation', _this select 0];" + onLoad = "uiNamespace setVariable ['ACE_RscDisplayInformation', _this select 0];"; fadein = 0; class controlsBackground { class header: ACE_gui_staticBase { diff --git a/addons/common/config.cpp b/addons/common/config.cpp index b1c479b54f..b86744f0a9 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -102,7 +102,14 @@ class ACE_Settings { displayName = "$STR_ACE_Common_SettingFeedbackIconsName"; description = "$STR_ACE_Common_SettingFeedbackIconsDesc"; values[] = {"Hide", "Top right, downwards", "Top right, to the left", "Top left, downwards", "Top left, to the right"}; - }; + }; + class GVAR(displayTextColor) { + value[] = {0,0,0,0}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingDisplayTextColorName"; + description = "$STR_ACE_Common_SettingDisplayTextColorDesc"; + }; }; #include "define.hpp" @@ -113,3 +120,23 @@ class ACE_Settings { #include #include +class CfgUIGrids { + class IGUI { + class Presets { + class Arma3 { + class Variables { + grid_ACE_displayText[] = {{safeZoneW + safeZoneX - 0.175 * safezoneW, safeZoneY + 0.175 * safezoneH, 0.15 * safeZoneW, 0.125 * SafeZoneH}, "(((safezoneW / safezoneH) min 1.2) / 40)","((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"}; + }; + }; + }; + + class Variables { + class grid_ACE_displayText { + displayName = "ACE Hint"; + description = "Textual in game feedback to the player."; + preview = "\a3\Ui_f\data\GUI\Cfg\UIGrids\grid_hint_ca.paa"; + saveToProfile[] = {0,1}; + }; + }; + }; +}; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 8d46d8d38e..060f04f591 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -22,7 +22,7 @@ if (typeName _text != "TEXT") then { }; _text = composeText [ - parseText format ["", _image], + parseText format ["", _image], lineBreak, _text ]; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 62db6a829f..e103c904b3 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -private ["_text", "_size", "_isShown", "_ctrlHint"]; +private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position"]; _text = _this select 0; _size = _this select 1; @@ -20,7 +20,10 @@ _size = _this select 1; if (isNil "_size") then {_size = 1}; if (typeName _text != "TEXT") then { - _text = composeText [lineBreak, parseText format ["%1", _text]]; + if (typeName _text == "STRING" && {isLocalized _text}) then { + _text = localize _text; + }; + _text = composeText [lineBreak, parseText format ["%1", _text]]; }; _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); @@ -30,19 +33,17 @@ _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); disableSerialization; _ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; +_ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor); + +_xPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_X", safeZoneW + safeZoneX - 0.175 * safezoneW]; +_yPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +_wPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_W", 0.15 * safeZoneW]; +_hPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_H", 0.125 * SafeZoneH]; +_position = [_xPos, _yPos, _wPos, _size * _hPos]; + +_ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit 0; _ctrlHint ctrlSetStructuredText _text; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0.2 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; +_ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit ([0.2, 0] select _isShown); diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 4151f3e0e4..577f3083e6 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -17,7 +17,8 @@ EXPLODE_1_PVT(_this,_optionEntry); _fnc_getValueWithType = { EXPLODE_2_PVT(_this,_optionEntry,_typeName); - _value = getNumber (_optionEntry >> "value"); + _valueConfig = (_optionEntry >> "value"); + _value = if (!(isArray _valueConfig) && !(isText _valueConfig)) then { getNumber (_optionEntry >> "value"); } else { 0 }; TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value); if (_typeName == "BOOL") exitWith { _value > 0 diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index f7705f8ad9..3ece4206d7 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -320,7 +320,13 @@ Select the position of or disable the feedback icons on your screen. These icons will show to provide extra feedback on your character status and actions performed. - + + + Hint Background color + + + The color of the background from the ACE hints. + \ No newline at end of file