From 6130b5b3736cd128993d1a7bcb848b14f6e89a18 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 14 Jul 2015 00:24:55 -0500 Subject: [PATCH 001/239] Working Demo --- addons/explosives/GUI_VirtualAmmo.hpp | 30 ++++ addons/explosives/config.cpp | 5 +- .../functions/fnc_addExplosiveActions.sqf | 4 +- .../functions/fnc_handleScrollWheel.sqf | 8 +- .../functions/fnc_setupExplosive.sqf | 130 ++++++++++++++++-- addons/explosives/script_component.hpp | 4 + 6 files changed, 163 insertions(+), 18 deletions(-) create mode 100644 addons/explosives/GUI_VirtualAmmo.hpp diff --git a/addons/explosives/GUI_VirtualAmmo.hpp b/addons/explosives/GUI_VirtualAmmo.hpp new file mode 100644 index 0000000000..96e5b452ee --- /dev/null +++ b/addons/explosives/GUI_VirtualAmmo.hpp @@ -0,0 +1,30 @@ +class RscTitles { + class GVAR(virtualAmmo) { + idd = -1; + movingEnable = 1; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable ['ACE_explosives_virtualAmmoDisplay', (_this select 0)];"; + class controls {}; + class objects { + class TheObject { + idc = 800851; + type = 82; + model = "\a3\weapons_f\Ammo\Handgrenade.p3d"; //dummy value, cannot be "" !!! + scale = 1; + direction[] = {0, 0, 1}; + up[] = {0, 1, 0}; + x = 0.5; + y = 0.5; + z = 1; + xBack = 0.5; + yBack = 0.5; + zBack = 0.5; + inBack = 0; + enableZoom = 0; + zoomDuration = 1; + }; + }; + }; +}; diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 873c4e0dc3..99544213d3 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -12,6 +12,8 @@ class CfgPatches { }; }; +#include "ACE_Settings.hpp" + #include "CfgEventHandlers.hpp" #include "CfgAmmo.hpp" @@ -21,6 +23,7 @@ class CfgPatches { #include "ACE_Triggers.hpp" #include "ExplosivesUI.hpp" +#include "GUI_VirtualAmmo.hpp" class CfgActions { class None; @@ -39,5 +42,3 @@ class CfgMineTriggers { mineTriggerRange = 1; }; }; - -#include "ACE_Settings.hpp" diff --git a/addons/explosives/functions/fnc_addExplosiveActions.sqf b/addons/explosives/functions/fnc_addExplosiveActions.sqf index 214b41602c..005163f2db 100644 --- a/addons/explosives/functions/fnc_addExplosiveActions.sqf +++ b/addons/explosives/functions/fnc_addExplosiveActions.sqf @@ -43,10 +43,10 @@ _children = []; format ["Explosive_%1", _forEachIndex], format [_name + " (%1)", _itemCount select _foreachIndex], getText(_x >> "picture"), - {(_this select 2) call FUNC(setupExplosive);}, + {_this call FUNC(setupExplosive);}, {true}, {}, - [_unit, configName _x] + (configName _x) ] call EFUNC(interact_menu,createAction), [], _unit diff --git a/addons/explosives/functions/fnc_handleScrollWheel.sqf b/addons/explosives/functions/fnc_handleScrollWheel.sqf index 3bef53e196..3f0552bfd2 100644 --- a/addons/explosives/functions/fnc_handleScrollWheel.sqf +++ b/addons/explosives/functions/fnc_handleScrollWheel.sqf @@ -14,9 +14,9 @@ * Public: No */ #include "script_component.hpp" -if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false}; -_this = _this * 5; -GVAR(Setup) setDir ((getDir GVAR(Setup)) + _this); -GVAR(TweakedAngle) = GVAR(TweakedAngle) + _this; + +if ((!GVAR(pfeh_running)) || {ACE_Modifier == 0}) exitWith {false}; + +GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 5 * _this) + 360) % 360; true diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 566ab9c281..14b2b52844 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -3,8 +3,9 @@ * Starts the setup process for the passed explosive. Player only. * * Arguments: - * 0: Unit - * 1: Classname of explosive to place. (CfgMagazine class) + * 0: Vehicle + * 1: Player Unit + * 2: Classname of explosive to place. (CfgMagazine class) * * Return Value: * None @@ -15,6 +16,120 @@ * Public: Yes */ #include "script_component.hpp" + +PARAMS_3(_vehicle,_player,_magClassname); + +[_player, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); +GVAR(TweakedAngle) = 0; + +//Get setup object vehicle and model: +_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); +if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");}; +_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); +if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! + +[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); +_player setVariable [QGVAR(placeActionEH), [_player, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; +_player setVariable [QGVAR(cancelActionEH), [_player, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)]; + + +//Display to show virtual object: +(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false]; +((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel; + +GVAR(pfeh_running) = true; +GVAR(placeAction) = PLACE_WAITING; + + +[{ + private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_badPosition"]; + + PARAMS_2(_args,_pfID); + EXPLODE_3_PVT(_args,_unit,_magClassname,_setupObjectClass); + + _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,1]) vectorDiff (positionCameraToWorld [0,0,0]); + if (cameraView == "EXTERNAL") then { + _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); + }; + _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); + _intersectsWith = lineIntersectsWith [eyePos ACE_player, _virtualPosASL, ACE_player]; + + hintSilent format ["IntersectsWith %1", _intersectsWith]; + + _badPosition = (count _intersectsWith) > 0; + + //Don't allow placing in a bad position: + if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; + + //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't + if ((inputAction "zoomTemp") > 0) then {GVAR(placeAction) = PLACE_CANCEL;}; + + if ((GVAR(placeAction) != PLACE_WAITING) || + {_unit != ACE_player} || + {(inputAction "optics") > 0}) then { + + [_pfID] call CBA_fnc_removePerFrameHandler; + GVAR(pfeh_running) = false; + + [_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus); + [] call EFUNC(interaction,hideMouseHint); + [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); + [_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler); + + (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + + if (GVAR(placeAction) == PLACE_APPROVE) then { + systemChat "place"; + _dir = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); + _angle = ((_dir select 0) atan2 (_dir select 1)) - GVAR(TweakedAngle) - 180; + + systemChat format ["Pos %1, Cam %2, Ang %3", _virtualPosASL, ((_dir select 0) atan2 (_dir select 1)), _angle]; + + _realObject = _setupObjectClass createVehicle _virtualPos; + _realObject setPosAsl _virtualPosASL; + _realObject setDir _angle; + // [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _virtualPos] call FUNC(placeApprove); + }; + } else { + // systemChat format ["A Running %1 - %2", time, _badPosition]; + //Show the virtual object: + if (_badPosition) then { + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; + } else { + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; + _screenPos = worldToScreen _virtualPos; + if (_screenPos isEqualTo []) exitWith { + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; + }; + _realDistance = (_virtualPos distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); + _screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)]; + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos; + _dir = (positionCameraToWorld [0,0,1]) vectorFromTo (positionCameraToWorld [0,0,0]); + _angle = asin (_dir select 2) + 90; + + _modelUp = [0, (cos _angle), (sin _angle)]; + _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; + + // systemChat format ["Running %1", [_modelDir, _modelUp]]; + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp]; + }; + }; +}, 0, [_player, _magClassname, _setupObjectClass]] call CBA_fnc_addPerFrameHandler; + + + + + + + + + + + + +/* + + closeDialog 0; EXPLODE_2_PVT(_this,_unit,_class); GVAR(placer) = _unit; @@ -24,8 +139,8 @@ GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> " GVAR(Setup) enableSimulationGlobal false; GVAR(Setup) setVariable [QGVAR(class), _class, true]; -[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); -GVAR(TweakedAngle) = 180; + + [QGVAR(Placement),"OnEachFrame", { private ["_player", "_pos"]; @@ -41,9 +156,4 @@ GVAR(TweakedAngle) = 180; }; }] call CALLSTACK(BIS_fnc_addStackedEventHandler); -[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), - localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); -_unit setVariable [QGVAR(Place), [_unit, "DefaultAction", - {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)]; -_unit setVariable [QGVAR(Cancel), [_unit, "zoomtemp", - {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)]; + */ diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp index 5ff12b8ba3..057f0aa086 100644 --- a/addons/explosives/script_component.hpp +++ b/addons/explosives/script_component.hpp @@ -12,3 +12,7 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define PLACE_WAITING -1 +#define PLACE_CANCEL 0 +#define PLACE_APPROVE 1 \ No newline at end of file From 104d1a1cc77602fdcf53c03a5d231360d81ffd72 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Jul 2015 02:54:38 -0500 Subject: [PATCH 002/239] Attaching (Rotate to verticle) --- addons/explosives/CfgMagazines.hpp | 6 +- addons/explosives/XEH_postInit.sqf | 13 +- addons/explosives/XEH_preInit.sqf | 4 - addons/explosives/functions/fnc_onLanded.sqf | 45 ----- .../functions/fnc_place_Approve.sqf | 46 ----- .../explosives/functions/fnc_place_Cancel.sqf | 32 ---- .../functions/fnc_setupExplosive.sqf | 177 ++++++++++-------- 7 files changed, 108 insertions(+), 215 deletions(-) delete mode 100644 addons/explosives/functions/fnc_onLanded.sqf delete mode 100644 addons/explosives/functions/fnc_place_Approve.sqf delete mode 100644 addons/explosives/functions/fnc_place_Cancel.sqf diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 39d08917c3..b6ba37af67 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -96,7 +96,7 @@ class CfgMagazines { }; }; }; - + class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; class ACE_Triggers { @@ -113,9 +113,9 @@ class CfgMagazines { ammo = "IEDUrbanBig_Range_Ammo"; pitch = 0; }; - }; + }; }; - + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; class ACE_Triggers: ACE_Triggers { diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 27a4703906..836631efdd 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -17,18 +17,21 @@ if !(hasInterface) exitWith {}; -["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler); - GVAR(PlacedCount) = 0; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; -//Cancel placement if interact menu opened + ["interactMenuOpened", { - if (GVAR(pfeh_running) && {!isNull (GVAR(Setup))}) then { - call FUNC(place_Cancel) + //Cancel placement if interact menu opened + if (GVAR(pfeh_running)) then { + GVAR(placeAction) = PLACE_CANCEL; }; + + //Show defuse actions on cfgAmmos (allMines): + _this call FUNC(interactEH); + }] call EFUNC(common,addEventHandler); [{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index b3888e1535..fc1b02e1bc 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -46,13 +46,9 @@ PREP(module); PREP(onInventoryChanged); PREP(onKilled); -PREP(onLanded); PREP(openTimerSetUI); -PREP(place_Approve); -PREP(place_Cancel); - PREP(placeExplosive); PREP(removeFromSpeedDial); diff --git a/addons/explosives/functions/fnc_onLanded.sqf b/addons/explosives/functions/fnc_onLanded.sqf deleted file mode 100644 index f2ed729b1a..0000000000 --- a/addons/explosives/functions/fnc_onLanded.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Handles the "EpeContactStart" event when placing the explosive. - * - * Arguments: - * 0: Explosive Placing Object - * 1: Colliding Object - * - * Return Value: - * None - * - * Example: - * object addEventHandler ["EpeContactStart", ACE_explosive_fnc_onLanded]; - * - * Public: No - */ -#include "script_component.hpp" -EXPLODE_2_PVT(_this,_explosive,_hitTarget); - -TRACE_2("Explosive EpeContactStart",_explosive,_hitTarget); - -if ((_explosive getVariable [QGVAR(Handled), false])) exitWith {}; - -_explosive setVariable [QGVAR(Handled), true]; -if (!isNull _hitTarget && {_hitTarget isKindOf "AllVehicles"}) then { - TRACE_1("Attaching to",_hitTarget); - _explosive attachTo [_hitTarget]; - private "_dir"; - _dir = _explosive getVariable [QGVAR(Direction), 0]; - _dir = _dir - (getDir _hitTarget); - [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); -} else { - [{ - EXPLODE_2_PVT(_this,_player,_explosive); - private "_pos"; - _pos = getPosASL _explosive; - if (surfaceIsWater _pos) then { - _pos = getPosASL _explosive; - _explosive setPosASL _pos; - }else{ - _pos = getPosATL _explosive; - _explosive setPosATL _pos; - }; - }, [ACE_player, _explosive], 0.5, 0.1] call EFUNC(common,waitAndExecute); -}; diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf deleted file mode 100644 index 0604045f65..0000000000 --- a/addons/explosives/functions/fnc_place_Approve.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Approves placement of the explosive, releases the placement object for it - * to settle in a location suitable for the explosive to be created. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ACE_Explosives_fnc_place_Approve; - * - * Public: No - */ -#include "script_component.hpp" -if (GVAR(pfeh_running)) then { - [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); - GVAR(pfeh_running) = false; -}; -private ["_setup", "_player", "_dir"]; -_setup = GVAR(Setup); -GVAR(Setup) = objNull; -[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); -GVAR(placer) = objNull; -_player = ACE_player; -call EFUNC(interaction,hideMouseHint); -if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith { - deleteVehicle _setup; -}; -_dir = (getDir _setup); -if (_dir > 180) then { - _dir = _dir - 180; -} else { - _dir = 180 + _dir; -}; -_setup setVariable [QGVAR(Direction), _dir, true]; -_player setVariable [QGVAR(PlantingExplosive), true]; -[{_this setVariable [QGVAR(PlantingExplosive), false]}, _player, 1.5, 0.5] call EFUNC(common,waitAndExecute); -_setup addEventHandler ["EpeContactStart", FUNC(onLanded)]; -_setup enableSimulationGlobal true; -_player playActionNow "PutDown"; -_player removeMagazine (_setup getVariable [QGVAR(Class), ""]); diff --git a/addons/explosives/functions/fnc_place_Cancel.sqf b/addons/explosives/functions/fnc_place_Cancel.sqf deleted file mode 100644 index 78d718e283..0000000000 --- a/addons/explosives/functions/fnc_place_Cancel.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Cancels placement of the explosive - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ACE_Explosives_fnc_place_Cancel; - * - * Public: Yes - */ -#include "script_component.hpp" -if (GVAR(pfeh_running)) then { - [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); - GVAR(pfeh_running) = false; -}; -if (!isNull (GVAR(Setup))) then { - deleteVehicle GVAR(Setup); -}; -GVAR(Setup) = objNull; -if (isNil {GVAR(placer)}) then { - GVAR(placer) = objNull; -}; -[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus); -GVAR(placer) = objNull; -call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 14b2b52844..1e6a17fa72 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -15,12 +15,12 @@ * * Public: Yes */ +#define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" -PARAMS_3(_vehicle,_player,_magClassname); +PARAMS_3(_vehicle,_unit,_magClassname); -[_player, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); -GVAR(TweakedAngle) = 0; +[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); //Get setup object vehicle and model: _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); @@ -28,10 +28,10 @@ if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! +//Show mouse buttons: [localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); -_player setVariable [QGVAR(placeActionEH), [_player, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; -_player setVariable [QGVAR(cancelActionEH), [_player, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)]; - +_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; +_unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)]; //Display to show virtual object: (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false]; @@ -39,25 +39,65 @@ _player setVariable [QGVAR(cancelActionEH), [_player, "zoomtemp", {true}, {GVAR( GVAR(pfeh_running) = true; GVAR(placeAction) = PLACE_WAITING; +GVAR(TweakedAngle) = 0; [{ - private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_badPosition"]; + BEGIN_COUNTER(pfeh); PARAMS_2(_args,_pfID); EXPLODE_3_PVT(_args,_unit,_magClassname,_setupObjectClass); - _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,1]) vectorDiff (positionCameraToWorld [0,0,0]); - if (cameraView == "EXTERNAL") then { - _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); - }; - _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); - _intersectsWith = lineIntersectsWith [eyePos ACE_player, _virtualPosASL, ACE_player]; + _lookDirVector = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); + _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); + + _basePosASL = (eyePos _unit); + if (cameraView == "EXTERNAL") then { + _basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); + }; + + _testPositionIsValid = { + _testDistance = _this select 0; + _testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply _testDistance); + _return = true; + { + _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; + drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]]; + if (lineIntersects [eyePos _unit, _testPos, _unit]) exitWith {_return = false;}; + } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; + _return + }; + + _distanceFromBase = 1; + _badPosition = !([_distanceFromBase] call _testPositionIsValid); + _attachVehicle = objNull; + + + if (_badPosition && {!isNull cursorTarget} && {(cursorTarget isKindOf "Car")}) then { + _attachVehicle = cursorTarget; + if ([0.05] call _testPositionIsValid) then { + _min = 0.05; + _max = 1; + for "_index" from 0 to 5 do { + _distanceFromBase = (_min + _max) / 2; + if ([_distanceFromBase] call _testPositionIsValid) then { + _min = _distanceFromBase; + } else { + _max = _distanceFromBase; + }; + }; + _badPosition = false; + _distanceFromBase = ((_min + _max) / 2 + 0.075) min 1; + systemChat format ["Attaching, dist %1", _distanceFromBase]; + }; + }; + + _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase); + if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then { + systemChat "adjusting height"; + _virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)]; + }; - hintSilent format ["IntersectsWith %1", _intersectsWith]; - - _badPosition = (count _intersectsWith) > 0; - //Don't allow placing in a bad position: if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; @@ -65,8 +105,7 @@ GVAR(placeAction) = PLACE_WAITING; if ((inputAction "zoomTemp") > 0) then {GVAR(placeAction) = PLACE_CANCEL;}; if ((GVAR(placeAction) != PLACE_WAITING) || - {_unit != ACE_player} || - {(inputAction "optics") > 0}) then { + {_unit != ACE_player}) then { [_pfID] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_running) = false; @@ -80,80 +119,58 @@ GVAR(placeAction) = PLACE_WAITING; if (GVAR(placeAction) == PLACE_APPROVE) then { systemChat "place"; - _dir = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); - _angle = ((_dir select 0) atan2 (_dir select 1)) - GVAR(TweakedAngle) - 180; + _placeAngle = 0; + _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); + if (isNull _attachVehicle) then { + _placeAngle = _cameraAngle - GVAR(TweakedAngle) - 180; + _expSetupVehicle setPosAsl _virtualPosASL; + _expSetupVehicle setDir _angle; + } else { + _modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition)); + _placeAngle = _cameraAngle - (getDir _attachVehicle) + 180; + _expSetupVehicle attachTo [_attachVehicle, _modelOffset]; + _expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]]; + }; - systemChat format ["Pos %1, Cam %2, Ang %3", _virtualPosASL, ((_dir select 0) atan2 (_dir select 1)), _angle]; - _realObject = _setupObjectClass createVehicle _virtualPos; - _realObject setPosAsl _virtualPosASL; - _realObject setDir _angle; - // [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _virtualPos] call FUNC(placeApprove); + systemChat format ["Attach angel %1", _placeAngle]; + + _expSetupVehicle setVariable [QGVAR(class), _magClassname, true]; + _expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true]; + + _unit removeMagazine _magClassname; + _unit playActionNow "PutDown"; + _unit setVariable [QGVAR(PlantingExplosive), true]; + [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute); + + x3 = _expSetupVehicle; + systemChat format ["Mass %1", getMass _expSetupVehicle]; + // x3 setMass 1; }; } else { - // systemChat format ["A Running %1 - %2", time, _badPosition]; - //Show the virtual object: - if (_badPosition) then { + _screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition)); + if (_badPosition || {_screenPos isEqualTo []}) then { ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; } else { ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; - _screenPos = worldToScreen _virtualPos; - if (_screenPos isEqualTo []) exitWith { - ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; - }; - _realDistance = (_virtualPos distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); + + _realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); _screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos; - _dir = (positionCameraToWorld [0,0,1]) vectorFromTo (positionCameraToWorld [0,0,0]); - _angle = asin (_dir select 2) + 90; - _modelUp = [0, (cos _angle), (sin _angle)]; - _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; + _modelDir = [0,0,-1]; + _modelUp = [0,-1,0]; + if (isNull _attachVehicle) then { + _angle = acos (_lookDirVector select 2); + _modelUp = [0, (cos _angle), (sin _angle)]; + _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; + }; - // systemChat format ["Running %1", [_modelDir, _modelUp]]; + // systemChat format ["Running %1 [%2]", [_modelDir, _modelUp], _attachVehicle]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp]; }; }; -}, 0, [_player, _magClassname, _setupObjectClass]] call CBA_fnc_addPerFrameHandler; - - - - - - - - - - -/* - - -closeDialog 0; -EXPLODE_2_PVT(_this,_unit,_class); -GVAR(placer) = _unit; -// TODO: check MP performance and MP compatible. -GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject"),[0,0,-10000],[], 0, "NONE"]; - -GVAR(Setup) enableSimulationGlobal false; -GVAR(Setup) setVariable [QGVAR(class), _class, true]; - - - - -[QGVAR(Placement),"OnEachFrame", { - private ["_player", "_pos"]; - _player = ACE_player; - if (GVAR(placer) != _player) exitWith { - call FUNC(place_Cancel); - }; - GVAR(pfeh_running) = true; - _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - GVAR(Setup) setPosATL _pos; - if (ACE_Modifier == 0) then { - GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player); - }; -}] call CALLSTACK(BIS_fnc_addStackedEventHandler); - - */ + END_COUNTER(pfeh); +}, 0, [_unit, _magClassname, _setupObjectClass]] call CBA_fnc_addPerFrameHandler; From 7cc2628c533207ad6cbf2f0694988c1a59b15cd7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Jul 2015 03:18:19 -0500 Subject: [PATCH 003/239] Stuff --- addons/explosives/functions/fnc_selectTrigger.sqf | 2 +- addons/explosives/functions/fnc_setupExplosive.sqf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/explosives/functions/fnc_selectTrigger.sqf b/addons/explosives/functions/fnc_selectTrigger.sqf index 53bc8b66cb..4683aaa717 100644 --- a/addons/explosives/functions/fnc_selectTrigger.sqf +++ b/addons/explosives/functions/fnc_selectTrigger.sqf @@ -24,4 +24,4 @@ _config = ConfigFile >> "ACE_Triggers" >> _trigger; // If the onSetup function returns true, it is handled elsewhere if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {}; -[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call ACE_Explosives_fnc_placeExplosive; +[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive); diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 1e6a17fa72..aa87280b1a 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -118,13 +118,13 @@ GVAR(TweakedAngle) = 0; (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; if (GVAR(placeAction) == PLACE_APPROVE) then { - systemChat "place"; + systemChat format ["place %1 - %2", _virtualPosASL, aslToAtl _virtualPosASL];; _placeAngle = 0; _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); if (isNull _attachVehicle) then { _placeAngle = _cameraAngle - GVAR(TweakedAngle) - 180; _expSetupVehicle setPosAsl _virtualPosASL; - _expSetupVehicle setDir _angle; + _expSetupVehicle setDir _placeAngle; } else { _modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition)); _placeAngle = _cameraAngle - (getDir _attachVehicle) + 180; From 1f4488253d1916584cb607edb58fa05eb5f70175 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Jul 2015 23:52:47 -0500 Subject: [PATCH 004/239] Only attach some triggers --- addons/explosives/ACE_Triggers.hpp | 12 ++++++++++-- addons/explosives/functions/fnc_setupExplosive.sqf | 13 ++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index 5df3d005bc..86fbab1cef 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -1,5 +1,5 @@ class ACE_Triggers { -/* onPlace parameters: + /* onPlace parameters: 0: OBJECT - unit placing 1: OBJECT - Placed explosive 2: STRING - Magazine classname @@ -7,46 +7,54 @@ class ACE_Triggers { Last Index: ACE_Triggers config of trigger type. onSetup parameters: 0: STRING - Magazine Classname -*/ + */ class Command { + isAttachable = 1; displayName = CSTRING(clacker_displayName); picture = PATHTOF(Data\UI\Clacker.paa); onPlace = QUOTE(_this call FUNC(AddClacker);false); requires[] = {"ACE_Clacker"}; }; class MK16_Transmitter:Command { + isAttachable = 1; displayName = CSTRING(MK16_displayName); picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa); requires[] = {"ACE_M26_Clacker"}; }; class DeadManSwitch:Command { + isAttachable = 1; displayName = CSTRING(DeadManSwitch_displayName); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; class Cellphone:Command { + isAttachable = 1; displayName = CSTRING(cellphone_displayName); picture = PATHTOF(Data\UI\Cellphone_UI.paa); onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); requires[] = {"ACE_Cellphone"}; }; class PressurePlate { + isAttachable = 0; displayName = CSTRING(PressurePlate); picture = PATHTOF(Data\UI\PressurePlate.paa); onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false"; }; class IRSensor { + isAttachable = 0; displayName = CSTRING(IRSensor); picture = PATHTOF(Data\UI\PressurePlate.paa); onPlace = "false"; }; class Timer { + isAttachable = 1; displayName = CSTRING(timerName); picture = PATHTOF(data\UI\Timer.paa); onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false); onSetup = QUOTE(_this call FUNC(openTimerSetUI);true); }; class Tripwire { + isAttachable = 0; displayName = CSTRING(TripWire); picture = PATHTOF(Data\UI\Tripwire.paa); onPlace = "false"; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index aa87280b1a..ffd3ab0294 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -37,6 +37,13 @@ _unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(plac (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel; +_isAttachable = false; +_supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers"); +{ + if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;}; +} forEach _supportedTriggers; + + GVAR(pfeh_running) = true; GVAR(placeAction) = PLACE_WAITING; GVAR(TweakedAngle) = 0; @@ -46,7 +53,7 @@ GVAR(TweakedAngle) = 0; BEGIN_COUNTER(pfeh); PARAMS_2(_args,_pfID); - EXPLODE_3_PVT(_args,_unit,_magClassname,_setupObjectClass); + EXPLODE_4_PVT(_args,_unit,_magClassname,_setupObjectClass,_isAttachable); _lookDirVector = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); @@ -73,7 +80,7 @@ GVAR(TweakedAngle) = 0; _attachVehicle = objNull; - if (_badPosition && {!isNull cursorTarget} && {(cursorTarget isKindOf "Car")}) then { + if (_isAttachable && _badPosition && {!isNull cursorTarget} && {(cursorTarget isKindOf "Car")}) then { _attachVehicle = cursorTarget; if ([0.05] call _testPositionIsValid) then { _min = 0.05; @@ -173,4 +180,4 @@ GVAR(TweakedAngle) = 0; END_COUNTER(pfeh); -}, 0, [_unit, _magClassname, _setupObjectClass]] call CBA_fnc_addPerFrameHandler; +}, 0, [_unit, _magClassname, _setupObjectClass, _isAttachable]] call CBA_fnc_addPerFrameHandler; From df90c4b88e9b1af1448c9ae1972ed7fa4dea641e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 16 Jul 2015 23:59:31 -0500 Subject: [PATCH 005/239] More Attach Stuff --- .../functions/fnc_addTriggerActions.sqf | 7 +++-- .../functions/fnc_placeExplosive.sqf | 3 ++ .../explosives/functions/fnc_setPosition.sqf | 16 +++++++--- .../functions/fnc_setupExplosive.sqf | 31 ++++++++++++------- .../explosives/functions/fnc_triggerType.sqf | 5 ++- 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/addons/explosives/functions/fnc_addTriggerActions.sqf b/addons/explosives/functions/fnc_addTriggerActions.sqf index 6f4ece163c..c8c9fd7b09 100644 --- a/addons/explosives/functions/fnc_addTriggerActions.sqf +++ b/addons/explosives/functions/fnc_addTriggerActions.sqf @@ -15,10 +15,11 @@ * Public: No */ #include "script_component.hpp" -private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"]; +private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"]; EXPLODE_2_PVT(_this,_magazine,_explosive); -_detonators = [ACE_player] call FUNC(getDetonators); +_isAttached = !isNull (attachedTo _explosive); +_detonators = [ACE_player] call FUNC(getDetonators); _triggerTypes = [_magazine] call FUNC(triggerType); _magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers"; _children = []; @@ -30,7 +31,7 @@ _children = []; _hasRequiredItems = false; }; } count _required; - if (_hasRequiredItems) then { + if (_hasRequiredItems && {(!_isAttached) || {(getNumber (_x >> "isAttachable")) == 1}}) then { _children pushBack [ [ diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index 68580c2ba0..a0191bbc30 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -62,5 +62,8 @@ if (!isNull _attachedTo) then { if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive}; + + systemChat format ["Placing %1 [%2]", _dir, _this]; + [[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); _explosive diff --git a/addons/explosives/functions/fnc_setPosition.sqf b/addons/explosives/functions/fnc_setPosition.sqf index dcf2537776..e182bc5e8b 100644 --- a/addons/explosives/functions/fnc_setPosition.sqf +++ b/addons/explosives/functions/fnc_setPosition.sqf @@ -11,13 +11,21 @@ * None * * Example: - * [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos; + * [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition; * * Public: Yes */ #include "script_component.hpp" + EXPLODE_3_PVT(_this,_explosive,_direction,_pitch); -_explosive setDir _direction; -if (_pitch != 0) then { - [_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank); + +if (isNull (attachedTo _explosive)) then { + _explosive setDir _direction; + if (_pitch != 0) then { + [_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank); + }; +} else { + _explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]]; }; + + diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index ffd3ab0294..c6c0207e9b 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -37,6 +37,7 @@ _unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(plac (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel; +//Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate) _isAttachable = false; _supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers"); { @@ -48,7 +49,6 @@ GVAR(pfeh_running) = true; GVAR(placeAction) = PLACE_WAITING; GVAR(TweakedAngle) = 0; - [{ BEGIN_COUNTER(pfeh); @@ -80,12 +80,19 @@ GVAR(TweakedAngle) = 0; _attachVehicle = objNull; - if (_isAttachable && _badPosition && {!isNull cursorTarget} && {(cursorTarget isKindOf "Car")}) then { - _attachVehicle = cursorTarget; - if ([0.05] call _testPositionIsValid) then { + if (_isAttachable && _badPosition) then { + _attachVehicle = objNull; + _testBase = _basePosASL vectorAdd _lookDirVector; + { + _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; + _intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit]; + if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);}; + } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; + if ((!isNull _attachVehicle) && {[0.05] call _testPositionIsValid} && + {(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then { _min = 0.05; _max = 1; - for "_index" from 0 to 5 do { + for "_index" from 0 to 6 do { _distanceFromBase = (_min + _max) / 2; if ([_distanceFromBase] call _testPositionIsValid) then { _min = _distanceFromBase; @@ -95,13 +102,15 @@ GVAR(TweakedAngle) = 0; }; _badPosition = false; _distanceFromBase = ((_min + _max) / 2 + 0.075) min 1; - systemChat format ["Attaching, dist %1", _distanceFromBase]; + systemChat format ["Attaching to %1 dist %2", _attachVehicle, _distanceFromBase]; + } else { + _attachVehicle = objNull; }; }; _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase); + //Don't allow Placing bellow terrain if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then { - systemChat "adjusting height"; _virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)]; }; @@ -129,9 +138,10 @@ GVAR(TweakedAngle) = 0; _placeAngle = 0; _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); if (isNull _attachVehicle) then { - _placeAngle = _cameraAngle - GVAR(TweakedAngle) - 180; + _placeAngle = _cameraAngle - GVAR(TweakedAngle) + 180; _expSetupVehicle setPosAsl _virtualPosASL; _expSetupVehicle setDir _placeAngle; + _placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason } else { _modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition)); _placeAngle = _cameraAngle - (getDir _attachVehicle) + 180; @@ -139,8 +149,7 @@ GVAR(TweakedAngle) = 0; _expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]]; }; - - systemChat format ["Attach angel %1", _placeAngle]; + systemChat format ["Place angel %1", _placeAngle]; _expSetupVehicle setVariable [QGVAR(class), _magClassname, true]; _expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true]; @@ -172,12 +181,10 @@ GVAR(TweakedAngle) = 0; _modelUp = [0, (cos _angle), (sin _angle)]; _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; }; - // systemChat format ["Running %1 [%2]", [_modelDir, _modelUp], _attachVehicle]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp]; }; }; - END_COUNTER(pfeh); }, 0, [_unit, _magClassname, _setupObjectClass, _isAttachable]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/explosives/functions/fnc_triggerType.sqf b/addons/explosives/functions/fnc_triggerType.sqf index f9d8790a56..7ca7d27c6a 100644 --- a/addons/explosives/functions/fnc_triggerType.sqf +++ b/addons/explosives/functions/fnc_triggerType.sqf @@ -9,14 +9,13 @@ * Supported triggers as ACE_Triggers config entries * * Example: - * _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType + * ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType * * Public: Yes */ #include "script_component.hpp" -private["_result", "_config", "_count", "_index", "_supports"]; -// IGNORE_PRIVATE_WARNING(_supports); +private["_result", "_config", "_count", "_index"]; _result = []; _config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers"); From bc953b32bc9b8ea5795229ba1286d57166f00ba9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 18 Jul 2015 00:36:47 -0500 Subject: [PATCH 006/239] More Stuff --- addons/explosives/XEH_postInit.sqf | 2 +- .../functions/fnc_handleScrollWheel.sqf | 2 +- addons/explosives/functions/fnc_onKilled.sqf | 9 ++++--- .../functions/fnc_setupExplosive.sqf | 24 +++++++++++-------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 836631efdd..373a53d3ba 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -34,4 +34,4 @@ GVAR(CurrentSpeedDial) = 0; }] call EFUNC(common,addEventHandler); -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(common,addScrollWheelEventHandler); diff --git a/addons/explosives/functions/fnc_handleScrollWheel.sqf b/addons/explosives/functions/fnc_handleScrollWheel.sqf index 3f0552bfd2..0d5fdd2aba 100644 --- a/addons/explosives/functions/fnc_handleScrollWheel.sqf +++ b/addons/explosives/functions/fnc_handleScrollWheel.sqf @@ -17,6 +17,6 @@ if ((!GVAR(pfeh_running)) || {ACE_Modifier == 0}) exitWith {false}; -GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 5 * _this) + 360) % 360; +GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 7.2 * _this) + 360) % 360; true diff --git a/addons/explosives/functions/fnc_onKilled.sqf b/addons/explosives/functions/fnc_onKilled.sqf index 74775b2e66..979ea7c536 100644 --- a/addons/explosives/functions/fnc_onKilled.sqf +++ b/addons/explosives/functions/fnc_onKilled.sqf @@ -14,12 +14,11 @@ * Public: No */ #include "script_component.hpp" + +PARAMS_1(_unit); //Extended_Killed_EventHandlers runs only where _unit is local + private ["_deadman"]; -_unit = _this select 0; -if (_unit == ACE_player) then { - call FUNC(place_Cancel); -}; -if (!isServer) exitWith{}; + _deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives); { [_unit, -1, _x, true] call FUNC(detonateExplosive); diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index c6c0207e9b..3648f7ac9e 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -20,7 +20,7 @@ PARAMS_3(_vehicle,_unit,_magClassname); -[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); +private["_isAttachable", "_setupObjectClass", "_supportedTriggers"]; //Get setup object vehicle and model: _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); @@ -28,6 +28,8 @@ if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! +[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); + //Show mouse buttons: [localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; @@ -49,12 +51,15 @@ GVAR(pfeh_running) = true; GVAR(placeAction) = PLACE_WAITING; GVAR(TweakedAngle) = 0; + [{ BEGIN_COUNTER(pfeh); PARAMS_2(_args,_pfID); EXPLODE_4_PVT(_args,_unit,_magClassname,_setupObjectClass,_isAttachable); + private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testDistance", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; + _lookDirVector = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); @@ -79,7 +84,6 @@ GVAR(TweakedAngle) = 0; _badPosition = !([_distanceFromBase] call _testPositionIsValid); _attachVehicle = objNull; - if (_isAttachable && _badPosition) then { _attachVehicle = objNull; _testBase = _basePosASL vectorAdd _lookDirVector; @@ -102,7 +106,6 @@ GVAR(TweakedAngle) = 0; }; _badPosition = false; _distanceFromBase = ((_min + _max) / 2 + 0.075) min 1; - systemChat format ["Attaching to %1 dist %2", _attachVehicle, _distanceFromBase]; } else { _attachVehicle = objNull; }; @@ -117,12 +120,14 @@ GVAR(TweakedAngle) = 0; //Don't allow placing in a bad position: if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; - //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't - if ((inputAction "zoomTemp") > 0) then {GVAR(placeAction) = PLACE_CANCEL;}; - - if ((GVAR(placeAction) != PLACE_WAITING) || - {_unit != ACE_player}) then { + if (((inputAction "zoomTemp") > 0) || //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't + {_unit != ACE_player} || + {!([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} || + {!(_magClassname in (magazines _unit))}) then { + GVAR(placeAction) = PLACE_CANCEL; + }; + if (GVAR(placeAction) != PLACE_WAITING) then { [_pfID] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_running) = false; @@ -160,7 +165,6 @@ GVAR(TweakedAngle) = 0; [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute); x3 = _expSetupVehicle; - systemChat format ["Mass %1", getMass _expSetupVehicle]; // x3 setMass 1; }; } else { @@ -168,6 +172,7 @@ GVAR(TweakedAngle) = 0; if (_badPosition || {_screenPos isEqualTo []}) then { ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; } else { + //Show the model on the hud in aprox the same size/location as it will be placed: ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; _realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); @@ -181,7 +186,6 @@ GVAR(TweakedAngle) = 0; _modelUp = [0, (cos _angle), (sin _angle)]; _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; }; - // systemChat format ["Running %1 [%2]", [_modelDir, _modelUp], _attachVehicle]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp]; }; }; From bff629be9ca1925d5c3807d9bec0b9e03b180c6f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 25 Jul 2015 01:42:17 -0500 Subject: [PATCH 007/239] Fix PositionAsl / Update mouse hints --- .../functions/fnc_setupExplosive.sqf | 34 +++++++++++++------ addons/explosives/stringtable.xml | 16 +++++++++ 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 3648f7ac9e..988d3969f1 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -18,9 +18,12 @@ #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" +#define PLACE_RANGE_MAX 1 +#define PLACE_RANGE_MIN 0.025 + PARAMS_3(_vehicle,_unit,_magClassname); -private["_isAttachable", "_setupObjectClass", "_supportedTriggers"]; +private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"]; //Get setup object vehicle and model: _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); @@ -59,8 +62,8 @@ GVAR(TweakedAngle) = 0; EXPLODE_4_PVT(_args,_unit,_magClassname,_setupObjectClass,_isAttachable); private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testDistance", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; - - _lookDirVector = (positionCameraToWorld [0,0,0]) vectorFromTo (positionCameraToWorld [0,0,1]); + + _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL)); _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); _basePosASL = (eyePos _unit); @@ -80,7 +83,7 @@ GVAR(TweakedAngle) = 0; _return }; - _distanceFromBase = 1; + _distanceFromBase = PLACE_RANGE_MAX; _badPosition = !([_distanceFromBase] call _testPositionIsValid); _attachVehicle = objNull; @@ -92,10 +95,10 @@ GVAR(TweakedAngle) = 0; _intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit]; if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);}; } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; - if ((!isNull _attachVehicle) && {[0.05] call _testPositionIsValid} && + if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} && {(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then { - _min = 0.05; - _max = 1; + _min = PLACE_RANGE_MIN; + _max = PLACE_RANGE_MAX; for "_index" from 0 to 6 do { _distanceFromBase = (_min + _max) / 2; if ([_distanceFromBase] call _testPositionIsValid) then { @@ -112,6 +115,18 @@ GVAR(TweakedAngle) = 0; }; _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase); + + //Update mouse hint: + if (_badPosition) then { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(BlockedAction); + } else { + if (isNull _attachVehicle) then { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(PlaceAction); + } else { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(AttachAction); + }; + }; + //Don't allow Placing bellow terrain if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then { _virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)]; @@ -139,7 +154,6 @@ GVAR(TweakedAngle) = 0; (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; if (GVAR(placeAction) == PLACE_APPROVE) then { - systemChat format ["place %1 - %2", _virtualPosASL, aslToAtl _virtualPosASL];; _placeAngle = 0; _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); if (isNull _attachVehicle) then { @@ -154,7 +168,7 @@ GVAR(TweakedAngle) = 0; _expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]]; }; - systemChat format ["Place angel %1", _placeAngle]; + TRACE_1("Place angel",_placeAngle); _expSetupVehicle setVariable [QGVAR(class), _magClassname, true]; _expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true]; @@ -164,8 +178,6 @@ GVAR(TweakedAngle) = 0; _unit setVariable [QGVAR(PlantingExplosive), true]; [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute); - x3 = _expSetupVehicle; - // x3 setMass 1; }; } else { _screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition)); diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 7ab3c13fe0..cc7b7f2df6 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -61,6 +61,22 @@ Colocar Установить + + Attach + Befestigen + Acoplar + Przyczep + Attacher + Připnout + Fixar + Attacca + Hozzácsatolás + Прикрепить + + + Blocked + Obstruido + Cancel Abbrechen From 9f078d405b9364ee4e277940871695622175096b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 25 Jul 2015 02:10:33 -0500 Subject: [PATCH 008/239] Tweak Place when Prone --- .../explosives/functions/fnc_setupExplosive.sqf | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 988d3969f1..4cd693fc6d 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -61,23 +61,28 @@ GVAR(TweakedAngle) = 0; PARAMS_2(_args,_pfID); EXPLODE_4_PVT(_args,_unit,_magClassname,_setupObjectClass,_isAttachable); - private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testDistance", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; + private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL)); - _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); - _basePosASL = (eyePos _unit); - if (cameraView == "EXTERNAL") then { + if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder _basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); }; + if ((stance _unit) == "PRONE") then { + //If prone, lower base and increase up angle of look - Makes it much easier to attach to underside of vehicles + _basePosASL set [2, ((_basePosASL select 2) - 0.3)]; + _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL)); + }; + _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); _testPositionIsValid = { - _testDistance = _this select 0; - _testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply _testDistance); + _testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0)); _return = true; { _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; + #ifdef DEBUG_MODE_FULL drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]]; + #endif if (lineIntersects [eyePos _unit, _testPos, _unit]) exitWith {_return = false;}; } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; _return From 33314f8a9e7675f7e6694ebf86062d9e02213924 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 31 Jul 2015 23:32:25 +0100 Subject: [PATCH 009/239] Adjust spectator camera boom speed Vertical camera movement (boom) was previously at a constant speed. However this felt too slow at times, half the horizontal (dolly) speed should improve this. --- addons/spectator/functions/fnc_handleInterface.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 864ae32adc..709c0263b2 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -224,7 +224,7 @@ switch (toLower _mode) do { [_display,nil,nil,true] call FUNC(toggleInterface); }; case 16: { // Q - GVAR(camBoom) = 0.5; + GVAR(camBoom) = 0.5 * GVAR(camSpeed); }; case 17: { // W GVAR(camDolly) set [1, GVAR(camSpeed)]; @@ -245,7 +245,7 @@ switch (toLower _mode) do { [_display,nil,true] call FUNC(toggleInterface); }; case 44: { // Z - GVAR(camBoom) = -0.5; + GVAR(camBoom) = -0.5 * GVAR(camSpeed); }; case 49: { // N if (_ctrl) then { From 612aa2d679515c0d74156c823852efe10083bf5a Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 1 Aug 2015 18:10:11 +0100 Subject: [PATCH 010/239] Separate spectator physical and virtual states With the changes planned to allow spectator in the true death state, physical changes aren't applicable in all of the possible usage cases. This separates the physical process into new function ace_spectator_fnc_stageSpectator --- addons/spectator/XEH_preInit.sqf | 1 + .../spectator/functions/fnc_setSpectator.sqf | 49 +++---------- .../functions/fnc_stageSpectator.sqf | 68 +++++++++++++++++++ 3 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 addons/spectator/functions/fnc_stageSpectator.sqf diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index e5872c3272..2cc65602cc 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -16,6 +16,7 @@ PREP(handleUnits); PREP(moduleSpectatorSettings); PREP(setCameraAttributes); PREP(setSpectator); +PREP(stageSpectator); PREP(transitionCamera); PREP(toggleInterface); PREP(updateCameraModes); diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index fd3dd9861c..f4dc86c3da 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -1,10 +1,14 @@ /* * Author: SilentSpike - * Sets target unit to the given spectator state + * Sets target unit to the given spectator state (virtually) + * To physically handle a spectator see ace_spectator_fnc_stageSpectator + * + * Units will be able to communicate in ACRE/TFAR as appropriate + * The spectator interface will be opened/closed * * Arguments: * 0: Unit to put into spectator state - * 1: New spectator state + * 1: Spectator state * * Return Value: * None @@ -17,10 +21,7 @@ #include "script_component.hpp" -params ["_unit",["_set",true,[true]],["_target",objNull,[objNull]]]; - -// No change, no service (but allow spectators who respawn to be reset) -if !(_set || (_unit getVariable [QGVAR(isSpectator), false])) exitWith {}; +params ["_unit", ["_set",true,[true]]]; // Only run for player units if !(isPlayer _unit) exitWith {}; @@ -29,49 +30,15 @@ if !(local _unit) exitwith { [[_unit, _set, _target], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc); }; -// Prevent player falling into water -_unit enableSimulation !_set; - -// Move to/from group as appropriate -[_unit, _set, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); - if (_set) then { - // Move and hide the player ASAP to avoid being seen - _unit setPos (getMarkerPos QGVAR(respawn)); - - // Ghosts can't talk - [_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit); - [_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit); - ["open"] call FUNC(handleInterface); } else { ["close"] call FUNC(handleInterface); - - // Physical beings can talk - [_unit, QGVAR(isSpectator)] call EFUNC(common,unhideUnit); - [_unit, QGVAR(isSpectator)] call EFUNC(common,unmuteUnit); - - private "_marker"; - _marker = ["respawn_west","respawn_east","respawn_guerrila","respawn_civilian"] select ([west,east,resistance,civilian] find (side group _unit)); - _unit setPos (getMarkerPos _marker); }; -// Enable/disable input as appropriate -//[QGVAR(isSpectator), _set] call EFUNC(common,setDisableUserInputStatus); - // 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 {[_unit, _set] call TFAR_fnc_forceSpectator}; -// 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 && (_unit getVariable [QGVAR(isSpectator), false])) then { - // Mark spectator state for reference - _unit setVariable [QGVAR(isSpectator), _set, true]; - - ["spectatorChanged",[_set]] call EFUNC(common,localEvent); -}; +["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..2f6741e35a --- /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", ["_set",true,[true]]]; + +// No change, no service (but allow spectators who respawn to be reset) +if !(_set || (GETVAR(_unit,GVAR(isSpectator),false))) exitWith {}; + +// Only run for player units +if !(isPlayer _unit) exitWith {}; + +if !(local _unit) exitwith { + [[_unit, _set, _target], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); +}; + +// Prevent player falling into water +_unit enableSimulation !_set; + +// Move to/from group as appropriate +[_unit, _set, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); + +if (_set) then { + // Move and hide the player ASAP to avoid being seen + GVAR(oldPos) = getPosATL _unit; + _unit setPos (getMarkerPos QGVAR(respawn)); + + // Ghosts can't talk + [_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit); + [_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit); +} else { + // Physical beings can talk + [_unit, QGVAR(isSpectator)] call EFUNC(common,unhideUnit); + [_unit, QGVAR(isSpectator)] 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(isSpectator),false))) then { + // Mark spectator state for reference + _unit setVariable [QGVAR(isSpectator), _set, true]; + + ["spectatorStaged",[_set]] call EFUNC(common,localEvent); +}; From 38e08d513a91fe0c084ecfd2d8dfd575224961d2 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 2 Aug 2015 12:34:35 +0100 Subject: [PATCH 011/239] Clear spectator display variable at preInit uiNamespace persists between missions and should be reset on mission start --- addons/spectator/XEH_preInit.sqf | 2 ++ addons/spectator/functions/fnc_handleInterface.sqf | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 2cc65602cc..a77d731478 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -38,6 +38,8 @@ GVAR(camUnit) = objNull; GVAR(camVision) = -2; GVAR(camZoom) = 1.25; +SETUVAR(GVAR(display),nil); + GVAR(showComp) = true; GVAR(showHelp) = true; GVAR(showIcons) = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 709c0263b2..2fa0d1439c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -95,9 +95,7 @@ switch (toLower _mode) do { case "onload": { _args params ["_display"]; - with uiNamespace do { - GVAR(display) = _display; - }; + SETUVAR(GVAR(display),_display); // Always show interface and hide map upon opening [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); @@ -151,9 +149,7 @@ switch (toLower _mode) do { //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; }; case "onunload": { - with uiNamespace do { - GVAR(display) = nil; - }; + SETUVAR(GVAR(display),nil); GVAR(camHandler) = nil; GVAR(compHandler) = nil; From 63c034e348421d22a01e84f923841b48e76deebc Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 2 Aug 2015 12:47:26 +0100 Subject: [PATCH 012/239] Differentiate between staged and set spectators Existing variable "ace_spectator_isSpectator" split into counterparts "ace_spectator_isSet" and "ace_spectator_isStaged" in order to better manage spectator events --- addons/spectator/XEH_postInit.sqf | 2 +- .../spectator/functions/fnc_setSpectator.sqf | 11 ++++++++++- .../spectator/functions/fnc_stageSpectator.sqf | 18 +++++++++--------- addons/spectator/functions/fnc_updateUnits.sqf | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index bad3758c19..45ac78e89c 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -2,7 +2,7 @@ //#include "initKeybinds.sqf"; // Add interaction menu exception -["isNotSpectating", {!((_this select 0) getVariable [QGVAR(isSpectator), false])}] call EFUNC(common,addCanInteractWithCondition); +["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); diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index f4dc86c3da..2f8e1d3c2d 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -23,6 +23,9 @@ params ["_unit", ["_set",true,[true]]]; +// No change, no service (but allow spectators to be reset) +if !(_set || (GETVAR(_unit,GVAR(isSet),false))) exitWith {}; + // Only run for player units if !(isPlayer _unit) exitWith {}; @@ -41,4 +44,10 @@ if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableV if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator}; if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[_unit, _set] call TFAR_fnc_forceSpectator}; -["spectatorSet",[_set]] call EFUNC(common,localEvent); +// No theoretical change if an existing spectator was reset +if !(_set isEqualTo (GETVAR(_unit,GVAR(isSet),false))) then { + // Mark spectator state for reference + _unit setVariable [QGVAR(isSet), _set, true]; + + ["spectatorSet",[_set]] call EFUNC(common,localEvent); +}; diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 2f6741e35a..84bd6ffced 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -23,8 +23,8 @@ params ["_unit", ["_set",true,[true]]]; -// No change, no service (but allow spectators who respawn to be reset) -if !(_set || (GETVAR(_unit,GVAR(isSpectator),false))) exitWith {}; +// No change, no service (but allow spectators to be reset) +if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; // Only run for player units if !(isPlayer _unit) exitWith {}; @@ -37,7 +37,7 @@ if !(local _unit) exitwith { _unit enableSimulation !_set; // Move to/from group as appropriate -[_unit, _set, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); +[_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide); if (_set) then { // Move and hide the player ASAP to avoid being seen @@ -45,12 +45,12 @@ if (_set) then { _unit setPos (getMarkerPos QGVAR(respawn)); // Ghosts can't talk - [_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit); - [_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit); } else { // Physical beings can talk - [_unit, QGVAR(isSpectator)] call EFUNC(common,unhideUnit); - [_unit, QGVAR(isSpectator)] call EFUNC(common,unmuteUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,unmuteUnit); _unit setPosATL GVAR(oldPos); }; @@ -60,9 +60,9 @@ _unit allowDamage !_set; _unit setVariable [QEGVAR(medical,allowDamage), !_set]; // No theoretical change if an existing spectator was reset -if !(_set isEqualTo (GETVAR(_unit,GVAR(isSpectator),false))) then { +if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { // Mark spectator state for reference - _unit setVariable [QGVAR(isSpectator), _set, true]; + _unit setVariable [QGVAR(isStaged), _set, true]; ["spectatorStaged",[_set]] call EFUNC(common,localEvent); }; diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index 0393fa0e36..ef8fc3b4f1 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -55,7 +55,7 @@ _filteredUnits = []; {(_x isKindOf "CAManBase")} && {(side group _x) in _sides} && // Side filter {simulationEnabled _x} && - {!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen? + {!(_x getVariable [QGVAR(isStaged), false])} // Who watches the watchmen? ) then { _filteredUnits pushBack _x; }; From 52460182c9c662dacc76e27f21a5d9e8b37786e8 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 2 Aug 2015 16:42:24 +0100 Subject: [PATCH 013/239] Enable spectator on death system New spectator on death system should enter spectator mode upon dying and exit upon respawning. Only virtual spectator state is suitable for this system since the body should remain as is. --- addons/spectator/functions/fnc_handleKilled.sqf | 9 ++++----- addons/spectator/functions/fnc_handleRespawn.sqf | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/spectator/functions/fnc_handleKilled.sqf b/addons/spectator/functions/fnc_handleKilled.sqf index 67c556cc3f..05671ed749 100644 --- a/addons/spectator/functions/fnc_handleKilled.sqf +++ b/addons/spectator/functions/fnc_handleKilled.sqf @@ -1,7 +1,7 @@ /* * Author: SilentSpike - * Cache necessary details and process unit for spectator on death - * Part of the basic spectator system + * Set inital camera attributes and set as spectator on death + * Part of the spectator during death system * * Arguments: * 0: Corpse @@ -17,11 +17,10 @@ params ["_unit","_killer"]; -// Remove from group to prevent appearing on HUD upon respawn -[_unit, true, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); - if (isNull _killer) then { [2,_unit] call FUNC(setCameraAttributes); } else { [2,_killer] call FUNC(setCameraAttributes); }; + +[_unit] call FUNC(setSpectator); diff --git a/addons/spectator/functions/fnc_handleRespawn.sqf b/addons/spectator/functions/fnc_handleRespawn.sqf index 9b6b0bb802..3e7dfa41f3 100644 --- a/addons/spectator/functions/fnc_handleRespawn.sqf +++ b/addons/spectator/functions/fnc_handleRespawn.sqf @@ -1,7 +1,7 @@ /* * Author: SilentSpike - * Start the interface on respawn - * Part of the basic spectator system + * Un-set as spectator on respawn + * Part of the spectator during death system * * Arguments: * 0: New unit @@ -15,4 +15,4 @@ #include "script_component.hpp" -[_this select 0] call FUNC(setSpectator); +[_unit,false] call FUNC(setSpectator); From 9b764bbba45a3980114676842d07c260379c55c2 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 2 Aug 2015 17:27:32 +0100 Subject: [PATCH 014/239] Preserve Polish translations from master branch Since spectator was pushed back to a feature branch from the release branch these translations from a PR were also lost (as the commits were prior to the removal commit) when it was merged after the fact. --- addons/spectator/stringtable.xml | 70 +++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 8b91608981..1f74d08c43 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -3,195 +3,253 @@ Spectator Settings + Ustawienia obserwatora Configure how the spectator system will operate by default. + Skonfiguruj domyślne ustawienia obserwatora. Spectate on death + Obserwator po śmierci Enables spectator upon death. + Włącz obserwatora po śmierci 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 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 Unit icons + Ikony jednostek Render icons above spectatable units. + Renderuj ikony nad głowami jednostek, które można obserwować. - Spectator Controls + Sterowanie obserwatorem Free + Wolna Internal + Wewnętrzna External + Zewnętrzna Normal + Normalna Night + Noc Thermal + Termo - Free Camera Controls + Wolne sterowanie kamerą 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 - Zoom In/Out + Zoom +/- + Zoom +/- - Speed Up/Down + Speed +/- + Prędkość +/- Next Vision Mode + Następny tryb wizji Previous Vision Mode + Poprzedni tryb wizji - Interface Controls + Sterowanie interfejsem 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 - Other Controls + Pozostałe sterowanie Next Camera + Następna kamera Previous Camera + Poprzednia kamera Next Unit + Następna jednostka Previous Unit + Poprzednia jednostka From b87b4ea16aba273aca2ad287239bd45f60c890c5 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 3 Aug 2015 00:22:50 +0100 Subject: [PATCH 015/239] Improve spectator GUI reopening prevention Using boolean instead of simply checking for the display. Checking for diplay was unreliable since it can be technically closed while theoretically open during the escape menu and such. --- addons/spectator/XEH_preInit.sqf | 2 +- addons/spectator/functions/fnc_handleInterface.sqf | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index a77d731478..3b317ba904 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -38,7 +38,7 @@ GVAR(camUnit) = objNull; GVAR(camVision) = -2; GVAR(camZoom) = 1.25; -SETUVAR(GVAR(display),nil); +GVAR(open) = false; GVAR(showComp) = true; GVAR(showHelp) = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 2fa0d1439c..114f4e163b 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -23,7 +23,8 @@ switch (toLower _mode) do { // Safely open/close the interface case "open": { // Prevent reopening - if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {}; + if (GVAR(open)) exitWith {}; + GVAR(open) = true; // Initalize camera variables GVAR(camBoom) = 0; @@ -57,13 +58,13 @@ switch (toLower _mode) do { }; case "close": { // Can't close a second time - if (isNull (GETUVAR(GVAR(display),displayNull))) exitWith {}; + if !(GVAR(open)) exitWith {}; + GVAR(open) = false; // Terminate interface while {dialog} do { closeDialog 0; }; - GETUVAR(GVAR(display),displayNull) closeDisplay 0; // Terminate camera GVAR(camera) cameraEffect ["terminate", "back"]; @@ -95,8 +96,6 @@ switch (toLower _mode) do { case "onload": { _args params ["_display"]; - SETUVAR(GVAR(display),_display); - // Always show interface and hide map upon opening [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); @@ -149,8 +148,7 @@ switch (toLower _mode) do { //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; }; case "onunload": { - SETUVAR(GVAR(display),nil); - + // Kill GUI PFHs GVAR(camHandler) = nil; GVAR(compHandler) = nil; GVAR(iconHandler) = nil; From 98b088f26f717d172c3bdb5e1a0695412ce38c5a Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 3 Aug 2015 00:24:36 +0100 Subject: [PATCH 016/239] Fix pre-spectator position saving When staging a spectator (physically applying the spectator state) the unit position is saved for potential later restoration. This shouldn't be done multiple times since the function can be called again to reset staged units. --- addons/spectator/functions/fnc_handleRespawn.sqf | 2 ++ addons/spectator/functions/fnc_stageSpectator.sqf | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/spectator/functions/fnc_handleRespawn.sqf b/addons/spectator/functions/fnc_handleRespawn.sqf index 3e7dfa41f3..aa695dd553 100644 --- a/addons/spectator/functions/fnc_handleRespawn.sqf +++ b/addons/spectator/functions/fnc_handleRespawn.sqf @@ -15,4 +15,6 @@ #include "script_component.hpp" +params ["_unit","_oldUnit"]; + [_unit,false] call FUNC(setSpectator); diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 84bd6ffced..bac5174601 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -40,13 +40,16 @@ _unit enableSimulation !_set; [_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide); if (_set) then { - // Move and hide the player ASAP to avoid being seen - GVAR(oldPos) = getPosATL _unit; - _unit setPos (getMarkerPos QGVAR(respawn)); + // 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 (getMarkerPos QGVAR(respawn)); } else { // Physical beings can talk [_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit); From f5e7185aec965d0166cf8cae2e85a6b81d717a44 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 3 Aug 2015 13:04:36 +0100 Subject: [PATCH 017/239] Fix spectator camera exiting mechanism When using ACE_Player the camera would return to the dead body. It makes sense to simply pass the reset unit by reference to the camera exit code. --- addons/spectator/functions/fnc_handleInterface.sqf | 4 +++- addons/spectator/functions/fnc_setSpectator.sqf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 114f4e163b..255d282983 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -57,6 +57,8 @@ switch (toLower _mode) do { }; }; case "close": { + _args params ["_unit"]; + // Can't close a second time if !(GVAR(open)) exitWith {}; GVAR(open) = false; @@ -71,7 +73,7 @@ switch (toLower _mode) do { camDestroy GVAR(camera); // Return to player view - ACE_Player switchCamera "internal"; + _unit switchCamera "internal"; // Cleanup camera variables GVAR(camera) = nil; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 2f8e1d3c2d..b6e85926c5 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -36,7 +36,7 @@ if !(local _unit) exitwith { if (_set) then { ["open"] call FUNC(handleInterface); } else { - ["close"] call FUNC(handleInterface); + ["close",_unit] call FUNC(handleInterface); }; // Handle common addon audio From 5bfa4e597113356d534d28cef9b5dc011b761e6f Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 3 Aug 2015 15:18:09 +0100 Subject: [PATCH 018/239] Improve spectator camera vision mode on start The spectator camera should start in night vision mode if the sun to moon transition state is appropriate --- addons/spectator/functions/fnc_handleInterface.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 255d282983..315398ab0c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -37,6 +37,11 @@ switch (toLower _mode) do { GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; + // Camera starts with night vision if it's dark + if (sunOrMoon < 1) then { + [nil,nil,-1] call FUNC(setCameraAttributes); + }; + // Initalize the camera view GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); [] call FUNC(transitionCamera); From 7e9500f2ca6a240458b16031153565ff8e451efa Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 3 Aug 2015 21:38:44 +0100 Subject: [PATCH 019/239] Enable ace_spectator respawn framework integration Seamlessly integrates the spectator system with the vanilla respawn framework when the onDeath setting is enabled. This commit makes a lot of changes: - Edit BI functions used by the vanilla respawn framework to enable support for ace_spectator. - Set spectator state is now tracked using a GVAR for the local player since using a unit won't be reliable all of the time. However unit is still marked for any filtering purposes. - Instead of NV being used based on the sun to moon transition state by default, that functionality only takes place in the integrated system so that custom frameworks can do what they want. - Seagull units are hidden when using framework integration since they're spawned by the engine with respawn type 1 and they just hang around undesirably --- addons/spectator/XEH_postInit.sqf | 7 - addons/spectator/XEH_preInit.sqf | 12 +- addons/spectator/config.cpp | 35 +++ .../functions/fnc_bi_respawnBase.sqf | 35 +++ .../functions/fnc_bi_respawnCounter.sqf | 35 +++ .../functions/fnc_bi_respawnEndMission.sqf | 62 ++++ .../functions/fnc_bi_respawnInstant.sqf | 35 +++ .../functions/fnc_bi_respawnNone.sqf | 293 ++++++++++++++++++ .../functions/fnc_bi_respawnSeagull.sqf | 101 ++++++ .../functions/fnc_bi_respawnSpectator.sqf | 59 ++++ .../functions/fnc_bi_respawnWave.sqf | 43 +++ .../functions/fnc_handleInterface.sqf | 22 +- .../spectator/functions/fnc_handleKilled.sqf | 26 -- .../spectator/functions/fnc_handleRespawn.sqf | 20 -- .../functions/fnc_setCameraAttributes.sqf | 2 +- .../spectator/functions/fnc_setSpectator.sqf | 31 +- .../functions/fnc_stageSpectator.sqf | 4 +- 17 files changed, 736 insertions(+), 86 deletions(-) create mode 100644 addons/spectator/functions/fnc_bi_respawnBase.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnCounter.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnEndMission.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnInstant.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnNone.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnSeagull.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnSpectator.sqf create mode 100644 addons/spectator/functions/fnc_bi_respawnWave.sqf delete mode 100644 addons/spectator/functions/fnc_handleKilled.sqf delete mode 100644 addons/spectator/functions/fnc_handleRespawn.sqf diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index 45ac78e89c..35b463837f 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -7,11 +7,4 @@ ["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); - - if !(hasInterface) exitWith {}; - - if (GVAR(onDeath)) then { - player addEventHandler ["Killed",FUNC(handleKilled)]; - player addEventHandler ["Respawn",FUNC(handleRespawn)]; - }; }] call EFUNC(common,addEventHandler); diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 3b317ba904..73c629a0ce 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -2,15 +2,21 @@ ADDON = false; +PREP(bi_respawnBase); +PREP(bi_respawnCounter); +PREP(bi_respawnEndMission); +PREP(bi_respawnInstant); +PREP(bi_respawnNone); +PREP(bi_respawnSeagull); +PREP(bi_respawnSpectator); +PREP(bi_respawnWave); PREP(cacheUnitInfo); PREP(cycleCamera); PREP(handleCamera); PREP(handleCompass); PREP(handleIcons); PREP(handleInterface); -PREP(handleKilled); PREP(handleMouse); -PREP(handleRespawn); PREP(handleToolbar); PREP(handleUnits); PREP(moduleSpectatorSettings); @@ -38,7 +44,7 @@ GVAR(camUnit) = objNull; GVAR(camVision) = -2; GVAR(camZoom) = 1.25; -GVAR(open) = false; +GVAR(isSet) = false; GVAR(showComp) = true; GVAR(showHelp) = true; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp index e686c75294..eb73761e5f 100644 --- a/addons/spectator/config.cpp +++ b/addons/spectator/config.cpp @@ -16,3 +16,38 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "ui\interface.hpp" + +class CfgRespawnTemplates { + class None { + onPlayerKilled = QFUNC(bi_respawnNone); + }; + class Spectator { + onPlayerKilled = QFUNC(bi_respawnSpectator); + onPlayerRespawn = QFUNC(bi_respawnSpectator); + }; + class Instant { + onPlayerKilled = QFUNC(bi_respawnInstant); + onPlayerRespawn = QFUNC(bi_respawnInstant); + }; + class Base { + onPlayerKilled = QFUNC(bi_respawnBase); + onPlayerRespawn = QFUNC(bi_respawnBase); + }; + class EndMission + { + onPlayerKilled = QFUNC(bi_respawnEndMission); + onPlayerRespawn = QFUNC(bi_respawnEndMission); + }; + class Seagull { + onPlayerRespawn = QFUNC(bi_respawnSeagull); + }; + class Wave + { + onPlayerKilled = QFUNC(bi_respawnWave); + onPlayerRespawn = QFUNC(bi_respawnWave); + }; + class Counter { + onPlayerKilled = QFUNC(bi_respawnCounter); + onPlayerRespawn = QFUNC(bi_respawnCounter); + }; +}; diff --git a/addons/spectator/functions/fnc_bi_respawnBase.sqf b/addons/spectator/functions/fnc_bi_respawnBase.sqf new file mode 100644 index 0000000000..7ea5b0c745 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnBase.sqf @@ -0,0 +1,35 @@ +/* + * Author: Bohemia Interactive + * Part of the BI respawn framework + * Handles base respawn type (respawn on marker) + * Edited to support ace_spectator integration + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +if !(GVAR(onDeath)) exitWith {}; + +params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]]; + +if (alive _unit) then { + [_unit,false] call FUNC(setSpectator); +} else { + private ["_vision","_pos"]; + if (isNull _killer) then {_killer = _unit}; + _vision = [-2,-1] select (sunOrMoon < 1); + _pos = (getPosATL _unit) vectorAdd [0,0,5]; + + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_bi_respawnCounter.sqf b/addons/spectator/functions/fnc_bi_respawnCounter.sqf new file mode 100644 index 0000000000..0bee90ec61 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnCounter.sqf @@ -0,0 +1,35 @@ +/* + * Author: Bohemia Interactive (Karel Moricky) + * Part of the BI respawn framework + * Handles the respawn timer display + * Edited to disable counter when spectator is opened + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +_player = [_this,0,objNull,[objnull]] call bis_fnc_param; + +_respawnDelay = [_this,3,0,[0]] call bis_fnc_param; + +if (!isplayer _player && !isnull _player && _respawnDelay > 0) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; + +//--- Engine-triggered respawn +_layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; + +if (!alive _player) then { + if (GVAR(onDeath) || (playerrespawntime < 1)) exitwith {}; + _layer cutrsc ["RscRespawnCounter","plain"]; +} else { + _layer cuttext ["","plain"]; +}; diff --git a/addons/spectator/functions/fnc_bi_respawnEndMission.sqf b/addons/spectator/functions/fnc_bi_respawnEndMission.sqf new file mode 100644 index 0000000000..23b8dacc17 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnEndMission.sqf @@ -0,0 +1,62 @@ +/* + * Author: Bohemia Interactive (Karel Moricky) + * Part of the BI respawn framework + * Ends the mission when all players are dead + * Edited to support ace_spectator integration + * + * 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]]]; +private ["_vision","_pos"]; + +if (isNull _killer) then {_killer = _unit}; +_vision = [-2,-1] select (sunOrMoon < 1); +_pos = (getPosATL _unit) vectorAdd [0,0,5]; + +if (ismultiplayer) then { + + _respawnType = 0 call bis_fnc_missionRespawnType; + if (_respawnType in [0,1,4,5]) then { + + //--- No more respawn slots + if ({isplayer _x && alive _x} count playableunits == 0) then { + [["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp; + } else { + if (GVAR(onDeath) && (_respawnType in [0,1])) then { + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); + }; + }; + + //--- Don't end the script to prevent premature mission end + waituntil {false}; + } else { + + if (!alive _unit) then { + + //--- No more respawn tickets + if ([] call bis_fnc_respawntickets == 0 && {isplayer _x} count playableunits == 0) then { + [["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp; + } else { + if (GVAR(onDeath)) then { + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); + }; + }; + } else { + [_unit,false] call FUNC(setSpectator); + }; + }; +}; diff --git a/addons/spectator/functions/fnc_bi_respawnInstant.sqf b/addons/spectator/functions/fnc_bi_respawnInstant.sqf new file mode 100644 index 0000000000..fd1d255cf9 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnInstant.sqf @@ -0,0 +1,35 @@ +/* + * Author: Bohemia Interactive + * Part of the BI respawn framework + * Handles instant respawn type (respawn at position of death) + * Edited to support ace_spectator integration + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +if !(GVAR(onDeath)) exitWith {}; + +params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]]; + +if (alive _unit) then { + [_unit,false] call FUNC(setSpectator); +} else { + private ["_vision","_pos"]; + if (isNull _killer) then {_killer = _unit}; + _vision = [-2,-1] select (sunOrMoon < 1); + _pos = (getPosATL _unit) vectorAdd [0,0,5]; + + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_bi_respawnNone.sqf b/addons/spectator/functions/fnc_bi_respawnNone.sqf new file mode 100644 index 0000000000..a5031a8fd9 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnNone.sqf @@ -0,0 +1,293 @@ +/* + * Author: Bohemia Interactive (Karel Moricky) + * Part of the BI respawn framework + * Shows death screen for respawn type "None" + * Edited to support ace_spectator integration + * + * Arguments: + * 0: Corpse + * 1: Killer + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ +private ["_soundvolume","_musicvolume"]; + +#define BI_CONTROL (_display displayctrl _n) + +#include "script_component.hpp" + +disableserialization; +_player = _this select 0; +_killer = _this select 1; +if (isnull _killer) then {_killer = _player}; + +_musicvolume = musicvolume; +_soundvolume = soundvolume; //MUF-TODO: check if this is done before sound is faded in fn_feedbackMain.fsm + +_start = isnil "bis_fnc_respawnNone_start"; +if (_start) then { + bis_fnc_respawnNone_start = [daytime,time / 3600]; + + //3.5 fadesound 0; //MUF-commented + + sleep 2; + if (alive player) exitwith {}; + cutText ["","BLACK OUT",1]; + sleep 1.5; + BIS_fnc_feedback_allowPP = false; //MUF-switch health PP off + //(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1];//MUF-black in (remove black screen that was launched in FSM PP) + + if (ismultiplayer) then { + if (GVAR(onDeath)) then { + private ["_vision","_pos"]; + _vision = [-2,-1] select (sunOrMoon < 1); + _pos = (getPosATL _player) vectorAdd [0,0,5]; + + [2,_killer,_vision,_pos,getDir _player] call FUNC(setCameraAttributes); + [_player] call FUNC(setSpectator); + } else { + (finddisplay 46) createdisplay "RscDisplayMissionEnd"; + }; + } else {enableenddialog}; +}; +if (alive player) exitwith { + [player,false] call FUNC(setSpectator); + cuttext ["","plain"]; +}; //--- Terminate when player manages to switch do different unit already + +if (GVAR(onDeath)) exitWith {}; + +waituntil {!isnull (finddisplay 58)}; +_display = finddisplay 58; + +//--- Black fade in +_n = 1060; +BI_CONTROL ctrlsetfade 1; +if (_start) then { + + //--- Play ambient radio + setacctime 1; + 0 fademusic 0; + 4 fademusic 0.8; + playmusic format ['RadioAmbient%1',ceil random 1/*30*/]; + _musicEH = addMusicEventHandler ["MusicStop",{[] spawn {playmusic format ['RadioAmbient%1',ceil random 1/*30*/];};}]; + uinamespace setvariable ["bis_fnc_respawnNone_musicEH",_musicEH]; + _display displayaddeventhandler ["unload","removeMusicEventHandler ['MusicStop',uinamespace getvariable ['bis_fnc_respawnNone_musicEH',-1]];"]; + + BI_CONTROL ctrlcommit 4; +} else { + BI_CONTROL ctrlcommit 0; +}; +cuttext ["","plain"]; + +//--- HUD +_n = 5800; +BI_CONTROL ctrlsettext gettext (configfile >> "cfgingameui" >> "cursor" >> "select"); +BI_CONTROL ctrlsetposition [-10,-10,safezoneH * 0.07 * 3/4,safezoneH * 0.07]; +BI_CONTROL ctrlsettextcolor [1,1,1,1]; +BI_CONTROL ctrlcommit 0; + +//--- SITREP (ToDO: Localize) +_sitrep = "SITREP||"; +if (name _player != "Error: No unit") then { + _sitrep = _sitrep + "KIA: %4. %5|"; +}; +_sitrep = _sitrep + "TOD: %2 [%3]|LOC: %6 \ %7"; +if (_killer != _player) then { + _sitrep = _sitrep + "||ENY: %8"; + if (currentweapon _killer != "") then { + _sitrep = _sitrep + "|ENW: %9" + }; +}; +_sitrep = format [ + _sitrep, + 1 * safezoneH, + [bis_fnc_respawnNone_start select 0,"HH:MM:SS"] call bis_fnc_timetostring, + [bis_fnc_respawnNone_start select 1,"HH:MM:SS"] call bis_fnc_timetostring, + toupper localize format ["STR_SHORT_%1",rank _player], + toupper name _player, + mapGridPosition _player, + toupper worldname, + toupper ((configfile >> "cfgvehicles" >> typeof _killer) call bis_fnc_displayname), + toupper ((configfile >> "cfgweapons" >> currentweapon _killer) call bis_fnc_displayname) + +]; + +_n = 11000; +_bcgPos = ctrlposition BI_CONTROL; +_n = 5858; +//BI_CONTROL ctrlsetposition [_bcgPos select 0,safezoneY + ((_bcgPos select 0) - safezoneX) * 4/3,safezoneW - 2 * (_bcgPos select 2),safezoneH / 2]; +BI_CONTROL ctrlsetposition [(((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX), + ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY), + safezoneW - 2 * (_bcgPos select 2), + safezoneH / 2]; +BI_CONTROL ctrlcommit 0; +[BI_CONTROL,_sitrep] spawn { + scriptname "bis_fnc_respawnNone: SITREP"; + disableserialization; + _control = _this select 0; + _sitrepArray = toarray (_this select 1); + {_sitrepArray set [_foreachindex,tostring [_x]]} foreach _sitrepArray; + _sitrep = ""; + //_sitrepFormat = "%1"; + _sitrepFormat = "%1"; + + sleep 1; + for "_i" from 0 to (count _sitrepArray - 1) do { + _letter = _sitrepArray select _i; + _delay = if (_letter == "|") then {_letter = "
"; 1} else {0.01}; + _sitrep = _sitrep + _letter; + _control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep + "_"]; + //playsound ["IncomingChallenge",true]; + sleep _delay; + if (isnull _control) exitwith {}; + }; + _control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep]; +}; + + +//--- Create UAV camera +_camera = "camera" camcreate position player; +_camera cameraeffect ["internal","back"]; +_camera campreparefov 0.4; +_camera campreparetarget _killer; +showcinemaborder false; + +//--- Set PP effects +_saturation = 0.0 + random 0.3; +_ppColor = ppEffectCreate ["ColorCorrections", 1999]; +_ppColor ppEffectEnable true; +_ppColor ppEffectAdjust [1, 1, 0, [1, 1, 1, 0], [1 - _saturation, 1 - _saturation, 1 - _saturation, _saturation], [1, 0.25, 0, 1.0]]; +_ppColor ppEffectCommit 0; + +_ppGrain = ppEffectCreate ["filmGrain", 2012]; +_ppGrain ppEffectEnable true; +_ppGrain ppEffectAdjust [random 0.2, 1, 1, 0, 1]; +_ppGrain ppEffectCommit 0; + +//--- Camera update executed every frame +bis_fnc_respawnNone_player = _player; +bis_fnc_respawnNone_killer = _killer; +bis_fnc_respawnNone_camera = _camera; +bis_fnc_respawnNone_loop = { + scriptname "bis_fnc_respawnNone: camera"; + _display = _this select 0; + _player = bis_fnc_respawnNone_player; + _killer = bis_fnc_respawnNone_killer; + _camera = bis_fnc_respawnNone_camera; + + _sin = 20 * sin (time * 7); + _killerPos = [ + (visiblepositionasl _killer select 0), + (visiblepositionasl _killer select 1) + (_sin), + (visiblepositionasl _killer select 2) + (_sin) + ]; + + _dirToKiller = if (_killer == _player) then { + direction _player; + } else { + ([_player,_killerPos] call bis_fnc_dirto) + _sin; + }; + _pos = [ + visiblepositionasl _player, + -20, + _dirToKiller + ] call bis_fnc_relpos; + _pos set [2,((_pos select 2) + 7) max (getterrainheightasl _pos + 7)]; + + //--- Pitch + _heightCamera = getterrainheightasl _pos; + _heightKiller = getterrainheightasl _killerPos; + _height = _heightCamera - _heightKiller; + _dis = _killerPos distance _pos; + _angle = (asin (_height/_dis)); + + _camera setdir _dirtokiller; + [_camera,-_angle,_sin] call bis_fnc_setpitchbank; + _camera setposasl _pos; + + //--- HUD + _n = 5800; + _hudPos = (worldtoscreen position _player); + if (count _hudPos > 0) then { + _hudPosW = ctrlposition BI_CONTROL select 2; + _hudPosH = ctrlposition BI_CONTROL select 3; + _hudPos = [ + (_hudPos select 0) - _hudPosW / 2, + (_hudPos select 1) - _hudPosH / 2, + _hudPosW, + _hudPosH + ]; + BI_CONTROL ctrlsetposition _hudPos; + BI_CONTROL ctrlcommit 0; + }; +}; + +bis_fnc_respawnNone_keydown = { + _key = _this select 1; + + if (_key in (actionkeys 'nightvision') || _key < 0) then { + bis_fnc_respawnNone_vision = bis_fnc_respawnNone_vision + 1; + _vision = bis_fnc_respawnNone_vision % 4; + switch (_vision) do { + case 0: { + camusenvg false; + call compile 'false SetCamUseTi 0'; + }; + case 1: { + camusenvg true; + call compile 'false SetCamUseTi 0'; + }; + case 2: { + camusenvg false; + call compile 'true SetCamUseTi 0'; + }; + case 3: { + camusenvg false; + call compile 'true SetCamUseTi 1'; + }; + }; + }; +}; +//bis_fnc_respawnNone_vision = (1 + floor random 3) % 4; //--- Random vision (not NVG) +bis_fnc_respawnNone_vision = -1; +if (sunormoon < 1) then {bis_fnc_respawnNone_vision = 0;}; +[-1,-1] call bis_fnc_respawnNone_keydown; + +_display displayaddeventhandler ["mousemoving","_this call bis_fnc_respawnNone_loop"]; +_display displayaddeventhandler ["mouseholding","_this call bis_fnc_respawnNone_loop"]; +_display displayaddeventhandler ["keydown","_this call bis_fnc_respawnNone_keydown"]; + + +//--- Team Switch display opened +waituntil {isnull _display}; +_displayTeamSwitch = finddisplay 632; + +//--- Team Switch display closed - cleanup and restart the view +waituntil {isnull _displayTeamSwitch}; + +_camera cameraeffect ["terminate","back"]; +camdestroy _camera; + +bis_fnc_respawnNone_player = nil; +bis_fnc_respawnNone_killer = nil; +bis_fnc_respawnNone_camera = nil; +bis_fnc_respawnNone_loop = nil; + +ppeffectdestroy _ppColor; +ppeffectdestroy _ppGrain; + +if (!alive player) exitwith {_this call bis_fnc_respawnNone;}; + + +//--- Resurrection! +BIS_fnc_feedback_allowPP = true; +0 fadesound _soundvolume; +0 fademusic _musicvolume; +playmusic ""; +bis_fnc_respawnNone_start = nil; diff --git a/addons/spectator/functions/fnc_bi_respawnSeagull.sqf b/addons/spectator/functions/fnc_bi_respawnSeagull.sqf new file mode 100644 index 0000000000..2e01ffa6ea --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnSeagull.sqf @@ -0,0 +1,101 @@ +/* + * Author: Bohemia Interactive + * Part of the BI respawn framework + * Correctly handles seagull respawn (not used by default) + * Edited to support ace_spectator integration + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +_seagull = _this select 0; +_player = _this select 1; +_this call bis_fnc_log; + +if (!isplayer _player && !isplayer _seagull) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; + +waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]}; +BIS_fnc_feedback_allowPP = false; +//(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",8]; + +if (GVAR(onDeath)) exitWith { + private ["_vision","_pos"]; + + if (isNull _player) then {_player = _seagull}; + _vision = [-2,-1] select (sunOrMoon < 1); + _pos = (getPosATL _player) vectorAdd [0,0,5]; + + [_seagull,QGVAR(isSeagull)] call EFUNC(common,hideUnit); + [2,_player,_vision,_pos,getDir _seagull] call FUNC(setCameraAttributes); + [_seagull] call FUNC(setSpectator); +}; + +_camera = "camera" camCreate [(position _player select 0)-0.75, (position _player select 1)-0.75,(position _player select 2) + 0.5]; +_camera cameraEffect ["internal","back"]; +_camera camSetFOV 0.800; +_camera camCommit 0; +waituntil {camCommitted _camera}; + +0 fadeMusic 0.5; +playMusic "Track06_Abandoned_Battlespace"; + +_camera camSetTarget vehicle _player; +_camera camSetRelPos [-0.82,-3.12,3.38]; +_camera camSetFOV 0.800; +_camera camCommit 7; + +sleep 1; +_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (2 preloadObject _this)}}; +sleep 5; +waituntil {camCommitted _camera}; + +_camera camSetRelPos [1.17,-21.71,2.07]; +_camera camSetFOV 0.400; +_camera camCommit 10; +sleep 2; +terminate _preload; +sleep 3; +_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (3 preloadObject _this)}}; +waituntil {camCommitted _camera}; + +_camera camSetTarget vehicle _player; +_camera camSetRelPos [5.80,1.29,5.07]; +_camera camSetFOV 0.300; +_camera camCommit 7; +sleep 2; +terminate _preload; +_preload = _seagull spawn {waitUntil {(preloadCamera getPos _this) && (4 preloadObject _this)}}; +waituntil {camCommitted _camera}; + +_camera camSetRelPos [2.71,19.55,12.94]; +_camera camSetFOV 0.700; +_camera camCommit 2; +waituntil {camCommitted _camera}; + +_camera camSetTarget _seagull; +_camera camSetRelPos [-6.66,18.99,2.59]; +_camera camSetFOV 0.700; +_camera camCommit 3; +waituntil {camCommitted _camera}; + +3 fadeMusic 0; + +_camera camSetRelPos [1.17,-21.71,-1.07]; +_camera camSetFOV 0.300; +_camera camCommit 3; +waituntil {camCommitted _camera}; +terminate _preload; + +_seagull switchCamera "EXTERNAL"; +_seagull cameraEffect ["terminate","back"]; +camDestroy _camera; diff --git a/addons/spectator/functions/fnc_bi_respawnSpectator.sqf b/addons/spectator/functions/fnc_bi_respawnSpectator.sqf new file mode 100644 index 0000000000..5097b61ab2 --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnSpectator.sqf @@ -0,0 +1,59 @@ +/* + * Author: Bohemia Interactive + * Part of the BI respawn framework + * Opens BI spectator interface (default used by seagull respawn) + * Edited to support ace_spectator integration + * + * 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",-1,[0]]]; +private ["_vision","_pos"]; + +if (isNull _killer) then {_killer = _unit}; +_vision = [-2,-1] select (sunOrMoon < 1); +_pos = (getPosATL _unit) vectorAdd [0,0,5]; + +_layer = "BIS_fnc_respawnSpectator" call bis_fnc_rscLayer; + +if (!alive _unit) then { + if (GVAR(onDeath)) then { + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); + } else { + _layer cutrsc ["RscSpectator","plain"]; + }; +} else { + if (_respawn == 1) then { + + //--- Open + waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]}; + BIS_fnc_feedback_allowPP = false; + //(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1]; + if (GVAR(onDeath)) then { + [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); + } else { + _layer cutrsc ["RscSpectator","plain"]; + }; + } else { + if (GVAR(onDeath)) then { + [_unit,false] call FUNC(setSpectator); + }; + + //--- Close + _layer cuttext ["","plain"]; + }; +}; diff --git a/addons/spectator/functions/fnc_bi_respawnWave.sqf b/addons/spectator/functions/fnc_bi_respawnWave.sqf new file mode 100644 index 0000000000..371a8edcdc --- /dev/null +++ b/addons/spectator/functions/fnc_bi_respawnWave.sqf @@ -0,0 +1,43 @@ +/* + * Author: Bohemia Interactive + * Part of the BI respawn framework + * Handles wave respawning system + * Edited to support ace_spectator integration + * + * 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]]]; + +if (!isplayer _unit && !isnull _unit) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; + +if (!alive _unit) then { + //--- Set the time only when it was not modified already + if (_respawnDelay != 0 && _respawnDelay == playerrespawntime) then { + setplayerrespawntime (_respawnDelay + _respawnDelay - (servertime % _respawnDelay)); + + if !(GVAR(onDeath)) exitWith {}; + private ["_vision","_pos"]; + + if (isNull _killer) then {_killer = _unit}; + _vision = [-2,-1] select (sunOrMoon < 1); + _pos = (getPosATL _unit) vectorAdd [0,0,5]; + + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); + }; +} else { + setplayerrespawntime _respawndelay; + [_unit,false] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 315398ab0c..5c8c958451 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -23,8 +23,7 @@ switch (toLower _mode) do { // Safely open/close the interface case "open": { // Prevent reopening - if (GVAR(open)) exitWith {}; - GVAR(open) = true; + if (GVAR(isSet)) exitWith {}; // Initalize camera variables GVAR(camBoom) = 0; @@ -37,15 +36,17 @@ switch (toLower _mode) do { GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; - // Camera starts with night vision if it's dark - if (sunOrMoon < 1) then { - [nil,nil,-1] call FUNC(setCameraAttributes); - }; - // Initalize the camera view GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); [] call FUNC(transitionCamera); + // Close map + openMap [false,false]; + + // Close any BI layers/effects + BIS_fnc_feedback_allowPP = false; + ("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"]; + // Close all existing dialogs while {dialog} do { closeDialog 0; @@ -65,8 +66,7 @@ switch (toLower _mode) do { _args params ["_unit"]; // Can't close a second time - if !(GVAR(open)) exitWith {}; - GVAR(open) = false; + if !(GVAR(isSet)) exitWith {}; // Terminate interface while {dialog} do { @@ -80,6 +80,10 @@ switch (toLower _mode) do { // Return to player view _unit switchCamera "internal"; + // Re-enable any BI effects + BIS_fnc_feedback_allowPP = true; + BIS_fnc_respawnNone_start = nil; + // Cleanup camera variables GVAR(camera) = nil; GVAR(camBoom) = nil; diff --git a/addons/spectator/functions/fnc_handleKilled.sqf b/addons/spectator/functions/fnc_handleKilled.sqf deleted file mode 100644 index 05671ed749..0000000000 --- a/addons/spectator/functions/fnc_handleKilled.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Author: SilentSpike - * Set inital camera attributes and set as spectator on death - * Part of the spectator during death system - * - * Arguments: - * 0: Corpse - * 1: Killer - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -params ["_unit","_killer"]; - -if (isNull _killer) then { - [2,_unit] call FUNC(setCameraAttributes); -} else { - [2,_killer] call FUNC(setCameraAttributes); -}; - -[_unit] call FUNC(setSpectator); diff --git a/addons/spectator/functions/fnc_handleRespawn.sqf b/addons/spectator/functions/fnc_handleRespawn.sqf deleted file mode 100644 index aa695dd553..0000000000 --- a/addons/spectator/functions/fnc_handleRespawn.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: SilentSpike - * Un-set as spectator on respawn - * Part of the spectator during death system - * - * Arguments: - * 0: New unit - * 1: Old unit - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -params ["_unit","_oldUnit"]; - -[_unit,false] call FUNC(setSpectator); diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf index da2373318d..278a8c4758 100644 --- a/addons/spectator/functions/fnc_setCameraAttributes.sqf +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -51,7 +51,7 @@ if !(_vision in GVAR(availableVisions)) then { }; GVAR(camPan) = _heading % 360; -GVAR(camPosition) = (ATLtoASL _position); +GVAR(camPos) = (ATLtoASL _position); GVAR(camSpeed) = (_speed max 0.05) min 10; GVAR(camTilt) = (_tilt max -89) min 89; GVAR(camUnit) = _unit; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index b6e85926c5..2d5ada415c 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -1,9 +1,9 @@ /* * Author: SilentSpike - * Sets target unit to the given spectator state (virtually) + * Sets target player to the given spectator state (virtually) * To physically handle a spectator see ace_spectator_fnc_stageSpectator * - * Units will be able to communicate in ACRE/TFAR as appropriate + * Player will be able to communicate in ACRE/TFAR as appropriate * The spectator interface will be opened/closed * * Arguments: @@ -23,20 +23,11 @@ params ["_unit", ["_set",true,[true]]]; -// No change, no service (but allow spectators to be reset) -if !(_set || (GETVAR(_unit,GVAR(isSet),false))) exitWith {}; - // Only run for player units if !(isPlayer _unit) exitWith {}; if !(local _unit) exitwith { - [[_unit, _set, _target], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc); -}; - -if (_set) then { - ["open"] call FUNC(handleInterface); -} else { - ["close",_unit] call FUNC(handleInterface); + [[_unit, _set], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc); }; // Handle common addon audio @@ -44,10 +35,14 @@ if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableV if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator}; if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[_unit, _set] call TFAR_fnc_forceSpectator}; -// No theoretical change if an existing spectator was reset -if !(_set isEqualTo (GETVAR(_unit,GVAR(isSet),false))) then { - // Mark spectator state for reference - _unit setVariable [QGVAR(isSet), _set, true]; - - ["spectatorSet",[_set]] call EFUNC(common,localEvent); +if (_set) then { + ["open"] call FUNC(handleInterface); +} else { + ["close",_unit] call FUNC(handleInterface); }; + +// Mark spectator state for reference +_unit setVariable [QGVAR(isSet), _set, true]; +GVAR(isSet) = _set; + +["spectatorSet",[_set,_unit]] call EFUNC(common,localEvent); diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index bac5174601..3e17235e3e 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -30,7 +30,7 @@ if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; if !(isPlayer _unit) exitWith {}; if !(local _unit) exitwith { - [[_unit, _set, _target], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); + [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); }; // Prevent player falling into water @@ -49,7 +49,7 @@ if (_set) then { [_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit); [_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit); - _unit setPos (getMarkerPos QGVAR(respawn)); + _unit setPos (markerPos QGVAR(respawn)); } else { // Physical beings can talk [_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit); From 1b12d3728437a948d4e6779f724f7a6387e50396 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 4 Aug 2015 22:11:34 +0100 Subject: [PATCH 020/239] Replace spectator respawn changes with a template Hacking the BI respawn framework to support a spectator setting was intrusive and limiting. Instead of using a setting, I've opted to introduce a new respawn template that can be used within BI's respawn framework. The benefits of this approach are: - Compatibility isn't a concern, that responsibility is shifted onto mission designers. - Mission designers can use the functionality of the BI framework alongside the spectator system (combining templates, using different templates for different sides, etc.). - If a custom respawn framework is used, then this doesn't change anything. Custom frameworks are still fully supported via the public functions provided. - Remains simple to set up, just requires a description.ext edit --- addons/spectator/ACE_Settings.hpp | 4 - addons/spectator/CfgVehicles.hpp | 6 - addons/spectator/XEH_preInit.sqf | 10 +- addons/spectator/config.cpp | 34 +- .../functions/fnc_bi_respawnBase.sqf | 35 --- .../functions/fnc_bi_respawnCounter.sqf | 35 --- .../functions/fnc_bi_respawnEndMission.sqf | 62 ---- .../functions/fnc_bi_respawnInstant.sqf | 35 --- .../functions/fnc_bi_respawnNone.sqf | 293 ------------------ .../functions/fnc_bi_respawnSeagull.sqf | 101 ------ .../functions/fnc_bi_respawnSpectator.sqf | 59 ---- .../functions/fnc_bi_respawnWave.sqf | 43 --- .../functions/fnc_handleInterface.sqf | 5 +- .../functions/fnc_moduleSpectatorSettings.sqf | 1 - .../functions/fnc_respawnTemplate.sqf | 39 +++ .../functions/fnc_transitionCamera.sqf | 8 +- addons/spectator/stringtable.xml | 8 - 17 files changed, 52 insertions(+), 726 deletions(-) delete mode 100644 addons/spectator/functions/fnc_bi_respawnBase.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnCounter.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnEndMission.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnInstant.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnNone.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnSeagull.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnSpectator.sqf delete mode 100644 addons/spectator/functions/fnc_bi_respawnWave.sqf create mode 100644 addons/spectator/functions/fnc_respawnTemplate.sqf diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 5e7907d19f..539f7cef2d 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -1,8 +1,4 @@ class ACE_Settings { - class GVAR(onDeath) { - typeName = "BOOL"; - value = 0; - }; class GVAR(filterUnits) { typeName = "SCALAR"; value = 1; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index 7067257f23..8e685dae07 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -9,12 +9,6 @@ class CfgVehicles { isGlobal = 1; author = ECSTRING(common,ACETeam); class Arguments { - class systemEnable { - displayName = CSTRING(system_DisplayName); - description = CSTRING(system_Description); - typeName = "BOOL"; - defaultValue = 0; - }; class unitsFilter { displayName = CSTRING(units_DisplayName); description = CSTRING(units_Description); diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 73c629a0ce..95c18f4a54 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -2,14 +2,6 @@ ADDON = false; -PREP(bi_respawnBase); -PREP(bi_respawnCounter); -PREP(bi_respawnEndMission); -PREP(bi_respawnInstant); -PREP(bi_respawnNone); -PREP(bi_respawnSeagull); -PREP(bi_respawnSpectator); -PREP(bi_respawnWave); PREP(cacheUnitInfo); PREP(cycleCamera); PREP(handleCamera); @@ -20,6 +12,7 @@ PREP(handleMouse); PREP(handleToolbar); PREP(handleUnits); PREP(moduleSpectatorSettings); +PREP(respawnTemplate); PREP(setCameraAttributes); PREP(setSpectator); PREP(stageSpectator); @@ -35,6 +28,7 @@ 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]; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp index eb73761e5f..6e32ed0413 100644 --- a/addons/spectator/config.cpp +++ b/addons/spectator/config.cpp @@ -18,36 +18,8 @@ class CfgPatches { #include "ui\interface.hpp" class CfgRespawnTemplates { - class None { - onPlayerKilled = QFUNC(bi_respawnNone); - }; - class Spectator { - onPlayerKilled = QFUNC(bi_respawnSpectator); - onPlayerRespawn = QFUNC(bi_respawnSpectator); - }; - class Instant { - onPlayerKilled = QFUNC(bi_respawnInstant); - onPlayerRespawn = QFUNC(bi_respawnInstant); - }; - class Base { - onPlayerKilled = QFUNC(bi_respawnBase); - onPlayerRespawn = QFUNC(bi_respawnBase); - }; - class EndMission - { - onPlayerKilled = QFUNC(bi_respawnEndMission); - onPlayerRespawn = QFUNC(bi_respawnEndMission); - }; - class Seagull { - onPlayerRespawn = QFUNC(bi_respawnSeagull); - }; - class Wave - { - onPlayerKilled = QFUNC(bi_respawnWave); - onPlayerRespawn = QFUNC(bi_respawnWave); - }; - class Counter { - onPlayerKilled = QFUNC(bi_respawnCounter); - onPlayerRespawn = QFUNC(bi_respawnCounter); + class ADDON { + onPlayerKilled = QFUNC(respawnTemplate); + onPlayerRespawn = QFUNC(respawnTemplate); }; }; diff --git a/addons/spectator/functions/fnc_bi_respawnBase.sqf b/addons/spectator/functions/fnc_bi_respawnBase.sqf deleted file mode 100644 index 7ea5b0c745..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnBase.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: Bohemia Interactive - * Part of the BI respawn framework - * Handles base respawn type (respawn on marker) - * Edited to support ace_spectator integration - * - * Arguments: - * 0: Corpse/New Unit - * 1: Killer/Old Unit - * 2: Respawn Type - * 3: Respawn Delay - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -if !(GVAR(onDeath)) exitWith {}; - -params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]]; - -if (alive _unit) then { - [_unit,false] call FUNC(setSpectator); -} else { - private ["_vision","_pos"]; - if (isNull _killer) then {_killer = _unit}; - _vision = [-2,-1] select (sunOrMoon < 1); - _pos = (getPosATL _unit) vectorAdd [0,0,5]; - - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); -}; diff --git a/addons/spectator/functions/fnc_bi_respawnCounter.sqf b/addons/spectator/functions/fnc_bi_respawnCounter.sqf deleted file mode 100644 index 0bee90ec61..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnCounter.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: Bohemia Interactive (Karel Moricky) - * Part of the BI respawn framework - * Handles the respawn timer display - * Edited to disable counter when spectator is opened - * - * Arguments: - * 0: Corpse/New Unit - * 1: Killer/Old Unit - * 2: Respawn Type - * 3: Respawn Delay - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -_player = [_this,0,objNull,[objnull]] call bis_fnc_param; - -_respawnDelay = [_this,3,0,[0]] call bis_fnc_param; - -if (!isplayer _player && !isnull _player && _respawnDelay > 0) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; - -//--- Engine-triggered respawn -_layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; - -if (!alive _player) then { - if (GVAR(onDeath) || (playerrespawntime < 1)) exitwith {}; - _layer cutrsc ["RscRespawnCounter","plain"]; -} else { - _layer cuttext ["","plain"]; -}; diff --git a/addons/spectator/functions/fnc_bi_respawnEndMission.sqf b/addons/spectator/functions/fnc_bi_respawnEndMission.sqf deleted file mode 100644 index 23b8dacc17..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnEndMission.sqf +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: Bohemia Interactive (Karel Moricky) - * Part of the BI respawn framework - * Ends the mission when all players are dead - * Edited to support ace_spectator integration - * - * 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]]]; -private ["_vision","_pos"]; - -if (isNull _killer) then {_killer = _unit}; -_vision = [-2,-1] select (sunOrMoon < 1); -_pos = (getPosATL _unit) vectorAdd [0,0,5]; - -if (ismultiplayer) then { - - _respawnType = 0 call bis_fnc_missionRespawnType; - if (_respawnType in [0,1,4,5]) then { - - //--- No more respawn slots - if ({isplayer _x && alive _x} count playableunits == 0) then { - [["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp; - } else { - if (GVAR(onDeath) && (_respawnType in [0,1])) then { - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); - }; - }; - - //--- Don't end the script to prevent premature mission end - waituntil {false}; - } else { - - if (!alive _unit) then { - - //--- No more respawn tickets - if ([] call bis_fnc_respawntickets == 0 && {isplayer _x} count playableunits == 0) then { - [["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp; - } else { - if (GVAR(onDeath)) then { - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); - }; - }; - } else { - [_unit,false] call FUNC(setSpectator); - }; - }; -}; diff --git a/addons/spectator/functions/fnc_bi_respawnInstant.sqf b/addons/spectator/functions/fnc_bi_respawnInstant.sqf deleted file mode 100644 index fd1d255cf9..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnInstant.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: Bohemia Interactive - * Part of the BI respawn framework - * Handles instant respawn type (respawn at position of death) - * Edited to support ace_spectator integration - * - * Arguments: - * 0: Corpse/New Unit - * 1: Killer/Old Unit - * 2: Respawn Type - * 3: Respawn Delay - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -if !(GVAR(onDeath)) exitWith {}; - -params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]]; - -if (alive _unit) then { - [_unit,false] call FUNC(setSpectator); -} else { - private ["_vision","_pos"]; - if (isNull _killer) then {_killer = _unit}; - _vision = [-2,-1] select (sunOrMoon < 1); - _pos = (getPosATL _unit) vectorAdd [0,0,5]; - - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); -}; diff --git a/addons/spectator/functions/fnc_bi_respawnNone.sqf b/addons/spectator/functions/fnc_bi_respawnNone.sqf deleted file mode 100644 index a5031a8fd9..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnNone.sqf +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Author: Bohemia Interactive (Karel Moricky) - * Part of the BI respawn framework - * Shows death screen for respawn type "None" - * Edited to support ace_spectator integration - * - * Arguments: - * 0: Corpse - * 1: Killer - * 2: Respawn Type - * 3: Respawn Delay - * - * Return Value: - * None - * - * Public: No - */ -private ["_soundvolume","_musicvolume"]; - -#define BI_CONTROL (_display displayctrl _n) - -#include "script_component.hpp" - -disableserialization; -_player = _this select 0; -_killer = _this select 1; -if (isnull _killer) then {_killer = _player}; - -_musicvolume = musicvolume; -_soundvolume = soundvolume; //MUF-TODO: check if this is done before sound is faded in fn_feedbackMain.fsm - -_start = isnil "bis_fnc_respawnNone_start"; -if (_start) then { - bis_fnc_respawnNone_start = [daytime,time / 3600]; - - //3.5 fadesound 0; //MUF-commented - - sleep 2; - if (alive player) exitwith {}; - cutText ["","BLACK OUT",1]; - sleep 1.5; - BIS_fnc_feedback_allowPP = false; //MUF-switch health PP off - //(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1];//MUF-black in (remove black screen that was launched in FSM PP) - - if (ismultiplayer) then { - if (GVAR(onDeath)) then { - private ["_vision","_pos"]; - _vision = [-2,-1] select (sunOrMoon < 1); - _pos = (getPosATL _player) vectorAdd [0,0,5]; - - [2,_killer,_vision,_pos,getDir _player] call FUNC(setCameraAttributes); - [_player] call FUNC(setSpectator); - } else { - (finddisplay 46) createdisplay "RscDisplayMissionEnd"; - }; - } else {enableenddialog}; -}; -if (alive player) exitwith { - [player,false] call FUNC(setSpectator); - cuttext ["","plain"]; -}; //--- Terminate when player manages to switch do different unit already - -if (GVAR(onDeath)) exitWith {}; - -waituntil {!isnull (finddisplay 58)}; -_display = finddisplay 58; - -//--- Black fade in -_n = 1060; -BI_CONTROL ctrlsetfade 1; -if (_start) then { - - //--- Play ambient radio - setacctime 1; - 0 fademusic 0; - 4 fademusic 0.8; - playmusic format ['RadioAmbient%1',ceil random 1/*30*/]; - _musicEH = addMusicEventHandler ["MusicStop",{[] spawn {playmusic format ['RadioAmbient%1',ceil random 1/*30*/];};}]; - uinamespace setvariable ["bis_fnc_respawnNone_musicEH",_musicEH]; - _display displayaddeventhandler ["unload","removeMusicEventHandler ['MusicStop',uinamespace getvariable ['bis_fnc_respawnNone_musicEH',-1]];"]; - - BI_CONTROL ctrlcommit 4; -} else { - BI_CONTROL ctrlcommit 0; -}; -cuttext ["","plain"]; - -//--- HUD -_n = 5800; -BI_CONTROL ctrlsettext gettext (configfile >> "cfgingameui" >> "cursor" >> "select"); -BI_CONTROL ctrlsetposition [-10,-10,safezoneH * 0.07 * 3/4,safezoneH * 0.07]; -BI_CONTROL ctrlsettextcolor [1,1,1,1]; -BI_CONTROL ctrlcommit 0; - -//--- SITREP (ToDO: Localize) -_sitrep = "SITREP||"; -if (name _player != "Error: No unit") then { - _sitrep = _sitrep + "KIA: %4. %5|"; -}; -_sitrep = _sitrep + "TOD: %2 [%3]|LOC: %6 \ %7"; -if (_killer != _player) then { - _sitrep = _sitrep + "||ENY: %8"; - if (currentweapon _killer != "") then { - _sitrep = _sitrep + "|ENW: %9" - }; -}; -_sitrep = format [ - _sitrep, - 1 * safezoneH, - [bis_fnc_respawnNone_start select 0,"HH:MM:SS"] call bis_fnc_timetostring, - [bis_fnc_respawnNone_start select 1,"HH:MM:SS"] call bis_fnc_timetostring, - toupper localize format ["STR_SHORT_%1",rank _player], - toupper name _player, - mapGridPosition _player, - toupper worldname, - toupper ((configfile >> "cfgvehicles" >> typeof _killer) call bis_fnc_displayname), - toupper ((configfile >> "cfgweapons" >> currentweapon _killer) call bis_fnc_displayname) - -]; - -_n = 11000; -_bcgPos = ctrlposition BI_CONTROL; -_n = 5858; -//BI_CONTROL ctrlsetposition [_bcgPos select 0,safezoneY + ((_bcgPos select 0) - safezoneX) * 4/3,safezoneW - 2 * (_bcgPos select 2),safezoneH / 2]; -BI_CONTROL ctrlsetposition [(((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX), - ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY), - safezoneW - 2 * (_bcgPos select 2), - safezoneH / 2]; -BI_CONTROL ctrlcommit 0; -[BI_CONTROL,_sitrep] spawn { - scriptname "bis_fnc_respawnNone: SITREP"; - disableserialization; - _control = _this select 0; - _sitrepArray = toarray (_this select 1); - {_sitrepArray set [_foreachindex,tostring [_x]]} foreach _sitrepArray; - _sitrep = ""; - //_sitrepFormat = "%1"; - _sitrepFormat = "%1"; - - sleep 1; - for "_i" from 0 to (count _sitrepArray - 1) do { - _letter = _sitrepArray select _i; - _delay = if (_letter == "|") then {_letter = "
"; 1} else {0.01}; - _sitrep = _sitrep + _letter; - _control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep + "_"]; - //playsound ["IncomingChallenge",true]; - sleep _delay; - if (isnull _control) exitwith {}; - }; - _control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep]; -}; - - -//--- Create UAV camera -_camera = "camera" camcreate position player; -_camera cameraeffect ["internal","back"]; -_camera campreparefov 0.4; -_camera campreparetarget _killer; -showcinemaborder false; - -//--- Set PP effects -_saturation = 0.0 + random 0.3; -_ppColor = ppEffectCreate ["ColorCorrections", 1999]; -_ppColor ppEffectEnable true; -_ppColor ppEffectAdjust [1, 1, 0, [1, 1, 1, 0], [1 - _saturation, 1 - _saturation, 1 - _saturation, _saturation], [1, 0.25, 0, 1.0]]; -_ppColor ppEffectCommit 0; - -_ppGrain = ppEffectCreate ["filmGrain", 2012]; -_ppGrain ppEffectEnable true; -_ppGrain ppEffectAdjust [random 0.2, 1, 1, 0, 1]; -_ppGrain ppEffectCommit 0; - -//--- Camera update executed every frame -bis_fnc_respawnNone_player = _player; -bis_fnc_respawnNone_killer = _killer; -bis_fnc_respawnNone_camera = _camera; -bis_fnc_respawnNone_loop = { - scriptname "bis_fnc_respawnNone: camera"; - _display = _this select 0; - _player = bis_fnc_respawnNone_player; - _killer = bis_fnc_respawnNone_killer; - _camera = bis_fnc_respawnNone_camera; - - _sin = 20 * sin (time * 7); - _killerPos = [ - (visiblepositionasl _killer select 0), - (visiblepositionasl _killer select 1) + (_sin), - (visiblepositionasl _killer select 2) + (_sin) - ]; - - _dirToKiller = if (_killer == _player) then { - direction _player; - } else { - ([_player,_killerPos] call bis_fnc_dirto) + _sin; - }; - _pos = [ - visiblepositionasl _player, - -20, - _dirToKiller - ] call bis_fnc_relpos; - _pos set [2,((_pos select 2) + 7) max (getterrainheightasl _pos + 7)]; - - //--- Pitch - _heightCamera = getterrainheightasl _pos; - _heightKiller = getterrainheightasl _killerPos; - _height = _heightCamera - _heightKiller; - _dis = _killerPos distance _pos; - _angle = (asin (_height/_dis)); - - _camera setdir _dirtokiller; - [_camera,-_angle,_sin] call bis_fnc_setpitchbank; - _camera setposasl _pos; - - //--- HUD - _n = 5800; - _hudPos = (worldtoscreen position _player); - if (count _hudPos > 0) then { - _hudPosW = ctrlposition BI_CONTROL select 2; - _hudPosH = ctrlposition BI_CONTROL select 3; - _hudPos = [ - (_hudPos select 0) - _hudPosW / 2, - (_hudPos select 1) - _hudPosH / 2, - _hudPosW, - _hudPosH - ]; - BI_CONTROL ctrlsetposition _hudPos; - BI_CONTROL ctrlcommit 0; - }; -}; - -bis_fnc_respawnNone_keydown = { - _key = _this select 1; - - if (_key in (actionkeys 'nightvision') || _key < 0) then { - bis_fnc_respawnNone_vision = bis_fnc_respawnNone_vision + 1; - _vision = bis_fnc_respawnNone_vision % 4; - switch (_vision) do { - case 0: { - camusenvg false; - call compile 'false SetCamUseTi 0'; - }; - case 1: { - camusenvg true; - call compile 'false SetCamUseTi 0'; - }; - case 2: { - camusenvg false; - call compile 'true SetCamUseTi 0'; - }; - case 3: { - camusenvg false; - call compile 'true SetCamUseTi 1'; - }; - }; - }; -}; -//bis_fnc_respawnNone_vision = (1 + floor random 3) % 4; //--- Random vision (not NVG) -bis_fnc_respawnNone_vision = -1; -if (sunormoon < 1) then {bis_fnc_respawnNone_vision = 0;}; -[-1,-1] call bis_fnc_respawnNone_keydown; - -_display displayaddeventhandler ["mousemoving","_this call bis_fnc_respawnNone_loop"]; -_display displayaddeventhandler ["mouseholding","_this call bis_fnc_respawnNone_loop"]; -_display displayaddeventhandler ["keydown","_this call bis_fnc_respawnNone_keydown"]; - - -//--- Team Switch display opened -waituntil {isnull _display}; -_displayTeamSwitch = finddisplay 632; - -//--- Team Switch display closed - cleanup and restart the view -waituntil {isnull _displayTeamSwitch}; - -_camera cameraeffect ["terminate","back"]; -camdestroy _camera; - -bis_fnc_respawnNone_player = nil; -bis_fnc_respawnNone_killer = nil; -bis_fnc_respawnNone_camera = nil; -bis_fnc_respawnNone_loop = nil; - -ppeffectdestroy _ppColor; -ppeffectdestroy _ppGrain; - -if (!alive player) exitwith {_this call bis_fnc_respawnNone;}; - - -//--- Resurrection! -BIS_fnc_feedback_allowPP = true; -0 fadesound _soundvolume; -0 fademusic _musicvolume; -playmusic ""; -bis_fnc_respawnNone_start = nil; diff --git a/addons/spectator/functions/fnc_bi_respawnSeagull.sqf b/addons/spectator/functions/fnc_bi_respawnSeagull.sqf deleted file mode 100644 index 2e01ffa6ea..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnSeagull.sqf +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Author: Bohemia Interactive - * Part of the BI respawn framework - * Correctly handles seagull respawn (not used by default) - * Edited to support ace_spectator integration - * - * Arguments: - * 0: Corpse/New Unit - * 1: Killer/Old Unit - * 2: Respawn Type - * 3: Respawn Delay - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -_seagull = _this select 0; -_player = _this select 1; -_this call bis_fnc_log; - -if (!isplayer _player && !isplayer _seagull) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; - -waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]}; -BIS_fnc_feedback_allowPP = false; -//(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",8]; - -if (GVAR(onDeath)) exitWith { - private ["_vision","_pos"]; - - if (isNull _player) then {_player = _seagull}; - _vision = [-2,-1] select (sunOrMoon < 1); - _pos = (getPosATL _player) vectorAdd [0,0,5]; - - [_seagull,QGVAR(isSeagull)] call EFUNC(common,hideUnit); - [2,_player,_vision,_pos,getDir _seagull] call FUNC(setCameraAttributes); - [_seagull] call FUNC(setSpectator); -}; - -_camera = "camera" camCreate [(position _player select 0)-0.75, (position _player select 1)-0.75,(position _player select 2) + 0.5]; -_camera cameraEffect ["internal","back"]; -_camera camSetFOV 0.800; -_camera camCommit 0; -waituntil {camCommitted _camera}; - -0 fadeMusic 0.5; -playMusic "Track06_Abandoned_Battlespace"; - -_camera camSetTarget vehicle _player; -_camera camSetRelPos [-0.82,-3.12,3.38]; -_camera camSetFOV 0.800; -_camera camCommit 7; - -sleep 1; -_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (2 preloadObject _this)}}; -sleep 5; -waituntil {camCommitted _camera}; - -_camera camSetRelPos [1.17,-21.71,2.07]; -_camera camSetFOV 0.400; -_camera camCommit 10; -sleep 2; -terminate _preload; -sleep 3; -_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (3 preloadObject _this)}}; -waituntil {camCommitted _camera}; - -_camera camSetTarget vehicle _player; -_camera camSetRelPos [5.80,1.29,5.07]; -_camera camSetFOV 0.300; -_camera camCommit 7; -sleep 2; -terminate _preload; -_preload = _seagull spawn {waitUntil {(preloadCamera getPos _this) && (4 preloadObject _this)}}; -waituntil {camCommitted _camera}; - -_camera camSetRelPos [2.71,19.55,12.94]; -_camera camSetFOV 0.700; -_camera camCommit 2; -waituntil {camCommitted _camera}; - -_camera camSetTarget _seagull; -_camera camSetRelPos [-6.66,18.99,2.59]; -_camera camSetFOV 0.700; -_camera camCommit 3; -waituntil {camCommitted _camera}; - -3 fadeMusic 0; - -_camera camSetRelPos [1.17,-21.71,-1.07]; -_camera camSetFOV 0.300; -_camera camCommit 3; -waituntil {camCommitted _camera}; -terminate _preload; - -_seagull switchCamera "EXTERNAL"; -_seagull cameraEffect ["terminate","back"]; -camDestroy _camera; diff --git a/addons/spectator/functions/fnc_bi_respawnSpectator.sqf b/addons/spectator/functions/fnc_bi_respawnSpectator.sqf deleted file mode 100644 index 5097b61ab2..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnSpectator.sqf +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: Bohemia Interactive - * Part of the BI respawn framework - * Opens BI spectator interface (default used by seagull respawn) - * Edited to support ace_spectator integration - * - * 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",-1,[0]]]; -private ["_vision","_pos"]; - -if (isNull _killer) then {_killer = _unit}; -_vision = [-2,-1] select (sunOrMoon < 1); -_pos = (getPosATL _unit) vectorAdd [0,0,5]; - -_layer = "BIS_fnc_respawnSpectator" call bis_fnc_rscLayer; - -if (!alive _unit) then { - if (GVAR(onDeath)) then { - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); - } else { - _layer cutrsc ["RscSpectator","plain"]; - }; -} else { - if (_respawn == 1) then { - - //--- Open - waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]}; - BIS_fnc_feedback_allowPP = false; - //(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1]; - if (GVAR(onDeath)) then { - [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); - } else { - _layer cutrsc ["RscSpectator","plain"]; - }; - } else { - if (GVAR(onDeath)) then { - [_unit,false] call FUNC(setSpectator); - }; - - //--- Close - _layer cuttext ["","plain"]; - }; -}; diff --git a/addons/spectator/functions/fnc_bi_respawnWave.sqf b/addons/spectator/functions/fnc_bi_respawnWave.sqf deleted file mode 100644 index 371a8edcdc..0000000000 --- a/addons/spectator/functions/fnc_bi_respawnWave.sqf +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: Bohemia Interactive - * Part of the BI respawn framework - * Handles wave respawning system - * Edited to support ace_spectator integration - * - * 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]]]; - -if (!isplayer _unit && !isnull _unit) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;}; - -if (!alive _unit) then { - //--- Set the time only when it was not modified already - if (_respawnDelay != 0 && _respawnDelay == playerrespawntime) then { - setplayerrespawntime (_respawnDelay + _respawnDelay - (servertime % _respawnDelay)); - - if !(GVAR(onDeath)) exitWith {}; - private ["_vision","_pos"]; - - if (isNull _killer) then {_killer = _unit}; - _vision = [-2,-1] select (sunOrMoon < 1); - _pos = (getPosATL _unit) vectorAdd [0,0,5]; - - [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); - }; -} else { - setplayerrespawntime _respawndelay; - [_unit,false] call FUNC(setSpectator); -}; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 5c8c958451..777e8d2ea9 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -43,7 +43,7 @@ switch (toLower _mode) do { // Close map openMap [false,false]; - // Close any BI layers/effects + // Disable BI damage effects and remove counter layer BIS_fnc_feedback_allowPP = false; ("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"]; @@ -80,9 +80,8 @@ switch (toLower _mode) do { // Return to player view _unit switchCamera "internal"; - // Re-enable any BI effects + // Re-enable BI damage effects BIS_fnc_feedback_allowPP = true; - BIS_fnc_respawnNone_start = nil; // Cleanup camera variables GVAR(camera) = nil; diff --git a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf index 1fd20f50e4..c23fb7ad20 100644 --- a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf +++ b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf @@ -19,7 +19,6 @@ params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; -[_logic, QGVAR(onDeath), "systemEnable"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(restrictModes), "cameraModes"] 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..b03c6dfb06 --- /dev/null +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -0,0 +1,39 @@ +/* + * 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"]; + +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); + [_unit] call FUNC(setSpectator); + } else { + [_unit,false] call FUNC(setSpectator); + }; +} else { + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [_unit] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 07abbc94ab..a4d99445fb 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -53,8 +53,12 @@ if (_newMode == 0) then { // Free GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]); GVAR(camera) camCommit 0; - // Switch to camera to stop AI group chat - ACE_Player switchCamera "internal"; + // Agent is switched to in free cam to hide death table and prevent AI chat + 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) diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 1f74d08c43..4eb0e25c0a 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -9,14 +9,6 @@ Configure how the spectator system will operate by default. Skonfiguruj domyślne ustawienia obserwatora. - - Spectate on death - Obserwator po śmierci - - - Enables spectator upon death. - Włącz obserwatora po śmierci - Unit filter Filtr jednostek From 7a0a1ead6ee8e143303ac4f1cd6f0e564dc0bbf4 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 00:32:48 +0200 Subject: [PATCH 021/239] Updated parameterization in Advanced Ballistics module. --- addons/advanced_ballistics/ACE_Settings.hpp | 40 +++++++++---------- ..._calculateAmmoTemperatureVelocityShift.sqf | 5 +-- .../fnc_calculateAtmosphericCorrection.sqf | 9 ++--- ...fnc_calculateBarrelLengthVelocityShift.sqf | 7 +--- .../functions/fnc_calculateRetardation.sqf | 25 +++++------- .../fnc_calculateStabilityFactor.sqf | 10 +---- .../functions/fnc_displayProtractor.sqf | 17 ++++---- .../functions/fnc_handleFired.sqf | 30 +++++--------- .../functions/fnc_initModuleSettings.sqf | 5 +-- .../fnc_initializeTerrainExtension.sqf | 15 +++---- 10 files changed, 63 insertions(+), 100 deletions(-) diff --git a/addons/advanced_ballistics/ACE_Settings.hpp b/addons/advanced_ballistics/ACE_Settings.hpp index d88a9b1148..757385deb3 100644 --- a/addons/advanced_ballistics/ACE_Settings.hpp +++ b/addons/advanced_ballistics/ACE_Settings.hpp @@ -1,31 +1,31 @@ class ACE_Settings { class GVAR(enabled) { - displayName = CSTRING(enabled_DisplayName); - description = CSTRING(enabled_Description); + displayName = "Advanced Ballistics"; + description = "Enables advanced ballistics"; typeName = "BOOL"; value = 0; }; class GVAR(simulateForSnipers) { - displayName = CSTRING(simulateForSnipers_DisplayName); - description = CSTRING(simulateForSnipers_Description); + displayName = "Enabled For Snipers"; + description = "Enables advanced ballistics for non local snipers (when using high power optics)"; typeName = "BOOL"; value = 1; }; class GVAR(simulateForGroupMembers) { - displayName = CSTRING(simulateForGroupMembers_DisplayName); - description = CSTRING(simulateForGroupMembers_Description); + displayName = "Enabled For Group Members"; + description = "Enables advanced ballistics for non local group members"; typeName = "BOOL"; value = 0; }; class GVAR(simulateForEveryone) { - displayName = CSTRING(simulateForEveryone_DisplayName); - description = CSTRING(simulateForEveryone_Description); + displayName = "Enabled For Everyone"; + description = "Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)"; typeName = "BOOL"; value = 0; }; class GVAR(disabledInFullAutoMode) { - displayName = CSTRING(disabledInFullAutoMod_DisplayName); - description = CSTRING(disabledInFullAutoMod_Description); + displayName = "Disabled In FullAuto Mode"; + description = "Disables advanced ballistics during full auto fire"; typeName = "BOOL"; value = 0; }; @@ -38,32 +38,32 @@ class ACE_Settings { }; */ class GVAR(ammoTemperatureEnabled) { - displayName = CSTRING(ammoTemperatureEnabled_DisplayName); - description = CSTRING(ammoTemperatureEnabled_Description); + displayName = "Enable Ammo Temperature Simulation"; + description = "Muzzle velocity varies with ammo temperature"; typeName = "BOOL"; value = 1; }; class GVAR(barrelLengthInfluenceEnabled) { - displayName = CSTRING(barrelLengthInfluenceEnabled_DisplayName); - description = CSTRING(barrelLengthInfluenceEnabled_Description); + displayName = "Enable Barrel Length Simulation"; + description = "Muzzle velocity varies with barrel length"; typeName = "BOOL"; value = 1; }; class GVAR(bulletTraceEnabled) { - displayName = CSTRING(bulletTraceEnabled_DisplayName); - description = CSTRING(bulletTraceEnabled_Description); + displayName = "Enable Bullet Trace Effect"; + description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)"; typeName = "BOOL"; value = 1; }; class GVAR(simulationInterval) { - displayName = CSTRING(simulationInterval_DisplayName); - description = CSTRING(simulationInterval_Description); + displayName = "Simulation Interval"; + description = "Defines the interval between every calculation step"; typeName = "SCALAR"; value = 0.0; }; class GVAR(simulationRadius) { - displayName = CSTRING(simulationRadius_DisplayName); - description = CSTRING(simulationRadius_Description); + displayName = "Simulation Radius"; + description = "Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles"; typeName = "SCALAR"; value = 3000; }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 28df9d1d97..16b094b462 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -15,9 +15,8 @@ */ #include "script_component.hpp" -private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; -_muzzleVelocityShiftTable = _this select 0; -_temperature = _this select 1; +private ["_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; +params["_muzzleVelocityShiftTable", "_temperature"]; if (count _muzzleVelocityShiftTable != 11) exitWith { 0 }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf index b0166109f5..fac048c061 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf @@ -17,12 +17,9 @@ */ #include "script_component.hpp" -private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"]; -_ballisticCoefficient = _this select 0; -_temperature = _this select 1; // in C -_pressure = _this select 2; // in hPa -_relativeHumidity = _this select 3; // as ratio 0-1 -_atmosphereModel = _this select 4; // "ICAO" or "ASM" +private "_airDensity"; + +params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/]; _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index de037f49bc..1896ef816b 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -17,11 +17,8 @@ */ #include "script_component.hpp" -private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; -_barrelLength = _this select 0; -_muzzleVelocityTable = _this select 1; -_barrelLengthTable = _this select 2; -_muzzleVelocity = _this select 3; +private ["_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; +params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"]; if (_barrelLength == 0) exitWith { 0 }; if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 433dafbe10..507410276e 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -18,18 +18,16 @@ // Source: GNU Exterior Ballistics -private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"]; -_dragModel = _this select 0; -_dragCoefficient = _this select 1; -_velocity = (_this select 2) * 3.2808399; +private ["_A", "_M", "_result"]; +params ["_dragModel", "_dragCoefficient", "_velocity"]; +_velocity = _velocity * 3.2808399; _A = -1; _M = -1; _result = 0; switch _dragModel do { - case 1: - { + case 1: { switch true do { case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; @@ -74,8 +72,7 @@ switch _dragModel do { case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; }; }; }; - case 2: - { + case 2: { switch true do { case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; @@ -86,8 +83,7 @@ switch _dragModel do { case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; }; }; }; - case 5: - { + case 5: { switch true do { case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; @@ -98,8 +94,7 @@ switch _dragModel do { case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; }; }; }; - case 6: - { + case 6: { switch true do { case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; @@ -110,8 +105,7 @@ switch _dragModel do { case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; }; }; }; - case 7: - { + case 7: { switch true do { case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; @@ -124,8 +118,7 @@ switch _dragModel do { case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; }; }; }; - case 8: - { + case 8: { switch true do { case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf index 9b205c3ec2..d09e292138 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf @@ -19,14 +19,8 @@ */ #include "script_component.hpp" -private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"]; -_caliber = _this select 0; -_bulletLength = _this select 1; -_bulletMass = _this select 2; -_barrelTwist = _this select 3; -_muzzleVelocity = _this select 4; -_temperature = _this select 5; -_barometricPressure = _this select 6; +private ["_l", "_t", "_stabilityFactor"]; +params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"]; // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf _t = _barrelTwist / _caliber; diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 1a4c344b2e..3acefff54e 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -32,30 +32,29 @@ EGVAR(weather,WindInfo) = false; GVAR(Protractor) = true; [{ + params ["","_idPFH"]; if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith { GVAR(Protractor) = false; 1 cutText ["", "PLAIN"]; - [_this select 1] call cba_fnc_removePerFrameHandler; + [_idPFH] call cba_fnc_removePerFrameHandler; }; - - _refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3]; - + _inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2); _inclinationAngle = -58 max _inclinationAngle min 58; - + 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; - + __ctrl1 ctrlSetScale 1; __ctrl1 ctrlCommit 0; __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; - + __ctrl2 ctrlSetScale 1; - __ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; + __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * _inclinationAngle, 0.2, 0.2 * 4/3]; __ctrl2 ctrlCommit 0; __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; - + }, 0.1, []] call CBA_fnc_addPerFrameHandler; true diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 7c01bd9f23..8285eb49cb 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -19,13 +19,8 @@ */ #include "script_component.hpp" -private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; -_unit = _this select 0; -_weapon = _this select 1; -_mode = _this select 3; -_ammo = _this select 4; -_magazine = _this select 5; -_bullet = _this select 6; +private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; +params ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet"]; _abort = false; if (!hasInterface) exitWith {}; @@ -53,9 +48,7 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then { if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; if (_abort || !(GVAR(extensionAvailable))) exitWith { - if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then { - EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")]; - }; + [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH); }; _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; @@ -120,21 +113,18 @@ GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; [{ private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; - _args = _this select 0; - _bullet = _args select 0; - _caliber = _args select 1; - _bulletTraceVisible = _args select 2; - _index = _args select 3; - + params ["_args","_idPFH"]; + _args params["_bullet","_caliber","_bulletTraceVisible","_index"]; + _bulletVelocity = velocity _bullet; _bulletPosition = getPosASL _bullet; - + _bulletSpeed = vectorMagnitude _bulletVelocity; - + if (!alive _bullet || _bulletSpeed < 100) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; + [_idPFH] call cba_fnc_removePerFrameHandler; }; - + if (_bulletTraceVisible && _bulletSpeed > 500) then { drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; diff --git a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf index 186c0d0649..7cfa50b7df 100644 --- a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf +++ b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf @@ -15,10 +15,7 @@ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic","_units", "_activated"] if !(_activated) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index b2fc7ba084..7587285963 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -33,19 +33,16 @@ _gridCells = _mapGrids * _mapGrids; GVAR(currentGrid) = 0; [{ - private ["_args", "_mapGrids", "_gridCells", "_initStartTime"]; - _args = _this select 0; - _mapGrids = _args select 0; - _gridCells = _args select 1; - _initStartTime = _args select 2; - + params ["_args","_idPFH"]; + _args params ["_mapGrids", "_gridCells", "_initStartTime"]; + if (GVAR(currentGrid) >= _gridCells) exitWith { if (GVAR(initMessageEnabled)) then { systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; }; - [_this select 1] call cba_fnc_removePerFrameHandler; + [_idPFH] call cba_fnc_removePerFrameHandler; }; - + for "_i" from 1 to 50 do { _x = floor(GVAR(currentGrid) / _mapGrids) * 50; _y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50; @@ -57,5 +54,5 @@ GVAR(currentGrid) = 0; GVAR(currentGrid) = GVAR(currentGrid) + 1; if (GVAR(currentGrid) >= _gridCells) exitWith {}; }; - + }, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler From 3a2963c2526dc63e736c86552d7d9db631d40229 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 02:09:51 +0200 Subject: [PATCH 022/239] Fixed mission semicolon --- addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf index 7cfa50b7df..55a443d778 100644 --- a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf +++ b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" -params ["_logic","_units", "_activated"] +params ["_logic","_units", "_activated"]; if !(_activated) exitWith {}; From d95bc3c2993af0039d913bb78982b5e124d54834 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 04:13:36 +0200 Subject: [PATCH 023/239] AB Performance Optimization (Part 1) --- ..._calculateAmmoTemperatureVelocityShift.sqf | 26 +++---- ...fnc_calculateBarrelLengthVelocityShift.sqf | 70 ++++++++++++------- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 16b094b462..8013bbd80a 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -15,21 +15,23 @@ */ #include "script_component.hpp" -private ["_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; +private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction", + "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"]; params["_muzzleVelocityShiftTable", "_temperature"]; -if (count _muzzleVelocityShiftTable != 11) exitWith { 0 }; +// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys +_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10; +if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 }; -_temperatureIndexA = floor((_temperature + 15) / 5); -_temperatureIndexA = 0 max _temperatureIndexA; -_temperatureIndexA = _temperatureIndexA min 10; +// Find exact data index required for given temperature +_temperatureIndexFunction = (_temperature + 15) / 5; -_temperatureIndexB = ceil((_temperature + 15) / 5); -_temperatureIndexB = 0 max _temperatureIndexB; -_temperatureIndexB = _temperatureIndexB min 10; +// lower and upper data index used for interpolation +_temperatureIndexA = (0 max (floor(_temperatureIndexFunction)) min 10; +_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10; -_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5); +// Interpolation ratio +_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction); -_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio; - -_muzzleVelocityShift +// Interpolation +(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index 1896ef816b..513752c538 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -1,5 +1,5 @@ /* - * Author: Ruthberg + * Author: Ruthberg, MikeMatrix, joko // Jonas * * Calculates the muzzle velocity shift caused by different barrel lengths * @@ -17,36 +17,56 @@ */ #include "script_component.hpp" -private ["_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; +scopeName "main"; + +private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex", + "_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity", + "_upperMuzzleVelocity", "_interpolationRatio"]; params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"]; +// If barrel length is not defined, then there is no point in calculating muzzle velocity if (_barrelLength == 0) exitWith { 0 }; -if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 }; -if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 }; -if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; -_lowerIndex = 0; -_upperIndex = (count _barrelLengthTable) - 1; +_muzzleVelocityTableCount = count _muzzleVelocityTable; +_barrelLengthTableCount = count _barrelLengthTable; -if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity }; -if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity }; +// Exit if tables are different sizes, have no elements or have only one element +if (_muzzleVelocityTableCount != _barrelLengthTableCount) exitWith { 0 }; +if (_muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 }; +if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; -for "_i" from 0 to (count _barrelLengthTable) - 1 do { - if (_barrelLength >= _barrelLengthTable select _i) then { - _lowerIndex = _i; - }; -}; -for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do { - if (_barrelLength <= _barrelLengthTable select _i) then { - _upperIndex = _i; +// If we have the precise barrel length value, return result immediately +if (_barrelLength in _barrelLengthTable) exitWith { + _muzzleVelocityTable select (_barrelLengthTable find _barrelLength) - _muzzleVelocity +}; + +// Limit values to lower and upper bound of data we have available +if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; +if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity }; + +// Find closest bordering values for barrel length +{ + if (_barrelLength >= _x) then { + _lowerDataIndex = _forEachIndex; + _upperDataIndex = _lowerDataIndex + 1; + breakTo "main"; }; +} forEach _barrelLengthTable; + +// Worst case scenario +if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0}; + +_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex; +_upperBarrelLength = _barrelLengthTable select _upperDataIndex; +_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex; +_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex; + +// Calculate interpolation ratio +_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then { + (_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength) +} else { + 0 }; -_barrelLengthRatio = 0; -if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then { - _barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex)); -}; - -_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio); - -_muzzleVelocityNew - _muzzleVelocity +// Calculate interpolated muzzle velocity +(_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return From 12aa0b5584a0c9cd97e58e125c02543a3c599bf2 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 04:27:11 +0200 Subject: [PATCH 024/239] revert Merge Issue --- addons/advanced_ballistics/ACE_Settings.hpp | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/advanced_ballistics/ACE_Settings.hpp b/addons/advanced_ballistics/ACE_Settings.hpp index 757385deb3..d88a9b1148 100644 --- a/addons/advanced_ballistics/ACE_Settings.hpp +++ b/addons/advanced_ballistics/ACE_Settings.hpp @@ -1,31 +1,31 @@ class ACE_Settings { class GVAR(enabled) { - displayName = "Advanced Ballistics"; - description = "Enables advanced ballistics"; + displayName = CSTRING(enabled_DisplayName); + description = CSTRING(enabled_Description); typeName = "BOOL"; value = 0; }; class GVAR(simulateForSnipers) { - displayName = "Enabled For Snipers"; - description = "Enables advanced ballistics for non local snipers (when using high power optics)"; + displayName = CSTRING(simulateForSnipers_DisplayName); + description = CSTRING(simulateForSnipers_Description); typeName = "BOOL"; value = 1; }; class GVAR(simulateForGroupMembers) { - displayName = "Enabled For Group Members"; - description = "Enables advanced ballistics for non local group members"; + displayName = CSTRING(simulateForGroupMembers_DisplayName); + description = CSTRING(simulateForGroupMembers_Description); typeName = "BOOL"; value = 0; }; class GVAR(simulateForEveryone) { - displayName = "Enabled For Everyone"; - description = "Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)"; + displayName = CSTRING(simulateForEveryone_DisplayName); + description = CSTRING(simulateForEveryone_Description); typeName = "BOOL"; value = 0; }; class GVAR(disabledInFullAutoMode) { - displayName = "Disabled In FullAuto Mode"; - description = "Disables advanced ballistics during full auto fire"; + displayName = CSTRING(disabledInFullAutoMod_DisplayName); + description = CSTRING(disabledInFullAutoMod_Description); typeName = "BOOL"; value = 0; }; @@ -38,32 +38,32 @@ class ACE_Settings { }; */ class GVAR(ammoTemperatureEnabled) { - displayName = "Enable Ammo Temperature Simulation"; - description = "Muzzle velocity varies with ammo temperature"; + displayName = CSTRING(ammoTemperatureEnabled_DisplayName); + description = CSTRING(ammoTemperatureEnabled_Description); typeName = "BOOL"; value = 1; }; class GVAR(barrelLengthInfluenceEnabled) { - displayName = "Enable Barrel Length Simulation"; - description = "Muzzle velocity varies with barrel length"; + displayName = CSTRING(barrelLengthInfluenceEnabled_DisplayName); + description = CSTRING(barrelLengthInfluenceEnabled_Description); typeName = "BOOL"; value = 1; }; class GVAR(bulletTraceEnabled) { - displayName = "Enable Bullet Trace Effect"; - description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)"; + displayName = CSTRING(bulletTraceEnabled_DisplayName); + description = CSTRING(bulletTraceEnabled_Description); typeName = "BOOL"; value = 1; }; class GVAR(simulationInterval) { - displayName = "Simulation Interval"; - description = "Defines the interval between every calculation step"; + displayName = CSTRING(simulationInterval_DisplayName); + description = CSTRING(simulationInterval_Description); typeName = "SCALAR"; value = 0.0; }; class GVAR(simulationRadius) { - displayName = "Simulation Radius"; - description = "Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles"; + displayName = CSTRING(simulationRadius_DisplayName); + description = CSTRING(simulationRadius_Description); typeName = "SCALAR"; value = 3000; }; From c7e104437f7b34bcf1148b5665f3572a69ad3748 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 04:38:04 +0200 Subject: [PATCH 025/239] Update Docu Comments in AB --- .../functions/fnc_calculateAmmoTemperatureVelocityShift.sqf | 2 ++ .../functions/fnc_calculateBarrelLengthVelocityShift.sqf | 2 ++ .../advanced_ballistics/functions/fnc_calculateRetardation.sqf | 2 ++ addons/advanced_ballistics/functions/fnc_displayProtractor.sqf | 2 ++ .../functions/fnc_readAmmoDataFromConfig.sqf | 2 ++ .../functions/fnc_readWeaponDataFromConfig.sqf | 2 ++ 6 files changed, 12 insertions(+) diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 8013bbd80a..6f45edb774 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -12,6 +12,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index 513752c538..27e6480337 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -14,6 +14,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 507410276e..0111f6d8e1 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -13,6 +13,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 3acefff54e..3877caa724 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -8,6 +8,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 10e7e60df2..1edc0ebef6 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -11,6 +11,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index 8a1a29f7b0..1dbd0509e8 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -11,6 +11,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" From 6b58b0b3bd2d24758a84881c3fdb9ba7d8c785c4 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 05:01:30 +0200 Subject: [PATCH 026/239] AB Performance Optimization and documentation cleanup --- ..._calculateAmmoTemperatureVelocityShift.sqf | 5 +- ...fnc_calculateBarrelLengthVelocityShift.sqf | 5 +- .../functions/fnc_calculateRetardation.sqf | 185 +++++++++--------- .../fnc_calculateStabilityFactor.sqf | 2 +- .../functions/fnc_handleFired.sqf | 2 +- .../functions/fnc_initModuleSettings.sqf | 2 +- .../fnc_initializeTerrainExtension.sqf | 4 +- .../functions/fnc_readAmmoDataFromConfig.sqf | 18 +- .../fnc_readWeaponDataFromConfig.sqf | 9 +- 9 files changed, 114 insertions(+), 118 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 6f45edb774..fcffc85864 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -8,10 +8,7 @@ * 1: temperature - degrees celcius * * Return Value: - * 0: muzzle velocity shift - m/s - * - * Return value: - * None + * muzzle velocity shift - m/s * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index 27e6480337..9b904ebadd 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -10,10 +10,7 @@ * 3: muzzle velocity - m/s * * Return Value: - * 0: muzzle velocity shift - m/s - * - * Return value: - * None + * muzzle velocity shift - m/s * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 0111f6d8e1..440b2653f2 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -4,15 +4,12 @@ * Calculates the retardation of the bullet * * Arguments: - * 0: drag model - 1-7 + * 0: drag model - integer 1-7 * 1: drag coefficient - bc * 2: velocity - m/s * * Return Value: - * 0: retardation - m/(s^2) - * - * Return value: - * None + * retardation - m/(s^2) * * Public: No */ @@ -20,121 +17,119 @@ // Source: GNU Exterior Ballistics -private ["_A", "_M", "_result"]; +private ["_A", "_M"]; params ["_dragModel", "_dragCoefficient", "_velocity"]; _velocity = _velocity * 3.2808399; _A = -1; _M = -1; -_result = 0; switch _dragModel do { case 1: { - switch true do { - case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; - case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; - case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; - case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; - case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; - case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; - case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; - case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; - case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; - case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; - case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; - case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; - case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; - case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; - case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; - case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; - case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; - case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; - case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; - case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; - case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; - case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; - case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; - case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; - case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; - case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; - case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; - case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; - case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; - case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; - case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; - case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; - case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; - case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; - case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; - case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; - case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; - case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; - case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; - case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; - case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; }; + call { + if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; }; + if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; }; + if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; }; + if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; }; + if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; }; + if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; }; + if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; }; + if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; }; + if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; }; + if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; }; + if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; }; + if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; }; + if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; }; + if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; }; + if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; }; + if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; }; + if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; }; + if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; }; + if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; }; + if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; }; + if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; }; + if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; }; + if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; }; + if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; }; + if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; }; + if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; }; + if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; }; + if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; }; + if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; }; + if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; }; + if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; }; + if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; }; + if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; }; + if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; }; + if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; }; + if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; }; + if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; }; + if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; }; + if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; }; + if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; }; + if (_velocity > 0) exitWith { _A = 0.00005206214107320588; _M = 2.000; }; }; }; case 2: { - switch true do { - case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; - case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; - case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; - case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; - case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; - case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; - case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; }; + call { + if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; }; + if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; }; + if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; + if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; + if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; }; + if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; }; + if (_velocity > 0) exitWith { _A = 0.0000518033561289704; _M = 1.98160270524632; }; }; }; case 5: { - switch true do { - case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; - case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; - case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; - case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; - case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; - case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; - case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; }; + call { + if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; }; + if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; }; + if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; + if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; }; + if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; }; + if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; }; + if (_velocity > 0) exitWith { _A = 0.0000351963178524273; _M = 2.00477856801111; }; }; }; case 6: { - switch true do { - case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; - case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; - case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; - case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; - case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; - case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; - case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; }; + call { + if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; }; + if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; }; + if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; }; + if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; }; + if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; + if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; }; + if (_velocity > 0) exitWith { _A = 0.0000750912466084823; _M = 1.92031057847052; }; }; }; case 7: { - switch true do { - case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; - case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; - case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; - case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; - case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; - case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; - case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; - case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; - case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; }; + call { + if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; + if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; }; + if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; }; + if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; }; + if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; }; + if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; + if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; }; + if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; }; + if (_velocity > 0) exitWith { _A = 0.0000134504843776525; _M = 2.08702306738884; }; }; }; case 8: { - switch true do { - case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; - case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; - case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; - case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; - case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; - case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; }; + call { + if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; }; + if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; }; + if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; }; + if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; + if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; + if (_velocity > 0) exitWith { _A = 0.000043917343795117; _M = 1.99978116283334; }; }; }; }; if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { - _result = _A * (_velocity ^ _M) / _dragCoefficient; - _result = _result / 3.2808399; -}; - -_result + (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399 +} else { + 0 +} diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf index d09e292138..b3cc481e7b 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf @@ -13,7 +13,7 @@ * 6: barometric Pressure - hPA * * Return Value: - * 0: stability factor + * stability factor * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 8285eb49cb..ec7cbf28e9 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -13,7 +13,7 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf index 55a443d778..6e5371e461 100644 --- a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf +++ b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf @@ -8,7 +8,7 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 7587285963..0b982ff76f 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -3,10 +3,10 @@ * Initializes the advanced ballistics dll extension with terrain data * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 1edc0ebef6..6da578ff63 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -4,13 +4,21 @@ * Reads the ammo class config and updates the config cache * * Arguments: - * 0: ammo - classname + * 0: ammo - classname * * Return Value: - * 0: [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable] - * - * Return value: - * None + * 0: _airFriction + * 1: _caliber + * 2: _bulletLength + * 3: _bulletMass + * 4: _transonicStabilityCoef + * 5: _dragModel + * 6: _ballisticCoefficients + * 7: _velocityBoundaries + * 8: _atmosphereModel + * 9: _ammoTempMuzzleVelocityShifts + * 10: _muzzleVelocityTable + * 11: _barrelLengthTable * * Public: No */ diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index 1dbd0509e8..df3c9443e7 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -4,13 +4,12 @@ * Reads the weapon class config and updates the config cache * * Arguments: - * 0: weapon - classname + * 0: weapon - classname * * Return Value: - * 0: [_barrelTwist, _twistDirection, _barrelLength] - * - * Return value: - * None + * 0: _barrelTwist + * 1: _twistDirection + * 2: _barrelLength * * Public: No */ From f6bc36173448bcf1241678e06629517c1e5fcb57 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 05:04:34 +0200 Subject: [PATCH 027/239] Minimal performance improvement and fixed missing semicolon --- .../functions/fnc_calculateRetardation.sqf | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 440b2653f2..0bd801c6b9 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -21,9 +21,6 @@ private ["_A", "_M"]; params ["_dragModel", "_dragCoefficient", "_velocity"]; _velocity = _velocity * 3.2808399; -_A = -1; -_M = -1; - switch _dragModel do { case 1: { call { @@ -128,8 +125,8 @@ switch _dragModel do { }; }; -if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { +if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then { (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399 } else { 0 -} +}; From b8f1fa82aec8764cf98bbfd55cddf87ac12f4608 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 05:19:08 +0200 Subject: [PATCH 028/239] AB Performance Optimization (Part 2) --- .../functions/fnc_calculateStabilityFactor.sqf | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf index b3cc481e7b..671ab2ccb0 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf @@ -19,21 +19,17 @@ */ #include "script_component.hpp" -private ["_l", "_t", "_stabilityFactor"]; +private ["_twist", "_length", "_stabilityFactor"]; params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"]; // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf -_t = _barrelTwist / _caliber; -_l = _bulletLength / _caliber; +_twist = _barrelTwist / _caliber; +_length = _bulletLength / _caliber; -_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); +_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2)); if (_muzzleVelocity > 341.376) then { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3); + (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure } else { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3); + (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure }; - -_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure; - -_stabilityFactor From eca7f83cca6006bbc9b16607dcf4af88199c02cc Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 06:01:38 +0200 Subject: [PATCH 029/239] AB Performance Optimization (Part 3) --- .../functions/fnc_displayProtractor.sqf | 7 +-- .../functions/fnc_initModuleSettings.sqf | 1 - .../functions/fnc_readAmmoDataFromConfig.sqf | 60 +++++++------------ 3 files changed, 22 insertions(+), 46 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 3877caa724..9debec1dc8 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -17,8 +17,6 @@ #define __ctrl1 (__dsp displayCtrl 132950) #define __ctrl2 (__dsp displayCtrl 132951) -private ["_inclinationAngle", "_refPosition"]; - if (GVAR(Protractor)) exitWith { GVAR(Protractor) = false; 1 cutText ["", "PLAIN"]; @@ -41,9 +39,6 @@ GVAR(Protractor) = true; [_idPFH] call cba_fnc_removePerFrameHandler; }; - _inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2); - _inclinationAngle = -58 max _inclinationAngle min 58; - 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; __ctrl1 ctrlSetScale 1; @@ -52,7 +47,7 @@ GVAR(Protractor) = true; __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; __ctrl2 ctrlSetScale 1; - __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * _inclinationAngle, 0.2, 0.2 * 4/3]; + __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3]; __ctrl2 ctrlCommit 0; __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; diff --git a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf index 6e5371e461..4898c51c10 100644 --- a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf +++ b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf @@ -12,7 +12,6 @@ * * Public: No */ - #include "script_component.hpp" params ["_logic","_units", "_activated"]; diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 6da578ff63..9839c1dcc3 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -4,7 +4,7 @@ * Reads the ammo class config and updates the config cache * * Arguments: - * 0: ammo - classname + * ammo - classname * * Return Value: * 0: _airFriction @@ -25,50 +25,32 @@ #include "script_component.hpp" private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"]; -_ammo = _this; +_ammoConfig = configFile >> "CfgAmmo" >> _this; -_airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction"); -_caliber = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); -_bulletLength = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletLength"); -_bulletMass = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletMass"); -_transonicStabilityCoef = 0.5; -if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then { - _transonicStabilityCoef = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); +_airFriction = getNumber(_ammoConfig >> "airFriction"); +_caliber = getNumber(_ammoConfig >> "ACE_caliber"); +_bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength"); +_bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass"); +_transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef"); +if (_transonicStabilityCoef == 0) then { + _transonicStabilityCoef = 0.5; }; -_dragModel = 1; -_ballisticCoefficients = []; -_velocityBoundaries = []; -_atmosphereModel = "ICAO"; -if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel")) then { - _dragModel = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel"); - if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { - _dragModel = 1; - }; +_dragModel = getNumber(_ammoConfig >> "ACE_dragModel"); +if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then { + _dragModel = 1; }; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { - _ballisticCoefficients = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); -}; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { - _velocityBoundaries = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); -}; -if (isText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { - _atmosphereModel = getText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); -}; -_ammoTempMuzzleVelocityShifts = []; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then { - _ammoTempMuzzleVelocityShifts = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts"); -}; -_muzzleVelocityTable = []; -_barrelLengthTable = []; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then { - _muzzleVelocityTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities"); -}; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths")) then { - _barrelLengthTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths"); +_ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients"); +_velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries"); +_atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere"); +if (_atmosphereModel isEqualTo "") then { + _atmosphereModel = "ICAO"; }; +_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts"); +_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities"); +_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths"); _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; -uiNamespace setVariable [format[QGVAR(%1), _ammo], _result]; +uiNamespace setVariable [format[QGVAR(%1), _this], _result]; _result From 8fbcdfec5aed514c03c38623109c02233a732be4 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 10:04:24 +0200 Subject: [PATCH 030/239] Fixed missing bracket and parameter list issue in AB --- .../functions/fnc_calculateAmmoTemperatureVelocityShift.sqf | 2 +- addons/advanced_ballistics/functions/fnc_handleFired.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index fcffc85864..8b0c78e86c 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -26,7 +26,7 @@ if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 }; _temperatureIndexFunction = (_temperature + 15) / 5; // lower and upper data index used for interpolation -_temperatureIndexA = (0 max (floor(_temperatureIndexFunction)) min 10; +_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10; _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10; // Interpolation ratio diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index ec7cbf28e9..7ce6a6ac7a 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -20,7 +20,7 @@ #include "script_component.hpp" private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; -params ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet"]; +params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; _abort = false; if (!hasInterface) exitWith {}; From 9eb560ff3d81587301a53c28b93350b568eb3160 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Wed, 5 Aug 2015 10:28:02 +0200 Subject: [PATCH 031/239] AB Performance Optimization (Part 4) --- .../functions/fnc_handleFired.sqf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 7ce6a6ac7a..0287d205b9 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -60,11 +60,14 @@ if (isNil {_WeaponCacheEntry}) then { _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); }; +_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"]; +_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; + _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = [_WeaponCacheEntry select 2, _AmmoCacheEntry select 10, _AmmoCacheEntry select 11, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); if (_muzzleVelocityShift != 0) then { _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; @@ -74,7 +77,7 @@ if (GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(ammoTemperatureEnabled)) then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); - _muzzleVelocityShift = [_AmmoCacheEntry select 9, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); + _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); if (_muzzleVelocityShift != 0) then { _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; @@ -95,12 +98,7 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { }; }; -_caliber = _AmmoCacheEntry select 1; -_bulletLength = _AmmoCacheEntry select 2; -_bulletMass = _AmmoCacheEntry select 3; -_barrelTwist = _WeaponCacheEntry select 0; _stabilityFactor = 1.5; - if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); @@ -109,7 +107,8 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; -"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _AmmoCacheEntry select 0, _AmmoCacheEntry select 6, _AmmoCacheEntry select 7, _AmmoCacheEntry select 8, _AmmoCacheEntry select 5, _stabilityFactor, _WeaponCacheEntry select 1, _muzzleVelocity, _AmmoCacheEntry select 4, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, floor(ACE_time), ACE_time - floor(ACE_time)]; +_aceTimeSecond = floor ACE_time; +"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; [{ private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; @@ -129,6 +128,7 @@ GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(ACE_time), ACE_time - floor(ACE_time)]); + _aceTimeSecond = floor ACE_time; + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); }, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; From 79e607836b20f828f00f5c0525c42a779e64d123 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 12:51:13 +0100 Subject: [PATCH 032/239] Add contributor email for Head --- AUTHORS.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 70bd7af086..814ab311a3 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -68,8 +68,8 @@ Hamburger SV Harakhti havena Hawkins -Head -jokoho482 ` +Head +jokoho482 Jonpas Karneck Kavinsky From 07e09b60faa7b4b09663d53cb7baa414259bdbb8 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 13:19:47 +0100 Subject: [PATCH 033/239] Stop spectator camera unit changing on corpses Previously the camera would be automatically moved away from corpses (when the unit currently being watched dies). This changes it to stay on them until the view is manually switched as users might want to stick around and watch whatever was going on at the time of death. --- addons/spectator/functions/fnc_handleInterface.sqf | 1 + addons/spectator/functions/fnc_handleUnits.sqf | 6 ++++-- addons/spectator/functions/fnc_transitionCamera.sqf | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 777e8d2ea9..b85e73dabb 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -78,6 +78,7 @@ switch (toLower _mode) do { camDestroy GVAR(camera); // Return to player view + clearRadio; _unit switchCamera "internal"; // Re-enable BI damage effects diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf index b64a1a2717..e8cd561da0 100644 --- a/addons/spectator/functions/fnc_handleUnits.sqf +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -26,9 +26,11 @@ if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHand // Remove all dead and null units from the list [] call FUNC(updateUnits); -// Camera shouldn't stay on unit that isn't in the list +// Camera shouldn't stay on unit that isn't in the list (unless dead) if !(GVAR(camUnit) in GVAR(unitList)) then { - [nil,1] call FUNC(cycleCamera); + if (alive GVAR(camUnit) || isNull GVAR(camUnit)) then { + [nil,1] call FUNC(cycleCamera); + }; }; // Reduce overhead when unit tree is hidden diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index a4d99445fb..4957540fa4 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -33,7 +33,7 @@ if !(_newMode in GVAR(availableModes)) then { }; // When no units available to spectate, exit to freecam -if (GVAR(unitList) isEqualTo []) then { +if ((GVAR(unitList) isEqualTo []) && (alive _newUnit || isNull _newUnit)) then { _newMode = 0; _newUnit = objNull; }; From 5200fd6a0298a593fc21d4233de494ff2867a927 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 14:15:27 +0100 Subject: [PATCH 034/239] Add new option to spectator unit filter setting Adds an option to use playableUnits for scenarios where AI playable units are enabled. --- addons/spectator/ACE_Settings.hpp | 4 ++-- addons/spectator/CfgVehicles.hpp | 6 +++++- addons/spectator/functions/fnc_updateUnits.sqf | 2 +- addons/spectator/stringtable.xml | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 539f7cef2d..2889fd2e0f 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -1,8 +1,8 @@ class ACE_Settings { class GVAR(filterUnits) { typeName = "SCALAR"; - value = 1; - values[] = {CSTRING(units_none), CSTRING(units_players), CSTRING(units_all)}; + value = 2; + values[] = {CSTRING(units_none), CSTRING(units_players), CSTRING(units_playable), CSTRING(units_all)}; }; class GVAR(filterSides) { typeName = "SCALAR"; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index 8e685dae07..b63f349b0a 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -21,11 +21,15 @@ class CfgVehicles { 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 = 2; + value = 3; }; }; }; diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index ef8fc3b4f1..75f1402179 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -36,7 +36,7 @@ if !(_newUnits isEqualTo []) exitWith { private ["_sides","_cond","_filteredUnits","_color","_icon"]; // Unit setting filter -_newUnits = [[],allPlayers,allUnits] select GVAR(filterUnits); +_newUnits = [[],allPlayers,playableUnits,allUnits] select GVAR(filterUnits); // Side setting filter _sides = []; diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 4eb0e25c0a..5219ba7e2d 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -25,6 +25,9 @@ Only players Tylko gracze + + Playable Units + All units Wszystkie jednostki From c4e4f184ff4e15ba72bb0f4b2b759c5014002a21 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 18:33:28 +0200 Subject: [PATCH 035/239] AB Performance Optimization (Part 5) --- addons/advanced_ballistics/XEH_postInit.sqf | 1 - .../fnc_initializeTerrainExtension.sqf | 8 ++++---- .../fnc_readWeaponDataFromConfig.sqf | 19 +++++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index b199acb9e5..6416e7908a 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -8,7 +8,6 @@ GVAR(Protractor) = false; GVAR(ProtractorStart) = ACE_time; GVAR(currentGrid) = 0; -GVAR(initMessageEnabled) = false; GVAR(extensionAvailable) = true; /* @TODO: Remove this until versioning is in sync with cmake/build versioning diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 0b982ff76f..53ac6aa874 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -22,9 +22,9 @@ _initStartTime = ACE_time; _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { - if (GVAR(initMessageEnabled)) then { + #ifdef DEBUG_MODE_FULL systemChat "AdvancedBallistics: Terrain already initialized"; - }; + #endIf }; _mapGrids = ceil(_mapSize / 50) + 1; @@ -37,9 +37,9 @@ GVAR(currentGrid) = 0; _args params ["_mapGrids", "_gridCells", "_initStartTime"]; if (GVAR(currentGrid) >= _gridCells) exitWith { - if (GVAR(initMessageEnabled)) then { + #ifdef DEBUG_MODE_FULL systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; - }; + #endif [_idPFH] call cba_fnc_removePerFrameHandler; }; diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index df3c9443e7..8e13dc04dc 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -4,7 +4,7 @@ * Reads the weapon class config and updates the config cache * * Arguments: - * 0: weapon - classname + * weapon - classname * * Return Value: * 0: _barrelTwist @@ -15,18 +15,17 @@ */ #include "script_component.hpp" -private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; -_weapon = _this; +private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; +_weaponConfig = (configFile >> "CfgWeapons" >> _this); -_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist"); +_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist"); _twistDirection = 1; -if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then { - _twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection"); - if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { - _twistDirection = 1; - }; +_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection"); +if !(_twistDirection in [-1, 0, 1]) then { + _twistDirection = 1; }; -_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength"); + +_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength"); _result = [_barrelTwist, _twistDirection, _barrelLength]; From 0ab865171dd04a23ab9c3d27ee0fc8ff7d7447ad Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 5 Aug 2015 18:50:37 +0200 Subject: [PATCH 036/239] AB Performance Optimization (Part 6) Add some todo comments --- .../functions/fnc_handleFired.sqf | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 0287d205b9..d15f9a95e8 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -67,8 +67,13 @@ _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); - if (_muzzleVelocityShift != 0) then { + _muzzleVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; + if (isNil "_muzzleVelocityShift") then { + _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift]; + }; + + if (_muzzleVelocityShift != 0) then { // @ combine with same functions _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; @@ -76,9 +81,9 @@ if (GVAR(barrelLengthInfluenceEnabled)) then { }; if (GVAR(ammoTemperatureEnabled)) then { - _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); - _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); - if (_muzzleVelocityShift != 0) then { + _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); // @todo make it not Shoot dependent + _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); //@todo make it not Shoot dependent + if (_muzzleVelocityShift != 0) then { // @ combine with same functions _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; @@ -100,7 +105,7 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { _stabilityFactor = 1.5; if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { - _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); + _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); // @todo double call not neede and make it not shoot dependet _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; From a6292db1e886071af53343e1579aa609b0a896d1 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 5 Aug 2015 11:54:45 -0500 Subject: [PATCH 037/239] #2018 - Dead Mans Switch / unconscious --- addons/explosives/CfgEventHandlers.hpp | 2 +- addons/explosives/XEH_postInit.sqf | 10 ++++++++++ addons/explosives/XEH_preInit.sqf | 2 +- .../{fnc_onKilled.sqf => fnc_onIncapacitated.sqf} | 0 4 files changed, 12 insertions(+), 2 deletions(-) rename addons/explosives/functions/{fnc_onKilled.sqf => fnc_onIncapacitated.sqf} (100%) diff --git a/addons/explosives/CfgEventHandlers.hpp b/addons/explosives/CfgEventHandlers.hpp index 89e3017e8a..e7bf74e414 100644 --- a/addons/explosives/CfgEventHandlers.hpp +++ b/addons/explosives/CfgEventHandlers.hpp @@ -11,7 +11,7 @@ class Extended_PostInit_EventHandlers { class Extended_Killed_EventHandlers { class CAManBase { - GVAR(killedHandler) = QUOTE(_this call FUNC(onKilled)); + GVAR(killedHandler) = QUOTE(_this call FUNC(onIncapacitated)); }; }; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 373a53d3ba..2043a2a632 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -15,6 +15,16 @@ */ #include "script_component.hpp" +if (isServer) then { + //Event is global, only run on server (ref: ace_medical_fnc_setUnconscious) + ["medical_onUnconscious", { + params ["_unit", "_isUnconscious"]; + if (!_isUnconscious) exitWith {}; + TRACE_1("Knocked Out, Doing Deadman", _unit); + [_unit] call FUNC(onIncapacitated); + }] call EFUNC(common,addEventHandler); +}; + if !(hasInterface) exitWith {}; GVAR(PlacedCount) = 0; diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index fc1b02e1bc..470cae661d 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -44,8 +44,8 @@ PREP(getSpeedDialExplosive); PREP(module); +PREP(onIncapacitated); PREP(onInventoryChanged); -PREP(onKilled); PREP(openTimerSetUI); diff --git a/addons/explosives/functions/fnc_onKilled.sqf b/addons/explosives/functions/fnc_onIncapacitated.sqf similarity index 100% rename from addons/explosives/functions/fnc_onKilled.sqf rename to addons/explosives/functions/fnc_onIncapacitated.sqf From 7203bb2a3d68c9bf80984a9a88ba57fc44ae9cb6 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 5 Aug 2015 12:22:43 -0500 Subject: [PATCH 038/239] Cleanup Debug, Limit Satchel Mass --- addons/explosives/functions/fnc_placeExplosive.sqf | 6 +++--- addons/explosives/functions/fnc_setupExplosive.sqf | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index a0191bbc30..1740b6213a 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -62,8 +62,8 @@ if (!isNull _attachedTo) then { if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive}; - - systemChat format ["Placing %1 [%2]", _dir, _this]; - + + [[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); + _explosive diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 4cd693fc6d..754812f9d3 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -161,6 +161,11 @@ GVAR(TweakedAngle) = 0; if (GVAR(placeAction) == PLACE_APPROVE) then { _placeAngle = 0; _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); + + TRACE_1("Planting Mass", (getMass _expSetupVehicle)); + //If the object is too heavy, it can kill a player if it colides + if ((getMass _expSetupVehicle) > 5) then {_expSetupVehicle setMass 5;}; + if (isNull _attachVehicle) then { _placeAngle = _cameraAngle - GVAR(TweakedAngle) + 180; _expSetupVehicle setPosAsl _virtualPosASL; From 42b5abae116c27cad907aee5cc5dd85ad978c59c Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 19:25:38 +0100 Subject: [PATCH 039/239] Add support for respawn counter to spectator UI Rather than hiding the BI respawn counter, it should be "integrated" into the UI via code if present. --- addons/spectator/UI/interface.hpp | 11 +++++- .../functions/fnc_handleInterface.sqf | 35 +++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index e8df31c280..bd6d34339f 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -1,6 +1,15 @@ +// 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 RscFrame; class RscListNBox; class RscMapControl; class RscPicture; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index b85e73dabb..b6608959b7 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -43,9 +43,8 @@ switch (toLower _mode) do { // Close map openMap [false,false]; - // Disable BI damage effects and remove counter layer + // Disable BI damage effects BIS_fnc_feedback_allowPP = false; - ("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"]; // Close all existing dialogs while {dialog} do { @@ -81,7 +80,7 @@ switch (toLower _mode) do { clearRadio; _unit switchCamera "internal"; - // Re-enable BI damage effects + // Enable BI damage effects BIS_fnc_feedback_allowPP = true; // Cleanup camera variables @@ -154,9 +153,33 @@ switch (toLower _mode) do { [localize LSTRING(prevUnit),"Left Arrow"] ]; - // Hacky way to enable keybindings - //_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; - //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; + // 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]; + _timer ctrlSetFontHeight TOOL_H; + + _title ctrlCommit 0; + _back ctrlCommit 0; + _timer ctrlCommit 0; + _frame ctrlCommit 0; + }; + },[],0.5] call EFUNC(common,waitAndExecute); }; case "onunload": { // Kill GUI PFHs From c808021c7c9ae480d2d27a4735516ed02f688049 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 21:11:25 +0100 Subject: [PATCH 040/239] Tweak spectator interface layout - Swap the FOV and vision mode tools into a more logical order. - Shorten the unit list to prevent overlay with main UI - Fix name tool on dead units --- addons/spectator/UI/interface.hpp | 14 +++++++------- addons/spectator/functions/fnc_handleToolbar.sqf | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index bd6d34339f..2ac33e4a64 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -121,11 +121,11 @@ class GVAR(interface) { idc = -1; style = 64; }; - class fovTool: viewTool { - idc = IDC_TOOL_FOV; + class visionTool: viewTool { + idc = IDC_TOOL_VISION; x = TOOL_W * 3 + MARGIN * 2; }; - class fovFrame: fovTool { + class visionFrame: visionTool { idc = -1; style = 64; }; @@ -137,11 +137,11 @@ class GVAR(interface) { idc = -1; style = 64; }; - class visionTool: viewTool { - idc = IDC_TOOL_VISION; + class fovTool: viewTool { + idc = IDC_TOOL_FOV; x = safeZoneW - TOOL_W * 2 - MARGIN; }; - class visionFrame: visionTool { + class fovFrame: fovTool { idc = -1; style = 64; }; @@ -160,7 +160,7 @@ class GVAR(interface) { x = safeZoneX; y = safeZoneY + TOOL_H * 2; w = TOOL_W * 2; - h = safeZoneH - TOOL_H * 4; + h = safeZoneH - TOOL_H * 6; sizeEx = H_PART(0.8); borderSize = 1; colorBorder[] = {COL_FORE}; diff --git a/addons/spectator/functions/fnc_handleToolbar.sqf b/addons/spectator/functions/fnc_handleToolbar.sqf index fd29ca532e..878f3e46de 100644 --- a/addons/spectator/functions/fnc_handleToolbar.sqf +++ b/addons/spectator/functions/fnc_handleToolbar.sqf @@ -1,6 +1,6 @@ /* * Author: Karel Moricky, SilentSpike - * Handles the spectator UI toolbar values and applies them to the camera + * Handles the spectator UI toolbar values * * Arguments: * 0: Parameters @@ -31,15 +31,15 @@ if (GVAR(camMode) == 0) then { _fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01]; _speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01]; } else { - _vision = format ["%1 m", floor(getPosASL GVAR(camUnit) select 2)]; - _fov = [side group GVAR(camUnit)] call BIS_fnc_sideName; + _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 (isNull GVAR(camUnit)) then { - _name = localize "STR_Special_None"; -} else { +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); From d1975a593dc6d88755b5792b1bd627181bc6d9f0 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 6 Aug 2015 00:39:14 +0100 Subject: [PATCH 041/239] Improve spectator pause menu emulation Makes the fake pause menu closer to the real thing for UX purposes --- .../functions/fnc_handleInterface.sqf | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index b6608959b7..fdd84ee5ef 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -457,10 +457,10 @@ switch (toLower _mode) do { }; } forEach GVAR(unitList); }; - // Other + // Break from interface for escape menu case "escape": { _args params ["_display"]; - private ["_dlg","_key","_index","_ctrl","_config"]; + private "_dlg"; // Kill display _display closeDisplay 0; @@ -474,7 +474,6 @@ switch (toLower _mode) do { GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; - // Below is from EFUNC(common,disableUserInput) createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); disableSerialization; @@ -484,30 +483,35 @@ switch (toLower _mode) do { !(_key == 1) }]; - for "_index" from 100 to 2000 do { - (_dlg displayCtrl _index) ctrlEnable false; + // 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; - _ctrl = _dlg displayctrl 103; - _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {dialog} do {closeDialog 0}; failMission 'LOSER';)]; - _ctrl ctrlEnable true; - _ctrl ctrlSetText "ABORT"; - _ctrl ctrlSetTooltip "Abort."; - - _ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer); - _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1;)]; - _ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); - _ctrl ctrlSetText "RESPAWN"; - _ctrl ctrlSetTooltip "Respawn."; + // 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 {}; - createDialog QGVAR(interface); - [] call FUNC(transitionCamera); + // If still a spectator then re-enter the interface + if (GVAR(isSet)) then { + createDialog QGVAR(interface); + [] call FUNC(transitionCamera); + }; [_this select 1] call CBA_fnc_removePerFrameHandler; },0] call CBA_fnc_addPerFrameHandler; + + true }; }; From d6cc14a39d20afbd4734ab4c90ddfdbde63cee12 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 6 Aug 2015 00:52:39 +0100 Subject: [PATCH 042/239] Add zeus support to spectator UI Can only use zeus while alive, so it won't work using the respawn template. However it's useful for communities usign custom frameworks --- .../functions/fnc_handleInterface.sqf | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index fdd84ee5ef..defe5332ba 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -225,6 +225,10 @@ switch (toLower _mode) do { case "onkeydown": { _args params ["_display","_dik","_shift","_ctrl","_alt"]; + if ((alive player) && {_dik in (actionKeys "curatorInterface")} && {!isNull (getAssignedCuratorLogic player)}) exitWith { + ["zeus", [_display]] call FUNC(handleInterface); + }; + // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; // Exclude movement keys so that speed can be adjusted on fly @@ -457,7 +461,7 @@ switch (toLower _mode) do { }; } forEach GVAR(unitList); }; - // Break from interface for escape menu + // Break from interface for eexternal events case "escape": { _args params ["_display"]; private "_dlg"; @@ -511,6 +515,38 @@ switch (toLower _mode) do { [_this select 1] call CBA_fnc_removePerFrameHandler; },0] call CBA_fnc_addPerFrameHandler; + }; + case "zeus": { + _args params ["_display"]; + + // Kill display + _display closeDisplay 0; + + // Reset cam/UI vars + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + + 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 + if (GVAR(isSet)) then { + createDialog QGVAR(interface); + [] call FUNC(transitionCamera); + }; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + },[],5] call EFUNC(common,waitAndExecute); true }; From 15a1a0d535e2484671237a43f58ad7e5d0d3cf1e Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 6 Aug 2015 10:58:07 +0200 Subject: [PATCH 043/239] AB Performance Optimization (Part 7) --- .../functions/fnc_handleFired.sqf | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index d15f9a95e8..a6e4611e2f 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -19,17 +19,22 @@ */ #include "script_component.hpp" +// Early Quiting +if (!hasInterface) exitWith {}; +if (!GVAR(enabled)) exitWith {}; + +// parameterization private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; _abort = false; -if (!hasInterface) exitWith {}; -if (!alive _bullet) exitWith {}; -if (!GVAR(enabled)) exitWith {}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; -if (underwater _unit) exitWith {}; + + if (!(_ammo isKindOf "BulletBase")) exitWith {}; +if (!alive _bullet) exitWith {}; +if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; +if (underwater _unit) exitWith {}; if (!GVAR(simulateForEveryone) && !(local _unit)) then { // The shooter is non local _abort = true; @@ -51,18 +56,20 @@ if (_abort || !(GVAR(extensionAvailable))) exitWith { [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH); }; +// Get Weapon and Ammo Configurations _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; -if (isNil {_AmmoCacheEntry}) then { +if (isNil "_AmmoCacheEntry") then { _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); }; _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; -if (isNil {_WeaponCacheEntry}) then { +if (isNil "_WeaponCacheEntry") then { _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); }; _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"]; _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; + _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; @@ -72,24 +79,25 @@ if (GVAR(barrelLengthInfluenceEnabled)) then { _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift]; }; - - if (_muzzleVelocityShift != 0) then { // @ combine with same functions - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); - _bullet setVelocity _bulletVelocity; + if (_muzzleVelocityShift != 0) then { _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; }; if (GVAR(ammoTemperatureEnabled)) then { - _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); // @todo make it not Shoot dependent - _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); //@todo make it not Shoot dependent - if (_muzzleVelocityShift != 0) then { // @ combine with same functions - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); - _bullet setVelocity _bulletVelocity; + _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); + _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); + if (_muzzleVelocityShift != 0) then { _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; }; +if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { + if (_muzzleVelocityShift != 0) then { + _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); + _bullet setVelocity _bulletVelocity; + }; +}; _bulletTraceVisible = false; if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { if (currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) then { @@ -105,7 +113,9 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { _stabilityFactor = 1.5; if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { - _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); // @todo double call not neede and make it not shoot dependet + if (isNil "_temperature") then { + _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); + }; _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; @@ -121,7 +131,6 @@ _aceTimeSecond = floor ACE_time; _args params["_bullet","_caliber","_bulletTraceVisible","_index"]; _bulletVelocity = velocity _bullet; - _bulletPosition = getPosASL _bullet; _bulletSpeed = vectorMagnitude _bulletVelocity; @@ -129,6 +138,8 @@ _aceTimeSecond = floor ACE_time; [_idPFH] call cba_fnc_removePerFrameHandler; }; + _bulletPosition = getPosASL _bullet; + if (_bulletTraceVisible && _bulletSpeed > 500) then { drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; From 92ef0bfe995632527c255099d45862a99a913a3f Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 6 Aug 2015 11:34:24 +0100 Subject: [PATCH 044/239] Whitelist spectator free camera boom keys Now that booming the free camera is influenced by the camera speed, the keys should be whitelisted from the held-key prevention system to allow the speed to be adjusted on the move. Also includes a failed attempt to fix the free camera map teleporting functionality. --- addons/spectator/UI/interface.hpp | 2 +- addons/spectator/functions/fnc_handleInterface.sqf | 12 +++++++----- addons/spectator/functions/fnc_transitionCamera.sqf | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 2ac33e4a64..182263e7b4 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -180,7 +180,7 @@ class GVAR(interface) { y = safeZoneY; w = safeZoneW; h = safeZoneH; - onMouseButtonDblClick = QUOTE([ARR_2('onMapDblClick',_this)] call FUNC(handleInterface)); + onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface)); onDraw = QUOTE([ARR_2('onDraw',_this)] call FUNC(handleInterface)); }; class helpSplash: RscControlsGroupNoScrollbars { diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index defe5332ba..502ce65fd4 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -40,8 +40,9 @@ switch (toLower _mode) do { GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); [] call FUNC(transitionCamera); - // Close map + // Close map and clear radio openMap [false,false]; + clearRadio; // Disable BI damage effects BIS_fnc_feedback_allowPP = false; @@ -76,8 +77,9 @@ switch (toLower _mode) do { GVAR(camera) cameraEffect ["terminate", "back"]; camDestroy GVAR(camera); - // Return to player view clearRadio; + + // Return to player view _unit switchCamera "internal"; // Enable BI damage effects @@ -232,7 +234,7 @@ switch (toLower _mode) do { // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; // Exclude movement keys so that speed can be adjusted on fly - if !(_dik in [17,30,31,32]) then { + if !(_dik in [16,17,30,31,32,44]) then { GVAR(heldKeys) pushBack _dik; }; @@ -422,8 +424,8 @@ switch (toLower _mode) do { _tree tvSort [[],false]; }; // Map events - case "onmapdblclick": { - _args params ["_map","_button","_x","_y"]; + case "onmapclick": { + _args params ["_map","_button","_x","_y","_shift","_ctrl","_alt"]; private ["_newPos","_oldZ"]; if ((GVAR(camMode) == 0) && (_button == 0)) then { diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 4957540fa4..90a2dc776b 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -53,7 +53,9 @@ if (_newMode == 0) then { // Free 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 + // Agent is switched to in free cam to hide death table and prevent AI chat while allowing icons to draw + // However, map click events don't fire in free cam for some reason... + // (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,""]; }; From 87b9b5019c753fd35ce5afa364a4558f55d9d5cc Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 6 Aug 2015 13:35:55 +0200 Subject: [PATCH 045/239] AB Performance Optimization (Part 8) --- .../functions/fnc_handleFired.sqf | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index a6e4611e2f..d93b6a4eac 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -23,7 +23,7 @@ if (!hasInterface) exitWith {}; if (!GVAR(enabled)) exitWith {}; -// parameterization +// Parameterization private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; @@ -74,30 +74,26 @@ _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; - if (isNil "_muzzleVelocityShift") then { - _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + _barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; + if (isNil "_barrelVelocityShift") then { + _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift]; }; - if (_muzzleVelocityShift != 0) then { - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; }; if (GVAR(ammoTemperatureEnabled)) then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); - _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); - if (_muzzleVelocityShift != 0) then { - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; + _temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift)); }; if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (_muzzleVelocityShift != 0) then { + _muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; }; }; + _bulletTraceVisible = false; if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { if (currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) then { From bcb21b782e1ed9d52ca5c7ac61b30d09e90ef795 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 6 Aug 2015 13:42:31 +0100 Subject: [PATCH 046/239] Overhaul spectator icon handling and rendering - Optimize and improve 3D icon drawing - Combine 2D and 3D PFHs into 1 - Render group icons outside of 200m, unit icons within - Store list of groups on units update to cut down on what needs to be done each frame - Change map control type to 100 to remove all default unit icons - Improve colour caching, group colours don't change, unit colours do - Remove icon setting, toggling should be at users discretion --- addons/spectator/ACE_Settings.hpp | 4 -- addons/spectator/UI/interface.hpp | 3 +- addons/spectator/XEH_preInit.sqf | 2 + .../spectator/functions/fnc_cacheUnitInfo.sqf | 11 +++- .../spectator/functions/fnc_handleIcons.sqf | 57 ++++++++----------- .../functions/fnc_handleInterface.sqf | 32 ++--------- addons/spectator/functions/fnc_handleMap.sqf | 46 +++++++++++++++ .../functions/fnc_transitionCamera.sqf | 6 -- .../spectator/functions/fnc_updateUnits.sqf | 7 ++- addons/spectator/stringtable.xml | 8 --- 10 files changed, 90 insertions(+), 86 deletions(-) create mode 100644 addons/spectator/functions/fnc_handleMap.sqf diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 2889fd2e0f..78402cff23 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -19,8 +19,4 @@ class ACE_Settings { value = 0; values[] = {CSTRING(modes_all), CSTRING(visions_nv), CSTRING(visions_ti), "$STR_Special_None"}; }; - class GVAR(unitIcons) { - typeName = "BOOL"; - value = 1; - }; }; diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 182263e7b4..0b4d33ea75 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -176,12 +176,13 @@ class GVAR(interface) { }; 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([ARR_2('onDraw',_this)] call FUNC(handleInterface)); + onDraw = QUOTE(_this call FUNC(handleMap)); }; class helpSplash: RscControlsGroupNoScrollbars { idc = IDC_HELP; diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 95c18f4a54..2c29598ebc 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(handleCamera); PREP(handleCompass); PREP(handleIcons); PREP(handleInterface); +PREP(handleMap); PREP(handleMouse); PREP(handleToolbar); PREP(handleUnits); @@ -51,5 +52,6 @@ GVAR(showUnit) = true; GVAR(unitList) = []; GVAR(unitBlacklist) = []; GVAR(unitWhitelist) = []; +GVAR(groupList) = []; ADDON = true; diff --git a/addons/spectator/functions/fnc_cacheUnitInfo.sqf b/addons/spectator/functions/fnc_cacheUnitInfo.sqf index 13977bf398..9f40651748 100644 --- a/addons/spectator/functions/fnc_cacheUnitInfo.sqf +++ b/addons/spectator/functions/fnc_cacheUnitInfo.sqf @@ -19,15 +19,20 @@ params ["_unit"]; private ["_color","_icon","_name"]; -_color = [side group _unit] call BIS_fnc_sideColor; +// 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 { +if (isText (configFile >> "CfgVehicleIcons" >> _icon)) then { _icon = getText (configFile >> "CfgVehicleIcons" >> _icon); }; -SETVAR(_unit,GVAR(uColor),_color); SETVAR(_unit,GVAR(uIcon),_icon); SETVAR(_unit,GVAR(uName),_name); diff --git a/addons/spectator/functions/fnc_handleIcons.sqf b/addons/spectator/functions/fnc_handleIcons.sqf index c52943ad10..72c0d7dee6 100644 --- a/addons/spectator/functions/fnc_handleIcons.sqf +++ b/addons/spectator/functions/fnc_handleIcons.sqf @@ -1,5 +1,5 @@ /* - * Author: SilentSpike + * Author: Head, SilentSpike * Handles rendering the spectator 3D unit icons * * Arguments: @@ -17,41 +17,30 @@ #include "script_component.hpp" -// Kill PFH when not in free cam (or display is closed) -if (isNil QGVAR(iconHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - if !(GVAR(showIcons)) exitWith {}; +private ["_refPoint","_drawVehicles","_leader","_color","_txt","_unit"]; -private ["_cachedVehicles","_unit","_cameraPos","_cameraDir","_lambda","_uPos","_cmd","_txt"]; -_cachedVehicles = []; +// Draw groups unless leader is within distance +_refPoint = [GVAR(camera),GVAR(camUnit)] select (GVAR(camMode) > 0); +_drawVehicles = []; { - _unit = vehicle _x; + _leader = leader _x; + if ((_leader distanceSqr _refPoint) > 40000) then { + _color = GETVAR(_x,GVAR(gColor),[ARR_4(0,0,0,0)]); + _txt = groupID _x; - // Only try each vehicle once - if !(_unit in _cachedVehicles) then { - _cachedVehicles pushBack _unit; - - // Within 200m - if ((GVAR(camera) distanceSqr _unit) < 40000) then { - _cameraPos = (positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL); - _cameraDir = ((positionCameraToWorld [0, 0, 1]) call EFUNC(common,positionToASL)) vectorDiff _cameraPos; - - // Quick oclussion test (taken from interact_menu) - _lambda = ((getPosASL _x) vectorDiff _cameraPos) vectorDotProduct _cameraDir; - if (_lambda > -1) then { - _uPos = worldToScreen (visiblePosition _unit); - - // Only draw if onscreen - if ((_uPos select 0 > safeZoneXAbs) && (_uPos select 0 < safeZoneXAbs + safeZoneWAbs)) then { - if ((_uPos select 1 > safeZoneY) && (_uPos select 1 < safeZoneY + safeZoneH)) then { - // Use commander's info if available - _cmd = [_x, effectiveCommander _unit] select ((effectiveCommander _unit) in GVAR(unitList)); - _txt = ["", GETVAR(_cmd,GVAR(uName),"")] select (isPlayer _cmd); - - drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", GETVAR(_cmd,GVAR(uColor),[ARR_4(0,0,0,0)]), _unit modelToWorldVisual [0,0,3], 0.7, 0.7, 0, _txt, 1, 0.02]; - }; - }; - }; - }; + 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); }; -} forEach GVAR(unitList); + 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 index 502ce65fd4..d58566968c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -114,6 +114,9 @@ switch (toLower _mode) do { // Keep unit list and tree up to date [FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler; + // Handle unit icons on map and 3D + GVAR(iconHandler) = addMissionEventHandler ["Draw3D",FUNC(handleIcons)]; + // Populate the help splash private "_help"; _help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST; @@ -187,6 +190,7 @@ switch (toLower _mode) do { // Kill GUI PFHs GVAR(camHandler) = nil; GVAR(compHandler) = nil; + removeMissionEventHandler ["Draw3D",GVAR(iconHandler)]; GVAR(iconHandler) = nil; GVAR(toolHandler) = nil; }; @@ -435,34 +439,6 @@ switch (toLower _mode) do { [nil,nil,nil, _newPos] call FUNC(setCameraAttributes); }; }; - case "ondraw": { - _args params ["_map"]; - - if (GVAR(camMode) == 0) then { - _map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(camera),24,24,GVAR(camPan)]; - }; - - if !(GVAR(showIcons)) exitWith {}; - - private ["_cachedVehicles","_unit","_color","_icon"]; - _cachedVehicles = []; - { - _unit = vehicle _x; - - if !(_unit in _cachedVehicles) then { - _cachedVehicles pushBack _unit; - - // Use previously cached info where possible - if (isNil { GETVAR(_unit,GVAR(uIcon),nil) }) then { - [_unit] call FUNC(cacheUnitInfo); - }; - - _color = GETVAR(_unit,GVAR(uColor),[ARR_4(0,0,0,0)]); - _icon = GETVAR(_unit,GVAR(uIcon),""); - _map drawIcon [_icon, _color, _unit, 24, 24, getDir _unit]; - }; - } forEach GVAR(unitList); - }; // Break from interface for eexternal events case "escape": { _args params ["_display"]; diff --git a/addons/spectator/functions/fnc_handleMap.sqf b/addons/spectator/functions/fnc_handleMap.sqf new file mode 100644 index 0000000000..a0000718bd --- /dev/null +++ b/addons/spectator/functions/fnc_handleMap.sqf @@ -0,0 +1,46 @@ +/* + * 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"]; + +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),""); + + _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit]; + }; + false +} count GVAR(unitList); diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 90a2dc776b..b35b61b311 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -79,11 +79,6 @@ if (_newMode == 0) then { // Free // Handle camera movement if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; - - // Handle unit icons - if (GVAR(unitIcons)) then { - if (isNil QGVAR(iconHandler)) then { GVAR(iconHandler) = [FUNC(handleIcons), 0] call CBA_fnc_addPerFrameHandler; }; - }; } else { // When null unit is given choose random if (isNull _newUnit) then { @@ -111,7 +106,6 @@ if (_newMode == 0) then { // Free // Terminate camera view GVAR(camera) cameraEffect ["terminate", "back"]; GVAR(camHandler) = nil; - GVAR(iconHandler) = nil; cameraEffectEnableHUD true; }; diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index 75f1402179..50494cf499 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -33,7 +33,7 @@ if !(_newUnits isEqualTo []) exitWith { }; }; -private ["_sides","_cond","_filteredUnits","_color","_icon"]; +private ["_sides","_cond","_filteredUnits","_filteredGroups"]; // Unit setting filter _newUnits = [[],allPlayers,playableUnits,allUnits] select GVAR(filterUnits); @@ -63,10 +63,13 @@ _filteredUnits = []; _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 list entirely (removes any no longer valid) +// Replace previous lists entirely (removes any no longer valid) GVAR(unitList) = _filteredUnits arrayIntersect _filteredUnits; +GVAR(groupList) = _filteredGroups arrayIntersect _filteredGroups; diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 5219ba7e2d..4d615d4e1e 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -100,14 +100,6 @@ Thermal imaging Termowizja - - Unit icons - Ikony jednostek - - - Render icons above spectatable units. - Renderuj ikony nad głowami jednostek, które można obserwować. - Spectator Controls From 4c9b6e94cfa915a70b3911d18acda892c7ff8c66 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 00:05:21 +0100 Subject: [PATCH 047/239] Overhaul and improve spectator unit tree UX The old method of refreshing the tree on each update would reset all expanded/collapsed nodes. Now the code will cull any units/groups/sides no longer spectatable from the list and cache the ones that are still valid. The cached data is then used to populate the list with new units. Add coloured unit icons beside units in the list for quick user reference of side and type. Store group netIDs in respective nodes for possible use in code. --- addons/spectator/UI/interface.hpp | 4 +- .../functions/fnc_handleInterface.sqf | 85 ++++++++++++------- 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 0b4d33ea75..ea5f5f0e53 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -158,9 +158,9 @@ class GVAR(interface) { class unitTree: RscTree { idc = IDC_UNIT; x = safeZoneX; - y = safeZoneY + TOOL_H * 2; + y = safeZoneY + TOOL_H * 6; w = TOOL_W * 2; - h = safeZoneH - TOOL_H * 6; + h = safeZoneH - TOOL_H * 13; sizeEx = H_PART(0.8); borderSize = 1; colorBorder[] = {COL_FORE}; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index d58566968c..9687ba8b2a 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -367,17 +367,43 @@ switch (toLower _mode) do { }; case "onunitsupdate": { _args params ["_tree"]; - private ["_curSelData","_cachedGrps","_cachedSides","_grp","_side","_sNode","_gNode","_uNode"]; + private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"]; - // Cache current selection - _curSelData = _tree tvData (tvCurSel _tree); - - // Clear the tree - tvClear _tree; - - // Update the tree from the unit list + // 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; @@ -385,47 +411,42 @@ switch (toLower _mode) do { // Use correct side node if !(_side in _cachedSides) then { // Add side node - _sNode = _tree tvAdd [[], _side]; + _s = _tree tvAdd [[], _side]; + _tree tvExpand [_s]; _cachedSides pushBack _side; - _cachedSides pushBack _sNode; + _cachedSides pushBack _s; } else { // If side already processed, use existing node - _sNode = _cachedSides select ((_cachedSides find _side) + 1); + _s = _cachedSides select ((_cachedSides find _side) + 1); }; // Use correct group node if !(_grp in _cachedGrps) then { // Add group node - _gNode = _tree tvAdd [[_sNode], groupID _grp]; + _g = _tree tvAdd [[_s], groupID _grp]; + _tree tvSetData [[_s,_g], netID _grp]; _cachedGrps pushBack _grp; - _cachedGrps pushBack _gNode; + _cachedGrps pushBack _g; } else { // If group already processed, use existing node - _gNode = _cachedGrps select ((_cachedGrps find _grp) + 1); + _g = _cachedGrps select ((_cachedGrps find _grp) + 1); }; - _uNode = _tree tvAdd [[_sNode,_gNode], GETVAR(_x,GVAR(uName),"")]; - _tree tvSetData [[_sNode,_gNode,_uNode], netID _x]; + _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)])]; - // Preserve the previous selection - if (_curSelData == (_tree tvData [_sNode,_gNode,_uNode])) then { - _tree tvSetCurSel [_sNode,_gNode,_uNode]; - }; - - _tree tvSort [[_sNode,_gNode],false]; - _tree tvExpand [_sNode,_gNode]; - } forEach GVAR(unitList); - - { - if (typeName _x == "SCALAR") then { - _tree tvSort [[_x],false]; - _tree tvExpand [_x]; - }; - } forEach _cachedSides; + _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": { @@ -439,7 +460,7 @@ switch (toLower _mode) do { [nil,nil,nil, _newPos] call FUNC(setCameraAttributes); }; }; - // Break from interface for eexternal events + // Break from interface for external events case "escape": { _args params ["_display"]; private "_dlg"; From f59536b5a3c26c1bee28f77ae01c8d739c06ad19 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 00:28:54 +0100 Subject: [PATCH 048/239] Remove legacy spectator settings module argument --- addons/spectator/CfgVehicles.hpp | 6 ------ addons/spectator/functions/fnc_moduleSpectatorSettings.sqf | 1 - 2 files changed, 7 deletions(-) diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index b63f349b0a..f6869462ac 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -109,12 +109,6 @@ class CfgVehicles { }; }; }; - class unitIcons { - displayName = CSTRING(icons_DisplayName); - description = CSTRING(icons_Description); - typeName = "BOOL"; - defaultValue = 1; - }; }; class ModuleDescription { description = CSTRING(Settings_Description); diff --git a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf index c23fb7ad20..52b6e5d8fa 100644 --- a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf +++ b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf @@ -23,4 +23,3 @@ if !(_activated) exitWith {}; [_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(restrictVisions), "visionModes"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(unitIcons), "unitIcons"] call EFUNC(common,readSettingFromModule); From 043c5c47c5765c64d32e8df23d408db87a8df75b Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 01:44:32 +0100 Subject: [PATCH 049/239] Improve spectator help window layout Having the help window in the centre of the screen blocked too much of the users view and also clashed with the MPTable element (the table that appears on death, aka "respawnDialog"). It was moved to the right of the screen and now mirrors the unit list. To save screen space, the action keys are given as tooltips for the listbox entries so users must mouse over for more info. --- addons/spectator/UI/interface.hpp | 53 +++++++++++-------- .../functions/fnc_handleInterface.sqf | 39 +++++++------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index ea5f5f0e53..5dbea22273 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -10,7 +10,7 @@ class RscFrame { class RscButtonMenu; class RscControlsGroupNoScrollbars; //class RscFrame; -class RscListNBox; +class RscListBox; class RscMapControl; class RscPicture; class RscText; @@ -163,12 +163,13 @@ class GVAR(interface) { h = safeZoneH - TOOL_H * 13; sizeEx = H_PART(0.8); borderSize = 1; + colorText[] = {COL_FORE}; colorBorder[] = {COL_FORE}; 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])", + QUOTE(GETPRVAR(GUI_BCG_RGB_R,0.77)), + QUOTE(GETPRVAR(GUI_BCG_RGB_G,0.51)), + QUOTE(GETPRVAR(GUI_BCG_RGB_B,0.08)), 1 }; multiselectEnabled = 0; @@ -184,35 +185,43 @@ class GVAR(interface) { onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface)); onDraw = QUOTE(_this call FUNC(handleMap)); }; - class helpSplash: RscControlsGroupNoScrollbars { + class helpWindow: RscControlsGroupNoScrollbars { idc = IDC_HELP; - x = 0.5 - W_PART(12); - y = 0.5 - H_PART(12); - w = W_PART(24); - h = H_PART(24); + x = safeZoneX + safeZoneW - TOOL_W * 2; + y = safeZoneY + TOOL_H * 6; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + colorText[] = {COL_FORE}; + colorSelectBackground[] = {COL_FORE_D}; + colorSelectBackground2[] = {COL_BACK}; + colorBackground[] = {0,0,0,0}; class controls { - class helpBack: RscText { + class helpTitle: RscText { x = 0; y = 0; - w = W_PART(24); - h = H_PART(24); - colorBackground[] = {COL_BACK}; - }; - class helpTitle: helpBack { + w = TOOL_W * 2; h = H_PART(1); - colorText[]={COL_FORE}; + colorText[] = {COL_FORE}; colorBackground[] = {COL_FORE_D}; sizeEx = H_PART(1); text = CSTRING(HelpTitle); }; - class helpContent: RscListNBox { + class helpContent: RscListBox { idc = IDC_HELP_LIST; - x = W_PART(1); - y = H_PART(2); - W = W_PART(22); - H = H_PART(21); + x = 0; + y = H_PART(1); + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 14; + colorBackground[] = {COL_BACK}; default = 1; - columns[] = {0.01,0.5}; + }; + class helpFrame: RscText { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + colorText[] = {COL_FORE}; + style = 64; }; }; }; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 9687ba8b2a..ef3363b72c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -117,27 +117,27 @@ switch (toLower _mode) do { // Handle unit icons on map and 3D GVAR(iconHandler) = addMissionEventHandler ["Draw3D",FUNC(handleIcons)]; - // Populate the help splash + // Populate the help window private "_help"; _help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST; { - // Add space before category titles - if (count _x == 1) then { - _help lnbAddRow [""]; + _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]; }; - - _help lnbAddRow _x; } forEach [ [localize LSTRING(uiControls),""], - [localize LSTRING(uiToggleHelp),"H"], - [localize LSTRING(uiToggleMap),"M"], [localize LSTRING(uiToggleUnits),"1"], - [localize LSTRING(uiToggleTools),"2"], - [localize LSTRING(uiToggleCompass),"3"], - [localize LSTRING(uiToggleIcons),"4"], + [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(freeCamControls),""], [localize LSTRING(freeCamForward),"W"], [localize LSTRING(freeCamBackward),"S"], [localize LSTRING(freeCamLeft),"A"], @@ -150,8 +150,7 @@ switch (toLower _mode) do { [localize LSTRING(freeCamZoom),"Ctrl + Scrollwheel"], [localize LSTRING(freeCamNextVis),"N"], [localize LSTRING(freeCamPrevVis),"Ctrl + N"], - - [localize LSTRING(otherControls)], + [localize LSTRING(otherControls),""], [localize LSTRING(nextCam),"Up Arrow"], [localize LSTRING(prevCam),"Down Arrow"], [localize LSTRING(nextUnit),"Right Arrow"], @@ -250,12 +249,15 @@ switch (toLower _mode) do { [_display,nil,nil,nil,nil,nil,true] call FUNC(toggleInterface); }; case 3: { // 2 - [_display,nil,nil,nil,nil,true] call FUNC(toggleInterface); + [_display,nil,true] call FUNC(toggleInterface); }; case 4: { // 3 - [_display,true] call FUNC(toggleInterface); + [_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 @@ -279,9 +281,6 @@ switch (toLower _mode) do { case 32: { // D GVAR(camDolly) set [0, GVAR(camSpeed)]; }; - case 35: { // H - [_display,nil,true] call FUNC(toggleInterface); - }; case 44: { // Z GVAR(camBoom) = -0.5 * GVAR(camSpeed); }; From 485f9438bb1e2aa56e908156b0a7fd5f883a69d5 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 01:51:46 +0100 Subject: [PATCH 050/239] Change spectator UI toggle to include help window With new layout of help window the toggle UX also changes. User expects help window to toggle as part of overall UI. --- .../spectator/functions/fnc_toggleInterface.sqf | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/addons/spectator/functions/fnc_toggleInterface.sqf b/addons/spectator/functions/fnc_toggleInterface.sqf index 609c7cd757..4a03de4271 100644 --- a/addons/spectator/functions/fnc_toggleInterface.sqf +++ b/addons/spectator/functions/fnc_toggleInterface.sqf @@ -31,17 +31,8 @@ _map = _display displayCtrl IDC_MAP; _tool = _display displayCtrl IDC_TOOL; _unit = _display displayCtrl IDC_UNIT; -// Map and help operate outside of interface -GVAR(showHelp) = [GVAR(showHelp), !GVAR(showHelp)] select _toggleHelp; +// Map operates outside of interface GVAR(showMap) = [GVAR(showMap), !GVAR(showMap)] select _toggleMap; - -// When help changes with map open, minimise the map -if (GVAR(showMap) && _toggleHelp) then { - GVAR(showHelp) = true; - GVAR(showMap) = false; -}; - -_help ctrlShow GVAR(showHelp); _map ctrlShow GVAR(showMap); if (GVAR(showMap)) then { @@ -62,16 +53,18 @@ if (GVAR(showMap)) then { 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,_tool,_unit]; + } forEach [_comp,_help,_tool,_unit]; }; }; From a330e7b0c52d88e221911ce943a5a5a9471664cb Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Fri, 7 Aug 2015 09:18:42 +0200 Subject: [PATCH 051/239] Code cleanup of Switchunits module --- .../functions/fnc_addMapFunction.sqf | 7 ++-- .../functions/fnc_handleMapClick.sqf | 18 +++++----- .../switchunits/functions/fnc_initPlayer.sqf | 7 ++-- .../switchunits/functions/fnc_isValidAi.sqf | 15 ++++----- .../switchunits/functions/fnc_markAiOnMap.sqf | 27 +++++++-------- addons/switchunits/functions/fnc_module.sqf | 3 +- .../functions/fnc_nearestPlayers.sqf | 7 ++-- .../functions/fnc_startSwitchUnits.sqf | 4 +-- .../switchunits/functions/fnc_switchBack.sqf | 15 ++++----- .../switchunits/functions/fnc_switchUnit.sqf | 33 +++++-------------- 10 files changed, 54 insertions(+), 82 deletions(-) diff --git a/addons/switchunits/functions/fnc_addMapFunction.sqf b/addons/switchunits/functions/fnc_addMapFunction.sqf index 7204e73d36..3a7b20601c 100644 --- a/addons/switchunits/functions/fnc_addMapFunction.sqf +++ b/addons/switchunits/functions/fnc_addMapFunction.sqf @@ -10,19 +10,18 @@ * None * * Example: - * [_unit, _sides] call FUNC(addMapFunction) + * [_unit, _sides] call ace_switchunits_fnc_addMapFunction * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_unit,_sides); +params ["_unit", "_sides"]; ["theMapClick", "onMapSingleClick", { // IGNORE_PRIVATE_WARNING(_pos,_shift,_alt) if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { [_this, _pos, _shift, _alt] call FUNC(handleMapClick); }; - + }, [_unit, _sides]] call BIS_fnc_addStackedEventHandler; diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index e8efa2640f..03a94f81af 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -3,24 +3,25 @@ * Switches to a unit close to a clicked map position * * Arguments: - * 0: unit - * 1: sides > + * 0: Faction + * 0: unit + * 1: sides + * 1: Map Position * * Return Value: * None * * Example: - * [unit, _sides] call FUNC(handleMapClick) + * [[unit, _sides], [20, 30]] call ace_switchunits_fnc_handleMapClick * * Public: No */ - #include "script_component.hpp" -private ["_sides", "_pos", "_sideNearest"]; +private ["_sideNearest"]; -_sides = (_this select 0) select 1; -_pos = _this select 1; +params ["_faction", "_pos"]; +_faction params ["", "_sides"]; _sideNearest = []; @@ -28,7 +29,8 @@ _sideNearest = []; if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { _sideNearest pushBack _x; }; -} forEach (nearestObjects [_pos, ["Man"], 15]); + nil +} count (nearestObjects [_pos, ["Man"], 15]); if (count _sideNearest > 0) then { [_sideNearest select 0] call FUNC(switchUnit); diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 67669c071c..80388a9d2b 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -10,24 +10,21 @@ * None * * Example: - * [player, [west]] call FUNC(initPlayer) + * [player, [west]] call ace_switchunits_fnc_initPlayer * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_playerUnit,_sides); +params ["_playerUnit", "_sides"]; if (vehicle _playerUnit == _playerUnit) then { - [_sides] call FUNC(markAiOnMap); _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; - //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); GVAR(OriginalName) = name _playerUnit; GVAR(OriginalGroup) = group _playerUnit; diff --git a/addons/switchunits/functions/fnc_isValidAi.sqf b/addons/switchunits/functions/fnc_isValidAi.sqf index 61c2401da9..0b6a35c257 100644 --- a/addons/switchunits/functions/fnc_isValidAi.sqf +++ b/addons/switchunits/functions/fnc_isValidAi.sqf @@ -6,22 +6,19 @@ * 0: unit * * Return Value: - * Boolean + * Valid AI * * Example: - * [_unit] call FUNC(isValidAi) + * [_unit] call ace_switchunits_fnc_isValidAi * * Public: Yes */ - #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; !([_unit] call EFUNC(common,isPlayer) || {_unit in playableUnits} -|| {vehicle _unit != _unit} -|| {_unit getVariable [QGVAR(IsPlayerUnit), false]} -|| {_unit getVariable [QGVAR(IsPlayerControlled), false]}) +|| {vehicle _unit != _unit} +|| {_unit getVariable [QGVAR(IsPlayerUnit), false]} +|| {_unit getVariable [QGVAR(IsPlayerControlled), false]}) // return diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index 620b805cb9..011768845a 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -1,7 +1,7 @@ /* * Author: bux578 * Creates markers for AI units for given sides. - * Marks players in a different colour. + * Marks players in a different colour. * * Arguments: * 0: side @@ -10,28 +10,24 @@ * None * * Example: - * [[west, east]] call FUNC(markAiOnMap) + * [[west, east]] call ace_switchunits_fnc_markAiOnMap * * Public: No */ - #include "script_component.hpp" -private "_sidesToShow"; -_sidesToShow = _this select 0; +params ["_sidesToShow"]; GVAR(AllMarkerNames) = []; -DFUNC(pfhMarkAiOnMap) = { - private ["_args", "_sides"]; - _args = _this select 0; - _sides = _args select 0; - +_fnc_pfhMarkAiOnMap = { + params ["_args"]; + _args params ["_sides"]; // delete markers { - deleteMarkerLocal _x; - } forEach GVAR(AllMarkerNames); + deleteMarkerLocal _x; + } count GVAR(AllMarkerNames); // reset the array GVAR(AllMarkerNames) = []; @@ -48,7 +44,7 @@ DFUNC(pfhMarkAiOnMap) = { _marker = createMarkerLocal [_markerName, position _x]; _markerName setMarkerTypeLocal "mil_triangle"; _markerName setMarkerShapeLocal "ICON"; - _markerName setMarkerSizeLocal [0.5,0.7]; + _markerName setMarkerSizeLocal [0.5, 0.7]; _markerName setMarkerDirLocal getDir _x; // commy's one liner magic @@ -63,9 +59,10 @@ DFUNC(pfhMarkAiOnMap) = { }; GVAR(AllMarkerNames) pushBack _markerName; + nil }; - } forEach allUnits; + } count allUnits; }; }; -[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; +[_fnc_pfhMarkAiOnMap, 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index 9563dea71f..ec9164a866 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -15,12 +15,11 @@ * * Public: No */ - #include "script_component.hpp" if !(isServer) exitWith {}; -EXPLODE_3_PVT(_this,_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 987c4e3528..64e347d7da 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -10,7 +10,7 @@ * Player units > * * Example: - * [[300,300,0], 100] call FUNC(nearestPlayers) + * [[300,300,0], 100] call ace_switchunits_fnc_nearestPlayers * * Public: Yes */ @@ -18,10 +18,7 @@ private ["_nearestPlayers"]; -PARAMS_2(_position,_radius); - -_position = _this select 0; -_radius = _this select 1; +params ["_position", "_radius"]; _nearestPlayers = []; diff --git a/addons/switchunits/functions/fnc_startSwitchUnits.sqf b/addons/switchunits/functions/fnc_startSwitchUnits.sqf index 7985bfa094..481b04d2cd 100644 --- a/addons/switchunits/functions/fnc_startSwitchUnits.sqf +++ b/addons/switchunits/functions/fnc_startSwitchUnits.sqf @@ -9,14 +9,14 @@ * None * * Example: - * [_player] call FUNC(startSwitchUnits) + * [_player] call ace_switchunits_fnc_startSwitchUnits * * Public: No */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; if (GVAR(EnableSwitchUnits)) then { private "_sides"; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index c9ca731427..3ebf49a3ab 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -10,20 +10,19 @@ * None * * Example: - * [_originalPlayerUnit, _currentUnit] call FUNC(switchBack) + * [_originalPlayerUnit, _currentUnit] call ace_switchunits_fnc_switchBack * * Public: Yes */ - #include "script_component.hpp" -PARAMS_1(_originalPlayerUnit); +params ["_originalPlayerUnit"]; [_originalPlayerUnit] joinSilent GVAR(OriginalGroup); -DFUNC(pfhSwitchBack) = { - PARAMS_2(_args,_pfID); - EXPLODE_2_PVT(_args,_originalPlayerUnit,_currentUnit); +_fnc_pfhSwitchBack = { + params ["_args", "_pfhId"]; + _args params ["_originalPlayerUnit", "_currentUnit"]; if (local _originalPlayerUnit) exitWith { selectPlayer _originalPlayerUnit; @@ -33,8 +32,8 @@ DFUNC(pfhSwitchBack) = { _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; _layer cuttext ["","plain"]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_pfhId] call cba_fnc_removePerFrameHandler; }; }; -[FUNC(pfhSwitchBack), 0.2, _this] call CBA_fnc_addPerFrameHandler; +[_fnc_pfhSwitchBack, 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index c57012afdb..2079982fc0 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -3,24 +3,21 @@ * Switches to the new given player unit * * Arguments: - * 0: current unit - * 1: the unit to switch to + * 0: the unit to switch to * * Return Value: * None * * Example: - * [_unit] call FUNC(switchUnit) + * [_unit] call ace_switchunits_fnc_switchUnit * * Public: Yes */ - - #include "script_component.hpp" private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; -PARAMS_1(_unit); +params ["_unit"]; // don't switch to original player units if (!([_unit] call FUNC(isValidAi))) exitWith {}; @@ -29,14 +26,12 @@ if (!([_unit] call FUNC(isValidAi))) exitWith {}; _leave = false; if (GVAR(EnableSafeZone)) then { - _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); if (count _nearestEnemyPlayers > 0) exitWith { _leave = true; }; - }; // exitWith doesn't exit past the "if(EnableSafeZone)" block @@ -49,21 +44,12 @@ if (_leave) exitWith { //[_unit] joinSilent group player; [[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); -_oldUnit = player; - - -DFUNC(pfhSwitchUnit) = { - - private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; - _args = _this select 0; - - _unit = _args select 0; - _oldUnit = _args select 1; - - +_fnc_pfhSwitchUnit = { + private ["_respawnEhId", "_oldOwner"]; + params ["_args", "_pfhId"]; + _args params ["_unit", "_oldUnit"]; if (local _unit) exitWith { - _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; @@ -90,9 +76,8 @@ DFUNC(pfhSwitchUnit) = { [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); - [(_this select 1)] call cba_fnc_removePerFrameHandler; - + [_pfhId] call cba_fnc_removePerFrameHandler; }; }; -[FUNC(pfhSwitchUnit), 0.2, [_unit, _oldUnit]] call CBA_fnc_addPerFrameHandler; +[_fnc_pfhSwitchUnit, 0.2, [_unit, player]] call CBA_fnc_addPerFrameHandler; From da97472600fa5f78668e6b855c2f0823133f0414 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Fri, 7 Aug 2015 12:56:10 +0200 Subject: [PATCH 052/239] Added ace specific logging methods --- addons/main/script_macros.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index e67c45e675..78205a8d11 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -97,5 +97,9 @@ // Time functions for accuracy per frame #define ACE_tickTime (ACE_time + (diag_tickTime - ACE_diagTime)) +#define ACE_LOG(module,level,message) diag_log text format [QUOTE([ACE] (%1) %2: %3), module, level, message]; +#define ACE_LOGERROR(message) ACE_LOG(QUOTE(COMPONENT),"ERROR",message) +#define ACE_LOGWARNING(message) ACE_LOG(QUOTE(COMPONENT),"WARNING",message) +#define ACE_LOGINFO(message) ACE_LOG(QUOTE(COMPONENT),"INFO",message) -#include "script_debug.hpp" \ No newline at end of file +#include "script_debug.hpp" From f143db7fc067133e53e81897ff614297a5a25109 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 12:07:22 +0100 Subject: [PATCH 053/239] Draw player names on spectator map --- addons/spectator/UI/interface.hpp | 6 +++--- addons/spectator/functions/fnc_handleMap.sqf | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 5dbea22273..51105b216b 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -167,9 +167,9 @@ class GVAR(interface) { colorBorder[] = {COL_FORE}; colorBackground[] = {COL_BACK}; colorSelect[] = { - QUOTE(GETPRVAR(GUI_BCG_RGB_R,0.77)), - QUOTE(GETPRVAR(GUI_BCG_RGB_G,0.51)), - QUOTE(GETPRVAR(GUI_BCG_RGB_B,0.08)), + "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; diff --git a/addons/spectator/functions/fnc_handleMap.sqf b/addons/spectator/functions/fnc_handleMap.sqf index a0000718bd..4eeb5fd7e1 100644 --- a/addons/spectator/functions/fnc_handleMap.sqf +++ b/addons/spectator/functions/fnc_handleMap.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" params ["_map"]; -private ["_cachedVehicles","_unit","_color","_icon"]; +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)]; @@ -39,8 +39,9 @@ _cachedVehicles = []; // 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]; + _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.03]; }; false } count GVAR(unitList); From 702e50b731fd849c59a1ee1a7e531601ff703b52 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 12:30:50 +0100 Subject: [PATCH 054/239] Improve spectator UI respawn counter blending When the BI respawn counter is blended with the spectator UI its colours are also updated to match --- addons/spectator/functions/fnc_handleInterface.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index ef3363b72c..db701366b0 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -176,7 +176,11 @@ switch (toLower _mode) do { _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; From 1c79c8fa45fc55c85cd90458803879ae22a8e6de Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 15:15:04 +0100 Subject: [PATCH 055/239] Update spectator UI styling Adds a title to the unit tree to match the help list and enters the title text. --- addons/spectator/UI/interface.hpp | 67 +++++++++++++------ .../spectator/functions/fnc_handleUnits.sqf | 2 +- addons/spectator/script_component.hpp | 5 +- addons/spectator/stringtable.xml | 3 + 4 files changed, 53 insertions(+), 24 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 51105b216b..a7790d6da0 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -137,11 +137,11 @@ class GVAR(interface) { idc = -1; style = 64; }; - class fovTool: viewTool { + class zoomTool: viewTool { idc = IDC_TOOL_FOV; x = safeZoneW - TOOL_W * 2 - MARGIN; }; - class fovFrame: fovTool { + class zoomFrame: zoomTool { idc = -1; style = 64; }; @@ -155,25 +155,52 @@ class GVAR(interface) { }; }; }; - class unitTree: RscTree { + class unitTree: RscControlsGroupNoScrollbars { idc = IDC_UNIT; x = safeZoneX; y = safeZoneY + TOOL_H * 6; w = TOOL_W * 2; h = safeZoneH - TOOL_H * 13; - sizeEx = H_PART(0.8); - borderSize = 1; - colorText[] = {COL_FORE}; - colorBorder[] = {COL_FORE}; - 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 + 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)); + }; + class unitFrame: RscFrame { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + shadow = 2; + colorText[] = {COL_FORE}; + }; }; - multiselectEnabled = 0; - onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface)); }; class mapOverlay: RscMapControl { idc = IDC_MAP; @@ -191,16 +218,13 @@ class GVAR(interface) { y = safeZoneY + TOOL_H * 6; w = TOOL_W * 2; h = safeZoneH - TOOL_H * 13; - colorText[] = {COL_FORE}; - colorSelectBackground[] = {COL_FORE_D}; - colorSelectBackground2[] = {COL_BACK}; - colorBackground[] = {0,0,0,0}; 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); @@ -213,15 +237,16 @@ class GVAR(interface) { w = TOOL_W * 2; h = safeZoneH - TOOL_H * 14; colorBackground[] = {COL_BACK}; + sizeEx = H_PART(0.8); default = 1; }; - class helpFrame: RscText { + class helpFrame: RscFrame { x = 0; y = 0; w = TOOL_W * 2; h = safeZoneH - TOOL_H * 13; + shadow = 2; colorText[] = {COL_FORE}; - style = 64; }; }; }; diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf index e8cd561da0..c32961024c 100644 --- a/addons/spectator/functions/fnc_handleUnits.sqf +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -36,5 +36,5 @@ if !(GVAR(camUnit) in GVAR(unitList)) then { // 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]],1] call EFUNC(common,waitAndExecute); + [FUNC(handleInterface),["onUnitsUpdate",[(_display displayCtrl IDC_UNIT) controlsGroupCtrl IDC_UNIT_TREE]],1] call EFUNC(common,waitAndExecute); }; diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index a726c6c67f..de2ee22363 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -49,8 +49,9 @@ #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.8 +#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,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 index 4d615d4e1e..30af5d1aa6 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -101,6 +101,9 @@ Termowizja + + Spectator Units + Spectator Controls Sterowanie obserwatorem From c5d9ec5d500a83db1bc3e85c4dc9c005f89f8fb0 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 18:59:48 +0100 Subject: [PATCH 056/239] Add speed boost button to spectator free camera Sometimes you just want a burst of speed rather than to adjust it and then adjust it back. Also swapped the speed/zoom scrolling modifier around. --- .../functions/fnc_handleInterface.sqf | 33 ++++++++++--------- addons/spectator/stringtable.xml | 3 ++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index db701366b0..80d87cf40a 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -114,7 +114,7 @@ switch (toLower _mode) do { // Keep unit list and tree up to date [FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler; - // Handle unit icons on map and 3D + // Handle 3D unit icons GVAR(iconHandler) = addMissionEventHandler ["Draw3D",FUNC(handleIcons)]; // Populate the help window @@ -146,8 +146,9 @@ switch (toLower _mode) do { [localize LSTRING(freeCamDown),"Z"], [localize LSTRING(freeCamPan),"RMB (Hold)"], [localize LSTRING(freeCamDolly),"LMB (Hold)"], - [localize LSTRING(freeCamSpeed),"Scrollwheel"], - [localize LSTRING(freeCamZoom),"Ctrl + Scrollwheel"], + [localize LSTRING(freeCamZoom),"Scrollwheel"], + [localize LSTRING(freeCamSpeed),"Ctrl + Scrollwheel"], + [localize LSTRING(freeCamBoost),"Shift (Hold)"], [localize LSTRING(freeCamNextVis),"N"], [localize LSTRING(freeCamPrevVis),"Ctrl + N"], [localize LSTRING(otherControls),""], @@ -220,9 +221,9 @@ switch (toLower _mode) do { // Scroll to change speed, modifier for zoom if (GVAR(ctrlKey)) then { - [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + _zChange * 0.1] call FUNC(setCameraAttributes); - } else { [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": { @@ -268,31 +269,33 @@ switch (toLower _mode) do { [_display,nil,nil,true] call FUNC(toggleInterface); }; case 16: { // Q - GVAR(camBoom) = 0.5 * GVAR(camSpeed); + GVAR(camBoom) = 0.5 * GVAR(camSpeed) * ([1, 2] select _shift); }; case 17: { // W - GVAR(camDolly) set [1, GVAR(camSpeed)]; + 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)]; + GVAR(camDolly) set [0, -GVAR(camSpeed) * ([1, 2] select _shift)]; }; case 31: { // S - GVAR(camDolly) set [1, -GVAR(camSpeed)]; + GVAR(camDolly) set [1, -GVAR(camSpeed) * ([1, 2] select _shift)]; }; case 32: { // D - GVAR(camDolly) set [0, GVAR(camSpeed)]; + GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)]; }; case 44: { // Z - GVAR(camBoom) = -0.5 * GVAR(camSpeed); + GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift); }; case 49: { // N - if (_ctrl) then { - [nil,nil,-1] call FUNC(cycleCamera); - } else { - [nil,nil,1] call FUNC(cycleCamera); + if (GVAR(camMode) == 0) then { + if (_ctrl) then { + [nil,nil,-1] call FUNC(cycleCamera); + } else { + [nil,nil,1] call FUNC(cycleCamera); + }; }; }; case 50: { // M diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 30af5d1aa6..b174608d03 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -181,6 +181,9 @@ Speed +/- Prędkość +/- + + Speed Boost + Next Vision Mode Następny tryb wizji From 57bda372f0f221f049ecbeebf9d9f0d2ff88ae15 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Aug 2015 19:00:31 +0100 Subject: [PATCH 057/239] Adjust spectator free camera speed with zoom --- addons/spectator/functions/fnc_handleCamera.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf index 7f53b59009..1d1d5bef9e 100644 --- a/addons/spectator/functions/fnc_handleCamera.sqf +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -23,9 +23,9 @@ if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerF private ["_oldPos","_mX","_mY","_mZ","_pan","_x","_y","_z"]; _oldPos = getPosASL GVAR(camera); -_mX = GVAR(camDolly) select 0; -_mY = GVAR(camDolly) select 1; -_mZ = GVAR(camBoom); +_mX = (GVAR(camDolly) select 0) / ((GVAR(camZoom) * 0.8) max 1); +_mY = (GVAR(camDolly) select 1) / ((GVAR(camZoom) * 0.8) max 1); +_mZ = GVAR(camBoom) / ((GVAR(camZoom) * 0.8) max 1); _pan = (GVAR(camPan) + 360) % 360; _x = (_oldPos select 0) + (_mX * cos(_pan)) + (_mY * sin(_pan)); From 2b56b919dba3c1d3daf1b47599756f64b4bf2985 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sat, 8 Aug 2015 11:28:08 +0200 Subject: [PATCH 058/239] Fixed missing private in Switchunits --- addons/switchunits/functions/fnc_switchUnit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index 2079982fc0..ca1c054032 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; +private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave", "_fnc_pfhSwitchUnit"]; params ["_unit"]; From e59f0ce822ab64c8a8fd6c330341e16113437282 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 12:24:49 +0100 Subject: [PATCH 059/239] Fix spectator respawn template for types 0 and 1 Type 0 worked, but the mission didn't end when all players were killed. Type 1 didn't work because isPlayer isn't true for seagulls. So spectator virtual state is now entirely unassociated from objects in the game. --- .../functions/fnc_handleInterface.sqf | 2 +- .../functions/fnc_respawnTemplate.sqf | 11 +++++--- .../spectator/functions/fnc_setSpectator.sqf | 26 +++++++------------ .../functions/fnc_stageSpectator.sqf | 9 +++---- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 80d87cf40a..d06c19bd38 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -80,7 +80,7 @@ switch (toLower _mode) do { clearRadio; // Return to player view - _unit switchCamera "internal"; + player switchCamera "internal"; // Enable BI damage effects BIS_fnc_feedback_allowPP = true; diff --git a/addons/spectator/functions/fnc_respawnTemplate.sqf b/addons/spectator/functions/fnc_respawnTemplate.sqf index b03c6dfb06..b808c43eab 100644 --- a/addons/spectator/functions/fnc_respawnTemplate.sqf +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -21,6 +21,11 @@ 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]; @@ -29,11 +34,11 @@ if (alive _unit) then { if (_respawn == 1) then { [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); + [true] call FUNC(setSpectator); } else { - [_unit,false] call FUNC(setSpectator); + [false] call FUNC(setSpectator); }; } else { [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); - [_unit] call FUNC(setSpectator); + [true] call FUNC(setSpectator); }; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 2d5ada415c..4f41e073d7 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -1,48 +1,42 @@ /* * Author: SilentSpike - * Sets target player to the given spectator state (virtually) + * Sets local client to the given spectator state (virtually) * To physically handle a spectator see ace_spectator_fnc_stageSpectator * - * Player will be able to communicate in ACRE/TFAR as appropriate + * Client will be able to communicate in ACRE/TFAR as appropriate * The spectator interface will be opened/closed * * Arguments: - * 0: Unit to put into spectator state - * 1: Spectator state + * 0: Spectator state of local client * * Return Value: * None * * Example: - * [player, true] call ace_spectator_fnc_setSpectator + * [true] call ace_spectator_fnc_setSpectator * * Public: Yes */ #include "script_component.hpp" -params ["_unit", ["_set",true,[true]]]; +params [["_set",true,[true]]]; -// Only run for player units -if !(isPlayer _unit) exitWith {}; - -if !(local _unit) exitwith { - [[_unit, _set], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc); -}; +// Only clients can be spectators +if !(hasInterface) 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 {[_unit, _set] call TFAR_fnc_forceSpectator}; +if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator}; if (_set) then { ["open"] call FUNC(handleInterface); } else { - ["close",_unit] call FUNC(handleInterface); + ["close"] call FUNC(handleInterface); }; // Mark spectator state for reference -_unit setVariable [QGVAR(isSet), _set, true]; GVAR(isSet) = _set; -["spectatorSet",[_set,_unit]] call EFUNC(common,localEvent); +["spectatorSet",[_set]] call EFUNC(common,localEvent); diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 3e17235e3e..7f0d862719 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -7,7 +7,7 @@ * Upon unstage, units will be moved to the position they were in upon staging * * Arguments: - * 0: Unit to put into spectator stage + * 0: Unit to put into spectator stage * 1: Spectator stage * * Return Value: @@ -21,19 +21,16 @@ #include "script_component.hpp" -params ["_unit", ["_set",true,[true]]]; +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 {}; -// Only run for player units -if !(isPlayer _unit) exitWith {}; - if !(local _unit) exitwith { [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); }; -// Prevent player falling into water +// Prevent unit falling into water _unit enableSimulation !_set; // Move to/from group as appropriate From 9c29ff0c57e4d97107604cbcd74e15932453f809 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sat, 8 Aug 2015 13:34:35 +0200 Subject: [PATCH 060/239] Inlined PFHs in Switchunits --- addons/switchunits/functions/fnc_markAiOnMap.sqf | 6 ++---- addons/switchunits/functions/fnc_switchBack.sqf | 6 ++---- addons/switchunits/functions/fnc_switchUnit.sqf | 8 +++----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index 011768845a..db43c58f43 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -20,7 +20,7 @@ params ["_sidesToShow"]; GVAR(AllMarkerNames) = []; -_fnc_pfhMarkAiOnMap = { +[{ params ["_args"]; _args params ["_sides"]; @@ -63,6 +63,4 @@ _fnc_pfhMarkAiOnMap = { }; } count allUnits; }; -}; - -[_fnc_pfhMarkAiOnMap, 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; +}, 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index 3ebf49a3ab..c3cb99588a 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -20,7 +20,7 @@ params ["_originalPlayerUnit"]; [_originalPlayerUnit] joinSilent GVAR(OriginalGroup); -_fnc_pfhSwitchBack = { +[{ params ["_args", "_pfhId"]; _args params ["_originalPlayerUnit", "_currentUnit"]; @@ -34,6 +34,4 @@ _fnc_pfhSwitchBack = { [_pfhId] call cba_fnc_removePerFrameHandler; }; -}; - -[_fnc_pfhSwitchBack, 0.2, _this] call CBA_fnc_addPerFrameHandler; +}, 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index ca1c054032..793e72bb71 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave", "_fnc_pfhSwitchUnit"]; +private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; params ["_unit"]; @@ -44,7 +44,7 @@ if (_leave) exitWith { //[_unit] joinSilent group player; [[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); -_fnc_pfhSwitchUnit = { +[{ private ["_respawnEhId", "_oldOwner"]; params ["_args", "_pfhId"]; _args params ["_unit", "_oldUnit"]; @@ -78,6 +78,4 @@ _fnc_pfhSwitchUnit = { [_pfhId] call cba_fnc_removePerFrameHandler; }; -}; - -[_fnc_pfhSwitchUnit, 0.2, [_unit, player]] call CBA_fnc_addPerFrameHandler; +}, 0.2, [_unit, player]] call CBA_fnc_addPerFrameHandler; From 5b881224c5a231c35fb96d79183f240265915e89 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 13:19:07 +0100 Subject: [PATCH 061/239] Allow admins to use chat in the spectator UI --- addons/spectator/functions/fnc_handleInterface.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index d06c19bd38..21d6266fba 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -238,6 +238,9 @@ switch (toLower _mode) do { if ((alive player) && {_dik in (actionKeys "curatorInterface")} && {!isNull (getAssignedCuratorLogic player)}) exitWith { ["zeus", [_display]] call FUNC(handleInterface); }; + if ((isServer || {serverCommandAvailable "#kick"}) && {_dik in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) exitWith { + false + }; // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; From be7b156c49170da938b120cd16d45ec7c6daa245 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 15:49:07 +0100 Subject: [PATCH 062/239] Add "focus on unit" to spectator free camera Pressing F will move the free camera to a position viewing the unit currently selected in the list. Fixes map teleporting functionality also. --- addons/spectator/UI/interface.hpp | 23 ++++++++-------- .../functions/fnc_handleInterface.sqf | 26 +++++++++++++++++-- .../functions/fnc_setCameraAttributes.sqf | 9 ++++--- .../functions/fnc_transitionCamera.sqf | 3 +-- addons/spectator/stringtable.xml | 3 +++ 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index a7790d6da0..e8bc6c210f 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -155,7 +155,7 @@ class GVAR(interface) { }; }; }; - class unitTree: RscControlsGroupNoScrollbars { + class unitWindow: RscControlsGroupNoScrollbars { idc = IDC_UNIT; x = safeZoneX; y = safeZoneY + TOOL_H * 6; @@ -191,6 +191,7 @@ class GVAR(interface) { }; 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; @@ -202,16 +203,6 @@ class GVAR(interface) { }; }; }; - 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)); - }; class helpWindow: RscControlsGroupNoScrollbars { idc = IDC_HELP; x = safeZoneX + safeZoneW - TOOL_W * 2; @@ -250,5 +241,15 @@ class GVAR(interface) { }; }; }; + 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/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 21d6266fba..eda24dccf6 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -35,6 +35,7 @@ switch (toLower _mode) do { GVAR(heldKeys) = []; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; // Initalize the camera view GVAR(camera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); @@ -96,6 +97,7 @@ switch (toLower _mode) do { GVAR(heldKeys) = nil; GVAR(mouse) = nil; GVAR(mousePos) = nil; + GVAR(treeSel) = nil; // Reset nametag settings if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { @@ -146,11 +148,12 @@ switch (toLower _mode) do { [localize LSTRING(freeCamDown),"Z"], [localize LSTRING(freeCamPan),"RMB (Hold)"], [localize LSTRING(freeCamDolly),"LMB (Hold)"], + [localize LSTRING(freeCamFocus),"F"], + [localize LSTRING(freeCamNextVis),"N"], + [localize LSTRING(freeCamPrevVis),"Ctrl + N"], [localize LSTRING(freeCamZoom),"Scrollwheel"], [localize LSTRING(freeCamSpeed),"Ctrl + Scrollwheel"], [localize LSTRING(freeCamBoost),"Shift (Hold)"], - [localize LSTRING(freeCamNextVis),"N"], - [localize LSTRING(freeCamPrevVis),"Ctrl + N"], [localize LSTRING(otherControls),""], [localize LSTRING(nextCam),"Up Arrow"], [localize LSTRING(prevCam),"Down Arrow"], @@ -289,6 +292,14 @@ switch (toLower _mode) do { 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); }; @@ -374,6 +385,15 @@ switch (toLower _mode) do { [_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"]; @@ -485,6 +505,7 @@ switch (toLower _mode) do { GVAR(heldKeys) = []; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); @@ -538,6 +559,7 @@ switch (toLower _mode) do { GVAR(heldKeys) = []; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; openCuratorInterface; diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf index 278a8c4758..8eb6fe51ac 100644 --- a/addons/spectator/functions/fnc_setCameraAttributes.sqf +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -51,7 +51,6 @@ if !(_vision in GVAR(availableVisions)) then { }; GVAR(camPan) = _heading % 360; -GVAR(camPos) = (ATLtoASL _position); GVAR(camSpeed) = (_speed max 0.05) min 10; GVAR(camTilt) = (_tilt max -89) min 89; GVAR(camUnit) = _unit; @@ -59,8 +58,10 @@ GVAR(camVision) = _vision; GVAR(camZoom) = (_zoom min 2) max 0.01; // Apply if camera exists -if !(isNil QGVAR(camera)) then { - [_mode,_unit,_vision] call FUNC(transitionCamera); -} else { +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_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index b35b61b311..72cb9f1a45 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -53,8 +53,7 @@ if (_newMode == 0) then { // Free 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 - // However, map click events don't fire in free cam for some reason... + // 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,""]; diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index b174608d03..c4b9b6b631 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -184,6 +184,9 @@ Speed Boost + + Focus on Unit + Next Vision Mode Następny tryb wizji From d7730103c98c0cf5d677abeb42128de29e375aaf Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 17:22:04 +0100 Subject: [PATCH 063/239] Update ace_spectator readme --- addons/spectator/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/spectator/README.md b/addons/spectator/README.md index b3e586149b..b827bdcc49 100644 --- a/addons/spectator/README.md +++ b/addons/spectator/README.md @@ -1,7 +1,11 @@ ace_spectator ======= -Spectator. Includes features from Splendid Cam, and much more. +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 From 213deeffb405ac85138bd8376b25274922b6af02 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 18:31:37 +0100 Subject: [PATCH 064/239] Add keys to adjust spectator camera speed and zoom Allows for finer control of the speed and zoom, as well as a quick way to reset either. --- addons/spectator/XEH_preInit.sqf | 2 +- .../functions/fnc_handleInterface.sqf | 40 ++++++++++---- addons/spectator/stringtable.xml | 53 +++++++++++-------- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 2c29598ebc..a40f4a0dcb 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -33,7 +33,7 @@ GVAR(camAgent) = objNull; GVAR(camMode) = 0; GVAR(camPan) = 0; GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20]; -GVAR(camSpeed) = 1; +GVAR(camSpeed) = 2.5; GVAR(camTilt) = -10; GVAR(camUnit) = objNull; GVAR(camVision) = -2; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index eda24dccf6..80ee564ab5 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -148,17 +148,21 @@ switch (toLower _mode) do { [localize LSTRING(freeCamDown),"Z"], [localize LSTRING(freeCamPan),"RMB (Hold)"], [localize LSTRING(freeCamDolly),"LMB (Hold)"], - [localize LSTRING(freeCamFocus),"F"], - [localize LSTRING(freeCamNextVis),"N"], - [localize LSTRING(freeCamPrevVis),"Ctrl + N"], - [localize LSTRING(freeCamZoom),"Scrollwheel"], - [localize LSTRING(freeCamSpeed),"Ctrl + Scrollwheel"], [localize LSTRING(freeCamBoost),"Shift (Hold)"], - [localize LSTRING(otherControls),""], + [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(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 @@ -247,8 +251,8 @@ switch (toLower _mode) do { // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; - // Exclude movement keys so that speed can be adjusted on fly - if !(_dik in [16,17,30,31,32,44]) then { + // 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) pushBack _dik; }; @@ -295,7 +299,7 @@ switch (toLower _mode) do { case 33: { // F private ["_sel","_vector"]; _sel = GVAR(treeSel); - if !((GVAR(camMode) == 0) && {isNull _sel} && {_sel in GVAR(unitList)}) then { + 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); }; @@ -318,6 +322,22 @@ switch (toLower _mode) do { 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); }; diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index c4b9b6b631..895a279844 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -134,8 +134,7 @@ - Free Camera Controls - Wolne sterowanie kamerą + Free Camera Camera Forward @@ -173,31 +172,14 @@ Lock Camera to Target Zablokuj kamerę na celu - - Zoom +/- - Zoom +/- - - - Speed +/- - Prędkość +/- - Speed Boost Focus on Unit - - Next Vision Mode - Następny tryb wizji - - - Previous Vision Mode - Poprzedni tryb wizji - - Interface Controls - Sterowanie interfejsem + Interface Toggle Interface @@ -227,9 +209,8 @@ Toggle Help Przełącz pomoc - - Other Controls - Pozostałe sterowanie + + Camera Attributes Next Camera @@ -247,5 +228,31 @@ Previous Unit Poprzednia jednostka + + Next Vision Mode + Następny tryb wizji + + + Previous Vision Mode + Poprzedni tryb wizji + + + Adjust Zoom + + + Adjust Speed + + + Increment Zoom + + + Increment Speed + + + Reset Zoom + + + Reset Speed + From 182eef39de65cc53d413df36db6b7286bca20c68 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 18:41:38 +0100 Subject: [PATCH 065/239] Adjust spectator camera pan and tilt with zoom --- addons/spectator/functions/fnc_handleCamera.sqf | 11 +++++++---- addons/spectator/functions/fnc_handleMouse.sqf | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf index 1d1d5bef9e..960a20df80 100644 --- a/addons/spectator/functions/fnc_handleCamera.sqf +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -20,12 +20,15 @@ // Kill PFH when not in free cam (or display is closed) if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; -private ["_oldPos","_mX","_mY","_mZ","_pan","_x","_y","_z"]; +private ["_oldPos","_zoomMod","_mX","_mY","_mZ","_pan","_x","_y","_z"]; _oldPos = getPosASL GVAR(camera); -_mX = (GVAR(camDolly) select 0) / ((GVAR(camZoom) * 0.8) max 1); -_mY = (GVAR(camDolly) select 1) / ((GVAR(camZoom) * 0.8) max 1); -_mZ = GVAR(camBoom) / ((GVAR(camZoom) * 0.8) max 1); + +// Dolly/Boom amount should be influnced by zoom level (it should really be exponential) +_zoomMod = (GVAR(camZoom) * 0.8) max 1; +_mX = (GVAR(camDolly) select 0) / _zoomMod; +_mY = (GVAR(camDolly) select 1) / _zoomMod; +_mZ = GVAR(camBoom) / _zoomMod; _pan = (GVAR(camPan) + 360) % 360; _x = (_oldPos select 0) + (_mX * cos(_pan)) + (_mY * sin(_pan)); diff --git a/addons/spectator/functions/fnc_handleMouse.sqf b/addons/spectator/functions/fnc_handleMouse.sqf index 8158ba95b5..1c2b62798c 100644 --- a/addons/spectator/functions/fnc_handleMouse.sqf +++ b/addons/spectator/functions/fnc_handleMouse.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" params ["_x","_y"]; -private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY"]; +private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY","_zoomMod"]; _leftButton = GVAR(mouse) select 0; _rightButton = GVAR(mouse) select 1; @@ -35,8 +35,11 @@ if (_leftButton) then { GVAR(camDolly) set [1, _deltaY * 100 * GVAR(camSpeed)]; } else { if (_rightButton) then { - GVAR(camPan) = GVAR(camPan) - (_deltaX * 360); - GVAR(camTilt) = ((GVAR(camTilt) + (_deltaY * 180)) min 89) max -89; + // 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; }; }; From d294989cb06f04bc941a6f40ea4de123328f7920 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 19:08:27 +0100 Subject: [PATCH 066/239] Allow chat use on input disabled listen server Listen server technically doesn't have serverCommandAvailable. --- addons/common/functions/fnc_disableUserInput.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 520e4131b2..d9485b11e7 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -84,7 +84,7 @@ if (_state) then { openMap true; }; - if (serverCommandAvailable "#missions" || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then { + if (isServer || {serverCommandAvailable "#kick"} || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then { if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then { _key = 0; }; From a6acff9178bf2a6072d9a67673ca623ccdd2c092 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 8 Aug 2015 14:40:19 -0500 Subject: [PATCH 067/239] Setting to disable hearing for zeus RC --- addons/hearing/ACE_Settings.hpp | 6 ++++++ addons/hearing/CfgVehicles.hpp | 6 ++++++ addons/hearing/functions/fnc_earRinging.sqf | 1 + addons/hearing/functions/fnc_moduleHearing.sqf | 2 ++ addons/hearing/stringtable.xml | 8 +++++++- 5 files changed, 22 insertions(+), 1 deletion(-) 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/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 6ec0af0231..fed6335c07 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -21,4 +21,6 @@ if ((_logic getVariable "DisableEarRinging") != -1) then { [_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule); }; +[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule); + diag_log text "[ACE]: 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 From 416d559354971a0482f744b169a2de982006665a Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 8 Aug 2015 20:51:24 +0100 Subject: [PATCH 068/239] Expand common isFeatureCameraActive function The function is currently only used by ace_goggles and it makes sense to expand it to detect if any common feature camera is active rather than just BI cameras --- .../functions/fnc_isFeatureCameraActive.sqf | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/addons/common/functions/fnc_isFeatureCameraActive.sqf b/addons/common/functions/fnc_isFeatureCameraActive.sqf index 250beaa3ca..0b91b19e55 100644 --- a/addons/common/functions/fnc_isFeatureCameraActive.sqf +++ b/addons/common/functions/fnc_isFeatureCameraActive.sqf @@ -1,31 +1,35 @@ /* * Author: Sniperwolf572 + * Checks if one of the following common feature cameras is active: * - * Checks if one of the following BI feature cameras are active: - * - * - Classic camera (BIS_fnc_cameraOld) - * - Splendid camera (BIS_fnc_camera) + * - Curator + * - ACE Spectator * - Arsenal camera (BIS_fnc_arsenal) - * - Animation viewer (BIS_fnc_animViewer) * - Establishing shot (BIS_fnc_establishingShot) + * - Splendid camera (BIS_fnc_camera) + * - Animation viewer (BIS_fnc_animViewer) + * - Classic camera (BIS_fnc_cameraOld) * * Arguments: - * None + * 0: None * - * Return value: - * Is BI feature camera active (bool) + * Return Value: + * A feature camera is active * * Example: - * call ace_common_fnc_isFeatureCameraActive; + * [] call ace_common_fnc_isFeatureCameraActive * + * Public: No */ #include "script_component.hpp" -( - !isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera - {!isNull (missionNamespace getVariable ["BIS_fnc_camera_cam", objNull])} || // Splendid camera - {!isNull (uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull])} || // Arsenal camera - {!isNull (uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull])} || // Animation viewer camera - {!isNull (missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull])} // Establishing shot camera -) \ No newline at end of file +!( + isNull curatorCamera && // Curator + {isNull (GETMVAR(EGVAR(spectator,camera),objNull))} && // ACE Spectator + {isNull (GETUVAR(BIS_fnc_arsenal_cam, objNull))} && // Arsenal camera + {isNull (GETMVAR(BIS_fnc_establishingShot_fakeUAV, objNull))} && // Establishing shot camera + {isNull (GETMVAR(BIS_fnc_camera_cam, objNull))} && // Splendid camera + {isNull (GETUVAR(BIS_fnc_animViewer_cam, objNull))} && // Animation viewer camera + {isNull (GETMVAR(BIS_DEBUG_CAM, objNull))} // Classic camera +) From 3cac137851b1fb684d974c0c974bbc0e72a7b608 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 9 Aug 2015 09:14:42 +0200 Subject: [PATCH 069/239] Fixed #1893 - Menu closes when patient is more as 10 meters away --- addons/medical/functions/fnc_displayPatientInformation.sqf | 6 ++++++ addons/medical/stringtable.xml | 3 +++ addons/medical_menu/functions/fnc_onMenuOpen.sqf | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index cd61550152..e181328318 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -13,6 +13,7 @@ */ #include "script_component.hpp" +#define MAX_DISTANCE 10 // Exit for basic medical if (GVAR(level) < 2) exitWith {}; @@ -39,6 +40,11 @@ if (_show) then { if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + if (ACE_player distance _target > MAX_DISTANCE) exitwith { + ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; + [_this select 1] call CBA_fnc_removePerFrameHandler; + ["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); + }; disableSerialization; _display = uiNamespace getvariable QGVAR(DisplayInformation); diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index b852c27f96..63bd431f95 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -3609,5 +3609,8 @@ Médico Orvosi + + Distance to %1 has become to far for treatment + diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 52a957ae93..9c4d1865fa 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -14,6 +14,7 @@ * Public: No */ #include "script_component.hpp" +#define MAX_DISTANCE 10 private "_target"; @@ -72,6 +73,12 @@ setMousePosition [0.4, 0.4]; _status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus); (_display displayCtrl 2000) ctrlSetText (_status select 0); (_display displayCtrl 2000) ctrlSetBackgroundColor (_status select 2); + + if (ACE_player distance _target > MAX_DISTANCE) exitwith { + closeDialog 314412; + ["displayTextStructured", [ACE_player], [[ELSTRING(medical,DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); + }; + }, [_display]] call BIS_fnc_addStackedEventHandler; ["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call EFUNC(common,localEvent); From 323832474fc94d271a86ee750758184b4b20d5a1 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 9 Aug 2015 14:53:13 +0200 Subject: [PATCH 070/239] Code cleanup of Dragging module --- addons/dragging/XEH_clientInit.sqf | 8 +- addons/dragging/XEH_serverInit.sqf | 2 +- addons/dragging/functions/fnc_canCarry.sqf | 18 ++-- addons/dragging/functions/fnc_canDrag.sqf | 14 ++-- addons/dragging/functions/fnc_canDrop.sqf | 17 ++-- .../dragging/functions/fnc_canDrop_carry.sqf | 17 ++-- addons/dragging/functions/fnc_carryObject.sqf | 17 ++-- .../dragging/functions/fnc_carryObjectPFH.sqf | 23 +++-- addons/dragging/functions/fnc_dragObject.sqf | 24 +++--- .../dragging/functions/fnc_dragObjectPFH.sqf | 24 ++++-- addons/dragging/functions/fnc_dropObject.sqf | 17 ++-- .../functions/fnc_dropObject_carry.sqf | 17 ++-- addons/dragging/functions/fnc_getWeight.sqf | 83 +++++++++---------- .../functions/fnc_handleAnimChanged.sqf | 18 +++- .../dragging/functions/fnc_handleKilled.sqf | 21 ++++- .../functions/fnc_handlePlayerChanged.sqf | 23 +++-- .../fnc_handlePlayerWeaponChanged.sqf | 23 +++-- .../functions/fnc_handleScrollWheel.sqf | 20 ++--- .../functions/fnc_handleUnconscious.sqf | 25 ++++-- addons/dragging/functions/fnc_initObject.sqf | 19 ++--- addons/dragging/functions/fnc_initPerson.sqf | 10 +-- .../functions/fnc_isObjectOnObject.sqf | 18 +++- .../dragging/functions/fnc_setCarryable.sqf | 26 +++--- .../dragging/functions/fnc_setDraggable.sqf | 16 ++-- addons/dragging/functions/fnc_startCarry.sqf | 19 ++--- .../dragging/functions/fnc_startCarryPFH.sqf | 31 ++++--- addons/dragging/functions/fnc_startDrag.sqf | 11 +-- .../dragging/functions/fnc_startDragPFH.sqf | 29 ++++--- 28 files changed, 335 insertions(+), 255 deletions(-) diff --git a/addons/dragging/XEH_clientInit.sqf b/addons/dragging/XEH_clientInit.sqf index 21d699c688..e80d63cfde 100644 --- a/addons/dragging/XEH_clientInit.sqf +++ b/addons/dragging/XEH_clientInit.sqf @@ -1,7 +1,7 @@ // by PabstMirror, commy2 #include "script_component.hpp" -[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); +[DFUNC(handleScrollWheel)] call EFUNC(common,addScrollWheelEventHandler); if (isNil "ACE_maxWeightDrag") then { ACE_maxWeightDrag = 800; @@ -15,11 +15,11 @@ if (isNil "ACE_maxWeightCarry") then { ["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); // release object on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerChanged", DFUNC(handlePlayerChanged)] call EFUNC(common,addEventhandler); ["playerVehicleChanged", {[ACE_player, objNull] call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler); +["playerWeaponChanged", DFUNC(handlePlayerWeaponChanged)] call EFUNC(common,addEventhandler); // handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", {_this call DFUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["medical_onUnconscious", DFUNC(handleUnconscious)] call EFUNC(common,addEventhandler); //@todo Captivity? diff --git a/addons/dragging/XEH_serverInit.sqf b/addons/dragging/XEH_serverInit.sqf index f6c231d275..01d78ef4e3 100644 --- a/addons/dragging/XEH_serverInit.sqf +++ b/addons/dragging/XEH_serverInit.sqf @@ -2,4 +2,4 @@ #include "script_component.hpp" // release object on hard disconnection. Function is identical to killed -addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}]; +addMissionEventHandler ["HandleDisconnect", DFUNC(handleKilled)]; diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 6472124aef..0e44e3b860 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -3,19 +3,19 @@ * * Check if unit can carry the object. Doesn't check weight. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * Can the unit carry the object? (Bool) + * Return Value: + * Can the unit carry the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +private +params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 7eedfce179..4ab3562ba2 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -3,12 +3,14 @@ * * Check if unit can drag the object. Doesn't check weight. * - * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * Arguments: + * 0: Unit that should do the dragging + * 1: Object to drag * - * Return value: - * Can the unit drag the object? (Bool) + * Return Value: + * Can the unit drag the object? + * + * Public: No */ #include "script_component.hpp" @@ -22,4 +24,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; // a static weapon has to be empty for dragging if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; -alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; \ No newline at end of file +alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; diff --git a/addons/dragging/functions/fnc_canDrop.sqf b/addons/dragging/functions/fnc_canDrop.sqf index df75b9540f..58c02cab07 100644 --- a/addons/dragging/functions/fnc_canDrop.sqf +++ b/addons/dragging/functions/fnc_canDrop.sqf @@ -3,19 +3,18 @@ * * Check if unit can drop the object. * - * Argument: - * 0: Unit that currently drags a object (Object) - * 1: Object that is dragged (Object) + * Arguments: + * 0: Unit that currently drags a object + * 1: Object that is dragged * - * Return value: - * Can the unit drop the object? (Bool) + * Return Value: + * Can the unit drop the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_canDrop_carry.sqf b/addons/dragging/functions/fnc_canDrop_carry.sqf index 9efbbe9b0f..430b12c642 100644 --- a/addons/dragging/functions/fnc_canDrop_carry.sqf +++ b/addons/dragging/functions/fnc_canDrop_carry.sqf @@ -3,19 +3,18 @@ * * Check if unit can drop the carried object. * - * Argument: - * 0: Unit that currently carries a object (Object) - * 1: Object that is carried (Object) + * Arguments: + * 0: Unit that currently carries a object + * 1: Object that is carried * - * Return value: - * Can the unit drop the object? (Bool) + * Return Value: + * Can the unit drop the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index bb413d8240..7f70b2bdc5 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -3,19 +3,18 @@ * * Carry an object. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // get attachTo offset and direction. private ["_position", "_direction"]; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 3ad1f89f77..3c28c9737b 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,4 +1,16 @@ -// by commy2 +/* + * Author: commy2 + * + * PFH for Crarry Object + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING @@ -6,16 +18,15 @@ #endif private ["_unit", "_target"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; +params ["_args", "_idPFH"]; +_args params ["_unit","_target"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { [_unit, _target] call FUNC(dropObject_carry); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index e4b200c4dd..65fa277403 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -3,28 +3,25 @@ * * Drag an object. Called from ace_dragging_fnc_startDrag * - * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * Arguments: + * 0: Unit that should do the dragging + * 1: Object to drag * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +private ["_position", "_direction", "_offset", "_actionID"]; +params ["_unit", "_target"]; // get attachTo offset and direction. -private ["_position", "_direction"]; - _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; _direction = _target getVariable [QGVAR(dragDirection), 0]; // add height offset of model -private "_offset"; _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); _position = _position vectorAdd [0, 0, _offset]; @@ -41,7 +38,6 @@ _unit setVariable [QGVAR(isDragging), true, true]; _unit setVariable [QGVAR(draggedObject), _target, true]; // add scrollwheel action to release object -private "_actionID"; _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { @@ -50,7 +46,7 @@ if (_actionID != -1) then { _actionID = _unit addAction [ format ["%1", localize LSTRING(Drop)], - QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)), + QUOTE(param ['_unit']; [ARR_2('_unit', ('_unit') getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)), nil, 20, false, diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index 465107af39..dea8897b27 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -1,21 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * + * PFH for Drag Object + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 dragObjectPFH running", ACE_time]; #endif -private ["_unit", "_target"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 9589457dbe..2ae07be091 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -3,19 +3,18 @@ * * Drop a dragged object. * - * Argument: - * 0: Unit that drags the other object (Object) - * 1: Dragged object to drop (Object) + * Arguments: + * 0: Unit that drags the other object + * 1: Dragged object to drop * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // remove scroll wheel action _unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index b6dfe9fc45..86009ac867 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -3,19 +3,18 @@ * * Drop a carried object. * - * Argument: - * 0: Unit that carries the other object (Object) - * 1: Carried object to drop (Object) + * Arguments: + * 0: Unit that carries the other object + * 1: Carried object to drop * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // remove scroll wheel action _unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); diff --git a/addons/dragging/functions/fnc_getWeight.sqf b/addons/dragging/functions/fnc_getWeight.sqf index 871c49db89..d6e1b65ba5 100644 --- a/addons/dragging/functions/fnc_getWeight.sqf +++ b/addons/dragging/functions/fnc_getWeight.sqf @@ -1,54 +1,45 @@ /* - Name: AGM_Drag_fnc_GetWeight - - Author(s): - L-H, edited by commy2 - - Description: - Returns the weight of a crate. - - Parameters: - 0: OBJECT - Crate to get weight of - - Returns: - NUMBER - Weight - - Example: - _weight = Crate1 call AGM_Drag_fnc_GetWeight; + * Author: L-H, edited by commy2, rewritten by joko // Jonas + * + * Returns the weight of a crate. + * + * Arguments: + * Crate to get weight of + * + * Return Value: + * Total Weight + * + * Example: + * _weight = Crate1 call ace_dragging_fnc_getweight; + * + * Public: No */ #include "script_component.hpp" -private "_object"; +private "_totalWeight"; -_object = _this select 0; - -private ["_totalWeight", "_fnc","_fnc_Extra"]; +// Initialize the total weight. _totalWeight = 0; -_fnc_Extra = { - private ["_weight", "_items"]; - _items = _this select 0; - _weight = 0; - { - _weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> (_this select 2) >> "mass") * ((_items select 1) select _foreachIndex)); - } foreach (_items select 0); - - _weight -}; -_fnc = { - private ["_weight", "_items"]; - _items = _this select 0; - _weight = 0; - { - _weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> "mass") * ((_items select 1) select _foreachIndex)); - } foreach (_items select 0); - - _weight -}; -_totalWeight = ([getMagazineCargo _object, "CfgMagazines"] call _fnc); -_totalWeight = _totalWeight + ([getItemCargo _object, "CfgWeapons", "ItemInfo"] call _fnc_Extra); -_totalWeight = _totalWeight + ([getWeaponCargo _object, "CfgWeapons", "WeaponSlotsInfo"] call _fnc_Extra); -_totalWeight = _totalWeight + ([getBackpackCargo _object, "CfgVehicles"] call _fnc); -_totalWeight = _totalWeight * 0.5; // Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of). +// Cycle through all item types with their assigned config paths. +{ + _x params["_items","_getConfigCode"]; + _items params ["_item", "_count"] + // Cycle through all items and read their mass out of the config. + { + // Multiply mass with amount of items and add the mass to the total weight. + _totalWeight = _totalWeight + (getNumber ((call _getConfigCode) >> "mass") * (_count select _forEachIndex)); + } forEach _item; + true +} count [ + [getMagazineCargo _this, {configFile >> "CfgMagazines" >> _x}], + [getBackpackCargo _this, {configFile >> "CfgVehicles" >> _x}], + [getItemCargo _this, {configFile >> "CfgWeapons" >> _x >> "ItemInfo"}], + [getWeaponCargo _this, {configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo"}] +]; -_totalWeight +// add Weight of create to totalWeight +_totalWeight = _totalWeight + (getNumber (configFile >> "CfgVehicles" >> _this >> "mass")); + +// Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of). +_totalWeight * 0.5 diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index 14b2eff611..2c3a654842 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -1,4 +1,20 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Animaion for a Unit for Dragging Module + * + * Arguments: + * 0: Unit + * 1: Animaion + * + * Return Value: + * None + * + * Example: + * [_unit, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged; + * + * Public: No +*/ #include "script_component.hpp" private ["_unit", "_anim"]; diff --git a/addons/dragging/functions/fnc_handleKilled.sqf b/addons/dragging/functions/fnc_handleKilled.sqf index 4dcfc77fcd..a7d9c5eb8f 100644 --- a/addons/dragging/functions/fnc_handleKilled.sqf +++ b/addons/dragging/functions/fnc_handleKilled.sqf @@ -1,9 +1,22 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Kill of the Dragger + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [_unit] call ace_dragging_fnc_handleKilled; + * + * Public: No +*/ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; if (_unit getVariable [QGVAR(isDragging), false]) then { private "_draggedObject"; diff --git a/addons/dragging/functions/fnc_handlePlayerChanged.sqf b/addons/dragging/functions/fnc_handlePlayerChanged.sqf index e2dd41021b..4ea46749bb 100644 --- a/addons/dragging/functions/fnc_handlePlayerChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerChanged.sqf @@ -1,10 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Event if player is Changed + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Example: + * [_unitNew, _unitOld] call ace_dragging_fnc_handlePlayerChanged; + * + * Public: No +*/ #include "script_component.hpp" -private ["_newPlayer", "_oldPlayer"]; - -_newPlayer = _this select 0; -_oldPlayer = _this select 1; +params ["_newPlayer", "_oldPlayer"]; { if (_x getVariable [QGVAR(isDragging), false]) then { diff --git a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf index a7f9be7681..e0f1b2a8e4 100644 --- a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf @@ -1,10 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Weapon Changed Event + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + * [_unit, _currentWeapon] call ace_dragging_fnc_handlePlayerWeaponChanged; + * + * Public: No +*/ #include "script_component.hpp" -private ["_unit", "_weapon"]; - -_unit = _this select 0; -_weapon = _this select 1; +params ["_unit", "_weapon"]; if (_unit getVariable [QGVAR(isDragging), false]) then { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 96f46413bc..ac3941a79e 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -3,38 +3,38 @@ * * Handles raising and lowering the dragged weapon to be able to place it on top of objects. * - * Argument: - * 0: Scroll amount (Number) + * Arguments: + * 0: Scroll amount * - * Return value: - * Handled or not. (Bool) + * Return Value: + * Handled or not. + * + * Public: No */ #include "script_component.hpp" +private ["_unit", "_carriedItem", "_position", "_maxHeight", ] + +params ["_scrollAmount"]; + // requires modifier key to be hold down if (GETMVAR(ACE_Modifier,0) == 0) exitWith {false}; -private "_unit"; _unit = ACE_player; // EH is always assigned. Exit and don't overwrite input if not carrying if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; -private "_scrollAmount"; -_scrollAmount = _this select 0; // move carried item 15 cm per scroll interval _scrollAmount = _scrollAmount * 0.15; -private "_carriedItem"; _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -private ["_position", "_maxHeight"]; - _position = getPosATL _carriedItem; _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index 31c703f37b..6cdc9d26cf 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -1,17 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Unconscious of a Unit while Dragging + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [_unit] call ace_dragging_fnc_handlePlayerWeaponChanged; + * + * Public: No +*/ #include "script_component.hpp" -private ["_unit", "_isUnconscious"]; +private ["_player", "_draggedObject", "_carriedObject"]; -_unit = _this select 0; -_isUnconscious = _this select 1; +params ["_unit"]; -private "_player"; _player = ACE_player; if (_player getVariable [QGVAR(isDragging), false]) then { - private "_draggedObject"; _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; // handle falling unconscious @@ -28,7 +40,6 @@ if (_player getVariable [QGVAR(isDragging), false]) then { if (_player getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; // handle falling unconscious diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index 65866bd028..37999d4dc5 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -4,32 +4,29 @@ * Initialize variables for drag or carryable objects. Called from init EH. * * Argument: - * 0: Any object (Object) + * 0: Any object * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private "_object"; +private ["_position", "_direction", "config"]; -_object = _this select 0; +params ["_object"]; -private "_config"; _config = configFile >> "CfgVehicles" >> typeOf _object; if (getNumber (_config >> QGVAR(canDrag)) == 1) then { - private ["_position", "_direction"]; - _position = getArray (_config >> QGVAR(dragPosition)); _direction = getNumber (_config >> QGVAR(dragDirection)); [_object, true, _position, _direction] call FUNC(setDraggable); }; -if (getNumber (_config >> QGVAR(canCarry)) == 1) then { - private ["_position", "_direction"]; - +if (getNumber (_config >> QGVAR(canCarry)) == 1) then _position = getArray (_config >> QGVAR(carryPosition)); _direction = getNumber (_config >> QGVAR(carryDirection)); diff --git a/addons/dragging/functions/fnc_initPerson.sqf b/addons/dragging/functions/fnc_initPerson.sqf index 0dc2af1389..c0a951771c 100644 --- a/addons/dragging/functions/fnc_initPerson.sqf +++ b/addons/dragging/functions/fnc_initPerson.sqf @@ -4,16 +4,16 @@ * Initialize variables for drag or carryable persons. Called from init EH. * * Argument: - * 0: Any Unit (Object) + * 0: Unit * * Return value: - * NONE. + * None + * + * Public: No */ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; [_unit, true, [0,1.1,0.092], 180] call FUNC(setDraggable); [_unit, true, [0.4,-0.1,-1.25], 195] call FUNC(setCarryable); // hard-coded selection: "LeftShoulder" diff --git a/addons/dragging/functions/fnc_isObjectOnObject.sqf b/addons/dragging/functions/fnc_isObjectOnObject.sqf index 0a8624820e..e8ab5f307a 100644 --- a/addons/dragging/functions/fnc_isObjectOnObject.sqf +++ b/addons/dragging/functions/fnc_isObjectOnObject.sqf @@ -1,6 +1,16 @@ -// by commy2 - -private "_object"; -_object = _this select 0; +/* + * Author: commy2 + * + * Check if Object is Overlapping + * + * Argument: + * 0: Object + * + * Return value: + * + * + * Public: No + */ +params ["_object"]; (getPosATL _object select 2) - (getPos _object select 2) > 1E-5 diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 52c6e5643a..6bf05e5fde 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -4,25 +4,21 @@ * Enable the object to be carried. * * Argument: - * 0: Any object (Object) - * 1: true to enable carrying, false to disable (Bool) - * 2: Position offset for attachTo command (Array, optinal; default: [0,1,1]) - * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) + * 0: Any object + * 1: true to enable carrying, false to disable + * 2: Position offset for attachTo command (default: [0,1,1]) + * 3: Direction in degree to rotate the object after attachTo (default: 0) * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_carryAction", "_dropAction", "_object", "_enableCarry", "_position", "_direction"]; -//IGNORE_PRIVATE_WARNING("_player", "_target"); +private ["_carryAction", "_dropAction", "_type", "_initializedClasses"]; -_this resize 4; - -_object = _this select 0; -_enableCarry = _this select 1; -_position = _this select 2; -_direction = _this select 3; +params ["_object", "_enableCarry", "_position", "_direction"]; if (isNil "_position") then { _position = _object getVariable [QGVAR(carryPosition), [0,1,1]]; @@ -38,8 +34,6 @@ _object setVariable [QGVAR(carryPosition), _position]; _object setVariable [QGVAR(carryDirection), _direction]; // add action to class if it is not already present -private ["_type", "_initializedClasses"]; - _type = typeOf _object; _initializedClasses = GETGVAR(initializedClasses_carry,[]); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index 7745bd2d3e..bbfca9d868 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -10,19 +10,15 @@ * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) * * Return value: - * NONE. + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_dragAction", "_dropAction", "_object", "_enableDrag", "_position", "_direction"]; +private ["_dragAction", "_dropAction", "_type", "_initializedClasses"]; //IGNORE_PRIVATE_WARNING("_player", "_target"); - -_this resize 4; - -_object = _this select 0; -_enableDrag = _this select 1; -_position = _this select 2; -_direction = _this select 3; +params ["_object", "_enableDrag", "_position", "_direction"]; if (isNil "_position") then { _position = _object getVariable [QGVAR(dragPosition), [0,0,0]]; @@ -38,8 +34,6 @@ _object setVariable [QGVAR(dragPosition), _position]; _object setVariable [QGVAR(dragDirection), _direction]; // add action to class if it is not already present -private ["_type", "_initializedClasses"]; - _type = typeOf _object; _initializedClasses = GETGVAR(initializedClasses,[]); diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 5521bec375..c905bad8f3 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -3,29 +3,28 @@ * * Start the carrying process. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; +private ["_weight", "_timer"]; -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // check weight -private "_weight"; _weight = [_target] call FUNC(getWeight); if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; -private "_timer"; _timer = ACE_time + 5; // handle objects vs persons diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf index 47824a8e76..ae5ad17978 100644 --- a/addons/dragging/functions/fnc_startCarryPFH.sqf +++ b/addons/dragging/functions/fnc_startCarryPFH.sqf @@ -1,25 +1,34 @@ -// by commy2 +/* + * Author: commy2 + * + * Carry PFH + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 startCarryPFH running", ACE_time]; #endif -private ["_unit", "_target", "_timeOut"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; -_timeOut = _this select 0 select 2; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target", "_timeOut"]; // handle aborting carry if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // handle persons vs objects @@ -27,11 +36,11 @@ if (_target isKindOf "CAManBase") then { if (ACE_time > _timeOut) exitWith { [_unit, _target] call FUNC(carryObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; } else { if (ACE_time > _timeOut) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout private "_draggedObject"; @@ -43,7 +52,7 @@ if (_target isKindOf "CAManBase") then { if (stance _unit == "STAND") exitWith { [_unit, _target] call FUNC(carryObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 1d4eb9a158..43a8a14695 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -4,18 +4,15 @@ * Start the dragging process. * * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * 0: Unit that should do the dragging + * 1: Object to drag * * Return value: - * NONE. + * None */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // check weight private "_weight"; diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index 65cf0a2431..f527cda7d8 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -1,30 +1,39 @@ -// by commy2 +/* + * Author: commy2 + * + * Drag PFH + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 startDragPFH running", ACE_time]; #endif -private ["_unit", "_target", "_timeOut"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; -_timeOut = _this select 0 select 2; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target", "_timeOut"]; // handle aborting drag if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame ACE_time. if (ACE_time > _timeOut) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout private "_draggedObject"; @@ -36,5 +45,5 @@ if (ACE_time > _timeOut) exitWith { if (animationState _unit in DRAG_ANIMATIONS) exitWith { [_unit, _target] call FUNC(dragObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; From 79cf8dd98e1c990ba2c24b054b75e126b5bed844 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 9 Aug 2015 15:20:50 +0200 Subject: [PATCH 071/239] Fixing Some Spelling Remove Some forgotten Commands --- addons/dragging/functions/fnc_canCarry.sqf | 1 - addons/dragging/functions/fnc_carryObjectPFH.sqf | 3 +-- addons/dragging/functions/fnc_handleAnimChanged.sqf | 4 ++-- addons/dragging/functions/fnc_handleKilled.sqf | 2 +- addons/dragging/functions/fnc_handlePlayerChanged.sqf | 2 +- addons/dragging/functions/fnc_handleUnconscious.sqf | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 0e44e3b860..a6b8fed5ab 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -14,7 +14,6 @@ */ #include "script_component.hpp" -private params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 3c28c9737b..d0eb7fda17 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 * - * PFH for Crarry Object + * PFH for Carry Object * * Arguments: * ? @@ -17,7 +17,6 @@ systemChat format ["%1 carryObjectPFH running", ACE_time]; #endif -private ["_unit", "_target"]; params ["_args", "_idPFH"]; _args params ["_unit","_target"]; diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index 2c3a654842..0694687ca4 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -1,11 +1,11 @@ /* * Author: commy2 * - * Handle the Animaion for a Unit for Dragging Module + * Handle the animaion for a Unit for Dragging Module * * Arguments: * 0: Unit - * 1: Animaion + * 1: animaion * * Return Value: * None diff --git a/addons/dragging/functions/fnc_handleKilled.sqf b/addons/dragging/functions/fnc_handleKilled.sqf index a7d9c5eb8f..2d0923d624 100644 --- a/addons/dragging/functions/fnc_handleKilled.sqf +++ b/addons/dragging/functions/fnc_handleKilled.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 * - * Handle the Kill of the Dragger + * Handle death of the dragger * * Arguments: * 0: Unit diff --git a/addons/dragging/functions/fnc_handlePlayerChanged.sqf b/addons/dragging/functions/fnc_handlePlayerChanged.sqf index 4ea46749bb..41c9091c72 100644 --- a/addons/dragging/functions/fnc_handlePlayerChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerChanged.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 * - * Handle the Event if player is Changed + * Handle player changes. * * Arguments: * 0: New Player Unit diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index 6cdc9d26cf..b87e36b92d 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [_unit] call ace_dragging_fnc_handlePlayerWeaponChanged; + * [_unit] call ace_dragging_fnc_handleUnconscious; * * Public: No */ From c30cb45bd63fc40a0f6d8087f82655ac0363227d Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 9 Aug 2015 20:59:57 +0100 Subject: [PATCH 072/239] Optimize spectator UI held key prevention system --- addons/spectator/functions/fnc_handleInterface.sqf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 80ee564ab5..335b71bbe1 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -33,6 +33,7 @@ switch (toLower _mode) do { // 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; @@ -250,10 +251,10 @@ switch (toLower _mode) do { }; // Handle held keys (prevent repeat calling) - if (_dik in GVAR(heldKeys)) exitwith {}; + 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) pushBack _dik; + GVAR(heldKeys) set [_dik,true]; }; switch (_dik) do { @@ -358,7 +359,7 @@ switch (toLower _mode) do { _args params ["_display","_dik","_shift","_ctrl","_alt"]; // No longer being held - GVAR(heldKeys) = GVAR(heldKeys) - [_dik]; + GVAR(heldKeys) set [_dik,nil]; switch (_dik) do { case 16: { // Q @@ -523,6 +524,7 @@ switch (toLower _mode) do { GVAR(ctrlKey) = false; GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; GVAR(treeSel) = objNull; @@ -577,6 +579,7 @@ switch (toLower _mode) do { GVAR(ctrlKey) = false; GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; GVAR(treeSel) = objNull; From 4cce799ace5fcc1fb73265d8233370cffebac75a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 10 Aug 2015 22:08:13 -0500 Subject: [PATCH 073/239] #2045 - Push SDV sub, cleanup push --- addons/interaction/CfgVehicles.hpp | 4 ++-- addons/interaction/XEH_postInit.sqf | 7 +++++++ addons/interaction/functions/fnc_push.sqf | 16 ++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 6a492b14ad..d3260fd577 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); From 95aa9f604bf83d29ad51267cc1d62ded6eaf2f18 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 11 Aug 2015 13:53:55 +0100 Subject: [PATCH 074/239] Fix manual pre-setting of spectator camera unit If the spectator camera unit was set before the camera had ever opened then the unit list wouldn't be populated and as such the camera would automatically abort to free mode since the unit wasn't available to spectate. So now I'm running the updateUnits function before opening the camera to pre-populate the list. --- addons/spectator/functions/fnc_handleInterface.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 335b71bbe1..95f05d01ec 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -38,6 +38,9 @@ switch (toLower _mode) do { 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); From 42e7340b79ef191a6d7b6b97cdd8f33f7b7e4cd3 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sat, 8 Aug 2015 02:26:09 +0200 Subject: [PATCH 075/239] Code cleanup of Safemode module --- addons/safemode/XEH_preInit.sqf | 1 - addons/safemode/functions/fnc_firstMode.sqf | 9 ----- addons/safemode/functions/fnc_lockSafety.sqf | 40 +++++++++++++------ .../functions/fnc_playChangeFiremodeSound.sqf | 33 +++++++++++---- .../functions/fnc_setSafeModeVisual.sqf | 22 ++++++++-- .../safemode/functions/fnc_unlockSafety.sqf | 28 ++++++++++--- 6 files changed, 93 insertions(+), 40 deletions(-) delete mode 100644 addons/safemode/functions/fnc_firstMode.sqf diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf index 6bedb35134..e6eb91b8bd 100644 --- a/addons/safemode/XEH_preInit.sqf +++ b/addons/safemode/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(firstMode); PREP(lockSafety); PREP(playChangeFiremodeSound); PREP(setSafeModeVisual); diff --git a/addons/safemode/functions/fnc_firstMode.sqf b/addons/safemode/functions/fnc_firstMode.sqf deleted file mode 100644 index d10da3f896..0000000000 --- a/addons/safemode/functions/fnc_firstMode.sqf +++ /dev/null @@ -1,9 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -PARAMS_1(_weapon); - -private ["_mode"]; -_mode = getArray (configFile >> "CfgWeapons" >> _weapon >> "modes") select 0; - -[_mode, _weapon] select (_mode == "this") diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 42a8ef89fb..54fa254716 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -1,12 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * Put weapon on safety, or take it off safety if safety is already put on. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Muzzle + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call ace_safemode_fnc_lockSafety + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_unit,_weapon,_muzzle); - // don't immediately switch back if (inputAction "nextWeapon" > 0) exitWith {}; -private ["_safedWeapons"]; +private ["_safedWeapons", "_condition", "_statement", "_id", "_picture"]; + +params ["_unit", "_weapon", "_muzzle"]; + _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; if (_weapon in _safedWeapons) exitWith { @@ -18,15 +35,14 @@ _safedWeapons pushBack _weapon; _unit setVariable [QGVAR(safedWeapons), _safedWeapons]; if (_unit getVariable [QGVAR(actionID), -1] == -1) then { - private ["_condition", "_statement", "_id"]; - _condition = { + params ["", "_caller"]; if ( - [_this select 1] call EFUNC(common,canUseWeapon) + [_caller] call EFUNC(common,canUseWeapon) && { - if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then { + if (currentMuzzle _caller in (_caller getVariable [QGVAR(safedWeapons), []])) then { if (inputAction "nextWeapon" > 0) exitWith { - [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety); + [_this select 1, currentWeapon _caller, currentMuzzle _caller] call FUNC(unlockSafety); false }; true @@ -44,7 +60,8 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then { }; _statement = { - [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety); + params ["", "_caller"]; + [_caller, currentWeapon _caller, currentMuzzle _caller] call FUNC(unlockSafety); }; //_id = [_unit, format ["%1", localize LSTRING(TakeOffSafety)], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler); @@ -54,12 +71,11 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then { }; if ((typeName _muzzle) == (typeName "")) then { - _unit selectWeapon _muzzle;//_weapon + _unit selectWeapon _muzzle; //_weapon }; // play fire mode selector sound [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound); -private "_picture"; _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf index 754a02005c..e691ace65d 100644 --- a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf @@ -1,9 +1,25 @@ -// by commy2 +/* + * Author: commy2 + * Play weapon firemode change sound. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player] call ace_safemode_fnc_playChangeFiremodeSound + * + * Public: No + */ #include "script_component.hpp" -PARAMS_2(_unit,_weapon); +private ["_sound", "_position", "_soundCount"]; + +params ["_unit", "_weapon"]; -private ["_sound"]; _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); if (count _sound == 0) exitWith { @@ -16,12 +32,13 @@ if ({(toLower (_sound select 0) find _x == (count toArray (_sound select 0) - co }; // add default volume, pitch and distance -if (count _sound < 2) then {_sound pushBack 1}; -if (count _sound < 3) then {_sound pushBack 1}; -if (count _sound < 4) then {_sound pushBack 0}; +_soundCount = count _sound; +if (_soundCount < 2) then {_sound pushBack 1}; +if (_soundCount < 3) then {_sound pushBack 1}; +if (_soundCount < 4) then {_sound pushBack 0}; -private "_position"; _position = _unit modelToWorldVisual (_unit selectionPosition "RightHand"); _position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)]; -playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3]; +_sound params ["_filename", "_volume", "_soundPitch", "_distance"] +playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance]; diff --git a/addons/safemode/functions/fnc_setSafeModeVisual.sqf b/addons/safemode/functions/fnc_setSafeModeVisual.sqf index cb8c679855..65efc747cb 100644 --- a/addons/safemode/functions/fnc_setSafeModeVisual.sqf +++ b/addons/safemode/functions/fnc_setSafeModeVisual.sqf @@ -1,17 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * Show firemode indicator, representing safety lock + * + * Arguments: + * 0: Show firemode + * + * Return Value: + * + * + * Example: + * [true] call ace_safemode_fnc_setSafeModeVisual + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_show); +private ["_control", "_config"]; + +params ["_show"]; disableSerialization; -private ["_control"]; _control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187; if (isNull _control) exitWith {}; if (_show) then { - private "_config"; _config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture"; _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; diff --git a/addons/safemode/functions/fnc_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf index 2b4f00a4a9..35fdb0dee5 100644 --- a/addons/safemode/functions/fnc_unlockSafety.sqf +++ b/addons/safemode/functions/fnc_unlockSafety.sqf @@ -1,9 +1,26 @@ -// by commy2 +/* + * Author: commy2 + * Take weapon of safety lock. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Muzzle + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call ace_safemode_fnc_unlockSafety + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_unit,_weapon,_muzzle); +private ["_safedWeapons", "_id", "_picture"]; + +params ["_unit", "_weapon", "_muzzle"]; -private ["_safedWeapons"]; _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; if (_weapon in _safedWeapons) then { @@ -12,7 +29,6 @@ if (_weapon in _safedWeapons) then { _unit setVariable [QGVAR(safedWeapons), _safedWeapons]; if (count _safedWeapons == 0) then { - private "_id"; _id = _unit getVariable [QGVAR(actionID), -1]; //[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler); @@ -36,7 +52,8 @@ if (inputAction "nextWeapon" > 0) then { if (_x == "this") then { _modes pushBack _weapon; }; - } forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); + nil + } count getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); // select last mode _mode = _modes select (count _modes - 1); @@ -57,6 +74,5 @@ if (inputAction "nextWeapon" > 0) then { // player hud [true] call FUNC(setSafeModeVisual); -private "_picture"; _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture); From 4babfa0bf8c3cb27dca8b25ead1ace0e3e2f6e9b Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Tue, 11 Aug 2015 17:56:46 +0200 Subject: [PATCH 076/239] Fixed missing return value description in safemode module --- addons/safemode/functions/fnc_setSafeModeVisual.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/safemode/functions/fnc_setSafeModeVisual.sqf b/addons/safemode/functions/fnc_setSafeModeVisual.sqf index 65efc747cb..43f4bc79b6 100644 --- a/addons/safemode/functions/fnc_setSafeModeVisual.sqf +++ b/addons/safemode/functions/fnc_setSafeModeVisual.sqf @@ -6,7 +6,7 @@ * 0: Show firemode * * Return Value: - * + * None * * Example: * [true] call ace_safemode_fnc_setSafeModeVisual From 2144a56be15544e54b289b0f1af7c972e2919b17 Mon Sep 17 00:00:00 2001 From: voiper Date: Tue, 11 Aug 2015 10:49:39 -0700 Subject: [PATCH 077/239] Fix attempt. --- addons/map/ACE_Settings.hpp | 4 + addons/map/CfgAmmo.hpp | 48 +++++++ addons/map/CfgSounds.hpp | 7 + addons/map/CfgVehicles.hpp | 29 +++- addons/map/XEH_postInitClient.sqf | 66 +++++++-- addons/map/XEH_preInit.sqf | 5 + addons/map/config.cpp | 2 + .../functions/fnc_blueForceTrackingModule.sqf | 9 +- .../functions/fnc_compileFlashlightMenu.sqf | 65 +++++++++ .../map/functions/fnc_determineMapLight.sqf | 4 +- addons/map/functions/fnc_flashlightGlow.sqf | 41 ++++++ .../map/functions/fnc_getUnitFlashlights.sqf | 29 ++++ addons/map/functions/fnc_moduleMap.sqf | 4 +- addons/map/functions/fnc_simulateMapLight.sqf | 136 ++++++++++++++++++ addons/map/functions/fnc_switchFlashlight.sqf | 25 ++++ addons/map/functions/fnc_updateMapEffects.sqf | 24 ++-- addons/map/stringtable.xml | 45 ++++-- 17 files changed, 502 insertions(+), 41 deletions(-) create mode 100644 addons/map/CfgAmmo.hpp create mode 100644 addons/map/CfgSounds.hpp create mode 100644 addons/map/functions/fnc_compileFlashlightMenu.sqf create mode 100644 addons/map/functions/fnc_flashlightGlow.sqf create mode 100644 addons/map/functions/fnc_getUnitFlashlights.sqf create mode 100644 addons/map/functions/fnc_simulateMapLight.sqf create mode 100644 addons/map/functions/fnc_switchFlashlight.sqf diff --git a/addons/map/ACE_Settings.hpp b/addons/map/ACE_Settings.hpp index 15e2a174e4..4e2a5d5706 100644 --- a/addons/map/ACE_Settings.hpp +++ b/addons/map/ACE_Settings.hpp @@ -15,6 +15,10 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(mapGlow) { + value = 1; + typeName = "BOOL"; + }; class GVAR(mapShake) { value = 1; typeName = "BOOL"; diff --git a/addons/map/CfgAmmo.hpp b/addons/map/CfgAmmo.hpp new file mode 100644 index 0000000000..59d91d68f4 --- /dev/null +++ b/addons/map/CfgAmmo.hpp @@ -0,0 +1,48 @@ +class CfgAmmo { + + class FlareCore; + + class FlareBase: FlareCore {}; + class F_20mm_White: FlareBase {}; + + class ACE_FlashlightProxy_White: F_20mm_White { + model = ""; + effectFlare = "FlareShell"; + + triggerTime = 0; + intensity = 1; + flareSize = 1; + timeToLive = 10e10; + + lightColor[] = {1,1,1,1}; + + grenadeBurningSound[] = {}; + grenadeFireSound[] = {}; + soundTrigger[] = {}; + SmokeShellSoundHit1[] = {}; + SmokeShellSoundHit2[] = {}; + SmokeShellSoundHit3[] = {}; + SmokeShellSoundLoop1[] = {}; + SmokeShellSoundLoop2[] = {}; + }; + + class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White { + intensity = 2.5; + lightColor[] = {1,0,0,1}; + }; + + class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White { + intensity = 1.5; + lightColor[] = {0,1,0,1}; + }; + + class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White { + intensity = 2.5; + lightColor[] = {0.25,0.25,1,1}; + }; + + class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White { + intensity = 1.5; + lightColor[] = {1,1,0.5,1}; + }; +}; \ No newline at end of file diff --git a/addons/map/CfgSounds.hpp b/addons/map/CfgSounds.hpp new file mode 100644 index 0000000000..ede59914a7 --- /dev/null +++ b/addons/map/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_map_flashlightClick { + name = "ACE_map_flashlightClick"; + sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 30cae96ef6..130df03af8 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -1,4 +1,20 @@ class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_MapFlashlight { + displayName = CSTRING(Action_Flashlights); + icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa); + condition = QUOTE(GVAR(mapIllumination) && visibleMap && (count ([ACE_player] call FUNC(getUnitFlashlights)) > 0)); + statement = "true"; + exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; + insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu)); + showDisabled = 0; + priority = 99; + }; + }; + }; + class ACE_Module; class ACE_ModuleMap: ACE_Module { author = ECSTRING(common,ACETeam); @@ -15,6 +31,12 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class MapGlow { + displayName = CSTRING(MapGlow_DisplayName); + description = CSTRING(MapGlow_Description); + typeName = "BOOL"; + defaultValue = 1; + }; class MapShake { displayName = CSTRING(MapShake_DisplayName); description = CSTRING(MapShake_Description); @@ -39,13 +61,14 @@ class CfgVehicles { }; }; - class ACE_ModuleBlueForceTracking: ACE_Module { + class Module_F; + class ACE_ModuleBlueForceTracking: Module_F { author = ECSTRING(common,ACETeam); category = "ACE"; displayName = CSTRING(BFT_Module_DisplayName); function = QFUNC(blueForceTrackingModule); scope = 2; - isGlobal = 0; + isGlobal = 1; icon = PATHTOF(UI\Icon_Module_BFTracking_ca.paa); class Arguments { class Enabled { @@ -71,4 +94,4 @@ class CfgVehicles { description = CSTRING(BFT_Module_Description); }; }; -}; +}; \ No newline at end of file diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index 95f42db431..f358dcf944 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -1,23 +1,24 @@ #include "script_component.hpp" // Exit on Headless as well -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; LOG(MSG_INIT); // Calculate the maximum zoom allowed for this map call FUNC(determineZoom); -// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is. -// The thread dies as soon as the mission start, so it's not really compiting for scheduler space. -[] spawn { - // Wait until the map display is detected - waitUntil {(!isNull findDisplay 12)}; +[{ + if (isNull findDisplay 12) exitWith {}; GVAR(lastStillPosition) = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; GVAR(lastStillTime) = ACE_time; GVAR(isShaking) = false; + //map sizes are multiples of 1280 + GVAR(worldSize) = worldSize / 1280; + GVAR(mousePos) = [0.5,0.5]; + //Allow panning the lastStillPosition while mapShake is active GVAR(rightMouseButtonLastPos) = []; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapEffects);}]; @@ -42,13 +43,60 @@ call FUNC(determineZoom); GVAR(rightMouseButtonLastPos) = []; }; }]; -}; + + //get mouse position on map + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", { + GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; + }]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseHolding", { + GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; + }]; + + [_this select 1] call CBA_fnc_removePerFrameHandler; +}, 0] call CBA_fnc_addPerFrameHandler; ["SettingsInitialized", { // Start Blue Force Tracking if Enabled if (GVAR(BFT_Enabled)) then { - diag_log text "[ACE] Blue Force Tracking Enabled (client)"; GVAR(BFT_markers) = []; [FUNC(blueForceTrackingUpdate), GVAR(BFT_Interval), []] call CBA_fnc_addPerFrameHandler; }; -}] call EFUNC(common,addEventHandler); + + //illumination settings + if (GVAR(mapIllumination)) then { + GVAR(flashlightInUse) = ""; + GVAR(aceNVG) = ["ace_nightvision"] call EFUNC(common,isModLoaded); + GVAR(glow) = objNull; + + ["playerInventoryChanged", { + _flashlights = [ACE_player] call FUNC(getUnitFlashlights); + if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then { + GVAR(flashlightInUse) = ""; + }; + }] call EFUNC(common,addEventHandler); + + if (GVAR(mapGlow)) then { + ["visibleMapChanged", { + params ["_player", "_mapOn"]; + if (_mapOn) then { + if (!alive _player && !isNull GVAR(glow)) then { + GVAR(flashlightInUse) = ""; + }; + if (GVAR(flashlightInUse) != "") then { + if (isNull GVAR(glow)) then { + [GVAR(flashlightInUse)] call FUNC(flashlightGlow); + }; + } else { + if (!isNull GVAR(glow)) then { + [""] call FUNC(flashlightGlow); + }; + }; + } else { + if (!isNull GVAR(glow)) then { + [""] call FUNC(flashlightGlow); + }; + }; + }] call EFUNC(common,addEventHandler); + }; + }; +}] call EFUNC(common,addEventHandler); \ No newline at end of file diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf index c5645a52e7..9e123a3877 100644 --- a/addons/map/XEH_preInit.sqf +++ b/addons/map/XEH_preInit.sqf @@ -5,10 +5,15 @@ LOG(MSG_INIT); PREP(blueForceTrackingModule); PREP(blueForceTrackingUpdate); +PREP(compileFlashlightMenu); PREP(determineMapLight); PREP(determineZoom); +PREP(flashlightGlow); +PREP(getUnitFlashlights); PREP(moduleMap); PREP(onDrawMap); +PREP(simulateMapLight); +PREP(switchFlashlight); PREP(updateMapEffects); ADDON = true; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index 078c06b41d..84ed030779 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -27,6 +27,8 @@ class RscEdit; #include "CfgEventHandlers.hpp" #include "CfgMarkers.hpp" #include "CfgVehicles.hpp" +#include "CfgAmmo.hpp" +#include "CfgSounds.hpp" class RscMapControl { maxSatelliteAlpha = 0.5; diff --git a/addons/map/functions/fnc_blueForceTrackingModule.sqf b/addons/map/functions/fnc_blueForceTrackingModule.sqf index 33049c38ca..bab776c9ab 100644 --- a/addons/map/functions/fnc_blueForceTrackingModule.sqf +++ b/addons/map/functions/fnc_blueForceTrackingModule.sqf @@ -12,12 +12,15 @@ #include "script_component.hpp" -if (!isServer) exitWith {}; +if !(hasInterface) exitWith {}; -PARAMS_1(_logic); +PARAMS_3(_logic,_units,_activated); + +if !(_activated) exitWith {}; [_logic, QGVAR(BFT_Enabled), "Enabled"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule); -diag_log text "[ACE]: Blue Force Tracking Module initialized. (server)"; +diag_log text "[ACE]: Blue Force Tracking Module initialized."; +TRACE_2("[ACE]: Blue Force Tracking Module initialized.", GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf new file mode 100644 index 0000000000..0d081bb57c --- /dev/null +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -0,0 +1,65 @@ +/* + * Author: voiper + * Compile list of flashlight classnames and add to the "Flashlight" parent menu. + * + * Arguments: + * 0: Vehicle + * 1: Player + * 3: Parameters + * + * Return value: + * None + * + * Example: + * [_player, _player, []] call ace_map_fnc_compileFlashlightMenu; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_vehicle", "_player", "_parameters"]; + +_actions = []; +_flashlights = [_player] call FUNC(getUnitFlashlights); + +//add all carried flashlight menus and on/off submenu actions +{ + _displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName"); + _icon = getText (configFile >> "CfgWeapons" >> _x >> "picture"); + + _children = { + params ["_vehicle", "_player", "_flashlight"]; + _actions = []; + + _onAction = [ + (_flashlight + "_On"), + "On", + "", + {[_this select 2] call FUNC(switchFlashlight)}, + {GVAR(flashlightInUse) != (_this select 2)}, + {}, + _flashlight + ] call EFUNC(interact_menu,createAction); + + _offAction = [ + (_flashlight + "_Off"), + "Off", + "", + {[""] call FUNC(switchFlashlight)}, + {GVAR(flashlightInUse) == (_this select 2)}, + {}, + _flashlight + ] call EFUNC(interact_menu,createAction); + + _actions pushBack [_onAction, [], _player]; + _actions pushBack [_offAction, [], _player]; + + _actions + }; + + _parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction); + _actions pushBack [_parentAction, [], _player]; +} forEach _flashlights; + +_actions \ No newline at end of file diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 9c205299e6..8204b4b7f8 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -55,11 +55,13 @@ _fnc_calcColor = { _lightLevel = 0.04 + (0.96 * call EFUNC(common,ambientBrightness)); +/* // check if player has NVG enabled if (currentVisionMode _unit == 1) exitWith { // stick to nvg color [true, [154/255,253/255,177/255,0.5]] }; +*/ // Do not obscure the map if the ambient light level is above 0.95 if (_lightLevel > 0.95) exitWith { @@ -122,4 +124,4 @@ if (_lightLevel > 0.95) exitWith { }; // Calculate resulting map color -[true, [_lightTint, _lightLevel] call _fnc_calcColor] +[true, [_lightTint, _lightLevel] call _fnc_calcColor] \ No newline at end of file diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf new file mode 100644 index 0000000000..76cc871232 --- /dev/null +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -0,0 +1,41 @@ +/* + * Author: voiper + * Add or remove global flashlight glow for when player is looking at map. + * + * Arguments: + * 0: Flashlight classname ("" for off) + * + * Return value: + * None + * + * Example: + * ["ACE_Flashlight_MX991"] call ace_map_fnc_flashlightGlow; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_flashlight"]; + +_light = GVAR(glow); +if (!isNull _light) then {deleteVehicle _light}; + +if (_flashlight != "") then { + _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + + _class = switch (_colour) do { + case "white": {"ACE_FlashlightProxy_White"}; + case "red": {"ACE_FlashlightProxy_Red"}; + case "green": {"ACE_FlashlightProxy_Green"}; + case "blue": {"ACE_FlashlightProxy_Blue"}; + case "yellow": {"ACE_FlashlightProxy_Yellow"}; + }; + + _light = _class createVehicle [0,0,0]; + _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; +} else { + _light = objNull; +}; + +GVAR(glow) = _light; \ No newline at end of file diff --git a/addons/map/functions/fnc_getUnitFlashlights.sqf b/addons/map/functions/fnc_getUnitFlashlights.sqf new file mode 100644 index 0000000000..b7c4aa2e91 --- /dev/null +++ b/addons/map/functions/fnc_getUnitFlashlights.sqf @@ -0,0 +1,29 @@ +/* + * Author: voiper + * Check a unit for any flashlights that can be used on map. + * + * Arguments: + * 0: Unit to check + * + * Return value: + * Flashlight classnames (empty for none) + * + * Example: + * [unit] call ace_map_fnc_getUnitFlashlights; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit"]; + +_flashlights = []; + +{ + if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then { + _flashlights pushBack _x; + }; +} forEach (items _unit); + +_flashlights \ No newline at end of file diff --git a/addons/map/functions/fnc_moduleMap.sqf b/addons/map/functions/fnc_moduleMap.sqf index 514d2af034..b763db7eea 100644 --- a/addons/map/functions/fnc_moduleMap.sqf +++ b/addons/map/functions/fnc_moduleMap.sqf @@ -8,15 +8,17 @@ * Return Value: * None */ + #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; [_logic, QGVAR(mapIllumination), "MapIllumination" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(mapGlow), "MapGlow" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapShake), "MapShake" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapLimitZoom), "MapLimitZoom" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapShowCursorCoordinates), "MapShowCursorCoordinates"] call EFUNC(common,readSettingFromModule); diff --git a/addons/map/functions/fnc_simulateMapLight.sqf b/addons/map/functions/fnc_simulateMapLight.sqf new file mode 100644 index 0000000000..b4c64e6239 --- /dev/null +++ b/addons/map/functions/fnc_simulateMapLight.sqf @@ -0,0 +1,136 @@ +/* +* Author: voiper +* Draw sexy flashlight beams and NVG on main map. +* +* Arguments: +* 0: Map control (Control) +* 1: Map zoom level (Number) +* 2: Current map centre (Array) +* 3: Light level from ace_map_fnc_determineMapLight (Array) +* +* Return Value: +* None +* +* Public: No +*/ + +#include "script_component.hpp" + +params ["_mapCtrl", "_mapScale", "_mapCentre", "_lightLevel"]; + +_hmd = hmd ACE_player; +_nvgOn = (((getText (configFile >> 'CfgWeapons' >> _hmd >> 'simulation')) == 'NVGoggles') && (currentVisionMode ACE_player == 1)); +_aceNVG = GVAR(aceNVG); +_flashlight = GVAR(flashlightInUse); + +//map width (on screen) in pixels +_screenSize = 640 * safeZoneW; + +//resolution params (every frame in case resolution change) +getResolution params ["_resX", "_resY", "_viewPortX", "_viewPortY", "", "_uiScale"]; + +//engine rounds the viewport ratios, when they should be fractions; this can cause problems +_realViewPortY = _resY * _uiScale; +_realViewPortX = _realViewPortY * 4/3; + +//textures +_blackTex = "#(rgb,8,8,3)color(0,0,0,1)"; +_whiteTex = "#(rgb,8,8,3)color(1,1,1,1)"; + +//colour/alpha +_lightLevel params ["_r", "_g", "_b", "_a"]; +_colourAlpha = (_r + _g + _b) min _a; +_shadeAlpha = _a; + +if (_nvgOn) then { + _flashlightAdd = if (_flashlight != "") then {0.75} else {0}; + _shadeAlpha = 0.8 - _a + _flashlightAdd; + _fillTex = _whiteTex; + + if (_aceNVG) then { + _nvgAlpha = ACE_player getVariable [QEGVAR(nightvision,NVGBrightness), 0]; + + if (_nvgAlpha >= 0) then { + _shadeAlpha = _shadeAlpha + _nvgAlpha / 2; + } else { + //if flashlight off + if (_flashlight == "") then { + //if there's nearby light + if (_shadeAlpha > 0) then { + _shadeAlpha = _shadeAlpha + _nvgAlpha / 2; + } else { + _fillTex = _blackTex; + _shadeAlpha = -_nvgAlpha / 1.5; + }; + } else { + _shadeAlpha = _shadeAlpha + _nvgAlpha; + }; + }; + + _grainConfig = (configFile >> "CfgWeapons" >> _hmd >> "ACE_NightVision_grain"); + _grain = if (isNumber _grainConfig) then { + (getNumber _grainConfig) / 2 + } else { + 0 + }; + + if (_grain > 0) then { + _posX = (_mapCentre select 0) + (_mapScale * random 500); + _posY = (_mapCentre select 1) + (_mapScale * random 500); + _mapCtrl drawIcon [format["#(ai,2048,2048,1)perlinNoise(%1,%2,0,1)", _resX, _resX], [0.25,0.25,0.25,_grain], [_posX, _posY], _screenSize * 2.5, _screenSize * 2.5, 0, "", 0]; //noise + }; + }; + + _mapCtrl drawIcon ["#(rgb,8,8,3)color(0,0.5,0,1)", [1,1,1,0.5], _mapCentre, _screenSize, _screenSize, 0, "", 0]; //nvg green + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; //alpha fill +} else { + _fillTex = _blackTex; + + _colourList = [_r, _g, _b]; + _colourList sort false; + _maxColour = _colourList select 0; + + //ambient colour fill + _mapCtrl drawIcon [format["#(rgb,8,8,3)color(%1,%2,%3,1)", _r / _maxColour, _g / _maxColour, _b / _maxColour], [1,1,1,_colourAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; + + if (_flashlight == "") then { + //ambient shade fill + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; + } else { + //mouse pos + _mousePos = GVAR(mousePos); + + //flashlight settings + _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + _size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size"); + _flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour]; + _beamSize = _screenSize / _size; + + //after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom) + if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))}; + + //assign corrective ratio to fix sub-pixel gaps/overlaps (symptom of viewport * X/Y resolution rounding) + _viewPortRatioFixY = if (_realViewPortY != _viewPortY) then { + _realViewPortX / (_realViewPortY / _viewPortY * _viewPortX) + } else { + if (_realViewPortX != _viewPortX) then { + _realViewPortX / _viewPortX + } else { + 1 + }; + }; + + //offset the elements + _offsetX = _mapScale * GVAR(worldSize) * (_screenSize * 2 + _beamSize); + _offsetYDown = _mapScale * GVAR(worldSize) * (_screenSize + _beamSize) * _viewPortRatioFixY; + //up is bigger because of a potential exploit + _offsetYUp = _mapScale * GVAR(worldSize) * (_screenSize * 4 + _beamSize) * _viewPortRatioFixY; + + //draw the matrix /whoa + _mapCtrl drawIcon [_flashTex, [1,1,1,_shadeAlpha], _mousePos, _beamSize, _beamSize, 0, "", 0]; //centre beam + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) - _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //left + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) + _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //right + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) - _offsetYDown], _screenSize * 4, _screenSize, 0, "", 0]; //down + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) + _offsetYUp], _screenSize * 4, _screenSize * 4, 0, "", 0]; //up + }; +}; \ No newline at end of file diff --git a/addons/map/functions/fnc_switchFlashlight.sqf b/addons/map/functions/fnc_switchFlashlight.sqf new file mode 100644 index 0000000000..e177f886fa --- /dev/null +++ b/addons/map/functions/fnc_switchFlashlight.sqf @@ -0,0 +1,25 @@ +/* + * Author: voioper + * Switch flashlight. + * + * Arguments: + * 0: Flashlight classname ("" for off) + * + * Return value: + * None + * + * Example: + * ["ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_flashlight"]; + +GVAR(flashlightInUse) = _flashlight; +if (GVAR(mapGlow)) then { + [GVAR(flashlightInUse)] call FUNC(flashlightGlow); +}; +playSound "ACE_map_flashlightClick"; \ No newline at end of file diff --git a/addons/map/functions/fnc_updateMapEffects.sqf b/addons/map/functions/fnc_updateMapEffects.sqf index 3550df517c..72f5d0cec1 100644 --- a/addons/map/functions/fnc_updateMapEffects.sqf +++ b/addons/map/functions/fnc_updateMapEffects.sqf @@ -10,23 +10,21 @@ * * Public: No */ + #include "script_component.hpp" -private ["_mapCtrl","_mapScale"]; - -_mapCtrl = ((findDisplay 12) displayCtrl 51); +_mapCtrl = findDisplay 12 displayCtrl 51; _mapScale = ctrlMapScale _mapCtrl; +_mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; if (GVAR(mapIllumination)) then { - private ["_data","_darkenFill"]; + //get nearby lighting + _light = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall); - // Calculate map illumination - _data = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall); + _light params ["_applyLighting", "_lightLevel"]; - EXPLODE_2_PVT(_data,_darkenMap,_darkenColor); - if (_darkenMap) then { - _darkenFill = format["#(rgb,1,1,1)color(%1,%2,%3,%4)",_darkenColor select 0, _darkenColor select 1, _darkenColor select 2, _darkenColor select 3]; - _mapCtrl drawRectangle [(getArray(configFile >> 'CfgWorlds' >> worldName >> 'centerPosition')),80000,80000,0,_darkenColor,_darkenFill]; + if (_applyLighting) then { + [_mapCtrl, _mapScale, _mapCentre, _lightLevel] call FUNC(simulateMapLight); }; }; @@ -63,7 +61,7 @@ if (GVAR(mapShake)) then { GVAR(isShaking) = false; } else { // The map is still, store state - GVAR(lastStillPosition) = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; + GVAR(lastStillPosition) = _mapCentre; GVAR(lastStillTime) = ACE_time; }; }; @@ -72,7 +70,7 @@ if (GVAR(mapShake)) then { if (GVAR(mapLimitZoom)) then { if (GVAR(minMapSize) >= _mapScale) then { ctrlMapAnimClear _mapCtrl; - _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, (_mapCtrl ctrlMapScreenToWorld [0.5, 0.5])]; + _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre]; ctrlMapAnimCommit _mapCtrl; }; -}; +}; \ No newline at end of file diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 3f2d312fae..24cfa5fc7d 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -18,12 +18,13 @@ Iluminação do mapa? - Calculate dynamic map illumination based on light conditions? - Oblicza dynamiczne oświetlenie mapy bazujące na warunkach oświetleniowych - Calcula la iluminación dinámica del mapa basandose en las condiciones de luz - Berechne die Kartenauslichtung anhand des Umgebungslichts? - Vypočítat dynamické osvětlení mapy na základně světelných podmínek? - Calcular a iluminação dinâmica do mapa de acordo com as condições de luz? + Simulate map lighting based on ambient lighting and player's items? + + + Map flashlight glow? + + + Add external glow to players who use flashlight on map? Map shake? @@ -74,7 +75,7 @@ Mostrar as coordenadas de grade no ponteiro do mouse? - This module allows you to customize the map screen. + Moduł ten pozwala dostosować opcje widoku ekranu mapy. Dieses Modul erweitert die Kartenfunktionen. Tento modul umožňuje přizpůsobit mapu s obrazem. @@ -83,7 +84,7 @@ Blue Force Tracking Blue Force Tracking - Blue Force Tracking + Seguimiento de fuerzas amigas Blue Force Tracking Blue Force Tracking Rastreio de forças azuis @@ -93,14 +94,12 @@ RFA ativo Aktywuj BFT Povolit BFT - Activar BFT Enable Blue Force Tracking. Default: No Ativa Rastreio de Forças Azuis. Padrão: Não Aktywuj Blue Force Tracking. Domyślnie: Nie Povolit Blue Force Tracking. Výchozí: Ne - Activar Blue Force Tracking. Por defecto: No Interval @@ -135,11 +134,35 @@ Esconder marcadores que pertencem ao grupo de IA? - This module allows the tracking of allied units with BFT map markers. + Pozwala śledzić na mapie pozycje sojuszniczych jednostek za pomocą markerów BFT. Dieses Modul ermöglicht es verbündete Einheiten mit dem BFT auf der Karte zu verfolgen. Umožňuje sledovat přátelské jednokty na mapě v rámci BFT. Permite que você acompanhe as posições no mapa das unidades aliadas com marcadores RFA. + + Flashlights + Latarki + + + NVG + Noktowizja + + + On + Włącz + + + Off + Wyłącz + + + Increase Brightness + Zwiększ czułość + + + Decrease Brightness + Zmniejsz czułość + \ No newline at end of file From e0ed81dc67cf27a24046ba42099de4aa06223016 Mon Sep 17 00:00:00 2001 From: voiper Date: Tue, 11 Aug 2015 10:59:21 -0700 Subject: [PATCH 078/239] Git fix #2. --- addons/map/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 24cfa5fc7d..4666a2647c 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -75,7 +75,7 @@ Mostrar as coordenadas de grade no ponteiro do mouse? - + This module allows you to customize the map screen. Moduł ten pozwala dostosować opcje widoku ekranu mapy. Dieses Modul erweitert die Kartenfunktionen. Tento modul umožňuje přizpůsobit mapu s obrazem. From 2d101d064e1625e424d0e504def878fe15ed31c2 Mon Sep 17 00:00:00 2001 From: voiper Date: Tue, 11 Aug 2015 10:59:50 -0700 Subject: [PATCH 079/239] Git fix #3. --- addons/flashlights/$PBOPREFIX$ | 1 + addons/flashlights/CfgEventHandlers.hpp | 5 + addons/flashlights/CfgSounds.hpp | 7 ++ addons/flashlights/CfgVehicles.hpp | 89 ++++++++++++++++++ addons/flashlights/CfgWeapons.hpp | 61 ++++++++++++ addons/flashlights/README.md | 11 +++ .../UI/Flashlight_Beam_blue_ca.paa | Bin 0 -> 131489 bytes .../UI/Flashlight_Beam_green_ca.paa | Bin 0 -> 143504 bytes .../flashlights/UI/Flashlight_Beam_red_ca.paa | Bin 0 -> 133266 bytes .../UI/Flashlight_Beam_white_ca.paa | Bin 0 -> 123643 bytes .../UI/Flashlight_Beam_yellow_ca.paa | Bin 0 -> 143639 bytes addons/flashlights/UI/KSF1_ca.paa | Bin 0 -> 34359 bytes addons/flashlights/UI/mx991_ca.paa | Bin 0 -> 32340 bytes addons/flashlights/UI/xl50_ca.paa | Bin 0 -> 29497 bytes addons/flashlights/XEH_postInitClient.sqf | 8 ++ addons/flashlights/config.cpp | 18 ++++ addons/flashlights/data/KSF_1.p3d | Bin 0 -> 48588 bytes addons/flashlights/data/KSF_1.rvmat | 79 ++++++++++++++++ addons/flashlights/data/KSF_1_co.paa | Bin 0 -> 28405 bytes addons/flashlights/data/KSF_1_nohq.paa | Bin 0 -> 51285 bytes addons/flashlights/data/KSF_1_smdi.paa | Bin 0 -> 21947 bytes addons/flashlights/data/MX_991.p3d | Bin 0 -> 33648 bytes addons/flashlights/data/MX_991.rvmat | 79 ++++++++++++++++ addons/flashlights/data/MX_991_co.paa | Bin 0 -> 30434 bytes addons/flashlights/data/MX_991_nohq.paa | Bin 0 -> 77567 bytes addons/flashlights/data/Maglight.p3d | Bin 0 -> 29928 bytes addons/flashlights/data/Maglite.rvmat | 79 ++++++++++++++++ addons/flashlights/data/Maglite_co.paa | Bin 0 -> 11080 bytes addons/flashlights/data/Maglite_nohq.paa | Bin 0 -> 22016 bytes addons/flashlights/data/Maglite_smdi.paa | Bin 0 -> 11096 bytes addons/flashlights/script_component.hpp | 12 +++ addons/flashlights/stringtable.xml | 29 ++++++ 32 files changed, 478 insertions(+) create mode 100644 addons/flashlights/$PBOPREFIX$ create mode 100644 addons/flashlights/CfgEventHandlers.hpp create mode 100644 addons/flashlights/CfgSounds.hpp create mode 100644 addons/flashlights/CfgVehicles.hpp create mode 100644 addons/flashlights/CfgWeapons.hpp create mode 100644 addons/flashlights/README.md create mode 100644 addons/flashlights/UI/Flashlight_Beam_blue_ca.paa create mode 100644 addons/flashlights/UI/Flashlight_Beam_green_ca.paa create mode 100644 addons/flashlights/UI/Flashlight_Beam_red_ca.paa create mode 100644 addons/flashlights/UI/Flashlight_Beam_white_ca.paa create mode 100644 addons/flashlights/UI/Flashlight_Beam_yellow_ca.paa create mode 100644 addons/flashlights/UI/KSF1_ca.paa create mode 100644 addons/flashlights/UI/mx991_ca.paa create mode 100644 addons/flashlights/UI/xl50_ca.paa create mode 100644 addons/flashlights/XEH_postInitClient.sqf create mode 100644 addons/flashlights/config.cpp create mode 100644 addons/flashlights/data/KSF_1.p3d create mode 100644 addons/flashlights/data/KSF_1.rvmat create mode 100644 addons/flashlights/data/KSF_1_co.paa create mode 100644 addons/flashlights/data/KSF_1_nohq.paa create mode 100644 addons/flashlights/data/KSF_1_smdi.paa create mode 100644 addons/flashlights/data/MX_991.p3d create mode 100644 addons/flashlights/data/MX_991.rvmat create mode 100644 addons/flashlights/data/MX_991_co.paa create mode 100644 addons/flashlights/data/MX_991_nohq.paa create mode 100644 addons/flashlights/data/Maglight.p3d create mode 100644 addons/flashlights/data/Maglite.rvmat create mode 100644 addons/flashlights/data/Maglite_co.paa create mode 100644 addons/flashlights/data/Maglite_nohq.paa create mode 100644 addons/flashlights/data/Maglite_smdi.paa create mode 100644 addons/flashlights/script_component.hpp create mode 100644 addons/flashlights/stringtable.xml diff --git a/addons/flashlights/$PBOPREFIX$ b/addons/flashlights/$PBOPREFIX$ new file mode 100644 index 0000000000..674d0d255c --- /dev/null +++ b/addons/flashlights/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\flashlights \ No newline at end of file diff --git a/addons/flashlights/CfgEventHandlers.hpp b/addons/flashlights/CfgEventHandlers.hpp new file mode 100644 index 0000000000..d5f49bd5c3 --- /dev/null +++ b/addons/flashlights/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); + }; +}; diff --git a/addons/flashlights/CfgSounds.hpp b/addons/flashlights/CfgSounds.hpp new file mode 100644 index 0000000000..f0fabe3a39 --- /dev/null +++ b/addons/flashlights/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_flashlights_flashlightClick { + name = "ACE_flashlights_flashlightClick"; + sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/CfgVehicles.hpp b/addons/flashlights/CfgVehicles.hpp new file mode 100644 index 0000000000..fa766ad87b --- /dev/null +++ b/addons/flashlights/CfgVehicles.hpp @@ -0,0 +1,89 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + //todo: add flashlight attach actions + }; + }; + + class Item_Base_F; + + class ACE_Flashlight_MX991Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(MX991_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_MX991 { + name = "ACE_Flashlight_MX991"; + count = 1; + }; + }; + }; + + class ACE_Flashlight_KSF1Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(KSF1_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_KSF1 { + name = "ACE_Flashlight_KSF1"; + count = 1; + }; + }; + }; + + class ACE_Flashlight_XL50Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(XL50_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_XL50 { + name = "ACE_Flashlight_XL50"; + count = 1; + }; + }; + }; + + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + }; + }; + + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_KSF1,12); + }; + }; + + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_XL50,12); + }; + }; + + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + MACRO_ADDITEM(ACE_Flashlight_KSF1,12); + MACRO_ADDITEM(ACE_Flashlight_XL50,12); + }; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/CfgWeapons.hpp b/addons/flashlights/CfgWeapons.hpp new file mode 100644 index 0000000000..09fe70d764 --- /dev/null +++ b/addons/flashlights/CfgWeapons.hpp @@ -0,0 +1,61 @@ +class CfgWeapons { + + class ItemCore; + class ACE_ItemCore; + class InventoryItem_Base_F; + class InventoryFlashlightItem_Base_F; + + class acc_flashlight: ItemCore { + class ItemInfo: InventoryFlashlightItem_Base_F { + class Flashlight { + ACE_Flashlight_Colour = "white"; + ACE_Flashlight_Size = 2.75; + }; + }; + }; + + class ACE_Flashlight_MX991: ACE_ItemCore { + displayName = CSTRING(MX991_DisplayName); + descriptionShort = CSTRING(MX991_Description); + model = QUOTE(PATHTOF(data\MX_991.p3d)); + picture = PATHTOF(UI\mx991_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "red"; + ACE_Flashlight_Size = 1.75; + }; + }; + }; + + class ACE_Flashlight_KSF1: ACE_ItemCore { + displayName = CSTRING(KSF1_DisplayName); + descriptionShort = CSTRING(KSF1_Description); + model = QUOTE(PATHTOF(data\KSF_1.p3d)); + picture = PATHTOF(UI\ksf1_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "red"; + ACE_Flashlight_Size = 1.5; + }; + }; + }; + + class ACE_Flashlight_XL50: ACE_ItemCore { + displayName = CSTRING(XL50_DisplayName); + descriptionShort = CSTRING(XL50_Description); + model = QUOTE(PATHTOF(data\Maglight.p3d)); + picture = PATHTOF(UI\xl50_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "white"; + ACE_Flashlight_Size = 2.15; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/README.md b/addons/flashlights/README.md new file mode 100644 index 0000000000..6a04b78091 --- /dev/null +++ b/addons/flashlights/README.md @@ -0,0 +1,11 @@ +ace_flashlights +======= + +Flashlights for use on map and to attach to player. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [voiper](https://github.com/voiperr) diff --git a/addons/flashlights/UI/Flashlight_Beam_blue_ca.paa b/addons/flashlights/UI/Flashlight_Beam_blue_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..737780d1c8a7a97a007654621d91fe8ce81d7eed GIT binary patch literal 131489 zcma&Odvp_5mNi~iWyKcQAio+MW2;Iky)A=DAOWhRlIcvx$>f`KG8tg3hfV02FB9Ce zW=(hI(N!hc$uKM3J!>3y8aj<+z;QCPoy3HI6X2F4^GHGn;S~oPTL$CsG8h8Hab#7M ze#hzg{{O*}ED52i@o+l|mxos)f_?`Pj$4RWsvu$|p(8k?BVK{a|BpXygznu{ zs4SNw+yp`W?|-<;{&3U65!xF>-kJ!3qD+lUw7XaW8HvX`YDA)8HA_5gfE(@9QyhUf zLAR76j2@XJ;3rzj>6!n1vHydsBZwy`mzT&R-0Fim4_jHQR&~IAO{+;DO|8L|53xib z|AkA>A!1NPbQ0w>r4XT}k$#VpC3JgQMz%5!bA;;Qh#XbR5^@nLA~)Mvq896FI3gTJ zh|@^I=oB9?a2j1;tWD5)29KBK+bM%!`|~IHqgqYXcwu!ORjQxPu9mCS8Wzc@W2sP` z9-fxR`_pJJFpg6FEsY9^ayeCT%0w=VvP4w9Hi%ImACrx!N15f(sKMbSwlau80fhP{ zm5h|zx-WrxazV6bLFEYJ_7W}I$MSo6+#Hc~utZ$nQ#gMON6fC|&^9+l2#tKT626&O z4sY70EXq}=S+Z#1aado5r4#y`7C@rDC1=%?k)r&Dg#Nj8wJII1e}FJ9m1)CLfnGKD z-FzBV084I&{`m_&!VO{WbFWq&OZ8 z-m%%$%I^y-=vAi09w&QrMD}}!x};A;Glltiuk}wIB?{<>AvZfyl>cskgtgB9uKmXy z-7R)q0o92z-v#quEXqftWDxaB27keh;@tP&!H2hV#568Sqh8pn9*Xf1>8<^_qRe-d zE`gBCTijSDF6ve)LRF`K?!=@%JJZ2G(_dwW*B7lX$Ye5vlB-tDTv{ZYZYN*Bj9~MNzRD4&P znB+Bq3;>y{NxZQYkfSxbbT+S+Zyv{|HETmrq6qjjN$6(gP8Y>!!Z%q&uy z68_mfivnR{pJg~lyW9|AWU9z6KOeSZ$}0ceI{Ddlm-mJCJP)SoL_hVz!tN1Gypt={ zol|vU`cXNk-)w;L^(^xmO`{gjK;A#w>8kF=0kP zc9s2h!TgSWu=nzGw|rMi-+wKvrwi)S1KHr&t@Ai6AY<>dWy&WWjfg7Xx7)s19==sYf5%g}$?_x!9H1*e3 znx!=K%@iza4NC+U&4c)iE=v-3r*t7h{3xvBZCdp-KKZFlivWik>B7xtw$QZV8>>-xz|G4j{YNJaa#W z>^bK9Z#!a(n?z0a*|7g1 zOf?rO7LIONnWS>+NQ`ufh3!jm_foaZ_`@EEf{Bs69=B+E+{tdYB!d0c&Rv75kg;>y zr$cY4v*G*~M{HIh_&~4nJ;A(cZdemXeapS3s6&|6KK%Y$I>VdoK5y^LeSANGdV3Nx zQ;b8Y4x)WdmHh@{OD~>G?l?2lzdvx(E?3`<&D03h@|}Y8ji@;Ce9@u;`d_2E+&8z3 zKNbuak-6NRTSUKIAVP-Qw?g@i9dR@$qMONyjRls%(t2X*X1!@-tAisZ85|Mx0SiVK z4Y^zo^*0=`EsbWy@@1~1?)FX6&60`AZT*ryoRjFv(=K1$H@8Y?$^XVs9IXqXDZ(KT zG~uOLvyN(5Sur9!WKNjx-5$L^S_ffXL<>CR(l=7>jUiD#YZYxpR)Jn$Zc{1vb`&Gf z4vi||7gWA6G}`b$&+K&f(;Y39haQ!w60vwldQO{MD*Af^LA%@?ac~0o0bx!0ux&0@&vlD(S)Bou+ZS><~uD^vDFaQ3^vG|dLJKYc$P zy3u&f&IV(dAW6qaA%pXsDi^hR*<7DElM2p^#1OrPpLg#zRF6Quja^M+Hjs&_%1lg^ zPpaW_ss49ea`jDVX2j-Xt1U`IzStK)f*$Ap?fsrx;zR?^uD_z|xpiacD?hVRK;hz^ zn>Uz9>&Ai~cN!*d2urbk19HXCXnqh8bzY*Kfq0)+L|(@R84=VY9MK}9sJPGwFm7Sl zG}>9ThIC^xZQ87$ptaqV%$u4Vv0#53&Dv$UTlP%SENxL+yS2JIw}Sc?+$>E?%@rdy zFMW3^e1GK|L$KHwDSk6skDjr?KVZ9A@!Rm)^+hyx&^g*xKH|nyD4!@u>c9V1M<=NA zk@RzuMIV&KNC&0@WFX(pZOm8_=6?FWS|%+*H!2$5y2;J?4bEJ%O0+v9YF*@qJt-5Y zWnxEL4HtiWX(U8FZgeW%c-D%u7R|e*#U+|D!EB>d^Co-gB#@9-(;2Plk9pJWj*iVE zs~yRu2AMy zyM+zMlhd)8*tA=%ei0HUe2UooWcpNJe7fIXZ3EmuL%<{eHYgXaT#A>Z^~StBv$pZZ z_0b6dg(`1c3ojh%_XJREQ2^omF?9V}>=5vihBl~79aM{Nj&wOVaxNj#m2+fAq#sYv z>vF24-5$xCyiP7vX{e#}?mB^v&)?)^X@_c^6gUf8?^GxeZG&sb6=~}36eBcuqUXXE zLT~N(v8!JYXzoK)_(?u^>MgJrt`JY(nz#D0HBWil){Wq-aM%`>rX1Zhn z`Nkh?+6&nk8%x_*KdGY(w({+^WScr$X;$BQ$sZY;5R6|7N#b$=9&eqk0)#l`}63!)q^GzdE$wk;V=gO_OEUuZ&11 z`(GJLU%Sd^FTY}Bq>b0Ei0AiuSi&I@SFbP%4H)0f_+d{QR&m7F$%>baKVAh?8kiyB z7IowTOGC#af^G*I?r%{Lx_$+2jZC+D1lp-G z*8`>L72(kMkE#z#N(tUHQoA0m*{!r1~+h$z9<2hnC!3ciTV5`{f@NF#PpK-DqY0l3JS%=TB zJ&szXdNcVzb}D z^0oML8giBLyOl1Qwa-O`$Wrlt(K+z~#78NfLOA5&d>&T%>gdCa(%wG;Z-8C^?C0qR{E}UcV~jk4^t_ zTAJzijGkYQg!2~VlFM67@T&m*rmXg4)z?G)IGsROzP52(_X=R_$%*HUuM|F{JJ^%E zG7&bM=x^zSRv?L>X`z-v+E(R+g>ls3NTRQyY;n5YAhaurPCDKWkVHc2x>TC*h!(=B z(CFHg$~`Wu4=lB?yhETvb;q}kt%&4et6T~HHB$6!a>|s^#{I>4hwR@JdyN0yBl@F( zrz}cRL{KIDq2l9P?b62EH*qfa+?|^pG1%#s$#15}(+gg(N`5E;LbqAq)6KnwCjwck zKn3UTeh6U4U>5(f&mvG}iT?c`9Aa}>&`{wPnh{EG{e?qlW)zD(!7C}D!lq0-gj<(N z69q;i?Bg#8Yv>=T0@yrM$NAbka(u5N5uZ)biO|87b~bBH;I0;n5T_4>fOBFS>$3?V zfrKlw5))LL@H$YK-iIWUhwD=GOQrYzcm>cx2eHiAro5!b=ZMT z4E~iz3|aC~&b}i?S+yWH2@(-1Xp!M{#xhJYU0AQll5wmycc%7A7XXp7_Ob zT?ezt_+|{aVdui16^x>E<}DdrR_-Lw#O2ugzzLlRVq!c5yXIpFVTP(?2~I>UZb^sQ zoqsOFqm_0{)UkOM{3{JznHat6lEB7pusdhWw82G83rOdupZr&Jy8;$ziHzyt9E1E@dg>x<2_t|i_mG#Ha z`n$jf0CXX*_;0-erT^~k>!+XjdF3Iy(42Sw^{1csdBumYHFS>ZF8duYN9Fqk3!iwO z5xUHpU(L{hIY1^_wVM{M>o~)8t+R7o?RK`yXh2q^<4{Kp=I0WzT4^#C@PA8teg3vJ zoR6_<@xf^~E87yGp@UXV>NDrCqodowO0+V99Ith+wIxTAGxrwe@7)x%duONb(g|_j zgoS%H8Ozda1PB;F?ipKBoTnqw+0`B{WP=B+W4n^Q%dr=$@&9pIWG^94Jl|=!aaGcf ztc0fZ$*~WgQv(?>zkij&VbaB!D3`c;0+aC*lcO^(@xjYV)+JQ0;i~rtrRf{<3Q3#F zztTxwz7#W%Ot*1UK@KBG83CESYsW7I4B<81i(d)ZbGbNbSTon2fKJd()q3F@Q}aN^ zxO{13k6JNlm&vUTnH;ytzE>P_UV~lEiw4oMWeK{y#Us+2oUos+!~<6*%2KBIsy;@c zVt0dRlGdoJUt@A*&VTL72$08hP*X#t?VDY~%T~OxGc$SJ%2HN|p1gr?I5c}X8l4nyV9=2f|>nR@lcxjMN*sCLUsE{KBt3)eiFBgZdR zx)mZ|k4-!((xjcEXX7hIV)tDfjcUD*831hSi=5v2D-(EHd}BrSMt zDd&622@keA_HK5tJ{pHaat++5$>DEqMIjIwjLkwkbmzr$c8tkelc_D9Cn=rcT_c+I z+P!7hu3%DlSEv-SF69j=Ll7?3q!`3Qvz;00@wwXz9juAw=o&jmTq<;&8fl|7ZPkxheB6 zSyg_L7Q32$#OovZcW;xlcz7G59EPf_|MpJz)6YQtg{{on{oTE?rYGuL^5GJT(&|X^ zZ#O*y#Z^b4x67V&DVK#h2j(3R1(DXA*04-#^0!0bJ;YMQM?T6cC@~fjYzf&2y?|2< zJs=!&LjU!^JB=SWeQBfff<9|^Nz!Xwib{*p-J<;dfI7G7KFa(QWbi0NMBZ6BR{-Sj zCQwFJa)|Mipjy?D-T+{)f3MXknzq>4IA4&?dW7F?n90SmP9?TfG<}W7m0iMH!i+;S z4LM}*ES>aTCZd48+Dg8oM(_so>HWIE0gFJ}mB4b&)CiqU)P=eD$;aJFHI!!5i_fcM zZw%I%=#5R65j!8@sz>ky^ppWKS`3nn^w{W#6BAFM(F>i6m}5n2jAr5a0P4*Dc(I6{ zTgDN?g{6UkQH0do$S}ihlu?c<;XW=b>sL}%MVQGeKvI$lXAn)X*F|wAe$Hk9e3g5SB8z;tXBL9l=Q+(IX`75pB z#9I%uFWXta8}eH@_K-*oOXTwfzq)qg8WfVRp)NC+vIxyqrPZ!X=%yyqr(Y^3^y}}J z4CI}5vCZZL|GW3gQ=ln@A+-%4x?rBc17!mYP_R~7rVhpai}oI!{Z1l*Nn;+B@bl^z z`Lbq}FBduSWp}P=T{vPi5I?5>X_ot=f$2qUYe4)Xfm8*MKW{pyp0$cf64ZuVJnz*mhZ3jNY=NM+Cq^gR z&0=`9m6cH6tsAMOa)`0x5OV2mTvzThifEBW_zpKPF*W>hI(sdIJWqO5FAsHMOD!w9 zK;g&`28YKjd!KX(L7W5r6;oGnrv6&iR3me#8jc%b*#D5vxB} z*d=vrl|}ef429;848@klkmSBFq})hUT^M3=KY45M$DL?+XmnUb=VJ?l=&FM74Qe$< zAQ!0mPz6{*sZfw^WN75{OIFDo$<=Xr!@=Be+Pcmx)0M!y)(LKL;bz$r4m^bK#_M)6 zQ0*aOd+K##qrf0k3Ry*Z)}i`0*>nCe!dMG!&wa@H(ISV}-wx$tBg00`GNnly#z|MC zx%cbKHo^CZNEvHY9=R1BgJ#`qVJDp2*KoJhA+`4GUbyzwjkLIQpM!0tef*8BzpzFo zChy#WYBZf zUv7N2@sJ&xilZI62i{r#fz72T!hLvvyk~Uo-Sm`G3DF5}*Hca`(-04Wn*QfWMwHGu zBT{P1yEd;c*;~iT!SY6{9G_=qeGK+Fa43eX7+b{n7D4Y&M4Yi};zY_Jg(fvM>ruAH zvyVgBu(~29YePqkEbz5*upioSj}UZ;-XtS>`&~*v%xnh0_o&eDD0}Ckg62n`8u6sa5g&(4|MMFbhF#TDOQGX{AZZFW+w0nr2DRZeqLWe{WWmfc;0j#ik6nxmG^rcCtUB*;Xha ztgve-HqrNf&9|)*I*sUMc5qr%RIAXLpS+`dZ}eQ)_q<(Ei=&OY2R0Aw1%*mN#wWje z2Y%At&b(J0YRE-vp@K6WEp)cqrG(JX!IdozLGp0Ed18d|u)a|=`l>|@S)D>WHe;7V z6E-1iPK-=ywTdWafv|@ziS$9YEPC9Ex0Ve7b&>y+3}(03v6p`^kg==Pa~cjKu%PPL z6~ZiRtWg8gu?*n*z+f;tWD$4S917>bTph4Qp%_HZMo^uF`LMSPuGg-8^`$_nH+ltB z3P3f-F$T{`=lZP+$g4&Hsz?-H0i7(azZNKuqqBke7S4RF6McEshRxIpFEMzwbih0} zZV-wCr|g{WoRS5VU(DZ>LtlMKf=;ZU*d4n@p8qmFzu$#vkZ^Jui0}<_V+9ju81ehwt!rci*C=%g_(9t-7)%Lw}ju*ZS7#wg|{c8b~U6jxzNG=FFLi*b;2o0^K}2)Xjt7|-;*5> zH2?xW5!J+hGfT_y%O!2>UXL>;ZfO~^tKvK%8$4%qaPc9J5URnU8W42c&`{)C)Zma^ z_Uf#l>gY@A`O)D(KFwZ=@1Kqxu&`@852$l(V)0fNOfp)Wc&^+)vp86ax>h;?nH*Ae zt}iqgZE>m9=K>szwjPG~xfW56QP(;RU!EyTjce%K8IYItP-9M)w#6U*7y_as6(u{E zx2gPM37tJvHjuiOEF#XFlJ8#&6oUu^VF67^$EZGy8aOX;e6Ie~aA=t;G574~4q3mu zkQ5dL?_UMM_H+$P2Cf8-JJ>u78a8njs~Q?SE0Np!T{4Y;wmQXn&8$+Dqx$%Y$-pCG z`DPak-D+iO*pZ+v3^8O-ccBaxScKyQ1QKxMzg|yk5ebfW&+?=oyH&sL*b>mJ5Girfs`qr$5 zPFfS`WFIYcy8CG*?Mj-?bggwNGR_BJlTZt2d6I7Zq5c=oEh65qVmYR+R|Be*4Fd&k zJY-Qv2TN0{pPsIjWWKFNlp1kHn*a4Uqj()j(~*9wlN~iDpowuOLORAJj*QWD{tY(o zFOz*zwh$%~UUMWyJ>F*Zu5h`etmg!ydR=1nLRl){P`#&roJ~H~7s#L^{l9$C={22QY?f0t>@R`i@cSu(J8WCv1{&@=@f zd8#PCAb{4-M}4P0hpu;J65Z+fqL3_!t_hJ>7Yn5k1jsk0@0lloGXeq&NOmj}M;dUY zG>K{?f*>3s5sekuB{bVpXpyG2?-Lf9rAJSl6!SaO^2yMmJwK0Ee$rWb`irt?l~^hA zg#lCO#`f+weX(#pg!0H~2S-Pt_p7wB=D0Ij)JTekeVXUXGl9D_t2kt;lGfhb)~&7h z>ReIjF9W1Y^EaO`D^!4^U*^saF19K@o9I8{PHr4NU+MPwFAR-%)aDU~NJXql^W(Rq z=hpp;B|=3}B_mQhA9vEew)V{p4*UcyQp<||u^+lHGlnVM#>kCJV~YXX9ZG9pk<orAhmv^;W*=Cp8wArCF z6~C-&*|yKlwcZTpy33wr*j6(Ol{oBXFVo7njlEn-T58L;CEl8yw0Nl-Td4;*kfRBW z-Bl|jmL@uf0K80ryR{I*#n^<5&a>S$2?$%4&}kN$G_|kSrpQhxpn??2sJU8fvZ^7^ zBWmbtn-B-EoVBouOAU=n`M}-;2|~-k%JM?c(|j=mSEC4kba4zhg%Au+EkekmdJjQF z2TTu%rbZXwBuiMiM^d#)uvYeNfo)F;879eJUHm_4ChB2L4C_-frx+nPN5f}I(b&rP z;9y=EI(?Fe=FoJmFE(953<%@vQDCBs7{KGGcitB#;2mHbyrA^tXL7znz6tSH8oh)H zXefZCpC7j*c$)+Lw!*Bm0)Hp3Q+b6_>51ck6@e-E0H1mUf?7UTG!N#`=f_F6K%`5% zW99T=_T*<}(TmEWKxK&Bwof$8!b4x2!1+7q$(=;ulVwEGmY`34j*Bod3k=Q|JrO!5 zp828@z9b05voOHuPON~Z{&N{$1<^(VXOHDulhk`(owF&>Vo^1$A8C_AgHThS8vY6+ z?WY&c!+!<^8|vV;eVxH@&L%c*vI)(!+S)H5hs=*acd9u!crd|_UmQg>;>0FL@-W$6 z6q~jQt&9-%s7)%(&S9;B9{?PysM6-Vhewy`!Q&Cm@iA|Xdz`)nrz~(Cje7> zEgV(1!bfSdlPg62=i>WXEpFmVmb1GkA`Q5zs*l%ze<<~UogHh|W`&!YnoHJdQf4}s z>2g9S&BG>Ph88=2Z3CW_OZN3H!|A7saTfYLPmOGPK$wPt2<*zmb?$Ytonofnt%W>| z4lOi(321~%i&KyWhbySZLC{Ns8ENhnLIB=$0dJMCIucj++7+=*jcsvZZ!Y`R;%l8i zYrsgc5=JNIEF8BI#wMYu7tdMozoW_bzC2yoYFeYoXHSjhpo(Q2te5{jexgxED*wGz z=4^>mP@`smhT$0uwg!(}Js7(pX2C?X(Z*e2){p{nCwU=M8I|F)fN*(`r z$w0UP!mNlqR!rC`z?N1(H&irM<~}_(cGuC+Y54SLLAbc}$eNgbZQiFxqYp;Cp?pJy z*?Z)ZqgXEj*)IX5_S2&sylR+@BSJ(&c8ok;-SJ~3yrP!(1`z$P$BLskQ8C$5xTg5! z3g(TYa#c?e`AIyxFHQF_33^*M2n5|lr4EaaIr$kG%f>uwN542x3CX8WFq_NG?k@c2 z*i;C8yf|_OBGDoHBWCQ!cVQ3)rARCS`sE)y6R0TWIqfH3os%-#_dyd0um7k(h2~Ff zg*$ah7YKz;wRKbMXKTMskC02*W}9*t5LQ8fDhobr#-N*kHVs#1Heyr$PiZST3{iL7 zk=S+h>(Pu|X+o7Sva4ZR-O4}-@%A!dmy^8=Tr!fqbF<9OQi7h+vy=ljm7ulHl&4;{ ztI;$A3Q`7TOQL3*Fo4#D=M)A1QNl=kMd$?8nCB1rJ=i2(+u~4E4?70+%q(}l6PU8$ zPFj;{h6B0PY}k=7O{>&GY$_#w_4v0Cby)AlQcS->4P90YcDB=kqgrJAqF{0e3c55# zJm6MFmx@x#*{xPALJ(RN9%gtk1I&3E zT_82V81He=9JWpU|_|0Lwey8tnN6Lbm=S#r)GL%84DZIPM!F) zESkGG*!S7TOHvWLQY}sIn@V4t6z-Q2m+f5jktG9uXEHPU@sWg~fzHcoEbTdVSi9q* zrJKhNn|=Nc<_Uq+_4N=(2W0YzA`1=11aPiF<`6_dDZ{OOqHvLrFQ8F9h*C+=AZH(y ziS8UaI#B6U5#ix>VAHk}K)~%iW^k_+C%4@^4 z4F=^B4WE>cVh`%sec}^rxL7y&`KM;-k6?v>&NJtKVSBgD``8yJfHVR5+h$WX(wHhs z1;xk0^<`(jC~dvCT|gxX_1tN!hv6%68U?bz__jF(3g_%l?zp3y98xpcUZb?)o1jRK z4x7C{-qsEJB#K1R7Z@cXw3rncw60Cdg;wdxr7=cGLoLHl6L(dXrARY-csbtn2-G~b zwU(oXjk@|x*Aev~OD)GuI;N>)Ww}F(e*3yeHp=hM(j4_8H-wown?7xq$F-&Mc*I!f zH^c1VgXo)!3y6=520myc+c-4~YJyWyQNfumi-n8y(fk@3LQYjYPVX4yt`QQhM5oKO zOp%;iIGI;QElrrdp1>8*a{^&jLtEg|E2*jehm?>V%XmI4L_GpgrxeQL1qSB?a)S!0 zwNF}f;ru8$x(y_Ylv5rV3=9X(X*<6965x34y}`37>AvkMh>$E7%sOfmFO*lsD`vap z>@;+tm=q86#pFFF5n^!hfY6PT~n@Q3rDa z3C7#>5441GfU=2e&KDy^Jt=uK3&k`}HWZSfo4E*tBGjVil9-VjC7INBgvB3Oq$LWJ{ivrLGT?LsBDc6 z#hsJ7ypIpdr~$(=Sg}4`*Jl>%4MGkkAZFDc31v=vQpS&^xmmO5FA{PN$-f6#<>p!b z7WhAy1f@-yCF*pMO>5RBeJ~wX_+o!>JCktr9<)f!Q2oT_!8!3rX@xETrYT)6Wdf?4 zbYt{_Fjdayg@)53c&41RM#s{4T0m0v(ipzuWDl37LT!x)EeMs zYV_?IC2G`1%^3)z(AvOD6{UXj_}>3u8(rJBA8gD*=D;n3!Gb zj3nA?&KPykDu_y|7*Lo6vIjaz|3iSoiY(;2)e!H23(RF=hQxo)(^&+GW`ErIo55-5 zdtYSK>@?%`ZE30T`oPqaaRB*ac`K-`$-b}7mXYSGi{BQDTxK>-b3WUnbDHa#a~5xC zP%T^tV|dVoxKOW{-CrY^MADW!aN?7wOAhwY-oMRjDCQZP6#Vq)60$kp`9$oPn0a+9 zqXG>q<0q7i6&ybz+ea&0U?w;R%!|%{h|KRv9Fk{V43O&=KF}i{B$jOsjyw#Q8$%4&`eI>eC&CAWo4WIF|Hk>3 zBKkGh8JOP|&3DoV#9kR~SHPd#ucE;?sk4RPuPmtYFGJRPy6z-mVylS53y~*c}I^m+;kAkyZBEWm%m|}V|1w+n z{E}!CF9p}q(SdlT8y*913iewuRd0kso7xWeER7sLwj>&k`NI&#ufv>zQSF+A^$RmF z#4~ek4u+$87>U}p&w-oc6TB zdfnE2PPPlrKo|#dP%tgB{};?0a8nM&M?VTKo2GWa?sll00L)`(VjLS>Y^$Jmveam{ zbl{afY7snFje3d?zq#!ffYN3B^MKH1FLnP;2-W@GfyeXiZEbqi@cTa)5uu}f&2{C! ztJdkk_&ond(R%t{X_}=16=S(bZn?VCZ=BD+NfAHKbrNmVqe|zqH%In*m_%Y)Em<4f zocc8*g_C#8N@skAP}Tc1d_?Rsi!UT;m?|BvI@84nK4GHb@Os0UGE`kaACQTFY7uyc zcWmh3VlwsUa@<*?NDs*-D>WZjsXP{ZFaJ=0Dt&UU9J_U+kS*j~`Ah6H^)8wEN3Ut13gg)SRK|OxT zDtMujK9U6ISK`E=EM$UJjGTdPTr3^2V@{aCcZ0)80Vq*eO!wjOT3qecst$bwHoQip zJM>|E;hGqty_SO?Chzn*H;2hw&w(N`YUW;fH?9YM+Rte8JI=g9I>Q2~jOjlx~Y zBMKk&Gs@*SQsZb3bUwLGL=Xy!<=1j(F=#+iX~WjB;>n&rPo(EcGB{b~s_nTd0v})i zq*Yogdh!6HgseV#cj6%Q8lrR33hq2|v*4*;kitt+p>*9e5Y50fyW*#@--5%5RpD8f zONYjf9R^J@fargtc7l{hE6t^RoZBOPZRI9LqoK};)r#@HIz?)>U&vo*% zRIFG;?&5myiBB1U7gXBU+56eC;`%o?1;GQ8wDx{_v@Ckr%swJaN!hdepo_Obn9HAL>{j?w=?Cu#e< zklZo9|ASO4dlB{Q|3KBh7uWBX^iOuA$zBZe*=N6~i_L$8B`}1%lSQcigAuTwp+xca z?lCmkFD@E(By}I|BNJ-f$xZ}s2yIN|Uqg<7Nd&x!lh(NoD`AaHGG4fG(K&hOBaEO} zPeu!$uWSts>B--U^ZU$-->igenm>7n29pZKu+6qbQO)b;2SlBRhh#*LRx1 z{3N#;%=l9}NI9jaCbc4mITf8 z^+kR&Jl|{Ap%$FU?#Bf~-cdUrxPxZf>9KgV{`cN0(Ayq(~aRzpCTLreG&G=!qz9HYef1u)Ht zWg6>}Uz~u9qLU%r=f^?$v?oHJeO#7W%ZMxb0@;$bBTucdvHudxG6Dh%*wIuJ&OnH! zWPCmYlB&$W_(U`vf~1KJ&}~%WAg$~KiYFceW61&W?l}v$dYT7Ej5lx&`p(2TwJ&hq zjCaO|2l-pUnSL-Jd=Mk;iR%4(EmCUbNf9N3H}^955~x(A``(XbgXFuNcRqN(jG#ew zh@tfKyPf(E_Arv~i@H1}yolJl2j|eqy7!zyRRHannOgOpxDd#8Ab$;55j>a(=HL3E zC3H&YgFW$FKMaZ9hgu>P=O%@UvM8Ze>f+XD=S44C*^kTXEgz4V9sK*dw2 zxeRfGK>*TK-&waV2SXxz!jC@!_WKB(i|ht=ln<@nUnF4_d<^H;Xx49*4p;on=7mg% z%)Bx5qE(`frj`)Zv8QN_J$AU%FYmJm|Cbh`W}&$xC0Nw1Nnt}7&&D={$j?88#J5RZ zUwnpx5#gvI&6w$OC(k_ zV$cYplQ)3;E#iY^1A@mmKUK9MKNnYrpyhOOW0UBX21>^=-06WRFOf|(&IC+@NAvAi zVpzYCT)SjHjLwtN;MpM%L2a^fy42sb2GAfdV^u=o`AN_xku@SMJ^7i4My#9O*z-!>MqtcYW6XoDkNKg;W zUL)Dl_a5IoilpMccjvs!HE>?>&j%)9*@<{j!{|a@i6ON(7b~{2C|Euls|Y~bOFhU3 z1E`W8)v6#@NR5WGzu7i==6!KHgnt+k8(b+qI^ z*uP|;^BsY!FFf=S!|o9Ljrlv}195V@O=-3W6bu3cy@l-tBa_0H`UBhJKV1ib4X`0L z@1&Jhi=5qVmR*t1$>T?tM7<#8qa@IK7@=#BTNd2PBo3cC5l6q<@q#vcsSq3}VWDM? zmxGeQ9X?yy+Pc}A-1Xj9U*a3_f75JwYG=a4N^{5Im>Qb~_Xfo!l{R7p|ZX}jRfq6yxlgkBAWNOob z)d}=2NQa2Iz3Lka>jlf9BuDcj7Epm#w z_snq2#;j4N>I8kDsv`QQfIfg8^uN7_xI=q)ZSNON5ndOt2IZ|uYdCisENBCfFN)SW zAwl+nJy>wU!~!`mg;8t;t>gCZ1rz~}^Wg__?zaKbEIsnkeyo@LVGX$ZoRJhmitMzi z{LaGduxeIc+wLR=+rmBz1`!?Xgs5SAw=+Nr^DV*=SShJ%UDym&Jr%Rc{7wtzi&Lsi z`BTZudGl<)wt?C7=mm#x*sNRz$%X74N5BD2vvc*)W{rOt+hb zT{axm&D?wI>5@XSx}KT+uJG@Jk34JV#xpc)1M2mo!(EyZb1vckgP&JgKQY`76?=jp z{1j27m{1$Vmn<%6J2`5MIQ`E23*?G2(GTQW-sG%oc|jz6rZ` z-oZw6>wmNV#X~MgCpKK(7Q8-}=(b#Eo3#=Cv6Rm~t~uFA3|gRwkvv>Ar%kFg-m$T? zLo@aD)___GX6OWby1;ZoomQ964WxZveHqFh+Ok?Uf#bz=62pNrDW;YXT~Hj6d)~?8 zWl;+Z{$8`Gp`@?uwaSFmf&)okDl&W}b6s)eBY^k-;6A#d|hK z^s5%Sc1-oG|Bx2_`!w`Uk2Jlv#m*7EOL&6@2Snf4L^)aFxqa=y`QM0lHB7>}tZ!B= zaAL4R5Y#dlKQ9cFO8M{f;`iNN-3idvbv>yNoVc8B&ko|%G zfkSEQ!23hCSY?YAaAGUi@p`P@dP6&Q^S48Fd%$AjumAS_zEXaTTl6CVAZO$5ha_rF zc%=5lz@f$;*e~TOMxbw)HA`=vE^>*@2k?DHYwhhT>Kz$Hpdr?OmXeE6yuk&~0h*l5 z|9jyP;1MiE&Q9)(esV;buGntPJ=ycwvC`J`Hb%Rw!MWw8a);V<;z7QNQ3hyvR}^?m zAPq7P3*cb~n;y`khXCFaO;a#zrfPhsb-CIT@Z&ovJ zITO*2ysFfH0^dc)+c&{yiDG>z@pADN(~ax)A7I5qd}<-6>@>7f3d@5S3jpC={6OoH zAsQbnZ>^p#9#AsjWQk{a6?x&#?04df$0dd5pM|7h*ksk(MmWO@nvqQmt8^qh^y?K? zAriP)6A8Oq^NjiYDC3Q^fuXCDR>G@TIJJ~(~}7$Z!&1ux7fL4Z(HH#^2_L3N8= zNbuSm`BJ4XrQt&>sfxJ+JDl*F#>~9WKc!hI0H-@m(#%?WLhW@yQ&mpv zd6<^>(TNDOgSpra-QfOrQ#h_)eeun3;$V>M0=*yF_+-d^5c*)Vu=2sSypQ%R;dcqy z@Etc`iIRgeMQ}DO1r0`@nr-nwlfq6UvcQQ>!Gw5yelU|tXTA{6%nJ-+I1?Bd#F-L4 zBo2fBY)R^6hp>cE{-H*$24`bcgJdu+2a_1uG4;)=+EEg#D%m5e1Z2aX{($V5z(~r} zE(fmwkq58s0SUghr=gvx!#d~OZ^2;6*o=oW6Asq0B)S720h$@X*?1uLUav(}_DP^> z0z^0ke=G;KQLS~)dyJq$d+;l5@_hh6jr(8^Rs}!3DjuzssQ$fWsVoqu5c+VRMdZK? z)Hu8o+KU|c#w1!e0?dhPzD|P$nT^`zR&0^QU)ZES9Zr-I!d(4-l!9yFzD+v(@!>fJ zr8I>W0-5EPSn)0z)X6AoW?Rf`(_Dz_8R_!uBvlLoCT=q0^fEO{;;f6^Wx>s6Zdb&O z$LUp}s8t>>GLnQ2;=??L1LGA|c4ukpo4adqv=UhjOO>5YscE>~NTw#-LQ}nRYqDrj zp_LsFip^rv&#l6E8By;MnsoQxZhErL&5iQ{NKUD$g{B+ro0p_4W-T?c)h_RhRQpN7 zt)$!nMP1673Uo{jyF;hTDa^3s&SXrjOd)7ZWc358LN*;Mi@q$V>&s&* zxXTjK(G=FlRkxsGQrJ!oPRo5sZ1#CSu>FQ+|Jtl@G?(3CR=`km=tF2f8dcqa{jpL8 z#`xgJWjETSmHYSNjQBy45n`phS@^J|&9}D?jw*_w_prKBGQIasC-T5=EeQ4DQzicA ztq!G;(s@mMhdR;+UPw4oS?z&XF8mXeZOcEswlH8wBEExwBQ;O!f&CcfZe1)guD(r` z`-ndgIyQ+K2v}DFeyd6__c)w84(^J=^xSBV5WPL97IcvmSTy{TR+-APVP?5ZAwhKt z8$nK{BR27T1Z{d3=PZhiW;-En0f}I~EWlK=$|^SRF4~^9E3MKebG$ETO**xY_Q!5A z-ezewwBhw8@H3jdm*!9}1WtQeXoW&%Rd%7-fkc&X#;!HNYG#EO=zsOm991S{EnKTq zZ-miYe&8Hf8Y4NX#7CV?w+rLIQiN%S-32}ASFtIy=|2`X$TO^mnPC?|BVln%M6 zr~aFZX>d}AXtq3B?@C0$SAm;casJB~mGei;LOmliIU?gX zZwwnB7@(`n9RHFF2>*f?UW4P2O%mDul3i@NPisE9*r}vI(u2_V)489dxBk2;YN36+ z!I)Q#j;;Gqls4YuQ7!f@V|N(IR#`1=s~&2z2oXavdFLh^dM~ggX$^sij;5GAClx`-2xk_ZtrxQIs?04^(|sM7}GKs`{l_WDbIQE6kamaA%yh z$*SC`p6LRCbUp+U)bOzI-;J5xqp7kem_TJTPdAW&WA%Yd zYOR3ag_Gp8cw^3qG88POt$2YlMCLl6%}Ktm`1`|>mZaF`^S-@aulMVt9Zq)B(CS^I zlQ+}!#Kvs$EvNuIzT1Vk+m_euxkM4bA)nx1Y5}pUZo(oOU+7?c{_LUG%<^hS?x