From 213deeffb405ac85138bd8376b25274922b6af02 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 18:31:37 +0100 Subject: [PATCH] Add keys to adjust spectator camera speed and zoom Allows for finer control of the speed and zoom, as well as a quick way to reset either. --- addons/spectator/XEH_preInit.sqf | 2 +- .../functions/fnc_handleInterface.sqf | 40 ++++++++++---- addons/spectator/stringtable.xml | 53 +++++++++++-------- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 2c29598ebc..a40f4a0dcb 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -33,7 +33,7 @@ GVAR(camAgent) = objNull; GVAR(camMode) = 0; GVAR(camPan) = 0; GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20]; -GVAR(camSpeed) = 1; +GVAR(camSpeed) = 2.5; GVAR(camTilt) = -10; GVAR(camUnit) = objNull; GVAR(camVision) = -2; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index eda24dccf6..80ee564ab5 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -148,17 +148,21 @@ switch (toLower _mode) do { [localize LSTRING(freeCamDown),"Z"], [localize LSTRING(freeCamPan),"RMB (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(freeCamSpeed),"Ctrl + Scrollwheel"], [localize LSTRING(freeCamBoost),"Shift (Hold)"], - [localize LSTRING(otherControls),""], + [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(prevUnit),"Left Arrow"], + [localize LSTRING(nextVis),"N"], + [localize LSTRING(prevVis),"Ctrl + N"], + [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+"] ]; // Handle support for BI's respawn counter @@ -247,8 +251,8 @@ switch (toLower _mode) do { // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; - // Exclude movement keys so that speed can be adjusted on fly - if !(_dik in [16,17,30,31,32,44]) then { + // Exclude movement/adjustment keys so that speed can be adjusted on fly + if !(_dik in [16,17,30,31,32,44,74,78]) then { GVAR(heldKeys) pushBack _dik; }; @@ -295,7 +299,7 @@ switch (toLower _mode) do { case 33: { // F private ["_sel","_vector"]; _sel = GVAR(treeSel); - if !((GVAR(camMode) == 0) && {isNull _sel} && {_sel in GVAR(unitList)}) then { + 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); }; @@ -318,6 +322,22 @@ switch (toLower _mode) do { case 57: { // Spacebar // Freecam attachment here, if in external then set cam pos and attach }; + case 74: { // Num - + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil, 1.25] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) - 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) - 0.01] call FUNC(setCameraAttributes); + }; + }; + case 78: { // Num + + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 2.5] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + 0.01] call FUNC(setCameraAttributes); + }; + }; case 200: { // Up arrow [-1] call FUNC(cycleCamera); }; diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index c4b9b6b631..895a279844 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -134,8 +134,7 @@ - Free Camera Controls - Wolne sterowanie kamerą + Free Camera Camera Forward @@ -173,31 +172,14 @@ Lock Camera to Target Zablokuj kamerę na celu - - Zoom +/- - Zoom +/- - - - Speed +/- - Prędkość +/- - Speed Boost Focus on Unit - - Next Vision Mode - Następny tryb wizji - - - Previous Vision Mode - Poprzedni tryb wizji - - Interface Controls - Sterowanie interfejsem + Interface Toggle Interface @@ -227,9 +209,8 @@ Toggle Help Przełącz pomoc - - Other Controls - Pozostałe sterowanie + + Camera Attributes Next Camera @@ -247,5 +228,31 @@ Previous Unit Poprzednia jednostka + + Next Vision Mode + Następny tryb wizji + + + Previous Vision Mode + Poprzedni tryb wizji + + + Adjust Zoom + + + Adjust Speed + + + Increment Zoom + + + Increment Speed + + + Reset Zoom + + + Reset Speed +