This commit is contained in:
PabstMirror 2015-06-18 22:04:48 -05:00
parent e235ebcc15
commit 9c0478ddfd
12 changed files with 33 additions and 88 deletions

View File

@ -6,7 +6,7 @@ if(GVAR(EnableDebugTrace) && !isMultiplayer) then {
};
if(isServer) then {
[QGVAR(frag_eh), { _this call FUNC(frago); }] call ace_common_fnc_addEventHandler;
[QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler);
};
[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
private ["_round"];
_round = _this select 0;
GVAR(blackList) set[(count GVAR(blackList)), _round];
GVAR(blackList) set [(count GVAR(blackList)), _round];

View File

@ -28,14 +28,16 @@ if(_gun == ACE_player) then {
};
};
};
_doSpall = false;
if(GVAR(SpallEnabled)) then {
if(GVAR(spallIsTrackingCount) <= 0) then {
GVAR(spallHPData) = [];
};
if(GVAR(spallIsTrackingCount) > 5) then {
// ACE_player sideChat "LIMT!";
_doSpall = false;
} else {
_doSpall = true;
GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) + 1;
};
};
@ -46,30 +48,27 @@ if(GVAR(autoTrace)) then {
};
// We only do the single track object check here.
// We should do an {!(_round in GVAR(objects))}
// We should do an {!(_round in GVAR(objects))}
// But we leave that out here for optimization. So this cannot be a framework function
// Otherwise, it should only be added once and from the FiredEH
if(_doFragTrack && alive _round) then {
_spallTrack = [];
_spallTrackID = [];
private["_args"];
_args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID,
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))),
(getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")),
(getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")),
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force))),
(getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")))))
];
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))),
(getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")),
(getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")),
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force))),
(getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")))))
];
TRACE_1("Initializing track", _round);
GVAR(objects) pushBack _round;
GVAR(arguments) pushBack _args;
if(_doSpall) then {
[_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack);
};
// ACE_player sideChat "WTF2";
};

View File

@ -149,4 +149,4 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
};
};
};
};
};

View File

@ -1,11 +1,7 @@
//fnc_findReflections.sqf
#include "script_component.hpp"
private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange",
"_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos",
"_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp",
"_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec"];
private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"];
_params = _this select 0;
_pos = _params select 0;
@ -46,7 +42,7 @@ if(_zIndex < 5) then {
// } forEach _res;
// drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""];
// TEST_PAIRS pushBack [_pos, _lastPos, [1,0,0,1]];
};
// if(terrainIntersectASL [_pos, _testPos]) exitWith {};
_lastPos = _testPos;
@ -91,7 +87,7 @@ if(_zIndex < 5) then {
_avgX = 0;
_avgY = 0;
_avgZ = 0;
{
_avgX = _avgX + (_x select 0);
_avgY = _avgY + (_x select 1);
@ -99,7 +95,7 @@ if(_zIndex < 5) then {
} forEach _blist;
_c = count _blist;
_bpos = [_avgX/_c, _avgY/_c, _avgZ/_c];
_distance = _pos vectorDistance _bpos;
_hitFactor = 1-(((_distance/(_indirectHitRange*4)) min 1) max 0);
// _hitFactor = 1/(_distance^2);
@ -108,16 +104,16 @@ if(_zIndex < 5) then {
_hit = _hit - (_hit%10);
_range = (floor (_indirectHitRange-(_distance/4))) min 100;
_range = _range - (_range%2);
if(_hit >= 10 && _range > 0) then {
// TEST_ICONS pushBack [_bpos, format["h: %1, r: %2, hf: %3 d: %4 ihr: %5", _hit, _range, _hitFactor, _distance, _indirectHitRange*4]];
// TEST_PAIRS pushBack [_pos, _bpos, [1,0,0,1]];
_refExp = format["ace_explosion_reflection_%1_%2", _range, _hit];
// _refExp createVehicle (ASLtoATL _bpos);
// drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _bpos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""];
_explosions pushBack [_refExp, _bpos, _hit, _distance, _indirectHitRange/4, _depth];
};
if(count _explosions > (_radi*2)/_depth) exitWith {};
} forEach _buckets;

View File

@ -15,13 +15,13 @@
if (!GVAR(enabled)) exitWith {};
private["_gcIndex"];
private["_gcIndex", "_iter"];
_gcIndex = [];
_iter = 0;
while { (count GVAR(objects)) > 0 && { _iter < GVAR(MaxTrackPerFrame) } } do {
while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do {
private["_object", "_args"];
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) exitWith {
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then {
GVAR(lastIterationIndex) = 0;
};
_object = GVAR(objects) select GVAR(lastIterationIndex);
@ -47,4 +47,4 @@ _deletionCount = 0;
GVAR(arguments) deleteAt _deleteIndex;
_deletionCount = _deletionCount + 1;
} forEach _gcIndex;
} forEach _gcIndex;

View File

@ -2,8 +2,10 @@
// THIS FUNCTION SHOULD NOT BE USED BECAUSE IT CAUSES AN SEARCH AND REBUILD
PARAMS_1(_round);
if(_round in GVAR(blackList)) then {
GVAR(blackList) = GVAR(blackList) - [_round];
};
GVAR(objects) = GVAR(objects) - [_round];
GVAR(objects) = GVAR(objects) - [_round];

View File

@ -11,4 +11,4 @@ if(IS_ARRAY((_this select 0))) then {
_ret = false;
};
};
_ret
_ret

View File

@ -2,4 +2,4 @@
if(!GVAR(tracesStarted)) then {
GVAR(tracesStarted) = true;
GVAR(traceID) = [FUNC(drawTraces), 0, []] call cba_fnc_addPerFrameHandler;
};
};

View File

@ -2,4 +2,4 @@
if(GVAR(tracesStarted)) then {
GVAR(tracesStarted) = false;
[GVAR(traceID)] call cba_fnc_removePerFrameHandler;
};
};

View File

@ -1,52 +0,0 @@
//fnc_trackFragRound.sqf
#include "script_component.hpp"
private ["_params", "_round", "_lastPos", "_lastVel", "_type", "_time", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"];
_params = _this select 0;
_round = _params select 0;
_lastPos = _params select 1;
_lastVel = _params select 2;
_type = _params select 3;
_time = _params select 4;
_doSpall = _params select 6;
_spallTrack = _params select 7;
_foundObjectHPIds = _params select 8;
if (!alive _round) then {
[_this select 1] call cba_fnc_removePerFrameHandler;
if(_time != ACE_time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then {
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
_skip = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip));
if(_skip == 0) then {
_explosive = getNumber (configFile >> "CfgAmmo" >> _type >> "explosive");
_indirectRange = getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange");
_force = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(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 ace_common_fnc_serverEvent;
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
};
};
};
if(_doSpall) then {
GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) - 1;
// diag_log text format["F: %1", _foundObjectHPIds];
{
if(!isNil "_x") then {
_x removeEventHandler ["hitPart", _foundObjectHPIds select _forEachIndex];
};
} forEach _spallTrack;
};
} else {
if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then {
[_this select 1] call cba_fnc_removePerFrameHandler;
if(_round in GVAR(blackList)) then {
GVAR(blackList) = GVAR(blackList) - [_round];
};
};
_params set[1, (getPosASL _round)];
_params set[2, (velocity _round)];
if(_doSpall) then {
[_round, 1, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
};
};

View File

@ -8,7 +8,7 @@ _index = _params select 1;
if (alive _tracerObj && (count GVAR(traces)) > 0) then {
_data = GVAR(traces) select _index;
_positions = _data select 4;
_positions set[(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]];
_positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]];
} else {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};