Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artillery rangletables (universal) #6853

Merged
merged 38 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4120eca
Initial
PabstMirror Mar 2, 2019
93eb04f
Update artillerytables.cpp
PabstMirror Mar 10, 2019
4ad1fba
Pass by value, remove c17 features
PabstMirror Mar 11, 2019
8d6c1cd
Tweak accuracy
PabstMirror Mar 13, 2019
429c11e
Merge branch 'master' into artilleryTables
PabstMirror Mar 14, 2019
c6d7df3
SQF work
PabstMirror Mar 15, 2019
1d2ecdd
Support per mag air friction
PabstMirror Mar 16, 2019
8c8e8fe
tweak friction
PabstMirror Mar 16, 2019
659b5fa
Integrate with mk6
PabstMirror Mar 16, 2019
dab3f72
more acos fixes
PabstMirror Mar 16, 2019
8b4a530
Handle invalid memPointGunOptic (CUP_BM21_Base)
PabstMirror Mar 18, 2019
6274d67
Cleanup
PabstMirror Mar 19, 2019
9756b22
cleanup/tweaks
PabstMirror Mar 22, 2019
fb49401
Merge branch 'master' into artilleryTables
PabstMirror May 24, 2019
5847bef
Update checkConfigs.sqf
PabstMirror May 24, 2019
3072e2e
Merge branch 'cswSuperBranch' into artilleryTables
PabstMirror Jun 8, 2019
8f7aa1e
Finish cleanup of ace_mk6mortar
PabstMirror Jun 8, 2019
fe418ec
Merge branch 'cswSuperBranch' into artilleryTables
PabstMirror Jul 5, 2019
76a1dd0
Update stringtable.xml
PabstMirror Jul 6, 2019
a556fd1
fix bwc for ACE_RangeTable_82mm
PabstMirror Jul 9, 2019
c787f30
Update fnc_rangeTableCanUse.sqf
PabstMirror Jul 10, 2019
65e8186
Merge branch 'master' into artilleryTables
PabstMirror Aug 12, 2019
f5aa320
Merge branch 'master' into artilleryTables
PabstMirror Sep 4, 2019
ba461a5
build 32dll, fix some headers
PabstMirror Sep 4, 2019
687663b
Merge branch 'master' into artilleryTables
PabstMirror Oct 1, 2019
126c8d3
strncpy and move testing to seperate file
PabstMirror Oct 1, 2019
2d6414a
Merge branch 'master' into artilleryTables
PabstMirror Oct 15, 2019
9f27b55
Move to sub-category
PabstMirror Oct 15, 2019
1ad36a7
Merge branch 'master' into artilleryTables
PabstMirror Dec 12, 2019
2e0ca76
Update for ACE_Extensions changes and add warning to ace_common
PabstMirror Dec 12, 2019
4551efe
Update stringtable.xml
PabstMirror Dec 12, 2019
a1f2fb5
Update addons/common/functions/fnc_checkFiles.sqf
PabstMirror Dec 12, 2019
991c0f3
Update stringtable.xml
PabstMirror Dec 12, 2019
1b5f9fb
Merge branch 'artilleryTables' of https://github.com/acemod/ACE3 into…
PabstMirror Dec 12, 2019
a9580b4
Update stringtable.xml
PabstMirror Dec 12, 2019
b187172
test extension.yml update logical operator
PabstMirror Dec 12, 2019
e6383a0
Revert "test extension.yml update logical operator"
PabstMirror Dec 12, 2019
3159f91
more guess and test
PabstMirror Dec 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- name: Checkout the source code
uses: actions/checkout@master
- name: Build
shell: cmd
run: |
cd extensions/build
cmake .. && cmake --build .
Expand Down
Binary file added ace_artillerytables.dll
Binary file not shown.
Binary file added ace_artillerytables_x64.dll
Binary file not shown.
1 change: 1 addition & 0 deletions addons/artillerytables/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\artillerytables
15 changes: 15 additions & 0 deletions addons/artillerytables/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
6 changes: 6 additions & 0 deletions addons/artillerytables/CfgMagazines.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class CfgMagazines {
class 32Rnd_155mm_Mo_shells;
class 8Rnd_82mm_Mo_shells: 32Rnd_155mm_Mo_shells {
GVAR(airFriction) = -0.0001;
};
};
7 changes: 7 additions & 0 deletions addons/artillerytables/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CfgVehicles {
class StaticWeapon;
class StaticMortar: StaticWeapon {
// Small mortars seem to need the alternate elevation calculations,
GVAR(showGunLaying) = 2;
};
};
15 changes: 15 additions & 0 deletions addons/artillerytables/CfgWeapons.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CfgWeapons {
class ACE_ItemCore;
class CBA_MiscItem_ItemInfo;

class ACE_artilleryTable: ACE_ItemCore {
author = ECSTRING(common,ACETeam);
scope = 2;
displayName = CSTRING(rangetable_displayName);
descriptionShort = CSTRING(rangetable_description);
picture = QPATHTOF(UI\icon_rangeTable.paa);
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 0.5;
};
};
};
14 changes: 14 additions & 0 deletions addons/artillerytables/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ace_artillerytables
==========

Universal artillery rangetables.

#### Items Added:
`ACE_artilleryTable`


## Maintainers

The people responsible for merging changes to this component or answering potential questions.

- [PabstMirror](https://github.com/PabstMirror)
96 changes: 96 additions & 0 deletions addons/artillerytables/RscRangeTable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
class GVAR(rangeTableDialog) {
idd = -1;
movingEnable = 1;
onLoad = QUOTE(with uiNameSpace do { GVAR(rangeTableDialog) = _this select 0 };);
objects[] = {};

class ControlsBackground {
class TableBackground: RscPicture {
idc = -1;
text = QPATHTOF(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 LeftSideBackground: RscText {
idc = -1;
x = "13 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH) / 2)";
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2)) / 2)";
w = "5 * (safeZoneH / 40)";
h = "23 * ((safeZoneH / 1.2) / 25)";
colorBackground[] = {0,0,0,0.8};
};
};
class controls {
class TheTable: RscListNBox {
idc = IDC_TABLE;
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 = -1;
idcRight = -1;
colorText[] = {0, 0, 0, 1};
shadow = "0";
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 = IDC_CHARGELIST;
style = ST_RIGHT;
x = "13 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH) / 2)";
y = "2 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2)) / 2)";
w = "5 * (safeZoneH / 40)";
h = "22 * ((safeZoneH / 1.2) / 25)";
onLBSelChanged = QUOTE([] call FUNC(rangeTableUpdate));
};
class elevationHigh: ctrlButton {
idc = IDC_BUTTON_ELEV_HIGH;
text = "High";
onButtonClick = QUOTE([true] call FUNC(rangeTableUpdate));
x = "13.1 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH) / 2)";
y = "1.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2)) / 2)";
w = "2.3 * (safeZoneH / 40)";
h = "0.8 * ((safeZoneH / 1.2) / 25)";
};
class elevationLow: elevationHigh {
idc = IDC_BUTTON_ELEV_LOW;
text = "Low";
onButtonClick = QUOTE([false] call FUNC(rangeTableUpdate));
x = "15.6 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH) / 2)";
};
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";
};
};
};
42 changes: 42 additions & 0 deletions addons/artillerytables/RscTitles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class RscTitles {
class GVAR(modeDisplay) {
idd = -1;
onLoad = QUOTE(with uiNameSpace do { GVAR(display) = _this select 0 };);
movingEnable = 0;
duration = 60;
fadeIn = "false";
fadeOut = "false";
class controls {
class ModeControlGroup: RscControlsGroupNoScrollbars {
idc = IDC_MODECONTROLGROUP;
x = "3.8 * (((safezoneW / safezoneH) min 1.2) / 40) + (profilenamespace getvariable ['IGUI_GRID_WEAPON_X',((safezoneX + safezoneW) - (10 * (((safezoneW / safezoneH) min 1.2) / 40)) - 4.3 * (((safezoneW / safezoneH) min 1.2) / 40))])";
y = "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))])";
w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";

class controls {
class Charge: RscText {
idc = IDC_CHARGE;
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0, 0, 0, 0};
x = "0";
y = "0";
w = "(2) * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class Azimuth: Charge {
idc = IDC_AZIMUTH;
x = "(2) * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "(3) * (((safezoneW / safezoneH) min 1.2) / 40)";
};
class Elevation: Azimuth {
idc = IDC_ELEVATION;
x = "(5) * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
};
};

};
};
};
Binary file not shown.
Binary file added addons/artillerytables/UI/icon_rangeTable.paa
Binary file not shown.
8 changes: 8 additions & 0 deletions addons/artillerytables/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TRACE_1("prep",_this);

PREP(firedEH);
PREP(interactMenuOpened);
PREP(rangeTableOpen);
PREP(rangeTableUpdate);
PREP(turretChanged);
PREP(turretPFEH);
36 changes: 36 additions & 0 deletions addons/artillerytables/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "script_component.hpp"

["ace_settingsInitialized", {
TRACE_2("ace_settingsInitialized",GVAR(advancedCorrections),GVAR(disableArtilleryComputer));

if (hasInterface) then {
// Add hud overlay for actuall azimuth and elevation:
GVAR(pfID) = -1;
["turret", LINKFUNC(turretChanged), true] call CBA_fnc_addPlayerEventHandler;

// Add ability to dynamically open rangetables:
["ace_interactMenuOpened", LINKFUNC(interactMenuOpened)] call CBA_fnc_addEventHandler;
};

if (GVAR(advancedCorrections)) then {
["LandVehicle", "init", {
params ["_vehicle"];
private _vehicleCfg = configFile >> "CfgVehicles" >> typeOf _vehicle;
// config "ace_artillerytables_applyCorrections" [0 disabled, 1 enabled] falls back to artilleryScanner
private _applyCorrections = if (isNumber (_vehicleCfg >> QGVAR(applyCorrections))) then {
getNumber (_vehicleCfg >> QGVAR(applyCorrections))
} else {
getNumber (_vehicleCfg >> "artilleryScanner")
};
if (_applyCorrections == 1) then {
TRACE_2("adding firedEH",_vehicle,configName _vehicleCfg);
_vehicle addEventHandler ["Fired", {call FUNC(firedEH)}];
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
};
}] call CBA_fnc_addEventHandler;

#ifdef DEBUG_MODE_FULL
#include "dev\showShotInfo.sqf"
#include "dev\checkConfigs.sqf"
#endif
11 changes: 11 additions & 0 deletions addons/artillerytables/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
3 changes: 3 additions & 0 deletions addons/artillerytables/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
44 changes: 44 additions & 0 deletions addons/artillerytables/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author = ECSTRING(common,ACETeam);
authors[] = {"PabstMirror"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

class ACE_Extensions {
class ace_artillerytables {
windows = 1;
client = 1;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgMagazines.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"


// Common UI Stuff:
class RscText;
class RscListbox;
class RscListNBox;
class RscPicture;
class RscControlsGroup;
class RscControlsGroupNoScrollbars;
class ScrollBar;
class RscActiveText;
class RscStructuredText;
class ctrlButton;

#include "RscTitles.hpp"
#include "RscRangeTable.hpp"

20 changes: 20 additions & 0 deletions addons/artillerytables/dev/checkConfigs.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diag_log text "-------------------------------------------";
INFO("Showing entries with custom configs");
diag_log text "-------------------------------------------";


private _fnc_showPropertyDefined = {
params ["_configBase", "_configProperty"];

private _customAll = configProperties [_configBase, 'isClass _x && {isNumber (_x >> _configProperty)}', true];
private _customExplicit = _customAll select {!([] isEqualTo configProperties [_x, 'configName _x == _configProperty', false])};
diag_log text format ["%1 with custom %2: %3 Explicit, %4 Total]", configName _configBase, _configProperty, count _customExplicit, count _customAll];
diag_log text format [" - Defined: %1", _customExplicit apply {configName _x}];
diag_log text format [" - Inherited: %1", _customAll apply {[configName _x, getNumber (_x >> _configProperty)]}];
};

[configFile >> "CfgMagazines", QGVAR(airFriction)] call _fnc_showPropertyDefined;
[configFile >> "CfgVehicles", QGVAR(showGunLaying)] call _fnc_showPropertyDefined;
[configFile >> "CfgVehicles", QGVAR(applyCorrections)] call _fnc_showPropertyDefined;

diag_log text "-------------------------------------------";
47 changes: 47 additions & 0 deletions addons/artillerytables/dev/showShotInfo.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// #include "\z\ace\addons\artillerytables\script_component.hpp"

INFO("showing shot info");

["LandVehicle", "fired", {
params ["_shooter", "", "", "", "_ammo", "", "_proj"];
((velocity _proj) call CBA_fnc_vect2Polar) params ["_mag", "_dir", "_elev"];
private _shootPos = getPosASL _shooter;
if (_dir < 0) then {_dir = _dir + 360;};

private _offsetElev = _elev - (missionNamespace getVariable [QGVAR(predictedElevation), -999]);
private _offsetAz = _dir - (missionNamespace getVariable [QGVAR(predictedAzimuth), -999]);

hintSilent format ["%1 m/s\nAz: %2 [%3]\nEl: %4 [%5]\nError Az: %6\nError EL: %7",_mag toFixed 1, _dir toFixed 2, ((6400 / 360) * _dir) toFixed 0, _elev toFixed 2, ((6400 / 360) * _elev) toFixed 0,
_offsetAz toFixed 3, _offsetElev toFixed 3];
TRACE_2("",_offsetAz,_offsetElev);
private _submunitionAmmo = getText (configFile >> "CfgAmmo" >> _ammo >> "submunitionAmmo");

[{
params ["_proj", "_shootPos", "_lastPos", "_submunitionAmmo"];
if ((isNull _proj) && {_submunitionAmmo != ""}) then {
_proj = nearestObject [_lastPos, _submunitionAmmo];
_this set [0, _proj];
};
if (isNull _proj) exitWith {true};
_this set [2, getPosASL _proj];
false
}, {
params ["", "_shootPos", "_lastPos"];
private _mkrB = createMarker [format ["shotInfo-%1-%2",_shootPos,_lastPos], _lastPos];
_mkrB setMarkerType "mil_dot";
_mkrB setMarkerColor "ColorGreen";
_mkrB setMarkerSize [0.5,0.5];
private _diff = _lastPos vectorDiff _shootPos;
_mkrB setMarkerText format ["%1", _diff apply {round _x}];

private _dist2d = _shootPos distance2d _lastPos;
private _dir = _shootPos getDir _lastPos;
private _height = (_lastPos select 2) - (_shootPos select 2);
_mkrB setMarkerText format ["Dist: %1m Az: %2[%3] Height:%4", _dist2d toFixed 0, _dir toFixed 2, ((6400 / 360) * _dir) toFixed 0, _height toFixed 0];
}, [_proj, _shootPos, [0,0,0], _submunitionAmmo]] call CBA_fnc_waitUntilAndExecute;

private _mkrA = createMarker [format ["shotInfo-%1",_shootPos], _shootPos];
_mkrA setMarkerType "mil_dot";
_mkrA setMarkerColor "ColorRed";
_mkrA setMarkerSize [0.5,0.5];
}] call CBA_fnc_addClassEventHandler;
Loading