mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial commit of frag/spalling optimization rewrite. Now tracks in single PFH, with index-based referencing instead of searches. TODO: Break spall calculation up to multiple frames. Needs testing.
This commit is contained in:
46
addons/frag/functions/fnc_masterPFH.sqf
Normal file
46
addons/frag/functions/fnc_masterPFH.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Author: jaynus
|
||||
*
|
||||
* Master single PFH abstraction for all rounds being tracked by frag/spall
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
PARAMS_2(_pfhArgs,_handle);
|
||||
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
private["_gcIndex"];
|
||||
_gcIndex = [];
|
||||
{
|
||||
private["_object", "_args"];
|
||||
_object = _x;
|
||||
if(!isNil "_object") then {
|
||||
if(isNull _object) then {
|
||||
_gcIndex pushBack _forEachIndex;
|
||||
} else {
|
||||
_args = GVAR(arguments) select _forEachIndex;
|
||||
|
||||
_args call FUNC(pfhRound);
|
||||
};
|
||||
|
||||
if(!alive _object) then {
|
||||
_gcIndex pushBack _forEachIndex;
|
||||
};
|
||||
};
|
||||
} forEach GVAR(objects);
|
||||
|
||||
// clean up dead object references
|
||||
private["_deletionCount", "_deleteIndex"];
|
||||
_deletionCount = 0;
|
||||
{
|
||||
_deleteIndex = _gcIndex - _deletionCount;
|
||||
GVAR(objects) deleteAt _deleteIndex;
|
||||
GVAR(arguments) deleteAt _deleteIndex;
|
||||
|
||||
_deletionCount = _deletionCount + 1;
|
||||
} forEach _gcIndex;
|
Reference in New Issue
Block a user