removed unused functions

This commit is contained in:
lambdatiger 2024-01-10 15:47:50 -06:00
parent 3578b7a2fb
commit 0da454d270
11 changed files with 27 additions and 218 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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"
[

View File

@ -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);
};

View File

@ -1,34 +0,0 @@
#include "script_component.hpp"
/*
* Author: Lambda.Tiger
* Fades a trace over time based on given parameters
*
* Arguments:
* 0: PFEH arguments <ARRAY>
* 1: PHEH handle <SCALAR>
*
* 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;
};

View File

@ -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"
[
{

View File

@ -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));
};

View File

@ -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

View File

@ -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 {

View File

@ -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;
};

View File

@ -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 {