From 6fde2de40f4b7d08eefa5b2aaa6cc851e582b482 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 24 Feb 2015 17:14:19 +0100 Subject: [PATCH 1/6] Improved localization support and sendDisplayText to remote client objects. --- .../functions/fnc_displayTextPicture.sqf | 19 ++++++++++++++++-- .../functions/fnc_displayTextStructured.sqf | 20 +++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 8472b3d1b6..6216adb20e 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -14,14 +14,29 @@ #include "script_component.hpp" -private ["_text", "_image", "_imageColor"]; +private ["_text", "_image", "_imageColor", "_target"]; _text = _this select 0; _image = _this select 1; _imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]}; _imageColor resize 3; +_target = if (count _this > 3) then {_this select 3} else {ACE_player}; + +if (!local _target && {_target != ACE_player}) exitwith { + [_this, QUOTE(DFUNC(displayTextPicture)), _target] call FUNC(execRemoteFnc); +}; if (typeName _text != "TEXT") then { - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; + if (typeName _text == "STRING" && {isLocalized _text}) then { _text = localize _text; }; _text = parseText format ["%1", _text]; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 054e98de70..be3e4b585b 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -13,14 +13,26 @@ #include "script_component.hpp" -private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position"]; - +private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"]; _text = _this select 0; -_size = _this select 1; +_size = if (count _this > 1) then {_this select 1} else {0.1;}; +_target = if (count _this > 2) then {_this select 2} else {ACE_player}; -if (isNil "_size") then {_size = 1.5}; +if (!local _target && {_target != ACE_player}) exitwith { + [_this, QUOTE(DFUNC(displayTextStructured)), _target] call FUNC(execRemoteFnc); +}; if (typeName _text != "TEXT") then { + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; if (typeName _text == "STRING" && {isLocalized _text}) then { _text = localize _text; }; From 278f0ab889cb3e5a19f80d67f97f5478ae1213f4 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 24 Feb 2015 18:02:41 +0100 Subject: [PATCH 2/6] Fixed indentation Added check for AI units --- .../functions/fnc_displayTextPicture.sqf | 27 ++++++++++--------- .../functions/fnc_displayTextStructured.sqf | 23 ++++++++-------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 6216adb20e..9885524db7 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -22,24 +22,25 @@ _imageColor resize 3; _target = if (count _this > 3) then {_this select 3} else {ACE_player}; if (!local _target && {_target != ACE_player}) exitwith { - [_this, QUOTE(DFUNC(displayTextPicture)), _target] call FUNC(execRemoteFnc); + [_this, QUOTE(DFUNC(displayTextPicture)), _target] call FUNC(execRemoteFnc); }; +if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { - if (count _text > 0) then { - { - if (typeName _x == "STRING" && {isLocalized _x}) then { - _text set [_foreachIndex, localize _x]; - }; - }foreach _text; - _text = format _text; - }; - }; - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; + if (typeName _text == "STRING" && {isLocalized _text}) then { _text = localize _text; }; - _text = parseText format ["%1", _text]; + _text = parseText format ["%1", _text]; }; _text = composeText [parseText format ["", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text]; [_text, 2] call FUNC(displayTextStructured); diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index be3e4b585b..90f066057b 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -19,20 +19,21 @@ _size = if (count _this > 1) then {_this select 1} else {0.1;}; _target = if (count _this > 2) then {_this select 2} else {ACE_player}; if (!local _target && {_target != ACE_player}) exitwith { - [_this, QUOTE(DFUNC(displayTextStructured)), _target] call FUNC(execRemoteFnc); + [_this, QUOTE(DFUNC(displayTextStructured)), _target] call FUNC(execRemoteFnc); }; +if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { - if (count _text > 0) then { - { - if (typeName _x == "STRING" && {isLocalized _x}) then { - _text set [_foreachIndex, localize _x]; - }; - }foreach _text; - _text = format _text; - }; - }; + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; if (typeName _text == "STRING" && {isLocalized _text}) then { _text = localize _text; }; From 37031b5002ec9b0630ceb1bcd757f8adf7698b8d Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 24 Feb 2015 18:10:40 +0100 Subject: [PATCH 3/6] Replaced execRemoteFnc by ACE event system --- addons/common/XEH_postInit.sqf | 3 +++ addons/common/functions/fnc_displayTextPicture.sqf | 3 --- addons/common/functions/fnc_displayTextStructured.sqf | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index dbb665d446..35b0f5c3fe 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -158,3 +158,6 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); PARAMS_2(_vehicle,_fuelLevel); _vehicle setFuel _fuelLevel; }] call FUNC(addEventhandler); + +["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); +["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 9885524db7..a2c6ec51e1 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -21,9 +21,6 @@ _imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]}; _imageColor resize 3; _target = if (count _this > 3) then {_this select 3} else {ACE_player}; -if (!local _target && {_target != ACE_player}) exitwith { - [_this, QUOTE(DFUNC(displayTextPicture)), _target] call FUNC(execRemoteFnc); -}; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 90f066057b..3953f218d0 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -18,9 +18,6 @@ _text = _this select 0; _size = if (count _this > 1) then {_this select 1} else {0.1;}; _target = if (count _this > 2) then {_this select 2} else {ACE_player}; -if (!local _target && {_target != ACE_player}) exitwith { - [_this, QUOTE(DFUNC(displayTextStructured)), _target] call FUNC(execRemoteFnc); -}; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { From 97d18899716f31d709bd44c72525785cd9a1bb5a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 24 Feb 2015 12:40:22 -0600 Subject: [PATCH 4/6] Shift Display to Right if Zeus Interface is open --- addons/common/functions/fnc_displayTextStructured.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 3953f218d0..6e8851a099 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -58,6 +58,12 @@ _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40) _yPos = safeZoneY + 0.175 * safezoneH; _wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); _hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)); + +//Zeus Interface Open and Display would be under the "CREATE" list +if (!isnull curatorCamera) then { + _xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos); +}; + _position = [_xPos, _yPos, _wPos, _size * _hPos]; _ctrlHint ctrlSetPosition _position; From e10c907454f12750a8a223653dd17c972f095e7c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 24 Feb 2015 20:25:34 +0100 Subject: [PATCH 5/6] Added missing header arguments --- addons/common/functions/fnc_displayTextPicture.sqf | 1 + addons/common/functions/fnc_displayTextStructured.sqf | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index a2c6ec51e1..fadf28b480 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -7,6 +7,7 @@ * 0: Text * 1: Image * 2: Image color + * 3: Target Unit. Will only display if target is the player controlled object * * Return value: * Nothing diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 3953f218d0..f1761c39a7 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -6,6 +6,7 @@ * Argument: * 0: Text * 1: Size of the textbox + * 2: Target Unit. Will only display if target is the player controlled object * * Return value: * Nothing From 5b50910ef64df20dff80d75474ae688e6e1e4cb6 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 25 Feb 2015 11:23:35 +0100 Subject: [PATCH 6/6] Fixed incorrect size --- addons/common/functions/fnc_displayTextStructured.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 1bbb89052e..cfe2feb3cb 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -16,7 +16,7 @@ private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"]; _text = _this select 0; -_size = if (count _this > 1) then {_this select 1} else {0.1;}; +_size = if (count _this > 1) then {_this select 1} else {1.5;}; _target = if (count _this > 2) then {_this select 2} else {ACE_player}; if (_target != ACE_player) exitWith {};