diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf index da41d93358..f5d1304a95 100644 --- a/addons/cargo/functions/fnc_canLoad.sqf +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -18,6 +18,8 @@ params ["_player", "_object"]; +if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false}; + private ["_nearestVehicle"]; _nearestVehicle = [_player] call FUNC(findNearestVehicle); diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index 06f8fbcbbc..b817688336 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -39,7 +39,10 @@ SETMVAR(GVAR(initializedClasses),_initializedClasses); if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {}; private ["_text", "_condition", "_statement", "_icon", "_action"]; -_condition = {GVAR(enable)}; +_condition = { + params ["_target", "_player"]; + GVAR(enable) && {[_player, _target, []] call EFUNC(common,canInteractWith)} +}; _text = localize LSTRING(openMenu); _statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; _icon = ""; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 00831b60f5..4188950736 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -327,7 +327,7 @@ GVAR(OldIsCamera) = false; // Lastly, do JIP events // JIP Detection and event trigger. Run this at the very end, just in case anything uses it -if(isMultiplayer && { ACE_time > 0 || isNull player } ) then { +if (didJip) then { // We are jipping! Get ready and wait, and throw the event [{ if(!(isNull player)) then { diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index d0514aa700..81304da853 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -74,6 +74,7 @@ class CfgVehicles { scope = 2; displayName = $STR_ACE_CONCERTINA_WIRE; model = PATHTOF(data\ACE_ConcertinaWire.p3d); + EGVAR(logistics_wirecutter,isFence) = 1; class ACE_Actions { class ACE_MainActions { selection = ""; diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp index 867914b857..262c3edc34 100644 --- a/addons/hearing/ACE_Settings.hpp +++ b/addons/hearing/ACE_Settings.hpp @@ -19,4 +19,10 @@ class ACE_Settings { isClientSettable = 1; displayName = CSTRING(DisableEarRinging); }; + class GVAR(enabledForZeusUnits) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(enabledForZeusUnits_DisplayName); + description = CSTRING(enabledForZeusUnits_Description); + }; }; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 44ea8f734f..2273653c3a 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -130,6 +130,12 @@ class CfgVehicles { }; }; }; + class enabledForZeusUnits { + displayName = CSTRING(enabledForZeusUnits_DisplayName); + description = CSTRING(enabledForZeusUnits_Description); + typeName = "BOOL"; + defaultValue = 1; + }; }; class ModuleDescription { description = CSTRING(Module_Description); diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index 2806ef9970..7c21baaed2 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -47,5 +47,16 @@ class CfgWeapons { GVAR(lowerVolume) = 0.60; }; class H_Cap_marshal: H_Cap_headphones {}; -}; + class H_HelmetB_light: H_HelmetB { + GVAR(protection) = 0.8; + GVAR(lowerVolume) = 0.20; + }; + + class H_HelmetB_plain_mcamo; + class H_HelmetSpecB: H_HelmetB_plain_mcamo { + GVAR(protection) = 0.8; + GVAR(lowerVolume) = 0.20; + }; + +}; diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index 6a896c1820..de70c4f860 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -21,6 +21,7 @@ PARAMS_2(_unit,_strength); if (_unit != ACE_player) exitWith {}; if (_strength < 0.05) exitWith {}; if (!isNull curatorCamera) exitWith {}; +if ((!GVAR(enabledForZeusUnits)) && {player != ACE_player}) exitWith {}; if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { _strength = _strength / 4; diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf index 0c720ba278..b7213cec3a 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -21,4 +21,5 @@ if ((_logic getVariable "DisableEarRinging") != -1) then { [_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule); }; +[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule); ACE_LOGINFO("Hearing Module Initialized."); diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index a3af102580..403434cf4f 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -118,7 +118,7 @@ Audição - Enable combat deafness? + Combat Deafness Wł. głuchotę bojową ¿Habilitar sordera de combate? Aktiviere Taubheit im Gefecht? @@ -140,5 +140,11 @@ Ztráta sluchu je možná ve chvíly, kdy se v bezprostřední blízkosti střílí z velkorážní zbraně nebo při bombardování a osoba je bez ochrany sluchu (např. špunty). Tento modul umožňuje tuto věc povolit nebo zakázat. Este módulo ativa / desativa surdez em combate. Quando ativado, os jogadores podem ficar surdos quando uma arma é disparada ao seu redor ou uma explosão ocorre sem proteção auditiva. + + Effect Zeus RC + + + Allow zeus remote controlled units to be able to take hearing damage. + \ No newline at end of file diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index bcc553fff0..9eb22b9fb5 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -7,13 +7,13 @@ * 0: HuntIR * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -PARAMS_1(_huntIR); +params ["_huntIR"]; GVAR(huntIR) = _huntIR; GVAR(pos) = getPosVisual GVAR(huntIR); @@ -73,7 +73,8 @@ GVAR(no_cams) sort true; if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {_x getHitPointDamage "HitCamera" < 0.25}) then { GVAR(no_cams) pushBack _x; }; - } forEach GVAR(nearHuntIRs); + true + } count GVAR(nearHuntIRs); { if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {_x getHitPointDamage "HitCamera" >= 0.25}) then { GVAR(no_cams) deleteAt _forEachIndex; @@ -82,19 +83,19 @@ GVAR(no_cams) sort true; }; }; } forEach GVAR(no_cams); - + GVAR(cur_cam) = 0 max GVAR(cur_cam) min ((count GVAR(no_cams)) - 1); if (count GVAR(no_cams) > 0) then { GVAR(huntIR) = GVAR(no_cams) select GVAR(cur_cam); }; - + GVAR(pos) = getPosVisual GVAR(huntIR); - + if ((!dialog) || (count GVAR(no_cams) == 0) || ((GVAR(pos) select 2) <= 20)) exitWith { [_this select 1] call cba_fnc_removePerFrameHandler; - + GVAR(stop) = true; - + GVAR(pphandle) ppEffectEnable true; ppEffectDestroy GVAR(pphandle); @@ -108,7 +109,7 @@ GVAR(no_cams) sort true; deleteVehicle GVAR(logic); if (player != ACE_player) then { player remoteControl ACE_player; - }; + }; }; switch (GVAR(ZOOM)) do { @@ -131,7 +132,7 @@ GVAR(no_cams) sort true; }; 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); GVAR(logic) setVectorUp [0.0001, 0.0001, 1]; diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 121cd9fd12..1919b4547c 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -13,19 +13,19 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -PARAMS_7(_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; if (_ammo != "F_HuntIR") exitWith {}; [{ - PARAMS_1(_projectile); - + params ["_projectile"]; + //If null (deleted or hit water) exit: if (isNull _projectile) exitWith {}; //If it's not spinning (hit ground), bail: @@ -33,15 +33,16 @@ if (_ammo != "F_HuntIR") exitWith {}; "ACE_HuntIR_Propell" createVehicle (getPosATL _projectile); [{ - PARAMS_1(_position); private ["_huntir"]; + params ["_position"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; _huntir setVariable [QGVAR(startTime), ACE_time, true]; [{ - EXPLODE_1_PVT(_this select 0,_huntir); + params ["_args", "_idPFH"]; + _args params ["_huntir"]; if (isNull _huntir) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; private ["_parachuteDamage", "_velocity"]; _parachuteDamage = _huntir getHitPointDamage "HitParachute"; diff --git a/addons/huntir/functions/fnc_huntir.sqf b/addons/huntir/functions/fnc_huntir.sqf index 27fd5e280b..b1c269533d 100644 --- a/addons/huntir/functions/fnc_huntir.sqf +++ b/addons/huntir/functions/fnc_huntir.sqf @@ -4,10 +4,10 @@ * HuntIR monitor system * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ @@ -35,21 +35,21 @@ createDialog "ace_huntir_cam_dialog_off"; GVAR(connectionDelay) = 5; GVAR(state) = "searching"; GVAR(message) = []; - GVAR(messageSearching) = toArray "Searching....."; + GVAR(messageSearching) = toArray "Searching....."; GVAR(messageConnecting) = toArray "Connecting....."; [{ //Close monitor if we no longer have item: if ((!([ACE_player, "ACE_HuntIR_monitor"] call EFUNC(common,hasItem))) && {!isNull (uiNameSpace getVariable ["ace_huntir_monitor", displayNull])}) then { closeDialog 0; }; - + private ["_elapsedTime", "_nearestHuntIRs"]; _elapsedTime = ACE_time - GVAR(startTime); _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE]; - + if ((!dialog) || GVAR(done)) exitWith { [_this select 1] call cba_fnc_removePerFrameHandler; - + if (dialog && GVAR(state) == "connected") then { [_nearestHuntIRs select 0] call FUNC(cam); } else { diff --git a/addons/huntir/functions/fnc_huntirCompass.sqf b/addons/huntir/functions/fnc_huntirCompass.sqf index 30fcf45900..ff06b47df3 100644 --- a/addons/huntir/functions/fnc_huntirCompass.sqf +++ b/addons/huntir/functions/fnc_huntirCompass.sqf @@ -4,10 +4,10 @@ * HuntIR monitor compass * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ @@ -32,7 +32,7 @@ disableSerialization; private ["_fnc_correctIt"]; _fnc_correctIt = { - PARAMS_2(_pos,_dir); + params ["_pos", "_dir"]; if (_dir >= 270 || {_dir <= 90}) then { _pos set [1, (_pos select 1) + __OFFSET_Y] }; @@ -51,16 +51,17 @@ _fnc_correctIt = { HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"]; [{ - EXPLODE_1_PVT(_this select 0,_fnc_correctIt); - + params ["_args", "_idPFH"]; + _args params ["_fnc_correctIt"]; + if (GVAR(stop)) exitWith { HUNTIR_CAM_ROSE_LAYER_ID cutText ["", "PLAIN"]; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; - + private ["_dir", "_x1", "_y1", "_pos"]; _dir = getDir GVAR(cam); // direction player; - + _x1 = __CENTER_X - (__RADIUS * sin(_dir)); _y1 = __CENTER_Y - (__RADIUS * cos(_dir)); _pos = [[_x1, _y1], _dir] call _fnc_correctIt; @@ -84,5 +85,5 @@ HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"]; _pos = [[_x1, _y1], _dir] call _fnc_correctIt; __CHAR_E ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT]; __CHAR_E ctrlCommit 0; - + }, 0.01, [_fnc_correctIt]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 997974d2e3..d2cef4c9ef 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -501,8 +501,8 @@ class CfgVehicles { class ACE_Push { displayName = CSTRING(Push); distance = 6; - condition = QUOTE(getMass _target < 1000 && {alive _target}); - statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call DFUNC(push);); + condition = QUOTE(((getMass _target) <= 2600) && {alive _target} && {(vectorMagnitude (velocity _target)) < 3}); + statement = QUOTE(_this call FUNC(push)); showDisabled = 0; priority = -1; }; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 7fe151dac1..8db2d34ad1 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -10,6 +10,13 @@ ACE_Modifier = 0; _group selectLeader _leader; }] call EFUNC(common,addEventHandler); +//Pushing boats from FUNC(push) +[QGVAR(pushBoat), { + params ["_boat", "_newVelocity"]; + _boat setVelocity _newVelocity; +}] call EFUNC(common,addEventHandler); + + if (!hasInterface) exitWith {}; GVAR(isOpeningDoor) = false; diff --git a/addons/interaction/functions/fnc_push.sqf b/addons/interaction/functions/fnc_push.sqf index 946a5118be..86ad673d9c 100644 --- a/addons/interaction/functions/fnc_push.sqf +++ b/addons/interaction/functions/fnc_push.sqf @@ -4,23 +4,23 @@ * * Arguments: * 0: Boat - * 1: Velocity + * 1: Player * * Return Value: * None * * Example: - * [target, [vector]] call ace_interaction_fnc_push + * [Boats, Jose] call ace_interaction_fnc_push * * Public: No */ - + #include "script_component.hpp" -PARAMS_2(_boat,_velocity); +params ["_boat", "_player"]; -if !(local _boat) exitWith { - [_this, QUOTE(FUNC(push)), _boat] call EFUNC(common,execRemoteFnc); -}; +private ["_newVelocity"]; -_boat setVelocity _velocity; +_newVelocity = [2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5]; + +[QGVAR(pushBoat), [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent); diff --git a/addons/laserpointer/CfgJointRails.hpp b/addons/laserpointer/CfgJointRails.hpp new file mode 100644 index 0000000000..7583bd03b5 --- /dev/null +++ b/addons/laserpointer/CfgJointRails.hpp @@ -0,0 +1,8 @@ +class asdg_SlotInfo; +class asdg_FrontSideRail: asdg_SlotInfo { + class compatibleItems { + ACE_acc_pointer_red = 1; + ACE_acc_pointer_green = 1; + ACE_acc_pointer_green_IR = 1; + }; +}; diff --git a/addons/laserpointer/config.cpp b/addons/laserpointer/config.cpp index d368512257..cbb3105696 100644 --- a/addons/laserpointer/config.cpp +++ b/addons/laserpointer/config.cpp @@ -16,3 +16,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgJointRails.hpp" diff --git a/addons/logistics_wirecutter/CfgVehicles.hpp b/addons/logistics_wirecutter/CfgVehicles.hpp index a31d9c0d99..0b584409d3 100644 --- a/addons/logistics_wirecutter/CfgVehicles.hpp +++ b/addons/logistics_wirecutter/CfgVehicles.hpp @@ -5,4 +5,22 @@ class CfgVehicles { MACRO_ADDITEM(ACE_wirecutter,4); }; }; + + class Wall_F; + class NonStrategic; + + class Land_Net_Fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Net_Fence_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Net_FenceD_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_5m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_10m_Dam_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_10m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Pipe_fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Pipe_fence_4mNoLC_F: Wall_F { GVAR(isFence) = 1; }; + class Land_SportGround_fence_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_4mD_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_8mD_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Razorwire_F: NonStrategic { GVAR(isFence) = 1; }; }; diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index 4297cb3b83..2b365cc8e6 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -10,7 +10,7 @@ class CfgWeapons { picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); scope = 2; class ItemInfo: InventoryItem_Base_F { - mass = 100; + mass = 65; }; }; }; diff --git a/addons/logistics_wirecutter/XEH_preInit.sqf b/addons/logistics_wirecutter/XEH_preInit.sqf index 44eb941c16..39620bf35c 100644 --- a/addons/logistics_wirecutter/XEH_preInit.sqf +++ b/addons/logistics_wirecutter/XEH_preInit.sqf @@ -3,9 +3,6 @@ ADDON = false; PREP(cutDownFence); -PREP(cutDownFenceAbort); -PREP(cutDownFenceCallback); -PREP(getNearestFence); PREP(interactEH); PREP(isFence); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index f45f0c1511..2bf807975f 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -16,21 +16,35 @@ */ #include "script_component.hpp" -#define SOUND_CLIP_TIME_SPACEING 1.5 -private ["_timeToCut", "_progressCheck"]; +params ["_unit", "_fenceObject"]; +TRACE_2("params",_unit,_fenceObject); + +private ["_timeToCut", "_progressCheck", "_onCompletion", "_onFail"]; -PARAMS_2(_unit,_fenceObject); if (_unit != ACE_player) exitWith {}; _timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11}; [ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); +_onCompletion = { + TRACE_1("_onCompletion",_this); + (_this select 0) params ["_fenceObject", "", "_unit"]; + _fenceObject setdamage 1; + [_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); +}; + +_onFail = { + TRACE_1("_onFail", _this); + (_this select 0) params ["", "", "_unit"]; + [_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); +}; + _progressCheck = { - PARAMS_2(_args,_passedTime); - EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime); + params ["_args", "_passedTime"]; + _args params ["_fenceObject", "_lastSoundEffectTime"]; + if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then { - // playSound "ACE_wirecutter_sound"; playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10]; _args set [1, _passedTime]; }; @@ -38,4 +52,4 @@ _progressCheck = { ((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))}) }; -[_timeToCut, [_fenceObject,0], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar); +[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf deleted file mode 100644 index 20cb092131..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Author: commy2 - * Stops cutting down fence (reset animation) - * - * Arguments: - * Nothing - * - * Return Value: - * Nothing - * - * Example: - * [] call ace_logistics_wirecutter_fnc_cutDownFenceAbort - * - * Public: No - */ -#include "script_component.hpp" - -[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf deleted file mode 100644 index 57495a2a03..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: PabstMirror - * Once progressbar is done: Fence is cutdown - * - * Arguments: - * 0: Fence Object - * - * Return Value: - * Nothing - * - * Example: - * [aFence] call ace_logistics_wirecutter_fnc_cutDownFenceCallback - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_fenceObject); - -_fenceObject setdamage 1; -// [localize LSTRING(FenceCut)] call EFUNC(common,displayTextStructured); -[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf deleted file mode 100644 index 15bfbdb8ef..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: PabstMirror - * Gets nearest fence object (not actully used, left for utility) - * - * Arguments: - * 0: Unit - * - * Return Value: - * The return value - * - * Example: - * [player] call ace_logistics_wirecutter_fnc_getNearestFence - * - * Public: Yes - */ -#include "script_component.hpp" - -private "_nearestFence"; -PARAMS_1(_unit); - -_nearestFence = objNull; -{ - if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { - _nearestFence = _x; - }; -} forEach nearestObjects [_unit, [], 15]; - -_nearestFence diff --git a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf index 05c47c4454..e93296e44a 100644 --- a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf +++ b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf @@ -15,22 +15,24 @@ */ #include "script_component.hpp" -PARAMS_1(_interactionType); +params ["_interactionType"]; -//Ignore self-interaction menu -if (_interactionType != 0) exitWith {}; +//Ignore self-interaction menu or mounted vehicle interaction +if ((_interactionType != 0) || {(vehicle ACE_player) != ACE_player}) exitWith {}; //for performance only do stuff it they have a wirecutter item //(if they somehow get one durring keydown they'll just have to reopen) if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; +TRACE_1("Starting wire-cut action PFEH",_interactionType); + [{ private ["_fncStatement", "_attachedFence", "_fncCondition", "_helper", "_action"]; - PARAMS_2(_args,_pfID); - EXPLODE_3_PVT(_args,_setPosition,_addedHelpers,_fencesHelped); + params ["_args", "_pfID"]; + _args params ["_setPosition", "_addedHelpers", "_fencesHelped"]; if (!EGVAR(interact_menu,keyDown)) then { - {deleteVehicle _x;} forEach _addedHelpers; + {deleteVehicle _x; nil} count _addedHelpers; [_pfID] call CBA_fnc_removePerFrameHandler; } else { // Prevent Rare Error when ending mission with interact key down: @@ -40,11 +42,12 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; if (((getPosASL ace_player) distance _setPosition) > 5) then { _fncStatement = { - PARAMS_3(_dummyTarget,_player,_attachedFence); + params ["", "_player", "_attachedFence"]; [_player, _attachedFence] call FUNC(cutDownFence); }; _fncCondition = { - PARAMS_3(_dummyTarget,_player,_attachedFence); + params ["", "_player", "_attachedFence"]; + if (!([_player, _attachedFence, []] call EFUNC(common,canInteractWith))) exitWith {false}; ((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))}) }; @@ -52,15 +55,15 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; if (!(_x in _fencesHelped)) then { if ([_x] call FUNC(isFence)) then { _fencesHelped pushBack _x; - _helper = "Sign_Sphere25cm_F" createVehicleLocal (getpos _x); + _helper = "ACE_LogicDummy" createVehicleLocal (getpos _x); _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QUOTE(PATHTOF(ui\wirecutter_ca.paa)), _fncStatement, _fncCondition, {}, _x, [0,0,0], 5] call EFUNC(interact_menu,createAction); [_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject); _helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]); - _helper hideObject true; _addedHelpers pushBack _helper; }; }; - } forEach nearestObjects [ace_player, [], 15]; + nil + } count nearestObjects [ace_player, [], 15]; _args set [0, (getPosASL ace_player)]; }; diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf index 4c247b268a..c1e30a7e6f 100644 --- a/addons/logistics_wirecutter/functions/fnc_isFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -16,27 +16,26 @@ */ #include "script_component.hpp" -//find is case sensitive, so keep everything lowercase -#define FENCE_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f", "ace_concertinawire"] - -#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] +params ["_object"]; +TRACE_1("params",_object); private ["_typeOf", "_returnValue"]; -PARAMS_1(_object); -_typeOf = toLower (typeOf _object); +_typeOf = typeOf _object; _returnValue = false; if (_typeOf != "") then { //If the fence has configEntry we can check it directly - _returnValue = _typeOf in FENCE_TYPENAMES; + _returnValue = (1 == (getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence)))); } else { + //TODO: 1.50 use getModelInfo _typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d" { if ((_typeOf find _x) != -1) exitWith { _returnValue = true; }; - } forEach FENCE_P3DS; + nil + } count FENCE_P3DS; }; _returnValue diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index 6dae60dfd2..a86ace1592 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT logistics_wirecutter #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER #define DEBUG_MODE_FULL #endif @@ -10,3 +12,9 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + + +//find is case sensitive, so keep everything lowercase +#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] + +#define SOUND_CLIP_TIME_SPACEING 1.5 diff --git a/addons/main/config.cpp b/addons/main/config.cpp index 9399b14279..c44f9d1d46 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -541,7 +541,7 @@ class CfgPatches { "a3_weapons_f_vests", "a3data", "map_vr", - "extended_eventhandlers", "CBA_UI", "CBA_XEH", "CBA_XEH_A3" + "extended_eventhandlers", "cba_ui", "cba_xeh", "cba_xeh_a3", "cba_jr" }; author[] = {"ACE Team"}; authorUrl = ""; diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index e67c45e675..41514e4aaf 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -97,5 +97,87 @@ // Time functions for accuracy per frame #define ACE_tickTime (ACE_time + (diag_tickTime - ACE_diagTime)) +#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message) +#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message) -#include "script_debug.hpp" \ No newline at end of file +#define ACE_LOGERROR(message) ACE_LOG(COMPONENT,"ERROR",message) +#define ACE_LOGERROR_1(message,arg1) ACE_LOGERROR(FORMAT_1(message,arg1)) +#define ACE_LOGERROR_2(message,arg1,arg2) ACE_LOGERROR(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGERROR_3(message,arg1,arg2,arg3) ACE_LOGERROR(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGERROR_4(message,arg1,arg2,arg3,arg4) ACE_LOGERROR(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGERROR_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGERROR(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGERROR_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGERROR(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGERROR_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGERROR(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGERROR_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGERROR(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_ERRORFORMAT(message) ACE_LOGFORMAT(COMPONENT,"ERROR",message) +#define ACE_ERRORFORMAT_1(message,arg1) ACE_ERRORFORMAT(FORMAT_1(message,arg1)) +#define ACE_ERRORFORMAT_2(message,arg1,arg2) ACE_ERRORFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_ERRORFORMAT_3(message,arg1,arg2,arg3) ACE_ERRORFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_ERRORFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_ERRORFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_ERRORFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_ERRORFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_ERRORFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_ERRORFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_ERRORFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_ERRORFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_ERRORFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_ERRORFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGWARNING(message) ACE_LOG(COMPONENT,"WARNING",message) +#define ACE_LOGWARNING_1(message,arg1) ACE_LOGWARNING(FORMAT_1(message,arg1)) +#define ACE_LOGWARNING_2(message,arg1,arg2) ACE_LOGWARNING(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGWARNING_3(message,arg1,arg2,arg3) ACE_LOGWARNING(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGWARNING_4(message,arg1,arg2,arg3,arg4) ACE_LOGWARNING(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGWARNING_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGWARNING(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGWARNING_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGWARNING(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGWARNING_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGWARNING(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGWARNING_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGWARNING(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_WARNINGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"WARNING",message) +#define ACE_WARNINGFORMAT_1(message,arg1) ACE_WARNINGFORMAT(FORMAT_1(message,arg1)) +#define ACE_WARNINGFORMAT_2(message,arg1,arg2) ACE_WARNINGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_WARNINGFORMAT_3(message,arg1,arg2,arg3) ACE_WARNINGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_WARNINGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_WARNINGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_WARNINGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_WARNINGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_WARNINGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_WARNINGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_WARNINGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_WARNINGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_WARNINGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_WARNINGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGINFO(message) ACE_LOG(COMPONENT,"INFO",message) +#define ACE_LOGINFO_1(message,arg1) ACE_LOGINFO(FORMAT_1(message,arg1)) +#define ACE_LOGINFO_2(message,arg1,arg2) ACE_LOGINFO(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGINFO_3(message,arg1,arg2,arg3) ACE_LOGINFO(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGINFO_4(message,arg1,arg2,arg3,arg4) ACE_LOGINFO(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGINFO_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGINFO(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGINFO_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGINFO(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGINFO_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGINFO(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGINFO_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGINFO(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_INFOFORMAT(message) ACE_LOGFORMAT(COMPONENT,"INFO",message) +#define ACE_INFOFORMAT_1(message,arg1) ACE_INFOFORMAT(FORMAT_1(message,arg1)) +#define ACE_INFOFORMAT_2(message,arg1,arg2) ACE_INFOFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_INFOFORMAT_3(message,arg1,arg2,arg3) ACE_INFOFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_INFOFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_INFOFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_INFOFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_INFOFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_INFOFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_INFOFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_INFOFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_INFOFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_INFOFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_INFOFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGDEBUG(message) ACE_LOG(COMPONENT,"DEBUG",message) +#define ACE_LOGDEBUG_1(message,arg1) ACE_LOGDEBUG(FORMAT_1(message,arg1)) +#define ACE_LOGDEBUG_2(message,arg1,arg2) ACE_LOGDEBUG(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGDEBUG_3(message,arg1,arg2,arg3) ACE_LOGDEBUG(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGDEBUG_4(message,arg1,arg2,arg3,arg4) ACE_LOGDEBUG(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGDEBUG_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGDEBUG(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGDEBUG_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGDEBUG(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGDEBUG_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGDEBUG(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGDEBUG_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGDEBUG(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_DEBUGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"DEBUG",message) +#define ACE_DEBUGFORMAT_1(message,arg1) ACE_DEBUGFORMAT(FORMAT_1(message,arg1)) +#define ACE_DEBUGFORMAT_2(message,arg1,arg2) ACE_DEBUGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_DEBUGFORMAT_3(message,arg1,arg2,arg3) ACE_DEBUGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_DEBUGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_DEBUGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_DEBUGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_DEBUGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_DEBUGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_DEBUGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_DEBUGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_DEBUGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_DEBUGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_DEBUGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#include "script_debug.hpp" diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf index e8e03bb4c0..646e472f70 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -14,7 +14,8 @@ #include "script_component.hpp" -private ["_caller","_target"]; +private ["_caller","_target","_selectionName"]; _caller = _this select 0; _target = _this select 1; -[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +_selectionName = _this select 2; +[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 82edd1749f..92120a280c 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -14,9 +14,10 @@ #include "script_component.hpp" -private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow", "_logOutPut", "_output"]; +private ["_caller","_target","_selectionName","_bloodPressure","_bloodPressureHigh","_bloodPressureLow", "_logOutPut", "_output"]; _caller = _this select 0; _target = _this select 1; +_selectionName = _this select 2; _bloodPressure = [_target] call FUNC(getBloodPressure); if (!alive _target) then { @@ -54,6 +55,11 @@ if ([_caller] call FUNC(isMedic)) then { }; }; +if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC(hasTourniquetAppliedTo)}) then { + _output = LSTRING(Check_Bloodpressure_Output_6); + _logOutPut = ""; +}; + ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf index fd96321e8f..f615c69983 100644 --- a/addons/medical/functions/fnc_actionCheckPulse.sqf +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -14,7 +14,8 @@ #include "script_component.hpp" -private ["_caller","_target"]; +private ["_caller","_target","_selectionName"]; _caller = _this select 0; _target = _this select 1; -[[_caller, _target], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +_selectionName = _this select 2; +[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index d759bf1bc8..f719aad2d8 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -14,10 +14,10 @@ #include "script_component.hpp" -private ["_caller", "_unit", "_heartRateOutput", "_heartRate", "_logOutPut"]; +private ["_caller", "_unit", "_selectionName", "_heartRateOutput", "_heartRate", "_logOutPut"]; _caller = _this select 0; _unit = _this select 1; - +_selectionName = _this select 2; _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (!alive _unit) then { @@ -46,6 +46,11 @@ if (_heartRate > 1.0) then { }; }; +if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC(hasTourniquetAppliedTo)}) then { + _heartRateOutput = LSTRING(Check_Pulse_Output_5); + _logOutPut = LSTRING(Check_Pulse_None); +}; + ["displayTextStructured", [_caller], [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index 49f7a0e65c..ee16870fe0 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -37,7 +37,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); function = QFUNC(moduleMapFill); scope = 2; - isGlobal = 1; + isGlobal = 0; icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); functionPriority = 0; class Arguments { @@ -46,9 +46,9 @@ class CfgVehicles { description = CSTRING(MapDataAvailable_Description); typeName = "NUMBER"; class values { - class None {name = CSTRING(None); value = MAP_DETAIL_SAT; default = 1;}; - class Side {name = CSTRING(Side); value = MAP_DETAIL_TOPOROADS;}; - class Unique {name = CSTRING(Unique); value = MAP_DETAIL_NONE;}; + class Full {name = CSTRING(MapFill_Full); value = MAP_DETAIL_SAT; default = 1;}; + class Roads {name = CSTRING(MapFill_OnlyRoads); value = MAP_DETAIL_TOPOROADS;}; + class Disabled {name = CSTRING(MapFill_None); value = MAP_DETAIL_NONE;}; }; }; }; diff --git a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf index 0822bdf310..86ace87b3e 100644 --- a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf +++ b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf @@ -6,7 +6,7 @@ * 0: String version of Keypad entry ["ok","del","1",...] * * Return Value: - * Nothing + * None * * Example: * ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry @@ -16,15 +16,12 @@ #include "script_component.hpp" private ["_display", "_editText", "_actualPos"]; -PARAMS_1(_keypadButton); + +params ["_keypadButton"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) != APP_MODE_MARK) exitWith {}; diff --git a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf index 1cf81963f5..589ec096fb 100644 --- a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf +++ b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf @@ -3,18 +3,18 @@ * Handles the "Connect To" button from the menu application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appMenuButtonConnectRangefinder + * call ace_microdagr_fnc_appMenuButtonConnectRangefinder * * Public: No */ #include "script_component.hpp" -GVAR(currentWaypoint) = if (GVAR(currentWaypoint) == -2) then {-1} else {-2}; +GVAR(currentWaypoint) = [-2, -1] select (GVAR(currentWaypoint) == -2); GVAR(rangeFinderPositionASL) = []; [APP_MODE_INFODISPLAY] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf index bc6779c10a..9e808559b2 100644 --- a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf +++ b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf @@ -7,7 +7,7 @@ * 1: Index * * Return Value: - * Nothing + * None * * Example: * [settingList, 1] call ace_microdagr_fnc_appSettingsLBClick @@ -17,7 +17,7 @@ #include "script_component.hpp" disableSerialization; -PARAMS_2(_control,_itemClicked); +params ["", "_itemClicked"]; switch (_itemClicked) do { case (0): { GVAR(settingUseMils) = ! GVAR(settingUseMils)}; diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf index 1acd936370..956e24c5ba 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf @@ -3,13 +3,13 @@ * Handles clicking the delete button from the waypoint application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonDeleteWP + * call ace_microdagr_fnc_appWaypointsButtonDeleteWP * * Public: No */ @@ -18,12 +18,8 @@ private ["_display", "_wpIndex"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select GVAR(currentShowMode) == DISPLAY_MODE_DIALOG, displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; _wpIndex = lbCurSel (_display displayCtrl IDC_MODEWAYPOINTS_LISTOFWAYPOINTS); diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf index 881c0b3b5d..d2b3b0e20c 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf @@ -6,10 +6,10 @@ * The "SetWP" button * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonSetWP + * [1234] call ace_microdagr_fnc_appWaypointsButtonSetWP * * Public: No */ @@ -18,7 +18,7 @@ private ["_wpListBox", "_newWpIndex", "_waypoints"]; disableSerialization; -PARAMS_1(_wpButton); +params ["_wpButton"]; _wpListBox = (ctrlParent _wpButton) displayCtrl 144501; _newWpIndex = lbCurSel _wpListBox; diff --git a/addons/microdagr/functions/fnc_canShow.sqf b/addons/microdagr/functions/fnc_canShow.sqf index 9e54f927e0..70e8989031 100644 --- a/addons/microdagr/functions/fnc_canShow.sqf +++ b/addons/microdagr/functions/fnc_canShow.sqf @@ -6,32 +6,31 @@ * The display mode to test showing * * Return Value: - * Nothing + * None * * Example: - * [mode] call ace_microdagr_fnc_canShow + * [1] call ace_microdagr_fnc_canShow * * Public: No */ #include "script_component.hpp" - -PARAMS_1(_showType); +params ["_showType"]; private ["_returnValue"]; _returnValue = false; -switch (_showType) do { -case (DISPLAY_MODE_CLOSED): {_returnValue = true}; //Can always close -case (DISPLAY_MODE_HIDDEN): {_returnValue = true}; //Can always hide - -case (DISPLAY_MODE_DIALOG): { - _returnValue = ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; +_returnValue = switch (_showType) do { + case (DISPLAY_MODE_CLOSED): { true }; //Can always close + case (DISPLAY_MODE_HIDDEN): { true }; //Can always hide + case (DISPLAY_MODE_DIALOG): { + ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; -case (DISPLAY_MODE_DISPLAY): { + case (DISPLAY_MODE_DISPLAY): { //Can't have minimap up while zoomed in - _returnValue = (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; + (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; + default { false }; }; _returnValue diff --git a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf index c383d0a95e..f99ec78354 100644 --- a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf @@ -8,7 +8,7 @@ * 1: Waypoint Position ASL * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceAddWaypoint @@ -17,10 +17,11 @@ */ #include "script_component.hpp" -PARAMS_2(_waypointName,_waypointPosASL); - private "_waypoints"; +params ["_waypointName","_waypointPosASL"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; + + +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; _waypoints pushBack [_waypointName, _waypointPosASL]; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf index 62ca5a222a..d3681466b4 100644 --- a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf @@ -7,7 +7,7 @@ * 0: Waypoint Index * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceDeleteWaypoint @@ -16,13 +16,12 @@ */ #include "script_component.hpp" -PARAMS_1(_wpIndex); - private "_waypoints"; +params ["_wpIndex"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; if ((_wpIndex < 0) || (_wpIndex > ((count _waypoints) - 1))) exitWith {ERROR("out of bounds wp");}; _waypoints deleteAt _wpIndex; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf index f90ecb06be..da3484ceb0 100644 --- a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf +++ b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf @@ -4,7 +4,7 @@ * Device saving not implemented yet, just save to player object * * Arguments: - * Nothing + * None * * Return Value: * Waypoints @@ -16,4 +16,4 @@ */ #include "script_component.hpp" -(ace_player getVariable [QGVAR(waypoints), []]) +(ACE_player getVariable [QGVAR(waypoints), []]) diff --git a/addons/microdagr/functions/fnc_dialogClosedEH.sqf b/addons/microdagr/functions/fnc_dialogClosedEH.sqf index 0a7e5e5115..5180734644 100644 --- a/addons/microdagr/functions/fnc_dialogClosedEH.sqf +++ b/addons/microdagr/functions/fnc_dialogClosedEH.sqf @@ -3,13 +3,13 @@ * Handles the dialog closeing, switches back to display mode * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_dialogClosedEH + * call ace_microdagr_fnc_dialogClosedEH * * Public: No */ diff --git a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf index e7d2618160..566f08dc66 100644 --- a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf +++ b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf @@ -10,7 +10,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapButtonDownEH @@ -19,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["", "_mouseButton"]; //Only handle RMB if (_mouseButton != 1) exitWith {}; diff --git a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf index 21a164ff2e..2226011215 100644 --- a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf +++ b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf @@ -9,7 +9,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapDoubleTapEH @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["_theMap", "_mouseButton", "_xPos", "_yPos"]; private ["_worldPos"]; @@ -26,7 +26,7 @@ private ["_worldPos"]; if (_mouseButton != 0) exitWith {}; _worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos]; -_worldPos set [2, (getTerrainHeightASL _worldPos)]; +_worldPos pushBack (getTerrainHeightASL _worldPos); GVAR(newWaypointPosition) = _worldPos; [APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 644064d069..a74255601c 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -6,7 +6,7 @@ * 0: The Map * * Return Value: - * Nothing + * None * * Example: * [compassMap] call ace_microdagr_fnc_mapOnDrawEH @@ -15,10 +15,10 @@ */ #include "script_component.hpp" -PARAMS_1(_theMap); - private ["_mapSize", "_waypoints", "_size", "_targetPos", "_relBearing", "_wpName", "_wpPos", "_alpha"]; +params ["_theMap"]; + _mapSize = (ctrlPosition _theMap) select 3; _waypoints = [] call FUNC(deviceGetWaypoints); @@ -27,7 +27,7 @@ if (GVAR(currentApplicationPage) == 1) then { _theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS]; ctrlMapAnimCommit _theMap; _size = 412 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ace_player)), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ACE_player)), '', 0 ]; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ]; if (GVAR(currentWaypoint) != -1) then { @@ -42,23 +42,23 @@ if (GVAR(currentApplicationPage) == 1) then { }; }; if ((count _targetPos) == 3) then { - _relBearing = [ace_player, _targetPos] call BIS_fnc_relativeDirTo; + _relBearing = [ACE_player, _targetPos] call BIS_fnc_relativeDirTo; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [1,0.564,0.564,1], DUMMY_POS, _size, _size, _relBearing, '', 0 ]; }; }; } else { //Map Mode: if (GVAR(mapAutoTrackPosition)) then { - _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ace_player)]; + _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ACE_player)]; ctrlMapAnimCommit _theMap; }; _size = 48 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ace_player), _size, _size, (getDir ace_player), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (getDir ACE_player), '', 0 ]; if (GVAR(settingShowAllWaypointsOnMap)) then { _size = 32 * _mapSize; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5}; _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ]; } forEach _waypoints; diff --git a/addons/microdagr/functions/fnc_modeMapButtons.sqf b/addons/microdagr/functions/fnc_modeMapButtons.sqf index 5de4bf9ca7..a0d74bec49 100644 --- a/addons/microdagr/functions/fnc_modeMapButtons.sqf +++ b/addons/microdagr/functions/fnc_modeMapButtons.sqf @@ -6,7 +6,7 @@ * 0: String of the map button pressed * * Return Value: - * Nothing + * None * * Example: * ["autotrack"] call ace_microdagr_fnc_modeMapButtons @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_mode); +params ["_mode"]; [-1] call FUNC(saveCurrentAndSetNewMode); //backup current draw pos/zoom diff --git a/addons/microdagr/functions/fnc_moduleMapFill.sqf b/addons/microdagr/functions/fnc_moduleMapFill.sqf index d07b0bc518..03089a4ff4 100644 --- a/addons/microdagr/functions/fnc_moduleMapFill.sqf +++ b/addons/microdagr/functions/fnc_moduleMapFill.sqf @@ -4,23 +4,18 @@ * * Arguments: * 0: logic - * 1: synced units-not used - * 2: Module Activated * * Return Value: - * Nothing + * None * * Example: - * [module, [], true] call ace_microdagr_fnc_moduleMapFill + * [module] call ace_microdagr_fnc_moduleMapFill * * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_syncedUnits,_activated); +if !(isServer) exitWith {}; +params ["_logic"]; -if (!_activated) exitWith {WARNING("Module Placed but not active");}; - -if (isServer) then { - [_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); -}; +[_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/microdagr/functions/fnc_openDisplay.sqf b/addons/microdagr/functions/fnc_openDisplay.sqf index b4cec0fe46..aa2db94827 100644 --- a/addons/microdagr/functions/fnc_openDisplay.sqf +++ b/addons/microdagr/functions/fnc_openDisplay.sqf @@ -6,7 +6,7 @@ * 0: Display Mode to show the microDAGR in * * Return Value: - * Nothing + * None * * Example: * [1] call ace_microdagr_fnc_openDisplay @@ -15,9 +15,9 @@ */ #include "script_component.hpp" -private ["_oldShowMode", "_args", "_pfID", "_player"]; +private ["_oldShowMode", "_args", "_player"]; -DEFAULT_PARAM(0,_newDisplayShowMode,-1); +params [["_newDisplayShowMode", -1, [-1]]]; _oldShowMode = GVAR(currentShowMode); if (_newDisplayShowMode == -1) then { @@ -30,11 +30,10 @@ if ((_newDisplayShowMode == DISPLAY_MODE_DISPLAY) && {!([DISPLAY_MODE_DISPLAY] c if ((_newDisplayShowMode == DISPLAY_MODE_DIALOG) && {!([DISPLAY_MODE_DIALOG] call FUNC(canShow))}) then {_newDisplayShowMode = DISPLAY_MODE_HIDDEN}; - //On first-startup if (GVAR(currentApplicationPage) == APP_MODE_NULL) then { GVAR(currentApplicationPage) = APP_MODE_INFODISPLAY; - GVAR(mapPosition) = getPos ace_player; + GVAR(mapPosition) = getPos ACE_player; }; if (_newDisplayShowMode in [DISPLAY_MODE_CLOSED, DISPLAY_MODE_HIDDEN]) then { @@ -74,14 +73,14 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M //Start a pfeh to update display and handle hiding display [{ - PARAMS_2(_args,_pfID); - EXPLODE_1_PVT(_args,_player); - if ((isNull ace_player) || {!alive ace_player} || {ace_player != _player} || {!("ACE_microDAGR" in (items ace_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { + params ["_args", "_idPFH"]; + _args params ["_player"]; + if ((isNull ACE_player) || {!alive ACE_player} || {ACE_player != _player} || {!("ACE_microDAGR" in (items ACE_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { //Close Display if still open: if (GVAR(currentShowMode) != DISPLAY_MODE_CLOSED) then { [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); }; - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; } else { if (GVAR(currentShowMode) == DISPLAY_MODE_HIDDEN) then { //If display is hidden, and we can show, then swithc modes: @@ -96,5 +95,5 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M }; }; }; - }, 0.1, [ace_player]] call CBA_fnc_addPerFrameHandler; + }, 0.1, [ACE_player]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf index 154dfff94a..8b2c6672a8 100644 --- a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf +++ b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf @@ -8,7 +8,7 @@ * 2: Inclination (Degrees) * * Return Value: - * Nothing + * None * * Example: * [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData @@ -19,7 +19,7 @@ private ["_horizontalDistance", "_verticleDistance", "_targetOffset", "_targetPosASL"]; -PARAMS_3(_slopeDistance,_azimuth,_inclination); +params ["_slopeDistance", "_azimuth", "_inclination"]; if (GVAR(currentWaypoint) != -2) exitWith {}; //Only take waypoint when "connected" if (_slopeDistance < 0) exitWith {}; //Bad Data @@ -29,6 +29,6 @@ _verticleDistance = (sin _inclination) * _slopeDistance; _targetOffset = [((sin _azimuth) * _horizontalDistance), ((cos _azimuth) * _horizontalDistance), _verticleDistance]; //This assumes the "rangefinder view" pos is very close to player, at worst the turret should only be a few meters different -_targetPosASL = (getPosASL ace_player) vectorAdd _targetOffset; +_targetPosASL = (getPosASL ACE_player) vectorAdd _targetOffset; GVAR(rangeFinderPositionASL) = _targetPosASL; diff --git a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf index 64a5cab991..7cbec9f242 100644 --- a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf +++ b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf @@ -7,7 +7,7 @@ * 0: New Mode * * Return Value: - * Nothing + * None * * Example: * [2] call ace_microdagr_fnc_saveCurrentAndSetNewMode @@ -16,24 +16,21 @@ */ #include "script_component.hpp" -private ["_display", "_theMap", "_mapSize", "_centerPos", "_mapCtrlPos"]; +private ["_display", "_theMap", "_centerPos", "_mapCtrlPos"]; -PARAMS_1(_newMode); +params ["_newMode"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) == 2) then { - _theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS}; + _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture)); _mapCtrlPos = ctrlPosition _theMap; - _mapSize = _mapCtrlPos select 3; - _centerPos = [((_mapCtrlPos select 0) + (_mapCtrlPos select 2) / 2), ((_mapCtrlPos select 1) + (_mapCtrlPos select 3) / 2)]; + + _mapCtrlPos params ["_mapCtrlPosX", "_mapCtrlPosY", "_mapCtrlPosZ", "_mapSize"]; + _centerPos = [(_mapCtrlPosX + _mapCtrlPosZ / 2), (_mapCtrlPosY + _mapSize / 2)]; GVAR(mapPosition) = _theMap ctrlMapScreenToWorld _centerPos; GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize; diff --git a/addons/microdagr/functions/fnc_showApplicationPage.sqf b/addons/microdagr/functions/fnc_showApplicationPage.sqf index 3c042fdff3..dba6b54f18 100644 --- a/addons/microdagr/functions/fnc_showApplicationPage.sqf +++ b/addons/microdagr/functions/fnc_showApplicationPage.sqf @@ -3,10 +3,10 @@ * Changes the "application page" shown on the microDAGR * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_showApplicationPage @@ -19,12 +19,8 @@ private ["_display", "_theMap", "_mapSize"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //TopBar diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 910f422c75..826ea55e6c 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -3,10 +3,10 @@ * Updates the display (several times a second) called from the pfeh * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_updateDisplay @@ -15,15 +15,11 @@ */ #include "script_component.hpp" -private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_playerPos2d", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString"]; +private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString", "_daylight"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //Fade "shell" at night @@ -44,21 +40,21 @@ case (APP_MODE_INFODISPLAY): { (_display displayCtrl IDC_MODEDISPLAY_NORTHING) ctrlSetText _northingText; //Elevation: - _numASL = ((getPosASL ace_player) select 2) + EGVAR(common,mapAltitude); + _numASL = ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; _aboveSeaLevelText = if (_numASL > 0) then {"+" + _aboveSeaLevelText + " MSL"} else {_aboveSeaLevelText + " MSL"}; (_display displayCtrl IDC_MODEDISPLAY_ELEVATIONNUM) ctrlSetText _aboveSeaLevelText; //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODEDISPLAY_HEADINGNUM) ctrlSetText _compassAngleText; //Speed: - (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ace_player)))];; + (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ACE_player)))];; if (GVAR(currentWaypoint) == -1) then { @@ -89,13 +85,13 @@ case (APP_MODE_INFODISPLAY): { }; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; _numASL = (_targetPosLocationASL select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; @@ -111,14 +107,14 @@ case (APP_MODE_INFODISPLAY): { case (APP_MODE_COMPASS): { //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODECOMPASS_HEADING) ctrlSetText _compassAngleText; //Speed: - _SpeedText = format ["%1kph", (round (speed (vehicle ace_player)))];; + _SpeedText = format ["%1kph", (round (speed (vehicle ACE_player)))];; (_display displayCtrl IDC_MODECOMPASS_SPEED) ctrlSetText _SpeedText; if (GVAR(currentWaypoint) == -1) then { @@ -126,8 +122,6 @@ case (APP_MODE_COMPASS): { (_display displayCtrl IDC_MODECOMPASS_RANGE) ctrlSetText ""; (_display displayCtrl IDC_MODECOMPASS_TARGET) ctrlSetText ""; } else { - _playerPos2d = (getPosASL ace_player) select [0,2]; - _targetPosName = ""; _targetPosLocationASL = []; @@ -147,13 +141,13 @@ case (APP_MODE_COMPASS): { _rangeText = "---"; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; }; @@ -169,9 +163,9 @@ case (APP_MODE_WAYPOINTS): { lbClear _wpListBox; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _wpListBox lbAdd _wpName; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _wpPos) / 1000; _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)])]; } forEach _waypoints; diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index f28e3397c3..d3a955580a 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -325,7 +325,7 @@ Kolik informací je načteno do MicroDAGR? Quanta informação é preenchida no mapa do MicroDAGR - + Full Satellite + Buildings Pełna satelitarna + budynki Satelite completo + Edificios @@ -333,7 +333,7 @@ Satelit + Budovy Satélite completo + Edifícios - + Topographical + Roads Topograficzna + drogi Topografico + Carreteras @@ -341,7 +341,7 @@ Topografické + Cesty Topográfico + Estradas - + None (Cannot use map view) Żadna (wyłącza ekran mapy) Nada (No se puede el mapa) diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 6c6e824b16..68962af2c4 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/optics/CfgJointRails.hpp b/addons/optics/CfgJointRails.hpp new file mode 100644 index 0000000000..86c962afe5 --- /dev/null +++ b/addons/optics/CfgJointRails.hpp @@ -0,0 +1,15 @@ +class asdg_OpticRail; +class asdg_OpticRail1913: asdg_OpticRail { + class compatibleItems { + ACE_optic_Hamr_2D = 1; + ACE_optic_Hamr_PIP = 1; + ACE_optic_Arco_2D = 1; + ACE_optic_Arco_PIP = 1; + ACE_optic_MRCO_2D = 1; + ACE_optic_MRCO_PIP = 1; + ACE_optic_SOS_2D = 1; + ACE_optic_SOS_PIP = 1; + ACE_optic_LRPS_2D = 1; + ACE_optic_LRPS_PIP = 1; + }; +}; diff --git a/addons/optics/CfgOpticsEffect.hpp b/addons/optics/CfgOpticsEffect.hpp index a1bf62d6e3..8638277732 100644 --- a/addons/optics/CfgOpticsEffect.hpp +++ b/addons/optics/CfgOpticsEffect.hpp @@ -1,4 +1,3 @@ - class CfgOpticsEffect { class ACE_OpticsRadBlur1 { type = "radialblur"; diff --git a/addons/optics/CfgPreloadTextures.hpp b/addons/optics/CfgPreloadTextures.hpp index 57fa2cabf8..1354f91e18 100644 --- a/addons/optics/CfgPreloadTextures.hpp +++ b/addons/optics/CfgPreloadTextures.hpp @@ -1,4 +1,3 @@ - #define MACRO_PRELOAD \ GVAR(BodyDay) = "*"; \ GVAR(BodyNight) = "*"; \ diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index b7d2005d77..3bbd6b62bc 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -1,4 +1,3 @@ - class RscOpticsValue; class RscMapControl; class RscText; @@ -111,7 +110,7 @@ class RscInGameUI { idc = 1713011; x = "safeZoneXAbs + safeZoneWAbs - (safezoneX - safeZoneXABS) * ((getResolution select 4)/(16/3))"; colorBackground[] = {0,0,0,1}; - }; + }; }; class ACE_RscWeapon_Hamr: ACE_RscWeapon_base { diff --git a/addons/optics/CfgVehicles.hpp b/addons/optics/CfgVehicles.hpp index 92abeac04f..eda9a3d930 100644 --- a/addons/optics/CfgVehicles.hpp +++ b/addons/optics/CfgVehicles.hpp @@ -1,4 +1,3 @@ - class CfgVehicles { class Box_NATO_Support_F; class ACE_Box_Misc: Box_NATO_Support_F { diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index 11fdb1f427..1be66d3aa2 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -1,18 +1,17 @@ - class CfgWeapons { class ItemCore; class InventoryOpticsItem_Base_F; class Default; - + class Binocular: Default { forceOptics = 0; // Allow using compass with Binocular opticsZoomMin = 0.056889; // 5.25x power opticsZoomMax = 0.056889; // 9 px/mil - modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 horizontal field of view + modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 degrees horizontal field of view visionMode[] = {"Normal"}; // Can't use nvgs with binoculars any more than you can with scopes // Fix AI using Binocs on short range - #18737 // minRange = 300; // 300 = uses Rangefinder often (runs a few meters, stops, uses RF, repeats) - minRange = 500; //500 = seem almost never use it..? + minRange = 500; //500 = seem almost never use it..? minRangeProbab = 0.001; midRange = 1000; midRangeProbab = 0.01; diff --git a/addons/optics/config.cpp b/addons/optics/config.cpp index 224410cdec..79f71842ee 100644 --- a/addons/optics/config.cpp +++ b/addons/optics/config.cpp @@ -30,5 +30,6 @@ class CfgPatches { #include "CfgRscTitles.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgJointRails.hpp" #include "CfgPreloadTextures.hpp" diff --git a/addons/realisticnames/CfgWeapons.hpp b/addons/realisticnames/CfgWeapons.hpp index c8f8e1d845..83534a1083 100644 --- a/addons/realisticnames/CfgWeapons.hpp +++ b/addons/realisticnames/CfgWeapons.hpp @@ -1,4 +1,4 @@ - +class Mode_SemiAuto; class Mode_FullAuto; class CfgWeapons { @@ -510,14 +510,14 @@ class CfgWeapons { class player: player {}; }; - class cannon_105mm: cannon_120mm { + class cannon_105mm: CannonCore { displayName = "M68"; - class player: player { + class player: Mode_SemiAuto { displayName = "M68"; }; }; - class cannon_125mm: cannon_120mm { + class cannon_125mm: CannonCore { displayName = "2A46"; }; diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp index c12566d5b1..219945003d 100644 --- a/addons/repair/ACE_Repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -31,7 +31,7 @@ class ACE_Repair { class MiscRepair: ReplaceWheel { displayName = CSTRING(Repairing); // let's make empty string an auto generated string displayNameProgress = CSTRING(RepairingHitPoint); - condition = QUOTE((_target getHitPointDamage _hitPoint) > ([_caller] call FUNC(getPostRepairDamage))); + condition = QUOTE(call FUNC(canMiscRepair)); requiredEngineer = 0; repairingTime = 15; callbackSuccess = QUOTE(call FUNC(doRepair)); @@ -63,7 +63,7 @@ class ACE_Repair { requiredEngineer = QGVAR(engineerSetting_fullRepair); repairLocations[] = {QGVAR(fullRepairLocation)}; repairingTime = 30; - condition = "damage (_this select 1) > 0"; + condition = "damage _target > 0"; callbackSuccess = QUOTE(call FUNC(doFullRepair)); }; }; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 99a3588803..47459f532d 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -285,7 +285,10 @@ class CfgVehicles { transportRepair = 0; }; - class Heli_Transport_04_base_F; + class Helicopter_Base_H; + class Heli_Transport_04_base_F: Helicopter_Base_H { + GVAR(hitpointGroups[]) = { {"HitEngine", {"HitEngine1", "HitEngine2"}}, {"Glass_1_hitpoint", {"Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"}} }; + }; class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F { GVAR(canRepair) = 1; transportRepair = 0; @@ -303,12 +306,19 @@ class CfgVehicles { transportRepair = 0; }; - class Offroad_01_base_F; + class Car_F; + class Offroad_01_base_F: Car_F { + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2"}} }; + }; class Offroad_01_repair_base_F: Offroad_01_base_F { GVAR(canRepair) = 1; transportRepair = 0; }; + class MRAP_01_base_F: Car_F { + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}} }; + }; + class B_Truck_01_mover_F; class B_Truck_01_Repair_F: B_Truck_01_mover_F { GVAR(canRepair) = 1; diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf index ebf4c87537..8d2f1d8497 100644 --- a/addons/repair/XEH_preInit.sqf +++ b/addons/repair/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(addRepairActions); +PREP(canMiscRepair); PREP(canRemove); PREP(canRepair); PREP(canRepairTrack); @@ -15,6 +16,7 @@ PREP(doRepair); PREP(doRepairTrack); PREP(doReplaceTrack); PREP(doReplaceWheel); +PREP(getHitPointString); PREP(getPostRepairDamage); PREP(getWheelHitPointsWithSelections); PREP(hasItems); diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 9cd89838ae..11f4942d74 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -14,7 +14,6 @@ * Public: No */ #include "script_component.hpp" -#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] params ["_vehicle"]; TRACE_1("params", _vehicle); @@ -35,6 +34,11 @@ if (_type in _initializedClasses) exitWith {}; ([_vehicle] call FUNC(getWheelHitPointsWithSelections)) params ["_wheelHitPoints", "_wheelHitPointSelections"]; +private ["_hitPointsAddedNames", "_hitPointsAddedStrings", "_hitPointsAddedAmount"]; +_hitPointsAddedNames = []; +_hitPointsAddedStrings = []; +_hitPointsAddedAmount = []; + // add repair events to this vehicle class { if (_x in _wheelHitPoints) then { @@ -51,7 +55,7 @@ if (_type in _initializedClasses) exitWith {}; // remove wheel action _name = format ["Remove_%1", _x]; - _text = localize "STR_ACE_Repair_RemoveWheel"; + _text = localize LSTRING(RemoveWheel); _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)}; @@ -74,22 +78,39 @@ if (_type in _initializedClasses) exitWith {}; // exit if the hitpoint is in the blacklist, e.g. glasses if (_x in IGNORED_HITPOINTS) exitWith {}; + private ["_hitpointGroupConfig", "_inHitpointSubGroup", "_currentHitpoint"]; + + // Get hitpoint groups if available + _hitpointGroupConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); + _inHitpointSubGroup = false; + if (isArray _hitpointGroupConfig) then { + // Set variable if current hitpoint is in a sub-group (to be excluded from adding action) + _currentHitpoint = _x; + { + { + if (_x == _currentHitpoint) exitWith { + _inHitpointSubGroup = true; + }; + } forEach (_x select 1); + } forEach (getArray _hitpointGroupConfig); + }; + + // Exit if current hitpoint is in sub-group (only main hitpoints get actions) + if (_inHitpointSubGroup) exitWith {}; + // exit if the hitpoint is virtual if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; // add misc repair action - - private ["_name", "_text", "_icon", "_selection", "_customSelectionsConfig", "_currentHitpoint", "_condition", "_statement"]; + private ["_name", "_icon", "_selection", "_condition", "_statement"]; _name = format ["Repair_%1", _x]; - _text = format ["STR_ACE_Repair_%1", _x]; - - if (isLocalized _text) then { - _text = format [localize LSTRING(RepairHitpoint), localize _text]; - } else { - _text = format [localize LSTRING(RepairHitpoint), _x]; - }; + // Find localized string and track those added for numerization + ([_x, "%1", _x, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_text", "_trackArray"]; + _hitPointsAddedNames = _trackArray select 0; + _hitPointsAddedStrings = _trackArray select 1; + _hitPointsAddedAmount = _trackArray select 2; _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf new file mode 100644 index 0000000000..c60e59c840 --- /dev/null +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -0,0 +1,54 @@ +/* + * Author: Jonpas + * Check if misc repair action can be done, called from callbackSuccess. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * Can Misc Repair + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_canMiscRepair + * + * Public: No + */ +#include "script_component.hpp" + +private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return"]; +params ["_caller", "_target", "_hitPoint"]; + +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroups); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group + { + // Exit using found hitpoint group if this hitpoint is leader of any + if (_x select 0 == _hitPoint) exitWith { + _hitpointGroup = _x select 1; + }; + } forEach (getArray _hitpointGroupConfig); +}; + +// Add current hitpoint to the group +_hitpointGroup pushBack _hitPoint; + +// Get post repair damage +_postRepairDamage = [_caller] call FUNC(getPostRepairDamage); + +// Return true if damage can be repaired on any hitpoint in the group, else false +_return = false; +{ + if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith { + _return = true; + }; +} forEach _hitpointGroup; + +if (typeOf _target == "B_MRAP_01_F") then { + diag_log format ["%1 - %2", _hitPoint, _hitpointGroup]; +}; + +_return diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index dfc21830c9..1cf3f77bca 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -17,11 +17,11 @@ */ #include "script_component.hpp" +private ["_hitPointDamage", "_text", "_hitpointGroup"]; params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); // get current hitpoint damage -private "_hitPointDamage"; _hitPointDamage = _vehicle getHitPointDamage _hitPoint; _hitPointDamage = _hitPointDamage - 0.5; @@ -31,16 +31,36 @@ _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); // raise event to set the new hitpoint damage ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Retrieve group if current hitpoint is leader of any + { + if (_x select 0 == _hitPoint) exitWith { + ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; + // Set all sub-group hitpoints' damage to 0, if a hitpoint is invalid print RPT error + { + if (_x in _hitpoints) then { + ["setVehicleHitPointDamage", _vehicle, [_vehicle, _x, 0]] call EFUNC(common,targetEvent); + } else { + diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroups of %2", _x, _vehicle]; + }; + + } forEach (_x select 1); + }; + } forEach (getArray _hitpointGroupConfig); +}; + // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { - private "_text"; - _text = format ["STR_ACE_Repair_%1", _hitPoint]; + private ["_textLocalized", "_textDefault"]; - if (isLocalized _text) then { - _text = format [localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)), localize _text]; - } else { - _text = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); - }; + // Find localized string + _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)); + _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); + ([_hitPoint, _textLocalized, _textDefault] call FUNC(getHitPointString)) params ["_text"]; + // Display text [_text] call EFUNC(common,displayTextStructured); }; diff --git a/addons/repair/functions/fnc_getHitPointString.sqf b/addons/repair/functions/fnc_getHitPointString.sqf new file mode 100644 index 0000000000..1358e99595 --- /dev/null +++ b/addons/repair/functions/fnc_getHitPointString.sqf @@ -0,0 +1,89 @@ +/* + * Author: Jonpas + * Finds the localized string of the given hitpoint name or uses default text if none found. + * + * Arguments: + * 0: Hitpoint + * 1: Localized Text + * 2: Default Text + * 3: Track Added Hitpoints (default: false) + * + * Return Value: + * 0: Text + * 1: Added Hitpoint (default: []) + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getHitPointString + * + * Public: No + */ +#include "script_component.hpp" + +private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; +params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]]; + +_track = if (count _trackArray > 0) then {true} else {false}; +_trackNames = []; +_trackStrings = []; +_trackAmount = []; + +if (_track) then { + _trackNames = _trackArray select 0; + _trackStrings = _trackArray select 1; + _trackAmount = _trackArray select 2; +}; + +// Prepare first part of the string from stringtable +_text = LSTRING(Hit); + +// Remove "Hit" from hitpoint name if one exists +_toFind = if (_hitPoint find "Hit" == 0) then { + [_hitPoint, 3] call CBA_fnc_substr +} else { + _hitPoint +}; + +// Loop through always shorter part of the hitpoint name to find the string from stringtable +for "_i" from 0 to (count _hitPoint) do { + if (_track) then { + // Loop through already added hitpoints and save index + _trackIndex = -1; + { + if (_x == _toFind) exitWith { + _trackIndex = _forEachIndex; + }; + } forEach _trackNames; + + // Use already added hitpoint if one found above and numerize + if (_trackIndex != -1) exitWith { + _text = localize (_trackStrings select _trackIndex) + " " + str(_trackAmount select _trackIndex); + _trackAmount set [_trackIndex, (_trackAmount select _trackIndex) + 1]; // Set amount + TRACE_2("Same hitpoint found",_toFind,_trackNames); + }; + }; + + + // Localize if localization found + _combinedString = _text + _toFind; + if (isLocalized _combinedString) exitWith { + _text = format [_textLocalized, localize _combinedString]; + TRACE_1("Hitpoint localized",_toFind); + + if (_track) then { + // Add hitpoint to the list + _trackNames pushBack _toFind; + _trackStrings pushBack _combinedString; + _trackAmount pushBack 2; + }; + }; + + // Cut off one character + _toFind = [_toFind, 0, count _toFind - 1] call CBA_fnc_substr; +}; + +// Don't display part name if no string is found in stringtable +if (_text == LSTRING(Hit)) then { + _text = _textDefault; +}; + +[_text, [_trackNames, _trackStrings, _trackAmount]] diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index 92af5df80e..8fa7f498bd 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -164,14 +164,10 @@ _repairTime = if (isNumber (_config >> "repairingTime")) then { 0; }; -private ["_text", "_processText"]; +private ["_processText"]; +// Find localized string _processText = getText (_config >> "displayNameProgress"); -_text = format ["STR_ACE_Repair_%1", _hitPoint]; -if (isLocalized _text) then { - _text = format [_processText, localize _text]; -} else { - _text = _processText; -}; +([_hitPoint, _processText, _processText] call FUNC(getHitPointString)) params ["_text"]; // Start repair [ diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index 23c52bdec8..89983dd0e8 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -12,5 +12,5 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define IGNORED_HITPOINTS ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitGlass7","HitGlass8","HitGlass9","HitGlass10","HitGlass11","HitGlass12","HitGlass13","HitGlass14","HitGlass15","HitRGlass","HitLGlass"] -// #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]; +#define IGNORED_HITPOINTS ["HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6", "HitGlass7", "HitGlass8", "HitGlass9", "HitGlass10", "HitGlass11", "HitGlass12", "HitGlass13", "HitGlass14", "HitGlass15", "HitRGlass", "HitLGlass", "Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"] +#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 48a40f5b49..09759344f8 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -118,18 +118,6 @@ Who can perform a full repair on a vehicle? Kto może przeprowadzić pełną naprawę pojazdu? - - Repair %1 - Reparieren %1 - Reparación %1 - Réparer %1 - Napraw %1 - Opravit %1 - Reparar %1 - Ripara %1 - Szerelés %1 - Ремонт %1 - Repair >> Reparieren >> @@ -242,6 +230,15 @@ Motor Двигатель + + Left Horizontal Stabilizer + + + Right Horizontal Stabilizer + + + Vertical Stabilizer + Fuel Tank Tank @@ -254,15 +251,36 @@ Üzemanyagtank Топливный бак + + Transmission + + + Gear + + + Starter + + + Tail + + + Pilot Tube + + + Static Port + + + Ammo + - Main Turret + Turret Turm - Torreta príncipal + Torreta Tourelle Wieżyczka - Hlavní Věž - Torre principal - Torretta principale + Věž + Torre + Torretta Lövegtorony Башню @@ -278,6 +296,9 @@ Ágyú Пушку + + Missiles + Left Track Linke Kette @@ -463,77 +484,17 @@ Bal szélvédő Стекло (слава) - - Glass 1 - Scheibe 1 - Ventana 1 - Vitre 1 - Szyba 1 - Sklo 1 - Vidro 1 - Vetro 1 - Üveg 1 - Стекло 1 - - - Glass 2 - Scheibe 2 - Ventana 2 - Vitre 2 - Szyba 2 - Sklo 2 - Vidro 2 - Vetro 2 - Üveg 2 - Стекло 2 - - - Glass 3 - Scheibe 3 - Ventana 3 - Vitre 3 - Szyba 3 - Sklo 3 - Vidro 3 - Vetro 3 - Üveg 3 - Стекло 3 - - - Glass 4 - Scheibe 4 - Ventana 4 - Vitre 4 - Szyba 4 - Sklo 4 - Vidro 4 - Vetro 4 - Üveg 4 - Стекло 4 - - - Glass 5 - Scheibe 5 - Ventana 5 - Vitre 5 - Szyba 5 - Sklo 5 - Vidro 5 - Vetro 5 - Üveg 5 - Стекло 5 - - - Glass 6 - Scheibe 6 - Ventana 6 - Vitre 6 - Szyba 6 - Sklo 6 - Vidro 6 - Vetro 6 - Üveg 6 - Стекло 6 + + Glass + Scheibe + Ventana + Vitre + Szyba + Sklo + Vidro + Vetro + Üveg + Стекло Repair Settings @@ -696,4 +657,4 @@ Przydziel klasę budynku naprawczego do jednego lub kilku budynków. - \ No newline at end of file + diff --git a/addons/spectator/$PBOPREFIX$ b/addons/spectator/$PBOPREFIX$ new file mode 100644 index 0000000000..42fe4034e9 --- /dev/null +++ b/addons/spectator/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\spectator \ No newline at end of file diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp new file mode 100644 index 0000000000..78402cff23 --- /dev/null +++ b/addons/spectator/ACE_Settings.hpp @@ -0,0 +1,22 @@ +class ACE_Settings { + class GVAR(filterUnits) { + typeName = "SCALAR"; + value = 2; + values[] = {CSTRING(units_none), CSTRING(units_players), CSTRING(units_playable), CSTRING(units_all)}; + }; + class GVAR(filterSides) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_hostile), CSTRING(sides_all)}; + }; + class GVAR(restrictModes) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(modes_all), CSTRING(modes_unit), CSTRING(modes_free), CSTRING(modes_internal), CSTRING(modes_external)}; + }; + class GVAR(restrictVisions) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(modes_all), CSTRING(visions_nv), CSTRING(visions_ti), "$STR_Special_None"}; + }; +}; diff --git a/addons/spectator/CfgEventHandlers.hpp b/addons/spectator/CfgEventHandlers.hpp new file mode 100644 index 0000000000..e75956f440 --- /dev/null +++ b/addons/spectator/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)); + }; +}; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp new file mode 100644 index 0000000000..f6869462ac --- /dev/null +++ b/addons/spectator/CfgVehicles.hpp @@ -0,0 +1,117 @@ +class CfgVehicles { + class ACE_Module; + class GVAR(moduleSettings): ACE_Module { + scope = 2; + displayName = CSTRING(Settings_DisplayName); + icon = PATHTOF(UI\Icon_Module_Spectator_ca.paa); + category = "ACE"; + function = QFUNC(moduleSpectatorSettings); + isGlobal = 1; + author = ECSTRING(common,ACETeam); + class Arguments { + class unitsFilter { + displayName = CSTRING(units_DisplayName); + description = CSTRING(units_Description); + typeName = "NUMBER"; + class values { + class none { + name = CSTRING(units_none); + value = 0; + }; + class players { + name = CSTRING(units_players); + value = 1; + }; + class playable { + name = CSTRING(units_playable); + value = 2; + default = 1; + }; + class all { + name = CSTRING(units_all); + value = 3; + }; + }; + }; + class sidesFilter { + displayName = CSTRING(sides_DisplayName); + description = CSTRING(sides_Description); + typeName = "NUMBER"; + class values { + class player { + name = CSTRING(sides_player); + value = 0; + default = 1; + }; + class friendly { + name = CSTRING(sides_friendly); + value = 1; + }; + class hostile { + name = CSTRING(sides_hostile); + value = 2; + }; + class all { + name = CSTRING(sides_all); + value = 3; + }; + }; + }; + class cameraModes { + displayName = CSTRING(modes_DisplayName); + description = CSTRING(modes_Description); + typeName = "NUMBER"; + class values { + class all { + name = CSTRING(modes_all); + value = 0; + default = 1; + }; + class unit { + name = CSTRING(modes_unit); + value = 1; + }; + class free { + name = CSTRING(modes_free); + value = 2; + }; + class internal { + name = CSTRING(modes_internal); + value = 3; + }; + class external { + name = CSTRING(modes_external); + value = 4; + }; + }; + }; + class visionModes { + displayName = CSTRING(visions_DisplayName); + description = CSTRING(visions_Description); + typeName = "NUMBER"; + class values { + class all { + name = CSTRING(modes_all); + value = 0; + default = 1; + }; + class nv { + name = CSTRING(visions_nv); + value = 1; + }; + class ti { + name = CSTRING(visions_ti); + value = 2; + }; + class none { + name = "$STR_Special_None"; + value = 3; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(Settings_Description); + }; + }; +}; diff --git a/addons/spectator/README.md b/addons/spectator/README.md new file mode 100644 index 0000000000..b827bdcc49 --- /dev/null +++ b/addons/spectator/README.md @@ -0,0 +1,14 @@ +ace_spectator +======= + +A flexible spectator framework for mission makers to use. + +Includes a public API for integration into custom respawn frameworks and a template for use with the vanilla respawn framework. + +For more information, see: http://ace3mod.com/wiki/feature/spectator.html + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [SilentSpike](https://github.com/SilentSpike) diff --git a/addons/spectator/UI/Icon_Module_Spectator_ca.paa b/addons/spectator/UI/Icon_Module_Spectator_ca.paa new file mode 100644 index 0000000000..97258bb0d0 Binary files /dev/null and b/addons/spectator/UI/Icon_Module_Spectator_ca.paa differ diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp new file mode 100644 index 0000000000..e8bc6c210f --- /dev/null +++ b/addons/spectator/UI/interface.hpp @@ -0,0 +1,255 @@ +// Temporary fix until BI take care of it +class RscFrame { + x = 0; + y = 0; + w = 0; + h = 0; +}; + + +class RscButtonMenu; +class RscControlsGroupNoScrollbars; +//class RscFrame; +class RscListBox; +class RscMapControl; +class RscPicture; +class RscText; +class RscTree; + +class GVAR(interface) { + idd = 12249; + enableSimulation = 1; + movingEnable = 0; + onLoad = QUOTE([ARR_2('onLoad',_this)] call FUNC(handleInterface)); + onUnload = QUOTE([ARR_2('onUnload',_this)] call FUNC(handleInterface)); + onKeyDown = QUOTE([ARR_2('onKeyDown',_this)] call FUNC(handleInterface)); + onKeyUp = QUOTE([ARR_2('onKeyUp',_this)] call FUNC(handleInterface)); + class controlsBackground { + class mouseHandler: RscControlsGroupNoScrollbars { + x = safeZoneXAbs; + y = safeZoneY; + w = safeZoneWAbs; + h = safeZoneH; + onMouseButtonDown = QUOTE([ARR_2('onMouseButtonDown',_this)] call FUNC(handleInterface)); + onMouseButtonUp = QUOTE([ARR_2('onMouseButtonUp',_this)] call FUNC(handleInterface)); + onMouseZChanged = QUOTE([ARR_2('onMouseZChanged',_this)] call FUNC(handleInterface)); + onMouseMoving = QUOTE([ARR_2('onMouseMoving',_this)] call FUNC(handleInterface)); + onMouseHolding = QUOTE([ARR_2('onMouseMoving',_this)] call FUNC(handleInterface)); + }; + }; + class controls { + class compass: RscControlsGroupNoScrollbars { + idc = IDC_COMP; + x = COMPASS_X; + y = safeZoneY; + w = COMPASS_W; + h = TOOL_H; + class controls { + class compassBack: RscText { + x = 0; + y = 0; + w = COMPASS_W; + h = TOOL_H; + colorBackground[] = {COL_BACK}; + }; + class compass0_90: RscPicture { + idc = IDC_COMP_0; + x = COMPASS_W * 0.5; + y = 0; + w = COMPASS_W * 0.5; + h = TOOL_H; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture180_ca.paa"; + }; + class compass90_180: compass0_90 { + idc = IDC_COMP_90; + x = COMPASS_W; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture270_ca.paa"; + }; + class compass180_270: compass0_90 { + idc = IDC_COMP_180; + x = 0; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture0_ca.paa"; + }; + class compass270_0: compass0_90 { + idc = IDC_COMP_270; + x = COMPASS_W * -0.5; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture90_ca.paa"; + }; + class compassCaret: RscFrame { + x = COMPASS_W * 0.5; + y = 0; + w = 0; + h = TOOL_H; + colorText[] = {COL_FORE}; + }; + class compassFrame: compassBack { + style = 64; + shadow=2; + colorText[] = {COL_FORE}; + }; + }; + }; + class toolbar: RscControlsGroupNoScrollbars { + idc = IDC_TOOL; + x = safeZoneX; + y = safeZoneY + safeZoneH - TOOL_H; + w = safeZoneW; + h = TOOL_H; + class controls { + class nameTool: RscText { + idc = IDC_TOOL_NAME; + style = 2; + x = 0; + y = 0; + w = TOOL_W * 2; + h = TOOL_H; + shadow = 2; + colorText[]={COL_FORE}; + colorBackground[] = {COL_BACK}; + sizeEx = H_PART(1); + }; + class nameFrame: nameTool { + idc = -1; + style = 64; + }; + class viewTool: nameTool { + idc = IDC_TOOL_VIEW; + x = TOOL_W * 2 + MARGIN; + w = TOOL_W; + }; + class viewFrame: viewTool { + idc = -1; + style = 64; + }; + class visionTool: viewTool { + idc = IDC_TOOL_VISION; + x = TOOL_W * 3 + MARGIN * 2; + }; + class visionFrame: visionTool { + idc = -1; + style = 64; + }; + class clockTool: viewTool { + idc = IDC_TOOL_CLOCK; + x = safeZoneW - TOOL_W * 3 - MARGIN * 2; + }; + class clockFrame: clockTool { + idc = -1; + style = 64; + }; + class zoomTool: viewTool { + idc = IDC_TOOL_FOV; + x = safeZoneW - TOOL_W * 2 - MARGIN; + }; + class zoomFrame: zoomTool { + idc = -1; + style = 64; + }; + class speedTool: viewTool { + idc = IDC_TOOL_SPEED; + x = safeZoneW - TOOL_W; + }; + class speedFrame: speedTool { + idc = -1; + style = 64; + }; + }; + }; + class unitWindow: RscControlsGroupNoScrollbars { + idc = IDC_UNIT; + x = safeZoneX; + y = safeZoneY + TOOL_H * 6; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + class controls { + class unitTitle: RscText { + x = 0; + y = 0; + w = TOOL_W * 2; + h = H_PART(1); + style = 2; + colorText[] = {COL_FORE}; + colorBackground[] = {COL_FORE_D}; + sizeEx = H_PART(1); + text = CSTRING(UnitTitle); + }; + class unitTree: RscTree { + idc = IDC_UNIT_TREE; + x = 0; + y = H_PART(1); + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 14; + sizeEx = H_PART(0.8); + colorText[] = {COL_FORE}; + colorBorder[] = {0,0,0,0}; + colorBackground[] = {COL_BACK}; + colorSelect[] = { + "profilenamespace getvariable ['GUI_BCG_RGB_R',0.77]", + "profilenamespace getvariable ['GUI_BCG_RGB_G',0.51]", + "profilenamespace getvariable ['GUI_BCG_RGB_B',0.08]", + 1 + }; + multiselectEnabled = 0; + onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface)); + onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface)); + }; + class unitFrame: RscFrame { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + shadow = 2; + colorText[] = {COL_FORE}; + }; + }; + }; + class helpWindow: RscControlsGroupNoScrollbars { + idc = IDC_HELP; + x = safeZoneX + safeZoneW - TOOL_W * 2; + y = safeZoneY + TOOL_H * 6; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + class controls { + class helpTitle: RscText { + x = 0; + y = 0; + w = TOOL_W * 2; + h = H_PART(1); + style = 2; + colorText[] = {COL_FORE}; + colorBackground[] = {COL_FORE_D}; + sizeEx = H_PART(1); + text = CSTRING(HelpTitle); + }; + class helpContent: RscListBox { + idc = IDC_HELP_LIST; + x = 0; + y = H_PART(1); + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 14; + colorBackground[] = {COL_BACK}; + sizeEx = H_PART(0.8); + default = 1; + }; + class helpFrame: RscFrame { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + shadow = 2; + colorText[] = {COL_FORE}; + }; + }; + }; + class mapOverlay: RscMapControl { + idc = IDC_MAP; + type = 100; + x = safeZoneX; + y = safeZoneY; + w = safeZoneW; + h = safeZoneH; + onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface)); + onDraw = QUOTE(_this call FUNC(handleMap)); + }; + }; +}; diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf new file mode 100644 index 0000000000..35b463837f --- /dev/null +++ b/addons/spectator/XEH_postInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +//#include "initKeybinds.sqf"; + +// Add interaction menu exception +["isNotSpectating", {!(GETVAR((_this select 0),GVAR(isStaged),false))}] call EFUNC(common,addCanInteractWithCondition); + +["SettingsInitialized", { + GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes); + GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions); +}] call EFUNC(common,addEventHandler); diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf new file mode 100644 index 0000000000..d1bf48d106 --- /dev/null +++ b/addons/spectator/XEH_preInit.sqf @@ -0,0 +1,59 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(cacheUnitInfo); +PREP(cycleCamera); +PREP(handleCamera); +PREP(handleCompass); +PREP(handleIcons); +PREP(handleInterface); +PREP(handleMap); +PREP(handleMouse); +PREP(handleToolbar); +PREP(handleUnits); +PREP(interrupt); +PREP(moduleSpectatorSettings); +PREP(respawnTemplate); +PREP(setCameraAttributes); +PREP(setSpectator); +PREP(stageSpectator); +PREP(transitionCamera); +PREP(toggleInterface); +PREP(updateCameraModes); +PREP(updateSpectatableSides); +PREP(updateUnits); +PREP(updateVisionModes); + +// Permanent variables +GVAR(availableModes) = [0,1,2]; +GVAR(availableSides) = [west,east,resistance,civilian]; +GVAR(availableVisions) = [-2,-1,0,1]; + +GVAR(camAgent) = objNull; +GVAR(camMode) = 0; +GVAR(camPan) = 0; +GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20]; +GVAR(camSpeed) = 2.5; +GVAR(camTilt) = -10; +GVAR(camUnit) = objNull; +GVAR(camVision) = -2; +GVAR(camZoom) = 1.25; + +GVAR(interrupts) = []; +GVAR(isSet) = false; + +GVAR(showComp) = true; +GVAR(showHelp) = true; +GVAR(showIcons) = true; +GVAR(showInterface) = true; +GVAR(showMap) = false; +GVAR(showTool) = true; +GVAR(showUnit) = true; + +GVAR(unitList) = []; +GVAR(unitBlacklist) = []; +GVAR(unitWhitelist) = []; +GVAR(groupList) = []; + +ADDON = true; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp new file mode 100644 index 0000000000..6e32ed0413 --- /dev/null +++ b/addons/spectator/config.cpp @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"F3 Project","Head","SilentSpike","voiper"}; + authorUrl = "https://github.com/acemod"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "ui\interface.hpp" + +class CfgRespawnTemplates { + class ADDON { + onPlayerKilled = QFUNC(respawnTemplate); + onPlayerRespawn = QFUNC(respawnTemplate); + }; +}; diff --git a/addons/spectator/functions/fnc_cacheUnitInfo.sqf b/addons/spectator/functions/fnc_cacheUnitInfo.sqf new file mode 100644 index 0000000000..9f40651748 --- /dev/null +++ b/addons/spectator/functions/fnc_cacheUnitInfo.sqf @@ -0,0 +1,38 @@ +/* + * Author: SilentSpike + * Caches the units information for quick retrevial in spectator interface PFHs + * + * Arguments: + * 0: Unit to have info cached for + * + * Return Value: + * None + * + * Example: + * [vehicle player] call ace_spectator_fnc_cacheUnitInfo + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit"]; +private ["_color","_icon","_name"]; + +// Group info only needs to be cached once (groups can't change) +if (isNil { GETVAR((group _unit),GVAR(gColor),nil) }) then { + _color = [side group _unit] call BIS_fnc_sideColor; + SETVAR((group _unit),GVAR(gColor),_color); +}; + +// Unit info should be updated each time +_icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "Icon"); +_name = [_unit,false] call EFUNC(common,getName); + +// Handle CfgVehicleIcons +if (isText (configFile >> "CfgVehicleIcons" >> _icon)) then { + _icon = getText (configFile >> "CfgVehicleIcons" >> _icon); +}; + +SETVAR(_unit,GVAR(uIcon),_icon); +SETVAR(_unit,GVAR(uName),_name); diff --git a/addons/spectator/functions/fnc_cycleCamera.sqf b/addons/spectator/functions/fnc_cycleCamera.sqf new file mode 100644 index 0000000000..474d25cd0c --- /dev/null +++ b/addons/spectator/functions/fnc_cycleCamera.sqf @@ -0,0 +1,58 @@ +/* + * Author: SilentSpike + * Cycle through the spectator camera vision/view/units in steps + * + * Arguments: + * 0: Camera mode steps + * 1: Camera unit steps + * 2: Vision mode steps + * + * Return Value: + * None + * + * Example: + * [0, -1] call ace_spectator_fnc_cycleCamera + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_stepMode",0], ["_stepUnit",0], ["_stepVision",0]]; +private ["_modes","_visions","_iMode","_iVision","_countModes","_countVisions","_newMode","_newVision","_newUnit"]; + +_modes = GVAR(availableModes); +_units = GVAR(unitList); +_visions = GVAR(availableVisions); + +// Get current index +_iMode = (_modes find GVAR(camMode)) max 0; +_iUnit = (_units find GVAR(camUnit)) max 0; +_iVision = (_visions find GVAR(camVision)) max 0; + +_countModes = count _modes; +_countUnits = count _units; +_countVisions = count _visions; + +// Step index by step number (loop at ends) +if (_countModes != 0) then { + _iMode = (_iMode + _stepMode) % _countModes; + if (_iMode < 0) then { _iMode = _countModes + _iMode; }; +}; + +if (_countUnits != 0) then { + _iUnit = (_iUnit + _stepUnit) % _countUnits; + if (_iUnit < 0) then { _iUnit = _countUnits + _iUnit; }; +}; + +if (_countVisions != 0) then { + _iVision = (_iVision + _stepVision) % _countVisions; + if (_iVision < 0) then { _iVision = _countVisions + _iVision; }; +}; + +// Get value at new index +_newMode = _modes select _iMode; +_newUnit = _units select _iUnit; +_newVision = _visions select _iVision; + +[_newMode, _newUnit, _newVision] call FUNC(transitionCamera); diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf new file mode 100644 index 0000000000..db196c8504 --- /dev/null +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -0,0 +1,48 @@ +/* + * Author: F3 Project, Head, SilentSpike + * Handles free camera manipulation according to input + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleCamera, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +// Kill PFH when not in free cam (or display is closed) +if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_camera","_oldPos","_altMod","_zoomMod","_mX","_mY","_mZ","_pan","_x","_y","_z"]; + +_camera = GVAR(camera); +_oldPos = getPosASL _camera; + +// Dolly/Boom amount should be influnced by zoom level (it should really be exponential) +// Dollying should also slow as the camera gets close to the ground +_zoomMod = (GVAR(camZoom) * 0.8) max 1; +_altMod = ((((getPos _camera) select 2) * 0.05) max 0.1) min 1; + +_mX = (GVAR(camDolly) select 0) * _altMod / _zoomMod; +_mY = (GVAR(camDolly) select 1) * _altMod / _zoomMod; +_mZ = GVAR(camBoom) / _zoomMod; + +_pan = (GVAR(camPan) + 360) % 360; +_x = (_oldPos select 0) + (_mX * cos(_pan)) + (_mY * sin(_pan)); +_y = (_oldPos select 1) - (_mX * sin(_pan)) + (_mY * cos(_pan)); +_z = (_oldPos select 2) + _mZ; + +// Prevent camera going under terrain +GVAR(camPos) = [_x,_y,_z max (getTerrainHeightASL [_x,_y])]; + +// Update camera position and rotation +_camera setPosASL GVAR(camPos); +_camera setDir GVAR(camPan); +[_camera, GVAR(camTilt), 0] call BIS_fnc_setPitchBank; diff --git a/addons/spectator/functions/fnc_handleCompass.sqf b/addons/spectator/functions/fnc_handleCompass.sqf new file mode 100644 index 0000000000..a65cc9ddce --- /dev/null +++ b/addons/spectator/functions/fnc_handleCompass.sqf @@ -0,0 +1,67 @@ +/* + * Author: SilentSpike, voiper + * Handles the spectator UI compass + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleCompass, 0, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when compass hidden (or display is closed) +if (isNil QGVAR(compHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_compass","_NE","_ES","_SW","_WN","_compassW","_degree","_heading","_offset","_positions","_sequence"]; + +_compass = _display displayCtrl IDC_COMP; + +_NE = _compass controlsGroupCtrl IDC_COMP_0; +_ES = _compass controlsGroupCtrl IDC_COMP_90; +_SW = _compass controlsGroupCtrl IDC_COMP_180; +_WN = _compass controlsGroupCtrl IDC_COMP_270; + +_compassW = (ctrlPosition _compass) select 2; +_degree = _compassW / 180; + +// Get direction of screen rather than object (accounts for unit freelook) +_heading = (positionCameraToWorld [0,0,1]) vectorDiff (positionCameraToWorld [0,0,0]); +_heading = (((_heading select 0) atan2 (_heading select 1)) + 360) % 360; +_offset = -(_heading % 90) * _degree; + +_positions = [ + [_compassW * -0.5 + _offset, 0], + [_offset, 0], + [_compassW * 0.5 + _offset, 0], + [_compassW + _offset, 0] +]; + +_sequence = if (_heading < 90) then { + [_SW, _WN, _NE, _ES] +} else { + if (_heading < 180) then { + [_WN, _NE, _ES, _SW] + } else { + if (_heading < 270) then { + [_NE, _ES, _SW, _WN] + } else { + [_ES, _SW, _WN, _NE] + }; + }; +}; + + +{ + _x ctrlSetPosition (_positions select _forEachIndex); + _x ctrlCommit 0; +} forEach _sequence; diff --git a/addons/spectator/functions/fnc_handleIcons.sqf b/addons/spectator/functions/fnc_handleIcons.sqf new file mode 100644 index 0000000000..72c0d7dee6 --- /dev/null +++ b/addons/spectator/functions/fnc_handleIcons.sqf @@ -0,0 +1,46 @@ +/* + * Author: Head, SilentSpike + * Handles rendering the spectator 3D unit icons + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleIcons, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +if !(GVAR(showIcons)) exitWith {}; +private ["_refPoint","_drawVehicles","_leader","_color","_txt","_unit"]; + +// Draw groups unless leader is within distance +_refPoint = [GVAR(camera),GVAR(camUnit)] select (GVAR(camMode) > 0); +_drawVehicles = []; +{ + _leader = leader _x; + if ((_leader distanceSqr _refPoint) > 40000) then { + _color = GETVAR(_x,GVAR(gColor),[ARR_4(0,0,0,0)]); + _txt = groupID _x; + + drawIcon3D ["\A3\ui_f\data\map\markers\nato\b_inf.paa", _color, _leader modelToWorldVisual [0,0,30], 1, 1, 0, _txt, 2, 0.02]; + } else { + _drawVehicles append (units _x); + }; + false +} count GVAR(groupList); + +// Draw units for groups within distance +{ + _color = GETVAR((group _x),GVAR(gColor),[ARR_4(0,0,0,0)]); + _txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x); + + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", _color, _x modelToWorldVisual [0,0,3], 0.7, 0.7, 0, _txt, 1, 0.02]; + false +} count (_drawVehicles arrayIntersect GVAR(unitList)); diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf new file mode 100644 index 0000000000..93c6ca3ddd --- /dev/null +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -0,0 +1,493 @@ +/* + * Author: SilentSpike + * Handles spectator interface events + * + * Arguments: + * 0: Event name + * 1: Event arguments + * + * Return Value: + * None + * + * Example: + * ["onLoad",_this] call ace_spectator_fnc_handleInterface + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_mode",["_args",[]]]; + +switch (toLower _mode) do { + case "onload": { + _args params ["_display"]; + + // Always show interface and hide map upon opening + [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); + + // Keep unit list and tree up to date + [FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler; + + // Handle 3D unit icons + GVAR(iconHandler) = addMissionEventHandler ["Draw3D",FUNC(handleIcons)]; + + // Populate the help window + private "_help"; + _help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST; + { + _i = _help lbAdd (_x select 0); + if ((_x select 1) == "") then { + _help lbSetPicture [_i,"\A3\ui_f\data\map\markers\military\dot_CA.paa"]; + _help lbSetPictureColor [_i,[COL_FORE]]; + } else { + _help lbSetTooltip [_i,_x select 1]; + }; + } forEach [ + [localize LSTRING(uiControls),""], + [localize LSTRING(uiToggleUnits),"1"], + [localize LSTRING(uiToggleHelp),"2"], + [localize LSTRING(uiToggleTools),"3"], + [localize LSTRING(uiToggleCompass),"4"], + [localize LSTRING(uiToggleIcons),"5"], + [localize LSTRING(uiToggleMap),"M"], + [localize LSTRING(uiToggleInterface),"Backspace"], + [localize LSTRING(freeCamControls),""], + [localize LSTRING(freeCamForward),"W"], + [localize LSTRING(freeCamBackward),"S"], + [localize LSTRING(freeCamLeft),"A"], + [localize LSTRING(freeCamRight),"D"], + [localize LSTRING(freeCamUp),"Q"], + [localize LSTRING(freeCamDown),"Z"], + [localize LSTRING(freeCamPan),"RMB (Hold)"], + [localize LSTRING(freeCamDolly),"LMB (Hold)"], + [localize LSTRING(freeCamBoost),"Shift (Hold)"], + [localize LSTRING(freeCamFocus),"F"], + [localize LSTRING(attributeControls),""], + [localize LSTRING(nextCam),"Up Arrow"], + [localize LSTRING(prevCam),"Down Arrow"], + [localize LSTRING(nextUnit),"Right Arrow"], + [localize LSTRING(prevUnit),"Left Arrow"], + [localize LSTRING(nextVis),"N"], + [localize LSTRING(prevVis),"Ctrl + N"], + [localize LSTRING(adjZoom),"Scrollwheel"], + [localize LSTRING(adjSpeed),"Ctrl + Scrollwheel"], + [localize LSTRING(incZoom),"Num-/Num+"], + [localize LSTRING(incSpeed),"Ctrl + Num-/Num+"], + [localize LSTRING(reZoom),"Alt + Num-"], + [localize LSTRING(reSpeed),"Alt + Num+"] + ]; + + // Handle support for BI's respawn counter + [{ + if !(isNull (GETUVAR(RscRespawnCounter,displayNull))) then { + disableSerialization; + private ["_counter","_title","_back","_timer","_frame","_x","_y"]; + _counter = GETUVAR(RscRespawnCounter,displayNull); + _title = _counter displayCtrl 1001; + _back = _counter displayCtrl 1002; + _timer = _counter displayCtrl 1003; + _frame = _counter ctrlCreate ["RscFrame",1008]; + + _x = safeZoneX + safeZoneW - TOOL_W * 4 - MARGIN * 3; + _y = safeZoneY + safeZoneH - TOOL_H; + + // Timer + _title ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _back ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _timer ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _frame ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + + _title ctrlSetBackgroundColor [0,0,0,0]; + _back ctrlSetBackgroundColor [COL_BACK]; + _timer ctrlSetFontHeight TOOL_H; + _frame ctrlSetTextColor [COL_FORE]; + + _title ctrlCommit 0; + _back ctrlCommit 0; + _timer ctrlCommit 0; + _frame ctrlCommit 0; + }; + },[],0.5] call EFUNC(common,waitAndExecute); + }; + case "onunload": { + // Kill GUI PFHs + removeMissionEventHandler ["Draw3D",GVAR(iconHandler)]; + GVAR(camHandler) = nil; + GVAR(compHandler) = nil; + GVAR(iconHandler) = nil; + GVAR(toolHandler) = nil; + + // Reset variables + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; + }; + // Mouse events + case "onmousebuttondown": { + _args params ["_ctrl","_button"]; + GVAR(mouse) set [_button,true]; + + // Detect right click + if ((_button == 1) && (GVAR(camMode) == 1)) then { + // In first person toggle sights mode + GVAR(camGun) = !GVAR(camGun); + [] call FUNC(transitionCamera); + }; + }; + case "onmousebuttonup": { + _args params ["_ctrl","_button"]; + + GVAR(mouse) set [_button,false]; + if (_button == 0) then { GVAR(camDolly) = [0,0]; }; + }; + case "onmousezchanged": { + _args params ["_ctrl","_zChange"]; + + // Scroll to change speed, modifier for zoom + if (GVAR(ctrlKey)) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + _zChange * 0.2] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + _zChange * 0.1] call FUNC(setCameraAttributes); + }; + }; + case "onmousemoving": { + _args params ["_ctrl","_x","_y"]; + + [_x,_y] call FUNC(handleMouse); + }; + // Keyboard events + case "onkeydown": { + _args params ["_display","_dik","_shift","_ctrl","_alt"]; + + if ((alive player) && {_dik in (actionKeys "curatorInterface")} && {!isNull (getAssignedCuratorLogic player)}) exitWith { + [QGVAR(zeus)] call FUNC(interrupt); + ["zeus"] call FUNC(handleInterface); + }; + if ((isServer || {serverCommandAvailable "#kick"}) && {_dik in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) exitWith { + false + }; + + // Handle held keys (prevent repeat calling) + if (GVAR(heldKeys) param [_dik,false]) exitwith {}; + // Exclude movement/adjustment keys so that speed can be adjusted on fly + if !(_dik in [16,17,30,31,32,44,74,78]) then { + GVAR(heldKeys) set [_dik,true]; + }; + + switch (_dik) do { + case 1: { // Esc + [QGVAR(escape)] call FUNC(interrupt); + ["escape"] call FUNC(handleInterface); + }; + case 2: { // 1 + [_display,nil,nil,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 3: { // 2 + [_display,nil,true] call FUNC(toggleInterface); + }; + case 4: { // 3 + [_display,nil,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 5: { // 4 + [_display,true] call FUNC(toggleInterface); + }; + case 6: { // 5 + GVAR(showIcons) = !GVAR(showIcons); + }; + case 14: { // Backspace + [_display,nil,nil,true] call FUNC(toggleInterface); + }; + case 16: { // Q + GVAR(camBoom) = 0.5 * GVAR(camSpeed) * ([1, 2] select _shift); + }; + case 17: { // W + GVAR(camDolly) set [1, GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 29: { // Ctrl + GVAR(ctrlKey) = true; + }; + case 30: { // A + GVAR(camDolly) set [0, -GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 31: { // S + GVAR(camDolly) set [1, -GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 32: { // D + GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 33: { // F + private ["_sel","_vector"]; + _sel = GVAR(treeSel); + if ((GVAR(camMode) == 0) && {!isNull _sel} && {_sel in GVAR(unitList)}) then { + _vector = (positionCameraToWorld [0,0,0]) vectorDiff (positionCameraToWorld [0,0,25]); + [nil,nil,nil,(getPosATL _sel) vectorAdd _vector] call FUNC(setCameraAttributes); + }; + }; + case 44: { // Z + GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift); + }; + case 49: { // N + if (GVAR(camMode) == 0) then { + if (_ctrl) then { + [nil,nil,-1] call FUNC(cycleCamera); + } else { + [nil,nil,1] call FUNC(cycleCamera); + }; + }; + }; + case 50: { // M + [_display,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 57: { // Spacebar + // Freecam attachment here, if in external then set cam pos and attach + }; + case 74: { // Num - + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil, 1.25] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) - 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) - 0.01] call FUNC(setCameraAttributes); + }; + }; + case 78: { // Num + + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 2.5] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + 0.01] call FUNC(setCameraAttributes); + }; + }; + case 200: { // Up arrow + [-1] call FUNC(cycleCamera); + }; + case 203: { // Left arrow + [nil,1] call FUNC(cycleCamera); + }; + case 205: { // Right arrow + [nil,-1] call FUNC(cycleCamera); + }; + case 208: { // Down arrow + [1] call FUNC(cycleCamera); + }; + }; + + true + }; + case "onkeyup": { + _args params ["_display","_dik","_shift","_ctrl","_alt"]; + + // No longer being held + GVAR(heldKeys) set [_dik,nil]; + + switch (_dik) do { + case 16: { // Q + GVAR(camBoom) = 0; + }; + case 17: { // W + GVAR(camDolly) set [1, 0]; + }; + case 29: { // Ctrl + GVAR(ctrlKey) = false; + }; + case 30: { // A + GVAR(camDolly) set [0, 0]; + }; + case 31: { // S + GVAR(camDolly) set [1, 0]; + }; + case 32: { // D + GVAR(camDolly) set [0, 0]; + }; + case 44: { // Z + GVAR(camBoom) = 0; + }; + }; + + true + }; + // Tree events + case "ontreedblclick": { + // Update camera view when listbox unit is double clicked on + _args params ["_tree","_sel"]; + + // Ensure a unit was selected + if (count _sel == 3) then { + private ["_netID","_newUnit","_newMode"]; + _netID = (_args select 0) tvData _sel; + _newUnit = objectFromNetId _netID; + + // When unit is reselected, toggle camera mode + if (_newUnit == GVAR(camUnit) || GVAR(camMode) == 0) then { + _newMode = [2,2,1] select GVAR(camMode); + }; + + [_newMode,_newUnit] call FUNC(transitionCamera); + }; + }; + case "ontreeselchanged": { + _args params ["_tree","_sel"]; + + if (count _sel == 3) then { + GVAR(treeSel) = objectFromNetId (_tree tvData _sel); + } else { + GVAR(treeSel) = objNull; + }; + }; + case "onunitsupdate": { + _args params ["_tree"]; + private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"]; + + // Cache existing group and side nodes and cull removed data + _cachedUnits = []; + _cachedGrps = []; + _cachedSides = []; + for "_s" from 0 to ((_tree tvCount []) - 1) do { + for "_g" from 0 to ((_tree tvCount [_s]) - 1) do { + _grp = groupFromNetID (_tree tvData [_s,_g]); + + if (_grp in GVAR(groupList)) then { + _cachedGrps pushBack _grp; + _cachedGrps pushBack _g; + + for "_u" from 0 to ((_tree tvCount [_s,_g])) do { + _unit = objectFromNetId (_tree tvData [_s,_g,_u]); + + if (_unit in GVAR(unitList)) then { + _cachedUnits pushBack _unit; + } else { + _tree tvDelete [_s,_g,_u]; + }; + }; + } else { + _tree tvDelete [_s,_g]; + }; + }; + + if ((_tree tvCount [_s]) > 0) then { + _cachedSides pushBack (_tree tvText [_s]); + _cachedSides pushBack _s; + } else { + _tree tvDelete [_s]; + }; + }; + + // Update the tree from the unit list + { + _grp = group _x; + _side = [side _grp] call BIS_fnc_sideName; + + // Use correct side node + if !(_side in _cachedSides) then { + // Add side node + _s = _tree tvAdd [[], _side]; + _tree tvExpand [_s]; + + _cachedSides pushBack _side; + _cachedSides pushBack _s; + } else { + // If side already processed, use existing node + _s = _cachedSides select ((_cachedSides find _side) + 1); + }; + + // Use correct group node + if !(_grp in _cachedGrps) then { + // Add group node + _g = _tree tvAdd [[_s], groupID _grp]; + _tree tvSetData [[_s,_g], netID _grp]; + + _cachedGrps pushBack _grp; + _cachedGrps pushBack _g; + } else { + // If group already processed, use existing node + _g = _cachedGrps select ((_cachedGrps find _grp) + 1); + }; + + _u = _tree tvAdd [[_s,_g], GETVAR(_x,GVAR(uName),"")]; + _tree tvSetData [[_s,_g,_u], netID _x]; + _tree tvSetPicture [[_s,_g,_u], GETVAR(_x,GVAR(uIcon),"")]; + _tree tvSetPictureColor [[_s,_g,_u], GETVAR(_grp,GVAR(gColor),[ARR_4(1,1,1,1)])]; + + _tree tvSort [[_s,_g],false]; + } forEach (GVAR(unitList) - _cachedUnits); + + _tree tvSort [[],false]; + + if ((_tree tvCount []) <= 0) then { + _tree tvAdd [[], localize LSTRING(units_none)]; + }; + }; + // Map events + case "onmapclick": { + _args params ["_map","_button","_x","_y","_shift","_ctrl","_alt"]; + private ["_newPos","_oldZ"]; + + if ((GVAR(camMode) == 0) && (_button == 0)) then { + _newPos = _map ctrlMapScreenToWorld [_x,_y]; + _oldZ = (ASLtoATL GVAR(camPos)) select 2; + _newPos set [2, _oldZ]; + [nil,nil,nil, _newPos] call FUNC(setCameraAttributes); + }; + }; + // Interrupt events + case "escape": { + private "_dlg"; + + createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); + + disableSerialization; + _dlg = finddisplay 49; + _dlg displayAddEventHandler ["KeyDown", { + _key = _this select 1; + !(_key == 1) + }]; + + // Disable save, respawn, options & manual buttons + (_dlg displayCtrl 103) ctrlEnable false; + if !(alive player) then { + (_dlg displayCtrl 1010) ctrlEnable false; + }; + (_dlg displayCtrl 101) ctrlEnable false; + (_dlg displayCtrl 122) ctrlEnable false; + + // Initalize abort button (the "spawn" is a necessary evil) + (_dlg displayCtrl 104) ctrlAddEventHandler ["ButtonClick",{_this spawn { + disableSerialization; + _display = ctrlparent (_this select 0); + _abort = [localize "str_msg_confirm_return_lobby",nil,localize "str_disp_xbox_hint_yes",localize "str_disp_xbox_hint_no",_display,nil,true] call BIS_fnc_guiMessage; + if (_abort) then {_display closeDisplay 2; failMission "loser"}; + }}]; + + // PFH to re-open display when menu closes + [{ + if !(isNull (findDisplay 49)) exitWith {}; + + // If still a spectator then re-enter the interface + [QGVAR(escape),false] call FUNC(interrupt); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + }; + case "zeus": { + openCuratorInterface; + + [{ + // PFH to re-open display when menu closes + [{ + if !((isNull curatorCamera) && {isNull (GETMVAR(bis_fnc_moduleRemoteControl_unit,objNull))}) exitWith {}; + + // If still a spectator then re-enter the interface + [QGVAR(zeus),false] call FUNC(interrupt); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + },[],5] call EFUNC(common,waitAndExecute); + + true + }; +}; diff --git a/addons/spectator/functions/fnc_handleMap.sqf b/addons/spectator/functions/fnc_handleMap.sqf new file mode 100644 index 0000000000..4eeb5fd7e1 --- /dev/null +++ b/addons/spectator/functions/fnc_handleMap.sqf @@ -0,0 +1,47 @@ +/* + * Author: Head, SilentSpike + * Handles rendering the spectator map icons + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleIcons, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_map"]; +private ["_cachedVehicles","_unit","_color","_icon","_txt"]; + +if (GVAR(camMode) == 0) then { + _map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(camera),20,20,GVAR(camPan)]; +}; + +_cachedVehicles = []; +{ + _unit = vehicle _x; + + if !(_unit in _cachedVehicles) then { + _cachedVehicles pushBack _unit; + + // Use previously cached info where possible + if (GETVAR(_unit,GVAR(uIcon),"") == "") then { + [_unit] call FUNC(cacheUnitInfo); + }; + + // Function has caching built in + _color = [side effectiveCommander _unit] call BIS_fnc_sideColor; + _icon = GETVAR(_unit,GVAR(uIcon),""); + _txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x); + + _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.03]; + }; + false +} count GVAR(unitList); diff --git a/addons/spectator/functions/fnc_handleMouse.sqf b/addons/spectator/functions/fnc_handleMouse.sqf new file mode 100644 index 0000000000..1c2b62798c --- /dev/null +++ b/addons/spectator/functions/fnc_handleMouse.sqf @@ -0,0 +1,46 @@ +/* + * Author: F3 Project, Head, SilentSpike + * Processes the change in mouse position for the spectator camera + * + * Arguments: + * 0: Mouse x coord + * 1: Mouse y coord + * + * Return Value: + * None + * + * Example: + * [0.5, 0.5] call ace_spectator_fnc_handleMouse; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_x","_y"]; +private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY","_zoomMod"]; + +_leftButton = GVAR(mouse) select 0; +_rightButton = GVAR(mouse) select 1; + +_oldX = GVAR(mousePos) select 0; +_oldY = GVAR(mousePos) select 1; + +// Get change in pos +_deltaX = _oldX - _x; +_deltaY = _oldY - _y; + +if (_leftButton) then { + GVAR(camDolly) set [0, _deltaX * -100 * GVAR(camSpeed)]; + GVAR(camDolly) set [1, _deltaY * 100 * GVAR(camSpeed)]; +} else { + if (_rightButton) then { + // Pan/Tilt amount should be influnced by zoom level (it should really be exponential) + _zoomMod = (GVAR(camZoom) * 0.8) max 1; + + GVAR(camPan) = GVAR(camPan) - ((_deltaX * 360) / _zoomMod); + GVAR(camTilt) = ((GVAR(camTilt) + ((_deltaY * 180) / _zoomMod)) min 89) max -89; + }; +}; + +GVAR(mousePos) = [_x,_y]; diff --git a/addons/spectator/functions/fnc_handleToolbar.sqf b/addons/spectator/functions/fnc_handleToolbar.sqf new file mode 100644 index 0000000000..878f3e46de --- /dev/null +++ b/addons/spectator/functions/fnc_handleToolbar.sqf @@ -0,0 +1,54 @@ +/* + * Author: Karel Moricky, SilentSpike + * Handles the spectator UI toolbar values + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleToolbar, 0, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when toolbar hidden (or display is closed) +if (isNil QGVAR(toolHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"]; +_toolbar = _display displayCtrl IDC_TOOL; + +// Find all tool values +if (GVAR(camMode) == 0) then { + _vision = if (GVAR(camVision) >= 0) then {localize LSTRING(VisionThermal)} else { [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1) }; + _fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01]; + _speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01]; +} else { + _vision = [side group GVAR(camUnit)] call BIS_fnc_sideName; + _fov = format ["%1 m", floor(getPosASL GVAR(camUnit) select 2)]; + _speed = format ["%1 km/h", floor(speed GVAR(camUnit)) max 0]; +}; + +if (alive GVAR(camUnit)) then { + _name = GETVAR(GVAR(camUnit),GVAR(uName),""); +} else { + _name = localize "STR_Special_None"; +}; + +_mode = [localize LSTRING(ViewFree),localize LSTRING(ViewInternal),localize LSTRING(ViewExternal)] select GVAR(camMode); +_time = [daytime,"HH:MM"] call BIS_fnc_timeToString; + +// Update the UI tools +(_toolbar controlsGroupCtrl IDC_TOOL_CLOCK) ctrlSetText _time; +(_toolbar controlsGroupCtrl IDC_TOOL_VISION) ctrlSetText _vision; +(_toolbar controlsGroupCtrl IDC_TOOL_FOV) ctrlSetText _fov; +(_toolbar controlsGroupCtrl IDC_TOOL_NAME) ctrlSetText _name; +(_toolbar controlsGroupCtrl IDC_TOOL_SPEED) ctrlSetText _speed; +(_toolbar controlsGroupCtrl IDC_TOOL_VIEW) ctrlSetText _mode; diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf new file mode 100644 index 0000000000..c32961024c --- /dev/null +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -0,0 +1,40 @@ +/* + * Author: SilentSpike + * Maintains the spectatable unit list and updates the unit tree accordingly + * Also updates current camera unit when status changes + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleUnits, 10, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when display is closed +if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +// Remove all dead and null units from the list +[] call FUNC(updateUnits); + +// Camera shouldn't stay on unit that isn't in the list (unless dead) +if !(GVAR(camUnit) in GVAR(unitList)) then { + if (alive GVAR(camUnit) || isNull GVAR(camUnit)) then { + [nil,1] call FUNC(cycleCamera); + }; +}; + +// Reduce overhead when unit tree is hidden +if (ctrlShown (_display displayCtrl IDC_UNIT)) then { + // Reduce overhead by spreading across frames + [FUNC(handleInterface),["onUnitsUpdate",[(_display displayCtrl IDC_UNIT) controlsGroupCtrl IDC_UNIT_TREE]],1] call EFUNC(common,waitAndExecute); +}; diff --git a/addons/spectator/functions/fnc_interrupt.sqf b/addons/spectator/functions/fnc_interrupt.sqf new file mode 100644 index 0000000000..48cca7d102 --- /dev/null +++ b/addons/spectator/functions/fnc_interrupt.sqf @@ -0,0 +1,44 @@ +/* + * Author: SilentSpike + * Interrupts the spectator interface for external systems + * + * Arguments: + * 0: Reason + * 1: Interrupting + * + * Return Value: + * None + * + * Example: + * ["mySystem"] call ace_spectator_fnc_interrupt + * + * Public: Yes + */ +#include "script_component.hpp" + +params [["_reason", "", [""]], ["_interrupt", true, [true]]]; + +// Nothing to do when spectator is closed +if !(GVAR(isSet)) exitWith {}; + +if (_reason == "") exitWith { ERROR("Invalid Reason"); }; +if (_interrupt) then { + GVAR(interrupts) pushBack _reason; +} else { + GVAR(interrupts) = GVAR(interrupts) - [_reason]; +}; + +if (GVAR(interrupts) isEqualTo []) then { + if (isNull (findDisplay 12249)) then { + createDialog QGVAR(interface); + [] call FUNC(transitionCamera); + }; +} else { + if !(isNull (findDisplay 12249)) then { + while {dialog} do { + closeDialog 0; + }; + + (findDisplay 12249) closeDisplay 0; + }; +}; diff --git a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf new file mode 100644 index 0000000000..52b6e5d8fa --- /dev/null +++ b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf @@ -0,0 +1,25 @@ +/* + * Author: SilentSpike + * Read spectator settings from module + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(restrictVisions), "visionModes"] call EFUNC(common,readSettingFromModule); diff --git a/addons/spectator/functions/fnc_respawnTemplate.sqf b/addons/spectator/functions/fnc_respawnTemplate.sqf new file mode 100644 index 0000000000..b808c43eab --- /dev/null +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -0,0 +1,44 @@ +/* + * Author: SilentSpike + * The ace_spectator respawn template, handles killed + respawn + * Can be used via BI's respawn framework, see: + * https://community.bistudio.com/wiki/Arma_3_Respawn + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]]; +private ["_vision","_pos"]; + +// End mission when all are dead with respawn type "None" +if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith { + [["endDeath",false],"BIS_fnc_endMission"] call EFUNC(common,execRemoteFnc); +}; + +if (isNull _killer) then {_killer = _unit}; +_vision = [-2,-1] select (sunOrMoon < 1); +_pos = (getPosATL _unit) vectorAdd [0,0,5]; + +if (alive _unit) then { + if (_respawn == 1) then { + [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [true] call FUNC(setSpectator); + } else { + [false] call FUNC(setSpectator); + }; +} else { + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [true] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf new file mode 100644 index 0000000000..8eb6fe51ac --- /dev/null +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -0,0 +1,67 @@ +/* + * Author: SilentSpike + * Sets the spectator camera attributes as desired + * + * Arguments: + * 0: Camera mode + * - 0: Free + * - 1: Internal + * - 2: External + * 1: Camera unit (objNull for random) + * 2: Camera vision + * - -2: Normal + * - -1: Night vision + * - 0: Thermal white hot + * - 1: Thermal black hot + * 3: Camera position (ATL) + * 4: Camera pan (0 - 360) + * 5: Camera tilt (-90 - 90) + * 6: Camera zoom (0.01 - 2) + * 7: Camera speed in m/s (0.05 - 10) + * + * Return Value: + * None + * + * Example: + * [1, objNull] call ace_spectator_fnc_setCameraAttributes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [ + ["_mode",GVAR(camMode),[0]], + ["_unit",GVAR(camUnit),[objNull]], + ["_vision",GVAR(camVision),[0]], + ["_position",ASLtoATL GVAR(camPos),[[]],3], + ["_heading",GVAR(camPan),[0]], + ["_tilt",GVAR(camTilt),[0]], + ["_zoom",GVAR(camZoom),[0]], + ["_speed",GVAR(camSpeed),[0]] +]; + +// Normalize input +if !(_mode in GVAR(availableModes)) then { + _mode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0); +}; + +if !(_vision in GVAR(availableVisions)) then { + _vision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); +}; + +GVAR(camPan) = _heading % 360; +GVAR(camSpeed) = (_speed max 0.05) min 10; +GVAR(camTilt) = (_tilt max -89) min 89; +GVAR(camUnit) = _unit; +GVAR(camVision) = _vision; +GVAR(camZoom) = (_zoom min 2) max 0.01; + +// Apply if camera exists +if (isNil QGVAR(camera)) then { + GVAR(camMode) = _mode; + GVAR(camPos) = (ATLtoASL _position); +} else { + [_mode,_unit,_vision] call FUNC(transitionCamera); + GVAR(camera) setPosATL _position; +}; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf new file mode 100644 index 0000000000..621100a5ba --- /dev/null +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -0,0 +1,126 @@ +/* + * Author: SilentSpike + * Sets local client to the given spectator state (virtually) + * To physically handle a spectator see ace_spectator_fnc_stageSpectator + * + * Client will be able to communicate in ACRE/TFAR as appropriate + * The spectator interface will be opened/closed + * + * Arguments: + * 0: Spectator state of local client + * + * Return Value: + * None + * + * Example: + * [true] call ace_spectator_fnc_setSpectator + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_set",true,[true]]]; + +// Only clients can be spectators +if !(hasInterface) exitWith {}; + +// Exit if no change +if (_set isEqualTo GVAR(isSet)) exitwith {}; + +// Handle common addon audio +if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableVolumeUpdate) = _set}; +if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator}; +if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator}; + +if (_set) then { + // Initalize camera variables + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + GVAR(camGun) = false; + + // Initalize display variables + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; + + // Update units before opening to support pre-set camera unit + [] call FUNC(updateUnits); + + // Initalize the camera view + GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); + [] call FUNC(transitionCamera); + + // Close map and clear radio + openMap [false,false]; + clearRadio; + + // Disable BI damage effects + BIS_fnc_feedback_allowPP = false; + + // Close any open dialogs + while {dialog} do { + closeDialog 0; + }; + + // Create the display + (findDisplay 46) createDisplay QGVAR(interface); + + // Cache and disable nametag settings + if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { + GVAR(nametagSettingCache) = [EGVAR(nametags,showPlayerNames), EGVAR(nametags,showNamesForAI)]; + EGVAR(nametags,showPlayerNames) = 0; + EGVAR(nametags,showNamesForAI) = false; + }; +} else { + // Close any open dialogs (could be interrupts) + while {dialog} do { + closeDialog 0; + }; + + // Kill the display + (findDisplay 12249) closeDisplay 0; + + // Terminate camera + GVAR(camera) cameraEffect ["terminate", "back"]; + camDestroy GVAR(camera); + + clearRadio; + + // Return to player view + player switchCamera "internal"; + + // Enable BI damage effects + BIS_fnc_feedback_allowPP = true; + + // Cleanup camera variables + GVAR(camera) = nil; + GVAR(camBoom) = nil; + GVAR(camDolly) = nil; + GVAR(camGun) = nil; + + // Cleanup display variables + GVAR(ctrlKey) = nil; + GVAR(heldKeys) = nil; + GVAR(mouse) = nil; + GVAR(mousePos) = nil; + GVAR(treeSel) = nil; + + // Reset nametag settings + if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { + EGVAR(nametags,showPlayerNames) = GVAR(nametagSettingCache) select 0; + EGVAR(nametags,showNamesForAI) = GVAR(nametagSettingCache) select 1; + GVAR(nametagSettingCache) = nil; + }; +}; + +// Reset interruptions +GVAR(interrupts) = []; + +// Mark spectator state for reference +GVAR(isSet) = _set; + +["spectatorSet",[_set]] call EFUNC(common,localEvent); diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf new file mode 100644 index 0000000000..7f0d862719 --- /dev/null +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -0,0 +1,68 @@ +/* + * Author: SilentSpike + * Sets target unit to the given spectator state (physically) + * To virtually handle a spectator see ace_spectator_fnc_setSpectator + * + * Units will be gathered at marker ace_spectator_respawn (or [0,0,0] by default) + * Upon unstage, units will be moved to the position they were in upon staging + * + * Arguments: + * 0: Unit to put into spectator stage + * 1: Spectator stage + * + * Return Value: + * None + * + * Example: + * [player, false] call ace_spectator_fnc_stageSpectator + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_unit",player,[objNull]], ["_set",true,[true]]]; + +// No change, no service (but allow spectators to be reset) +if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; + +if !(local _unit) exitwith { + [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); +}; + +// Prevent unit falling into water +_unit enableSimulation !_set; + +// Move to/from group as appropriate +[_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide); + +if (_set) then { + // Position should only be saved on first entry + if !(GETVAR(_unit,GVAR(isStaged),false)) then { + GVAR(oldPos) = getPosATL _unit; + }; + + // Ghosts can't talk + [_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit); + + _unit setPos (markerPos QGVAR(respawn)); +} else { + // Physical beings can talk + [_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,unmuteUnit); + + _unit setPosATL GVAR(oldPos); +}; + +// Spectators ignore damage (vanilla and ace_medical) +_unit allowDamage !_set; +_unit setVariable [QEGVAR(medical,allowDamage), !_set]; + +// No theoretical change if an existing spectator was reset +if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { + // Mark spectator state for reference + _unit setVariable [QGVAR(isStaged), _set, true]; + + ["spectatorStaged",[_set]] call EFUNC(common,localEvent); +}; diff --git a/addons/spectator/functions/fnc_toggleInterface.sqf b/addons/spectator/functions/fnc_toggleInterface.sqf new file mode 100644 index 0000000000..4a03de4271 --- /dev/null +++ b/addons/spectator/functions/fnc_toggleInterface.sqf @@ -0,0 +1,82 @@ +/* + * Author: SilentSpike + * Correctly handles toggling of spectator interface elements for clean UX + * + * Arguments: + * 0: Display + * 1: Toogle compass + * 2: Toogle help + * 3: Toogle interface + * 4: Toogle map + * 5: Toogle toolbar + * 6: Toogle unit list + * + * Return Value: + * None + * + * Example: + * [_dsiplay, nil, true] call ace_spectator_fnc_toggleInterface + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display", ["_toggleComp",false], ["_toggleHelp",false], ["_toggleInterface",false], ["_toggleMap",false], ["_toggleTool",false], ["_toggleUnit",false]]; + +private ["_comp","_help","_map","_tool","_unit"]; +_comp = _display displayCtrl IDC_COMP; +_help = _display displayCtrl IDC_HELP; +_map = _display displayCtrl IDC_MAP; +_tool = _display displayCtrl IDC_TOOL; +_unit = _display displayCtrl IDC_UNIT; + +// Map operates outside of interface +GVAR(showMap) = [GVAR(showMap), !GVAR(showMap)] select _toggleMap; +_map ctrlShow GVAR(showMap); + +if (GVAR(showMap)) then { + // When map is shown, temporarily hide interface to stop overlapping + { + _x ctrlShow false; + } forEach [_comp,_help,_tool,_unit]; + + // Centre map on camera/unit upon opening + if (_toggleMap) then { + _map ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)]; + ctrlMapAnimCommit _map; + }; +} else { + // Can only toggle interface with map minimised + GVAR(showInterface) = [GVAR(showInterface), !GVAR(showInterface)] select _toggleInterface; + + if (GVAR(showInterface)) then { + // Can only toggle interface elements with interface shown + GVAR(showComp) = [GVAR(showComp), !GVAR(showComp)] select _toggleComp; + GVAR(showHelp) = [GVAR(showHelp), !GVAR(showHelp)] select _toggleHelp; + GVAR(showTool) = [GVAR(showTool), !GVAR(showTool)] select _toggleTool; + GVAR(showUnit) = [GVAR(showUnit), !GVAR(showUnit)] select _toggleUnit; + + _comp ctrlShow GVAR(showComp); + _help ctrlShow GVAR(showHelp); + _tool ctrlShow GVAR(showTool); + _unit ctrlShow GVAR(showUnit); + } else { + { + _x ctrlShow false; + } forEach [_comp,_help,_tool,_unit]; + }; +}; + +// Only run PFHs when respective control is shown, otherwise kill +if (ctrlShown _comp) then { + if (isNil QGVAR(compHandler)) then { GVAR(compHandler) = [FUNC(handleCompass), 0, _display] call CBA_fnc_addPerFrameHandler; }; +} else { + GVAR(compHandler) = nil; +}; + +if (ctrlShown _tool) then { + if (isNil QGVAR(toolHandler)) then { GVAR(toolHandler) = [FUNC(handleToolbar), 0, _display] call CBA_fnc_addPerFrameHandler; }; +} else { + GVAR(toolHandler) = nil; +}; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf new file mode 100644 index 0000000000..72cb9f1a45 --- /dev/null +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -0,0 +1,111 @@ +/* + * Author: SilentSpike + * Transitions the spectator camera vision/view/unit + * + * Arguments: + * 0: Camera mode + * - 0: Free + * - 1: Internal + * - 2: External + * 1: Camera unit + * 2: Vision mode + * - -2: Normal + * - -1: NV + * - 0: White hot + * - 1: Black hot + * + * Return Value: + * None + * + * Example: + * [0,objNull] call ace_spectator_fnc_transitionCamera + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]]; + +// If new mode isn't available then keep current (unless current also isn't) +if !(_newMode in GVAR(availableModes)) then { + _newMode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0); +}; + +// When no units available to spectate, exit to freecam +if ((GVAR(unitList) isEqualTo []) && (alive _newUnit || isNull _newUnit)) then { + _newMode = 0; + _newUnit = objNull; +}; + +// Reset gun cam if not internal +if (_newMode != 1) then { + GVAR(camGun) = false; +}; + +if (_newMode == 0) then { // Free + // Preserve camUnit value for consistency when manually changing view + GVAR(camera) cameraEffect ["internal", "back"]; + showCinemaBorder false; + cameraEffectEnableHUD true; + + // Apply the camera zoom + GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]); + GVAR(camera) camCommit 0; + + // Agent is switched to in free cam to hide death table and prevent AI chat while allowing icons to draw (also prevents systemChat and unit HUD) + // (Why is so much stuff tied into the current camera unit BI?!) + if (isNull GVAR(camAgent)) then { + GVAR(camAgent) = createAgent ["VirtualMan_F",markerPos QGVAR(respawn),[],0,""]; + }; + + GVAR(camAgent) switchCamera "internal"; + clearRadio; + + // If new vision isn't available then keep current (unless current also isn't) + if !(_newVision in GVAR(availableVisions)) then { + _newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); + }; + + // Vision mode only applies to free cam + if (_newVision < 0) then { + false setCamUseTi 0; + camUseNVG (_newVision >= -1); + } else { + true setCamUseTi _newVision; + }; + GVAR(camVision) = _newVision; + + // Handle camera movement + if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; +} else { + // When null unit is given choose random + if (isNull _newUnit) then { + _newUnit = GVAR(unitList) select floor(random(count GVAR(unitList))); + }; + + if (_newMode == 1) then { // Internal + // Handle gun cam + if (GVAR(camGun)) then { + _newUnit switchCamera "gunner"; + } else { + _newUnit switchCamera "internal"; + }; + } else { // External + _newUnit switchCamera "external"; + }; + + // Clear radio if group changed + if (group _newUnit != group GVAR(camUnit)) then { + clearRadio; + }; + + GVAR(camUnit) = _newUnit; + + // Terminate camera view + GVAR(camera) cameraEffect ["terminate", "back"]; + GVAR(camHandler) = nil; + cameraEffectEnableHUD true; +}; + +GVAR(camMode) = _newMode; diff --git a/addons/spectator/functions/fnc_updateCameraModes.sqf b/addons/spectator/functions/fnc_updateCameraModes.sqf new file mode 100644 index 0000000000..aef51b56c6 --- /dev/null +++ b/addons/spectator/functions/fnc_updateCameraModes.sqf @@ -0,0 +1,48 @@ +/* + * Author: SilentSpike + * Adds or removes spectator camera modes from the selection available to the local player. + * Possible camera modes are: + * - 0: Free + * - 1: Internal + * - 2: External + * + * Arguments: + * 0: Camera modes to add + * 1: Camera modes to remove + * + * Return Value: + * Available camera modes + * + * Example: + * [[0], [1,2]] call ace_spectator_fnc_updateCameraModes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; +private ["_newModes","_currentModes"]; + +_currentModes = GVAR(availableModes); + +// Restrict additions to only possible values +_newModes = _addModes arrayIntersect [0,1,2]; +_newModes append (_currentModes - _removeModes); + +_newModes = _newModes arrayIntersect _newModes; +_newModes sort true; + +// Can't become an empty array +if (_newModes isEqualTo []) then { + ["Cannot remove all camera modes (%1)", QFUNC(updateCameraModes)] call BIS_fnc_error; +} else { + GVAR(availableModes) = _newModes; +}; + +// Update camera in case of change +if !(isNil QGVAR(camera)) then { + [] call FUNC(transitionCamera); +}; + +_newModes diff --git a/addons/spectator/functions/fnc_updateSpectatableSides.sqf b/addons/spectator/functions/fnc_updateSpectatableSides.sqf new file mode 100644 index 0000000000..57f7756d54 --- /dev/null +++ b/addons/spectator/functions/fnc_updateSpectatableSides.sqf @@ -0,0 +1,33 @@ +/* + * Author: SilentSpike + * Adds or removes sides from the selection available to spectate by the local player. + * Note that the side filter setting is applied to the available sides dynamically. + * + * Default selection is [west,east,resistance,civilian] + * + * Arguments: + * 0: Sides to add + * 1: Sides to remove + * + * Return Value: + * Spectatable sides + * + * Example: + * [[west], [east,civilian]] call ace_spectator_fnc_updateSpectatableSides + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addSides",[],[[]]], ["_removeSides",[],[[]]]]; + +// Add and remove sides +_addSides append (GVAR(availableSides) - _removeSides); + +// Only need array of unique sides +_addSides = _addSides arrayIntersect _addSides; + +GVAR(availableSides) = _addSides; + +_addSides diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf new file mode 100644 index 0000000000..50494cf499 --- /dev/null +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -0,0 +1,75 @@ +/* + * Author: SilentSpike + * Adds units to spectator whitelist/blacklist and refreshes the filter units + * + * Arguments: + * 0: Units to add to the whitelist + * 1: Use blacklist + * + * Return Value: + * None + * + * Example: + * [allUnits,true] call ace_spectator_fnc_updateUnits + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_newUnits",[],[[]]],["_blacklist",false,[false]]]; + +// Function only matters on player clients +if !(hasInterface) exitWith {}; + +// If adding to a list we can exit here, since it won't show up until the UI refreshes anyway +if !(_newUnits isEqualTo []) exitWith { + if (_blacklist) then { + GVAR(unitWhitelist) = GVAR(unitWhitelist) - _newUnits; + GVAR(unitBlacklist) append _newUnits; + } else { + GVAR(unitBlacklist) = GVAR(unitBlacklist) - _newUnits; + GVAR(unitWhitelist) append _newUnits; + }; +}; + +private ["_sides","_cond","_filteredUnits","_filteredGroups"]; + +// Unit setting filter +_newUnits = [[],allPlayers,playableUnits,allUnits] select GVAR(filterUnits); + +// Side setting filter +_sides = []; +_cond = [{_this == (side group player)},{(_this getFriend (side group player)) >= 0.6},{(_this getFriend (side group player)) < 0.6},{true}] select GVAR(filterSides); +{ + if (_x call _cond) then { + _sides pushBack _x; + }; +} forEach GVAR(availableSides); + +// Filter units and append to list +_filteredUnits = []; +{ + if ( + (alive _x) && + {(_x isKindOf "CAManBase")} && + {(side group _x) in _sides} && // Side filter + {simulationEnabled _x} && + {!(_x getVariable [QGVAR(isStaged), false])} // Who watches the watchmen? + ) then { + _filteredUnits pushBack _x; + }; +} forEach (_newUnits - GVAR(unitBlacklist)); +_filteredUnits append GVAR(unitWhitelist); + +// Cache icons and colour for drawing +_filteredGroups = []; +{ + // Intentionally re-applied to units in case their status changes + [_x] call FUNC(cacheUnitInfo); + _filteredGroups pushBack (group _x); +} forEach _filteredUnits; + +// Replace previous lists entirely (removes any no longer valid) +GVAR(unitList) = _filteredUnits arrayIntersect _filteredUnits; +GVAR(groupList) = _filteredGroups arrayIntersect _filteredGroups; diff --git a/addons/spectator/functions/fnc_updateVisionModes.sqf b/addons/spectator/functions/fnc_updateVisionModes.sqf new file mode 100644 index 0000000000..2a1e500f3f --- /dev/null +++ b/addons/spectator/functions/fnc_updateVisionModes.sqf @@ -0,0 +1,56 @@ +/* + * Author: SilentSpike + * Adds or removes spectator vision modes from the selection available to the local player. + * The default selection is [-2,-1,0,1]. + * Possible vision modes are: + * - -2: Normal + * - -1: Night vision + * - 0: White hot + * - 1: Black hot + * - 2: Light Green Hot / Darker Green cold + * - 3: Black Hot / Darker Green cold + * - 4: Light Red Hot / Darker Red Cold + * - 5: Black Hot / Darker Red Cold + * - 6: White Hot / Darker Red Cold + * - 7: Thermal (Shade of Red and Green, Bodies are white) + * + * Arguments: + * 0: Vision modes to add + * 1: Vision modes to remove + * + * Return Value: + * Available vision modes + * + * Example: + * [[0], [1,2]] call ace_spectator_fnc_updateVisionModes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; +private ["_newModes","_currentModes"]; + +_currentModes = GVAR(availableVisions); + +// Restrict additions to only possible values +_newModes = _addModes arrayIntersect [-2,-1,0,1,2,3,4,5,6,7]; +_newModes append (_currentModes - _removeModes); + +_newModes = _newModes arrayIntersect _newModes; +_newModes sort true; + +// Can't become an empty array +if (_newModes isEqualTo []) then { + ["Cannot remove all vision modes (%1)", QFUNC(updateVisionModes)] call BIS_fnc_error; +} else { + GVAR(availableVisions) = _newModes; +}; + +// Update camera in case of change +if !(isNil QGVAR(camera)) then { + [] call FUNC(transitionCamera); +}; + +_newModes diff --git a/addons/spectator/functions/script_component.hpp b/addons/spectator/functions/script_component.hpp new file mode 100644 index 0000000000..d5034cb39c --- /dev/null +++ b/addons/spectator/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\spectator\script_component.hpp" \ No newline at end of file diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp new file mode 100644 index 0000000000..de2ee22363 --- /dev/null +++ b/addons/spectator/script_component.hpp @@ -0,0 +1,57 @@ +#define COMPONENT spectator +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_SPECTATOR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_SPECTATOR + #define DEBUG_SETTINGS DEBUG_SETTINGS_SPECTATOR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +// UI grid +#define SIZEX ((safezoneW / safezoneH) min 1.2) +#define SIZEY (SIZEX / 1.2) +#define W_PART(num) (num * (SIZEX / 40)) +#define H_PART(num) (num * (SIZEY / 25)) +#define X_PART(num) (W_PART(num) + (safezoneX + (safezoneW - SIZEX)/2)) +#define Y_PART(num) (H_PART(num) + (safezoneY + (safezoneH - SIZEY)/2)) + +// UI tools +#define TOOL_H H_PART(1) +#define TOOL_W W_PART(5) +#define MARGIN TOOL_W * 0.05 + +// UI compass +#define COMPASS_W (TOOL_W * 4) +#define COMPASS_X (safeZoneX + safeZoneW * 0.5 - COMPASS_W * 0.5) + +// UI IDCs +#define IDC_COMP 4490 +#define IDC_COMP_0 5000 +#define IDC_COMP_90 5090 +#define IDC_COMP_180 5180 +#define IDC_COMP_270 5270 + +#define IDC_HELP 7631 +#define IDC_HELP_LIST 7622 + +#define IDC_MAP 6791 + +#define IDC_TOOL 3000 +#define IDC_TOOL_CLOCK 3003 +#define IDC_TOOL_FOV 3005 +#define IDC_TOOL_NAME 3001 +#define IDC_TOOL_SPEED 3006 +#define IDC_TOOL_VIEW 3002 +#define IDC_TOOL_VISION 3004 + +#define IDC_UNIT 6002 +#define IDC_UNIT_TREE 6005 + +// UI colours +#define COL_BACK 0.1,0.1,0.1,0.7 +#define COL_FORE 1,1,1,1 +#define COL_FORE_D 0.1,0.1,0.1,0.8 diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml new file mode 100644 index 0000000000..5c24224b72 --- /dev/null +++ b/addons/spectator/stringtable.xml @@ -0,0 +1,271 @@ + + + + + Spectator Settings + Ustawienia obserwatora + + + Configure how the spectator system will operate by default. + Skonfiguruj domyślne ustawienia obserwatora. + + + Unit filter + Filtr jednostek + + + Method of filtering spectatable units. + Wybierz jednostki, jakie będzie można obserwować po uruchomeniu obserwatora. + + + No units + Brak jednostek + + + Only players + Tylko gracze + + + Playable Units + Grywalne jednostki + + + All units + Wszystkie jednostki + + + Side filter + Filtr stron + + + Method of filtering spectatable sides. + Wybierz strony, jakie będzie można obserwować po uruchomeniu obserwatora. + + + Player side + Strona gracza + + + Friendly sides + Strony sojusznicze + + + Hostile sides + Strony wrogie + + + All sides + Wszystkie strony + + + Camera modes + Tryby kamery + + + Camera modes that can be used. + Tryby kamery, jakie mogą być używane. + + + All + Wszystkie + + + Free only + Tylko wolna + + + Internal only + Tylko wewnętrzna + + + External only + Tylko zewnętrzna + + + Internal and external + Wewnętrzna i zewnętrzna + + + Vision modes + Tryby wizji + + + Vision modes that can be used. + Tryby wizji, jakie mogą być używane. + + + Night vision + Noktowizja + + + Thermal imaging + Termowizja + + + + Spectator Units + Jednostki obserwatora + + + Spectator Controls + Sterowanie obserwatorem + + + Free + Wolna + + + Internal + Wewnętrzna + + + External + Zewnętrzna + + + Normal + Normalna + + + Night + Noc + + + Thermal + Termo + + + + Free Camera + Kamera swobodna + + + Camera Forward + Kamera naprzód + + + Camera Backward + Kamera w tył + + + Camera Left + Kamera w lewo + + + Camera Right + Kamera w prawo + + + Camera Up + Kamera w górę + + + Camera Down + Kamera w dół + + + Pan Camera + Panoramowanie + + + Dolly Camera + Płynna kamera + + + Lock Camera to Target + Zablokuj kamerę na celu + + + Speed Boost + Przyśpieszenie kamery + + + Focus on Unit + Skup na jednostce + + + Interface + Interfejs + + + Toggle Interface + Przełącz interfejs + + + Toggle Unit Icons + Przełącz ikony jednostek + + + Toggle Unit List + Przełącz listę jednostek + + + Toggle Toolbar + Przełącz pasek narzędzi + + + Toggle Compass + Przełącz kompas + + + Toggle Map + Przełącz mapę + + + Toggle Help + Przełącz pomoc + + + Camera Attributes + Atrybuty kamery + + + Next Camera + Następna kamera + + + Previous Camera + Poprzednia kamera + + + Next Unit + Następna jednostka + + + Previous Unit + Poprzednia jednostka + + + Next Vision Mode + Następny tryb wizji + + + Previous Vision Mode + Poprzedni tryb wizji + + + Adjust Zoom + Reguluj zoom + + + Adjust Speed + Reguluj prędkość + + + Increment Zoom + Reguluj zoom (krok) + + + Increment Speed + Reguluj prędkość (krok) + + + Reset Zoom + Resetuj zoom + + + Reset Speed + Resetuj prędkość + + + diff --git a/addons/tacticalladder/data/ace_tacticalladder.p3d b/addons/tacticalladder/data/ace_tacticalladder.p3d index a331f24084..7bb924ff46 100644 Binary files a/addons/tacticalladder/data/ace_tacticalladder.p3d and b/addons/tacticalladder/data/ace_tacticalladder.p3d differ diff --git a/addons/tacticalladder/data/model.cfg b/addons/tacticalladder/data/model.cfg index 1fc8840d4f..ba19d58c65 100644 --- a/addons/tacticalladder/data/model.cfg +++ b/addons/tacticalladder/data/model.cfg @@ -1,4 +1,4 @@ -class CfgSkeletons { +class CfgSkeletons { class Default { isDiscrete = 1; skeletonInherit = ""; @@ -21,7 +21,7 @@ class CfgSkeletons { "10","9", "11","10", "step","11" - }; + }; }; class OFP2_ManSkeleton { isDiscrete = 0; @@ -180,7 +180,7 @@ class CfgModels { class ace_tacticalladder { skeletonName = "ace_tacticalladder_skeleton"; sections[] = { "roadway" }; - sectionsInherit = ""; + sectionsInherit = ""; class Animations { class rotate { type = "rotation"; @@ -192,7 +192,7 @@ class CfgModels { maxValue = 90; angle0="rad 0"; angle1="rad +90"; - }; + }; class extract_1 { type = "translation"; source = ""; @@ -280,4 +280,4 @@ class CfgModels { }; class ace_tacticalladder_pack: ArmaMan { }; -}; \ No newline at end of file +}; diff --git a/optionals/compat_asdg/$PBOPREFIX$ b/optionals/compat_asdg/$PBOPREFIX$ deleted file mode 100644 index 0ba5166c16..0000000000 --- a/optionals/compat_asdg/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\compat_asdg \ No newline at end of file diff --git a/optionals/compat_asdg/config.cpp b/optionals/compat_asdg/config.cpp deleted file mode 100644 index 40dae32051..0000000000 --- a/optionals/compat_asdg/config.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"asdg_jointrails","ace_laserpointer","ace_optics"}; - author[]={"OnkelDisMaster"}; - authorUrl = "http://2.xn--gebirgsjgerkompanie-nwb.de/"; - VERSION_CONFIG; - }; -}; - -class asdg_SlotInfo; -class asdg_FrontSideRail: asdg_SlotInfo { - class compatibleItems { - ACE_acc_pointer_red = 1; - ACE_acc_pointer_green = 1; - ACE_acc_pointer_green_IR = 1; - }; -}; - -class asdg_OpticRail; -class asdg_OpticRail1913: asdg_OpticRail { - class compatibleItems { - ACE_optic_Hamr_2D = 1; - ACE_optic_Hamr_PIP = 1; - ACE_optic_Arco_2D = 1; - ACE_optic_Arco_PIP = 1; - ACE_optic_MRCO_2D = 1; - ACE_optic_MRCO_PIP = 1; - ACE_optic_SOS_2D = 1; - ACE_optic_SOS_PIP = 1; - ACE_optic_LRPS_2D = 1; - ACE_optic_LRPS_PIP = 1; - }; -}; diff --git a/optionals/compat_asdg/script_component.hpp b/optionals/compat_asdg/script_component.hpp deleted file mode 100644 index e67bf3b9e4..0000000000 --- a/optionals/compat_asdg/script_component.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#define COMPONENT asdg_comp - -#include "\z\ace\addons\main\script_mod.hpp" - -#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_bwa3/$PBOPREFIX$ b/optionals/compat_bwa3/$PBOPREFIX$ deleted file mode 100644 index 7331009959..0000000000 --- a/optionals/compat_bwa3/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\compat_bwa3 \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgAmmo.hpp b/optionals/compat_bwa3/CfgAmmo.hpp deleted file mode 100644 index c19e00819a..0000000000 --- a/optionals/compat_bwa3/CfgAmmo.hpp +++ /dev/null @@ -1,142 +0,0 @@ -class CfgAmmo { - class B_9x21_Ball; - class B_556x45_Ball_Tracer_Red; - class B_762x51_Tracer_Red; - class B_127x99_Ball_Tracer_Red; - class GrenadeHand; - class BWA3_B_556x45_Ball: B_556x45_Ball_Tracer_Red { - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.0176; - ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; - ACE_ballisticCoefficients[]={0.151}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; - ACE_barrelLengths[]={210.82, 238.76, 269.24, 299.72, 330.2, 360.68, 391.16, 419.1, 449.58, 480.06, 508.0, 609.6}; - }; - class BWA3_B_556x45_Ball_SD: BWA3_B_556x45_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_B_556x45_Ball_AP: BWA3_B_556x45_Ball { - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.5359237; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.310}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820, 865, 880}; - ACE_barrelLengths[]={254.0, 393.7, 508.0}; - }; - class BWA3_B_762x51_Ball: B_762x51_Tracer_Red { - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_762x51_Ball_SD: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=34.036; - ACE_bulletMass=12.96; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.235}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={305, 325, 335, 340}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_762x51_Ball_AP: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=8.22946157; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.359}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={875, 910, 930}; - ACE_barrelLengths[]={330.2, 406.4, 508.0}; - }; - class BWA3_B_762x51_Ball_LR: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=11.34; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.243}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={750, 780, 790, 794}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_127x99_Ball: B_127x99_Ball_Tracer_Red { - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9256; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class BWA3_B_127x99_Ball_SD: BWA3_B_127x99_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_B_127x99_Ball_AP: BWA3_B_127x99_Ball { - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class BWA3_B_46x30_Ball: B_9x21_Ball { - ACE_caliber=4.902; - ACE_bulletLength=13.005; - ACE_bulletMass=2.0088; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.1455}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 720, 730, 740}; - ACE_barrelLengths[]={101.6, 177.8, 228.6, 304.8}; - }; - class BWA3_B_46x30_Ball_SD: BWA3_B_46x30_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_G_DM51A1: GrenadeHand { - ace_frag_metal = 296; - ace_frag_charge = 180; - ace_frag_gurney_c = 2930; // Gurney velocity constant for PETN - ace_frag_gurney_k = 1/2; // shape factor for a cylinder - }; -}; \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgMagazines.hpp b/optionals/compat_bwa3/CfgMagazines.hpp deleted file mode 100644 index bf43af6426..0000000000 --- a/optionals/compat_bwa3/CfgMagazines.hpp +++ /dev/null @@ -1,9 +0,0 @@ -class CfgMagazines { - class CA_Magazine; - class BWA3_200Rnd_556x45: CA_Magazine { - ACE_isBelt = 1; - }; - class BWA3_120Rnd_762x51: CA_Magazine { - ACE_isBelt = 1; - }; -}; \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgWeapons.hpp b/optionals/compat_bwa3/CfgWeapons.hpp deleted file mode 100644 index c0acea9912..0000000000 --- a/optionals/compat_bwa3/CfgWeapons.hpp +++ /dev/null @@ -1,173 +0,0 @@ -class CfgWeapons { - class Pistol_Base_F; - class Rifle_Base_F; - class Rifle_Long_Base_F; - class UGL_F; - class BWA3_P8: Pistol_Base_F { - ACE_barrelTwist=248.92; - ACE_barrelLength=108; - }; - class BWA3_MP7: Pistol_Base_F { - ACE_barrelTwist=160.02; - ACE_barrelLength=180; - }; - class BWA3_G36: Rifle_Base_F { - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class BWA3_G36K: BWA3_G36 { - ACE_barrelTwist=177.8; - ACE_barrelLength=318; - }; - class BWA3_G28_Standard: Rifle_Long_Base_F { - ACE_barrelTwist=304.8; - ACE_barrelLength=421; - }; - class BWA3_G28_Assault: BWA3_G28_Standard { - ACE_barrelTwist=304.8; - ACE_barrelLength=421; - }; - class BWA3_G27: BWA3_G28_Standard { - ACE_barrelTwist=304.8; - ACE_barrelLength=406; - }; - class BWA3_G27_AG: BWA3_G27 { - class AG40: UGL_F { - magazines[] += { - "ACE_HuntIR_M203" - }; - }; - }; - class BWA3_MG4: Rifle_Long_Base_F { - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class BWA3_MG5: Rifle_Long_Base_F { - ACE_barrelTwist=304.8; - ACE_barrelLength=550; - }; - class BWA3_G82: Rifle_Long_Base_F { - ACE_barrelTwist=381.0; - ACE_barrelLength=736.7; - }; - class AG40: UGL_F { - magazines[] += { - "ACE_HuntIR_M203" - }; - }; - class optic_Hamr; - class InventoryOpticsItem_Base_F; - - class BWA3_optic_ZO4x30 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_ZO4x30_NSV : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_ZO4x30_IRV : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_Shortdot : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -0.1, 10.1 }; - ACE_ScopeAdjust_Horizontal[] = { -5.1, 5.1 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_20x50 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { 0, 26 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_20x50_NSV : BWA3_optic_20x50 { - ACE_ScopeAdjust_Vertical[] = { 0, 26 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_24x72 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { 0, 16 }; - ACE_ScopeAdjust_Horizontal[] = { -7, 7 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_24x72_NSV : BWA3_optic_20x50 { - ACE_ScopeAdjust_Vertical[] = { 0, 16 }; - ACE_ScopeAdjust_Horizontal[] = { -7, 7 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; -}; diff --git a/optionals/compat_bwa3/config.cpp b/optionals/compat_bwa3/config.cpp deleted file mode 100644 index efdebaf616..0000000000 --- a/optionals/compat_bwa3/config.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"BWA3_Weapons"}; - author[]={"Ruthberg"}; - VERSION_CONFIG; - }; -}; - -#include "CfgAmmo.hpp" -#include "CfgWeapons.hpp" -#include "CfgMagazines.hpp" diff --git a/optionals/compat_bwa3/script_component.hpp b/optionals/compat_bwa3/script_component.hpp deleted file mode 100644 index 86bb669119..0000000000 --- a/optionals/compat_bwa3/script_component.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#define COMPONENT BWA3_Weapons_comp - -#include "\z\ace\addons\main\script_mod.hpp" - -#include "\z\ace\addons\main\script_macros.hpp" diff --git a/tools/make.py b/tools/make.py index 0420b2df92..f8a4c80886 100644 --- a/tools/make.py +++ b/tools/make.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : # make.py @@ -30,7 +30,7 @@ ############################################################################### -__version__ = "0.6" +__version__ = "0.7" import sys @@ -59,7 +59,7 @@ if sys.platform == "win32": ######## GLOBALS ######### project = "@ace" -ACE_VERSION = "3.0.0" +project_version = "3.0.0" arma3tools_path = "" work_drive = "" module_root = "" @@ -130,7 +130,6 @@ def Fract_Sec(s): return d,h,m,sec #endef Fract_Sec - # Copyright (c) André Burgaud # http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ if sys.platform == "win32": @@ -387,6 +386,7 @@ def copy_optionals_for_building(mod,pbos): if (os.path.isfile(sig_path)): #print("Moving {} for processing.".format(sig_path)) shutil.move(sig_path, os.path.join(release_dir, project, "addons", sigFile_name)) + except: print_error("Error in moving") raise @@ -450,6 +450,9 @@ def cleanup_optionals(mod): continue shutil.rmtree(destination) + except FileNotFoundError: + print_yellow("{} file not found".format(file_name)) + except: print_error("Cleaning Optionals Failed") raise @@ -556,9 +559,9 @@ def addon_restore(modulePath): return True -def get_ace_version(): - global ACE_VERSION - versionStamp = ACE_VERSION +def get_project_version(): + global project_version + versionStamp = project_version #do the magic based on https://github.com/acemod/ACE3/issues/806#issuecomment-95639048 try: @@ -583,16 +586,16 @@ def get_ace_version(): raise FileNotFoundError("File Not Found: {}".format(scriptModPath)) except Exception as e: - print_error("Get_Ace_Version error: {}".format(e)) + print_error("Get_project_version error: {}".format(e)) print_error("Check the integrity of the file: {}".format(scriptModPath)) - versionStamp = ACE_VERSION + versionStamp = project_version print_error("Resetting to the default version stamp: {}".format(versionStamp)) input("Press Enter to continue...") print("Resuming build...") print_yellow("{} VERSION set to {}".format(project.lstrip("@").upper(),versionStamp)) - ACE_VERSION = versionStamp - return ACE_VERSION + project_version = versionStamp + return project_version def replace_file(filePath, oldSubstring, newSubstring): @@ -610,7 +613,7 @@ def replace_file(filePath, oldSubstring, newSubstring): def set_version_in_files(): - newVersion = ACE_VERSION # MAJOR.MINOR.PATCH.BUILD + newVersion = project_version # MAJOR.MINOR.PATCH.BUILD newVersionShort = newVersion[:-2] # MAJOR.MINOR.PATCH # Regex patterns @@ -692,7 +695,7 @@ def restore_version_files(): def get_private_keyname(commitID,module="main"): global pbo_name_prefix - aceVersion = get_ace_version() + aceVersion = get_project_version() keyName = str("{prefix}{version}-{commit_id}".format(prefix=pbo_name_prefix,version=aceVersion,commit_id=commitID)) return keyName @@ -769,7 +772,7 @@ def main(argv): """Build an Arma addon suite in a directory from rules in a make.cfg file.""" print_blue("\nmake.py for Arma, modified for Advanced Combat Environment v{}".format(__version__)) - global ACE_VERSION + global project_version global arma3tools_path global work_drive global module_root @@ -855,7 +858,7 @@ See the make.cfg file for additional build options. argv.remove("release") else: make_release_zip = False - release_version = ACE_VERSION + release_version = project_version if "target" in argv: make_target = argv[argv.index("target") + 1]