2015-07-15 11:03:54 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
|
|
|
* Handles spectator interface events
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Event name <STRING>
|
|
|
|
* 1: Event arguments <ANY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["onLoad",_this] call ace_spectator_fnc_handleInterface
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-07-18 17:46:46 +00:00
|
|
|
params ["_mode",["_args",[]]];
|
2015-07-15 11:03:54 +00:00
|
|
|
|
|
|
|
switch (toLower _mode) do {
|
|
|
|
// Safely open/close the interface
|
|
|
|
case "open": {
|
|
|
|
// Prevent reopening
|
|
|
|
if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {};
|
|
|
|
|
2015-07-15 11:11:19 +00:00
|
|
|
// Initalize camera variables
|
2015-07-21 17:05:29 +00:00
|
|
|
GVAR(camBoom) = 0;
|
|
|
|
GVAR(camDolly) = [0,0];
|
2015-07-21 10:59:20 +00:00
|
|
|
GVAR(camGun) = false;
|
2015-07-15 11:11:19 +00:00
|
|
|
|
|
|
|
// Initalize display variables
|
|
|
|
GVAR(ctrlKey) = false;
|
2015-07-24 10:12:26 +00:00
|
|
|
GVAR(heldKeys) = [];
|
2015-07-15 11:11:19 +00:00
|
|
|
GVAR(mouse) = [false,false];
|
|
|
|
GVAR(mousePos) = [0.5,0.5];
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
// Initalize the camera view
|
2015-07-21 17:07:55 +00:00
|
|
|
GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos));
|
2015-07-20 21:45:11 +00:00
|
|
|
[] call FUNC(transitionCamera);
|
2015-07-15 13:33:11 +00:00
|
|
|
|
2015-07-24 16:55:33 +00:00
|
|
|
// Close all existing dialogs
|
|
|
|
while {dialog} do {
|
|
|
|
closeDialog 0;
|
|
|
|
};
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
// Create the dialog
|
2015-07-17 00:44:49 +00:00
|
|
|
createDialog QGVAR(interface);
|
2015-07-15 11:03:54 +00:00
|
|
|
|
|
|
|
// Cache and disable nametag settings
|
|
|
|
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
GVAR(nametagSettingCache) = [EGVAR(nametags,showPlayerNames), EGVAR(nametags,showNamesForAI)];
|
|
|
|
EGVAR(nametags,showPlayerNames) = 0;
|
|
|
|
EGVAR(nametags,showNamesForAI) = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case "close": {
|
|
|
|
// Can't close a second time
|
|
|
|
if (isNull (GETUVAR(GVAR(display),displayNull))) exitWith {};
|
|
|
|
|
|
|
|
// Terminate interface
|
|
|
|
(GETUVAR(GVAR(display),displayNull)) closeDisplay 0;
|
|
|
|
|
|
|
|
// Terminate camera
|
|
|
|
GVAR(camera) cameraEffect ["terminate", "back"];
|
|
|
|
camDestroy GVAR(camera);
|
|
|
|
|
|
|
|
// Return to player view
|
|
|
|
ACE_Player switchCamera "internal";
|
|
|
|
|
2015-07-15 11:11:19 +00:00
|
|
|
// Cleanup camera variables
|
|
|
|
GVAR(camera) = nil;
|
|
|
|
GVAR(camBoom) = nil;
|
|
|
|
GVAR(camDolly) = nil;
|
2015-07-21 10:59:20 +00:00
|
|
|
GVAR(camGun) = nil;
|
2015-07-15 11:11:19 +00:00
|
|
|
|
|
|
|
// Cleanup display variables
|
2015-07-18 17:46:46 +00:00
|
|
|
GVAR(ctrlKey) = nil;
|
2015-07-24 10:12:26 +00:00
|
|
|
GVAR(heldKeys) = nil;
|
2015-07-15 11:11:19 +00:00
|
|
|
GVAR(mouse) = nil;
|
|
|
|
GVAR(mousePos) = nil;
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
// Reset nametag settings
|
|
|
|
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
EGVAR(nametags,showPlayerNames) = GVAR(nametagSettingCache) select 0;
|
|
|
|
EGVAR(nametags,showNamesForAI) = GVAR(nametagSettingCache) select 1;
|
|
|
|
GVAR(nametagSettingCache) = nil;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// Dialog events
|
|
|
|
case "onload": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_display"];
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
with uiNamespace do {
|
2015-07-18 17:46:46 +00:00
|
|
|
GVAR(display) = _display;
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
|
|
|
|
2015-07-18 14:42:07 +00:00
|
|
|
// Always show interface and hide map upon opening
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface);
|
2015-07-15 11:03:54 +00:00
|
|
|
|
2015-07-24 18:02:27 +00:00
|
|
|
// Keep unit list and tree up to date
|
2015-07-19 12:40:08 +00:00
|
|
|
[FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler;
|
2015-07-19 01:25:52 +00:00
|
|
|
|
2015-07-21 22:20:41 +00:00
|
|
|
// Populate the help splash
|
2015-07-24 16:50:33 +00:00
|
|
|
private "_help";
|
|
|
|
_help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST;
|
2015-07-21 22:20:41 +00:00
|
|
|
{
|
2015-07-24 16:50:33 +00:00
|
|
|
// Add space before category titles
|
|
|
|
if (count _x == 1) then {
|
|
|
|
_help lnbAddRow [""];
|
|
|
|
};
|
|
|
|
|
|
|
|
_help lnbAddRow _x;
|
2015-07-21 22:20:41 +00:00
|
|
|
} forEach [
|
2015-07-24 16:50:33 +00:00
|
|
|
[localize LSTRING(uiControls),""],
|
2015-07-24 10:23:14 +00:00
|
|
|
[localize LSTRING(uiToggleHelp),"H"],
|
|
|
|
[localize LSTRING(uiToggleMap),"M"],
|
|
|
|
[localize LSTRING(uiToggleUnits),"1"],
|
|
|
|
[localize LSTRING(uiToggleTools),"2"],
|
|
|
|
[localize LSTRING(uiToggleCompass),"3"],
|
2015-07-24 16:23:25 +00:00
|
|
|
[localize LSTRING(uiToggleIcons),"4"],
|
2015-07-24 10:23:14 +00:00
|
|
|
[localize LSTRING(uiToggleInterface),"Backspace"],
|
|
|
|
|
2015-07-24 16:23:25 +00:00
|
|
|
[localize LSTRING(freeCamControls)],
|
2015-07-21 22:20:41 +00:00
|
|
|
[localize LSTRING(freeCamForward),"W"],
|
|
|
|
[localize LSTRING(freeCamBackward),"S"],
|
|
|
|
[localize LSTRING(freeCamLeft),"A"],
|
|
|
|
[localize LSTRING(freeCamRight),"D"],
|
|
|
|
[localize LSTRING(freeCamUp),"Q"],
|
|
|
|
[localize LSTRING(freeCamDown),"Z"],
|
2015-07-24 10:23:14 +00:00
|
|
|
[localize LSTRING(freeCamPan),"RMB (Hold)"],
|
|
|
|
[localize LSTRING(freeCamDolly),"LMB (Hold)"],
|
|
|
|
[localize LSTRING(freeCamSpeed),"Scrollwheel"],
|
|
|
|
[localize LSTRING(freeCamZoom),"Ctrl + Scrollwheel"],
|
2015-07-24 10:12:26 +00:00
|
|
|
[localize LSTRING(freeCamNextVis),"N"],
|
|
|
|
[localize LSTRING(freeCamPrevVis),"Ctrl + N"],
|
2015-07-24 10:23:14 +00:00
|
|
|
|
2015-07-24 16:50:33 +00:00
|
|
|
[localize LSTRING(otherControls)],
|
2015-07-25 10:20:59 +00:00
|
|
|
[localize LSTRING(nextCam),"Up Arrow"],
|
|
|
|
[localize LSTRING(prevCam),"Down Arrow"],
|
|
|
|
[localize LSTRING(nextUnit),"Right Arrow"],
|
|
|
|
[localize LSTRING(prevUnit),"Left Arrow"]
|
2015-07-21 22:20:41 +00:00
|
|
|
];
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
// Hacky way to enable keybindings
|
|
|
|
//_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}];
|
|
|
|
//_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}];
|
|
|
|
};
|
|
|
|
case "onunload": {
|
|
|
|
with uiNamespace do {
|
|
|
|
GVAR(display) = nil;
|
|
|
|
};
|
2015-07-18 16:06:13 +00:00
|
|
|
|
|
|
|
GVAR(camHandler) = nil;
|
2015-07-24 18:02:27 +00:00
|
|
|
GVAR(compHandler) = nil;
|
2015-07-25 11:28:03 +00:00
|
|
|
GVAR(iconHandler) = nil;
|
2015-07-24 18:02:27 +00:00
|
|
|
GVAR(toolHandler) = nil;
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
// Mouse events
|
|
|
|
case "onmousebuttondown": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_ctrl","_button"];
|
2015-07-15 11:11:19 +00:00
|
|
|
GVAR(mouse) set [_button,true];
|
2015-07-15 11:33:32 +00:00
|
|
|
|
|
|
|
// Detect right click
|
|
|
|
if ((_button == 1) && (GVAR(camMode) == 1)) then {
|
2015-07-15 13:33:11 +00:00
|
|
|
// In first person toggle sights mode
|
2015-07-21 17:05:29 +00:00
|
|
|
GVAR(camGun) = !GVAR(camGun);
|
2015-07-20 21:45:11 +00:00
|
|
|
[] call FUNC(transitionCamera);
|
2015-07-15 11:33:32 +00:00
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case "onmousebuttonup": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_ctrl","_button"];
|
|
|
|
|
2015-07-15 11:11:19 +00:00
|
|
|
GVAR(mouse) set [_button,false];
|
2015-07-21 17:44:24 +00:00
|
|
|
if (_button == 0) then { GVAR(camDolly) = [0,0]; };
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case "onmousezchanged": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_ctrl","_zChange"];
|
2015-07-15 11:33:32 +00:00
|
|
|
|
2015-07-19 21:30:44 +00:00
|
|
|
// Scroll to change speed, modifier for zoom
|
2015-07-15 11:33:32 +00:00
|
|
|
if (GVAR(ctrlKey)) then {
|
2015-07-24 18:02:27 +00:00
|
|
|
[nil,nil,nil,nil,nil,nil, GVAR(camZoom) + _zChange * 0.1] call FUNC(setCameraAttributes);
|
2015-07-15 11:33:32 +00:00
|
|
|
} else {
|
2015-07-24 18:02:27 +00:00
|
|
|
[nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + _zChange * 0.2] call FUNC(setCameraAttributes);
|
2015-07-15 11:33:32 +00:00
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case "onmousemoving": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_ctrl","_x","_y"];
|
2015-07-15 11:11:19 +00:00
|
|
|
|
2015-07-18 15:59:05 +00:00
|
|
|
[_x,_y] call FUNC(handleMouse);
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
// Keyboard events
|
|
|
|
case "onkeydown": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_display","_dik","_shift","_ctrl","_alt"];
|
2015-07-15 11:03:54 +00:00
|
|
|
|
2015-07-24 10:12:26 +00:00
|
|
|
// Handle held keys (prevent repeat calling)
|
2015-07-25 22:59:15 +00:00
|
|
|
if (_dik in GVAR(heldKeys)) exitwith {};
|
2015-07-24 10:12:26 +00:00
|
|
|
GVAR(heldKeys) pushBack _dik;
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
switch (_dik) do {
|
|
|
|
case 1: { // Esc
|
2015-07-25 22:59:15 +00:00
|
|
|
["escape", [_display]] call FUNC(handleInterface);
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
2015-07-19 21:50:13 +00:00
|
|
|
case 2: { // 1
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,nil,nil,nil,nil,true] call FUNC(toggleInterface);
|
2015-07-19 21:50:13 +00:00
|
|
|
};
|
|
|
|
case 3: { // 2
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,nil,nil,nil,true] call FUNC(toggleInterface);
|
2015-07-19 21:50:13 +00:00
|
|
|
};
|
|
|
|
case 4: { // 3
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,true] call FUNC(toggleInterface);
|
2015-07-19 21:50:13 +00:00
|
|
|
};
|
2015-07-24 16:23:25 +00:00
|
|
|
case 5: { // 4
|
|
|
|
GVAR(showIcons) = !GVAR(showIcons);
|
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
case 14: { // Backspace
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,nil,true] call FUNC(toggleInterface);
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
case 16: { // Q
|
2015-07-21 17:05:29 +00:00
|
|
|
GVAR(camBoom) = 0.5;
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 17: { // W
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [1, GVAR(camSpeed)];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 29: { // Ctrl
|
|
|
|
GVAR(ctrlKey) = true;
|
|
|
|
};
|
|
|
|
case 30: { // A
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [0, -GVAR(camSpeed)];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 31: { // S
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [1, -GVAR(camSpeed)];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 32: { // D
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [0, GVAR(camSpeed)];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
2015-07-16 20:45:52 +00:00
|
|
|
case 35: { // H
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,true] call FUNC(toggleInterface);
|
2015-07-18 14:42:07 +00:00
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
case 44: { // Z
|
2015-07-21 17:05:29 +00:00
|
|
|
GVAR(camBoom) = -0.5;
|
2015-07-21 10:59:20 +00:00
|
|
|
};
|
|
|
|
case 49: { // N
|
2015-07-24 10:12:26 +00:00
|
|
|
if (_ctrl) then {
|
|
|
|
[nil,nil,-1] call FUNC(cycleCamera);
|
|
|
|
} else {
|
|
|
|
[nil,nil,1] call FUNC(cycleCamera);
|
|
|
|
};
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
case 50: { // M
|
2015-07-20 21:45:11 +00:00
|
|
|
[_display,nil,nil,nil,true] call FUNC(toggleInterface);
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
2015-07-15 11:33:32 +00:00
|
|
|
case 57: { // Spacebar
|
2015-07-18 16:13:27 +00:00
|
|
|
// Freecam attachment here, if in external then set cam pos and attach
|
|
|
|
};
|
|
|
|
case 200: { // Up arrow
|
2015-07-21 12:31:13 +00:00
|
|
|
[-1] call FUNC(cycleCamera);
|
2015-07-15 11:33:32 +00:00
|
|
|
};
|
2015-07-18 15:20:19 +00:00
|
|
|
case 203: { // Left arrow
|
2015-07-21 15:06:07 +00:00
|
|
|
[nil,1] call FUNC(cycleCamera);
|
2015-07-18 15:20:19 +00:00
|
|
|
};
|
|
|
|
case 205: { // Right arrow
|
2015-07-21 15:06:07 +00:00
|
|
|
[nil,-1] call FUNC(cycleCamera);
|
2015-07-18 15:20:19 +00:00
|
|
|
};
|
2015-07-18 18:05:18 +00:00
|
|
|
case 208: { // Down arrow
|
2015-07-21 12:31:13 +00:00
|
|
|
[1] call FUNC(cycleCamera);
|
2015-07-18 18:05:18 +00:00
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
true
|
|
|
|
};
|
|
|
|
case "onkeyup": {
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_display","_dik","_shift","_ctrl","_alt"];
|
2015-07-15 11:03:54 +00:00
|
|
|
|
2015-07-24 10:12:26 +00:00
|
|
|
// No longer being held
|
|
|
|
GVAR(heldKeys) = GVAR(heldKeys) - [_dik];
|
|
|
|
|
2015-07-15 11:03:54 +00:00
|
|
|
switch (_dik) do {
|
2015-07-15 11:11:19 +00:00
|
|
|
case 16: { // Q
|
2015-07-21 17:26:49 +00:00
|
|
|
GVAR(camBoom) = 0;
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 17: { // W
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [1, 0];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 29: { // Ctrl
|
|
|
|
GVAR(ctrlKey) = false;
|
|
|
|
};
|
|
|
|
case 30: { // A
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [0, 0];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 31: { // S
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [1, 0];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 32: { // D
|
2015-07-21 17:44:24 +00:00
|
|
|
GVAR(camDolly) set [0, 0];
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
|
|
|
case 44: { // Z
|
2015-07-21 17:26:49 +00:00
|
|
|
GVAR(camBoom) = 0;
|
2015-07-15 11:11:19 +00:00
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
true
|
|
|
|
};
|
2015-07-16 16:01:04 +00:00
|
|
|
// Tree events
|
|
|
|
case "ontreedblclick": {
|
2015-07-16 17:31:49 +00:00
|
|
|
// Update camera view when listbox unit is double clicked on
|
2015-07-18 17:46:46 +00:00
|
|
|
_args params ["_tree","_sel"];
|
2015-07-16 17:31:49 +00:00
|
|
|
|
|
|
|
// Ensure a unit was selected
|
2015-07-20 16:42:11 +00:00
|
|
|
if (count _sel == 3) then {
|
2015-07-18 17:46:46 +00:00
|
|
|
private ["_netID","_newUnit","_newMode"];
|
2015-07-16 17:31:49 +00:00
|
|
|
_netID = (_args select 0) tvData _sel;
|
2015-07-16 18:43:16 +00:00
|
|
|
_newUnit = objectFromNetId _netID;
|
2015-07-16 17:31:49 +00:00
|
|
|
|
2015-07-16 20:37:20 +00:00
|
|
|
// When unit is reselected, toggle camera mode
|
|
|
|
if (_newUnit == GVAR(camUnit) || GVAR(camMode) == 0) then {
|
2015-07-17 00:52:08 +00:00
|
|
|
_newMode = [2,2,1] select GVAR(camMode);
|
2015-07-16 16:01:04 +00:00
|
|
|
};
|
2015-07-16 20:37:20 +00:00
|
|
|
|
2015-07-21 14:53:20 +00:00
|
|
|
[_newMode,_newUnit] call FUNC(transitionCamera);
|
2015-07-16 16:01:04 +00:00
|
|
|
};
|
|
|
|
};
|
2015-07-19 12:40:08 +00:00
|
|
|
case "onunitsupdate": {
|
2015-07-19 22:03:40 +00:00
|
|
|
_args params ["_tree"];
|
2015-07-21 20:21:46 +00:00
|
|
|
private ["_curSelData","_cachedGrps","_cachedSides","_grp","_side","_sNode","_gNode","_uNode"];
|
2015-07-19 12:40:08 +00:00
|
|
|
|
|
|
|
// Cache current selection
|
2015-07-19 22:03:40 +00:00
|
|
|
_curSelData = _tree tvData (tvCurSel _tree);
|
2015-07-19 12:40:08 +00:00
|
|
|
|
|
|
|
// Clear the tree
|
2015-07-19 22:03:40 +00:00
|
|
|
tvClear _tree;
|
2015-07-19 12:40:08 +00:00
|
|
|
|
|
|
|
// Update the tree from the unit list
|
|
|
|
_cachedGrps = [];
|
2015-07-21 20:21:46 +00:00
|
|
|
_cachedSides = [];
|
2015-07-19 12:40:08 +00:00
|
|
|
{
|
|
|
|
_grp = group _x;
|
2015-07-24 14:53:08 +00:00
|
|
|
_side = [side _grp] call BIS_fnc_sideName;
|
2015-07-19 12:40:08 +00:00
|
|
|
|
2015-07-20 16:42:11 +00:00
|
|
|
// Use correct side node
|
2015-07-21 20:21:46 +00:00
|
|
|
if !(_side in _cachedSides) then {
|
|
|
|
// Add side node
|
|
|
|
_sNode = _tree tvAdd [[], _side];
|
|
|
|
|
|
|
|
_cachedSides pushBack _side;
|
|
|
|
_cachedSides pushBack _sNode;
|
|
|
|
} else {
|
|
|
|
// If side already processed, use existing node
|
|
|
|
_sNode = _cachedSides select ((_cachedSides find _side) + 1);
|
|
|
|
};
|
2015-07-20 16:42:11 +00:00
|
|
|
|
|
|
|
// Use correct group node
|
|
|
|
if !(_grp in _cachedGrps) then {
|
|
|
|
// Add group node
|
|
|
|
_gNode = _tree tvAdd [[_sNode], groupID _grp];
|
2015-07-19 12:40:08 +00:00
|
|
|
|
|
|
|
_cachedGrps pushBack _grp;
|
2015-07-20 16:42:11 +00:00
|
|
|
_cachedGrps pushBack _gNode;
|
2015-07-19 12:40:08 +00:00
|
|
|
} else {
|
2015-07-20 16:42:11 +00:00
|
|
|
// If group already processed, use existing node
|
|
|
|
_gNode = _cachedGrps select ((_cachedGrps find _grp) + 1);
|
2015-07-19 12:40:08 +00:00
|
|
|
};
|
|
|
|
|
2015-07-24 16:13:03 +00:00
|
|
|
_uNode = _tree tvAdd [[_sNode,_gNode], GETVAR(_x,GVAR(uName),"")];
|
2015-07-20 16:42:11 +00:00
|
|
|
_tree tvSetData [[_sNode,_gNode,_uNode], netID _x];
|
2015-07-19 12:40:08 +00:00
|
|
|
|
|
|
|
// Preserve the previous selection
|
2015-07-20 16:42:11 +00:00
|
|
|
if (_curSelData == (_tree tvData [_sNode,_gNode,_uNode])) then {
|
|
|
|
_tree tvSetCurSel [_sNode,_gNode,_uNode];
|
2015-07-19 12:40:08 +00:00
|
|
|
};
|
|
|
|
|
2015-07-20 16:42:11 +00:00
|
|
|
_tree tvSort [[_sNode,_gNode],false];
|
|
|
|
_tree tvExpand [_sNode,_gNode];
|
2015-07-19 12:40:08 +00:00
|
|
|
} forEach GVAR(unitList);
|
|
|
|
|
2015-07-21 20:21:46 +00:00
|
|
|
{
|
|
|
|
if (typeName _x == "SCALAR") then {
|
|
|
|
_tree tvSort [[_x],false];
|
|
|
|
_tree tvExpand [_x];
|
|
|
|
};
|
|
|
|
} forEach _cachedSides;
|
|
|
|
|
|
|
|
_tree tvSort [[],false];
|
2015-07-19 12:40:08 +00:00
|
|
|
};
|
2015-07-20 19:30:13 +00:00
|
|
|
// Map events
|
|
|
|
case "onmapdblclick": {
|
2015-07-25 14:29:53 +00:00
|
|
|
_args params ["_map","_button","_x","_y"];
|
2015-07-24 14:36:36 +00:00
|
|
|
private ["_newPos","_oldZ"];
|
2015-07-20 19:30:13 +00:00
|
|
|
|
2015-07-25 14:29:53 +00:00
|
|
|
if ((GVAR(camMode) == 0) && (_button == 0)) then {
|
2015-07-20 19:30:13 +00:00
|
|
|
_newPos = _map ctrlMapScreenToWorld [_x,_y];
|
2015-07-21 17:05:29 +00:00
|
|
|
_oldZ = (ASLtoATL GVAR(camPos)) select 2;
|
2015-07-21 17:07:55 +00:00
|
|
|
_newPos set [2, _oldZ];
|
2015-07-25 11:28:03 +00:00
|
|
|
[nil,nil,nil, _newPos] call FUNC(setCameraAttributes);
|
2015-07-20 19:30:13 +00:00
|
|
|
};
|
|
|
|
};
|
2015-07-24 14:36:36 +00:00
|
|
|
case "ondraw": {
|
|
|
|
_args params ["_map"];
|
|
|
|
|
|
|
|
if (GVAR(camMode) == 0) then {
|
|
|
|
_map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(camera),24,24,GVAR(camPan)];
|
|
|
|
};
|
|
|
|
|
2015-07-24 16:23:25 +00:00
|
|
|
if !(GVAR(showIcons)) exitWith {};
|
|
|
|
|
2015-07-24 14:36:36 +00:00
|
|
|
private ["_cachedVehicles","_unit","_color","_icon"];
|
|
|
|
_cachedVehicles = [];
|
|
|
|
{
|
|
|
|
_unit = vehicle _x;
|
|
|
|
|
|
|
|
if !(_unit in _cachedVehicles) then {
|
|
|
|
_cachedVehicles pushBack _unit;
|
|
|
|
|
2015-07-24 16:13:03 +00:00
|
|
|
// Use previously cached info where possible
|
|
|
|
if (isNil { GETVAR(_unit,GVAR(uIcon),nil) }) then {
|
|
|
|
[_unit] call FUNC(cacheUnitInfo);
|
2015-07-24 14:36:36 +00:00
|
|
|
};
|
|
|
|
|
2015-07-24 16:23:25 +00:00
|
|
|
_color = GETVAR(_unit,GVAR(uColor),[ARR_4(0,0,0,0)]);
|
2015-07-24 16:13:03 +00:00
|
|
|
_icon = GETVAR(_unit,GVAR(uIcon),"");
|
2015-07-24 14:36:36 +00:00
|
|
|
_map drawIcon [_icon, _color, _unit, 24, 24, getDir _unit];
|
|
|
|
};
|
|
|
|
} forEach GVAR(unitList);
|
|
|
|
};
|
2015-07-25 22:59:15 +00:00
|
|
|
// Other
|
|
|
|
case "escape": {
|
|
|
|
_args params ["_display"];
|
|
|
|
private ["_dlg","_key","_index","_ctrl","_config"];
|
|
|
|
|
|
|
|
// Kill display
|
|
|
|
_display closeDisplay 0;
|
|
|
|
|
|
|
|
// Reset UI vars
|
|
|
|
GVAR(ctrlKey) = false;
|
|
|
|
GVAR(heldKeys) = [];
|
|
|
|
GVAR(mouse) = [false,false];
|
|
|
|
GVAR(mousePos) = [0.5,0.5];
|
|
|
|
|
|
|
|
// Below is from EFUNC(common,disableUserInput)
|
|
|
|
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
|
|
|
|
|
|
|
disableSerialization;
|
|
|
|
_dlg = finddisplay 49;
|
|
|
|
_dlg displayAddEventHandler ["KeyDown", {
|
|
|
|
_key = _this select 1;
|
|
|
|
!(_key == 1)
|
|
|
|
}];
|
|
|
|
|
|
|
|
for "_index" from 100 to 2000 do {
|
|
|
|
(_dlg displayCtrl _index) ctrlEnable false;
|
|
|
|
};
|
|
|
|
|
|
|
|
_ctrl = _dlg displayctrl 103;
|
|
|
|
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {dialog} do {closeDialog 0}; failMission 'LOSER';)];
|
|
|
|
_ctrl ctrlEnable true;
|
|
|
|
_ctrl ctrlSetText "ABORT";
|
|
|
|
_ctrl ctrlSetTooltip "Abort.";
|
|
|
|
|
|
|
|
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
|
|
|
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1;)];
|
|
|
|
_ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
|
|
|
_ctrl ctrlSetText "RESPAWN";
|
|
|
|
_ctrl ctrlSetTooltip "Respawn.";
|
|
|
|
|
|
|
|
// PFH to re-open display when menu closes
|
|
|
|
[{
|
|
|
|
if !(isNull (findDisplay 49)) exitWith {};
|
|
|
|
|
|
|
|
createDialog QGVAR(interface);
|
|
|
|
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
},0] call CBA_fnc_addPerFrameHandler;
|
|
|
|
};
|
2015-07-15 11:03:54 +00:00
|
|
|
};
|