diff --git a/addons/frag/cfgAmmoFragSpawner.hpp b/addons/frag/cfgAmmoFragSpawner.hpp index d7dc0be689..3b6a507603 100644 --- a/addons/frag/cfgAmmoFragSpawner.hpp +++ b/addons/frag/cfgAmmoFragSpawner.hpp @@ -1,5 +1,3 @@ -// format fragType_spawn_n_range -/********************* ***************************/ class GVAR(spawnbase) : B_65x39_Caseless { access = 2; deleteParentWhenTriggered = 1; @@ -16,7 +14,9 @@ class GVAR(spawnbase) : B_65x39_Caseless { ACE_FRAG_RM_EH; }; -/********************* ***************************/ +/* + * Default frag, spawning 10 fragments + */ class GVAR(def_10) : GVAR(spawnbase) { submunitionConeType[] = {"random", 10}; }; @@ -35,8 +35,9 @@ class GVAR(def_10_top) : GVAR(def_10) { submunitionConeAngle = 60; triggerSpeedCoef[] = {-1.5, -0.75}; }; - -/********************* ***************************/ +/* + * Default frag, spawning 15 fragments + */ class GVAR(def_15) : GVAR(spawnbase) { submunitionConeType[] = {"random", 15}; }; @@ -56,7 +57,9 @@ class GVAR(def_15_top) : GVAR(def_15) { triggerSpeedCoef[] = {-1.5, -0.75}; }; -/********************* ***************************/ +/* + * Default frag, spawning 5 fragments + */ class GVAR(def_5) : GVAR(spawnbase) { submunitionConeType[] = {"random", 5}; }; @@ -76,7 +79,9 @@ class GVAR(def_5_top) : GVAR(def_5) { triggerSpeedCoef[] = {-1.5, -0.75}; }; -/********************* ***************************/ +/* + * Default frag, spawning tiny fragments only + */ class GVAR(def_tiny_15) : GVAR(spawnbase) { submunitionConeType[] = {"random", 15}; submunitionAmmo = QGVAR(tiny); @@ -97,7 +102,9 @@ class GVAR(def_tiny_15_top) : GVAR(def_tiny_15) { triggerSpeedCoef[] = {-1.5, -0.75}; }; -/********************* ***************************/ +/* + * Default frag, spawning 10 tiny fragments only + */ class GVAR(def_tiny_10) : GVAR(spawnbase) { submunitionConeType[] = {"random", 10}; submunitionAmmo = QGVAR(tiny); @@ -118,7 +125,9 @@ class GVAR(def_tiny_10_top) : GVAR(def_tiny_10) { triggerSpeedCoef[] = {-1.5, -0.75}; }; -/********************* ***************************/ +/* + * Default frag, spawning 15 tiny fragments only + */ class GVAR(def_tiny_5) : GVAR(spawnbase) { submunitionConeType[] = {"random", 5}; submunitionAmmo = QGVAR(tiny); @@ -138,7 +147,10 @@ class GVAR(def_tiny_5_top) : GVAR(def_tiny_5) { submunitionConeAngle = 60; triggerSpeedCoef[] = {-1.5, -0.75}; }; -/********************* ***************************/ + +/* + * Default frag, spawning 15 tiny fragments only + */ class GVAR(def_small_15) : GVAR(spawnbase) { submunitionConeType[] = {"random", 15}; submunitionAmmo = QGVAR(small); @@ -158,7 +170,10 @@ class GVAR(def_small_15_top) : GVAR(def_small_15) { submunitionConeAngle = 60; triggerSpeedCoef[] = {-1.15, -0.715}; }; -/********************* ***************************/ + +/* + * Default frag, spawning 10 small fragments only + */ class GVAR(def_small_10) : GVAR(spawnbase) { submunitionConeType[] = {"random", 10}; submunitionAmmo = QGVAR(small); @@ -178,7 +193,9 @@ class GVAR(def_small_10_top) : GVAR(def_small_10) { submunitionConeAngle = 60; triggerSpeedCoef[] = {-1.10, -0.710}; }; -/********************* ***************************/ +/* + * Default frag, spawning small fragments only + */ class GVAR(def_small_5) : GVAR(spawnbase) { submunitionConeType[] = {"random", 5}; submunitionAmmo = QGVAR(small); @@ -199,7 +216,9 @@ class GVAR(def_small_5_top) : GVAR(def_small_5) { triggerSpeedCoef[] = {-1.5, -0.75}; }; -/******************* targeted fragments ********************/ +/* + * Targeted fragment spawner, for when multiple fragments are spawned (1-3) + */ class GVAR(spawnbase_targeted) : GVAR(spawnbase) { access = 2; submunitionConeType[] = {"random", 2}; diff --git a/addons/frag/cfgAmmoSpall.hpp b/addons/frag/cfgAmmoSpall.hpp index 3e51df4a15..21e58347e3 100644 --- a/addons/frag/cfgAmmoSpall.hpp +++ b/addons/frag/cfgAmmoSpall.hpp @@ -14,7 +14,9 @@ class GVAR(spallBase) : B_65x39_Caseless { }; -//**** ground ****// +/* + * ground + */ class GVAR(ground_spall_tiny) : GVAR(spallBase) { submunitionAmmo[] = {QGVAR(tiny), 9, QGVAR(small), 1}; submunitionConeType[] = {"poissondisccenter", 4}; @@ -41,7 +43,9 @@ class GVAR(ground_spall_huge) : GVAR(spallBase) { }; -//**** rock ****// +/* + * rock + */ class GVAR(rock_spall_tiny) : GVAR(spallBase) { submunitionAmmo[] = {QGVAR(small), 4, QGVAR(medium_HD), 1}; submunitionConeType[] = {"poissondisccenter", 4}; @@ -68,7 +72,9 @@ class GVAR(rock_spall_huge) : GVAR(spallBase) { }; -//**** wood ****// +/* + * wood + */ class GVAR(wood_spall_tiny) : GVAR(spallBase) { submunitionAmmo[] = {QGVAR(tiny), 2, QGVAR(small), 4}; submunitionConeType[] = {"poissondisccenter", 4}; @@ -95,7 +101,9 @@ class GVAR(wood_spall_huge) : GVAR(spallBase) { }; -//**** concrete ****// +/* + * concrete + */ class GVAR(concrete_spall_tiny) : GVAR(spallBase) { submunitionAmmo[] = {QGVAR(tiny), 6, QGVAR(tiny_HD), 3, QGVAR(small), 1}; submunitionConeType[] = {"poissondisccenter", 4}; @@ -122,7 +130,9 @@ class GVAR(concrete_spall_huge) : GVAR(spallBase) { }; -//**** metal ****// +/* + * metal + */ class GVAR(metal_spall_tiny) : GVAR(spallBase) { submunitionAmmo[] = {QGVAR(tiny), 9, QGVAR(small), 1}; submunitionConeType[] = {"poissondisccenter", 4}; diff --git a/addons/frag/functions/fnc_dev_addRound.sqf b/addons/frag/functions/fnc_dev_addRound.sqf index 483ac8cfae..332f2e8dc3 100644 --- a/addons/frag/functions/fnc_dev_addRound.sqf +++ b/addons/frag/functions/fnc_dev_addRound.sqf @@ -22,7 +22,7 @@ params [ ["_sidePlayer", true, [true]] ]; -/// track round on each frame +// track round on each frame // Create entry in position array from hashmap if (_sidePlayer) then { diff --git a/addons/frag/functions/fnc_dev_trackObj.sqf b/addons/frag/functions/fnc_dev_trackObj.sqf index 0f45ad370d..34f927dd98 100644 --- a/addons/frag/functions/fnc_dev_trackObj.sqf +++ b/addons/frag/functions/fnc_dev_trackObj.sqf @@ -22,7 +22,7 @@ params [ ["_isProj", false, [false]] ]; TRACE_4("devDraw",_this,_obj,_color,_isProj); -/// track round on each frame +// track round on each frame // Create entry in position array from hashmap private _colorArray = switch (toLower _color) do { case "purple": {[0.8, 0, 0.8, 1]}; diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 0a6d315035..da9624da77 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -76,7 +76,7 @@ if (120 > acos ((vectorNormalized _lVelUnit) vectorDotProduct _sNorm)) then { _spallPos = _spallPos vectorAdd (_unitStep vectorMultiply 5); }; -//***** Passed all exit withs *****// +// Passed all exit withs GVAR(lastSpallTime) = CBA_missionTime; // step through @@ -97,7 +97,8 @@ if GVAR(dbgSphere) then { [_lPosASL, "orange"] call FUNC(dev_sphereDraw); }; #endif -//***** Select spalled fragment spawner **// + +// Select spalled fragment spawner private _spawnSize = switch (true) do { @@ -108,7 +109,7 @@ private _spawnSize = switch (true) do default { "_spall_huge" }; }; -//***** Spawn spalled fragments +// Spawn spalled fragments private _spallSpawner = createVehicle [ "ace_frag_" + _material + _spawnSize, ASLToATL _spallPos, diff --git a/addons/frag/functions/fnc_getFragInfo.sqf b/addons/frag/functions/fnc_getFragInfo.sqf index 40b9c9a4fc..d34da54155 100644 --- a/addons/frag/functions/fnc_getFragInfo.sqf +++ b/addons/frag/functions/fnc_getFragInfo.sqf @@ -35,24 +35,25 @@ if (isArray (configFile >> "cfgAmmo" >> _ammo >> QGVAR(CLASSES))) then { _warn = true; }; -/************ Gurney equation notes *****************/ -// see https://en.wikipedia.org/wiki/Gurney_equations -// -// GURNEY_K is the constant added to _m/_c -// GURNEY_C = sqrt(2E) -// -// _c = 185; // grams of comp-b -// _m = 210; // grams of fragmentating metal -// _k = 3/5; // spherical K factor -// _gC = 2843; // Gurney constant of comp-b in /ms - -// _c = 429; // grams of tritonal -// _m = 496; // grams of fragmentating metal -// _k = 1/2; // cylindrical K factor -// _gC = 2320; // Gurney constant of tritonal in m/s -// Equation - 0.8 for empirical 80% speed -// 0.8 * (((_m / _c) + _k) ^ - (1 / 2)) * _gC; -// or 0.8 * _gC * sqrt (_c /(_m + _c * _k)); (slightly faster to compute) +/************ Gurney equation notes *****************//* + * see https://en.wikipedia.org/wiki/Gurney_equations + * + * GURNEY_K is the constant added to _m/_c + * GURNEY_C = sqrt(2E) + * + * _c = 185; - grams of comp-b + * _m = 210; - grams of fragmentating metal + * _k = 3/5; - spherical K factor + * _gC = 2843; - Gurney constant of comp-b in /ms + * + * _c = 429; - grams of tritonal + * _m = 496; - grams of fragmentating metal + * _k = 1/2; - cylindrical K factor + * _gC = 2320; - Gurney constant of tritonal in m/s + * Equation - 0.8 for empirical 80% speed + * 0.8 * (((_m / _c) + _k) ^ - (1 / 2)) * _gC; + * or 0.8 * _gC * sqrt (_c /(_m + _c * _k)); (slightly faster to compute) + */ private _c = getNumber (configFile >> "cfgAmmo" >> _ammo >> QGVAR(CHARGE)); if (_c == 0) then {_c = 1; _warn = true;}; @@ -69,12 +70,14 @@ if (_warn) then { INFO_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_ammo); }; -/********************** _ammoInfo format *************************/ -// 0: _fragRange - search range for fragments -// 1: _fragVel - gurney equation calculated velocity -// 2: _fragTypes - array of fragment types -// 3: _fragCount - modified frag count used under assumptions -// of spherical fragmentation +/********************** _ammoInfo format *************************//* + * 0: _fragRange - search range for fragments, calculated with + * a 0.5% chance to hit as the minimum + * 1: _fragVel - gurney equation calculated velocity + * 2: _fragTypes - array of fragment types + * 3: _fragCount - modified frag count used under assumptions + * of spherical fragmentation + */ _ammoInfo = [ sqrt (_fragCount / (4 * pi * 0.005)), 0.8 * _gC * sqrt (_c / (_m + _c * _k)), diff --git a/addons/frag/initSettingsDebug.inc.sqf b/addons/frag/initSettingsDebug.inc.sqf index 382d3ac4b2..09072683af 100644 --- a/addons/frag/initSettingsDebug.inc.sqf +++ b/addons/frag/initSettingsDebug.inc.sqf @@ -7,11 +7,9 @@ private _category = format ["ACE %1", localize LSTRING(Module_DisplayName)]; true ] call CBA_fnc_addSetting; -//*** debug options ***// [ QGVAR(dbgSphere), "CHECKBOX", [LSTRING(HitSphereEnable), LSTRING(HitSphereEnable_Desc)], -// "Create color coded spheres at ", [_category, LSTRING(Debug)], false, 0, @@ -22,7 +20,6 @@ private _category = format ["ACE %1", localize LSTRING(Module_DisplayName)]; [ QGVAR(drawHitBox),"CHECKBOX", [LSTRING(DrawHitBox), LSTRING(DrawHitBox_Desc)], -// ["Draw unit hitboxes", "Draw added hitboxes each frame"], [_category, LSTRING(Debug)], true ] call CBA_fnc_addSetting; \ No newline at end of file