diff --git a/TO_MERGE/agm/Recoil/config.cpp b/TO_MERGE/agm/Recoil/config.cpp deleted file mode 100644 index e671d76bb1..0000000000 --- a/TO_MERGE/agm/Recoil/config.cpp +++ /dev/null @@ -1,366 +0,0 @@ -// SEE LICENSE.TXT FOR LICENSING INFORMATION - -class CfgPatches { - class AGM_Recoil { - units[] = {}; - weapons[] = {}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"KoffeinFlummi", "TaoSensai", "commy2"}; - authorUrl = "https://github.com/Taosenai/tmr"; - }; -}; - -class CfgFunctions { - class AGM_Recoil { - class AGM_Recoil { - file = "\AGM_Recoil\functions"; - class burstDispersion; - class camshake; - }; - }; -}; - -class Extended_FiredBis_EventHandlers { - class CAManBase { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == AGM_player) then {_this call AGM_Recoil_fnc_camshake; _this call AGM_Recoil_fnc_burstDispersion;};"; - }; - }; - class Tank { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; - class Car { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; - class Helicopter { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; - class Plane { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; - class Ship_F { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; - class StaticWeapon { - class AGM_Recoil_CamShake { - clientFiredBis = "if (_this select 0 == vehicle AGM_player) then {_this call AGM_Recoil_fnc_camshake;};"; - }; - }; -}; - -// DOC: http://forums.bistudio.com/showthread.php?94464-explaining-the-cfgRecoils-array -class CfgRecoils { - #define KICKBACK 0.07 - #define KICKBACKPRONE 0.05 - - #define MUZZLECLIMB 0.01 - #define MUZZLERECOVERY -0.004 - -// BASE RECOILS - pistolBase[] = {0,0.8*KICKBACK,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; - subMachineGunBase[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - assaultRifleBase[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - machinegunBase[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - launcherBase[] = {0,0,0}; - -// PISTOLS - recoil_pistol_light[] = {0,0.8*KICKBACK,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; - recoil_pistol_heavy[] = {0,1.1*KICKBACK,1.4*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.4*MUZZLERECOVERY, 0.3,0,0}; - recoil_prone_pistol_light[] = {0,0.8*KICKBACKPRONE,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; - recoil_prone_pistol_heavy[] = {0,1.1*KICKBACKPRONE,1.4*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.4*MUZZLERECOVERY, 0.3,0,0}; - -// SUBMACHINE GUNS - recoil_single_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_burst_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; - -// ASSAULT RIFLES - recoil_single_mx[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_mx[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_mx[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_mx[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_ktb[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_ktb[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_ktb[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_ktb[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_mk20[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_mk20[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_mk20[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_mk20[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_trg[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_trg[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_trg[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_trg[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_sdar[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_sdar[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_sdar[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_sdar[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; - -// MACHINE GUNS - recoil_single_mk200[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_mk200[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_mk200[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_mk200[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_zafir[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_zafir[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_zafir[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_zafir[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - -// PRECISION RIFLES - recoil_single_dmr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_dmr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_dmr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_dmr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_ebr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_ebr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_ebr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_auto_prone_ebr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; - - recoil_single_gm6[] = {0,2.5*KICKBACK,2.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,2.5*MUZZLERECOVERY, 0.3,0,0}; - recoil_single_prone_gm6[] = {0,2.5*KICKBACKPRONE,2.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,2.5*MUZZLERECOVERY, 0.3,0,0}; - -// LAUNCHERS - recoil_single_law[] = {0,0,0}; - recoil_single_nlaw[] = {0,0,0}; - recoil_single_titan[] = {0,0,0}; -}; - -class CfgCameraShake { - // What does this do, really? It seems like the engine no longer respects it. - defaultCaliberCoefWeaponFire = 0; -}; - -// Completely disable BI's camshake on fire. -#define AGM_CAMSHAKEFIRE_BASE 0 -#define AGM_CAMSHAKEFIRE_LESS 0 -#define AGM_CAMSHAKEFIRE_MORE 0 - -// Go through all modes that have a camshakefire defined and change it to ours. -class CfgMovesBasic { - class Default { - camShakeFire = AGM_CAMSHAKEFIRE_BASE; - }; -}; -class CfgMovesMaleSdr : CfgMovesBasic { - class States { - class AmovPercMstpSlowWrflDnon; - class AmovPknlMstpSlowWrflDnon : AmovPercMstpSlowWrflDnon { - camShakeFire = AGM_CAMSHAKEFIRE_LESS; - }; - class AmovPercMstpSrasWrflDnon; - class AmovPpneMstpSrasWrflDnon : AmovPercMstpSrasWrflDnon { - camShakeFire = AGM_CAMSHAKEFIRE_LESS; - }; - class AmovPknlMstpSrasWlnrDnon : Default { - camShakeFire = AGM_CAMSHAKEFIRE_LESS; - }; - class AmovPknlMrunSlowWrflDf; - class AmovPknlMtacSlowWrflDf : AmovPknlMrunSlowWrflDf { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDfl; - class AmovPknlMtacSlowWrflDfl : AmovPknlMrunSlowWrflDfl { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDl; - class AmovPknlMtacSlowWrflDl : AmovPknlMrunSlowWrflDl { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDbl; - class AmovPknlMtacSlowWrflDbl : AmovPknlMrunSlowWrflDbl { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDb; - class AmovPknlMtacSlowWrflDb : AmovPknlMrunSlowWrflDb { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDbr; - class AmovPknlMtacSlowWrflDbr : AmovPknlMrunSlowWrflDbr { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDr; - class AmovPknlMtacSlowWrflDr : AmovPknlMrunSlowWrflDr { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMrunSlowWrflDfr; - class AmovPknlMtacSlowWrflDfr : AmovPknlMrunSlowWrflDfr { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMstpSrasWrflDnon; - class AmovPknlMwlkSrasWrflDf : AmovPknlMstpSrasWrflDnon { - camShakeFire = AGM_CAMSHAKEFIRE_BASE; - }; - class AmovPknlMrunSrasWrflDf; - class AmovPknlMtacSrasWrflDf : AmovPknlMrunSrasWrflDf { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - class AmovPknlMwlkSrasWpstDf; - class AmovPknlMtacSrasWpstDf : AmovPknlMwlkSrasWpstDf { - camShakeFire = AGM_CAMSHAKEFIRE_MORE; - }; - }; -}; - -// Ammo -class CfgAmmo { - class MissileCore; - class MissileBase: MissileCore { - AGM_Recoil_shakeMultiplier = 2; - }; - - class BombCore; - class LaserBombCore: BombCore { - AGM_Recoil_shakeMultiplier = 2; - }; - class Bo_Mk82: BombCore { - AGM_Recoil_shakeMultiplier = 2; - }; - - class RocketCore; - class ArtilleryRocketCore: RocketCore { - AGM_Recoil_shakeMultiplier = 1.4; - }; - class RocketBase: RocketCore { - AGM_Recoil_shakeMultiplier = 1.4; - }; - - class BulletCore; - class BulletBase: BulletCore { - AGM_Recoil_shakeMultiplier = 1; - }; - - class ShotgunCore; - class ShotgunBase: ShotgunCore { - AGM_Recoil_shakeMultiplier = 1.1; - }; - - class ShellCore; - class ShellBase: ShellCore { - AGM_Recoil_shakeMultiplier = 3; - }; - - class SubmunitionCore; - class SubmunitionBase: SubmunitionCore { - AGM_Recoil_shakeMultiplier = 3; - }; - - class ShotDeployCore; - class ShotDeployBase: ShotDeployCore { - AGM_Recoil_shakeMultiplier = 3; - }; -}; - -// Weapons -// 1. Set the recoil profiles for all fire modes. -// 2. Set the shake multiplier. This determines the camshake for the weapon. -// Ex: agm_recoil_shakeMultiplier = 1; - -// disabled currently -#define SHAKEMULTIPLIER_BASE 0 - -class CfgWeapons { - class CannonCore; - class autocannon_Base_F: CannonCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - class autocannon_35mm: CannonCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - class cannon_120mm: CannonCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - class mortar_155mm_AMOS: CannonCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - class mortar_82mm: CannonCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - - // No camshake for gatlings - class gatling_20mm: CannonCore { - agm_recoil_shakeMultiplier = 0; - }; - class gatling_25mm: CannonCore { - agm_recoil_shakeMultiplier = 0; - }; - class gatling_30mm: CannonCore { - agm_recoil_shakeMultiplier = 0; - }; - - class MGunCore; - class MGun: MGunCore { - agm_recoil_shakeMultiplier = SHAKEMULTIPLIER_BASE; - }; - // No camshake for smoke launchers - class SmokeLauncher: MGun { - agm_recoil_shakeMultiplier = 0; - }; - - // No camshake for coax machine guns - class LMG_RCWS; - class LMG_M200: LMG_RCWS { - agm_recoil_shakeMultiplier = 0; - }; - class LMG_coax: LMG_RCWS { - agm_recoil_shakeMultiplier = 0; - }; - class LMG_Minigun: LMG_RCWS { - agm_recoil_shakeMultiplier = 0; - }; -}; - -// Vehicles -class CfgVehicles { - class LandVehicle; - class Tank: LandVehicle { - AGM_enableCamshake = 1; - }; - class Car: LandVehicle { - AGM_enableCamshake = 1; - }; - class StaticWeapon: LandVehicle { - AGM_enableCamshake = 1; - }; - - class Allvehicles; - class Air: Allvehicles { - AGM_enableCamshake = 1; - }; -}; diff --git a/addons/recoil/$PBOPREFIX$ b/addons/recoil/$PBOPREFIX$ new file mode 100644 index 0000000000..efd38b75ed --- /dev/null +++ b/addons/recoil/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\recoil diff --git a/addons/recoil/CfgEventHandlers.hpp b/addons/recoil/CfgEventHandlers.hpp new file mode 100644 index 0000000000..1bf256e028 --- /dev/null +++ b/addons/recoil/CfgEventHandlers.hpp @@ -0,0 +1,43 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_FiredBis_EventHandlers { + class CAManBase { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(camShake); _this call FUNC(burstDispersion);};); + }; + }; + class Tank { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; + class Car { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; + class Helicopter { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; + class Plane { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; + class Ship_F { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; + class StaticWeapon { + class ADDON { + clientFiredBis = QUOTE(if (_this select 0 == vehicle ACE_player) then {_this call FUNC(camShake);};); + }; + }; +}; diff --git a/addons/recoil/XEH_preInit.sqf b/addons/recoil/XEH_preInit.sqf new file mode 100644 index 0000000000..4d2bf8c538 --- /dev/null +++ b/addons/recoil/XEH_preInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +PREP(burstDispersion); +PREP(camShake); diff --git a/addons/recoil/config.cpp b/addons/recoil/config.cpp new file mode 100644 index 0000000000..40defea1fb --- /dev/null +++ b/addons/recoil/config.cpp @@ -0,0 +1,312 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = 0.60; + requiredAddons[] = {ace_common}; + version = QUOTE(VERSION); + versionStr = QUOTE(VERSION); + versionAr[] = {VERSION_AR}; + author[] = {"KoffeinFlummi", "TaoSensai", "commy2"}; + authorUrl = "https://github.com/Taosenai/tmr"; + }; +}; + +#include "CfgEventHandlers.hpp" + +// DOC: http://forums.bistudio.com/showthread.php?94464-explaining-the-cfgRecoils-array +class CfgRecoils { + #define KICKBACK 0.07 + #define KICKBACKPRONE 0.05 + + #define MUZZLECLIMB 0.01 + #define MUZZLERECOVERY -0.004 + + // BASE RECOILS + pistolBase[] = {0,0.8*KICKBACK,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; + subMachineGunBase[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + assaultRifleBase[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + machinegunBase[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + launcherBase[] = {0,0,0}; + + // PISTOLS + recoil_pistol_light[] = {0,0.8*KICKBACK,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; + recoil_pistol_heavy[] = {0,1.1*KICKBACK,1.4*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.4*MUZZLERECOVERY, 0.3,0,0}; + recoil_prone_pistol_light[] = {0,0.8*KICKBACKPRONE,0.9*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.9*MUZZLERECOVERY, 0.3,0,0}; + recoil_prone_pistol_heavy[] = {0,1.1*KICKBACKPRONE,1.4*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.4*MUZZLERECOVERY, 0.3,0,0}; + + // SUBMACHINE GUNS + recoil_single_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_smg_01[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_smg_01[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_smg_02[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_smg_02[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_pdw[] = {0,0.5*KICKBACK,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_burst_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_pdw[] = {0,0.5*KICKBACKPRONE,0.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.5*MUZZLERECOVERY, 0.3,0,0}; + + // ASSAULT RIFLES + recoil_single_mx[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_mx[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_mx[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_mx[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_ktb[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_ktb[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_ktb[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_ktb[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_mk20[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_mk20[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_mk20[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_mk20[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_trg[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_trg[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_trg[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_trg[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_sdar[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_sdar[] = {0,0.8*KICKBACK,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_sdar[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_sdar[] = {0,0.8*KICKBACKPRONE,0.8*MUZZLECLIMB, 0.12,0,0, 0.15,0,0.8*MUZZLERECOVERY, 0.3,0,0}; + + // MACHINE GUNS + recoil_single_mk200[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_mk200[] = {0,1*KICKBACK,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_mk200[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_mk200[] = {0,1*KICKBACKPRONE,1*MUZZLECLIMB, 0.12,0,0, 0.15,0,1*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_zafir[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_zafir[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_zafir[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_zafir[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + + // PRECISION RIFLES + recoil_single_dmr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_dmr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_dmr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_dmr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_ebr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_ebr[] = {0,1.5*KICKBACK,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_ebr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_auto_prone_ebr[] = {0,1.5*KICKBACKPRONE,1.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,1.5*MUZZLERECOVERY, 0.3,0,0}; + + recoil_single_gm6[] = {0,2.5*KICKBACK,2.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,2.5*MUZZLERECOVERY, 0.3,0,0}; + recoil_single_prone_gm6[] = {0,2.5*KICKBACKPRONE,2.5*MUZZLECLIMB, 0.12,0,0, 0.15,0,2.5*MUZZLERECOVERY, 0.3,0,0}; + + // LAUNCHERS + recoil_single_law[] = {0,0,0}; + recoil_single_nlaw[] = {0,0,0}; + recoil_single_titan[] = {0,0,0}; +}; + +class CfgCameraShake { + // Seems to be ignored by Arma + defaultCaliberCoefWeaponFire = 0; +}; + +// Completely disable BI's camshake on fire. +class CfgMovesBasic { + class Default { + camShakeFire = 0; + }; +}; +class CfgMovesMaleSdr : CfgMovesBasic { + class States { + class AmovPercMstpSlowWrflDnon; + class AmovPknlMstpSlowWrflDnon : AmovPercMstpSlowWrflDnon { + camShakeFire = 0; + }; + class AmovPercMstpSrasWrflDnon; + class AmovPpneMstpSrasWrflDnon : AmovPercMstpSrasWrflDnon { + camShakeFire = 0; + }; + class AmovPknlMstpSrasWlnrDnon : Default { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDf; + class AmovPknlMtacSlowWrflDf : AmovPknlMrunSlowWrflDf { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDfl; + class AmovPknlMtacSlowWrflDfl : AmovPknlMrunSlowWrflDfl { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDl; + class AmovPknlMtacSlowWrflDl : AmovPknlMrunSlowWrflDl { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDbl; + class AmovPknlMtacSlowWrflDbl : AmovPknlMrunSlowWrflDbl { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDb; + class AmovPknlMtacSlowWrflDb : AmovPknlMrunSlowWrflDb { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDbr; + class AmovPknlMtacSlowWrflDbr : AmovPknlMrunSlowWrflDbr { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDr; + class AmovPknlMtacSlowWrflDr : AmovPknlMrunSlowWrflDr { + camShakeFire = 0; + }; + class AmovPknlMrunSlowWrflDfr; + class AmovPknlMtacSlowWrflDfr : AmovPknlMrunSlowWrflDfr { + camShakeFire = 0; + }; + class AmovPknlMstpSrasWrflDnon; + class AmovPknlMwlkSrasWrflDf : AmovPknlMstpSrasWrflDnon { + camShakeFire = 0; + }; + class AmovPknlMrunSrasWrflDf; + class AmovPknlMtacSrasWrflDf : AmovPknlMrunSrasWrflDf { + camShakeFire = 0; + }; + class AmovPknlMwlkSrasWpstDf; + class AmovPknlMtacSrasWpstDf : AmovPknlMwlkSrasWpstDf { + camShakeFire = 0; + }; + }; +}; + +// Ammo +class CfgAmmo { + class MissileCore; + class MissileBase: MissileCore { + GVAR(shakeMultiplier) = 2; + }; + + class BombCore; + class LaserBombCore: BombCore { + GVAR(shakeMultiplier) = 2; + }; + class Bo_Mk82: BombCore { + GVAR(shakeMultiplier) = 2; + }; + + class RocketCore; + class ArtilleryRocketCore: RocketCore { + GVAR(shakeMultiplier) = 1.4; + }; + class RocketBase: RocketCore { + GVAR(shakeMultiplier) = 1.4; + }; + + class BulletCore; + class BulletBase: BulletCore { + GVAR(shakeMultiplier) = 1; + }; + + class ShotgunCore; + class ShotgunBase: ShotgunCore { + GVAR(shakeMultiplier) = 1.1; + }; + + class ShellCore; + class ShellBase: ShellCore { + GVAR(shakeMultiplier) = 3; + }; + + class SubmunitionCore; + class SubmunitionBase: SubmunitionCore { + GVAR(shakeMultiplier) = 3; + }; + + class ShotDeployCore; + class ShotDeployBase: ShotDeployCore { + GVAR(shakeMultiplier) = 3; + }; +}; + +// Weapons +// 1. Set the recoil profiles for all fire modes. +// 2. Set the shake multiplier. This determines the camshake for the weapon. +// Ex: GVAR(shakeMultiplier) = 1; (disabled currently) + +class CfgWeapons { + class CannonCore; + class autocannon_Base_F: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class autocannon_35mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class cannon_120mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class mortar_155mm_AMOS: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class mortar_82mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + + // No camshake for gatlings + class gatling_20mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class gatling_25mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + class gatling_30mm: CannonCore { + GVAR(shakeMultiplier) = 0; + }; + + class MGunCore; + class MGun: MGunCore { + GVAR(shakeMultiplier) = 0; + }; + // No camshake for smoke launchers + class SmokeLauncher: MGun { + GVAR(shakeMultiplier) = 0; + }; + + // No camshake for coax machine guns + class LMG_RCWS; + class LMG_M200: LMG_RCWS { + GVAR(shakeMultiplier) = 0; + }; + class LMG_coax: LMG_RCWS { + GVAR(shakeMultiplier) = 0; + }; + class LMG_Minigun: LMG_RCWS { + GVAR(shakeMultiplier) = 0; + }; +}; + +// Vehicles +class CfgVehicles { + class LandVehicle; + class Tank: LandVehicle { + GVAR(enableCamshake) = 1; + }; + class Car: LandVehicle { + GVAR(enableCamshake) = 1; + }; + class StaticWeapon: LandVehicle { + GVAR(enableCamshake) = 1; + }; + + class Allvehicles; + class Air: Allvehicles { + GVAR(enableCamshake) = 1; + }; +}; diff --git a/TO_MERGE/agm/Recoil/functions/fn_burstDispersion.sqf b/addons/recoil/functions/fnc_burstDispersion.sqf similarity index 65% rename from TO_MERGE/agm/Recoil/functions/fn_burstDispersion.sqf rename to addons/recoil/functions/fnc_burstDispersion.sqf index 220fc60341..9467e922ff 100644 --- a/TO_MERGE/agm/Recoil/functions/fn_burstDispersion.sqf +++ b/addons/recoil/functions/fnc_burstDispersion.sqf @@ -1,8 +1,10 @@ // TMR: Small Arms - Recoil initialization and functions // (C) 2013 Ryan Schultz. See LICENSE. -// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi +// Edited for compatability in ACE by KoffeinFlummi // Edited by commy2 +#include "script_component.hpp" + private ["_unit", "_weapon", "_projectile"]; _unit = _this select 0; @@ -13,13 +15,13 @@ if (_weapon in ["Throw", "Put"]) exitWith {}; private ["_lastFired", "_burst"]; -_lastFired = _unit getVariable ["AGM_Recoil_lastFired", -1]; -_burst = _unit getVariable ["AGM_Recoil_Burst", 0]; +_lastFired = _unit getVariable [QUOTE(GVAR(lastFired)), -1]; +_burst = _unit getVariable [QUOTE(GVAR(burst)), 0]; if (time - _lastFired < 0.45) then { private "_startDisperse"; _burst = _burst + 1; - _unit setVariable ["AGM_Recoil_Burst", _burst, false]; + _unit setVariable [QUOTE(GVAR(burst)), _burst, false]; _startDisperse = [1, 3] select (cameraView == "GUNNER"); @@ -39,8 +41,8 @@ if (time - _lastFired < 0.45) then { // Maximum possible dispersion (without _sightsBurst mod) _maxBurst = 50; - if (_unit getVariable ["AGM_weaponRested", false]) then {_maxBurst = 25}; - if (_unit getVariable ["AGM_bipodDeployed", false]) then {_maxBurst = 18}; + if (_unit getVariable [QUOTE(EGVAR(resting,weaponRested)), false]) then {_maxBurst = 25}; + if (_unit getVariable [QUOTE(EGVAR(resting,bipodDeployed)), false]) then {_maxBurst = 18}; // Cap the dispersion _burst = (_burst min _maxBurst) + _sightsBurst; @@ -49,14 +51,12 @@ if (time - _lastFired < 0.45) then { _elevAngle = (_burst / 300) - random (_burst / 300) * 2; _travAngle = (_burst / 260) - random (_burst / 260) * 2; - ["Burst", [_travAngle, _elevAngle]] call AGM_Debug_fnc_log; - - [_projectile, _travAngle, _elevAngle] call AGM_Core_fnc_changeProjectileDirection; + [_projectile, _travAngle, _elevAngle] call EFUNC(common,changeProjectileDirection); }; } else { // Long enough delay, reset burst - _unit setVariable ["AGM_Recoil_Burst", 0, false]; + _unit setVariable [QUOTE(GVAR(burst)), 0, false]; }; -_unit setVariable ["AGM_Recoil_lastFired", time, false]; +_unit setVariable [QUOTE(GVAR(lastFired)), time, false]; diff --git a/TO_MERGE/agm/Recoil/functions/fn_camshake.sqf b/addons/recoil/functions/fnc_camShake.sqf similarity index 78% rename from TO_MERGE/agm/Recoil/functions/fn_camshake.sqf rename to addons/recoil/functions/fnc_camShake.sqf index 3bbdfd33bf..cfe179d67b 100644 --- a/TO_MERGE/agm/Recoil/functions/fn_camshake.sqf +++ b/addons/recoil/functions/fnc_camShake.sqf @@ -1,8 +1,10 @@ // TMR: Small Arms - Recoil initialization and functions // (C) 2013 Ryan Schultz. See LICENSE. -// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi +// Edited for compatability in ACE by KoffeinFlummi // Edited by commy2 +#include "script_component.hpp" + #define BASE_POWER 0.40 #define BASE_TIME 0.19 #define BASE_FREQ 13 @@ -25,8 +27,8 @@ _freqMod = 0; _powerCoef = 0; if (_unit != vehicle _unit) then { - _powerCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> "AGM_Recoil_shakeMultiplier"); - _powerCoef = _powerCoef * getNumber (configFile >> "CfgAmmo" >> _ammo >> "AGM_Recoil_shakeMultiplier"); + _powerCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> QUOTE(GVAR(shakeMultiplier))); + _powerCoef = _powerCoef * getNumber (configFile >> "CfgAmmo" >> _ammo >> QUOTE(GVAR(shakeMultiplier))); } else { private ["_type", "_config", "_recoil"]; @@ -46,8 +48,8 @@ if (_unit != vehicle _unit) then { _powerCoef = (call compile format ["%1", _powerCoef]) * RECOIL_COEF; }; -if (_unit getVariable ["AGM_weaponRested", false]) then {_powerMod = _powerMod - 0.07}; -if (_unit getVariable ["AGM_bipodDeployed", false]) then {_powerMod = _powerMod - 0.11}; +if (_unit getVariable [QUOTE(EGVAR(resting,weaponRested)), false]) then {_powerMod = _powerMod - 0.07}; +if (_unit getVariable [QUOTE(EGVAR(resting,bipodDeployed)), false]) then {_powerMod = _powerMod - 0.11}; private "_camshake"; _camshake = [ @@ -56,6 +58,4 @@ _camshake = [ BASE_FREQ + _freqMod max 0 ]; -["CamShake", _camshake, {copyToClipboard format ["addCamShake %1;", _this]; _this}] call AGM_Debug_fnc_log; - addCamShake _camshake; diff --git a/addons/recoil/functions/script_component.hpp b/addons/recoil/functions/script_component.hpp new file mode 100644 index 0000000000..d104528384 --- /dev/null +++ b/addons/recoil/functions/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT recoil +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_RECOIL + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_RECOIL + #define DEBUG_SETTINGS DEBUG_SETTINGS_RECOIL +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" diff --git a/addons/recoil/script_component.hpp b/addons/recoil/script_component.hpp new file mode 100644 index 0000000000..d104528384 --- /dev/null +++ b/addons/recoil/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT recoil +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_RECOIL + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_RECOIL + #define DEBUG_SETTINGS DEBUG_SETTINGS_RECOIL +#endif + +#include "\z\ace\Addons\main\script_macros.hpp"