1
0
mirror of https://github.com/acemod/ACE3.git synced 2024-08-30 18:23:18 +00:00

*Replaced call compile preprocessFile with FUNC macro

*Removed some unused files
*Fixed incorrect .paa filepath
*Fixed incorrect profileNamespace access
This commit is contained in:
ulteq 2015-04-06 20:46:33 +02:00
parent 1320176c12
commit 6578ff4559
26 changed files with 47 additions and 48 deletions

@ -5,7 +5,7 @@ class CfgVehicles {
class ACE_OpenATragMX {
displayName = "$STR_ACE_ATragMX_OpenATragMXDialog";
condition = QUOTE('ACE_ATragMX' in items _player && {!GVAR(ATragMX)});
statement = QUOTE(call FUNC(createATragMXDialog));
statement = QUOTE(call FUNC(create_dialog));
showDisabled = 0;
priority = 2;
icon = PATHTOF(UI\ATRAG_Icon.paa);

@ -208,7 +208,7 @@ class ATragMX_Display
h=1.024*4/3;
colorBackground[]={1,1,1,1};
colorText[]={1,1,1,1};
text="\atragmx\data\atrag.paa";
text=PATHTOF(UI\atrag.paa);
};
class POWER: ATragMX_RscButton
{

@ -2,8 +2,8 @@
#include "initKeybinds.sqf"
if (count (profileNamespace getVariable ["GVAR(ATragMX_gunList)", []]) > 0) then {
GVAR(ATragMX_gunList) = profileNamespace getVariable "GVAR(ATragMX_gunList)";
if (count (profileNamespace getVariable ["ACE_ATragMX_gunList", []]) > 0) then {
GVAR(ATragMX_gunList) = profileNamespace getVariable "ACE_ATragMX_gunList";
} else {
// Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Elevation Scope Step, Windage Scope Step, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Ammo Class Name, Magazine Class Name, BC, Drag Model, Atmosphere Model
GVAR(ATragMX_gunList) = [["12.7x108mm" , 820, 500, 0.255, -0.0005600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.28, "B_127x108_Ball" , "5Rnd_127x108_Mag" , 0.700, 1, "ASM" ],
@ -14,7 +14,7 @@ if (count (profileNamespace getVariable ["GVAR(ATragMX_gunList)", []]) > 0) then
["5.56x45mm" , 920, 500, 0.259, -0.0012000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.000, "B_556x45_Ball" , "30Rnd_556x45_Stanag" , 0.304, 1, "ASM" ],
["5.56x45mm Mk262" , 850, 500, 0.294, -0.0011250, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.990, "RH_556x45_Mk262" , "RH_30Rnd_556x45_Mk262" , 0.361, 1, "ASM" ]];
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(ATragMX_gunList)];
};
[] call FUNC(init);

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {"ACE_ATragMX"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_common", "ACE_weather"};
author[] = {$STR_ACE_Common_ACETeam, "Ruthberg"};
author = "Ruthberg";
VERSION_CONFIG;
};
};

@ -1 +0,0 @@
#define GET_TEMPERATURE_AT_HEIGHT(h) (EGVAR(weather,currentTemperature) - 0.0065 * (h))

@ -10,5 +10,5 @@ if (_gunName != "") then {
lbAdd [6000, _gunProfileEntry select 0];
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(ATragMX_gunList)];
};

@ -1,6 +1,6 @@
#include "script_component.hpp"
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
[] call FUNC(parse_input.sqf);
private ["_scopeBaseAngle"];
_scopeBaseAngle = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 3);

@ -48,9 +48,9 @@ if (_storeRangeCardData) then {
private ["_wind"];
_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 0];
if (AdvancedBallistics) then {
if (AB_AdvancedAirDragEnabled) then {
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call ab_fnc_calculate_atmospheric_correction;
if (EGVAR(advanced_ballistics,AdvancedBallistics)) then {
if (EGVAR(advanced_ballistics,AdvancedAirDragEnabled)) then {
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call FUNC(calculateAtmosphericCorrection);
};
};
@ -70,11 +70,11 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do
_trueVelocity = _bulletVelocity vectorDiff _wind;
_trueSpeed = vectorMagnitude _trueVelocity;
if (AdvancedBallistics) then {
if (AB_AdvancedAirDragEnabled) then {
if (EGVAR(advanced_ballistics,AdvancedBallistics)) then {
if (EGVAR(advanced_ballistics,AdvancedAirDragEnabled)) then {
private ["_drag"];
_drag = -1 * ([_dragModel, _bc, _trueSpeed] call ab_fnc_calculate_retardation);
_drag = -1 * ([_dragModel, _bc, _trueSpeed] call FUNC(calculateRetardation);
_bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (_drag);
};
} else {

@ -1,6 +1,6 @@
#include "script_component.hpp"
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
[] call FUNC(parse_input);
private ["_scopeBaseAngle"];
_scopeBaseAngle = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 3);
@ -49,4 +49,4 @@ GVAR(ATragMX_leadOutput) set [GVAR(ATragMX_currentTarget), _result select 2];
GVAR(ATragMX_tofOutput) set [GVAR(ATragMX_currentTarget), _result select 3];
GVAR(ATragMX_velocityOutput) set [GVAR(ATragMX_currentTarget), _result select 4];
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_result);

@ -12,7 +12,7 @@ if ((GVAR(ATragMX_scopeUnits) select (GVAR(ATragMX_currentScopeUnit) select GVAR
GVAR(ATragMX_currentScopeUnit) set [GVAR(ATragMX_currentTarget), (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 6];
};
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
[] call FUNC(update_gun);
GVAR(ATragMX_elevationOutput) set [GVAR(ATragMX_currentTarget), 0];
GVAR(ATragMX_windageOutput) set [GVAR(ATragMX_currentTarget), 0];
@ -20,4 +20,4 @@ GVAR(ATragMX_leadOutput) set [GVAR(ATragMX_currentTarget), 0];
GVAR(ATragMX_tofOutput) set [GVAR(ATragMX_currentTarget), 0];
GVAR(ATragMX_velocityOutput) set [GVAR(ATragMX_currentTarget), 0];
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_result);

@ -4,4 +4,4 @@ GVAR(ATragMX_rangeCardCurrentColumn) = (GVAR(ATragMX_rangeCardCurrentColumn) + 1
ctrlSetText [5006, (GVAR(ATragMX_rangeCardLastColumns) select GVAR(ATragMX_rangeCardCurrentColumn))];
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
[] call FUNC(update_range_card);

@ -1,8 +1,8 @@
#include "script_component.hpp"
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
[] call FUNC(parse_input);
GVAR(ATragMX_currentScopeUnit) set [GVAR(ATragMX_currentTarget), ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget)) + 1) % (count GVAR(ATragMX_scopeUnits))];
call compile preprocessFile ("\atragmx\fnc_update_scope_unit.sqf");
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_scope_unit);
[] call FUNC(update_result);

@ -16,4 +16,4 @@ GVAR(ATragMX_gunList) = GVAR(ATragMX_gunList) - [0];
lbDelete [6000, _index];
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(ATragMX_gunList)];

@ -69,6 +69,6 @@ switch ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))) do
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, _elevationCur];
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, _windageCur];
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
call compile preprocessFile ("\atragmx\fnc_update_atmosphere.sqf");
call compile preprocessFile ("\atragmx\fnc_update_target.sqf");
[] call FUNC(update_gun);
[] call FUNC(update_atmosphere);
[] call FUNC(update_target);

@ -3,4 +3,4 @@
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, 0];
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, 0];
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_result);

@ -10,4 +10,4 @@ lbClear 6000;
lbAdd [6000, _x select 0];
} forEach GVAR(ATragMX_gunList);
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(ATragMX_gunList)];

@ -1,17 +1,17 @@
#include "script_component.hpp"
ATragMX_COMPAT_LRF = ["Rangefinder", "Laserdesignator"];
GVAR(ATragMX_COMPAT_LRF) = ["Rangefinder", "Laserdesignator"];
private ["_fnc_atragmx"];
_fnc_atragmx = {
private ["_target", "_position", "_range", "_inclinationAngle"];
if ((local player) && (currentWeapon player) in ATragMX_COMPAT_LRF && (!isNull (_this select 0))) then {
if ((local ACE_player) && (currentWeapon ACE_player) in GVAR(ATragMX_COMPAT_LRF) && (!isNull (_this select 0))) then {
_target = getPosATL (_this select 0);
_position = getPosATL player;
_position = getPosATL ACE_player;
_inclinationAngle = asin((player weaponDirection currentWeapon player) select 2);
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
_range = _position distance _target;
GVAR(ATragMX_inclinationAngle) set [GVAR(ATragMX_currentTarget), _inclinationAngle];

@ -23,7 +23,7 @@ if !(ctrlVisible 9000) then
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
call compile preprocessFile ("\atragmx\fnc_calculate_target_speed_assist.sqf");
[] call FUNC(calculate_target_speed_assist);
false execVM "\atragmx\fnc_show_target_speed_assist_timer.sqf";
true execVM "\atragmx\fnc_show_target_speed_assist.sqf";

@ -8,7 +8,7 @@ if (ctrlVisible 6000) then
true execVM "\atragmx\fnc_show_main_page.sqf";
if (_this) then {
(lbCurSel 6000) call compile preprocessFile ("\atragmx\fnc_change_gun.sqf");
(lbCurSel 6000) call FUNC(change_gun);
};
} else
{

@ -13,6 +13,6 @@ if (ctrlVisible 5006) then
ctrlSetFocus (_dsp displayCtrl 5001);
call compile preprocessFile ("\atragmx\fnc_calculate_range_card.sqf");
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
[] call FUNC(calculate_range_card);
[] call FUNC(update_range_card);
};

@ -13,8 +13,8 @@ if (ctrlVisible 10000) then
GVAR(ATragMX_rangeCardEndRange) = 0 max Round(parseNumber(ctrlText 10004)) min 3000;
GVAR(ATragMX_rangeCardIncrement) = 1 max Round(parseNumber(ctrlText 10005)) min 3000;
call compile preprocessFile ("\atragmx\fnc_calculate_range_card.sqf");
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
[] call FUNC(calculate_range_card);
[] call FUNC(update_range_card);
};
} else
{

@ -9,7 +9,7 @@ if (ctrlVisible 8000) then
if (_this == 1) then
{
call compile preprocessFile ("\atragmx\fnc_calculate_target_speed_assist.sqf");
[] call FUNC(calculate_target_speed_assist);
ctrlSetText [330, Str(parseNumber(ctrlText 8007))];
};
} else

@ -35,4 +35,4 @@ if (GVAR(ATragMX_currentUnit) == 2) then
ctrlSetText [140, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 2) * 1.0936133))];
};
call compile preprocessFile ("\atragmx\fnc_update_scope_unit.sqf");
[] call FUNC(update_scope_unit);

@ -3,4 +3,4 @@
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, (GVAR(ATragMX_elevationOutput) select GVAR(ATragMX_currentTarget))];
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, (GVAR(ATragMX_windageOutput) select GVAR(ATragMX_currentTarget))];
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_result);

@ -11,4 +11,4 @@
ctrlSetFocus (_dsp displayCtrl 3000);
call compile preprocessFile ("\atragmx\fnc_update_unit_selection.sqf");
[] call FUNC(update_unit_selection);

@ -8,7 +8,7 @@
(_dsp displayCtrl 600 + GVAR(ATragMX_currentUnit)) ctrlEnable false;
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
call compile preprocessFile ("\atragmx\fnc_update_atmosphere.sqf");
call compile preprocessFile ("\atragmx\fnc_update_target.sqf");
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
[] call FUNC(update_gun);
[] call FUNC(update_atmosphere);
[] call FUNC(update_target);
[] call FUNC(update_result);