Frag Superanal Cleanup (#4803)

* Minimal frag cleanup

* Why did this even happen in the first place

Conflicts:
	addons/frag/functions/fnc_frago.sqf
This commit is contained in:
Ozan Eğitmen 2017-02-10 21:28:27 +03:00 committed by Glowbal
parent a2f1a4684e
commit 2554aba559
9 changed files with 52 additions and 61 deletions

View File

@ -1,6 +1,6 @@
#include "script_component.hpp"
if (GVAR(EnableDebugTrace) && {!isMultiplayer}) then {
if (GVAR(enableDebugTrace) && {!isMultiplayer}) then {
GVAR(traceFrags) = true;
GVAR(autoTrace) = true;
};

View File

@ -13,7 +13,7 @@ if (_round in GVAR(blackList)) exitWith {
};
// Exit on max track
if ((count GVAR(objects)) > GVAR(MaxTrack)) exitWith {};
if ((count GVAR(objects)) > GVAR(maxTrack)) exitWith {};
if (
_gun == ACE_player ||

View File

@ -103,6 +103,7 @@ for "_i" from 1 to _spallCount do {
[ACE_player, _fragment, [1, 0.5, 0, 1]] call FUNC(addTrack);
};
};
_spread = 5 + (random 5);
_spallCount = 3 + (random 5);
for "_i" from 1 to _spallCount do {

View File

@ -75,23 +75,18 @@ if (_zIndex < 5) then {
private _explosions = [];
{
private _blist = _x select 1;
private _avgX = 0;
private _avgY = 0;
private _avgZ = 0;
private _avg = [0, 0, 0];
{
ADD(_avgX,_x select 0);
ADD(_avgY,_x select 1);
ADD(_avgZ,_x select 2);
_avg = _avg vectorAdd _x;
} forEach _blist;
_c = count _blist;
private _bpos = [_avgX / _c, _avgY / _c, _avgZ / _c];
private _bpos = _avg vectorMultiply (1 / _c);
private _distance = _pos vectorDistance _bpos;
private _hitFactor = 1 - (((_distance / (_indirectHitRange * 4)) min 1) max 0);
// _hitFactor = 1 / (_distance ^ 2);
private _hit = _indirectHit * _hitFactor;
_hit = (floor (_hit / 4)) min 500;
private _hit = (floor (_indirectHit * _hitFactor / 4)) min 500;
SUB(_hit,_hit % 10);
private _range = (floor (_indirectHitRange - (_distance / 4))) min 100;
SUB(_range,_range % 2);

View File

@ -30,7 +30,7 @@ if (isNil "_shouldAdd") then {
_shouldAdd = false;
};
if (GVAR(SpallEnabled)) exitWith {
if (GVAR(spallEnabled)) exitWith {
//Always want to run whenever spall is enabled?
_shouldAdd = true;
TRACE_2("SettingCache[spallEnabled]",_ammo,_shouldAdd);

View File

@ -66,7 +66,7 @@ private _atlPos = ASLtoATL _lastPos;
private _fragPowerRandom = _fragPower * 0.5;
if ((_atlPos select 2) < 0.5) then {
_lastPos set [2, (_lastPos select 2) + 0.5];
_lastPos vectorAdd [0, 0, 0.5];
};
// _manObjects = _atlPos nearEntities ["CaManBase", _fragRange];
@ -96,7 +96,7 @@ _fragArcs set [360, 0];
private _doRandom = true;
if (_isArmed && {!(_objects isEqualTo [])}) then {
if (GVAR(ReflectionsEnabled)) then {
if (GVAR(reflectionsEnabled)) then {
[_lastPos, _shellType] call FUNC(doReflections);
};
{
@ -115,53 +115,49 @@ if (_isArmed && {!(_objects isEqualTo [])}) then {
private _distance = _targetPos vectorDistance _lastPos;
private _add = ((_boundingBoxB select 2) / 2) + ((((_distance - (_fragpower / 8)) max 0) / _fragPower) * 10);
private _targetVel = velocity _target;
_targetPos = _targetPos vectorAdd [
(_targetVel select 0) * (_distance / _fragPower),
(_targetVel select 1) * (_distance / _fragPower),
_add
];
_targetPos = _targetPos vectorAdd [
(_targetVel select 0) * (_distance / _fragPower),
(_targetVel select 1) * (_distance / _fragPower),
_add
];
private _baseVec = _lastPos vectorFromTo _targetPos;
private _baseVec = _lastPos vectorFromTo _targetPos;
private _dir = floor (_baseVec call CBA_fnc_vectDir);
private _currentCount = _fragArcs select _dir;
ISNILS(_currentCount,0);
if (_currentCount < 20) then {
private _count = ceil (random (sqrt (_m / 1000)));
private _vecVar = FRAG_VEC_VAR;
if (!(_target isKindOf "Man")) then {
_vecVar = ((sqrt _cubic) / 2000) + FRAG_VEC_VAR;
if ((crew _target) isEqualTo [] && {_count > 0}) then {
_count = 0 max (_count / 2);
};
private _dir = floor (_baseVec call CBA_fnc_vectDir);
private _currentCount = RETDEF(_fragArcs select _dir,0);
if (_currentCount < 20) then {
private _count = ceil (random (sqrt (_m / 1000)));
private _vecVar = FRAG_VEC_VAR;
if (!(_target isKindOf "Man")) then {
ADD(_vecVar,(sqrt _cubic) / 2000);
if ((crew _target) isEqualTo [] && {_count > 0}) then {
_count = 0 max (_count / 2);
};
for "_i" from 1 to _count do {
private _vec = _baseVec vectorDiff [
(_vecVar / 2) + (random _vecVar),
(_vecVar / 2) + (random _vecVar),
(_vecVar / 2) + (random _vecVar)
];
private _fp = _fragPower - (random (_fragPowerRandom));
private _vel = _vec vectorMultiply _fp;
private _fragType = round (random ((count _fragTypes) - 1));
private _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
// diag_log text format ["fp: %1 %2", _fp, typeOf _fragObj];
_fragObj setPosASL _lastPos;
_fragObj setVectorDir _vec;
_fragObj setVelocity _vel;
if (GVAR(traceFrags)) then {
INC(GVAR(totalFrags));
[ACE_player, _fragObj, [1,0,0,1]] call FUNC(addTrack);
};
INC(_fragCount);
INC(_currentCount);
};
_fragArcs set [_dir, _currentCount];
};
for "_i" from 1 to _count do {
private _vec = _baseVec vectorDiff [
(_vecVar / 2) + (random _vecVar),
(_vecVar / 2) + (random _vecVar),
(_vecVar / 2) + (random _vecVar)
];
private _fp = _fragPower - (random (_fragPowerRandom));
private _vel = _vec vectorMultiply _fp;
private _fragType = round (random ((count _fragTypes) - 1));
private _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
// diag_log text format ["fp: %1 %2", _fp, typeOf _fragObj];
_fragObj setPosASL _lastPos;
_fragObj setVectorDir _vec;
_fragObj setVelocity _vel;
if (GVAR(traceFrags)) then {
INC(GVAR(totalFrags));
[ACE_player, _fragObj, [1,0,0,1]] call FUNC(addTrack);
};
INC(_fragCount);
INC(_currentCount);
};
_fragArcs set [_dir, _currentCount];
};
};
//};

View File

@ -19,7 +19,7 @@ private _gcIndex = [];
private _iter = 0;
private _objectCount = count GVAR(objects);
while {_objectCount > 0 && {_iter < (GVAR(MaxTrackPerFrame) min _objectCount)}} do {
while {_objectCount > 0 && {_iter < (GVAR(maxTrackPerFrame) min _objectCount)}} do {
if (GVAR(lastIterationIndex) >= _objectCount) then {
GVAR(lastIterationIndex) = 0;

View File

@ -32,8 +32,7 @@ _this set [1, getPosASL _round];
_this set [2, velocity _round];
if (_doSpall) then {
private ["_scale"];
_scale = ((count GVAR(objects)) / GVAR(MaxTrackPerFrame)) max 0.1;
private _scale = ((count GVAR(objects)) / GVAR(maxTrackPerFrame)) max 0.1;
[_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
};

View File

@ -2,7 +2,7 @@
// THIS FUNCTION SHOULD NOT BE USED BECAUSE IT CAUSES AN SEARCH AND REBUILD
PARAMS_1(_round);
params ["_round"];
if (_round in GVAR(blackList)) then {
REM(GVAR(blackList),_round);