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..3daad1425a --- /dev/null +++ b/addons/mk6mortar/CfgEventHandlers.hpp @@ -0,0 +1,10 @@ +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) ); + }; +}; diff --git a/addons/mk6mortar/CfgMagazines.hpp b/addons/mk6mortar/CfgMagazines.hpp new file mode 100644 index 0000000000..39f8bdd780 --- /dev/null +++ b/addons/mk6mortar/CfgMagazines.hpp @@ -0,0 +1,3 @@ +class CfgMagazines { + +}; diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp new file mode 100644 index 0000000000..8399777054 --- /dev/null +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -0,0 +1,21 @@ +class CfgVehicles { + 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"; + }; + }; + }; +}; diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp new file mode 100644 index 0000000000..9d03783519 --- /dev/null +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -0,0 +1,3 @@ +class CfgWeapons { + +}; 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..4082977a5c --- /dev/null +++ b/addons/mk6mortar/RscInGameUI.hpp @@ -0,0 +1,34 @@ +class RscControlsGroup; +class RscText; + +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_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/XEH_clientInit.sqf b/addons/mk6mortar/XEH_clientInit.sqf new file mode 100644 index 0000000000..36b39e58c4 --- /dev/null +++ b/addons/mk6mortar/XEH_clientInit.sqf @@ -0,0 +1,6 @@ +#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..ab2d8370d0 --- /dev/null +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(handleFired); +PREP(handlePlayerVehicleChanged); +PREP(turretDisplayLoaded); + +ADDON = true; diff --git a/addons/mk6mortar/config.cpp b/addons/mk6mortar/config.cpp new file mode 100644 index 0000000000..f7635d1fb6 --- /dev/null +++ b/addons/mk6mortar/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"PabstMirror"}; + authorUrl = "https://github.com/acemod"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "RscInGameUI.hpp" diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf new file mode 100644 index 0000000000..7f1e00453d --- /dev/null +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -0,0 +1,29 @@ +/* + * Author: PabstMirror + * + * 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_grenades_fnc_throwGrenade + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; + +PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + + + + diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf new file mode 100644 index 0000000000..a25bda21ff --- /dev/null +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -0,0 +1,55 @@ +/* + * Author: PabstMirror + * + * + * Arguments: + * + * Return Value: + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_player,_newVehicle); + +if (isNull _newVehicle) exitWith {}; +if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {}; + +[{ + PARAMS_2(_args,_pfID); + EXPLODE_1_PVT(_args,_veh); + + if ((vehicle ACE_player) != _veh) then { + [_pfID] call CBA_fnc_removePerFrameHandler; + } else { + _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; + if (isNull _display) exitWith {systemChat "null";}; + + _hideRangefinder = false; + + _elevDeg = parseNumber ctrlText (_display displayCtrl 175); + if (true) then { + (_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360); + hintSilent str (_elevDeg * 6400 / 360); + } else { + (_display displayCtrl 80175) ctrlSetText str _elevDeg; + }; + + if (_hideRangefinder) then { + (_display displayCtrl 80176) ctrlSetText ""; + } else { + _elevDeg = parseNumber ctrlText (_display displayCtrl 176); + if (_elevDeg <= 0) then { + (_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176)); + } else { + if (true) then { + (_display displayCtrl 80176) ctrlSetText str round (_elevDeg * 6400 / 360); + } else { + (_display displayCtrl 80176) ctrlSetText str _elevDeg; + }; + }; + }; + }; +}, 0, [_newVehicle]] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf new file mode 100644 index 0000000000..dc3dda4038 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf @@ -0,0 +1,62 @@ +/* + * Author: PabstMirror + * + * + * Arguments: + * + * Return Value: + * + * Example: + * + * Public: No + */ +#include "script_component.hpp" + +#define CTRL_CA_HEADING (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_Heading") +#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_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") + + +disableSerialization; + +// PARAMS_1(_display); +_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; +if (isNull _display) exitWith {}; + +_hideRangefinder = true; + +_fnc_hideControl = { + 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, _hideRangefinder] call _fnc_hideControl; +} forEach [CTRL_CA_HEADING, 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]; + +[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..adf4a56946 --- /dev/null +++ b/addons/mk6mortar/script_component.hpp @@ -0,0 +1,12 @@ +#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" \ No newline at end of file diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml new file mode 100644 index 0000000000..0124da4007 --- /dev/null +++ b/addons/mk6mortar/stringtable.xml @@ -0,0 +1,6 @@ + + + + + +