From 7877ce31164cac308ad41d432736d48e6e0f3ec7 Mon Sep 17 00:00:00 2001
From: mharis001 <34453221+mharis001@users.noreply.github.com>
Date: Sun, 12 May 2019 00:32:13 -0400
Subject: [PATCH] Spectator - Add setting for follow camera max distance
(#6989)
* Add setting for follow camera max distance
* Convert spectator settings to CBA function
---
addons/spectator/ACE_Settings.hpp | 20 ++--------
addons/spectator/XEH_preInit.sqf | 2 +
.../functions/fnc_ui_handleMouseZChanged.sqf | 3 +-
addons/spectator/initSettings.sqf | 39 +++++++++++++++++++
addons/spectator/stringtable.xml | 6 +++
5 files changed, 51 insertions(+), 19 deletions(-)
create mode 100644 addons/spectator/initSettings.sqf
diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp
index ef74580428..3bd0f0bc50 100644
--- a/addons/spectator/ACE_Settings.hpp
+++ b/addons/spectator/ACE_Settings.hpp
@@ -1,25 +1,11 @@
class ACE_Settings {
class GVAR(enableAI) {
- category = CSTRING(Module_DisplayName);
- displayName = CSTRING(ai_DisplayName);
- description = CSTRING(ai_Description);
- typeName = "BOOL";
- value = 0;
+ movedToSQF = 1;
};
class GVAR(restrictModes) {
- category = CSTRING(Module_DisplayName);
- displayName = CSTRING(modes_DisplayName);
- description = CSTRING(modes_Description);
- typeName = "SCALAR";
- value = 0;
- values[] = {CSTRING(modes_all), CSTRING(modes_unit), "$STR_A3_Spectator_free_camera_tooltip", "$STR_A3_Spectator_1pp_camera_tooltip", "$STR_A3_Spectator_3pp_camera_tooltip"};
+ movedToSQF = 1;
};
class GVAR(restrictVisions) {
- category = CSTRING(Module_DisplayName);
- displayName = CSTRING(visions_DisplayName);
- description = CSTRING(visions_Description);
- typeName = "SCALAR";
- value = 0;
- values[] = {CSTRING(modes_all), CSTRING(visions_nv), CSTRING(visions_ti), "$STR_Special_None"};
+ movedToSQF = 1;
};
};
diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf
index 8220b21520..1e3d019177 100644
--- a/addons/spectator/XEH_preInit.sqf
+++ b/addons/spectator/XEH_preInit.sqf
@@ -6,6 +6,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
+#include "initSettings.sqf"
+
// Used by public functions
GVAR(availableModes) = [MODE_FREE, MODE_FPS, MODE_FOLLOW];
GVAR(availableSides) = [west,east,resistance,civilian];
diff --git a/addons/spectator/functions/fnc_ui_handleMouseZChanged.sqf b/addons/spectator/functions/fnc_ui_handleMouseZChanged.sqf
index 8b109d430c..b402d9830e 100644
--- a/addons/spectator/functions/fnc_ui_handleMouseZChanged.sqf
+++ b/addons/spectator/functions/fnc_ui_handleMouseZChanged.sqf
@@ -15,12 +15,11 @@
*
* Public: No
*/
-#define FOLLOW_CAMERA_MAX_DISTANCE 5
if (GVAR(camMode) == MODE_FOLLOW) then {
if ((_this select 1) > 0) then {
GVAR(camDistance) = (GVAR(camDistance) - 1) max 0;
} else {
- GVAR(camDistance) = (GVAR(camDistance) + 1) min FOLLOW_CAMERA_MAX_DISTANCE;
+ GVAR(camDistance) = (GVAR(camDistance) + 1) min GVAR(maxFollowDistance);
};
};
diff --git a/addons/spectator/initSettings.sqf b/addons/spectator/initSettings.sqf
new file mode 100644
index 0000000000..c970fe77c7
--- /dev/null
+++ b/addons/spectator/initSettings.sqf
@@ -0,0 +1,39 @@
+[
+ QGVAR(enableAI),
+ "CHECKBOX",
+ [LSTRING(ai_DisplayName), LSTRING(ai_Description)],
+ LSTRING(Settings_DisplayName),
+ false,
+ true
+] call CBA_settings_fnc_init;
+
+[
+ QGVAR(restrictModes),
+ "LIST",
+ [LSTRING(modes_DisplayName), LSTRING(modes_Description)],
+ LSTRING(Settings_DisplayName),
+ [[0, 1, 2, 3, 4], [LSTRING(modes_all), LSTRING(modes_unit), "STR_A3_Spectator_free_camera_tooltip", "STR_A3_Spectator_1pp_camera_tooltip", "STR_A3_Spectator_3pp_camera_tooltip"], 0],
+ true,
+ {},
+ true
+] call CBA_settings_fnc_init;
+
+[
+ QGVAR(restrictVisions),
+ "LIST",
+ [LSTRING(visions_DisplayName), LSTRING(visions_Description)],
+ LSTRING(Settings_DisplayName),
+ [[0, 1, 2, 3], [LSTRING(modes_all), LSTRING(visions_nv), LSTRING(visions_ti), "STR_Special_None"], 0],
+ true,
+ {},
+ true
+] call CBA_settings_fnc_init;
+
+[
+ QGVAR(maxFollowDistance),
+ "SLIDER",
+ [LSTRING(MaxFollowDistance_DisplayName), LSTRING(MaxFollowDistance_Description)],
+ LSTRING(Settings_DisplayName),
+ [5, 25, 5, 1],
+ false
+] call CBA_settings_fnc_init;
diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml
index 634fd675cf..01ad0f210c 100644
--- a/addons/spectator/stringtable.xml
+++ b/addons/spectator/stringtable.xml
@@ -180,6 +180,12 @@
热成像
熱成像
+
+ Max Follow Distance
+
+
+ Maximum distance the follow camera can be from the target
+
Engineer