diff --git a/addons/radiodirectionfinder/CfgVehicles.hpp b/addons/radiodirectionfinder/CfgVehicles.hpp index 4db3d14549..019802c252 100644 --- a/addons/radiodirectionfinder/CfgVehicles.hpp +++ b/addons/radiodirectionfinder/CfgVehicles.hpp @@ -6,7 +6,7 @@ class CfgVehicles { class GVAR(backpack): Bag_Base { scope = 2; displayName = "PRD-13 Radio Direction Finder"; - author = "PabstMirror"; + author = ECSTRING(common,aceteam); model = "z\ace\addons\radiodirectionfinder\data\ace_antennaBackpack"; maximumLoad = 50; mass = 100; @@ -16,14 +16,14 @@ class CfgVehicles { class Items_base_F; class ACE_transmitter_base: Items_base_F { class EventHandlers { - class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; + class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; // enable XEH }; author = ECSTRING(common,aceteam); model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; scope = 1; }; class ACE_transmitter_406MHz: ACE_transmitter_base { - displayName = "Transmitter 406MHz"; + displayName = "[ACE] Transmitter 406MHz"; GVAR(freq) = 406; GVAR(power) = 5000; }; @@ -33,16 +33,14 @@ class CfgVehicles { class CAManBase: Man { class ACE_SelfActions { class ACE_Equipment { - class GVAR(open) { - //Opens the dialog + class GVAR(open) { // Opens the dialog // displayName = CSTRING(configure); - displayName = "open"; + displayName = "RDF: Open"; condition = QUOTE(_player call FUNC(displayCondition)); - statement = QUOTE([DISPLAY_MODE_DIALOG] call FUNC(toggleDisplayMode)); + statement = QUOTE([ARR_2(FUNC(toggleDisplayMode),[DISPLAY_MODE_DIALOG])] call CBA_fnc_execNextFrame); // icon = QPATHTOF(UI\icon_android.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; - class GVAR(show) { - //Opens the mini map + class GVAR(show) { // Opens the display // displayName = CSTRING(show); displayName = "Show"; condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY); diff --git a/addons/radiodirectionfinder/CfgWeapons.hpp b/addons/radiodirectionfinder/CfgWeapons.hpp index 024559c22b..d0da623c02 100644 --- a/addons/radiodirectionfinder/CfgWeapons.hpp +++ b/addons/radiodirectionfinder/CfgWeapons.hpp @@ -3,16 +3,16 @@ class CfgWeapons { class CBA_MiscItem_ItemInfo; class ACE_TransmitterItem_406MHz: ACE_ItemCore { - ACE_attachable = "ACE_transmitter_406MHz"; + ACE_attachable = "ACE_transmitter_406MHz"; // the CfgVehicle author = ECSTRING(common,ACETeam); scope = 2; // displayName = CSTRING(IrStrobe_Name); - displayName = "406MHz Locator Bacon"; + displayName = "[ACE] 406MHz Locator Bacon"; // descriptionShort = CSTRING(IrStrobe_Description); + descriptionShort = "Attach to activate"; // model = QPATHTOF(data\x.p3d); model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; // picture = QPATHTOF(UI\irstrobe_item.paa); - class ItemInfo: CBA_MiscItem_ItemInfo { mass = 1; }; diff --git a/addons/radiodirectionfinder/GUI.hpp b/addons/radiodirectionfinder/GUI.hpp index eb753a0c02..e8a9ea7a33 100644 --- a/addons/radiodirectionfinder/GUI.hpp +++ b/addons/radiodirectionfinder/GUI.hpp @@ -50,15 +50,13 @@ class GVAR(dialog) { fadein = 0; fadeout = 0; onLoad = QUOTE(with uiNamespace do {GVAR(dialog) = _this select 0;};); - // onUnload = QUOTE(call FUNC()); class objects { class GVAR(MapGpsDisplay): RscObject { - // show = 0; idc = IDC_OBJECT_SCREEN; type = 82; model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d); // useGlobalLight = 1; - // minGlobalLightIntensity = -100; + // minGlobalLightIntensity = -100; // can't find any doc on this, seems to apply sun effects, but is too much /* 1.000 - normal model memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br" @@ -106,12 +104,9 @@ class RscTitles { class controls {}; class objects { class GVAR(MapGpsDisplay): RscObject { - // show = 0; idc = IDC_OBJECT_SCREEN; type = 82; model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d); - // useGlobalLight = 1; - // minGlobalLightIntensity = -100; /* 1.000 - normal model memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br" diff --git a/addons/radiodirectionfinder/XEH_postInit.sqf b/addons/radiodirectionfinder/XEH_postInit.sqf index 0152bb2e57..fe855a1d34 100644 --- a/addons/radiodirectionfinder/XEH_postInit.sqf +++ b/addons/radiodirectionfinder/XEH_postInit.sqf @@ -1,13 +1,14 @@ #include "script_component.hpp" -// debug -["Q", "Q", "Q", { - systemChat "Q RECOMPILE"; - [] call ACE_PREP_RECOMPILE; - [-1] call FUNC(toggleDisplayMode); - false -}, {false}, [0x10, [false, false, false]], false] call CBA_fnc_addKeybind; // Q Key - +["ace_settingsInitialized", { + TRACE_2("ace_settingsInitialized",GVAR(showUAV),GVAR(showACRE)); + if (GVAR(showUAV)) then { + GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsUAV); + }; + if ((isClass (configFile >> "CfgPatches" >> "acre_sys_core")) && GVAR(showACRE)) then { + GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsACRE); + }; +}] call CBA_fnc_addEventHandler; if (isServer) then { ["ACE_transmitter_base", "init", FUNC(beaconInit), true, [], true] call CBA_fnc_addClassEventHandler; @@ -19,6 +20,7 @@ if (isServer) then { _uav setVariable [QGVAR(freqMhz), _randomFreq, true]; }] call CBA_fnc_addEventHandler; }; + if (!hasInterface) exitWith {}; GVAR(currentShowMode) = 0; @@ -37,3 +39,16 @@ private _closeCode = { }; // [(localize LSTRING(itemName)), QPATHTOF(images\x_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); ["RDF", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); + + +#ifdef DEBUG_MODE_FULL +["Q", "Q", "Q", { + systemChat "Q RECOMPILE"; + [] call ACE_PREP_RECOMPILE; + [-1] call FUNC(toggleDisplayMode); + false +}, {false}, [0x10, [false, false, false]], false] call CBA_fnc_addKeybind; // Q Key + + + +#endif diff --git a/addons/radiodirectionfinder/XEH_preInit.sqf b/addons/radiodirectionfinder/XEH_preInit.sqf index 0e961abf71..c7c64b654b 100644 --- a/addons/radiodirectionfinder/XEH_preInit.sqf +++ b/addons/radiodirectionfinder/XEH_preInit.sqf @@ -6,8 +6,9 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + // Semi-public var: -GVAR(signalSourceFuncs) = [FUNC(getSignalsScripted), FUNC(getSignalsUAV)]; -if (isClass (configFile >> "CfgPatches" >> "acre_sys_core")) then { GVAR(signalSourceFuncs) pushBack FUNC(getSignalsACRE); }; +GVAR(signalSourceFuncs) = [LINKFUNC(getSignalsScripted)]; ADDON = true; diff --git a/addons/radiodirectionfinder/functions/fnc_addSignal.sqf b/addons/radiodirectionfinder/functions/fnc_addSignal.sqf index a27b388ed1..8b83d49b48 100644 --- a/addons/radiodirectionfinder/functions/fnc_addSignal.sqf +++ b/addons/radiodirectionfinder/functions/fnc_addSignal.sqf @@ -1,18 +1,20 @@ #include "script_component.hpp" /* * Author: PabstMirror - * + * Adds a scripted signal * * Arguments: - * 0: + * 0: Source or + * 1: Frequency + * 2: Power * * Return Value: * None * * Example: - * [] call ace_radiodirectionfinder_fnc_addSignal + * [player, 2400, 50] call ace_radiodirectionfinder_fnc_addSignal * - * Public: No + * Public: Yes */ if (!isServer) exitWith {}; diff --git a/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf b/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf index 162a868bbf..d5f9d62eab 100644 --- a/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf +++ b/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * + * (Server Only) * * Arguments: * None @@ -20,16 +20,13 @@ TRACE_1("beaconCleanup",_this); [{ private _removed = false; private _list = missionNamespace getVariable [QGVAR(signalList), []]; - _list = _list select { + private _countStart = count _list; + _list = _list select { // select if array or alive or just not-null (if not a transmitter) _x params ["_obj"]; - if ((_obj isEqualType []) || {alive _obj} || {!isNull _obj && {!(_obj isKindOf "ACE_transmitter_base")}}) then { - true - } else { - _removed = true; - false - }; + (_obj isEqualType []) || {alive _obj} || {(!isNull _obj) && {!(_obj isKindOf "ACE_transmitter_base")}} }; - TRACE_1("",_removed); - if (!_removed) exitWith {}; - missionNamespace setVariable [QGVAR(signalList), _list, true]; -}, []] call CBA_fnc_execNextFrame; + TRACE_2("",_countStart,count _list); + if (_countStart != count _list) then { + missionNamespace setVariable [QGVAR(signalList), _list, true]; + }; +}, []] call CBA_fnc_execNextFrame; // delay a frame because deletedEH is weird diff --git a/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf b/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf index 523feb4487..fd60ca4288 100644 --- a/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf +++ b/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf @@ -17,13 +17,13 @@ params ["_beacon"]; -if (!alive _beacon) exitWith { TRACE_1("dead",_this); }; +if (!alive _beacon) exitWith { TRACE_1("beaconInit - dead",_this); }; private _typeOf = typeOf _beacon; -private _freqMHz = getNumber (configFile >> "CfgVehicles" >> QGVAR(freq)); -private _powerMW = getNumber (configFile >> "CfgVehicles" >> QGVAR(power)); -TRACE_4("beaconInit - new",_beacon,_typeOf,_freqMHz,_powerMW); +private _freqMHz = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(freq)); +private _powerMW = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(power)); +TRACE_4("beaconInit",_beacon,_typeOf,_freqMHz,_powerMW); -[_beacon, 444, 55] call FUNC(addSignal); +[_beacon, _freqMHz, _powerMW] call FUNC(addSignal); _beacon addEventHandler ["Killed", {call FUNC(beaconCleanup)}]; _beacon addEventHandler ["Deleted", {call FUNC(beaconCleanup)}]; diff --git a/addons/radiodirectionfinder/functions/fnc_createGUI.sqf b/addons/radiodirectionfinder/functions/fnc_createGUI.sqf index e400985d8c..d7fd4d76e1 100644 --- a/addons/radiodirectionfinder/functions/fnc_createGUI.sqf +++ b/addons/radiodirectionfinder/functions/fnc_createGUI.sqf @@ -104,7 +104,7 @@ for "_i" from 0 to 9 do { _display setVariable [QGVAR(lines), _lines]; private _ctrlText = _display ctrlCreate [QGVAR(structuredText), IDC_MODE1_SCAN_INFO_TEXT, _ctrlModeGroup1]; -_ctrlText ctrlSetPosition [0,_circleY+_circleH/4,1-_circleW,_circleH/2]; +_ctrlText ctrlSetPosition [0, _circleY+_circleH/4, 1 - 0.95*_circleW, _circleH/2]; _ctrlText ctrlCommit 0; // _ctrlText ctrlSetBackgroundColor [0.1,0.1,0.1,0.5]; diff --git a/addons/radiodirectionfinder/functions/fnc_getSignals.sqf b/addons/radiodirectionfinder/functions/fnc_getSignals.sqf index 9e28a6735f..1af0530f90 100644 --- a/addons/radiodirectionfinder/functions/fnc_getSignals.sqf +++ b/addons/radiodirectionfinder/functions/fnc_getSignals.sqf @@ -20,7 +20,7 @@ params ["_positionASL", "_targetFreq", "_maxSignals"]; // semi-cached (Run though only a single source func each tick, then process all at end) if (GVAR(signalStage) < count GVAR(signalSourceFuncs)) then { [GVAR(signalsAccumulator)] call (GVAR(signalSourceFuncs) select GVAR(signalStage)); - TRACE_2("tick",GVAR(signalsAccumulator),GVAR(signalStage)); + // TRACE_2("tick",GVAR(signalsAccumulator),GVAR(signalStage)); GVAR(signalStage) = GVAR(signalStage) + 1; } else { GVAR(signalStage) = 0; @@ -34,7 +34,7 @@ if (GVAR(signalStage) < count GVAR(signalSourceFuncs)) then { // for meters/MHz/miliwatts (ignoring antenna gain, terrain.....) private _rtx = (10 * log _powerMW) - (-27.55 + 20 * log _freqMhz + 20 * log _distance); - private _bearing = _positionASL getDir _xPosASL; + private _bearing = (_positionASL getDir _xPosASL) + 2 * sin (time * 6) + 2 * sin (time * 20); // add some drift GVAR(signalsLast) pushBack [_rtx, _freqMhz, _bearing]; #ifdef DEBUG_MODE_FULL diff --git a/addons/radiodirectionfinder/functions/fnc_getSignalsUAV.sqf b/addons/radiodirectionfinder/functions/fnc_getSignalsUAV.sqf index aa8edebf82..17a260496c 100644 --- a/addons/radiodirectionfinder/functions/fnc_getSignalsUAV.sqf +++ b/addons/radiodirectionfinder/functions/fnc_getSignalsUAV.sqf @@ -23,9 +23,13 @@ params ["_list"]; [QGVAR(getUavFreq), [_x]] call CBA_fnc_serverEvent; } else { _list pushBack [getPosASL _x, _freqMhz, 10000]; - private _unit = (UAVControl _x) param [0, objNull]; - if (alive _unit) then { - _list pushBack [getPosASL _unit, _freqMhz, 10000]; + private _unit1 = (UAVControl _x) param [0, objNull]; + if (alive _unit1) then { + _list pushBack [getPosASL _unit1, _freqMhz, 10000]; + }; + private _unit2 = (UAVControl _x) param [2, objNull]; + if (alive _unit2) then { + _list pushBack [getPosASL _unit2, _freqMhz, 10000]; }; }; } forEach allUnitsUAV; diff --git a/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf b/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf index c2dc0123f9..31ed958dfa 100644 --- a/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf +++ b/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf @@ -29,14 +29,14 @@ _display setVariable [QGVAR(currentShown), _currentShown]; _ctrlPhoneObject ctrlSetModelScale 0.5; -if (_currentShown == 0) then { +if (_currentShown <= 0) then { _ctrlPhoneObject ctrlShow false; false } else { _ctrlPhoneObject ctrlShow true; - private _xPos = linearConversion [0.9, 1, _currentShown, 0.35, 0.5, true]; + private _xPos = linearConversion [0.9, 1, _currentShown, 0.3, 0.5, true]; private _yPos = linearConversion [0.9, 1, _currentShown, 0.12, 0.08, true]; - private _zPos = linearConversion [0, 1, _currentShown, 1.25, 0.75] + linearConversion [0, 0.5, _currentShown, 0.25, 0, true]; + private _zPos = linearConversion [0, 1, _currentShown, 1.25, 0.75] + linearConversion [0, 0.1, _currentShown, 0.5, 0, true]; private _yAngle = linearConversion [0, 1, _currentShown, 30, 80] + linearConversion [0, 0.75, _currentShown, -30, 0, true]; // [xScreen, dist, yScreen] x/y extents are based on UI scaling _ctrlPhoneObject ctrlSetPosition [_xPos, _yPos, _zPos]; diff --git a/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf b/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf index 4b1448caac..7d99d491f2 100644 --- a/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf +++ b/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf @@ -28,14 +28,14 @@ _args params ["_deltaTime"]; _deltaTime = CBA_missionTime - _deltaTime; _args set [0, CBA_missionTime]; -private _canShow = [_unit, objNull, ["isNotSitting"]] call EFUNC(common,canInteractWith); +private _canShow = [_unit, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith); private _display = displayNull; private _shown = false; if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then { _display = uiNamespace getVariable [QGVAR(display), displayNull]; private _desiredPhase = if (_canShow && {cameraView != "GUNNER"} && {EGVAR(interact_menu,openedMenuType) < 0}) then { - if (weaponLowered _unit) then { 0.9 } else { 0.7 }; + if (weaponLowered _unit) then { 0.9 } else { 0.75 }; } else { 0 }; @@ -43,7 +43,7 @@ if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then { } else { _display = uiNamespace getVariable [QGVAR(dialog), displayNull]; if ((!_canShow) || {isNull _display}) exitWith { [DISPLAY_MODE_DISPLAY, 1] call FUNC(toggleDisplayMode); }; - _shown = [_display, 1, _deltaTime * 2] call FUNC(updateDisplayAnim); + _shown = [_display, 1, _deltaTime] call FUNC(updateDisplayAnim); }; if (!_shown) exitWith {}; diff --git a/addons/radiodirectionfinder/initSettings.sqf b/addons/radiodirectionfinder/initSettings.sqf new file mode 100644 index 0000000000..47969db40a --- /dev/null +++ b/addons/radiodirectionfinder/initSettings.sqf @@ -0,0 +1,23 @@ +// CBA Settings [ADDON: ace_radiodirectionfinder]: + +private _categoryArray = ["ACE Radiodirectionfinder"]; + +[ + QGVAR(showUAV), "CHECKBOX", + ["showUAV"], // [LSTRING(), LSTRING()], + _categoryArray, + true, // default value + true, // isGlobal + {[QGVAR(showUAV), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +if (isClass (configFile >> "CfgPatches" >> "acre_sys_core")) then { + [ + QGVAR(showACRE), "CHECKBOX", + ["showACRE"], // [LSTRING(), LSTRING()], + _categoryArray, + false, // default value + true, // isGlobal + {[QGVAR(showACRE), _this] call EFUNC(common,cbaSettings_settingChanged)} + ] call CBA_settings_fnc_init; +}; diff --git a/addons/radiodirectionfinder/script_component.hpp b/addons/radiodirectionfinder/script_component.hpp index f0a46b4614..4c12694238 100644 --- a/addons/radiodirectionfinder/script_component.hpp +++ b/addons/radiodirectionfinder/script_component.hpp @@ -2,9 +2,9 @@ #define COMPONENT_BEAUTIFIED RadioDirectionFinder #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL -#define DISABLE_COMPILE_CACHE -#define ENABLE_PERFORMANCE_COUNTERS +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define ENABLE_PERFORMANCE_COUNTERS #include "\z\ace\addons\main\script_macros.hpp"