diff --git a/.github/workflows/arma.yml b/.github/workflows/arma.yml index 74449f3..4a8467b 100644 --- a/.github/workflows/arma.yml +++ b/.github/workflows/arma.yml @@ -23,31 +23,17 @@ jobs: - name: Check for BOM uses: arma-actions/bom-check@master - lint: + build-linux: runs-on: ubuntu-latest steps: - name: Checkout the source code - uses: actions/checkout@master - - name: Lint (sqflint) - uses: arma-actions/sqflint@master - continue-on-error: true # No failure due to many false-positives - - build: - runs-on: windows-2022 - steps: - - name: Checkout the source code - uses: actions/checkout@master - - name: Pull Arma3Tools - run: | - echo ${{ secrets.CR_PAT }} | docker login -u ${{ secrets.CR_USER }} --password-stdin ghcr.io - docker pull ghcr.io/armaforces/arma3tools:v2 - - name: Build using HEMTT - run: | - docker run -v "$(pwd):c:/workdir" -e CI=$True ghcr.io/armaforces/arma3tools:v2 hemtt release - - - uses: actions/upload-artifact@v2 + uses: actions/checkout@v4 + - name: Setup HEMTT + uses: arma-actions/hemtt@v1 + - name: Run HEMTT build + run: hemtt build + - uses: actions/upload-artifact@v4 with: - name: armaforces_wargame - path: | - releases/*.zip - !releases/afwg-latest.zip + name: afwg_${{ github.sha }}-nobin + path: .hemttout/@* + include-hidden-files: true # Because .hemttout is a hidden directory diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5e28ae1..59ee3b0 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Release Drafter - if: github.repository == 'ArmaForces/Wargame' + if: github.repository == 'ArmaForces/Arma-Wargame' uses: release-drafter/release-drafter@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c479ea3..07fb001 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,64 +7,27 @@ on: jobs: build_addon: - runs-on: windows-2022 - steps: - - name: Set VERSION env - run: echo VERSION=${GITHUB_REF:11} >> $GITHUB_ENV - - - uses: actions/checkout@v2 - - - name: Pull Arma3Tools - run: | - echo ${{ secrets.CR_PAT }} | docker login -u ${{ secrets.CR_USER }} --password-stdin ghcr.io - docker pull ghcr.io/armaforces/arma3tools:v2 - - - name: Build using HEMTT - run: | - docker run -v "$(pwd):c:/workdir" -e CI=$True ghcr.io/armaforces/arma3tools:v2 hemtt release - - - uses: actions/upload-artifact@v2 - with: - name: hemttout - path: .hemttout/ - if-no-files-found: error - retention-days: 1 - - - uses: actions/upload-artifact@v2 - with: - name: releases - path: releases/ - if-no-files-found: error - retention-days: 7 - - release_addon: runs-on: ubuntu-latest - needs: build_addon steps: + - uses: actions/checkout@v4 - name: Set VERSION env run: echo VERSION=${GITHUB_REF:11} >> $GITHUB_ENV - + - name: Setup HEMTT + uses: arma-actions/hemtt@v1 + - name: Run HEMTT release + run: hemtt release # Upload to GitHub - - uses: actions/download-artifact@v2 - with: - name: releases - path: releases - uses: softprops/action-gh-release@v1 with: files: 'releases/afwg-${{ env.VERSION }}-*.zip' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Upload to Steam Workshop - - uses: actions/download-artifact@v2 - with: - name: hemttout - path: .hemttout - uses: arma-actions/workshop-upload@v1 with: - itemId: '1934142795' # Id of item to update + itemId: '2377030287' # Id of item to update contentPath: '.hemttout/release' - changelog: 'https://github.com/ArmaForces/Wargame/releases/tag/v${{ env.VERSION }}' + changelog: 'https://github.com/ArmaForces/Arma-Wargame/releases/tag/v${{ env.VERSION }}' env: STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml new file mode 100644 index 0000000..23294ca --- /dev/null +++ b/.hemtt/launch.toml @@ -0,0 +1,40 @@ +[default] +workshop = [ + "450814997", # CBA_A3 + "2369477168", # ADT +] +parameters = [ + "-name=dev", +] + +[ace] +extends = "default" +workshop = [ + "463939057", # ACE +# "766491311", # KKA3 ACE Extension +] + +[cup] +extends = "default" +workshop = [ + "583496184", # CUP Terrains - Core + "583544987", # CUP Terrains - Maps +] + +[vn] +extends = "default" +dlc = [ + "S.O.G. Prairie Fire", +] + +[ww2] +extends = "default" +dlc = [ + "Spearhead 1944", +] + +[gm] +extends = "default" +dlc = [ + "Global Mobilization", +] diff --git a/.hemtt/lints.toml b/.hemtt/lints.toml new file mode 100644 index 0000000..a8fd636 --- /dev/null +++ b/.hemtt/lints.toml @@ -0,0 +1,5 @@ +[sqf.command_case] +options.ignore = [ + "EAST", + "WEST", +] diff --git a/.hemtt/project.toml b/.hemtt/project.toml index 1222003..9d5c1e0 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -18,73 +18,3 @@ author = "ArmaForces" [version] path = "addons/main/script_version.hpp" - -# Unused in HEMTT v1.11 or higher, kept for backwards compatibility -[asc] -exclude = [ - ".inc.sqf", -] - -[hemtt.launch.default] -workshop = [ - "450814997", # CBA_A3 - "2369477168", # ADT -] -parameters = [ - "-name=dev", - "-window", -] - -[hemtt.launch.ace] -workshop = [ - "450814997", # CBA_A3 - "2369477168", # ADT - "463939057", # ACE -# "766491311", # KKA3 ACE Extension -] -parameters = [ - "-name=dev", -] - -[hemtt.launch.cup] -workshop = [ - "450814997", # CBA_A3 - "2369477168", # ADT - "583496184", # CUP Terrains - Core - "583544987", # CUP Terrains - Maps -] -parameters = [ - "-name=dev", - "-window", -] - -[hemtt.launch.vn] -workshop = [ - "450814997", # CBA_A3 - "2369477168", # ADT -] -parameters = [ - "-name=dev", - "-window", -] -dlc = [ - "S.O.G. Prairie Fire", -] - -[hemtt.launch.ww2] -workshop = [ - "450814997", # CBA_A3 - "2369477168", # ADT -] -parameters = [ - "-name=dev", - "-window", -] -dlc = [ - "Spearhead 1944", -] - -[hemtt.launch.gm] -dlc = [ - "Global Mobilization", -] diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..4ef01b0 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": [] +} diff --git a/addons/common/CfgWargay.hpp b/addons/common/CfgWargay.hpp new file mode 100644 index 0000000..ae5de64 --- /dev/null +++ b/addons/common/CfgWargay.hpp @@ -0,0 +1,278 @@ +// TODO: This is duplicated in /z/afwg/addons/compatibility, remove from here when feasible +#define ARMOR(FRONT,SIDES,BACK,TOP) armor[] = { FRONT, SIDES, BACK, TOP } +#define VEHICLE_LIKE(otherVehicleClass,vehicleClass) class vehicleClass : otherVehicleClass {} +#define HAS_PENETRATOR(penetratorClass) NO_DAMAGE \ + { \ + child = QUOTE(penetratorClass);\ + } + +// Icon macros +#define ARMA_NATO_MARKERS_DIR \A3\ui_f\data\map\markers\nato +#define WARGAY_NATO_MARKERS_DIR PATHTOEF(markers,assets) +#define ANTIAIR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_antiair.paa) +#define ANTIAIR_SPAAG_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antiair_spaag.paa) +#define ANTIAIR_SPAAG_RADAR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antiair_spaag_radar.paa) +#define ANTITANK_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antitank.paa) +#define ANTITANK_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antitank_armor.paa) +#define ART_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_art.paa) +#define ART_ROCKET_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_art_rocket.paa) +#define ARMOR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_armor.paa) +#define CV_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_cv_armor.paa) +#define CV_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_cv.paa) +#define HELI_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_air.paa) +#define LOG_ARMOR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_support.paa) +#define LOG_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_support.paa) +#define MECH_INF_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_mech_inf.paa) +#define MECH_INF_ARMED_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_mech_inf_armed.paa) +#define MOTOR_INF_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_motor_inf.paa) +#define PLANE_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_air.paa) +#define RECON_AIR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_air.paa) +#define RECON_ANTITANK_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_antitank.paa) +#define RECON_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_armor.paa) +#define RECON_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon.paa) + +// TODO: Consider moving all these to compatibility addons for other mods +class CfgWargay +{ + // westMarkerColor[] = { + // __EVAL(96/255), + // __EVAL(159/255), + // __EVAL(197/255), + // 0.85 + // }; + // westAiMarkerColor[] = { + // __EVAL(29/255), + // __EVAL(197/255), + // __EVAL(46/255), + // 0.85 + // }; + // eastMarkerColor[] = { + // __EVAL(192/255), + // __EVAL(29/255), + // __EVAL(46/255), + // 0.85 + // }; + // filledHpColor[] = { + // __EVAL(117/255), + // 1, + // 1, + // 1 + // }; + // missingHpColor[] = { + // __EVAL(117/255), + // __EVAL(117/255), + // __EVAL(117/255), + // 1 + // }; + + class Ammo + { + class NO_DAMAGE + { + damage = 0; + type = "NONE"; + }; + + /* Base */ + class AA_HE + { + damage = 1; + type = "HE"; + }; + class SMALL_ARMS + { + damage = 0.1; + type = "AP"; + }; + class HMG_HE : AA_HE {}; + class HMG_AP + { + damage = 1; + type = "AP"; + }; + class Small_HE + { + damage = 2; + type = "HE"; + }; + class Tank_HE + { + damage = 3; + type = "HE"; + }; + + /* ACE Fragmentation */ + class ace_frag_tiny + { + damage = 0.1; + type = "HE"; + }; + class ace_frag_tiny_HD : ace_frag_tiny {}; + class ace_frag_small + { + damage = 0.2; + type = "HE"; + }; + class ace_frag_small_HD : ace_frag_small {}; + class ace_frag_medium + { + damage = 0.5; + type = "HE"; + }; + class ace_frag_medium_HD : ace_frag_medium {}; + class ace_frag_large + { + damage = 1; + type = "HE"; + }; + class ace_frag_large_HD : ace_frag_large {}; + class ace_frag_huge + { + damage = 2; + type = "HE"; + }; + class ace_frag_huge_HD : ace_frag_huge {}; + + class ACE_ammoExplosionLarge + { + damage = 4; + type = "HE"; + }; + + /* + Vanilla + */ + class SatchelCharge_Remote_Ammo : ACE_ammoExplosionLarge {}; + + /* + USA + */ + class B_127x107_Ball : SMALL_ARMS {}; + class B_762x51_Tracer_Red : SMALL_ARMS {}; + + /* + Soviet Union + */ + class ammo_Missile_AA_R77 + { + damage = 5; + type = "HE"; + }; + class Rocket_03_HE_F + { + damage = 2; + type = "HE"; + }; + class Rocket_03_AP_F + { + damage = 2; + type = "HEAT"; + }; + + class Sh_125mm_APFSDS_T_Green + { + damage = 16; + type = "AP"; + }; + class Sh_125mm_HE_T_Green + { + damage = 4; + type = "HE"; + }; + + /* + Military Aviation + */ + class B_20mm_Tracer_Red : AA_HE {}; + class sab_milavi_27mm_he_ammo : AA_HE {}; + class sab_milavi_rkt_hydra_ammo + { + damage = 3; + type = "HE"; + }; + class sab_milavi_rkt_zuni_ammo + { + damage = 4; + type = "HE"; + }; + class sab_milavi_bmb_mk82_ammo + { + damage = 10; + type = "HE"; + }; + class sab_milavi_bomblets_he_subammo + { + damage = 1; + type = "HE"; + }; + class sab_milavi_msl_maverick_ammo + { + damage = 26; + type = "HEAT"; + }; + }; + + class Vehicles + { + /* + USA + */ + + // LOG + class Truck_01_base_F // HEMTT + { + pointCost = 40; + hitpoints = 10; + ARMOR(1,1,1,0); + iconPath = LOG_ICON; + markerType = "b_support"; + isLogistics = 1; + }; + + // PLA + class sab_f104_base + { + pointCost = 70; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = PLANE_ICON; + markerType = "b_air"; + }; + + /* + West Germany + */ + + // PLA + class sab_alphajet_base + { + pointCost = 50; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = PLANE_ICON; + markerType = "b_air"; + }; + }; +}; + +// For future CSLA usage: +// ["CSLA_T72", [11, 6, 3, 2]]; +// ["CSLA_T72M", [12, 7, 3, 2]]; +// ["CSLA_T72M1", [14, 7, 3, 2]]; +// ["CSLA_BVP1", [3, 1, 1, 1]]; +// ["CSLA_BPzV", [3, 1, 1, 1]]; +// ["CSLA_DTP90", [3, 1, 1, 1]]; +// ["CSLA_MU90", [3, 1, 1, 1]]; +// ["CSLA_OZV90", [3, 1, 1, 1]]; +// ["CSLA_OT62", [2, 1, 1, 1]]; +// ["CSLA_OT64C", [1, 1, 1, 1]]; +// ["CSLA_OT64C_VB", [1, 1, 1, 1]]; +// ["CSLA_OT65A", [1, 1, 1, 1]]; +// ["AFMC_M1IP", [17, 7, 3, 3]]; +// ["AFMC_M1A1", [17, 7, 4, 3]]; +// ["AFMC_LAV25", [1, 1, 1, 1]]; +// ["AFMC_M113_AMB", [1, 1, 1, 1]]; +// ["AFMC_M113_DTP", [1, 1, 1, 1]]; +// ["AFMC_M113", [1, 1, 1, 1]]; +// ["AFMC_M163", [1, 1, 1, 1]]; +// ["AFMC_M270", [1, 0, 0, 0]]; diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index cde2f95..66c7ef3 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -1,2 +1,8 @@ -PREP(isEmptyString); -PREP(systemChat); +PREP(createVehicleInfoForNonConfiguredVehicle); +PREP(getAmmoInfo); +PREP(getGroupVehicles); +PREP(getVehicleDisplayName); +PREP(getVehicleInfo); +PREP(isEngineer); +PREP(isReconVehicle); +PREP(shouldStillBeVisible); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index ecb5d0c..6706cf8 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -5,4 +5,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.inc.sqf" + ADDON = true; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index d821136..212e50f 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgWargay.hpp" diff --git a/addons/common/functions/fnc_createVehicleInfoForNonConfiguredVehicle.sqf b/addons/common/functions/fnc_createVehicleInfoForNonConfiguredVehicle.sqf new file mode 100644 index 0000000..8e612c1 --- /dev/null +++ b/addons/common/functions/fnc_createVehicleInfoForNonConfiguredVehicle.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Creates configuration hashmap for given vehicle. + * Includes className and display name. + * + * Arguments: + * 0: Vehicle to create hashmap for + * + * Return Value: + * Created hashmap with base properties + * + * Public: No + */ + +params ["_vehicle"]; + +private _newVehicleInfo = createHashMapFromArray [ + [CLASS_NAME_PROPERTY, toUpper typeOf _vehicle], + [DISPLAY_NAME_PROPERTY, getText (configOf _vehicle >> DISPLAY_NAME_PROPERTY)], + ["iconPath", "\A3\ui_f\data\map\markers\nato\b_unknown.paa"], + ["markerType", "b_unknown"], + ["pointCost", 5] +]; + +VehicleTypes set [toUpper typeOf _vehicle, _newVehicleInfo]; + +_newVehicleInfo diff --git a/addons/common/functions/fnc_getAmmoInfo.sqf b/addons/common/functions/fnc_getAmmoInfo.sqf new file mode 100644 index 0000000..505a079 --- /dev/null +++ b/addons/common/functions/fnc_getAmmoInfo.sqf @@ -0,0 +1,128 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Retrieves vehicle info hashmap for given unit or group (leader vehicle) if available. + * + * Arguments: + * 0: Unit or group to get its vehicle + * 1: Unit info key (Optional, if empty whole hashmap is returned) + * 2: Default value if key or unit info doesn't exist + * + * Return Value: + * Unit info or retrieved or default value + * + * Public: No + */ + +params ["_unitOrGroup"/*, ["_key", ""], ["_defaultValue", objNull]*/]; + +private _vehicle = if (_unitOrGroup isEqualType objNull) then { + vehicle _unitOrGroup +} else { + vehicle leader _unitOrGroup +}; + +private _vehicleInfo = [_vehicle] call FUNC(getVehicleInfo); + +private _ammoInfo = _vehicleInfo getOrDefault [AMMO_PROPERTY, objNull]; +if (_ammoInfo isEqualTo objNull) then { + private _vehicleClassName = _vehicleInfo get CLASS_NAME_PROPERTY; + + LOG_1("Searching ammo info for %1",_vehicleClassName); + + private _magazines = getArray (configFile >> "CfgVehicles" >> _vehicleClassName >> "Turrets" >> "MainTurret" >> "magazines"); + _magazines = _magazines arrayIntersect _magazines; + + LOG_1("Found mags: %1",str _magazines); + + private _ammo = _magazines apply { + MagazineTypes getOrDefault [toUpper _x, objNull] + } + select {_x isNotEqualTo objNull} + apply { + [_x get CLASS_NAME_PROPERTY, _x getOrDefault [AMMO_PROPERTY, objNull]] + } + select {_x select 1 isNotEqualTo objNull} + apply { + (_x select 1) set ["displayName", getText (configFile >> "CfgMagazines" >> (_x select 0) >> "displayName")]; + _x select 1 + }; + + LOG_1("Found ammo: %1",str _ammo); + + _ammoInfo = createHashMap; + { + _ammoInfo set [_x get CLASS_NAME_PROPERTY, _x]; + } forEach _ammo; + + LOG_1("Created ammo info: %1",str _ammoInfo); + + _vehicleInfo set [AMMO_PROPERTY, _ammoInfo]; + + LOG_1("Updated vehicle info: %1",str _vehicleInfo); +}; + +_ammoInfo + + +/* + +private _unitClassName = toUpper typeOf _unit; + +private _ammoInfo = AmmoTypes getOrDefault [_unitClassName, objNull]; + +// Handle classes that have a parent configured +if (_ammoInfo isEqualTo objNull) then { + + private _parentClassNames = [configOf _unit, true] call BIS_fnc_returnParents; + + LOG_3("Not found info for '%1'. Found %2 parents: %3",_unitClassName,count _parentClassNames,str _parentClassNames); + + while {_ammoInfo isEqualTo objNull && {count _parentClassNames > 0}} do { + private _parent = _parentClassNames deleteAt 0; + _ammoInfo = VehicleTypes getOrDefault [toUpper _parent, objNull]; + }; + + if (_ammoInfo isNotEqualTo objNull) then { + LOG_3("Found matching parent '%1' for '%2' with vehicle info: %3",_ammoInfo get CLASS_NAME_PROPERTY,_unitClassName,str _ammoInfo); + + _ammoInfo set [CLASS_NAME_PROPERTY, _unitClassName]; + _ammoInfo set [DISPLAY_NAME_PROPERTY, getText (configFile >> "CfgVehicles" >> _unitClassName >> DISPLAY_NAME_PROPERTY)]; + VehicleTypes set [_unitClassName, _ammoInfo]; + + LOG_1("Saved vehicle info: '%1'",str _ammoInfo); + } else { + _ammoInfo = [_unit] call FUNC(createVehicleInfoForNonConfiguredVehicle); + LOG_2("Parent not found for '%1', created dummy info: %2",_unitClassName,str _ammoInfo); + }; +}; + +LOG_2("Found vehicle info for '%1': %2",_unitClassName,str _ammoInfo); + +/*if (_key isEqualTo "") exitWith { _ammoInfo }; + +_ammoInfo getOrDefault [_key, _defaultValue]*/ + + +// _hashMap set [DISPLAY_NAME_PROPERTY, getText (configFile >> "CfgAmmo" >> configName _x >> DISPLAY_NAME_PROPERTY)]; + +/* + private _vehicle = get3DENSelected "Object" select 0; +_vehicle = vehicle player; + +private _magazines = getArray (configOf _vehicle >> "Turrets" >> "MainTurret" >> "magazines"); +_magazines = _magazines arrayIntersect _magazines; + +private _ammo = _magazines apply { + [_x, getText (configFile >> "CfgMagazines" >> _x >> "ammo")] +}; + +_ammo apply { + [_x select 0, AmmoTypes getOrDefault [toUpper (_x select 1), objNull]]; +} select {_x select 1 isNotEqualTo objNull} +apply { + (_x select 1) set ["displayName", getText (configFile >> "CfgMagazines" >> (_x select 0) >> "displayName")]; + _x select 1 +} + + */ diff --git a/addons/common/functions/fnc_getGroupVehicles.sqf b/addons/common/functions/fnc_getGroupVehicles.sqf new file mode 100644 index 0000000..c761bd1 --- /dev/null +++ b/addons/common/functions/fnc_getGroupVehicles.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Returns all vehicles in possesion of given group. + * + * Arguments: + * 0: Group + * + * Return Value: + * List of unique vehicles > + * + * Public: No + */ + +params ["_group"]; + +private _groupVehicles = units _group apply { vehicle _x } select {_x isKindOf "AllVehicles"}; +_groupVehicles arrayIntersect _groupVehicles diff --git a/addons/common/functions/fnc_getVehicleDisplayName.sqf b/addons/common/functions/fnc_getVehicleDisplayName.sqf new file mode 100644 index 0000000..7e32ff2 --- /dev/null +++ b/addons/common/functions/fnc_getVehicleDisplayName.sqf @@ -0,0 +1,30 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3, veteran29 + * Returns displayName for given vehicle type. + * + * Arguments: + * 0: Vehicle or unit info + * + * Return Value: + * Short display name of a vehicle type + * + * Public: No + */ + +params ["_vehicleOrInfo"]; + +if ( + _vehicleOrInfo isEqualType objNull + && {!(_vehicleOrInfo isKindOf "AllVehicles")} +) exitWith { "" }; + +if (_vehicleOrInfo isEqualType objNull) then { + _vehicleOrInfo = [_vehicleOrInfo] call FUNC(getVehicleInfo); +}; + +_vehicleOrInfo getOrDefaultCall [ + DISPLAY_NAME_PROPERTY, + {getText (configFile >> "CfgVehicles" >> (_vehicleOrInfo get CLASS_NAME_PROPERTY) >> DISPLAY_NAME_PROPERTY)}, + true +] // return diff --git a/addons/common/functions/fnc_getVehicleInfo.sqf b/addons/common/functions/fnc_getVehicleInfo.sqf new file mode 100644 index 0000000..a69b4d2 --- /dev/null +++ b/addons/common/functions/fnc_getVehicleInfo.sqf @@ -0,0 +1,60 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Retrieves vehicle info hashmap for given unit or group (leader vehicle) if available. + * + * Arguments: + * 0: Unit or group to get its vehicle + * 1: Unit info key (Optional, if empty whole hashmap is returned) + * 2: Default value if key or unit info doesn't exist + * + * Return Value: + * Unit info or retrieved or default value + * + * Public: No + */ + +params ["_unitOrGroup", ["_key", ""], ["_defaultValue", objNull]]; + +private _unit = if (_unitOrGroup isEqualType objNull) then { + vehicle _unitOrGroup +} else { + vehicle leader _unitOrGroup +}; + +private _unitClassName = toUpper typeOf _unit; + +private _vehicleInfo = VehicleTypes getOrDefault [_unitClassName, objNull]; + +// Handle classes that have a parent configured +if (_vehicleInfo isEqualTo objNull) then { + + private _parentClassNames = [configOf _unit, true] call BIS_fnc_returnParents; + + LOG_3("Not found info for '%1'. Found %2 parents: %3",_unitClassName,count _parentClassNames,str _parentClassNames); + + while {_vehicleInfo isEqualTo objNull && {count _parentClassNames > 0}} do { + private _parent = _parentClassNames deleteAt 0; + _vehicleInfo = VehicleTypes getOrDefault [toUpper _parent, objNull]; + }; + + if (_vehicleInfo isNotEqualTo objNull) then { + LOG_3("Found matching parent '%1' for '%2' with vehicle info: %3",_vehicleInfo get CLASS_NAME_PROPERTY,_unitClassName,str _vehicleInfo); + + // BUG:? It might replace value in original hashmap + _vehicleInfo set [CLASS_NAME_PROPERTY, _unitClassName]; + _vehicleInfo set [DISPLAY_NAME_PROPERTY, getText (configFile >> "CfgVehicles" >> _unitClassName >> DISPLAY_NAME_PROPERTY)]; + VehicleTypes set [_unitClassName, _vehicleInfo]; + + LOG_1("Saved vehicle info: '%1'",str _vehicleInfo); + } else { + _vehicleInfo = [_unit] call FUNC(createVehicleInfoForNonConfiguredVehicle); + LOG_2("Parent not found for '%1', created dummy info: %2",_unitClassName,str _vehicleInfo); + }; +}; + +LOG_2("Found vehicle info for '%1': %2",_unitClassName,str _vehicleInfo); + +if (_key isEqualTo "") exitWith { _vehicleInfo }; + +_vehicleInfo getOrDefault [_key, _defaultValue] diff --git a/addons/common/functions/fnc_isEmptyString.sqf b/addons/common/functions/fnc_isEmptyString.sqf deleted file mode 100644 index 1e73e85..0000000 --- a/addons/common/functions/fnc_isEmptyString.sqf +++ /dev/null @@ -1,22 +0,0 @@ -#include "script_component.hpp" -/* - * Author: 3Mydlo3 - * Example function checking if string is empty. - * - * Arguments: - * 0: String to check - * - * Return Value: - * True if string is null or empty - * - * Example: - * [nil] call afwg_common_fnc_isEmptyString - * - * Public: No - */ - -params [["_string", ""]]; - -if (_string isEqualTo "") exitWith { true }; - -false diff --git a/addons/common/functions/fnc_isEngineer.sqf b/addons/common/functions/fnc_isEngineer.sqf new file mode 100644 index 0000000..03f7d1c --- /dev/null +++ b/addons/common/functions/fnc_isEngineer.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if given unit is an engineer. + * + * Arguments: + * 0: Unit + * + * Return Value: + * True if unit is an engineer + * + * Public: No + */ + +params ["_unit"]; + +_unit getUnitTrait "Engineer" isEqualTo 1 || {[_unit] call ACE_repair_fnc_isEngineer} diff --git a/addons/common/functions/fnc_isReconVehicle.sqf b/addons/common/functions/fnc_isReconVehicle.sqf new file mode 100644 index 0000000..f21b7df --- /dev/null +++ b/addons/common/functions/fnc_isReconVehicle.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if given unit or group is recon. + * + * Arguments: + * 0: Unit or group to check if it's recon + * + * Return Value: + * True if vehicle of a unit (or his leader) is recon + * + * Public: No + */ + +params ["_unitOrGroup"]; + +[_unitOrGroup, "isRecon", false] call FUNC(getVehicleInfo) isEqualTo 1 diff --git a/addons/common/functions/fnc_shouldStillBeVisible.sqf b/addons/common/functions/fnc_shouldStillBeVisible.sqf new file mode 100644 index 0000000..b29649b --- /dev/null +++ b/addons/common/functions/fnc_shouldStillBeVisible.sqf @@ -0,0 +1,19 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if given target is known to at least one unit. + * + * Arguments: + * 0: Object to check if anyone knows about it + * + * Return Value: + * True if at least one unit knows about the target + * + * Public: No + */ + +params ["_target", ["_side", WEST]]; + +private _anyoneKnowsAbout = groups _side findIf {leader _x targetKnowledge _target select 0} != -1; + +_anyoneKnowsAbout diff --git a/addons/common/functions/fnc_systemChat.sqf b/addons/common/functions/fnc_systemChat.sqf deleted file mode 100644 index 8cbe320..0000000 --- a/addons/common/functions/fnc_systemChat.sqf +++ /dev/null @@ -1,24 +0,0 @@ -#include "script_component.hpp" -/* - * Author: 3Mydlo3 - * Example function printing sytemChat message. - * - * Arguments: - * 0: Actual message - * - * Return Value: - * True if message was printed - * - * Example: - * ["Test message"] call afwg_common_fnc_systemChat - * - * Public: No - */ - -params [["_message", ""]]; - -if (_message call FUNC(isEmptyString)) exitWith { false }; - -sytemChat _message; - -true diff --git a/addons/common/initSettings.inc.sqf b/addons/common/initSettings.inc.sqf new file mode 100644 index 0000000..173265e --- /dev/null +++ b/addons/common/initSettings.inc.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(onlyReconCanSpot), + "CHECKBOX", + ["Only recon can spot", "If enabled, only recon units can spot enemies to be visible for other units"], + [LSTRING(DisplayName)], + false, + true +] call CBA_fnc_addSetting; diff --git a/addons/common/script_component.hpp b/addons/common/script_component.hpp index 5921328..0f429bd 100644 --- a/addons/common/script_component.hpp +++ b/addons/common/script_component.hpp @@ -1,10 +1,6 @@ #define COMPONENT common #include "\z\afwg\addons\main\script_mod.hpp" -#include "\a3\ui_f\hpp\defineCommonGrids.inc" -#include "\a3\ui_f\hpp\defineResincl.inc" -#include "\a3\ui_f\hpp\defineResinclDesign.inc" - // #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index cee4bc5..23b482b 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -2,8 +2,8 @@ - ArmaForces - Common - ArmaForces - Common + ArmaForces Wargame - Common + ArmaForces Wargame - Common Enable component @@ -13,5 +13,9 @@ Controls whether this component is active. Pozwala kontrolować czy komponent jest włączony. + + Action interrupted, vehicle is in combat. + Akcja przerwana, pojazd uczestniczy w walce. + diff --git a/addons/compatibility/$PBOPREFIX$ b/addons/compatibility/$PBOPREFIX$ new file mode 100644 index 0000000..b254666 --- /dev/null +++ b/addons/compatibility/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\compatibility diff --git a/addons/compatibility/README.md b/addons/compatibility/README.md new file mode 100644 index 0000000..dc66ee5 --- /dev/null +++ b/addons/compatibility/README.md @@ -0,0 +1,5 @@ +# Compatiblity + +Adds compatiblity for various mods and cDLCs, loaded as needed thanks to `skipWhenMissingDependencies`. + +Please pay attention to any warnings or incorrect unit stats (basic cost, no armor for tanks etc.). Feel free to contribute. diff --git a/addons/compatibility/config.cpp b/addons/compatibility/config.cpp new file mode 100644 index 0000000..19e1e8b --- /dev/null +++ b/addons/compatibility/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common", + "A3_Data_F_Decade_Loadorder" + }; + author = "ArmaForces"; + authors[] = {"veteran29"}; + VERSION_CONFIG; + }; +}; diff --git a/addons/compatibility/cup/CfgWargay.hpp b/addons/compatibility/cup/CfgWargay.hpp new file mode 100644 index 0000000..9ea6720 --- /dev/null +++ b/addons/compatibility/cup/CfgWargay.hpp @@ -0,0 +1,111 @@ +class CfgWargay +{ + class Ammo + { + class NO_DAMAGE; + class AA_HE; + class SMALL_ARMS; + class ace_frag_small; + + class CUP_R_70mm_Hydra_HE + { + damage = 2; + type = "HE"; + }; + class CUP_B_20mm_AP_Tracer_Red + { + damage = 2; + type = "AP"; + }; + class CUP_R_TOW_AT + { + damage = 20; + type = "HEAT"; + }; + + class CUP_Sh_105mm_M900 + { + damage = 13; + type = "AP"; + }; + class CUP_Sh_105mm_M456A2 : HAS_PENETRATOR(CUP_P_105mm_M393A3); + class CUP_P_105mm_M393A3 + { + damage = 13; + type = "HEAT"; + }; + class CUP_P_120mm_HESH + { + damage = 3; + type = "HE"; + }; + + class CUP_B_20mm_API_Tracer_Red : AA_HE {}; + + class CUP_B_127x99_Ball_Red_Tracer : SMALL_ARMS {}; + + class G_40mm_HE : ace_frag_small {}; + + class CUP_M_9M119M_Refleks_AT11_Sniper_AT + { + damage = 20; + type = "HEAT"; + }; + class CUP_B_30mm_CAS_Red_Tracer : AA_HE {}; + class CUP_B_23mm_APHE_Tracer_Green : AA_HE {}; + }; + + class Vehicles + { + // LOG + class CUP_M113New_HQ_Base + { + pointCost = 120; + hitpoints = 10; + ARMOR(2,2,1,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + + // SUP + class CUP_M163New_Base + { + pointCost = 40; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ANTIAIR_SPAAG_RADAR_ICON; + markerType = "b_antiair_spaag_radar"; + }; + + // TNK + class CUP_M60A3_Base + { + pointCost = 50; + hitpoints = 10; + ARMOR(10,5,2,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + + // VEH + class CUP_nM1036_TOW_Base + { + pointCost = 40; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = ANTITANK_ICON; + markerType = "b_antitank"; + }; + + // HEL + class CUP_Mi24_D_Dynamic_Base + { + pointCost = 55; + hitpoints = 10; + ARMOR(1,1,0,0); + iconPath = HELI_ICON; + markerType = "b_air"; + }; + }; +}; diff --git a/addons/compatibility/cup/README.md b/addons/compatibility/cup/README.md new file mode 100644 index 0000000..c3dd3fe --- /dev/null +++ b/addons/compatibility/cup/README.md @@ -0,0 +1,7 @@ +# CUP + +Compatibility addon for [CUP Vehicles](https://steamcommunity.com/sharedfiles/filedetails/?id=541888371). + +## Notes + +Not all classes are covered by this compat. Pay attention to warnings and incorrect unit stats (like basic cost or no armor for a tank). Feel free to contribute. diff --git a/addons/compatibility/cup/config.cpp b/addons/compatibility/cup/config.cpp new file mode 100644 index 0000000..0593220 --- /dev/null +++ b/addons/compatibility/cup/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_compatibility", + "CUP_Vehicles_LoadOrder" + }; + skipWhenMissingDependencies = 1; + author = "ArmaForces"; + authors[] = {"3Mydlo3"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWargay.hpp" diff --git a/addons/compatibility/cup/script_component.hpp b/addons/compatibility/cup/script_component.hpp new file mode 100644 index 0000000..40c633d --- /dev/null +++ b/addons/compatibility/cup/script_component.hpp @@ -0,0 +1,2 @@ +#define SUBCOMPONENT cup +#include "..\script_component.hpp" diff --git a/addons/compatibility/cwr3/CfgWargay.hpp b/addons/compatibility/cwr3/CfgWargay.hpp new file mode 100644 index 0000000..47efb83 --- /dev/null +++ b/addons/compatibility/cwr3/CfgWargay.hpp @@ -0,0 +1,99 @@ +class CfgWargay +{ + class Ammo + { + class AA_HE; + + class cwr3_b_30mm_nr30_hedp_tracer_red : AA_HE {}; + }; + + class Vehicles + { + /* + USA + */ + // VEH + class cwr3_m901_itv_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(2,2,1,1); + iconPath = ANTITANK_ICON; + markerType = "b_antitank"; + }; + + // HEL + class cwr3_ah1f_base + { + pointCost = 80; + hitpoints = 10; // Should be 6 according to Wargay + ARMOR(0,0,0,0); + iconPath = HELI_ICON; + markerType = "b_air"; + }; + + /* + Soviet Union + */ + + // SUP + class cwr3_mtlb_sa13_base + { + pointCost = 45; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ANTIAIR_ICON; + }; + + // TNK + class cwr3_t64b_base + { + pointCost = 65; + hitpoints = 10; + ARMOR(13,6,3,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + class cwr3_t72_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(11,6,3,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + class cwr3_o_t72a : cwr3_t72_base + { + pointCost = 50; + ARMOR(13,7,3,2); + }; + class cwr3_o_t72b1 : cwr3_t72_base + { + pointCost = 85; + ARMOR(15,8,4,4); + // TODO: Ammo config + }; + + // PLA + class cwr3_mig23_base + { + pointCost = 90; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = PLANE_ICON; + markerType = "b_air"; + }; + class cwr3_mig27_base : cwr3_mig23_base + { + pointCost = 115; + }; + class cwr3_su17_base : cwr3_mig23_base + { + pointCost = 70; + }; + class cwr3_su25_base : cwr3_mig23_base + { + pointCost = 130; + }; + }; +}; diff --git a/addons/compatibility/cwr3/README.md b/addons/compatibility/cwr3/README.md new file mode 100644 index 0000000..66813f3 --- /dev/null +++ b/addons/compatibility/cwr3/README.md @@ -0,0 +1,7 @@ +# Cold War Rearmed III + +Compatibility addon for [Cold War Rearmed III](https://steamcommunity.com/workshop/filedetails/?id=2316343124). + +## Notes + +Not all classes are covered by this compat. Pay attention to warnings and incorrect unit stats (like basic cost or no armor for a tank). Feel free to contribute. diff --git a/addons/compatibility/cwr3/config.cpp b/addons/compatibility/cwr3/config.cpp new file mode 100644 index 0000000..9355d41 --- /dev/null +++ b/addons/compatibility/cwr3/config.cpp @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_compatibility", + "CUP_Vehicles_LoadOrder", + "afwg_compatibility_cup" + }; + skipWhenMissingDependencies = 1; + author = "ArmaForces"; + authors[] = {"3Mydlo3"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWargay.hpp" diff --git a/addons/compatibility/cwr3/script_component.hpp b/addons/compatibility/cwr3/script_component.hpp new file mode 100644 index 0000000..81ae33c --- /dev/null +++ b/addons/compatibility/cwr3/script_component.hpp @@ -0,0 +1,2 @@ +#define SUBCOMPONENT cwr3 +#include "..\script_component.hpp" diff --git a/addons/compatibility/french_armour_pack/CfgWargay.hpp b/addons/compatibility/french_armour_pack/CfgWargay.hpp new file mode 100644 index 0000000..080b70f --- /dev/null +++ b/addons/compatibility/french_armour_pack/CfgWargay.hpp @@ -0,0 +1,63 @@ +class CfgWargay +{ + // Mod uses vanilla ammo, so it might be incompatible in some scenarios + // TODO: Configure B_30mm_APFSDS_Tracer_Green and B_30mm_MP_Tracer_Green if needed + class Ammo + { + class NO_DAMAGE; + class Tank_HE; + + class Sh_105mm_APFSDS_T_Red + { + damage = 12; + type = "AP"; + }; + + class Sh_105mm_HEAT_MP_T_Red : HAS_PENETRATOR(ammo_Penetrator_105mm); + class ammo_Penetrator_105mm + { + damage = 12; + type = "HEAT"; + }; + + class Sh_120mm_HE_Tracer_Red : Tank_HE {}; + + class 4Rnd_hot2_ammo : HAS_PENETRATOR(ammo_Penetrator_Titan_AT_long); + class ammo_Penetrator_Titan_AT_long + { + damage = 22; + type = "HEAT"; + }; + }; + + class Vehicles + { + class amx10rc_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(3,2,1,1); + iconPath = RECON_ARMOR_ICON; + markerType = "b_recon_armor"; + }; + + // Based on AMX-30B2 https://wargame.fandom.com/wiki/AMX-30B2 + class amx30_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(7,4,2,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + + class mephisto_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ANTITANK_ICON; + markerType = "b_antitank"; + }; + }; +}; diff --git a/addons/compatibility/french_armour_pack/README.md b/addons/compatibility/french_armour_pack/README.md new file mode 100644 index 0000000..5099d15 --- /dev/null +++ b/addons/compatibility/french_armour_pack/README.md @@ -0,0 +1,7 @@ +# French Armour Pack + +Compatibility addon for [French Armour Pack](https://steamcommunity.com/sharedfiles/filedetails/?id=3317407146). + +## Notes + +This mod uses vanilla ammo classes, thus might result in degraded experience in combination with other mods that use vanilla ammo. Feel free to contribute and update this addon with custom ammo classes (can be derived from vanilla ones), so that it can work flawlessly with other mods. diff --git a/addons/compatibility/french_armour_pack/config.cpp b/addons/compatibility/french_armour_pack/config.cpp new file mode 100644 index 0000000..0dfc741 --- /dev/null +++ b/addons/compatibility/french_armour_pack/config.cpp @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_compatibility", + "amx10rc", + "amx30", + "mephisto" + }; + skipWhenMissingDependencies = 1; + author = "ArmaForces"; + authors[] = {"3Mydlo3"}; + VERSION_CONFIG; + }; +}; + +#include "CfgWargay.hpp" diff --git a/addons/compatibility/french_armour_pack/script_component.hpp b/addons/compatibility/french_armour_pack/script_component.hpp new file mode 100644 index 0000000..22cdabb --- /dev/null +++ b/addons/compatibility/french_armour_pack/script_component.hpp @@ -0,0 +1,2 @@ +#define SUBCOMPONENT french_armour_pack +#include "..\script_component.hpp" diff --git a/addons/compatibility/global_mobilization/CfgAmmo.hpp b/addons/compatibility/global_mobilization/CfgAmmo.hpp new file mode 100644 index 0000000..038a260 --- /dev/null +++ b/addons/compatibility/global_mobilization/CfgAmmo.hpp @@ -0,0 +1,15 @@ + +class CfgAmmo { + /* + Reference: + B_30mm_APFSDS_Tracer_Green + aiAmmoUsageFlags = "128 + 512"; + caliber = 6; + hit = 120; + */ + class gm_bullet_23x152mm_base; + class gm_bullet_23x152mm_API_T_BZT: gm_bullet_23x152mm_base { + caliber = 6; // 3.80952 + hit = 80; // 52.47; + }; +}; diff --git a/addons/compatibility/global_mobilization/CfgVehicles.hpp b/addons/compatibility/global_mobilization/CfgVehicles.hpp new file mode 100644 index 0000000..9e5712c --- /dev/null +++ b/addons/compatibility/global_mobilization/CfgVehicles.hpp @@ -0,0 +1,322 @@ +class CfgVehicles { + class gm_bo105p_base; + class gm_bo105p_pah1_base : gm_bo105p_base { + displayName = SUBCSTRING(Bo105P_PAH1_Name); + shortDisplayName = SUBCSTRING(Bo105P_PAH1_Name); + }; + class gm_bo105p_pah1a1_base : gm_bo105p_pah1_base { + displayName = SUBCSTRING(Bo105P_PAH1A1_Name); + shortDisplayName = SUBCSTRING(Bo105P_PAH1A1_Name); + }; + class gm_bo105m_base; + class gm_bo105m_vbh_base : gm_bo105m_base { + displayName = SUBCSTRING(Bo105M_VBH1_Name); + shortDisplayName = SUBCSTRING(Bo105M_VBH1_Name); + }; + class gm_bo105p1m_base : gm_bo105p_base {}; + class gm_bo105p1m_vbh_base : gm_bo105p1m_base { + displayName = SUBCSTRING(Bo105M_VBH1A1_Name); + shortDisplayName = SUBCSTRING(Bo105M_VBH1A1_Name); + }; + class gm_bo105p1m_vbh_swooper_base : gm_bo105p1m_vbh_base { + displayName = SUBCSTRING(Bo105M_VBH1A1_Swooper_Name); + shortDisplayName = SUBCSTRING(Bo105M_VBH1A1_Name); + }; + class gm_ge_pol_bo105m_vbh_base : gm_bo105m_vbh_base { + displayName = SUBCSTRING(Bo105M_VBH1_Police_Name); + shortDisplayName = SUBCSTRING(Bo105M_VBH1_Name); + }; + class gm_ge_adak_bo105m_vbh_base : gm_bo105m_vbh_base { + displayName = SUBCSTRING(Bo105M_VBH1_ADAK_Name); + shortDisplayName = SUBCSTRING(Bo105M_VBH1_Name); + }; + + class gm_tracked_Tank_base; + + class gm_Leopard1_base : gm_tracked_Tank_base { + displayName = SUBCSTRING(Leopard1_Name); + shortDisplayName = SUBCSTRING(Leopard1_Name); + }; + class gm_Leopard1a0_base : gm_Leopard1_base { + displayName = SUBCSTRING(Leopard1A0_Name); + shortDisplayName = SUBCSTRING(Leopard1A0_Name); + }; + + class gm_Leopard1a1_base : gm_Leopard1a0_base { + displayName = SUBCSTRING(Leopard1A1_Name); + shortDisplayName = SUBCSTRING(Leopard1A1_Name); + }; + class gm_Leopard1a1a1_base : gm_Leopard1a1_base { + displayName = SUBCSTRING(Leopard1A1A1_Name); + shortDisplayName = SUBCSTRING(Leopard1A1A1_Name); + }; + class gm_Leopard1a1a2_base : gm_Leopard1a1a1_base { + displayName = SUBCSTRING(Leopard1A1A2_Name); + shortDisplayName = SUBCSTRING(Leopard1A1A2_Name); + }; + class gm_Leopard1a1a3_base : gm_Leopard1a1a1_base { + displayName = SUBCSTRING(Leopard1A1A3_Name); + shortDisplayName = SUBCSTRING(Leopard1A1A3_Name); + }; + class gm_Leopard1a1a4_base : gm_Leopard1a1a2_base { + displayName = SUBCSTRING(Leopard1A1A4_Name); + shortDisplayName = SUBCSTRING(Leopard1A1A4_Name); + }; + class gm_Leopard1a1no_base : gm_Leopard1a1_base { + displayName = SUBCSTRING(Leopard1A1NO_Name); + shortDisplayName = SUBCSTRING(Leopard1A1NO_Name); + }; + + class gm_Leopard1a3_base : gm_Leopard1a0_base { + displayName = SUBCSTRING(Leopard1A3_Name); + shortDisplayName = SUBCSTRING(Leopard1A3_Name); + }; + class gm_Leopard1a3a1_base : gm_Leopard1a3_base { + displayName = SUBCSTRING(Leopard1A3A1_Name); + shortDisplayName = SUBCSTRING(Leopard1A3A1_Name); + }; + class gm_Leopard1a3a2_base : gm_Leopard1a3_base { + displayName = SUBCSTRING(Leopard1A3A2_Name); + shortDisplayName = SUBCSTRING(Leopard1A3A2_Name); + }; + class gm_Leopard1a3a3_base : gm_Leopard1a3_base { + displayName = SUBCSTRING(Leopard1A3A3_Name); + shortDisplayName = SUBCSTRING(Leopard1A3A3_Name); + }; + class gm_Leopard1a3dk_base : gm_Leopard1a3_base { + displayName = SUBCSTRING(Leopard1A3DK_Name); + shortDisplayName = SUBCSTRING(Leopard1A3DK_Name); + }; + + class gm_Leopard1a4_base : gm_Leopard1a3_base { + displayName = SUBCSTRING(Leopard1A4_Name); + shortDisplayName = SUBCSTRING(Leopard1A4_Name); + }; + class gm_Leopard1a4a1_base : gm_Leopard1a4_base { + displayName = SUBCSTRING(Leopard1A4A1_Name); + shortDisplayName = SUBCSTRING(Leopard1A4A1_Name); + }; + + class gm_Leopard1a5_base : gm_Leopard1a0_base { + displayName = SUBCSTRING(Leopard1A5_Name); + shortDisplayName = SUBCSTRING(Leopard1A5_Name); + }; + class gm_Leopard1a5a1_base : gm_Leopard1a5_base { + displayName = SUBCSTRING(Leopard1A5A1_Name); + shortDisplayName = SUBCSTRING(Leopard1A5A1_Name); + }; + class gm_Leopard1a5dk_base : gm_Leopard1a5_base { + displayName = SUBCSTRING(Leopard1A5DK_Name); + shortDisplayName = SUBCSTRING(Leopard1A5DK_Name); + }; + class gm_Leopard1a5dk1_base : gm_Leopard1a5_base { + displayName = SUBCSTRING(Leopard1A5DK1_Name); + shortDisplayName = SUBCSTRING(Leopard1A5DK1_Name); + }; + class gm_Leopard1a5no_base : gm_Leopard1a5_base { + displayName = SUBCSTRING(Leopard1A5NO_Name); + shortDisplayName = SUBCSTRING(Leopard1A5NO_Name); + }; + class gm_Leopard1a5no2_base : gm_Leopard1a5_base { + displayName = SUBCSTRING(Leopard1A5NO2_Name); + shortDisplayName = SUBCSTRING(Leopard1A5NO2_Name); + }; + + class gm_Gepard_base : gm_Leopard1_base { + displayName = SUBCSTRING(Gepard_Name); + shortDisplayName = SUBCSTRING(Gepard_Name); + }; + class gm_Gepard1a1_base : gm_Gepard_base { + displayName = SUBCSTRING(Gepard1A1_Name); + shortDisplayName = SUBCSTRING(Gepard1A1_Name); + }; + + class gm_biber_base : gm_Leopard1_base { + displayName = SUBCSTRING(Biber_Name); + shortDisplayName = SUBCSTRING(Biber_Name); + }; + + class gm_tracked_APC_base; + class gm_marder1_base : gm_tracked_APC_base { + displayName = SUBCSTRING(Marder1_Name); + shortDisplayName = SUBCSTRING(Marder1_Name); + }; + class gm_marder1a0_base : gm_marder1_base { + displayName = SUBCSTRING(Marder1A0_Name); + shortDisplayName = SUBCSTRING(Marder1A0_Name); + }; + class gm_marder1a1_base : gm_marder1a0_base { + displayName = SUBCSTRING(Marder1A1_Name); + shortDisplayName = SUBCSTRING(Marder1A1_Name); + }; + class gm_marder1a1a_base : gm_marder1a1_base { + displayName = SUBCSTRING(Marder1A1A_Name); + shortDisplayName = SUBCSTRING(Marder1A1A_Name); + }; + class gm_marder1a1minus_base : gm_marder1a1_base { + displayName = SUBCSTRING(Marder1A1Minus_Name); + shortDisplayName = SUBCSTRING(Marder1A1Minus_Name); + }; + class gm_marder1a1plus_base : gm_marder1a1_base { + displayName = SUBCSTRING(Marder1A1Plus_Name); + shortDisplayName = SUBCSTRING(Marder1A1Plus_Name); + }; + class gm_marder1a2_base : gm_marder1a1_base { + displayName = SUBCSTRING(Marder1A2_Name); + shortDisplayName = SUBCSTRING(Marder1A2_Name); + }; + + class gm_m113a1g_base; + class gm_m113a1g_apc_milan_base : gm_m113a1g_base { + displayName = SUBCSTRING(M113A1G_Milan_Name); + shortDisplayName = SUBCSTRING(M113A1G_Milan_Name); + }; + + class gm_wheeled_APC_base; + class gm_luchs_base : gm_wheeled_APC_base { + displayName = SUBCSTRING(Luchs_Name); + shortDisplayName = SUBCSTRING(Luchs_Name); + }; + class gm_luchsa1_base : gm_luchs_base { + displayName = SUBCSTRING(LuchsA1_Name); + shortDisplayName = SUBCSTRING(LuchsA1_Name); + }; + class gm_luchsa2_base : gm_luchs_base { + displayName = SUBCSTRING(LuchsA2_Name); + shortDisplayName = SUBCSTRING(LuchsA2_Name); + }; + + class gm_fuchs_base : gm_wheeled_APC_base { + displayName = SUBCSTRING(Fuchs_Name); + shortDisplayName = SUBCSTRING(Fuchs_Name); + }; + class gm_fuchsa0_base : gm_fuchs_base { + displayName = SUBCSTRING(Fuchs1A0_Name); + shortDisplayName = SUBCSTRING(Fuchs1A0_Name); + }; + class gm_fuchsa0_command_base : gm_fuchsa0_base { + displayName = SUBCSTRING(Fuchs1A0_Command_Name); + shortDisplayName = SUBCSTRING(Fuchs1A0_Name); + }; + class gm_fuchsa0_engineer_base : gm_fuchsa0_base { + displayName = SUBCSTRING(Fuchs1A0_Engineer_Name); + shortDisplayName = SUBCSTRING(Fuchs1A0_Name); + }; + class gm_fuchsa0_medic_base : gm_fuchsa0_base { + displayName = SUBCSTRING(Fuchs1A0_Medic_Name); + shortDisplayName = SUBCSTRING(Fuchs1A0_Name); + }; + class gm_fuchsa0_reconnaissance_base : gm_fuchsa0_base { + displayName = SUBCSTRING(Fuchs1A0_Reconnaissance_Name); + shortDisplayName = SUBCSTRING(Fuchs1A0_Milan_Name); + }; + class gm_fuchsa4_command_base : gm_fuchsa0_command_base { + displayName = SUBCSTRING(Fuchs1A4_Command_Name); + shortDisplayName = SUBCSTRING(Fuchs1A4_Name); + }; + class gm_fuchsa4_engineer_base : gm_fuchsa0_engineer_base { + displayName = SUBCSTRING(Fuchs1A4_Engineer_Name); + shortDisplayName = SUBCSTRING(Fuchs1A4_Name); + }; + class gm_fuchsa4_medic_base : gm_fuchsa0_medic_base { + displayName = SUBCSTRING(Fuchs1A4_Medic_Name); + shortDisplayName = SUBCSTRING(Fuchs1A4_Name); + }; + class gm_fuchsa4_reconnaissance_base : gm_fuchsa0_reconnaissance_base { + displayName = SUBCSTRING(Fuchs1A4_Reconnaissance_Name); + shortDisplayName = SUBCSTRING(Fuchs1A4_Milan_Name); + }; + + class gm_iltis_cargo_base; + class gm_ge_army_iltis_cargo_base : gm_iltis_cargo_base { + displayName = SUBCSTRING(Iltis_Name); + shortDisplayName = SUBCSTRING(Iltis_Name); + }; + class gm_iltis_milan_base; + class gm_ge_army_iltis_milan_base : gm_iltis_milan_base { + displayName = SUBCSTRING(Iltis_Milan_Name); + shortDisplayName = SUBCSTRING(Iltis_Milan_Name); + }; + class gm_iltis_mg3_base; + class gm_ge_army_iltis_mg3_base : gm_iltis_mg3_base { + displayName = SUBCSTRING(Iltis_MG3_Name); + shortDisplayName = SUBCSTRING(Iltis_MG3_Name); + }; + + // TODO: MAN Kat1 4x4/6x6/8x8 + + class gm_wheeled_car_base; + class gm_w123_base : gm_wheeled_car_base { + displayName = SUBCSTRING(W123_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_army_w123_cargo_base : gm_w123_base { + displayName = SUBCSTRING(W123_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_civ_w123_base : gm_w123_base { + displayName = SUBCSTRING(W123_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_taxi_w123 : gm_ge_civ_w123_base { + displayName = SUBCSTRING(W123_Taxi_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_pol_w123 : gm_ge_civ_w123_base { + displayName = SUBCSTRING(W123_Police_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_ff_w123 : gm_ge_civ_w123_base { + displayName = SUBCSTRING(W123_FF_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + class gm_ge_dbp_w123 : gm_ge_civ_w123_base { + displayName = SUBCSTRING(W123_DBP_Name); + shortDisplayName = SUBCSTRING(W123_Name); + }; + + class gm_typ1_base; + class gm_typ1200_base : gm_typ1_base { + displayName = SUBCSTRING(Typ1200_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + class gm_typ1200_patrol_base : gm_typ1200_base { + displayName = SUBCSTRING(Typ1200_Patrol_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + class gm_ge_army_typ1200_cargo_base : gm_typ1200_patrol_base { + displayName = SUBCSTRING(Typ1200_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + class gm_ge_ff_typ1200 : gm_typ1200_base { + displayName = SUBCSTRING(Typ1200_FF_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + class gm_ge_pol_typ1200 : gm_typ1200_base { + displayName = SUBCSTRING(Typ1200_Police_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + class gm_ge_dbp_typ1200 : gm_typ1200_base { + displayName = SUBCSTRING(Typ1200_DBP_Name); + shortDisplayName = SUBCSTRING(Typ1200_Name); + }; + + // TODO: Typ247/251/253 Volkswagen Type 2 (T3) + + class gm_wheeled_motorcycle_base; + class gm_k125_base : gm_wheeled_motorcycle_base { + displayName = SUBCSTRING(K125_Name); + shortDisplayName = SUBCSTRING(K125_Name); + }; + class gm_k125_bw_base : gm_k125_base {}; + class gm_ge_army_k125_base : gm_k125_bw_base { + displayName = SUBCSTRING(K125_Name); + shortDisplayName = SUBCSTRING(K125_Name); + }; + + class gm_staticATGM_base; + class gm_milan_launcher_tripod_base : gm_staticATGM_base { + displayName = SUBCSTRING(Milan_Tripod_Name); + shortDisplayName = SUBCSTRING(Milan_Name); + }; +}; diff --git a/addons/compatibility/global_mobilization/CfgWargay.hpp b/addons/compatibility/global_mobilization/CfgWargay.hpp new file mode 100644 index 0000000..9efdf35 --- /dev/null +++ b/addons/compatibility/global_mobilization/CfgWargay.hpp @@ -0,0 +1,807 @@ +class CfgWargay +{ + class Ammo + { + class NO_DAMAGE; + class SMALL_ARMS; + class HMG_AP; + class HMG_HE; + class Small_HE; + class AA_HE; + class Tank_HE; + class ace_frag_small; + + class gm_HandGrenade_frag_dm51a1 : ace_frag_small {}; + + /* + Western Germany + */ + // LARS-2 + class gm_rocket_mlrs_110mm_he_dm21 : HAS_PENETRATOR(gm_warhead_mlrs_110mm_he_dm21); + class gm_warhead_mlrs_110mm_he_dm21 + { + damage = 7; + type = "HE"; + }; + + class gm_rocket_mlrs_110mm_icm_dm602 : HAS_PENETRATOR(gm_penetrator_m77); + class gm_penetrator_m77 + { + damage = 6; + type = "HEAT"; + }; + + // M-109G + class gm_shell_155mm_he_dm21 : HAS_PENETRATOR(gm_warhead_155mm_he_dm21); + class gm_warhead_155mm_he_dm21 + { + damage = 7; + type = "HE"; + }; + + class gm_shell_155mm_icm_602 : HAS_PENETRATOR(gm_warhead_155mm_icm_602); + class gm_warhead_155mm_icm_602 + { + damage = 6; + type = "HEAT"; + }; + + // Flakpanzer Gepard 1A1 + class gm_bullet_35x228mm_hei_t_DM21 : AA_HE {}; + class gm_bullet_35x228mm_hvapds_t_DM23 : AA_HE {}; + + // Luchs & Marder 1 + class gm_bullet_20x139mm_hei_t_dm81 : HMG_HE {}; + class gm_bullet_20x139mm_apds_t_dm63 + { + damage = 2; + type = "AP"; + }; + + /* Leopard 1 family */ + class gm_shell_105x617mm_apds_t_dm13 + { + damage = 11; + type = "AP"; + }; + + class gm_shell_105x617mm_heat_mp_t_dm12 : HAS_PENETRATOR(gm_penetrator_105x617mm_heat_dm12); + class gm_penetrator_105x617mm_heat_dm12 + { + damage = 11; + type = "HEAT"; + }; + + class gm_shell_105x617mm_apfsds_t_dm23 : gm_shell_105x617mm_apds_t_dm13 {}; + + // Leopard 1A3/4 + class gm_shell_105x617mm_apfsds_t_dm33 + { + damage = 12; + type = "AP"; + }; + + // Leopard 1A5 + class gm_shell_105x617mm_apfsds_t_dm63 + { + damage = 16; + type = "AP"; + }; + + // Milan + class gm_missile_milan_heat_dm92 : HAS_PENETRATOR(gm_penetrator_milan_HEAT_dm92); + class gm_penetrator_milan_HEAT_dm82 + { + damage = 17; + type = "HEAT"; + }; + class gm_penetrator_milan_HEAT_dm92 : gm_penetrator_milan_HEAT_dm82 {}; + + // Hot 1 & 2 + class gm_missile_hot_heat_dm72 : HAS_PENETRATOR(gm_penetrator_hot_HEAT_dm72); + class gm_missile_hot_heat_dm102 : HAS_PENETRATOR(gm_penetrator_hot_HEAT_dm102); + class gm_penetrator_hot_HEAT_dm72 + { + damage = 22; + type = "HEAT"; + }; + class gm_penetrator_hot_HEAT_dm102 + { + damage = 25; + type = "HEAT"; + }; + + // PzF 44 + class gm_rocket_44x537mm_HEAT_dm32 : HAS_PENETRATOR(gm_penetrator_44x537mm_HEAT_dm32); + class gm_penetrator_44x537mm_HEAT_dm32 + { + damage = 16; + type = "HEAT"; + }; + + // PzF 3 + class gm_rocket_60mm_HEAT_dm12 : HAS_PENETRATOR(gm_penetrator_60mm_HEAT_dm12); + class gm_rocket_60mm_HEAT_dm22 : HAS_PENETRATOR(gm_penetrator_60mm_HEAT_dm22); + class gm_rocket_60mm_HEAT_dm32 : HAS_PENETRATOR(gm_penetrator_60mm_HEAT_dm32); + class gm_penetrator_60mm_HEAT_dm12 + { + damage = 24; + type = "HEAT"; + }; + class gm_penetrator_60mm_HEAT_dm22 : gm_penetrator_60mm_HEAT_dm12 + { + damage = 26; + }; + class gm_penetrator_60mm_HEAT_dm32 : gm_penetrator_60mm_HEAT_dm12 + { + damage = 28; + }; + + // PzF 84 (Carl Gustav M2) + class gm_rocket_84x245mm_HEAT_T_DM12 : HAS_PENETRATOR(gm_penetrator_84x245mm_HEAT_DM12); + class gm_rocket_84x245mm_HEAT_T_DM12A1 : HAS_PENETRATOR(gm_penetrator_84x245mm_HEAT_DM12A1); + class gm_rocket_84x245mm_HEAT_T_DM22 : HAS_PENETRATOR(gm_penetrator_84x245mm_HEAT_DM22); + class gm_rocket_84x245mm_HEAT_T_DM32 : HAS_PENETRATOR(gm_penetrator_84x245mm_HEAT_DM32); + + class gm_penetrator_84x245mm_HEAT_DM12 + { + damage = 18; + type = "HEAT"; + }; + class gm_penetrator_84x245mm_HEAT_DM12A1 : gm_penetrator_84x245mm_HEAT_DM12 {}; + class gm_penetrator_84x245mm_HEAT_DM22 : gm_penetrator_84x245mm_HEAT_DM12 + { + damage = 20; + }; + class gm_penetrator_84x245mm_HEAT_DM32 : gm_penetrator_84x245mm_HEAT_DM12 + { + damage = 22; + }; + + // M72A3 LAW + class gm_rocket_66mm_HEAT_m72a3 : HAS_PENETRATOR(gm_penetrator_66mm_HEAT_m72a3); + + class gm_penetrator_66mm_HEAT_m72a3 + { + damage = 13; + type = "HEAT"; + }; + + // FIM-43 (Redeye) + class gm_rocket_70mm_HE_m585 + { + damage = 3; + type = "HE"; + }; + + /* + Eastern Germany + */ + + /* PT-76B */ + class gm_shell_76x385mm_he_of350 : Small_HE {}; + class gm_shell_76x385mm_HVAP_T_br354p + { + damage = 10; + type = "AP"; + }; + class gm_shell_76x385mm_HEAT_T_bk350m + { + damage = 10; + type = "HEAT"; + }; + + /* T-55 family */ + class gm_shell_100x695mm_apfsds_t_bm8 + { + damage = 11; + type = "AP"; + }; + + class gm_shell_100x695mm_he_of412 : Tank_HE {}; + + // T-55A + class gm_shell_100x695mm_heat_t_bk5m : HAS_PENETRATOR(gm_penetrator_100x695mm_HEAT_T_bk5m); + class gm_penetrator_100x695mm_HEAT_T_bk5m + { + damage = 11; + type = "HEAT"; + }; + + class gm_shell_100x695mm_apfsds_t_bm20 + { + damage = 11; + type = "AP"; + }; + + // T-55AK/T-55AM2/T-55AM2B + class gm_shell_100x695mm_apfsds_t_bm25 + { + damage = 15; + type = "AP"; + }; + + // ZSU-23-4 + class gm_bullet_23x152mm_hei_t_ofzt : AA_HE {}; + class gm_bullet_23x152mm_api_t_bzt : gm_bullet_23x152mm_hei_t_ofzt {}; + + // SFL 2S1 + class gm_shell_122x447mm_he_of462 : HAS_PENETRATOR(gm_warhead_122x447mm_he_of462); + class gm_warhead_122x447mm_he_of462 + { + damage = 6; + type = "HE"; + }; + + class gm_shell_122x447mm_heat_t_bk13 : HAS_PENETRATOR(gm_penetrator_122x447mm_heat_t_bk13); + class gm_penetrator_122x447mm_heat_bk6m + { + damage = 9; + type = "HEAT"; + }; + class gm_penetrator_122x447mm_heat_t_bk13 : gm_penetrator_122x447mm_heat_bk6m {}; + + // BM-21 + class gm_rocket_mlrs_122mm_he_9m22u : HAS_PENETRATOR(gm_warhead_122mm_he_9m22u); + class gm_warhead_122mm_he_9m22u + { + damage = 7; + type = "HE"; + }; + + class gm_rocket_mlrs_122mm_icm_9m218 : HAS_PENETRATOR(gm_penetrator_3b30); + class gm_penetrator_3b30 + { + damage = 5; + type = "HEAT"; + }; + + // 2P16 + class gm_rocket_luna_he_3r9 + { + damage = 15; + type = "HE"; + }; + + // BMP-1 & SPG-9 + class gm_shell_73mm_heat_pg15v + { + damage = 12; + type = "HEAT"; + }; + class gm_shell_73mm_he_og15v : Small_HE {}; + + class gm_missile_maljutka_heat_9m14m : HAS_PENETRATOR(gm_penetrator_maljutka_HEAT_9m14m); + class gm_penetrator_maljutka_HEAT_9m14 + { + damage = 15; + type = "HEAT"; + }; + class gm_penetrator_maljutka_HEAT_9m14m : gm_penetrator_maljutka_HEAT_9m14 {}; + + // SPW-60PB + class gm_bullet_145x114mm_AP_B32 : HMG_AP {}; + class gm_bullet_145x114mm_HEI_T_MDZ : HMG_HE {}; + + // Fagot + class gm_missile_fagot_heat_9m111 : HAS_PENETRATOR(gm_penetrator_fagot_HEAT_9m111); + class gm_penetrator_fagot_HEAT_9m111 + { + damage = 16; + type = "HEAT"; + }; + + + class gm_rocket_40mm_HEAT_pg7v : HAS_PENETRATOR(gm_penetrator_40mm_HEAT_pg7v); + class gm_penetrator_40mm_HEAT_pg7v + { + damage = 14; + type = "HEAT"; + }; + + class gm_rocket_40mm_HEAT_pg7v1 : HAS_PENETRATOR(gm_penetrator_40mm_HEAT_pg7v1); + class gm_penetrator_40mm_HEAT_pg7v1 + { + damage = 17; + type = "HEAT"; + }; + + class gm_rocket_55mm_HE_s5 + { + damage = 1; + type = "HE"; + }; + + class gm_rocket_55mm_heat_s5k : HAS_PENETRATOR(gm_penetrator_55mm_heat_s5k); + class gm_penetrator_55mm_heat_s5k + { + damage = 2; + type = "HEAT"; + }; + + class gm_rocket_64mm_HEAT_pg18 : HAS_PENETRATOR(gm_penetrator_64mm_HEAT_pg18); + class gm_penetrator_64mm_HEAT_pg18 + { + damage = 15; + type = "HEAT"; + }; + + // Strela-2 + class gm_rocket_72mm_HE_9m32m : gm_rocket_70mm_HE_m585 {}; + + // DShKM + class gm_bullet_127x108mm_API_T_BZT : SMALL_ARMS {}; + }; + + class Vehicles + { + /* + West Germany + */ + + // LOG + class gm_ge_army_m113a1g_command + { + pointCost = 105; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + class gm_iltis_cargo_base + { + pointCost = 110; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = CV_ICON; + markerType = "b_cv"; + isCommandVehicle = 1; + }; + class gm_fuchsa0_command_base + { + pointCost = 120; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + + class gm_kat1_451_reammo_base + { + pointCost = 30; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = LOG_ICON; + markerType = "b_support"; + isLogistics = 1; + }; + VEHICLE_LIKE(gm_kat1_451_reammo_base,gm_kat1_451_refuel_base); + VEHICLE_LIKE(gm_kat1_451_reammo_base,gm_kat1_451_container_base); + class gm_kat1_452_container_base : gm_kat1_451_reammo_base + { + pointCost = 35; + }; + class gm_kat1_454_cargo_base : gm_kat1_451_reammo_base + { + pointCost = 40; + }; + class gm_u1300l_repair_base : gm_kat1_451_reammo_base + { + pointCost = 10; + hitpoints = 5; + }; + VEHICLE_LIKE(gm_u1300l_repair_base,gm_u1300l_container_base); + VEHICLE_LIKE(gm_u1300l_repair_base,gm_u1300l_medic_base); + + // TNK + class gm_Leopard1_base + { + pointCost = 30; + hitpoints = 10; + ARMOR(6,2,2,1); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + VEHICLE_LIKE(gm_Leopard1_base,gm_Leopard1a1_base); // 1A1 should be recon with 5/2/2/1 + + class gm_BPz2_base : gm_Leopard1_base + { + pointCost = 40; + iconPath = LOG_ARMOR_ICON; + markerType = "b_support"; + isLogistics = 1; + }; + class gm_Leopard1a3_base + { + pointCost = 40; + hitpoints = 10; + ARMOR(8,3,2,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + class gm_leopard1a5_base + { + pointCost = 65; + hitpoints = 10; + ARMOR(10,3,2,2); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + + // SUP + class gm_Gepard1a1_base + { + pointCost = 55; + hitpoints = 10; + ARMOR(3,2,2,1); + iconPath = ANTIAIR_SPAAG_RADAR_ICON; + markerType = "b_antiair_spaag_radar"; + }; + class gm_m109g_base + { + pointCost = 50; + hitpoints = 10; + ARMOR(2,1,1,1); + iconPath = ART_ICON; + markerType = "b_art"; + }; + class gm_kat1_463_mlrs_base + { + pointCost = 70; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = ART_ROCKET_ICON; + markerType = "b_art_rocket"; + }; + + // VEH + class gm_iltis_base + { + pointCost = 5; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_iltis_milan_base : gm_iltis_base + { + pointCost = 20; + iconPath = ANTITANK_ICON; + markerType = "b_antitank"; + }; + class gm_kat1_base + { + pointCost = 5; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_u1300l_base : gm_kat1_base + { + hitpoints = 5; + }; + + class gm_marder1_base + { + pointCost = 15; + hitpoints = 10; + ARMOR(4,2,1,1); + iconPath = MECH_INF_ARMED_ICON; + markerType = "b_mech_inf_armed"; + }; + class gm_marder1a1plus_base : gm_marder1_base + { + pointCost = 15; + ARMOR(4,2,2,1); + }; + class gm_marder1a2_base : gm_marder1_base + { + pointCost = 20; + ARMOR(5,3,2,2); + }; + class gm_m113_base + { + pointCost = 5; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = MECH_INF_ICON; + markerType = "b_mech_inf"; + }; + class gm_m113a1g_apc_milan_base : gm_m113_base + { + pointCost = 20; + iconPath = ANTITANK_ARMOR_ICON; + markerType = "b_antitank_armor"; + }; + class gm_m113a1g_medic_base : gm_m113_base + { + pointCost = 15; + iconPath = LOG_ARMOR_ICON; + markerType = "b_med"; + isLogistics = 1; + }; + class gm_fuchs_base : gm_m113_base + { + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_fuchsa0_engineer_base : gm_fuchs_base + { + pointCost = 20; + iconPath = LOG_ARMOR_ICON; + markerType = "b_support"; + isLogistics = 1; + }; + + // REC + class gm_iltis_mg3_base : gm_iltis_base + { + pointCost = 25; + iconPath = RECON_ICON; + markerType = "b_recon"; + isRecon = 1; + }; + class gm_luchs_base + { + pointCost = 25; + hitpoints = 10; + ARMOR(2,1,1,1); + iconPath = RECON_ARMOR_ICON; + markerType = "b_recon_armor"; + isRecon = 1; + }; + class gm_fuchsa0_reconnaissance_base : gm_luchs_base + { + pointCost = 10; + ARMOR(1,1,1,1); + iconPath = RECON_ANTITANK_ICON; + markerType = "b_recon_antitank"; + }; + class gm_bo105m_base + { + pointCost = 45; + hitpoints = 10; // Should be 4 according to Wargay + ARMOR(0,0,0,0); + iconPath = RECON_AIR_ICON; + markerType = "b_recon_air"; + isRecon = 1; + }; + + // HEL + class gm_bo105p_base + { + pointCost = 50; + hitpoints = 10; // Should be 4 according to Wargay + ARMOR(0,0,0,0); + iconPath = HELI_ICON; + markerType = "b_air"; + }; + class gm_bo105p_pah1a1_base : gm_bo105p_base + { + pointCost = 60; + }; + class gm_ch53_base + { + pointCost = 20; + hitpoints = 10; + ARMOR(0,0,0,0); + iconPath = HELI_ICON; // TODO: Consider Heli cargo vs heli attack icon + markerType = "b_air"; + }; + + /* + East Germany + */ + + // LOG + class gm_uaz469_cargo_base + { + pointCost = 100; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = CV_ICON; + markerType = "b_cv"; + isCommandVehicle = 1; + }; + class gm_btr60pu12_base + { + pointCost = 110; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + class gm_brdm2um_base + { + pointCost = 120; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + class gm_t55ak_base + { + pointCost = 120; + hitpoints = 10; + ARMOR(7,3,2,1); + iconPath = CV_ARMOR_ICON; + markerType = "b_cv_armor"; + isCommandVehicle = 1; + }; + class gm_ural4320_repair_base + { + pointCost = 20; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = LOG_ICON; + markerType = "b_support"; + isLogistics = 1; + }; + VEHICLE_LIKE(gm_ural4320_repair_base,gm_ural4320_reammo_base); + class gm_ural375d_refuel_base : gm_ural4320_repair_base + { + pointCost = 15; + }; + VEHICLE_LIKE(gm_ural375d_refuel_base,gm_ural375d_medic_base); + + // SUP + class gm_zsu234_base + { + pointCost = 35; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ANTIAIR_SPAAG_RADAR_ICON; + markerType = "b_antiair_spaag_radar"; + }; + class gm_2s1_base + { + pointCost = 55; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ART_ICON; + markerType = "b_art"; + }; + class gm_2p16_base + { + pointCost = 130; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = ART_ROCKET_ICON; + markerType = "b_art_rocket"; + }; + class gm_ural375d_mlrs_base + { + pointCost = 65; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = ART_ROCKET_ICON; + markerType = "b_art_rocket"; + }; + + // TNK + class gm_t55_base + { + pointCost = 25; + hitpoints = 10; + ARMOR(7,3,2,1); + iconPath = ARMOR_ICON; + markerType = "b_armor"; + }; + VEHICLE_LIKE(gm_t55_base,gm_t55a_base); + class gm_t55am2_base : gm_t55_base + { + pointCost = 50; + ARMOR(10,4,2,2); + }; + class gm_t55am2b_base + { + pointCost = 55; + ARMOR(10,5,2,2); + }; + + // VEH + class gm_ural4320_base + { + pointCost = 5; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_uaz469_base + { + pointCost = 5; + hitpoints = 5; + ARMOR(0,0,0,0); + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_uaz469_spg9_base : gm_uaz469_base + { + pointCost = 10; + iconPath = ANTITANK_ICON; + markerType = "b_antitank"; + }; + class gm_bmp1_base + { + pointCost = 10; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = MECH_INF_ARMED_ICON; + markerType = "b_mech_inf_armed"; + }; + class gm_btr60_base + { + pointCost = 10; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = MOTOR_INF_ICON; + markerType = "b_motor_inf"; + }; + class gm_btr60pb_base : gm_btr60_base + { + pointCost = 15; + iconPath = MECH_INF_ARMED_ICON;// TODO: Consider MOTOR_INF_ARMED_ICON; + markerType = "b_mech_inf_armed"; + }; + + // SKOT-2A https://wargame.fandom.com/wiki/SKOT-2A + class gm_ot64_base : gm_btr60_base {}; + + // REC + class gm_pt76_base + { + pointCost = 15; + hitpoints = 10; + ARMOR(2,1,1,1); + iconPath = RECON_ARMOR_ICON; + markerType = "b_recon_armor"; + isRecon = 1; + }; + class gm_brdm2_base + { + pointCost = 15; + hitpoints = 10; + ARMOR(1,1,1,1); + iconPath = RECON_ARMOR_ICON; + markerType = "b_recon_armor"; + isRecon = 1; + }; + class gm_mi2p_base + { + pointCost = 40; + hitpoints = 10; // Should be 4 according to Wargay + ARMOR(0,0,0,0); + iconPath = RECON_AIR_ICON; + markerType = "b_recon_air"; + isRecon = 1; + }; + + // HEL + class gm_mi2_base + { + pointCost = 10; + hitpoints = 10; // Should be 4 according to Wargay + ARMOR(0,0,0,0); + iconPath = HELI_ICON; + markerType = "b_air"; + }; + class gm_mi2t_base : gm_mi2_base + { + pointCost = 15; + }; + class gm_mi2us_base : gm_mi2_base + { + pointCost = 20; + }; + class gm_mi2urn_base : gm_mi2_base + { + pointCost = 30; + }; + }; +}; diff --git a/addons/compatibility/global_mobilization/README.md b/addons/compatibility/global_mobilization/README.md new file mode 100644 index 0000000..3fbd519 --- /dev/null +++ b/addons/compatibility/global_mobilization/README.md @@ -0,0 +1,7 @@ +# Global Mobilization + +Compatibility addon for [Arma 3 Creator DLC: Global Mobilization - Cold War Germany](https://store.steampowered.com/app/1042220/Arma_3_Creator_DLC_Global_Mobilization__Cold_War_Germany/). + +## Notes + +A lot of West German and East German classes are covered. Pay attention to warnings and incorrect unit stats (like basic cost or no armor for a tank). Feel free to contribute. diff --git a/addons/compatibility/global_mobilization/config.cpp b/addons/compatibility/global_mobilization/config.cpp new file mode 100644 index 0000000..f458d8b --- /dev/null +++ b/addons/compatibility/global_mobilization/config.cpp @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "gm_core", + "afwg_compatibility" + }; + skipWhenMissingDependencies = 1; + author = "ArmaForces"; + authors[] = {"veteran29", "3Mydlo3"}; + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgVehicles.hpp" +#include "CfgWargay.hpp" diff --git a/addons/compatibility/global_mobilization/script_component.hpp b/addons/compatibility/global_mobilization/script_component.hpp new file mode 100644 index 0000000..b76a337 --- /dev/null +++ b/addons/compatibility/global_mobilization/script_component.hpp @@ -0,0 +1,2 @@ +#define SUBCOMPONENT global_mobilization +#include "..\script_component.hpp" diff --git a/addons/compatibility/global_mobilization/stringtable.xml b/addons/compatibility/global_mobilization/stringtable.xml new file mode 100644 index 0000000..884fc99 --- /dev/null +++ b/addons/compatibility/global_mobilization/stringtable.xml @@ -0,0 +1,296 @@ + + + + + BrPz 1 Biber + BrPz 1 Biber + + + Bo 105M/VBH-1A1 + Bo 105M/VBH-1A1 + + + Bo 105M/VBH-1A1 Swooper + Bo 105M/VBH-1A1 Swooper + + + Bo 105M/VBH-1 (ADAK) + + + Bo 105M/VBH-1 + Bo 105M/VBH-1 + + + Bo 105M/VBH-1 (Police) + Bo 105M/VBH-1 (Policja) + Bo 105M/VBH-1 (Polizei) + + + Bo 105P/PAH-1A1 + Bo 105P/PAH-1A1 + + + Bo 105P/PAH-1 + Bo 105P/PAH-1 + + + TPz Fuchs 1A0 Command + TPz Fuchs 1A0 Dowodzenia + + + TPz Fuchs 1A0 Engineer + TPz Fuchs 1A0 Inżynieryjny + + + TPz Fuchs 1A0 Medical + TPz Fuchs 1A0 Medyczny + + + TPz Fuchs 1A0 (Milan) + TPz Fuchs 1A0 (Milan) + + + TPz Fuchs 1A0 + TPz Fuchs 1A0 + + + TPz Fuchs 1A0 Recon (Milan) + TPz Fuchs 1A0 Zwiadowczy (Milan) + + + TPz Fuchs 1A4 Command + TPz Fuchs 1A4 Dowodzenia + + + TPz Fuchs 1A4 Engineer + TPz Fuchs 1A4 Inżynieryjny + + + TPz Fuchs 1A4 Medical + TPz Fuchs 1A4 Medyczny + + + TPz Fuchs 1A4 (Milan) + TPz Fuchs 1A4 (Milan) + + + TPz Fuchs 1A4 + TPz Fuchs 1A4 + + + TPz Fuchs 1A4 Recon (Milan) + TPz Fuchs 1A4 Zwiadowczy (Milan) + + + TPz Fuchs + TPz Fuchs + + + Flakpanzer Gepard 1A1 + Flakpanzer Gepard 1A1 + + + Flakpanzer Gepard + Flakpanzer Gepard + + + Iltis (MG3) + Iltis (MG3) + + + Iltis (Milan) + Iltis (Milan) + + + Iltis + Iltis + + + Hercules K 125 BW + Hercules K 125 BW + + + Leopard 1A0 + Leopard 1A0 + + + Leopard 1A1A1 + Leopard 1A1A1 + + + Leopard 1A1A2 + Leopard 1A1A2 + + + Leopard 1A1A3 + Leopard 1A1A3 + + + Leopard 1A1A4 + Leopard 1A1A4 + + + Leopard 1A1NO + Leopard 1A1NO + + + Leopard 1A1 + Leopard 1A1 + + + Leopard 1A3A1 + Leopard 1A3A1 + + + Leopard 1A3A2 + Leopard 1A3A2 + + + Leopard 1A3A3 + Leopard 1A3A3 + + + Leopard 1A3DK + Leopard 1A3DK + + + Leopard 1A3 + Leopard 1A3 + + + Leopard 1A4A1 + Leopard 1A4A1 + + + Leopard 1A4 + Leopard 1A4 + + + Leopard 1A5A1 + Leopard 1A5A1 + + + Leopard 1A5DK1 + Leopard 1A5DK1 + + + Leopard 1A5DK + Leopard 1A5DK + + + Leopard 1A5NO2 + Leopard 1A5NO2 + + + Leopard 1A5NO + Leopard 1A5NO + + + Leopard 1A5 + Leopard 1A5 + + + Leopard 1 + Leopard 1 + + + SpPz Luchs A1 + SpPz Luchs A1 + + + SpPz Luchs A2 + SpPz Luchs A2 + + + SpPz Luchs + SpPz Luchs + + + M113A1G (Milan) + M113A1G (Milan) + + + Marder 1A0 + Marder 1A0 + + + Marder 1A1A + Marder 1A1A + + + Marder 1A1- + Marder 1A1- + + + Marder 1A1+ + Marder 1A1+ + + + Marder 1A1 + Marder 1A1 + + + Marder 1A2 + Marder 1A2 + + + Marder 1 + Marder 1 + + + Milan + Milan + + + Milan - Tripod + Milan - Trójnóg + + + Volkswagen Beetle 1200 (Post) + Volkswagen Garbus 1200 (Poczta) + VW Käfer 1200 (Post) + + + Volkswagen Beetle 1200 (Firefighters) + Volkswagen Garbus 1200 (Straż Pożarna) + VW Käfer 1200 (Feuerwehr) + + + Volkswagen Beetle 1200 + Volkswagen Garbus 1200 + VW Käfer 1200 + + + Volkswagen Beetle 1200 (Patrol) + Volkswagen Garbus 1200 (Patrol) + VW Käfer 1200 (Patrouille) + + + Volkswagen Beetle 1200 (Police) + Volkswagen Garbus 1200 (Policja) + VW Käfer 1200 (Polizei) + + + Mercedes-Benz W123 (Post) + Mercedes-Benz W123 (Poczta) + + + Mercedes-Benz W123 (Firefighters) + Mercedes-Benz W123 (Straż Pożarna) + Mercedes-Benz W123 (Feuerwehr) + + + Mercedes-Benz W123 + Mercedes-Benz W123 + + + Mercedes-Benz W123 (Police) + Mercedes-Benz W123 (Policja) + Mercedes-Benz W123 (Polizei) + + + Mercedes-Benz W123 (Taxi) + Mercedes-Benz W123 (Taxi) + + + diff --git a/addons/compatibility/script_component.hpp b/addons/compatibility/script_component.hpp new file mode 100644 index 0000000..df4f976 --- /dev/null +++ b/addons/compatibility/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT compatibility +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_COMPATIBILITY + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_COMPATIBILITY + #define DEBUG_SETTINGS DEBUG_SETTINGS_COMPATIBILITY +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" +#include "\z\afwg\addons\compatibility\script_macros.hpp" diff --git a/addons/compatibility/script_macros.hpp b/addons/compatibility/script_macros.hpp new file mode 100644 index 0000000..cab003f --- /dev/null +++ b/addons/compatibility/script_macros.hpp @@ -0,0 +1,33 @@ +// Macros used for CfgWargay.hpp to avoid duplication and improve consistency + +#define ARMOR(FRONT,SIDES,BACK,TOP) armor[] = { FRONT, SIDES, BACK, TOP } +#define VEHICLE_LIKE(otherVehicleClass,vehicleClass) class vehicleClass : otherVehicleClass {} +#define HAS_PENETRATOR(penetratorClass) NO_DAMAGE \ + { \ + child = QUOTE(penetratorClass);\ + } + +// Icon macros +#define ARMA_NATO_MARKERS_DIR \A3\ui_f\data\map\markers\nato +#define WARGAY_NATO_MARKERS_DIR PATHTOEF(markers,assets) +#define ANTIAIR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_antiair.paa) +#define ANTIAIR_SPAAG_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antiair_spaag.paa) +#define ANTIAIR_SPAAG_RADAR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antiair_spaag_radar.paa) +#define ANTITANK_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antitank.paa) +#define ANTITANK_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_antitank_armor.paa) +#define ART_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_art.paa) +#define ART_ROCKET_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_art_rocket.paa) +#define ARMOR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_armor.paa) +#define CV_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_cv_armor.paa) +#define CV_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_cv.paa) +#define HELI_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_air.paa) +#define LOG_ARMOR_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_support.paa) +#define LOG_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_support.paa) +#define MECH_INF_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_mech_inf.paa) +#define MECH_INF_ARMED_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_mech_inf_armed.paa) +#define MOTOR_INF_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_motor_inf.paa) +#define PLANE_ICON QUOTE(ARMA_NATO_MARKERS_DIR\b_air.paa) +#define RECON_AIR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_air.paa) +#define RECON_ANTITANK_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_antitank.paa) +#define RECON_ARMOR_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon_armor.paa) +#define RECON_ICON QUOTE(WARGAY_NATO_MARKERS_DIR\b_recon.paa) diff --git a/addons/damage/$PBOPREFIX$ b/addons/damage/$PBOPREFIX$ new file mode 100644 index 0000000..2f072d2 --- /dev/null +++ b/addons/damage/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\damage \ No newline at end of file diff --git a/addons/damage/CfgEventHandlers.hpp b/addons/damage/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/damage/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/damage/XEH_PREP.hpp b/addons/damage/XEH_PREP.hpp new file mode 100644 index 0000000..2eba20f --- /dev/null +++ b/addons/damage/XEH_PREP.hpp @@ -0,0 +1,6 @@ +PREP(applyDamage); +PREP(calculateAndApplyDamage); +PREP(getHitDir); +PREP(heatDamage); +PREP(heDamage); +PREP(keDamage); diff --git a/addons/damage/XEH_postInit.sqf b/addons/damage/XEH_postInit.sqf new file mode 100644 index 0000000..724d5c7 --- /dev/null +++ b/addons/damage/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; diff --git a/addons/damage/XEH_postInitServer.sqf b/addons/damage/XEH_postInitServer.sqf new file mode 100644 index 0000000..48480ec --- /dev/null +++ b/addons/damage/XEH_postInitServer.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["MDL_applyDamage", FUNC(applyDamage)] call CBA_fnc_addEventHandler; diff --git a/addons/damage/XEH_preInit.sqf b/addons/damage/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/damage/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/damage/XEH_preStart.sqf b/addons/damage/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/damage/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/damage/config.cpp b/addons/damage/config.cpp new file mode 100644 index 0000000..2949b60 --- /dev/null +++ b/addons/damage/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/damage/functions/fnc_applyDamage.sqf b/addons/damage/functions/fnc_applyDamage.sqf new file mode 100644 index 0000000..2adb3a4 --- /dev/null +++ b/addons/damage/functions/fnc_applyDamage.sqf @@ -0,0 +1,58 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Applies damage to unit + * + * Arguments: + * 0: Unit to damage + * 1: Damage amount + * 2: Unit shooting + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit", "_damage", "_shooter"]; + +private _currentHp = _unit getVariable ["MDL_currentHp", 10]; +private _newHp = _currentHp - _damage; + +// Check if this is a kill +if (_newHp <= 0) exitWith { + // Add experience for players first + if (isPlayer _shooter) then { + if ([side _shooter, side _unit] call BIS_fnc_sideIsEnemy) then { + [_shooter, _unit] call EFUNC(stats,addExperienceForKill); + } else { + // TODO: Handle friendly-fire + // TODO: Consider removing XP for damaging friendly units too + }; + }; + + if (_unit getVariable ["MDL_deployedVehicle", false]) then { + ["MDL_unitLost", [_unit]] call CBA_fnc_globalEvent; + }; + + _unit setVariable ["MDL_currentHp", 0, true]; + ["MDL_showCurrentHp", [_unit], crew _unit] call CBA_fnc_targetEvent; + {_x setDamage 1} forEach crew _unit; + _unit setDamage 1; + _unit setVariable ["MDL_IsVisible", false, true]; +}; + +#ifdef DEV_DEBUG +systemChat format ["Remaining HP: %1/10", _newHp]; +#endif + +private _maxHp = _unit getVariable ["MDL_maxHp", MAX_HP]; +_unit setVariable ["MDL_currentHp", _newHp, true]; +// Limit to 0.8 to avoid explosions when hull or fuel are almost destroyed +_unit setDamage (((1 - _newHp)/_maxHp) min 0.8); +["MDL_showCurrentHp", [_unit], crew _unit] call CBA_fnc_targetEvent; + +if (isPlayer _unit) then { + // Need to publicize it as this function runs on server + _unit setVariable ["MDL_lastCombatActive", CBA_missionTime, true]; +}; diff --git a/addons/damage/functions/fnc_calculateAndApplyDamage.sqf b/addons/damage/functions/fnc_calculateAndApplyDamage.sqf new file mode 100644 index 0000000..9c21583 --- /dev/null +++ b/addons/damage/functions/fnc_calculateAndApplyDamage.sqf @@ -0,0 +1,93 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles damage calculation and applying using HitPart EH data. + * + * Arguments: + * 0: Targeted object + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit", "_shooter", "_hitDir", "_hitPositionAGL", "_velocity", "_projectile", "_ammo"]; +_ammo params ["_hitValue", "_indirectHitValue", "_indirectHitRange", "_explosiveDamage", "_ammoClassName"]; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG CALCULATE DAMAGE [%1]: %2", diag_tickTime, str _this]; +#endif + +private _unitType = VehicleTypes getOrDefault [toUpper typeOf _unit, []]; +private _unitArmor = if (_unitType isEqualTo []) then { NO_ARMOR } else { + _unitType getOrDefault ["armor", NO_ARMOR] +}; + +private _armor = switch (_hitDir) do { + case "FRONT": { _unitArmor select 0 }; + case "SIDE": { _unitArmor select 1 }; + case "REAR": { _unitArmor select 2 }; + case "TOP": { _unitArmor select 3 }; + default { 0 }; +}; + +private _ammoInfo = AmmoTypes getOrDefault [toUpper _ammoClassName, []]; +if (_ammoInfo isEqualTo []) then { + // Try to recover for small arms as I was lazy and didn't want to copy all the ammo classes + private _isSmallArms = getNumber (configFile >> "CfgAmmo" >> _ammoClassName >> "caliber") < 1; + if (_isSmallArms) then { + private _hashMap = AmmoTypes get "SMALL_ARMS"; + AmmoTypes set [toUpper _ammoClassName, _hashMap]; + _ammoInfo = _hashMap; + }; +}; +if (_ammoInfo isEqualTo []) exitWith { + private _infoMsg = format ["Unknown ammunition '%1' used, ignoring calculations",_ammoClassName]; + systemChat _infoMsg; + WARNING(_infoMsg); +}; + +private _ammoDamage = _ammoInfo getOrDefault ["damage", 0]; +if (_ammoDamage isEqualTo 0) exitWith {}; + +private _isUnknownAmmoType = false; +private _ammoType = _ammoInfo getOrDefault ["type", "NONE"]; +private _damage = switch (_ammoType) do { + case "AP": { + private _initialVelocity = _projectile getVariable ["MDL_initialVelocity", [0, 0, 0]]; + [_armor, _ammoDamage, _velocity, _initialVelocity] call FUNC(keDamage) + }; + case "HEAT": { + // Ignore no velocity HEAT as this is most likely some splash and we don't want that + if (_velocity isEqualTo [0, 0, 0]) exitWith {}; + [_armor, _ammoDamage] call FUNC(heatDamage) + }; + case "HE" : { + private _distanceToTarget = if (_hitPositionAGL isEqualTo []) then { 0 } else { getPosATL _unit distance _hitPositionAGL }; + [_armor, _ammoDamage, _distanceToTarget] call FUNC(heDamage) + }; + default { _isUnknownAmmoType = true; 0 }; +}; + +if (_isUnknownAmmoType) exitWith { + private _infoMsg = format ["Unknown ammunition '%1' used, ignoring calculations",_ammoClassName]; + systemChat _infoMsg; + WARNING(_infoMsg); +}; + +if (GVAR(showDamageFeedback)) then { + private _infoMsg = format ["Potential damage: %1 %2, Hit armor: %3 %4, Actual damage: %5", _ammoDamage, _ammoType, _hitDir, _armor, _damage]; + systemChat _infoMsg; + LOG(_infoMsg); +}; + +#ifdef DEV_DEBUG +private _infoMsg = format ["Potential damage: %1 %2, Hit armor: %3 %4, Actual damage: %5", _ammoDamage, _ammoType, _hitDir, _armor, _damage]; +systemChat _infoMsg; +diag_log _infoMsg; +#endif + +if (_damage isEqualTo 0) exitWith {}; + +["MDL_applyDamage", [_unit, _damage, _shooter]] call CBA_fnc_serverEvent; diff --git a/addons/damage/functions/fnc_getHitDir.sqf b/addons/damage/functions/fnc_getHitDir.sqf new file mode 100644 index 0000000..4896bba --- /dev/null +++ b/addons/damage/functions/fnc_getHitDir.sqf @@ -0,0 +1,57 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Returns direction [FRONT/SIDE/REAR/TOP] of the armor that was hit. + * + * Arguments: + * 0: Target hit + * 1: Vector prependicular to surface hit + * 2: Velocity vector of a projectile + * 3: Projectile + * + * Return Value: + * Hit direction one of: FRONT/SIDE/REAR/TOP + * + * Public: No + */ + +params ["_target", "_surfaceVector", "_velocity", "_projectile"]; + +private _hitDirVectorNormalized = if (_velocity isEqualTo [0, 0, 0]) then { + #ifdef DEV_DEBUG + HitpointHits pushBack getPosATL _projectile; + #endif + getPosATL _target vectorDiff getPosATL _projectile vectorMultiply -1 +} else { + vectorNormalized _surfaceVector +}; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG GET HIT DIR [%1]: Target position: %2 Projectile position: %3", diag_tickTime, getPosATL _target, getPosATL _projectile]; +SurfaceVectors pushBack [getPosASL _target vectorAdd [0, 0, 1], getPosATL _target vectorDiff getPosATL _projectile vectorMultiply -1]; +ProjectileRelPosVectors pushBack [getPosATL _target vectorAdd [0, 0, 1], _hitDirVectorNormalized]; + +diag_log format ["WARGAY DEBUG GET HIT DIR [%1]: Target: %2, Vector: %3, Velocity: %4, HitVector: %5", diag_tickTime, _target, _surfaceVector, _velocity, _hitDirVectorNormalized]; +#endif + +private _targetDir = vectorDir _target; +#ifdef DEV_DEBUG +TargetDirVectors pushBack [getPosATL _target vectorAdd [0, 0, 1], _targetDir]; +#endif + +private _dotProduct = _targetDir vectorDotProduct _hitDirVectorNormalized; +private _topHitDir = _surfaceVector#2 atan2 sqrt (_surfaceVector#0^2 + _surfaceVector#1^2); + +private _hitDir = if (_topHitDir > 70) then { + "TOP" +} else { + if (_dotProduct > 0.5) exitWith { "FRONT" }; + if (_dotProduct < -0.5) exitWith { "REAR" }; + "SIDE" +}; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG GET HIT DIR [%1]: Target Dir: %2, Dot product: %3, Top='%4'", diag_tickTime, _targetDir, _dotProduct, _topHitDir]; +#endif + +_hitDir diff --git a/addons/damage/functions/fnc_heDamage.sqf b/addons/damage/functions/fnc_heDamage.sqf new file mode 100644 index 0000000..7f7b8e4 --- /dev/null +++ b/addons/damage/functions/fnc_heDamage.sqf @@ -0,0 +1,39 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Calculates HE damage. + * + * Arguments: + * 0: Armor value + * 1: Ammo base damage + * 2: Distance to target + * + * Return Value: + * Damage + * + * Public: No + */ + +params ["_armor", "_ammoBaseDamage", "_distanceToTarget"]; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG HE DAMAGE [%1]: %2 AV, %3 HE, %4 m to target", diag_tickTime, _armor, _ammoBaseDamage, _distanceToTarget]; +#endif + +fnc_damagePerHe = { + params ["_armor"]; + + if (_armor < 2) exitWith {1}; + if (_armor isEqualTo 2) exitWith {0.4}; + if (_armor isEqualTo 3) exitWith {0.3}; + if (_armor isEqualTo 4) exitWith {0.2}; + if (_armor isEqualTo 5) exitWith {0.15}; + if (_armor < 8) exitWith {0.1}; + if (_armor < 14) exitWith {0.05}; + 0.01 +}; + +private _damage = _ammoBaseDamage * ([_armor] call fnc_damagePerHe); +private _maxDistanceToTarget = _ammoBaseDamage^2 + 1; +private _calculatedDamage = _damage * ((_maxDistanceToTarget - _distanceToTarget)/_maxDistanceToTarget); +0 max _calculatedDamage diff --git a/addons/damage/functions/fnc_heatDamage.sqf b/addons/damage/functions/fnc_heatDamage.sqf new file mode 100644 index 0000000..5f657b4 --- /dev/null +++ b/addons/damage/functions/fnc_heatDamage.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Calculates damage of a HEAT projectile based on armor and ammo base damage. + * HEAT always does at least 1 dmg. + * + * Arguments: + * 0: Armor value + * 1: Ammo base damage + * + * Return Value: + * Damage + * + * Public: No + */ + +params ["_armor", "_ammoBaseDamage"]; + +if (_armor isEqualTo 0) exitWith { _ammoBaseDamage * 2 }; +private _standardDamage = ((_ammoBaseDamage - _armor)/2) + 1; + +// 1 dmg for each 1 AP above 10 difference from armor value (e.g., 13 AP vs 2 AV = 1 dmg) +private _extraDamage = 0 max (_ammoBaseDamage - _armor - 10); + +// HEAT always does at least 1 dmg +1 max (_standardDamage + _extraDamage) diff --git a/addons/damage/functions/fnc_keDamage.sqf b/addons/damage/functions/fnc_keDamage.sqf new file mode 100644 index 0000000..c14bc27 --- /dev/null +++ b/addons/damage/functions/fnc_keDamage.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Wargame Red Dragon KE formula reverse engineered. + * Not using distance as velocity seems to fit better. + * + * Arguments: + * 0: Armor value + * 1: Ammo base damage + * 2: Projectile velocity + * 3: Projectile initial velocity + * + * Return Value: + * Damage + * + * Public: No + */ + +#define VELOCITY_STEP 125 + +params ["_armor", "_ammoBaseDamage", "_velocity", "_initialVelocity"]; + +if (_ammoBaseDamage isEqualTo 0.1) exitWith { + [0, _ammoBaseDamage] select (_armor isEqualTo 0) +}; + +private _damageFromVelocity = _ammoBaseDamage - ((vectorMagnitude _initialVelocity - vectorMagnitude _velocity) / VELOCITY_STEP); +if (_armor isEqualTo 0) exitWith { 2 * (_ammoBaseDamage max _damageFromVelocity) }; +if (_armor isEqualTo 1) exitWith { (_ammoBaseDamage max _damageFromVelocity) }; +if (_damageFromVelocity < 0) exitWith { 0 }; + +// Half for 2 armor, decreasing .5 for every additional armor point +_damageFromVelocity - (_damageFromVelocity/2) - (_armor - 2) * 0.5 diff --git a/addons/damage/functions/script_component.hpp b/addons/damage/functions/script_component.hpp new file mode 100644 index 0000000..0e7955a --- /dev/null +++ b/addons/damage/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\damage\script_component.hpp" diff --git a/addons/damage/initSettings.inc.sqf b/addons/damage/initSettings.inc.sqf new file mode 100644 index 0000000..cdbe300 --- /dev/null +++ b/addons/damage/initSettings.inc.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(showDamageFeedback), + "CHECKBOX", + [LSTRING(ShowDamageFeedback), LSTRING(ShowDamageFeedback_Description)], + [LSTRING(DisplayName)], + true, + false +] call CBA_fnc_addSetting; diff --git a/addons/damage/script_component.hpp b/addons/damage/script_component.hpp new file mode 100644 index 0000000..5d00009 --- /dev/null +++ b/addons/damage/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT damage +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_DAMAGE + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_DAMAGE + #define DEBUG_SETTINGS DEBUG_SETTINGS_DAMAGE +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/damage/stringtable.xml b/addons/damage/stringtable.xml new file mode 100644 index 0000000..a1be29e --- /dev/null +++ b/addons/damage/stringtable.xml @@ -0,0 +1,25 @@ + + + + + ArmaForces Wargame - Damage + ArmaForces Wargame - Damage + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Show Damage Feedback + Informacja zwrotna o obrażeniach + + + Adds feedback message with dealt damage information - potential damage, armor hit and actual damage. + Dodaje informację zwrotną o zadanych obrażeniach - obrażenia potencjalne, trafiony pancerz i faktycznie zadane obrażenia. + + + diff --git a/addons/debug/$PBOPREFIX$ b/addons/debug/$PBOPREFIX$ new file mode 100644 index 0000000..956fb9d --- /dev/null +++ b/addons/debug/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\debug \ No newline at end of file diff --git a/addons/debug/CfgEventHandlers.hpp b/addons/debug/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/debug/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/debug/XEH_PREP.hpp b/addons/debug/XEH_PREP.hpp new file mode 100644 index 0000000..958cd2c --- /dev/null +++ b/addons/debug/XEH_PREP.hpp @@ -0,0 +1,2 @@ +PREP(drawHitDebug); +PREP(initDebug); diff --git a/addons/debug/XEH_postInit.sqf b/addons/debug/XEH_postInit.sqf new file mode 100644 index 0000000..421c54b --- /dev/null +++ b/addons/debug/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" diff --git a/addons/debug/XEH_preInit.sqf b/addons/debug/XEH_preInit.sqf new file mode 100644 index 0000000..ea4a0a8 --- /dev/null +++ b/addons/debug/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +call FUNC(initDebug); + +ADDON = true; diff --git a/addons/debug/XEH_preStart.sqf b/addons/debug/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/debug/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/debug/config.cpp b/addons/debug/config.cpp new file mode 100644 index 0000000..d821136 --- /dev/null +++ b/addons/debug/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/debug/functions/fnc_drawHitDebug.sqf b/addons/debug/functions/fnc_drawHitDebug.sqf new file mode 100644 index 0000000..37d7749 --- /dev/null +++ b/addons/debug/functions/fnc_drawHitDebug.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Draws debug hits data. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +#ifdef DEV_DEBUG +{ + drawIcon3D ["#(argb,8,8,3)color(1,0,0,1)", [1,1,1,1], _x, 0.25, 0.25, 0, "Hit", 0, 0.03]; +} forEach HitpointHits; +{ + drawIcon3D ["#(argb,8,8,3)color(0,0,1,1)", [1,1,1,1], ASLToAGL _x, 0.25, 0.25, 0, "Hit", 0, 0.03]; +} forEach PositionHits; +{ + _x params ["_position", "_vector"]; + drawLine3D [ASLToAGL _position, ASLToAGL _position vectorAdd vectorNormalized _vector, [0,1,0,1]]; +} forEach SurfaceVectors; +{ + _x params ["_position", "_vector"]; + drawLine3D [ASLToAGL _position, ASLToAGL _position vectorAdd vectorNormalized _vector, [0,0,1,1]]; +} forEach VelocityVectors; +{ + _x params ["_position", "_vector"]; + drawLine3D [_position, _position vectorAdd vectorNormalized _vector, [1,1,0,1]]; +} forEach ProjectileRelPosVectors; +{ + _x params ["_position", "_vector"]; + drawLine3D [_position, _position vectorAdd vectorNormalized _vector, [0,1,1,1]]; +} forEach TargetDirVectors; +#endif + +nil diff --git a/addons/debug/functions/fnc_initDebug.sqf b/addons/debug/functions/fnc_initDebug.sqf new file mode 100644 index 0000000..4088174 --- /dev/null +++ b/addons/debug/functions/fnc_initDebug.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Initializes things for debugging if enabled. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +#ifdef DEV_DEBUG +HitpointHits = []; +PositionHits = []; +TargetDirVectors = []; +ProjectileRelPosVectors = []; +SurfaceVectors = []; +VelocityVectors = []; +#endif + +nil diff --git a/addons/debug/functions/script_component.hpp b/addons/debug/functions/script_component.hpp new file mode 100644 index 0000000..83fd66e --- /dev/null +++ b/addons/debug/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\debug\script_component.hpp" diff --git a/addons/debug/script_component.hpp b/addons/debug/script_component.hpp new file mode 100644 index 0000000..957918c --- /dev/null +++ b/addons/debug/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT debug +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_DEBUG + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_DEBUG + #define DEBUG_SETTINGS DEBUG_SETTINGS_DEBUG +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/debug/stringtable.xml b/addons/debug/stringtable.xml new file mode 100644 index 0000000..9284154 --- /dev/null +++ b/addons/debug/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Debug + ArmaForces Wargame - Debug + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/deployment/$PBOPREFIX$ b/addons/deployment/$PBOPREFIX$ new file mode 100644 index 0000000..491a3c4 --- /dev/null +++ b/addons/deployment/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\deployment \ No newline at end of file diff --git a/addons/deployment/CfgEventHandlers.hpp b/addons/deployment/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/deployment/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/deployment/README.md b/addons/deployment/README.md new file mode 100644 index 0000000..2c6ca42 --- /dev/null +++ b/addons/deployment/README.md @@ -0,0 +1,5 @@ +# Deployment + +## Public functions + +- [fnc_addDeployableVehicle](functions/fnc_addDeployableVehicle.sqf) diff --git a/addons/deployment/XEH_PREP.hpp b/addons/deployment/XEH_PREP.hpp new file mode 100644 index 0000000..6146e0f --- /dev/null +++ b/addons/deployment/XEH_PREP.hpp @@ -0,0 +1,2 @@ +PREP(addDeployableVehicle); +PREP(deployVehicle); diff --git a/addons/deployment/XEH_postInit.sqf b/addons/deployment/XEH_postInit.sqf new file mode 100644 index 0000000..11b376e --- /dev/null +++ b/addons/deployment/XEH_postInit.sqf @@ -0,0 +1,50 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; +if (!hasInterface) exitWith {}; + +["MDL_createVehicleFailed", { + systemChat LLSTRING(DeploymentFailure); +}] call CBA_fnc_addEventHandler; + +["MDL_vehicleDeployment", { + params ["_vehicleClassName", "_caller", "_vehicle"]; + + if (_caller isEqualTo player) then { + player moveInDriver _vehicle; + }; + + private _vehicleInfo = VehicleTypes getOrDefault [toUpper _vehicleClassName, ""]; + private _vehicleName = if (_vehicleInfo isNotEqualTo "") then { + [_vehicleInfo] call EFUNC(common,getVehicleDisplayName) + } else { + _vehicleClassName + }; + + [WEST, "HQ"] sideChat format [LLSTRING(DeploymentOfVehicle), _vehicleName, name _caller]; +}] call CBA_fnc_addEventHandler; + +["MDL_vehicleDeploymentNoLongerPossible", { + params ["_vehicleClassName"]; + private _vehicleInfo = VehicleTypes getOrDefault [toUpper _vehicleClassName, ""]; + private _vehicleName = if (_vehicleInfo isNotEqualTo "") then { + [_vehicleInfo] call EFUNC(common,getVehicleDisplayName) + } else { + _vehicleClassName + }; + + [WEST, "HQ"] sideChat format [LLSTRING(DeploymentOfVehicleNoLongerPossible), _vehicleName]; +}] call CBA_fnc_addEventHandler; + +["MDL_unitLost", { + params ["_unit"]; + private _vehicleDisplayName = [_unit] call EFUNC(common,getVehicleDisplayName); + private _crew = crew _unit; + private _crewNames = if (_crew isEqualTo []) then { + "" + } else { + format ["%1: %2", groupId group leader effectiveCommander _unit, _crew] + }; + + [WEST, "HQ"] sideChat format [LLSTRING(UnitLost), _vehicleDisplayName, _crewNames] +}] call CBA_fnc_addEventHandler; diff --git a/addons/deployment/XEH_postInitServer.sqf b/addons/deployment/XEH_postInitServer.sqf new file mode 100644 index 0000000..b265b2c --- /dev/null +++ b/addons/deployment/XEH_postInitServer.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["MDL_deployVehicle", FUNC(deployVehicle)] call CBA_fnc_addEventHandler; diff --git a/addons/deployment/XEH_preInit.sqf b/addons/deployment/XEH_preInit.sqf new file mode 100644 index 0000000..5de204e --- /dev/null +++ b/addons/deployment/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +// Can be initialized using FUNC(addDeployableVehicle) +GVAR(spawnableVehicles) = createHashMap; + +ADDON = true; diff --git a/addons/deployment/XEH_preStart.sqf b/addons/deployment/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/deployment/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/deployment/config.cpp b/addons/deployment/config.cpp new file mode 100644 index 0000000..d821136 --- /dev/null +++ b/addons/deployment/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/deployment/functions/fnc_addDeployableVehicle.sqf b/addons/deployment/functions/fnc_addDeployableVehicle.sqf new file mode 100644 index 0000000..3a1a1a2 --- /dev/null +++ b/addons/deployment/functions/fnc_addDeployableVehicle.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Changes availability of given vehicle class according to the number specified. + * Cannot change availability below 0. + * + * Arguments: + * 0: Vehicle class that will be deployable + * 1: Requested change in availability (can be negative) + * + * Example: + * ["GM_GC_ARMY_T55AM2", 4] call afwg_deployment_fnc_addDeployableVehicle + * + * Return Value: + * New availability of given vehicle + * + * Public: Yes + */ + +params [["_vehicleClassName", "", [""]], ["_count", 0, [0]]]; + +if (_vehicleClassName isEqualTo "") exitWith { 0 }; + +private _currentCount = GVAR(spawnableVehicles) getOrDefault [_vehicleClassName, 0]; + +private _newCount = (_currentCount + _count) max 0; +GVAR(spawnableVehicles) set [_vehicleClassName, _newCount]; + +_newCount diff --git a/addons/deployment/functions/fnc_deployVehicle.sqf b/addons/deployment/functions/fnc_deployVehicle.sqf new file mode 100644 index 0000000..490c29f --- /dev/null +++ b/addons/deployment/functions/fnc_deployVehicle.sqf @@ -0,0 +1,44 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Serverside handling of new vehicle deployment. + * + * Arguments: + * 0: Vehicle class to create + * 1: Person deploying vehicle + * 2: Vehicle used for spawning + * + * Return Value: + * None + * + * Public: No + */ + +params ["_vehicleClassName", "_caller", "_spawner"]; + +private _remainingSpawns = GVAR(spawnableVehicles) getOrDefault [_vehicleClassName, 0]; + +if (_remainingSpawns < 1) exitWith { + ["MDL_vehicleDeploymentNoLongerPossible", [_vehicleClassName], _caller] call CBA_fnc_targetEvent; +}; + +private _vehicle = createVehicle [_vehicleClassName, getMarkerPos "sys_marker_spawner_1", ["sys_marker_spawner_1", "sys_marker_spawner_2", "sys_marker_spawner_3"]]; +_vehicle setVariable ["MDL_deployedVehicle", true, true]; + +{ + _x addCuratorEditableObjects [[_vehicle], true]; +} forEach allCurators; + +if (_vehicle isEqualTo objNull) exitWith { + ["MDL_createVehicleFailed", [], _caller] call CBA_fnc_targetEvent; +}; + +// TODO: Provide number of remaining vehicles of given type +["MDL_vehicleDeployment", [_vehicleClassName, _caller, _vehicle]] call CBA_fnc_globalEvent; + +private _newRemainingSpawns = _remainingSpawns - 1; +GVAR(spawnableVehicles) set [_vehicleClassName, _newRemainingSpawns]; +if (_newRemainingSpawns isEqualTo 0) then { + ["MDL_vehicleDeploymentNoLongerPossible", [_vehicleClassName]] call CBA_fnc_globalEvent; + deleteVehicle _spawner; +}; diff --git a/addons/deployment/functions/script_component.hpp b/addons/deployment/functions/script_component.hpp new file mode 100644 index 0000000..a041db3 --- /dev/null +++ b/addons/deployment/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\deployment\script_component.hpp" diff --git a/addons/deployment/script_component.hpp b/addons/deployment/script_component.hpp new file mode 100644 index 0000000..939f78c --- /dev/null +++ b/addons/deployment/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT deployment +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_DEPLOYMENT + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_DEPLOYMENT + #define DEBUG_SETTINGS DEBUG_SETTINGS_DEPLOYMENT +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/deployment/stringtable.xml b/addons/deployment/stringtable.xml new file mode 100644 index 0000000..bb87075 --- /dev/null +++ b/addons/deployment/stringtable.xml @@ -0,0 +1,33 @@ + + + + + Failed deploying vehicle + Nie udało się rozmieścić pojazdu + + + %2 deployed new '%1' vehicle. + %2 rozmieścił nowy pojazd '%1'. + + + Deployment of new '%1' vehicle is no longer possible. + Rozmieszczenie nowych pojazdów '%1' już nie jest możliwe. + + + ArmaForces Wargame - Deployment + ArmaForces Wargame - Deployment + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Lost %1 %2 + Utracono %1 %2 + + + diff --git a/addons/event_handlers/$PBOPREFIX$ b/addons/event_handlers/$PBOPREFIX$ new file mode 100644 index 0000000..f7aa4e9 --- /dev/null +++ b/addons/event_handlers/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\event_handlers \ No newline at end of file diff --git a/addons/event_handlers/CfgEventHandlers.hpp b/addons/event_handlers/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/event_handlers/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/event_handlers/XEH_PREP.hpp b/addons/event_handlers/XEH_PREP.hpp new file mode 100644 index 0000000..d84620c --- /dev/null +++ b/addons/event_handlers/XEH_PREP.hpp @@ -0,0 +1,7 @@ +PREP(curatorObjectDeleted); +PREP(draw3D); +PREP(fired); +PREP(handleDamage); +PREP(handleDamageMan); +PREP(hitPart); +PREP(knowsAboutChanged); diff --git a/addons/event_handlers/XEH_postInit.sqf b/addons/event_handlers/XEH_postInit.sqf new file mode 100644 index 0000000..67a4984 --- /dev/null +++ b/addons/event_handlers/XEH_postInit.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +// TODO: Add KnowsAboutChanged EH to WEST groups as needed as this thing most likely won't work +{ + _x addEventHandler ["KnowsAboutChanged", FUNC(knowsAboutChanged)]; +} forEach (groups WEST); + +{ + _x addEventHandler ["CuratorObjectDeleted", FUNC(curatorObjectDeleted)]; +} forEach allCurators; + +if (!hasInterface) exitWith {}; + +addMissionEventHandler ["Draw3D", FUNC(draw3D)]; diff --git a/addons/event_handlers/XEH_preInit.sqf b/addons/event_handlers/XEH_preInit.sqf new file mode 100644 index 0000000..ecb5d0c --- /dev/null +++ b/addons/event_handlers/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; diff --git a/addons/event_handlers/XEH_preStart.sqf b/addons/event_handlers/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/event_handlers/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/event_handlers/config.cpp b/addons/event_handlers/config.cpp new file mode 100644 index 0000000..6e73c27 --- /dev/null +++ b/addons/event_handlers/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common", + "afwg_damage", + "afwg_icons", + "afwg_markers" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/event_handlers/functions/fnc_curatorObjectDeleted.sqf b/addons/event_handlers/functions/fnc_curatorObjectDeleted.sqf new file mode 100644 index 0000000..b98a477 --- /dev/null +++ b/addons/event_handlers/functions/fnc_curatorObjectDeleted.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Removes marker of an entity that has been deleted by curator. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +params ["_curator", "_entity"]; + +[_entity] call EFUNC(markers,removeVehicleMarker); diff --git a/addons/event_handlers/functions/fnc_draw3D.sqf b/addons/event_handlers/functions/fnc_draw3D.sqf new file mode 100644 index 0000000..7548da7 --- /dev/null +++ b/addons/event_handlers/functions/fnc_draw3D.sqf @@ -0,0 +1,79 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3, veteran29 + * Draws unit icons in Draw3D MissionEventHandler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +#ifdef DEV_DEBUG +call EFUNC(debug,drawHitDebug); +#endif + +// Always draw icon for cursor object +// Not using cursorTarget to avoid issues with knowledge that might be lagging +private _cursorObject = cursorObject; +private _vehiclesWithIcons = if ( + side effectiveCommander _cursorObject isEqualTo playerSide || { + (_cursorObject getVariable ["MDL_IsVisible", false] + && {side effectiveCommander _cursorObject isNotEqualTo sideUnknown}) +}) then { + [[_cursorObject, true]] +} else { [] }; + +private _iconMode = EGVAR(icons,unitIconMode); + +switch (_iconMode) do { + // Friendly and enemy + case 0: { + _vehiclesWithIcons append (vehicles select {( + side effectiveCommander _x isEqualTo playerSide + ) || { + _x getVariable ["MDL_IsVisible", false] + && {side effectiveCommander _x isEqualTo EAST} + } + }); + }; + // Enemy only + case 1: { + _vehiclesWithIcons append (vehicles select { + _x getVariable ["MDL_IsVisible", false] + && {side effectiveCommander _x isEqualTo EAST} + }); + }; + default {}; +}; + +// curator icons +if (!isNull findDisplay 312) then { + curatorMouseOver params ["_type", "_entity", "_index"]; + if (_type isEqualTo "OBJECT") then { + _vehiclesWithIcons pushBackUnique [_entity, true]; + }; + if (_type isEqualTo "GROUP") then { + { + _vehiclesWithIcons pushBackUnique [_x, true]; + } forEach ([_entity] call EFUNC(common,getGroupVehicles)); + }; + + curatorSelected params ["_objects", "_groups"]; + { + _vehiclesWithIcons pushBackUnique [_x, true]; + } forEach _objects; + { + { + _vehiclesWithIcons pushBackUnique [_x, true]; + } forEach ([_x] call EFUNC(common,getGroupVehicles)); + } forEach _groups; +}; + +// Draws icons. Might draw an icon twice for one object if it's targeted/highlighted. +{ + _x call EFUNC(icons,drawIcon); +} forEach _vehiclesWithIcons; diff --git a/addons/event_handlers/functions/fnc_fired.sqf b/addons/event_handlers/functions/fnc_fired.sqf new file mode 100644 index 0000000..2633104 --- /dev/null +++ b/addons/event_handlers/functions/fnc_fired.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * + * + * Arguments: + * "Fired" EH params + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; + +// if (!local _unit) exitWith {}; +_projectile setVariable ["MDL_initialVelocity", velocity _projectile]; + +// We don't care about AIs +if !(isPlayer _unit) exitWith {}; + +_unit setVariable ["MDL_lastCombatActive", CBA_missionTime]; diff --git a/addons/event_handlers/functions/fnc_handleDamage.sqf b/addons/event_handlers/functions/fnc_handleDamage.sqf new file mode 100644 index 0000000..428d96f --- /dev/null +++ b/addons/event_handlers/functions/fnc_handleDamage.sqf @@ -0,0 +1,41 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Overrides damage handler to ignore default engine damage handling. + * + * Arguments: + * "HandleDamage" EH params + * + * Return Value: + * Damage taken by the unit if overriden + * + * Public: No + */ + +params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; + +// Exclude total damage info (_context == 0), FakeHeadHit (3) and TotalDamageBeforeBleeding (4) +if (_context isEqualTo 0 || {_context > 2}) exitWith { damage _unit }; + +// Most likely a collision so let the engine handle it +if (_projectile isEqualTo "" && {isNull _instigator}) exitWith {}; +// TODO: Consider changing HP afterwards somehow + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG HANDLE DAMAGE [%1]: %2", diag_tickTime, str _this]; +#endif + +private _selectionHitpointName = getText (configOf _unit >> "Hitpoints" >> _hitPoint >> "name"); +private _modelHitpointPosition = _unit selectionPosition _selectionHitpointName; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG HANDLE DAMAGE [%1]: Model hitpoint name '%2' and position %3", diag_tickTime, _selectionHitpointName, str _modelHitpointPosition]; +#endif + +if (_modelHitpointPosition isEqualTo [0, 0, 0]) exitWith { damage _unit }; + +#ifdef DEV_DEBUG +HitpointHits pushBackUnique (_unit modelToWorld _modelHitpointPosition); +#endif + +0 diff --git a/addons/event_handlers/functions/fnc_handleDamageMan.sqf b/addons/event_handlers/functions/fnc_handleDamageMan.sqf new file mode 100644 index 0000000..1838144 --- /dev/null +++ b/addons/event_handlers/functions/fnc_handleDamageMan.sqf @@ -0,0 +1,19 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Overrides damage handler to ignore default engine damage handling. + * + * Arguments: + * "HandleDamage" EH params + * + * Return Value: + * Damage taken by the unit if overriden + * + * Public: No + */ + +params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; + +if (vehicle _unit isEqualTo _unit) exitWith {}; + +damage _unit diff --git a/addons/event_handlers/functions/fnc_hitPart.sqf b/addons/event_handlers/functions/fnc_hitPart.sqf new file mode 100644 index 0000000..986dd91 --- /dev/null +++ b/addons/event_handlers/functions/fnc_hitPart.sqf @@ -0,0 +1,54 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * + * + * Arguments: + * "HitPart" EH params + * + * Return Value: + * None + * + * Public: No + */ + +(_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect", "_instigator"]; + +#ifdef DEV_DEBUG +private _i = 0; +{ + diag_log format ["WARGAY DEBUG HIT PART [%1]: All [%2]: %3", diag_tickTime, _i, str _x]; + _i = _i + 1; +} forEach _this; +diag_log format ["WARGAY DEBUG HIT PART [%1]: Projectile relative position: %2 | Hit relative position: %3", diag_tickTime, str (_target worldToModel getPosATL _projectile), str (_target worldToModel ASLToAGL _position)]; +#endif + +if (!alive _target) exitWith { + _target removeEventHandler [_thisEvent, _thisEventHandler]; +}; + +private _isHandledForTarget = _projectile getVariable [str _target, false]; + +if (_isHandledForTarget) exitWith {}; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG HIT PART [%1]: Selection: %2 Vector: %3, Velocity: %4", diag_tickTime, str _selection, str _vector, str _velocity]; +#endif + +// Do not handle projectiles coming at a surface at extreme angles +private _velocityAndSurfaceProduct = vectorNormalized _velocity vectorDotProduct _vector; +if (_velocity isNotEqualTo [0, 0, 0] && {_velocityAndSurfaceProduct < 0.15 && {_velocityAndSurfaceProduct > -0.15}}) exitWith {}; + +private _hitDir = [_target, _vector, _velocity, _projectile] call EFUNC(damage,getHitDir); + +#ifdef DEV_DEBUG +PositionHits pushBack (_position); +SurfaceVectors pushBack ([_position, _vector]); +VelocityVectors pushBack ([_position, _velocity]); +#endif + +_projectile setVariable [str _target, true]; + +private _hitPosition = if (_isDirect) then { [] } else { getPosATL _projectile }; + +[_target, _shooter, _hitDir, _hitPosition, _velocity, _projectile, _ammo] call EFUNC(damage,calculateAndApplyDamage); diff --git a/addons/event_handlers/functions/fnc_knowsAboutChanged.sqf b/addons/event_handlers/functions/fnc_knowsAboutChanged.sqf new file mode 100644 index 0000000..9b73bc4 --- /dev/null +++ b/addons/event_handlers/functions/fnc_knowsAboutChanged.sqf @@ -0,0 +1,39 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if new unit is spotted and propagates info so that the icon can be drawn for target. + * + * Arguments: + * 0: Group changing knowledge + * 1: Target that the knowledge concerns + * 2: New KnowsAbout value + * 3: Old KnowsAbout value + * + * Return Value: + * None + * + * Public: No + */ + +params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"]; + +if (side _targetUnit isNotEqualTo EAST) exitWith {}; +if (isObjectHidden leader _group) exitWith {}; + +if (EGVAR(common,onlyReconCanSpot) && {!([_group] call EFUNC(common,isReconVehicle))}) exitWith {}; + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG KNOWS ABOUT CHANGED [%1]: Group: %2, Target: %3, KnowsAbout: %4 -> %5", diag_tickTime, _group, _targetUnit, _oldKnowsAbout, _newKnowsAbout]; +#endif + +private _isRevealed = _targetUnit getVariable ["MDL_IsVisible", false]; + +if (_newKnowsAbout > 0.75 && {!_isRevealed}) then { + + _targetUnit setVariable ["MDL_IsVisible", true, true]; + #ifdef DEV_DEBUG + diag_log format ["WARGAY DEBUG KNOWS ABOUT CHANGED [%1]: Revealing Target: %3 detected by Group: %2", diag_tickTime, _group, _targetUnit/*, _oldKnowsAbout, _newKnowsAbout*/]; + #endif + _group reveal _targetUnit; + ["MDL_unitSpotted", [_targetUnit]] call CBA_fnc_globalEvent; +}; diff --git a/addons/event_handlers/functions/script_component.hpp b/addons/event_handlers/functions/script_component.hpp new file mode 100644 index 0000000..624a555 --- /dev/null +++ b/addons/event_handlers/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\event_handlers\script_component.hpp" diff --git a/addons/event_handlers/script_component.hpp b/addons/event_handlers/script_component.hpp new file mode 100644 index 0000000..c8a15f4 --- /dev/null +++ b/addons/event_handlers/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT event_handlers +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_EVENT_HANDLERS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_EVENT_HANDLERS + #define DEBUG_SETTINGS DEBUG_SETTINGS_EVENT_HANDLERS +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/event_handlers/stringtable.xml b/addons/event_handlers/stringtable.xml new file mode 100644 index 0000000..9f9eee5 --- /dev/null +++ b/addons/event_handlers/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Event Handlers + ArmaForces Wargame - Event Handlers + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/help/$PBOPREFIX$ b/addons/help/$PBOPREFIX$ new file mode 100644 index 0000000..16d68ca --- /dev/null +++ b/addons/help/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\help \ No newline at end of file diff --git a/addons/help/CfgEventHandlers.hpp b/addons/help/CfgEventHandlers.hpp new file mode 100644 index 0000000..e5bcd3c --- /dev/null +++ b/addons/help/CfgEventHandlers.hpp @@ -0,0 +1,21 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; + +class Extended_DisplayLoad_EventHandlers { + class RscUnitInfo { + MDL_Wargay = QUOTE(call FUNC(initHitpointsDisplay)); + }; +}; diff --git a/addons/help/CfgHintCategories.hpp b/addons/help/CfgHintCategories.hpp new file mode 100644 index 0000000..8ac3a18 --- /dev/null +++ b/addons/help/CfgHintCategories.hpp @@ -0,0 +1,7 @@ +class CfgHintCategories +{ + class AFWG_help + { + displayName = ECSTRING(main,DisplayName); + }; +}; diff --git a/addons/help/CfgHints.hpp b/addons/help/CfgHints.hpp new file mode 100644 index 0000000..76126ee --- /dev/null +++ b/addons/help/CfgHints.hpp @@ -0,0 +1,143 @@ +class CfgHints +{ + class GVAR(concepts) + { + category = "AFWG_help"; + displayName = "Concepts"; + + class Spotting + { + displayName = "Spotting enemy units"; + displayNameShort = "Spotting"; + description = "Press %11 to spot enemy unit when aiming at it."; + tip = ""; + arguments[] = { + {{ "revealTarget" }} + }; + }; + + class UnitInfo + { + displayName = "Showing unit information"; + displayNameShort = "Unit info"; + description = "Press %11 when aiming at a unit to show its unit card in a hint."; + tip = "Use unit card to judge danger that enemy unit poses."; + arguments[] = { + { "TAB" } + }; + }; + + // class Vehicles + // { + // displayName = "Vehicles"; + // }; + }; + + class GVAR(damage) + { + category = "AFWG_help"; + displayName = "Damage"; + + class Armor + { + displayName = "Armor (AV) System"; + description = "Armor (AV) is resistance of a vehicle to the damage. It might be different for different sides of the vehicle.%1 + Small arms can shred through 0 AV.%1 + 1 AV is enough to be safe from small arms fire (although crew can still be killed if there are windows!).%1 + As a rule of thumb, 2 AV from all sides makes vehicle relatively safe from several HE hits nearby. Strong top armor makes vehicle more resistant to artillery (especially cluster).%1 + Due to technical limitations, hit armor direction is determined using relative hull orientation. This means that if a tank has the turret aiming backwards and gets hit in rear turret armor, the front armor is getting hit (rather than rear)."; + tip = "Armor values are always shown as [FRONT/SIDE/REAR/TOP]"; + }; + + class Damage + { + displayName = "Damage System"; + description = "Default arma damage system is turned off (except for collisions!) and replaced with Wargame-like system, where vehicles are either destroyed or not (no track or turret damage). This means even vehicle with 1 HP is as deadly as with 10 HP."; + tip = "There are 3 different damage types: KE (Kinetic Energy), HE (High Explosive) and HEAT (High Explosive Anti Tank)"; + }; + + class DamageHE + { + displayName = "Damage (HE)"; + description = "All explosions are treated as HE damage, dealing decreased damage the further it is from the target. For every 1 HE damage of a weapon, target receives damage respectively to AV being hit. + %1%2Below 2 AV - full damage. + %1%2For 2 AV - 0.4 damage + %1%2For 3 AV - 0.3 damage + %1%2For 4 AV - 0.2 damage + %1%2For 5 AV - 0.15 damage + %1%2Up to 7 AV - 0.1 damage + %1%2Up to 13 AV - 0.05 damage + %1%2Above 14 AV - 0.01 damage"; + tip = "While damage values might be much smaller, it almost always deals some damage. This makes rapid firing vehicles really dangerous flankers."; + }; + + class DamageHEAT + { + displayName = "Damage (HEAT)"; + description = "Weapons with tandem warheads are treated as HEAT damage, always having the same damage potential. Damage dealt increases by 0.5 for every 1 potential damage above target AV. Over 10 difference and it increases by 1 for every difference from armor value."; + tip = "HEAT weapons deal consistent damage no matter the distance to the target. Moreover HEAT always deals at least 1 damage, even if armor cannot be penetrated."; + }; + + class DamageKE + { + displayName = "Damage (KE)"; + description = "APFSDS and similar are treated as KE (or AP) damage, which damage potential depends on distance to the target. Damage dealt increases by 0.5 for every 1 potential damage above target AV."; + tip = "The closer you are to the target, the more power your shell has. It can sometimes penetrate and damage multiple targets."; + }; + + class Hitpoints + { + displayName = "Hitpoints"; + description = ""; + tip = "Some vehicles might have less than 10 hitpoints, which makes them extra vulnerable."; + }; + }; + + class GVAR(logisics) + { + category = "AFWG_help"; + displayName = "Logistics"; + + class Rearm + { + + }; + + class Refuel + { + + }; + + class Repair + { + + }; + }; + + class GVAR(vehicleTypes) + { + category = "AFWG_help"; + displayName = "Unit Classes"; + + class Logistics + { + displayName = "Logistics"; + displayNameShort = "LOG"; + description = "Various command vehicles (CV) and logistic vehicles are available."; + }; + + class Infantry + { + displayName = "Infantry"; + displayNameShort = "INF"; + description = "Just some meat, in this mod there's nothing special about it. Shouldn't be ignored though, their AT weapons can surprise you."; + }; + + class Tanks + { + displayName = "Tanks"; + displayNameShort = "TNK"; + description = "Main force of the battlefield, but can easily end up in tough situations."; + }; + }; +}; diff --git a/addons/help/XEH_PREP.hpp b/addons/help/XEH_PREP.hpp new file mode 100644 index 0000000..e69de29 diff --git a/addons/help/XEH_postInit.sqf b/addons/help/XEH_postInit.sqf new file mode 100644 index 0000000..421c54b --- /dev/null +++ b/addons/help/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" diff --git a/addons/help/XEH_preInit.sqf b/addons/help/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/help/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/help/XEH_preStart.sqf b/addons/help/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/help/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/help/config.cpp b/addons/help/config.cpp new file mode 100644 index 0000000..ae6d826 --- /dev/null +++ b/addons/help/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgHintCategories.hpp" +#include "CfgHints.hpp" diff --git a/addons/help/functions/script_component.hpp b/addons/help/functions/script_component.hpp new file mode 100644 index 0000000..ed37ac7 --- /dev/null +++ b/addons/help/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\help\script_component.hpp" diff --git a/addons/help/initSettings.inc.sqf b/addons/help/initSettings.inc.sqf new file mode 100644 index 0000000..e184efd --- /dev/null +++ b/addons/help/initSettings.inc.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(enableHints), + "CHECKBOX", + ["Enable hints", "Controls whether mod-related hints should be shown even if turned off in game settings"], + [LSTRING(DisplayName)], + true, + false +] call CBA_fnc_addSetting; diff --git a/addons/help/script_component.hpp b/addons/help/script_component.hpp new file mode 100644 index 0000000..cdc5a3d --- /dev/null +++ b/addons/help/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT help +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_HELP + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_HELP + #define DEBUG_SETTINGS DEBUG_SETTINGS_HELP +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/help/stringtable.xml b/addons/help/stringtable.xml new file mode 100644 index 0000000..6406377 --- /dev/null +++ b/addons/help/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Help + ArmaForces Wargame - Help + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/hud/$PBOPREFIX$ b/addons/hud/$PBOPREFIX$ new file mode 100644 index 0000000..5a652ce --- /dev/null +++ b/addons/hud/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\hud \ No newline at end of file diff --git a/addons/hud/CfgEventHandlers.hpp b/addons/hud/CfgEventHandlers.hpp new file mode 100644 index 0000000..e5bcd3c --- /dev/null +++ b/addons/hud/CfgEventHandlers.hpp @@ -0,0 +1,21 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; + +class Extended_DisplayLoad_EventHandlers { + class RscUnitInfo { + MDL_Wargay = QUOTE(call FUNC(initHitpointsDisplay)); + }; +}; diff --git a/addons/hud/XEH_PREP.hpp b/addons/hud/XEH_PREP.hpp new file mode 100644 index 0000000..a274a05 --- /dev/null +++ b/addons/hud/XEH_PREP.hpp @@ -0,0 +1,5 @@ +PREP(currentHpString); +PREP(initHitpointsDisplay); +PREP(keyUnitInfo); +PREP(showUnitInfo); +PREP(updateHitpointsDisplay); diff --git a/addons/hud/XEH_postInit.sqf b/addons/hud/XEH_postInit.sqf new file mode 100644 index 0000000..22bdf33 --- /dev/null +++ b/addons/hud/XEH_postInit.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +["MDL_showCurrentHp", { + if (vehicle player isEqualTo player) exitWith {}; + call FUNC(updateHitpointsDisplay); +}] call CBA_fnc_addEventHandler; + +// Register a simple keypress to an action +#include "\a3\ui_f\hpp\defineDIKCodes.inc" + +// Handle "Info" button +[ + "MDL Wargay", + "MDL_WG_UnitInfo", + ["Unit Info", "Opens info popup of targeted unit"], + FUNC(keyUnitInfo), + {}, + [DIK_TAB, [false, false, false]] +] call CBA_fnc_addKeybind; diff --git a/addons/hud/XEH_preInit.sqf b/addons/hud/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/hud/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/hud/XEH_preStart.sqf b/addons/hud/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/hud/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/hud/config.cpp b/addons/hud/config.cpp new file mode 100644 index 0000000..2949b60 --- /dev/null +++ b/addons/hud/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/hud/functions/fnc_currentHpString.sqf b/addons/hud/functions/fnc_currentHpString.sqf new file mode 100644 index 0000000..9009e07 --- /dev/null +++ b/addons/hud/functions/fnc_currentHpString.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3, veteran29 + * Returns the unit HP in [ ] string representation. + * Allows specifying optional character for non-damaged squares in case whitespace characters are removed and result doesn't look satisfying. + * + * Arguments: + * 0: Unit + * 1: Optional character for non-damaged squares + * + * Return Value: + * Stringified HP boxes display + * + * Public: No + */ + +params ["_unit"]; + +private _currentHp = _unit getVariable ["MDL_currentHp", 0]; +private _maxHp = _unit getVariable ["MDL_maxHp", MAX_HP]; +private _missingHp = _maxHp - _currentHp; + +private _string = []; +_string resize [_currentHp, "[ ]"]; +_string resize [_maxHp, "[X]"]; + +_string joinString "" // return diff --git a/addons/hud/functions/fnc_initHitpointsDisplay.sqf b/addons/hud/functions/fnc_initHitpointsDisplay.sqf new file mode 100644 index 0000000..9a1c2c3 --- /dev/null +++ b/addons/hud/functions/fnc_initHitpointsDisplay.sqf @@ -0,0 +1,42 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Initializes Wargay-like HP HUD display in vehicle. + * + * Arguments: + * 0: Vehicle HUD display + * + * Return Value: + * None + * + * Public: No + */ + +#define IDC_HITZONES 111 + +params ["_display"]; + +private _hitZonesCtrl = _display displayCtrl IDC_HITZONES; +// ignore HUDs without HitZones +if (isNull _hitZonesCtrl) exitWith { + // systemChat "Unable to init custom HUD"; +}; + +#ifdef DEV_DEBUG +systemChat "Initializing custom HUD"; +#endif + +// create container for hit points squares +private _ctrlContainer = _display ctrlCreate ["RscControlsGroupNoScrollbars", -1]; +_ctrlContainer ctrlSetPosition ctrlPosition _hitZonesCtrl; +_ctrlContainer ctrlCommit 0; +// hide original hitzones ctrl +_hitZonesCtrl ctrlShow false; + +uiNamespace setVariable ["MDL_hitpointsContainer", _ctrlContainer]; + +/* + cameraOn setVariable ["my_hitpoints", 2]; + [] call fnc_renderHitpoints; + */ +call FUNC(updateHitpointsDisplay); diff --git a/addons/hud/functions/fnc_keyUnitInfo.sqf b/addons/hud/functions/fnc_keyUnitInfo.sqf new file mode 100644 index 0000000..7722487 --- /dev/null +++ b/addons/hud/functions/fnc_keyUnitInfo.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if TAB is pressed and shows targeted unit info. + * + * Arguments: + * 0: Main display + * 1: Key pressed + * 2: Is SHIFT pressed + * 3: Is CTRL pressed + * 4: Is ALT pressed + * + * Return Value: + * None + * + * Public: No + */ + +params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"]; + +private _cursorTarget = cursorTarget; +if (_cursorTarget isEqualTo objNull) exitWith {}; + +[_cursorTarget] call FUNC(showUnitInfo); diff --git a/addons/hud/functions/fnc_showUnitInfo.sqf b/addons/hud/functions/fnc_showUnitInfo.sqf new file mode 100644 index 0000000..dda9b62 --- /dev/null +++ b/addons/hud/functions/fnc_showUnitInfo.sqf @@ -0,0 +1,67 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Shows targeted unit info to local player. + * Works only for objects of kind "AllVehicles". + * + * Arguments: + * 0: Targeted object + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit"]; + +if !(_unit isKindOf "AllVehicles") exitWith {}; + +private _unitInfo = [_unit] call EFUNC(common,getVehicleInfo); + +if (_unitInfo isEqualTo objNull) exitWith {}; + +private _messageParts = [ + [_unitInfo] call EFUNC(common,getVehicleDisplayName), + lineBreak, + lineBreak, + format ["Points cost: %1", _unitInfo getOrDefault ["pointCost", 5]], + lineBreak, + lineBreak +]; + +// Get ammo and its damage +private _ammoInfo = [_unit] call EFUNC(common,getAmmoInfo); +if (_ammoInfo isNotEqualTo objNull) then { + private _ammoInfoText = keys _ammoInfo apply { + private _displayName = _ammoInfo get _x get DISPLAY_NAME_PROPERTY; + private _damage = _ammoInfo get _x get DAMAGE_PROPERTY; + private _damageType = _ammoInfo get _x get TYPE_PROPERTY; + if (_damage isEqualTo 0 || {_damageType isEqualTo "NONE"}) then { "" } else { + format ["%1: %2 %3", _displayName, _damage, _damageType]; + }; + } select {_x isNotEqualTo ""}; + + if (_ammoInfoText isNotEqualTo []) then { + _messageParts pushBack "Ammo:"; + _messageParts pushBack lineBreak; + + { + _messageParts pushBack _x; + _messageParts pushBack lineBreak; + } forEach _ammoInfoText; + + _messageParts pushBack lineBreak; + }; +}; + +private _armorInfoParts = [ + "Armor [Front/Sides/Back/Top]:", + lineBreak, + _unitInfo getOrDefault ["armor", NO_ARMOR] joinString "/" +]; + +_messageParts append _armorInfoParts; + +private _text = composeText _messageParts; +hint _text; diff --git a/addons/hud/functions/fnc_updateHitpointsDisplay.sqf b/addons/hud/functions/fnc_updateHitpointsDisplay.sqf new file mode 100644 index 0000000..32de595 --- /dev/null +++ b/addons/hud/functions/fnc_updateHitpointsDisplay.sqf @@ -0,0 +1,57 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Updates Wargay-like HP HUD display. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +private _ctrlContainer = uiNamespace getVariable ["MDL_hitpointsContainer", controlNull]; +if (isNull _ctrlContainer) exitWith {}; + +private _display = ctrlParent _ctrlContainer; + + +{ctrlDelete _x} forEach (_ctrlContainer getVariable ["MDL_hitpointsContainer_indicators", []]); + +private _totalHitPoints = vehicle cameraOn getVariable ["MDL_maxHp", MAX_HP]; +private _exactHitPoints = vehicle cameraOn getVariable ["MDL_currentHp", MAX_HP]; +private _hitPoints = ceil _exactHitPoints; +// calculate size of the hitzone squares +ctrlPosition _ctrlContainer params ["", "", "_w"]; +private _hpW = _w / _totalHitPoints; +private _gutterW = _hpW / 4; + +// render hitpoint squares +private _indicators = []; +for "_i" from 0 to (_totalHitPoints-1) do { + private _hpCtrl = _display ctrlCreate ["RscText", -1, _ctrlContainer]; + _hpCtrl ctrlSetBackgroundColor ([ + GVAR(missingHpColor), + GVAR(filledHpColor) + ] select (_i < _hitPoints)); + + _hpCtrl ctrlSetPosition [ + _hpW * _i, + pixelH * 4, + _hpW - _gutterW, + _hpW + ]; + _hpCtrl ctrlCommit 0; + + _indicators pushBack _hpCtrl; +}; + +if (_exactHitPoints isNotEqualTo _hitPoints) then { + private _partialHpCtrl = _indicators select (_hitPoints - 1); + _partialHpCtrl ctrlSetFade (_hitPoints - _exactHitPoints); + _partialHpCtrl ctrlCommit 0; +}; + +_ctrlContainer setVariable ["MDL_hitpointsContainer_indicators", _indicators]; diff --git a/addons/hud/functions/script_component.hpp b/addons/hud/functions/script_component.hpp new file mode 100644 index 0000000..ae35276 --- /dev/null +++ b/addons/hud/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\hud\script_component.hpp" diff --git a/addons/hud/initSettings.inc.sqf b/addons/hud/initSettings.inc.sqf new file mode 100644 index 0000000..5f4b6cb --- /dev/null +++ b/addons/hud/initSettings.inc.sqf @@ -0,0 +1,28 @@ +// GVAR(filledHpColor) = getArray (missionConfigFile >> "CfgWargay" >> "filledHpColor"); +// GVAR(missingHpColor) = getArray (missionConfigFile >> "CfgWargay" >> "missingHpColor"); + +[ + QGVAR(filledHpColor), + "COLOR", + ["HP color", "Color used for full HP boxes in HUD"], + [LSTRING(DisplayName)], + [ + 117/255, + 1, + 1, + 1 + ] +] call CBA_fnc_addSetting; + +[ + QGVAR(missingHpColor), + "COLOR", + ["Missing HP color", "Color used for missing HP boxes in HUD"], + [LSTRING(DisplayName)], + [ + 117/255, + 117/255, + 117/255, + 1 + ] +] call CBA_fnc_addSetting; diff --git a/addons/hud/script_component.hpp b/addons/hud/script_component.hpp new file mode 100644 index 0000000..94e0555 --- /dev/null +++ b/addons/hud/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT hud +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_HUD + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_HUD + #define DEBUG_SETTINGS DEBUG_SETTINGS_HUD +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/hud/stringtable.xml b/addons/hud/stringtable.xml new file mode 100644 index 0000000..f659d38 --- /dev/null +++ b/addons/hud/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Hud + ArmaForces Wargame - Hud + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/icons/$PBOPREFIX$ b/addons/icons/$PBOPREFIX$ new file mode 100644 index 0000000..74fa5f0 --- /dev/null +++ b/addons/icons/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\icons \ No newline at end of file diff --git a/addons/icons/CfgEventHandlers.hpp b/addons/icons/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/icons/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/icons/XEH_PREP.hpp b/addons/icons/XEH_PREP.hpp new file mode 100644 index 0000000..69eefb8 --- /dev/null +++ b/addons/icons/XEH_PREP.hpp @@ -0,0 +1,3 @@ +PREP(drawIcon); +PREP(getIconPath); +PREP(visibilityCheckLoop); diff --git a/addons/icons/XEH_postInit.sqf b/addons/icons/XEH_postInit.sqf new file mode 100644 index 0000000..724d5c7 --- /dev/null +++ b/addons/icons/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; diff --git a/addons/icons/XEH_postInitServer.sqf b/addons/icons/XEH_postInitServer.sqf new file mode 100644 index 0000000..7a4d59f --- /dev/null +++ b/addons/icons/XEH_postInitServer.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +call FUNC(visibilityCheckLoop); diff --git a/addons/icons/XEH_preInit.sqf b/addons/icons/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/icons/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/icons/XEH_preStart.sqf b/addons/icons/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/icons/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/icons/config.cpp b/addons/icons/config.cpp new file mode 100644 index 0000000..1543844 --- /dev/null +++ b/addons/icons/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common", + "afwg_hud", + "afwg_markers" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/icons/functions/fnc_drawIcon.sqf b/addons/icons/functions/fnc_drawIcon.sqf new file mode 100644 index 0000000..ccc16e7 --- /dev/null +++ b/addons/icons/functions/fnc_drawIcon.sqf @@ -0,0 +1,59 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3, veteran29 + * Draws 3D icon above given unit. + * + * Arguments: + * 0: Alive unit to draw an icon for + * 1: Include unit name and HP text (Optional, default false) + * + * Return Value: + * None + * + * Public: No + */ + +#define ABOVE_UNIT [0, 0, 1.5] + +params ["_target", ["_includeText", false]]; + +if (!alive _target || {_target getVariable ["MDL_currentHp", 0] isEqualTo 0}) exitWith {}; + +private _worldPos = _target modelToWorldVisual ABOVE_UNIT; + +private _screenPosition = worldToScreen _worldPos; +if (_screenPosition isEqualTo []) exitWith {}; + +private _iconDescription = if (_includeText) then { + format ["%1 - %2", [_target] call EFUNC(common,getVehicleDisplayName), _target call EFUNC(hud,currentHpString)] +} else { "" }; + +private _iconPath = [_target] call FUNC(getIconPath); +private _iconSize = (GVAR(unitIconSizeMultiplier) * 0.01 * safeZoneW) / GVAR(iconWidth); +private _effectiveCommander = effectiveCommander _target; +private _sideColor = if (side _effectiveCommander isEqualTo WEST) then { + [GVAR(westAiIconColor), GVAR(westIconColor)] select isPlayer _effectiveCommander +} else { GVAR(eastIconColor) }; + +if (GVAR(unitIconSizeDependsOnDistance)) then { + // BUG: Distance should be from camera? + private _distance = (player distance _worldPos) + 0.001; // Adding fraction to ensure it's positive in case someone ends up perfectly aligned (not gonna happen) + private _factor = (3 - (log _distance)/1.5) min 2 max 0.55; + // private _factor = 2 min (1 max ((_distance - 300) * 0.0014)); + _iconSize = _iconSize * _factor; +}; + +TRACE_6("drawIcon3D",_iconPath,_sideColor,_worldPos,_iconSize,_iconDescription,_includeText); + +drawIcon3D [ + _iconPath, + [_sideColor, [1,1,1,1]], + _worldPos, + _iconSize, + _iconSize, + 0, + _iconDescription, + _includeText, // True = outline, False = nothing + GVAR(unitIconTextSizeMultiplier) * 0.02, + "EtelkaMonospacePro" +]; diff --git a/addons/icons/functions/fnc_getIconPath.sqf b/addons/icons/functions/fnc_getIconPath.sqf new file mode 100644 index 0000000..c6b443a --- /dev/null +++ b/addons/icons/functions/fnc_getIconPath.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3, veteran29 + * Returns path to icon corresponding to given vehicle type. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * Path to vehicle icon + * + * Public: No + */ + +params ["_vehicle"]; + +private _iconType = _vehicle getVariable ["MDL_iconPath", ""]; + +if (_iconType isNotEqualTo "") exitWith { _iconType }; + +private _vehicleInfo = [_vehicle] call EFUNC(common,getVehicleInfo); + +private _iconPath = _vehicleInfo getOrDefault [ + "iconPath", + "\A3\gui_f\data\map\markers\nato\b_unknown.paa", + true +]; + +_vehicle setVariable ["MDL_iconPath", _iconPath]; + +_iconPath diff --git a/addons/icons/functions/fnc_visibilityCheckLoop.sqf b/addons/icons/functions/fnc_visibilityCheckLoop.sqf new file mode 100644 index 0000000..0d1f073 --- /dev/null +++ b/addons/icons/functions/fnc_visibilityCheckLoop.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Loop checking all enemy units one by one. + * Switches off icons for units that no friendly unit knows about anymore. + * + * Arguments: + * 0: Targeted object + * + * Return Value: + * None + * + * Public: No + */ + +params [["_targetsToCheck", []]]; + +if (_targetsToCheck isEqualTo []) then { + _targetsToCheck = vehicles select {side effectiveCommander _x isEqualTo EAST}; +}; +if (_targetsToCheck isEqualTo []) exitWith { + [FUNC(visibilityCheckLoop), [], 5] call CBA_fnc_waitAndExecute; +}; + +private _target = _targetsToCheck deleteAt (count _targetsToCheck - 1); + +#ifdef DEV_DEBUG +diag_log format ["WARGAY DEBUG VISIBILITY CHECK [%1]: Checking Target %2", diag_tickTime, _target]; +#endif + +private _shouldBeVisible = [_target] call EFUNC(common,shouldStillBeVisible); +private _isVisible = _target getVariable ["MDL_IsVisible", false]; +if (_isVisible && {!_shouldBeVisible}) then { + #ifdef DEV_DEBUG + diag_log format ["WARGAY DEBUG VISIBILITY CHECK [%1]: Making Target %2 not visible", diag_tickTime, _target]; + #endif + _target setVariable ["MDL_IsVisible", false, false]; +}; + +[FUNC(visibilityCheckLoop), [_targetsToCheck], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/icons/functions/script_component.hpp b/addons/icons/functions/script_component.hpp new file mode 100644 index 0000000..e8f4801 --- /dev/null +++ b/addons/icons/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\icons\script_component.hpp" diff --git a/addons/icons/initSettings.inc.sqf b/addons/icons/initSettings.inc.sqf new file mode 100644 index 0000000..48f1806 --- /dev/null +++ b/addons/icons/initSettings.inc.sqf @@ -0,0 +1,79 @@ +[ + QGVAR(unitIconMode), + "LIST", + ["Unit icon mode", ""], + [LSTRING(DisplayName), LSTRING(UnitIcons)], + [[0, 1], ["All", "Enemy only"]], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(unitIconSizeDependsOnDistance), + "CHECKBOX", + [LSTRING(UnitIconSizeDependsOnDistance), LSTRING(UnitIconSizeDependsOnDistance_Description)], + [LSTRING(DisplayName), LSTRING(UnitIconsSize)], + true, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(unitIconSizeMultiplier), + "SLIDER", + [LSTRING(UnitIconSizeMultiplier), LSTRING(UnitIconSizeMultiplier_Description)], + [LSTRING(DisplayName), LSTRING(UnitIconsSize)], + [0, 10, 1, 0], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(unitIconTextSizeMultiplier), + "SLIDER", + [LSTRING(UnitIconTextSizeMultiplier), LSTRING(UnitIconTextSizeMultiplier_Description)], + [LSTRING(DisplayName), LSTRING(UnitIconsSize)], + [0, 10, 1, 0], + false +] call CBA_fnc_addSetting; + +GVAR(iconWidth) = getNumber (configFile >> "CfgInGameUI" >> "Cursor" >> "activeWidth"); +// GVAR(westIconColor) = getArray (missionConfigFile >> "CfgWargay" >> "westMarkerColor"); +// GVAR(westAiIconColor) = getArray (missionConfigFile >> "CfgWargay" >> "westAiMarkerColor"); +// GVAR(eastIconColor) = getArray (missionConfigFile >> "CfgWargay" >> "eastMarkerColor"); + +[ + QGVAR(westIconColor), + "COLOR", + ["Friendly players color", "Color used for icons of friendly player's vehicles"], + [LSTRING(DisplayName), LSTRING(UnitIcons)], + [ + 96/255, + 159/255, + 197/255, + 0.85 + ] +] call CBA_fnc_addSetting; + +[ + QGVAR(westAiIconColor), + "COLOR", + ["Friendly AI color", "Color used for icons of friendly AI's vehicles"], + [LSTRING(DisplayName), LSTRING(UnitIcons)], + [ + 29/255, + 197/255, + 46/255, + 0.85 + ] +] call CBA_fnc_addSetting; + +[ + QGVAR(eastIconColor), + "COLOR", + ["Enemy color", "Color used for icons of enemy vehicles"], + [LSTRING(DisplayName), LSTRING(UnitIcons)], + [ + 192/255, + 29/255, + 46/255, + 0.85 + ] +] call CBA_fnc_addSetting; diff --git a/addons/icons/script_component.hpp b/addons/icons/script_component.hpp new file mode 100644 index 0000000..33c7dc1 --- /dev/null +++ b/addons/icons/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT icons +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_ICONS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_ICONS + #define DEBUG_SETTINGS DEBUG_SETTINGS_ICONS +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/icons/stringtable.xml b/addons/icons/stringtable.xml new file mode 100644 index 0000000..12580f7 --- /dev/null +++ b/addons/icons/stringtable.xml @@ -0,0 +1,49 @@ + + + + + ArmaForces Wargame - Icons + ArmaForces Wargame - Icons + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Icon size depending on distance + Rozmiar znaczników zależny od odległości + + + Enables autoscaling of icon size depending on the distance to the unit. The closer the unit is, the bigger the icon gets (up to 2x the standard size when it's 50 m or closer). + Włącza skalowanie rozmiaru znaczników w zależności od odległości do jednostki. Im bliżej jest jednostka, tym większy będzie jej znacznik (do 2x normalnego rozmiaru jeżeli jest w odległości do 50 m). + + + Icon size multiplier + Mnożnik rozmiaru znaczników + + + Allows adjusting size of icons shown above known units + Pozwala dostosować rozmiar znaczników wyświetlanych nad znanymi jednostkami + + + Icon text size multiplier + Mnożnik rozmiaru tekstu znaczników + + + Allows adjusting size of text shown above targeted unit + Pozwala dostosować rozmiar tekstu wyświetlanego nad namierzoną jednostką + + + Unit Icons + Znaczniki jednostek + + + Icon size multiplier + Mnożnik rozmiaru znaczników + + + diff --git a/addons/init/$PBOPREFIX$ b/addons/init/$PBOPREFIX$ new file mode 100644 index 0000000..b48ece6 --- /dev/null +++ b/addons/init/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\init \ No newline at end of file diff --git a/addons/init/CfgEventHandlers.hpp b/addons/init/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/init/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/init/XEH_PREP.hpp b/addons/init/XEH_PREP.hpp new file mode 100644 index 0000000..39b4b28 --- /dev/null +++ b/addons/init/XEH_PREP.hpp @@ -0,0 +1,3 @@ +PREP(manInit); +PREP(vehicleInit); +PREP(vehicleSpawnerInit); diff --git a/addons/init/XEH_postInit.sqf b/addons/init/XEH_postInit.sqf new file mode 100644 index 0000000..7f7068e --- /dev/null +++ b/addons/init/XEH_postInit.sqf @@ -0,0 +1,111 @@ +#include "script_component.hpp" + +// Allow mission init to specify whether is it test run or not. +if (isNil QGVAR(isTest)) then { + GVAR(isTest) = false; +}; + +AmmoTypes = createHashMapFromArray + ("true" configClasses (configFile >> "CfgWargay" >> "Ammo") + apply { + private _hashMap = createHashMap; + _hashMap set [CLASS_NAME_PROPERTY, toUpper configName _x]; + _hashMap set [DAMAGE_PROPERTY, getNumber (_x >> DAMAGE_PROPERTY)]; + _hashMap set [TYPE_PROPERTY, getText (_x >> TYPE_PROPERTY)]; + + private _child = getText (_x >> "child"); + if (_child isNotEqualTo "") then { + _hashMap set ["child", _child]; + }; + + LOG_1("Configuration for ammo type %1 read from config",toUpper configName _x); + [toUpper configName _x, _hashMap] + }); + +VehicleTypes = createHashMapFromArray + ("true" configClasses (configFile >> "CfgWargay" >> "Vehicles") + apply { + private _hashMap = createHashMap; + _hashMap set [CLASS_NAME_PROPERTY, toUpper configName _x]; + _hashMap set ["pointCost", getNumber (_x >> "pointCost")]; + _hashMap set ["hitpoints", getNumber (_x >> "hitpoints")]; + _hashMap set ["armor", getArray (_x >> "armor")]; + _hashMap set ["iconPath", getText (_x >> "iconPath")]; + _hashMap set ["markerType", getText (_x >> "markerType")]; + _hashMap set ["isCommandVehicle", (_x >> "isCommandVehicle") call BIS_fnc_getCfgDataBool]; + _hashMap set ["isLogistics", (_x >> "isLogistics") call BIS_fnc_getCfgDataBool]; + _hashMap set ["isRecon", (_x >> "isRecon") call BIS_fnc_getCfgDataBool]; + LOG_1("Configuration for vehicle type %1 read from config",toUpper configName _x); + [toUpper configName _x, _hashMap] + }); + +private _magazinesForVehicles = VehicleTypes apply { + private _vehicleClassName = VehicleTypes get _x get CLASS_NAME_PROPERTY; + private _magazines = getArray (configFile >> "CfgVehicles" >> _vehicleClassName >> "Turrets" >> "MainTurret" >> "magazines"); + _magazines = _magazines arrayIntersect _magazines; + + private _magazinesAndAmmo = _magazines apply { + [_x, getText (configFile >> "CfgMagazines" >> _x >> "ammo")] + } apply { + [_x select 0, AmmoTypes getOrDefault [toUpper (_x select 1), objNull]] + } select { + _x select 1 isNotEqualTo objNull + }; + + _magazinesAndAmmo apply { + private _hashMap = createHashMap; + + _hashMap set [CLASS_NAME_PROPERTY, _x select 0]; + + private _ammoInfo = _x select 1; + private _child = _ammoInfo getOrDefault ["child", ""]; + if (_child isNotEqualTo "") then { + _ammoInfo = AmmoTypes get toUpper _child; + // diag_log format ["WARGAY MAGS DEBUG: %1 Has child: %2 Ammo Info: %3", _x select 0, _child, str _ammoInfo]; + }; + + _hashMap set [AMMO_PROPERTY, _ammoInfo]; + [toUpper (_x select 0), _hashMap]; + } +}; + +private _magazineTypes = []; +{ + _magazineTypes append _x; +} forEach _magazinesForVehicles; +MagazineTypes = createHashMapFromArray _magazineTypes; + +[ + "AllVehicles", + "Init", + FUNC(vehicleInit), + true, // Allow inheritance + ["Man"], // Excluded classes + true // Apply retroactive +] call CBA_fnc_addClassEventHandler; + +[ + "Man", + "Init", + FUNC(manInit), + true, // Allow inheritance + [], // Excluded classes + true // Apply retroactive +] call CBA_fnc_addClassEventHandler; + +if (GVAR(isTest)) then { + [{ + ["MDL_startGame"] call CBA_fnc_globalEvent; + }] call CBA_fnc_execNextFrame; +}; + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; +if (!hasInterface) exitWith {}; + +player addMPEventHandler ["MPKilled", { + params ["_unit", "_killer", "_instigator", "_useEffects"]; + + private _vehicle = if (vehicle player isEqualTo player) then { objNull } else { vehicle player }; + + ["MDL_playerKilled", [getPlayerUID player, player, _vehicle]] call CBA_fnc_serverEvent; +}]; diff --git a/addons/init/XEH_postInitServer.sqf b/addons/init/XEH_postInitServer.sqf new file mode 100644 index 0000000..59da299 --- /dev/null +++ b/addons/init/XEH_postInitServer.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" + +GVAR(gameStarted) = false; + +["MDL_startGame", { + if (GVAR(gameStarted)) exitWith {}; + + // TODO: Check if SoundSystems mod is loaded + private _allWargayTracks = [ + "WARGAME_EE_Preparation", + "WARGAME_EE_Campaign_Brief", + "WARGAME_EE_Tension", + "WARGAME_EE_The_Lost_Rites", + "WARGAME_RD_Keep_it_Cool", + "WARGAME_RD_Sweeping_Bass", + "WARGAME_RD_Cryptoplanets", + "WARGAME_RD_Mission_Omega", + "WARGAME_RD_The_Infiltrator", + "WARNO_Dark_City_Beats", + "WARNO_Lap_Time", + "WARNO_Mysteries", + "WARNO_Raging_Burn" + ]; + + [(_allWargayTracks call BIS_fnc_arrayShuffle)] call EFUNC(music,addToMusicQueue); + + GVAR(gameStarted) = true; +}] call CBA_fnc_addEventHandler; diff --git a/addons/init/XEH_preInit.sqf b/addons/init/XEH_preInit.sqf new file mode 100644 index 0000000..ecb5d0c --- /dev/null +++ b/addons/init/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; diff --git a/addons/init/XEH_preStart.sqf b/addons/init/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/init/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/init/config.cpp b/addons/init/config.cpp new file mode 100644 index 0000000..d821136 --- /dev/null +++ b/addons/init/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/init/functions/fnc_manInit.sqf b/addons/init/functions/fnc_manInit.sqf new file mode 100644 index 0000000..897b219 --- /dev/null +++ b/addons/init/functions/fnc_manInit.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Initializes infantry units to work with custom damage model. + * Prevents taking damage when in vehicle + * + * Arguments: + * Nonede + * + * Return Value: + * None + * + * Public: No + */ + +params ["_entity"]; + +_entity addEventHandler ["HandleDamage", EFUNC(event_handlers,handleDamageMan)]; diff --git a/addons/init/functions/fnc_vehicleInit.sqf b/addons/init/functions/fnc_vehicleInit.sqf new file mode 100644 index 0000000..580b39c --- /dev/null +++ b/addons/init/functions/fnc_vehicleInit.sqf @@ -0,0 +1,65 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Initializes vehicles to work with custom damage model. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +params ["_entity"]; + +#ifdef DEV_DEBUG +LOG_3("Init [%1]: Entity: %2, Type: %3",diag_tickTime,_entity,typeOf _entity); +#endif + +private _vehicleHitpoints = [_entity, "hitpoints"] call EFUNC(common,getVehicleInfo); +if (_vehicleHitpoints isEqualTo objNull) then { + private _defaultHitpoints = 10; + _vehicleHitpoints = _defaultHitpoints; + WARNING_2("Hitpoints not defined for %1. Setting default hitpoints %2",typeOf _entity,_defaultHitpoints); +} else { + LOG_2("Hitpoints for entity %1: %2",typeOf _entity,str _vehicleHitpoints); +}; + +_entity setVariable ["MDL_currentHp", _vehicleHitpoints]; +_entity setVariable ["MDL_maxHp", _vehicleHitpoints]; + +_entity addEventHandler ["HandleDamage", { + _this call EFUNC(event_handlers,handleDamage); +}]; +_entity addEventHandler ["HitPart", EFUNC(event_handlers,hitPart)]; +_entity addEventHandler ["Fired", EFUNC(event_handlers,fired)]; + +LOG_1("Event handlers registered for %1",_entity); + +// Increase fuel consumption for players +if (_entity getVariable ["MDL_deployedVehicle", false]) then { + private _fuelCoef = if (_entity isKindOf "Air") then { + EGVAR(refuel,fuelConsumptionMultiplier)/2 + } else { + EGVAR(refuel,fuelConsumptionMultiplier) + }; + + _entity setFuelConsumptionCoef _fuelCoef; +}; + +_entity allowCrewInImmobile true; + +if (hasInterface) then { + // TODO: Consider allowing repair only near supply vehicles + // TODO: Consider repair/rearm/refuel for all eligible vehicles in some radius (e.g., via some deployable) + [_entity] call EFUNC(repair,addRepairAction); + [_entity] call EFUNC(rearm,addRearmAction); + [_entity] call EFUNC(refuel,addRefuelAction); + + if (_entity getVariable ["MDL_isSpawner", false]) then { + [_entity] call FUNC(vehicleSpawnerInit); + LOG_1("Initialized spawner using %1",_entity); + }; +}; diff --git a/addons/init/functions/fnc_vehicleSpawnerInit.sqf b/addons/init/functions/fnc_vehicleSpawnerInit.sqf new file mode 100644 index 0000000..2e5d72a --- /dev/null +++ b/addons/init/functions/fnc_vehicleSpawnerInit.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Initializes spawner for given vehicle. + * + * Arguments: + * 0: Vehicle with spawn action + * + * Return Value: + * None + * + * Public: No + */ + +params ["_spawner"]; + +private _vehicleClass = typeOf _spawner; +private _vehicleName = [_spawner] call EFUNC(common,getVehicleDisplayName); + +_spawner addAction [ + _vehicleName, + { + params ["_target", "_caller", "", "_arguments"]; + + ["MDL_deployVehicle", [_arguments select 0, _caller, _target]] call CBA_fnc_serverEvent; + }, + [_vehicleClass] +]; diff --git a/addons/init/functions/script_component.hpp b/addons/init/functions/script_component.hpp new file mode 100644 index 0000000..7dcac22 --- /dev/null +++ b/addons/init/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\init\script_component.hpp" diff --git a/addons/init/script_component.hpp b/addons/init/script_component.hpp new file mode 100644 index 0000000..90f3182 --- /dev/null +++ b/addons/init/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT init +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_INIT + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_INIT + #define DEBUG_SETTINGS DEBUG_SETTINGS_INIT +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/init/stringtable.xml b/addons/init/stringtable.xml new file mode 100644 index 0000000..8d99057 --- /dev/null +++ b/addons/init/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Init + ArmaForces Wargame - Init + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 23a8203..50317b0 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -22,6 +22,13 @@ // AFWG macros #define IS_MOD_LOADED(modclass) (isClass (configFile >> "CfgPatches" >> #modclass)) +#define AMMO_PROPERTY "ammo" +#define CLASS_NAME_PROPERTY "className" +#define DAMAGE_PROPERTY "damage" +#define DISPLAY_NAME_PROPERTY "displayName" +#define TYPE_PROPERTY "type" +#define MAX_HP 10 +#define NO_ARMOR [0, 0, 0, 0] // Extension macros #define EXT "armaforces_wargame" diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 2c7a696..b1f63a7 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -14,3 +14,7 @@ #else #define COMPONENT_NAME QUOTE(AFWG - COMPONENT) #endif + +// Global DEBUG +// #define DEV_DEBUG +// #define DEBUG_MODE_FULL diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index 960a5de..e93dced 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,3 +1,3 @@ -#define MAJOR 1 -#define MINOR 17 -#define PATCH 0 +#define MAJOR 0 +#define MINOR 1 +#define PATCH 1 diff --git a/addons/main/stringtable.xml b/addons/main/stringtable.xml index 2d0c603..027ca2f 100644 --- a/addons/main/stringtable.xml +++ b/addons/main/stringtable.xml @@ -2,14 +2,18 @@ - ArmaForces Attributes - Atrybuty ArmaForces + Arma Wargame Attributes + Atrybuty Arma Wargame - ArmaForces + Armas Wargame + + + Arma Wargame + Arma Wargame - ArmaForces + Arma Wargame Wiki diff --git a/addons/markers/$PBOPREFIX$ b/addons/markers/$PBOPREFIX$ new file mode 100644 index 0000000..5cd41e8 --- /dev/null +++ b/addons/markers/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\markers \ No newline at end of file diff --git a/addons/markers/CfgEventHandlers.hpp b/addons/markers/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/markers/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/markers/CfgMarkers.hpp b/addons/markers/CfgMarkers.hpp new file mode 100644 index 0000000..d8a5581 --- /dev/null +++ b/addons/markers/CfgMarkers.hpp @@ -0,0 +1,160 @@ +// TODO: Proper stringtable for marker names +// TODO: Separate markerClass +// TODO: Change marker classes to include mod prefix +class CfgMarkers +{ + class b_antiair_spaag_radar + { + scope = 2; + name = "b_antiair_spaag_radar"; + icon = QPATHTOF(assets\b_antiair_spaag_radar.paa); + texture = QPATHTOF(assets\b_antiair_spaag_radar.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_antiair_spaag + { + scope = 2; + name = "b_antiair_spaag"; + icon = QPATHTOF(assets\b_antiair_spaag.paa); + texture = QPATHTOF(assets\b_antiair_spaag.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_antitank_armor + { + scope = 2; + name = "b_antitank_armor"; + icon = QPATHTOF(assets\b_antitank_armor.paa); + texture = QPATHTOF(assets\b_antitank_armor.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_antitank + { + scope = 2; + name = "b_antitank"; + icon = QPATHTOF(assets\b_antitank.paa); + texture = QPATHTOF(assets\b_antitank.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_art_rocket + { + scope = 2; + name = "b_art_rocket"; + icon = QPATHTOF(assets\b_art_rocket.paa); + texture = QPATHTOF(assets\b_art_rocket.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_cv_armor + { + scope = 2; + name = "b_cv_armor"; + icon = QPATHTOF(assets\b_cv_armor.paa); + texture = QPATHTOF(assets\b_cv_armor.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_cv + { + scope = 2; + name = "b_cv"; + icon = QPATHTOF(assets\b_cv.paa); + texture = QPATHTOF(assets\b_cv.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_mech_inf_armed + { + scope = 2; + name = "b_mech_inf_armed"; + icon = QPATHTOF(assets\b_mech_inf_armed.paa); + texture = QPATHTOF(assets\b_mech_inf_armed.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_recon_air + { + scope = 2; + name = "b_recon_air"; + icon = QPATHTOF(assets\b_recon_air.paa); + texture = QPATHTOF(assets\b_recon_air.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_recon_antitank + { + scope = 2; + name = "b_recon_antitank"; + icon = QPATHTOF(assets\b_recon_antitank.paa); + texture = QPATHTOF(assets\b_recon_antitank.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + + class b_recon_armor + { + scope = 2; + name = "b_recon_armor"; + icon = QPATHTOF(assets\b_recon_armor.paa); + texture = QPATHTOF(assets\b_recon_armor.paa); + color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"}; + markerClass = "NATO_BLUFOR"; + shadow = 0; + side = 1; + size = 29; + showEditorMarkerColor = 1; + }; + +}; diff --git a/addons/markers/XEH_PREP.hpp b/addons/markers/XEH_PREP.hpp new file mode 100644 index 0000000..adc2683 --- /dev/null +++ b/addons/markers/XEH_PREP.hpp @@ -0,0 +1,3 @@ +PREP(createVehicleMarker); +PREP(enemyMarkersLoop); +PREP(removeVehicleMarker); diff --git a/addons/markers/XEH_postInit.sqf b/addons/markers/XEH_postInit.sqf new file mode 100644 index 0000000..977eae9 --- /dev/null +++ b/addons/markers/XEH_postInit.sqf @@ -0,0 +1,12 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +[FUNC(enemyMarkersLoop)] call afm_common_fnc_runAfterSettingsInit; + +// TODO: Consider moving this to the same component that triggers the event +["MDL_unitSpotted", { + params ["_unit"]; + if (_unit isKindOf "Man") exitWith {}; + [_unit] call FUNC(createVehicleMarker); +}] call CBA_fnc_addEventHandler; diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/markers/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/markers/XEH_preStart.sqf b/addons/markers/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/markers/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/markers/assets/b_antiair_spaag.paa b/addons/markers/assets/b_antiair_spaag.paa new file mode 100644 index 0000000..4aaf315 Binary files /dev/null and b/addons/markers/assets/b_antiair_spaag.paa differ diff --git a/addons/markers/assets/b_antiair_spaag_radar.paa b/addons/markers/assets/b_antiair_spaag_radar.paa new file mode 100644 index 0000000..4b4f176 Binary files /dev/null and b/addons/markers/assets/b_antiair_spaag_radar.paa differ diff --git a/addons/markers/assets/b_antitank.paa b/addons/markers/assets/b_antitank.paa new file mode 100644 index 0000000..88fd194 Binary files /dev/null and b/addons/markers/assets/b_antitank.paa differ diff --git a/addons/markers/assets/b_antitank_armor.paa b/addons/markers/assets/b_antitank_armor.paa new file mode 100644 index 0000000..0cb16de Binary files /dev/null and b/addons/markers/assets/b_antitank_armor.paa differ diff --git a/addons/markers/assets/b_art_rocket.paa b/addons/markers/assets/b_art_rocket.paa new file mode 100644 index 0000000..e6090f8 Binary files /dev/null and b/addons/markers/assets/b_art_rocket.paa differ diff --git a/addons/markers/assets/b_cv.paa b/addons/markers/assets/b_cv.paa new file mode 100644 index 0000000..cc7d212 Binary files /dev/null and b/addons/markers/assets/b_cv.paa differ diff --git a/addons/markers/assets/b_cv_armor.paa b/addons/markers/assets/b_cv_armor.paa new file mode 100644 index 0000000..7084368 Binary files /dev/null and b/addons/markers/assets/b_cv_armor.paa differ diff --git a/addons/markers/assets/b_mech_inf_armed.paa b/addons/markers/assets/b_mech_inf_armed.paa new file mode 100644 index 0000000..4e36092 Binary files /dev/null and b/addons/markers/assets/b_mech_inf_armed.paa differ diff --git a/addons/markers/assets/b_recon_air.paa b/addons/markers/assets/b_recon_air.paa new file mode 100644 index 0000000..c65f3d2 Binary files /dev/null and b/addons/markers/assets/b_recon_air.paa differ diff --git a/addons/markers/assets/b_recon_antitank.paa b/addons/markers/assets/b_recon_antitank.paa new file mode 100644 index 0000000..8eed3e8 Binary files /dev/null and b/addons/markers/assets/b_recon_antitank.paa differ diff --git a/addons/markers/assets/b_recon_armor.paa b/addons/markers/assets/b_recon_armor.paa new file mode 100644 index 0000000..9d835d8 Binary files /dev/null and b/addons/markers/assets/b_recon_armor.paa differ diff --git a/addons/markers/config.cpp b/addons/markers/config.cpp new file mode 100644 index 0000000..01429aa --- /dev/null +++ b/addons/markers/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgMarkers.hpp" diff --git a/addons/markers/functions/fnc_createVehicleMarker.sqf b/addons/markers/functions/fnc_createVehicleMarker.sqf new file mode 100644 index 0000000..a828482 --- /dev/null +++ b/addons/markers/functions/fnc_createVehicleMarker.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Creates local marker for given vehicle. + * + * Arguments: + * 0: Vehicle to create marker for + * + * Return Value: + * Name of the created marker + * + * Public: No + */ + +params ["_vehicle"]; + +_markerName = format ["MDL_EnemyVehicle_%1", str _vehicle]; +createMarkerLocal [_markerName, getPosATL _vehicle]; +_vehicle setVariable ["MDL_marker", _markerName]; + +_markerName setMarkerColorLocal "ColorEAST"; +_markerName setMarkerSizeLocal [0.7, 0.7]; + +private _markerType = _vehicle getVariable ["MDL_markerType", ""]; +if (_markerType isEqualTo "") then { + _markerType = [_vehicle, "markerType"] call EFUNC(common,getVehicleInfo); + _vehicle setVariable ["MDL_markerType", _markerType]; +}; +_markerName setMarkerTypeLocal _markerType; + +_markerName diff --git a/addons/markers/functions/fnc_enemyMarkersLoop.sqf b/addons/markers/functions/fnc_enemyMarkersLoop.sqf new file mode 100644 index 0000000..f85d0b6 --- /dev/null +++ b/addons/markers/functions/fnc_enemyMarkersLoop.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * + * + * Arguments: + * + * + * Return Value: + * None + * + * Public: No + */ + +if (!GVAR(enemyMarkersEnabled)) exitWith { + [FUNC(enemyMarkersLoop), [], GVAR(enemyMarkersRefreshRate)] call CBA_fnc_waitAndExecute; +}; + +private _vehiclesWithMarkers = vehicles select {_x getVariable ["MDL_IsVisible", false] + && {side effectiveCommander _x isEqualTo EAST}}; + +private _vehiclesToRemoveMarkers = vehicles select {(_x getVariable ["MDL_marker", ""] isNotEqualTo "") + && {!(_x getVariable ["MDL_IsVisible", false])}}; + +{ + private _markerName = _x getVariable ["MDL_marker", ""]; + if (_markerName isEqualTo "") then { + [_x] call FUNC(createVehicleMarker); + } else { + _markerName setMarkerPosLocal (getPosASL _x); + }; +} forEach _vehiclesWithMarkers; + +{ + [_x] call FUNC(removeVehicleMarker); +} forEach _vehiclesToRemoveMarkers; + +[FUNC(enemyMarkersLoop), [], GVAR(enemyMarkersRefreshRate)] call CBA_fnc_waitAndExecute; diff --git a/addons/markers/functions/fnc_removeVehicleMarker.sqf b/addons/markers/functions/fnc_removeVehicleMarker.sqf new file mode 100644 index 0000000..e22dc88 --- /dev/null +++ b/addons/markers/functions/fnc_removeVehicleMarker.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * + * + * Arguments: + * + * + * Return Value: + * None + * + * Public: No + */ + +params ["_vehicle"]; + +private _markerName = _vehicle getVariable ["MDL_marker", ""]; +if (_markerName isEqualTo "") exitWith {}; + +deleteMarkerLocal _markerName; +_vehicle setVariable ["MDL_marker", nil]; diff --git a/addons/markers/functions/script_component.hpp b/addons/markers/functions/script_component.hpp new file mode 100644 index 0000000..348e9c8 --- /dev/null +++ b/addons/markers/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\markers\script_component.hpp" diff --git a/addons/markers/initSettings.inc.sqf b/addons/markers/initSettings.inc.sqf new file mode 100644 index 0000000..0c6b8aa --- /dev/null +++ b/addons/markers/initSettings.inc.sqf @@ -0,0 +1,17 @@ +[ + QGVAR(enemyMarkersEnabled), + "CHECKBOX", + ["Enable map markers enemies", "If enabled, map markers will be show for spotted enemy units (icons might look different on map vs in-game)."], + [LSTRING(DisplayName), ELSTRING(icons,UnitIcons)], + true, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(enemyMarkersRefreshRate), + "TIME", + ["Refresh rate for enemy markers", "Controls how often map markers for enemies should refresh."], + [LSTRING(DisplayName), ELSTRING(icons,UnitIcons)], + [0, 60, 5], + true +] call CBA_fnc_addSetting; diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp new file mode 100644 index 0000000..4c8b16f --- /dev/null +++ b/addons/markers/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT markers +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_MARKERS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_MARKERS + #define DEBUG_SETTINGS DEBUG_SETTINGS_MARKERS +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml new file mode 100644 index 0000000..83fb694 --- /dev/null +++ b/addons/markers/stringtable.xml @@ -0,0 +1,17 @@ + + + + + ArmaForces Wargame - Markers + ArmaForces Wargame - Markers + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/music/$PBOPREFIX$ b/addons/music/$PBOPREFIX$ new file mode 100644 index 0000000..20d4283 --- /dev/null +++ b/addons/music/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\music \ No newline at end of file diff --git a/addons/music/CfgEventHandlers.hpp b/addons/music/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/music/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/music/CfgSounds.hpp b/addons/music/CfgSounds.hpp new file mode 100644 index 0000000..0554a2e --- /dev/null +++ b/addons/music/CfgSounds.hpp @@ -0,0 +1,10 @@ +class CfgSounds +{ + class MDL_Wargay_Alarm + { + name = "Wargay alarm"; + // BUG: Possible bug with path not existing on clients (use getMissionPath) + sound[] = { QPATHTOF(assets\wargay-alarm.ogg), 4, 1 }; + titles[] = { 0, CSTRING(DamageReceived) }; + }; +}; diff --git a/addons/music/XEH_PREP.hpp b/addons/music/XEH_PREP.hpp new file mode 100644 index 0000000..09a55e4 --- /dev/null +++ b/addons/music/XEH_PREP.hpp @@ -0,0 +1,4 @@ +PREP(addToMusicQueue); +PREP(isMusicPlaying); +PREP(isMusicQueueEmpty); +PREP(playNextMusic); diff --git a/addons/music/XEH_postInit.sqf b/addons/music/XEH_postInit.sqf new file mode 100644 index 0000000..cb7ffc5 --- /dev/null +++ b/addons/music/XEH_postInit.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; +if (!hasInterface) exitWith {}; + +// TODO: Automatic queue of Wargame tracks if proper mod is loaded + +GVAR(isSoundPlaying) = false; + +addMusicEventHandler ["MusicStop", { + [EFUNC(music,playNextMusic), [], random 15] call CBA_fnc_waitAndExecute; +}]; + +["MDL_applyDamage", { + params ["_unit"]; + + if (GVAR(damageAlarmEnabled) && {_unit isEqualTo vehicle player} && {!GVAR(isSoundPlaying)}) then { + GVAR(isSoundPlaying) = true; + playSound ["MDL_Wargay_Alarm", 2]; + [{ + GVAR(isSoundPlaying) = false; + }, [], 4] call CBA_fnc_waitAndExecute; + }; +}] call CBA_fnc_addEventHandler; diff --git a/addons/music/XEH_postInitServer.sqf b/addons/music/XEH_postInitServer.sqf new file mode 100644 index 0000000..308c3bf --- /dev/null +++ b/addons/music/XEH_postInitServer.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +GVAR(musicQueue) = []; diff --git a/addons/music/XEH_preInit.sqf b/addons/music/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/music/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/music/XEH_preStart.sqf b/addons/music/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/music/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/music/assets/wargay-alarm.ogg b/addons/music/assets/wargay-alarm.ogg new file mode 100644 index 0000000..bdd277c Binary files /dev/null and b/addons/music/assets/wargay-alarm.ogg differ diff --git a/addons/music/config.cpp b/addons/music/config.cpp new file mode 100644 index 0000000..200d360 --- /dev/null +++ b/addons/music/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgSounds.hpp" +// TODO: Add wargay music oggs +// TOOD: Add Wargay alarm sound diff --git a/addons/music/functions/fnc_addToMusicQueue.sqf b/addons/music/functions/fnc_addToMusicQueue.sqf new file mode 100644 index 0000000..8f08f67 --- /dev/null +++ b/addons/music/functions/fnc_addToMusicQueue.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Adds given music to the queue. + * Allows forcing to play it immediately. + * + * Arguments: + * 0: Class(es) of the music to add > + * 1: Force playing now (Default: false) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_music", ["_forceNow", false]]; + +if (!isServer) exitWith {}; + +if (_forceNow) exitWith { + _music remoteExec ["playMusic", 0]; +}; + +if (_music isEqualType "") then { + GVAR(musicQueue) pushBack _music; +} else { + GVAR(musicQueue) append _music; +}; + +[FUNC(playNextMusic)] call CBA_fnc_execNextFrame; diff --git a/addons/music/functions/fnc_isMusicPlaying.sqf b/addons/music/functions/fnc_isMusicPlaying.sqf new file mode 100644 index 0000000..e3334a3 --- /dev/null +++ b/addons/music/functions/fnc_isMusicPlaying.sqf @@ -0,0 +1,15 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks whether there is currently music playing. + * + * Arguments: + * None + * + * Return Value: + * True if music is playing + * + * Public: No + */ + +getMusicPlayedTime isNotEqualTo 0 diff --git a/addons/music/functions/fnc_isMusicQueueEmpty.sqf b/addons/music/functions/fnc_isMusicQueueEmpty.sqf new file mode 100644 index 0000000..2d6c734 --- /dev/null +++ b/addons/music/functions/fnc_isMusicQueueEmpty.sqf @@ -0,0 +1,15 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks whether play queue is empty. + * + * Arguments: + * None + * + * Return Value: + * True if nothing is queued to be played. + * + * Public: No + */ + +count GVAR(musicQueue) isEqualTo 0 diff --git a/addons/music/functions/fnc_playNextMusic.sqf b/addons/music/functions/fnc_playNextMusic.sqf new file mode 100644 index 0000000..a45cbad --- /dev/null +++ b/addons/music/functions/fnc_playNextMusic.sqf @@ -0,0 +1,20 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Plays next music from the queue. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +if (!isServer) exitWith {}; + +if (call FUNC(isMusicQueueEmpty) || FUNC(isMusicPlaying)) exitWith {}; + +private _nextTrack = GVAR(musicQueue) deleteAt 0; +_nextTrack remoteExec ["playMusic", 0]; diff --git a/addons/music/functions/script_component.hpp b/addons/music/functions/script_component.hpp new file mode 100644 index 0000000..2ba53f0 --- /dev/null +++ b/addons/music/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\music\script_component.hpp" diff --git a/addons/music/initSettings.inc.sqf b/addons/music/initSettings.inc.sqf new file mode 100644 index 0000000..af36bf4 --- /dev/null +++ b/addons/music/initSettings.inc.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(damageAlarmEnabled), + "CHECKBOX", + [LSTRING(DamageAlarmEnabled), LSTRING(DamageAlarmEnabled_Description)], + [LSTRING(DisplayName)], + true, + false +] call CBA_fnc_addSetting; diff --git a/addons/music/script_component.hpp b/addons/music/script_component.hpp new file mode 100644 index 0000000..f0e78ae --- /dev/null +++ b/addons/music/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT music +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_MUSIC + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_MUSIC + #define DEBUG_SETTINGS DEBUG_SETTINGS_MUSIC +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/music/stringtable.xml b/addons/music/stringtable.xml new file mode 100644 index 0000000..e53dca7 --- /dev/null +++ b/addons/music/stringtable.xml @@ -0,0 +1,29 @@ + + + + + Damage alarm + Alarm o uszkodzeniach + + + Audible alarm when your vehicle gets damaged. + Alarm dźwiękowy gdy Twój pojazd zostanie uszkodzony. + + + Damage received + Otrzymano uszkodzenia + + + ArmaForces Wargame - Music + ArmaForces Wargame - Music + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + diff --git a/addons/rearm/$PBOPREFIX$ b/addons/rearm/$PBOPREFIX$ new file mode 100644 index 0000000..36a5e65 --- /dev/null +++ b/addons/rearm/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\rearm \ No newline at end of file diff --git a/addons/rearm/CfgEventHandlers.hpp b/addons/rearm/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/rearm/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/rearm/XEH_PREP.hpp b/addons/rearm/XEH_PREP.hpp new file mode 100644 index 0000000..54ccb41 --- /dev/null +++ b/addons/rearm/XEH_PREP.hpp @@ -0,0 +1,5 @@ +PREP(addRearmAction); +PREP(canRearm); +PREP(completeRearm); +PREP(interruptedRearm); +PREP(rearmVehicle); diff --git a/addons/rearm/XEH_postInit.sqf b/addons/rearm/XEH_postInit.sqf new file mode 100644 index 0000000..320473f --- /dev/null +++ b/addons/rearm/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (isServer) exitWith {}; + +["MDL_rearmVehicle", FUNC(rearmVehicle)] call CBA_fnc_addEventHandler; diff --git a/addons/rearm/XEH_preInit.sqf b/addons/rearm/XEH_preInit.sqf new file mode 100644 index 0000000..ecb5d0c --- /dev/null +++ b/addons/rearm/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; diff --git a/addons/rearm/XEH_preStart.sqf b/addons/rearm/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/rearm/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/rearm/config.cpp b/addons/rearm/config.cpp new file mode 100644 index 0000000..2949b60 --- /dev/null +++ b/addons/rearm/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/rearm/functions/fnc_addRearmAction.sqf b/addons/rearm/functions/fnc_addRearmAction.sqf new file mode 100644 index 0000000..1ac3df4 --- /dev/null +++ b/addons/rearm/functions/fnc_addRearmAction.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Creates rearm action for given entity. + * + * Arguments: + * 0: Unit to add rearm action to + * + * Return Value: + * None + * + * Public: No + */ + +params ["_entity"]; + +// TODO For never: Rearming one by one/mag by mag +[ + _entity, + localize "str_state_rearm", + "\A3\ui_f\data\igui\cfg\simpleTasks\types\rearm_ca.paa", + "\A3\ui_f\data\igui\cfg\simpleTasks\types\rearm_ca.paa", + QUOTE([ARR_2(_this,_target)] call FUNC(canRearm)), // Condition show + QUOTE([ARR_2(_this,_target)] call FUNC(canRearm)), // Condition progress + {}, // Code start + {}, // Code progress + FUNC(completeRearm), // Code completed + FUNC(interruptedRearm), // Code interrupted, + [], // Arguments + 20, // Duration (will be changed by codeStart) + 299, // Priority + false // Remove completed +] call BIS_fnc_holdActionAdd; diff --git a/addons/rearm/functions/fnc_canRearm.sqf b/addons/rearm/functions/fnc_canRearm.sqf new file mode 100644 index 0000000..37ab29c --- /dev/null +++ b/addons/rearm/functions/fnc_canRearm.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if caller can rearm target. + * + * Arguments: + * 0: Unit + * + * Return Value: + * True if unit is an engineer + * + * Public: No + */ + +params ["_caller", "_target"]; + +alive _target && { + _caller call EFUNC(common,isEngineer) && { + vehicle _caller isEqualTo _caller && { + _caller distance _target < 5 && { + ((_target getVariable ["MDL_lastCombatActive", -GVAR(repairMinNoCombatTime)]) + GVAR(repairMinNoCombatTime)) < CBA_missionTime +}}}} diff --git a/addons/rearm/functions/fnc_completeRearm.sqf b/addons/rearm/functions/fnc_completeRearm.sqf new file mode 100644 index 0000000..73b219a --- /dev/null +++ b/addons/rearm/functions/fnc_completeRearm.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Completes repair fully repairing vehicle + * + * Arguments: + * 0: Unit being repaired + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +["MDL_rearmVehicle", [_target, 1]] call CBA_fnc_globalEvent; +systemChat LLSTRING(RearmFinished); diff --git a/addons/rearm/functions/fnc_interruptedRearm.sqf b/addons/rearm/functions/fnc_interruptedRearm.sqf new file mode 100644 index 0000000..4901bab --- /dev/null +++ b/addons/rearm/functions/fnc_interruptedRearm.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles rearm process interruption. + * + * Arguments: + * 0: Unit being rearmed (not anymore) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +private _lastCombatActive = _target getVariable ["MDL_lastCombatActive", -GVAR(repairMinNoCombatTime)]; +if (_lastCombatActive + GVAR(repairMinNoCombatTime) > CBA_missionTime) exitWith { + systemChat LELSTRING(Common,VehicleInCombat); +}; + +systemChat LLSTRING(RearmInterrupted); diff --git a/addons/rearm/functions/fnc_rearmVehicle.sqf b/addons/rearm/functions/fnc_rearmVehicle.sqf new file mode 100644 index 0000000..731a74f --- /dev/null +++ b/addons/rearm/functions/fnc_rearmVehicle.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles rearming vehicle. + * + * Arguments: + * 0: Vehicle to rearm + * 1: New ammo amount 0-1 + * + * Return Value: + * None + * + * Public: No + */ + +params ["_vehicle", ["_ammo", 1]]; + +_vehicle setVehicleAmmo _ammo; diff --git a/addons/rearm/functions/script_component.hpp b/addons/rearm/functions/script_component.hpp new file mode 100644 index 0000000..18831a1 --- /dev/null +++ b/addons/rearm/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\rearm\script_component.hpp" diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp new file mode 100644 index 0000000..2316d1d --- /dev/null +++ b/addons/rearm/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT rearm +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_REARM + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_REARM + #define DEBUG_SETTINGS DEBUG_SETTINGS_REARM +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml new file mode 100644 index 0000000..c9108e6 --- /dev/null +++ b/addons/rearm/stringtable.xml @@ -0,0 +1,25 @@ + + + + + ArmaForces Wargame - Rearm + ArmaForces Wargame - Rearm + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Rearm finished + Przezbrojenie zakończone + + + Rearm interrupted + Przezbrojenie przerwane + + + diff --git a/addons/refuel/$PBOPREFIX$ b/addons/refuel/$PBOPREFIX$ new file mode 100644 index 0000000..a68b92c --- /dev/null +++ b/addons/refuel/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\refuel \ No newline at end of file diff --git a/addons/refuel/CfgEventHandlers.hpp b/addons/refuel/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/refuel/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/refuel/XEH_PREP.hpp b/addons/refuel/XEH_PREP.hpp new file mode 100644 index 0000000..21b5a2b --- /dev/null +++ b/addons/refuel/XEH_PREP.hpp @@ -0,0 +1,7 @@ +PREP(addRefuelAction); +PREP(canRefuel); +PREP(completeRefuel); +PREP(interruptedRefuel); +PREP(progressRefuel); +PREP(refuelVehicle); +PREP(startRefuel); diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf new file mode 100644 index 0000000..0ff39e0 --- /dev/null +++ b/addons/refuel/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (isServer) exitWith {}; + +["MDL_refuelVehicle", FUNC(refuelVehicle)] call CBA_fnc_addEventHandler; diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/refuel/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/refuel/XEH_preStart.sqf b/addons/refuel/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/refuel/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp new file mode 100644 index 0000000..2949b60 --- /dev/null +++ b/addons/refuel/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/refuel/functions/fnc_addRefuelAction.sqf b/addons/refuel/functions/fnc_addRefuelAction.sqf new file mode 100644 index 0000000..642cdda --- /dev/null +++ b/addons/refuel/functions/fnc_addRefuelAction.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Creates refuel action for given entity. + * + * Arguments: + * 0: Unit to add refuel action to + * + * Return Value: + * None + * + * Public: No + */ + +params ["_entity"]; + +[ + _entity, + localize "str_state_refuel", + "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\refuel_ca.paa", + "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\refuel_ca.paa", + QUOTE([ARR_2(_this,_target)] call FUNC(canRefuel)), // Condition show + QUOTE([ARR_2(_this,_target)] call FUNC(canRefuel)), // Condition progress + FUNC(startRefuel), // Code start + FUNC(progressRefuel), // Code progress + FUNC(completeRefuel), // Code completed + FUNC(interruptedRefuel), // Code interrupted, + [], // Arguments + 1, // Duration (will be changed by codeStart) + 298, // Priority + false // Remove completed +] call BIS_fnc_holdActionAdd; diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf new file mode 100644 index 0000000..dc376a3 --- /dev/null +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if caller can repair target. + * + * Arguments: + * 0: Unit + * + * Return Value: + * True if unit is an engineer + * + * Public: No + */ + +params ["_caller", "_target"]; + +alive _target && { + _caller call EFUNC(common,isEngineer) && { + vehicle _caller isEqualTo _caller && { + _caller distance _target < 5 && { + fuel _target < 1 && { + ((_target getVariable ["MDL_lastCombatActive", -GVAR(repairMinNoCombatTime)]) + GVAR(repairMinNoCombatTime)) < CBA_missionTime +}}}}} diff --git a/addons/refuel/functions/fnc_completeRefuel.sqf b/addons/refuel/functions/fnc_completeRefuel.sqf new file mode 100644 index 0000000..984a275 --- /dev/null +++ b/addons/refuel/functions/fnc_completeRefuel.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Completes refueling fully fueling vehicle + * + * Arguments: + * 0: Unit being refueled + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; +["MDL_refuelVehicle", [_target, 1]] call CBA_fnc_globalEvent; +systemChat LLSTRING(RefuelFinished); diff --git a/addons/refuel/functions/fnc_interruptedRefuel.sqf b/addons/refuel/functions/fnc_interruptedRefuel.sqf new file mode 100644 index 0000000..c287021 --- /dev/null +++ b/addons/refuel/functions/fnc_interruptedRefuel.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles refuel process interruption. + * + * Arguments: + * 0: Unit being refueled (not anymore) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +private _currentFuel = fuel _target * 100; + +private _lastCombatActive = _target getVariable ["MDL_lastCombatActive", -GVAR(repairMinNoCombatTime)]; +if (_lastCombatActive + GVAR(repairMinNoCombatTime) > CBA_missionTime) exitWith { + systemChat LELSTRING(Common,VehicleInCombat); +}; + +systemChat format [LLSTRING(RefuelInterrupted), _currentFuel]; diff --git a/addons/refuel/functions/fnc_progressRefuel.sqf b/addons/refuel/functions/fnc_progressRefuel.sqf new file mode 100644 index 0000000..39a57e4 --- /dev/null +++ b/addons/refuel/functions/fnc_progressRefuel.sqf @@ -0,0 +1,35 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles refuel progress + * + * Arguments: + * 0: Unit being refueled + * 1: Unit commencing refueling + * 4: Current progress frame + * 5: Max progress frame (should be 24) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target", "_caller", "_actionId", "_arguments", "_frame", "_maxFrame"]; + +private _stepsWithRefuel = _target getVariable ["MDL_refuelAtSteps", []]; +if (_stepsWithRefuel isEqualTo []) exitWith {}; + +private _nextRefuelStep = _stepsWithRefuel select (count _stepsWithRefuel - 1); + +if (_frame > _nextRefuelStep) then { + // For display purposes only + private _newFuel = fuel _target + REFUEL_AMOUNT; + private _newFuelPercent = (_newFuel*100) min 100; + systemChat format [LLSTRING(RefuelProgress), _newFuelPercent]; + + // Actual refueling + ["MDL_refuelVehicle", [_target, _newFuel]] call CBA_fnc_globalEvent; + + _stepsWithRefuel deleteAt (count _stepsWithRefuel - 1); +}; diff --git a/addons/refuel/functions/fnc_refuelVehicle.sqf b/addons/refuel/functions/fnc_refuelVehicle.sqf new file mode 100644 index 0000000..a2726b6 --- /dev/null +++ b/addons/refuel/functions/fnc_refuelVehicle.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles refueling vehicle. + * + * Arguments: + * 0: Vehicle to refuel + * 1: New fuel amount 0-1 + * + * Return Value: + * None + * + * Public: No + */ + +params ["_vehicle", ["_fuel", 1]]; + +_vehicle setFuel _fuel; diff --git a/addons/refuel/functions/fnc_startRefuel.sqf b/addons/refuel/functions/fnc_startRefuel.sqf new file mode 100644 index 0000000..9673805 --- /dev/null +++ b/addons/refuel/functions/fnc_startRefuel.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles repair start. + * + * Arguments: + * 0: Unit being repaired + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +private _currentFuel = fuel _target; +private _actualDuration = (1 - _currentFuel) * REFUEL_SECONDS_FULL; +// TODO: Shorten duration based on unit skill +// TODO: Check acutal fuel capacity + +// Please forgive me for magically changing variable from unknown outer scope +_duration = _actualDuration; + +// Determine at which steps we want to repair +#define MAX_FRAME 24 +private _stepsToFullRefuel = ceil ((1 - _currentFuel)/REFUEL_AMOUNT); +private _refuelEvery = MAX_FRAME / _stepsToFullRefuel; +private _lastRefuel = MAX_FRAME; +private _stepsWithRefuel = []; + +systemChat format ["Duration: %1, Refuel every: %2", _duration, _refuelEvery]; +while {(_stepsToFullRefuel - 1) > count _stepsWithRefuel} do { + _lastRefuel = _lastRefuel - _refuelEvery; + _stepsWithRefuel pushBack (_lastRefuel); +}; + +_target setVariable ["MDL_refuelAtSteps", _stepsWithRefuel]; diff --git a/addons/refuel/functions/script_component.hpp b/addons/refuel/functions/script_component.hpp new file mode 100644 index 0000000..8b0430e --- /dev/null +++ b/addons/refuel/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\refuel\script_component.hpp" diff --git a/addons/refuel/initSettings.inc.sqf b/addons/refuel/initSettings.inc.sqf new file mode 100644 index 0000000..a59a2f5 --- /dev/null +++ b/addons/refuel/initSettings.inc.sqf @@ -0,0 +1,2 @@ + +GVAR(fuelConsumptionMultiplier) = 4; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp new file mode 100644 index 0000000..cf8b5fa --- /dev/null +++ b/addons/refuel/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT refuel +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_REFUEL + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_REFUEL + #define DEBUG_SETTINGS DEBUG_SETTINGS_REFUEL +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" + +// Component specific macros +#define REFUEL_AMOUNT 0.05 +#define REFUEL_SECONDS_FULL 50 diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml new file mode 100644 index 0000000..c7eba12 --- /dev/null +++ b/addons/refuel/stringtable.xml @@ -0,0 +1,29 @@ + + + + + ArmaForces Wargame - Refuel + ArmaForces Wargame - Refuel + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Refuel finished + Tankowanie zakończone + + + Refuel interrupted %1 percent + Tankowanie przerwane %1 procent + + + Refuel progress %1 percent + Postęp tankowania %1 procent + + + diff --git a/addons/repair/$PBOPREFIX$ b/addons/repair/$PBOPREFIX$ new file mode 100644 index 0000000..9181fb5 --- /dev/null +++ b/addons/repair/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\repair \ No newline at end of file diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/repair/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/repair/XEH_PREP.hpp b/addons/repair/XEH_PREP.hpp new file mode 100644 index 0000000..97fa3ea --- /dev/null +++ b/addons/repair/XEH_PREP.hpp @@ -0,0 +1,7 @@ +PREP(addRepairAction); +PREP(canRepair); +PREP(completeRepair); +PREP(healDamage); +PREP(interruptedRepair); +PREP(progressRepair); +PREP(startRepair); diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf new file mode 100644 index 0000000..724d5c7 --- /dev/null +++ b/addons/repair/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; diff --git a/addons/repair/XEH_postInitServer.sqf b/addons/repair/XEH_postInitServer.sqf new file mode 100644 index 0000000..474f8a6 --- /dev/null +++ b/addons/repair/XEH_postInitServer.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["MDL_healDamage", FUNC(healDamage)] call CBA_fnc_addEventHandler; diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf new file mode 100644 index 0000000..6706cf8 --- /dev/null +++ b/addons/repair/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.inc.sqf" + +ADDON = true; diff --git a/addons/repair/XEH_preStart.sqf b/addons/repair/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/repair/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp new file mode 100644 index 0000000..2949b60 --- /dev/null +++ b/addons/repair/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_common" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/repair/functions/fnc_addRepairAction.sqf b/addons/repair/functions/fnc_addRepairAction.sqf new file mode 100644 index 0000000..541a3b0 --- /dev/null +++ b/addons/repair/functions/fnc_addRepairAction.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Creates repair action for given entity. + * + * Arguments: + * 0: Unit to add repair action to + * + * Return Value: + * None + * + * Public: No + */ + +params ["_entity"]; + +[ + _entity, + localize "str_state_repair", + "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa", + "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa", + QUOTE([ARR_2(_this,_target)] call FUNC(canRepair)), // Condition show + QUOTE([ARR_2(_this,_target)] call FUNC(canRepair)), // Condition progress + FUNC(startRepair), // Code start + FUNC(progressRepair), // Code progress + FUNC(completeRepair), // Code completed + FUNC(interruptedRepair), // Code interrupted, + [], // Arguments + 1, // Duration (will be changed by codeStart) + 300, // Priority + false // Remove completed +] call BIS_fnc_holdActionAdd; diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf new file mode 100644 index 0000000..f405a8d --- /dev/null +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Checks if caller can repair target. + * + * Arguments: + * 0: Unit + * + * Return Value: + * True if unit is an engineer + * + * Public: No + */ + +params ["_caller", "_target"]; + +alive _target && { + _caller call EFUNC(common,isEngineer) && { + vehicle _caller isEqualTo _caller && { + _caller distance _target < 5 && { + (_target getVariable ['MDL_currentHp', 0]) < (_target getVariable ['MDL_maxHp', 0]) && { + ((_target getVariable ["MDL_lastCombatActive", -GVAR(repairMinNoCombatTime)]) + GVAR(repairMinNoCombatTime)) < CBA_missionTime +}}}}} diff --git a/addons/repair/functions/fnc_completeRepair.sqf b/addons/repair/functions/fnc_completeRepair.sqf new file mode 100644 index 0000000..4e22dcd --- /dev/null +++ b/addons/repair/functions/fnc_completeRepair.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Completes repair fully repairing vehicle + * + * Arguments: + * 0: Unit being repaired + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; +["MDL_healDamage", [_target]] call CBA_fnc_serverEvent; +systemChat LLSTRING(RepairFinished); diff --git a/addons/repair/functions/fnc_healDamage.sqf b/addons/repair/functions/fnc_healDamage.sqf new file mode 100644 index 0000000..d0bcfcc --- /dev/null +++ b/addons/repair/functions/fnc_healDamage.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Heals damage of unit + * + * Arguments: + * 0: Unit to heal + * 1: Heal amount (Default: full heal) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit", ["_healAmount", MAX_HP]]; + +if (_healAmount isEqualTo MAX_HP) exitWith { + private _maxHp = _unit getVariable ["MDL_maxHp", MAX_HP]; + _unit setVariable ["MDL_currentHp", _maxHp, true]; + _unit setDamage 0; + // Heal crew + {_x setDamage 0} forEach crew _unit; +}; + +private _maxHp = _unit getVariable ["MDL_maxHp", MAX_HP]; +private _currentHp = _unit getVariable ["MDL_currentHp", MAX_HP]; +private _newHp = (_currentHp + 0.5) min 10; +_unit setVariable ["MDL_currentHp", _newHp, true]; +_unit setDamage (((1 - _newHp)/_maxHp) min 0.8); + +["MDL_showCurrentHp", [_unit], crew _unit] call CBA_fnc_targetEvent; diff --git a/addons/repair/functions/fnc_interruptedRepair.sqf b/addons/repair/functions/fnc_interruptedRepair.sqf new file mode 100644 index 0000000..0ffe24e --- /dev/null +++ b/addons/repair/functions/fnc_interruptedRepair.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles repair process interruption. + * + * Arguments: + * 0: Unit being repaired (not anymore) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +private _maxHp = _target getVariable ["MDL_maxHp", MAX_HP]; +private _currentHp = _target getVariable ["MDL_currentHp", MAX_HP]; + +private _lastCombatActive = _target getVariable ["MDL_lastCombatActive", -1]; +if (_lastCombatActive + GVAR(repairMinNoCombatTime) > CBA_missionTime) exitWith { + systemChat LELSTRING(Common,VehicleInCombat); +}; + +systemChat format [LLSTRING(RepairInterrupted), _currentHp, _maxHp]; diff --git a/addons/repair/functions/fnc_progressRepair.sqf b/addons/repair/functions/fnc_progressRepair.sqf new file mode 100644 index 0000000..e683b2d --- /dev/null +++ b/addons/repair/functions/fnc_progressRepair.sqf @@ -0,0 +1,36 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles repair progress + * + * Arguments: + * 0: Unit being repaired + * 1: Unit commencing repairs + * 4: Current progress frame + * 5: Max progress frame (should be 24) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target", "_caller", "_actionId", "_arguments", "_frame", "_maxFrame"]; + +private _stepsWithRepair = _target getVariable ["MDL_repairAtSteps", []]; +if (_stepsWithRepair isEqualTo []) exitWith {}; + +private _nextRepairStep = _stepsWithRepair select (count _stepsWithRepair - 1); + +if (_frame > _nextRepairStep) then { + // For display purposes only + private _maxHp = _target getVariable ["MDL_maxHp", MAX_HP]; + private _currentHp = _target getVariable ["MDL_currentHp", MAX_HP]; + private _newHp = (_currentHp + HEAL_AMOUNT) min 10; + systemChat format [LLSTRING(RepairProgress), _newHp, _maxHp]; + + // Actual healing + ["MDL_healDamage", [_target, HEAL_AMOUNT]] call CBA_fnc_serverEvent; + + _stepsWithRepair deleteAt (count _stepsWithRepair - 1); +}; diff --git a/addons/repair/functions/fnc_startRepair.sqf b/addons/repair/functions/fnc_startRepair.sqf new file mode 100644 index 0000000..b4d8421 --- /dev/null +++ b/addons/repair/functions/fnc_startRepair.sqf @@ -0,0 +1,36 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles repair start. + * + * Arguments: + * 0: Unit being repaired + * + * Return Value: + * None + * + * Public: No + */ + +params ["_target"]; + +private _currentHp = _target getVariable ["MDL_currentHp", 0]; +private _maxHp = _target getVariable ["MDL_maxHp", MAX_HP]; +private _actualDuration = (_maxHp - _currentHp) * HEAL_SECONDS_PER_POINT; +// TODO: Shorten duration based on unit skill + +// Please forgive me for magically changing variable from unknown outer scope +_duration = _actualDuration; + +// Determine at which steps we want to repair +#define MAX_FRAME 24 +private _stepsToHeal = ceil ((_maxHp - _currentHp)/HEAL_AMOUNT); +private _healEvery = MAX_FRAME / _stepsToHeal; +private _lastHeal = MAX_FRAME; +private _stepsWithRepair = []; +while {(_stepsToHeal - 1) > count _stepsWithRepair} do { + _lastHeal = _lastHeal - _healEvery; + _stepsWithRepair pushBack (_lastHeal); +}; + +_target setVariable ["MDL_repairAtSteps", _stepsWithRepair]; diff --git a/addons/repair/functions/script_component.hpp b/addons/repair/functions/script_component.hpp new file mode 100644 index 0000000..fa232ce --- /dev/null +++ b/addons/repair/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\repair\script_component.hpp" diff --git a/addons/repair/initSettings.inc.sqf b/addons/repair/initSettings.inc.sqf new file mode 100644 index 0000000..988c128 --- /dev/null +++ b/addons/repair/initSettings.inc.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(repairMinNoCombatTime), + "TIME", + ["Minimum no combat time", "Vehicle must be out of combat for long enough to be able to be repaired"], + [LSTRING(DisplayName), localize "str_state_repair"], + [0, 900, 60], + true +] call CBA_fnc_addSetting; diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp new file mode 100644 index 0000000..10f28d9 --- /dev/null +++ b/addons/repair/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT repair +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_REPAIR + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_REPAIR + #define DEBUG_SETTINGS DEBUG_SETTINGS_REPAIR +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" + +// Component specific +#define HEAL_AMOUNT 0.5 +#define HEAL_SECONDS_PER_POINT 5 diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml new file mode 100644 index 0000000..0d868cf --- /dev/null +++ b/addons/repair/stringtable.xml @@ -0,0 +1,29 @@ + + + + + ArmaForces Wargame - Repair + ArmaForces Wargame - Repair + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Repair finished + Naprawa zakończona + + + Repair interrupted %1/%2 HP + Naprawa przerwana %1/%2 PŻ + + + Repair progress %1/%2 HP + Postęp naprawy %1/%2 PŻ + + + diff --git a/addons/stats/$PBOPREFIX$ b/addons/stats/$PBOPREFIX$ new file mode 100644 index 0000000..646a820 --- /dev/null +++ b/addons/stats/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afwg\addons\stats \ No newline at end of file diff --git a/addons/stats/CfgEventHandlers.hpp b/addons/stats/CfgEventHandlers.hpp new file mode 100644 index 0000000..2a3f71f --- /dev/null +++ b/addons/stats/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/stats/XEH_PREP.hpp b/addons/stats/XEH_PREP.hpp new file mode 100644 index 0000000..12ad1f9 --- /dev/null +++ b/addons/stats/XEH_PREP.hpp @@ -0,0 +1,7 @@ +PREP(addExperienceForKill); +PREP(getPlayerStats); +PREP(loadAllStats); +PREP(loadPlayerStats); +PREP(playerKilled); +PREP(saveAllStats); +PREP(showPlayerStats); diff --git a/addons/stats/XEH_postInit.sqf b/addons/stats/XEH_postInit.sqf new file mode 100644 index 0000000..4a596dc --- /dev/null +++ b/addons/stats/XEH_postInit.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +if (isServer) then { call COMPILE_SCRIPT(XEH_postInitServer) }; +if (!hasInterface) exitWith {}; + +["MDL_xpReceived", { + params ["_receivedXp", "_newLifeXp", "_newTotalXp"]; + + systemChat format [LLSTRING(XpReceived), _receivedXp, _newLifeXp, _newTotalXp]; +}] call CBA_fnc_addEventHandler; + +["MDL_showXp", { + params ["_currentXp", "_totalXp"]; + + systemChat format [LLSTRING(CurrentAndTotalXp), _currentXp, _totalXp]; +}] call CBA_fnc_addEventHandler; + +call FUNC(loadPlayerStats); diff --git a/addons/stats/XEH_postInitServer.sqf b/addons/stats/XEH_postInitServer.sqf new file mode 100644 index 0000000..1ddcbed --- /dev/null +++ b/addons/stats/XEH_postInitServer.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +GVAR(loadedPlayers) = []; +GVAR(allPlayersStats) = call FUNC(loadAllStats); + +addMissionEventHandler ["Ended", FUNC(saveAllStats)]; +addMissionEventHandler ["MPEnded", FUNC(saveAllStats)]; + +["MDL_loadPlayerStats", FUNC(loadPlayerStats)] call CBA_fnc_addEventHandler; + +["MDL_playerKilled", FUNC(playerKilled)] call CBA_fnc_addEventHandler; diff --git a/addons/stats/XEH_preInit.sqf b/addons/stats/XEH_preInit.sqf new file mode 100644 index 0000000..ecb5d0c --- /dev/null +++ b/addons/stats/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; diff --git a/addons/stats/XEH_preStart.sqf b/addons/stats/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/stats/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/stats/config.cpp b/addons/stats/config.cpp new file mode 100644 index 0000000..d821136 --- /dev/null +++ b/addons/stats/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "afwg_main" + }; + author = "ArmaForces"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/stats/functions/fnc_addExperienceForKill.sqf b/addons/stats/functions/fnc_addExperienceForKill.sqf new file mode 100644 index 0000000..4e1aa01 --- /dev/null +++ b/addons/stats/functions/fnc_addExperienceForKill.sqf @@ -0,0 +1,44 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Adds experience for kill to crew of shooting vehicle + * + * Arguments: + * 0: Unit shooting + * 1: Killed unit + * + * Return Value: + * None + * + * Public: No + */ + +params ["_shooter", "_unit"]; + +private _vehicleInfo = VehicleTypes getOrDefault [toUpper typeOf _unit, objNull]; +private _xpAmount = if (_vehicleInfo isEqualTo objNull) then { 5 } else { _vehicleInfo get "pointCost" }; + +{ + private _playerStats = [getPlayerUID _x] call FUNC(getPlayerStats); + + // TODO: Consider keeping list of killed units + private _killedUnits = _x getVariable ["MDL_killedUnits", []]; + _killedUnits pushBack typeOf _unit; + _x setVariable ["MDL_killedUnits", _killedUnits, true]; + + private _currentXp = _playerStats getOrDefault ["Current XP", 0]; + private _newXp = _currentXp + _xpAmount; + _playerStats set ["Current XP", _newXp]; + + private _currentTotalXp = _playerStats getOrDefault ["Total XP", 0]; + private _newTotalXp = _currentTotalXp + _xpAmount; + _playerStats set ["Total XP", _newTotalXp]; + + private _currentKills = _playerStats getOrDefault ["Kills", 0]; + private _newKills = _currentKills + _xpAmount; + _playerStats set ["Kills", _currentKills + _xpAmount]; + + _x setVariable ["MDL_playerStats", _playerStats, true]; + + ["MDL_xpReceived", [_xpAmount, _newXp, _newTotalXp], _x] call CBA_fnc_targetEvent; +} forEach crew vehicle _shooter; diff --git a/addons/stats/functions/fnc_getPlayerStats.sqf b/addons/stats/functions/fnc_getPlayerStats.sqf new file mode 100644 index 0000000..b563d81 --- /dev/null +++ b/addons/stats/functions/fnc_getPlayerStats.sqf @@ -0,0 +1,26 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Retrieves player stats. + * + * Arguments: + * 0: Player UID + * + * Return Value: + * Map containing player statistics + * + * Public: No + */ + +params ["_uid"]; + +if (_uid isEqualTo "") exitWith {}; + +if (isServer) then { + GVAR(allPlayersStats) getOrDefaultCall [_uid, {createHashMap}, true] +} else { + private _playerData = player get ["MDL_playerStats", []]; + if (_playerData isEqualTo []) then { _playerData = createHashMap }; + _playerData +} diff --git a/addons/stats/functions/fnc_loadAllStats.sqf b/addons/stats/functions/fnc_loadAllStats.sqf new file mode 100644 index 0000000..2282426 --- /dev/null +++ b/addons/stats/functions/fnc_loadAllStats.sqf @@ -0,0 +1,25 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Loads all stats from previous missions. + * + * Arguments: + * None + * + * Return Value: + * Stats of all players + * + * Public: No + */ + +params ["_uid"]; + +private _wargayProgress = profileNamespace getVariable ["MDL_WG_Progress", []]; + +if (_wargayProgress isEqualTo []) then { + _wargayProgress = createHashMap; + profileNamespace setVariable ["MDL_WG_Progress", _wargayProgress]; +}; + +_wargayProgress getOrDefaultCall ["Players", {createHashMap}, true] diff --git a/addons/stats/functions/fnc_loadPlayerStats.sqf b/addons/stats/functions/fnc_loadPlayerStats.sqf new file mode 100644 index 0000000..6f2f281 --- /dev/null +++ b/addons/stats/functions/fnc_loadPlayerStats.sqf @@ -0,0 +1,40 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Loads player's stats from previous mission. + * If ran on client, requests stats to be saved into player's unit namespace. + * + * Arguments: + * 0: Player unit + * + * Return Value: + * True if loaded successfully + * + * Public: No + */ + +params [["_unit", player]]; + +if (!isServer) exitWith { + ["MDL_loadPlayerStats", [player]] call CBA_fnc_serverEvent; +}; + +private _uid = getPlayerUID _unit; + +if (_uid isEqualTo "") exitWith { false }; + +private _playerData = [_uid] call FUNC(getPlayerStats); + +private _index = GVAR(loadedPlayers) pushBackUnique _uid; +if (_index isEqualTo -1) then { + private _playedMissions = _playerData getOrDefault ["Missions", 0, true]; + _playerData set ["Missions", _playedMissions + 1]; +}; + +_unit setVariable ["MDL_playerStats", _playerData, true]; + +// BUG: probably doesn't work +["MDL_showStats", [_playerData], _unit] call CBA_fnc_targetEvent; + +true diff --git a/addons/stats/functions/fnc_playerKilled.sqf b/addons/stats/functions/fnc_playerKilled.sqf new file mode 100644 index 0000000..c5c0c3f --- /dev/null +++ b/addons/stats/functions/fnc_playerKilled.sqf @@ -0,0 +1,42 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Handles player death. Updates his stats. + * + * Arguments: + * 0: Player UID + * 1: Player unit + * 2: Veehicle player was in when dying + * + * Return Value: + * None + * + * Public: No + */ + +params ["_playerUid", ["_playerUnit", objNull], ["_vehicle", objNull]]; + +if (!isServer) exitWith {}; + +private _playerStats = [_playerUid] call FUNC(getPlayerStats); + +_playerStats set ["Current XP", 0]; +private _currentDeaths = _playerStats getOrDefault ["Deaths", 0]; +_playerStats set ["Deaths", _currentDeaths + 1]; + +// If outside vehicle or vehicle still lives, do not count as a loss + +if (isNull _vehicle || {alive _vehicle}) exitWith { + _playerUnit setVariable ["MDL_playerStats", _playerStats, true]; +}; + +private _vehicleInfo = VehicleTypes getOrDefault [toUpper typeOf _vehicle, objNull]; +private _pointCost = if (_vehicleInfo isEqualTo objNull) then { 5 } else { _vehicleInfo get "pointCost" }; + +private _currentLosses = _playerStats getOrDefault ["Losses", 0]; +_playerStats set ["Losses", _currentLosses + _pointCost]; + +_playerUnit setVariable ["MDL_playerStats", _playerStats, true]; + +nil diff --git a/addons/stats/functions/fnc_saveAllStats.sqf b/addons/stats/functions/fnc_saveAllStats.sqf new file mode 100644 index 0000000..54707de --- /dev/null +++ b/addons/stats/functions/fnc_saveAllStats.sqf @@ -0,0 +1,19 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Saves all stats to profile namespace. + * Runs on server only. + * + * Arguments: + * 0: Player unit + * + * Return Value: + * None + * + * Public: No + */ + +if (GVAR(isTest) || {!isServer}) exitWith {}; + +saveProfileNamespace; diff --git a/addons/stats/functions/fnc_showPlayerStats.sqf b/addons/stats/functions/fnc_showPlayerStats.sqf new file mode 100644 index 0000000..bfeefee --- /dev/null +++ b/addons/stats/functions/fnc_showPlayerStats.sqf @@ -0,0 +1,47 @@ + +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Shows all player stats from whole campaign. + * Runs clientside only. + * + * Arguments: + * 0: Player unit + * + * Return Value: + * None + * + * Public: No + */ + +params [["_unit", player]]; + +if (!hasInterface) exitWith {}; + +private _playerData = [getPlayerUID _unit] call FUNC(getPlayerStats); + +private _currentXp = _playerData getOrDefault ["Current XP", 0]; +private _totalXp = _playerData getOrDefault ["Total XP", 0]; +private _deaths = _playerData getOrDefault ["Deaths", 0]; +private _kills = _playerData getOrDefault ["Kills", 0]; +private _losses = _playerData getOrDefault ["Losses", 0]; +private _playedMissions = _playerData getOrDefault ["Missions", 0]; + +private _messageParts = [ + format ["Player: %1", name _unit], + lineBreak, + lineBreak, + format ["XP: %1", _currentXp], + lineBreak, + format ["XP Total: %1", _totalXp], + lineBreak, + lineBreak, + format ["Played missions: %1", _playedMissions], + format ["Deaths: %1", _deaths], + format ["Kills: %1", _kills], + format ["Losses: %1", _losses], + format ["K/L ratio: %1", _kills/_losses] +]; + +private _text = composeText _messageParts; +hint _text; diff --git a/addons/stats/functions/script_component.hpp b/addons/stats/functions/script_component.hpp new file mode 100644 index 0000000..2baa40f --- /dev/null +++ b/addons/stats/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\afwg\addons\stats\script_component.hpp" diff --git a/addons/stats/script_component.hpp b/addons/stats/script_component.hpp new file mode 100644 index 0000000..d686621 --- /dev/null +++ b/addons/stats/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT stats +#include "\z\afwg\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_STATS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_STATS + #define DEBUG_SETTINGS DEBUG_SETTINGS_STATS +#endif + +#include "\z\afwg\addons\main\script_macros.hpp" diff --git a/addons/stats/stringtable.xml b/addons/stats/stringtable.xml new file mode 100644 index 0000000..92a8240 --- /dev/null +++ b/addons/stats/stringtable.xml @@ -0,0 +1,21 @@ + + + + + ArmaForces Wargame - Stats + ArmaForces Wargame - Stats + + + Enable component + Włącz komponent + + + Controls whether this component is active. + Pozwala kontrolować czy komponent jest włączony. + + + Received %1 XP. New total from last death: %2 XP. Grand total: %3 XP + Otrzymano %1 PD. Całkowite PD od ostatniej śmierci: %2. PD w kampanii: %3 XP + + + diff --git a/include/a3/ui_f/hpp/definedikcodes.inc b/include/a3/ui_f/hpp/definedikcodes.inc new file mode 100644 index 0000000..c641d60 --- /dev/null +++ b/include/a3/ui_f/hpp/definedikcodes.inc @@ -0,0 +1,190 @@ +#ifndef DIK_ESCAPE + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ + +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 + +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ + +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* / ? on Portugese (Brazilian) keyboards */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Portugese (Brazilian) keyboards */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + + +/* + * Combination keys + */ +#define INPUT_CTRL_OFFSET 512 +#define INPUT_SHIFT_OFFSET 1024 +#define INPUT_ALT_OFFSET 2048 + + +#endif /* DIK_ESCAPE */ + diff --git a/tools/stringtable_validator.py b/tools/stringtable_validator.py index bfdc162..207f09d 100644 --- a/tools/stringtable_validator.py +++ b/tools/stringtable_validator.py @@ -53,9 +53,16 @@ def check_stringtable(filepath): print(" ERROR: Package name attribute '{}' is all lowercase, should be in titlecase.".format(package_name)) errors += 1 - if package_name.lower() != os.path.basename(os.path.dirname(filepath)): - print(" ERROR: Package name attribute '{}' does not match the component folder name.".format(package_name)) - errors += 1 + component_folder_name = os.path.basename(os.path.dirname(filepath)) + + if package_name.lower() != component_folder_name: + parent_component_folder_name = os.path.basename(os.path.dirname(os.path.dirname(filepath))) + subcomponent_name = f"{parent_component_folder_name}_{component_folder_name}" + if package_name.lower() != subcomponent_name: + print(" ERROR: Package name attribute '{}' does not match any of component folder name '{}' and subcomponent '{}'.".format(package_name, component_folder_name, subcomponent_name)) + errors += 1 + else: + print(f" INFO: Detected subaddon '{subcomponent_name}' used in Package name attribute.") # Get all keys contained in the stringtable keys = package.findall("Key")