From d3bfcf0aa93028ca7bf0de24ca450f70bafe8364 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 11 Feb 2017 15:07:10 -0600 Subject: [PATCH] Fix MUL macros (#4888) Conflicts: addons/frag/functions/fnc_frago.sqf --- addons/frag/XEH_postInit.sqf | 1 - addons/frag/functions/fnc_frago.sqf | 23 +++++++++++----------- addons/frag/functions/fnc_startTracing.sqf | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index 20a6a1ca70..7ab776fb57 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -27,4 +27,3 @@ GVAR(cacheRoundsTypesToTrack) = [false] call CBA_fnc_createNamespace; #ifdef DEBUG_ENABLED_FRAG [true, true, 30] call FUNC(dev_debugAmmo); #endif - diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index 51ed23cfea..86031f78a7 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -59,8 +59,8 @@ if (_warn) then { INFO_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_shellType); }; -private _fragPower = (((_m / _c) + _k) ^ - (1 / 2)) * _gC; -_fragPower = _fragPower * 0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation +// Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation +private _fragPower = 0.8 * (((_m / _c) + _k) ^ - (1 / 2)) * _gC; private _atlPos = ASLtoATL _lastPos; @@ -103,16 +103,17 @@ if (_isArmed && {!(_objects isEqualTo [])}) then { //if (random(1) > 0.5) then { private _target = _x; if (alive _target) then { - private _boundingBox = boundingBox _target; + (boundingBox _target) params ["_boundingBoxA", "_boundingBoxB"]; + + private _cubic = ((abs (_boundingBoxA select 0)) + (_boundingBoxB select 0)) * ((abs (_boundingBoxA select 1)) + (_boundingBoxB select 1)) * ((abs (_boundingBoxA select 2)) + (_boundingBoxB select 2)); + + if (_cubic <= 1) exitWith {}; + _doRandom = true; + + private _targetVel = velocity _target; private _targetPos = getPosASL _target; - private _distance = _targetPos distance _lastPos; - private _add = (((_boundingBox select 1) select 2) / 2) + ((((_distance - (_fragpower / 8)) max 0) / _fragPower) * 10); - private _bbX = (abs ((_boundingBox select 0) select 0)) + ((_boundingBox select 1) select 0); - private _bbY = (abs ((_boundingBox select 0) select 1)) + ((_boundingBox select 1) select 1); - private _bbZ = (abs ((_boundingBox select 0) select 2)) + ((_boundingBox select 1) select 2); - private _cubic = _bbX * _bbY * _bbZ; - if (_cubic > 1) then { - _doRandom = true; + private _distance = _targetPos vectorDistance _lastPos; + private _add = ((_boundingBoxB select 2) / 2) + ((((_distance - (_fragpower / 8)) max 0) / _fragPower) * 10); private _targetVel = velocity _target; diff --git a/addons/frag/functions/fnc_startTracing.sqf b/addons/frag/functions/fnc_startTracing.sqf index d860d6635e..c697a8dca2 100644 --- a/addons/frag/functions/fnc_startTracing.sqf +++ b/addons/frag/functions/fnc_startTracing.sqf @@ -2,4 +2,4 @@ if (GVAR(tracesStarted)) exitWith {}; GVAR(tracesStarted) = true; -GVAR(traceID) = [FUNC(drawTraces)] call CBA_fnc_addPerFrameHandler; +GVAR(traceID) = [FUNC(drawTraces), 0, []] call CBA_fnc_addPerFrameHandler;