mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add "focus on unit" to spectator free camera
Pressing F will move the free camera to a position viewing the unit currently selected in the list. Fixes map teleporting functionality also.
This commit is contained in:
parent
5b881224c5
commit
be7b156c49
@ -155,7 +155,7 @@ class GVAR(interface) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class unitTree: RscControlsGroupNoScrollbars {
|
class unitWindow: RscControlsGroupNoScrollbars {
|
||||||
idc = IDC_UNIT;
|
idc = IDC_UNIT;
|
||||||
x = safeZoneX;
|
x = safeZoneX;
|
||||||
y = safeZoneY + TOOL_H * 6;
|
y = safeZoneY + TOOL_H * 6;
|
||||||
@ -191,6 +191,7 @@ class GVAR(interface) {
|
|||||||
};
|
};
|
||||||
multiselectEnabled = 0;
|
multiselectEnabled = 0;
|
||||||
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
|
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
|
||||||
|
onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface));
|
||||||
};
|
};
|
||||||
class unitFrame: RscFrame {
|
class unitFrame: RscFrame {
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -202,16 +203,6 @@ class GVAR(interface) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class mapOverlay: RscMapControl {
|
|
||||||
idc = IDC_MAP;
|
|
||||||
type = 100;
|
|
||||||
x = safeZoneX;
|
|
||||||
y = safeZoneY;
|
|
||||||
w = safeZoneW;
|
|
||||||
h = safeZoneH;
|
|
||||||
onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface));
|
|
||||||
onDraw = QUOTE(_this call FUNC(handleMap));
|
|
||||||
};
|
|
||||||
class helpWindow: RscControlsGroupNoScrollbars {
|
class helpWindow: RscControlsGroupNoScrollbars {
|
||||||
idc = IDC_HELP;
|
idc = IDC_HELP;
|
||||||
x = safeZoneX + safeZoneW - TOOL_W * 2;
|
x = safeZoneX + safeZoneW - TOOL_W * 2;
|
||||||
@ -250,5 +241,15 @@ class GVAR(interface) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
class mapOverlay: RscMapControl {
|
||||||
|
idc = IDC_MAP;
|
||||||
|
type = 100;
|
||||||
|
x = safeZoneX;
|
||||||
|
y = safeZoneY;
|
||||||
|
w = safeZoneW;
|
||||||
|
h = safeZoneH;
|
||||||
|
onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface));
|
||||||
|
onDraw = QUOTE(_this call FUNC(handleMap));
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,7 @@ switch (toLower _mode) do {
|
|||||||
GVAR(heldKeys) = [];
|
GVAR(heldKeys) = [];
|
||||||
GVAR(mouse) = [false,false];
|
GVAR(mouse) = [false,false];
|
||||||
GVAR(mousePos) = [0.5,0.5];
|
GVAR(mousePos) = [0.5,0.5];
|
||||||
|
GVAR(treeSel) = objNull;
|
||||||
|
|
||||||
// Initalize the camera view
|
// Initalize the camera view
|
||||||
GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos));
|
GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos));
|
||||||
@ -96,6 +97,7 @@ switch (toLower _mode) do {
|
|||||||
GVAR(heldKeys) = nil;
|
GVAR(heldKeys) = nil;
|
||||||
GVAR(mouse) = nil;
|
GVAR(mouse) = nil;
|
||||||
GVAR(mousePos) = nil;
|
GVAR(mousePos) = nil;
|
||||||
|
GVAR(treeSel) = nil;
|
||||||
|
|
||||||
// Reset nametag settings
|
// Reset nametag settings
|
||||||
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
||||||
@ -146,11 +148,12 @@ switch (toLower _mode) do {
|
|||||||
[localize LSTRING(freeCamDown),"Z"],
|
[localize LSTRING(freeCamDown),"Z"],
|
||||||
[localize LSTRING(freeCamPan),"RMB (Hold)"],
|
[localize LSTRING(freeCamPan),"RMB (Hold)"],
|
||||||
[localize LSTRING(freeCamDolly),"LMB (Hold)"],
|
[localize LSTRING(freeCamDolly),"LMB (Hold)"],
|
||||||
|
[localize LSTRING(freeCamFocus),"F"],
|
||||||
|
[localize LSTRING(freeCamNextVis),"N"],
|
||||||
|
[localize LSTRING(freeCamPrevVis),"Ctrl + N"],
|
||||||
[localize LSTRING(freeCamZoom),"Scrollwheel"],
|
[localize LSTRING(freeCamZoom),"Scrollwheel"],
|
||||||
[localize LSTRING(freeCamSpeed),"Ctrl + Scrollwheel"],
|
[localize LSTRING(freeCamSpeed),"Ctrl + Scrollwheel"],
|
||||||
[localize LSTRING(freeCamBoost),"Shift (Hold)"],
|
[localize LSTRING(freeCamBoost),"Shift (Hold)"],
|
||||||
[localize LSTRING(freeCamNextVis),"N"],
|
|
||||||
[localize LSTRING(freeCamPrevVis),"Ctrl + N"],
|
|
||||||
[localize LSTRING(otherControls),""],
|
[localize LSTRING(otherControls),""],
|
||||||
[localize LSTRING(nextCam),"Up Arrow"],
|
[localize LSTRING(nextCam),"Up Arrow"],
|
||||||
[localize LSTRING(prevCam),"Down Arrow"],
|
[localize LSTRING(prevCam),"Down Arrow"],
|
||||||
@ -289,6 +292,14 @@ switch (toLower _mode) do {
|
|||||||
case 32: { // D
|
case 32: { // D
|
||||||
GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)];
|
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
|
case 44: { // Z
|
||||||
GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift);
|
GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift);
|
||||||
};
|
};
|
||||||
@ -374,6 +385,15 @@ switch (toLower _mode) do {
|
|||||||
[_newMode,_newUnit] call FUNC(transitionCamera);
|
[_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": {
|
case "onunitsupdate": {
|
||||||
_args params ["_tree"];
|
_args params ["_tree"];
|
||||||
private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"];
|
private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"];
|
||||||
@ -485,6 +505,7 @@ switch (toLower _mode) do {
|
|||||||
GVAR(heldKeys) = [];
|
GVAR(heldKeys) = [];
|
||||||
GVAR(mouse) = [false,false];
|
GVAR(mouse) = [false,false];
|
||||||
GVAR(mousePos) = [0.5,0.5];
|
GVAR(mousePos) = [0.5,0.5];
|
||||||
|
GVAR(treeSel) = objNull;
|
||||||
|
|
||||||
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
||||||
|
|
||||||
@ -538,6 +559,7 @@ switch (toLower _mode) do {
|
|||||||
GVAR(heldKeys) = [];
|
GVAR(heldKeys) = [];
|
||||||
GVAR(mouse) = [false,false];
|
GVAR(mouse) = [false,false];
|
||||||
GVAR(mousePos) = [0.5,0.5];
|
GVAR(mousePos) = [0.5,0.5];
|
||||||
|
GVAR(treeSel) = objNull;
|
||||||
|
|
||||||
openCuratorInterface;
|
openCuratorInterface;
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@ if !(_vision in GVAR(availableVisions)) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
GVAR(camPan) = _heading % 360;
|
GVAR(camPan) = _heading % 360;
|
||||||
GVAR(camPos) = (ATLtoASL _position);
|
|
||||||
GVAR(camSpeed) = (_speed max 0.05) min 10;
|
GVAR(camSpeed) = (_speed max 0.05) min 10;
|
||||||
GVAR(camTilt) = (_tilt max -89) min 89;
|
GVAR(camTilt) = (_tilt max -89) min 89;
|
||||||
GVAR(camUnit) = _unit;
|
GVAR(camUnit) = _unit;
|
||||||
@ -59,8 +58,10 @@ GVAR(camVision) = _vision;
|
|||||||
GVAR(camZoom) = (_zoom min 2) max 0.01;
|
GVAR(camZoom) = (_zoom min 2) max 0.01;
|
||||||
|
|
||||||
// Apply if camera exists
|
// Apply if camera exists
|
||||||
if !(isNil QGVAR(camera)) then {
|
if (isNil QGVAR(camera)) then {
|
||||||
[_mode,_unit,_vision] call FUNC(transitionCamera);
|
|
||||||
} else {
|
|
||||||
GVAR(camMode) = _mode;
|
GVAR(camMode) = _mode;
|
||||||
|
GVAR(camPos) = (ATLtoASL _position);
|
||||||
|
} else {
|
||||||
|
[_mode,_unit,_vision] call FUNC(transitionCamera);
|
||||||
|
GVAR(camera) setPosATL _position;
|
||||||
};
|
};
|
||||||
|
@ -53,8 +53,7 @@ if (_newMode == 0) then { // Free
|
|||||||
GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
|
GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
|
||||||
GVAR(camera) camCommit 0;
|
GVAR(camera) camCommit 0;
|
||||||
|
|
||||||
// Agent is switched to in free cam to hide death table and prevent AI chat while allowing icons to draw
|
// Agent is switched to in free cam to hide death table and prevent AI chat while allowing icons to draw (also prevents systemChat and unit HUD)
|
||||||
// However, map click events don't fire in free cam for some reason...
|
|
||||||
// (Why is so much stuff tied into the current camera unit BI?!)
|
// (Why is so much stuff tied into the current camera unit BI?!)
|
||||||
if (isNull GVAR(camAgent)) then {
|
if (isNull GVAR(camAgent)) then {
|
||||||
GVAR(camAgent) = createAgent ["VirtualMan_F",markerPos QGVAR(respawn),[],0,""];
|
GVAR(camAgent) = createAgent ["VirtualMan_F",markerPos QGVAR(respawn),[],0,""];
|
||||||
|
@ -184,6 +184,9 @@
|
|||||||
<Key ID="STR_ACE_Spectator_freeCamBoost">
|
<Key ID="STR_ACE_Spectator_freeCamBoost">
|
||||||
<English>Speed Boost</English>
|
<English>Speed Boost</English>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Spectator_freeCamFocus">
|
||||||
|
<English>Focus on Unit</English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Spectator_freeCamNextVis">
|
<Key ID="STR_ACE_Spectator_freeCamNextVis">
|
||||||
<English>Next Vision Mode</English>
|
<English>Next Vision Mode</English>
|
||||||
<Polish>Następny tryb wizji</Polish>
|
<Polish>Następny tryb wizji</Polish>
|
||||||
|
Loading…
Reference in New Issue
Block a user