From 12cadc603f054f66fa019e03fb9113496e0659fd Mon Sep 17 00:00:00 2001 From: Nou Date: Sat, 21 Mar 2015 21:22:16 -0700 Subject: [PATCH] Fragmentation enabled. --- addons/frag/CfgAmmo.hpp | 2 +- addons/frag/XEH_post_init.sqf | 5 +++-- addons/frag/XEH_pre_Init.sqf | 4 ++-- addons/frag/functions/fnc_addManualTrack.sqf | 2 +- addons/frag/functions/fnc_addTrack.sqf | 2 +- addons/frag/functions/fnc_doSpall.sqf | 7 ++----- addons/frag/functions/fnc_fired.sqf | 10 ++++------ addons/frag/functions/fnc_frag_trace.sqf | 2 +- addons/frag/functions/fnc_frago.sqf | 8 ++++---- addons/frag/functions/fnc_spallHP.sqf | 2 +- addons/frag/functions/fnc_stopTracing.sqf | 2 +- addons/frag/functions/fnc_trackFragRound.sqf | 6 +++--- addons/frag/functions/fnc_trackTrace.sqf | 2 +- addons/frag/script_component.hpp | 6 ++++-- 14 files changed, 29 insertions(+), 31 deletions(-) diff --git a/addons/frag/CfgAmmo.hpp b/addons/frag/CfgAmmo.hpp index c9d13d3ce3..58ed5573e1 100644 --- a/addons/frag/CfgAmmo.hpp +++ b/addons/frag/CfgAmmo.hpp @@ -26,7 +26,7 @@ class CfgAmmo { ACE_FRAG_SKIP = 0; ACE_FRAG_FORCE = 1; // This is a good high-drag frag type for grenades. - ACE_FRAG_CLASSES[] = {"ACE_frag_medium_HD"}; + ACE_FRAG_CLASSES[] = {"ACE_frag_tiny_HD"}; /* These values are based on the M67 Grenade, should be tweaked for individual grenades. diff --git a/addons/frag/XEH_post_init.sqf b/addons/frag/XEH_post_init.sqf index 25cb5132c8..ed0e715376 100644 --- a/addons/frag/XEH_post_init.sqf +++ b/addons/frag/XEH_post_init.sqf @@ -1,8 +1,8 @@ #include "script_component.hpp" -[QUOTE(ffsBIS), "oneachframe", QUOTE(FUNC(onFrame))] call BIS_fnc_addStackedEventHandler; if(isServer) then { - [QGVAR(frag_eh), { _this call FUNC(frago); }] call CBA_fnc_addClientToServerEventhandler; + [QGVAR(frag_eh), { _this call FUNC(frago); }] call ace_common_fnc_addEventHandler; }; +/* GVAR(replacedBisArtyWrapper) = false; [] spawn { waitUntil { @@ -15,3 +15,4 @@ GVAR(replacedBisArtyWrapper) = false; GVAR(replacedBisArtyWrapper) }; }; +*/ \ No newline at end of file diff --git a/addons/frag/XEH_pre_Init.sqf b/addons/frag/XEH_pre_Init.sqf index 406e6e7f63..5b3aa36b18 100644 --- a/addons/frag/XEH_pre_Init.sqf +++ b/addons/frag/XEH_pre_Init.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -#define ACE_TRACE_DRAW_INC 1 + ADDON = false; PREP(fired); @@ -14,7 +14,7 @@ GVAR(trackedObjects) = []; GVAR(blackList) = []; GVAR(traceFrags) = false; -GVAR(replacedBisArtyWrapper) = false; +GVAR(replacedBisArtyWrapper) = true; GVAR(TOTALFRAGS) = 0; diff --git a/addons/frag/functions/fnc_addManualTrack.sqf b/addons/frag/functions/fnc_addManualTrack.sqf index 1719842240..066499f6aa 100644 --- a/addons/frag/functions/fnc_addManualTrack.sqf +++ b/addons/frag/functions/fnc_addManualTrack.sqf @@ -3,5 +3,5 @@ private ["_round"]; _round = _this select 0; if(alive _round) then { GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round]; - [FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler; + [DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler; }; \ No newline at end of file diff --git a/addons/frag/functions/fnc_addTrack.sqf b/addons/frag/functions/fnc_addTrack.sqf index 4ffaef5a7c..65ad3b6a22 100644 --- a/addons/frag/functions/fnc_addTrack.sqf +++ b/addons/frag/functions/fnc_addTrack.sqf @@ -17,4 +17,4 @@ _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2) _positions set[(count _positions), [(getPos _obj), _objTVel]]; _data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color]; GVAR(traces) set[_index, _data]; -[FUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler; \ No newline at end of file +[DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 92b67e0256..5560a4f0af 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -44,13 +44,12 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { _exit = false; _vm = 1; _velocity = _initialData select 5; - _unitDir = _velocity call BIS_fnc_unitVector; _oldVelocity = _velocity call BIS_fnc_magnitude; _curVelocity = (velocity _round) call BIS_fnc_magnitude; if(alive _round) then { - _diff = [_velocity, (velocity _round)] call FUNC(vectorDiffFast); + _diff = _velocity vectorDiff (velocity _round); _polar = _diff call CBA_fnc_vect2polar; // player sideChat format["polar: %1", _polar]; if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then { @@ -63,7 +62,7 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { }; }; if(!_exit) then { - _unitDir = _velocity call BIS_fnc_unitVector; + _unitDir = vectorNormalized _velocity; _pos = _hpData select 3; _spallPos = nil; for "_i" from 0 to 100 do { @@ -137,7 +136,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; _fragment setPosASL _spallPos; _fragment setVelocity _spallFragVect; - // [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler; if(GVAR(traceFrags)) then { [player, _fragment, [1,0.5,0,1]] call FUNC(addTrack); }; @@ -159,7 +157,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; _fragment setPosASL _spallPos; _fragment setVelocity _spallFragVect; - // [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler; if(GVAR(traceFrags)) then { [player, _fragment, [1,0,0,1]] call FUNC(addTrack); }; diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 5910d2481b..a6e934c667 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -1,5 +1,4 @@ #include "script_component.hpp" -/* private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"]; if !(isNil QGVAR(enabled) && {GVAR(enabled)}) exitWith {}; @@ -23,7 +22,7 @@ if(_gun == player) then { }; }; }; -_doSpall = true; +_doSpall = false; if(_doSpall) then { if(GVAR(spallIsTrackingCount) <= 0) then { GVAR(spallHPData) = []; @@ -36,15 +35,14 @@ if(_doSpall) then { }; }; // player sideChat format["c: %1", GVAR(spallIsTrackingCount)]; -[player, _round, [1,0,0,1]] call FUNC(addTrack); +[player, _round, [1,0,0,1]] call nou_fnc_addTrack; if(_doFragTrack && alive _round) then { - GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round]; + GVAR(trackedObjects) pushBack _round; _spallTrack = []; _spallTrackID = []; - [FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler; + [DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler; if(_doSpall) then { [_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack); }; // player sideChat "WTF2"; }; -*/ \ No newline at end of file diff --git a/addons/frag/functions/fnc_frag_trace.sqf b/addons/frag/functions/fnc_frag_trace.sqf index 9b0c8dc3db..f4e14fa12a 100644 --- a/addons/frag/functions/fnc_frag_trace.sqf +++ b/addons/frag/functions/fnc_frag_trace.sqf @@ -6,5 +6,5 @@ _shell = _params select 0; if(alive _shell) then { drop ["\Ca\Data\Cl_basic","","Billboard",1,30,(getPos _shell),[0,0,0],1,1.275,1.0,0.0,[0.5],[[0,1,0,1]],[0],0.0,2.0,"","",""]; } else { - [_this select 1] call FUNC(removeBISPFH); + [_this select 1] call cba_fnc_removePerFrameHandler; }; \ No newline at end of file diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index 88ec0c4742..79eea53cd7 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -130,11 +130,12 @@ if(_isArmed && (count _objects) > 0) then { _targetVel = (velocity _target); - _targetPos set[2, (_targetPos select 2)+_add]; + _targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))]; _targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))]; - - _baseVec = [_lastPos, _targetPos] call BIS_fnc_vectorFromXToY; + _targetPos set[2, (_targetPos select 2)+_add]; + + _baseVec = _lastPos vectorFromTo _targetPos; _dir = floor(_baseVec call CBA_fnc_vectDir); _currentCount = _fragArcs select _dir; @@ -213,7 +214,6 @@ if(_isArmed && (count _objects) > 0) then { _fragObj setVelocity _vel; #ifdef DEBUG_MODE_FULL GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; - // [FUNC(frag_trace), 0, [_fragObj]] call cba_fnc_addPerFrameHandler; GVAR(traceFrags) = true; #endif if(GVAR(traceFrags)) then { diff --git a/addons/frag/functions/fnc_spallHP.sqf b/addons/frag/functions/fnc_spallHP.sqf index aeba4e7a5d..89ba572ce2 100644 --- a/addons/frag/functions/fnc_spallHP.sqf +++ b/addons/frag/functions/fnc_spallHP.sqf @@ -21,7 +21,7 @@ if((_this select 0) <= (count GVAR(spallHPData))) then { // diag_log text format["%1: %2", _forEachIndex, _x]; // } forEach _hp; // } forEach (_this select 1); - [FUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler; + [DFUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler; // player sideChat "WEEE"; } forEach (_this select 1); }; diff --git a/addons/frag/functions/fnc_stopTracing.sqf b/addons/frag/functions/fnc_stopTracing.sqf index 02b4fd7f59..693390fff2 100644 --- a/addons/frag/functions/fnc_stopTracing.sqf +++ b/addons/frag/functions/fnc_stopTracing.sqf @@ -1,5 +1,5 @@ #include "script_component.hpp" if(GVAR(tracesStarted)) then { GVAR(tracesStarted) = false; - [GVAR(traceID)] call FUNC(removeBISPFH); + [GVAR(traceID)] call cba_fnc_removePerFrameHandler; }; \ No newline at end of file diff --git a/addons/frag/functions/fnc_trackFragRound.sqf b/addons/frag/functions/fnc_trackFragRound.sqf index 2780a85664..0a8e3948d0 100644 --- a/addons/frag/functions/fnc_trackFragRound.sqf +++ b/addons/frag/functions/fnc_trackFragRound.sqf @@ -12,7 +12,7 @@ _spallTrack = _params select 7; _foundObjectHPIds = _params select 8; if (!alive _round) then { - [_this select 1] call FUNC(removeBISPFH); + [_this select 1] call cba_fnc_removePerFrameHandler; if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then { GVAR(trackedObjects) = GVAR(trackedObjects) - [_round]; _skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP"); @@ -22,7 +22,7 @@ if (!alive _round) then { _force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE"); _fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange)); if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then { - [QGVAR(frag_eh), _params] call CBA_fnc_clientToServerEvent; + [QGVAR(frag_eh), _params] call ace_common_fnc_serverEvent; GVAR(trackedObjects) = GVAR(trackedObjects) - [_round]; }; }; @@ -38,7 +38,7 @@ if (!alive _round) then { }; } else { if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then { - [_this select 1] call FUNC(removeBISPFH); + [_this select 1] call cba_fnc_removePerFrameHandler; if(_round in GVAR(blackList)) then { GVAR(blackList) = GVAR(blackList) - [_round]; }; diff --git a/addons/frag/functions/fnc_trackTrace.sqf b/addons/frag/functions/fnc_trackTrace.sqf index 71b4a9a866..628fece605 100644 --- a/addons/frag/functions/fnc_trackTrace.sqf +++ b/addons/frag/functions/fnc_trackTrace.sqf @@ -10,5 +10,5 @@ if(alive _tracerObj && (count GVAR(traces)) > 0) then { _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2); _positions set[(count _positions), [(getPos _tracerObj), _objTVel]]; } else { - [(_this select 1)] call FUNC(removeBISPFH); + [(_this select 1)] call cba_fnc_removePerFrameHandler; }; \ No newline at end of file diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index 274270cbbb..371067db3e 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -1,7 +1,7 @@ #define COMPONENT frag #include "\z\ace\Addons\main\script_mod.hpp" -#define DEBUG_ENABLED_FRAG +//#define DEBUG_ENABLED_FRAG #ifdef DEBUG_ENABLED_FRAG #define DEBUG_MODE_FULL @@ -11,4 +11,6 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_FRAG #endif -#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\Addons\main\script_macros.hpp" + +#define ACE_TRACE_DRAW_INC 1 \ No newline at end of file