diff --git a/addons/apl/data/Jezek_kov.rvmat b/addons/apl/data/Jezek_kov.rvmat new file mode 100644 index 0000000000..d2133e6b5a --- /dev/null +++ b/addons/apl/data/Jezek_kov.rvmat @@ -0,0 +1,79 @@ +ambient[]={1.000000,1.000000,1.000000,1.000000}; +diffuse[]={1.000000,1.000000,1.000000,1.000000}; +forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; +emmisive[]={0.000000,0.000000,0.000000,1.000000}; +specular[]={1.000000,1.000000,1.000000,1.000000}; +specularPower=83.900002; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 { + texture="z\ace\addons\apl\data\jezek_texture_NOHQ.tga"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource="tex"; + class uvTransform + { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage5 { + texture="z\ace\addons\apl\data\jezek_texture_SMDI.tga"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage6 { + texture="#(ai,32,128,1)fresnel(1.85,0.64)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; diff --git a/addons/apl/data/barbwire_a_co.paa b/addons/apl/data/barbwire_a_co.paa new file mode 100644 index 0000000000..1809c2c08e Binary files /dev/null and b/addons/apl/data/barbwire_a_co.paa differ diff --git a/addons/apl/data/barbwire_a_nohq.paa b/addons/apl/data/barbwire_a_nohq.paa new file mode 100644 index 0000000000..5612dc460a Binary files /dev/null and b/addons/apl/data/barbwire_a_nohq.paa differ diff --git a/addons/apl/data/barbwire_a_ns.rvmat b/addons/apl/data/barbwire_a_ns.rvmat new file mode 100644 index 0000000000..0a6ad7c316 --- /dev/null +++ b/addons/apl/data/barbwire_a_ns.rvmat @@ -0,0 +1,78 @@ +ambient[]={1.000000,1.000000,1.000000,1.000000}; +diffuse[]={1.000000,1.000000,1.000000,1.000000}; +forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; +emmisive[]={0.000000,0.000000,0.000000,1.000000}; +specular[]={1.000000,1.000000,1.000000,0.000000}; +specularPower=16.000000; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 { + texture="z\ace\addons\apl\data\BarbWire_A_NOHQ.tga"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage5 { + texture="#(argb,8,8,3)color(0,0,1,1,SMDI)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage6 { + texture="#(ai,32,128,1)fresnel(0.01,0.01)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage7 { + texture="#(argb,8,8,3)color(0,0,0,1,CO)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; diff --git a/addons/apl/data/glass_House.bisurf b/addons/apl/data/glass_House.bisurf new file mode 100644 index 0000000000..b8b91bb2a6 --- /dev/null +++ b/addons/apl/data/glass_House.bisurf @@ -0,0 +1,10 @@ +Density=2400; +rough=0; +dust=0; +bulletPenetrability=50; +soundEnviron=Empty; +isWater=false; +friction=0.1; +restitution=0.1; +impact = Hit_Glass; +soundHit = glass; \ No newline at end of file diff --git a/addons/apl/data/glass_house.rvmat b/addons/apl/data/glass_house.rvmat index db033f6cd1..004fd8c6e5 100644 Binary files a/addons/apl/data/glass_house.rvmat and b/addons/apl/data/glass_house.rvmat differ diff --git a/addons/apl/data/jezek_texture_co.paa b/addons/apl/data/jezek_texture_co.paa new file mode 100644 index 0000000000..7b2e16d0e7 Binary files /dev/null and b/addons/apl/data/jezek_texture_co.paa differ diff --git a/addons/apl/data/jezek_texture_nohq.paa b/addons/apl/data/jezek_texture_nohq.paa new file mode 100644 index 0000000000..6a34328e5f Binary files /dev/null and b/addons/apl/data/jezek_texture_nohq.paa differ diff --git a/addons/apl/data/jezek_texture_smdi.paa b/addons/apl/data/jezek_texture_smdi.paa new file mode 100644 index 0000000000..415d98a09f Binary files /dev/null and b/addons/apl/data/jezek_texture_smdi.paa differ diff --git a/addons/apl/data/plastic.bisurf b/addons/apl/data/plastic.bisurf new file mode 100644 index 0000000000..84984886ec --- /dev/null +++ b/addons/apl/data/plastic.bisurf @@ -0,0 +1,10 @@ +Density=1380; +rough=0.1; +dust=0; +bulletPenetrability=150; +soundEnviron=Empty; +isWater=false; +friction=0.7; +restitution=0.3; +impact = default_Mat; +soundHit = plastic; \ No newline at end of file diff --git a/addons/apl/data/plastic.rvmat b/addons/apl/data/plastic.rvmat index ba54cd9164..6cf20f3d7f 100644 Binary files a/addons/apl/data/plastic.rvmat and b/addons/apl/data/plastic.rvmat differ diff --git a/addons/atragmx/initKeybinds.sqf b/addons/atragmx/initKeybinds.sqf index a000a106f4..730ec4daed 100644 --- a/addons/atragmx/initKeybinds.sqf +++ b/addons/atragmx/initKeybinds.sqf @@ -1,7 +1,7 @@ ["ACE3 Equipment", QGVAR(ATragMXDialogKey), localize LSTRING(ATragMXDialogKey), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (GVAR(active)) exitWith { closeDialog 0; false diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ff79bca2ff..6d0a3d67b1 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -3,6 +3,27 @@ //IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent"); +//Singe PFEH to handle execNextFrame and waitAndExec: +[{ + private ["_entry"]; + + //Handle the waitAndExec array: + while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do { + _entry = GVAR(waitAndExecArray) deleteAt 0; + (_entry select 2) call (_entry select 1); + }; + + //Handle the execNextFrame array: + { + (_x select 0) call (_x select 1); + } forEach GVAR(nextFrameBufferA); + //Swap double-buffer: + GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); + GVAR(nextFrameBufferB) = []; + GVAR(nextFrameNo) = diag_frameno + 1; +}, 0, []] call CBA_fnc_addPerFrameHandler; + + // Listens for global "SettingChanged" events, to update the force status locally ["SettingChanged", { PARAMS_2(_name,_value); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 4d93705898..d16f4878be 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -287,7 +287,12 @@ PREP(_handleRequestSyncedEvent); PREP(_handleRequestAllSyncedEvents); GVAR(syncedEvents) = HASH_CREATE; + +//GVARS for execNextFrame and waitAndExec GVAR(waitAndExecArray) = []; +GVAR(nextFrameNo) = diag_frameno; +GVAR(nextFrameBufferA) = []; +GVAR(nextFrameBufferB) = []; // @TODO: Generic local-managed global-synced objects (createVehicleLocal) diff --git a/addons/common/functions/fnc_execNextFrame.sqf b/addons/common/functions/fnc_execNextFrame.sqf index 39fef16519..ddd36be073 100644 --- a/addons/common/functions/fnc_execNextFrame.sqf +++ b/addons/common/functions/fnc_execNextFrame.sqf @@ -14,21 +14,8 @@ PARAMS_2(_func,_params); -[ - { - EXPLODE_2_PVT(_this,_params,_pfhId); - EXPLODE_2_PVT(_params,_delayedExecParams,_startFrame); - EXPLODE_2_PVT(_delayedExecParams,_func,_funcParams); - - // Exit if we are still on the same frame - if (diag_frameno == _startFrame) exitWith {}; - - // Remove the PFH - [_pfhId] call cba_fnc_removePerFrameHandler; - - // Execute the function - _funcParams call _func; - }, - 0, - [_this, diag_frameno] -] call CBA_fnc_addPerFrameHandler +if (diag_frameno != GVAR(nextFrameNo)) then { + GVAR(nextFrameBufferA) pushBack [_params, _func]; +} else { + GVAR(nextFrameBufferB) pushBack [_params, _func]; +}; diff --git a/addons/common/functions/fnc_waitAndExecute.sqf b/addons/common/functions/fnc_waitAndExecute.sqf index f7318ac1c8..977e4f146d 100644 --- a/addons/common/functions/fnc_waitAndExecute.sqf +++ b/addons/common/functions/fnc_waitAndExecute.sqf @@ -22,16 +22,3 @@ PARAMS_3(_func,_params,_delay); GVAR(waitAndExecArray) pushBack [(ACE_time + _delay), _func, _params]; GVAR(waitAndExecArray) sort true; - -if ((count GVAR(waitAndExecArray)) == 1) then { - [{ - while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do { - private ["_entry"]; - _entry = GVAR(waitAndExecArray) deleteAt 0; - (_entry select 2) call (_entry select 1); - }; - if ((count GVAR(waitAndExecArray)) == 0) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - }, 0, []] call CBA_fnc_addPerFrameHandler; -}; diff --git a/addons/concertina_wire/$PBOPREFIX$ b/addons/concertina_wire/$PBOPREFIX$ new file mode 100644 index 0000000000..0ca718ad15 --- /dev/null +++ b/addons/concertina_wire/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\concertina_wire \ No newline at end of file diff --git a/addons/concertina_wire/CfgEventHandlers.hpp b/addons/concertina_wire/CfgEventHandlers.hpp new file mode 100644 index 0000000000..026afb4e2d --- /dev/null +++ b/addons/concertina_wire/CfgEventHandlers.hpp @@ -0,0 +1,44 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; +}; + +class Extended_Killed_EventHandlers { + // TODO: Probably needs handledamage eh for better tracking what killed the wire + // Also disallow wire becoming destroyed by small explosives e.g. 40mm + class ACE_ConcertinaWire { + class ADDON { + killed = QUOTE(call FUNC(handleKilled)); + }; + }; + class Land_Razorwire_F { + class ADDON { + killed = QUOTE(call FUNC(handleKilled)); + }; + }; +}; + +class Extended_Init_EventHandlers { + class ACE_ConcertinaWireCoil { + class ADDON { + init = QUOTE(_this call DEFUNC(dragging,initObject)); + }; + }; + class ACE_ConcertinaWire { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_init)); + }; + }; + class Land_Razorwire_F { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_init)); + }; + }; +}; diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp new file mode 100644 index 0000000000..2592bf5b77 --- /dev/null +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -0,0 +1,139 @@ + +class CfgVehicles { + class Fence; + class thingX; + class NonStrategic; + + class ACE_ConcertinaWireNoGeo: Fence { + XEH_ENABLED; + scope = 1; + displayName = ""; + model = PATHTOF(data\ACE_ConcertinaWireNoGeo.p3d); + destrType = "DestructTent"; + accuracy = 0.3; + mapSize = 2.8; + animated = 1; + autocenter = 0; + armor = 200; + class AnimationSources { + class fix1 { + source = "user"; + animPeriod = 1e-007; + initPhase = 0; + }; + class fix2: fix1 {}; + class fix3: fix1 {}; + class fix4: fix1 {}; + class rotate { + source = "user"; + animPeriod = 1e-007; + }; + class wire_2 { + source = "user"; + animPeriod = 1e-007; + }; + class wire_3: wire_2{}; + class wire_4: wire_2{}; + class wire_5: wire_2{}; + class wire_6: wire_2{}; + class wire_7: wire_2{}; + class wire_8: wire_2{}; + class wire_9: wire_2{}; + class wire_10: wire_2{}; + class wire_11: wire_2{}; + class wire_12: wire_2{}; + class wire_13: wire_2{}; + class wire_14: wire_2{}; + class wire_15: wire_2{}; + class wire_16: wire_2{}; + class wire_17: wire_2{}; + class wire_18: wire_2{}; + + class wire_2_1: wire_2 { + animPeriod = 8; + }; + class wire_3_1: wire_2_1 {}; + class wire_4_1: wire_2_1 {}; + class wire_5_1: wire_2_1 {}; + class wire_6_1: wire_2_1 {}; + class wire_7_1: wire_2_1 {}; + class wire_8_1: wire_2_1 {}; + class wire_9_1: wire_2_1 {}; + class wire_10_1: wire_2_1 {}; + class wire_11_1: wire_2_1 {}; + class wire_12_1: wire_2_1 {}; + class wire_13_1: wire_2_1 {}; + class wire_14_1: wire_2_1 {}; + class wire_15_1: wire_2_1 {}; + class wire_16_1: wire_2_1 {}; + class wire_17_1: wire_2_1 {}; + class wire_18_1: wire_2_1 {}; + }; + }; + class ACE_ConcertinaWire: ACE_ConcertinaWireNoGeo { + scope = 2; + displayName = $STR_ACE_CONCERTINA_WIRE; + model = PATHTOF(data\ACE_ConcertinaWire.p3d); + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 5; + condition = "true"; + class ACE_Dismount { + selection = ""; + displayName = "$STR_ACE_UNROLLWIRE"; + distance = 5; + condition = "true"; + statement = QUOTE([ARR_2(_target,_player)] call FUNC(dismount)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + }; + class ACE_ConcertinaWireCoil: thingX { + XEH_ENABLED; + scope = 2; + displayName = $STR_ACE_CONCERTINA_WIRECOIL; + model = PATHTOF(data\ACE_ConcertinaWireCoil.p3d); + mapsize = 0.5; + animated = 0; + nameSound = "fence"; + typicalCargo[] = {}; + transportAmmo = 0; + transportRepair = 0; + transportFuel = 0; + cost = 0; + armor = 1000; + destrType = "DestructNo"; + accuracy = 1000; + autocenter = 0; + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition[]) = {0,0.5,0.5}; + EGVAR(dragging,dragDirection) = 0; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 4; + condition = "true"; + class ACE_Deploy { + selection = ""; + displayName = "$STR_ACE_ROLLWIRE"; + distance = 4; + condition = "true"; + statement = QUOTE([ARR_2(_target,_player)] call FUNC(deploy)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + }; + + class Land_Razorwire_F: NonStrategic { + XEH_ENABLED; + }; +}; diff --git a/addons/concertina_wire/README.md b/addons/concertina_wire/README.md new file mode 100644 index 0000000000..ab62458de9 --- /dev/null +++ b/addons/concertina_wire/README.md @@ -0,0 +1,10 @@ +ace_concertina_wire +=============== + +Adds concertina wire. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file diff --git a/addons/concertina_wire/UI/icon_sandbag_ca.paa b/addons/concertina_wire/UI/icon_sandbag_ca.paa new file mode 100644 index 0000000000..5d6ea6d4d9 Binary files /dev/null and b/addons/concertina_wire/UI/icon_sandbag_ca.paa differ diff --git a/addons/concertina_wire/XEH_init.sqf b/addons/concertina_wire/XEH_init.sqf new file mode 100644 index 0000000000..dbce4a9b92 --- /dev/null +++ b/addons/concertina_wire/XEH_init.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +PARAMS_1(_wire); +_wire addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; \ No newline at end of file diff --git a/addons/concertina_wire/XEH_postInit.sqf b/addons/concertina_wire/XEH_postInit.sqf new file mode 100644 index 0000000000..ff3b5c5167 --- /dev/null +++ b/addons/concertina_wire/XEH_postInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +GVAR(placer) = objNull; +GVAR(deployPFH) = -1; + +// Deploy concertina wire if interact menu is opened +["interactMenuOpened", { + if (GVAR(deployPFH) != -1) then { + GVAR(placer) setVariable [QGVAR(wireDeployed), true]; + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/concertina_wire/XEH_preInit.sqf b/addons/concertina_wire/XEH_preInit.sqf new file mode 100644 index 0000000000..f15feb48bd --- /dev/null +++ b/addons/concertina_wire/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(deploy); +PREP(dismount); +PREP(dismountSuccess); +PREP(handleDamage); +PREP(handleKilled); + +ADDON = true; diff --git a/addons/concertina_wire/config.cpp b/addons/concertina_wire/config.cpp new file mode 100644 index 0000000000..06b7bf5d86 --- /dev/null +++ b/addons/concertina_wire/config.cpp @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_ConcertinaWire", "ACE_ConcertinaWireNoGeo", "ACE_ConcertinaWireCoil"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_apl", "ace_interaction"}; + author[] = {"Rocko", "Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" \ No newline at end of file diff --git a/addons/concertina_wire/data/ACE_ConcertinaWire.p3d b/addons/concertina_wire/data/ACE_ConcertinaWire.p3d new file mode 100644 index 0000000000..3e1c9c881c Binary files /dev/null and b/addons/concertina_wire/data/ACE_ConcertinaWire.p3d differ diff --git a/addons/concertina_wire/data/ACE_ConcertinaWireCoil.p3d b/addons/concertina_wire/data/ACE_ConcertinaWireCoil.p3d new file mode 100644 index 0000000000..24f6ebf0fe Binary files /dev/null and b/addons/concertina_wire/data/ACE_ConcertinaWireCoil.p3d differ diff --git a/addons/concertina_wire/data/ACE_ConcertinaWireNoGeo.p3d b/addons/concertina_wire/data/ACE_ConcertinaWireNoGeo.p3d new file mode 100644 index 0000000000..3af6a40a15 Binary files /dev/null and b/addons/concertina_wire/data/ACE_ConcertinaWireNoGeo.p3d differ diff --git a/addons/concertina_wire/data/model.cfg b/addons/concertina_wire/data/model.cfg new file mode 100644 index 0000000000..20845cfacb --- /dev/null +++ b/addons/concertina_wire/data/model.cfg @@ -0,0 +1,290 @@ +class CfgSkeletons { + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; + class ACE_SB_Skeleton: Default {}; + class ACE_ConcertinaSkeleton { + isDiscrete = 0; + skeletonInherit = ""; + skeletonBones[] = { + "1","", + "2","1", + "3","2", + "4","3", + "5","4", + "6","5", + "7","6", + "8","7", + "9","8", + "10","9", + "11","10", + "12","11", + "13","12", + "14","13", + "15","14", + "16","15", + "17","16", + "18","17", + "fix1","", + "fix2","", + "fix3","", + "fix4","" + }; + }; + class ace_tacticalladder_skeleton: Default { + isDiscrete = 0; + skeletonInherit = ""; + skeletonBones[] = { + "base","", + "1","base", + "2","1", + "3","2", + "4","3", + "5","4", + "6","5", + "7","6", + "8","7", + "9","8", + "10","9", + "11","10", + "step","11" + }; + }; +}; + +class CfgModels { + class Default { + sectionsInherit=""; + sections[] = {""}; + skeletonName = ""; + }; + class ace_sandbag_build { + sectionsInherit = "Default"; + sections[] = {"zbytek"}; + skeletonName = "ACE_SB_Skeleton"; + }; + class ACE_ConcertinaWire { + skeletonName = "ACE_ConcertinaSkeleton"; + sections[] = {}; + sectionsInherit = ""; + class Animations { + class fix1 { + type="hide"; + source="user"; + selection="fix1"; + minValue = 0; + maxValue = 1; + minPhase = 0; + maxPhase = 1; + hideValue = 1; + }; + class fix2: fix1 { + selection="fix2"; + }; + class fix3: fix1 { + selection="fix3"; + }; + class fix4: fix1 { + selection="fix4"; + }; + class rotate { + type = "rotation"; + source = ""; + sourceAddress = "loop"; + selection = "1"; + axis = "rotate_axis"; + minValue = 0; + maxValue = 360; + + angle0="rad -360"; + angle1="rad +360"; + }; + class wire_2 { + type = "translation"; + source = ""; + selection = "2"; + axis = "2_axis"; + animPeriod = 0; + minValue = 0; + maxValue = 1; + minPhase = 0; + maxPhase = 1; + offset0 = 0; + offset1 = -1; + }; + class wire_3: wire_2 { + selection = "3"; axis = "3_axis"; + }; + class wire_4: wire_2 { + selection = "4"; axis = "4_axis"; + }; + class wire_5: wire_2 { + selection = "5"; axis = "5_axis"; + }; + class wire_6: wire_2 { + selection = "6"; axis = "6_axis"; + }; + class wire_7: wire_2 { + selection = "7"; axis = "7_axis"; + }; + class wire_8: wire_2 { + selection = "8"; axis = "8_axis"; + }; + class wire_9: wire_2 { + selection = "9"; axis = "9_axis"; + }; + class wire_10: wire_2 { + selection = "10"; axis = "10_axis"; + }; + class wire_11: wire_2 { + selection = "11"; axis = "11_axis"; + }; + class wire_12: wire_2 { + selection = "12"; axis = "12_axis"; + }; + class wire_13: wire_2 { + selection = "13"; axis = "13_axis"; + }; + class wire_14: wire_2 { + selection = "14"; axis = "14_axis"; + }; + class wire_15: wire_2 { + selection = "15"; axis = "15_axis"; + }; + class wire_16: wire_2 { + selection = "16"; axis = "16_axis"; + }; + class wire_17: wire_2 { + selection = "17"; axis = "17_axis"; + }; + class wire_18: wire_2 { + selection = "18"; axis = "18_axis"; + }; + class wire_2_1: wire_2 { + selection = "2";axis = "2_axis";offset1 = -1; + }; + class wire_3_1: wire_2_1 { + selection = "3"; axis = "3_axis"; + }; + class wire_4_1: wire_2_1 { + selection = "4"; axis = "4_axis"; + }; + class wire_5_1: wire_2_1 { + selection = "5"; axis = "5_axis"; + }; + class wire_6_1: wire_2_1 { + selection = "6"; axis = "6_axis"; + }; + class wire_7_1: wire_2_1 { + selection = "7"; axis = "7_axis"; + }; + class wire_8_1: wire_2_1 { + selection = "8"; axis = "8_axis"; + }; + class wire_9_1: wire_2_1 { + selection = "9"; axis = "9_axis"; + }; + class wire_10_1: wire_2_1 { + selection = "10"; axis = "10_axis"; + }; + class wire_11_1: wire_2_1 { + selection = "11"; axis = "11_axis"; + }; + class wire_12_1: wire_2_1 { + selection = "12"; axis = "12_axis"; + }; + class wire_13_1: wire_2_1 { + selection = "13"; axis = "13_axis"; + }; + class wire_14_1: wire_2_1 { + selection = "14"; axis = "14_axis"; + }; + class wire_15_1: wire_2_1 { + selection = "15"; axis = "15_axis"; + }; + class wire_16_1: wire_2_1 { + selection = "16"; axis = "16_axis"; + }; + class wire_17_1: wire_2_1 { + selection = "17"; axis = "17_axis"; + }; + class wire_18_1: wire_2_1 { + selection = "18"; axis = "18_axis"; + }; + }; + }; + class ACE_ConcertinaWireNoGeo: ACE_ConcertinaWire {}; + class ace_tacticalladder { + skeletonName = "ace_tacticalladder_skeleton"; + sections[] = { "roadway" }; + sectionsInherit = ""; + class Animations { + class rotate { + type = "rotation"; + source = ""; + sourceAddress = "clamp"; + selection = "base"; + axis = "axis_rotate"; + minValue = 0; + maxValue = 90; + angle0="rad 0"; + angle1="rad +90"; + }; + class extract_1 { + type = "translation"; + source = ""; + selection = "1"; + axis = "axis_1"; + animPeriod = 0; + minValue = 0; + maxValue = 1; + minPhase = 0; + maxPhase = 1; + offset0 = 0; + offset1 = 0.82; + }; + class extract_2: extract_1 { + selection = "2"; + axis = "axis_2"; + }; + class extract_3: extract_1 { + selection = "3"; + axis = "axis_3"; + }; + class extract_4: extract_1 { + selection = "4"; + axis = "axis_4"; + }; + class extract_5: extract_1 { + selection = "5"; + axis = "axis_5"; + }; + class extract_6: extract_1 { + selection = "6"; + axis = "axis_6"; + }; + class extract_7: extract_1 { + selection = "7"; + axis = "axis_7"; + }; + class extract_8: extract_1 { + selection = "8"; + axis = "axis_8"; + }; + class extract_9: extract_1 { + selection = "9"; + axis = "axis_9"; + }; + class extract_10: extract_1 { + selection = "10"; + axis = "axis_10"; + }; + class extract_11: extract_1 { + selection = "11"; + axis = "axis_11"; + }; + }; + }; +}; diff --git a/addons/concertina_wire/functions/fnc_deploy.sqf b/addons/concertina_wire/functions/fnc_deploy.sqf new file mode 100644 index 0000000000..c30e767266 --- /dev/null +++ b/addons/concertina_wire/functions/fnc_deploy.sqf @@ -0,0 +1,84 @@ +/* + * Author: Rocko, Ruthberg + * + * Deploys the concertina wire + * + * Arguments: + * 0: wire coil + * 1: unit + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_2(_wirecoil,_unit); + +private ["_wireNoGeo", "_dir", "_pos", "_wireNoGeoPos"]; + +_wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0]; +{ + _wireNoGeo animate [_x, 1]; +} foreach WIRE_FAST; + +GVAR(placer) = _unit; +_dir = getDir _unit; +_pos = getPosASL _unit; +_wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0]; + +_wireNoGeo setDir _dir; +_wireNoGeo setPosASL _wireNoGeoPos; + +deleteVehicle _wirecoil; + +_unit setVariable [QGVAR(wireDeployed), false]; + +GVAR(deployPFH) = [{ + EXPLODE_4_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit,_action); + + private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"]; + _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL); + _posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit); + _dirVect = _posStart vectorDiff _posEnd; + _dir = _dirVect call CBA_fnc_vectDir; + _range = vectorMagnitude _dirVect; + _anim = 0 max (1 - (_range / 12)); + + if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith { + _wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0]; + { + _wire animate [_x, _anim]; + } foreach WIRE_FAST; + + [{ + EXPLODE_5_PVT(_this select 0,_wireNoGeo,_wire,_anim,_dir,_wireNoGeoPos); + if (_wire animationPhase "wire_2" == _anim) then { + deleteVehicle _wireNoGeo; + _wire setDir _dir; + _wire setPosASL _wireNoGeoPos; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + }, 0, [_wireNoGeo, _wire, _anim, _dir, _wireNoGeoPos]] call CBA_fnc_addPerFrameHandler; + + [_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); + call EFUNC(interaction,hideMouseHint); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + _wireNoGeo setDir _dir; + { + _wireNoGeo animate [_x, _anim]; + } foreach WIRE_FAST; +}, 0, [_wireNoGeo, _wireNoGeoPos, _unit, _action]] call CBA_fnc_addPerFrameHandler; + +[localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint); + +GVAR(placer) setVariable [QGVAR(Deploy), + [GVAR(placer), "DefaultAction", + {GVAR(deployPFH) != -1}, + {GVAR(placer) setVariable [QGVAR(wireDeployed), true]} +] call EFUNC(common,AddActionEventHandler)]; diff --git a/addons/concertina_wire/functions/fnc_dismount.sqf b/addons/concertina_wire/functions/fnc_dismount.sqf new file mode 100644 index 0000000000..c9a5d1f9ff --- /dev/null +++ b/addons/concertina_wire/functions/fnc_dismount.sqf @@ -0,0 +1,41 @@ +/* + * Author: Ruthberg + * + * Start dismounting the concertina wire + * + * Arguments: + * 0: wire + * 1: unit + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +// If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine +if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { + [{ + _this call FUNC(dismount); + }, _this] call EFUNC(common,execNextFrame); +}; + +PARAMS_2(_wire,_unit); + +private ["_config", "_delay"]; +_config = (configFile >> "CfgVehicles" >> typeOf _unit); +_delay = if (getNumber(_config >> "engineer") == 1 || getNumber(_config >> "canDeactivateMines") == 1) then {60} else {120}; + +// TODO: Animation? + +[ + _delay, + [_wire], + {(_this select 0) call FUNC(dismountSuccess)}, + {}, + localize "STR_ACE_UNROLLWIRE", + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/concertina_wire/functions/fnc_dismountSuccess.sqf b/addons/concertina_wire/functions/fnc_dismountSuccess.sqf new file mode 100644 index 0000000000..a6e34fe44f --- /dev/null +++ b/addons/concertina_wire/functions/fnc_dismountSuccess.sqf @@ -0,0 +1,42 @@ +/* + * Author: Rocko, Ruthberg + * + * Dismounts the concertina wire + * + * Arguments: + * 0: wire + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_1(_wire); + +{ + _wire animate [_x, 1]; +} foreach WIRE_FAST; + +[{ + EXPLODE_1_PVT(_this select 0,_wire); + + if (_wire animationPhase "wire_2" == 1) then { + private ["_dir", "_pos", "_wirecoil"]; + + _dir = getDir _wire; + _pos = getPosASL _wire; + + _wirecoil = "ACE_ConcertinaWireCoil" createvehicle [0, 0, 0]; + + deleteVehicle _wire; + + _wirecoil setDir _dir; + _wirecoil setPosASL _pos; + _wirecoil setVelocity [0, 0, 0]; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; +}, 0, [_wire]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/concertina_wire/functions/fnc_handleDamage.sqf b/addons/concertina_wire/functions/fnc_handleDamage.sqf new file mode 100644 index 0000000000..61cd1c4e7c --- /dev/null +++ b/addons/concertina_wire/functions/fnc_handleDamage.sqf @@ -0,0 +1,29 @@ +/* + * Author: Ruthberg + * + * Handles wire damage + * + * Arguments: + * 0: wire + * 1: selectionName + * 2: damage + * 3: source + * 4: projectile + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_5(_wire,_selectionName,_damage,_source,_projectile); + +if (_damage < 0.5) exitWith { 0 }; + +if (!(isNull _source)) then { + _wire setVariable [QGVAR(lastDamager), _source]; +}; + +_damage diff --git a/addons/concertina_wire/functions/fnc_handleKilled.sqf b/addons/concertina_wire/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..2d2cd7f789 --- /dev/null +++ b/addons/concertina_wire/functions/fnc_handleKilled.sqf @@ -0,0 +1,135 @@ +/* + * Author: Rocko + * + * Handles wire and vehicle damage + * + * Arguments: + * 0: wire + * 1: killer (vehicle) + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_2(_wire,_killer); + +if (isNull _killer) then { + _killer = _wire getVariable ["ace_concertina_wire_lastDamager", objNull]; + if (isNull _killer) then { + _killer = nearestObject [_wire, "car"]; + }; +}; +if (isNull _killer || {_killer == _wire} || {_killer == gunner (vehicle _killer)}) exitWith {}; + +private ["_type", "_mode", "_distance", "_anim", "_parts", "_selectionPart", "_selection", "_pos_w", "_dir_w", "_vehicle"]; +_type = typeOf _wire; +_mode = switch (_type) do { + case "ACE_ConcertinaWire": { 0 }; + case "Land_Razorwire_F": { 1 }; + default { -1 }; +}; + +if (_mode == -1) exitWith {}; + +// _mode = 0 = Single Coil +// _mode = 1 = Triple Coil + +// -------------------------------- +// L M R +// 4.54929 (4) +// 6.13564 (6) +//9.78744 (10) + +_distance = _wire distance _killer; +if (_distance > 14 || {_distance < 2}) exitWith {}; // Fix if shooting wire + +_type = typeOf _wire; +_anim = _wire animationPhase "wire_2"; +_pos_w = getPos _wire; +_dir_w = getDir _wire; +_vehicle = vehicle _killer; + +if (_mode == 0) then { + private ["_x", "_y", "_found", "_wireCheckPosAr", "_no"]; + _x = _pos_w select 0; + _y = _pos_w select 1; + // Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle) + _wireCheckPosAr = [ + [_x + (sin (_dir_w+90) * 1.5),_y + (cos (_dir_w+90) * 1.5)], + [(_x-(sin _dir_w)) + (sin (_dir_w+90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w+90) * 1.5)], + [_x + (sin (_dir_w-90) * 1.5),_y + (cos (_dir_w-90) * 1.5)], + [(_x-(sin _dir_w)) + (sin (_dir_w-90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w-90) * 1.5)] + ]; + { + _found = false; + _no = nearestObjects [_x, [typeOf _wire], 3]; //diag_log _no; diag_log "....."; + _no = _no - [_wire]; //diag_log _no; + if (count _no > 0) exitWith { + _found = true; //diag_log "found"; + }; + } foreach _wireCheckPosAr; + // Double coil found! + if (_found) then { + _mode = 1; + } else { + // Randomly make a single coil also catch tanks, if speed is high + if (_vehicle isKindOf "Tank" && {20 > random 100} && {speed _vehicle > 30}) then { + _mode = 1; + } else { + if !(_vehicle isKindOf "Tank") then { + _mode = 1; + }; + }; + }; +}; + +if (_mode == 1) then { + switch (true) do { + case (_vehicle isKindOf "Tank"): { + _parts = ["ltrack","rtrack"]; + }; + case (_vehicle isKindOf "Wheeled_APC" || {_vehicle isKindOf "Car"}): { + _parts = ["lfwheel","lf2wheel","lmwheel","lbwheel","rfwheel","rf2wheel","rmwheel","rbwheel"]; + }; + }; +} else { + switch (true) do { + case (_vehicle isKindOf "Wheeled_APC" || {_vehicle isKindOf "Car"}): { + _parts = ["lfwheel","lf2wheel","lmwheel","lbwheel","rfwheel","rf2wheel","rmwheel","rbwheel"]; + }; + }; +}; + +if (canMove _vehicle) then { + { + _selectionPart = "hit" + _x; + if (isText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name")) then { + _selection = getText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name"); + // TODO: Only the tires that have touched the wire should burst. + _vehicle setHit [_selection, 1]; + }; + } forEach _parts; +}; + +if (_mode == 1) then { + if (_vehicle isKindOf "StaticWeapon") exitWith {}; + [{ + PARAMS_2(_vehicle,_wire); + + _vehicle setVelocity ((velocity _vehicle) vectorMultiply 0.75); + + private ["_vPos", "_vDir"]; + // Set vehicle back in front of wire, since the wire will make the vehicle jump, and a wire with no geometry lod is undestructible and not recognizeable + _vPos = getPosASL _vehicle; + _vDir = getDir _vehicle; + _vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]); + // TODO: Needs to be placed in safe distance to wire, so we do not constantly re-spawn new wires + }, [_vehicle, _wire], 0.1, 0] call EFUNC(common,waitAndExecute); +}; + +//TODO: Create broken geoless wire (two version) +//TODO: Make wire remains stop vehicles diff --git a/addons/concertina_wire/functions/script_component.hpp b/addons/concertina_wire/functions/script_component.hpp new file mode 100644 index 0000000000..5ec20093ef --- /dev/null +++ b/addons/concertina_wire/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\concertina_wire\script_component.hpp" \ No newline at end of file diff --git a/addons/concertina_wire/script_component.hpp b/addons/concertina_wire/script_component.hpp new file mode 100644 index 0000000000..f3f353f181 --- /dev/null +++ b/addons/concertina_wire/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT concertina_wire +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_CONCERTINA_WIRE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_CONCERTINA_WIRE + #define DEBUG_SETTINGS DEBUG_SETTINGS_CONCERTINA_WIRE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define WIRE_FAST ["wire_2","wire_3","wire_4","wire_5","wire_6","wire_7","wire_8","wire_9","wire_10","wire_11","wire_12","wire_13","wire_14","wire_15","wire_16","wire_17","wire_18"] +#define WIRE_SLOW ["wire_2_1","wire_3_1","wire_4_1","wire_5_1","wire_6_1","wire_7_1","wire_8_1","wire_9_1","wire_10_1","wire_11_1","wire_12_1","wire_13_1","wire_14_1","wire_15_1","wire_16_1","wire_17_1","wire_18_1"] diff --git a/addons/concertina_wire/stringtable.xml b/addons/concertina_wire/stringtable.xml new file mode 100644 index 0000000000..0583a9448d --- /dev/null +++ b/addons/concertina_wire/stringtable.xml @@ -0,0 +1,49 @@ + + + + + Concertina Wire + NATO-Draht + Проволочная спираль + Drut kolczasty + Concertina wire + Concertina wire + Ostnatý drát + Concertina wire + Concertina wire + + + Concertina Wire Coil + NATO-Draht Rolle + Проволочная спираль (моток) + Zwój drutu kolczastego + Concertina wire coil + Concertina wire coil + Smyčka ostnatého drátu + Concertina wire coil + Concertina wire coil + + + Dismount Concertina Wire + NATO-Draht abbauen + Демонтировать проволочную спираль + Zwiń drut kolczasty + Dismount Concertina wire + Dismount Concertina wire + Svinout ostnatý drát + Dismount Concertina wire + Dismount Concertina wire + + + Deploy Concertina Wire + NATO-Draht verlegen + Монтировать проволочную спираль + Rozwiń drut kolczasty + Deploy Concertina wire + Deploy Concertina wire + Rozvinout ostnatý drát + Deploy Concertina wire + Deploy Concertina wire + + + \ No newline at end of file diff --git a/addons/dagr/$PBOPREFIX$ b/addons/dagr/$PBOPREFIX$ new file mode 100644 index 0000000000..98e51ae9ea --- /dev/null +++ b/addons/dagr/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\dagr \ No newline at end of file diff --git a/addons/dagr/CfgEventHandlers.hpp b/addons/dagr/CfgEventHandlers.hpp new file mode 100644 index 0000000000..2a05b72298 --- /dev/null +++ b/addons/dagr/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; +}; \ No newline at end of file diff --git a/addons/dagr/CfgVehicles.hpp b/addons/dagr/CfgVehicles.hpp new file mode 100644 index 0000000000..96b81c15b6 --- /dev/null +++ b/addons/dagr/CfgVehicles.hpp @@ -0,0 +1,49 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(menu) { + displayName = "Configure DAGR"; + condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem)); + statement = QUOTE(call FUNC(menuInit)); + showDisabled = 0; + priority = 0.1; + icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa)); + exceptions[] = {"isNotInside"}; + class GVAR(toggle) { + displayName = "Toggle DAGR"; + condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem)); + statement = QUOTE(call FUNC(toggleOverlay)); + showDisabled = 0; + priority = 0.2; + icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa)); + exceptions[] = {"notOnMap", "isNotInside"}; + }; + }; + }; + }; + }; + + class Item_Base_F; + class ACE_Item_DAGR: Item_Base_F { + author[] = {"Rosuto", "Ruthberg"}; + scope = 2; + scopeCurator = 2; + displayName = "DAGR"; + vehicleClass = "Items"; + class TransportItems { + class ACE_DAGR { + name = "ACE_DAGR"; + count = 1; + }; + }; + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_DAGR,6); + }; + }; +}; diff --git a/addons/dagr/CfgWeapons.hpp b/addons/dagr/CfgWeapons.hpp new file mode 100644 index 0000000000..31b0603ff2 --- /dev/null +++ b/addons/dagr/CfgWeapons.hpp @@ -0,0 +1,19 @@ + +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_DAGR: ACE_ItemCore { + author[] = {$STR_ACE_Common_ACETeam, "Ruthberg"}; + scope = 2; + displayName = "DAGR"; + descriptionShort = ""; + picture = PATHTOF(UI\DAGR_Icon.paa); + icon = "iconObject_circle"; + mapSize = 0.034; + + class ItemInfo: InventoryItem_Base_F { + mass = 10; + }; + }; +}; diff --git a/addons/dagr/Dialog.hpp b/addons/dagr/Dialog.hpp new file mode 100644 index 0000000000..2faeb03879 --- /dev/null +++ b/addons/dagr/Dialog.hpp @@ -0,0 +1,424 @@ +// Control types +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUT_BUTTON 16 // Arma 2 - textured button + +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_List_N_Box 102 // Arma 2 - N columns list box + + +// Static styles +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0c +#define ST_TYPE 0xF0 +#define ST_SINGLE 0 +#define ST_MULTI 16 +#define ST_TITLE_BAR 32 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_BACKGROUND 80 +#define ST_GROUP_BOX 96 +#define ST_GROUP_BOX2 112 +#define ST_HUD_BACKGROUND 128 +#define ST_TILE_PICTURE 144 +#define ST_WITH_RECT 160 +#define ST_LINE 176 +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 +#define ST_TITLE ST_TITLE_BAR + ST_CENTER + +// Slider styles +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 +#define SL_TEXTURES 0x10 + +// Listbox styles +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 +#define FontM "PuristaMedium" + +class RscText; + +class DAGR_Button { + idc = -1; + type = CT_BUTTON; + style = ST_LEFT; + font = "PuristaMedium"; + sizeEx = 0.02; + colorText[] = { 0, 1, 0, 1 }; + colorFocused[] = { 0, 0, 0, 0 }; // border color for focused state + colorDisabled[] = { 0, 0, 0, 0 }; // text color for disabled state + colorBackground[] = { 0, 0, 0, 0 }; + colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // background color for disabled state + colorBackgroundActive[] = { 0, 0, 0, 0 }; // background color for active state + offsetX = 0; + offsetY = 0; + offsetPressedX = 0; + offsetPressedY = 0; + colorShadow[] = { 0, 0, 0, 0 }; + colorBorder[] = { 0, 0, 0, 0 }; + borderSize = 0; + soundEnter[] = { "", 0, 1 }; // no sound + soundPush[] = { "", 0, 1 }; + soundClick[] = { "", 0, 1 }; // no sound + soundEscape[] = { "", 0, 1 }; // no sound + x = 0.5; + y = 0.5; + w = 0.07; + h = 0.05; + text = ""; + action = ""; +}; +class DAGR_Menu_Pic { + type = 0; + idc = -1; + style = 48; + x = 0; + y = 0; + w = 0.7; + h = 1.4; + text = ""; + colorBackground[] = {}; + colorText[] = {}; + font = "PuristaMedium"; + sizeEx = 0.04; + waitForLoad = 0; +}; + +class DAGR_Menu_Text { + type = 0; + idc = -1; + style = 0x00; + x = 0.5; + y = 0.5; + w = 0.15; + h = 0.15; + colorBackground[] = { 0, 0, 0, 0 }; + colorText[] = { 0.239, 0.216, 0.153, 1 }; + font = "PuristaMedium"; + sizeEx = 0.03; + waitForLoad = 0; + text = ""; +}; + +class DAGR_Menu { + idd = 266860; + movingEnable = false; + duration = 100000; + fadein = 0; + fadeout = 0; + name = "Dagr_Menu"; + onLoad = "uiNamespace setVariable ['DAGR_Menu', _this select 0]"; + onUnload = QUOTE(GVAR(PWR) = true); // Simulate pressing the power button + controls[] = {"DAGR_MENU_UI", "DAGR_PWR_Button", "DAGR_UP_Button", "DAGR_DOWN_Button", "DAGR_LEFT_Button", "DAGR_RIGHT_Button", "DAGR_NEXT_Button", + "DAGR_SEL_Button", "DAGR_MENU_Button", "DAGR_F1_Button", "DAGR_F2_Button", "DAGR_F3_Button", "DAGR_F1_Text", "DAGR_F2_Text", "DAGR_F3_Text", "DAGR_MENU_OPTION0", + "DAGR_MENU_OPTION1", "DAGR_MENU_OPTION2", "DAGR_MENU_OPTION3", "DAGR_MENU_OPTION4", "DAGR_MENU_SELECTION0", "DAGR_MENU_SELECTION1", "DAGR_MENU_SELECTION2", + "DAGR_MENU_SELECTION3", "DAGR_MENU_SELECTION4", "DAGR_MENU_Main_Text", "DAGR_MENU_PSELECTION1", "DAGR_MENU_PSELECTION2", "DAGR_MENU_PSELECTION3", + "DAGR_MENU_PSELECTION4", "DAGR_MENU_PSELECTION5", "DAGR_MENU_PSELECTION6","DAGR_MENU_PSELECTION7", "DAGR_MENU_PSELECTION8"}; + + class DAGR_MENU_UI : DAGR_Menu_Pic { + idc = 266861; + x = 0.175; + y = -0.173; + text = QUOTE(PATHTOF(UI\dagr_menu.paa)); + sizeEx = 0.1; + }; + + class DAGR_PWR_Button : DAGR_Button { + idc = 266863; + action = QUOTE(GVAR(PWR) = true); + x = 0.40; + y = 0.65; + }; + + class DAGR_UP_Button : DAGR_Button { + idc = 266864; + action = QUOTE(GVAR(UP) = true); + x = 0.50; + y = 0.675; + }; + + class DAGR_DOWN_Button : DAGR_Button { + idc = 266865; + action = QUOTE(GVAR(DOWN) = true); + x = 0.50; + y = 0.81; + }; + + class DAGR_LEFT_Button : DAGR_Button { + idc = 266866; + action = QUOTE(GVAR(LEFT) = true); + x = 0.40; + y = 0.735; + w = 0.05; + h = 0.07; + }; + + class DAGR_RIGHT_Button : DAGR_Button { + idc = 266867; + action = QUOTE(GVAR(RIGHT) = true); + x = 0.62; + y = 0.735; + w = 0.05; + h = 0.07; + }; + + class DAGR_NEXT_Button : DAGR_Button { + idc = 266868; + action = QUOTE(DAGR_NEXT = true); + x = 0.60; + y = 0.65; + }; + + class DAGR_SEL_Button : DAGR_Button { + idc = 266869; + action = QUOTE(GVAR(SEL) = true); + x = 0.54; + y = 0.735; + w = 0.06; + h = 0.06; + }; + + class DAGR_MENU_Button : DAGR_Button { + idc = 266870; + action = QUOTE(GVAR(MENU_B) = true); + x = 0.46; + y = 0.735; + w = 0.06; + h = 0.06; + }; + + class DAGR_F1_Button : DAGR_Button { + idc = 266871; + action = QUOTE(GVAR(F1) = true); + x = 0.40; + y = 0.575; + }; + + class DAGR_F2_Button : DAGR_Button { + idc = 266872; + action = QUOTE(GVAR(F2) = true); + x = 0.495; + y = 0.575; + }; + + class DAGR_F3_Button : DAGR_Button { + idc = 266873; + action = QUOTE(GVAR(F3) = true); + x = 0.59; + y = 0.575; + }; + + class DAGR_F1_Text : DAGR_Menu_Text { + idc = 266874; + x = 0.388; + y = 0.38; + text = ""; + }; + + class DAGR_F2_Text : DAGR_Menu_Text { + idc = 266875; + x = 0.506; + y = 0.38; + }; + + class DAGR_F3_Text : DAGR_Menu_Text { + idc = 266876; + x = 0.612; + y = 0.38; + }; + + class DAGR_MENU_OPTION0 : DAGR_Menu_Text { + idc = 2668777; + style = 0x02; + sizeEx = 0.035; + x = 0.43; + y = 0.19; + }; + + class DAGR_MENU_OPTION1 : DAGR_Menu_Text { + idc = 2668778; + style = 0x02; + sizeEx = 0.035; + x = 0.43; + y = 0.225; + }; + + class DAGR_MENU_OPTION2 : DAGR_Menu_Text { + idc = 2668779; + style = 0x02; + sizeEx = 0.035; + x = 0.43; + y = 0.26; + }; + + class DAGR_MENU_OPTION3 : DAGR_Menu_Text { + idc = 2668780; + style = 0x02; + sizeEx = 0.035; + x = 0.43; + y = 0.295; + }; + + class DAGR_MENU_OPTION4 : DAGR_Menu_Text { + idc = 2668781; + style = 0x02; + sizeEx = 0.035; + x = 0.43; + y = 0.33; + }; + class DAGR_MENU_SELECTION0 : DAGR_Menu_Pic { + idc = 2668783; + x = 0.42; + y = 0.246; + w = 0.17; + h = 0.035; + sizeEx = 0.05; + }; + + class DAGR_MENU_SELECTION1 : DAGR_Menu_Pic { + idc = 2668784; + x = 0.42; + y = 0.281; + w = 0.17; + h = 0.035; + sizeEx = 0.05; + }; + + class DAGR_MENU_SELECTION2 : DAGR_Menu_Pic { + idc = 2668785; + x = 0.42; + y = 0.316; + w = 0.17; + h = 0.035; + sizeEx = 0.05; + }; + + class DAGR_MENU_SELECTION3 : DAGR_Menu_Pic { + idc = 2668786; + x = 0.42; + y = 0.351; + w = 0.17; + h = 0.035; + sizeEx = 0.05; + }; + + class DAGR_MENU_SELECTION4 : DAGR_Menu_Pic { + idc = 2668787; + x = 0.42; + y = 0.386; + w = 0.17; + h = 0.035; + sizeEx = 0.05; + }; + + class DAGR_MENU_Main_Text : DAGR_Menu_Text { + idc = 2668782; + style = ST_CENTER; + x = 0.38; + y = 0.32; + w = 0.25; + h = 0.035; + sizeEx = 0.04; + }; + + class DAGR_MENU_PSELECTION1 : DAGR_Menu_Pic { + idc = 2668788; + x = 0.451; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION2 : DAGR_Menu_Pic { + idc = 2668789; + x = 0.465; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION3 : DAGR_Menu_Pic { + idc = 2668790; + x = 0.479; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION4 : DAGR_Menu_Pic { + idc = 2668791; + x = 0.493; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION5 : DAGR_Menu_Pic { + idc = 2668792; + x = 0.507; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION6 : DAGR_Menu_Pic { + idc = 2668793; + x = 0.521; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION7 : DAGR_Menu_Pic { + idc = 2668794; + x = 0.535; + y = 0.352; + w = 0.01; + h = 0.003; + }; + + class DAGR_MENU_PSELECTION8 : DAGR_Menu_Pic { + idc = 2668795; + x = 0.549; + y = 0.352; + w = 0.01; + h = 0.003; + }; +}; diff --git a/addons/dagr/README.md b/addons/dagr/README.md new file mode 100644 index 0000000000..33d095dca4 --- /dev/null +++ b/addons/dagr/README.md @@ -0,0 +1,10 @@ +ace_dagr +=============== + +Defense Advanced GPS Receiver + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file diff --git a/addons/dagr/RscTitles.hpp b/addons/dagr/RscTitles.hpp new file mode 100644 index 0000000000..8467c70f66 --- /dev/null +++ b/addons/dagr/RscTitles.hpp @@ -0,0 +1,95 @@ +class RscTitles { + class DAGR_Text { + type = 0; + idc = -1; + style = 0x01; + x = 0; + y = 0; + w = 0.15; + h = 0.050; + text = ""; + colorBackground[] = { 0, 0, 0, 0 }; + colorText[] = { 0.239, 0.216, 0.153, 1 }; + font = "PuristaMedium"; + sizeEx = 0.04; + waitForLoad = 0; + }; + class DAGR_Pic { + type = 0; + idc = -1; + style = 48; + x = 0; + y = 0; + w = 0.50; + h = 0.50; + text = ""; + colorBackground[] = {}; + colorText[] = {}; + font = "PuristaMedium"; + sizeEx = 0.02; + waitForLoad = 0; + }; + + class DAGR_Display { + idd = 266850; + movingEnable = false; + duration = 100000; + fadein = 0; + fadeout = 0; + name = "Dagr_Display"; + onLoad="uiNamespace setVariable ['DAGR_Display', _this select 0]"; + controls[] = {"DAGR_UI", "DAGR_Grid", "DAGR_Speed", "DAGR_Elevation", "DAGR_Heading", "DAGR_Time", "DAGR_WP", "DAGR_Bearing", "DAGR_DIST"}; + + class DAGR_UI : DAGR_Pic { + idc = 266856; + x = "(SafeZoneW + SafeZoneX) - 0.45"; + y = "(SafeZoneH + SafeZoneY) - 0.47"; + }; + + class DAGR_Grid : DAGR_Text { + idc = 266851; + x = "(SafeZoneW + SafeZoneX) - 0.370";// 0.830 + y = "(SafeZoneH + SafeZoneY)- 0.250";// 0.845 + w = 0.25; + h = 0.06; + sizeEx = 0.07; + }; + class DAGR_Speed : DAGR_Text { + idc = 266852; + x = "(SafeZoneW + SafeZoneX) - 0.388"; //0.812 + y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914 + }; + class DAGR_Elevation : DAGR_Text { + idc = 266853; + x = "(SafeZoneW + SafeZoneX) - 0.270"; //0.930 + y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914 + }; + class DAGR_Heading : DAGR_Text { + idc = 266854; + x = "(SafeZoneW + SafeZoneX) - 0.413"; //0.787 + y = "(SafeZoneH + SafeZoneY) - 0.1294"; //0.9656 + }; + class DAGR_Time : DAGR_Text { + idc = 266855; + x = "(SafeZoneW + SafeZoneX) - 0.275"; //0.925 + y = "(SafeZoneH + SafeZoneY) - 0.129"; //0.965 + }; + + class DAGR_WP : DAGR_Text { + idc = 266857; + x = "(SafeZoneW + SafeZoneX) - 0.235"; //0.965 + y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914 + }; + + class DAGR_Bearing : DAGR_Text { + idc = 266858; + x = "(SafeZoneW + SafeZoneX) - 0.413"; //0.787 + y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914 + }; + class DAGR_DIST : DAGR_Text { + idc = 266859; + x = "(SafeZoneW + SafeZoneX) - 0.265"; //0.935 + y = "(SafeZoneH + SafeZoneY) - 0.129"; //0.965 + }; + }; +}; diff --git a/addons/dagr/UI/DAGR_Button.paa b/addons/dagr/UI/DAGR_Button.paa new file mode 100644 index 0000000000..f81a8cef4a Binary files /dev/null and b/addons/dagr/UI/DAGR_Button.paa differ diff --git a/addons/dagr/UI/DAGR_GPS.paa b/addons/dagr/UI/DAGR_GPS.paa new file mode 100644 index 0000000000..b0e05a5a65 Binary files /dev/null and b/addons/dagr/UI/DAGR_GPS.paa differ diff --git a/addons/dagr/UI/DAGR_GPS_SHOW.paa b/addons/dagr/UI/DAGR_GPS_SHOW.paa new file mode 100644 index 0000000000..71f93e5f01 Binary files /dev/null and b/addons/dagr/UI/DAGR_GPS_SHOW.paa differ diff --git a/addons/dagr/UI/DAGR_Icon.paa b/addons/dagr/UI/DAGR_Icon.paa new file mode 100644 index 0000000000..be4afe7b51 Binary files /dev/null and b/addons/dagr/UI/DAGR_Icon.paa differ diff --git a/addons/dagr/UI/DAGR_MENU.paa b/addons/dagr/UI/DAGR_MENU.paa new file mode 100644 index 0000000000..311e2a607a Binary files /dev/null and b/addons/dagr/UI/DAGR_MENU.paa differ diff --git a/addons/dagr/UI/DAGR_PSelection.paa b/addons/dagr/UI/DAGR_PSelection.paa new file mode 100644 index 0000000000..9e1eb679fa Binary files /dev/null and b/addons/dagr/UI/DAGR_PSelection.paa differ diff --git a/addons/dagr/UI/DAGR_Selection.paa b/addons/dagr/UI/DAGR_Selection.paa new file mode 100644 index 0000000000..16ecf82593 Binary files /dev/null and b/addons/dagr/UI/DAGR_Selection.paa differ diff --git a/addons/dagr/UI/DAGR_Vector.paa b/addons/dagr/UI/DAGR_Vector.paa new file mode 100644 index 0000000000..c414cbd7e7 Binary files /dev/null and b/addons/dagr/UI/DAGR_Vector.paa differ diff --git a/addons/dagr/UI/DAGR_WP.paa b/addons/dagr/UI/DAGR_WP.paa new file mode 100644 index 0000000000..e8e541a36f Binary files /dev/null and b/addons/dagr/UI/DAGR_WP.paa differ diff --git a/addons/dagr/XEH_postInit.sqf b/addons/dagr/XEH_postInit.sqf new file mode 100644 index 0000000000..17fa744074 --- /dev/null +++ b/addons/dagr/XEH_postInit.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" + +#include "initKeybinds.sqf" + +GVAR(outputPFH) = -1; + +GVAR(run) = false; +GVAR(hidden) = true; +GVAR(menuRun) = false; +GVAR(useDegrees) = true; +GVAR(updateInterval) = 0.5; + +GVAR(numWaypoints) = 0; +GVAR(wpString0) = ""; +GVAR(wpString1) = ""; +GVAR(wpString2) = ""; +GVAR(wpString3) = ""; +GVAR(wpString4) = ""; +GVAR(wp0) = 0; +GVAR(wp1) = 0; +GVAR(wp2) = 0; +GVAR(wp3) = 0; +GVAR(wp4) = 0; + +GVAR(displaySelection) = "DATA"; + +GVAR(vectorConnected) = false; +GVAR(noVectorData) = true; +GVAR(vectorGrid) = "00000000"; + +["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler); diff --git a/addons/dagr/XEH_preInit.sqf b/addons/dagr/XEH_preInit.sqf new file mode 100644 index 0000000000..7c61d71775 --- /dev/null +++ b/addons/dagr/XEH_preInit.sqf @@ -0,0 +1,12 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(handleRangeFinderData); +PREP(menuInit); +PREP(outputData); +PREP(outputVector); +PREP(outputWP); +PREP(toggleOverlay); + +ADDON = true; diff --git a/addons/dagr/config.cpp b/addons/dagr/config.cpp new file mode 100644 index 0000000000..9f46660aaa --- /dev/null +++ b/addons/dagr/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Item_DAGR"}; + weapons[] = {"ACE_DAGR"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_weather"}; + author[] = {"Rosuto", "Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "Dialog.hpp" +#include "RscTitles.hpp" diff --git a/addons/dagr/functions/fnc_handleRangeFinderData.sqf b/addons/dagr/functions/fnc_handleRangeFinderData.sqf new file mode 100644 index 0000000000..59e10a1711 --- /dev/null +++ b/addons/dagr/functions/fnc_handleRangeFinderData.sqf @@ -0,0 +1,30 @@ +/* + * Author: Rosuto, Ruthberg + * Handles incoming data packets from the Vectronix Vector LRF + * + * Arguments: + * 0: Slope distance (Meters) + * 1: Azimuth (Degrees) + * 2: Inclination (Degrees) + * + * Return Value: + * Nothing + * + * Example: + * [1000, 45, 1] call ace_dagr_fnc_handleRangeFinderData + * + * Public: No + */ +#include "script_component.hpp" + +#define EMP_RF_ACC 5 // Rangefinder Accuracy + +PARAMS_3(_slopeDistance,_azimuth,_inclination); + +if (GVAR(vectorConnected)) then { + GVAR(LAZPOS) = (eyePos player) vectorAdd ([_slopeDistance, _azimuth, _inclination] call CBA_fnc_polar2vect); + GVAR(LAZDIST) = _slopeDistance * cos(_inclination); + GVAR(LAZDIST) = floor (GVAR(LAZDIST) / EMP_RF_ACC) * EMP_RF_ACC; + GVAR(LAZHEADING) = _azimuth; + GVAR(noVectorData) = false; +}; diff --git a/addons/dagr/functions/fnc_menuInit.sqf b/addons/dagr/functions/fnc_menuInit.sqf new file mode 100644 index 0000000000..ae1eed9a2b --- /dev/null +++ b/addons/dagr/functions/fnc_menuInit.sqf @@ -0,0 +1,607 @@ +/* + * Author: Rosuto, Ruthberg + * Creates the DAGR menu dialog + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +#define __dsp (uiNamespace getVariable "DAGR_MENU") +#define __F1 266874 +#define __F2 266875 +#define __F3 266876 +#define __Option0 2668777 +#define __Option1 2668778 +#define __Option2 2668779 +#define __Option3 2668780 +#define __Option4 2668781 +#define __Selection0 2668783 +#define __Selection1 2668784 +#define __Selection2 2668785 +#define __Selection3 2668786 +#define __Selection4 2668787 +#define __mainText 2668782 +#define __PSelection1 2668788 +#define __PSelection2 2668789 +#define __PSelection3 2668790 +#define __PSelection4 2668791 +#define __PSelection5 2668792 +#define __PSelection6 2668793 +#define __PSelection7 2668794 +#define __PSelection8 2668795 + +135471 cutText ["", "PLAIN"]; +closeDialog 0; +createDialog "DAGR_MENU"; + +GVAR(menu) = "main"; +GVAR(selection) = 0; +GVAR(numSelections) = 5; +GVAR(tmpUpdateRate) = GVAR(updateInterval); +GVAR(edit) = false; +GVAR(add) = false; +GVAR(pointer) = 0; +GVAR(digit1) = 0; +GVAR(digit2) = 0; +GVAR(digit3) = 0; +GVAR(digit4) = 0; +GVAR(digit5) = 0; +GVAR(digit6) = 0; +GVAR(digit7) = 0; +GVAR(digit8) = 0; + +GVAR(busy) = false; +GVAR(busyTimer) = 0; + +GVAR(showNoWaypointsFound) = false; +GVAR(showInfoUpdatin) = false; +GVAR(showDeleting) = false; +GVAR(showOutOfSpace) = false; + +GVAR(PWR) = false; +GVAR(menuRun) = true; +[{ + if (!dialog || GVAR(PWR)) exitWith { + closeDialog 266860; + GVAR(menuRun) = false; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + if (GVAR(MENU_B)) then { + GVAR(menu) = "main"; + GVAR(selection) = 0; + GVAR(numSelections) = 5; + }; + + if (!GVAR(add) && !GVAR(edit)) then { + if (GVAR(DOWN)) then { + GVAR(selection) = (GVAR(numSelections) + GVAR(selection) + 1); + }; + if (GVAR(UP)) then { + GVAR(selection) = (GVAR(numSelections) + GVAR(selection) - 1); + }; + GVAR(selection) = if (GVAR(numSelections) > 0) then { GVAR(selection) % GVAR(numSelections) } else { 0 }; + }; + + if (GVAR(LEFT)) then { + GVAR(pointer) = (8 + GVAR(pointer) - 1); + }; + if (GVAR(RIGHT)) then { + GVAR(pointer) = (8 + GVAR(pointer) + 1); + }; + GVAR(pointer) = GVAR(pointer) % 8; + + (__dsp displayCtrl __PSelection1) ctrlSetText ""; + (__dsp displayCtrl __PSelection2) ctrlSetText ""; + (__dsp displayCtrl __PSelection3) ctrlSetText ""; + (__dsp displayCtrl __PSelection4) ctrlSetText ""; + (__dsp displayCtrl __PSelection5) ctrlSetText ""; + (__dsp displayCtrl __PSelection6) ctrlSetText ""; + (__dsp displayCtrl __PSelection7) ctrlSetText ""; + (__dsp displayCtrl __PSelection8) ctrlSetText ""; + + (__dsp displayCtrl __Selection0) ctrlSetText ""; + (__dsp displayCtrl __Selection1) ctrlSetText ""; + (__dsp displayCtrl __Selection2) ctrlSetText ""; + (__dsp displayCtrl __Selection3) ctrlSetText ""; + (__dsp displayCtrl __Selection4) ctrlSetText ""; + + (__dsp displayCtrl __F1) ctrlSetText ""; + (__dsp displayCtrl __F2) ctrlSetText ""; + (__dsp displayCtrl __F3) ctrlSetText ""; + + (__dsp displayCtrl __mainText) ctrlSetText ""; + (__dsp displayCtrl __Option0) ctrlSetText ""; + (__dsp displayCtrl __Option1) ctrlSetText ""; + (__dsp displayCtrl __Option2) ctrlSetText ""; + (__dsp displayCtrl __Option3) ctrlSetText ""; + (__dsp displayCtrl __Option4) ctrlSetText ""; + + switch (GVAR(menu)) do { + case "main": { + if (GVAR(SEL)) then { + switch (GVAR(selection)) do { + case 0: { + GVAR(displaySelection) = "DATA"; + GVAR(vectorConnected) = false; + if (!GVAR(busy)) then { + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data."; + if (ACE_time - GVAR(busyTimer) > 0.5) then { + (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data.."; + }; + if (ACE_time - GVAR(busyTimer) > 1.0) then { + (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data..."; + }; + if (ACE_time - GVAR(busyTimer) > 1.5) then { + (__dsp displayCtrl __mainText) ctrlSetText "Position Acquired"; + }; + if (ACE_time - GVAR(busyTimer) > 3.0) then { + GVAR(busy) = false; + }; + }; + case 1: { + if (GVAR(numWaypoints) < 1) then { + (__dsp displayCtrl __mainText) ctrlSetText "No Waypoints Found"; + if (!GVAR(busy)) then { + GVAR(showNoWaypointsFound) = true; + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + } else { + GVAR(menu) = "goto_wp"; GVAR(numSelections) = GVAR(numWaypoints); GVAR(selection) = 0; + }; + }; + case 2: { GVAR(menu) = "wp_list"; GVAR(numSelections) = GVAR(numWaypoints); GVAR(selection) = 0 }; + case 3: { GVAR(menu) = "connect"; GVAR(numSelections) = 1; }; + case 4: { GVAR(menu) = "options"; GVAR(numSelections) = 2; }; + }; + }; + if (GVAR(busy) && GVAR(showNoWaypointsFound)) then { + if (ACE_time - GVAR(busyTimer) > 2) then { + GVAR(showNoWaypointsFound) = false; + GVAR(busy) = false; + }; + }; + if (!GVAR(busy)) then { + (__dsp displayCtrl __Option0) ctrlSetText "DATA VIEW"; + (__dsp displayCtrl __Option1) ctrlSetText "GOTO WP"; + (__dsp displayCtrl __Option2) ctrlSetText "WP LIST"; + (__dsp displayCtrl __Option3) ctrlSetText "CONNECT TO"; + (__dsp displayCtrl __Option4) ctrlSetText "OPTIONS"; + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + }; + }; + case "goto_wp": { + if (!GVAR(busy)) then { + (__dsp displayCtrl __Option0) ctrlSetText GVAR(wpString0); + (__dsp displayCtrl __Option1) ctrlSetText GVAR(wpString1); + (__dsp displayCtrl __Option2) ctrlSetText GVAR(wpString2); + (__dsp displayCtrl __Option3) ctrlSetText GVAR(wpString3); + (__dsp displayCtrl __Option4) ctrlSetText GVAR(wpString4); + if (GVAR(numSelections) > 0) then { + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + }; + }; + if (GVAR(SEL)) then { + GVAR(vectorConnected) = false; + GVAR(displaySelection) = "WP"; + switch (GVAR(selection)) do { + case 0: { DAGR_WP_INFO = GVAR(wp0); }; + case 1: { DAGR_WP_INFO = GVAR(wp1); }; + case 2: { DAGR_WP_INFO = GVAR(wp2); }; + case 3: { DAGR_WP_INFO = GVAR(wp3); }; + case 4: { DAGR_WP_INFO = GVAR(wp4); }; + }; + if (!GVAR(busy)) then { + GVAR(showInfoUpdating) = true; + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + }; + if (GVAR(busy) && GVAR(showInfoUpdating)) then { + (__dsp displayCtrl __mainText) ctrlSetText "Info Update."; + if (ACE_time - GVAR(busyTimer) > 1) then { + (__dsp displayCtrl __mainText) ctrlSetText "Info Update.."; + }; + if (ACE_time - GVAR(busyTimer) > 1.2) then { + (__dsp displayCtrl __mainText) ctrlSetText "Info Update..."; + }; + if (ACE_time - GVAR(busyTimer) > 1.4) then { + (__dsp displayCtrl __mainText) ctrlSetText "Info Updated"; + }; + if (ACE_time - GVAR(busyTimer) > 2.9) then { + GVAR(showInfoUpdating) = false; + GVAR(busy) = false; + }; + }; + }; + case "wp_list": { + if (!GVAR(add) && !GVAR(edit)) then { + if (!GVAR(busy)) then { + (__dsp displayCtrl __Option0) ctrlSetText GVAR(wpString0); + (__dsp displayCtrl __Option1) ctrlSetText GVAR(wpString1); + (__dsp displayCtrl __Option2) ctrlSetText GVAR(wpString2); + (__dsp displayCtrl __Option3) ctrlSetText GVAR(wpString3); + (__dsp displayCtrl __Option4) ctrlSetText GVAR(wpString4); + (__dsp displayCtrl __F1) ctrlSetText "Add"; + (__dsp displayCtrl __F2) ctrlSetText "Edit"; + (__dsp displayCtrl __F3) ctrlSetText "Delete"; + if (GVAR(numSelections) > 0) then { + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + }; + }; + if (GVAR(F3) && GVAR(numWaypoints) > 0) then { + if (!GVAR(busy)) then { + switch (GVAR(selection)) do { + case 0: { + GVAR(wpString0) = GVAR(wpString1); + GVAR(wp0) = GVAR(wp1); + GVAR(wpString1) = GVAR(wpString2); + GVAR(wp1) = GVAR(wp2); + GVAR(wpString2) = GVAR(wpString3); + GVAR(wp2) = GVAR(wp3); + GVAR(wpString3) = GVAR(wpString4); + GVAR(wp3) = GVAR(wp4); + GVAR(wpString4) = ""; + GVAR(wp4) = ""; + }; + case 1: { + GVAR(wpString1) = GVAR(wpString2); + GVAR(wp1) = GVAR(wp2); + GVAR(wpString2) = GVAR(wpString3); + GVAR(wp2) = GVAR(wp3); + GVAR(wpString3) = GVAR(wpString4); + GVAR(wp3) = GVAR(wp4); + GVAR(wpString4) = ""; + GVAR(wp4) = ""; + }; + case 2: { + GVAR(wpString2) = GVAR(wpString3); + GVAR(wp2) = GVAR(wp3); + GVAR(wpString3) = GVAR(wpString4); + GVAR(wp3) = GVAR(wp4); + GVAR(wpString4) = ""; + GVAR(wp4) = ""; + }; + case 3: { + GVAR(wpString3) = GVAR(wpString4); + GVAR(wp3) = GVAR(wp4); + GVAR(wpString4) = ""; + GVAR(wp4) = ""; + }; + case 4: { + GVAR(wpString4) = ""; + GVAR(wp4) = ""; + }; + }; + GVAR(numWaypoints) = GVAR(numWaypoints) - 1; + GVAR(numSelections) = GVAR(numWaypoints); + GVAR(showDeleting) = true; + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + }; + if (GVAR(busy) && GVAR(showDeleting)) then { + (__dsp displayCtrl __mainText) ctrlSetText "Deleting."; + if (ACE_time - GVAR(busyTimer) > 1) then { + (__dsp displayCtrl __mainText) ctrlSetText "Deleting.."; + }; + if (ACE_time - GVAR(busyTimer) > 1.2) then { + (__dsp displayCtrl __mainText) ctrlSetText "Deleting..."; + }; + if (ACE_time - GVAR(busyTimer) > 1.4) then { + (__dsp displayCtrl __mainText) ctrlSetText "Waypoint Deleted"; + }; + if (ACE_time - GVAR(busyTimer) > 2.9) then { + GVAR(showDeleting) = false; + GVAR(busy) = false; + }; + }; + if (GVAR(F1)) then { + if (GVAR(numWaypoints) == 5) then { + if (!GVAR(busy)) then { + GVAR(showOutOfSpace) = true; + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + } else { + GVAR(digit1) = 0; + GVAR(digit2) = 0; + GVAR(digit3) = 0; + GVAR(digit4) = 0; + GVAR(digit5) = 0; + GVAR(digit6) = 0; + GVAR(digit7) = 0; + GVAR(digit8) = 0; + GVAR(pointer) = 0; + GVAR(add) = true; + }; + }; + if (GVAR(busy) && GVAR(showOutOfSpace)) then { + (__dsp displayCtrl __mainText) ctrlSetText "Out of Space"; + if (ACE_time - GVAR(busyTimer) > 2.5) then { + GVAR(showOutOfSpace) = false; + GVAR(busy) = false; + }; + }; + if (GVAR(F2) && GVAR(numWaypoints) > 0) then { + GVAR(pointer) = 0; + GVAR(edit) = true; + GVAR(add) = false; + switch (GVAR(selection)) do { + case 0: { + GVAR(digit1) = floor (GVAR(wp0) / 10000000); + GVAR(digit2) = floor (GVAR(wp0) / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor (GVAR(wp0) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor (GVAR(wp0) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor (GVAR(wp0) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor (GVAR(wp0) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor (GVAR(wp0) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor (GVAR(wp0) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + case 1: { + GVAR(digit1) = floor (GVAR(wp1) / 10000000); + GVAR(digit2) = floor (GVAR(wp1) / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor (GVAR(wp1) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor (GVAR(wp1) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor (GVAR(wp1) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor (GVAR(wp1) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor (GVAR(wp1) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor (GVAR(wp1) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + case 2: { + GVAR(digit1) = floor (GVAR(wp2) / 10000000); + GVAR(digit2) = floor (GVAR(wp2) / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor (GVAR(wp2) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor (GVAR(wp2) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor (GVAR(wp2) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor (GVAR(wp2) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor (GVAR(wp2) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor (GVAR(wp2) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + case 3: { + GVAR(digit1) = floor (GVAR(wp3) / 10000000); + GVAR(digit2) = floor (GVAR(wp3) / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor (GVAR(wp3) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor (GVAR(wp3) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor (GVAR(wp3) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor (GVAR(wp3) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor (GVAR(wp3) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor (GVAR(wp3) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + case 4: { + GVAR(digit1) = floor (GVAR(wp4) / 10000000); + GVAR(digit2) = floor (GVAR(wp4) / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor (GVAR(wp4) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor (GVAR(wp4) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor (GVAR(wp4) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor (GVAR(wp4) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor (GVAR(wp4) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor (GVAR(wp4) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + }; + }; + } else { + if (!GVAR(busy)) then { + (__dsp displayCtrl __F1) ctrlSetText "Save"; + (__dsp displayCtrl __F2) ctrlSetText "Vector"; + (__dsp displayCtrl __F3) ctrlSetText "Cancel"; + GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8); + (__dsp displayCtrl __mainText) ctrlSetText GVAR(output); + (__dsp displayCtrl __PSelection1 + GVAR(pointer)) ctrlSetText QUOTE(PATHTOF(UI\DAGR_PSelection.paa)); + }; + if (GVAR(F1)) then { + if (!GVAR(busy)) then { + if (GVAR(add)) then { + switch (GVAR(numWaypoints)) do { + case 0: { GVAR(wpString0) = GVAR(output); GVAR(wp0) = parseNumber GVAR(output); }; + case 1: { GVAR(wpString1) = GVAR(output); GVAR(wp1) = parseNumber GVAR(output); }; + case 2: { GVAR(wpString2) = GVAR(output); GVAR(wp2) = parseNumber GVAR(output); }; + case 3: { GVAR(wpString3) = GVAR(output); GVAR(wp3) = parseNumber GVAR(output); }; + case 4: { GVAR(wpString4) = GVAR(output); GVAR(wp4) = parseNumber GVAR(output); }; + }; + GVAR(numWaypoints) = GVAR(numWaypoints) + 1; + GVAR(numSelections) = GVAR(numWaypoints); + GVAR(selection) = 0; + }; + if (GVAR(edit)) then { + switch (GVAR(selection)) do { + case 0: { GVAR(wpString0) = GVAR(output); GVAR(wp0) = parseNumber GVAR(output); }; + case 1: { GVAR(wpString1) = GVAR(output); GVAR(wp1) = parseNumber GVAR(output); }; + case 2: { GVAR(wpString2) = GVAR(output); GVAR(wp2) = parseNumber GVAR(output); }; + case 3: { GVAR(wpString3) = GVAR(output); GVAR(wp3) = parseNumber GVAR(output); }; + case 4: { GVAR(wpString4) = GVAR(output); GVAR(wp4) = parseNumber GVAR(output); }; + }; + }; + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + (__dsp displayCtrl __F1) ctrlSetText ""; + (__dsp displayCtrl __F2) ctrlSetText ""; + (__dsp displayCtrl __F3) ctrlSetText ""; + (__dsp displayCtrl __mainText) ctrlSetText "Saving."; + if (ACE_time - GVAR(busyTimer) > 1) then { + (__dsp displayCtrl __mainText) ctrlSetText "Saving.."; + }; + if (ACE_time - GVAR(busyTimer) > 1.2) then { + (__dsp displayCtrl __mainText) ctrlSetText "Saving..."; + }; + if (ACE_time - GVAR(busyTimer) > 1.4) then { + (__dsp displayCtrl __mainText) ctrlSetText "Waypoint Saved"; + }; + if (ACE_time - GVAR(busyTimer) > 2.9) then { + GVAR(edit) = false; + GVAR(add) = false; + GVAR(busy) = false; + }; + }; + if (GVAR(F2)) then { + private ["_grid", "_gridVector"]; + _grid = toArray GVAR(vectorGrid); + _grid deleteAt 4; + _grid = toString _grid; + _gridVector = parseNumber _grid; + GVAR(digit1) = floor(_gridVector / 10000000); + GVAR(digit2) = floor(_gridVector / 1000000 - GVAR(digit1) *10); + GVAR(digit3) = floor(_gridVector / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100); + GVAR(digit4) = floor(_gridVector / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000); + GVAR(digit5) = floor(_gridVector / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000); + GVAR(digit6) = floor(_gridVector / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000); + GVAR(digit7) = floor(_gridVector / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000); + GVAR(digit8) = floor(_gridVector - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000); + }; + if (GVAR(F3)) then { + if (!GVAR(busy)) then { + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + } else { + (__dsp displayCtrl __F1) ctrlSetText "Save"; + (__dsp displayCtrl __F2) ctrlSetText "Vector"; + (__dsp displayCtrl __F3) ctrlSetText "Cancel"; + GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8); + (__dsp displayCtrl __mainText) ctrlSetText GVAR(output); + }; + if (ACE_time - GVAR(busyTimer) > 0.1) then { + GVAR(add) = false; + GVAR(edit) = false; + GVAR(busy) = false; + }; + }; + if (GVAR(UP)) then { + switch (GVAR(pointer) + 1) do { + case 1: { GVAR(digit1) = (10 + GVAR(digit1) + 1) % 10 }; + case 2: { GVAR(digit2) = (10 + GVAR(digit2) + 1) % 10 }; + case 3: { GVAR(digit3) = (10 + GVAR(digit3) + 1) % 10 }; + case 4: { GVAR(digit4) = (10 + GVAR(digit4) + 1) % 10 }; + case 5: { GVAR(digit5) = (10 + GVAR(digit5) + 1) % 10 }; + case 6: { GVAR(digit6) = (10 + GVAR(digit6) + 1) % 10 }; + case 7: { GVAR(digit7) = (10 + GVAR(digit7) + 1) % 10 }; + case 8: { GVAR(digit8) = (10 + GVAR(digit8) + 1) % 10 }; + }; + }; + if (GVAR(DOWN)) then { + switch (GVAR(pointer) + 1) do { + case 1: { GVAR(digit1) = (10 + GVAR(digit1) - 1) % 10 }; + case 2: { GVAR(digit2) = (10 + GVAR(digit2) - 1) % 10 }; + case 3: { GVAR(digit3) = (10 + GVAR(digit3) - 1) % 10 }; + case 4: { GVAR(digit4) = (10 + GVAR(digit4) - 1) % 10 }; + case 5: { GVAR(digit5) = (10 + GVAR(digit5) - 1) % 10 }; + case 6: { GVAR(digit6) = (10 + GVAR(digit6) - 1) % 10 }; + case 7: { GVAR(digit7) = (10 + GVAR(digit7) - 1) % 10 }; + case 8: { GVAR(digit8) = (10 + GVAR(digit8) - 1) % 10 }; + }; + }; + }; + }; + case "connect": { + if (!GVAR(busy)) then { + (__dsp displayCtrl __Option0) ctrlSetText "Vector 21"; + (__dsp displayCtrl __Selection0) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + }; + if (GVAR(SEL)) then { + if (!GVAR(busy)) then { + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + (__dsp displayCtrl __mainText) ctrlSetText "Connecting."; + if (ACE_time - GVAR(busyTimer) > 0.2) then { + (__dsp displayCtrl __mainText) ctrlSetText "Connecting.."; + }; + if (ACE_time - GVAR(busyTimer) > 0.4) then { + (__dsp displayCtrl __mainText) ctrlSetText "Connecting..."; + }; + if (ACE_time - GVAR(busyTimer) > 0.6) then { + if (ACE_player hasWeapon "ACE_Vector") then { + GVAR(displaySelection) = "VECTOR"; + (__dsp displayCtrl __mainText) ctrlSetText "Vector Connected"; + GVAR(vectorConnected) = true; + } else { + (__dsp displayCtrl __mainText) ctrlSetText "No Device Found"; + GVAR(vectorConnected) = false; + }; + }; + if (ACE_time - GVAR(busyTimer) > 3.1) then { + GVAR(busy) = false; + if (GVAR(vectorConnected)) then { + GVAR(menu) = "main"; GVAR(numSelections) = 5; + }; + }; + }; + }; + case "options": { + (__dsp displayCtrl __Option0) ctrlSetText "Signal Delay"; + (__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" }); + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + if (GVAR(SEL)) then { + GVAR(vectorConnected) = false; + switch (GVAR(selection)) do { + case 0: { GVAR(menu) = "update_rate"; GVAR(numSelections) = 1; GVAR(tmpUpdateRate) = GVAR(updateInterval); }; + case 1: { GVAR(useDegrees) = !GVAR(useDegrees); }; + }; + } + }; + case "update_rate": { + if (GVAR(F1)) then { + GVAR(updateInterval) = GVAR(tmpUpdateRate); + if (!GVAR(busy)) then { + GVAR(busy) = true; + GVAR(busyTimer) = ACE_time; + }; + (__dsp displayCtrl __mainText) ctrlSetText "Updating."; + if (ACE_time - GVAR(busyTimer) > 0.2) then { + (__dsp displayCtrl __mainText) ctrlSetText "Updating.."; + }; + if (ACE_time - GVAR(busyTimer) > 0.4) then { + (__dsp displayCtrl __mainText) ctrlSetText "Updating..."; + }; + if (ACE_time - GVAR(busyTimer) > 0.6) then { + (__dsp displayCtrl __mainText) ctrlSetText "Update Success"; + }; + if (ACE_time - GVAR(busyTimer) > 2.1) then { + GVAR(busy) = false; + GVAR(menu) = "options"; GVAR(numSelections) = 2; + }; + }; + if (GVAR(F3)) then { + GVAR(menu) = "options"; GVAR(numSelections) = 2; + }; + if (GVAR(DOWN)) then { + GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) - 0.1; + }; + if (GVAR(UP)) then { + GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) + 0.1; + }; + GVAR(tmpUpdateRate) = 0.1 max GVAR(tmpUpdateRate) min 2.0; + if (!GVAR(busy)) then { + (__dsp displayCtrl __mainText) ctrlSetText (Str(GVAR(tmpUpdateRate) * 1000) + "ms"); + (__dsp displayCtrl __F1) ctrlSetText "Save"; + (__dsp displayCtrl __F3) ctrlSetText "Cancel"; + }; + }; + }; + + if (!GVAR(busy)) then { + GVAR(F3) = false; + GVAR(F2) = false; + GVAR(F1) = false; + GVAR(MENU_B) = false; + GVAR(SEL) = false; + DAGR_NEXT = false; + GVAR(RIGHT) = false; + GVAR(LEFT) = false; + GVAR(UP) = false; + GVAR(DOWN) = false; + GVAR(PWR) = false; + }; +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dagr/functions/fnc_outputData.sqf b/addons/dagr/functions/fnc_outputData.sqf new file mode 100644 index 0000000000..ff7429fa0a --- /dev/null +++ b/addons/dagr/functions/fnc_outputData.sqf @@ -0,0 +1,120 @@ +/* + * Author: Rosuto + * DAGR data output loop + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +135471 cutRsc ["DAGR_DISPLAY", "plain down"]; + +#define __display (uiNameSpace getVariable "DAGR_DISPLAY") + +#define __gridControl (__display displayCtrl 266851) +#define __speedControl (__display displayCtrl 266852) +#define __elevationControl (__display displayCtrl 266853) +#define __headingControl (__display displayCtrl 266854) +#define __timeControl (__display displayCtrl 266855) +#define __background (__display displayCtrl 266856) + +__background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa)); + +if (GVAR(outputPFH) != -1) exitWith {}; + +GVAR(outputPFH) = [{ + private ["_pos", "_mapSize", "_gridConfig", "_offsetX", "_offsetY", "_stepX", "_stepY", "_xgrid", "_ygrid", "_xcoord", "_ycoord", "_speed", "_dagrHeading", "_dagrGrid", "_dagrElevation", "_dagrSpeed", "_dagrTime", "_elevation"]; + + // Abort Condition + if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { + GVAR(outputPFH) = -1; + 135471 cutText ["", "PLAIN"]; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + // GRID + _pos = getPosASL ACE_player; + + _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); + _gridConfig = (configFile >> "CfgWorlds" >> worldName >> "Grid"); + _offsetX = getNumber (_gridConfig >> "offsetX"); + _offsetY = getNumber (_gridConfig >> "offsetY"); + _stepX = getNumber (_gridConfig >> "Zoom1" >> "stepX"); + _stepY = getNumber (_gridConfig >> "Zoom1" >> "stepY"); + + if (_stepY >= 0) then { + _pos set [1, (_mapSize - 100) - (_pos select 1) - _offsetY]; + }; + + // Incase grids go neg due to 99-00 boundry + if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];}; + if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];}; + + _xGrid = toArray Str(round(_pos select 0)); + while {count _xGrid < 5} do { + _xGrid = [48] + _xGrid; + }; + _xGrid resize 4; + _xGrid = toString _xGrid; + _xGrid = parseNumber _xGrid; + + _yGrid = toArray Str(round(_pos select 1)); + while {count _yGrid < 5} do { + _yGrid = [48] + _yGrid; + }; + _yGrid resize 4; + _yGrid = toString _yGrid; + _yGrid = parseNumber _yGrid; + + _xCoord = switch true do { + case (_xGrid >= 1000): { "" + Str(_xGrid) }; + case (_xGrid >= 100): { "0" + Str(_xGrid) }; + case (_xGrid >= 10): { "00" + Str(_xGrid) }; + default { "000" + Str(_xGrid) }; + }; + + _yCoord = switch true do { + case (_yGrid >= 1000): { "" + Str(_yGrid) }; + case (_yGrid >= 100): { "0" + Str(_yGrid) }; + case (_yGrid >= 10): { "00" + Str(_yGrid) }; + default { "000" + Str(_yGrid) }; + }; + + _dagrGrid = _xcoord + " " + _ycoord; + + // SPEED + _speed = speed (vehicle ACE_player); + _speed = floor (_speed * 10) / 10; + _speed = abs(_speed); + _dagrspeed = str _speed + "kph"; + + // Elevation + _elevation = getPosASL ACE_player; + _elevation = floor ((_elevation select 2) + EGVAR(weather,altitude)); + _dagrElevation = str _elevation + "m"; + + // Heading + _dagrHeading = if (!GVAR(useDegrees)) then { + floor (DEG_TO_MIL(direction (vehicle ACE_player))) + } else { + floor (direction (vehicle ACE_player)) + }; + + // Time + _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; + + // Output + __gridControl ctrlSetText format ["%1", _dagrGrid]; + __speedControl ctrlSetText format ["%1", _dagrSpeed]; + __elevationControl ctrlSetText format ["%1", _dagrElevation]; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 ", _dagrHeading] }); + __timeControl ctrlSetText format ["%1", _dagrTime]; + +}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dagr/functions/fnc_outputVector.sqf b/addons/dagr/functions/fnc_outputVector.sqf new file mode 100644 index 0000000000..660e678a82 --- /dev/null +++ b/addons/dagr/functions/fnc_outputVector.sqf @@ -0,0 +1,98 @@ +/* + * Author: Rosuto + * DAGR vector output loop + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"]; + +135471 cutRsc ["DAGR_DISPLAY", "plain down"]; + +#define __display (uiNameSpace getVariable "DAGR_DISPLAY") + +#define __gridControl (__display displayCtrl 266851) +#define __speedControl (__display displayCtrl 266858) +#define __elevationControl (__display displayCtrl 266853) +#define __headingControl (__display displayCtrl 266854) +#define __timeControl (__display displayCtrl 266855) +#define __background (__display displayCtrl 266856) + +__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa)); + +if (GVAR(noVectorData)) exitwith {}; + +_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1]; + +// Incase grids go neg due to 99-00 boundry +if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];}; +if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];}; + +// Find laser position +_xGrid = toArray Str(round(_pos select 0)); + +while {count _xGrid < 5} do { + _xGrid = [48] + _xGrid; +}; +_xGrid resize 4; +_xGrid = toString _xGrid; +_xGrid = parseNumber _xGrid; + +_yGrid = toArray Str(round(_pos select 1)); +while {count _yGrid < 5} do { + _yGrid = [48] + _yGrid; +}; +_yGrid resize 4; +_yGrid = toString _yGrid; +_yGrid = parseNumber _yGrid; + +_xCoord = switch true do { + case (_xGrid >= 1000): { "" + Str(_xGrid) }; + case (_xGrid >= 100): { "0" + Str(_xGrid) }; + case (_xGrid >= 10): { "00" + Str(_xGrid) }; + default { "000" + Str(_xGrid) }; +}; + +_yCoord = switch true do { + case (_yGrid >= 1000): { "" + Str(_yGrid) }; + case (_yGrid >= 100): { "0" + Str(_yGrid) }; + case (_yGrid >= 10): { "00" + Str(_yGrid) }; + default { "000" + Str(_yGrid) }; +}; + +_dagrGrid = _xCoord + " " + _yCoord; + +// Find target elevation +_elevation = floor ((GVAR(LAZPOS) select 2) + EGVAR(weather,altitude)); +_dagrElevation = str _elevation + "m"; + +// Time +_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; + +// Bearing +_bearing = GVAR(LAZHEADING); +if (_bearing >= 360) then {_bearing = _bearing - 360;}; +if (!GVAR(useDegrees)) then {_bearing = DEG_TO_MIL(_bearing)}; +_bearing = floor (_bearing); + +// Distance +_dagrDist = str GVAR(LAZDIST) + "m"; + +// Put grid into variable so DAGR menu can access it +GVAR(vectorGrid) = _dagrGrid; + +// OUTPUT +__gridControl ctrlSetText format ["%1", _dagrGrid]; +__speedControl ctrlSetText format ["%1", _dagrDist]; +__elevationControl ctrlSetText format ["%1", _dagrElevation]; +__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1", _bearing] }); +__timeControl ctrlSetText format ["%1", _dagrTime]; diff --git a/addons/dagr/functions/fnc_outputWP.sqf b/addons/dagr/functions/fnc_outputWP.sqf new file mode 100644 index 0000000000..d1fc2a47f2 --- /dev/null +++ b/addons/dagr/functions/fnc_outputWP.sqf @@ -0,0 +1,136 @@ +/* + * Author: Rosuto + * DAGR waypoint output loop + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +135471 cutRsc ["DAGR_DISPLAY", "plain down"]; + +#define __display (uiNameSpace getVariable "DAGR_DISPLAY") + +#define __gridControl (__display displayCtrl 266851) +#define __speedControl (__display displayCtrl 266858) +#define __elevationControl (__display displayCtrl 266857) +#define __headingControl (__display displayCtrl 266854) +#define __timeControl (__display displayCtrl 266859) +#define __background (__display displayCtrl 266856) + +__background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa)); + +if (GVAR(outputPFH) != -1) exitWith {}; + +GVAR(outputPFH) = [{ + private ["_pos", "_mapSize", "_gridConfig", "_offsetX", "_offsetY", "_stepX", "_stepY", "_xGrid", "_yGrid", "_xCoord", "_yCoord", "_dagrHeading", "_dagrGrid", "_bearing", "_MYpos", "_WPpos", "_dagrDistance", "_distance"]; + + // Abort Condition + if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { + GVAR(outputPFH) = -1; + 135471 cutText ["", "PLAIN"]; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + // GRID + _pos = getPosASL ACE_player; + + _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); + _gridConfig = (configFile >> "CfgWorlds" >> worldName >> "Grid"); + _offsetX = getNumber (_gridConfig >> "offsetX"); + _offsetY = getNumber (_gridConfig >> "offsetY"); + _stepX = getNumber (_gridConfig >> "Zoom1" >> "stepX"); + _stepY = getNumber (_gridConfig >> "Zoom1" >> "stepY"); + + if (_stepY >= 0) then { + _pos set [1, (_mapSize - 100) - (_pos select 1) - _offsetY]; + }; + + // Incase grids go neg due to 99-00 boundry + if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];}; + if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];}; + + _xGrid = toArray Str(round(_pos select 0)); + while {count _xGrid < 5} do { + _xGrid = [48] + _xGrid; + }; + _xGrid resize 4; + _xGrid = toString _xGrid; + _xGrid = parseNumber _xGrid; + + _yGrid = toArray Str(round(_pos select 1)); + while {count _yGrid < 5} do { + _yGrid = [48] + _yGrid; + }; + _yGrid resize 4; + _yGrid = toString _yGrid; + _yGrid = parseNumber _yGrid; + + _xCoord = switch true do { + case (_xGrid >= 1000): { "" + Str(_xGrid) }; + case (_xGrid >= 100): { "0" + Str(_xGrid) }; + case (_xGrid >= 10): { "00" + Str(_xGrid) }; + default { "000" + Str(_xGrid) }; + }; + + _yCoord = switch true do { + case (_yGrid >= 1000): { "" + Str(_yGrid) }; + case (_yGrid >= 100): { "0" + Str(_yGrid) }; + case (_yGrid >= 10): { "00" + Str(_yGrid) }; + default { "000" + Str(_yGrid) }; + }; + + _dagrGrid = _xCoord + " " + _yCoord; + + // WP Grid + _xGrid2 = floor (DAGR_WP_INFO / 10000); + _yGrid2 = DAGR_WP_INFO - _xGrid2 * 10000; + + _xCoord2 = switch true do { + case (_xGrid2 >= 1000): { "" + Str(_xGrid2) }; + case (_xGrid2 >= 100): { "0" + Str(_xGrid2) }; + case (_xGrid2 >= 10): { "00" + Str(_xGrid2) }; + default { "000" + Str(_xGrid2) }; + }; + + _yCoord2 = switch true do { + case (_yGrid2 >= 1000): { "" + Str(_yGrid2) }; + case (_yGrid2 >= 100): { "0" + Str(_yGrid2) }; + case (_yGrid2 >= 10): { "00" + Str(_yGrid2) }; + default { "000" + Str(_yGrid2) }; + }; + + _dagrGrid2 = _xCoord2 + " " + _yCoord2; + + // Distance + _WPpos = [[_xCoord2, _yCoord2], true] call CBA_fnc_mapGridToPos; + _MYpos = [[_xCoord, _yCoord], true] call CBA_fnc_mapGridToPos; + _distance = _MYpos distance _WPpos; + _distance = floor (_distance * 10) / 10; + _dagrDistance = str _distance + "m"; + + // Heading + _dagrHeading = floor (if (GVAR(useDegrees)) then { + direction (vehicle ACE_player) + } else { + DEG_TO_MIL(direction (vehicle ACE_player)) + }); + + // WP Heading + _bearing = floor ((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir); + + // Output + __gridControl ctrlSetText format ["%1", _dagrGrid]; + __speedControl ctrlSetText format ["%1", _bearing]; + __elevationControl ctrlSetText format ["%1", _dagrGrid2]; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1", _dagrHeading] }); + __timeControl ctrlSetText format ["%1", _dagrDistance]; + +}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dagr/functions/fnc_toggleOverlay.sqf b/addons/dagr/functions/fnc_toggleOverlay.sqf new file mode 100644 index 0000000000..b05cb23fe5 --- /dev/null +++ b/addons/dagr/functions/fnc_toggleOverlay.sqf @@ -0,0 +1,50 @@ +/* + * Author: Rosuto, Ruthberg + * Toggles the DAGR overlay + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(run) = !GVAR(run); + +if (GVAR(run)) then { + GVAR(hidden) = true; + [{ + EXPLODE_1_PVT(_this select 0,_vehicle); + if (!GVAR(run) || (!alive ACE_player) || (vehicle ACE_player != _vehicle)) exitWith { + GVAR(run) = false; + 135471 cutText ["", "PLAIN"]; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + if (cameraView == "GUNNER") then { + if (!GVAR(hidden)) then { + GVAR(hidden) = true; + 135471 cutText ["", "PLAIN"]; + }; + } else { + if (GVAR(hidden)) then { + GVAR(hidden) = false; + switch (toUpper GVAR(displaySelection)) do { + case "WP" : { + call FUNC(outputWP); + }; + case "VECTOR" : { + call FUNC(outputVector); + }; + case "DATA" : { + call FUNC(outputData); + }; + }; + }; + }; + }, 0.1, [vehicle ACE_player]] call CBA_fnc_addPerFrameHandler; +}; diff --git a/addons/dagr/functions/script_component.hpp b/addons/dagr/functions/script_component.hpp new file mode 100644 index 0000000000..18b02deaee --- /dev/null +++ b/addons/dagr/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\dagr\script_component.hpp" \ No newline at end of file diff --git a/addons/dagr/initKeybinds.sqf b/addons/dagr/initKeybinds.sqf new file mode 100644 index 0000000000..a0a1107a08 --- /dev/null +++ b/addons/dagr/initKeybinds.sqf @@ -0,0 +1,30 @@ + +["ACE3 Equipment", QGVAR(MenuKey), "Configure DAGR", +{ + // Conditions: canInteract + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {false}; + + // Statement + if (!GVAR(menuRun)) then { + [] call FUNC(menuInit); + } else { + GVAR(PWR) = true; // Simulate pressing the power button + }; + true +}, +{false}, +[199, [false, true, false]], false] call cba_fnc_addKeybind; // (CTRL + Home) + +["ACE3 Equipment", QGVAR(ToggleKey), "Toggle DAGR", +{ + // Conditions: canInteract + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {false}; + + // Statement + [] call FUNC(toggleOverlay); + true +}, +{false}, +[199, [false, false, false]], false] call cba_fnc_addKeybind; // (Home) diff --git a/addons/dagr/script_component.hpp b/addons/dagr/script_component.hpp new file mode 100644 index 0000000000..f7a723e533 --- /dev/null +++ b/addons/dagr/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT dagr +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_DAGR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_DAGR + #define DEBUG_SETTINGS DEBUG_SETTINGS_DAGR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define DEG_TO_MIL(d) (d / 360 * 6400) +#define MIL_TO_DEG(d) (d / 6400 * 360) diff --git a/addons/dagr/stringtable.xml b/addons/dagr/stringtable.xml new file mode 100644 index 0000000000..7da844d614 --- /dev/null +++ b/addons/dagr/stringtable.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/addons/huntir/CfgMagazines.hpp b/addons/huntir/CfgMagazines.hpp index 176384c268..c11f81a98c 100644 --- a/addons/huntir/CfgMagazines.hpp +++ b/addons/huntir/CfgMagazines.hpp @@ -5,7 +5,7 @@ class CfgMagazines { displayName = CSTRING(magazine_displayName); displayNameShort = "HuntIR"; descriptionShort = ""; - picture = PATHTOF(UI\m_m1070_ca.paa); + picture = PATHTOF(data\m_m1070_ca.paa); ammo = "F_HuntIR"; }; }; diff --git a/addons/huntir/CfgVehicles.hpp b/addons/huntir/CfgVehicles.hpp index 3cce76e201..9e24473243 100644 --- a/addons/huntir/CfgVehicles.hpp +++ b/addons/huntir/CfgVehicles.hpp @@ -20,6 +20,7 @@ class CfgVehicles { class Parachute_02_base_F; class ACE_HuntIR: Parachute_02_base_F { scope = 1; + destrType = "DestructDefault"; displayName = "HuntIR"; model = PATHTOF(data\huntir.p3d); castDriverShadow = 0; diff --git a/addons/huntir/CfgWeapons.hpp b/addons/huntir/CfgWeapons.hpp index b4d6206441..6ff271d604 100644 --- a/addons/huntir/CfgWeapons.hpp +++ b/addons/huntir/CfgWeapons.hpp @@ -5,9 +5,9 @@ class CfgWeapons { class ACE_HuntIR_monitor: ACE_ItemCore { scope = 2; - displayName = CSTRING(STR_ACE_HUNTIR_monitor_displayName); + displayName = CSTRING(monitor_displayName); picture = PATHTOF(UI\w_huntir_monitor_ca.paa); - descriptionShort = CSTRING(STR_ACE_HUNTIR_monitor_displayName); + descriptionShort = CSTRING(monitor_displayName); model = PATHTOF(data\ace_huntir_monitor.p3d); class ItemInfo: InventoryItem_Base_F { diff --git a/addons/huntir/XEH_preInit.sqf b/addons/huntir/XEH_preInit.sqf index 0ae45c1540..7737030571 100644 --- a/addons/huntir/XEH_preInit.sqf +++ b/addons/huntir/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(cam); +PREP(handleDamage); PREP(handleFired); PREP(huntir); PREP(huntirCompass); diff --git a/addons/huntir/data/huntir.p3d b/addons/huntir/data/huntir.p3d index ebf349672e..e9b9147416 100644 Binary files a/addons/huntir/data/huntir.p3d and b/addons/huntir/data/huntir.p3d differ diff --git a/addons/huntir/UI/m_M1070_ca.paa b/addons/huntir/data/m_M1070_ca.paa similarity index 100% rename from addons/huntir/UI/m_M1070_ca.paa rename to addons/huntir/data/m_M1070_ca.paa diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index af229bfe75..64bf9e37b8 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -65,12 +65,12 @@ GVAR(no_cams) sort true; [{ GVAR(nearHuntIRs) = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE]; { - if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))}) then { + if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {damage _x < 0.5}) then { GVAR(no_cams) pushBack _x; }; } forEach GVAR(nearHuntIRs); { - if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))}) then { + if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {damage _x >= 0.5}) then { GVAR(no_cams) deleteAt _forEachIndex; if (_forEachIndex < GVAR(cur_cam)) then { GVAR(cur_cam) = GVAR(cur_cam) - 1; @@ -125,7 +125,7 @@ GVAR(no_cams) sort true; }; }; - private ["_cam_coord_y", "_cam_coord_x", "_speed", "_cam_time", "_cam_pos"]; + private ["_cam_coord_y", "_cam_coord_x", "_cam_time", "_cam_pos"]; GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]); GVAR(logic) setDir GVAR(ROTATE); @@ -138,8 +138,7 @@ GVAR(no_cams) sort true; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; - _speed = 1 max abs((velocity GVAR(huntIR)) select 2); - _cam_time = ((GVAR(pos) select 2) - 20) / _speed; + _cam_time = ACE_time - (GVAR(huntIR) getVariable [QGVAR(startTime), ACE_time]); ctrlSetText [3, format["%1 s", round(_cam_time)]]; _cam_pos = getPosVisual GVAR(huntIR); _cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)]; diff --git a/addons/huntir/functions/fnc_handleDamage.sqf b/addons/huntir/functions/fnc_handleDamage.sqf new file mode 100644 index 0000000000..34772d8a66 --- /dev/null +++ b/addons/huntir/functions/fnc_handleDamage.sqf @@ -0,0 +1,25 @@ +/* + * Author: Ruthberg + * + * Handles huntir damage + * + * Arguments: + * 0: huntir + * 1: selectionName + * 2: damage + * 3: source + * 4: projectile + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_5(_huntir,_selectionName,_damage,_source,_projectile); + +systemChat format["Selection: %1; Damage: %2", _selectionName, _damage]; + +_damage diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 16afd17546..447d5a4435 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -23,24 +23,29 @@ PARAMS_7(_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if (_ammo != "F_HuntIR") exitWith {}; -private ["_dir", "_pos", "_dirDegree", "_b", "_a", "_y", "_x"]; -_dir = ACE_player weaponDirection _weapon; -_pos = getPosATL ACE_player; - -_dirDegree = (_dir select 0) atan2 (_dir select 1); -_b = 500 / (tan((asin(_dir select 2)) + 10)); -_a = _b * sin(_dirDegree); -_b = _a / tan(_dirDegree); -_x = (_pos select 0) + _a; -_y = (_pos select 1) + _b; - [{ - PARAMS_3(_projectile,_x,_y); + PARAMS_1(_projectile); "ACE_HuntIR_Propell" createVehicle (getPosATL _projectile); [{ - PARAMS_3(_x,_y,_z); + PARAMS_1(_position); private ["_huntir"]; - _huntir = createVehicle ["ACE_HuntIR", [_x, _y, _z], [], 0, "FLY"]; - _huntir setPosATL [_x, _y, _z]; - }, [_x, _y, ((getPosATL _projectile) select 2) + 400], 5, 0] call EFUNC(common,waitAndExecute); -}, [_projectile, _x, _y], 5, 0] call EFUNC(common,waitAndExecute); + _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; + _huntir setPosATL _position; + _huntir setVariable [QGVAR(startTime), ACE_time, true]; + // TODO: Edit the .p3d to allow doing the following _huntir getHit "camera"; _huntir getHit "parachute"; + //_huntir addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; + [{ + EXPLODE_1_PVT(_this select 0,_huntir); + if (isNull _huntir) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + if (damage _huntir > 0) then { + private ["_velocity"]; + _velocity = velocity _huntir; + _velocity set [2, -1 min -20 * sqrt(damage _huntir)]; + _huntir setVelocity _velocity; + _huntir setVectorUp [0, 0, 1]; + }; + }, 0, [_huntir]] call CBA_fnc_addPerFrameHandler; + }, [getPosATL _projectile vectorAdd [0, 0, 50]], 2, 0] call EFUNC(common,waitAndExecute); +}, [_projectile], 5, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 7ee56415bf..da74ddf639 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -23,15 +23,21 @@ private ["_actions"]; _actions = []; { - private ["_unit"]; + private ["_unit", "_icon"]; _unit = _x; if ((_unit != _player) && {(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"}) then { + _icon = switch _unit do { + case (driver _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa) }; + case (gunner _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa) }; + case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) }; + default { "" }; + }; _actions pushBack [ [ str(_unit), [_unit, true] call EFUNC(common,getName), - "", + _icon, {}, {true}, {_this call FUNC(addPassengerActions);}, diff --git a/addons/kestrel4500/data/Kestrel4500.rvmat b/addons/kestrel4500/data/Kestrel4500.rvmat index 80872f5fec..256b6b86bb 100644 --- a/addons/kestrel4500/data/Kestrel4500.rvmat +++ b/addons/kestrel4500/data/Kestrel4500.rvmat @@ -5,8 +5,8 @@ ambient[] = {1,1,1,1}; diffuse[] = {1,1,1,1}; forcedDiffuse[] = {0,0,0,0}; emmisive[] = {0,0,0,1}; -specular[] = {1,1,1,1}; -specularPower = 0; +specular[] = {0.3,0.3,0.3,1}; +specularPower = 50; PixelShaderID = "Super"; VertexShaderID = "Super"; class Stage1 { @@ -50,7 +50,7 @@ class Stage4 { }; }; class Stage5 { - texture = "#(argb,8,8,3)color(0,0,0,0,0)"; + texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)"; uvSource = "tex"; class uvTransform { aside[] = {1,0,0}; diff --git a/addons/kestrel4500/initKeybinds.sqf b/addons/kestrel4500/initKeybinds.sqf index f6ad1e8a17..ab06dc2d2c 100644 --- a/addons/kestrel4500/initKeybinds.sqf +++ b/addons/kestrel4500/initKeybinds.sqf @@ -1,7 +1,7 @@ ["ACE3 Equipment", QGVAR(KestrelDialogKey), localize LSTRING(KestrelDialogKey), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (GVAR(Kestrel4500)) exitWith { closeDialog 0; false @@ -16,7 +16,7 @@ ["ACE3 Equipment", QGVAR(DisplayKestrelKey), localize LSTRING(DisplayKestrelKey), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement [] call FUNC(displayKestrel); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index a2fda5347c..0b51f57165 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -6,9 +6,9 @@ GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "A GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; -["medical_propagateWound", FUNC(onPropagateWound)] call ace_common_fnc_addEventHandler; -["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call ace_common_fnc_addEventHandler; -["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call ace_common_fnc_addEventHandler; +["medical_propagateWound", FUNC(onPropagateWound)] call EFUNC(common,addEventHandler); +["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call EFUNC(common,addEventHandler); +["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); ["medical_onUnconscious", { if (local (_this select 0)) then { @@ -30,7 +30,7 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; if (!isNil "acre_api_fnc_setGlobalVolume") then { [1] call acre_api_fnc_setGlobalVolume; }; }; }; -}] call ace_common_fnc_addEventHandler; +}] call EFUNC(common,addEventHandler); // Initialize all effects diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 701be65f2d..19bd75caad 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -33,22 +33,23 @@ if ([_caller] call FUNC(isMedic)) then { } else { if (_bloodPressureHigh > 20) then { _output = LSTRING(Check_Bloodpressure_Output_2); - _logOutPut = localize LSTRING(Check_Bloodpressure_Low); + _logOutPut = LSTRING(Check_Bloodpressure_Low); if (_bloodPressureHigh > 100) then { _output = LSTRING(Check_Bloodpressure_Output_3); - _logOutPut = localize LSTRING(Check_Bloodpressure_Normal); + _logOutPut = LSTRING(Check_Bloodpressure_Normal); if (_bloodPressureHigh > 160) then { _output = LSTRING(Check_Bloodpressure_Output_4); - _logOutPut = localize LSTRING(Check_Bloodpressure_High); + _logOutPut = LSTRING(Check_Bloodpressure_High); }; }; } else { if (random(10) > 3) then { _output = LSTRING(Check_Bloodpressure_Output_5); - _logOutPut = localize LSTRING(Check_Bloodpressure_NoBloodpressure); + _logOutPut = LSTRING(Check_Bloodpressure_NoBloodpressure); } else { _output = LSTRING(Check_Bloodpressure_Output_6); + //Fail to find pressure, no logoutput }; }; }; @@ -56,5 +57,5 @@ if ([_caller] call FUNC(isMedic)) then { ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { - [_target,"activity", localize LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + [_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); }; diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index 09d275d07d..9af18d0a6d 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -24,7 +24,7 @@ if (!alive _unit) then { _heartRate = 0; }; _heartRateOutput = LSTRING(Check_Pulse_Output_5); -_logOutPut = localize LSTRING(Check_Pulse_None); +_logOutPut = LSTRING(Check_Pulse_None); if (_heartRate > 1.0) then { if ([_caller] call FUNC(isMedic)) then { @@ -33,14 +33,14 @@ if (_heartRate > 1.0) then { } else { // non medical personel will only find a pulse/HR _heartRateOutput = LSTRING(Check_Pulse_Output_2); - _logOutPut = localize LSTRING(Check_Pulse_Weak); + _logOutPut = LSTRING(Check_Pulse_Weak); if (_heartRate > 60) then { if (_heartRate > 100) then { _heartRateOutput = LSTRING(Check_Pulse_Output_3); - _logOutPut = localize LSTRING(Check_Pulse_Strong); + _logOutPut = LSTRING(Check_Pulse_Strong); } else { _heartRateOutput = LSTRING(Check_Pulse_Output_4); - _logOutPut = localize LSTRING(Check_Pulse_Normal); + _logOutPut = LSTRING(Check_Pulse_Normal); }; }; }; @@ -49,5 +49,5 @@ if (_heartRate > 1.0) then { ["displayTextStructured", [_caller], [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { - [_unit,"activity", localize LSTRING(Check_Pulse_Log),[[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); + [_unit,"activity", LSTRING(Check_Pulse_Log),[[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); }; diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index 4c55cdabf6..f4516a100c 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -25,4 +25,4 @@ _callBack = [_this, 3, {}, [{}]] call BIS_fnc_Param; _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; _adjustment pushback [_value, _time, _callBack]; _unit setvariable [QGVAR(heartRateAdjustments), _adjustment ]; -["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call ace_common_fnc_localEvent; +["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index 46bacf2349..af7d9f3170 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -47,7 +47,7 @@ if (count _log >= 8) then { _log pushback [_message,_moment,_type, _arguments]; _unit setvariable [_logVarName, _log, true]; -["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call ace_common_fnc_localEvent; +["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent); _logs = _unit getvariable [QGVAR(allLogs), []]; if !(_logVarName in _logs) then { diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index 4f08cf5c1e..7495c04a8a 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -42,4 +42,4 @@ if (!_inList) then { _log pushback [_newItem, 1, ACE_time]; }; _unit setvariable [QGVAR(triageCard), _log, true]; -["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call ace_common_fnc_localEvent; +["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf index 4dd517679a..d51131ce0c 100644 --- a/addons/medical/functions/fnc_getTypeOfDamage.sqf +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -13,22 +13,23 @@ #include "script_component.hpp" -private ["_typeOfProjectile","_typeOfInjury"]; -_typeOfProjectile = _this select 0; -_typeOfInjury = switch (true) do { - case (_typeOfProjectile iskindof "BulletBase"): {"Bullet"}; - case (_typeOfProjectile iskindof "GrenadeCore"): {"Grenade"}; - case (_typeOfProjectile iskindof "TimeBombCore"): {"Explosive"}; - case (_typeOfProjectile iskindof "MineCore"): {"Explosive"}; - case (_typeOfProjectile iskindof "FuelExplosion"): {"Explosive"}; - case (_typeOfProjectile iskindof "ShellBase"): {"Shell"}; - case (_typeOfProjectile iskindof "RocketBase"): {"Explosive"}; - case (_typeOfProjectile iskindof "MissileBase"): {"Explosive"}; - case (_typeOfProjectile iskindof "LaserBombCore"): {"Explosive"}; - case (_typeOfProjectile iskindof "BombCore"): {"Explosive"}; - case (_typeOfProjectile iskindof "Grenade"): {"Grenade"}; - case (_typeOfProjectile == "VehicleCrash"): {"VehicleCrash"}; - default {_typeOfProjectile}; +PARAMS_1(_typeOfProjectile); + +private ["_typeOfDamage"]; + +_typeOfDamage = switch (true) do { + case (_typeOfProjectile isKindOf "BulletBase"): {"bullet"}; + case (_typeOfProjectile isKindOf "GrenadeCore"): {"grenade"}; + case (_typeOfProjectile isKindOf "TimeBombCore"): {"explosive"}; + case (_typeOfProjectile isKindOf "MineCore"): {"explosive"}; + case (_typeOfProjectile isKindOf "FuelExplosion"): {"explosive"}; + case (_typeOfProjectile isKindOf "ShellBase"): {"shell"}; + case (_typeOfProjectile isKindOf "RocketBase"): {"explosive"}; + case (_typeOfProjectile isKindOf "MissileBase"): {"explosive"}; + case (_typeOfProjectile isKindOf "LaserBombCore"): {"explosive"}; + case (_typeOfProjectile isKindOf "BombCore"): {"explosive"}; + case (_typeOfProjectile isKindOf "Grenade"): {"grenade"}; + default {toLower _typeOfProjectile}; }; -// TODO replace the capitalization on the switch results instead.. -toLower _typeOfInjury; + +_typeOfDamage diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 5e58772a36..ab6e6f2a68 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -52,6 +52,8 @@ if (GVAR(level) < 2) then { _damageReturn = _this call FUNC(handleDamage_basic); }; _newDamage = _this call FUNC(handleDamage_caching); + // handleDamage_caching may have modified the projectile string + _projectile = _this select 4; _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 8bd0267d3f..35e8b900fb 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -12,7 +12,7 @@ * 6: Type of Damage * * Return Value: - * Damage To Be Inflicted + * Nothing * * Public: No */ @@ -28,10 +28,7 @@ _typeOfProjectile = _this select 4; _newDamage = _this select 5; // Most likely taking exessive fire damage. Lets exit. -if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith { - 0 -}; -_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); +if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {}; _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitwith {}; @@ -44,6 +41,7 @@ _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; [_unit] call FUNC(handleDamage_advancedSetDamage); +_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); [_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds); // TODO Disabled until implemented fully @@ -63,5 +61,3 @@ if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { [_unit] call FUNC(setUnconscious); }; }; - -_amountOfDamage; diff --git a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index f464ef5a94..3df8a5ce0c 100644 --- a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -13,42 +13,22 @@ #include "script_component.hpp" -private ["_unit", "_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"]; -_unit = _this select 0; +PARAMS_1(_unit); if (!local _unit) exitwith {}; -_bodyStatus = _unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]; +private ["_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"]; + // ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"] -_headDamage = _bodyStatus select 0; -if (_headDamage > 0.95) then { - _unit setHitPointDamage ["hitHead", 0.95]; -} else { - _unit setHitPointDamage ["hitHead", _headDamage]; -}; +_bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; -_torsoDamage = _bodyStatus select 1; -if (_torsoDamage > 0.95) then { - _unit setHitPointDamage ["hitBody", 0.95]; -} else { - _unit setHitPointDamage ["hitBody", _torsoDamage]; -}; +EXPLODE_6_PVT(_bodyStatus,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_unit setHitPointDamage ["hitHead", _headDamage min 0.95]; +_unit setHitPointDamage ["hitBody", _torsoDamage min 0.95]; +_unit setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95]; +_unit setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; -_handsDamage = (_bodyStatus select 2) + (_bodyStatus select 3); -if (_handsDamage > 0.95) then { - _unit setHitPointDamage ["hitHands", 0.95]; -} else { - _unit setHitPointDamage ["hitHands", _handsDamage]; -}; - -_legsDamage = (_bodyStatus select 4) + (_bodyStatus select 5); -if (_legsDamage > 0.95) then { - _unit setHitPointDamage ["hitLegs", 0.95]; -} else { - _unit setHitPointDamage ["hitLegs", _legsDamage]; -}; - -if ({_x > 0} count _bodyStatus == 0) then { +if (_bodyStatus isEqualTo [0,0,0,0,0,0]) then { _unit setDamage 0; }; diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 95d750843d..042d9c702b 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -41,17 +41,24 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN if (GVAR(enableVehicleCrashes)) then { _selectionName = _hitSelections select (floor(random(count _hitSelections))); _projectile = "vehiclecrash"; + _this set [1, _selectionName]; + _this set [4, _projectile]; }; }; // From AGM medical: // Exclude falling damage to everything other than legs; reduce structural damage. if (((velocity _unit) select 2 < -5) && {(vehicle _unit == _unit)}) then { - _unit setVariable [QGVAR(isFalling), True]; + _unit setVariable [QGVAR(isFalling), true]; + _projectile = "falling"; + _this set [4, "falling"]; }; - -if (_unit getVariable [QGVAR(isFalling), false] && {!(_selectionName in ["", "leg_l", "leg_r"])}) exitWith {}; +if (_unit getVariable [QGVAR(isFalling), false] && {!(_selectionName in ["", "leg_l", "leg_r"])}) exitWith {0}; if (_unit getVariable [QGVAR(isFalling), false]) then { + if (_selectionName == "") then { + _selectionName = ["leg_l", "leg_r"] select (floor(random 2)); + }; + _this set [1, _selectionName]; _newDamage = _newDamage * 0.7; }; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 0ff6eaccd4..c33d83bb40 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -21,7 +21,7 @@ if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {}; _unit setvariable [QGVAR(inCardiacArrest), true,true]; _unit setvariable [QGVAR(heartRate), 0]; -["Medical_onEnteredCardiacArrest", [_unit]] call ace_common_fnc_localEvent; +["Medical_onEnteredCardiacArrest", [_unit]] call EFUNC(common,localEvent); [_unit, true] call FUNC(setUnconscious); _timeInCardiacArrest = 120 + round(random(600)); diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index b2ddd0122a..543a2e6ae9 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1585,6 +1585,13 @@ %1 zkontroloval srdeční tep: %2 %1 verificou a frequência cardíaca: %2 + + None + Нет + Żadna + Nada + Keine + Weak Schwach diff --git a/addons/rangecard/CfgVehicles.hpp b/addons/rangecard/CfgVehicles.hpp index f999d7a5a7..a5832756ff 100644 --- a/addons/rangecard/CfgVehicles.hpp +++ b/addons/rangecard/CfgVehicles.hpp @@ -22,15 +22,24 @@ class CfgVehicles { priority = 0.1; icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); exceptions[] = {"notOnMap"}; - }; - class GVAR(openCopy) { - displayName = CSTRING(OpenRangeCardCopy); - condition = QUOTE(call FUNC(canShowCopy) && !GVAR(RangeCardOpened)); - statement = QUOTE(true call FUNC(openRangeCard)); - showDisabled = 0; - priority = 0.1; - icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); - exceptions[] = {"notOnMap"}; + class GVAR(openCopy) { + displayName = CSTRING(OpenRangeCardCopy); + condition = QUOTE(call FUNC(canShowCopy) && !GVAR(RangeCardOpened)); + statement = QUOTE(true call FUNC(openRangeCard)); + showDisabled = 0; + priority = 0.1; + icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + exceptions[] = {"notOnMap"}; + }; + class GVAR(makeCopy) { + displayName = CSTRING(CopyRangeCard); + condition = QUOTE(call FUNC(canShow) && !GVAR(RangeCardOpened)); + statement = QUOTE(GVAR(ammoClassCopy) = GVAR(ammoClass); GVAR(magazineClassCopy) = GVAR(magazineClass); GVAR(weaponClassCopy) = GVAR(ammoClass);); + showDisabled = 0; + priority = 0.1; + icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + exceptions[] = {"notOnMap"}; + }; }; }; }; diff --git a/addons/rangecard/functions/fnc_canShow.sqf b/addons/rangecard/functions/fnc_canShow.sqf index f7450e10e3..330788ee7c 100644 --- a/addons/rangecard/functions/fnc_canShow.sqf +++ b/addons/rangecard/functions/fnc_canShow.sqf @@ -15,4 +15,4 @@ */ #include "script_component.hpp" -(GVAR(ammoClass) != "" && GVAR(magazineClass) != "" && GVAR(weaponClass) != "" && !GVAR(RangeCardOpened) && !(underwater ACE_player) && ("ACE_RangeCard" in (uniformItems ACE_player)) || ("ACE_RangeCard" in (vestItems ACE_player))) +(GVAR(ammoClass) != "" && GVAR(magazineClass) != "" && GVAR(weaponClass) != "" && !GVAR(RangeCardOpened) && ("ACE_RangeCard" in (uniformItems ACE_player)) || ("ACE_RangeCard" in (vestItems ACE_player))) diff --git a/addons/rangecard/functions/fnc_canShowCopy.sqf b/addons/rangecard/functions/fnc_canShowCopy.sqf index 49fd891953..e78c64cc89 100644 --- a/addons/rangecard/functions/fnc_canShowCopy.sqf +++ b/addons/rangecard/functions/fnc_canShowCopy.sqf @@ -15,4 +15,4 @@ */ #include "script_component.hpp" -(GVAR(ammoClassCopy) != "" && GVAR(magazineClassCopy) != "" && GVAR(weaponClassCopy) != "" && !GVAR(RangeCardOpened) && !(underwater ACE_player) && ("ACE_RangeCard" in (uniformItems ACE_player)) || ("ACE_RangeCard" in (vestItems ACE_player))) +(GVAR(ammoClassCopy) != "" && GVAR(magazineClassCopy) != "" && GVAR(weaponClassCopy) != "" && !GVAR(RangeCardOpened) && ("ACE_RangeCard" in (uniformItems ACE_player)) || ("ACE_RangeCard" in (vestItems ACE_player))) diff --git a/addons/rangecard/initKeybinds.sqf b/addons/rangecard/initKeybinds.sqf index 519b4730cc..cb6ff49206 100644 --- a/addons/rangecard/initKeybinds.sqf +++ b/addons/rangecard/initKeybinds.sqf @@ -1,7 +1,7 @@ ["ACE3 Equipment", QGVAR(RangeCardDialogKey), localize "STR_ACE_RangeCard_RangeCardDialogKey", { // Conditions: canInteract, canShow - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (GVAR(RangeCardOpened)) exitWith { closeDialog 0; false @@ -17,7 +17,7 @@ ["ACE3 Equipment", QGVAR(RangeCardCopyDialogKey), localize "STR_ACE_RangeCard_RangeCardCopyDialogKey", { // Conditions: canInteract, canShowCopy - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (GVAR(RangeCardOpened)) exitWith { closeDialog 0; false diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index c2049a0e74..b16d2f978d 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -6,7 +6,7 @@ class CfgVehicles { displayName = CSTRING(DeploySandbag); condition = QUOTE(call FUNC(canDeploy)); statement = QUOTE(call FUNC(deploy)); - exceptions[] = {"isNotSwimming", "isNotInside"}; + exceptions[] = {"isNotSwimming"}; showDisabled = 1; priority = 4; icon = PATHTOF(UI\icon_sandbag_ca.paa); diff --git a/addons/spottingscope/CfgVehicles.hpp b/addons/spottingscope/CfgVehicles.hpp index 12f2f937dd..d42946214b 100644 --- a/addons/spottingscope/CfgVehicles.hpp +++ b/addons/spottingscope/CfgVehicles.hpp @@ -11,7 +11,6 @@ class CfgVehicles { showDisabled = 0; priority = 2; icon = PATHTOF(UI\w_spottingscope_ca.paa); - exceptions[] = {"isNotInside"}; }; }; }; diff --git a/addons/spottingscope/data/ace_ssvzs.p3d b/addons/spottingscope/data/ace_ssvzs.p3d index a30b34fa3e..a4d58c13f4 100644 Binary files a/addons/spottingscope/data/ace_ssvzs.p3d and b/addons/spottingscope/data/ace_ssvzs.p3d differ diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index bee27fbe8d..714d2cafb1 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -11,7 +11,6 @@ class CfgVehicles { showDisabled = 0; priority = 2; icon = PATHTOF(UI\w_sniper_tripod_ca.paa); - exceptions[] = {"isNotInside"}; }; }; };