From 0da454d2701258224746b7b3052202d454d391dc Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Wed, 10 Jan 2024 15:47:50 -0600 Subject: [PATCH] removed unused functions --- addons/frag/XEH_PREP.hpp | 4 +- addons/frag/XEH_preInit.sqf | 2 +- addons/frag/functions/fnc_dev_addRound.sqf | 24 +---- addons/frag/functions/fnc_dev_drawTrace.sqf | 25 +---- addons/frag/functions/fnc_dev_fadeRound.sqf | 34 ------- addons/frag/functions/fnc_dev_trackObj.sqf | 44 +++------ addons/frag/functions/fnc_doFrag.sqf | 6 +- addons/frag/functions/fnc_doSpall.sqf | 98 ------------------- addons/frag/functions/fnc_doSpallMomentum.sqf | 4 +- addons/frag/functions/fnc_fired.sqf | 2 +- addons/frag/functions/fnc_initRound.sqf | 2 +- 11 files changed, 27 insertions(+), 218 deletions(-) delete mode 100644 addons/frag/functions/fnc_dev_fadeRound.sqf delete mode 100644 addons/frag/functions/fnc_doSpall.sqf diff --git a/addons/frag/XEH_PREP.hpp b/addons/frag/XEH_PREP.hpp index 16dde5e8c7..350a178038 100644 --- a/addons/frag/XEH_PREP.hpp +++ b/addons/frag/XEH_PREP.hpp @@ -3,7 +3,6 @@ PREP(dev_fired); PREP(dev_fragCalcDump); PREP(dev_debugAmmo); PREP(dev_trackHitBox); -PREP(dev_fadeRound); PREP(dev_sphereDraw); PREP(dev_addRound); PREP(dev_trackObj); @@ -28,9 +27,8 @@ PREP(doFragRandom); // Spall PREP(shouldSpall); PREP(doSpall); -PREP(doSpallMomentum); +PREP(doSpall); PREP(getMaterialInfo); -//PREP(spallHP); Look at me !*! // Explosive Reflection PREP(findReflections); diff --git a/addons/frag/XEH_preInit.sqf b/addons/frag/XEH_preInit.sqf index e38296c5c4..646bcb1dbc 100644 --- a/addons/frag/XEH_preInit.sqf +++ b/addons/frag/XEH_preInit.sqf @@ -18,7 +18,7 @@ GVAR(lastFragTime) = -2; #include "initSettings.inc.sqf" -#ifdef DEBUG_MODE_FULL +#ifdef DEBUG_MODE_DRAW GVAR(dev_trackLines) = createHashMap; GVAR(dev_hitBoxes) = createHashMap; GVAR(dev_failedToDelete) = 0; diff --git a/addons/frag/functions/fnc_dev_addRound.sqf b/addons/frag/functions/fnc_dev_addRound.sqf index 49d4d24bc4..7ad5b05df3 100644 --- a/addons/frag/functions/fnc_dev_addRound.sqf +++ b/addons/frag/functions/fnc_dev_addRound.sqf @@ -24,28 +24,12 @@ params [ /// track round on each frame // Create entry in position array from hashmap -private _pID = getObjectID _proj; -if (GVAR(fadeRounds)) then +if (_sidePlayer) then { - if (_sidePlayer) then - { - GVAR(dev_trackLines) set [_pID, [__FADE_INIT, [getposATL _proj], [0, 0, 1, __FADE_INIT]]]; - } else - { - GVAR(dev_trackLines) set [_pID, [__FADE_INIT, [getposATL _proj], [1, 0.5, 0, __FADE_INIT]]]; - }; - - // add fading factor - [LINKFUNC(dev_fadeRound), __FADE_INTERVAL, [_pID]] call CBA_fnc_addPerFrameHandler; -} else + GVAR(dev_trackLines) set [getObjectID _proj, [1, [getposATL _proj], [0, 0, 1, 1]]]; +} else { - if (_sidePlayer) then - { - GVAR(dev_trackLines) set [_pID, [1, [getposATL _proj], [0, 0, 1, 1]]]; - } else - { - GVAR(dev_trackLines) set [_pID, [1, [getposATL _proj], [1, 0, 0, 1]]]; - }; + GVAR(dev_trackLines) set [getObjectID _proj, [1, [getposATL _proj], [1, 0, 0, 1]]]; }; // eventhandler to track round and cleanup when round is "dead" [ diff --git a/addons/frag/functions/fnc_dev_drawTrace.sqf b/addons/frag/functions/fnc_dev_drawTrace.sqf index c7ff03b13f..f561d0b513 100644 --- a/addons/frag/functions/fnc_dev_drawTrace.sqf +++ b/addons/frag/functions/fnc_dev_drawTrace.sqf @@ -16,32 +16,16 @@ private _deleteArr = []; { - private _alpha = _y#0; // leave if trace is not to be drawn - if (GVAR(dltTrace) && _alpha <= 0) then - { - _deleteArr pushBack _x; - continue; - }; - if (count (_y#1) > 1) then - { - private _color = _y#2; + { for "_j" from 1 to count (_y#1) - 1 do { - drawLine3D [_y#1#(_j-1), _y#1#_j, _color]; + drawLine3D [_y#1#(_j-1), _y#1#_j, _y#2]; }; }; } forEach GVAR(dev_trackLines); -if (GVAR(dltTrace)) then -{ - for "_i" from 0 to count _deleteArr - 1 do - { - GVAR(dev_trackLines) deleteAt (_deleteArr#_i); - }; -}; - if (GVAR(drawHitBox)) then { #define HB_DRAW_ARRS [[3,2,1,5,6,7,3,0,4,5],[0,1],[2,6],[7,4]] @@ -67,9 +51,4 @@ if (GVAR(drawHitBox)) then { { GVAR(dev_hitBoxes) deleteAt (_deleteArr#_i); }; -}; - -if (GVAR(frameHint)) then -{ - hintsilent str (1/diag_deltaTime); }; \ No newline at end of file diff --git a/addons/frag/functions/fnc_dev_fadeRound.sqf b/addons/frag/functions/fnc_dev_fadeRound.sqf deleted file mode 100644 index 49d1f566c4..0000000000 --- a/addons/frag/functions/fnc_dev_fadeRound.sqf +++ /dev/null @@ -1,34 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Lambda.Tiger - * Fades a trace over time based on given parameters - * - * Arguments: - * 0: PFEH arguments - * 1: PHEH handle - * - * Return Value: - * None - * - * Example: - * - * Public: No - */ -params ["_args", "_h"]; - -private _arr = GVAR(dev_trackLines) getOrDefault [(_args#0), []]; -if (count _arr < 3) exitWith -{ - [_h] call CBA_fnc_removePerFrameHandler; -}; - -private _alpha = _arr#0; -private _color = _arr#2; -_alpha = (_alpha - __FADE_RATE) min 1; -_arr set [0, _alpha]; -_color set [3, _alpha]; -_color set [1, (0.5 - _alpha/2) max 0]; -if (_alpha <= 0 ) then -{ - [_h] call CBA_fnc_removePerFrameHandler; -}; \ No newline at end of file diff --git a/addons/frag/functions/fnc_dev_trackObj.sqf b/addons/frag/functions/fnc_dev_trackObj.sqf index 9b43ec9c5c..c06fa763ae 100644 --- a/addons/frag/functions/fnc_dev_trackObj.sqf +++ b/addons/frag/functions/fnc_dev_trackObj.sqf @@ -24,39 +24,19 @@ params [ TRACE_4("devDraw",_this,_obj,_color,_isProj); /// track round on each frame // Create entry in position array from hashmap -private _pID = getObjectID _obj; -if (GVAR(fadeRounds)) then -{ - private _colorArray = switch (toLower _color) do { - case "purple": {[0.8, 0, 0.8, __FADE_INIT]}; - case "blue": {[0, 0, 0.8, __FADE_INIT]}; - case "green": {[0, 0.8, 0, __FADE_INIT]}; - case "orange": {[0.8, 0.518, 0, __FADE_INIT]}; - case "yellow": {[0.8, 0.8, 0, __FADE_INIT] }; - case "red": {[0.8, 0, 0, __FADE_INIT]}; - case "black": {[1, 1, 1, __FADE_INIT]}; - case "white": {[0, 0, 0, __FADE_INIT]}; - default {[0, 0.8, 0.8, __FADE_INIT]}; - }; - - GVAR(dev_trackLines) set [_pID, [__FADE_INIT, [getposATL _obj], _colorArray]]; - // add fading factor - [LINKFUNC(dev_fadeRound), __FADE_INTERVAL, [_pID]] call CBA_fnc_addPerFrameHandler; -} else -{ - private _colorArray = switch (toLower _color) do { - case "purple": {[0.8, 0, 0.8, 1]}; - case "blue": {[0, 0, 0.8, 1]}; - case "green": {[0, 0.8, 0, 1]}; - case "orange": {[0.8, 0.518, 0, 1]}; - case "yellow": {[0.8, 0.8, 0, 1] }; - case "red": {[0.8, 0, 0, 1]}; - case "black": {[1, 1, 1, 1]}; - case "white": {[0, 0, 0, 1]}; - default {[0, 0.8, 0.8, 1]}; - }; - GVAR(dev_trackLines) set [_pID, [1, [getposATL _obj], _colorArray]]; +private _colorArray = switch (toLower _color) do { + case "purple": {[0.8, 0, 0.8, 1]}; + case "blue": {[0, 0, 0.8, 1]}; + case "green": {[0, 0.8, 0, 1]}; + case "orange": {[0.8, 0.518, 0, 1]}; + case "yellow": {[0.8, 0.8, 0, 1] }; + case "red": {[0.8, 0, 0, 1]}; + case "black": {[1, 1, 1, 1]}; + case "white": {[0, 0, 0, 1]}; + default {[0, 0.8, 0.8, 1]}; }; +GVAR(dev_trackLines) set [getObjectID _obj, [1, [getposATL _obj], _colorArray]]; + // eventhandler to track round and cleanup when round is "dead" [ { diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index b8cdc72d2a..8316ee268e 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -52,9 +52,9 @@ if (_heightAGL < 0.25) then { _posASL = _posASL vectorAdd [0, 0, 0.25]; }; -// !*! make timesince a gvar? -TRACE_4("fnc_doFragTargeted IF", _fragRange, _timeSince, GVAR(fragSimComplexity)); -if (_fragRange > 3 && _timeSince > 0.3 && {GVAR(fragSimComplexity) != 1}) then { +// !*! make holdoff a gvar? +TRACE_3("fnc_doFragTargeted IF", _fragRange, _timeSince, GVAR(fragSimComplexity)); +if (_fragRange > 3 && _timeSince > ACE_FRAG_HOLDOFF*1.5 && GVAR(fragSimComplexity) != 1) then { _maxFrags = _maxFrags - ([_posASL, _fragVel, _fragRange, _maxFrags, _fragTypes, _modFragCount, _shotParents] call FUNC(doFragTargeted)); }; diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf deleted file mode 100644 index b1281404f2..0000000000 --- a/addons/frag/functions/fnc_doSpall.sqf +++ /dev/null @@ -1,98 +0,0 @@ -#include "script_component.hpp" -/* - * Author: ACE-Team - * Dev things - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_frag_fnc_doSpall - * - * Public: No - */ -params ["_projectile", "_hitObj", "", "_lPosASL", "_lVel", "", "", "" ,"_surfaceType"]; - -if (!isNil "_hitObj" && {_hitObj isKindOf "man"}) exitWith {}; - -if ((isNil "_lPosASL") || {!(_lPosASL isEqualTypeArray [0,0,0])}) exitWith {WARNING_1("Problem with hitPart data - bad pos [%1]",_lPosASL);}; - - -private _posASL = _lPosASL; -private _vel = [0, 0, 0]; -private _lVelUnit = vectorNormalized _lVel; -private _velMod = 1; -if (alive _projectile) then { - _vel = velocity _projectile; - _posASL = getPosASL _projectile; - // Dot product math - private _diffAngle = acos (_lVelUnit vectorDotProduct vectorNormalized _vel); - - if (abs _diffAngle > 45) then { - SUB(_velMod, (vectorMagnitude _vel) / (vectorMagnitude _lVel)); - }; - _projectile setVariable [QGVAR(lastSpallTime), diag_tickTime ]; -}; - - -//** start calculating where the spalling should come **// -private _unitStep = _lVelUnit vectorMultiply 0.05; -private _spallPos = +_lPosASL; -// exit if we hit the ground -if (terrainIntersectASL [_lPosASL vectorAdd _unitStep, _lPosASL]) exitWith {}; -// step through -for "_i" from 1 to 20 do -{ - private _nPos = _spallPos vectorAdd _unitStep; - if (!lineIntersects [_spallPos, _nPos]) then {break}; - _spallPos = +_nPos; -}; -#ifdef DEBUG_MODE_DRAW -if (GVAR(dbgSphere)) then { - [_spallPos, "orange"] call FUNC(dev_sphereDraw); - [_lPosASL, "orange"] call FUNC(dev_sphereDraw); -}; -#endif -// find last intersect with the object - -private _ammo = typeOf _projectile; -private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); - -#ifdef DEBUG_MODE_FULL -private _dv = vectorMagnitude _lVel - vectorMagnitude _vel; -private _caliber = getNumber (configFile >> "cfgAmmo" >> _ammo >> "caliber"); -systemChat ("dV: " + str _dv + ", caliber: " + str _caliber + ", product: " + str (_caliber*_dv)); -#endif - -if (_explosive > 0) then { - private _fragMod = (_ammo call FUNC(getFragInfo))#1; - _velMod = _fragMod * _velMod; -}; - -// diag_log text format ["SPALL POWER: %1", _spallPolar select 0]; -// range of spread 15-40 -// N rounds 5-15 -// speed from 0.75-1.5 -// range of spread 5-10 -// N rounds 3-8 -// speed from 0.75-1.5 -private _velScalar = 0.33 * _velMod; - -private _fragSpawner = QGVAR(base) createVehicleLocal [0,0,12345]; -_fragSpawner setPosASL _spallPos; -_fragSpawner setVectorDirandUp [vectorDir _projectile, vectorUp _projectile]; -_fragSpawner setVelocity (_lVelUnit vectorMultiply _velScalar); - - -#ifdef DEBUG_MODE_DRAW -_fragSpawner addEventHandler [ - "SubmunitionCreated", - { - params ["", "_subProj"]; - [_subProj] call FUNC(dev_addRound); - } -]; -#endif \ No newline at end of file diff --git a/addons/frag/functions/fnc_doSpallMomentum.sqf b/addons/frag/functions/fnc_doSpallMomentum.sqf index eaec55c1d7..42eb09d52f 100644 --- a/addons/frag/functions/fnc_doSpallMomentum.sqf +++ b/addons/frag/functions/fnc_doSpallMomentum.sqf @@ -11,7 +11,7 @@ * None * * Example: - * [BIS_HITPART_EH_ARGS] call ace_frag_fnc_doSpallMomentum; + * [BIS_HITPART_EH_ARGS] call ace_frag_fnc_doSpall; * * Public: No */ @@ -54,7 +54,7 @@ private _vel = if (alive _projectile) then { private _dV = vectorMagnitude _lVel - vectorMagnitude _vel; private _caliber = getNumber (configFile >> "cfgAmmo" >> _ammo >> "caliber"); // !*! optimize this later? // scaled momentum change made on caliber-mass assumption ~sqrt(2)/20 * caliber ~= mass -private _deltaMomentum = 0.0707 * _caliber * sqrt( _dV ); +private _deltaMomentum = 0.0707 * _caliber * sqrt( _dV ) * GVAR(SpallIntensity); TRACE_3("found speed",_dV,_caliber,_deltaMomentum); if (_deltaMomentum < 2) exitWith { diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 5a2f0cc5c7..d6918a067a 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -54,7 +54,7 @@ if (GVAR(spallEnabled) && {_shouldSpall}) then "HitPart", { if (isServer) then { - [LINKFUNC(doSpallMomentum), _this] call CBA_fnc_execNextFrame; + [LINKFUNC(doSpall), _this] call CBA_fnc_execNextFrame; } else { [QGVAR(spall_eh), [_this]] call CBA_fnc_serverEvent; }; diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index b636637044..bac3b0c879 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -66,7 +66,7 @@ if (GVAR(spallEnabled) && {_shouldSpall}) then private _vUp = vectorUp _proj; if (isServer) then { [ - LINKFUNC(doSpallMomentum), + LINKFUNC(doSpall), [_proj, _hitObj, _posASL, _vel, _sNorm, _surfType, _ammo, _shotPrnt, _vUp] ] call CBA_fnc_execNextFrame; } else {