From 5bab127a5aac1396cdc3a9ab94b792d7002be596 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Thu, 28 Mar 2024 19:13:21 -0500 Subject: [PATCH] removed some magic numbers, and cached numbers from shouldSpall --- addons/frag/functions/fnc_doSpall.sqf | 10 +++++----- addons/frag/script_component.hpp | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 35c6c58d71..7765a7cc50 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -55,7 +55,7 @@ private _speedChange = 0 max (vectorMagnitude _lastVelocity - vectorMagnitude _v private _spallPower = (ACE_FRAG_SPALL_CALIBER_COEF * _caliber * sqrt _speedChange + _explosive * _indirectHit) * GVAR(spallIntensity); TRACE_3("found speed",_speedChange,_caliber,_spallPower); -if (_spallPower < 2) exitWith { +if (_spallPower < ACE_FRAG_SPALL_POWER_MIN) exitWith { TRACE_1("lowImpulse",_ammo); }; @@ -107,10 +107,10 @@ 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"} ; + case (_spallPower < ACE_FRAG_SPALL_POWER_TINY_MAX): {"_spall_tiny"}; + case (_spallPower < ACE_FRAG_SPALL_POWER_SMALL_MAX): {"_spall_small"}; + case (_spallPower < ACE_FRAG_SPALL_POWER_MEDIUM_MAX): {"_spall_medium"}; + case (_spallPower < ACE_FRAG_SPALL_POWER_LARGE_MAX): {"_spall_large"}; default {"_spall_huge"}; }; diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index ae3f36cc5e..e8d5ad32ca 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -48,3 +48,8 @@ #define ACE_FRAG_SPALL_VELOCITY_INHERIT_COEFF 0.5 // sqrt(2)/50 #define ACE_FRAG_SPALL_CALIBER_COEF 0.02828427 +#define ACE_FRAG_SPALL_POWER_MIN 2 +#define ACE_FRAG_SPALL_POWER_TINY_MAX 5 +#define ACE_FRAG_SPALL_POWER_SMALL_MAX 8 +#define ACE_FRAG_SPALL_POWER_MEDIUM_MAX 11 +#define ACE_FRAG_SPALL_POWER_LARGE_MAX 15 \ No newline at end of file