diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:58:31 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:58:31 +0300 |
| commit | e670b4ed55c459a21090bd0178ceaaaf12d87989 (patch) | |
| tree | b6833d5e842475f0ee27f5f617096445fdd4e4a1 /Client/GUI/GUI_UnitsCamera.sqf | |
| download | a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2 a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip | |
init
Diffstat (limited to 'Client/GUI/GUI_UnitsCamera.sqf')
| -rw-r--r-- | Client/GUI/GUI_UnitsCamera.sqf | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Client/GUI/GUI_UnitsCamera.sqf b/Client/GUI/GUI_UnitsCamera.sqf new file mode 100644 index 0000000..2a71926 --- /dev/null +++ b/Client/GUI/GUI_UnitsCamera.sqf @@ -0,0 +1,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;
\ No newline at end of file |
