diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index f744f58143..e8df31c280 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -172,6 +172,7 @@ class GVAR(interface) { w = safeZoneW; h = safeZoneH; onMouseButtonDblClick = QUOTE([ARR_2('onMapDblClick',_this)] call FUNC(handleInterface)); + onDraw = QUOTE([ARR_2('onDraw',_this)] call FUNC(handleInterface)); }; class helpSplash: RscControlsGroupNoScrollbars { idc = IDC_HELP; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 5d2dfbd31b..201adef578 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -234,8 +234,6 @@ switch (toLower _mode) do { }; case 50: { // M [_display,nil,nil,nil,true] call FUNC(toggleInterface); - (_display displayCtrl IDC_MAP) ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)]; - ctrlMapAnimCommit (_display displayCtrl IDC_MAP); }; case 57: { // Spacebar // Freecam attachment here, if in external then set cam pos and attach @@ -372,12 +370,40 @@ switch (toLower _mode) do { // Map events case "onmapdblclick": { _args params ["_map","_button","_x","_y","_shift","_ctrl"]; + private ["_newPos","_oldZ"]; - if (GVAR(camMode == 0) && (_button == 0) && _ctrl) then { + if ((GVAR(camMode) == 0) && (_button == 0) && _ctrl) then { _newPos = _map ctrlMapScreenToWorld [_x,_y]; _oldZ = (ASLtoATL GVAR(camPos)) select 2; _newPos set [2, _oldZ]; GVAR(camPos) = (ATLtoASL _newPos); }; }; + 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)]; + }; + + private ["_cachedVehicles","_unit","_color","_icon"]; + _cachedVehicles = []; + { + _unit = vehicle _x; + + if !(_unit in _cachedVehicles) then { + _cachedVehicles pushBack _unit; + + _color = [side group _unit] call BIS_fnc_sideColor; + _icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "Icon"); + + // Handle CfgVehicleIcons + if isText (configFile >> "CfgVehicleIcons" >> _icon) then { + _icon = getText (configFile >> "CfgVehicleIcons" >> _icon); + }; + + _map drawIcon [_icon, _color, _unit, 24, 24, getDir _unit]; + }; + } forEach GVAR(unitList); + }; }; diff --git a/addons/spectator/functions/fnc_toggleInterface.sqf b/addons/spectator/functions/fnc_toggleInterface.sqf index 44eb965f0a..cd4563f7f0 100644 --- a/addons/spectator/functions/fnc_toggleInterface.sqf +++ b/addons/spectator/functions/fnc_toggleInterface.sqf @@ -42,6 +42,10 @@ if (GVAR(showMap)) then { { (_display displayCtrl _x) ctrlShow false; } forEach [IDC_COMP,IDC_HELP,IDC_TOOL,IDC_UNIT]; + + // Centre map on camera/unit + (_display displayCtrl IDC_MAP) ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)]; + ctrlMapAnimCommit (_display displayCtrl IDC_MAP); } else { // Can only toggle interface with map minimised GVAR(showInterface) = [GVAR(showInterface), !GVAR(showInterface)] select _toggleInterface; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 198929af66..d7f443b400 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -48,7 +48,7 @@ if (_newMode == 0) then { // Free GVAR(camera) cameraEffect ["internal", "back"]; // Switch to player to stop AI group chat - ACE_Player switchCamera "internal"; + GVAR(camera) switchCamera "internal"; clearRadio; // HUD stuff