1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
private ["_n","_objects","_units","_currentUnit","_cameraSwap","_near","_list","_selected","_currentMode","_display","_cameraModes","_id","_type","_map"];
disableSerialization;
_display = _this select 0;
MenuAction = -1;
mouseButtonUp = -1;
_cameraModes = ["Internal","External","Gunner","Group"];
_n = 1;
{lbAdd[21002,Format["[%1] %2",_n,name (leader _x)]];_n = _n + 1} forEach clientTeams;
_id = clientTeams find playerTeam;
lbSetCurSel[21002,_id];
_currentUnit = (player) Call GetUnitVehicle;
_currentMode = "Internal";
_currentUnit switchCamera _currentMode;
_units = (Units (group player) - [player]) Call GetLiveUnits;
{lbAdd[21004,Format["(%1) %2",getText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
_type = if (!(difficultyEnabled "3rdPersonView")) then {["Internal"]} else {["Internal","External","Ironsight","Group"]};
{lbAdd[21006,_x]} forEach _type;
lbSetCurSel[21006,0];
_map = _display displayCtrl 21007;
_map ctrlMapAnimAdd [0,.25,getPos _currentUnit];
ctrlMapAnimCommit _map;
while {true} do {
sleep 0.1;
_cameraSwap = false;
if (Side player != sideJoined || !dialog) exitWith {};
//--- Map click.
if (mouseButtonUp == 0) then {
mouseButtonUp = -1;
_near = _map PosScreenToWorld[mouseX,mouseY];
_list = _near nearEntities [["Man","Car","Motorcycle","Ship","Tank","Air"],200];
if (count _list > 0) then {
_objects = [];
{if (!(_x isKindOf "Man") && side _x != sideJoined) then {if (count (crew _x) == 0) then {_objects = _objects - [_x]}};if (side _x == sideJoined) then {_objects = _objects + [_x]}} forEach _list;
if (count _objects > 0) then {
_units = [_near,_objects] Call SortByDistance;
_currentUnit = (_units select 0) Call GetUnitVehicle;
_cameraSwap = true;
};
};
};
//--- Leader Selection.
if (MenuAction == 101) then {
MenuAction = -1;
_selected = leader (clientTeams select (lbCurSel 21002));
_currentUnit = (_selected) Call GetUnitVehicle;
_n = 0;
_units = (Units (group _selected) - [_selected]) Call GetLiveUnits;
lbClear 21004;
{lbAdd[21004,Format["(%1) %2",GetText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units;
_cameraSwap = true;
};
//--- Leader commands AIs.
if (MenuAction == 102) then {
MenuAction = -1;
_currentUnit = (_units select (lbCurSel 21004)) Call GetUnitVehicle;
_cameraSwap = true;
};
//--- Camera Modes
if (MenuAction == 103) then {
MenuAction = -1;
_currentMode = (_cameraModes select (lbCurSel 21006));
_cameraSwap = true;
};
if !(alive _currentUnit) then {
_currentUnit = (player) Call GetUnitVehicle;
_cameraSwap = true;
};
//--- Update the Camera.
if (_cameraSwap) then {
ctrlMapAnimClear _map;
_map ctrlMapAnimAdd [1,.25,getPos _currentUnit];
ctrlMapAnimCommit _map;
_currentUnit switchCamera _currentMode;
};
};
closeDialog 0;
((player) Call GetUnitVehicle) switchCamera _currentMode;
|