mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2760 from acemod/spectatorUpdates
Spectator updates
This commit is contained in:
commit
f07f06c843
@ -190,8 +190,8 @@ class GVAR(interface) {
|
||||
1
|
||||
};
|
||||
multiselectEnabled = 0;
|
||||
maxHistoryDelay = 10e10;
|
||||
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
|
||||
onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface));
|
||||
};
|
||||
class unitFrame: RscFrame {
|
||||
x = 0;
|
||||
|
@ -8,3 +8,6 @@
|
||||
GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes);
|
||||
GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
// Should prevent unending spectator on mission end
|
||||
addMissionEventHandler ["Ended",{ [false] call FUNC(setSpectator) }];
|
||||
|
@ -35,7 +35,7 @@ GVAR(camDistance) = 10;
|
||||
GVAR(camMode) = 0;
|
||||
GVAR(camPan) = 0;
|
||||
GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20];
|
||||
GVAR(camSpeed) = 2.5;
|
||||
GVAR(camSpeed) = 1.5;
|
||||
GVAR(camTilt) = -10;
|
||||
GVAR(camUnit) = objNull;
|
||||
GVAR(camVision) = -2;
|
||||
|
@ -45,37 +45,36 @@ switch (toLower _mode) do {
|
||||
};
|
||||
} forEach [
|
||||
[localize LSTRING(uiControls),""],
|
||||
[localize LSTRING(uiToggleUnits),"1"],
|
||||
[localize LSTRING(uiToggleHelp),"2"],
|
||||
[localize LSTRING(uiToggleTools),"3"],
|
||||
[localize LSTRING(uiToggleCompass),"4"],
|
||||
[localize LSTRING(uiToggleIcons),"5"],
|
||||
[localize LSTRING(uiToggleMap),"M"],
|
||||
[localize LSTRING(uiToggleInterface),"Backspace"],
|
||||
[localize LSTRING(uiToggleUnits),keyName 2],
|
||||
[localize LSTRING(uiToggleHelp),keyName 3],
|
||||
[localize LSTRING(uiToggleTools),keyName 4],
|
||||
[localize LSTRING(uiToggleCompass),keyName 5],
|
||||
[localize LSTRING(uiToggleIcons),keyName 6],
|
||||
[localize LSTRING(uiToggleMap),keyName 50],
|
||||
[localize LSTRING(uiToggleInterface),keyName 14],
|
||||
[localize LSTRING(freeCamControls),""],
|
||||
[localize LSTRING(freeCamForward),"W"],
|
||||
[localize LSTRING(freeCamBackward),"S"],
|
||||
[localize LSTRING(freeCamLeft),"A"],
|
||||
[localize LSTRING(freeCamRight),"D"],
|
||||
[localize LSTRING(freeCamUp),"Q"],
|
||||
[localize LSTRING(freeCamDown),"Z"],
|
||||
[localize LSTRING(freeCamForward),keyName 17],
|
||||
[localize LSTRING(freeCamBackward),keyName 31],
|
||||
[localize LSTRING(freeCamLeft),keyName 30],
|
||||
[localize LSTRING(freeCamRight),keyName 32],
|
||||
[localize LSTRING(freeCamUp),keyName 16],
|
||||
[localize LSTRING(freeCamDown),keyName 44],
|
||||
[localize LSTRING(freeCamPan),"RMB (Hold)"],
|
||||
[localize LSTRING(freeCamDolly),"LMB (Hold)"],
|
||||
[localize LSTRING(freeCamBoost),"Shift (Hold)"],
|
||||
[localize LSTRING(freeCamFocus),"F"],
|
||||
[localize LSTRING(attributeControls),""],
|
||||
[localize LSTRING(nextCam),"Up Arrow"],
|
||||
[localize LSTRING(prevCam),"Down Arrow"],
|
||||
[localize LSTRING(nextUnit),"Right Arrow"],
|
||||
[localize LSTRING(prevUnit),"Left Arrow"],
|
||||
[localize LSTRING(nextVis),"N"],
|
||||
[localize LSTRING(prevVis),"Ctrl + N"],
|
||||
[localize LSTRING(nextCam),keyName 200],
|
||||
[localize LSTRING(prevCam),keyName 208],
|
||||
[localize LSTRING(nextUnit),keyName 205],
|
||||
[localize LSTRING(prevUnit),keyName 203],
|
||||
[localize LSTRING(nextVis),keyName 49],
|
||||
[localize LSTRING(prevVis),format["%1 + %2",keyName 29,keyname 49]],
|
||||
[localize LSTRING(adjZoom),"Scrollwheel"],
|
||||
[localize LSTRING(adjSpeed),"Ctrl + Scrollwheel"],
|
||||
[localize LSTRING(incZoom),"Num-/Num+"],
|
||||
[localize LSTRING(incSpeed),"Ctrl + Num-/Num+"],
|
||||
[localize LSTRING(reZoom),"Alt + Num-"],
|
||||
[localize LSTRING(reSpeed),"Alt + Num+"]
|
||||
[localize LSTRING(adjSpeed),format["%1 + Scrollwheel",keyName 29]],
|
||||
[localize LSTRING(incZoom),format["%1/%2",keyName 74,keyName 78]],
|
||||
[localize LSTRING(incSpeed),format["%1 + %2/%3",keyName 29,keyName 74,keyName 78]],
|
||||
[localize LSTRING(reZoom),format["%1 + %2",keyName 56,keyName 74]],
|
||||
[localize LSTRING(reSpeed),format["%1 + %2",keyName 56,keyName 78]]
|
||||
];
|
||||
|
||||
// Handle support for BI's respawn counter
|
||||
@ -126,7 +125,6 @@ switch (toLower _mode) do {
|
||||
GVAR(heldKeys) resize 255;
|
||||
GVAR(mouse) = [false,false];
|
||||
GVAR(mousePos) = [0.5,0.5];
|
||||
GVAR(treeSel) = objNull;
|
||||
};
|
||||
// Mouse events
|
||||
case "onmousebuttondown": {
|
||||
@ -226,19 +224,11 @@ switch (toLower _mode) do {
|
||||
case 32: { // D
|
||||
GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)];
|
||||
};
|
||||
case 33: { // F
|
||||
private ["_sel","_vector"];
|
||||
_sel = GVAR(treeSel);
|
||||
if ((GVAR(camMode) == 0) && {!isNull _sel} && {_sel in GVAR(unitList)}) then {
|
||||
_vector = (positionCameraToWorld [0,0,0]) vectorDiff (positionCameraToWorld [0,0,25]);
|
||||
[nil,nil,nil,(getPosATL _sel) vectorAdd _vector] call FUNC(setCameraAttributes);
|
||||
};
|
||||
};
|
||||
case 44: { // Z
|
||||
GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift);
|
||||
};
|
||||
case 49: { // N
|
||||
if (GVAR(camMode) == 0) then {
|
||||
if (GVAR(camMode) != 1) then {
|
||||
if (_ctrl) then {
|
||||
[nil,nil,-1] call FUNC(cycleCamera);
|
||||
} else {
|
||||
@ -250,7 +240,7 @@ switch (toLower _mode) do {
|
||||
[_display,nil,nil,nil,true] call FUNC(toggleInterface);
|
||||
};
|
||||
case 57: { // Spacebar
|
||||
// Freecam attachment here, if in external then set cam pos and attach
|
||||
// Switch between unit and freecam here
|
||||
};
|
||||
case 74: { // Num -
|
||||
if (_alt) exitWith { [nil,nil,nil,nil,nil,nil, 1.25] call FUNC(setCameraAttributes); };
|
||||
@ -261,7 +251,7 @@ switch (toLower _mode) do {
|
||||
};
|
||||
};
|
||||
case 78: { // Num +
|
||||
if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 2.5] call FUNC(setCameraAttributes); };
|
||||
if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 1.5] call FUNC(setCameraAttributes); };
|
||||
if (_ctrl) then {
|
||||
[nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + 0.05] call FUNC(setCameraAttributes);
|
||||
} else {
|
||||
@ -335,15 +325,6 @@ switch (toLower _mode) do {
|
||||
[_newMode,_newUnit] call FUNC(transitionCamera);
|
||||
};
|
||||
};
|
||||
case "ontreeselchanged": {
|
||||
_args params ["_tree","_sel"];
|
||||
|
||||
if (count _sel == 3) then {
|
||||
GVAR(treeSel) = objectFromNetId (_tree tvData _sel);
|
||||
} else {
|
||||
GVAR(treeSel) = objNull;
|
||||
};
|
||||
};
|
||||
case "onunitsupdate": {
|
||||
_args params ["_tree"];
|
||||
private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"];
|
||||
|
@ -18,12 +18,32 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_map"];
|
||||
private ["_cachedVehicles","_unit","_color","_icon","_txt"];
|
||||
private ["_center","_radius","_scaled","_drawVehicles","_leader","_color","_cachedVehicles","_unit","_icon","_txt"];
|
||||
|
||||
if (GVAR(camMode) == 0) then {
|
||||
_map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(freeCamera),20,20,GVAR(camPan)];
|
||||
};
|
||||
|
||||
_center = _map ctrlMapScreenToWorld [0.5,0.5];
|
||||
_radius = (_map ctrlMapScreenToWorld [safeZoneX,safeZoneY]) distance2D _center;
|
||||
_scaled = (ctrlMapScale _map) > 0.2;
|
||||
|
||||
// Draw only group icons when scaled out
|
||||
_drawVehicles = [];
|
||||
{
|
||||
_leader = leader _x;
|
||||
if (_scaled) then {
|
||||
_color = GETVAR(_x,GVAR(gColor),[ARR_4(0,0,0,0)]);
|
||||
_map drawIcon ["\A3\ui_f\data\map\markers\nato\b_inf.paa", _color, _leader, 20, 20, 0, "", 0, 0];
|
||||
} else {
|
||||
if ((_leader distance2D _center) < _radius) then {
|
||||
_drawVehicles append (units _x);
|
||||
};
|
||||
};
|
||||
nil
|
||||
} count GVAR(groupList);
|
||||
|
||||
// Draw units when group leader is within screen bounds
|
||||
_cachedVehicles = [];
|
||||
{
|
||||
_unit = vehicle _x;
|
||||
@ -41,7 +61,7 @@ _cachedVehicles = [];
|
||||
_icon = GETVAR(_unit,GVAR(uIcon),"");
|
||||
_txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x);
|
||||
|
||||
_map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.03];
|
||||
_map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.04];
|
||||
};
|
||||
false
|
||||
} count GVAR(unitList);
|
||||
nil
|
||||
} count (_drawVehicles arrayIntersect GVAR(unitList));
|
||||
|
@ -26,8 +26,13 @@ private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"];
|
||||
_toolbar = _display displayCtrl IDC_TOOL;
|
||||
|
||||
// Find all tool values
|
||||
if (GVAR(camVision) >= 0) then {
|
||||
_vision = localize LSTRING(VisionThermal);
|
||||
} else {
|
||||
_vision = [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1);
|
||||
};
|
||||
|
||||
if (GVAR(camMode) == 0) then {
|
||||
_vision = if (GVAR(camVision) >= 0) then {localize LSTRING(VisionThermal)} else { [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1) };
|
||||
_fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01];
|
||||
_speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01];
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Reason <STRING>
|
||||
* 1: Interrupting <BOOL>
|
||||
* 1: Interrupting <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
|
@ -34,7 +34,7 @@ _pos = (getPosATL _unit) vectorAdd [0,0,5];
|
||||
// Enter/exit spectator based on the respawn type and whether killed/respawned
|
||||
if (alive _unit) then {
|
||||
if (_respawn == 1) then {
|
||||
[_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit);
|
||||
[_unit] call FUNC(stageSpectator);
|
||||
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
|
||||
[true] call FUNC(setSpectator);
|
||||
} else {
|
||||
|
@ -1,23 +1,24 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Sets the spectator camera attributes as desired
|
||||
* All values are optional and default to whatever the current value is
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Camera mode <NUMBER> <OPTIONAL>
|
||||
* 0: Camera mode <NUMBER>
|
||||
* - 0: Free
|
||||
* - 1: Internal
|
||||
* - 2: External
|
||||
* 1: Camera unit (objNull for random) <OBJECT> <OPTIONAL>
|
||||
* 2: Camera vision <NUMBER> <OPTIONAL>
|
||||
* 1: Camera unit (objNull for random) <OBJECT>
|
||||
* 2: Camera vision <NUMBER>
|
||||
* - -2: Normal
|
||||
* - -1: Night vision
|
||||
* - 0: Thermal white hot
|
||||
* - 1: Thermal black hot
|
||||
* 3: Camera position (ATL) <ARRAY> <OPTIONAL>
|
||||
* 4: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
|
||||
* 5: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
|
||||
* 6: Camera zoom (0.01 - 2) <NUMBER> <OPTIONAL>
|
||||
* 7: Camera speed in m/s (0.05 - 10) <NUMBER> <OPTIONAL>
|
||||
* 3: Camera position (ATL) <ARRAY>
|
||||
* 4: Camera pan (0 - 360) <NUMBER>
|
||||
* 5: Camera tilt (-90 - 90) <NUMBER>
|
||||
* 6: Camera zoom (0.01 - 2) <NUMBER>
|
||||
* 7: Camera speed in m/s (0.05 - 10) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
|
@ -7,7 +7,8 @@
|
||||
* The spectator interface will be opened/closed
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Spectator state of local client <BOOL> <OPTIONAL>
|
||||
* 0: Spectator state of local client <BOOL> (default: true)
|
||||
* 1: Force interface <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
@ -20,7 +21,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_set",true,[true]]];
|
||||
params [["_set",true,[true]], ["_force",true,[true]]];
|
||||
|
||||
// Only clients can be spectators
|
||||
if (!hasInterface) exitWith {};
|
||||
@ -29,7 +30,10 @@ if (!hasInterface) exitWith {};
|
||||
if (_set isEqualTo GVAR(isSet)) exitwith {};
|
||||
|
||||
// Handle common addon audio
|
||||
if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableVolumeUpdate) = _set};
|
||||
if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {
|
||||
EGVAR(hearing,disableVolumeUpdate) = _set;
|
||||
EGVAR(hearing,deafnessDV) = 0;
|
||||
};
|
||||
if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator};
|
||||
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator};
|
||||
|
||||
@ -45,7 +49,6 @@ if (_set) then {
|
||||
GVAR(heldKeys) resize 255;
|
||||
GVAR(mouse) = [false,false];
|
||||
GVAR(mousePos) = [0.5,0.5];
|
||||
GVAR(treeSel) = objNull;
|
||||
|
||||
// Update units before opening to support pre-set camera unit
|
||||
[] call FUNC(updateUnits);
|
||||
@ -75,7 +78,17 @@ if (_set) then {
|
||||
[{
|
||||
// Create the display
|
||||
(findDisplay 46) createDisplay QGVAR(interface);
|
||||
}, []] call EFUNC(common,execNextFrame);
|
||||
|
||||
// If not forced, make esc end spectator
|
||||
if (_this) then {
|
||||
(findDisplay 12249) displayAddEventHandler ["KeyDown", {
|
||||
if (_this select 1 == 1) then {
|
||||
[false] call ace_spectator_fnc_setSpectator;
|
||||
true
|
||||
};
|
||||
}];
|
||||
};
|
||||
}, !_force] call EFUNC(common,execNextFrame);
|
||||
|
||||
// Cache and disable nametag settings
|
||||
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
||||
@ -119,7 +132,6 @@ if (_set) then {
|
||||
GVAR(heldKeys) = nil;
|
||||
GVAR(mouse) = nil;
|
||||
GVAR(mousePos) = nil;
|
||||
GVAR(treeSel) = nil;
|
||||
|
||||
// Reset nametag settings
|
||||
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Upon unstage, units will be moved to the position they were in upon staging
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit to put into spectator stage <OBJECT> <OPTIONAL>
|
||||
* 1: Spectator stage <BOOL> <OPTIONAL>
|
||||
* 0: Unit to put into spectator stage <OBJECT> (default: player)
|
||||
* 1: Unit should be staged <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
|
@ -49,7 +49,6 @@ if (_newMode == 0) then { // Free
|
||||
|
||||
// Preserve camUnit value for consistency when manually changing view
|
||||
_camera cameraEffect ["internal", "back"];
|
||||
showCinemaBorder false;
|
||||
|
||||
// Apply the camera zoom
|
||||
_camera camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
|
||||
@ -63,23 +62,6 @@ if (_newMode == 0) then { // Free
|
||||
|
||||
GVAR(camAgent) switchCamera "internal";
|
||||
clearRadio;
|
||||
|
||||
// If new vision isn't available then keep current (unless current also isn't)
|
||||
if !(_newVision in GVAR(availableVisions)) then {
|
||||
_newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0);
|
||||
};
|
||||
|
||||
// Vision mode only applies to free cam
|
||||
if (_newVision < 0) then {
|
||||
false setCamUseTi 0;
|
||||
camUseNVG (_newVision >= -1);
|
||||
} else {
|
||||
true setCamUseTi _newVision;
|
||||
};
|
||||
GVAR(camVision) = _newVision;
|
||||
|
||||
// Handle camera movement
|
||||
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
|
||||
} else {
|
||||
_camera = GVAR(unitCamera);
|
||||
|
||||
@ -103,10 +85,6 @@ if (_newMode == 0) then { // Free
|
||||
} else {
|
||||
// Switch to the camera
|
||||
_camera cameraEffect ["internal", "back"];
|
||||
showCinemaBorder false;
|
||||
|
||||
// Handle camera orbit movement
|
||||
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
|
||||
};
|
||||
|
||||
// Clear radio if group changed
|
||||
@ -117,4 +95,27 @@ if (_newMode == 0) then { // Free
|
||||
GVAR(camUnit) = _newUnit;
|
||||
};
|
||||
|
||||
if (_newMode in [0,2]) then {
|
||||
// Set up camera UI
|
||||
showCinemaBorder false;
|
||||
cameraEffectEnableHUD true;
|
||||
|
||||
// Handle camera movement
|
||||
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
|
||||
|
||||
// If new vision isn't available then keep current (unless current also isn't)
|
||||
if !(_newVision in GVAR(availableVisions)) then {
|
||||
_newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0);
|
||||
};
|
||||
|
||||
// Vision mode applies to free and external cam
|
||||
if (_newVision < 0) then {
|
||||
false setCamUseTi 0;
|
||||
camUseNVG (_newVision >= -1);
|
||||
} else {
|
||||
true setCamUseTi _newVision;
|
||||
};
|
||||
GVAR(camVision) = _newVision;
|
||||
};
|
||||
|
||||
GVAR(camMode) = _newMode;
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Units to add to the whitelist <ARRAY>
|
||||
* 1: Use blacklist <BOOL> <OPTIONAL>
|
||||
* 1: Use blacklist <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
|
@ -344,14 +344,6 @@
|
||||
<Russian>Ускорение камеры</Russian>
|
||||
<Spanish>Aumento de velocidad</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_freeCamFocus">
|
||||
<English>Focus on Unit</English>
|
||||
<Polish>Skup na jednostce</Polish>
|
||||
<Portuguese>Focar na unidade</Portuguese>
|
||||
<Russian>Фокус на юните</Russian>
|
||||
<Czech>Zaměřit se na Jednotku</Czech>
|
||||
<Spanish>Centrarse en la unidad</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_uiControls">
|
||||
<English>Interface</English>
|
||||
<Polish>Interfejs</Polish>
|
||||
|
Loading…
Reference in New Issue
Block a user