From fe1850a34adfbdbd690a18caf91cd134e741040c Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Sun, 14 Jan 2024 18:46:52 -0600 Subject: [PATCH] Fixed issue with spalling happening on thin surfaces instead of thicker surfaces hit afterwards --- addons/frag/functions/fnc_doSpall.sqf | 6 +++--- addons/frag/functions/fnc_initRound.sqf | 5 +++-- addons/frag/script_component.hpp | 12 ++---------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 1bdf13e7a4..ab404d0c06 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -73,15 +73,15 @@ GVAR(lastSpallTime) = CBA_missionTime; * Improve performance of finding otherside of object on shallow angle * impacts. 120 degrees due to 90 degree offset with _lVelUnit into object. */ -private _spallPos = +_lPosASL; +private _spallPos = _lPosASL vectorAdd _unitStep; if (120 > acos ( _lVelUnit vectorDotProduct _sNorm)) then { _spallPos = _spallPos vectorAdd (_unitStep vectorMultiply 5); }; -for "_i" from 1 to 20 do +for "_i" from 2 to 20 do { private _nPos = _spallPos vectorAdd _unitStep; if (!lineIntersects [_spallPos, _nPos]) then { - _spallPos = _nPos vectorAdd _unitStep; + _spallPos = _nPos vectorAdd (_unitStep vectorMultiply 2); break }; _spallPos = _nPos; diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index caa5bd2dda..a542e59ee0 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -60,9 +60,10 @@ if (GVAR(spallEnabled) && {_shouldSpall}) then private _ammo = typeOf _proj; private _vUp = vectorUp _proj; [ - GVAR(spall_eh), + FUNC(doSpall), [_proj, _hitObj, _posASL, _vel, _sNorm, _surfType, _ammo, _shotPrnt, _vUp] ] call CBA_fnc_execNextFrame; } ]; -}; \ No newline at end of file +}; +TRACE_2("exit",_shouldFrag,_shouldSpall); \ No newline at end of file diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index 63cc715fae..982997218f 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -3,8 +3,8 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define LOG_FRAG_INFO -// #define DEBUG_MODE_FULL -// #define DEBUG_MODE_DRAW +#define DEBUG_MODE_FULL +#define DEBUG_MODE_DRAW // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS @@ -26,14 +26,6 @@ #define ACE_FRAG_HITPOINTS ["spine1","spine2","spine3","head","leftarm","leftarmroll","leftforearm","rightarm","rightarmroll","rightforearm","pelvis","leftupleg","leftuplegroll","leftlegroll","leftfoot","rightupleg","rightuplegroll","rightleg","rightlegroll","rightfoot"] #define ACE_FRAG_HITPOINTS_WEIGHTS -#ifdef DEBUG_MODE_FULL -#define __FADE_TIME 1 -#define __FADE_START 0.5 -#define __FADE_INTERVAL 0.1 -#define __FADE_RATE __FADE_INTERVAL/__FADE_TIME/2 -#define __FADE_INIT (__FADE_TIME+__FADE_START)/__FADE_TIME/2 -#endif - #ifndef GLUE #define GLUE(g1,g2) g1##g2 #endif \ No newline at end of file