diff --git a/LICENSE b/LICENSE index 0f013a10b9..b76b90e8fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2014 Felix "KoffeinFlummi" Wiegand +Copyright (C) 2015 Felix "KoffeinFlummi" Wiegand This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ace_advanced_ballistics.dll b/ace_advanced_ballistics.dll index 3349bb5b38..8f1c62484f 100644 Binary files a/ace_advanced_ballistics.dll and b/ace_advanced_ballistics.dll differ diff --git a/ace_breakLine.dll b/ace_breakLine.dll index 428df80092..a13e1a8da9 100644 Binary files a/ace_breakLine.dll and b/ace_breakLine.dll differ diff --git a/ace_fcs.dll b/ace_fcs.dll index 9cef4549c7..71fbba7d92 100644 Binary files a/ace_fcs.dll and b/ace_fcs.dll differ diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 41615696ac..3f0e101d3b 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -20,19 +20,11 @@ GVAR(WindInfoStart) = time; GVAR(Protractor) = false; GVAR(ProtractorStart) = time; -// Those are only used in the pure sqf version (extension free PFH) -GVAR(SimulationPrecision) = 2; -GVAR(WindEnabled) = true; -GVAR(SpinDriftEnabled) = true; -GVAR(CoriolisEnabled) = true; -GVAR(EoetvoesEnabled) = true; -GVAR(AdvancedAirDragEnabled) = true; -GVAR(TransonicRegionEnabled) = true; -GVAR(AtmosphericDensitySimulationEnabled) = true; - GVAR(currentGrid) = 0; GVAR(INIT_MESSAGE_ENABLED) = false; +GVAR(extensionAvailable) = true; +/* @TODO: Remove this until verisoning is in sync with cmake/build versioning GVAR(extensionVersion) = ("ace_advanced_ballistics" callExtension "version"); GVAR(extensionAvailable) = (GVAR(extensionVersion) == EXTENSION_REQUIRED_VERSION); if (!GVAR(extensionAvailable)) exitWith { @@ -42,5 +34,5 @@ if (!GVAR(extensionAvailable)) exitWith { diag_log text "[ACE] ERROR: ace_advanced_ballistics.dll is incompatible"; }; }; - +*/ [] call FUNC(initializeTerrainExtension); diff --git a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf b/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf deleted file mode 100644 index 298049e51d..0000000000 --- a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: Ruthberg - * - * Calculates the air density - * - * Arguments: - * 0: temperature - degrees celcius - * 1: pressure - hPa - * 2: relativeHumidity - value between 0.0 and 1.0 - * - * Return Value: - * 0: density of air - kg * m^(-3) - * - * Return value: - * None - */ -#include "script_component.hpp" - -private ["_temperature", "_pressure", "_relativeHumidity"]; -_temperature = _this select 0; // in C -_pressure = _this select 1; // in hPa -_relativeHumidity = _this select 2; // as ratio 0-1 - -_pressure = _pressure * 100; - -if (_relativeHumidity > 0) then { - private ["_pSat", "_vaporPressure", "_partialPressure"]; - // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm - _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); - _vaporPressure = _relativeHumidity * _pSat; - _partialPressure = _pressure - _vaporPressure; - - (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) -} else { - _pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature)) -}; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 54a7f2d5b0..b6aae2c740 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -19,7 +19,7 @@ */ #include "script_component.hpp" -private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_index", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_atmosphereModel", "_bulletMass", "_bulletLength", "_airFriction", "_dragModel", "_muzzleVelocity", "_muzzleVelocityCoef", "_muzzleAccessory", "_initSpeedCoef", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_bulletWeight", "_barrelTwist", "_twistDirection", "_stabilityFactor", "_transonicStabilityCoef"]; +private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_index", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_atmosphereModel", "_bulletMass", "_bulletLength", "_airFriction", "_dragModel", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_twistDirection", "_stabilityFactor", "_transonicStabilityCoef", "_ballisticCoefficients", "_velocityBoundaries"]; _unit = _this select 0; _weapon = _this select 1; _mode = _this select 3; @@ -35,49 +35,34 @@ if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; if (underwater _unit) exitWith {}; if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; -if (GVAR(onlyActiveForLocalPlayers) && _unit != ACE_player) then { _abort = true; }; +if (GVAR(onlyActiveForLocalPlayers) && !(local _unit)) then { + if (GVAR(alwaysSimulateForSnipers)) then { + // The shooter is non local + if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then { + _opticsName = (primaryWeaponItems _unit) select 2; + _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); + _abort = _opticType != 2; // We only abort if the non local shooter is not a sniper + }; + } else { + _abort = true; + }; +}; //if (!GVAR(vehicleGunnerEnabled) && !(_unit isKindOf "Man")) then { _abort = true; }; // TODO: We currently do not have firedEHs on vehicles if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; -if (_abort && alwaysSimulateForSnipers) then { - // The shooter is non local - if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then { - _opticsName = (primaryWeaponItems _unit) select 2; - _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); - _abort = _opticType != 2; // We only abort if the non local shooter is not a sniper - }; -}; if (_abort || !(GVAR(extensionAvailable))) exitWith { [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH); }; _airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction"); -_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed"); -_muzzleVelocityCoef = getNumber(configFile >> "cfgWeapons" >> _weapon >> "initSpeed"); -if (_muzzleVelocityCoef > 0) then { - _muzzleVelocity = _muzzleVelocityCoef; -}; -if (_muzzleVelocityCoef < 0) then { - _muzzleVelocity = _muzzleVelocity * (-1 * _muzzleVelocityCoef); -}; -_muzzleAccessory = ""; -switch (currentWeapon _unit) do { - case primaryWeapon _unit: { _muzzleAccessory = (primaryWeaponItems _unit) select 0; }; - case handgunWeapon _unit: { _muzzleAccessory = (handgunItems _unit) select 0; }; -}; - -if (_muzzleAccessory != "" && isNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed")) then { - _initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed"); - _muzzleVelocity = _muzzleVelocity * _initSpeedCoef; -}; +_bulletVelocity = velocity _bullet; +_muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { _muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); if (_muzzleVelocityShift != 0) then { - _bulletVelocity = velocity _bullet; - _bulletSpeed = vectorMagnitude _bulletVelocity; - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); + _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; @@ -87,19 +72,23 @@ if (GVAR(ammoTemperatureEnabled)) then { _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); _muzzleVelocityShift = [_ammo, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); if (_muzzleVelocityShift != 0) then { - _bulletVelocity = velocity _bullet; - _bulletSpeed = vectorMagnitude _bulletVelocity; - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); + _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; }; _bulletTraceVisible = false; -if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER" && currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then { - _opticsName = (primaryWeaponItems ACE_player) select 2; - _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); - _bulletTraceVisible = (_opticType == 2 || currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]); +if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { + if (currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) then { + _bulletTraceVisible = true; + } else { + if (currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then { + _opticsName = (primaryWeaponItems ACE_player) select 2; + _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); + _bulletTraceVisible = _opticType == 2; + }; + }; }; _caliber = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_caliber"); @@ -131,253 +120,47 @@ _dragModel = 1; _ballisticCoefficients = []; _velocityBoundaries = []; _atmosphereModel = "ICAO"; -if (GVAR(AdvancedAirDragEnabled)) then { - if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel")) then { - _dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel"); - if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { - _dragModel = 1; - }; - }; - if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { - _ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); - }; - if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { - _velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); - }; - if (isText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { - _atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); +if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel")) then { + _dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel"); + if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { + _dragModel = 1; }; }; +if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { + _ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); +}; +if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { + _velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); +}; +if (isText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { + _atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); +}; -#ifdef USE_ADVANCEDBALLISTICS_DLL - GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; +GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; - "ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(weather,Latitude), EGVAR(weather,currentTemperature), EGVAR(weather,Altitude), EGVAR(weather,currentHumidity), overcast, floor(time), time - floor(time)]; +"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(weather,Latitude), EGVAR(weather,currentTemperature), EGVAR(weather,Altitude), EGVAR(weather,currentHumidity), overcast, floor(time), time - floor(time)]; - [{ - private ["_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; - EXPLODE_4_PVT(_this select 0,_bullet,_caliber,_bulletTraceVisible,_index); - - _bulletVelocity = velocity _bullet; - _bulletPosition = getPosASL _bullet; - - _bulletSpeed = vectorMagnitude _bulletVelocity; - - if (!alive _bullet || _bulletSpeed < 100) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; - }; - - if (_bulletTraceVisible && _bulletSpeed > 600) then { - drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.4*_caliber,0.2*_caliber],[[0,0,0,0.6],[0,0,0,0.4]],[1,0],0,0,"","",""]; - }; - - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(time), time - floor(time)]); - - }, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; -#else - _index = count GVAR(bulletDatabase); - if (count GVAR(bulletDatabaseFreeIndices) > 0) then { - _index = GVAR(bulletDatabaseFreeIndices) select 0; - GVAR(bulletDatabaseFreeIndices) = GVAR(bulletDatabaseFreeIndices) - [_index]; +[{ + private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; + _args = _this select 0; + _bullet = _args select 0; + _caliber = _args select 1; + _bulletTraceVisible = _args select 2; + _index = _args select 3; + + _bulletVelocity = velocity _bullet; + _bulletPosition = getPosASL _bullet; + + _bulletSpeed = vectorMagnitude _bulletVelocity; + + if (!alive _bullet || _bulletSpeed < 100) exitWith { + [_this select 1] call cba_fnc_removePerFrameHandler; + }; + + if (_bulletTraceVisible && _bulletSpeed > 600) then { + drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.4*_caliber,0.2*_caliber],[[0,0,0,0.6],[0,0,0,0.4]],[1,0],0,0,"","",""]; }; - GVAR(bulletDatabase) set[_index, [_bullet, _caliber, _airFriction, _muzzleVelocity, _stabilityFactor, _transonicStabilityCoef, _twistDirection, _unit, _bulletTraceVisible, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _index]]; - GVAR(bulletDatabaseStartTime) set[_index, time]; - GVAR(bulletDatabaseSpeed) set[_index, 0]; - GVAR(bulletDatabaseFrames) set[_index, 1]; - GVAR(bulletDatabaseLastFrame) set[_index, time]; - GVAR(bulletDatabaseHDeflect) set[_index, 0]; - GVAR(bulletDatabaseSpinDrift) set[_index, 0]; + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(time), time - floor(time)]); - if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then { - [{ - private ["_bulletDatabaseEntry", "_bullet", "_caliber", "_muzzleVelocity", "_frames", "_speed", "_airFriction", "_airFrictionRef", "_dragModel", "_atmosphereModel", "_ballisticCoefficient", "_ballisticCoefficients", "_velocityBoundaries", "_airDensity", "_stabilityFactor", "_transonicStabilityCoef", "_twistDirection", "_unit", "_bulletTraceVisible", "_index", "_temperature", "_humidity", "_deltaT", "_TOF", "_bulletPosition", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_bulletSpeedAvg", "_wind", "_drag", "_dragRef", "_vect", "_accel", "_accelRef", "_centripetalAccel", "_pressure", "_pressureDeviation", "_windSourceObstacle", "_windSourceTerrain", "_height", "_roughnessLength", "_bulletDir", "_horizontalDeflection", "_horizontalDeflectionPartial", "_spinDrift", "_spinDriftPartial"]; - - { - _bulletDatabaseEntry = (GVAR(bulletDatabase) select _x); - if (!alive (_bulletDatabaseEntry select 0)) then { - _index = _bulletDatabaseEntry select 13; - GVAR(bulletDatabaseOccupiedIndices) = GVAR(bulletDatabaseOccupiedIndices) - [_index]; - GVAR(bulletDatabaseFreeIndices) pushBack _index; - }; - true - } count GVAR(bulletDatabaseOccupiedIndices); - - if (count GVAR(bulletDatabaseOccupiedIndices) == 0) exitWith { - GVAR(bulletDatabase) = []; - GVAR(bulletDatabaseStartTime) = []; - GVAR(bulletDatabaseSpeed) = []; - GVAR(bulletDatabaseFrames) = []; - GVAR(bulletDatabaseLastFrame) = []; - GVAR(bulletDatabaseHDeflect) = []; - GVAR(bulletDatabaseSpinDrift) = []; - GVAR(bulletDatabaseOccupiedIndices) = []; - GVAR(bulletDatabaseFreeIndices) = []; - [_this select 1] call cba_fnc_removePerFrameHandler; - }; - - { - _bulletDatabaseEntry = GVAR(bulletDatabase) select _x; - _bullet = _bulletDatabaseEntry select 0; - _caliber = _bulletDatabaseEntry select 1; - _airFriction = _bulletDatabaseEntry select 2; - _muzzleVelocity = _bulletDatabaseEntry select 3; - _stabilityFactor = _bulletDatabaseEntry select 4; - _transonicStabilityCoef = _bulletDatabaseEntry select 5; - _twistDirection = _bulletDatabaseEntry select 6; - _unit = _bulletDatabaseEntry select 7; - _bulletTraceVisible = _bulletDatabaseEntry select 8; - _ballisticCoefficients = _bulletDatabaseEntry select 9; - _velocityBoundaries = _bulletDatabaseEntry select 10; - _atmosphereModel = _bulletDatabaseEntry select 11; - _dragModel = _bulletDatabaseEntry select 12; - _index = _bulletDatabaseEntry select 13; - - _TOF = time - (GVAR(bulletDatabaseStartTime) select _index); - - _bulletVelocity = velocity _bullet; - _bulletPosition = getPosASL _bullet; - - _bulletSpeed = vectorMagnitude _bulletVelocity; - _bulletDir = (_bulletVelocity select 0) atan2 (_bulletVelocity select 1); - - _speed = (GVAR(bulletDatabaseSpeed) select _index); - GVAR(bulletDatabaseSpeed) set[_index, _speed + _bulletSpeed]; - - _frames = (GVAR(bulletDatabaseFrames) select _index); - GVAR(bulletDatabaseFrames) set[_index, _frames + 1]; - - _bulletSpeedAvg = (_speed / _frames); - - if ((GVAR(SimulationPrecision) < 2) || {_frames % GVAR(SimulationPrecision) == _index % GVAR(SimulationPrecision)}) then { - _deltaT = time - (GVAR(bulletDatabaseLastFrame) select _index); - GVAR(bulletDatabaseLastFrame) set[_index, time]; - - _trueVelocity = _bulletVelocity; - _trueSpeed = _bulletSpeed; - _wind = [0, 0, 0]; - if (GVAR(WindEnabled) && (vectorMagnitude ACE_wind) > 0) then { - _windSourceObstacle = _bulletPosition vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 10); - _windSourceTerrain = _bulletPosition vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 100); - - if (!(lineIntersects [_bulletPosition, _windSourceObstacle]) && !(terrainIntersectASL [_bulletPosition, _windSourceTerrain])) then { - _wind = ACE_wind; - _height = ASLToATL(_bulletPosition) select 2; - _height = 0 max _height min 20; - if (_height < 20) then { - _roughnessLength = _bulletPosition call FUNC(calculateRoughnessLength); - _wind = _wind vectorMultiply (ln(_height / _roughnessLength) / ln(20 / _roughnessLength)); - }; - - _trueVelocity = _bulletVelocity vectorDiff _wind; - _trueSpeed = vectorMagnitude _trueVelocity; - }; - }; - - _airFrictionRef = _airFriction; - if (GVAR(AdvancedAirDragEnabled) && (count _ballisticCoefficients) == (count _velocityBoundaries) + 1) then { - _dragRef = _deltaT * _airFrictionRef * _bulletSpeed * _bulletSpeed; - _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef); - _bulletVelocity = _bulletVelocity vectorDiff _accelRef; - - _ballisticCoefficient = (_ballisticCoefficients select 0); - for "_i" from (count _velocityBoundaries) - 1 to 0 step -1 do { - if (_bulletSpeed < (_velocityBoundaries select _i)) exitWith { - _ballisticCoefficient = (_ballisticCoefficients select (_i + 1)); - }; - }; - - if (GVAR(AtmosphericDensitySimulationEnabled)) then { - _pressure = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure); - _temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2); - _humidity = EGVAR(weather,currentHumidity); - _airDensity = STD_AIR_DENSITY_ICAO; - if (_humidity > 0) then { - private ["_pSat", "_vaporPressure", "_partialPressure"]; - // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm - _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); - _vaporPressure = _humidity * _pSat; - _partialPressure = (_pressure * 100)- _vaporPressure; - - _airDensity = (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)); - } else { - _airDensity = (_pressure * 100) / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature)); - }; - if (_atmosphereModel == "ICAO") then { - _ballisticCoefficient = (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient; - } else { - _ballisticCoefficient = (STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient; - }; - }; - - _drag = _deltaT * ([_dragModel, _ballisticCoefficient, _trueSpeed] call FUNC(calculateRetardation)); - _accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag); - _bulletVelocity = _bulletVelocity vectorDiff _accel; - } else { - if (GVAR(AtmosphericDensitySimulationEnabled)) then { - _pressureDeviation = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure) - 1013.25; - _temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2); - _humidity = EGVAR(weather,currentHumidity); - _airFriction = _airFriction + ((_temperature - 15) * 0.0000015 + _humidity * 0.0000040 + _pressureDeviation * -0.0000009); - }; - - if (_airFriction != _airFrictionRef || vectorMagnitude _wind > 0) then { - _dragRef = _deltaT * _airFrictionRef * _bulletSpeed * _bulletSpeed; - _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef); - _bulletVelocity = _bulletVelocity vectorDiff _accelRef; - - _drag = _deltaT * _airFriction * _trueSpeed * _trueSpeed; - _accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag); - _bulletVelocity = _bulletVelocity vectorAdd _accel; - }; - }; - - if (GVAR(CoriolisEnabled) && _bulletSpeedAvg > 0) then { - _horizontalDeflection = 0.0000729 * (_unit distanceSqr _bullet) * sin(EGVAR(weather,Latitude)) / _bulletSpeedAvg; - _horizontalDeflectionPartial = _horizontalDeflection - (GVAR(bulletDatabaseHDeflect) select _index); - GVAR(bulletDatabaseHDeflect) set[_index, _horizontalDeflection]; - _vect = [sin(_bulletDir + 90) * _horizontalDeflectionPartial, cos(_bulletDir + 90) * _horizontalDeflectionPartial, 0]; - - _bulletPosition = _bulletPosition vectorAdd _vect; - }; - - /* - // Negligible effect on the trajectory - if (GVAR(EoetvoesEnabled)) then { - _centripetalAccel = 2 * 0.0000729 * (_muzzleVelocity / -32.2) * cos(EGVAR(weather,Latitude)) * sin(_bulletDir); - _accel = [0, 0, -(_centripetalAccel * _deltaT)]; - - _bulletVelocity = _bulletVelocity vectorAdd _accel; - }; - //*/ - - if (GVAR(SpinDriftEnabled)) then { - _spinDrift = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; - _spinDriftPartial = _spinDrift - (GVAR(bulletDatabaseSpinDrift) select _index); - GVAR(bulletDatabaseSpinDrift) set[_index, _spinDrift]; - _vect = [sin(_bulletDir + 90) * _spinDriftPartial, cos(_bulletDir + 90) * _spinDriftPartial, 0]; - - _bulletPosition = _bulletPosition vectorAdd _vect; - }; - }; - - if (GVAR(TransonicRegionEnabled) && _transonicStabilityCoef < 1) then { - if (_bulletSpeed < 345 && _bulletSpeedAvg > 340 && _bulletSpeed > 335) then { - _accel = [(random 0.8) - 0.4, (random 0.8) - 0.4, (random 0.8) - 0.4]; - _accel = _accel vectorMultiply (1 - _transonicStabilityCoef); - _bulletVelocity = _bulletVelocity vectorAdd _accel; - }; - }; - - if (_bulletTraceVisible && _bulletSpeed > 600 && _bullet distanceSqr _unit > 400) then { - drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.4*_caliber,0.2*_caliber],[[0,0,0,0.6],[0,0,0,0.4]],[1,0],0,0,"","",""]; - }; - - _bullet setVelocity _bulletVelocity; - _bullet setPosASL _bulletPosition; - true - } count GVAR(bulletDatabaseOccupiedIndices); - - }, GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler; - }; -#endif +}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index 70c2f47990..3334bb3207 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -1,8 +1,6 @@ #define COMPONENT advanced_ballistics #include "\z\ace\addons\main\script_mod.hpp" -#define USE_ADVANCEDBALLISTICS_DLL - #ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/aircraft/Heli_Attack_01_base_F.hpp b/addons/aircraft/Heli_Attack_01_base_F.hpp index 22f2da3833..14ca7ef7cd 100644 --- a/addons/aircraft/Heli_Attack_01_base_F.hpp +++ b/addons/aircraft/Heli_Attack_01_base_F.hpp @@ -891,6 +891,25 @@ class Heli_Attack_01_base_F: Helicopter_Base_F { class OpticsIn { + class WideUnstabalized + { + opticsDisplayName = "WU"; + initAngleX = 0; + minAngleX = -35; + maxAngleX = 10; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.466; + minFov = 0.466; + maxFov = 0.466; + visionMode[] = {"Normal","Ti"}; + thermalMode[] = {0,1}; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 0; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F"; + }; class Wide { opticsDisplayName = "W"; diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index fe45ef67f5..76f06744dc 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -128,7 +128,7 @@ class ATragMX_RscListBox { class ATragMX_RscListNBox: ATragMX_RscListBox { idc=-1; type=102; - columns[]={0.0, 0.225, 0.475, 0.725}; + columns[]={0.0, 0.225, 0.475, 0.7}; drawSideArrows=0; idcLeft=-1; idcRight=-1; @@ -523,9 +523,12 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.32; text="Cur"; }; - class TEXT_ELEVATION_OUTPUT_ABSOLUTE: ATragMX_RscEdit { + class TEXT_ELEVATION_OUTPUT_ABSOLUTE: ATragMX_RscText { idc=400; - w=0.07; + style=160; + sizeEx=0.025; + w=0.065; + h=0.032; x=0.550*safezoneW+safezoneX+0.17; y=0.265*safezoneH+safezoneY+0.50; text=""; @@ -537,7 +540,6 @@ class ATragMX_Display { class TEXT_ELEVATION_INPUT_CURRENT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { idc=402; x=0.550*safezoneW+safezoneX+0.323; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); }; class TEXT_WINDAGE: TEXT_ELEVATION { idc=41; @@ -555,7 +557,6 @@ class ATragMX_Display { class TEXT_WINDAGE_INPUT_CURRENT: TEXT_WINDAGE_OUTPUT_ABSOLUTE { idc=412; x=0.550*safezoneW+safezoneX+0.323; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); }; class TEXT_LEAD: TEXT_GUN { idc=42; @@ -595,11 +596,20 @@ class ATragMX_Display { class TEXT_SCOPE_UNIT: TEXT_GUN_LIST { idc=2000; style=ST_CENTER; + w=0.06; x=0.550*safezoneW+safezoneX+0.205; colorBackground[]={0,0,0,0}; text="TMOA"; action=QUOTE(call FUNC(cycle_scope_unit)); }; + class TEXT_SCOPE_CLICK_NUMBER: TEXT_GUN_LIST { + idc=2001; + style=ST_CENTER; + w=0.03; + x=0.550*safezoneW+safezoneX+0.27; + text="4"; + action=QUOTE(call FUNC(toggle_solution_setup)); + }; class TEXT_CALCULATE: TEXT_SCOPE_UNIT { idc=3000; style=ST_RIGHT; @@ -1213,7 +1223,10 @@ class ATragMX_Display { }; class TEXT_ATMO_ENV_DATA_CALC_METHOD: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { idc=13011; - x=0.550*safezoneW+safezoneX+0.24; + style=64; + w=0.14; + h=0.07; + x=0.550*safezoneW+safezoneX+0.235; y=0.265*safezoneH+safezoneY+0.29; text="Calc Method"; }; @@ -1325,6 +1338,16 @@ class ATragMX_Display { idc=140050; y=0.265*safezoneH+safezoneY+0.480; }; + class TEXT_TARGET_DATA_TARGET_SPEED_DIRECTION: ATragMX_RscButton { + idc=140051; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.305; + y=0.265*safezoneH+safezoneY+0.480; + text=">"; + action=QUOTE(call FUNC(cycle_target_speed_direction)); + }; class TEXT_TARGET_DATA_TARGET_RANGE: TEXT_TARGET_DATA_LATITUDE { idc=14006; y=0.265*safezoneH+safezoneY+0.520; @@ -1355,5 +1378,94 @@ class ATragMX_Display { class TEXT_TARGET_DATA_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { idc=14011; }; + + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=15000; + style=64; + w=0.25; + h=0.07; + x=0.550*safezoneW+safezoneX+0.13; + y=0.265*safezoneH+safezoneY+0.32; + text="Show result in"; + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1: TEXT_TARGET_A { + idc=15001; + w=0.04; + x=0.550*safezoneW+safezoneX+0.14; + y=0.265*safezoneH+safezoneY+0.35; + text="1"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 1; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_2: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15002; + x=0.550*safezoneW+safezoneX+0.18; + text="2"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 2; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_3: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15003; + x=0.550*safezoneW+safezoneX+0.22; + text="3"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 3; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_4: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15004; + x=0.550*safezoneW+safezoneX+0.26; + text="4"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 4; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_8: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15005; + x=0.550*safezoneW+safezoneX+0.30; + text="8"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 8; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_10: TEXT_SOLUTION_SETUP_SHOW_RESULT_IN_1 { + idc=15006; + x=0.550*safezoneW+safezoneX+0.34; + text="10"; + action=QUOTE(GVAR(currentScopeClickNumberTemp) = 10; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=15007; + style=64; + w=0.25; + h=0.07; + x=0.550*safezoneW+safezoneX+0.13; + y=0.265*safezoneH+safezoneY+0.42; + text="Clicks per"; + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA: TEXT_TARGET_A { + idc=15008; + w=0.05; + x=0.550*safezoneW+safezoneX+0.15; + y=0.265*safezoneH+safezoneY+0.45; + text="TMOA"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 0; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_SMOA: TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA { + idc=15009; + x=0.550*safezoneW+safezoneX+0.23; + text="SMOA"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 1; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CLICKS_PER_MILS: TEXT_SOLUTION_SETUP_CLICKS_PER_TMOA { + idc=15010; + x=0.550*safezoneW+safezoneX+0.31; + text="MILS"; + action=QUOTE(GVAR(currentScopeClickUnitTemp) = 2; call FUNC(update_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=15011; + x=0.550*safezoneW+safezoneX+0.18; + y=0.265*safezoneH+safezoneY+0.55; + action=QUOTE(1 call FUNC(toggle_solution_setup)); + }; + class TEXT_SOLUTION_SETUP_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=15012; + x=0.550*safezoneW+safezoneX+0.26; + y=0.265*safezoneH+safezoneY+0.55; + action=QUOTE(0 call FUNC(toggle_solution_setup)); + }; }; }; \ No newline at end of file diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf index 7f047834e2..e2e3cb254c 100644 --- a/addons/atragmx/XEH_postInit.sqf +++ b/addons/atragmx/XEH_postInit.sqf @@ -9,7 +9,7 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0657, -0.0006400, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ], ["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0003740, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ], - ["12.7x99mm" , 853, 100, 0.0623, -0.0006000, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ], + ["12.7x99mm" , 900, 100, 0.0623, -0.0006000, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ], ["12.7x54mm" , 300, 100, 0.3395, -0.0001400, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ], @@ -34,6 +34,7 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == ["6.5x39mm" , 800, 100, 0.0683, -0.0007850, 3.81, 0, 2, 10, 120, 0, 0, 7.970, 6.71, 22.86, 0.263, 7, "ICAO"], ["6.5x47mm Lapua" , 800, 100, 0.0682, -0.0007710, 3.81, 0, 2, 10, 120, 0, 0, 9.007, 6.71, 22.86, 0.290, 7, "ICAO"], + ["6.5mm Creedmor" , 840, 100, 0.0637, -0.0006510, 3.81, 0, 2, 10, 120, 0, 0, 9.072, 6.71, 22.86, 0.317, 7, "ICAO"], ["5.56x45mm M855" , 870, 100, 0.0626, -0.0012650, 3.81, 0, 2, 10, 120, 0, 0, 4.018, 5.70, 17.78, 0.151, 7, "ASM" ], ["5.56x45mm Mk262" , 820, 100, 0.0671, -0.0011250, 3.81, 0, 2, 10, 120, 0, 0, 4.990, 5.70, 17.78, 0.361, 1, "ASM" ], diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index b85e325494..6ec288b9c7 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -20,6 +20,7 @@ PREP(cycle_num_ticks_units); PREP(cycle_range_card_columns); PREP(cycle_scope_unit); PREP(cycle_target_size_units); +PREP(cycle_target_speed_direction); PREP(delete_gun); PREP(init); PREP(parse_input); @@ -34,6 +35,7 @@ PREP(show_gun_list); PREP(show_main_page); PREP(show_range_card); PREP(show_range_card_setup); +PREP(show_solution_setup); PREP(show_target_data); PREP(show_target_range_assist); PREP(show_target_speed_assist); @@ -46,6 +48,7 @@ PREP(toggle_gun_ammo_data); PREP(toggle_gun_list); PREP(toggle_range_card); PREP(toggle_range_card_setup); +PREP(toggle_solution_setup); PREP(toggle_target_data); PREP(toggle_target_range_assist); PREP(toggle_target_speed_assist); @@ -59,6 +62,7 @@ PREP(update_range_card); PREP(update_relative_click_memory); PREP(update_result); PREP(update_scope_unit); +PREP(update_solution_setup); PREP(update_target); PREP(update_target_data); PREP(update_target_selection); diff --git a/addons/atragmx/functions/fnc_add_new_gun.sqf b/addons/atragmx/functions/fnc_add_new_gun.sqf index bac04c2e07..0a0c034f39 100644 --- a/addons/atragmx/functions/fnc_add_new_gun.sqf +++ b/addons/atragmx/functions/fnc_add_new_gun.sqf @@ -19,7 +19,7 @@ private ["_gunName", "_gunProfileEntry"]; _gunName = ctrlText 11001; if (_gunName != "") then { - _gunProfileEntry = [_gunName, 850, 500, 0.280, -0.0010000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.460, "", "", 0.393, 1, "ICAO"]; + _gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"], GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry]; diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index f3f27f7d3e..cfaf7441f8 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -54,7 +54,7 @@ if (!GVAR(atmosphereModeTBH)) then { private ["_bulletLength", "_stabilityFactor"]; _bulletLength = 1.8; _stabilityFactor = 1.5; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); }; diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index f90b299ce9..2049398a9c 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -106,7 +106,7 @@ private ["_wind1", "_wind2", "_windDrift"]; _wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windDirection * 30) * _windSpeed1, 0]; _wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0]; _windDrift = 0; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection); }; @@ -117,7 +117,7 @@ _speedAverage = 0; private ["_eoetvoesMultiplier"]; _eoetvoesMultiplier = 0; -if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire); }; @@ -142,14 +142,12 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _trueSpeed = vectorMagnitude _trueVelocity; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false]) then { - _drag = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,extensionAvailable), false]) then { - parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3", _dragModel, _bc, _trueSpeed])) - } else { - ([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation)) - }; - _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); + _drag = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,extensionAvailable), false]) then { + parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3", _dragModel, _bc, _trueSpeed])) + } else { + ([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation)) }; + _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); } else { _bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction); }; @@ -177,23 +175,20 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _kineticEnergy = _kineticEnergy * 0.737562149; if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { - _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; - _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _horizontalCoriolis; - _windage2 = _windage2 + _horizontalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { - _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; - _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); - _elevation = _elevation + _verticalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { - _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; - _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _spinDrift; - _windage2 = _windage2 + _spinDrift; - }; + // Coriolis + _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _horizontalCoriolis; + _windage2 = _windage2 + _horizontalCoriolis; + // Eoetvoes + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + // Spin drift + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _spinDrift; + _windage2 = _windage2 + _spinDrift; }; GVAR(rangeCardData) set [_n, [_range, _elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy]]; @@ -217,23 +212,20 @@ _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { - _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; - _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _horizontalCoriolis; - _windage2 = _windage2 + _horizontalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { - _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; - _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); - _elevation = _elevation + _verticalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { - _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; - _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _spinDrift; - _windage2 = _windage2 + _spinDrift; - }; + // Coriolis + _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _horizontalCoriolis; + _windage2 = _windage2 + _horizontalCoriolis; + // Eoetvoes + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + // Spin drift + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _spinDrift; + _windage2 = _windage2 + _spinDrift; }; [_elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy, _verticalCoriolis * 60, _horizontalCoriolis * 60, _spinDrift * 60] diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf index 641551fca1..677c4bb793 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -54,7 +54,7 @@ if (!GVAR(atmosphereModeTBH)) then { private ["_bulletLength", "_stabilityFactor"]; _bulletLength = 1.8; _stabilityFactor = 1.5; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); }; diff --git a/addons/atragmx/functions/fnc_clear_user_data.sqf b/addons/atragmx/functions/fnc_clear_user_data.sqf index f805ce66b1..308b5bbf12 100644 --- a/addons/atragmx/functions/fnc_clear_user_data.sqf +++ b/addons/atragmx/functions/fnc_clear_user_data.sqf @@ -36,6 +36,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", nil]; profileNamespace setVariable ["ACE_ATragMX_windDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", nil]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", nil]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_targetRange", nil]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", nil]; diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index b4d51bd894..09e413d535 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -35,6 +35,7 @@ if (GVAR(showRangeCard)) then { [] call FUNC(update_range_card); }; GVAR(showRangeCardSetup) call FUNC(show_range_card_setup); +GVAR(showSolutionSetup) call FUNC(show_solution_setup); GVAR(showTargetData) call FUNC(show_target_data); GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist); GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist); diff --git a/addons/atragmx/functions/fnc_cycle_scope_unit.sqf b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf index 36f704bd2d..ea9e2bd8e8 100644 --- a/addons/atragmx/functions/fnc_cycle_scope_unit.sqf +++ b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf @@ -18,6 +18,7 @@ [] call FUNC(parse_input); GVAR(currentScopeUnit) = (GVAR(currentScopeUnit) + 1) % (count GVAR(scopeUnits)); +GVAR(workingMemory) set [6, GVAR(currentScopeUnit)]; [] call FUNC(update_scope_unit); [] call FUNC(update_result); diff --git a/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf new file mode 100644 index 0000000000..3c77fab792 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf @@ -0,0 +1,22 @@ +/* + * Author: Ruthberg + * Cycles through the target directions left/right + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_target_direction + * + * Public: No + */ +#include "script_component.hpp" + +if ((ctrlText 140051) == ">") then { + ctrlSetText [140051, "<"]; +} else { + ctrlSetText [140051, ">"]; +}; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index 2e613ca9e6..e4fe1b67a4 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -42,7 +42,9 @@ GVAR(currentGun) = 0; GVAR(currentTarget) = 0; GVAR(currentScopeUnit) = 0; GVAR(currentScopeClickUnit) = 2; +GVAR(currentScopeClickUnitTemp) = 2; GVAR(currentScopeClickNumber) = 10; +GVAR(currentScopeClickNumberTemp) = 10; GVAR(atmosphereModeTBH) = true; GVAR(altitude) = 0; @@ -57,6 +59,7 @@ GVAR(windSpeed2) = [0, 0, 0, 0]; GVAR(windDirection) = [12, 12, 12, 12]; GVAR(inclinationAngle) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0]; +GVAR(targetSpeedDirection) = [1, 1, 1, 1]; GVAR(targetRange) = [0, 0, 0, 0]; GVAR(showWind2) = false; @@ -74,6 +77,7 @@ GVAR(showGunAmmoData) = false; GVAR(showGunList) = false; GVAR(showRangeCard) = false; GVAR(showRangeCardSetup) = false; +GVAR(showSolutionSetup) = false; GVAR(showTargetData) = false; GVAR(showTargetRangeAssist) = false; GVAR(showTargetSpeedAssist) = false; diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index ca289302c9..2534c2a319 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -40,7 +40,12 @@ if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget) GVAR(inclinationAngle) set [GVAR(currentTarget), round(acos(_inclinationAngleCosine))]; }; }; -GVAR(targetSpeed) set [GVAR(currentTarget), -50 max abs(parseNumber(ctrlText 140050)) min 50]; +GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140050)) min 50]; +if ((ctrlText 140051) == ">") then { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), +1]; +} else { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1]; +}; GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000]; if (GVAR(currentUnit) != 2) then { GVAR(windSpeed1) set [GVAR(currentTarget), (GVAR(windSpeed1) select GVAR(currentTarget)) * 0.44704]; @@ -55,7 +60,7 @@ private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifl _boreHeight = parseNumber(ctrlText 120000); _bulletMass = parseNumber(ctrlText 120010); _bulletDiameter = parseNumber(ctrlText 120020); -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _airFriction = 0.1 max parseNumber(ctrlText 120030) min 2; } else { _airFriction = parseNumber(ctrlText 120030) / -1000; @@ -82,7 +87,7 @@ GVAR(workingMemory) set [5, _boreHeight]; GVAR(workingMemory) set [12, _bulletMass]; GVAR(workingMemory) set [13, _bulletDiameter]; GVAR(workingMemory) set [14, _rifleTwist]; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { GVAR(workingMemory) set [15, _airFriction]; } else { GVAR(workingMemory) set [4, _airFriction]; @@ -90,9 +95,9 @@ if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) GVAR(workingMemory) set [1, _muzzleVelocity]; GVAR(workingMemory) set [2, _zeroRange]; -private ["_elevationCur", "_windageCur", "_elevationScopeStep", "_windageScopeStep"]; -_elevationCur = parseNumber(ctrlText 402); -_windageCur = parseNumber(ctrlText 412); +private ["_elevationCur", "_windageCur", "_clickSize", "_clickNumber", "_clickInterval"]; +_elevationCur = GVAR(workingMemory) select 10; +_windageCur = GVAR(workingMemory) select 11; switch (GVAR(currentScopeUnit)) do { case 0: { @@ -104,11 +109,16 @@ switch (GVAR(currentScopeUnit)) do { _windageCur = _windageCur / 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevationCur = _elevationCur * _elevationScopeStep; - _windageCur = _windageCur * _windageScopeStep; + _elevationCur = Round(_elevationCur / _clickInterval); + _windageCur = Round(_windageCur / _clickInterval); }; }; diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf index 55b73cc5b5..896455ec7a 100644 --- a/addons/atragmx/functions/fnc_restore_user_data.sqf +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -18,7 +18,6 @@ GVAR(currentUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentUnit", 2]) min 2; [(profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]), true, false] call FUNC(change_gun); GVAR(currentTarget) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentTarget", 0]) min 3; -GVAR(currentScopeUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentScopeUnit", 0]) min 3; GVAR(atmosphereModeTBH) = profileNamespace getVariable ["ACE_ATragMX_atmosphereModeTBH", true]; GVAR(altitude) = -1000 max (profileNamespace getVariable ["ACE_ATragMX_altitude", 0]) min 20000; @@ -34,6 +33,7 @@ GVAR(windSpeed2) = profileNamespace getVariable ["ACE_ATragMX_windSpeed2", [0, 0 GVAR(windDirection) = profileNamespace getVariable ["ACE_ATragMX_windDirection", [12, 12, 12, 12]]; GVAR(inclinationAngle) = profileNamespace getVariable ["ACE_ATragMX_inclinationAngle", [0, 0, 0, 0]]; GVAR(targetSpeed) = profileNamespace getVariable ["ACE_ATragMX_targetSpeed", [0, 0, 0, 0]]; +GVAR(targetSpeedDirection) = profileNamespace getVariable ["ACE_ATragMX_targetSpeedDirection", [1, 1, 1, 1]]; GVAR(targetRange) = profileNamespace getVariable ["ACE_ATragMX_targetRange", [0, 0, 0, 0]]; GVAR(rangeCardStartRange) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardStartRange", 200]) min 3000; diff --git a/addons/atragmx/functions/fnc_show_main_page.sqf b/addons/atragmx/functions/fnc_show_main_page.sqf index ed999948b0..580d111c8f 100644 --- a/addons/atragmx/functions/fnc_show_main_page.sqf +++ b/addons/atragmx/functions/fnc_show_main_page.sqf @@ -18,7 +18,7 @@ GVAR(showMainPage) = _this; {ctrlShow [_x, _this]} forEach [10, 100, 11, 110, 12, 120, 13, 130, 14, 140, 20, 200, 21, 210, 22, 220, 23, 230, 30, 300, 31, 310, 32, 320, 33, 330, 34, 340, 40, 400, 401, 402, 403, 41, 410, 411, 412, 42, 420, - 500, 501, 502, 503, 600, 601, 602, 603, 1000, 1001, 1002, 1003, 1004, 2000, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008]; + 500, 501, 502, 503, 600, 601, 602, 603, 1000, 1001, 1002, 1003, 1004, 2000, 2001, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008]; if (_this) then { if (GVAR(atmosphereModeTBH)) then { @@ -26,4 +26,7 @@ if (_this) then { } else { {ctrlShow [_x, false]} forEach [21, 210, 22, 220]; }; + if (GVAR(currentScopeUnit) != 3) then { + {ctrlShow [_x, false]} forEach [2001]; + }; }; diff --git a/addons/atragmx/functions/fnc_show_solution_setup.sqf b/addons/atragmx/functions/fnc_show_solution_setup.sqf new file mode 100644 index 0000000000..761df45e6f --- /dev/null +++ b/addons/atragmx/functions/fnc_show_solution_setup.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * Shows/Hides the solution setup controls + * + * Arguments: + * visible - + * + * Return Value: + * Nothing + * + * Example: + * false call ace_atragmx_fnc_show_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(showSolutionSetup) = _this; + +{ctrlShow [_x, _this]} forEach [15000, 15001, 15002, 15003, 15004, 15005, 15006, 15007, 15008, 15009, 15010, 15011, 15012]; diff --git a/addons/atragmx/functions/fnc_show_target_data.sqf b/addons/atragmx/functions/fnc_show_target_data.sqf index 48e419f65f..f1b432edf8 100644 --- a/addons/atragmx/functions/fnc_show_target_data.sqf +++ b/addons/atragmx/functions/fnc_show_target_data.sqf @@ -17,7 +17,7 @@ GVAR(showTargetData) = _this; -{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; +{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 140051, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; if (_this) then { [] call FUNC(update_target_data); diff --git a/addons/atragmx/functions/fnc_store_user_data.sqf b/addons/atragmx/functions/fnc_store_user_data.sqf index 2045276426..5cfe7f2ae0 100644 --- a/addons/atragmx/functions/fnc_store_user_data.sqf +++ b/addons/atragmx/functions/fnc_store_user_data.sqf @@ -20,7 +20,6 @@ profileNamespace setVariable ["ACE_ATragMX_profileNamespaceVersion", ATRAGMX_PRO profileNamespace setVariable ["ACE_ATragMX_currentUnit", GVAR(currentUnit)]; profileNamespace setVariable ["ACE_ATragMX_currentGun", GVAR(currentGun)]; profileNamespace setVariable ["ACE_ATragMX_currentTarget", GVAR(currentTarget)]; -profileNamespace setVariable ["ACE_ATragMX_currentScopeUnit", GVAR(currentScopeUnit)]; profileNamespace setVariable ["ACE_ATragMX_atmosphereModeTBH", GVAR(atmosphereModeTBH)]; profileNamespace setVariable ["ACE_ATragMX_altitude", GVAR(altitude)]; @@ -36,6 +35,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", GVAR(windSpeed2)]; profileNamespace setVariable ["ACE_ATragMX_windDirection", GVAR(windDirection)]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", GVAR(inclinationAngle)]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", GVAR(targetSpeed)]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", GVAR(targetSpeedDirection)]; profileNamespace setVariable ["ACE_ATragMX_targetRange", GVAR(targetRange)]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", GVAR(rangeCardStartRange)]; diff --git a/addons/atragmx/functions/fnc_toggle_solution_setup.sqf b/addons/atragmx/functions/fnc_toggle_solution_setup.sqf new file mode 100644 index 0000000000..0e9f702383 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_solution_setup.sqf @@ -0,0 +1,38 @@ +/* + * Author: Ruthberg + * Toggles the solution setup screen on/off + * + * Arguments: + * Apply new data? + * + * Return Value: + * Nothing + * + * Example: + * 1 call ace_atragmx_fnc_toggle_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +if (ctrlVisible 15000) then { + false call FUNC(show_solution_setup); + true call FUNC(show_main_page); + + if (_this == 1) then { + GVAR(currentScopeClickUnit) = GVAR(currentScopeClickUnitTemp); + GVAR(currentScopeClickNumber) = GVAR(currentScopeClickNumberTemp); + GVAR(workingMemory) set [7, GVAR(currentScopeClickUnit)]; + GVAR(workingMemory) set [8, GVAR(currentScopeClickNumber)]; + [] call FUNC(update_scope_unit); + [] call FUNC(update_result); + }; +} else { + true call FUNC(show_solution_setup); + false call FUNC(show_main_page); + + GVAR(currentScopeClickUnitTemp) = GVAR(currentScopeClickUnit); + GVAR(currentScopeClickNumberTemp) = GVAR(currentScopeClickNumber); + + [] call FUNC(update_solution_setup); +}; diff --git a/addons/atragmx/functions/fnc_update_gun.sqf b/addons/atragmx/functions/fnc_update_gun.sqf index 4ca7338e57..aa1f8c44bf 100644 --- a/addons/atragmx/functions/fnc_update_gun.sqf +++ b/addons/atragmx/functions/fnc_update_gun.sqf @@ -26,7 +26,7 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [110, Str(Round(GVAR(workingMemory) select 12))]; }; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { ctrlSetText [120, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; } else { ctrlSetText [120, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; diff --git a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf index 4ccae287e7..b11b214500 100644 --- a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf +++ b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf @@ -32,7 +32,7 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [120020, Str(Round((GVAR(workingMemory) select 13) * 1000) / 1000)]; }; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; } else { ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; diff --git a/addons/atragmx/functions/fnc_update_range_card.sqf b/addons/atragmx/functions/fnc_update_range_card.sqf index 0c49b6f794..7e19abc36e 100644 --- a/addons/atragmx/functions/fnc_update_range_card.sqf +++ b/addons/atragmx/functions/fnc_update_range_card.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_range", "_elevation", "_windage1", "_windage2", "_elevationScopeStep", "_windageScopeStep", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"]; +private ["_range", "_elevation", "_windage1", "_windage2", "_clickSize", "_clickNumber", "_clickInterval", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"]; _lastColumnOutput = ""; if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then { @@ -54,12 +54,17 @@ lnbClear 5007; _windage2 = _windage2 * 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevation = Round(_elevation / _elevationScopeStep); - _windage1 = Round(_windage1 / _windageScopeStep); - _windage2 = Round(_windage2 / _windageScopeStep); + _elevation = Round(_elevation / _clickInterval); + _windage1 = Round(_windage1 / _clickInterval); + _windage2 = Round(_windage2 / _clickInterval); }; }; diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index a86170fd45..bb708efaab 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"]; +private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_clickSize", "_clickNumber", "_clickInterval"]; _elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget); _windageAbs = GVAR(windage1Output) select GVAR(currentTarget); @@ -55,19 +55,24 @@ switch (GVAR(currentScopeUnit)) do { _windageCur = _windageCur * 1.047; }; case 3: { - _elevationScopeStep = (GVAR(workingMemory) select 7); - _windageScopeStep = (GVAR(workingMemory) select 8); + switch (GVAR(workingMemory) select 7) do { + case 0: { _clickSize = 1; }; + case 1: { _clickSize = 1 / 1.047; }; + case 2: { _clickSize = 3.38; }; + }; + _clickNumber = GVAR(workingMemory) select 8; + _clickInterval = _clickSize / _clickNumber; - _elevationAbs = Round(_elevationAbs / _elevationScopeStep); - _windageAbs = Round(_windageAbs / _windageScopeStep); + _elevationAbs = Round(_elevationAbs / _clickInterval); + _windageAbs = Round(_windageAbs / _clickInterval); - _wind2 = Round(_wind2 / _windageScopeStep); + _wind2 = Round(_wind2 / _clickInterval); - _elevationRel = Round(_elevationRel / _elevationScopeStep); - _windageRel = Round(_windageRel / _windageScopeStep); + _elevationRel = Round(_elevationRel / _clickInterval); + _windageRel = Round(_windageRel / _clickInterval); - _elevationCur = Round(_elevationCur / _elevationScopeStep); - _windageCur = Round(_windageCur / _windageScopeStep); + _elevationCur = Round(_elevationCur / _clickInterval); + _windageCur = Round(_windageCur / _clickInterval); }; }; @@ -77,16 +82,88 @@ if (GVAR(showWind2)) then { ctrlSetText [42, "Lead"]; }; -ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)]; -ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)]; -ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)]; +_elevationAbs = Round(_elevationAbs * 100) / 100; +if (_elevationAbs > 0) then { + ctrlSetText [400, format["%1", abs(_elevationAbs)]]; +} else { + if (_elevationAbs < 0) then { + ctrlSetText [400, format["%1D", abs(_elevationAbs)]]; + } else { + ctrlSetText [400, "0.0"]; + }; +}; +_elevationRel = Round(_elevationRel * 100) / 100; +if (_elevationRel > 0) then { + ctrlSetText [401, format["%1", abs(_elevationRel)]]; +} else { + if (_elevationRel < 0) then { + ctrlSetText [401, format["%1D", abs(_elevationRel)]]; + } else { + ctrlSetText [401, "0.0"]; + }; +}; +_elevationCur = Round(_elevationCur * 100) / 100; +if (_elevationCur > 0) then { + ctrlSetText [402, format["%1", abs(_elevationCur)]]; +} else { + if (_elevationCur < 0) then { + ctrlSetText [402, format["%1D", abs(_elevationCur)]]; + } else { + ctrlSetText [402, "0.0"]; + }; +}; -ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)]; -ctrlSetText [411, Str(Round(_windageRel * 100) / 100)]; -ctrlSetText [412, Str(Round(_windageCur * 100) / 100)]; +_windageAbs = Round(_windageAbs * 100) / 100; +if (_windageAbs > 0) then { + ctrlSetText [410, format["%1R", abs(_windageAbs)]]; +} else { + if (_windageAbs < 0) then { + ctrlSetText [410, format["%1L", abs(_windageAbs)]]; + } else { + ctrlSetText [410, "0.0"]; + }; +}; +_windageRel = Round(_windageRel * 100) / 100; +if (_windageRel > 0) then { + ctrlSetText [411, format["%1R", abs(_windageRel)]]; +} else { + if (_windageRel < 0) then { + ctrlSetText [411, format["%1L", abs(_windageRel)]]; + } else { + ctrlSetText [411, "0.0"]; + }; +}; +_windageCur = Round(_windageCur * 100) / 100; +if (_windageCur > 0) then { + ctrlSetText [412, format["%1R", abs(_windageCur)]]; +} else { + if (_windageCur < 0) then { + ctrlSetText [412, format["%1L", abs(_windageCur)]]; + } else { + ctrlSetText [412, "0.0"]; + }; +}; if (GVAR(showWind2)) then { - ctrlSetText [420, Str(Round(_wind2 * 100) / 100)]; + _wind2 = Round(_wind2 * 100) / 100; + if (_wind2 > 0) then { + ctrlSetText [420, format["%1R", abs(_wind2)]]; + } else { + if (_wind2 < 0) then { + ctrlSetText [420, format["%1L", abs(_wind2)]]; + } else { + ctrlSetText [420, "0.0"]; + }; + }; } else { - ctrlSetText [420, Str(Round(_lead * 100) / 100)]; + _lead = Round(_lead * 100) / 100; + if (_lead > 0) then { + if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [420, format["%1R", abs(_lead)]]; + } else { + ctrlSetText [420, format["%1L", abs(_lead)]]; + }; + } else { + ctrlSetText [420, "0.0"]; + }; }; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_update_scope_unit.sqf b/addons/atragmx/functions/fnc_update_scope_unit.sqf index 72efeb772e..46db8c40c4 100644 --- a/addons/atragmx/functions/fnc_update_scope_unit.sqf +++ b/addons/atragmx/functions/fnc_update_scope_unit.sqf @@ -15,10 +15,15 @@ */ #include "script_component.hpp" +ctrlSetText [2000, GVAR(scopeUnits) select GVAR(currentScopeUnit)]; +ctrlSetText [2001, Str(GVAR(currentScopeClickNumber))]; + if (GVAR(currentScopeUnit) == 3) then { - ctrlSetText [2000, format["Clicks=%1", GVAR(currentScopeClickNumber)]]; ctrlSetText [5000, format["Clicks=%1", GVAR(currentScopeClickNumber)]]; + if (GVAR(showMainPage)) then { + ctrlShow [2001, true]; + }; } else { - ctrlSetText [2000, GVAR(scopeUnits) select GVAR(currentScopeUnit)]; ctrlSetText [5000, GVAR(scopeUnits) select GVAR(currentScopeUnit)]; -}; + ctrlShow [2001, false]; +}; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_update_solution_setup.sqf b/addons/atragmx/functions/fnc_update_solution_setup.sqf new file mode 100644 index 0000000000..204a844c9d --- /dev/null +++ b/addons/atragmx/functions/fnc_update_solution_setup.sqf @@ -0,0 +1,31 @@ +/* + * Author: Ruthberg + * Updates all solution setup input fields + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_update_solution_setup + * + * Public: No + */ +#include "script_component.hpp" + +{((uiNamespace getVariable "ATragMX_Display") displayCtrl _x) ctrlEnable true} forEach [15001, 15002, 15003, 15004, 15005, 15006, 15008, 15009, 15010]; + +switch (GVAR(currentScopeClickNumberTemp)) do { + case 1: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15001) ctrlEnable false; }; + case 2: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15002) ctrlEnable false; }; + case 3: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15003) ctrlEnable false; }; + case 4: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15004) ctrlEnable false; }; + case 8: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15005) ctrlEnable false; }; + case 10: { ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15006) ctrlEnable false; }; +}; + +((uiNamespace getVariable "ATragMX_Display") displayCtrl (15008 + GVAR(currentScopeClickUnitTemp))) ctrlEnable false; + +ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 15011); diff --git a/addons/atragmx/functions/fnc_update_target_data.sqf b/addons/atragmx/functions/fnc_update_target_data.sqf index b5e6dcf85a..6fa9035a62 100644 --- a/addons/atragmx/functions/fnc_update_target_data.sqf +++ b/addons/atragmx/functions/fnc_update_target_data.sqf @@ -32,6 +32,11 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [140050, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)]; }; +if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [140051, ">"]; +} else { + ctrlSetText [140051, "<"]; +}; if (GVAR(currentUnit) == 1) then { ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget)) * 1.0936133))]; } else { diff --git a/addons/atragmx/functions/fnc_update_target_selection.sqf b/addons/atragmx/functions/fnc_update_target_selection.sqf index d63f84a90c..d9fd6002c9 100644 --- a/addons/atragmx/functions/fnc_update_target_selection.sqf +++ b/addons/atragmx/functions/fnc_update_target_selection.sqf @@ -15,10 +15,7 @@ */ #include "script_component.hpp" -((uiNamespace getVariable "ATragMX_Display") displayCtrl 500) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 501) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 502) ctrlEnable true; -((uiNamespace getVariable "ATragMX_Display") displayCtrl 503) ctrlEnable true; +{((uiNamespace getVariable "ATragMX_Display") displayCtrl _x) ctrlEnable true} forEach [500, 501, 502, 503]; ((uiNamespace getVariable "ATragMX_Display") displayCtrl 500 + GVAR(currentTarget)) ctrlEnable false; diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index 6e81f79493..c201925147 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -11,4 +11,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.2 +#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.3 diff --git a/addons/ballistics/CfgAmmo.hpp b/addons/ballistics/CfgAmmo.hpp index 76a3970063..7a9a0c2acb 100644 --- a/addons/ballistics/CfgAmmo.hpp +++ b/addons/ballistics/CfgAmmo.hpp @@ -23,6 +23,8 @@ class CfgAmmo { airFriction=-0.001265; hit=8; typicalSpeed=750; + tracerStartTime = 0.073; //M856 tracer burns out to 800m + tracerEndTime = 1.579; //Time in seconds calculated with ballistics calculator ACE_caliber=0.224; ACE_bulletLength=0.906; ACE_bulletMass=62; @@ -36,7 +38,7 @@ class CfgAmmo { }; class ACE_556x45_Ball_Mk262 : B_556x45_Ball { airFriction=-0.001125; - caliber=0.6; + caliber=0.8; deflecting=18; hit=11; typicalSpeed=836; @@ -53,7 +55,7 @@ class CfgAmmo { }; class ACE_556x45_Ball_Mk318 : B_556x45_Ball { airFriction=-0.001120; - caliber=0.6; + caliber=0.8; deflecting=18; hit=9; typicalSpeed=886; @@ -68,13 +70,30 @@ class CfgAmmo { ACE_muzzleVelocities[]={780, 886, 950}; ACE_barrelLengths[]={10, 15.5, 20}; }; + class ACE_556x45_Ball_M995_AP : B_556x45_Ball { + airFriction=-0.001120; + caliber=1.6; + deflecting=18; + hit=6; + typicalSpeed=886; + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=46; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.151}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={950, 1030, 1040}; + ACE_barrelLengths[]={10, 15.5, 20}; + }; class B_556x45_Ball_Tracer_Red; class ACE_B_556x45_Ball_Tracer_Dim: B_556x45_Ball_Tracer_Red { nvgOnly = 1; }; class ACE_545x39_Ball_7N6M : B_556x45_Ball { airFriction=-0.001162; - caliber=0.5; + caliber=0.6; deflecting=18; hit=7; typicalSpeed=880; @@ -89,13 +108,15 @@ class CfgAmmo { ACE_muzzleVelocities[]={780, 880, 920}; ACE_barrelLengths[]={10, 16.3, 20}; }; - class B_556x45_Ball_Tracer_Yellow; - class ACE_545x39_Ball_7T3M : B_556x45_Ball_Tracer_Yellow { + class B_556x45_Ball_Tracer_Green; + class ACE_545x39_Ball_7T3M : B_556x45_Ball_Tracer_Green { airFriction=-0.001162; - caliber=0.5; + caliber=0.6; deflecting=18; hit=7; typicalSpeed=883; + tracerStartTime = 0.073; //7T3M tracer burns out to 850m + tracerEndTime = 1.736; //Time in seconds calculated with ballistics calculator ACE_caliber=0.220; ACE_bulletLength=0.85; ACE_bulletMass=49.8; @@ -129,10 +150,10 @@ class CfgAmmo { class ACE_65x39_Caseless_green_Tracer_Dim : B_65x39_Caseless_green { nvgOnly = 1; }; - class ACE_65x47_Ball_Scenar: B_65x39_Caseless - { + class ACE_65x47_Ball_Scenar: B_65x39_Caseless { airFriction=-0.00078; typicalSpeed=820 ; + caliber=0.9; ACE_caliber=0.264; ACE_bulletLength=1.364; ACE_bulletMass=139; @@ -144,10 +165,27 @@ class CfgAmmo { ACE_muzzleVelocities[]={730, 760, 790, 820, 830}; ACE_barrelLengths[]={10, 16, 20, 24, 26}; }; + class ACE_65_Creedmor_Ball: B_65x39_Caseless { + airFriction=-0.000651; + typicalSpeed=860 ; + caliber=1.1; + ACE_caliber=0.264; + ACE_bulletLength=1.426; + ACE_bulletMass=140; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.317}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={750, 820, 840, 852, 860}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; class B_762x51_Ball : BulletBase { airFriction=-0.001035; typicalSpeed=833; hit=9; + tracerStartTime = 0.073; //Based on the British L5A1 which burns out to 1000m + tracerEndTime = 2.058; //Time in seconds calculated with ballistics calculator ACE_caliber=0.308; ACE_bulletLength=1.14; ACE_bulletMass=146; @@ -165,7 +203,7 @@ class CfgAmmo { }; class ACE_762x51_Ball_M118LR : B_762x51_Ball { airFriction=-0.0008525; - caliber=1.05; + caliber=1.8; hit=16; typicalSpeed=790; ACE_caliber=0.308; @@ -179,11 +217,27 @@ class CfgAmmo { ACE_muzzleVelocities[]={750, 780, 790, 794}; ACE_barrelLengths[]={16, 20, 24, 26}; }; + class ACE_762x51_Ball_Mk316_Mod_0 : B_762x51_Ball { + airFriction=-0.0008525; + caliber=1.8; + hit=16; + typicalSpeed=790; + ACE_caliber=0.308; + ACE_bulletLength=1.24; + ACE_bulletMass=175; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; + ACE_ballisticCoefficients[]={0.243}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={775, 790, 805, 810}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; class ACE_762x51_Ball_Mk319_Mod_0 : B_762x51_Ball { airFriction=-0.00103; - caliber=0.85; + caliber=1.5; hit=14; - typicalSpeed=890; + typicalSpeed=900; ACE_caliber=0.308; ACE_bulletLength=1.24; ACE_bulletMass=130; @@ -195,11 +249,27 @@ class CfgAmmo { ACE_muzzleVelocities[]={838, 892, 910}; ACE_barrelLengths[]={13, 16, 20}; }; + class ACE_762x51_Ball_M993_AP : B_762x51_Ball { + airFriction=-0.00103; + caliber=2.2; + hit=11; + typicalSpeed=930; + ACE_caliber=0.308; + ACE_bulletLength=1.24; + ACE_bulletMass=127; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.377}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={875, 910, 930}; + ACE_barrelLengths[]={13, 16, 20}; + }; class ACE_762x51_Ball_Subsonic : B_762x51_Ball { airFriction=-0.000535; - caliber=0.5; + caliber=1; hit=6; - typicalSpeed=790; + typicalSpeed=320; ACE_caliber=0.308; ACE_bulletLength=1.340; ACE_bulletMass=200; @@ -211,15 +281,63 @@ class CfgAmmo { ACE_muzzleVelocities[]={305, 325, 335, 340}; ACE_barrelLengths[]={16, 20, 24, 26}; }; + class ACE_30_06_M1_Ball : B_762x51_Ball { + airFriction=-0.0009; + typicalSpeed=800; + caliber=2.0; + hit=10; + ACE_caliber=0.308; + ACE_bulletLength=1.21; + ACE_bulletMass=174; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.494}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={700, 785, 800, 830, 840}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class ACE_7_Remington_Magnum_Ball : B_762x51_Ball { + airFriction=-0.0008; + typicalSpeed=820; + caliber=2.1; + hit=8; + ACE_caliber=0.284; + ACE_bulletLength=1.529; + ACE_bulletMass=180; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.345}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={720, 780, 812, 822, 830}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class ACE_243_Winchester_Ball : B_762x51_Ball { + airFriction=-0.00095; + typicalSpeed=915; + caliber=2.3; + hit=6; + ACE_caliber=0.243; + ACE_bulletLength=1.282; + ACE_bulletMass=180; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.278}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={830, 875, 900, 915, 920}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; class ACE_762x67_Ball_Mk248_Mod_0 : B_762x51_Ball { airFriction=-0.000830; - caliber=1.08; + caliber=1.8; hit=17; typicalSpeed=900; ACE_caliber=0.308; ACE_bulletLength=1.353; ACE_bulletMass=190; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; ACE_ballisticCoefficients[]={0.268}; ACE_velocityBoundaries[]={}; ACE_standardAtmosphere="ICAO"; @@ -229,13 +347,13 @@ class CfgAmmo { }; class ACE_762x67_Ball_Mk248_Mod_1 : B_762x51_Ball { airFriction=-0.000815; - caliber=1.12; + caliber=1.9; hit=18; typicalSpeed=867; ACE_caliber=0.308; ACE_bulletLength=1.489; ACE_bulletMass=220; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; ACE_ballisticCoefficients[]={0.310}; ACE_velocityBoundaries[]={}; ACE_standardAtmosphere="ICAO"; @@ -245,7 +363,7 @@ class CfgAmmo { }; class ACE_762x67_Ball_Berger_Hybrid_OTM : B_762x51_Ball { airFriction=-0.00076; - caliber=1.15; + caliber=2.0; hit=19; typicalSpeed=853; ACE_caliber=0.308; @@ -275,7 +393,7 @@ class CfgAmmo { }; class ACE_762x54_Ball_7N14 : B_762x51_Ball { airFriction=-0.001023; - caliber=0.95; + caliber=1.5; hit=15; typicalSpeed=820; ACE_caliber=0.312; @@ -292,9 +410,11 @@ class CfgAmmo { class B_762x54_Tracer_Green; class ACE_762x54_Ball_7T2 : B_762x54_Tracer_Green { airFriction=-0.001023; - caliber=0.9; + caliber=1.5; hit=15; typicalSpeed=800; + tracerStartTime = 0.073; //Based on the 7T2 which burns three seconds + tracerEndTime = 3; ACE_caliber=0.312; ACE_bulletLength=1.14; ACE_bulletMass=149; @@ -308,7 +428,7 @@ class CfgAmmo { }; class ACE_762x35_Ball : B_762x51_Ball { airFriction=-0.000821; - caliber=0.9; + caliber=1.5; hit=11; typicalSpeed=790; ACE_caliber=0.308; @@ -325,6 +445,7 @@ class CfgAmmo { class ACE_762x39_Ball : B_762x51_Ball { airFriction=-0.0015168; hit=12; + caliber=1.5; typicalSpeed=716; ACE_caliber=0.308; ACE_bulletLength=1.14; @@ -337,10 +458,13 @@ class CfgAmmo { ACE_muzzleVelocities[]={650, 716, 750}; ACE_barrelLengths[]={10, 16.3, 20}; }; - class ACE_762x39_Ball_57N231P : B_762x51_Tracer_Yellow { + class ACE_762x39_Ball_57N231P : B_762x54_Tracer_Green { airFriction=-0.0015168; hit=12; + caliber=1.5; typicalSpeed=716; + tracerStartTime = 0.073; //57N231P tracer burns out to 800m + tracerEndTime = 2.082; //Time in seconds calculated with ballistics calculator ACE_caliber=0.308; ACE_bulletLength=1.14; ACE_bulletMass=117; @@ -430,6 +554,7 @@ class CfgAmmo { class ACE_303_Ball : ACE_762x51_Ball_M118LR { airFriction=-0.00083; typicalSpeed=761; + caliber=2.0; ACE_caliber=0.311; ACE_bulletLength=1.227; ACE_bulletMass=174; @@ -517,7 +642,6 @@ class CfgAmmo { class ACE_338_Ball : B_338_Ball { timeToLive=10; airFriction=-0.000535; - caliber=1.55; typicalSpeed=826; ACE_caliber=0.338; ACE_bulletLength=1.70; @@ -533,7 +657,7 @@ class CfgAmmo { class ACE_338_Ball_API526 : B_338_Ball { timeToLive=10; airFriction=-0.000673; - caliber=2.4; + caliber=2.8; typicalSpeed=826; ACE_caliber=0.338; ACE_bulletLength=1.535; @@ -563,7 +687,7 @@ class CfgAmmo { class B_127x99_Ball : BulletBase { timeToLive=10; airFriction=-0.0006; - typicalSpeed=853; + typicalSpeed=900; ACE_caliber=0.510; ACE_bulletLength=2.310; ACE_bulletMass=647; @@ -572,13 +696,31 @@ class CfgAmmo { ACE_velocityBoundaries[]={}; ACE_standardAtmosphere="ASM"; ACE_dragModel=1; - ACE_muzzleVelocities[]={853}; + ACE_muzzleVelocities[]={900}; + ACE_barrelLengths[]={29}; + }; + class ACE_127x99_API : BulletBase { + timeToLive=10; + airFriction=-0.0006; + typicalSpeed=900; + hit=25; + caliber=4.0; + ACE_caliber=0.510; + ACE_bulletLength=2.310; + ACE_bulletMass=648; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.670}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={900}; ACE_barrelLengths[]={29}; }; class ACE_127x99_Ball_AMAX : B_127x99_Ball { timeToLive=10; airFriction=-0.000374; typicalSpeed=860; + caliber=3.0; ACE_caliber=0.510; ACE_bulletLength=2.540; ACE_bulletMass=750; diff --git a/addons/ballistics/CfgMagazines.hpp b/addons/ballistics/CfgMagazines.hpp index 9ce3ad3eb0..9ead13c962 100644 --- a/addons/ballistics/CfgMagazines.hpp +++ b/addons/ballistics/CfgMagazines.hpp @@ -42,13 +42,21 @@ class CfgMagazines { class ACE_30Rnd_65x39_caseless_green_mag_Tracer_Dim: 30Rnd_65x39_caseless_green_mag_Tracer { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_65x39_Caseless_green_Tracer_Dim"; - displayName = "$STR_ACE_30Rnd_65x39_caseless_mag_Tracer_DimName"; - displayNameShort = "$STR_ACE_30Rnd_65x39_caseless_mag_Tracer_DimNameShort"; - descriptionShort = "$STR_ACE_30Rnd_65x39_caseless_mag_Tracer_DimDescription"; + displayName = "$STR_ACE_30Rnd_65x39_caseless_green_mag_Tracer_DimName"; + displayNameShort = "$STR_ACE_30Rnd_65x39_caseless_green_mag_Tracer_DimNameShort"; + descriptionShort = "$STR_ACE_30Rnd_65x39_caseless_green_mag_Tracer_DimDescription"; }; class 30Rnd_556x45_Stanag: CA_Magazine { }; + class ACE_30Rnd_556x45_Stanag_M995_AP_mag: 30Rnd_556x45_Stanag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_556x45_Ball_M995_AP"; + displayName = "$STR_ACE_30Rnd_556x45_Stanag_M995_AP_mag_Name"; + displayNameShort = "$STR_ACE_30Rnd_556x45_Stanag_M995_AP_mag_NameShort"; + descriptionShort = "$STR_ACE_30Rnd_556x45_Stanag_M995_AP_mag_Description"; + initSpeed = 1046; + }; class ACE_30Rnd_556x45_Stanag_Mk262_mag: 30Rnd_556x45_Stanag { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_556x45_Ball_Mk262"; @@ -123,6 +131,15 @@ class CfgMagazines { descriptionShort = "$STR_ACE_10Rnd_762x51_M118LR_Mag_Description"; initSpeed = 780; }; + class ACE_10Rnd_762x51_Mk316_Mod_0_Mag: 10Rnd_762x51_Mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_762x51_Ball_Mk316_Mod_0"; + count = 10; + displayName = "$STR_ACE_10Rnd_762x51_Mk316_Mod_0_Mag_Name"; + displayNameShort = "$STR_ACE_10Rnd_762x51_Mk316_Mod_0_Mag_NameShort"; + descriptionShort = "$STR_ACE_10Rnd_762x51_Mk316_Mod_0_Mag_Description"; + initSpeed = 790; + }; class ACE_10Rnd_762x51_Mk319_Mod_0_Mag: 10Rnd_762x51_Mag { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_762x51_Ball_Mk319_Mod_0"; @@ -132,6 +149,15 @@ class CfgMagazines { descriptionShort = "$STR_ACE_10Rnd_762x51_Mk319_Mod_0_Mag_Description"; initSpeed = 900; }; + class ACE_10Rnd_762x51_M993_AP_Mag: 10Rnd_762x51_Mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_762x51_Ball_M993_AP"; + count = 10; + displayName = "$STR_ACE_10Rnd_762x51_M993_AP_Mag_Name"; + displayNameShort = "$STR_ACE_10Rnd_762x51_M993_AP_Mag_NameShort"; + descriptionShort = "$STR_ACE_10Rnd_762x51_M993_AP_Mag_Description"; + initSpeed = 920; + }; class ACE_20Rnd_762x51_M118LR_Mag: 20Rnd_762x51_Mag { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_762x51_Ball_M118LR"; @@ -140,6 +166,15 @@ class CfgMagazines { descriptionShort = "$STR_ACE_20Rnd_762x51_M118LR_Mag_Description"; initSpeed = 780; }; + class ACE_20Rnd_762x51_Mk316_Mod_0_Mag: 20Rnd_762x51_Mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_762x51_Ball_Mk316_Mod_0"; + count = 20; + displayName = "$STR_ACE_20Rnd_762x51_Mk316_Mod_0_Mag_Name"; + displayNameShort = "$STR_ACE_20Rnd_762x51_Mk316_Mod_0_Mag_NameShort"; + descriptionShort = "$STR_ACE_20Rnd_762x51_Mk316_Mod_0_Mag_Description"; + initSpeed = 790; + }; class ACE_20Rnd_762x51_Mk319_Mod_0_Mag: 20Rnd_762x51_Mag { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_762x51_Ball_Mk319_Mod_0"; @@ -148,6 +183,15 @@ class CfgMagazines { descriptionShort = "$STR_ACE_20Rnd_762x51_Mk319_Mod_0_Mag_Description"; initSpeed = 900; }; + class ACE_20Rnd_762x51_M993_AP_Mag: 20Rnd_762x51_Mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_762x51_Ball_M993_AP"; + count = 20; + displayName = "$STR_ACE_20Rnd_762x51_M993_AP_Mag_Name"; + displayNameShort = "$STR_ACE_20Rnd_762x51_M993_AP_Mag_NameShort"; + descriptionShort = "$STR_ACE_20Rnd_762x51_M993_AP_Mag_Description"; + initSpeed = 920; + }; class ACE_20Rnd_762x67_Mk248_Mod_0_Mag: 20Rnd_762x51_Mag { author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_762x67_Ball_Mk248_Mod_0"; @@ -179,6 +223,13 @@ class CfgMagazines { displayNameShort = "$STR_ACE_30Rnd_65x47_Scenar_mag_NameShort"; descriptionShort = "$STR_ACE_30Rnd_65x47_Scenar_mag_Description"; }; + class ACE_30Rnd_65_Creedmor_mag: 30Rnd_65x39_caseless_mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_65_Creedmor_Ball"; + displayName = "$STR_ACE_30Rnd_65_Creedmor_mag_Name"; + displayNameShort = "$STR_ACE_30Rnd_65_Creedmor_mag_NameShort"; + descriptionShort = "$STR_ACE_30Rnd_65_Creedmor_mag_Description"; + }; class 10Rnd_338_Mag; class ACE_10Rnd_338_300gr_HPBT_Mag: 10Rnd_338_Mag { author = "$STR_ACE_Common_ACETeam"; @@ -204,7 +255,15 @@ class CfgMagazines { displayName = "$STR_ACE_5Rnd_127x99_Mag_Name"; displayNameShort = "$STR_ACE_5Rnd_127x99_Mag_NameShort"; descriptionShort = "$STR_ACE_5Rnd_127x99_Mag_Description"; - initSpeed = 853; + initSpeed = 900; + }; + class ACE_5Rnd_127x99_API_Mag: 5Rnd_127x108_Mag { + author = "$STR_ACE_Common_ACETeam"; + ammo = "ACE_127x99_API"; + displayName = "$STR_ACE_5Rnd_127x99_API_Mag_Name"; + displayNameShort = "$STR_ACE_5Rnd_127x99_API_Mag_NameShort"; + descriptionShort = "$STR_ACE_5Rnd_127x99_API_Mag_Description"; + initSpeed = 900; }; class ACE_5Rnd_127x99_AMAX_Mag: 5Rnd_127x108_Mag { author = "$STR_ACE_Common_ACETeam"; diff --git a/addons/ballistics/CfgVehicles.hpp b/addons/ballistics/CfgVehicles.hpp index 4ea9fc87a2..89f5c26652 100644 --- a/addons/ballistics/CfgVehicles.hpp +++ b/addons/ballistics/CfgVehicles.hpp @@ -14,6 +14,7 @@ class CfgVehicles { class Box_NATO_Wps_F: NATO_Box_Base { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); }; }; @@ -26,6 +27,7 @@ class CfgVehicles { MACRO_ADDMAGAZINE(ACE_10Rnd_338_300gr_HPBT_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_API526_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_Mag,4); + MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_API_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_AMAX_Mag,4); }; }; @@ -33,14 +35,18 @@ class CfgVehicles { class Box_NATO_Ammo_F: NATO_Box_Base { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M118LR_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M118LR_Mag,4); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk316_Mod_0_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk316_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_Tracer_Dim,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_300gr_HPBT_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_API526_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_Mag,4); + MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_API_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_AMAX_Mag,4); }; }; @@ -49,13 +55,18 @@ class CfgVehicles { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M118LR_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M118LR_Mag,4); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk316_Mod_0_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk316_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_Tracer_Dim,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_SD,3); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M993_AP_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M993_AP_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_300gr_HPBT_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_API526_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_Mag,4); + MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_API_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_AMAX_Mag,4); }; }; @@ -64,8 +75,11 @@ class CfgVehicles { class B_supplyCrate_F: ReammoBox_F { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M118LR_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M118LR_Mag,4); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk316_Mod_0_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk316_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_Tracer_Dim,4); @@ -76,6 +90,7 @@ class CfgVehicles { class Box_East_Wps_F: EAST_Box_Base { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x54_Tracer_mag,4); }; }; @@ -85,6 +100,7 @@ class CfgVehicles { MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Tracer_Dim,1); MACRO_ADDMAGAZINE(ACE_30Rnd_65x39_caseless_green_mag_Tracer_Dim,4); MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x54_Tracer_mag,4); }; }; @@ -92,6 +108,7 @@ class CfgVehicles { class Box_East_Ammo_F: EAST_Box_Base { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x54_Tracer_mag,4); }; }; @@ -99,7 +116,7 @@ class CfgVehicles { class Box_East_Support_F: EAST_Box_Base { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,6); - MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_SD,3); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x54_Tracer_mag,4); }; }; @@ -107,6 +124,7 @@ class CfgVehicles { class IND_Box_Base; class Box_IND_Wps_F: IND_Box_Base { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -120,6 +138,7 @@ class CfgVehicles { class Box_IND_Ammo_F: IND_Box_Base { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -128,6 +147,7 @@ class CfgVehicles { class FIA_Box_Base_F; class Box_FIA_Wps_F: FIA_Box_Base_F { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -135,6 +155,7 @@ class CfgVehicles { class Box_FIA_Ammo_F: FIA_Box_Base_F { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -142,6 +163,7 @@ class CfgVehicles { class I_supplyCrate_F: B_supplyCrate_F { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -149,6 +171,7 @@ class CfgVehicles { class IG_supplyCrate_F: ReammoBox_F { class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); }; @@ -157,6 +180,7 @@ class CfgVehicles { class C_supplyCrate_F: ReammoBox_F { class TransportMagazines { MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); }; }; @@ -164,12 +188,16 @@ class CfgVehicles { scope = 2; accuracy = 1000; displayName = "[ACE] Ammo Supply Crate"; - // TODO: model = "..."; + model = "\A3\weapons_F\AmmoBoxes\AmmoBox_F"; author = "$STR_ACE_Common_ACETeam"; class TransportMagazines { MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_SD,4); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M993_AP_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M993_AP_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_M118LR_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_M118LR_Mag,4); + MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk316_Mod_0_Mag,4); + MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk316_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mk319_Mod_0_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x51_Mag_Tracer_Dim,4); @@ -177,6 +205,7 @@ class CfgVehicles { MACRO_ADDMAGAZINE(ACE_20Rnd_762x67_Mk248_Mod_1_Mag,4); MACRO_ADDMAGAZINE(ACE_20Rnd_762x67_Berger_Hybrid_OTM_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_762x54_Tracer_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_M995_AP_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk262_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Mk318_mag,4); MACRO_ADDMAGAZINE(ACE_30Rnd_556x45_Stanag_Tracer_Dim,4); @@ -185,9 +214,11 @@ class CfgVehicles { MACRO_ADDMAGAZINE(ACE_100Rnd_65x39_caseless_mag_Tracer_Dim,4); MACRO_ADDMAGAZINE(ACE_200Rnd_65x39_cased_Box_Tracer_Dim,4); MACRO_ADDMAGAZINE(ACE_30Rnd_65x47_Scenar_mag,4); + MACRO_ADDMAGAZINE(ACE_30Rnd_65_Creedmor_mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_300gr_HPBT_Mag,4); MACRO_ADDMAGAZINE(ACE_10Rnd_338_API526_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_Mag,4); + MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_API_Mag,4); MACRO_ADDMAGAZINE(ACE_5Rnd_127x99_AMAX_Mag,4); }; }; diff --git a/addons/ballistics/CfgWeapons.hpp b/addons/ballistics/CfgWeapons.hpp index 26b07303c0..7e647d2605 100644 --- a/addons/ballistics/CfgWeapons.hpp +++ b/addons/ballistics/CfgWeapons.hpp @@ -88,7 +88,8 @@ class CfgWeapons { "30Rnd_65x39_caseless_mag", "30Rnd_65x39_caseless_mag_Tracer", "ACE_30Rnd_65x39_caseless_mag_Tracer_Dim", - "ACE_30Rnd_65x47_Scenar_mag" + "ACE_30Rnd_65x47_Scenar_mag", + "ACE_30Rnd_65_Creedmor_mag" }; initSpeed = -1.018; ACE_barrelTwist=9; @@ -381,6 +382,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -400,6 +402,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -414,6 +417,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -428,6 +432,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -448,6 +453,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -462,6 +468,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -476,6 +483,7 @@ class CfgWeapons { "30Rnd_556x45_Stanag_Tracer_Red", "30Rnd_556x45_Stanag_Tracer_Green", "30Rnd_556x45_Stanag_Tracer_Yellow", + "ACE_30Rnd_556x45_Stanag_M995_AP_mag", "ACE_30Rnd_556x45_Stanag_Mk262_mag", "ACE_30Rnd_556x45_Stanag_Mk318_mag", "ACE_30Rnd_556x45_Stanag_Tracer_Dim" @@ -502,8 +510,10 @@ class CfgWeapons { magazines[] = { "20Rnd_762x51_Mag", "ACE_20Rnd_762x51_Mag_Tracer_Dim", + "ACE_20Rnd_762x51_Mk316_Mod_0_Mag", "ACE_20Rnd_762x51_M118LR_Mag", "ACE_20Rnd_762x51_Mk319_Mod_0_Mag", + "ACE_20Rnd_762x51_M993_AP_Mag", "ACE_20Rnd_762x51_Mag_SD" }; initSpeed = -0.9724; @@ -527,6 +537,7 @@ class CfgWeapons { "5Rnd_127x108_Mag", "5Rnd_127x108_APDS_Mag", "ACE_5Rnd_127x99_Mag", + "ACE_5Rnd_127x99_API_Mag", "ACE_5Rnd_127x99_AMAX_Mag" }; initSpeed = -1.0; @@ -550,8 +561,10 @@ class CfgWeapons { magazines[] = { "20Rnd_762x51_Mag", "ACE_20Rnd_762x51_Mag_Tracer_Dim", + "ACE_20Rnd_762x51_Mk316_Mod_0_Mag", "ACE_20Rnd_762x51_M118LR_Mag", "ACE_20Rnd_762x51_Mk319_Mod_0_Mag", + "ACE_20Rnd_762x51_M993_AP_Mag", "ACE_20Rnd_762x51_Mag_SD" }; initSpeed = -0.9843; @@ -572,8 +585,10 @@ class CfgWeapons { magazines[] = { "20Rnd_762x51_Mag", "ACE_20Rnd_762x51_Mag_Tracer_Dim", + "ACE_20Rnd_762x51_Mk316_Mod_0_Mag", "ACE_20Rnd_762x51_M118LR_Mag", "ACE_20Rnd_762x51_Mk319_Mod_0_Mag", + "ACE_20Rnd_762x51_M993_AP_Mag", "ACE_20Rnd_762x51_Mag_SD" }; initSpeed = -0.9916; diff --git a/addons/ballistics/stringtable.xml b/addons/ballistics/stringtable.xml index c75ab6339d..4dc27fd2fc 100644 --- a/addons/ballistics/stringtable.xml +++ b/addons/ballistics/stringtable.xml @@ -256,42 +256,6 @@ Calibro: 5.56x45 mm Traccianti IR-DIM<br />Munizioni: 30<br />In uso su: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Калибр: 5,56x45 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - - 5.56mm 30Rnd AP Mag - 5,56 mm Páncéltörő 30-as Tár - 5,56 mm 30-Schuss-Magazin AP - Cargador de 30 balas AP de 5,56mm - Ch. 5,56mm 30Cps AP - Magazynek 5,56mm 30rd AP - 5.56mm 30ks AP Zásobník - Carregador de 30 projéteis AP de 5,56mm - Caricatore 5.56mm 30Rnd AP - Магазин из 30-ти 5,56 мм бронебойных - - - 5.56mm AP - 5,56 mm Páncéltörő - 5,56mm AP - 5,56mm AP - 5,56mm AP - 5,56mm AP - 5.56mm AP - 5,56mm AP - 5.56mm AP - 5,56 мм бронебойные - - - Caliber: 5.56x45 mm AP<br />Rounds: 30<br />Used in: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Kaliber: 5,56x45 mm Páncéltörő<br />Lövedékek: 30<br />Használható: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Kaliber: 5,56x45 mm AP<br />Patronen: 30<br />Eingesetzt von: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Calibre: 5,56x45 mm AP<br />Balas: 30<br />Se usa en: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Calibre: 5,56x45 mm AP<br />Cartouches: 30<br />Utilisé dans: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Kaliber: 5,56x45 mm AP<br />Pociski: 30<br />Używane w: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Ráže: 5.56x45 mm AP<br />Munice: 30<br />Použití: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Calibre: 5,56x45 mm AP<br />Projéteis: 30<br />Usado em: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Calibro: 5.56x45 mm AP<br />Munizioni: 30<br />In uso su: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Калибр: 5,56x45 мм бронебойные<br />Патронов: 30<br />Используются с: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - 7.62mm 20rnd Tracer Mag @@ -401,42 +365,6 @@ Calibro: 7.62x51 mm Sil.<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм дозвуковые<br />Патронов: 20<br />Используются с: Mk18 ABR - - 7.62mm 20Rnd AP Mag - 7,62 mm Páncéltörő 20-as Tár - 7,62 mm 20-Schuss-Magazin AP - Cargador de 20 balas AP de 7,62mm - Ch. 7,62mm 20Cps AP - Magazynek 7,62mm 20rd AP - 7.62mm 20ks AP Zásobník - Carregador de 20 projéteis AP de 7,62mm - Caricatore 7.62mm 20Rnd AP - Магазин из 20-ти 7,62 мм бронебойных - - - 7.62mm AP - 7,62 mm Páncéltörő - 7,62mm AP - 7,62mm AP - 7,62mm AP - 7,62mm AP - 7.62mm AP - 7,62mm AP - 7.62mm AP - 7,62 мм бронебойные - - - Caliber: 7.62x51 mm AP<br />Rounds: 20<br />Used in: Mk18 ABR - Kaliber: 7,62x51 mm Páncéltörő<br />Lövedékek: 20<br />Használható: Mk18 ABR - Kaliber: 7,62x51 mm AP<br />Patronen: 20<br />Eingesetzt von: EBR - Calibre: 7,62x51 mm AP<br />Balas: 20<br />Se usa en: Mk18 ABR - Calibre: 7,62x51 mm AP<br />Cartouches: 20<br />Utilisé dans: EBR - Kaliber: 7,62x51 mm AP<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51 mm AP<br />Munice: 20<br />Použití: Mk18 ABR - Calibre: 7,62x51 mm AP<br />Projéteis: 20<br />Usado em: Mk18 ABR - Calibro: 7.62x51 mm AP<br />Munizioni: 20<br />In uso su: Mk18 ABR - Калибр: 7,62x51 мм дозвуковые<br />Патронов: 20<br />Используются с: Mk18 ABR - .338 NM 130Rnd Tracer Belt @@ -564,31 +492,6 @@ Calibre: 9.3x64mm trazadora IR-DIM<br />Balas: 10<br />Se usa en: Cyrus Калибр: 9,3x64 мм ИК-трассирующие<br />Патронов: 10<br />Используются с: Cyrus - - 9.3mm 10Rnd AP Mag - 9,3mm 10-Schuss-Magazin Hartkern - Magazynek 9,3mm 10rd AP - Chargeur 9.3mm 10Cps AP - Cargador de 10 balas AP de 9.3mm - Магазин из 10-ти 9,3 мм бронебойных - - - 9.3mm AP - 9,3mm AP - 9,3mm AP - 9.3mm AP - 9.3mm AP - 9.3mm AP - 9,3 мм бронебойные - - - Caliber: 9.3x64mm AP<br />Rounds: 10<br />Used in: Cyrus - Kaliber: 9,3x64mm Hartkern<br />Schuss: 10<br />Verwendet für: Cyrus - Kaliber: 9,3x64 mm AP<br />Pociski: 10<br />Używany w: Cyrus - Calibre: 9.3x64mm AP<br />Cartouches: 10<br />Utilisé dans: Cyrus - Calibre: 9.3x64mm AP<br />Balas: 10<br />Se usa en: Cyrus - Калибр: 9,3x64 мм бронебойные<br />Патронов: 10<br />Используются с: Cyrus - 9.3mm 150Rnd Tracer Belt @@ -743,7 +646,7 @@ 6,5 мм ИК-трассирующие - 6.5mm 100Rnd Tracer IR-DIM Mag + 6.5mm 100Rnd Tracer IR-DIM Mag<br />Rounds: 100<br />Used in: MX LSW Magazynek 6,5mm 100rd Smugacz IR-DIM Chargeur 6.5mm 100Rnd Traçante IR-DIM Cargador de 100 balas trazadoras IR-DIM de 6.5mm @@ -764,7 +667,7 @@ 6,5 мм ИК-трассирующие - 6.5mm 200Rnd Tracer IR-DIM Belt + 6.5mm 200Rnd Tracer IR-DIM Belt<br />Rounds: 200<br />Used in: Stoner 99 LMG Magazynek 6,5mm 200rd Smugacz IR-DIM Bande 6.5mm 200Cps Traçante IR-DIM Cinta de 200 balas trazadoras IR-DIM de 6.5mm @@ -781,7 +684,7 @@ 5.56mm Mk262 5,56mm Mk262 5.56mm Mk262 - 5.56mm (Mk262) + 5.56mm Mk262 5,56 мм Mk262 @@ -793,16 +696,16 @@ 5.56mm 30Rnd Mag (Mk318) - Magazynek 5,56mm 30rd Mk318 + Magazynek 5,56mm 30rd (Mk318) 5.56mm 30Cps (Mk318) Cargador de 30 balas de 5.56mm (Mk318) - Магазин из 30-ти 5.56 мм Mk318 + Магазин из 30-ти 5.56 мм (Mk318) 5.56mm Mk318 5,56mm Mk318 5.56mm Mk318 - 5.56mm (Mk318) + 5.56mm Mk318 5.56 мм Mk318 @@ -812,6 +715,27 @@ Calibre: 5.56x45 mm NATO (Mk318)<br />Balas: 30 Калибр: 5,56x45 мм NATO (Mk318)<br />Патронов: 30 + + 5.56mm 30Rnd Mag (M995 AP) + Magazynek 5,56mm 30rd (M995 AP) + 5.56mm 30Cps (M995 AP) + Cargador de 30 balas de 5.56mm (M995 AP) + Магазин из 30-ти 5.56 мм (M995 AP) + + + 5.56mm AP + 5,56mm AP + 5.56mm AP + 5.56mm AP + 5.56 мм AP + + + Caliber: 5.56x45 mm NATO (M995 AP)<br />Rounds: 30 + Kaliber: 5,56x45 mm NATO (M995 AP)<br />Pociski: 30 + Calibre: 5.56x45 mm NATO (M995 AP)<br />Cartouches: 30 + Calibre: 5.56x45 mm NATO (M995 AP)<br />Balas: 30 + Калибр: 5,56x45 мм NATO (M995 AP)<br />Патронов: 30 + 7.62mm 10Rnd Mag (M118LR) Magazynek 7,62mm 10rd (M118LR) @@ -854,6 +778,48 @@ Calibre: 7.62x51 mm NATO (M118LR)<br />Balas: 20 Калибр: 7,62x51 мм NATO (M118LR)<br />Патронов: 20 + + 7.62mm 10Rnd Mag (Mk316 Mod 0) + Magazynek 7,62mm 10rd (Mk316 Mod 0) + 7.62mm 10Cps (Mk316 Mod 0) + Cargador de 10 balas de 7.62mm (Mk316 Mod 0) + Магазин из 10-ти 7,62 мм (Mk316 Mod 0) + + + 7.62mm Mk316 + 7,62mm Mk316 + 7.62mm Mk316 + 7.62mm Mk316 + 7,62 мм Mk316 + + + Caliber: 7.62x51 mm NATO (Mk316 Mod 0)<br />Rounds: 10 + Kaliber: 7,62x51 mm NATO (Mk316 Mod 0)<br />Pociski: 10 + Calibre: 7.62x51 mm NATO (Mk316 Mod 0)<br />Cartouches: 10 + Calibre: 7.62x51 mm NATO (Mk316 Mod 0)<br />Balas: 10 + Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 10 + + + 7.62mm 20Rnd Mag (Mk316 Mod 0) + Magazynek 7,62mm 20rd (Mk316 Mod 0) + 7.62mm 20Cps (Mk316 Mod 0) + Cargador de 20 balas de 7.62mm (Mk316 Mod 0) + Магазин из 20-ти 7,62 мм (Mk316 Mod 0) + + + 7.62mm Mk316 + 7,62mm Mk316 + 7.62mm Mk316 + 7.62mm Mk316 + 7,62 мм Mk316 + + + Caliber: 7.62x51 mm NATO (Mk316 Mod 0)<br />Rounds: 20 + Kaliber: 7,62x51 mm NATO (Mk316 Mod 0)<br />Pociski: 20 + Calibre: 7.62x51 mm NATO (Mk316 Mod 0)<br />Cartouches: 20 + Calibre: 7.62x51 mm NATO (Mk316 Mod 0)<br />Balas: 20 + Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 20 + 7.62mm 10Rnd Mag (Mk319 Mod 0) Magazynek 7,62mm 10rd (Mk319 Mod 0) @@ -896,6 +862,48 @@ Calibre: 7.62x51 mm NATO (Mk319 Mod 0)<br />Balas: 20 Калибр: 7,62x51 мм NATO (Mk319 Mod 0)<br />Патронов: 20 + + 7.62mm 10Rnd Mag (M993 AP) + Magazynek 7,62mm 10rd (M993 AP) + 7.62mm 10Cps (M993 AP) + Cargador de 10 balas de 7.62mm (M993 AP) + Магазин из 10-ти 7,62 мм (M993 AP) + + + 7.62mm AP + 7,62mm AP + 7.62mm AP + 7.62mm AP + 7,62mm AP + + + Caliber: 7.62x51 mm NATO (M993 AP)<br />Rounds: 10 + Kaliber: 7,62x51 mm NATO (M993 AP)<br />Pociski: 10 + Calibre: 7.62x51 mm NATO (M993 AP)<br />Cartouches: 10 + Calibre: 7.62x51 mm NATO (M993 AP)<br />Balas: 10 + Калибр: 7,62x51 мм NATO (M993 AP)<br />Патронов: 10 + + + 7.62mm 20Rnd Mag (M993 AP) + Magazynek 7,62mm 20rd (M993 AP) + 7.62mm 20Cps (M993 AP) + Cargador de 20 balas de 7.62mm (M993 AP) + Магазин из 20-ти 7,62 мм (M993 AP) + + + 7.62mm AP + 7,62mm AP + 7.62mm AP + 7.62mm AP + 7,62 мм AP + + + Caliber: 7.62x51 mm NATO (M993 AP)<br />Rounds: 20 + Kaliber: 7,62x51 mm NATO (M993 AP)<br />Pociski: 20 + Calibre: 7.62x51 mm NATO (M993 AP)<br />Cartouches: 20 + Calibre: 7.62x51 mm NATO (M993 AP)<br />Balas: 20 + Калибр: 7,62x51 мм NATO (M993 AP)<br />Патронов: 20 + 7.62mm 20Rnd Mag (Mk248 Mod 0) Magazynek 7,62mm 20rd (Mk248 Mod 0) @@ -967,19 +975,34 @@ Магазин из 30-ти 6,5x47 мм (HPBT Scenar) - 6.5mm Scenar - 6.5mm Scenar - 6.5mm Scenar - 6,5mm Scenar - 6,5 мм Scenar + 6.5mm Lapua + 6.5mm Lapua + 6.5mm Lapua + 6,5mm Lapua + 6,5 мм Lapua - Caliber: 6.5x47mm (HPBT Scenar)<br />Rounds: 30 + Caliber: 6.5x47mm (HPBT Scenar)<br />Rounds: 30<br />Used in: MXM Calibre: 6.5x47mm (HPBT Scenar)<br />Cartouches: 30 Calibre: 6.5x47mm (HPBT Scenar)<br />Balas: 30 Kaliber: 6,5x47 mm (HPBT Scenar)<br />Pociski: 30 Калибр: 6,5x47 мм (HPBT Scenar)<br />Патронов: 30 + + 6.5mm Creedmor 30Rnd Mag + Magazynek 6,5mm Creedmor 30rd + + + 6.5mm CM + 6.5mm CM + 6.5mm CM + 6,5mm CM + 6,5 мм CM + + + Caliber: 6.5mm Creedmor<br />Rounds: 30<br />Used in: MXM + Kaliber: 6,5mm Creedmor<br />Pociski: 30<br />Używany w: MXM + .338 10Rnd Mag (300gr Sierra MatchKing HPBT) .338 10 Cps (300gr Sierra MatchKing HPBT) @@ -1043,6 +1066,24 @@ Kaliber: 12,7x99 mm<br />Pociski: 5 Калибр: 12,7x99 мм<br />Патронов: 5 + + 12.7x99mm API 5Rnd Mag + 12.7x99mm API 5Cps + Cargador de 5 balas de 12.7x99mm API + Magazynek 12,7x99mm API 5rd + + + 12.7mm API + 12.7mm API + 12.7mm API + 12,7mm API + + + Caliber: 12.7x99mm API<br />Rounds: 5 + Calibre: 12.7x99mm API<br />Cartouches: 5 + Calibre: 12.7x99mm API<br />Balas: 5 + Kaliber: 12,7x99 mm API<br />Pociski: 5 + 12.7x99mm 5Rnd Mag (AMAX) 12.7x99mm 5Rnd Mag (AMAX) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 10b2d0285f..1e2eb3f201 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -101,25 +101,20 @@ class CfgVehicles { #define MACRO_LOADUNLOADCAPTIVE \ class ACE_Actions { \ class ACE_MainActions { \ - selection = ""; \ - class ACE_LoadCaptive { \ + class GVAR(LoadCaptive) { \ displayName = "$STR_ACE_Captives_LoadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ exceptions[] = {"isNotEscorting"}; \ - showDisabled = 0; \ priority = 1.2; \ - hotkey = "L"; \ }; \ - class ACE_UnloadCaptive { \ + class GVAR(UnloadCaptive) { \ displayName = "$STR_ACE_Captives_UnloadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ - showDisabled = 0; \ priority = 1.2; \ - hotkey = "C"; \ }; \ }; \ }; diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 08f44a1437..b8758065d8 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -22,7 +22,7 @@ PARAMS_3(_unit,_target,_state); if (_state) then { if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; - [_unit, _target] call EFUNC(common,claim); + [_unit, _target, false] call EFUNC(common,claim); _unit setVariable [QGVAR(isEscorting), true, true]; _target attachTo [_unit, [0, 1, 0]]; @@ -34,8 +34,7 @@ if (_state) then { {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; - private "_escortFnc"; - _escortFnc = { + [{ EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); if (_unit getVariable [QGVAR(isEscorting), false]) then { if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { @@ -45,13 +44,12 @@ if (_state) then { if (!(_unit getVariable [QGVAR(isEscorting), false])) then { [(_this select 1)] call cba_fnc_removePerFrameHandler; - [objNull, _target] call EFUNC(common,claim); + [objNull, _target, false] call EFUNC(common,claim); detach _target; _unit removeAction _actionID; _unit setVariable [QGVAR(escortedUnit), objNull, true]; }; - }; - [_escortFnc, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler; + }, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler; } else { _unit setVariable [QGVAR(isEscorting), false, true]; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 3a16ac9d43..7dc07743ed 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -97,14 +97,16 @@ if (!hasInterface) exitWith {}; call COMPILE_FILE(scripts\assignedItemFix); call COMPILE_FILE(scripts\initScrollWheel); -0 spawn { - while {true} do { - waitUntil {!isNull (findDisplay 46)}; sleep 0.1; - findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; - [false] call FUNC(disableUserInput); - waitUntil {isNull (findDisplay 46)}; - }; +DFUNC(mouseZHandler) = { + waitUntil {!isNull (findDisplay 46)}; sleep 0.1; + findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; + [false] call FUNC(disableUserInput); }; + +addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}]; +[] spawn FUNC(mouseZHandler); + + enableCamShake true; // Set the name for the current player diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 4067b366d6..0fc5c074d6 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; // a static weapon has to be empty for dragging if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; -alive _target && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLeftLeg") + (_target getHitPointDamage "HitRightLeg") > 0.4})} +alive _target && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})} diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index dc2d64168b..92744553fd 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; // a static weapon has to be empty for dragging if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; -alive _target && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLeftLeg") + (_target getHitPointDamage "HitRightLeg") > 0.4})}; \ No newline at end of file +alive _target && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; \ No newline at end of file diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index 3f1a5707a8..8e79bc8056 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -35,7 +35,7 @@ // Conditions: canInteract if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + if !(call FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange); @@ -49,7 +49,7 @@ // Conditions: canInteract if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + if !(call FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange); diff --git a/addons/frag/CfgAmmo.hpp b/addons/frag/CfgAmmo.hpp index 61cd0ccfd0..14b1a1ab69 100644 --- a/addons/frag/CfgAmmo.hpp +++ b/addons/frag/CfgAmmo.hpp @@ -6,15 +6,15 @@ class CfgAmmo { //class ace_arty_105mm_m1_m782_time; //class ace_arty_105mm_m1_m782_prox: ace_arty_105mm_m1_m782_time {}; //class ace_arty_105mm_m1_m782_delay: ace_arty_105mm_m1_m782_prox { - // ACE_FRAG_SKIP = 1; + // GVAR(skip) = 1; //}; class Bo_GBU12_LGB; class Nou_GBU12 : Bo_GBU12_LGB { - ACE_FRAG_CLASSES[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - ACE_FRAG_METAL = 140000; - ACE_FRAG_CHARGE = 87000; - ACE_FRAG_GURNEY_C = 2320; - ACE_FRAG_GURNEY_K = 1/2; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 140000; + GVAR(charge) = 87000; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; sideAirFriction = 0.04; airFriction = 0.04; laserLock = 0; @@ -23,68 +23,78 @@ class CfgAmmo { class GrenadeBase; class Grenade; class GrenadeHand: Grenade { - ACE_FRAG_SKIP = 0; - ACE_FRAG_FORCE = 1; + GVAR(skip) = 0; + GVAR(force) = 1; // This is a good high-drag frag type for grenades. - ACE_FRAG_CLASSES[] = {"ACE_frag_tiny_HD"}; + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; /* These values are based on the M67 Grenade, should be tweaked for individual grenades. */ - ACE_FRAG_METAL = 210; // metal in grams - ACE_FRAG_CHARGE = 185; // explosive in grams - ACE_FRAG_GURNEY_C = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations - ACE_FRAG_GURNEY_K = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations + GVAR(metal) = 210; // metal in grams + GVAR(charge) = 185; // explosive in grams + GVAR(gurney_c) = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations + GVAR(gurney_k) = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations }; class GrenadeHand_stone: GrenadeHand { - ACE_FRAG_SKIP = 1; + GVAR(skip) = 1; }; class SmokeShell: GrenadeHand { - ACE_FRAG_SKIP = 1; + GVAR(skip) = 1; }; class RocketBase; //class R_Hydra_HE: RocketBase { - // ACE_FRAG_SKIP = 1; + // GVAR(skip) = 1; //}; //class R_57mm_HE: RocketBase { - // ACE_FRAG_SKIP = 1; + // GVAR(skip) = 1; //}; class R_80mm_HE: RocketBase { - ACE_FRAG_SKIP = 1; + GVAR(skip) = 1; }; //class R_S8T_AT: RocketBase { - // ACE_FRAG_SKIP = 1; + // GVAR(skip) = 1; //}; class BombCore; class Bo_Mk82: BombCore { - ACE_FRAG_CLASSES[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - ACE_FRAG_METAL = 140000; - ACE_FRAG_CHARGE = 87000; - ACE_FRAG_GURNEY_C = 2320; - ACE_FRAG_GURNEY_K = 1/2; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 140000; + GVAR(charge) = 87000; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; }; class G_40mm_HE: GrenadeBase { - ACE_FRAG_SKIP = 0; - ACE_FRAG_FORCE = 1; + GVAR(skip) = 0; + GVAR(force) = 1; }; class ACE_G_40mm_HEDP: G_40mm_HE { + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; + GVAR(metal) = 200; + GVAR(charge) = 45; + GVAR(gurney_c) = 2830; + GVAR(gurney_k) = 3/5; }; class ACE_G_40mm_HE: ACE_G_40mm_HEDP { + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; + GVAR(metal) = 200; + GVAR(charge) = 32; + GVAR(gurney_c) = 2700; + GVAR(gurney_k) = 3/5; }; class ACE_G_40mm_Practice: ACE_G_40mm_HE { - ACE_FRAG_SKIP = 1; + GVAR(skip) = 1; }; class ACE_G40mm_HE_VOG25P: G_40mm_HE { - ACE_FRAG_SKIP = 0; - ACE_FRAG_FORCE = 1; + GVAR(skip) = 0; + GVAR(force) = 1; }; // curator ammo entries @@ -117,14 +127,14 @@ class CfgAmmo { //class R_SMAW_HEDP; //class R_MEEWS_HEDP : R_SMAW_HEDP { - // ACE_FRAG_FORCE = 1; - // ACE_FRAG_MULTIPLIER = 1.2; + // GVAR(force) = 1; + // GVAR(multiplier) = 1.2; //}; //class MissileBase; //class M_Hellfire_AT: MissileBase { - // ACE_FRAG_FORCE = 1; - // ACE_FRAG_MULTIPLIER = 1.75; + // GVAR(force) = 1; + // GVAR(multiplier) = 1.75; //}; /* diff --git a/addons/frag/functions/fnc_trackFragRound.sqf b/addons/frag/functions/fnc_trackFragRound.sqf index 586bbc0166..4358448188 100644 --- a/addons/frag/functions/fnc_trackFragRound.sqf +++ b/addons/frag/functions/fnc_trackFragRound.sqf @@ -15,11 +15,11 @@ if (!alive _round) then { [_this select 1] call cba_fnc_removePerFrameHandler; if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then { GVAR(trackedObjects) = GVAR(trackedObjects) - [_round]; - _skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP"); + _skip = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)); if(_skip == 0) then { _explosive = getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"); _indirectRange = getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"); - _force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE"); + _force = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force)); _fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange)); if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then { [QGVAR(frag_eh), _params] call ace_common_fnc_serverEvent; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index 33392f41ee..23eb4cb759 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -1,6 +1,7 @@ class CfgMagazines { class HandGrenade; class ACE_HandFlare_Base: HandGrenade { + scope = 1; value = 2; nameSoundWeapon = "smokeshell"; nameSound = "smokeshell"; @@ -8,6 +9,8 @@ class CfgMagazines { initSpeed = 22; }; class ACE_HandFlare_White: ACE_HandFlare_Base { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; ammo = "ACE_F_Hand_White"; displayname = "$STR_ACE_Grenades_M127A1_White_Name"; descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; @@ -16,6 +19,8 @@ class CfgMagazines { picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; }; class ACE_HandFlare_Red: ACE_HandFlare_Base { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; ammo = "ACE_F_Hand_Red"; displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; @@ -24,6 +29,8 @@ class CfgMagazines { picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; }; class ACE_HandFlare_Green: ACE_HandFlare_Base { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; ammo = "ACE_F_Hand_Green"; displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; @@ -32,6 +39,8 @@ class CfgMagazines { picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; }; class ACE_HandFlare_Yellow: ACE_HandFlare_Base { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; ammo = "ACE_F_Hand_Yellow"; displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; @@ -40,20 +49,24 @@ class CfgMagazines { picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; }; class ACE_M84: HandGrenade { + author = "$STR_ACE_Common_ACETeam"; ammo = "ACE_G_M84"; displayname = "$STR_ACE_Grenades_M84_Name"; descriptionshort = "$STR_ACE_Grenades_M84_Description"; displayNameShort = "M84"; + mass = 4; model = PATHTOF(models\ACE_m84.p3d); picture = PATHTOF(UI\ACE_m84_x_ca.paa); }; class 3Rnd_UGL_FlareGreen_F; class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { + author = "$STR_ACE_Common_ACETeam"; ammo = "F_40mm_Green"; initSpeed = 120; }; class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { + author = "$STR_ACE_Common_ACETeam"; ammo = "F_40mm_Red"; initSpeed = 120; }; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 75e61dab56..67fb2ded9c 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -80,7 +80,7 @@ _affected = _grenade nearEntities ["CAManBase", 20]; //Add ace_medical pain effect: - if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0}) then { + if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then { [ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel); }; diff --git a/addons/hearing/CfgEventHandlers.hpp b/addons/hearing/CfgEventHandlers.hpp index 94b1ab0703..ce968ed2ca 100644 --- a/addons/hearing/CfgEventHandlers.hpp +++ b/addons/hearing/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit) ); @@ -20,9 +19,9 @@ class Extended_Init_EventHandlers { }; class Extended_FiredNear_EventHandlers { - class CAManBase { + class AllVehicles { class GVAR(FiredNear) { - clientFiredNear = QUOTE( if (GVAR(enableCombatDeafness) && {_this select 0 == ACE_player}) then {_this call FUNC(firedNear)}; ); + clientFiredNear = QUOTE(_this call FUNC(firedNear);); }; }; }; diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index adb7827ce7..7b584f8397 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -1,7 +1,14 @@ #include "script_component.hpp" +if (!hasInterface) exitWith {}; + GVAR(currentDeafness) = 0; GVAR(newStrength) = 0; +GVAR(playerVehAttenuation) = 1; // Spawn volume updating process [FUNC(updateVolume), 0.1, [] ] call CBA_fnc_addPerFrameHandler; + +//Update veh attunation when player veh changes +["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); +["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf index 0785a32aff..16b9f35f80 100644 --- a/addons/hearing/XEH_preInit.sqf +++ b/addons/hearing/XEH_preInit.sqf @@ -10,6 +10,7 @@ PREP(hasEarPlugsIn); PREP(moduleHearing); PREP(putInEarPlugs); PREP(removeEarPlugs); +PREP(updatePlayerVehAttenuation); PREP(updateVolume); ADDON = true; diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 7e9472e72a..6a603c3c3a 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -21,18 +21,19 @@ */ #include "script_component.hpp" -private ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_silencer", "_audibleFireCoef", "_loudness", "_strength", "_audibleFire", "_audibleFireTime", "_audibleFireTimeCoef"]; +private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation"]; -_unit = _this select 0; -_firer = _this select 1; -_distance = (_this select 2) max 1; -_weapon = _this select 3; -_muzzle = _this select 4; -_mode = _this select 5; -_ammo = _this select 6; +PARAMS_7(_object,_firer,_distance,_weapon,_muzzle,_mode,_ammo); -if (toLower _weapon in ["throw", "put"]) exitWith {}; -if (_unit != vehicle _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {}; +//Only run if combatDeafness enabled: +if (!GVAR(enableCombatDeafness)) exitWith {}; +//Only run if firedNear object is player or player's vehicle: +if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {}; +if (_weapon in ["Throw", "Put"]) exitWith {}; + +_vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; + +if (_distance < 1) then {_distance = 1;}; _silencer = switch (_weapon) do { case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0}; @@ -42,18 +43,15 @@ _silencer = switch (_weapon) do { }; _audibleFireCoef = 1; -//_audibleFireTimeCoef = 1; if (_silencer != "") then { _audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire"); - //_audibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFireTime"); }; _audibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire"); -//_audibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFireTime"); _loudness = _audibleFireCoef * _audibleFire / 64; -_strength = _loudness - (_loudness/50 * _distance); // linear drop off +_strength = _vehAttenuation * (_loudness - (_loudness/50 * _distance)); // linear drop off if (_strength < 0.01) exitWith {}; -[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute); +[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf b/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf new file mode 100644 index 0000000000..a7285d5e2b --- /dev/null +++ b/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf @@ -0,0 +1,57 @@ +/* + * Author: PabstMirror + * Gets the sound attenuation of a player to the outside. + * + * Arguments: + * None + * + * Return Value: + * Ammount that unit can hear outside + * + * Example: + * [] call ace_hearing_fnc_updatePlayerVehAttenuation + * + * Public: No + */ +#include "script_component.hpp" + +_vehicle = vehicle ACE_player; + +if (isNull _vehicle) exitWith {}; + +_newAttenuation = 1; +if (ACE_player != _vehicle) then { + _effectType = ""; + _turretPath = [ACE_player] call EFUNC(common,getTurretIndex); + _effectType = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "attenuationEffectType"); + + if (!(_turretPath isEqualTo [])) then { + _turretConfig = [(configFile >> "CfgVehicles" >> (typeOf _vehicle)), _turretPath] call EFUNC(common,getTurretConfigPath); + + if ((getNumber (_turretConfig >> "disableSoundAttenuation")) == 1) then { + _effectType = ""; + } else { + if (isText (_turretConfig >> "soundAttenuationTurret")) then { + _effectType = getText (_turretConfig >> "soundAttenuationTurret"); + }; + }; + }; + + _newAttenuation = switch (true) do { + case (_effectType == ""): {1}; + case (_effectType == "CarAttenuation"): {0.5}; + case (_effectType == "RHS_CarAttenuation"): {0.5}; + case (_effectType == "OpenCarAttenuation"): {1}; + case (_effectType == "TankAttenuation"): {0.1}; + case (_effectType == "HeliAttenuation"): {0.3}; + case (_effectType == "OpenHeliAttenuation"): {0.9}; + case (_effectType == "SemiOpenHeliAttenuation"): {0.6}; + case (_effectType == "HeliAttenuationGunner"): {0.85}; + case (_effectType == "HeliAttenuationRamp"): {0.85}; + default {1}; + }; +}; + +TRACE_2("New vehicle attenuation",_vehicle,_newAttenuation); + +GVAR(playerVehAttenuation) = _newAttenuation; diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index ea4a971563..faabf773f4 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -3,6 +3,17 @@ if (!hasInterface) exitWith {}; +GVAR(ParsedTextCached) = []; + +//Setup text/shadow color matrix +[] call FUNC(setupTextColors); +["SettingChanged", { + PARAMS_2(_name,_value); + if ((_name == QGVAR(colorTextMax)) || {_name == QGVAR(colorTextMin)} || {_name == QGVAR(colorShadowMax)} || {_name == QGVAR(colorShadowMin)}) then { + [] call FUNC(setupTextColors); + }; +}] call EFUNC(common,addEventhandler); + // Install the render EH on the main display addMissionEventHandler ["Draw3D", DFUNC(render)]; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 747da7083e..7e86646b79 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(compileMenu); PREP(compileMenuSelfAction); PREP(collectActiveActionTree); PREP(createAction); +PREP(ctrlSetParsedTextCached); PREP(findActionNode); PREP(handlePlayerChanged); PREP(isSubPath); @@ -21,6 +22,7 @@ PREP(renderBaseMenu); PREP(renderIcon); PREP(renderMenu); PREP(renderSelector); +PREP(setupTextColors); PREP(splitPath); GVAR(keyDown) = false; diff --git a/addons/interact_menu/config.cpp b/addons/interact_menu/config.cpp index eeff688a1a..c79c9cd6d1 100644 --- a/addons/interact_menu/config.cpp +++ b/addons/interact_menu/config.cpp @@ -37,6 +37,30 @@ class ACE_Settings { isClientSettable = 1; displayName = "$STR_ACE_Interact_Menu_UseListMenu"; }; + class GVAR(colorTextMax) { + value[] = {1, 1, 1, 1}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorTextMax"; + }; + class GVAR(colorTextMin) { + value[] = {1, 1, 1, 0.25}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorTextMin"; + }; + class GVAR(colorShadowMax) { + value[] = {0, 0, 0, 1}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorShadowMax"; + }; + class GVAR(colorShadowMin) { + value[] = {0, 0, 0, 0.25}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = "$STR_ACE_Interact_Menu_ColorShadowMin"; + }; }; class ACE_Extensions { diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 7983c493e1..bd2023a90d 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -53,7 +53,9 @@ _recurseFnc = { if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition - _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; + if ((configName _entryCfg) != "ACE_MainActions") then { + _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; + }; _insertChildren = compile (getText (_entryCfg >> "insertChildren")); _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); diff --git a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf new file mode 100644 index 0000000000..c68f233b9b --- /dev/null +++ b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf @@ -0,0 +1,13 @@ +// by commy2 +#include "script_component.hpp" + +private ["_ctrl", "_index", "_text"]; + +_ctrl = _this select 0; +_index = _this select 1; +_text = _this select 2; + +if (_text != Str(ARR_SELECT(GVAR(ParsedTextCached),_index,""))) then { + GVAR(ParsedTextCached) set [_index, _text]; + _ctrl ctrlSetStructuredText parseText _text; +}; diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 9a20962a8f..a5214ddcbe 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -41,9 +41,21 @@ if((count _this) > 2) then { }; }; -// For non-self actions, exit if the action is too far away +// For non-self actions, exit if the action is too far away or ocluded if (GVAR(openedMenuType) == 0 && vehicle ACE_player == ACE_player && - {(ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false}; + { + private ["_headPos","_actualDistance"]; + _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); + _actualDistance = _headPos distance _pos; + + if (_actualDistance > _distance) exitWith {true}; + + if (_distance > 1.0) exitWith { + // If distance to action is greater than 1.0 m, check LOS + _line = [_headPos call EFUNC(common,positionToASL), _pos call EFUNC(common,positionToASL), _object, ACE_player]; + lineIntersects _line + }; + }) exitWith {false}; // Exit if the action is behind you _sPos = if (count _pos != 2) then { diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 3da1777bed..443328fbc9 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -4,12 +4,11 @@ * * Argument: * 0: Text - * 1: Color + * 1: Icon * 2: 2d position - * 3: ? - * 4: ? - * 5: ? - * 6: Icon + * 3: Color + * 4: Shadow Color + * 5: Icon Color * * Return value: * None @@ -18,11 +17,8 @@ */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) -private ["_color", "_sPos", "_ctrl", "_icon"]; -_text = _this select 0; -_color = _this select 1; -_sPos = _this select 2; -_icon = _this select 6; +private ["_ctrl"]; +PARAMS_6(_text,_icon,_sPos,_textColor,_shadowColor,_iconColor); //systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; @@ -31,22 +27,23 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); }; _ctrl = GVAR(iconCtrls) select GVAR(iconCount); -GVAR(iconCount) = GVAR(iconCount) + 1; if(_icon == "") then { _icon = DEFAULT_ICON; }; _text = if (GVAR(UseListMenu)) then { - format ["%4", _icon, _color, _color, _text] + format ["%5", _icon, _iconColor, _textColor, _shadowColor, _text] } else { - format ["
%4", _icon, _color, _color, "ace_breakLine" callExtension _text]; + format ["
%5", _icon, _iconColor, _textColor, _shadowColor, "ace_breakLine" callExtension _text]; }; -_ctrl ctrlSetStructuredText (parseText _text); -_text = if (GVAR(UseListMenu)) then { - _ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]; +//_ctrl ctrlSetStructuredText parseText _text; +[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached); +GVAR(iconCount) = GVAR(iconCount) + 1; + +if (GVAR(UseListMenu)) then { + _ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]; } else { - _ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]; + _ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]; }; -//_ctrl ctrlSetBackgroundColor [0, 1, 0, 0.1]; _ctrl ctrlCommit 0; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index b46740921e..e80e9d41ab 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -45,19 +45,17 @@ _menuInSelectedPath = true; // Render icon // ARGB Color (First Hex Pair is transparancy) -_color = "#FFFFFFFF"; +_textColor = GVAR(colorSelected); +_shadowColor = GVAR(colorSelectedShadow); if(!_menuInSelectedPath) then { - if (_menuDepth > 0) then { - _color = format ["#%1FFFFFF", [255 * ((((count _path) - 1)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; - } else { - _color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)]; - }; + _textColor = (GVAR(colorNotSelectedMatrix) select (count _path)) select _menuDepth; + _shadowColor = (GVAR(colorShadowNotSelectedMatrix) select (count _path)) select _menuDepth; }; //END_COUNTER(constructing_colors); //BEGIN_COUNTER(fnc_renderIcons); -[_actionData select 1, _color, _sPos, 1, 1, 0, _actionData select 2, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); +[_actionData select 1, _actionData select 2, _sPos, _textColor, _shadowColor, "#FFFFFFFF"] call FUNC(renderIcon); //END_COUNTER(fnc_renderIcons); diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 5afcf63cc6..7d5a3359f7 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -22,14 +22,14 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { private "_ctrl"; _ctrl = GVAR(iconCtrls) select GVAR(iconCount); -GVAR(iconCount) = GVAR(iconCount) + 1; if (GVAR(UseListMenu)) then { - _ctrl ctrlSetStructuredText (parseText format ["", _icon]); + [_ctrl, GVAR(iconCount), format ["", _icon]] call FUNC(ctrlSetParsedTextCached); _ctrl ctrlSetPosition [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW]; } else { - _ctrl ctrlSetStructuredText (parseText format ["", _icon]); + [_ctrl, GVAR(iconCount), format ["", _icon]] call FUNC(ctrlSetParsedTextCached); _ctrl ctrlSetPosition [(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW]; }; //_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1]; +GVAR(iconCount) = GVAR(iconCount) + 1; _ctrl ctrlCommit 0; diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf new file mode 100644 index 0000000000..5df9c589da --- /dev/null +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -0,0 +1,52 @@ +/* + * Author: PabstMirror + * Builds color strings needed for displaying interaction text + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private ["_mixColor", "_rowT", "_rowS", "_menuDepth", "_pathCount", "_menuInSelectedPath", "_color", "_path"]; + +//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text +_mixColor = { + PARAMS_3(_color1,_color2,_ratio); + private ["_return", "_mix", "_index"]; + _return = ""; + for "_index" from 0 to 3 do { + _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; + if (_index != 3) then { + _return = _return + ([255 * _mix] call EFUNC(common,toHex)); + } else { + _return = "#" + ([255 * _mix] call EFUNC(common,toHex)) + _return; + }; + }; + _return +}; + +GVAR(colorSelected) = [GVAR(colorTextMin), GVAR(colorTextMax), 1] call _mixColor; +GVAR(colorSelectedShadow) = [GVAR(colorShadowMin), GVAR(colorShadowMax), 1] call _mixColor; +GVAR(colorNotSelectedMatrix) = []; +GVAR(colorShadowNotSelectedMatrix) = []; + +for "_pathCount" from 0 to 15 do { + _rowT = []; + _rowS = []; + for "_menuDepth" from 0 to 15 do { + if (_menuDepth > 0) then { + _rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor); + _rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor); + } else { + _rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), 0] call _mixColor); + _rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), 0] call _mixColor); + }; + }; + GVAR(colorNotSelectedMatrix) pushBack _rowT; + GVAR(colorShadowNotSelectedMatrix) pushBack _rowS; +}; diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 0b37f40f5e..1335432f28 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -17,6 +17,7 @@ Mostrar siempre el cursor para la interacción Toujours afficher le curseur pour les interactions Mostra sempre il cursore per le interazioni + Zawsze wyświetlaj kursor dla interakcji
Display interaction menus as lists @@ -71,5 +72,21 @@ Járműves cselekvések Interazioni con veicoli + + Interaction - Text Max + Interakcja - Tekst max + + + Interaction - Text Min + Interakcja - Tekst min + + + Interaction - Shadow Max + Interakcja - Cień max + + + Interaction - Shadow Min + Interakcja - Cień min + diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index bd36f42703..0408192919 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -27,7 +27,7 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { displayName = "$STR_ACE_Interaction_MainAction"; - distance = 5; + distance = 4; condition = QUOTE(true); statement = ""; icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; @@ -35,7 +35,6 @@ class CfgVehicles { class ACE_TeamManagement { displayName = "$STR_ACE_Interaction_TeamManagement"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); statement = ""; showDisabled = 0; @@ -45,7 +44,6 @@ class CfgVehicles { class ACE_JoinTeamRed { displayName = "$STR_ACE_Interaction_JoinTeamRed"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); showDisabled = 1; @@ -55,7 +53,6 @@ class CfgVehicles { }; class ACE_JoinTeamGreen { displayName = "$STR_ACE_Interaction_JoinTeamGreen"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); showDisabled = 1; @@ -65,7 +62,6 @@ class CfgVehicles { }; class ACE_JoinTeamBlue { displayName = "$STR_ACE_Interaction_JoinTeamBlue"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); showDisabled = 1; @@ -75,7 +71,6 @@ class CfgVehicles { }; class ACE_JoinTeamYellow { displayName = "$STR_ACE_Interaction_JoinTeamYellow"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); showDisabled = 1; @@ -86,7 +81,6 @@ class CfgVehicles { class ACE_LeaveTeam { displayName = "$STR_ACE_Interaction_LeaveTeam"; - distance = 5; condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'}); statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); showDisabled = 1; @@ -98,7 +92,6 @@ class CfgVehicles { class ACE_JoinGroup { displayName = "$STR_ACE_Interaction_JoinGroup"; - distance = 5; condition = QUOTE(side group _player == side group _target && {group _player != group _target}); statement = QUOTE([_player] joinSilent group _target;); showDisabled = 0; @@ -109,7 +102,6 @@ class CfgVehicles { class ACE_GetDown { displayName = "$STR_ACE_Interaction_GetDown"; - distance = 5; condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); statement = QUOTE([_target] call DFUNC(getDown)); showDisabled = 0; @@ -117,7 +109,6 @@ class CfgVehicles { }; class ACE_SendAway { displayName = "$STR_ACE_Interaction_SendAway"; - distance = 5; condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); statement = QUOTE([_target] call DFUNC(sendAway)); showDisabled = 0; @@ -125,7 +116,6 @@ class CfgVehicles { }; class ACE_Pardon { displayName = "$STR_ACE_Interaction_Pardon"; - distance = 5; condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); showDisabled = 0; diff --git a/addons/interaction/functions/fnc_addPassengerActions.sqf b/addons/interaction/functions/fnc_addPassengerActions.sqf index 9e577ed7bb..82e3b3b4fb 100644 --- a/addons/interaction/functions/fnc_addPassengerActions.sqf +++ b/addons/interaction/functions/fnc_addPassengerActions.sqf @@ -24,6 +24,10 @@ _actionTrees = missionNamespace getVariable [_varName, []]; _actions = []; // Mount unit MainActions menu -_actions pushBack [(_actionTrees select 0) select 0, (_actionTrees select 0) select 1, _unit]; + +{ + EXPLODE_2_PVT(_x,_actionData,_children); + _actions pushBack [_actionData, _children, _unit]; +} forEach ((_actionTrees select 0) select 1); _actions diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 74f7c49746..8fa96c036a 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -9,7 +9,9 @@ private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"]; private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"]; private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"]; -private["_runTime", "_soundTime", "_targetArray", "_zamerny"]; +private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"]; + +_currentShooter = (vehicle ACE_player); #define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5 #define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 @@ -128,7 +130,7 @@ FUNC(disableFire) = { if(_firedEH < 0 && difficulty > 0) then { _firedEH = [ACE_player, "DefaultAction", {true}, { - _canFire = ACE_player getVariable["ace_missileguidance_target", nil]; + _canFire = _this getVariable["ace_missileguidance_target", nil]; if(!isNil "_canFire") exitWith { false }; true }] call EFUNC(common,addActionEventHandler); @@ -155,7 +157,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false; - ACE_player setVariable ["ace_missileguidance_target",nil, false]; + _currentShooter setVariable ["ace_missileguidance_target",nil, false]; // Disallow fire _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); @@ -212,7 +214,7 @@ if (isNull _newTarget) then { {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; - ACE_player setVariable["ace_missileguidance_target", _currentTarget, false]; + _currentShooter setVariable["ace_missileguidance_target", _currentTarget, false]; // Allow fire _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); @@ -227,7 +229,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingConstrains ctrlShow true; __JavelinIGUITargetingLines ctrlShow false; - ACE_player setVariable["ace_missileguidance_target", nil, false]; + _currentShooter setVariable["ace_missileguidance_target", nil, false]; _boundsInput = if (_currentTarget isKindOf "CAManBase") then { [_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; @@ -270,7 +272,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false; - ACE_player setVariable ["ace_missileguidance_target",nil, false]; + _currentShooter setVariable ["ace_missileguidance_target",nil, false]; // Disallow fire _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); @@ -287,4 +289,4 @@ _args set[3, _lockTime]; _args set[4, _soundTime]; _args set[6, _fireDisabledEH]; -uiNamespace setVariable[QGVAR(arguments), _args ]; \ No newline at end of file +uiNamespace setVariable[QGVAR(arguments), _args ]; diff --git a/addons/javelin/functions/fnc_onOpticLoad.sqf b/addons/javelin/functions/fnc_onOpticLoad.sqf index a2b2692859..8e26806162 100644 --- a/addons/javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/javelin/functions/fnc_onOpticLoad.sqf @@ -33,7 +33,8 @@ uiNameSpace setVariable [QGVAR(arguments), _pfh_handle = uiNamespace getVariable ["ACE_RscOptics_javelin_PFH", nil]; -if(isNil "_pfh_handle") then { - _pfh_handle = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler; - uiNamespace setVariable["ACE_RscOptics_javelin_PFH", _pfh_handle]; -}; \ No newline at end of file +if(!isNil "_pfh_handle") then { + [] call FUNC(onOpticUnload); // Unload optic if it was already loaded +}; +_pfh_handle = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler; +uiNamespace setVariable["ACE_RscOptics_javelin_PFH", _pfh_handle]; diff --git a/addons/kestrel4500/functions/fnc_collectData.sqf b/addons/kestrel4500/functions/fnc_collectData.sqf index bbad8619bc..a812ad0f7c 100644 --- a/addons/kestrel4500/functions/fnc_collectData.sqf +++ b/addons/kestrel4500/functions/fnc_collectData.sqf @@ -14,7 +14,7 @@ */ #include "script_component.hpp" -private ["_playerDir", "_windSpeed", "_windDir", "_crosswind", "_headwind", "_humidity", "_temperature", "_humidity", "_barometricPressure", "_altitude"]; +private ["_playerDir", "_windSpeed", "_crosswind", "_headwind", "_humidity", "_temperature", "_humidity", "_barometricPressure", "_altitude"]; if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then { _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2); diff --git a/addons/kestrel4500/functions/fnc_displayKestrel.sqf b/addons/kestrel4500/functions/fnc_displayKestrel.sqf index 2c1241bb6c..8eb2cea0ad 100644 --- a/addons/kestrel4500/functions/fnc_displayKestrel.sqf +++ b/addons/kestrel4500/functions/fnc_displayKestrel.sqf @@ -42,9 +42,7 @@ if (GVAR(Kestrel4500) && dialog) then { GVAR(Overlay) = true; -[{ - private ["_outputData", "_updateTimer"]; - +[{ // abort condition if (!GVAR(Overlay) || {!(("ACE_Kestrel4500" in (uniformItems ACE_player)) || ("ACE_Kestrel4500" in (vestItems ACE_player)))}) exitWith { GVAR(Overlay) = false; @@ -55,6 +53,7 @@ GVAR(Overlay) = true; if (diag_tickTime > GVAR(updateTimer)) then { GVAR(updateTimer) = diag_tickTime + 1; + private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); 3 cutRsc ["RscKestrel4500", "PLAIN", 1, false]; diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 3f5e77b748..6b139fe72e 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -14,7 +14,7 @@ */ #include "script_component.hpp" -private ["_playerDir", "_textTop", "_textCenterBig", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_temperature", "_humidity", "_windSpeed", "_windDir", "_newWindSpeed", "_windSource", "_height"]; +private ["_playerDir", "_textTop", "_textCenterBig", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_temperature", "_humidity", "_windSpeed", "_windDir"]; [] call FUNC(collectData); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf index e677cccdce..c4ddb2d93d 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -53,4 +53,4 @@ _structuredOutputText = _structuredOutputText + format ["" + (localize "STR_ACE_MagazineRepack_RepackedMagazinesCount") + ""), _fullMags, _partialMags]; -[parseText _structuredOutputText] call EFUNC(common,displayTextStructured); +[parseText _structuredOutputText, 2] call EFUNC(common,displayTextStructured); diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index 3c84a9109e..9ea10924ac 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -1,4 +1,5 @@  + @@ -66,7 +67,7 @@ %1 volle(s) Magazin(e) und %2 übrig gebliebene Patrone(n) %1 cargador(es) completo(s) y %2 bala(s) extra(s) %1 chargeur(s) plein(s) et %2 cartouche(s) en rab - Pełnych magazynków: %1.<br /> Dodatkowych naboi: %2. + Pełnych magazynków: %1.<br/>Dodatkowych naboi: %2. %1 plný zásobník(y) a %2 munice navíc %1 caricatore/i pieno e %2 munizioni extra %1 carregador(es) cheio(s) e %2 disparo(s) a mais @@ -102,9 +103,9 @@ %1 Total y %2 Parcial %1 полных и %2 неполных %1 plný a %2 částečně - Pełnych: %1.<br />Częściowo pełnych: %2. + Pełnych: %1.<br/>Częściowo pełnych: %2. %1 teljes és %2 részleges %1 pieno e %2 parziale - \ No newline at end of file + diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index fce9ec526a..d4b6739918 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -1,6 +1,11 @@ #include "\x\cba\addons\main\script_macros_common.hpp" #include "\x\cba\addons\xeh\script_xeh.hpp" +//Faster Array Unwraping (skips the IS_ARRAY check normaly found in EXPLODE_1_SYS) +#undef EXPLODE_2_SYS +#define EXPLODE_1_SYS_FAST(ARRAY,A) A =(ARRAY) select 0 +#define EXPLODE_2_SYS(ARRAY,A,B) EXPLODE_1_SYS_FAST(ARRAY,A); B = (ARRAY) select 1 + // Default versioning level #define DEFAULT_VERSIONING_LEVEL 2 diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index a5168bd8a1..441dc8103a 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -72,7 +72,7 @@ _vehicle = vehicle _unit; // Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination) if (_vehicle != _unit) then { // Player is in a vehicle - if (isTurnedOut _unit && {_vehicle isKindOf "Tank" || {_vehicle isKindOf "Wheeled_APC"}}) then { + if (isTurnedOut _unit && { _vehicle isKindOf "Tank" || { ( _vehicle isKindOf "Helicopter" || _vehicle isKindOf "Plane" ) && { (driver _vehicle) == _unit || { (gunner _vehicle) == _unit } } } || {_vehicle isKindOf "Wheeled_APC"}}) then { _isEnclosed = true; }; }; diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index ed5670f814..a7b76fef44 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -3,6 +3,7 @@ class ACE_Head { displayName = "$STR_ACE_Interaction_Head"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,0,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); @@ -70,11 +71,18 @@ class ACE_Head { statement = QUOTE([ARR_4(_player, _target, 'head', 'CheckResponse')] call DFUNC(treatment)); EXCEPTIONS }; + class Diagnose: CheckPulse { + displayName = "Diagnose"; + condition = QUOTE([ARR_4(_player, _target, 'head', 'Diagnose')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'head', 'Diagnose')] call DFUNC(treatment)); + EXCEPTIONS + }; }; class ACE_Torso { displayName = "$STR_ACE_Interaction_Torso"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,1,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); @@ -175,6 +183,7 @@ class ACE_ArmLeft { displayName = "$STR_ACE_Interaction_ArmLeft"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,2,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); @@ -332,6 +341,7 @@ class ACE_ArmRight { displayName = "$STR_ACE_Interaction_ArmRight"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,3,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); @@ -486,6 +496,7 @@ class ACE_LegLeft { displayName = "$STR_ACE_Interaction_LegLeft"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,4,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); @@ -628,6 +639,7 @@ class ACE_LegRight { displayName = "$STR_ACE_Interaction_LegRight"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,5,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index 9c79503f3d..add07c8262 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -12,6 +12,7 @@ class Medical { icon = PATHTOF(UI\icons\medical_cross.paa); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,0,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; runOnHover = 1; @@ -80,6 +81,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,1,_this select 3)] call FUNC(modifyMedicalAction)); showDisabled = 1; priority = 2; hotkey = ""; @@ -148,6 +150,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,2,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); @@ -249,6 +252,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,3,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); @@ -346,6 +350,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,4,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); @@ -432,6 +437,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation)); + modifierFunction = QUOTE([ARR_4(_target,_player,5,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 5b5e0b6abd..03b9def612 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -71,14 +71,14 @@ class ACE_Medical_Actions { itemConsumed = 1; litter[] = {}; }; - class CheckPulse: Bandage { - displayName = ""; - displayNameProgress = ""; + class Diagnose: Bandage { + displayName = "Diagnose"; + displayNameProgress = "Diagnosing..."; treatmentLocations[] = {"All"}; requiredMedic = 0; - treatmentTime = 2; + treatmentTime = 1; items[] = {}; - callbackSuccess = QUOTE(DFUNC(actionCheckPulse)); + callbackSuccess = QUOTE(DFUNC(actionDiagnose)); callbackFailure = ""; callbackProgress = ""; animationPatient = ""; @@ -86,12 +86,6 @@ class ACE_Medical_Actions { itemConsumed = 0; litter[] = {}; }; - class CheckBloodPressure: CheckPulse { - callbackSuccess = QUOTE(DFUNC(actionCheckBloodPressure)); - }; - class CheckResponse: CheckPulse { - callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); - }; }; class Advanced { diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 107952c54b..b6deca4033 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -7,6 +7,7 @@ PREP(actionCheckBloodPressureLocal); PREP(actionCheckPulse); PREP(actionCheckPulseLocal); PREP(actionCheckResponse); +PREP(actionDiagnose); PREP(actionPlaceInBodyBag); PREP(actionRemoveTourniquet); PREP(actionLoadUnit); @@ -55,6 +56,7 @@ PREP(isInMedicalVehicle); PREP(isMedic); PREP(isMedicalVehicle); PREP(itemCheck); +PREP(modifyMedicalAction); PREP(onMedicationUsage); PREP(onWoundUpdateRequest); PREP(onPropagateWound); diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf new file mode 100644 index 0000000000..234cc6d303 --- /dev/null +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -0,0 +1,41 @@ +/* +* Author: Glowbal +* Action for diagnosing in basic medical +* +* Arguments: +* 0: The medic +* 1: The patient +* +* Return Value: +* NONE +* +* Public: No +*/ + +#include "script_component.hpp" + +private ["_caller","_target","_title","_content"]; +_caller = _this select 0; +_target = _this select 1; + +_genericMessages = ["STR_ACE_MEDICAL_diagnoseMessage"]; + +_genericMessages pushBack ([_target] call EFUNC(common,getName)); +if (alive _target) then { + _genericMessages pushback "STR_ACE_MEDICAL_diagnoseAlive"; +} else { + _genericMessages pushback "STR_ACE_MEDICAL_diagnoseDead"; +}; +if (_target getvariable[QGVAR(hasLostBlood), false]) then { + _genericMessages pushback "STR_ACE_MEDICAL_lostBlood"; +} else { + _genericMessages pushback "STR_ACE_MEDICAL_noBloodloss"; +}; + +if (_target getvariable[QGVAR(hasPain), false]) then { + _genericMessages pushback "STR_ACE_MEDICAL_inPain"; +} else { + _genericMessages pushback "STR_ACE_MEDICAL_noPain"; +}; + +["displayTextStructured", [_caller], [_genericMessages, 3.0, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index ecd2218c2b..65c98c4b85 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -14,6 +14,8 @@ #include "script_component.hpp" +// Exit for basic medical +if (GVAR(level) < 2) exitWith {}; private ["_target", "_show", "_selectionN"]; _target = _this select 0; _show = if (count _this > 1) then {_this select 1} else {true}; diff --git a/addons/medical/functions/fnc_modifyMedicalAction.sqf b/addons/medical/functions/fnc_modifyMedicalAction.sqf new file mode 100644 index 0000000000..66398a2590 --- /dev/null +++ b/addons/medical/functions/fnc_modifyMedicalAction.sqf @@ -0,0 +1,40 @@ +/* + * Author: esteldunedain + * Modify the visuals of a medical action point. + * On Basic medical: modify the icon color based on damage on that body part. + * + * Arguments: + * 0: The Patient Unit + * 1: The Diagnosing Unit + * 2: Selection Number + * 3: The action to modify + * + * ReturnValue: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +EXPLODE_4_PVT(_this,_target,_player,_selectionN,_actionData); +if (GVAR(level) < 2) exitwith { + private ["_pointDamage"]; + _pointDamage = _target getHitPointDamage (["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"] select _selectionN); + + if (_pointDamage >= 0.8) exitWith { + _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; + }; + if (_pointDamage > 0) exitWith { + _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossYellow.paa))]; + }; +}; + +private ["_openWounds", "_amountOf"]; +_openWounds = _target getvariable [QGVAR(openWounds), []]; +{ + _amountOf = _x select 3; + if (_amountOf > 0 && {(_selectionN == (_x select 2))}) exitwith { + _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; + }; +}foreach _openWounds; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index e85283c471..9220eb6671 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1,13 +1,15 @@  - + Litter Simulation Detail Detale zużytych medykamentów + Detalle de simulación de basura - + Litter simulation detail level sets the number of litter items which will be locally spawned in the client. Excessive amounts in local areas could cause FPS lag, so this is a client only setting. Opcja ta ustawia liczbę zużytych medykamentów, jakie pojawiają się lokalnie wokół gracza. Ich zbyt duża ilość może spowodować spadki FPS, dlatego jest to ustawienie tylko po stronie klienta. + Detalle simulación de basura establece el número de artículos de basura que se generan a nivel local en el cliente. Las cantidades excesivas en áreas locales podrían causar caída de rendimiento, así que esto es un ajuste de cliente únicamente. Inject Atropine @@ -1320,6 +1322,28 @@ Megnézted %1-t Hai controllato %1 + + Patient %1<br/>is %2.<br/>%3.<br/>%4 + + + alive + + + dead + + + He's lost some blood + + + He hasn't lost blood + + + He is in pain + + + He is not in pain + + Bandaged Bandé @@ -1634,4 +1658,4 @@ Aberration chromatique - + \ No newline at end of file diff --git a/addons/medical/ui/icons/medical_crossRed.paa b/addons/medical/ui/icons/medical_crossRed.paa new file mode 100644 index 0000000000..5a0c8e9f9c Binary files /dev/null and b/addons/medical/ui/icons/medical_crossRed.paa differ diff --git a/addons/medical/ui/icons/medical_crossYellow.paa b/addons/medical/ui/icons/medical_crossYellow.paa new file mode 100644 index 0000000000..74ddefd837 Binary files /dev/null and b/addons/medical/ui/icons/medical_crossYellow.paa differ diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index bff20a4b67..644064d069 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -49,11 +49,11 @@ if (GVAR(currentApplicationPage) == 1) then { } else { //Map Mode: if (GVAR(mapAutoTrackPosition)) then { - _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), GVAR(gpsPositionASL)]; + _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ace_player)]; ctrlMapAnimCommit _theMap; }; _size = 48 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], GVAR(gpsPositionASL), _size, _size, (getDir ace_player), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ace_player), _size, _size, (getDir ace_player), '', 0 ]; if (GVAR(settingShowAllWaypointsOnMap)) then { _size = 32 * _mapSize; diff --git a/addons/microdagr/functions/fnc_openDisplay.sqf b/addons/microdagr/functions/fnc_openDisplay.sqf index ae5f7f47f5..b4cec0fe46 100644 --- a/addons/microdagr/functions/fnc_openDisplay.sqf +++ b/addons/microdagr/functions/fnc_openDisplay.sqf @@ -83,7 +83,6 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M }; [_pfID] call CBA_fnc_removePerFrameHandler; } else { - GVAR(gpsPositionASL) = getPosAsl ace_player; if (GVAR(currentShowMode) == DISPLAY_MODE_HIDDEN) then { //If display is hidden, and we can show, then swithc modes: if ([DISPLAY_MODE_DISPLAY] call FUNC(canShow)) then { diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 2a5f34a12c..26e5ef8638 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -44,7 +44,7 @@ case (APP_MODE_INFODISPLAY): { (_display displayCtrl IDC_MODEDISPLAY_NORTHING) ctrlSetText _northingText; //Elevation: - _numASL = (GVAR(gpsPositionASL) select 2) + GVAR(mapAltitude); + _numASL = ((getPosASL ace_player) select 2) + GVAR(mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; _aboveSeaLevelText = if (_numASL > 0) then {"+" + _aboveSeaLevelText + " MSL"} else {_aboveSeaLevelText + " MSL"}; (_display displayCtrl IDC_MODEDISPLAY_ELEVATIONNUM) ctrlSetText _aboveSeaLevelText; @@ -88,13 +88,13 @@ case (APP_MODE_INFODISPLAY): { }; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [GVAR(gpsPositionASL), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = ((GVAR(gpsPositionASL) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; _numASL = (_targetPosLocationASL select 2) + GVAR(mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; @@ -125,7 +125,7 @@ case (APP_MODE_COMPASS): { (_display displayCtrl IDC_MODECOMPASS_RANGE) ctrlSetText ""; (_display displayCtrl IDC_MODECOMPASS_TARGET) ctrlSetText ""; } else { - _playerPos2d = GVAR(gpsPositionASL) select [0,2]; + _playerPos2d = (getPosASL ace_player) select [0,2]; _targetPosName = ""; _targetPosLocationASL = []; @@ -145,13 +145,13 @@ case (APP_MODE_COMPASS): { _rangeText = "---"; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [GVAR(gpsPositionASL), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = ((GVAR(gpsPositionASL) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; }; @@ -169,7 +169,7 @@ case (APP_MODE_WAYPOINTS): { { EXPLODE_2_PVT(_x,_wpName,_wpPos); _wpListBox lbAdd _wpName; - _2dDistanceKm = ((GVAR(gpsPositionASL) select [0,2]) distance (_wpPos select [0,2])) / 1000; + _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)])]; } forEach _waypoints; diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml index 9311ac2c0b..59a80df0dc 100644 --- a/addons/missileguidance/stringtable.xml +++ b/addons/missileguidance/stringtable.xml @@ -17,6 +17,7 @@ Advanced missile guidance, or AMG, provides multiple enhancements to missile locking and firing. It is also a framework required for missile weapon types. Zaawansowane namierzanie rakiet, lub ZNR, dostarcza wiele poprawek do systemu namierzania rakiet oraz dodaje nowe tryby strzału. Jest to wymagana opcja dla broni rakietowych. + Guía de misiles avanzada, o AMG en sus siglas en inglés, ofrece múltiples mejoras en el fijado y disparo de misiles. Es también un framework requerido para armas de tipo misil. Hydra-70 DAGR Missile diff --git a/addons/mk6mortar/$PBOPREFIX$ b/addons/mk6mortar/$PBOPREFIX$ new file mode 100644 index 0000000000..a21eaf95f0 --- /dev/null +++ b/addons/mk6mortar/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\Addons\mk6mortar \ No newline at end of file diff --git a/addons/mk6mortar/CfgEventHandlers.hpp b/addons/mk6mortar/CfgEventHandlers.hpp new file mode 100644 index 0000000000..34c6ecc22c --- /dev/null +++ b/addons/mk6mortar/CfgEventHandlers.hpp @@ -0,0 +1,17 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + }; +}; +class Extended_FiredBIS_EventHandlers { + class Mortar_01_base_F { + class ADDON { + firedBIS = QUOTE(_this call FUNC(handleFired)); + }; + }; +}; diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp new file mode 100644 index 0000000000..1c90842d5f --- /dev/null +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -0,0 +1,83 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(rangetable) { + displayName = "$STR_ACE_MK6MORTAR_rangetable_action"; + condition = QUOTE(_this call FUNC(rangeTableCanUse)); + statement = QUOTE(_this call FUNC(rangeTableOpen)); + priority = 0; + icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); + exceptions[] = {"notOnMap", "isNotInside"}; + }; + }; + }; + }; + + class LandVehicle; + class StaticWeapon: LandVehicle { + class Turrets { + class MainTurret; + }; + }; + class StaticMortar: StaticWeapon { + class Turrets: Turrets { + class MainTurret: MainTurret { + }; + }; + }; + class Mortar_01_base_F: StaticMortar { + class Turrets: Turrets { + class MainTurret: MainTurret { + turretInfoType = "ACE_Mk6_RscWeaponRangeArtillery"; + }; + }; + class ACE_SelfActions { + class GVAR(toggleMils) { + displayName = "Toggle MILS"; + condition = QUOTE(true); + statement = QUOTE(_this call FUNC(toggleMils)); + exceptions[] = {}; + }; + }; + }; + + class Logic; + class Module_F: Logic { + class ModuleDescription {}; + }; + class GVAR(module): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "MK6 Settings"; + function = QFUNC(moduleInit); + scope = 2; + isGlobal = 0; + icon = QUOTE(PATHTOF(UI\Icon_Module_mk6_ca.paa)); + functionPriority = 0; + class Arguments { + class airResistanceEnabled { + displayName = "Air Resitance"; + description = "For Player Shots, Model Air Restiance and Wind Effects"; + typeName = "BOOL"; + defaultValue = 1; + }; + class allowComputerRangefinder { + displayName = "Allow MK6 Computer"; + description = "Show the Computer and Rangefinder (these NEED to be removed if you enable air resistance)"; + typeName = "BOOL"; + defaultValue = 0; + }; + class allowCompass { + displayName = "Allow MK6 Compass"; + description = "Show the MK6 Digital Compass"; + typeName = "BOOL"; + defaultValue = 1; + }; + }; + class ModuleDescription: ModuleDescription { + description = ""; + }; + }; +}; diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp new file mode 100644 index 0000000000..7d5153e9ad --- /dev/null +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_RangeTable_82mm: ACE_ItemCore { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_MK6MORTAR_rangetable_name"; + descriptionShort = "$STR_ACE_MK6MORTAR_rangetable_description"; + picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); + class ItemInfo: InventoryItem_Base_F { + mass = 0.5; + }; + }; +}; diff --git a/addons/mk6mortar/README.md b/addons/mk6mortar/README.md new file mode 100644 index 0000000000..84c7a6e984 --- /dev/null +++ b/addons/mk6mortar/README.md @@ -0,0 +1,10 @@ +ace_mk6mortar +========== + +Tweaks the mk6 mortar from Arma3 + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/mk6mortar/RscInGameUI.hpp b/addons/mk6mortar/RscInGameUI.hpp new file mode 100644 index 0000000000..102362216a --- /dev/null +++ b/addons/mk6mortar/RscInGameUI.hpp @@ -0,0 +1,44 @@ +class RscInGameUI { + class RscWeaponRangeArtillery { + class CA_IGUI_elements_group: RscControlsGroup {}; + }; + class ACE_Mk6_RscWeaponRangeArtillery: RscWeaponRangeArtillery { + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_Mk6_RscWeaponRangeArtillery',(_this select 0))]; _this call FUNC(turretDisplayLoaded);); + controls[] = {"ACE_MILS_GROUP", "CA_IGUI_elements_group","CA_RangeElements_group"}; + class ACE_MILS_GROUP: CA_IGUI_elements_group { + idc = 80170; + class controls { + class CA_Heading_MILS: RscText { + idc = 80156; + style = 2; + colorText[] = {0.706,0.0745,0.0196,1}; + sizeEx = "0.028*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "015"; + x = "25.0 * (0.01875 * SafezoneH)"; + y = "6.3 * (0.025 * SafezoneH)"; + w = "3.3333 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class CA_Elev_MILS: RscText { + idc = 80175; + style = 1; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "80.5"; + x = "36.8 * (0.01875 * SafezoneH)"; + y = "29.3 * (0.025 * SafezoneH)"; + w = "5.2 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_Elev_Need_MILS: CA_Elev_MILS { + idc = 80176; + y = "30.8 * (0.025 * SafezoneH)"; + }; + }; + }; + }; +}; diff --git a/addons/mk6mortar/RscRangeTable.hpp b/addons/mk6mortar/RscRangeTable.hpp new file mode 100644 index 0000000000..6bf0e51619 --- /dev/null +++ b/addons/mk6mortar/RscRangeTable.hpp @@ -0,0 +1,87 @@ +class ACE_82mm_RangeTable_Dialog { + idd = -1; + movingEnable = 1; + onLoad = "uiNamespace setVariable ['ACE_82mm_RangeTable_Dialog', _this select 0];"; + objects[] = {}; + + class ControlsBackground { + class TableBackground: RscPicture { + idc = -1; + text = QUOTE(PATHTOF(UI\RangeTable_background.paa)); + x = "18 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "16.2634559672906 * (safeZoneH / 40)"; + h = "23 * ((safeZoneH / 1.2) / 25)"; + colorBackground[] = {1,1,1,1}; + }; + class ChargeBackground: RscText { + idc = -1; + x = "14 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "4 * (safeZoneH / 40)"; + h = "5 * ((safeZoneH / 1.2) / 25)"; + colorBackground[] = {0,0,0,1}; + }; + }; + class controls { + class TheTable: RscListNBox { + idc = 20001; + // style = ST_CENTER + ST_MULTI + LB_TEXTURES; + // style = ST_LEFT + ST_MULTI + LB_TEXTURES; + // style = LB_MULTI + ST_LEFT; // Style + x = "18 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "3.76 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "16.2634559672906 * (safeZoneH / 40)"; + h = "20.24 * ((safeZoneH / 1.2) / 25)"; + columns[] = {(10/867),(86/867),(171/867),(238/867),(320/867),(405/867), + (485/867),(546/867),(607/867),(668/867),(729/867),(790/867)}; + rowHeight = 0.015 * safeZoneH; + sizeEx = "0.014 * safeZoneH"; + font = "EtelkaMonospacePro"; + drawSideArrows = 1; + idcLeft = 14124; + idcRight = 412343243; + colorText[] = {0, 0, 0, 1}; + shadow = "0"; + // colorBorder[] = {1,0,0,1}; + // colorBackground[] = {1, 0, 0, 1}; + colorSelectBackground[] = {0, 0, 0, 0.025}; + colorSelectBackground2[] = {0, 0, 0, 0.025}; + colorScrollbar[] = {0.95,0,0.95,1}; + class ListScrollBar: ScrollBar{ + color[] = {0,0,0,0.6}; + }; + }; + class ChargeListBox: RscListbox { + idc = 1501; + style = ST_RIGHT; + x = "14 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "4 * (safeZoneH / 40)"; + h = "5 * ((safeZoneH / 1.2) / 25)"; + onLBSelChanged = QUOTE(_this call FUNC(rangeTablePageChange)); + }; + class CloseBackground: RscText { + idc = -1; + x = "33.7634559672906 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "0.5 * (safeZoneH / 40)"; + h = "0.5 * ((safeZoneH / 1.2) / 25)"; + colorBackground[] = {0,0,0,0.5}; + }; + class CloseActiveText: RscActiveText { + idc = -1; + style = 48; + color[] = {1,1,1,0.7}; + text = "A3\Ui_f\data\GUI\Rsc\RscDisplayArcadeMap\icon_exit_cross_ca.paa"; + x = "33.7634559672906 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; + y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; + w = "0.5 * (safeZoneH / 40)"; + h = "0.5 * ((safeZoneH / 1.2) / 25)"; + colorText[] = {1,1,1,0.7}; + colorActive[] = {1,1,1,1}; + tooltip = "Close"; + onButtonClick = "closeDialog 0"; + }; + }; +}; diff --git a/addons/mk6mortar/UI/Icon_Module_mk6_ca.paa b/addons/mk6mortar/UI/Icon_Module_mk6_ca.paa new file mode 100644 index 0000000000..8abfb4bdd3 Binary files /dev/null and b/addons/mk6mortar/UI/Icon_Module_mk6_ca.paa differ diff --git a/addons/mk6mortar/UI/RangeTable_background.paa b/addons/mk6mortar/UI/RangeTable_background.paa new file mode 100644 index 0000000000..bf4b5ee044 Binary files /dev/null and b/addons/mk6mortar/UI/RangeTable_background.paa differ diff --git a/addons/mk6mortar/UI/icon_rangeTable.paa b/addons/mk6mortar/UI/icon_rangeTable.paa new file mode 100644 index 0000000000..9273b849d7 Binary files /dev/null and b/addons/mk6mortar/UI/icon_rangeTable.paa differ diff --git a/addons/mk6mortar/UI/ui_charges.paa b/addons/mk6mortar/UI/ui_charges.paa new file mode 100644 index 0000000000..7041c654e0 Binary files /dev/null and b/addons/mk6mortar/UI/ui_charges.paa differ diff --git a/addons/mk6mortar/XEH_clientInit.sqf b/addons/mk6mortar/XEH_clientInit.sqf new file mode 100644 index 0000000000..973772c96a --- /dev/null +++ b/addons/mk6mortar/XEH_clientInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler); diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf new file mode 100644 index 0000000000..9af89ccb35 --- /dev/null +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(dev_buildTable); +PREP(dev_formatNumber); +PREP(dev_simulateCalcRangeTableLine); +PREP(dev_simulateFindSolution); +PREP(dev_simulateShot); + +PREP(handleFired); +PREP(handlePlayerVehicleChanged); +PREP(moduleInit); +PREP(rangeTableCanUse); +PREP(rangeTableOpen); +PREP(rangeTablePageChange); +PREP(rangeTablePreCalculatedValues); +PREP(toggleMils); +PREP(turretDisplayLoaded); + +ADDON = true; diff --git a/addons/mk6mortar/config.cpp b/addons/mk6mortar/config.cpp new file mode 100644 index 0000000000..6751cea5fb --- /dev/null +++ b/addons/mk6mortar/config.cpp @@ -0,0 +1,47 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_RangeTable_82mm"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"PabstMirror"}; + authorUrl = "https://github.com/acemod"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" + +class RscText; +class RscListbox; +class RscListNBox; +class RscPicture; +class RscControlsGroup; +class ScrollBar; +class RscActiveText; + +#include "RscInGameUI.hpp" +#include "RscRangeTable.hpp" + +class ACE_Settings { + //These settings effect gameplay difficutly: defaults will leave the mortar the same as vanilla + class GVAR(airResistanceEnabled) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; + class GVAR(allowComputerRangefinder) { + value = 1; + typeName = "BOOL"; + isClientSetable = 0; + }; + class GVAR(allowCompass) { + value = 1; + typeName = "BOOL"; + isClientSetable = 0; + }; +}; diff --git a/addons/mk6mortar/functions/fnc_dev_buildTable.sqf b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf new file mode 100644 index 0000000000..7a60e91e68 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf @@ -0,0 +1,87 @@ +/* + * Author: PabstMirror + * DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) + * + * Arguments: + * 0: Muzzle Velocity + * 1: Air Friction + * + * Return Value: + * + * + * Example: + * [100, -0.0001] spawn ace_mk6mortar_fnc_dev_buildTable; //spawn (scheduled) is slower + * [100, -0.0001] call ace_mk6mortar_fnc_dev_buildTable; //faster, but will lock while processing + * + * Public: No + */ +#include "script_component.hpp" + + +private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"]; + +_muzzleVelocity = _this select 0; +_airFriction = _this select 1; +_stillInRange = true; +_currentRange = 100; +_increasePerRow = 50; +_outputArray = []; + + +//[_rangeToHit, _lineElevation, _lineHeightElevation, _lineHeightTimeDelta, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc] + +while {_stillInRange} do { + _result = [_muzzleVelocity, _currentRange, _airFriction] call FUNC(dev_simulateCalcRangeTableLine); + if (_result isEqualTo []) then { + _stillInRange = false; + } else { + if (_airFriction == 0) then { + _result set [4, 0]; + _result set [5, 0]; + _result set [6, 0]; + _result set [7, 0]; + _result set [8, 0]; + _result set [9, 0]; + _result set [10, 0]; + }; + if ((_result select 1) < 88) then { + _outputArray pushBack [ + ([(_result select 0), "meters", false] call FUNC(dev_formatNumber)), + ([(_result select 1), "mil", true] call FUNC(dev_formatNumber)), + ([(_result select 2), "mil", true] call FUNC(dev_formatNumber)), + ([(_result select 3), "sec", false] call FUNC(dev_formatNumber)), + ([(_result select 4), "sec", false] call FUNC(dev_formatNumber)), + ([(_result select 5), "milPrecise", true] call FUNC(dev_formatNumber)), + ([(_result select 6), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 7), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 8), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 9), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 10), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 11), "metersprecise", false] call FUNC(dev_formatNumber)) + ]; + }; + _currentRange = _currentRange + _increasePerRow; + }; + hintSilent str _currentRange; +}; + +//handle floating point rounding errors +_outputString = format ["case ((abs(_muzzleVelocity - %1) < 0.00001) && {(abs(_airFriction - %2) < 0.00001)}): { +[ +", _muzzleVelocity, _airFriction]; + +{ + if (_forEachIndex < ((count _outputArray) - 1)) then { + _outputString = _outputString + format ["%1, + ", _x]; + } else { + _outputString = _outputString + format ["%1 + ] + };", _x]; + }; +} forEach _outputArray; + +copyToClipboard _outputString; +rangeTableOutput = _outputString; + +hint "done"; \ No newline at end of file diff --git a/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf b/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf new file mode 100644 index 0000000000..f89c3a1b8f --- /dev/null +++ b/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf @@ -0,0 +1,80 @@ +/* +Author: Pabst Mirror + +Description: +Converts numbers into nicely formated strings. + +Parameters: +0: NUMBER - Input number +1: STRING - Output type (see case statement) +2: BOOL - If output type is mil, convert input type from deg->mil + +Returns: +STRING - Formatted number + +Example: +[45, "mil4", true] call ace_mk6mortar_fnc_dev_formatNumber = "0800" + */ +#include "script_component.hpp" + +private ["_theNumber", "_inputType", "_convertToMils", "_decimalPlaces", "_integerPlaces", "_prefix", "_return"]; + +_theNumber = _this select 0; +_inputType = _this select 1; +_convertToMils = _this select 2; + +_decimalPlaces = -1; +_integerPlaces = -1; + +switch (toLower _inputType) do { +case ("meters"): { + _decimalPlaces = 0; + _integerPlaces = 1; + }; +case ("metersprecise"): { + _decimalPlaces = 1; + _integerPlaces = 1; + }; +case ("meters4"): { + _decimalPlaces = 0; + _integerPlaces = 4; + }; +case ("deg3precise"): { + _decimalPlaces = 2; + _integerPlaces = 3; + }; +case ("mil"): { + _decimalPlaces = 0; + _integerPlaces = 1; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; + }; +case ("mil4"): { + _decimalPlaces = 0; + _integerPlaces = 4; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; + }; +case ("milprecise"): { + _decimalPlaces = 1; + _integerPlaces = 1; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; + }; +case ("sec"): { + _decimalPlaces = 1; + _integerPlaces = 1; + }; + default {systemChat format ["badtype %1", _inputType];}; +}; + +//CBA_fnc_formatNumber is silly: [-9.58545, 1, 1, false] call CBA_fnc_formatNumber == "-9.-6" + +_prefix = if (_theNumber < 0) then {"-"} else {""}; + +_return = [abs (_theNumber), _integerPlaces, _decimalPlaces, false] call CBA_fnc_formatNumber; + +(_prefix + _return) diff --git a/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf b/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf new file mode 100644 index 0000000000..d1e0a8dd05 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf @@ -0,0 +1,79 @@ +/* +Author: Pabst Mirror + +Description: +Builds a rangeTable line for a certian range, given muzzle velocity and air friction, returns [] if out of range. + +Parameters: +0: NUMBER - Muzzle Velocity +1: NUMBER - Air Friction +2: NUMBER - Range To Hit + +Returns: +ARRAY - Range Table Line Data (see return line) + +Example: +[300, -0.0001, 3000] call ace_mk6mortar_fnc_simulateCalcRangeTableLine + */ +#include "script_component.hpp" + +#define TIME_STEP (1/50) + +private ["_startTime", "_muzzleVelocity", "_rangeToHit", "_airFriction", "_vacElevation", "_radicand", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts", "_lineElevation", "_lineTimeOfFlight", "_lineHeightElevation", "_lineHeightTimeDelta", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_result"]; + +_startTime = diag_tickTime; + +_muzzleVelocity = _this select 0; +_rangeToHit = _this select 1; +_airFriction = _this select 2; + +//Run Binary search for correct elevation +_solution = [_rangeToHit, 0, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(dev_simulateFindSolution); +if (_solution isEqualTo []) exitWith {[]}; + +//Real Elevation +_lineElevation = _solution select 0; + +//Time Of Flight: +_lineTimeOfFlight = _solution select 1; + +//Height Adjustment for -100m (another binary search) +_solution = [_rangeToHit, -100, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(dev_simulateFindSolution); +if (_solution isEqualTo []) exitWith {[]};//should never be triggered (lower elevation easier to hit) + +_lineHeightElevation = ((_solution select 0) - _lineElevation); +_lineHeightTimeDelta = (_solution select 1) - _lineTimeOfFlight; + +//Compute for 10x and divide to minimize rounding errors + +//Crosswind +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 10, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineCrosswindDeg = (_lastTestResult select 2) / 10; + +//Headwind: +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, -10, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineHeadwindMeters = (_rangeToHit - (_lastTestResult select 0)) / 10; + +//TailWind: +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, 10, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineTailWindMeters = (_rangeToHit - (_lastTestResult select 0)) / 10; + +//Air Temp Dec +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, (15 - 10), 1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineTempDec = (_rangeToHit - (_lastTestResult select 0)) / 10; + +//Air Temp Inc +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, (15 + 10), 1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineTempInc = (_rangeToHit - (_lastTestResult select 0)) / 10; + +//Air Density Dec +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 0.9, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineAirDensDec = (_rangeToHit - (_lastTestResult select 0)) / 10; + +//Air Density Inc +_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1.1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); +_lineAirDensInc = (_rangeToHit - (_lastTestResult select 0)) / 10; + +// systemChat format ["debug: Range %1 - in %2 sec", _rangeToHit, (diag_tickTime - _startTime)]; + +[_rangeToHit, _lineElevation, _lineHeightElevation, _lineHeightTimeDelta, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc] diff --git a/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf new file mode 100644 index 0000000000..a45c415b40 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf @@ -0,0 +1,55 @@ +/* + * Author: PabstMirror + * DEV to find a firing solution for a given range + * + * Arguments: + * 0: Range to Hit (Meters) + * 1: Height To Hit (Meters) + * 2: Muzzle Velocity (M/S) + * 3: Air Friction + * 4: Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) + * + * Return Value: + * ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] + * + * Example: + * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution); + * + * Public: No + */ +#include "script_component.hpp" + +private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"]; + +#define MAX_ATTEMPTS 22 + +_rangeToHit = _this select 0; +_heightToHit = _this select 1; +_muzzleVelocity = _this select 2; +_airFriction = _this select 3; +_timeStep = _this select 4; + +_maxElev = 90; +_minElev = 45; //todo - Low Angle Howitzers??? + +_error = 10000; +_solutionElevation = -1; +_lastTestResult = []; +_numberOfAttempts = 0; + +//(binary search) +while {(_numberOfAttempts < MAX_ATTEMPTS) && {(abs _error) > 0.2}} do { + _numberOfAttempts = _numberOfAttempts + 1; + _solutionElevation = (_maxElev + _minElev) / 2; + _lastTestResult = [_solutionElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 0, _heightToHit, _timeStep] call FUNC(dev_simulateShot); + _error = _rangeToHit - (_lastTestResult select 0); + if (_error > 0) then { + _maxElev = _solutionElevation; //test range was short + } else { + _minElev = _solutionElevation; //test range was long + }; +}; +if (_numberOfAttempts >= MAX_ATTEMPTS) exitWith {[]}; + +//return the elevation and time required +[_solutionElevation, (_lastTestResult select 1)] diff --git a/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf b/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf new file mode 100644 index 0000000000..0e53807a6b --- /dev/null +++ b/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf @@ -0,0 +1,73 @@ +/* + * Author: PabstMirror + * DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) + * + * Arguments: + * 0: Shot Angle (degrees) + * 1: Muzzle Velocity (m/s) + * 2: Air Friction + * 3: Tempeture (degres celcius) + * 4: Relative Air Denisty + * 5: Tail Wind (m/s) + * 6: Cross Wind (m/s) + * 7: Height Of Target (M) + * 8: Time Step (fraction of a second) + * + * Return Value: + * [Distance Traveled, Shot Time, Offset (degrees)] + * + * Example: + * [45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call ace_mk6mortar_fnc_dev_simulateShot; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_angleDeg", "_muzzleVelocity", "_airFriction", "_temp", "_relDensity", "_tailWind", "_crosswind", "_heightOfTarget", "_timeStep", "_wind", "_gravity", "_currentPos", "_currentVelocity", "_currentTime", "_lastPos", "_kCoefficent", "_aparentWind", "_changeInVelocity", "_linConversion", "_middlePos", "_middlePosOld", "_middleTotalTravelTime", "_offsetDeg"]; + +_angleDeg = _this select 0; +_muzzleVelocity = _this select 1; +_airFriction = _this select 2; +_temp = _this select 3; +_relDensity = _this select 4; +_tailWind = _this select 5; +_crosswind = _this select 6; +_heightOfTarget = _this select 7; +_timeStep = _this select 8; + +_wind = [_crosswind, _tailWind, 0]; +_gravity = [0,0,-9.8]; + +_currentPos = [0,0,0]; +_muzzleVelocity = _muzzleVelocity * (((_temp + 273.13) / 288.13 - 1) / 40 + 1); +_currentVelocity = [0, (_muzzleVelocity * cos _angleDeg), (_muzzleVelocity * sin _angleDeg)]; + +_currentTime = 0; +_lastPos = _currentPos; + +_kCoefficent = -1 * _relDensity * _airFriction; //save time in the loop and compute once + +while {((_currentVelocity select 2) > 0) || ((_currentPos select 2) >= _heightOfTarget)} do { + _lastPos = _currentPos; + + _aparentWind = _wind vectorDiff _currentVelocity; + _changeInVelocity = _gravity vectorAdd (_aparentWind vectorMultiply ((vectorMagnitude _aparentWind) * _kCoefficent)); + + _currentVelocity = _currentVelocity vectorAdd (_changeInVelocity vectorMultiply _timeStep); + + _currentPos = _currentPos vectorAdd (_currentVelocity vectorMultiply _timeStep); + _currentTime = _currentTime + _timeStep; +}; + +//Uses linearConversion to get a weighted average betwen points before and after dropping below target height +_linConversion = linearConversion [(_lastPos select 2), (_currentPos select 2), _heightOfTarget, 0, 1, true]; +_middlePos = (_lastPos vectorMultiply (1 - _linConversion)) vectorAdd (_currentPos vectorMultiply (_linConversion)); +// _middlePosOld = (_lastPos vectorAdd _currentPos) vectorMultiply 0.5; + +//Same to find travel time +_middleTotalTravelTime = _currentTime - (_timeStep * (1-_linConversion)); + +//Find shot offset (from crosswind), in degrees +_offsetDeg = (_middlePos select 0) aTan2 (_middlePos select 1); + +[(_middlePos select 1), _middleTotalTravelTime, _offsetDeg] diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf new file mode 100644 index 0000000000..e2b440c520 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -0,0 +1,89 @@ +/* + * Author: PabstMirror + * Called when the mortar is fired. + * + * Arguments: + * 0: mortar - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_mk6mortar_fnc_handleFired + * + * Public: No + */ +#include "script_component.hpp" + +private ["_shooterMan", "_bisAirFriction", "_temperature", "_newMuzzleVelocityCoefficent", "_bulletVelocity", "_bulletSpeed", "_muzzleVelocity", "_muzzleVelocityShift"]; + +disableSerialization; + +PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +if (!GVAR(airResistanceEnabled)) exitWith {}; +// Large enough distance to not simulate any wind deflection +if (_vehicle distance ACE_player > 8000) exitWith {false}; + +//AI will have no clue how to use: +_shooterMan = gunner _vehicle; +if (!([_shooterMan] call EFUNC(common,isPlayer))) exitWith {false}; + +//Should be zero, just make sure: +_bisAirFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); +if (_bisAirFriction != 0) exitWith {ERROR("Non zero base airFriction");}; + + +//Calculate air density: +_altitude = (getPosASL _vehicle) select 2; +#define GET_TEMPERATURE_AT_HEIGHT(h) (EGVAR(weather,currentTemperature) - 0.0065 * (h)) +_temperature = GET_TEMPERATURE_AT_HEIGHT(_altitude); +_pressure = _altitude call EFUNC(weather,calculateBarometricPressure); +_relativeHumidity = EGVAR(weather,currentHumidity); +_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); +_relativeDensity = _airDensity / 1.225; + +TRACE_5("FiredWeather",_temperature,_pressure,_relativeHumidity,_airDensity,_relativeDensity); + +//powder effects: +_newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1); +if (_newMuzzleVelocityCoefficent != 1) then { + _bulletVelocity = velocity _projectile; + _bulletSpeed = vectorMagnitude _bulletVelocity; + _bulletVelocity = (vectorNormalized _bulletVelocity) vectorMultiply (_bulletSpeed * _newMuzzleVelocityCoefficent); + _projectile setVelocity _bulletVelocity; + _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; +}; + + +[{ + private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"]; + PARAMS_2(_args,_pfID); + EXPLODE_4_PVT(_args,_shell,_airFriction,_time,_relativeDensity); + + if (isNull _shell || {!alive _shell}) exitwith { + [_pfID] call cba_fnc_removePerFrameHandler; + }; + + _deltaT = time - _time; + _args set[2, time]; + + _bulletVelocity = velocity _shell; + _bulletSpeed = vectorMagnitude _bulletVelocity; + + _trueVelocity = _bulletVelocity vectorDiff ACE_wind; + _trueSpeed = vectorMagnitude _trueVelocity; + + _drag = _deltaT * _airFriction * _trueSpeed * _relativeDensity; + _accel = _trueVelocity vectorMultiply (_drag); + _bulletVelocity = _bulletVelocity vectorAdd _accel; + + _shell setVelocity _bulletVelocity; + +}, 0, [_projectile, MK6_82mm_AIR_FRICTION, time, _relativeDensity]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf new file mode 100644 index 0000000000..91657fdbe2 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -0,0 +1,108 @@ +/* + * Author: PabstMirror + * Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar. + * + * Arguments: + * 0:Player + * 1: New Vehicle + * + * Return Value: + * No + * + * Example: + * [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_chargeText", "_xPos", "_yPos", "_wPos", "_hPos", "_tubeWeaponName", "_fireModes"]; + +PARAMS_2(_player,_newVehicle); + +if (isNull _newVehicle) exitWith {}; +if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {}; + +_chargeText = (findDisplay 46) ctrlCreate ["RscStructuredText", 80085]; + +_xPos = (profilenamespace getvariable ["IGUI_GRID_WEAPON_X", ((safezoneX + safezoneW) - (12.4 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))]); +_yPos = 2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable ["IGUI_GRID_WEAPON_Y", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]); +_wPos = 10 * (((safezoneW / safezoneH) min 1.2) / 40); +_hPos = 1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25); + +_chargeText ctrlSetPosition [_xPos, _yPos, _wPos, _hPos]; +_chargeText ctrlCommit 0; + +_tubeWeaponName = (weapons _newVehicle) select 0; +_fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes"); + +[{ + PARAMS_2(_args,_pfID); + EXPLODE_3_PVT(_args,_mortarVeh,_chargeText,_fireModes); + + if ((vehicle ACE_player) != _mortarVeh) then { + [_pfID] call CBA_fnc_removePerFrameHandler; + ctrlDelete _chargeText; + } else { + + _useMils = _mortarVeh getVariable [QGVAR(useMils), true]; + + //Compute: 'charge' from weaponstate + _currentFireMode = (weaponState [_mortarVeh, [0]]) select 2; + _currentChargeMode = _fireModes find _currentFireMode; + + _text = format ["%1: %2 ", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))]; + _chargeText ctrlSetStructuredText parseText _text; + if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then { + //Don't like this solution, but it works + closeDialog 0; + [parseText "Computer Disabled"] call EFUNC(common,displayTextStructured); + }; + + _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; + if (isNull _display) exitWith {}; //It may be null for the first frame + + //Hud should hidden in 3rd person + _notGunnerView = cameraView != "GUNNER"; + + //Update CurrentElevation Display: + if (_notGunnerView) then { + (_display displayCtrl 80175) ctrlSetText ""; + } else { + _elevDeg = parseNumber ctrlText (_display displayCtrl 175); + if (_useMils) then { + (_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360); + } else { + (_display displayCtrl 80175) ctrlSetText str _elevDeg; + }; + }; + + //Update ElevationNeeded Display: + if (_notGunnerView || (!GVAR(allowComputerRangefinder))) then { + (_display displayCtrl 80176) ctrlSetText ""; + } else { + _elevDeg = parseNumber ctrlText (_display displayCtrl 176); + if (_elevDeg <= 0) then { //Bad data means "----" out of range + (_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176)); + } else { + if (_useMils) then { + (_display displayCtrl 80176) ctrlSetText str round (_elevDeg * 6400 / 360); + } else { + (_display displayCtrl 80176) ctrlSetText str _elevDeg; + }; + }; + }; + + //Update Heading Display: + if (_notGunnerView || (!GVAR(allowCompass))) then { + (_display displayCtrl 80156) ctrlSetText ""; + } else { + _rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360; + if (_useMils) then { + (_display displayCtrl 80156) ctrlSetText str round (_rotationDegrees * 6400 / 360); + } else { + (_display displayCtrl 80156) ctrlSetText (ctrlText (_display displayCtrl 156)); + }; + }; + }; +}, 0, [_newVehicle, _chargeText,_fireModes]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/mk6mortar/functions/fnc_moduleInit.sqf b/addons/mk6mortar/functions/fnc_moduleInit.sqf new file mode 100644 index 0000000000..75bab4cee9 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_moduleInit.sqf @@ -0,0 +1,27 @@ +/* + * Author: PabstMirror + * Loads settings from the module. + * + * Arguments: + * 0: The Module Logic Object + * 1: synced objects + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [fromModule] call ace_mk6mortar_fnc_moduleInit + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_logic,_syncedUnits,_activated); + +if (!_activated) exitWith {WARNING("Module - placed but not active");}; +if (!isServer) exitWith {}; + +[_logic, QGVAR(airResistanceEnabled), "airResistanceEnabled"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(allowComputerRangefinder), "allowComputerRangefinder"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(allowCompass), "allowCompass"] call EFUNC(common,readSettingFromModule); diff --git a/addons/mk6mortar/functions/fnc_rangeTableCanUse.sqf b/addons/mk6mortar/functions/fnc_rangeTableCanUse.sqf new file mode 100644 index 0000000000..04ca9c3278 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_rangeTableCanUse.sqf @@ -0,0 +1,21 @@ +/* + * Author: PabstMirror + * Can player open 82mm rangetable. + * + * Arguments: + * 0: Vehicle + * 1: Player + * + * Return Value: + * Can Open + * + * Example: + * [bob, bob] call ace_mk6mortar_fnc_rangeTableCanUse + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_vehicle,_player); + +"ACE_RangeTable_82mm" in (items _player); \ No newline at end of file diff --git a/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf b/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf new file mode 100644 index 0000000000..dfb53842ab --- /dev/null +++ b/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf @@ -0,0 +1,48 @@ +/* + * Author: PabstMirror + * Opens the rangetable and fills the charge listbox. + * + * Arguments: + * No + * + * Return Value: + * No + * + * Example: + * [] call ace_mk6mortar_fnc_rangeTableOpen + * + * Public: No + */ +#include "script_component.hpp" + +#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501) + +private ["_weaponName", "_magazines", "_initSpeed", "_fireModes", "_muzzleVelocities", "_showToPlayer", "_artilleryCharge"]; + +_weaponName = "mortar_82mm"; //todo: work on other weapons + +createDialog "ACE_82mm_RangeTable_Dialog"; +if (isNull (uiNamespace getVariable ["ACE_82mm_RangeTable_Dialog", displayNull])) exitWith {ERROR("Dialog failed to open");}; + +//Get Magazine Types +_magazines = getArray (configFile >> "CfgWeapons" >> _weaponName >> "magazines"); + +//For now just get settings from first mag, all rounds have same flight characteristics: +if ((count _magazines) < 1) exitWith {ERROR("No Magazines for weapon");}; +_initSpeed = getNumber (configFile >> "CfgMagazines" >> (_magazines select 0) >> "initSpeed"); + +//Get Charge Modes +_fireModes = getArray (configFile >> "CfgWeapons" >> _weaponName >> "modes"); + +_muzzleVelocities = []; +{ + _showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer"); + if (_showToPlayer == 1) then { + _artilleryCharge = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "artilleryCharge"); + LIST_CHARGE lbAdd format ["%1: %2", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), (count _muzzleVelocities)]; + LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)]; + _muzzleVelocities pushBack _artilleryCharge; + }; +} forEach _fireModes; + +LIST_CHARGE lbSetCurSel 0; diff --git a/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf b/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf new file mode 100644 index 0000000000..c0cc40ccdc --- /dev/null +++ b/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf @@ -0,0 +1,37 @@ +/* + * Author: PabstMirror + * Called when listbox selection changes. Updates the rangetable with new values. + * + * Arguments: + * No + * + * Return Value: + * No + * + * Example: + * [] call ace_mk6mortar_fnc_rangeTablePageChange + * + * Public: No + */ +#include "script_component.hpp" + +#define RANGE_TABLE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 20001) +#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501) + +private ["_listBoxData", "_muzzleVelocity", "_airFriction", "_precalcArray"]; + +_listBoxData = LIST_CHARGE lbData (lbCurSel LIST_CHARGE); +if (isNil "_listBoxData" || {_listBoxData == ""}) exitWith {ERROR("lbCurSel out of bounds or no data");}; +_muzzleVelocity = parseNumber _listBoxData; + +_airFriction = if (GVAR(airResistanceEnabled)) then {MK6_82mm_AIR_FRICTION} else {0}; + +_precalcArray = [_muzzleVelocity, _airFriction] call FUNC(rangeTablePreCalculatedValues); + +lnbClear RANGE_TABLE; +{ + RANGE_TABLE lnbAddRow _x; +} forEach _precalcArray; + +//put dummy line at end because scrolling is fucked and can't see last line +RANGE_TABLE lnbAddRow ["", "", "", "", "", "", "", "", "", "", ""]; diff --git a/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf new file mode 100644 index 0000000000..d775b87365 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf @@ -0,0 +1,271 @@ +/* + * Author: PabstMirror + * Simple Lookup Table for various muzzle velocities and air frictions. + * Use ace_mk6mortar_fnc_dev_buildTable to build + * + * Arguments: + * 0: Muzzle Velocity + * 1: Air Friction + * + * Return Value: + * + * + * Example: + * [200, 0] call ace_mk6mortar_fnc_rangeTablePreCalculatedValues + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_muzzleVelocity,_airFriction); + +switch (true) do { + +case ((abs(_muzzleVelocity - 70) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): { + [ + ["100","1493","9","1.4","14.0","3.7","0.4","-0.3","0.0","-0.0","-0.0","0.0"], + ["150","1438","14","1.4","13.9","2.5","0.4","-0.4","0.0","-0.0","-0.1","0.0"], + ["200","1381","20","1.4","13.8","1.9","0.5","-0.4","0.0","-0.0","-0.1","0.1"], + ["250","1321","27","1.5","13.6","1.5","0.5","-0.4","0.0","-0.0","-0.1","0.1"], + ["300","1256","36","1.6","13.3","1.3","0.6","-0.5","0.0","-0.1","-0.1","0.1"], + ["350","1183","49","1.7","12.9","1.1","0.6","-0.5","0.1","-0.1","-0.1","0.1"], + ["400","1097","70","1.9","12.4","0.9","0.6","-0.5","0.1","-0.1","-0.2","0.1"], + ["450","979","113","2.3","11.6","0.8","0.6","-0.5","0.1","-0.1","-0.2","0.2"] + ] + }; +case ((abs(_muzzleVelocity - 140) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): { + [ + ["150","1556","1","0.8","27.2","16.3","2.5","-2.4","0.0","-0.0","-0.2","0.2"], + ["200","1541","1","0.8","27.2","12.3","2.5","-2.4","0.0","-0.0","-0.3","0.2"], + ["250","1527","2","0.8","27.2","9.9","2.6","-2.4","0.0","-0.0","-0.3","0.3"], + ["300","1512","2","0.8","27.2","8.3","2.7","-2.4","0.1","-0.0","-0.4","0.4"], + ["350","1497","3","0.8","27.1","7.1","2.7","-2.5","0.0","-0.1","-0.5","0.4"], + ["400","1482","3","0.8","27.1","6.2","2.7","-2.5","0.1","-0.1","-0.5","0.5"], + ["450","1467","3","0.8","27.0","5.6","2.8","-2.5","0.1","-0.1","-0.6","0.6"], + ["500","1451","4","0.8","27.0","5.0","2.9","-2.6","0.1","-0.1","-0.6","0.6"], + ["550","1436","4","0.8","26.9","4.6","2.9","-2.6","0.1","-0.1","-0.7","0.7"], + ["600","1420","5","0.8","26.8","4.2","3.0","-2.7","0.1","-0.1","-0.8","0.8"], + ["650","1404","5","0.8","26.8","3.9","3.0","-2.7","0.1","-0.1","-0.9","0.8"], + ["700","1388","6","0.8","26.7","3.6","3.1","-2.8","0.1","-0.1","-0.9","0.9"], + ["750","1372","6","0.8","26.6","3.4","3.2","-2.8","0.1","-0.1","-1.0","1.0"], + ["800","1355","7","0.8","26.5","3.2","3.2","-2.9","0.1","-0.1","-1.1","1.1"], + ["850","1338","8","0.8","26.4","3.0","3.3","-2.9","0.1","-0.1","-1.1","1.1"], + ["900","1321","8","0.8","26.2","2.8","3.4","-3.0","0.1","-0.1","-1.2","1.2"], + ["950","1303","9","0.9","26.1","2.7","3.4","-3.1","0.1","-0.2","-1.3","1.2"], + ["1000","1285","10","0.9","26.0","2.6","3.5","-3.1","0.2","-0.1","-1.4","1.3"], + ["1050","1266","11","0.9","25.8","2.4","3.5","-3.2","0.1","-0.2","-1.4","1.4"], + ["1100","1247","12","0.9","25.7","2.3","3.6","-3.3","0.1","-0.2","-1.5","1.4"], + ["1150","1228","13","0.9","25.5","2.2","3.7","-3.3","0.2","-0.2","-1.6","1.5"], + ["1200","1207","14","1.0","25.3","2.1","3.7","-3.4","0.2","-0.2","-1.7","1.6"], + ["1250","1186","15","1.0","25.1","2.0","3.8","-3.4","0.2","-0.2","-1.7","1.7"], + ["1300","1163","17","1.0","24.8","1.9","3.8","-3.5","0.2","-0.2","-1.8","1.7"], + ["1350","1140","19","1.0","24.6","1.9","3.9","-3.5","0.2","-0.2","-1.9","1.8"], + ["1400","1115","21","1.1","24.3","1.8","3.9","-3.6","0.2","-0.2","-1.9","1.9"], + ["1450","1088","24","1.1","23.9","1.7","4.0","-3.6","0.2","-0.2","-2.0","1.9"], + ["1500","1060","27","1.2","23.6","1.6","4.0","-3.7","0.2","-0.2","-2.1","2.0"], + ["1550","1028","32","1.3","23.1","1.5","4.0","-3.7","0.2","-0.2","-2.1","2.1"], + ["1600","991","38","1.4","22.6","1.5","4.0","-3.7","0.2","-0.2","-2.2","2.1"], + ["1650","947","49","1.7","21.9","1.4","4.0","-3.7","0.2","-0.3","-2.3","2.2"], + ["1700","888","71","2.1","21.0","1.3","3.9","-3.6","0.3","-0.3","-2.3","2.2"] + ] + }; +case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): { + [ + ["250","1559","1","0.6","37.3","23.8","6.1","-5.9","0.0","-0.0","-0.6","0.5"], + ["300","1551","1","0.6","37.3","20.0","6.1","-5.9","0.1","-0.0","-0.7","0.7"], + ["350","1543","1","0.6","37.3","17.2","6.2","-5.9","0.0","-0.1","-0.8","0.7"], + ["400","1535","1","0.6","37.3","15.1","6.2","-5.9","0.1","-0.0","-0.9","0.9"], + ["450","1527","1","0.6","37.3","13.4","6.3","-6.0","0.1","-0.1","-1.0","1.0"], + ["500","1519","1","0.6","37.2","12.1","6.3","-6.0","0.1","-0.1","-1.1","1.1"], + ["550","1510","1","0.6","37.2","11.0","6.4","-6.0","0.1","-0.1","-1.3","1.2"], + ["600","1502","1","0.6","37.2","10.1","6.4","-6.1","0.1","-0.1","-1.4","1.3"], + ["650","1494","1","0.6","37.2","9.4","6.5","-6.1","0.1","-0.1","-1.5","1.4"], + ["700","1485","2","0.6","37.1","8.7","6.5","-6.2","0.1","-0.1","-1.6","1.5"], + ["750","1477","2","0.6","37.1","8.2","6.6","-6.2","0.1","-0.1","-1.7","1.6"], + ["800","1468","2","0.6","37.0","7.7","6.7","-6.3","0.1","-0.1","-1.8","1.8"], + ["850","1460","2","0.6","37.0","7.2","6.7","-6.3","0.1","-0.1","-2.0","1.9"], + ["900","1451","2","0.6","37.0","6.8","6.8","-6.4","0.1","-0.1","-2.1","2.0"], + ["950","1443","2","0.6","36.9","6.5","6.9","-6.4","0.1","-0.1","-2.2","2.1"], + ["1000","1434","2","0.6","36.9","6.2","6.9","-6.5","0.1","-0.1","-2.3","2.2"], + ["1050","1425","2","0.6","36.8","5.9","7.0","-6.6","0.1","-0.2","-2.5","2.3"], + ["1100","1417","3","0.6","36.8","5.6","7.1","-6.6","0.1","-0.2","-2.6","2.4"], + ["1150","1408","3","0.6","36.7","5.4","7.1","-6.7","0.2","-0.2","-2.7","2.5"], + ["1200","1399","3","0.6","36.6","5.2","7.2","-6.7","0.2","-0.2","-2.8","2.7"], + ["1250","1390","3","0.6","36.6","5.0","7.3","-6.8","0.2","-0.2","-2.9","2.8"], + ["1300","1381","3","0.6","36.5","4.8","7.4","-6.9","0.2","-0.2","-3.0","2.9"], + ["1350","1372","3","0.6","36.4","4.6","7.4","-6.9","0.2","-0.2","-3.2","3.0"], + ["1400","1362","4","0.6","36.4","4.4","7.5","-7.0","0.2","-0.2","-3.3","3.1"], + ["1450","1353","4","0.6","36.3","4.3","7.6","-7.1","0.2","-0.2","-3.4","3.2"], + ["1500","1344","4","0.6","36.2","4.2","7.7","-7.1","0.2","-0.2","-3.5","3.4"], + ["1550","1334","4","0.6","36.1","4.0","7.7","-7.2","0.2","-0.2","-3.7","3.5"], + ["1600","1324","4","0.6","36.0","3.9","7.8","-7.3","0.2","-0.2","-3.8","3.6"], + ["1650","1314","4","0.7","35.9","3.8","7.9","-7.3","0.2","-0.2","-3.9","3.7"], + ["1700","1304","5","0.7","35.8","3.7","7.9","-7.4","0.2","-0.2","-4.0","3.8"], + ["1750","1294","5","0.7","35.7","3.6","8.0","-7.5","0.2","-0.2","-4.2","3.9"], + ["1800","1284","5","0.7","35.6","3.5","8.1","-7.6","0.2","-0.3","-4.3","4.0"], + ["1850","1274","5","0.7","35.5","3.4","8.2","-7.6","0.2","-0.3","-4.4","4.2"], + ["1900","1263","6","0.7","35.4","3.3","8.2","-7.7","0.2","-0.3","-4.5","4.3"], + ["1950","1253","6","0.7","35.2","3.2","8.3","-7.8","0.2","-0.3","-4.7","4.4"], + ["2000","1242","6","0.7","35.1","3.1","8.4","-7.8","0.3","-0.3","-4.8","4.5"], + ["2050","1231","7","0.7","35.0","3.0","8.4","-7.9","0.3","-0.3","-4.9","4.7"], + ["2100","1219","7","0.7","34.8","2.9","8.5","-8.0","0.3","-0.3","-5.0","4.8"], + ["2150","1208","7","0.7","34.7","2.9","8.5","-8.0","0.3","-0.3","-5.2","4.9"], + ["2200","1196","8","0.7","34.5","2.8","8.6","-8.1","0.3","-0.3","-5.3","5.0"], + ["2250","1184","8","0.7","34.3","2.7","8.7","-8.2","0.3","-0.3","-5.4","5.1"], + ["2300","1171","9","0.8","34.2","2.7","8.7","-8.2","0.3","-0.3","-5.5","5.2"], + ["2350","1158","9","0.8","34.0","2.6","8.8","-8.3","0.3","-0.3","-5.7","5.4"], + ["2400","1145","10","0.8","33.8","2.5","8.8","-8.3","0.3","-0.3","-5.8","5.5"], + ["2450","1132","10","0.8","33.6","2.5","8.9","-8.4","0.3","-0.3","-5.9","5.6"], + ["2500","1118","11","0.8","33.3","2.4","8.9","-8.4","0.3","-0.3","-6.0","5.7"], + ["2550","1103","12","0.8","33.1","2.4","9.0","-8.5","0.3","-0.3","-6.1","5.8"], + ["2600","1088","13","0.9","32.8","2.3","9.0","-8.5","0.4","-0.3","-6.2","5.9"], + ["2650","1072","14","0.9","32.6","2.2","9.0","-8.6","0.4","-0.4","-6.4","6.0"], + ["2700","1056","15","0.9","32.3","2.2","9.0","-8.6","0.3","-0.4","-6.5","6.1"], + ["2750","1038","16","1.0","31.9","2.1","9.1","-8.6","0.4","-0.4","-6.6","6.3"], + ["2800","1020","18","1.0","31.6","2.1","9.1","-8.6","0.4","-0.4","-6.7","6.4"], + ["2850","1000","20","1.1","31.2","2.0","9.1","-8.6","0.4","-0.4","-6.8","6.5"], + ["2900","978","22","1.1","30.8","1.9","9.0","-8.6","0.4","-0.4","-6.9","6.5"], + ["2950","954","26","1.2","30.3","1.9","9.0","-8.6","0.4","-0.4","-7.0","6.6"], + ["3000","927","31","1.4","29.7","1.8","8.9","-8.5","0.4","-0.4","-7.1","6.7"], + ["3050","894","38","1.6","29.0","1.7","8.8","-8.4","0.4","-0.4","-7.2","6.8"], + ["3100","849","54","2.0","27.9","1.6","8.5","-8.3","0.4","-0.4","-7.2","6.8"] + ] + }; +case ((abs(_muzzleVelocity - 70) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { + [ + ["100","1497","9","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["150","1445","14","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["200","1390","19","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["250","1333","26","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["300","1272","34","1.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["350","1204","45","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["400","1127","61","1.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["450","1028","91","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] + ] + }; +case ((abs(_muzzleVelocity - 140) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { + [ + ["150","1562","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["200","1549","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["250","1536","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["300","1523","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["350","1510","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["400","1497","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["450","1484","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["500","1471","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["550","1458","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["600","1445","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["650","1431","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["700","1418","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["750","1404","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["800","1390","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["850","1376","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["900","1362","6","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["950","1348","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1000","1333","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1050","1318","8","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1100","1303","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1150","1288","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1200","1272","10","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1250","1256","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1300","1239","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1350","1222","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1400","1205","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1450","1187","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1500","1168","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1550","1148","18","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1600","1127","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1650","1105","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1700","1082","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1750","1057","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1800","1029","31","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1850","997","37","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1900","960","46","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1950","912","63","1.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"] + ] + }; +case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { + [ + ["300","1563","0","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["350","1556","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["400","1550","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["450","1544","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["500","1537","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["550","1531","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["600","1525","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["650","1519","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["700","1512","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["750","1506","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["800","1499","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["850","1493","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["900","1487","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["950","1480","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1000","1474","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1050","1467","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1100","1461","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1150","1454","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1200","1448","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1250","1441","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1300","1435","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1350","1428","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1400","1422","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1450","1415","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1500","1408","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1550","1402","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1600","1395","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1650","1388","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["1700","1381","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1750","1374","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1800","1367","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1850","1360","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1900","1353","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1950","1346","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2000","1339","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2050","1332","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2100","1325","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2150","1317","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2200","1310","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2250","1302","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2300","1295","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2350","1287","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2400","1280","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2450","1272","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2500","1264","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2550","1256","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2600","1248","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2650","1240","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2700","1232","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2750","1223","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2800","1215","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2850","1206","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2900","1197","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["2950","1188","7","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3000","1179","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3050","1170","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3100","1160","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3150","1151","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3200","1141","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3250","1131","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3300","1120","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3350","1109","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3400","1098","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3450","1087","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3500","1075","13","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3550","1062","14","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3600","1049","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3650","1036","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3700","1021","17","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3750","1006","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3800","990","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3850","971","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["3900","952","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3950","929","32","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["4000","900","40","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"], + ["4050","861","56","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] + ] + }; + default { + ERROR("MuzzleVelocity not found in LUT"); + [] + }; +}; \ No newline at end of file diff --git a/addons/mk6mortar/functions/fnc_toggleMils.sqf b/addons/mk6mortar/functions/fnc_toggleMils.sqf new file mode 100644 index 0000000000..923a553f43 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_toggleMils.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Toggles the mortart to show mils or degrees + * + * Arguments: + * 0: Vehicle + * 1: Player + * + * Return Value: + * No + * + * Example: + * [mortar,bob] call ace_mk6mortar_fnc_toggleMils; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_mortarVeh,_unit); + +private "_currentSetting"; + +_currentSetting = _mortarVeh getVariable [QGVAR(useMils), true]; +_mortarVeh setVariable [QGVAR(useMils), (!_currentSetting)]; diff --git a/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf new file mode 100644 index 0000000000..c81ff32132 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf @@ -0,0 +1,67 @@ +/* + * Author: PabstMirror + * Called when the mk6's in game UI is loaded. Hides rangefinder data if it is disabled. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_mk6mortar_fnc_turretDisplayLoaded + * + * Public: No + */ +#include "script_component.hpp" + +#define CTRL_CA_OPTICSPITCH (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_OPTICSPITCH") +#define CTRL_CA_OPTICSZOOM (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_OPTICSZOOM") +#define CTRL_CA_SOLUTION_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_SOLUTION_TEXT") +#define CTRL_CA_DISTANCE_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_DISTANCE_TEXT") +#define CTRL_CA_DISTANCE (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_DISTANCE") +#define CTRL_CA_TIME_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_TIME_TEXT") +#define CTRL_CA_TIME (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_TIME") +#define CTRL_CA_ELEV_NEED_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED_TEXT") +#define CTRL_CA_RANGEELEMENTS_GROUP (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_RangeElements_group") + +#define CTRL_CA_HEADING (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_Heading") +#define CTRL_CA_ELEV (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV") +#define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED") + +private ["_display", "_fnc_hideControl"]; + +disableSerialization; + +_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; +if (isNull _display) exitWith {}; + +_fnc_hideControl = { + private "_idc"; + PARAMS_2(_path,_hideCtrl); + _idc = getNumber (_path >> "IDC"); + _pos = []; + if (_hideCtrl) then { + _pos = [-9,-9,0,0]; + } else { + { + if (isNumber (_path >> _x)) then { + _pos pushBack (getNumber (_path >> _x)); + } else { + _pos pushBack (call compile (getText (_path >> _x))); + }; + } forEach ["x", "y", "w", "h"]; + }; + (_display displayCtrl _idc) ctrlSetPosition _pos; + (_display displayCtrl _idc) ctrlCommit 0; +}; + +{ + [_x, (!GVAR(allowComputerRangefinder))] call _fnc_hideControl; +} forEach [CTRL_CA_OPTICSPITCH, CTRL_CA_OPTICSZOOM, CTRL_CA_SOLUTION_TEXT, CTRL_CA_DISTANCE_TEXT, CTRL_CA_DISTANCE, CTRL_CA_TIME_TEXT, CTRL_CA_TIME, CTRL_CA_ELEV_NEED_TEXT, CTRL_CA_RANGEELEMENTS_GROUP]; + +//Always hide these, handled by the mil convertions PFEH in handlePlayerVehChanged +[CTRL_CA_HEADING, true] call _fnc_hideControl; +[CTRL_CA_ELEV, true] call _fnc_hideControl; +[CTRL_CA_ELEV_NEED, true] call _fnc_hideControl; + diff --git a/addons/mk6mortar/functions/script_component.hpp b/addons/mk6mortar/functions/script_component.hpp new file mode 100644 index 0000000000..9980d4fc88 --- /dev/null +++ b/addons/mk6mortar/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\mk6mortar\script_component.hpp" \ No newline at end of file diff --git a/addons/mk6mortar/script_component.hpp b/addons/mk6mortar/script_component.hpp new file mode 100644 index 0000000000..cb74d552de --- /dev/null +++ b/addons/mk6mortar/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT mk6mortar +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MK6MORTAR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MK6MORTAR + #define DEBUG_SETTINGS DEBUG_SETTINGS_MK6MORTAR +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" + +#define MK6_82mm_AIR_FRICTION -0.0001 \ No newline at end of file diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml new file mode 100644 index 0000000000..da61afb03b --- /dev/null +++ b/addons/mk6mortar/stringtable.xml @@ -0,0 +1,18 @@ + + + + + + 82mm Rangetable + + + Range Table for the MK6 82mm Mortar + + + Open 82mm Rangetable + + + Charge + + + \ No newline at end of file diff --git a/addons/movement/CfgMoves.hpp b/addons/movement/CfgMoves.hpp index 677ad3dc94..bd9519b013 100644 --- a/addons/movement/CfgMoves.hpp +++ b/addons/movement/CfgMoves.hpp @@ -5,10 +5,35 @@ class CfgMovesBasic { }; class Actions { - class RifleStandActionsNoAdjust; - class RifleLowStandActionsNoAdjust; + class RifleBaseStandActions; + class RifleKneelActions: RifleBaseStandActions { + Civil = "AmovPknlMstpSnonWnonDnon"; + }; + class RifleProneActions: RifleBaseStandActions { + Civil = "AmovPpneMstpSnonWnonDnon"; + SecondaryWeapon = "AmovPpneMstpSrasWlnrDnon"; + }; + + class PistolStandActions; + class PistolProneActions: PistolStandActions { + SecondaryWeapon = "AmovPpneMstpSrasWlnrDnon"; + }; + + class LauncherKneelActions; + /*class LauncherStandActions: LauncherKneelActions { + PlayerProne = "AmovPpneMstpSrasWlnrDnon"; + Down = "AmovPpneMstpSrasWlnrDnon"; + };*/ + + class LauncherProneActions: LauncherKneelActions { + TurnL = "AmovPpneMstpSrasWlnrDnon_turnl"; + TurnLRelaxed = "AmovPpneMstpSrasWlnrDnon_turnl"; + TurnR = "AmovPpneMstpSrasWlnrDnon_turnr"; + TurnRRelaxed = "AmovPpneMstpSrasWlnrDnon_turnr"; + }; // WEAPON RAISED - RUNNING + class RifleStandActionsNoAdjust; class RifleStandActionsRunF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; @@ -18,6 +43,7 @@ class CfgMovesBasic { class RifleStandActionsRunFR: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; + // WEAPON RAISED - SPRINTING class RifleStandEvasiveActionsF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; @@ -28,7 +54,9 @@ class CfgMovesBasic { class RifleStandEvasiveActionsFR: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; + // WEAPON LOWERED - RUNNING + class RifleLowStandActionsNoAdjust; class RifleLowStandActionsRunF: RifleLowStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index e65087936e..bc8d6dcdec 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -218,6 +218,7 @@ Option Menu UI Scaling Menu option: taille de l'UI Skalowanie UI menu ustawień + Opción de escalado del menú UI - + \ No newline at end of file diff --git a/addons/realisticnames/CfgWeapons.hpp b/addons/realisticnames/CfgWeapons.hpp index 56d9e3b7c8..3cbe03f465 100644 --- a/addons/realisticnames/CfgWeapons.hpp +++ b/addons/realisticnames/CfgWeapons.hpp @@ -208,7 +208,7 @@ class CfgWeapons { class srifle_DMR_02_sniper_F: srifle_DMR_02_F { displayName = "$STR_ACE_RealisticNames_srifle_DMR_02_sniper"; //MAR-10 .338 (Sand)"; }; - + */ class DMR_03_base_F: Rifle_Long_Base_F { displayName = "$STR_ACE_RealisticNames_DMR_03"; //Mk-I EMR 7.62 mm"; }; @@ -236,7 +236,7 @@ class CfgWeapons { class srifle_DMR_03_spotter_F: srifle_DMR_03_F { displayName = "$STR_ACE_RealisticNames_srifle_DMR_03_spotter"; //NATO DMR (provisional) spotter"; }; - + /* class DMR_04_base_F: Rifle_Long_Base_F { displayName = "$STR_ACE_RealisticNames_DMR_04"; //ASP-1 Kir 12.7 mm"; }; @@ -264,7 +264,7 @@ class CfgWeapons { class srifle_DMR_05_tan_f: srifle_DMR_05_blk_F { displayName = "$STR_ACE_RealisticNames_srifle_DMR_05_tan"; //Cyrus 9.3 mm (Tan)"; }; - + */ class DMR_06_base_F: Rifle_Long_Base_F { displayName = "$STR_ACE_RealisticNames_DMR_06"; //Mk14 7.62 mm"; }; @@ -278,6 +278,7 @@ class CfgWeapons { }; // marksmen mgs + /* class MMG_01_base_F: Rifle_Long_Base_F { displayName = "$STR_ACE_RealisticNames_MMG_01"; //Navid 9.3 mm"; }; @@ -289,7 +290,7 @@ class CfgWeapons { class MMG_01_tan_F: MMG_01_hex_F { displayName = "$STR_ACE_RealisticNames_MMG_01_tan"; //Navid 9.3 mm (Tan)"; }; - + */ class MMG_02_base_F: Rifle_Long_Base_F { displayName = "$STR_ACE_RealisticNames_MMG_02"; //SPMG .338"; }; @@ -304,7 +305,7 @@ class CfgWeapons { class MMG_02_sand_F: MMG_02_camo_F { displayName = "$STR_ACE_RealisticNames_MMG_02_sand"; //SPMG .338 (Sand)"; - };*/ + }; // vehicle weapons diff --git a/addons/realisticnames/stringtable.xml b/addons/realisticnames/stringtable.xml index a21fcb8e05..02995def8c 100644 --- a/addons/realisticnames/stringtable.xml +++ b/addons/realisticnames/stringtable.xml @@ -519,7 +519,7 @@ Punisher (GMG) Punisher (GMW) Punisher (GMG) - Punisher (CKM) + Punisher (GMG) Punisher (granátomet) Punisher (GMG) Kаратель (Гранатомет) @@ -1510,53 +1510,60 @@ TODO: MAR-10 .338 (песочный) - TODO: Mk-I EMR 7.62 mm - TODO: Mk-I EMR 7.62 mm - Mk-l EMR 7.62 mm - TODO: Mk-I EMR 7.62 mm - TODO: Mk-I EMR 7.62 мм + SG 556 7.62 mm + SG 556 7.62 mm + SG 556 7.62 mm + SG 556 7.62 mm + SG 556 7.62 мм + SG 556 7,62 mm - TODO: Mk-I EMR 7.62 mm (Black) - TODO: Mk-I EMR 7.62 mm (Black) - Mk-l EMR 7.62 mm (Noir) - TODO: Mk-I EMR 7.62 mm (Negro) - TODO: Mk-I EMR 7.62 мм (черный) + SG 556 7.62 mm (Black) + SG 556 7.62 mm (Black) + SG 556 7.62 mm (Noir) + SG 556 7.62 mm (Negro) + SG 556 7.62 мм (черный) + SG 556 7,62 mm (czarny) - TODO: Mk-I EMR 7.62 mm (Khaki) - TODO: Mk-I EMR 7.62 mm (Khaki) - Mk-l EMR 7.62 mm (Kaki) - TODO: Mk-I EMR 7.62 mm (Caqui) - TODO: Mk-I EMR 7.62 мм (хаки) + SG 556 7.62 mm (Khaki) + SG 556 7.62 mm (Khaki) + SG 556 7.62 mm (Kaki) + SG 556 7.62 mm (Caqui) + SG 556 7.62 мм (хаки) + SG 556 7,62 mm (khaki) - TODO: Mk-I EMR 7.62 mm (Sand) - TODO: Mk-I EMR 7.62 mm (Sand) - Mk-l EMR 7.62 mm (Beige) - TODO: Mk-I EMR 7.62 mm (Arena) - TODO: Mk-I EMR 7.62 мм (песочный) + SG 556 7.62 mm (Sand) + SG 556 7.62 mm (Sand) + SG 556 7.62 mm (Beige) + SG 556 7.62 mm (Arena) + SG 556 7.62 мм (песочный) + SG 556 7,62 mm (piaskowy) - TODO: Mk-I EMR 7.62 mm (Camo) - TODO: Mk-I EMR 7.62 mm (Camo) - Mk-l EMR 7.62 mm (Camo) - TODO: Mk-I EMR 7.62 mm (Camuflaje) - TODO: Mk-I EMR 7.62 мм (камо) + SG 556 7.62 mm (Camo) + SG 556 7.62 mm (Camo) + SG 556 7.62 mm (Camo) + SG 556 7.62 mm (Camuflaje) + SG 556 7.62 мм (камо) + SG 556 7,62 mm (kamuflaż) - TODO: Mk-I EMR 7.62 mm (Woodland) - TODO: Mk-I EMR 7.62 mm (Woodland) - Mk-l EMR 7.62 mm (Woodland) - TODO: Mk-I EMR 7.62 mm (Bosque) - TODO: Mk-I EMR 7.62 мм (лесной) + SG 556 7.62 mm (Woodland) + SG 556 7.62 mm (Woodland) + SG 556 7.62 mm (Woodland) + SG 556 7.62 mm (Bosque) + SG 556 7.62 мм (лесной) + SG 556 7,62 mm (leśny) - TODO: NATO DMR (provisional) spotter - TODO: NATO DMR (provisional) spotter - NATO DMR (provisoire) observateur - TODO: NATO DMR (provisional) observador - TODO: NATO DMR (provisional) корректировщик + SG 556 7.62 mm (provisional) spotter + SG 556 7.62 mm (provisional) spotter + SG 556 7.62 mm (provisoire) Observateur + SG 556 7.62 mm (provisional) observador + SG 556 7.62 мм (provisional) корректировщик + SG 556 7,62 mm (prowizoryczny) obserwator TODO: ASP-1 Kir 12.7 mm @@ -1608,25 +1615,28 @@ TODO: Cyrus 9.3 мм (бронза) - TODO: Mk14 7.62 mm - TODO: Mk14 7.62 mm - Mk 14 7.62 mm - TODO: Mk14 7.62 mm - TODO: Mk14 7.62 мм + M14 7.62 mm + M14 7.62 mm + M14 7.62 mm + M14 7.62 mm + M14 7.62 мм + M14 7,62 mm - TODO: Mk14 7.62 mm (Camo) - TODO: Mk14 7.62 mm (Camo) - Mk 14 7.62 mm (Camo) - TODO: Mk14 7.62 mm (Camuflaje) - TODO: Mk14 7.62 мм (камо) + M14 7.62 mm (Camo) + M14 7.62 mm (Camo) + M14 7.62 mm (Camo) + M14 7.62 mm (Camuflaje) + M14 7.62 мм (Камо) + M14 7,62 mm (kamuflaż) - TODO: Mk14 7.62 mm (Olive) - TODO: Mk14 7.62 mm (Olive) - Mk 14 7.62 mm (Olive) - TODO: Mk14 7.62 mm (Oliva) - TODO: Mk14 7.62 мм (олива) + M14 7.62 mm (Olive) + M14 7.62 mm (Olive) + M14 7.62 mm (Olive) + M14 7.62 mm (Oliva) + M14 7.62 мм (Олива) + M14 7,62 mm (oliwkowy) TODO: Navid 9.3 mm @@ -1650,32 +1660,36 @@ TODO: Navid 9.3 мм (бронза) - TODO: SPMG .338 - TODO: SPMG .338 - SPMG .338 - TODO: SPMG .338 - TODO: SPMG .338 + LWMMG .338 + LWMMG .338 + LWMMG .338 + LWMMG .338 + LWMMG .338 + LWMMG .338 - TODO: SPMG .338 (MTP) - TODO: SPMG .338 (MTP) - SPMG .338 (MTP) - TODO: SPMG .338 (MTP) - TODO: SPMG .338 (MTP) + LWMMG .338 (MTP) + LWMMG .338 (MTP) + LWMMG .338 (MTP) + LWMMG .338 (MTP) + LWMMG .338 (MTP) + LWMMG .338 (MTP) - TODO: SPMG .338 (Black) - TODO: SPMG .338 (Black) - SPMG .338 (Noir) - TODO: SPMG .338 (Negro) - TODO: SPMG .338 (черный) + LWMMG .338 (Black) + LWMMG .338 (Black) + LWMMG .338 (Noir) + LWMMG .338 (Negro) + LWMMG .338 (Черный) + LWMMG .338 (czarny) - TODO: SPMG .338 (Sand) - TODO: SPMG .338 (Sand) + LWMMG .338 (Sand) + LWMMG .338 (Sand) SPMG .338 (Beige) - TODO: SPMG .338 (Arena) - TODO: SPMG .338 (песочный) + LWMMG .338 (Arena) + LWMMG .338 (Песочный) + LWMMG .338 (piaskowy) - \ No newline at end of file + diff --git a/addons/reload/CfgActions.hpp b/addons/reload/CfgActions.hpp index bdef8adf28..a76be64ba3 100644 --- a/addons/reload/CfgActions.hpp +++ b/addons/reload/CfgActions.hpp @@ -1,4 +1,3 @@ - class CfgActions { class LoadMagazine; class LoadEmptyMagazine : LoadMagazine { diff --git a/addons/reload/CfgEventHandlers.hpp b/addons/reload/CfgEventHandlers.hpp index c93f74e0bd..75c2280e24 100644 --- a/addons/reload/CfgEventHandlers.hpp +++ b/addons/reload/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/reload/CfgVehicles.hpp b/addons/reload/CfgVehicles.hpp index 84333a1a09..b6bd212015 100644 --- a/addons/reload/CfgVehicles.hpp +++ b/addons/reload/CfgVehicles.hpp @@ -3,13 +3,13 @@ class CfgVehicles { class CAManBase: Man { class ACE_Actions { class ACE_Weapon { - class ACE_LinkBelt { + class GVAR(LinkBelt) { displayName = "$STR_ACE_Reload_LinkBelt"; distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canLinkBelt)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(startLinkingBelt)); }; - class ACE_CheckAmmo { + class GVAR(CheckAmmo) { displayName = "$STR_ACE_Reload_checkAmmo"; distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo)); @@ -23,7 +23,7 @@ class CfgVehicles { class StaticWeapon: LandVehicle { class ACE_Actions { class ACE_MainActions { - class ACE_CheckAmmo { + class GVAR(CheckAmmo) { displayName = "$STR_ACE_Reload_checkAmmo"; distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo)); diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index faefbe449d..422ea183d3 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -7,10 +7,9 @@ if !(hasInterface) exitWith {}; ["ACE3", QGVAR(checkAmmo), localize "STR_ACE_Reload_checkAmmo", { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, (vehicle ACE_player), ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) || - {(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false}; + if !([ACE_player] call EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; // Statement [ACE_player] call FUNC(checkAmmo); diff --git a/addons/reload/functions/fnc_canCheckAmmo.sqf b/addons/reload/functions/fnc_canCheckAmmo.sqf index 4075e7a151..95ac2582a2 100644 --- a/addons/reload/functions/fnc_canCheckAmmo.sqf +++ b/addons/reload/functions/fnc_canCheckAmmo.sqf @@ -7,7 +7,12 @@ * 1: Target * * Return value: - * Can link belt + * Can link belt + * + * Example: + * [player, bob] call ace_reload_fnc_canCheckAmmo + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index a1001890cd..2499a9a893 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -33,8 +33,6 @@ if (count _this > 1) then { if (_unit == _target) then { _unit playActionNow "Gear"; -} else { - _unit playActionNow "PutDown"; }; [FUNC(displayAmmo), [_target], 1, 0.1] call EFUNC(common,waitAndExecute); diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index 06f3a39da3..ce08fbd062 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -14,7 +14,7 @@ EXPLODE_1_PVT(_this,_target); -private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture", "_a", "_string"]; +private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture","_ammoBarsStructuredText", "_a", "_loadedName", "_string"]; _weapon = currentWeapon _target; _muzzle = currentMuzzle _target; @@ -22,23 +22,23 @@ _magazine = currentMagazine _target; // currentWeapon returns "" for static weapons before they are shot once if (_target isKindOf "StaticWeapon") then { - if (_weapon == "") then { - if (count (weapons _target) == 1) then { - _weapon = (weapons _target) select 0; - _muzzle = _weapon; - }; - }; - - if (_magazine == "") then { - // Try to get magazine using magazinesAmmoFull - private ["_magazines"]; - _magazines = magazinesAmmoFull _target; - { - if (_x select 2) exitWith { - _magazine = _x select 0; + if (_weapon == "") then { + if (count (weapons _target) == 1) then { + _weapon = (weapons _target) select 0; + _muzzle = _weapon; }; - } forEach _magazines; - }; + }; + + if (_magazine == "") then { + // Try to get magazine using magazinesAmmoFull + private ["_magazines"]; + _magazines = magazinesAmmoFull _target; + { + if (_x select 2) exitWith { + _magazine = _x select 0; + }; + } forEach _magazines; + }; }; if (_magazine == "") exitWith {}; @@ -52,55 +52,56 @@ _count = 0; // not grenade launcher if (_muzzle == _weapon) then { - _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count") max 1; + _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count") max 1; - _ammo = _target ammo _weapon; - if (_maxRounds >= COUNT_BARS) then { - _count = round (COUNT_BARS * _ammo / _maxRounds); + _ammo = _target ammo _weapon; + if (_maxRounds >= COUNT_BARS) then { + _count = round (COUNT_BARS * _ammo / _maxRounds); - if (_ammo > 0) then {_count = _count max 1}; - if (_ammo < _maxRounds) then {_count = _count min (COUNT_BARS - 1)}; - } else { - _count = _ammo; - }; + if (_ammo > 0) then {_count = _count max 1}; + if (_ammo < _maxRounds) then {_count = _count min (COUNT_BARS - 1)}; + } else { + _count = _ammo; + }; -// grenade launcher + // grenade launcher } else { - _showNumber = true; + _showNumber = true; - _count = if (_magazine != "") then { - {_x == _magazine} count (magazines _target + [_magazine]) - } else { - {_x in getArray (configFile >> "CfgWeapons" >> _weapon >> _muzzle >> "Magazines")} count magazines _target - }; + _count = if (_magazine != "") then { + {_x == _magazine} count (magazines _target + [_magazine]) + } else { + {_x in getArray (configFile >> "CfgWeapons" >> _weapon >> _muzzle >> "Magazines")} count magazines _target + }; }; -_text = if (_showNumber) then { - parseText format ["%1x", _count] +_ammoBarsStructuredText = if (_showNumber) then { + parseText format ["%1x", _count] } else { - _color = [ - 2 * (1 - _ammo / _maxRounds) min 1, - 2 * _ammo / _maxRounds min 1, - 00 - ]; + _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0]; - _string = ""; - for "_a" from 1 to _count do { - _string = _string + "|"; - }; - _text = [_string, _color] call EFUNC(common,stringToColoredText); + _string = ""; + for "_a" from 1 to _count do { + _string = _string + "|"; + }; + _text = [_string, _color] call EFUNC(common,stringToColoredText); - _string = ""; - for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { - _string = _string + "|"; - }; + _string = ""; + for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { + _string = _string + "|"; + }; - composeText [ - _text, - [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) - ] + composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)]; }; -_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); -[_text, _picture] call EFUNC(common,displayTextPicture); +if (_target isKindOf "StaticWeapon") then { + //Vehicle mags (usualy) don't have pictures, so just show the text above ammo count + _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort"); + _loadedName = parseText format ["%1", _loadedName]; + _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText]; + [_text] call EFUNC(common,displayTextStructured); +} else { + _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); + [_ammoBarsStructuredText, _picture] call EFUNC(common,displayTextPicture); +}; diff --git a/addons/weather/CfgEventhandlers.hpp b/addons/weather/CfgEventhandlers.hpp index c3f1f2ba0b..842ad8e7bf 100644 --- a/addons/weather/CfgEventhandlers.hpp +++ b/addons/weather/CfgEventhandlers.hpp @@ -1,6 +1,5 @@ class Extended_PreInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit)); init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; diff --git a/addons/weather/CfgWorlds.hpp b/addons/weather/CfgWorlds.hpp index ed932654f7..1391468fd9 100644 --- a/addons/weather/CfgWorlds.hpp +++ b/addons/weather/CfgWorlds.hpp @@ -7,6 +7,22 @@ class CfgWorlds { ACE_TempNight[] = {4, 4, 6, 8, 13, 17, 20, 20, 16, 12, 8, 6}; // Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Limnos,Greece ACE_Humidity[] = {78, 77, 78, 74, 71, 60, 59, 61, 65, 72, 79, 80}; + // Source: https://weatherspark.com/averages/32194/Lemnos-Limnos-North-Aegean-Islands-Greece + ACE_WindSpeedMax[] = {{8.8, 5.5}, {8.8, 5}, {8.6, 4.8}, {7.6, 3.4}, {7.0, 3.0}, {7.1, 3.0}, {7.5, 3.1}, {8.0, 3.2}, {7.6, 3.5}, {7.8, 4.6}, {7.9, 5.0}, {8.2, 5.5}}; + ACE_WindSpeedMean[] = {4.8, 4.9, 4.6, 4.1, 3.5, 3.5, 4.3, 4.4, 4.1, 4.5, 4.5, 5.0}; + ACE_WindSpeedMin[] = {{0.2, 5.0}, {0.1, 5.0}, {0.2, 4.3}, {0.0, 3.0}, {0.0, 2.1}, {0.0, 2.0}, {0.1, 3.1}, {0.3, 3.1}, {0.0, 3.6}, {0.0, 4.2}, {0.1, 5.0}, {0.2, 5.5}}; + ACE_WindDirectionProbabilities[] = {{0.06, 0.32, 0.05, 0.04, 0.15, 0.06, 0.02, 0.02}, // January + {0.08, 0.32, 0.04, 0.04, 0.18, 0.06, 0.02, 0.02}, // February + {0.09, 0.30, 0.04, 0.04, 0.20, 0.06, 0.02, 0.03}, // March + {0.10, 0.25, 0.03, 0.04, 0.22, 0.06, 0.02, 0.04}, // April + {0.18, 0.25, 0.03, 0.04, 0.18, 0.04, 0.01, 0.05}, // May + {0.25, 0.25, 0.03, 0.03, 0.15, 0.03, 0.00, 0.08}, // June + {0.32, 0.30, 0.02, 0.02, 0.10, 0.01, 0.00, 0.09}, // July + {0.28, 0.35, 0.02, 0.01, 0.08, 0.01, 0.00, 0.08}, // August + {0.20, 0.37, 0.03, 0.01, 0.11, 0.01, 0.01, 0.05}, // September + {0.10, 0.39, 0.04, 0.02, 0.15, 0.02, 0.01, 0.03}, // October + {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November + {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December }; class Altis: CAWorld { @@ -15,5 +31,21 @@ class CfgWorlds { ACE_TempNight[] = {4, 4, 6, 8, 13, 17, 20, 20, 16, 12, 8, 6}; // Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Limnos,Greece ACE_Humidity[] = {78, 77, 78, 74, 71, 60, 59, 61, 65, 72, 79, 80}; + // Source: https://weatherspark.com/averages/32194/Lemnos-Limnos-North-Aegean-Islands-Greece + ACE_WindSpeedMax[] = {{8.8, 5.5}, {8.8, 5}, {8.6, 4.8}, {7.6, 3.4}, {7.0, 3.0}, {7.1, 3.0}, {7.5, 3.1}, {8.0, 3.2}, {7.6, 3.5}, {7.8, 4.6}, {7.9, 5.0}, {8.2, 5.5}}; + ACE_WindSpeedMean[] = {4.8, 4.9, 4.6, 4.1, 3.5, 3.5, 4.3, 4.4, 4.1, 4.5, 4.5, 5.0}; + ACE_WindSpeedMin[] = {{0.2, 5.0}, {0.1, 5.0}, {0.2, 4.3}, {0.0, 3.0}, {0.0, 2.1}, {0.0, 2.0}, {0.1, 3.1}, {0.3, 3.1}, {0.0, 3.6}, {0.0, 4.2}, {0.1, 5.0}, {0.2, 5.5}}; + ACE_WindDirectionProbabilities[] = {{0.06, 0.32, 0.05, 0.04, 0.15, 0.06, 0.02, 0.02}, // January + {0.08, 0.32, 0.04, 0.04, 0.18, 0.06, 0.02, 0.02}, // February + {0.09, 0.30, 0.04, 0.04, 0.20, 0.06, 0.02, 0.03}, // March + {0.10, 0.25, 0.03, 0.04, 0.22, 0.06, 0.02, 0.04}, // April + {0.18, 0.25, 0.03, 0.04, 0.18, 0.04, 0.01, 0.05}, // May + {0.25, 0.25, 0.03, 0.03, 0.15, 0.03, 0.00, 0.08}, // June + {0.32, 0.30, 0.02, 0.02, 0.10, 0.01, 0.00, 0.09}, // July + {0.28, 0.35, 0.02, 0.01, 0.08, 0.01, 0.00, 0.08}, // August + {0.20, 0.37, 0.03, 0.01, 0.11, 0.01, 0.01, 0.05}, // September + {0.10, 0.39, 0.04, 0.02, 0.15, 0.02, 0.01, 0.03}, // October + {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November + {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December }; -}; +}; \ No newline at end of file diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index e40a061aaf..1427ff59b1 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -1,43 +1,27 @@ #include "script_component.hpp" -// Rain variables -GVAR(enableRain) = true; -GVAR(rain_next_period) = -1; -GVAR(rain_period_count) = 0; -GVAR(rain_initial_rain) = 0; -if(overcast >= 0.7) then { - GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3)); -}; -GVAR(current_rain) = GVAR(rain_initial_rain); -GVAR(rain_current_range) = -1+(random 2); -GVAR(overcast_multiplier) = 1; +// Randomization +GVAR(temperatureShift) = 3 - random 6; +GVAR(badWeatherShift) = (random 1) ^ 2 * 10; +GVAR(humidityShift) = (5 - random 10) / 100; -// Wind Variables -ACE_wind = [0, 0, 0]; -GVAR(wind_initial_dir) = (random 360); -GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1; -GVAR(wind_mean_speed) = GVAR(wind_initial_speed); -GVAR(wind_mean_dir) = GVAR(wind_initial_dir); -GVAR(wind_current_speed) = GVAR(wind_initial_speed); -GVAR(wind_current_dir) = GVAR(wind_initial_dir); -GVAR(wind_current_range_speed) = -1+(random 2); -GVAR(wind_current_range_dir) = -1+(random 2); -GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10)); -GVAR(wind_next_major_period) = -1; -GVAR(wind_period_count) = 0; -GVAR(wind_major_period_count) = 0; -GVAR(wind_total_time) = 0; GVAR(wind_period_start_time) = time; - -call FUNC(getMapData); +GVAR(rain_period_start_time) = time; "ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = time; }; "ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = time; }; "ACE_MISC_PARAMS" addPublicVariableEventHandler { - if !(isServer) then { - 30 setLightnings (ACE_MISC_PARAMS select 0); - 30 setRainbow (ACE_MISC_PARAMS select 1); - 30 setFog (ACE_MISC_PARAMS select 2); + if (!isServer) then { + if (GVAR(syncMisc)) then { + 30 setLightnings (ACE_MISC_PARAMS select 0); + 30 setRainbow (ACE_MISC_PARAMS select 1); + 30 setFog (ACE_MISC_PARAMS select 2); + }; + GVAR(temperatureShift) = (ACE_MISC_PARAMS select 3); + GVAR(badWeatherShift) = (ACE_MISC_PARAMS select 4); + GVAR(humidityShift) = (ACE_MISC_PARAMS select 5); + call FUNC(updateTemperature); + call FUNC(updateHumidity); }; }; diff --git a/addons/weather/XEH_postServerInit.sqf b/addons/weather/XEH_postServerInit.sqf index cfe35e6009..076b538806 100644 --- a/addons/weather/XEH_postServerInit.sqf +++ b/addons/weather/XEH_postServerInit.sqf @@ -1,3 +1,15 @@ #include "script_component.hpp" -[FUNC(serverController), 60] call cba_fnc_addPerFrameHandler; +// Rain +GVAR(rain_next_period) = -1; +GVAR(rain_period_count) = 0; +GVAR(current_rain) = 0; +GVAR(rain_current_range) = -1+(random 2); + +// Wind +call FUNC(initWind); + +GVAR(overcast_multiplier) = 1; +GVAR(serverUpdateInterval) = 60; + +[FUNC(serverController), GVAR(serverUpdateInterval)] call cba_fnc_addPerFrameHandler; diff --git a/addons/weather/XEH_preClientInit.sqf b/addons/weather/XEH_preClientInit.sqf deleted file mode 100644 index b979521cdd..0000000000 --- a/addons/weather/XEH_preClientInit.sqf +++ /dev/null @@ -1,17 +0,0 @@ -#include "script_component.hpp" - - -FUNC(KEEPTIME) = { - if((count GVAR(WINDSPEED)) > 0) then { - private ["_wind", "_p", "_str"]; - _wind = ACE_wind; - - _p = _wind call CBA_fnc_vect2polar; - _str = format["Wind: %1 at %2m/s (%3MPH)\n%4", floor(_p select 1), floor(_p select 0), floor((_p select 0)*2.23693629), GVAR(WINDSPEED)]; - TRACE_2("Wind",_wind,_str); - }; -}; - -#ifdef DEBUG_MODE_FULL - [FUNC(KEEPTIME), 0.0, []] call CBA_fnc_addPerFrameHandler; -#endif diff --git a/addons/weather/XEH_preInit.sqf b/addons/weather/XEH_preInit.sqf index ee05983a69..401ae155c1 100644 --- a/addons/weather/XEH_preInit.sqf +++ b/addons/weather/XEH_preInit.sqf @@ -8,10 +8,22 @@ PREP(calculateBarometricPressure); PREP(displayWindInfo); PREP(getMapData); PREP(getWind); +PREP(initWind); PREP(serverController); PREP(updateHumidity); PREP(updateRain); PREP(updateTemperature); PREP(updateWind); +// Control server side weather propagation +GVAR(enableServerController) = true; + +// Control client side weather effects +GVAR(syncRain) = true; +GVAR(syncWind) = true; // Wind, Gusts, Waves +GVAR(syncMisc) = true; // Lightnings, Rainbow, Fog + +// Make sure this data is read before client/server postInit +call FUNC(getMapData); + ADDON = true; diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 58d728bf67..7996503719 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -28,7 +28,7 @@ EGVAR(advanced_ballistics,Protractor) = false; GVAR(WindInfo) = true; [{ - private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor", "_newWindSpeed", "_windSource", "_height"]; + private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor"]; if !(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player) exitWith { GVAR(WindInfo) = false; diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index cb0a961c21..f2527d1157 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -35,6 +35,32 @@ if (worldName in ["Thirsk"]) then { GVAR(Latitude) = 65; GVAR(Altitude) = 0; }; if (worldName in ["lingor"]) then { GVAR(Latitude) = -4; GVAR(Altitude) = 0; }; if (worldName in ["Panthera3"]) then { GVAR(Latitude) = 46; GVAR(Altitude) = 0; }; +// Assume default wind values +// Source: https://weatherspark.com/averages/32194/Lemnos-Limnos-North-Aegean-Islands-Greece +GVAR(WindSpeedMax) = [[8.8, 5.5], [8.8, 5], [8.6, 4.8], [7.6, 3.4], [7.0, 3.0], [7.1, 3.0], [7.5, 3.1], [8.0, 3.2], [7.6, 3.5], [7.8, 4.6], [7.9, 5.0], [8.2, 5.5]]; +GVAR(WindSpeedMean) = [4.8, 4.9, 4.6, 4.1, 3.5, 3.5, 4.3, 4.4, 4.1, 4.5, 4.5, 5.0]; +GVAR(WindSpeedMin) = [[0.2, 5.0], [0.1, 5.0], [0.2, 4.3], [0.0, 3.0], [0.0, 2.1], [0.0, 2.0], [0.1, 3.1], [0.3, 3.1], [0.0, 3.6], [0.0, 4.2], [0.1, 5.0], [0.2, 5.5]]; +GVAR(WindDirectionProbabilities) = [[0.06, 0.32, 0.05, 0.04, 0.15, 0.06, 0.02, 0.02], // January + [0.08, 0.32, 0.04, 0.04, 0.18, 0.06, 0.02, 0.02], // February + [0.09, 0.30, 0.04, 0.04, 0.20, 0.06, 0.02, 0.03], // March + [0.10, 0.25, 0.03, 0.04, 0.22, 0.06, 0.02, 0.04], // April + [0.18, 0.25, 0.03, 0.04, 0.18, 0.04, 0.01, 0.05], // May + [0.25, 0.25, 0.03, 0.03, 0.15, 0.03, 0.00, 0.08], // June + [0.32, 0.30, 0.02, 0.02, 0.10, 0.01, 0.00, 0.09], // July + [0.28, 0.35, 0.02, 0.01, 0.08, 0.01, 0.00, 0.08], // August + [0.20, 0.37, 0.03, 0.01, 0.11, 0.01, 0.01, 0.05], // September + [0.10, 0.39, 0.04, 0.02, 0.15, 0.02, 0.01, 0.03], // October + [0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02], // November + [0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02]];// December + +// Check if the wind data is defined in the map config +if (isArray (configFile >> "CfgWorlds" >> worldName >> "ACE_WindSpeedMean")) then { + GVAR(WindSpeedMin) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_WindSpeedMin"); + GVAR(WindSpeedMean) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_WindSpeedMean"); + GVAR(WindSpeedMax) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_WindSpeedMax"); + GVAR(WindDirectionProbabilities) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_WindDirectionProbabilities"); +}; + // Check if the weather data is defined in the map config if (isArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay")) exitWith { GVAR(TempDay) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay"); @@ -112,4 +138,4 @@ GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2]; GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82]; GVAR(currentTemperature) = 20; -GVAR(currentHumidity) = 0.5; +GVAR(currentHumidity) = 0.5; \ No newline at end of file diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index 54ec6efad3..a23394e992 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -1,5 +1,5 @@ /* - * Author: ACE2 Team + * Author: ACE2 Team, Ruthberg * * Calculate current wind locally from the data broadcasted by the server * @@ -10,25 +10,25 @@ * Wind */ #include "script_component.hpp" -private ["_dir","_dirInc","_dirRange","_period","_periodPercent","_periodPosition","_return","_spd","_spdInc","_spdRange"]; -_return = [0,0,0]; -if(!isNil "ACE_WIND_PARAMS") then { - _dir = ACE_WIND_PARAMS select 0; - _dirRange = (ACE_WIND_PARAMS select 1) - (ACE_WIND_PARAMS select 0); - _spd = ACE_WIND_PARAMS select 2; - _spdRange = (ACE_WIND_PARAMS select 3) - (ACE_WIND_PARAMS select 2); - _period = ACE_WIND_PARAMS select 4; +if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] }; - _periodPosition = (time - GVAR(wind_period_start_time)) min _period; - _periodPercent = _periodPosition/_period; - _spdInc = _spdRange * _periodPercent; - _dirInc = _dirRange * _periodPercent; - _spd = (_spd + _spdInc); - _dir = _dir + _dirInc; - if (_dir > 360) then {_dir = _dir - 360}; - if (_dir < 0) then {_dir = _dir + 360}; +EXPLODE_5_PVT(ACE_WIND_PARAMS,_dir,_dirChange,_spd,_spdChange,_period); - _return = [_spd * sin _dir, _spd * cos _dir, 0]; -}; -_return; \ No newline at end of file +private ["_periodPercent", "_periodPosition"]; +_periodPosition = (time - GVAR(wind_period_start_time)) min _period; +_periodPercent = _periodPosition / _period; + +_spd = _spd + _spdChange * _periodPercent; +_dir = _dir + _dirChange * _periodPercent; + +_dir = (360 + _dir) % 360; + +TRACE_1("PeriodStartTime",Round(GVAR(wind_period_start_time))); +TRACE_2("Dir: Current/Change",Round(_dir),Round(_dirChange)); +TRACE_2("Spd: Current/Change",Round(_spd * 10) / 10,Round(_spdChange * 10) / 10); +TRACE_3("Period/Position/Percent",Round(_period),Round(_periodPosition),Round(_periodPercent * 100) / 100); + +// TODO: Add some deterministic noise + +[-_spd * sin(_dir), -_spd * cos(_dir), 0] diff --git a/addons/weather/functions/fnc_initWind.sqf b/addons/weather/functions/fnc_initWind.sqf new file mode 100644 index 0000000000..10b22efa2a --- /dev/null +++ b/addons/weather/functions/fnc_initWind.sqf @@ -0,0 +1,58 @@ +/* + * Author: Ruthberg + * + * Inits the wind variables on mission start + * + * Argument: + * None + * + * Return value: + * None + */ +#include "script_component.hpp" + +private ["_sum", "_rand", "_csum", "_index", "_month", "_windDirectionProbabilities"]; +_month = date select 1; +_windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1); + +ACE_wind = [0, 0, 0]; + +GVAR(wind_direction_reference) = random 360; +_sum = 0; +for "_i" from 0 to 7 do { + _sum = _sum + (_windDirectionProbabilities select _i); +}; +_rand = random _sum; +_csum = [0, 0, 0, 0, 0, 0, 0, 0]; +for "_i" from 0 to 7 do { + for "_j" from 0 to _i do { + _csum set [_i, (_csum select _i) + (_windDirectionProbabilities select _j)]; + }; +}; +_index = 0; +for "_i" from 0 to 7 do { + if (_rand > (_csum select _i)) then { + _index = _index + 1; + }; +}; +GVAR(wind_direction_reference) = 45 * _index; + +GVAR(wind_mean_dir) = GVAR(wind_direction_reference); +GVAR(wind_direction_reference) = GVAR(wind_direction_reference) + (random 22.5) - (random 22.5); +GVAR(wind_direction_reference) = (360 + GVAR(wind_direction_reference)) % 360; + +GVAR(min_wind_speed) = GVAR(WindSpeedMin) select (_month - 1); +GVAR(min_wind_speed) = (GVAR(min_wind_speed) select 0) + (random (GVAR(min_wind_speed) select 1)) - (random (GVAR(min_wind_speed) select 1)); +GVAR(min_wind_speed) = 0 max GVAR(min_wind_speed); +GVAR(mean_wind_speed) = GVAR(WindSpeedMean) select (_month - 1); +GVAR(max_wind_speed) = GVAR(WindSpeedMax) select (_month - 1); +GVAR(max_wind_speed) = (GVAR(max_wind_speed) select 0) + (random (GVAR(max_wind_speed) select 1)) - (random (GVAR(max_wind_speed) select 1)); +GVAR(max_wind_speed) = 0 max GVAR(max_wind_speed); + +GVAR(current_wind_direction) = GVAR(wind_direction_reference); +GVAR(current_wind_speed) = GVAR(min_wind_speed) + (GVAR(max_wind_speed) - GVAR(min_wind_speed)) * (random 1); + +GVAR(wind_period_count) = 0; +GVAR(wind_next_period) = -1; + +GVAR(wind_speed_debug_output) = []; diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index d7dff0eb70..a9ceca3815 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -1,7 +1,7 @@ /* - * Author: ACE2 Team, esteldunedain + * Author: ACE2 Team, esteldunedain, ruthberg * - * Calculate the wind and rain evolution on the server. Broadcast the current and next values to the clients + * Calculate the wind and rain evolution on the server. Broadcasts the current and next values to the clients * * Argument: * None @@ -10,90 +10,98 @@ * None */ #include "script_component.hpp" -private ["_gustCount","_gustDir","_gustSpeed","_gustTime","_gusts","_i","_lastRain","_maxInterval","_rainOverCast","_startDir","_startSpeed","_time","_timeTillGust","_transitionTime"]; + +if (!GVAR(enableServerController)) exitWith {}; + +private ["_lastRain", "_rainOverCast", "_transitionTime", "_windDirectionVariance", "_windSpeed", "_windSpeedChange", "_windMaxDiff", "_windMinDiff", "_windDirection", "_windDirectionChange", "_ratioMin", "_ratioMax"]; // Rain simulation -if(GVAR(rain_period_count) > GVAR(rain_next_period)) then { +if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then { - if(overcast >= 0.7) then { - _lastRain = GVAR(current_rain); - _rainOverCast = ((overcast-0.7)/0.3); - GVAR(rain_next_period) = ceil((1+random(10))/GVAR(overcast_multiplier)); - - GVAR(current_rain) = (GVAR(current_rain)+(((GVAR(current_rain)))*((_rainOverCast*(GVAR(overcast_multiplier)))/8)*GVAR(rain_current_range))); - GVAR(current_rain) = (GVAR(current_rain) max 0.01) min 1; - - _transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20))+1; - GVAR(rain_current_range) = -1+(random 2); - - ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; - TRACE_4("",_lastRain,_rainOverCast,_transitionTime, overcast); + GVAR(rain_next_period) = ceil((1 + (random 10)) / GVAR(overcast_multiplier)); + GVAR(rain_period_count) = 0; + + _lastRain = GVAR(current_rain); + + if (overcast >= 0.7) then { + _rainOverCast = (overcast - 0.7) / 0.3; + if (GVAR(current_rain) == 0) then { + // Initialize rain with a random strength depending on the current overcast value + GVAR(current_rain) = 0.25 + (random 0.25) + (random 0.5) * _rainOverCast; + }; + + GVAR(current_rain) = GVAR(current_rain) + GVAR(current_rain) * ((_rainOverCast * GVAR(overcast_multiplier)) / 8) * GVAR(rain_current_range); + GVAR(current_rain) = 0.01 max GVAR(current_rain) min 1; + + GVAR(rain_current_range) = -1 + (random 2); } else { - GVAR(current_rain) = 0; - _lastRain = GVAR(current_rain); _rainOverCast = 1; - _transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20))+1; - - ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; - TRACE_4("",_lastRain,_rainOverCast,_transitionTime, overcast); + + GVAR(current_rain) = 0; }; + + _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20)); + + ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; + TRACE_4("",_lastRain,_rainOverCast,_transitionTime,overcast); GVAR(rain_period_start_time) = time; publicVariable "ACE_RAIN_PARAMS"; }; // Wind simulation -if(GVAR(wind_period_count) > GVAR(wind_next_period)) then { - _startDir = GVAR(wind_current_dir); - _startSpeed = GVAR(wind_current_speed); - GVAR(wind_current_dir) = (GVAR(wind_current_dir)+(((GVAR(wind_current_dir)))*((overcast*(GVAR(overcast_multiplier)))/8)*GVAR(wind_current_range_dir))); - - GVAR(wind_current_speed) = (GVAR(wind_current_speed)+(((GVAR(wind_current_speed)))*(overcast*(GVAR(overcast_multiplier))/12)*GVAR(wind_current_range_speed))); - GVAR(wind_current_speed) = GVAR(wind_current_speed) max 0.01; - - if(GVAR(wind_current_dir) < 0) then { - GVAR(wind_current_dir) = GVAR(wind_current_dir)+360; - }; - GVAR(wind_current_dir) = GVAR(wind_current_dir) % 360; - - GVAR(wind_current_range_speed) = (-1)+(random 2); - - GVAR(wind_current_range_dir) = (-1)+(random 2); - - GVAR(wind_next_period) = ceil((2+random(5))/(GVAR(overcast_multiplier))); +if (GVAR(syncWind) && GVAR(wind_period_count) > GVAR(wind_next_period)) then { + + GVAR(wind_next_period) = ceil((2 + (random 5)) / GVAR(overcast_multiplier)); GVAR(wind_period_count) = 0; - - _gustCount = floor(random(GVAR(wind_next_period)*(overcast*((GVAR(overcast_multiplier)^3))))); - - _time = GVAR(wind_next_period)*60; - _gusts = []; - if(_gustCount > 0) then { - _maxInterval = _time/_gustCount; - for "_i" from 0 to _gustCount-1 do { - _gustTime = (random (3 min _maxInterval)); - _timeTillGust = (_maxInterval*_i)+(random (_maxInterval - _gustTime)); - _gustSpeed = (random 1); - _gustDir = (GVAR(wind_current_dir)+(GVAR(wind_current_dir)*(-1+(random 2))))*(overcast*(GVAR(overcast_multiplier))); - _gusts set[(count _gusts), [_timeTillGust, _gustTime, _gustSpeed, _gustDir]]; - }; + + _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2); + _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; + _windDirectionChange = _windDirection - GVAR(current_wind_direction); + if (_windDirectionChange > 180) then { + _windDirectionChange = _windDirectionChange - 360; }; - - GVAR(wind_total_time) = GVAR(wind_total_time) + GVAR(wind_next_period); - - ACE_WIND_PARAMS = [_startDir, - GVAR(wind_current_dir), - _startSpeed, - GVAR(wind_current_speed), - _time, - _gusts]; - + if (_windDirectionChange < -180) then { + _windDirectionChange = 360 + _windDirectionChange; + }; + + _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed); + _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed); + + _ratioMax = (random 1) ^ 2; + _ratioMin = (random 1) ^ 2; + + _windSpeed = GVAR(current_wind_speed); + _windSpeedChange = 0; + if ((random 1) < (0.3 max overcast)) then { + _windSpeed = GVAR(mean_wind_speed) + _windMaxDiff * _ratioMax + _windMinDiff * _ratioMin; + _windSpeedChange = _windSpeed - GVAR(current_wind_speed); + }; + + _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval); + + TRACE_5("dirCur/dirNew/spdCur/spdNew/period",GVAR(current_wind_direction),_windDirection,GVAR(current_wind_speed),_windSpeed,_transitionTime); + + ACE_WIND_PARAMS = [GVAR(current_wind_direction), + _windDirectionChange, + GVAR(current_wind_speed), + _windSpeedChange, + _transitionTime]; + + GVAR(current_wind_direction) = _windDirection; + GVAR(current_wind_speed) = _windSpeed; + GVAR(wind_period_start_time) = time; publicVariable "ACE_WIND_PARAMS"; }; -// Sync misc. parameters -ACE_MISC_PARAMS = [lightnings, rainbow, fogParams]; -publicVariable "ACE_MISC_PARAMS"; + +if (GVAR(syncMisc)) then { + ACE_MISC_PARAMS = [lightnings, rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)]; + publicVariable "ACE_MISC_PARAMS"; +}; GVAR(rain_period_count) = GVAR(rain_period_count) + 1; -GVAR(wind_period_count) = GVAR(wind_period_count) + 1; \ No newline at end of file +GVAR(wind_period_count) = GVAR(wind_period_count) + 1; + +GVAR(overcast_multiplier) = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1) \ No newline at end of file diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf index e3ba7a0224..dce031b3f3 100644 --- a/addons/weather/functions/fnc_updateHumidity.sqf +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -23,6 +23,9 @@ if (rain > 0 && overcast > 0.7) then { _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; + GVAR(currentHumidity) = GVAR(currentHumidity) + GVAR(humidityShift); + + TRACE_1("humidityShift",GVAR(humidityShift)); }; GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1; diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf index 01e32e1734..d240093443 100644 --- a/addons/weather/functions/fnc_updateRain.sqf +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -1,5 +1,5 @@ /* - * Author: ACE2 Team + * Author: ACE2 Team, Ruthberg * * Updates rain based on ACE_RAIN_PARAMS * @@ -11,16 +11,15 @@ */ #include "script_component.hpp" -private ["_oldStrength", "_rainStrength", "_transitionTime", "_periodPosition", "_periodPercent"]; +if (!GVAR(syncRain)) exitWith {}; -if (!GVAR(enableRain)) exitWith {}; +if (!isNil "ACE_RAIN_PARAMS") then { + + EXPLODE_3_PVT(ACE_RAIN_PARAMS,_oldRain,_newRain,_period); + + private ["_periodPosition", "_periodPercent"]; + _periodPosition = (time - GVAR(rain_period_start_time)) min _period; + _periodPercent = (_periodPosition / _period) min 1; -if (!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then { - _oldStrength = ACE_RAIN_PARAMS select 0; - _rainStrength = ACE_RAIN_PARAMS select 1; - _transitionTime = ACE_RAIN_PARAMS select 2; - _periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime; - _periodPercent = (_periodPosition/_transitionTime) min 1; - - 0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength); + 0 setRain (_oldRain + (_newRain - _oldRain) * _periodPercent); }; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 5e342ad83d..870d00333c 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -18,5 +18,7 @@ _month = date select 1; _hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440)); GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef; -GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * humidity - 4 * overcast; +GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast; GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10; + +TRACE_2("temperatureShift/badWeatherShift",GVAR(temperatureShift),GVAR(badWeatherShift)); diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf index e5a52348a8..06bb57d093 100644 --- a/addons/weather/functions/fnc_updateWind.sqf +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -1,5 +1,5 @@ /* - * Author: ACE2 Team + * Author: ACE2 Team, Ruthberg * * Updates wind, gusts and waves based on ACE_wind * @@ -11,6 +11,8 @@ */ #include "script_component.hpp" +if (!GVAR(syncWind)) exitWith { ACE_wind = wind }; + ACE_wind = [] call FUNC(getWind); setWind [ACE_wind select 0, ACE_wind select 1, true]; 2 setGusts 0; @@ -18,4 +20,4 @@ setWind [ACE_wind select 0, ACE_wind select 1, true]; // Set waves: 0 when no wind, 1 when wind >= 16 m/s 1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0); -//hintSilent format["Wind: %1\nACE_wind: %2\nDeviation: %3 (m/s)", wind, ACE_wind, Round((vectorMagnitude (ACE_wind vectorDiff wind)) * 1000) / 1000]; +TRACE_3("Wind/ACE_wind/Deviation(m/s)",wind,ACE_wind,Round((vectorMagnitude (ACE_wind vectorDiff wind)) * 1000) / 1000); diff --git a/documentation/README_DE.md b/documentation/README_DE.md new file mode 100644 index 0000000000..0b5ca4d0ef --- /dev/null +++ b/documentation/README_DE.md @@ -0,0 +1,48 @@ +

+ +

+

+ + ACE version + + + ACE download + + + ACE issues + + + ACE license + +

+

Benötigt eine Aktuelle Version von CBA A3 | BIF thread

+ +**ACE3** ist ein Gemeinschaftsprojekt der sich zusammengeschlossenen Moddinggruppen von **ACE2**, **AGM** und **CSE** mit dem Ziel den Realismus und die Spieltiefe von Arma 3 zu steigern. + +Da die MOD vollkommen als **open-source** Projekt gestaltet ist, steht es jedem frei Änderungen vorzuschlagen, oder seine eigene, modifizierte Version zu erstellen, solange diese ebenfalls der Öffentlichkeit zugänglich ist und mit GNU General Public License übereinstimmt. (Weitere Informationen ist der Lizenzdatei in diesem Projekt entnehmbar) + +Die Mod ist **modular gestaltet** — beinahe jede PBO kann entfernt werden, sodass jede Gemeinschaft ihre eigene Version der Mod unterhalten kann. Dies kann zum Beispiel einige Funktionalitäten ausschließen, da das Feature nicht gewünscht ist, oder es mit einer anderen MOD in Konflikt gerät etc. .Ebenfalls können viele Einstellungen vom Missionsersteller vorgenommen werden (u.a. am medizinischem System), sodass eine individuelle Erfahrung gewährleistet wird. + +### Features +* Verbessertes medizinisches System +* Logistik System: U.a. Transport und Fahrzeugreparatur +* Sprengstoffsystem mit unterschiedlichen Zündern +* Gefangenensystem +* Reale Namen für Arma 3 Fahrzeuge und Waffen +* Realistisches, ballistisches Verhalten (Wind und Luftfeuchtigkeit) +* Simulation der Rückstrahlzone +* Ein Feuerleitsystem für gepanzerte Fahrzeuge und Hubschrauber + ***und noch viel mehr...*** + +#### Anleitungen +Du hast ACE3 installiert, hast aber keine Ahnung was und wie alles funktioniert und wo sich was befindet? [Erste Schritte](https://github.com/acemod/ACE3/blob/master/documentation/user/getting-started.md). + +#### Mitwirken +Wenn du bei der Entwicklung der MOD mithelfen möchtest, so kannst du dies tun, indem du nach Fehlern Ausschau hältst, oder neue Funktionen vorschlägst. Um etwas beizutragen, "Forke" einfach dieses Archiv (bzw. repository) und erstelle deine "Pull-Request", welche von anderen Entwicklern und Beiträgern überprüft wird. Bitte trage dich dabei in "AUTHORS.txt" mit deinem Nutzernamen und einer gütligen Email-Adresse ein. + +Um einen Fehler oder ein Feature zu melden bzw. ein bereits Bestehendes zu ändern - nutze unseren [Issue Tracker](https://github.com/acemod/ACE3/issues). + +#### Testen & MOD erstellen +Wenn du die neusten Entwicklungen erleben und uns dabei helfen möchtest bestehende Fehler zu entdecken, lade dir einfach die "Master Branch" herunter. Entweder nutzt du Git - wenn die Schritte bekannt sind - oder du lädst es dir direkt über [diesen Link] (https://github.com/acemod/ACE3/archive/master.zip) herunter. + +Wie du deine eigene Entwicklungsumgebung und eine Testversion von ACE erstellst folge [dieser Anleitung](https://github.com/acemod/ACE3/blob/master/documentation/development/setting-up-the-development-environment.md). diff --git a/documentation/feature/medical-system.md b/documentation/feature/medical-system.md new file mode 100644 index 0000000000..3d756b70c8 --- /dev/null +++ b/documentation/feature/medical-system.md @@ -0,0 +1,70 @@ +--- +layout: wiki +title: Medical System +group: feature +order: 4 +parent: wiki +--- + +## 1. Overview +ACE provide users with a more realistic medical system and comes in both a basic and advanced version. This page will detail the differences between both systems and what they do. It is split into two parts; basic and advanced. Both versions have overlap but each have their own unique characteristics. + + +## 2. Basic Medical +ACE's basic medical system is quite a bit more complex than Arma's default system, but not really difficult to grasp. ACE basic medical is a mixture between the ACE2 and AGM medical systems. + +The four main elements that basic medical introduces are: + +* damage divided into different zones (head, body, left & right arm, left & right leg) +* bleeding +* unconsciousness +* pain + +All interactions in the medical system are done with the interaction menu. Non-medics can - by default - not perform all actions, and their actions take more time as when performed by trained medics. These actions are using epinephrine and blood IVs. + + +### How it works + +When hit, units start to lose blood depending on the severity of their wounds. Once the level of blood falls below a certain threshold, the unit will fall unconscious and eventually die. Units will also fall unconscious when sustaining large amounts of damage at once. + +To stop the bleeding, the combat life saver needs to bandage every wounded limb. Unconscious units can be "woken up" with Epipens. Should a unit have lost a lot of blood, it might be necessary to replace the lost blood with a blood bag before being able to wake unconscious units up. + +Should a unit be in pain, materializing itself with a chromatic aberration screen effect, he can be given morphine. + +## 3. Advanced Medical +The advanced medical system provides a more complex and detailed medical simulation and is based off the CSE/CMS medical system. It focuses on a more realistic model for injuries and treatment, thus resulting in a more important and prominent role for combat medics, and a bigger incentive to not get shot. + +The system behind advanced medical is designed to attempt to mimic important parts of the human body, as well as react to any injuries sustained and treatments applied in a realistic manner. The available treatments and supplies in advanced medical are based off the Tactical Combat Casualty Care (TCCC) guidelines, which are the same guidelines used by real-life combat medics around the world. + +Besides the 4 elements introduced by basic medical, advanced introduces the following: + +* More detailed wound system +* Accurate blood loss based upon sustained injuries +* Vitals, including heart rate and blood pressure +* Cardiac Arrest +* Various treatment methods such as CPR, different kinds of IVs and tourniquets +* A basic medication simulation + +### How it works + +Same as with basic, when hit an injury is sustained. Different though is that the type of injury and the severity of it are based upon how the damage was done and what caused it. This affects both blood loss and immediate consequences, such as being knocked out or being killed right away. When a player has sustained an injury, this will be indicated by flashing red of the screen; this means the player is bleeding. + +##### Stopping bleeding +In order to stop the bleeding, all injuries on every bodypart requires treatment. This is done by either applying a tourniquet to legs or arms as a temporarly solution, or by using bandages to stop the bleeding as a more permament fix. + +##### Vitals +While a unit is bleeding however, the blood volume decreases which will result in a change of vitals. Depending on the factors such as current blood volume, the blood loss rate, medication used, the blood pressure will start to drop. To counter this drop, also based upon the previously mentioned factors and others, the heart rate will adjust accordingly to attempt to keep blood pressure at safe levels. This means that for any patient it is required to keep an eye on the vitals. This is done through the interaction system by selecting check pulse or blood pressure on either the arms or head. + +##### Medication +To stabalize the vitals and to counter for example pain, a player/medic can use medication. Advanced medical has 3 different medications available: +* Atropine +* Morphine +* Epinephrine + +Atropine is a vagolytic and anticholinergic drug which in low dosages reduces heart rate but in high dosages increases it, countering effects of organophosphate poisoning (in NBC scenarios; anticholinesterase poisoning) and symptomatic bradycardia (in post-ROSC care and resuscitative medicine). + +Morphine is used to alleviate large amounts of pain. Has an effect similar to Heroin due to its opiate properties. Must only ever be given once, and only when bleeding has been reduced to a minimum. Morphine must never be given to a casualty with a low heart rate, as it can stop the heart. + +Epinephrine is used to increase heart rate and blood pressure and alleviate unconsciousness. Epinephrine is a synthetic form of Adrenaline, which is naturally produced in the body. It can also be applied to counter-act the effects of Atropine. Be careful though, as it may only be given once. + +_Epinephrine must never be given to a casualty with a high heart rate or blood pressure._ diff --git a/documentation/framework/carry-drag.md b/documentation/framework/carry-drag.md new file mode 100644 index 0000000000..daaa9fb95a --- /dev/null +++ b/documentation/framework/carry-drag.md @@ -0,0 +1,27 @@ +--- +layout: wiki +title: Carry and Drag System +group: framework +order: 5 +parent: wiki +--- + +# 1. Config Values + +``` +class CfgVehicles { + class MyVehicle { + + + ace_dragging_canDrag = 1; // can this object be dragged?; 1 yes, 0 no (0 default) + ace_dragging_dragPosition[] = {0,1.2,0} // Offset of the model from the body while dragging, comparable to the offset in attachTo (It's the same actually) + ace_dragging_dragDirection = 0; // how much degrees is the model rotatated after dragging it (a global setDir after attachTo) + + ace_dragging_canCarry = 1; // can this object be carried?; 1 yes, 0 no (0 default) + ace_dragging_carryPosition[] = {0,1.2,0}; // Same as drag, but for carrying objects + ace_dragging_carryDirection = 0; // Same as drag, but for carrying objects + + }; +}; +``` + diff --git a/documentation/framework/fragmentation-configuration.md b/documentation/framework/fragmentation-configuration.md index 1372b2b69a..c8a64b2db4 100644 --- a/documentation/framework/fragmentation-configuration.md +++ b/documentation/framework/fragmentation-configuration.md @@ -15,15 +15,15 @@ The system for the end-developer is easy to use, and only requires minimal resea Below is an example set of explosives configuration properties for sys_frag (in this case an M67 hand grenade): ```c++ -ACE_FRAG_METAL = 210; // metal in grams -ACE_FRAG_CHARGE = 185; // explosive in grams -ACE_FRAG_GURNEY_C = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations -ACE_FRAG_GURNEY_K = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations +ace_frag_metal = 210; // metal in grams +ace_frag_charge = 185; // explosive in grams +ace_frag_gurney_c = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations +ace_frag_gurney_k = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations ``` -`ACE_FRAG_METAL` is the amount of metal being fragmented (generally taken as the entire weight of the warhead, though in some cases you might want to only include the fragmentation jacket or body. `ACE_FRAG_CHARGE` is the amount of explosive filler in the warhead. `ACE_FRAG_METAL` and `ACE_FRAG_CHARGE` are dimensionless values, as long as they are both in the same unit (for example kg/kg g/g lbs/lbs). +`ace_frag_metal` is the amount of metal being fragmented (generally taken as the entire weight of the warhead, though in some cases you might want to only include the fragmentation jacket or body. `ace_frag_charge` is the amount of explosive filler in the warhead. `ace_frag_metal` and `ace_frag_charge` are dimensionless values, as long as they are both in the same unit (for example kg/kg g/g lbs/lbs). -`ACE_FRAG_GURNEY_C` is the Gurney constant for explosive force. You can find a list of common explosive types below. If you can not find it here, or want more accurate numbers, just google the type of explosive and Gurney constant and you can find substantial information. This is *NOT* the detonation velocity of the explosive, do not confuse them! +`ace_frag_gurney_c` is the Gurney constant for explosive force. You can find a list of common explosive types below. If you can not find it here, or want more accurate numbers, just google the type of explosive and Gurney constant and you can find substantial information. This is *NOT* the detonation velocity of the explosive, do not confuse them! | Type | Speed | |------------------|----------| @@ -42,7 +42,7 @@ ACE_FRAG_GURNEY_K = 3/5; // Gurney shape factor, in this case a sphere. See: ht |Tritonal | 2320 m/s | -`ACE_FRAG_GURNEY_K` is the shape factor for the explosive configuration. You should choose it based on the general configuration of explosives/metal in the warhead. Most grenades for example are a sphere. Artillery and aircraft bombs are a cylinder. Mines generally a flat plate. Below is a list of the three common shapes and their factors. +`ace_frag_gurney_k` is the shape factor for the explosive configuration. You should choose it based on the general configuration of explosives/metal in the warhead. Most grenades for example are a sphere. Artillery and aircraft bombs are a cylinder. Mines generally a flat plate. Below is a list of the three common shapes and their factors. ``` Sphere = 3/5 @@ -52,7 +52,7 @@ Plate = 3/5 There are other configurations but these are the most common. If you are interested in others check out the wikipedia link given above. Most of these will not correctly function in sys_frag though due to additional variables for the equation. -In addition to these variables there are different types of fragmentation fragments to choose from, and they can be defined in the config value `ACE_FRAG_CLASSES[]`. Below are a list of the types. +In addition to these variables there are different types of fragmentation fragments to choose from, and they can be defined in the config value `ace_frag_classes[]`. Below are a list of the types. ``` ACE_frag_tiny @@ -71,6 +71,6 @@ The tinier the piece of fragmentation the shorter the distance of travel. The `_ The final information needed is a couple of entries for forcing or ignoring fragmentation for this ammo. -If you set `ACE_FRAG_SKIP` to 1 then you will skip fragmentation for ammo of this type. This is useful for things that might cause high network load, such as FFAR rockets, or possibly even 40mm grenades from AGLs. Experimentation under network conditions is required. +If you set `ace_frag_skip` to 1 then you will skip fragmentation for ammo of this type. This is useful for things that might cause high network load, such as FFAR rockets, or possibly even 40mm grenades from AGLs. Experimentation under network conditions is required. -If you set `ACE_FRAG_FORCE` to 1 it will force the fragmentation system to use frag on this ammo, ignoring sys_frags internal qualifications based on hit values. +If you set `ace_frag_force` to 1 it will force the fragmentation system to use frag on this ammo, ignoring sys_frags internal qualifications based on hit values. diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 6028771554..038bb71d5c 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -25,6 +25,34 @@ file(GLOB ACE_COMMON_SOURCES common/*.h common/*.hpp common/*.c common/*.cpp) add_library(ace_common STATIC ${ACE_COMMON_SOURCES}) include_directories(AFTER "common") +string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ") +set(ACE_VERSION_MAJOR 3) +set(ACE_VERSION_MINOR 0) +set(ACE_VERSION_REVISION 1) +EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD + OUTPUT_VARIABLE T_ACE_VERSION_BUILD + OUTPUT_STRIP_TRAILING_WHITESPACE +) +string(SUBSTRING ${T_ACE_VERSION_BUILD} 0 7 ACE_VERSION_BUILD ) + +message("Building for: " ${ACE_VERSION_MAJOR}.${ACE_VERSION_MINOR}.${ACE_VERSION_REVISION}-${ACE_VERSION_BUILD}) + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version.hpp.in" + "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version.hpp" + @ONLY) + +if(MSVC) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version_win32.rc.in" + "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc" + @ONLY) + set(GLOBAL_RC ${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc) +endif() + +include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/common) +set(GLOBAL_SOURCES ${GLOBAL_RC}) + # Add extensions to build here add_subdirectory(fcs) add_subdirectory(breakLine) diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 2851d6576b..4bc9a28933 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -19,8 +19,6 @@ #define STD_AIR_DENSITY_ICAO 1.22498 #define STD_AIR_DENSITY_ASM 1.20885 -static char version[] = "1.0"; - struct Bullet { double airFriction; double caliber; @@ -242,7 +240,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) { if (!strcmp(function, "version")) { - int n = sprintf_s(output, outputSize, "%s", version); + int n = sprintf_s(output, outputSize, "%s", ACE_FULL_VERSION_STR); return; } diff --git a/extensions/advanced_ballistics/CMakeLists.txt b/extensions/advanced_ballistics/CMakeLists.txt index f579339a04..19b9fc41d9 100644 --- a/extensions/advanced_ballistics/CMakeLists.txt +++ b/extensions/advanced_ballistics/CMakeLists.txt @@ -1,7 +1,7 @@ set(ACE_EXTENSION_NAME "ace_advanced_ballistics") file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES}) +add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES}) add_dependencies(${ACE_EXTENSION_NAME} ace_common) SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") diff --git a/extensions/breakLine/CMakeLists.txt b/extensions/breakLine/CMakeLists.txt index 8981ec487e..d34ae1b58e 100644 --- a/extensions/breakLine/CMakeLists.txt +++ b/extensions/breakLine/CMakeLists.txt @@ -1,7 +1,7 @@ set(ACE_EXTENSION_NAME "ace_breakLine") file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES}) +add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES}) add_dependencies(${ACE_EXTENSION_NAME} ace_common) SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") diff --git a/extensions/breakLine/ace_breakLine.cpp b/extensions/breakLine/ace_breakLine.cpp index fb5775b861..89ea1cfd85 100644 --- a/extensions/breakLine/ace_breakLine.cpp +++ b/extensions/breakLine/ace_breakLine.cpp @@ -19,8 +19,6 @@ #define MAXCHARACTERS 14 -static char VERSION[] = "1.0"; - extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); }; @@ -39,8 +37,8 @@ std::vector splitString(const std::string & input) { std::string addLineBreaks(const std::vector &words) { std::stringstream sstream; - int numChar = 0; - int i = 0; + size_t numChar = 0; + size_t i = 0; while (i < words.size()) { if (numChar == 0) { @@ -68,7 +66,7 @@ std::string addLineBreaks(const std::vector &words) { void __stdcall RVExtension(char *output, int outputSize, const char *function) { if (!strcmp(function, "version")) { - strncpy(output, VERSION, outputSize); + strncpy(output, ACE_FULL_VERSION_STR, outputSize); } else { strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize); output[outputSize - 1] = '\0'; diff --git a/extensions/common/ace_common.h b/extensions/common/ace_common.h index 4a8847b209..93f7b9af8a 100644 --- a/extensions/common/ace_common.h +++ b/extensions/common/ace_common.h @@ -1,4 +1,4 @@ #pragma once #include "targetver.h" - +#include "ace_version.hpp" diff --git a/extensions/common/ace_version.hpp.in b/extensions/common/ace_version.hpp.in new file mode 100644 index 0000000000..853648497d --- /dev/null +++ b/extensions/common/ace_version.hpp.in @@ -0,0 +1,4 @@ +#pragma once + +#define ACE_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@" +#define ACE_FULL_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" \ No newline at end of file diff --git a/extensions/common/ace_version_win32.rc.in b/extensions/common/ace_version_win32.rc.in new file mode 100644 index 0000000000..112f404649 --- /dev/null +++ b/extensions/common/ace_version_win32.rc.in @@ -0,0 +1,47 @@ +#ifdef _WIN32 + + #include + + #ifndef DEBUG + #define VER_DEBUG 0 + #else + #define VER_DEBUG VS_FF_DEBUG + #endif + + VS_VERSION_INFO VERSIONINFO + FILEVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ + PRODUCTVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG) + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "ACE3 Team" + VALUE "FileDescription", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "FileVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "ProductName", "ACE3" + VALUE "ProductVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "Build Date", "@ACE_BUILDSTAMP@" + END + END + + BLOCK "VarFileInfo" + BEGIN + /* The following line should only be modified for localized versions. */ + /* It consists of any number of WORD,WORD pairs, with each pair */ + /* describing a language,codepage combination supported by the file. */ + /* */ + /* For example, a file might have values "0x409,1252" indicating that it */ + /* supports English language (0x409) in the Windows ANSI codepage (1252). */ + + VALUE "Translation", 0x409, 1252 + + END + END + +#endif \ No newline at end of file diff --git a/extensions/fcs/CMakeLists.txt b/extensions/fcs/CMakeLists.txt index 2b24542566..0a4ba1b064 100644 --- a/extensions/fcs/CMakeLists.txt +++ b/extensions/fcs/CMakeLists.txt @@ -1,7 +1,7 @@ set(ACE_EXTENSION_NAME "ace_fcs") file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES}) +add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES}) add_dependencies(${ACE_EXTENSION_NAME} ace_common) SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") diff --git a/extensions/fcs/ace_fcs.cpp b/extensions/fcs/ace_fcs.cpp index 9ab4939058..4aada29aff 100644 --- a/extensions/fcs/ace_fcs.cpp +++ b/extensions/fcs/ace_fcs.cpp @@ -25,8 +25,6 @@ #define PRECISION 0.1 #define RADIANS(X) (X / (180 / M_PI)) -static char version[] = "1.0"; - extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); }; @@ -104,7 +102,7 @@ double getSolution(double initSpeed, double airFriction, double angleTarget, dou void __stdcall RVExtension(char *output, int outputSize, const char *function) { if (!strcmp(function, "version")) { - strncpy(output, version, outputSize); + strncpy(output, ACE_FULL_VERSION_STR, outputSize); } else { std::vector argStrings = splitString(function); double initSpeed = std::stod(argStrings[0]); diff --git a/extras/CfgWeaponsReference.hpp b/extras/CfgWeaponsReference.hpp index 77ce494e39..4821d53813 100644 --- a/extras/CfgWeaponsReference.hpp +++ b/extras/CfgWeaponsReference.hpp @@ -294,7 +294,7 @@ class CfgWeapons class RH_gsh18 : Pistol_Base_F { ACE_barrelTwist=9.8; - ACE_barrelLength=4.1; + ACE_barrelLength=4.1; }; class RH_mateba : Pistol_Base_F { @@ -329,7 +329,7 @@ class CfgWeapons class RH_fn57 : Pistol_Base_F { ACE_barrelTwist=9.1; - ACE_barrelLength=4.8; + ACE_barrelLength=4.8; }; class RH_vp70 : Pistol_Base_F { diff --git a/extras/assets/icons/Icons_Modules.psd b/extras/assets/icons/Icons_Modules.psd index 9dcfa6a38b..9686644521 100644 Binary files a/extras/assets/icons/Icons_Modules.psd and b/extras/assets/icons/Icons_Modules.psd differ diff --git a/extras/assets/icons/png/Icon_Module/Icon_Module_Repair_ca.png b/extras/assets/icons/png/Icon_Module/Icon_Module_Repair_ca.png new file mode 100644 index 0000000000..381c3d1c41 Binary files /dev/null and b/extras/assets/icons/png/Icon_Module/Icon_Module_Repair_ca.png differ diff --git a/extras/assets/icons/png/Icon_Module_mk6_ca.png b/extras/assets/icons/png/Icon_Module_mk6_ca.png new file mode 100644 index 0000000000..26c2966551 Binary files /dev/null and b/extras/assets/icons/png/Icon_Module_mk6_ca.png differ diff --git a/optionals/asdg_comp/config.cpp b/optionals/compat_asdg/config.cpp similarity index 100% rename from optionals/asdg_comp/config.cpp rename to optionals/compat_asdg/config.cpp diff --git a/optionals/asdg_comp/script_component.hpp b/optionals/compat_asdg/script_component.hpp similarity index 100% rename from optionals/asdg_comp/script_component.hpp rename to optionals/compat_asdg/script_component.hpp diff --git a/optionals/compat_cup/CfgAmmo.hpp b/optionals/compat_cup/CfgAmmo.hpp new file mode 100644 index 0000000000..1dcd91bc23 --- /dev/null +++ b/optionals/compat_cup/CfgAmmo.hpp @@ -0,0 +1,422 @@ +class CfgAmmo +{ + class BulletBase; + class B_762x51_Ball; + class B_127x99_Ball; + class CUP_B_545x39_Ball: BulletBase + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=52.9; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={780, 880, 920}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_545x39_Ball_Tracer_Green: CUP_B_545x39_Ball + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=49.8; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={785, 883, 925}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_545x39_Ball_Tracer_Red: BulletBase + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=49.8; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={785, 883, 925}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_545x39_Ball_Tracer_White: BulletBase + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=49.8; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={785, 883, 925}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_545x39_Ball_Tracer_Yellow: BulletBase + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=49.8; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={785, 883, 925}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_762x39_Ball: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=123; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_762x39_Ball_Tracer_Green: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=117; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_9x18_Ball: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_9x18_Ball_Tracer_Green: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_9x18_Ball_Tracer_Red: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_9x18_Ball_Tracer_Yellow: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_9x18_Ball_White_Tracer: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_9x19_Ball: BulletBase + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class CUP_B_762x51_noTracer: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class CUP_B_303_Ball: BulletBase + { + ACE_caliber=0.311; + ACE_bulletLength=1.227; + ACE_bulletMass=174; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.499, 0.493, 0.48}; + ACE_velocityBoundaries[]={671, 549}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={748, 761, 765}; + ACE_barrelLengths[]={20, 24, 26}; + }; + class CUP_B_127x107_Ball_Green_Tracer: BulletBase + { + ACE_caliber=0.511; + ACE_bulletLength=2.520; + ACE_bulletMass=745; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.63}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={820}; + ACE_barrelLengths[]={28.7}; + }; + class CUP_B_127x108_Ball_Green_Tracer: BulletBase + { + ACE_caliber=0.511; + ACE_bulletLength=2.520; + ACE_bulletMass=745; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.63}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={820}; + ACE_barrelLengths[]={28.7}; + }; + class CUP_B_762x54_Ball_White_Tracer: BulletBase + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=149; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class CUP_B_762x54_Ball_Red_Tracer: BulletBase + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=149; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class CUP_B_762x54_Ball_Green_Tracer: BulletBase + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=149; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class CUP_B_762x54_Ball_Yellow_Tracer: BulletBase + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=149; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class CUP_B_9x39_SP5: BulletBase + { + ACE_caliber=0.364; + ACE_bulletLength=1.24; + ACE_bulletMass=250; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={280, 300, 320}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class CUP_B_762x51_Tracer_Green: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class CUP_B_762x51_Tracer_Red: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class CUP_B_762x51_Tracer_Yellow: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class CUP_B_762x51_Tracer_White: BulletBase + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class B_127x107_Ball: BulletBase + { + ACE_caliber=0.511; + ACE_bulletLength=2.520; + ACE_bulletMass=745; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.63}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={820}; + ACE_barrelLengths[]={28.7}; + }; + class CUP_B_9x18_SD: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 340}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class CUP_B_765x17_Ball: BulletBase + { + ACE_caliber=0.3125; + ACE_bulletLength=0.610; + ACE_bulletMass=65; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.118}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={282, 300, 320}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class CUP_B_145x115_AP_Green_Tracer: BulletBase + { + ACE_caliber=0.586; + ACE_bulletLength=2.00; + ACE_bulletMass=1010; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.620}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={1000}; + ACE_barrelLengths[]={53}; + }; + class CUP_B_127x99_Ball_White_Tracer: B_127x99_Ball + { + ACE_caliber=0.510; + ACE_bulletLength=2.310; + ACE_bulletMass=647; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.670}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={853}; + ACE_barrelLengths[]={29}; + }; + class CUP_B_86x70_Ball_noTracer: BulletBase + { + ACE_caliber=0.338; + ACE_bulletLength=1.70; + ACE_bulletMass=300; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.381}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={820, 826, 830}; + ACE_barrelLengths[]={24, 26.5, 28}; + }; +}; \ No newline at end of file diff --git a/optionals/compat_cup/config.cpp b/optionals/compat_cup/config.cpp new file mode 100644 index 0000000000..e4f26f8051 --- /dev/null +++ b/optionals/compat_cup/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"CUP_Weapons_Ammunition"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" diff --git a/optionals/compat_cup/script_component.hpp b/optionals/compat_cup/script_component.hpp new file mode 100644 index 0000000000..3d77fcb370 --- /dev/null +++ b/optionals/compat_cup/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT CUP_Weapons_Ammunition_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlc_ar15/CfgWeapons.hpp b/optionals/compat_hlc_ar15/CfgWeapons.hpp new file mode 100644 index 0000000000..d57de932e6 --- /dev/null +++ b/optionals/compat_hlc_ar15/CfgWeapons.hpp @@ -0,0 +1,65 @@ +class CfgWeapons +{ + class Rifle; + class Rifle_Base_F; + class hlc_ar15_base: Rifle_Base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=11.5; + }; + class hlc_rifle_RU556: hlc_ar15_base + { + ACE_barrelTwist=7; + ACE_barrelLength=10.3; + }; + class hlc_rifle_RU5562: hlc_rifle_RU556 + { + ACE_barrelTwist=7; + ACE_barrelLength=10.3; + }; + class hlc_rifle_CQBR: hlc_rifle_RU556 + { + ACE_barrelTwist=7; + ACE_barrelLength=10; + }; + class hlc_rifle_M4: hlc_rifle_RU556 + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class hlc_rifle_bcmjack: hlc_ar15_base + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class hlc_rifle_Colt727: hlc_ar15_base + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class hlc_rifle_Colt727_GL: hlc_rifle_Colt727 + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class hlc_rifle_Bushmaster300: hlc_rifle_Colt727 + { + ACE_barrelTwist=8; + ACE_barrelLength=14.5; + }; + class hlc_rifle_vendimus: hlc_rifle_Bushmaster300 + { + ACE_barrelTwist=8; + ACE_barrelLength=16; + }; + class hlc_rifle_SAMR: hlc_rifle_RU556 + { + ACE_barrelTwist=9; + ACE_barrelLength=16; + }; + class hlc_rifle_honeybase: hlc_rifle_RU556 + { + ACE_barrelTwist=8; + ACE_barrelLength=6; + }; +}; \ No newline at end of file diff --git a/optionals/compat_hlc_ar15/config.cpp b/optionals/compat_hlc_ar15/config.cpp new file mode 100644 index 0000000000..51e42dc040 --- /dev/null +++ b/optionals/compat_hlc_ar15/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_ar15"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlc_ar15/script_component.hpp b/optionals/compat_hlc_ar15/script_component.hpp new file mode 100644 index 0000000000..3fb38b0477 --- /dev/null +++ b/optionals/compat_hlc_ar15/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_ar15_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlc_wp_mp5/CfgWeapons.hpp b/optionals/compat_hlc_wp_mp5/CfgWeapons.hpp new file mode 100644 index 0000000000..bb2762d1bc --- /dev/null +++ b/optionals/compat_hlc_wp_mp5/CfgWeapons.hpp @@ -0,0 +1,60 @@ + +class CfgWeapons +{ + class Rifle_Base_F; + class hlc_MP5_base: Rifle_Base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_mp5k_PDW: hlc_MP5_base + { + ACE_barrelTwist=10; + ACE_barrelLength=4.5; + }; + class hlc_smg_mp5k: hlc_smg_mp5k_PDW + { + ACE_barrelTwist=10; + ACE_barrelLength=4.5; + }; + class hlc_smg_mp5a2: hlc_MP5_base + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_MP5N: hlc_MP5_base + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_9mmar: hlc_smg_MP5N + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_mp5a4: hlc_MP5_base + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_mp510: hlc_smg_MP5N + { + ACE_barrelTwist=15; + ACE_barrelLength=9; + }; + class hlc_smg_mp5sd5: hlc_MP5_base + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_mp5a3: hlc_smg_mp5a2 + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; + class hlc_smg_mp5sd6: hlc_smg_mp5sd5 + { + ACE_barrelTwist=10; + ACE_barrelLength=9; + }; +}; diff --git a/optionals/compat_hlc_wp_mp5/config.cpp b/optionals/compat_hlc_wp_mp5/config.cpp new file mode 100644 index 0000000000..1f4fe78db4 --- /dev/null +++ b/optionals/compat_hlc_wp_mp5/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_mp5"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlc_wp_mp5/script_component.hpp b/optionals/compat_hlc_wp_mp5/script_component.hpp new file mode 100644 index 0000000000..6b19e4912b --- /dev/null +++ b/optionals/compat_hlc_wp_mp5/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_mp5_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_ak/CfgWeapons.hpp b/optionals/compat_hlcmods_ak/CfgWeapons.hpp new file mode 100644 index 0000000000..390d3e6177 --- /dev/null +++ b/optionals/compat_hlcmods_ak/CfgWeapons.hpp @@ -0,0 +1,76 @@ +class CfgWeapons +{ + class optic_dms; + class hlc_ak_base; + class hlc_rifle_ak12; + class InventoryOpticsItem_Base_F; + class hlc_rifle_ak74: hlc_ak_base + { + ACE_barrelTwist=7.8699999; + ACE_barrelLength=16.299999; + }; + class hlc_rifle_aku12: hlc_rifle_ak12 + { + ACE_barrelTwist=6.3000002; + ACE_barrelLength=8.3000002; + }; + class hlc_rifle_RPK12: hlc_rifle_ak12 + { + ACE_barrelLength=23.200001; + }; + class hlc_rifle_aks74u: hlc_rifle_ak74 + { + ACE_barrelTwist=6.3000002; + ACE_barrelLength=8.3000002; + }; + class hlc_rifle_ak47: hlc_rifle_ak74 + { + ACE_barrelTwist=9.4499998; + ACE_barrelLength=16.299999; + }; + class hlc_rifle_akm: hlc_rifle_ak47 + { + ACE_barrelTwist=7.8699999; + ACE_barrelLength=16.299999; + }; + class hlc_rifle_rpk: hlc_rifle_ak47 + { + ACE_barrelTwist=9.4499998; + ACE_barrelLength=23.200001; + }; + class hlc_rifle_rpk74n: hlc_rifle_rpk + { + ACE_barrelTwist=9.4499998; + ACE_barrelLength=23.200001; + }; + class hlc_rifle_aek971: hlc_rifle_ak74 + { + ACE_barrelTwist=9.5; + ACE_barrelLength=17; + }; + class hlc_rifle_saiga12k: hlc_rifle_ak47 + { + ACE_barrelTwist=0; + ACE_twistDirection=0; + ACE_barrelLength=16.9; + }; + + class HLC_Optic_PSO1 : optic_dms { + ACE_ScopeAdjust_Vertical[] = { 0, 0 }; + ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; + ACE_ScopeAdjust_Increment = 0.5; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class Snip { + discreteDistance[]={100, 200, 300, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; + discreteDistanceInitIndex=3; + }; + }; + }; + }; + class HLC_Optic_1p29 : HLC_Optic_PSO1 { + ACE_ScopeAdjust_Vertical[] = {}; + ACE_ScopeAdjust_Horizontal[] = {}; + ACE_ScopeAdjust_Increment = 0; + }; +}; \ No newline at end of file diff --git a/optionals/compat_hlcmods_ak/config.cpp b/optionals/compat_hlcmods_ak/config.cpp new file mode 100644 index 0000000000..7c8cdba2ba --- /dev/null +++ b/optionals/compat_hlcmods_ak/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_aks"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_ak/script_component.hpp b/optionals/compat_hlcmods_ak/script_component.hpp new file mode 100644 index 0000000000..a970229846 --- /dev/null +++ b/optionals/compat_hlcmods_ak/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_aks_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_aug/CfgWeapons.hpp b/optionals/compat_hlcmods_aug/CfgWeapons.hpp new file mode 100644 index 0000000000..b46cf485e1 --- /dev/null +++ b/optionals/compat_hlcmods_aug/CfgWeapons.hpp @@ -0,0 +1,51 @@ + +class CfgWeapons +{ + class Rifle_Base_F; + class hlc_aug_base; + class hlc_rifle_aug: hlc_aug_base + { + ACE_barrelTwist=9; + ACE_barrelLength=20; + }; + class hlc_rifle_auga1carb: hlc_rifle_aug + { + ACE_barrelTwist=9; + ACE_barrelLength=16; + }; + class hlc_rifle_aughbar: hlc_rifle_aug + { + ACE_barrelTwist=9; + ACE_barrelLength=24; + }; + class hlc_rifle_augpara: hlc_rifle_aug + { + ACE_barrelTwist=9; + ACE_barrelLength=16.5; + }; + class hlc_rifle_auga2: hlc_rifle_aug + { + ACE_barrelTwist=9; + ACE_barrelLength=20; + }; + class hlc_rifle_auga2para: hlc_rifle_auga2 + { + ACE_barrelTwist=9; + ACE_barrelLength=16.5; + }; + class hlc_rifle_auga2carb: hlc_rifle_auga2 + { + ACE_barrelTwist=9; + ACE_barrelLength=18; + }; + class hlc_rifle_auga2lsw: hlc_rifle_aughbar + { + ACE_barrelTwist=9; + ACE_barrelLength=24; + }; + class hlc_rifle_auga3: hlc_rifle_aug + { + ACE_barrelTwist=9; + ACE_barrelLength=18; + }; +}; \ No newline at end of file diff --git a/optionals/compat_hlcmods_aug/config.cpp b/optionals/compat_hlcmods_aug/config.cpp new file mode 100644 index 0000000000..06192a6ffd --- /dev/null +++ b/optionals/compat_hlcmods_aug/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_AUG"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_aug/script_component.hpp b/optionals/compat_hlcmods_aug/script_component.hpp new file mode 100644 index 0000000000..d5a6712b6b --- /dev/null +++ b/optionals/compat_hlcmods_aug/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_AUG_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_core/CfgAmmo.hpp b/optionals/compat_hlcmods_core/CfgAmmo.hpp new file mode 100644 index 0000000000..7259d2da3d --- /dev/null +++ b/optionals/compat_hlcmods_core/CfgAmmo.hpp @@ -0,0 +1,316 @@ +class CfgAmmo +{ + class B_762x51_Ball; + class B_556x45_Ball; + class B_127x99_Ball; + class B_127x99_Ball_Tracer_Red; + class HLC_762x51_tracer; + class HLC_762x51_ball; + class HLC_556NATO_EPR: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=62; + ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; + ACE_ballisticCoefficients[]={0.151}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; + ACE_barrelLengths[]={8.3, 9.4, 10.6, 11.8, 13.0, 14.2, 15.4, 16.5, 17.7, 18.9, 20.0, 24.0}; + }; + class HLC_556NATO_SOST: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=62; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.307}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={780, 886, 950}; + ACE_barrelLengths[]={10, 15.5, 20}; + }; + class HLC_556NATO_SPR: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=77; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.361}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={624, 816, 832, 838}; + ACE_barrelLengths[]={7.5, 14.5, 18, 20}; + }; + class HLC_300Blackout_Ball: B_556x45_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.118; + ACE_bulletMass=147; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.398}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={559, 609, 625}; + ACE_barrelLengths[]={6, 16, 20}; + }; + class HLC_300Blackout_SMK: HLC_300Blackout_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.489; + ACE_bulletMass=220; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.608}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={300, 320, 340}; + ACE_barrelLengths[]={9, 16, 20}; + }; + class HLC_762x39_Ball: HLC_300Blackout_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=123; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class HLC_762x39_Tracer: HLC_762x39_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=117; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class HLC_762x51_MK316_20in: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.24; + ACE_bulletMass=175; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.243}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={750, 780, 790, 794}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class HLC_762x51_BTSub: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.340; + ACE_bulletMass=200; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.235}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={305, 325, 335, 340}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class HLC_762x54_ball: HLC_762x51_ball + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=152; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.4}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={700, 800, 820, 833}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class HLC_762x54_tracer: HLC_762x51_tracer + { + ACE_caliber=0.312; + ACE_bulletLength=1.14; + ACE_bulletMass=149; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class HLC_303Brit_B: B_556x45_Ball + { + ACE_caliber=0.311; + ACE_bulletLength=1.227; + ACE_bulletMass=174; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.499, 0.493, 0.48}; + ACE_velocityBoundaries[]={671, 549}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={748, 761, 765}; + ACE_barrelLengths[]={20, 24, 26}; + }; + class HLC_792x57_Ball: HLC_303Brit_B + { + ACE_caliber=0.318; + ACE_bulletLength=1.128; + ACE_bulletMass=196; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.315}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={785, 800, 815}; + ACE_barrelLengths[]={20, 23.62, 26}; + }; + class HLC_542x42_ball: HLC_303Brit_B + { + }; + class HLC_542x42_Tracer: HLC_303Brit_B + { + }; + class FH_545x39_Ball: B_556x45_Ball + { + ACE_caliber=0.220; + ACE_bulletLength=0.85; + ACE_bulletMass=52.9; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={780, 880, 920}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class FH_545x39_7u1: FH_545x39_Ball + { + ACE_bulletMass=80; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_muzzleVelocities[]={260, 303, 320}; + ACE_barrelLengths[]={10, 16.3, 20}; + }; + class HLC_57x28mm_JHP: FH_545x39_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.495; + ACE_bulletMass=28; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.144}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={550, 625, 720}; + ACE_barrelLengths[]={4, 6, 10.35}; + }; + class HLC_9x19_Ball: B_556x45_Ball + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class HLC_9x19_M882_SMG: B_556x45_Ball + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class HLC_9x19_GoldDot: HLC_9x19_Ball + { + ACE_muzzleVelocities[]={350, 380, 420}; + }; + class HLC_9x19_Subsonic: HLC_9x19_Ball + { + ACE_muzzleVelocities[]={300, 320, 340}; + }; + class HLC_10mm_FMJ: HLC_9x19_Ball + { + ACE_caliber=0.5; + ACE_bulletLength=0.764; + ACE_bulletMass=165; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.189}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 400, 430}; + ACE_barrelLengths[]={4, 4.61, 9}; + }; + class HLC_45ACP_Ball: B_556x45_Ball + { + ACE_caliber=0.452; + ACE_bulletLength=0.68; + ACE_bulletMass=230; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.195}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={230, 250, 285}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class FH_44Mag: HLC_45ACP_Ball + { + ACE_caliber=0.429; + ACE_bulletLength=0.804; + ACE_bulletMass=200; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.172}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 390, 420}; + ACE_barrelLengths[]={4, 7.5, 9}; + }; + class FH_50BMG_SLAP: B_127x99_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.25; + ACE_bulletMass=350; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={1.056}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={1204}; + ACE_barrelLengths[]={29}; + }; + class FH_50BMG_Raufoss: B_127x99_Ball + { + ACE_caliber=0.510; + ACE_bulletLength=2.380; + ACE_bulletMass=660; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.670}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={817}; + ACE_barrelLengths[]={29}; + }; +}; diff --git a/optionals/compat_hlcmods_core/config.cpp b/optionals/compat_hlcmods_core/config.cpp new file mode 100644 index 0000000000..ecd780908f --- /dev/null +++ b/optionals/compat_hlcmods_core/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_core"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" diff --git a/optionals/compat_hlcmods_core/script_component.hpp b/optionals/compat_hlcmods_core/script_component.hpp new file mode 100644 index 0000000000..444799ed4a --- /dev/null +++ b/optionals/compat_hlcmods_core/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_core_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_fal/CfgWeapons.hpp b/optionals/compat_hlcmods_fal/CfgWeapons.hpp new file mode 100644 index 0000000000..05a17d8eb4 --- /dev/null +++ b/optionals/compat_hlcmods_fal/CfgWeapons.hpp @@ -0,0 +1,50 @@ + +class CfgWeapons +{ + class hlc_fal_base; + class hlc_rifle_falosw: hlc_fal_base + { + ACE_barrelTwist=12; + ACE_barrelLength=13; + }; + class hlc_rifle_osw_GL: hlc_rifle_falosw + { + ACE_barrelTwist=12; + ACE_barrelLength=13; + }; + class hlc_rifle_SLR: hlc_fal_base + { + ACE_barrelTwist=12; + ACE_barrelLength=21.700001; + }; + class hlc_rifle_STG58F: hlc_fal_base + { + ACE_barrelTwist=12; + ACE_barrelLength=21; + }; + class hlc_rifle_FAL5061: hlc_fal_base + { + ACE_barrelTwist=12; + ACE_barrelLength=18; + }; + class hlc_rifle_L1A1SLR: hlc_rifle_SLR + { + ACE_barrelTwist=12; + ACE_barrelLength=21.700001; + }; + class hlc_rifle_c1A1: hlc_rifle_SLR + { + ACE_barrelTwist=12; + ACE_barrelLength=21.700001; + }; + class hlc_rifle_LAR: hlc_rifle_FAL5061 + { + ACE_barrelTwist=12; + ACE_barrelLength=21; + }; + class hlc_rifle_SLRchopmod: hlc_rifle_FAL5061 + { + ACE_barrelTwist=12; + ACE_barrelLength=18; + }; +}; \ No newline at end of file diff --git a/optionals/compat_hlcmods_fal/config.cpp b/optionals/compat_hlcmods_fal/config.cpp new file mode 100644 index 0000000000..5428e9871c --- /dev/null +++ b/optionals/compat_hlcmods_fal/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_falpocalypse"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_fal/script_component.hpp b/optionals/compat_hlcmods_fal/script_component.hpp new file mode 100644 index 0000000000..828722a5a4 --- /dev/null +++ b/optionals/compat_hlcmods_fal/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_falpocalypse_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_g3/CfgWeapons.hpp b/optionals/compat_hlcmods_g3/CfgWeapons.hpp new file mode 100644 index 0000000000..e45fe34048 --- /dev/null +++ b/optionals/compat_hlcmods_g3/CfgWeapons.hpp @@ -0,0 +1,45 @@ + +class CfgWeapons +{ + class hlc_g3_base; + class hlc_rifle_g3sg1: hlc_g3_base + { + ACE_barrelTwist=12; + ACE_barrelLength=17.700001; + }; + class hlc_rifle_psg1: hlc_rifle_g3sg1 + { + ACE_barrelTwist=12; + ACE_barrelLength=25.6; + }; + class hlc_rifle_g3a3: hlc_rifle_g3sg1 + { + ACE_barrelTwist=12; + ACE_barrelLength=17.700001; + }; + class hlc_rifle_g3a3ris: hlc_rifle_g3a3 + { + ACE_barrelTwist=12; + ACE_barrelLength=17.700001; + }; + class hlc_rifle_g3ka4: hlc_rifle_g3a3 + { + ACE_barrelTwist=12; + ACE_barrelLength=12.4; + }; + class HLC_Rifle_g3ka4_GL: hlc_rifle_g3ka4 + { + ACE_barrelTwist=12; + ACE_barrelLength=12.4; + }; + class hlc_rifle_hk51: hlc_rifle_g3sg1 + { + ACE_barrelTwist=12; + ACE_barrelLength=8.3100004; + }; + class hlc_rifle_hk53: hlc_rifle_g3sg1 + { + ACE_barrelTwist=7; + ACE_barrelLength=8.3100004; + }; +}; \ No newline at end of file diff --git a/optionals/compat_hlcmods_g3/config.cpp b/optionals/compat_hlcmods_g3/config.cpp new file mode 100644 index 0000000000..6b79486364 --- /dev/null +++ b/optionals/compat_hlcmods_g3/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_g3"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_g3/script_component.hpp b/optionals/compat_hlcmods_g3/script_component.hpp new file mode 100644 index 0000000000..642977f87b --- /dev/null +++ b/optionals/compat_hlcmods_g3/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_g3_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_m14/CfgWeapons.hpp b/optionals/compat_hlcmods_m14/CfgWeapons.hpp new file mode 100644 index 0000000000..01a67ff063 --- /dev/null +++ b/optionals/compat_hlcmods_m14/CfgWeapons.hpp @@ -0,0 +1,16 @@ + +class CfgWeapons +{ + class Rifle_Base_F; + class hlc_rifle_M14; + class hlc_M14_base: Rifle_Base_F + { + ACE_barrelTwist=12; + ACE_barrelLength=22; + }; + class hlc_rifle_m14sopmod: hlc_rifle_M14 + { + ACE_barrelTwist=12; + ACE_barrelLength=18; + }; +}; diff --git a/optionals/compat_hlcmods_m14/config.cpp b/optionals/compat_hlcmods_m14/config.cpp new file mode 100644 index 0000000000..cdf11a7db1 --- /dev/null +++ b/optionals/compat_hlcmods_m14/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_m14"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_m14/script_component.hpp b/optionals/compat_hlcmods_m14/script_component.hpp new file mode 100644 index 0000000000..a29b751195 --- /dev/null +++ b/optionals/compat_hlcmods_m14/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlcweapons_m14_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_hlcmods_m60e4/CfgWeapons.hpp b/optionals/compat_hlcmods_m60e4/CfgWeapons.hpp new file mode 100644 index 0000000000..9532c1968d --- /dev/null +++ b/optionals/compat_hlcmods_m60e4/CfgWeapons.hpp @@ -0,0 +1,15 @@ + +class CfgWeapons +{ + class hlc_M60e4_base; + class hlc_lmg_M60E4: hlc_M60e4_base + { + ACE_barrelTwist=12; + ACE_barrelLength=17; + }; + class hlc_lmg_m60: hlc_M60e4_base + { + ACE_barrelTwist=12; + ACE_barrelLength=22; + }; +}; diff --git a/optionals/compat_hlcmods_m60e4/config.cpp b/optionals/compat_hlcmods_m60e4/config.cpp new file mode 100644 index 0000000000..1df3a97a20 --- /dev/null +++ b/optionals/compat_hlcmods_m60e4/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"hlcweapons_m60e4"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_hlcmods_m60e4/script_component.hpp b/optionals/compat_hlcmods_m60e4/script_component.hpp new file mode 100644 index 0000000000..4a5a9c03b0 --- /dev/null +++ b/optionals/compat_hlcmods_m60e4/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT hlc_m60e4_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rh_acc/CfgWeapons.hpp b/optionals/compat_rh_acc/CfgWeapons.hpp new file mode 100644 index 0000000000..4dda8ffbe0 --- /dev/null +++ b/optionals/compat_rh_acc/CfgWeapons.hpp @@ -0,0 +1,131 @@ + +class CfgWeapons { + class ItemCore; + class InventoryOpticsItem_Base_F; + + class RH_accupoint : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class Accupoint { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_m3lr : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class m3lr { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_leu_mk4 : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class mk4 { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_c79 : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class c79scope { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_c79_2d : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class c79scope { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_anpvs10 : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class pvs10 { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_pas13cm : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class MTWS { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_pas13cmg : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class MTWSmg { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RH_pas13ch : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class HTWS { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; +}; diff --git a/optionals/compat_rh_acc/config.cpp b/optionals/compat_rh_acc/config.cpp new file mode 100644 index 0000000000..9f563bd157 --- /dev/null +++ b/optionals/compat_rh_acc/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RH_acc"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_rh_acc/script_component.hpp b/optionals/compat_rh_acc/script_component.hpp new file mode 100644 index 0000000000..4b36a38ce0 --- /dev/null +++ b/optionals/compat_rh_acc/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT RH_acc_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rh_de/CfgAmmo.hpp b/optionals/compat_rh_de/CfgAmmo.hpp new file mode 100644 index 0000000000..b66b55f530 --- /dev/null +++ b/optionals/compat_rh_de/CfgAmmo.hpp @@ -0,0 +1,161 @@ + +class CfgAmmo +{ + class BulletBase; + class RH_50_AE_Ball: BulletBase + { + ACE_caliber=0.5; + ACE_bulletLength=1.110; + ACE_bulletMass=325; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.228}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 398, 420}; + ACE_barrelLengths[]={4, 6, 9}; + }; + class RH_454_Casull: BulletBase + { + ACE_caliber=0.452; + ACE_bulletLength=0.895; + ACE_bulletMass=325; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.171}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={450, 490, 500}; + ACE_barrelLengths[]={4, 7.5, 9}; + }; + class RH_32ACP: BulletBase + { + ACE_caliber=0.3125; + ACE_bulletLength=0.610; + ACE_bulletMass=65; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.118}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={282, 300, 320}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_45ACP: BulletBase + { + ACE_caliber=0.452; + ACE_bulletLength=0.68; + ACE_bulletMass=230; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.195}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={230, 250, 285}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_B_40SW: BulletBase + { + ACE_caliber=0.4; + ACE_bulletLength=0.447; + ACE_bulletMass=135; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.105, 0.115, 0.120, 0.105}; + ACE_velocityBoundaries[]={365, 305, 259}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 380, 400}; + ACE_barrelLengths[]={4, 6, 9}; + }; + class RH_44mag_ball: BulletBase + { + ACE_caliber=0.429; + ACE_bulletLength=0.804; + ACE_bulletMass=200; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.172}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 390, 420}; + ACE_barrelLengths[]={4, 7.5, 9}; + }; + class RH_357mag_ball: BulletBase + { + ACE_caliber=0.357; + ACE_bulletLength=0.541; + ACE_bulletMass=125; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.148}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={490, 510, 535}; + ACE_barrelLengths[]={4, 6, 9}; + }; + class RH_762x25: BulletBase + { + ACE_caliber=0.310; + ACE_bulletLength=0.5455; + ACE_bulletMass=86; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.17}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 380, 400}; + ACE_barrelLengths[]={4, 6, 9}; + }; + class RH_9x18_Ball: BulletBase + { + ACE_caliber=0.365; + ACE_bulletLength=0.610; + ACE_bulletMass=92.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={3.8, 5, 9}; + }; + class RH_B_9x19_Ball: BulletBase + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_B_22LR_SD: BulletBase + { + ACE_caliber=0.223; + ACE_bulletLength=0.45; + ACE_bulletMass=38; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.111}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={330, 340, 360}; + ACE_barrelLengths[]={4, 6, 9}; + }; + class RH_57x28mm: BulletBase + { + ACE_caliber=0.224; + ACE_bulletLength=0.495; + ACE_bulletMass=28; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.144}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={550, 625, 720}; + ACE_barrelLengths[]={4, 6, 10.35}; + }; +}; \ No newline at end of file diff --git a/optionals/compat_rh_de/CfgWeapons.hpp b/optionals/compat_rh_de/CfgWeapons.hpp new file mode 100644 index 0000000000..8fdff293c9 --- /dev/null +++ b/optionals/compat_rh_de/CfgWeapons.hpp @@ -0,0 +1,140 @@ +class CfgWeapons +{ + class Pistol_Base_F; + class RH_Pistol_Base_F; + class RH_deagle: RH_Pistol_Base_F + { + ACE_barrelTwist=19; + ACE_barrelLength=6; + }; + class RH_mateba: Pistol_Base_F + { + ACE_barrelTwist=14; + ACE_barrelLength=6; + }; + class RH_mp412: Pistol_Base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=6; + }; + class RH_python: Pistol_Base_F + { + ACE_barrelTwist=14; + ACE_barrelLength=6; + }; + class RH_bull: RH_python + { + ACE_barrelTwist=24; + ACE_barrelLength=6.5; + }; + class RH_ttracker: Pistol_Base_F + { + ACE_barrelTwist=12; + ACE_barrelLength=4; + }; + class RH_cz75: RH_Pistol_Base_F + { + ACE_barrelTwist=9.7; + ACE_barrelLength=4.7; + }; + class RH_p226: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.4; + }; + class RH_sw659: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=7.44; + }; + class RH_usp: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=4.41; + }; + class RH_uspm: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=6; + }; + class RH_kimber: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=5; + }; + class RH_m1911: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=5; + }; + class RH_tt33: RH_Pistol_Base_F + { + ACE_barrelTwist=9.45; + ACE_barrelLength=4.6; + }; + class RH_mak: RH_Pistol_Base_F + { + ACE_barrelTwist=9.45; + ACE_barrelLength=3.68; + }; + class RH_mk2: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=4; + }; + class RH_m9: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.9; + }; + class RH_g18: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.49; + }; + class RH_g17: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.49; + }; + class RH_g19: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4; + }; + class RH_gsh18: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.1; + }; + class RH_fnp45: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=4.5; + }; + class RH_fn57: RH_fnp45 + { + ACE_barrelTwist=9.1; + ACE_barrelLength=4.8; + }; + class RH_vp70: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=4.6; + }; + class RH_vz61: RH_Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=4.5; + }; + class RH_tec9: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=5; + }; + class RH_muzi: RH_Pistol_Base_F + { + ACE_barrelTwist=9.8; + ACE_barrelLength=5; + }; +}; \ No newline at end of file diff --git a/optionals/compat_rh_de/config.cpp b/optionals/compat_rh_de/config.cpp new file mode 100644 index 0000000000..3d82eab05a --- /dev/null +++ b/optionals/compat_rh_de/config.cpp @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RH_de_cfg"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgWeapons.hpp" diff --git a/optionals/compat_rh_de/script_component.hpp b/optionals/compat_rh_de/script_component.hpp new file mode 100644 index 0000000000..07ed06ae3f --- /dev/null +++ b/optionals/compat_rh_de/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT RH_de_cfg_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rh_m4/CfgAmmo.hpp b/optionals/compat_rh_m4/CfgAmmo.hpp new file mode 100644 index 0000000000..c15e0e503a --- /dev/null +++ b/optionals/compat_rh_m4/CfgAmmo.hpp @@ -0,0 +1,206 @@ +class CfgAmmo { + + class Default; + class BulletCore; + class BulletBase; + class B_9x21_Ball; + class B_556x45_Ball; + class B_65x39_Caseless; + class B_762x51_Ball; + + class RH_9x19_B_M822: BulletBase + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_9x19_B_HP: BulletBase + { + ACE_caliber=0.355; + ACE_bulletLength=0.610; + ACE_bulletMass=124; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_9x19_B_HPSB: BulletBase + { + ACE_caliber=0.355; + ACE_bulletLength=0.603; + ACE_bulletMass=147; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.212}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={295, 310, 330}; + ACE_barrelLengths[]={4, 5, 9}; + }; + class RH_556x45_B_M855A1: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=62; + ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; + ACE_ballisticCoefficients[]={0.151}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; + ACE_barrelLengths[]={8.3, 9.4, 10.6, 11.8, 13.0, 14.2, 15.4, 16.5, 17.7, 18.9, 20.0, 24.0}; + }; + class RH_556x45_B_Mk318: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=62; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.307}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={780, 886, 950}; + ACE_barrelLengths[]={10, 15.5, 20}; + }; + class RH_556x45_B_Mk262: B_556x45_Ball + { + ACE_caliber=0.224; + ACE_bulletLength=0.906; + ACE_bulletMass=77; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.361}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={624, 816, 832, 838}; + ACE_barrelLengths[]={7.5, 14.5, 18, 20}; + }; + class RH_68x43_B_FMJ: B_65x39_Caseless + { + ACE_caliber=0.277; + ACE_bulletLength=0.959; + ACE_bulletMass=115; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.162}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={713, 785, 810, 850}; + ACE_barrelLengths[]={12, 16, 20, 24}; + }; + class RH_68x43_B_Match: B_65x39_Caseless + { + ACE_caliber=0.277; + ACE_bulletLength=1.250; + ACE_bulletMass=135; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.253}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 732, 750, 780}; + ACE_barrelLengths[]={12, 16, 20, 24}; + }; + class RH_762x35_B_FMJ: B_65x39_Caseless + { + ACE_caliber=0.308; + ACE_bulletLength=1.118; + ACE_bulletMass=147; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.398}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={559, 609, 625}; + ACE_barrelLengths[]={6, 16, 20}; + }; + class RH_762x35_B_Match: B_65x39_Caseless + { + ACE_caliber=0.308; + ACE_bulletLength=1.153; + ACE_bulletMass=125; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.349, 0.338, 0.330, 0.310}; + ACE_velocityBoundaries[]={792, 610, 488}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={572, 676, 700}; + ACE_barrelLengths[]={6, 16, 20}; + }; + class RH_762x35_B_MSB: B_65x39_Caseless + { + ACE_caliber=0.308; + ACE_bulletLength=1.489; + ACE_bulletMass=220; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.608}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={300, 320, 340}; + ACE_barrelLengths[]={9, 16, 20}; + }; + class RH_762x51_B_M80A1: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.14; + ACE_bulletMass=146; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={10, 16, 20, 24, 26}; + }; + class RH_762x51_B_Mk316LR: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.24; + ACE_bulletMass=175; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; + ACE_ballisticCoefficients[]={0.243}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={775, 790, 805, 810}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; + class RH_762x51_B_Mk319: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.24; + ACE_bulletMass=130; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.377}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={838, 892, 910}; + ACE_barrelLengths[]={13, 16, 20}; + }; + class RH_762x51_B_LFMJSB: B_762x51_Ball + { + ACE_caliber=0.308; + ACE_bulletLength=1.340; + ACE_bulletMass=200; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.235}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={305, 325, 335, 340}; + ACE_barrelLengths[]={16, 20, 24, 26}; + }; +}; diff --git a/optionals/compat_rh_m4/CfgWeapons.hpp b/optionals/compat_rh_m4/CfgWeapons.hpp new file mode 100644 index 0000000000..69536e9302 --- /dev/null +++ b/optionals/compat_rh_m4/CfgWeapons.hpp @@ -0,0 +1,130 @@ + +class CfgWeapons +{ + class Rifle_Base_F; + class RH_ar10: Rifle_Base_F + { + ACE_barrelTwist=11.25; + ACE_barrelLength=20.8; + }; + class RH_m110: Rifle_Base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=20; + }; + class RH_Mk11: RH_m110 + { + ACE_barrelTwist=11.25; + ACE_barrelLength=24; + }; + class RH_SR25EC: RH_m110 + { + ACE_barrelTwist=11.25; + ACE_barrelLength=20; + }; + class RH_m4: Rifle_Base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class RH_M4_ris: RH_m4 + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class RH_M4A1_ris: RH_M4_ris + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class RH_M4m: RH_M4A1_ris + { + ACE_barrelTwist=7; + ACE_barrelLength=10.5; + }; + class RH_M4sbr: RH_M4A1_ris + { + ACE_barrelTwist=7; + ACE_barrelLength=10.5; + }; + class RH_hb: Rifle_Base_F + { + ACE_barrelTwist=8; + ACE_barrelLength=6; + }; + class RH_hb_b: RH_hb + { + ACE_barrelTwist=8; + ACE_barrelLength=6; + }; + class RH_sbr9: Rifle_Base_F + { + ACE_barrelTwist=9.7; + ACE_barrelLength=9; + }; + class RH_M4A6: RH_M4A1_ris + { + ACE_barrelTwist=10; + ACE_barrelLength=14.5; + }; + class RH_M16a1: RH_m4 + { + ACE_barrelTwist=14; + ACE_barrelLength=20; + }; + class RH_M16A2: RH_m4 + { + ACE_barrelTwist=7; + ACE_barrelLength=20; + }; + class RH_M16A4 : RH_M4_ris + { + ACE_barrelTwist=7; + ACE_barrelLength=20; + }; + class RH_M16A3: RH_M16A4 + { + ACE_barrelTwist=7; + ACE_barrelLength=20; + }; + class RH_M16A4_m: RH_M16A4 + { + ACE_barrelTwist=7; + ACE_barrelLength=20; + }; + class RH_M16A6: RH_M16A4 + { + ACE_barrelTwist=7; + ACE_barrelLength=20; + }; + class RH_Mk12mod1: RH_M16A4 + { + ACE_barrelTwist=7; + ACE_barrelLength=18; + }; + class RH_SAMR: RH_Mk12mod1 + { + ACE_barrelTwist=7.7; + ACE_barrelLength=20; + }; + class RH_Hk416: RH_M4A1_ris + { + ACE_barrelTwist=7; + ACE_barrelLength=14.5; + }; + class RH_Hk416s: RH_M4sbr + { + ACE_barrelTwist=7; + ACE_barrelLength=10.4; + }; + class RH_Hk416c: RH_M4sbr + { + ACE_barrelTwist=7; + ACE_barrelLength=9; + }; + class RH_M27IAR: RH_Mk12mod1 + { + ACE_barrelTwist=7; + ACE_barrelLength=16.5; + }; +}; \ No newline at end of file diff --git a/optionals/compat_rh_m4/config.cpp b/optionals/compat_rh_m4/config.cpp new file mode 100644 index 0000000000..9c28be4f89 --- /dev/null +++ b/optionals/compat_rh_m4/config.cpp @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RH_m4_cfg"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgWeapons.hpp" diff --git a/optionals/compat_rh_m4/script_component.hpp b/optionals/compat_rh_m4/script_component.hpp new file mode 100644 index 0000000000..167c926dd7 --- /dev/null +++ b/optionals/compat_rh_m4/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT RH_m4_cfg_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rh_pdw/CfgAmmo.hpp b/optionals/compat_rh_pdw/CfgAmmo.hpp new file mode 100644 index 0000000000..706344ff8c --- /dev/null +++ b/optionals/compat_rh_pdw/CfgAmmo.hpp @@ -0,0 +1,15 @@ + +class BulletBase; +class RH_B_6x35: BulletBase +{ + ACE_caliber=0.224; + ACE_bulletLength=0.445; + ACE_bulletMass=65; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.26}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={730, 750, 760}; + ACE_barrelLengths[]={8, 10, 12}; +}; \ No newline at end of file diff --git a/optionals/compat_rh_pdw/CfgWeapons.hpp b/optionals/compat_rh_pdw/CfgWeapons.hpp new file mode 100644 index 0000000000..b009a202ce --- /dev/null +++ b/optionals/compat_rh_pdw/CfgWeapons.hpp @@ -0,0 +1,10 @@ + +class CfgWeapons +{ + class Rifle_Base_F; + class RH_PDW: Rifle_Base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=10; + }; +}; diff --git a/optionals/compat_rh_pdw/config.cpp b/optionals/compat_rh_pdw/config.cpp new file mode 100644 index 0000000000..4aed0e6241 --- /dev/null +++ b/optionals/compat_rh_pdw/config.cpp @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RH_PDW"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgWeapons.hpp" diff --git a/optionals/compat_rh_pdw/script_component.hpp b/optionals/compat_rh_pdw/script_component.hpp new file mode 100644 index 0000000000..67c4617e06 --- /dev/null +++ b/optionals/compat_rh_pdw/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT RH_PDW_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rksl_pm_ii/CfgWeapons.hpp b/optionals/compat_rksl_pm_ii/CfgWeapons.hpp new file mode 100644 index 0000000000..621dd98b71 --- /dev/null +++ b/optionals/compat_rksl_pm_ii/CfgWeapons.hpp @@ -0,0 +1,33 @@ + +class CfgWeapons { + class ItemCore; + class InventoryOpticsItem_Base_F; + + class RKSL_optic_PMII_312 : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class Snip { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + + class RKSL_optic_PMII_312_sunshade : ItemCore { + ACE_ScopeAdjust_Vertical[] = { -4, 30 }; + ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; + ACE_ScopeAdjust_Increment = 0.1; + class ItemInfo : InventoryOpticsItem_Base_F { + class OpticsModes { + class Snip { + discreteDistance[] = { 100 }; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; +}; diff --git a/optionals/compat_rksl_pm_ii/config.cpp b/optionals/compat_rksl_pm_ii/config.cpp new file mode 100644 index 0000000000..c3ed720f8b --- /dev/null +++ b/optionals/compat_rksl_pm_ii/config.cpp @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RKSL_PMII"}; + author[]={"Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/optionals/compat_rksl_pm_ii/script_component.hpp b/optionals/compat_rksl_pm_ii/script_component.hpp new file mode 100644 index 0000000000..a98639b0e8 --- /dev/null +++ b/optionals/compat_rksl_pm_ii/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT RKSL_PMII_comp + +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/tools/make.cfg b/tools/make.cfg index e89568d60e..5e2d9d78da 100644 --- a/tools/make.cfg +++ b/tools/make.cfg @@ -17,6 +17,11 @@ project = @ace # Default: None # key = D:\Program Files (x86)\Bohemia Interactive\Tools\DSSignFile Tools\keys\ace_preAlpha.biprivatekey +# Path to where private keys are automatically created if the command-line parameter "key" is used +# Make sure this isn't in your public repository! +# Default: \private_keys +# private_key_path = P:\private_keys + # If set to True, the make system will attempt to autodetect addons in the # current folder by looking for directories with 'config.cpp' in them. # Default: True diff --git a/tools/make.py b/tools/make.py index 5146a666bb..382f8dd776 100644 --- a/tools/make.py +++ b/tools/make.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : # make.py @@ -35,8 +35,8 @@ __version__ = "0.4" import sys if sys.version_info[0] == 2: - print("Python 3 is required.") - sys.exit(1) + print("Python 3 is required.") + sys.exit(1) import os import os.path @@ -52,7 +52,7 @@ import time import re if sys.platform == "win32": - import winreg + import winreg ######## GLOBALS ######### work_drive = "" @@ -60,6 +60,9 @@ module_root = "" release_dir = "" module_root_parent = "" optionals_root = "" +key_name = "ace_preAlpha" +key = "" +dssignfile = "" ############################################################################### # http://akiscode.com/articles/sha-1directoryhash.shtml @@ -70,369 +73,430 @@ optionals_root = "" # -1 -> Directory does not exist # -2 -> General error (see stack traceback) def get_directory_hash(directory): - directory_hash = hashlib.sha1() - if not os.path.exists (directory): - return -1 + directory_hash = hashlib.sha1() + if not os.path.exists (directory): + return -1 - try: - for root, dirs, files in os.walk(directory): - for names in files: - path = os.path.join(root, names) - try: - f = open(path, 'rb') - except: - # You can't open the file for some reason - f.close() - continue + try: + for root, dirs, files in os.walk(directory): + for names in files: + path = os.path.join(root, names) + try: + f = open(path, 'rb') + except: + # You can't open the file for some reason + f.close() + continue - while 1: - # Read file in as little chunks - buf = f.read(4096) - if not buf: break - new = hashlib.sha1(buf) - directory_hash.update(new.digest()) - f.close() + while 1: + # Read file in as little chunks + buf = f.read(4096) + if not buf: break + new = hashlib.sha1(buf) + directory_hash.update(new.digest()) + f.close() - except: - # Print the stack traceback - traceback.print_exc() - return -2 + except: + # Print the stack traceback + traceback.print_exc() + return -2 - return directory_hash.hexdigest() + return directory_hash.hexdigest() # Copyright (c) André Burgaud # http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ if sys.platform == "win32": - from ctypes import windll, Structure, c_short, c_ushort, byref + from ctypes import windll, Structure, c_short, c_ushort, byref - SHORT = c_short - WORD = c_ushort + SHORT = c_short + WORD = c_ushort - class COORD(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("X", SHORT), - ("Y", SHORT)] + class COORD(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("X", SHORT), + ("Y", SHORT)] - class SMALL_RECT(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("Left", SHORT), - ("Top", SHORT), - ("Right", SHORT), - ("Bottom", SHORT)] + class SMALL_RECT(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("Left", SHORT), + ("Top", SHORT), + ("Right", SHORT), + ("Bottom", SHORT)] - class CONSOLE_SCREEN_BUFFER_INFO(Structure): - """struct in wincon.h.""" - _fields_ = [ - ("dwSize", COORD), - ("dwCursorPosition", COORD), - ("wAttributes", WORD), - ("srWindow", SMALL_RECT), - ("dwMaximumWindowSize", COORD)] + class CONSOLE_SCREEN_BUFFER_INFO(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("dwSize", COORD), + ("dwCursorPosition", COORD), + ("wAttributes", WORD), + ("srWindow", SMALL_RECT), + ("dwMaximumWindowSize", COORD)] - # winbase.h - STD_INPUT_HANDLE = -10 - STD_OUTPUT_HANDLE = -11 - STD_ERROR_HANDLE = -12 + # winbase.h + STD_INPUT_HANDLE = -10 + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 - # wincon.h - FOREGROUND_BLACK = 0x0000 - FOREGROUND_BLUE = 0x0001 - FOREGROUND_GREEN = 0x0002 - FOREGROUND_CYAN = 0x0003 - FOREGROUND_RED = 0x0004 - FOREGROUND_MAGENTA = 0x0005 - FOREGROUND_YELLOW = 0x0006 - FOREGROUND_GREY = 0x0007 - FOREGROUND_INTENSITY = 0x0008 # foreground color is intensified. + # wincon.h + FOREGROUND_BLACK = 0x0000 + FOREGROUND_BLUE = 0x0001 + FOREGROUND_GREEN = 0x0002 + FOREGROUND_CYAN = 0x0003 + FOREGROUND_RED = 0x0004 + FOREGROUND_MAGENTA = 0x0005 + FOREGROUND_YELLOW = 0x0006 + FOREGROUND_GREY = 0x0007 + FOREGROUND_INTENSITY = 0x0008 # foreground color is intensified. - BACKGROUND_BLACK = 0x0000 - BACKGROUND_BLUE = 0x0010 - BACKGROUND_GREEN = 0x0020 - BACKGROUND_CYAN = 0x0030 - BACKGROUND_RED = 0x0040 - BACKGROUND_MAGENTA = 0x0050 - BACKGROUND_YELLOW = 0x0060 - BACKGROUND_GREY = 0x0070 - BACKGROUND_INTENSITY = 0x0080 # background color is intensified. + BACKGROUND_BLACK = 0x0000 + BACKGROUND_BLUE = 0x0010 + BACKGROUND_GREEN = 0x0020 + BACKGROUND_CYAN = 0x0030 + BACKGROUND_RED = 0x0040 + BACKGROUND_MAGENTA = 0x0050 + BACKGROUND_YELLOW = 0x0060 + BACKGROUND_GREY = 0x0070 + BACKGROUND_INTENSITY = 0x0080 # background color is intensified. - stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) - SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute - GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo + stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) + SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute + GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo - def get_text_attr(): - """Returns the character attributes (colors) of the console screen - buffer.""" - csbi = CONSOLE_SCREEN_BUFFER_INFO() - GetConsoleScreenBufferInfo(stdout_handle, byref(csbi)) - return csbi.wAttributes + def get_text_attr(): + """Returns the character attributes (colors) of the console screen + buffer.""" + csbi = CONSOLE_SCREEN_BUFFER_INFO() + GetConsoleScreenBufferInfo(stdout_handle, byref(csbi)) + return csbi.wAttributes - def set_text_attr(color): - """Sets the character attributes (colors) of the console screen - buffer. Color is a combination of foreground and background color, - foreground and background intensity.""" - SetConsoleTextAttribute(stdout_handle, color) + def set_text_attr(color): + """Sets the character attributes (colors) of the console screen + buffer. Color is a combination of foreground and background color, + foreground and background intensity.""" + SetConsoleTextAttribute(stdout_handle, color) ############################################################################### def find_bi_tools(work_drive): - """Find BI tools.""" + """Find BI tools.""" - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - try: - k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") - arma3tools_path = winreg.QueryValueEx(k, "path")[0] - winreg.CloseKey(k) - except: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") - addonbuilder_path = os.path.join(arma3tools_path, "AddonBuilder", "AddonBuilder.exe") - dssignfile_path = os.path.join(arma3tools_path, "DSSignFile", "DSSignFile.exe") - dscreatekey_path = os.path.join(arma3tools_path, "DSSignFile", "DSCreateKey.exe") - cfgconvert_path = os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe") + addonbuilder_path = os.path.join(arma3tools_path, "AddonBuilder", "AddonBuilder.exe") + dssignfile_path = os.path.join(arma3tools_path, "DSSignFile", "DSSignFile.exe") + dscreatekey_path = os.path.join(arma3tools_path, "DSSignFile", "DSCreateKey.exe") + cfgconvert_path = os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe") + + if os.path.isfile(addonbuilder_path) and os.path.isfile(dssignfile_path) and os.path.isfile(dscreatekey_path) and os.path.isfile(cfgconvert_path): + return [addonbuilder_path, dssignfile_path, dscreatekey_path, cfgconvert_path] + else: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") - if os.path.isfile(addonbuilder_path) and os.path.isfile(dssignfile_path) and os.path.isfile(dscreatekey_path) and os.path.isfile(cfgconvert_path): - return [addonbuilder_path, dssignfile_path, dscreatekey_path, cfgconvert_path] - else: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") def find_depbo_tools(regKey): - """Use registry entries to find DePBO-based tools.""" - stop = False + """Use registry entries to find DePBO-based tools.""" + stop = False - if regKey == "HKCU": - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - stop = True - else: - reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + if regKey == "HKCU": + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + stop = True + else: + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - try: - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\pboProject") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\pboProject") - try: - pboproject_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found pboproject.") - except: - print_error("ERROR: Could not find pboProject.") + try: + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\pboProject") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\pboProject") + try: + pboproject_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found pboproject.") + except: + print_error("ERROR: Could not find pboProject.") - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\rapify") - try: - rapify_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found rapify.") - except: - print_error("Could not find rapify.") + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\rapify") + try: + rapify_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found rapify.") + except: + print_error("Could not find rapify.") - try: - k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\MakePbo") - except FileNotFoundError: - k = winreg.OpenKey(reg, r"Software\Mikero\MakePbo") - try: - makepbo_path = winreg.QueryValueEx(k, "exe")[0] - winreg.CloseKey(k) - print("Found makepbo.") - except: - print_error("Could not find makepbo.") - except: - if stop == True: - raise Exception("BadDePBO", "DePBO tools not installed correctly") - return -1 + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\MakePbo") + except FileNotFoundError: + k = winreg.OpenKey(reg, r"Software\Mikero\MakePbo") + try: + makepbo_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found makepbo.") + except: + print_error("Could not find makepbo.") + except: + if stop == True: + raise Exception("BadDePBO", "DePBO tools not installed correctly") + return -1 - #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. - return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] + #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. + return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] + def color(color): - """Set the color. Works on Win32 and normal terminals.""" - if sys.platform == "win32": - if color == "green": - set_text_attr(FOREGROUND_GREEN | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "red": - set_text_attr(FOREGROUND_RED | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "blue": - set_text_attr(FOREGROUND_BLUE | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) - elif color == "reset": - set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) - elif color == "grey": - set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) - else : - if color == "green": - sys.stdout.write('\033[92m') - elif color == "red": - sys.stdout.write('\033[91m') - elif color == "blue": - sys.stdout.write('\033[94m') - elif color == "reset": - sys.stdout.write('\033[0m') + """Set the color. Works on Win32 and normal terminals.""" + if sys.platform == "win32": + if color == "green": + set_text_attr(FOREGROUND_GREEN | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "yellow": + set_text_attr(FOREGROUND_YELLOW | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "red": + set_text_attr(FOREGROUND_RED | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "blue": + set_text_attr(FOREGROUND_BLUE | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "reset": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + elif color == "grey": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + else : + if color == "green": + sys.stdout.write('\033[92m') + elif color == "red": + sys.stdout.write('\033[91m') + elif color == "blue": + sys.stdout.write('\033[94m') + elif color == "reset": + sys.stdout.write('\033[0m') def print_error(msg): - color("red") - print ("ERROR: " + msg) - color("reset") + color("red") + print ("ERROR: " + msg) + color("reset") def print_green(msg): - color("green") - print(msg) - color("reset") + color("green") + print(msg) + color("reset") def print_blue(msg): - color("blue") - print(msg) - color("reset") + color("blue") + print(msg) + color("reset") def print_yellow(msg): - color("yellow") - print(msg) - color("reset") + color("yellow") + print(msg) + color("reset") + - def copy_important_files(source_dir,destination_dir): - - originalDir = os.getcwd() - importantFiles = ["mod.cpp", - "README.md", - "AUTHORS.txt", - "LICENSE", - "logo_ace3_ca.paa" - ] - - print_yellow ("source_dir: " + source_dir) - print_yellow("destination_dir: " + destination_dir) - - #copy importantFiles - try: - print_blue("\nSearching for important files in " + source_dir) - for file in importantFiles: - print_green("Copying file => " + os.path.join(source_dir,file)) - shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) - except: - print_error("COPYING IMPORTANT FILES.") - raise - - #copy all extension dlls - try: - os.chdir(os.path.join(source_dir)) - print_blue("\nSearching for DLLs in " + os.getcwd()) - filenames = glob.glob("*.dll") - - if not filenames: - print ("Empty SET") - - for dll in filenames: - print_green("Copying dll => " + os.path.join(source_dir,dll)) - if os.path.isfile(dll): - shutil.copyfile(os.path.join(source_dir,dll),os.path.join(destination_dir,dll)) - except: - print_error("COPYING DLL FILES.") - raise - finally: - os.chdir(originalDir) + + originalDir = os.getcwd() + importantFiles = ["mod.cpp", + "README.md", + "AUTHORS.txt", + "LICENSE", + "logo_ace3_ca.paa" + ] + + #copy importantFiles + try: + print_blue("\nSearching for important files in " + source_dir) + print("Source_dir: " + source_dir) + print("Destination_dir: " + destination_dir) + + for file in importantFiles: + print_green("Copying file => " + os.path.join(source_dir,file)) + shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) + except: + print_error("COPYING IMPORTANT FILES.") + raise + + #copy all extension dlls + try: + os.chdir(os.path.join(source_dir)) + print_blue("\nSearching for DLLs in " + os.getcwd()) + filenames = glob.glob("*.dll") + + if not filenames: + print ("Empty SET") + + for dll in filenames: + print_green("Copying dll => " + os.path.join(source_dir,dll)) + if os.path.isfile(dll): + shutil.copyfile(os.path.join(source_dir,dll),os.path.join(destination_dir,dll)) + except: + print_error("COPYING DLL FILES.") + raise + finally: + os.chdir(originalDir) + def copy_optionals_for_building(mod,pbos): - src_directories = os.listdir(optionals_root) - current_dir = os.getcwd() - - print("") - try: - - #special server.pbo processing - files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) - for file in files: - file_name = os.path.basename(file) - print ("Adding the following file: " + file_name) - pbos.append(file_name) - pbo_path = os.path.join(release_dir, "@ace","optionals",file_name) - if (os.path.isfile(pbo_path)): - print("Moving " + pbo_path + " for processing.") - shutil.move(pbo_path, os.path.join(release_dir,"@ace","addons",file_name)) + src_directories = os.listdir(optionals_root) + current_dir = os.getcwd() - except: - print_error("Error in moving") - raise - finally: - os.chdir(current_dir) + print_blue("\nChecking Optionals folder...") + try: - print("") - try: - for dir_name in src_directories: - mod.append(dir_name) - if (dir_name == "userconfig"): - destination = os.path.join(work_drive,dir_name) - else: - destination = os.path.join(module_root,dir_name) + #special server.pbo processing + files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) + for file in files: + file_name = os.path.basename(file) + #print ("Adding the following file: " + file_name) + pbos.append(file_name) + pbo_path = os.path.join(release_dir, "@ace","optionals",file_name) + sigFile_name = file_name +"."+ key_name + ".bisign" + sig_path = os.path.join(release_dir, "@ace","optionals",sigFile_name) + if (os.path.isfile(pbo_path)): + print("Moving " + pbo_path + " for processing.") + shutil.move(pbo_path, os.path.join(release_dir,"@ace","addons",file_name)) - print("Temporarily copying " + os.path.join(optionals_root,dir_name) + " => " + destination + " for building.") - shutil.rmtree(destination, True) - shutil.copytree(os.path.join(optionals_root,dir_name), destination) - except: - print_error("Copy Optionals Failed") - raise - finally: - os.chdir(current_dir) - -def cleanup_optionals(mod,pbos): - print("") - try: - for dir_name in mod: - if (dir_name == "userconfig"): - destination = os.path.join(work_drive,dir_name) - else: - destination = os.path.join(module_root,dir_name) - - print("Cleaning " + destination) - - try: - file_name = "ace_{}.pbo".format(dir_name) - src_file_path = os.path.join(release_dir, "@ace","addons",file_name) - dst_file_path = os.path.join(release_dir, "@ace","optionals",file_name) - if (os.path.isfile(src_file_path)): - #print("Preserving " + file_name) - os.renames(src_file_path,dst_file_path) - except FileExistsError: - print_error(file_name + " already exists") - continue - shutil.rmtree(destination) - - except: - print_error("Cleaning Optionals Failed") - raise + if (os.path.isfile(sig_path)): + #print("Moving " + sig_path + " for processing.") + shutil.move(sig_path, os.path.join(release_dir,"@ace","addons",sigFile_name)) + except: + print_error("Error in moving") + raise + finally: + os.chdir(current_dir) + + print("") + try: + for dir_name in src_directories: + mod.append(dir_name) + #userconfig requires special handling since it is not a PBO source folder. + #CfgConvert fails to build server.pbo if userconfig is not found in P:\ + if (dir_name == "userconfig"): + if (os.path.exists(os.path.join(release_dir, "@ace","optionals",dir_name))): + shutil.rmtree(os.path.join(release_dir, "@ace","optionals",dir_name), True) + shutil.copytree(os.path.join(optionals_root,dir_name), os.path.join(release_dir, "@ace","optionals",dir_name)) + destination = os.path.join(work_drive,dir_name) + else: + destination = os.path.join(module_root,dir_name) + + print("Temporarily copying " + os.path.join(optionals_root,dir_name) + " => " + destination + " for building.") + if (os.path.exists(destination)): + shutil.rmtree(destination, True) + shutil.copytree(os.path.join(optionals_root,dir_name), destination) + except: + print_error("Copy Optionals Failed") + raise + finally: + os.chdir(current_dir) + + +def cleanup_optionals(mod): + print("") + try: + for dir_name in mod: + #userconfig requires special handling since it is not a PBO source folder. + if (dir_name == "userconfig"): + destination = os.path.join(work_drive,dir_name) + else: + destination = os.path.join(module_root,dir_name) + + print("Cleaning " + destination) + + try: + file_name = "ace_{}.pbo".format(dir_name) + src_file_path = os.path.join(release_dir, "@ace","addons",file_name) + dst_file_path = os.path.join(release_dir, "@ace","optionals",file_name) + + sigFile_name = file_name +"."+ key_name + ".bisign" + src_sig_path = os.path.join(release_dir, "@ace","addons",sigFile_name) + dst_sig_path = os.path.join(release_dir, "@ace","optionals",sigFile_name) + + if (os.path.isfile(src_file_path)): + #print("Preserving " + file_name) + os.renames(src_file_path,dst_file_path) + if (os.path.isfile(src_sig_path)): + #print("Preserving " + sigFile_name) + os.renames(src_sig_path,dst_sig_path) + except FileExistsError: + print_error(file_name + " already exists") + continue + shutil.rmtree(destination) + + except: + print_error("Cleaning Optionals Failed") + raise + + +def purge(dir, pattern, friendlyPattern="files"): + print_green("Deleting " + friendlyPattern + " files from directory: " + dir) + for f in os.listdir(dir): + if re.search(pattern, f): + os.remove(os.path.join(dir, f)) + + +def build_signature_file(file_name): + global key + global dssignfile + print("Signing with " + key + ".") + ret = subprocess.call([dssignfile, key, file_name]) + if ret == 0: + return True + else: + return False + + +def check_for_obsolete_pbos(addonspath, file): + module = file[4:-4] + if not os.path.exists(os.path.join(addonspath, module)): + return True + return False ############################################################################### + def main(argv): - """Build an Arma addon suite in a directory from rules in a make.cfg file.""" - print_blue(("\nmake.py for Arma, modified for Advanced Combat Environment v" + __version__)) + """Build an Arma addon suite in a directory from rules in a make.cfg file.""" + print_blue(("\nmake.py for Arma, modified for Advanced Combat Environment v" + __version__)) - if sys.platform != "win32": - print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") - sys.exit(1) + global work_drive + global module_root + global release_dir + global module_root_parent + global optionals_root + global key_name + global key + global dssignfile - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) - try: - k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") - arma3tools_path = winreg.QueryValueEx(k, "path")[0] - winreg.CloseKey(k) - except: - raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + if sys.platform != "win32": + print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") + sys.exit(1) - # Default behaviors - test = False # Copy to Arma 3 directory? - arg_modules = False # Only build modules on command line? - make_release = False # Make zip file from the release? - release_version = 0 # Version of release - use_pboproject = True # Default to pboProject build tool - make_target = "DEFAULT" # Which section in make.cfg to use for the build - new_key = False # Make a new key and use it to sign? - quiet = False # Suppress output from build tool? + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") - # Parse arguments - if "help" in argv or "-h" in argv or "--help" in argv: - print (""" + # Default behaviors + test = False # Copy to Arma 3 directory? + arg_modules = False # Only build modules on command line? + make_release = False # Make zip file from the release? + release_version = 0 # Version of release + use_pboproject = True # Default to pboProject build tool + make_target = "DEFAULT" # Which section in make.cfg to use for the build + new_key = True # Make a new key and use it to sign? + quiet = False # Suppress output from build tool? + + # Parse arguments + if "help" in argv or "-h" in argv or "--help" in argv: + print (""" make.py [help] [test] [force] [key ] [target ] [release ] [module name] [module name] [...] @@ -463,539 +527,584 @@ If a file called $NOBIN$ is found in the module directory, that module will not See the make.cfg file for additional build options. """) - sys.exit(0) - - if "force" in argv: - argv.remove("force") - force_build = True - else: - force_build = False - - if "test" in argv: - test = True - argv.remove("test") - - if "release" in argv: - make_release = True - release_version = argv[argv.index("release") + 1] - argv.remove(release_version) - argv.remove("release") - - if "target" in argv: - make_target = argv[argv.index("target") + 1] - argv.remove("target") - argv.remove(make_target) - force_build = True - - if "key" in argv: - new_key = True - key_name = argv[argv.index("key") + 1] - argv.remove("key") - argv.remove(key_name) - - if "quiet" in argv: - quiet = True - argv.remove("quiet") - - if "checkexternal" in argv: - argv.remove("checkexternal") - check_external = True - else: - check_external = False - - # Get the directory the make script is in. - make_root = os.path.dirname(os.path.realpath(__file__)) - make_root_parent = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) - os.chdir(make_root) - - # Get latest commit ID - try: - gitpath = os.path.join(os.path.dirname(make_root), ".git") - assert os.path.exists(gitpath) - - commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"]) - commit_id = str(commit_id, "utf-8")[:8] - except: - print_error("FAILED TO DETERMINE COMMIT ID.") - commit_id = "NOGIT" - - cfg = configparser.ConfigParser(); - try: - global work_drive - global module_root - global release_dir - global module_root_parent - global optionals_root - - cfg.read(os.path.join(make_root, "make.cfg")) - - # Project name (with @ symbol) - project = cfg.get(make_target, "project", fallback="@"+os.path.basename(os.getcwd())) - - # Private key path - key = cfg.get(make_target, "key", fallback=None) - - # Project prefix (folder path) - prefix = cfg.get(make_target, "prefix", fallback="") - - # Should we autodetect modules on a complete build? - module_autodetect = cfg.getboolean(make_target, "module_autodetect", fallback=True) - - # Manual list of modules to build for a complete build - modules = cfg.get(make_target, "modules", fallback=None) - # Parse it out - if modules: - modules = [x.strip() for x in modules.split(',')] - else: - modules = [] - - # List of directories to ignore when detecting - ignore = [x.strip() for x in cfg.get(make_target, "ignore", fallback="release").split(',')] - - # BI Tools work drive on Windows - work_drive = cfg.get(make_target, "work_drive", fallback="P:\\") - - # Which build tool should we use? - build_tool = cfg.get(make_target, "build_tool", fallback="addonbuilder").lower() - - # Release/build directory, relative to script dir - release_dir = cfg.get(make_target, "release_dir", fallback="release") - - # Project PBO file prefix (files are renamed to prefix_name.pbo) - pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None) - - # Project module Root - module_root_parent = os.path.abspath(os.path.join(os.path.join(work_drive, prefix), os.pardir)) - module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons")) - optionals_root = os.path.join(module_root_parent, "optionals") - print_green ("module_root: " + module_root) - - if (os.path.isdir(module_root)): - os.chdir(module_root) - else: - print_error ("Directory " + module_root + " does not exist.") - sys.exit() - - if (os.path.isdir(optionals_root)): - print_green ("optionals_root: " + optionals_root) - else: - print_error ("Directory " + optionals_root + " does not exist.") - sys.exit() - - print_green ("release_dir: " + release_dir) - - except: - raise - print_error("Could not parse make.cfg.") - sys.exit(1) - - # See if we have been given specific modules to build from command line. - if len(argv) > 1 and not make_release: - arg_modules = True - modules = argv[1:] - - # Find the tools we need. - try: - tools = find_bi_tools(work_drive) - addonbuilder = tools[0] - dssignfile = tools[1] - dscreatekey = tools[2] - cfgconvert = tools[3] - - except: - print_error("Arma 3 Tools are not installed correctly or the P: drive has not been created.") - sys.exit(1) - - if build_tool == "pboproject": - try: - depbo_tools = find_depbo_tools("HKLM") - if depbo_tools == -1: - depbo_tools = find_depbo_tools("HKCU") - pboproject = depbo_tools[0] - rapifyTool = depbo_tools[1] - makepboTool = depbo_tools[2] - except: - raise - print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files") - sys.exit(1) - - # Try to open and deserialize build cache file. - try: - cache = {} - with open(os.path.join(make_root, "make.cache"), 'r') as f: - cache_raw = f.read() - - cache = json.loads(cache_raw) - - except: - print ("No cache found.") - cache = {} - - #Temporarily copy optionals_root for building. They will be removed later. - optionals_modules = [] - optional_files = [] - copy_optionals_for_building(optionals_modules,optional_files) - - # Get list of subdirs in make root. - dirs = next(os.walk(module_root))[1] - - # Autodetect what directories to build. - if module_autodetect and not arg_modules: - modules = [] - for path in dirs: - # Any dir that has a config.cpp in its root is an addon to build. - config_path = os.path.join(path, 'config.cpp') - if os.path.isfile(config_path) and not path in ignore: - modules.append(path) - - # Make the key specified from command line if necessary. - if new_key: - if not os.path.isfile(os.path.join(module_root, key_name + ".biprivatekey")): - print_green("\nRequested key does not exist.") - ret = subprocess.call([dscreatekey, key_name]) # Created in make_root - if ret == 0: - print_blue("Created: " + os.path.join(module_root, key_name + ".biprivatekey")) - else: - print_error("Failed to create key!") - - try: - print_blue("Copying public key to release directory.") - - try: - os.makedirs(os.path.join(module_root, release_dir, "Keys")) - except: - pass - - shutil.copyfile(os.path.join(module_root, key_name + ".bikey"), os.path.join(module_root, release_dir, "Keys", key_name + ".bikey")) - - except: - raise - print_error("Could not copy key to release directory.") - - else: - print_green("\nNOTE: Using key " + os.path.join(module_root, key_name + ".biprivatekey")) - - key = os.path.join(module_root, key_name + ".biprivatekey") - - - # For each module, prep files and then build. - for module in modules: - print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) - missing = False - - # Cache check - if module in cache: - old_sha = cache[module] - else: - old_sha = "" - - #We always build ACE_common so we can properly show the correct version stamp in the RPT file. - if module == "common": - old_sha = "" - - # Hash the module - new_sha = get_directory_hash(os.path.join(module_root, module)) - - # Is the pbo file missing? - missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module))) - if missing: - print("ace_{}.pbo".format(module) + " is missing. Building...") - - # Check if it needs rebuilt - # print ("Hash:", new_sha) - if old_sha == new_sha and not missing: - if not force_build: - print("Module has not changed.") - # Skip everything else - continue - - # Only do this if the project isn't stored directly on the work drive. - # Split the path at the drive name and see if they are on the same drive (usually P:) - if os.path.splitdrive(module_root)[0] != os.path.splitdrive(work_drive)[0]: - try: - # Remove old work drive version (ignore errors) - shutil.rmtree(os.path.join(work_drive, prefix, module), True) - - # Copy module to the work drive - shutil.copytree(module, os.path.join(work_drive, prefix, module)) - - except: - raise - print_error("ERROR: Could not copy module to work drive. Does the module exist?") - input("Press Enter to continue...") - print("Resuming build...") - continue - #else: - #print("WARNING: Module is stored on work drive (" + work_drive + ").") - - try: - # Remove the old pbo, key, and log - old = os.path.join(module_root, release_dir, project, "Addons", module) + "*" - files = glob.glob(old) - for f in files: - os.remove(f) - - if pbo_name_prefix: - old = os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module) + "*" - files = glob.glob(old) - for f in files: - os.remove(f) - except: - raise - print_error("ERROR: Could not copy module to work drive. Does the module exist?") - input("Press Enter to continue...") - print("Resuming build...") - continue - - # Build the module into a pbo - print_blue("Building: " + os.path.join(work_drive, prefix, module)) - print_blue("Destination: " + os.path.join(module_root, release_dir, project, "Addons")) - - # Make destination folder (if needed) - try: - os.makedirs(os.path.join(module_root, release_dir, project, "Addons")) - except: - pass - - # Run build tool - build_successful = False - if build_tool == "pboproject": - try: - #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) - - os.chdir("P:\\") - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -bin return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - - # Include build number - try: - configpath = os.path.join(work_drive, prefix, module, "config.cpp") - f = open(configpath, "r") - configtext = f.read() - f.close() - - if configtext: - patchestext = re.search(r"class CfgPatches\n\{(.*?)\n\}", configtext, re.DOTALL).group(1) - patchestext = re.sub(r'version(.*?)="(.*?)"', r'version\1="\2-{}"'.format(commit_id), patchestext) - configtext = re.sub(r"class CfgPatches\n\{(.*?)\n\}", "class CfgPatches\n{"+patchestext+"\n}", configtext, flags=re.DOTALL) - f = open(configpath, "w") - f.write(configtext) - f.close() - else: - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - except: - raise - print_error("Failed to include build number") - continue - - if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): - print_green("$NOBIN$ Found. Proceeding with non-binarizing!") - cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"Addons")] - - else: - if check_external: - cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "+X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] - else: - cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "-X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] - - color("grey") - if quiet: - devnull = open(os.devnull, 'w') - ret = subprocess.call(cmd, stdout=devnull) - devnull.close() - else: - ret = subprocess.call(cmd) - color("reset") - - if ret == 0: - print_green("pboProject return code == " + str(ret)) - # Prettyprefix rename the PBO if requested. - if pbo_name_prefix: - try: - os.rename(os.path.join(module_root, release_dir, project, "Addons", module+".pbo"), os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) - except: - raise - print_error("Could not rename built PBO with prefix.") - # Sign result - if key: - print("Signing with " + key + ".") - if pbo_name_prefix: - ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) - else: - ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", module + ".pbo")]) - - if ret == 0: - build_successful = True - else: - build_successful = True - - if not build_successful: - print_error("pboProject return code == " + str(ret)) - print_error("Module not successfully built/signed.") - print ("Resuming build...") - continue - - #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp - #print_green("\Pabst (restoring): " + os.path.join(work_drive, prefix, module, "config.cpp")) - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - os.remove(os.path.join(work_drive, prefix, module, "config.bin")) - os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - # Back to the root - os.chdir(module_root) - - except: - raise - print_error("Could not run Addon Builder.") - input("Press Enter to continue...") - print ("Resuming build...") - continue - - elif build_tool== "addonbuilder": - # Detect $NOBIN$ and do not binarize if found. - if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): - do_binarize = False - print("$NOBIN$ file found in module, packing only.") - else: - do_binarize = True - try: - # Call AddonBuilder - os.chdir("P:\\") - - cmd = [addonbuilder, os.path.join(work_drive, prefix, module), os.path.join(make_root, release_dir, project, "Addons"), "-clear", "-project="+work_drive] - if not do_binarize: - cmd.append("-packonly") - - if quiet: - previousDirectory = os.getcwd() - os.chdir(arma3tools_path) - devnull = open(os.devnull, 'w') - ret = subprocess.call(cmd, stdout=devnull) - devnull.close() - os.chdir(previousDirectory) - else: - previousDirectory = os.getcwd() - os.chdir(arma3tools_path) - print_error("Current directory - " + os.getcwd()) - ret = subprocess.call(cmd) - os.chdir(previousDirectory) - print_error("Current directory - " + os.getcwd()) - color("reset") - print_green("completed") - # Prettyprefix rename the PBO if requested. - if pbo_name_prefix: - try: - os.rename(os.path.join(make_root, release_dir, project, "Addons", module+".pbo"), os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) - except: - raise - print_error("Could not rename built PBO with prefix.") - - if ret == 0: - # Sign result - if key: - print("Signing with " + key + ".") - if pbo_name_prefix: - ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) - else: - ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", module + ".pbo")]) - - if ret == 0: - build_successful = True - else: - build_successful = True - - if not build_successful: - print_error("Module not successfully built.") - - # Back to the root - os.chdir(make_root) - - except: - raise - print_error("Could not run Addon Builder.") - input("Press Enter to continue...") - print ("Resuming build...") - continue - - else: - print_error("Unknown build_tool " + build_tool + "!") - - # Update the hash for a successfully built module - if build_successful: - cache[module] = new_sha - - # Done building all modules! - - # Write out the cache state - cache_out = json.dumps(cache) - with open(os.path.join(make_root, "make.cache"), 'w') as f: - f.write(cache_out) - - # Delete the pboproject temp files if building a release. - if make_release and build_tool == "pboproject": - try: - shutil.rmtree(os.path.join(module_root, release_dir, project, "temp"), True) - except: - print_error("ERROR: Could not delete pboProject temp files.") - - print_green("\nDone.") - - # Make release - if make_release: - print_blue("\nMaking release: " + project + "-" + release_version + ".zip") - - try: - # Delete all log files - for root, dirs, files in os.walk(os.path.join(module_root, release_dir, project, "Addons")): - for currentFile in files: - if currentFile.lower().endswith("log"): - os.remove(os.path.join(root, currentFile)) - - # Create a zip with the contents of release/ in it - shutil.make_archive(project + "-" + release_version, "zip", os.path.join(module_root, release_dir)) - except: - raise - print_error("Could not make release.") - - # Copy to Arma 3 folder for testing - if test: - print_blue("\nCopying to Arma 3.") - - if sys.platform == "win32": - reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - try: - k = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\Bohemia Interactive\Arma 3") - a3_path = winreg.EnumValue(k, 1)[1] - winreg.CloseKey(k) - except: - print_error("Could not find Arma 3's directory in the registry.") - else: - a3_path = cygwin_a3path - - if os.path.exists(a3_path): - try: - shutil.rmtree(os.path.join(a3_path, project), True) - shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) - except: - print_error("Could not copy files. Is Arma 3 running?") - - copy_important_files(module_root_parent,os.path.join(release_dir, "@ace")) - cleanup_optionals(optionals_modules,optional_files) + sys.exit(0) + + if "force" in argv: + argv.remove("force") + force_build = True + else: + force_build = False + + if "test" in argv: + test = True + argv.remove("test") + + if "release" in argv: + make_release = True + release_version = argv[argv.index("release") + 1] + argv.remove(release_version) + argv.remove("release") + + if "target" in argv: + make_target = argv[argv.index("target") + 1] + argv.remove("target") + argv.remove(make_target) + force_build = True + + if "key" in argv: + new_key = True + key_name = argv[argv.index("key") + 1] + argv.remove("key") + argv.remove(key_name) + + if "quiet" in argv: + quiet = True + argv.remove("quiet") + + if "checkexternal" in argv: + argv.remove("checkexternal") + check_external = True + else: + check_external = False + + print_yellow("\nCheck external references is set to " + str(check_external)) + + # Get the directory the make script is in. + make_root = os.path.dirname(os.path.realpath(__file__)) + make_root_parent = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + os.chdir(make_root) + + # Get latest commit ID + try: + gitpath = os.path.join(os.path.dirname(make_root), ".git") + assert os.path.exists(gitpath) + + commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"]) + commit_id = str(commit_id, "utf-8")[:8] + key_name = str(key_name+"-"+commit_id) + except: + print_error("FAILED TO DETERMINE COMMIT ID.") + commit_id = "NOGIT" + + cfg = configparser.ConfigParser(); + try: + cfg.read(os.path.join(make_root, "make.cfg")) + + # Project name (with @ symbol) + project = cfg.get(make_target, "project", fallback="@"+os.path.basename(os.getcwd())) + + # BI Tools work drive on Windows + work_drive = cfg.get(make_target, "work_drive", fallback="P:\\") + + # Private key path + key = cfg.get(make_target, "key", fallback=None) + + # Private key creation directory + private_key_path = cfg.get(make_target, "private_key_path", fallback=os.path.join(work_drive, "private_keys")) + + # Project prefix (folder path) + prefix = cfg.get(make_target, "prefix", fallback="") + + # Should we autodetect modules on a complete build? + module_autodetect = cfg.getboolean(make_target, "module_autodetect", fallback=True) + + # Manual list of modules to build for a complete build + modules = cfg.get(make_target, "modules", fallback=None) + # Parse it out + if modules: + modules = [x.strip() for x in modules.split(',')] + else: + modules = [] + + # List of directories to ignore when detecting + ignore = [x.strip() for x in cfg.get(make_target, "ignore", fallback="release").split(',')] + + # Which build tool should we use? + build_tool = cfg.get(make_target, "build_tool", fallback="addonbuilder").lower() + + # Release/build directory, relative to script dir + release_dir = cfg.get(make_target, "release_dir", fallback="release") + + # Project PBO file prefix (files are renamed to prefix_name.pbo) + pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None) + + # Project module Root + module_root_parent = os.path.abspath(os.path.join(os.path.join(work_drive, prefix), os.pardir)) + module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons")) + optionals_root = os.path.join(module_root_parent, "optionals") + print_green ("module_root: " + module_root) + + if (os.path.isdir(module_root)): + os.chdir(module_root) + else: + print_error ("Directory " + module_root + " does not exist.") + sys.exit() + + if (os.path.isdir(optionals_root)): + print_green ("optionals_root: " + optionals_root) + else: + print_error ("Directory " + optionals_root + " does not exist.") + sys.exit() + + print_green ("release_dir: " + release_dir) + + except: + raise + print_error("Could not parse make.cfg.") + sys.exit(1) + + # See if we have been given specific modules to build from command line. + if len(argv) > 1 and not make_release: + arg_modules = True + modules = argv[1:] + + # Find the tools we need. + try: + tools = find_bi_tools(work_drive) + addonbuilder = tools[0] + dssignfile = tools[1] + dscreatekey = tools[2] + cfgconvert = tools[3] + + except: + print_error("Arma 3 Tools are not installed correctly or the P: drive has not been created.") + sys.exit(1) + + if build_tool == "pboproject": + try: + depbo_tools = find_depbo_tools("HKLM") + if depbo_tools == -1: + depbo_tools = find_depbo_tools("HKCU") + pboproject = depbo_tools[0] + rapifyTool = depbo_tools[1] + makepboTool = depbo_tools[2] + except: + raise + print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files") + sys.exit(1) + + # Try to open and deserialize build cache file. + try: + cache = {} + with open(os.path.join(make_root, "make.cache"), 'r') as f: + cache_raw = f.read() + + cache = json.loads(cache_raw) + + except: + print ("No cache found.") + cache = {} + + if not os.path.isdir(os.path.join(release_dir, project, "addons")): + try: + os.makedirs(os.path.join(release_dir, project, "addons")) + except: + print_error("Cannot create release directory") + raise + + if not os.path.isdir(os.path.join(release_dir, project, "keys")): + try: + os.makedirs(os.path.join(release_dir, project, "keys")) + except: + print_error("Cannot create release directory") + raise + + #Temporarily copy optionals_root for building. They will be removed later. + optionals_modules = [] + optional_files = [] + copy_optionals_for_building(optionals_modules,optional_files) + + # Get list of subdirs in make root. + dirs = next(os.walk(module_root))[1] + + # Autodetect what directories to build. + if module_autodetect and not arg_modules: + modules = [] + for path in dirs: + # Any dir that has a config.cpp in its root is an addon to build. + config_path = os.path.join(path, 'config.cpp') + if os.path.isfile(config_path) and not path in ignore: + modules.append(path) + + # Make the key specified from command line if necessary. + if new_key: + if not os.path.isfile(os.path.join(private_key_path, key_name + ".biprivatekey")): + print_yellow("\nRequested key does not exist.") + try: + os.makedirs(private_key_path) + except: + pass + curDir = os.getcwd() + os.chdir(private_key_path) + ret = subprocess.call([dscreatekey, key_name]) # Created in make_root + os.chdir(curDir) + if ret == 0: + print_green("Created: " + os.path.join(private_key_path, key_name + ".biprivatekey")) + print("Removing any old signature keys...") + purge(os.path.join(module_root, release_dir, project, "addons"), "^.*\.bisign$","*.bisign") + purge(os.path.join(module_root, release_dir, project, "optionals"), "^.*\.bisign$","*.bisign") + purge(os.path.join(module_root, release_dir, project, "keys"), "^.*\.bikey$","*.bikey") + else: + print_error("Failed to create key!") + + try: + print("Copying public key to release directory.") + + try: + os.makedirs(os.path.join(module_root, release_dir, project, "keys")) + except: + pass + + shutil.copyfile(os.path.join(private_key_path, key_name + ".bikey"), os.path.join(module_root, release_dir, project, "keys", key_name + ".bikey")) + + except: + print_error("Could not copy key to release directory.") + raise + + else: + print_green("\nNOTE: Using key " + os.path.join(private_key_path, key_name + ".biprivatekey")) + + key = os.path.join(private_key_path, key_name + ".biprivatekey") + + # Remove any obsolete files. + print_blue("\nChecking for obsolete files...") + obsolete_check_path = os.path.join(module_root, release_dir, project,"addons") + for file in os.listdir(obsolete_check_path): + if (file.endswith(".pbo") and os.path.isfile(os.path.join(obsolete_check_path,file))): + if check_for_obsolete_pbos(module_root, file): + fileName = os.path.splitext(file)[0] + print_yellow("Removing obsolete file => " + file) + purge(obsolete_check_path,fileName+"\..",fileName+".*") + + # For each module, prep files and then build. + print_blue("\nBuilding...") + for module in modules: + print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) + missing = False + sigMissing = False + + # Cache check + if module in cache: + old_sha = cache[module] + else: + old_sha = "" + + #We always build ACE_common so we can properly show the correct version stamp in the RPT file. + if module == "common": + old_sha = "" + + # Hash the module + new_sha = get_directory_hash(os.path.join(module_root, module)) + + # Is the pbo or sig file missing? + missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module))) + sigFile = pbo_name_prefix+module + ".pbo." + key_name + ".bisign" + sigMissing = not os.path.isfile(os.path.join(release_dir, project, "addons", sigFile )) + + if missing: + print_yellow("Missing PBO file ace_{}.pbo".format(module) + ". Building...") + + # Check if it needs rebuilt + # print ("Hash:", new_sha) + if old_sha == new_sha and not missing: + if not force_build: + print("Module has not changed.") + if sigMissing: + if key: + print("Missing Signature key " + sigFile) + build_signature_file(os.path.join(module_root, release_dir, project, "addons", pbo_name_prefix + module + ".pbo")) + # Skip everything else + continue + + # Only do this if the project isn't stored directly on the work drive. + # Split the path at the drive name and see if they are on the same drive (usually P:) + if os.path.splitdrive(module_root)[0] != os.path.splitdrive(work_drive)[0]: + try: + # Remove old work drive version (ignore errors) + shutil.rmtree(os.path.join(work_drive, prefix, module), True) + + # Copy module to the work drive + shutil.copytree(module, os.path.join(work_drive, prefix, module)) + + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + #else: + #print("WARNING: Module is stored on work drive (" + work_drive + ").") + + try: + # Remove the old pbo, key, and log + old = os.path.join(module_root, release_dir, project, "addons", pbo_name_prefix+module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + + if pbo_name_prefix: + old = os.path.join(module_root, release_dir, project, "addons", pbo_name_prefix+module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + + # Build the module into a pbo + print_blue("Building: " + os.path.join(work_drive, prefix, module)) + print_blue("Destination: " + os.path.join(module_root, release_dir, project, "addons")) + + # Make destination folder (if needed) + try: + os.makedirs(os.path.join(module_root, release_dir, project, "addons")) + except: + pass + + # Run build tool + build_successful = False + if build_tool == "pboproject": + try: + #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) + + os.chdir("P:\\") + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -bin return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.") + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + + # Include build number + try: + configpath = os.path.join(work_drive, prefix, module, "config.cpp") + f = open(configpath, "r") + configtext = f.read() + f.close() + + if configtext: + patchestext = re.search(r"class CfgPatches\n\{(.*?)\n\}", configtext, re.DOTALL).group(1) + patchestext = re.sub(r'version(.*?)="(.*?)"', r'version\1="\2-{}"'.format(commit_id), patchestext) + configtext = re.sub(r"class CfgPatches\n\{(.*?)\n\}", "class CfgPatches\n{"+patchestext+"\n}", configtext, flags=re.DOTALL) + f = open(configpath, "w") + f.write(configtext) + f.close() + else: + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + except: + raise + print_error("Failed to include build number") + continue + + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + print_green("$NOBIN$ Found. Proceeding with non-binarizing!") + cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"addons")] + + else: + if check_external: + cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "+X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] + else: + cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "-X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] + + color("grey") + if quiet: + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + else: + ret = subprocess.call(cmd) + color("reset") + + if ret == 0: + print_green("pboProject return code == " + str(ret)) + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(module_root, release_dir, project, "addons", module+".pbo"), os.path.join(module_root, release_dir, project, "addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("pboProject return code == " + str(ret)) + print_error("Module not successfully built/signed.") + print ("Resuming build...") + continue + + #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp + #print_green("\Pabst (restoring): " + os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.bin")) + os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + # Back to the root + os.chdir(module_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + elif build_tool== "addonbuilder": + # Detect $NOBIN$ and do not binarize if found. + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + do_binarize = False + print("$NOBIN$ file found in module, packing only.") + else: + do_binarize = True + try: + # Call AddonBuilder + os.chdir("P:\\") + + cmd = [addonbuilder, os.path.join(work_drive, prefix, module), os.path.join(make_root, release_dir, project, "addons"), "-clear", "-project="+work_drive] + if not do_binarize: + cmd.append("-packonly") + + if quiet: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + os.chdir(previousDirectory) + else: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + print_error("Current directory - " + os.getcwd()) + ret = subprocess.call(cmd) + os.chdir(previousDirectory) + print_error("Current directory - " + os.getcwd()) + color("reset") + print_green("completed") + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(make_root, release_dir, project, "addons", module+".pbo"), os.path.join(make_root, release_dir, project, "addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + + if ret == 0: + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("Module not successfully built.") + + # Back to the root + os.chdir(make_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + else: + print_error("Unknown build_tool " + build_tool + "!") + + # Update the hash for a successfully built module + if build_successful: + cache[module] = new_sha + + # Done building all modules! + + # Write out the cache state + cache_out = json.dumps(cache) + with open(os.path.join(make_root, "make.cache"), 'w') as f: + f.write(cache_out) + + # Delete the pboproject temp files if building a release. + if make_release and build_tool == "pboproject": + try: + shutil.rmtree(os.path.join(module_root, release_dir, project, "temp"), True) + except: + print_error("ERROR: Could not delete pboProject temp files.") + + copy_important_files(module_root_parent,os.path.join(release_dir, "@ace")) + cleanup_optionals(optionals_modules) + + # Make release + if make_release: + print_blue("\nMaking release: " + project + "-" + release_version + ".zip") + + try: + # Delete all log files + for root, dirs, files in os.walk(os.path.join(module_root, release_dir, project, "addons")): + for currentFile in files: + if currentFile.lower().endswith("log"): + os.remove(os.path.join(root, currentFile)) + + # Create a zip with the contents of release/ in it + shutil.make_archive(project + "-" + release_version, "zip", os.path.join(module_root, release_dir)) + except: + raise + print_error("Could not make release.") + + # Copy to Arma 3 folder for testing + if test: + print_blue("\nCopying to Arma 3.") + + if sys.platform == "win32": + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + try: + k = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\Bohemia Interactive\Arma 3") + a3_path = winreg.EnumValue(k, 1)[1] + winreg.CloseKey(k) + except: + print_error("Could not find Arma 3's directory in the registry.") + else: + a3_path = cygwin_a3path + + if os.path.exists(a3_path): + try: + shutil.rmtree(os.path.join(a3_path, project), True) + shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) + except: + print_error("Could not copy files. Is Arma 3 running?") + + print_green("\nDone.") + + if __name__ == "__main__": - main(sys.argv) + main(sys.argv) input("Press Enter to continue...") diff --git a/tools/search_privates.py b/tools/search_privates.py index 6445a24dd7..37320214fc 100644 --- a/tools/search_privates.py +++ b/tools/search_privates.py @@ -53,7 +53,7 @@ def check_privates(filepath): # Regex search privates - srch = re.compile('(? 0: + print (filepath) + + private_output = 'private['; + first = True + for bad_priv in unused: + if first: + first = False + private_output = private_output + '"' + bad_priv + else: + private_output = private_output + '", "' + bad_priv + + private_output = private_output + '"];'; + print (private_output) + + for bad_priv in unused: + print ('\t' + bad_priv) + bad_count_file = bad_count_file + 1 + + + + return bad_count_file + +def main(): + + print("#########################") + print("# Search your Privates #") + print("#########################") + + sqf_list = [] + bad_count = 0 + + parser = argparse.ArgumentParser() + parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default=".") + args = parser.parse_args() + + for root, dirnames, filenames in os.walk('../addons' + '/' + args.module): + for filename in fnmatch.filter(filenames, '*.sqf'): + sqf_list.append(os.path.join(root, filename)) + + for filename in sqf_list: + bad_count = bad_count + check_privates(filename) + + + print ("Bad Count {0}".format(bad_count)) + +if __name__ == "__main__": + main()