Change the interact_menu selector to be a control. Makes it work reliably when surrendered

This commit is contained in:
Nicolás Badano 2015-03-23 19:16:10 -03:00
parent a432f74a6b
commit 50f5e2c858
3 changed files with 10 additions and 9 deletions

View File

@ -113,7 +113,7 @@ if (GVAR(keyDown)) then {
if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
// Draw the red selector only when there's no cursor // Draw the red selector only when there's no cursor
if !(uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { 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]); _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(lastTime) = _cTime;
GVAR(rotationAngle) = (GVAR(rotationAngle) + (270*_delta)) mod 360; 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; _foundTarget = true;
GVAR(actionSelected) = true; GVAR(actionSelected) = true;

View File

@ -24,7 +24,7 @@ _color = _this select 1;
_sPos = _this select 2; _sPos = _this select 2;
_icon = _this select 6; _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 { if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
_displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]);

View File

@ -4,6 +4,7 @@
* *
* Argument: * Argument:
* 0: 2d position <ARRAY> * 0: 2d position <ARRAY>
* 1: Icon <STRING>
* *
* Return value: * Return value:
* None * None
@ -11,19 +12,19 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
private ["_color", "_sPos", "_ctrl", "_icon"]; EXPLODE_2_PVT(_this,_sPos,_icon);
_sPos = _this select 0;
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { 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)]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
}; };
private "_ctrl";
_ctrl = GVAR(iconCtrls) select GVAR(iconCount); _ctrl = GVAR(iconCtrls) select GVAR(iconCount);
GVAR(iconCount) = GVAR(iconCount) + 1; GVAR(iconCount) = GVAR(iconCount) + 1;
_text = format ["<img image='%1' color='#FF0000' size='1.5' align='center'/>", format [QUOTE(PATHTOF(ui\selector%1.paa)), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]]; _ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.5' align='center'/>", _icon]);
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.012*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW]; _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 ctrlSetBackgroundColor [1, 0, 0, 0.1];
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;