From 1321c03a6e692e82ca43af2e1cb838f9765f6fc1 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 20 Jul 2024 21:51:11 +0200 Subject: [PATCH] Cleanup --- addons/markinglaser/CfgIRLaserSettings.hpp | 2 +- addons/markinglaser/CfgVehicles.hpp | 6 ++---- addons/markinglaser/XEH_postInit.sqf | 13 ++++++++----- addons/markinglaser/XEH_preInit.sqf | 2 +- addons/markinglaser/functions/fnc_findTurret.sqf | 4 ++-- .../functions/fnc_getPilotCamVector.sqf | 2 +- .../markinglaser/functions/fnc_getTurretVector.sqf | 8 ++++---- .../markinglaser/functions/fnc_onAircraftInit.sqf | 2 +- addons/markinglaser/functions/fnc_onLaserOff.sqf | 2 +- addons/markinglaser/functions/fnc_onLaserOn.sqf | 6 +++--- addons/markinglaser/functions/fnc_renderPFH.sqf | 8 ++++---- addons/markinglaser/functions/fnc_updatePFH.sqf | 2 +- addons/markinglaser/functions/script_component.hpp | 1 - .../{initSettings.sqf => initSettings.inc.sqf} | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 addons/markinglaser/functions/script_component.hpp rename addons/markinglaser/{initSettings.sqf => initSettings.inc.sqf} (95%) diff --git a/addons/markinglaser/CfgIRLaserSettings.hpp b/addons/markinglaser/CfgIRLaserSettings.hpp index 40438058b6..2432e338d0 100644 --- a/addons/markinglaser/CfgIRLaserSettings.hpp +++ b/addons/markinglaser/CfgIRLaserSettings.hpp @@ -1,4 +1,4 @@ class CfgIRLaserSettings { - laserMaxRange = 3000; // 4000 is max range of the laser in engine + laserMaxRange = LASER_MAX; // 4000 is max range of the laser in engine maxViewDistance = 6000; }; diff --git a/addons/markinglaser/CfgVehicles.hpp b/addons/markinglaser/CfgVehicles.hpp index 1e074ec322..4e9b3fd26c 100644 --- a/addons/markinglaser/CfgVehicles.hpp +++ b/addons/markinglaser/CfgVehicles.hpp @@ -1,5 +1,3 @@ -class CBA_Extended_EventHandlers_base; - class CfgVehicles { class AllVehicles; class Air: AllVehicles { @@ -10,8 +8,8 @@ class CfgVehicles { property = QGVAR(enabled); control = "Checkbox"; typeName = "BOOL"; - expression = QUOTE(_this setVariable [ARR_3('GVAR(enabled)',_value,true)]); - defaultValue = "(true)"; + expression = QUOTE(_this setVariable [ARR_3(QQGVAR(enabled),_value,true)]); + defaultValue = "true"; condition = "objectVehicle"; }; }; diff --git a/addons/markinglaser/XEH_postInit.sqf b/addons/markinglaser/XEH_postInit.sqf index 8115cf307c..ad7a1aed34 100644 --- a/addons/markinglaser/XEH_postInit.sqf +++ b/addons/markinglaser/XEH_postInit.sqf @@ -2,19 +2,22 @@ #include "\a3\ui_f\hpp\defineDIKCodes.inc" // Events -[QGVAR(laserOn), FUNC(onLaserOn)] call CBA_fnc_addEventHandler; -[QGVAR(laserOff), FUNC(onLaserOff)] call CBA_fnc_addEventHandler; +[QGVAR(laserOn), LINKFUNC(onLaserOn)] call CBA_fnc_addEventHandler; +[QGVAR(laserOff), LINKFUNC(onLaserOff)] call CBA_fnc_addEventHandler; // Keybinds -["ACE3 Vehicles", QGVAR(toggleLaser), localize LSTRING(ToggleLaser), { +["ACE3 Vehicles", QGVAR(toggleLaser), LLSTRING(ToggleLaser), { + // Ignore when in Zeus + if (!isNull curatorCamera) exitWith {}; + private _vehicle = cameraOn; if !(_vehicle getVariable [QGVAR(enabled), false]) exitWith {false}; - private _controlledUnit = [ACE_player, ACE_controlledUAV#1] select unitIsUAV _vehicle; + private _controlledUnit = [ACE_player, ACE_controlledUAV # 1] select (unitIsUAV _vehicle); private _canTurnOn = if (_vehicle getVariable [QGVAR(useTurret), false]) then { private _turretInfo = _vehicle getVariable [QGVAR(turretInfo), []]; - _controlledUnit == _vehicle turretUnit _turretInfo#0 + _controlledUnit == _vehicle turretUnit _turretInfo # 0 } else { _controlledUnit == driver _vehicle }; diff --git a/addons/markinglaser/XEH_preInit.sqf b/addons/markinglaser/XEH_preInit.sqf index bed26415e8..12c8e370b3 100644 --- a/addons/markinglaser/XEH_preInit.sqf +++ b/addons/markinglaser/XEH_preInit.sqf @@ -6,7 +6,7 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; -#include "initSettings.sqf" +#include "initSettings.inc.sqf" GVAR(lasers) = []; GVAR(localLasers) = []; diff --git a/addons/markinglaser/functions/fnc_findTurret.sqf b/addons/markinglaser/functions/fnc_findTurret.sqf index 00868e2e53..b92fdbd225 100644 --- a/addons/markinglaser/functions/fnc_findTurret.sqf +++ b/addons/markinglaser/functions/fnc_findTurret.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Finds the turret that has control over the marking laser. @@ -34,7 +34,7 @@ private _walkTurrets = { // Check if turret has a optics with night or thermal vision private _visionModes = flatten (("true" configClasses (_x >> "OpticsIn")) apply { - (getArray (_x >> "visionMode")) apply {toLower _x} + (getArray (_x >> "visionMode")) apply {toLowerANSI _x} }); if !("nvg" in _visionModes || {"ti" in _visionModes}) then { diff --git a/addons/markinglaser/functions/fnc_getPilotCamVector.sqf b/addons/markinglaser/functions/fnc_getPilotCamVector.sqf index 16bfd29d66..6b57f1fbd4 100644 --- a/addons/markinglaser/functions/fnc_getPilotCamVector.sqf +++ b/addons/markinglaser/functions/fnc_getPilotCamVector.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Calculates the directional vector of a pilot camera mounted marking laser. diff --git a/addons/markinglaser/functions/fnc_getTurretVector.sqf b/addons/markinglaser/functions/fnc_getTurretVector.sqf index 84fe13398b..27ded490ee 100644 --- a/addons/markinglaser/functions/fnc_getTurretVector.sqf +++ b/addons/markinglaser/functions/fnc_getTurretVector.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Calculates the directional vector of a turret mounted marking laser. @@ -21,7 +21,7 @@ private _turretInfo = _aircraft getVariable [QGVAR(turretInfo), []]; _turretInfo params ["_turretPath", "_animationSources", "_followFreeLook"]; private _controlledTurret = if (unitIsUAV cameraOn) then { - ACE_controlledUAV#2 + ACE_controlledUAV # 2 } else { cameraOn unitTurret ACE_player }; @@ -31,8 +31,8 @@ if ((cameraOn == _aircraft) && {(_followFreeLook && {cameraView == "INTERNAL"}) (AGLToASL positionCameraToWorld [0, 0, 0]) vectorFromTo (AGLToASL positionCameraToWorld [0, 0, 1]) } else { // Get turret dir through animation source - private _angleBody = -deg(_aircraft animationPhase _animationSources#0); - private _angleGun = deg(_aircraft animationPhase _animationSources#1); + private _angleBody = -deg (_aircraft animationPhase _animationSources # 0); + private _angleGun = deg (_aircraft animationPhase _animationSources # 1); _aircraft vectorModelToWorld ([1, _angleBody, _angleGun] call CBA_fnc_polar2vect) }; diff --git a/addons/markinglaser/functions/fnc_onAircraftInit.sqf b/addons/markinglaser/functions/fnc_onAircraftInit.sqf index ff5f7b522a..d786c477c8 100644 --- a/addons/markinglaser/functions/fnc_onAircraftInit.sqf +++ b/addons/markinglaser/functions/fnc_onAircraftInit.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Equips an aircraft with a marking laser. diff --git a/addons/markinglaser/functions/fnc_onLaserOff.sqf b/addons/markinglaser/functions/fnc_onLaserOff.sqf index 9ce9902511..8565fa6eb7 100644 --- a/addons/markinglaser/functions/fnc_onLaserOff.sqf +++ b/addons/markinglaser/functions/fnc_onLaserOff.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Handles a plane turning its marking laser on. diff --git a/addons/markinglaser/functions/fnc_onLaserOn.sqf b/addons/markinglaser/functions/fnc_onLaserOn.sqf index 2fd1a3d796..8a8ad2d277 100644 --- a/addons/markinglaser/functions/fnc_onLaserOn.sqf +++ b/addons/markinglaser/functions/fnc_onLaserOn.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Handles a plane turning its marking laser off. @@ -19,14 +19,14 @@ params ["_aircraft"]; // Start PFHs if this is the first laser if (local _aircraft && {GVAR(updatePFH) == -1}) then { - GVAR(updatePFH) = [FUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler; + GVAR(updatePFH) = [LINKFUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler; // Make sure update is called before first render [] call FUNC(updatePFH); }; if (hasInterface && {GVAR(renderPFH) == -1}) then { - GVAR(renderPFH) = [FUNC(renderPFH), 0, []] call CBA_fnc_addPerFrameHandler; + GVAR(renderPFH) = [LINKFUNC(renderPFH), 0, []] call CBA_fnc_addPerFrameHandler; }; GVAR(lasers) pushBack _aircraft; diff --git a/addons/markinglaser/functions/fnc_renderPFH.sqf b/addons/markinglaser/functions/fnc_renderPFH.sqf index a408a1eb0e..8ffe61f677 100644 --- a/addons/markinglaser/functions/fnc_renderPFH.sqf +++ b/addons/markinglaser/functions/fnc_renderPFH.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Renders all marking lasers. @@ -18,7 +18,7 @@ if (GVAR(lasers) isEqualTo []) exitWith {}; #ifndef DEBUG_MODE_FULL -private _controlledUnit = [ACE_player, ACE_controlledUAV#1] select unitIsUAV cameraOn; +private _controlledUnit = [ACE_player, ACE_controlledUAV # 1] select (unitIsUAV cameraOn); if (currentVisionMode _controlledUnit != 1 && { (!isNull curatorCamera) && { (_curator getVariable ["BIS_fnc_curatorVisionModes_current", 0]) != 0 @@ -41,12 +41,12 @@ if (currentVisionMode _controlledUnit != 1 && { // 0.1 is added to calculated values, seems to be slightly inaccurate _gimbalLimits params ["_minDir", "_maxDir", "_minElev", "_maxElev"]; private _modelVector = _aircraft vectorWorldToModelVisual _vector; - private _dir = _modelVector#0 atan2 _modelVector#1; + private _dir = _modelVector # 0 atan2 _modelVector # 1; if (_dir < _minDir - 0.1 || {_dir > _maxDir + 0.1}) then { continue; }; - private _elevation = _modelVector#2 atan2 vectorMagnitude [_modelVector#0, _modelVector#1, 0]; + private _elevation = _modelVector # 2 atan2 vectorMagnitude [_modelVector # 0, _modelVector # 1, 0]; if (_elevation < _minElev - 0.1 || {_elevation > _maxElev + 0.1}) then { continue; }; diff --git a/addons/markinglaser/functions/fnc_updatePFH.sqf b/addons/markinglaser/functions/fnc_updatePFH.sqf index 27f2436139..7f4f108640 100644 --- a/addons/markinglaser/functions/fnc_updatePFH.sqf +++ b/addons/markinglaser/functions/fnc_updatePFH.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: BaerMitUmlaut * Sends network updates for all local marking lasers. diff --git a/addons/markinglaser/functions/script_component.hpp b/addons/markinglaser/functions/script_component.hpp deleted file mode 100644 index e9b5b9b1d7..0000000000 --- a/addons/markinglaser/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\markinglaser\script_component.hpp" diff --git a/addons/markinglaser/initSettings.sqf b/addons/markinglaser/initSettings.inc.sqf similarity index 95% rename from addons/markinglaser/initSettings.sqf rename to addons/markinglaser/initSettings.inc.sqf index 52ae1e4e18..7d63081fb3 100644 --- a/addons/markinglaser/initSettings.sqf +++ b/addons/markinglaser/initSettings.inc.sqf @@ -4,5 +4,5 @@ [LSTRING(Setting_Enabled_DisplayName), LSTRING(Setting_Enabled_Description)], ELSTRING(common,ACEKeybindCategoryVehicles), true, - true + 1 ] call CBA_fnc_addSetting;