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 8472b3d1b6..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 @@ -14,17 +15,30 @@ #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 (_target != ACE_player) exitWith {}; 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]; + _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 054e98de70..cfe2feb3cb 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 @@ -13,14 +14,24 @@ #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 {1.5;}; +_target = if (count _this > 2) then {_this select 2} else {ACE_player}; -if (isNil "_size") then {_size = 1.5}; +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 { _text = localize _text; }; @@ -48,6 +59,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;