From 50f5e2c858691b3c5f3f4a86690081005fcef1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 23 Mar 2015 19:16:10 -0300 Subject: [PATCH] Change the interact_menu selector to be a control. Makes it work reliably when surrendered --- addons/interact_menu/functions/fnc_render.sqf | 4 ++-- addons/interact_menu/functions/fnc_renderIcon.sqf | 2 +- .../interact_menu/functions/fnc_renderSelector.sqf | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 9dabd6a974..edfe95cb3a 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -113,7 +113,7 @@ if (GVAR(keyDown)) then { if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { // Draw the red selector only when there's no cursor if !(uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"]; + [[0.5,0.5], "\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa"] call FUNC(renderSelector); }; _cursorScreenPos = [worldToScreen _cursorPos2, GVAR(cursorPos)] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); @@ -140,7 +140,7 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { GVAR(lastTime) = _cTime; GVAR(rotationAngle) = (GVAR(rotationAngle) + (270*_delta)) mod 360; - [_sPos] call FUNC(renderSelector); + [_sPos, format [QUOTE(PATHTOF(ui\selector%1.paa)), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]] call FUNC(renderSelector); _foundTarget = true; GVAR(actionSelected) = true; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 910ae73d12..21d58eaa5f 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -24,7 +24,7 @@ _color = _this select 1; _sPos = _this select 2; _icon = _this select 6; -//systemChat format ["Icon %1 - %2,%3,%4", _text, _pos select 0, _pos select 1, _pos select 2]; +//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 8600671b24..ff74783ef9 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -4,6 +4,7 @@ * * Argument: * 0: 2d position + * 1: Icon * * Return value: * None @@ -11,19 +12,19 @@ * Public: No */ #include "script_component.hpp" -#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) -private ["_color", "_sPos", "_ctrl", "_icon"]; -_sPos = _this select 0; + +EXPLODE_2_PVT(_this,_sPos,_icon); if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - _displayNum = [46,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); }; + +private "_ctrl"; _ctrl = GVAR(iconCtrls) select GVAR(iconCount); GVAR(iconCount) = GVAR(iconCount) + 1; -_text = format ["", format [QUOTE(PATHTOF(ui\selector%1.paa)), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]]; -_ctrl ctrlSetStructuredText (parseText _text); +_ctrl ctrlSetStructuredText (parseText format ["", _icon]); _ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.012*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW]; //_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1]; _ctrl ctrlCommit 0;