Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
};
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1_%2), _weapon, _weapon]; // Get primary muzzle
if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
_WeaponCacheEntry = [_weapon] call FUNC(readWeaponDataFromConfig);
};
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
Expand Down
4 changes: 2 additions & 2 deletions addons/advanced_ballistics/functions/fnc_handleFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
};
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1_%2), _weapon, _muzzle];
if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
_WeaponCacheEntry = [_weapon, _muzzle] call FUNC(readWeaponDataFromConfig);
};

_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
* Public: No
*/

private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
params ["_weapon", "_muzzle"];

if (isNil "_muzzle") then {_muzzle = _weapon};

// For most weapons muzzle == weapon (config value of "this" for muzzle)
private _weaponConfig = (configFile >> "CfgWeapons" >> _muzzle);

if (isNull _weaponConfig) then {
_weaponConfig = (configFile >> "CfgWeapons" >> _weapon >> _muzzle);
};

private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist");
private _twistDirection = parseNumber (_barrelTwist != 0);
Expand All @@ -33,6 +42,6 @@ private _barrelLength = 0 max getNumber(_weaponConfig >> "ACE_barrelLength");

private _result = [_barrelTwist, _twistDirection, _barrelLength];

uiNamespace setVariable [format[QGVAR(%1), _this], _result];
uiNamespace setVariable [format[QGVAR(%1_%2), _weapon, _muzzle], _result];

_result
6 changes: 3 additions & 3 deletions addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Public: No
*/

params ["_oldZeroRange", "_newZeroRange", "_boreHeight"/*in cm*/, "_weapon", "_ammo", "_magazine", "_advancedBallistics"];
params ["_oldZeroRange", "_newZeroRange", "_boreHeight"/*in cm*/, "_weapon", "_muzzle", "_ammo", "_magazine", "_advancedBallistics"];

// When FFV from vehicles currentZeroing will report 0 so just bail
if (_oldZeroRange <= 0) exitWith { 0 };
Expand All @@ -48,9 +48,9 @@ private _trueZero = if (_advancedBallistics) then {
if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call EFUNC(advanced_ballistics,readAmmoDataFromConfig);
};
private _WeaponCacheEntry = uiNamespace getVariable format[QEGVAR(advanced_ballistics,%1), _weapon];
private _WeaponCacheEntry = uiNamespace getVariable format[QEGVAR(advanced_ballistics,%1_%2), _weapon, _muzzle];
if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call EFUNC(advanced_ballistics,readWeaponDataFromConfig);
_WeaponCacheEntry = [_weapon, _muzzle] call EFUNC(advanced_ballistics,readWeaponDataFromConfig);
};

_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
Expand Down
2 changes: 1 addition & 1 deletion addons/scopes/functions/fnc_firedEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (GVAR(correctZeroing) || GVAR(simplifiedZeroing)) then {
private _newZeroRange = [_unit] call FUNC(getCurrentZeroRange);
private _zeroCorrection = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5_%6_%7), _oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics];
if (isNil "_zeroCorrection") then {
_zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection);
_zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _muzzle, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection);
TRACE_7("new calc",_oldZeroRange,_newZeroRange,_boreHeight,_weapon,_ammo,_magazine,_advancedBallistics);
TRACE_1("",_zeroCorrection);
};
Expand Down