diff --git a/addons/frag/functions/fnc_dev_trackObj.sqf b/addons/frag/functions/fnc_dev_trackObj.sqf index 4c73809dfe..fae711e26d 100644 --- a/addons/frag/functions/fnc_dev_trackObj.sqf +++ b/addons/frag/functions/fnc_dev_trackObj.sqf @@ -41,7 +41,7 @@ GVAR(dev_trackLines) set [getObjectID _object, [[getPosATL _object], _colorArray // event handler to track round and cleanup when round is "dead" [ { - if (isGamePaused || setAccTime == 0) exitWith {}; + if (isGamePaused || accTime == 0) exitWith {}; params ["_object", "_handle"]; if (!alive _object) exitWith { diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index a835f08027..27c92d1682 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -1,11 +1,10 @@ #include "..\script_component.hpp" /* * Author: Jaynus, NouberNou, Lambda.Tiger - * This function handles creating both random and targeted fragments as well - * as handling some of the performance optimizations. + * This function handles creating both random and targeted fragments as well as handling some of the performance optimizations. * * Arguments: - * 0: ASL position of projectile. + * 0: Position (posASL) of projectile * 1: Velocity of projectile * 2: Projectile CfgAmmo classname * 3: getShotParents of projectile at EH @@ -19,12 +18,7 @@ * Public: No */ TRACE_1("begin doFrag",_this); -params [ - "_posASL", - "_velocity", - "_ammo", - "_shotParents" -]; +params ["_posASL", "_velocity", "_ammo", "_shotParents"]; // Don't let a single object cause all fragmentation events _shotParents params ["_shotParentVic"]; @@ -35,7 +29,7 @@ _shotParentVic setVariable [QGVAR(obj_nextFragTime), CBA_missionTime + ACE_FRAG_ // Check normal round timeout and adjust _max frags private _timeSinceLastFrag = CBA_missionTime - GVAR(lastFragTime); -if (_timeSinceLastFrag < ACE_FRAG_HOLDOFF || {_posASL isEqualTo [0, 0, 0] || _ammo isEqualTo ""}) exitWith { +if (_timeSinceLastFrag < ACE_FRAG_HOLDOFF || {_posASL isEqualTo [0, 0, 0]} || {_ammo isEqualTo ""}) exitWith { TRACE_3("timeExit",_timeSinceLastFrag,CBA_missionTime,GVAR(lastFragTime)); }; private _maxFragCount = round linearConversion [ACE_FRAG_COUNT_MIN_TIME, ACE_FRAG_COUNT_MAX_TIME, _timeSinceLastFrag, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true]; diff --git a/addons/frag/functions/fnc_doFragRandom.sqf b/addons/frag/functions/fnc_doFragRandom.sqf index 6e6f8ecf51..5101e414d0 100644 --- a/addons/frag/functions/fnc_doFragRandom.sqf +++ b/addons/frag/functions/fnc_doFragRandom.sqf @@ -1,16 +1,15 @@ #include "..\script_component.hpp" /* * Author: Jaynus, NouberNou, Lambda.Tiger - * This function creates fragments randomly spreading out from an explosion to - * a maximum of 15. + * This function creates fragments randomly spreading out from an explosion to a maximum of 15. * * Arguments: - * 0: Position of fragmenting projectile ASL. - * 1: Velocity of the fragmenting projectile. - * 2: Height (AGL) of the fragmenting projectile. - * 3: Type of fragments to generate. - * 4: Remaining fragment budget. - * 5: Shot parents. + * 0: Position (posASL) of fragmenting projectile + * 1: Velocity of the fragmenting projectile + * 2: Height (AGL) of the fragmenting projectile + * 3: Type of fragments to generate + * 4: Remaining fragment budget + * 5: Shot parents * * Return Value: * None @@ -20,14 +19,7 @@ * * Public: No */ -params [ - "_posASL", - "_fragVelocity", - "_heightAGL", - "_fragType", - "_maxFragCount", - "_shotParents" -]; +params ["_posASL", "_fragVelocity", "_heightAGL", "_fragType", "_maxFragCount", "_shotParents"]; TRACE_6("doFragRandom",_posASL,_fragVelocity,_heightAGL,_fragType,_maxFragCount,_shotParents); // See CfgAmmoFragSpawner for different frag types diff --git a/addons/frag/functions/fnc_doFragTargeted.sqf b/addons/frag/functions/fnc_doFragTargeted.sqf index f914b64491..d49025541e 100644 --- a/addons/frag/functions/fnc_doFragTargeted.sqf +++ b/addons/frag/functions/fnc_doFragTargeted.sqf @@ -1,8 +1,7 @@ #include "..\script_component.hpp" /* * Author: Jaynus, NouberNou, Lambda.Tiger - * This function creates fragments targeted at specific entities, up to - * a configured maximum. + * This function creates fragments targeted at specific entities, up to _maxFrags. * * Arguments: * 0: Position of fragmenting projectile ASL @@ -25,15 +24,7 @@ #define ACE_FRAG_DEFAULT_CROSS_AREA 0.75 #define ACE_FRAG_MIN_TARGET_AREA 0.5 -params [ - "_posASL", - "_fragVelocity", - "_fragRange", - "_maxFrags", - "_fragTypes", - "_modFragCount", - "_shotParents" -]; +params [ "_posASL", "_fragVelocity", "_fragRange", "_maxFrags", "_fragTypes", "_modFragCount", "_shotParents"]; TRACE_5("fnc_doFragTargeted",_posASL,_fragRange,_maxFrags,_fragTypes,_modFragCount); if (_fragTypes isEqualTo []) then { diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index f352e253d3..4bcb58ecab 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: Jaynus, NouberNou, Lambda.Tiger, - * This function creates spalling if the hit slowed the speed down enough. + * This function creates spalling if the hit slowed the projectile speed down enough. * * Arguments: * Arguments are the same as BI's "HitPart" EH: @@ -15,24 +15,16 @@ * * Public: No */ +#define GLUE(g1,g2) g1##g2 TRACE_1("doSpall",_this); -params [ - "_projectile", - "_objectHit", - "_lastPosASL", - "_lastVelocity", - "_surfaceNorm", - "_surfaceType", - "_ammo", - "_shotParents", - "_vectorUp" -]; +params ["_projectile", "_objectHit", "_lastPosASL", "_lastVelocity", "_surfaceNorm", "_surfaceType", "_ammo", "_shotParents", "_vectorUp"]; -if (CBA_missionTime < GVAR(nextSpallAllowTime)|| - _lastPosASL isEqualTo [0,0,0] || - {_ammo isEqualTo "" || {!isNull _objectHit && - {objectHit isKindOf "CAManBase"}}}) exitWith { +if (CBA_missionTime < GVAR(nextSpallAllowTime) || + {isNull _objectHit} || + {_lastPosASL isEqualTo [0,0,0]} || + {_ammo isEqualTo ""} || + {_objectHit isKindOf "CAManBase"}) exitWith { TRACE_4("time/invalidHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); }; @@ -114,15 +106,15 @@ if GVAR(dbgSphere) then { private _spawnSize = switch (true) do { - case (_spallPower < 3): { "_spall_tiny" }; - case (_spallPower < 5): { "_spall_small" }; - case (_spallPower < 8): { "_spall_medium" }; - case (_spallPower < 12): { "_spall_large" }; - default { "_spall_huge" }; + case (_spallPower < 3): {"_spall_tiny"}; + case (_spallPower < 5): {"_spall_small"}; + case (_spallPower < 8): {"_spall_medium"}; + case (_spallPower < 12): {"_spall_large"} ; + default {"_spall_huge"}; }; private _spallSpawner = createVehicle [ - "ace_frag_" + _material + _spawnSize, + QUOTE(GLUE(ADDON,_)) + _material + _spawnSize, ASLToATL _spallPosASL, [], 0, diff --git a/addons/frag/functions/fnc_getMaterialInfo.sqf b/addons/frag/functions/fnc_getMaterialInfo.sqf index a7940d016c..7b3435b16a 100644 --- a/addons/frag/functions/fnc_getMaterialInfo.sqf +++ b/addons/frag/functions/fnc_getMaterialInfo.sqf @@ -1,23 +1,22 @@ #include "..\script_component.hpp" -#define ACE_FRAG_SOUNDENVIRON_STR_LEN 12 -#define ACE_FRAG_SOUNDGIT_STR_LEN 8 -#define ACE_FRAG_MATERIAL_SEARCH_LEN 10 /* * Author: Lambda.Tiger - * This function returns a classification of material type based - * on the surface hit. + * This function returns a classification of material type based on the surface hit. * * Arguments: - * 0: surfacetype - either a CfgSurfaces path .bisurf filepath + * 0: Surface type given as either a CfgSurfaces path or .bisurf filepath, same format as "HitPart" projectile parameter * * Return Value: - * _material - Material categories as expanded on in line 44 below + * Material categories as expanded on in line 44 below * * Example: * [_surfaceType] call ace_frag_fnc_getFragInfo; * * Public: No */ +#define ACE_FRAG_SOUNDENVIRON_STR_LEN 12 +#define ACE_FRAG_SOUNDGIT_STR_LEN 8 +#define ACE_FRAG_MATERIAL_SEARCH_LEN 10 params ["_surfType"]; diff --git a/addons/frag/functions/fnc_getSpallInfo.sqf b/addons/frag/functions/fnc_getSpallInfo.sqf index 4c76a0b909..da1347a135 100644 --- a/addons/frag/functions/fnc_getSpallInfo.sqf +++ b/addons/frag/functions/fnc_getSpallInfo.sqf @@ -1,17 +1,16 @@ #include "..\script_component.hpp" /* * Author: Lambda.Tiger - * This function returns spalling parameters for a specific - * ammo type. + * This function returns spalling parameters for a specific ammo type. * * Arguments: - * 0: _ammo - CfgAmmo type of ammo to check + * 0: Ammo classname * * Return Value: * _ammoInfo - * 0: _caliber - search range for fragments - * 1: _explosive - whether the round is explosive or not - * 2: _indirectHitRange - Indirect hit damage + * 0: Caliber + * 1: What part of the hit damage is from ballistic vs explosive energy (1 for all explosive) + * 2: Indirect hit damage * * Example: * ["B_556x45_Ball"] call ace_frag_fnc_getSpallInfo; diff --git a/addons/frag/functions/fnc_initMaterialCache.sqf b/addons/frag/functions/fnc_initMaterialCache.sqf index 809221e40f..b125d0119c 100644 --- a/addons/frag/functions/fnc_initMaterialCache.sqf +++ b/addons/frag/functions/fnc_initMaterialCache.sqf @@ -1,8 +1,7 @@ #include "..\script_component.hpp" /* * Author: Lambda.Tiger - * For performance, we load a bunch of vanilla materials preemptively into - * the spall material cache. + * For performance, we load a bunch of vanilla materials preemptively into the spall material cache. * * Arguments: * None @@ -11,7 +10,7 @@ * None * * Example: - * call initMaterialCache; + * call ace_frag_fnc_initMaterialCache; * * Public: No */ diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index 4d785e2e5f..18dbb400ef 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -19,7 +19,7 @@ TRACE_1("ACE_Frag rndInit",_this); params ["_projectile"]; -if !(isServer) exitWith {}; +if (!isServer) exitWith {}; private _ammo = typeOf _projectile; if (_ammo isEqualTo "" || {isNull _projectile}) exitWith { @@ -49,15 +49,12 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { _projectile addEventHandler [ "HitPart", { - params ["_projectile", "_hitObject", "", - "_posASL", "_velocity", "_surfNorm", "", - "", "_surfType" - ]; + params ["_projectile", "_hitObject", "", "_posASL", "_velocity", "_surfNorm", "", "", "_surfType"]; private _shotParent = getShotParents _projectile; private _ammo = typeOf _projectile; private _vectorUp = vectorUp _projectile; /* - * Wait a round to see what happens to the round, may result in + * Wait a frame to see what happens to the round, may result in * multiple hits / slowdowns getting shunted to the first hit */ [ diff --git a/addons/frag/functions/fnc_shouldSpall.sqf b/addons/frag/functions/fnc_shouldSpall.sqf index 1846bd99c7..c545c88676 100644 --- a/addons/frag/functions/fnc_shouldSpall.sqf +++ b/addons/frag/functions/fnc_shouldSpall.sqf @@ -4,7 +4,7 @@ * This function checks whether an ammunition type should cause spalling. * * Arguments: - * 0: Type of ammo to check + * 0: Ammo classname * * Return Value: * Whether the round type would spall when hitting an object