diff --git a/addons/frag/functions/fnc_dev_addRound.sqf b/addons/frag/functions/fnc_dev_addRound.sqf index 64d78e2759..498f6ffad5 100644 --- a/addons/frag/functions/fnc_dev_addRound.sqf +++ b/addons/frag/functions/fnc_dev_addRound.sqf @@ -13,7 +13,7 @@ * true results in blue traces, false in red. * * Return Value: - * None + * Nothing Useful * * Example: * [_projectile, false, false] call ace_frag_dev_addRound; @@ -28,9 +28,9 @@ params [ ]; if (_isSidePlayer) then { - GVAR(dev_trackLines) set [getObjectID _projectile, [[getposATL _projectile], [0, 0, 1, 1]]]; + GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [0, 0, 1, 1]]]; } else { - GVAR(dev_trackLines) set [getObjectID _projectile, [[getposATL _projectile], [1, 0, 0, 1]]]; + GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [1, 0, 0, 1]]]; }; // event handler to track round and cleanup when round is "dead" diff --git a/addons/frag/functions/fnc_dev_debugAmmo.sqf b/addons/frag/functions/fnc_dev_debugAmmo.sqf index 32c11c0164..682301714e 100644 --- a/addons/frag/functions/fnc_dev_debugAmmo.sqf +++ b/addons/frag/functions/fnc_dev_debugAmmo.sqf @@ -81,20 +81,20 @@ private _printCount = 0; private _warn = false; private _skip = getNumber (_ammoConfig >> QGVAR(skip)); - private _fragTypes = getArray (_ammoConfig >> QGVAR(CLASSES)); + private _fragTypes = getArray (_ammoConfig >> QGVAR(classes)); if (_fragTypes isEqualTo []) then {_warn = true;}; - private _c = getNumber(_ammoConfig >> QGVAR(CHARGE)); + private _c = getNumber (_ammoConfig >> QGVAR(charge)); if (_c == 0) then {_warn = true;}; - private _m = getNumber(_ammoConfig >> QGVAR(METAL)); + private _m = getNumber (_ammoConfig >> QGVAR(metal)); if (_m == 0) then {_warn = true;}; - private _k = getNumber(_ammoConfig >> QGVAR(GURNEY_K)); + private _k = getNumber (_ammoConfig >> QGVAR(gurney_k)); if (_k == 0) then {_warn = true;}; - private _gC = getNumber(_ammoConfig >> QGVAR(GURNEY_C)); + private _gC = getNumber (_ammoConfig >> QGVAR(gurney_c)); if (_gC == 0) then {_warn = true;}; private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount)); if (_fragCount == 0) then {_fragCount = 200; _warn = true;}; - if (!_printOnlyIncomplete || {_warn && _skip isNotEqualTo 0}) then { + if (!_printOnlyIncomplete || {_warn && _skip != 0}) then { INC(_printCount); if (_csvFormat) then { diag_log text format ["%7,%1,%2,%3,%4,%5,%6,%8", _c, _m, _k, _gC, _skip, _fragCount, _ammo, [_ammoConfig, true] call BIS_fnc_returnParents]; diff --git a/addons/frag/functions/fnc_dev_fired.sqf b/addons/frag/functions/fnc_dev_fired.sqf index 432228a173..113fb997df 100644 --- a/addons/frag/functions/fnc_dev_fired.sqf +++ b/addons/frag/functions/fnc_dev_fired.sqf @@ -7,7 +7,7 @@ * Parameters inherited from EFUNC(common,firedEH) * * Return Value: - * None + * Nothing Useful * * Example: * [clientFiredBIS-XEH] call ace_frag_fnc_fired diff --git a/addons/frag/functions/fnc_dev_fragCalcDump.sqf b/addons/frag/functions/fnc_dev_fragCalcDump.sqf index 148fed8b66..ded15a6d1c 100644 --- a/addons/frag/functions/fnc_dev_fragCalcDump.sqf +++ b/addons/frag/functions/fnc_dev_fragCalcDump.sqf @@ -12,7 +12,7 @@ * None * * Example: - * [false, 10] call ace_frag_fnc_fragoCalcDump + * false call ace_frag_fnc_dev_fragCalcDump * * Public: No */ @@ -28,15 +28,15 @@ diag_log text "//****************** fragCalcDump Beg ******************//"; { // Begin _allAmmoConfigs forEach private _ammo = configName _x; - if (_ammo isEqualTo "" || {_ammo in _processedCfgAmmos} ) then { + if (_ammo isEqualTo "" || {_ammo in _processedCfgAmmos}) then { continue }; private _shouldFrag = [_ammo] call FUNC(shouldFrag); - if (_nSkip || _logAll) then { + if (_shouldFrag || _logAll) then { private _fragInfo = [_ammo] call FUNC(getFragInfo); _fragInfo params ["_fragRange", "_fragMaxVelocity", "", "_modifiedFragCount"]; - private _fragCount = 4 * pi* _modifiedFragCount; + private _fragCount = 4 * pi * _modifiedFragCount; private _ammoConfig = configFile >> "CfgAmmo" >> _ammo; private _indirectHitRange = getNumber (_ammoConfig >> "indirectHitRange"); private _indirectHit = getNumber (_ammoConfig >> "indirectHit"); diff --git a/addons/frag/functions/fnc_dev_sphereDraw.sqf b/addons/frag/functions/fnc_dev_sphereDraw.sqf index 31cebab110..9a8408ff4c 100644 --- a/addons/frag/functions/fnc_dev_sphereDraw.sqf +++ b/addons/frag/functions/fnc_dev_sphereDraw.sqf @@ -11,7 +11,7 @@ * None * * Example: - * [unit0, player] call ace_frag_fnc_dev_switchUnitHandle; + * [getPosASL player, "blue"] call ace_frag_fnc_dev_sphereDraw; * * Public: No */ diff --git a/addons/frag/functions/fnc_dev_trackHitBox.sqf b/addons/frag/functions/fnc_dev_trackHitBox.sqf index 534bd0944e..58fa9b60de 100644 --- a/addons/frag/functions/fnc_dev_trackHitBox.sqf +++ b/addons/frag/functions/fnc_dev_trackHitBox.sqf @@ -48,7 +48,7 @@ private _centerPoint = ASLToAGL getPosASL _object; if (GVAR(dbgSphere) && {_addSphere && {isNull objectParent _object}}) then { private _centerSphere = [getPosASL _object, "yellow"] call FUNC(dev_sphereDraw); - _centerSphere disableCollisionWith vehicle _object; + _centerSphere disableCollisionWith _object; _centerSphere attachTo [_object, _object worldToModel _centerPoint]; }; @@ -66,7 +66,7 @@ private _points = [ [_p7#0, _p1#1, _p7#2] ]; -_color = switch (side _object) do { +private _color = switch (side _object) do { case east: {[1, 0, 0, 1]}; case resistance: {[0, 1, 0, 1]}; default {[0, 0, 1, 1]}; diff --git a/addons/frag/functions/fnc_dev_trackObj.sqf b/addons/frag/functions/fnc_dev_trackObj.sqf index 3e820c8125..d3cbf03c57 100644 --- a/addons/frag/functions/fnc_dev_trackObj.sqf +++ b/addons/frag/functions/fnc_dev_trackObj.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: Lambda.Tiger - * This function adds an object to have it's course tracked (every frame). + * This function adds an object to have its course tracked (every frame). * * Arguments: * 0: Object to draw track OBJECT> @@ -42,21 +42,22 @@ GVAR(dev_trackLines) set [getObjectID _object, [[getPosATL _object], _colorArray [ { if (isGamePaused) exitWith {}; - params ["_params", "_handle"]; - _params params ["_object"]; + params ["_object", "_handle"]; + if (!alive _object) exitWith { [_handle] call CBA_fnc_removePerFrameHandler; }; - private _arr = GVAR(dev_trackLines) getOrDefault [(getObjectID _object), -1]; + + private objectArray = GVAR(dev_trackLines) get (getObjectID _object); - if (_arr isEqualType 0) exitWith { + if (isNil "_objectArray") exitWith { [_handle] call CBA_fnc_removePerFrameHandler; }; - (_arr#0) pushBack getPosATL _object; + (objectArray#0) pushBack getPosATL _object; }, 0, - [_object] + _object ] call CBA_fnc_addPerFrameHandler; // Projectile event handlers that add spheres and points for more accurate round tracking diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index 0915111b98..5b59967b15 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -14,7 +14,7 @@ * None * * Example: - * [_projectile, getPosASL _projectile, velocity _projectile, typeOf _projectile, getShotParents _projectile] call ace_frag_fnc_doFrag; + * [getPosASL _projectile, velocity _projectile, typeOf _projectile, getShotParents _projectile] call ace_frag_fnc_doFrag; * * Public: No */ diff --git a/addons/frag/functions/fnc_doFragTargeted.sqf b/addons/frag/functions/fnc_doFragTargeted.sqf index 44092ff59c..5c96df5692 100644 --- a/addons/frag/functions/fnc_doFragTargeted.sqf +++ b/addons/frag/functions/fnc_doFragTargeted.sqf @@ -49,7 +49,7 @@ if (_fragTypes isEqualTo []) then { private _objects = (ASLToATL _posASL) nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange]; if (_objects isEqualTo []) exitWith { TRACE_2("No nearby targets",_posASL,_fragRange); - 0; + 0 }; // grab crews and add them in so that targets stay approx. sorted by distance @@ -126,12 +126,12 @@ private _totalFragCount = 0; // target pos for fragment to hit private _targetPos = (velocity _target vectorMultiply _timeOfFlight) vectorAdd [0, 0, ACE_FRAG_HALF_GRAVITY_APPROX * _timeOfFlight ^ 2]; - if _isPerson then { + _targetPos = if (_isPerson) then { private _hitPoint = selectRandom ACE_FRAG_HITPOINTS; private _hitPointPos = _target selectionPosition [_hitPoint, "HitPoints", "AveragePoint"]; - _targetPos = _target modelToWorldWorld _hitPointPos vectorAdd _targetPos; + _target modelToWorldWorld _hitPointPos vectorAdd _targetPos; } else { - _targetPos = _targetPos vectorAdd getPosASL _target vectorAdd [ + _targetPos vectorAdd getPosASL _target vectorAdd [ -0.5 + random 1, -0.5 + random 1, (0.1 + random 0.4) * _height diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index d4ef252651..4793b2d013 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -33,11 +33,11 @@ if (CBA_missionTime < GVAR(nextSpallAllowTime)|| _lastPosASL isEqualTo [0,0,0] || {_ammo isEqualTo "" || {!isNull _objectHit && {objectHit isKindOf "CAManBase"}}}) exitWith { - TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); + TRACE_4("time/invalidHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); }; private _material = [_surfaceType] call FUNC(getMaterialInfo); -if (_material isEqualTo "ground") then { +if (_material == "ground") then { #ifdef DEBUG_MODE_FULL systemChat "ground spall"; #endif @@ -49,7 +49,7 @@ private _vel = if (alive _projectile) then { _explosive = 0; // didn't explode since it's alive a frame later velocity _projectile } else { - [0, 0, 0]; + [0, 0, 0] }; private _velocityChange = 0 max (vectorMagnitude _lastVelocity - vectorMagnitude _vel); @@ -85,7 +85,7 @@ if GVAR(dbgSphere) then { * impacts. 120 degrees due to 90 degree offset with _lastVelocityUnit into object. */ private _spallPosASL = _lastPosASL vectorAdd _deltaStep; -if (120 > acos ( _lastVelocityUnit vectorDotProduct _surfaceNorm)) then { +if (120 > acos (_lastVelocityUnit vectorDotProduct _surfaceNorm)) then { _spallPosASL = _spallPosASL vectorAdd (_deltaStep vectorMultiply 5); }; private _insideObject = true; diff --git a/addons/frag/functions/fnc_getFragInfo.sqf b/addons/frag/functions/fnc_getFragInfo.sqf index d38f38765e..8d5470064b 100644 --- a/addons/frag/functions/fnc_getFragInfo.sqf +++ b/addons/frag/functions/fnc_getFragInfo.sqf @@ -29,8 +29,8 @@ if (!isNil "_ammoInfo") exitWith {_ammoInfo}; private _ammoConfig = configFile >> "CfgAmmo" >> _ammo; private _fragTypes = []; private _warn = false; -if (isArray (_ammoConfig >> QGVAR(CLASSES))) then { - _fragTypes = getArray (_ammoConfig >> QGVAR(CLASSES)); +if (isArray (_ammoConfig >> QGVAR(classes))) then { + _fragTypes = getArray (_ammoConfig >> QGVAR(classes)); } else { _warn = true; }; diff --git a/addons/frag/functions/fnc_getMaterialInfo.sqf b/addons/frag/functions/fnc_getMaterialInfo.sqf index e38144b6e6..a7940d016c 100644 --- a/addons/frag/functions/fnc_getMaterialInfo.sqf +++ b/addons/frag/functions/fnc_getMaterialInfo.sqf @@ -31,7 +31,7 @@ if (!isNil "_material") exitWith { private _surfaceConfig = configFile >> "CfgSurfaces" >> _surfType; if (isClass _surfaceConfig) then { _material = getText (_surfaceConfig >> "soundEnviron"); - if (_material isEqualTo "" || {_material isEqualTo "empty"}) then { + if (_material == "" || {_material == "empty"}) then { _material = getText (_surfaceConfig >> "soundhit"); }; } else { // Messy way when a surface isn't added to CfgSurfaces diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index b37333cd64..4d785e2e5f 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -68,7 +68,7 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { ]; }; #ifdef DEBUG_MODE_DRAW -if (GVAR(debugOptions) && (_shouldFrag || _shouldSpall)) then { +if (GVAR(debugOptions) && {_ammo call FUNC(shouldFrag) || {_ammo call FUNC(shouldSpall)}}) then { [_projectile, "red", true] call FUNC(dev_trackObj); }; #endif diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index d32af33ede..92591eda69 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -3,7 +3,7 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define LOG_FRAG_INFO -#define DEBUG_MODE_FULL +// #define DEBUG_MODE_FULL // #define DEBUG_MODE_DRAW // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS