2015-02-21 20:11:03 +00:00
|
|
|
/*
|
2015-03-24 15:27:27 +00:00
|
|
|
* Author: NouberNou and esteldunedain
|
|
|
|
* Handle interactions key down
|
2015-02-21 20:11:03 +00:00
|
|
|
*
|
|
|
|
* Argument:
|
2015-03-24 15:27:27 +00:00
|
|
|
* 0: Type of key: 0 interaction / 1 self interaction <NUMBER>
|
2015-02-21 20:11:03 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* true <BOOL>
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-18 18:38:27 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-03-24 15:27:27 +00:00
|
|
|
EXPLODE_1_PVT(_this,_menuType);
|
2015-02-28 20:48:46 +00:00
|
|
|
|
2015-03-24 15:27:27 +00:00
|
|
|
if (GVAR(openedMenuType) == _menuType) exitWith {true};
|
2015-02-28 20:48:46 +00:00
|
|
|
|
2015-03-24 15:27:27 +00:00
|
|
|
while {dialog} do {
|
|
|
|
closeDialog 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_menuType == 0) then {
|
2015-02-19 13:49:36 +00:00
|
|
|
GVAR(keyDown) = true;
|
2015-03-24 15:27:27 +00:00
|
|
|
GVAR(keyDownSelfAction) = false;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDown) = false;
|
|
|
|
GVAR(keyDownSelfAction) = true;
|
|
|
|
};
|
|
|
|
GVAR(keyDownTime) = diag_tickTime;
|
|
|
|
GVAR(openedMenuType) = _menuType;
|
2015-04-20 04:16:51 +00:00
|
|
|
GVAR(lastTimeSearchedActions) = -1000;
|
2015-04-26 10:41:15 +00:00
|
|
|
GVAR(ParsedTextCached) = [];
|
2015-03-10 20:48:08 +00:00
|
|
|
|
2015-03-24 15:27:27 +00:00
|
|
|
GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) ||
|
|
|
|
visibleMap ||
|
2015-04-20 16:54:20 +00:00
|
|
|
{(_menuType == 1) && {(isWeaponDeployed ACE_player) || GVAR(AlwaysUseCursorSelfInteraction) || {cameraView == "GUNNER"}}} ||
|
|
|
|
{(_menuType == 0) && GVAR(AlwaysUseCursorInteraction)};
|
|
|
|
|
2015-03-24 15:27:27 +00:00
|
|
|
if (GVAR(useCursorMenu)) then {
|
|
|
|
createDialog QGVAR(cursorMenu);
|
|
|
|
// The dialog sets:
|
|
|
|
// uiNamespace getVariable QGVAR(dlgCursorMenu);
|
|
|
|
// uiNamespace getVariable QGVAR(cursorMenuOpened);
|
|
|
|
ctrlEnable [91921, true];
|
2015-04-08 03:44:41 +00:00
|
|
|
GVAR(cursorPos) = [0.5,0.5,0];
|
2015-03-24 15:27:27 +00:00
|
|
|
((finddisplay 91919) displayctrl 91921) ctrlAddEventHandler ["MouseMoving", {
|
2015-04-08 03:44:41 +00:00
|
|
|
if (GVAR(cursorKeepCentered)) then {
|
|
|
|
GVAR(cursorPos) = GVAR(cursorPos) vectorAdd [_this select 1, _this select 2, 0] vectorDiff [0.5, 0.5, 0];
|
|
|
|
setMousePosition [0.5, 0.5];
|
|
|
|
} else {
|
|
|
|
GVAR(cursorPos) = [_this select 1, _this select 2, 0];
|
|
|
|
};
|
2015-03-24 15:27:27 +00:00
|
|
|
}];
|
2015-04-30 19:00:30 +00:00
|
|
|
// handles LMB in cursor mode when action on keyrelease is disabled
|
|
|
|
((finddisplay 91919) displayctrl 91921) ctrlAddEventHandler ["MouseButtonDown", {
|
2015-05-02 21:02:40 +00:00
|
|
|
if (!GVAR(actionOnKeyRelease) && GVAR(actionSelected)) then {
|
2015-04-30 19:00:30 +00:00
|
|
|
[GVAR(openedMenuType),true] call FUNC(keyUp);
|
|
|
|
};
|
|
|
|
}];
|
2015-03-24 15:27:27 +00:00
|
|
|
setMousePosition [0.5, 0.5];
|
2015-01-18 18:38:27 +00:00
|
|
|
};
|
2015-03-24 15:27:27 +00:00
|
|
|
|
|
|
|
GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff
|
|
|
|
((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL));
|
|
|
|
|
|
|
|
["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent);
|
|
|
|
|
2015-01-18 18:38:27 +00:00
|
|
|
true
|