Optics - Convert Optics to use CBA Optics (#7273)

* convert ace_optics to use cba_optics

* convert ace optics to cba optics

* Remove duplicate

* Add PIP config

* Use optics index

* Fix pboProject build

* Update CfgWeapons.hpp

* Correct SOS, adjust sizes and fix build issues

* Update addons/optics/script_component.hpp

* Corrected sizes again

* Made the scripted optics the first optics mode, fixed PIP SOS not being able to use irons

* Remove unused test object

* Readd AI stuff

visionMode is already set

* Updated some info on binos

forceOptics also already set

* Overhaul of magnifications

* Adjusted MOS & Nightforce

* Maybe this time the optics sizes will be fine... surely?

* Replace heavy optics blur with CBA one

* Added PIP names back

---------

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
commy2 2024-08-15 10:17:46 +02:00 committed by GitHub
parent 4014cd5539
commit 903f046810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 167 additions and 752 deletions

View File

@ -1,17 +0,0 @@
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));
};
};

View File

@ -1,7 +0,0 @@
class CfgOpticsEffect {
class ACE_OpticsRadBlur1 {
type = "radialblur";
params[] = {0.015, 0, 0.14, 0.2};
priority = 950;
};
};

View File

@ -1,49 +1,38 @@
#define MACRO_PRELOAD \
GVAR(BodyDay) = "*"; \
GVAR(BodyNight) = "*"; \
GVAR(ReticleDay) = "*"; \
GVAR(ReticleNight) = "*"
class PreloadTextures {
class CfgWeapons {
class ACE_optic_Hamr_2D {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_Hamr_PIP {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_Arco_2D {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_Arco_PIP {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_MRCO_2D {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_MRCO_PIP {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_SOS_2D {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_SOS_PIP {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_LRPS_2D {
MACRO_PRELOAD;
PRELOAD;
};
class ACE_optic_LRPS_PIP {
MACRO_PRELOAD;
PRELOAD;
};
};
};

View File

@ -1,204 +0,0 @@
class RscOpticsValue;
class RscMapControl;
class RscText;
class RscInGameUI {
class RscUnitInfo;
class RscWeaponZeroing: RscUnitInfo {
class CA_Zeroing;
};
class ACE_RscWeaponZeroing: RscWeaponZeroing {
controls[] = {"CA_Zeroing", "CA_FOVMode", "ACE_DrawReticleHelper", "ACE_ScriptedReticle"};
class CA_FOVMode: RscOpticsValue { // Idea by Taosenai. Apparently this can be used via isNil check to determine wheter the scope or the kolimator is used
idc = 154;
style = 2;
colorText[] = {0, 0, 0, 0};
x = 0;
y = 0;
w = 0;
h = 0;
};
class ACE_DrawReticleHelper: RscMapControl {
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawScope));
idc = -1;
w = 0;
h = 0;
};
class ACE_ScriptedReticle: RscText {
idc = 1713154;
style = 48;
size = 1;
sizeEx = 0;
text = QPATHTOF(reticles\ace_shortdot_reticle_1.paa);
w = 0;
h = 0;
};
};
class ACE_RscWeapon_base: RscWeaponZeroing {
controls[] = {"CA_Zeroing", "CA_FOVMode", "ACE_DrawReticleHelper", "ReticleDay", "ReticleNight", "BodyNight", "BodyDay", "trippleHeadLeft", "trippleHeadRight"}; // Don't change this order
class CA_FOVMode: RscOpticsValue { // Idea by Taosenai. Apparently this can be used via isNil check to determine wheter the scope or the kolimator is used
idc = 154;
style = 2;
colorText[] = {0, 0, 0, 0};
x = 0;
y = 0;
w = 0;
h = 0;
};
class ACE_DrawReticleHelper: RscMapControl {
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawScope2D));
idc = -1;
w = 0;
h = 0;
};
#define SIZEX 0.75/(getResolution select 5)
class ReticleDay: RscText {
idc = 1713001;
style = 48;
size = 0;
sizeEx = 1;
text = "";
colorText[] = {1, 1, 1, 0};
colorBackground[] = {0, 0, 0, 0};
x = QUOTE(safezoneX + 0.5 * safezoneW - 0.5 * SIZEX);
y = QUOTE(safezoneY + 0.5 * safezoneH - 0.5 * SIZEX * (4 / 3));
w = QUOTE(SIZEX);
h = QUOTE(SIZEX * (4 / 3));
};
class ReticleNight: ReticleDay {
idc = 1713002;
text = "";
};
#undef SIZEX
#define SIZEX 2*0.75/(getResolution select 5)
class BodyDay: ReticleDay {
idc = 1713005;
text = "";
x = QUOTE(safezoneX + 0.5 * safezoneW - 0.5 * SIZEX);
y = QUOTE(safezoneY + 0.5 * safezoneH - 0.5 * SIZEX * (4 / 3));
w = QUOTE(SIZEX);
h = QUOTE(SIZEX * (4 / 3));
};
class BodyNight: BodyDay {
idc = 1713006;
text = "";
};
// These are just black side panels to cover the areas that the optics p3d doesn't cover
// It will ONLY effect tripple head users as (safezoneX == safeZoneXAbs) for everyone else
// Reference PR #1156:
class trippleHeadLeft: RscText {
idc = 1713010;
x = "safeZoneXAbs";
Y = "safezoneY";
W = "(safezoneX - safeZoneXAbs) * ((getResolution select 4) / (16 / 3))";
H = "safeZoneH";
colorBackground[] = {0, 0, 0, 1};
};
class trippleHeadRight: trippleHeadLeft {
idc = 1713011;
x = "safeZoneXAbs + safeZoneWAbs - (safezoneX - safeZoneXABS) * ((getResolution select 4) / (16 / 3))";
colorBackground[] = {0, 0, 0, 1};
};
};
class ACE_RscWeapon_Hamr: ACE_RscWeapon_base {
class ReticleDay: ReticleDay {
text = QPATHTOF(reticles\hamr-reticle65_ca.paa);
};
class ReticleNight: ReticleNight {
text = QPATHTOF(reticles\hamr-reticle65Illum_ca.paa);
};
class BodyDay: BodyDay {
text = QPATHTOF(reticles\hamr-body_ca.paa);
};
class BodyNight: BodyNight {
text = QPATHTOF(reticles\hamr-bodyNight_ca.paa);
};
};
class ACE_RscWeapon_Arco: ACE_RscWeapon_base {
class ReticleDay: ReticleDay {
text = QPATHTOF(reticles\arco-reticle65_ca.paa);
};
class ReticleNight: ReticleNight {
text = QPATHTOF(reticles\arco-reticle65Illum_ca.paa);
};
class BodyDay: BodyDay {
text = QPATHTOF(reticles\arco-body_ca.paa);
};
class BodyNight: BodyNight {
text = QPATHTOF(reticles\arco-bodyNight_ca.paa);
};
};
class ACE_RscWeapon_MRCO: ACE_RscWeapon_base {
class ReticleDay: ReticleDay {
text = QPATHTOF(reticles\mrco-reticle556_ca.paa);
};
class ReticleNight: ReticleNight {
text = QPATHTOF(reticles\mrco-reticle556Illum_ca.paa);
};
class BodyDay: BodyDay {
text = QPATHTOF(reticles\mrco-body_ca.paa);
};
class BodyNight: BodyNight {
text = QPATHTOF(reticles\mrco-bodyNight_ca.paa);
};
};
class ACE_RscWeapon_SOS: ACE_RscWeapon_base {
class ReticleDay: ReticleDay {
text = QPATHTOF(reticles\sos-reticleMLR_ca.paa);
};
class ReticleNight: ReticleNight {
text = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa);
};
class BodyDay: BodyDay {
text = QPATHTOF(reticles\sos-body_ca.paa);
};
class BodyNight: BodyNight {
text = QPATHTOF(reticles\sos-bodyNight_ca.paa);
};
};
};
/*
_ctrl = (D displayCtrl 1713006);
_sizeX = 1.54 / (getResolution select 5);
_sizeY = _sizeX * safezoneW / safezoneH;
_ctrl ctrlSetPosition [
safezoneX + 0.5 * safezoneW - 0.5 * _sizeX,
safezoneY + 0.5 * safezoneH - 0.5 * _sizeY,
_sizeX,
_sizeY
];
_ctrl ctrlCommit 0
*/

View File

@ -3,16 +3,10 @@ class CfgVehicles {
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_optic_Hamr_2D,2);
MACRO_ADDITEM(ACE_optic_Hamr_PIP,2);
MACRO_ADDITEM(ACE_optic_Arco_2D,2);
MACRO_ADDITEM(ACE_optic_Arco_PIP,2);
MACRO_ADDITEM(ACE_optic_MRCO_2D,2);
//MACRO_ADDITEM(ACE_optic_MRCO_PIP,2);
MACRO_ADDITEM(ACE_optic_SOS_2D,2);
MACRO_ADDITEM(ACE_optic_SOS_PIP,2);
MACRO_ADDITEM(ACE_optic_LRPS_2D,2);
MACRO_ADDITEM(ACE_optic_LRPS_PIP,2);
//MACRO_ADDITEM(ACE_optic_DMS,2);
};
};
};

View File

@ -1,110 +1,62 @@
class CfgWeapons {
class ItemCore;
class InventoryOpticsItem_Base_F;
class Default;
class Binocular: Default {
forceOptics = 0; // Allow using compass with Binocular
opticsZoomMin = 0.056889; // 5.25x power
opticsZoomMax = 0.056889; // 9 px/mil
modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 degrees horizontal field of view
visionMode[] = {"Normal"}; // Can't use nvgs with binoculars any more than you can with scopes
// Fix AI using Binocs on short range - #18737
// minRange = 300; // 300 = uses Rangefinder often (runs a few meters, stops, uses RF, repeats)
minRange = 500; //500 = seem almost never use it..?
minRangeProbab = 0.001;
midRange = 1000;
midRangeProbab = 0.01;
maxRange = 5000;
maxRangeProbab = 0.01;
};
// zooming reticle scopes
class optic_DMS: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip;
class Iron;
};
};
};
/*class ACE_optic_DMS: optic_DMS {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_DMS";
scope = 1;
displayName = "LOCALIZE ACE DMS";
//descriptionShort = "$STR_A3_CFGWEAPONS_ACC_DMS1";
weaponInfoType = "ACE_RscWeaponZeroing";
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_shortdot_optics.p3d);
class OpticsModes: OpticsModes {
class Snip: Snip {
opticsZoomMin = 0.05;
opticsZoomMax = 0.3;
opticsZoomInit = 0.3;
discretefov[] = {};
modelOptics[] = {};
};
class Iron: Iron {};
};
};
};*/
// PIP scopes
// HAMR
class optic_Hamr: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Hamr2Collimator;
class Hamr2Scope;
class Hamr2Collimator;
};
};
};
class ACE_optic_Hamr_2D: optic_Hamr {
GVAR(BodyDay) = QPATHTOF(reticles\hamr-body_ca.paa);
GVAR(BodyNight) = QPATHTOF(reticles\hamr-bodyNight_ca.paa);
GVAR(ReticleDay) = QPATHTOF(reticles\hamr-reticle65_ca.paa);
GVAR(ReticleNight) = QPATHTOF(reticles\hamr-reticle65Illum_ca.paa);
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_Hamr_2D";
scope = 2;
displayName = CSTRING(hamr);
weaponInfoType = "ACE_RscWeapon_Hamr";
class CBA_ScriptedOptic {
opticsPPEffects[] = {"CBA_OpticsRadBlur3"};
reticleTexture = QPATHTOF(reticles\hamr-reticle65_ca.paa);
reticleTextureNight = QPATHTOF(reticles\hamr-reticle65Illum_ca.paa);
reticleTextureSize = 6 / 25 * 4; // At 25x using https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics#debug-reticle, the best choice is 6
bodyTexture = QPATHTOF(reticles\hamr-body_ca.paa);
bodyTextureNight = QPATHTOF(reticles\hamr-bodyNight_ca.paa);
bodyTextureSize = 2.2;
hideMagnification = 1;
};
weaponInfoType = "CBA_ScriptedOptic";
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_90.p3d";
class OpticsModes: OpticsModes {
class Hamr2Collimator: Hamr2Collimator {};
class Hamr2Scope: Hamr2Scope {
useModelOptics = 1;
opticsZoomInit = 0.0872664626;
opticsZoomMax = 0.0872664626;
opticsZoomMin = 0.0872664626;
opticsPPEffects[] = {"OpticsCHAbera5", "OpticsBlur5", "ACE_OpticsRadBlur1"};
opticsDisablePeripherialVision = 0;
visionMode[] = {"Normal", "NVG"};
opticsZoomInit = 0.25 / 4;
opticsZoomMax = 0.25 / 4;
opticsZoomMin = 0.25 / 4;
};
class Hamr2Collimator: Hamr2Collimator {};
};
};
};
class ACE_optic_Hamr_PIP: ACE_optic_Hamr_2D {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_Hamr_PIP";
//scopeArsenal = 1;
scope = 1;
displayName = CSTRING(hamr_pip);
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_pip.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_pip.p3d";
};
};
// ARCO
class optic_Arco: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
@ -115,95 +67,104 @@ class CfgWeapons {
};
class ACE_optic_Arco_2D: optic_Arco {
GVAR(BodyDay) = QPATHTOF(reticles\arco-body_ca.paa);
GVAR(BodyNight) = QPATHTOF(reticles\arco-bodyNight_ca.paa);
GVAR(ReticleDay) = QPATHTOF(reticles\arco-reticle65_ca.paa);
GVAR(ReticleNight) = QPATHTOF(reticles\arco-reticle65Illum_ca.paa);
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_Arco_2D";
scope = 2;
displayName = CSTRING(arco);
weaponInfoType = "ACE_RscWeapon_Arco";
class CBA_ScriptedOptic {
opticsPPEffects[] = {"CBA_OpticsRadBlur3"};
reticleTexture = QPATHTOF(reticles\arco-reticle65_ca.paa);
reticleTextureNight = QPATHTOF(reticles\arco-reticle65Illum_ca.paa);
reticleTextureSize = 6.4 / 25 * 4; // At 25x using https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics#debug-reticle, the best choice is 6.4
bodyTexture = QPATHTOF(reticles\arco-body_ca.paa);
bodyTextureNight = QPATHTOF(reticles\arco-bodyNight_ca.paa);
bodyTextureSize = 2.2;
hideMagnification = 1;
};
weaponInfoType = "CBA_ScriptedOptic";
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_90.p3d";
class OpticsModes: OpticsModes {
class ARCO2collimator: ARCO2collimator {};
class ARCO2scope: ARCO2scope {
useModelOptics = 1;
opticsZoomInit = 0.0872664626;
opticsZoomMax = 0.0872664626;
opticsZoomMin = 0.0872664626;
opticsPPEffects[] = {"OpticsCHAbera5", "OpticsBlur5", "ACE_OpticsRadBlur1"};
opticsDisablePeripherialVision = 0;
visionMode[] = {"Normal"};
opticsZoomInit = 0.25 / 4;
opticsZoomMax = 0.25 / 4;
opticsZoomMin = 0.25 / 4;
};
class ARCO2collimator: ARCO2collimator {};
};
};
};
class ACE_optic_Arco_PIP: ACE_optic_Arco_2D {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_Arco_PIP";
//scopeArsenal = 1;
scope = 1;
displayName = CSTRING(arco_pip);
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_pip.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_pip.p3d";
};
};
// MRCO
class optic_MRCO: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class MRCOcq;
class MRCOscope;
class MRCOcq;
};
};
};
class ACE_optic_MRCO_2D: optic_MRCO {
GVAR(BodyDay) = QPATHTOF(reticles\mrco-body_ca.paa);
GVAR(BodyNight) = QPATHTOF(reticles\mrco-bodyNight_ca.paa);
GVAR(ReticleDay) = QPATHTOF(reticles\mrco-reticle556_ca.paa);
GVAR(ReticleNight) = QPATHTOF(reticles\mrco-reticle556Illum_ca.paa);
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_MRCO_2D";
displayName = CSTRING(valdada);
weaponInfoType = "ACE_RscWeapon_MRCO";
scope = 2;
displayName = CSTRING(mrco);
class CBA_ScriptedOptic {
opticsPPEffects[] = {"CBA_OpticsRadBlur3"};
reticleTexture = QPATHTOF(reticles\mrco-reticle556_ca.paa);
reticleTextureNight = QPATHTOF(reticles\mrco-reticle556Illum_ca.paa);
reticleTextureSize = 6.4 / 25 * 4; // At 25x using https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics#debug-reticle, the best choice is 6.4
bodyTexture = QPATHTOF(reticles\mrco-body_ca.paa);
bodyTextureNight = QPATHTOF(reticles\mrco-bodyNight_ca.paa);
bodyTextureSize = 2.2;
hideMagnification = 1;
};
weaponInfoType = "CBA_ScriptedOptic";
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_90.p3d";
class OpticsModes: OpticsModes {
class MRCOcq: MRCOcq {};
class MRCOscope: MRCOscope {
useModelOptics = 1;
opticsZoomInit = 0.0872664626;
opticsZoomMax = 0.0872664626;
opticsZoomMin = 0.0872664626;
opticsPPEffects[] = {"OpticsCHAbera5", "OpticsBlur5", "ACE_OpticsRadBlur1"};
opticsDisablePeripherialVision = 0;
visionMode[] = {"Normal"};
opticsZoomInit = 0.25 / 4;
opticsZoomMax = 0.25 / 4;
opticsZoomMin = 0.25 / 4;
};
class MRCOcq: MRCOcq {};
};
};
};
class ACE_optic_MRCO_PIP: ACE_optic_MRCO_2D {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_MRCO_PIP";
scope = 1;
//scopeArsenal = 1;
displayName = CSTRING(valdada_pip);
displayName = CSTRING(mrco_pip);
class ItemInfo: ItemInfo {
modelOptics = QPATHTOF(models\ace_optics_pip.p3d);
modelOptics = "\x\cba\addons\optics\cba_optic_big_pip.p3d";
};
};
// SOS
class optic_SOS: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
@ -214,49 +175,53 @@ class CfgWeapons {
};
class ACE_optic_SOS_2D: optic_SOS {
GVAR(BodyDay) = QPATHTOF(reticles\sos-body_ca.paa);
GVAR(BodyNight) = QPATHTOF(reticles\sos-bodyNight_ca.paa);
GVAR(ReticleDay) = QPATHTOF(reticles\sos-reticleMLR_ca.paa);
GVAR(ReticleNight) = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa);
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_SOS_2D";
scope = 2;
displayName = CSTRING(sos);
weaponInfoType = "ACE_RscWeapon_SOS";
class CBA_ScriptedOptic {
opticsPPEffects[] = {"CBA_OpticsRadBlur3"};
reticleTexture = QPATHTOF(reticles\sos-reticleMLR_ca.paa);
reticleTextureNight = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa);
reticleTextureSize = 0.76; // At 22x using https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics#debug-reticle, the best choice is 0.76
bodyTexture = QPATHTOF(reticles\sos-body_ca.paa);
bodyTextureNight = QPATHTOF(reticles\sos-bodyNight_ca.paa);
bodyTextureSize = 1.55;
};
weaponInfoType = "CBA_ScriptedOptic";
class ItemInfo: ItemInfo {
class OpticsModes: OpticsModes {
class Snip: Snip {
modelOptics[] = {QPATHTOF(models\ace_optics_reticle90.p3d), QPATHTOF(models\ace_optics_reticle90.p3d)};
opticsZoomMin = "5.5 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
opticsZoomMax = "2.75 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
opticsZoomInit = "2.75 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
discreteFov[] = {};
modelOptics[] = {"\x\cba\addons\optics\cba_optic_big_90.p3d"};
useModelOptics = 1;
opticsZoomInit = 0.0116;
opticsZoomMax = 0.0464;
opticsZoomMin = 0.0116;
discreteFOV[] = {0.0464, 0.0116};
opticsPPEffects[] = {"OpticsCHAbera1", "OpticsBlur1", "ACE_OpticsRadBlur1"};
opticsDisablePeripherialVision = 0;
};
class Iron: Iron {};
};
};
};
class ACE_optic_SOS_PIP: ACE_optic_SOS_2D {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_SOS_PIP";
//scopeArsenal = 1;
scope = 1;
displayName = CSTRING(sos_pip);
class ItemInfo: ItemInfo {
class OpticsModes: OpticsModes {
class Snip: Snip {
modelOptics[] = {QPATHTOF(models\ace_optics_pip.p3d), QPATHTOF(models\ace_optics_pip.p3d)};
modelOptics[] = {"\x\cba\addons\optics\cba_optic_big_pip.p3d"};
};
class Iron: Iron {};
};
};
};
// LRPS
class optic_LRPS: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
@ -266,44 +231,64 @@ class CfgWeapons {
};
class ACE_optic_LRPS_2D: optic_LRPS {
GVAR(BodyDay) = QPATHTOF(reticles\sos-body_ca.paa);
GVAR(BodyNight) = QPATHTOF(reticles\sos-bodyNight_ca.paa);
GVAR(ReticleDay) = QPATHTOF(reticles\sos-reticleMLR_ca.paa);
GVAR(ReticleNight) = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa);
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_LRPS_2D";
scope = 2;
displayName = CSTRING(lrps);
weaponInfoType = "ACE_RscWeapon_SOS";
class CBA_ScriptedOptic {
opticsPPEffects[] = {"CBA_OpticsRadBlur3"};
reticleTexture = QPATHTOF(reticles\sos-reticleMLR_ca.paa);
reticleTextureNight = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa);
reticleTextureSize = 0.76; // At 22x using https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics#debug-reticle, the best choice is 0.76
bodyTexture = QPATHTOF(reticles\sos-body_ca.paa);
bodyTextureNight = QPATHTOF(reticles\sos-bodyNight_ca.paa);
bodyTextureSize = 1.55;
};
weaponInfoType = "CBA_ScriptedOptic";
class ItemInfo: ItemInfo {
class OpticsModes: OpticsModes {
class Snip: Snip {
modelOptics[] = {QPATHTOF(models\ace_optics_reticle90.p3d), QPATHTOF(models\ace_optics_reticle90.p3d)};
opticsZoomMin = "22 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
opticsZoomMax = "5.5 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
opticsZoomInit = "5.5 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper')";
discreteFov[] = {};
modelOptics[] = {"\x\cba\addons\optics\cba_optic_big_90.p3d"};
useModelOptics = 1;
opticsZoomInit = 0.0116;
opticsZoomMax = 0.0464;
opticsZoomMin = 0.0116;
discreteFOV[] = {};
opticsPPEffects[] = {"OpticsCHAbera1", "OpticsBlur1", "ACE_OpticsRadBlur1"};
opticsDisablePeripherialVision = 0;
};
};
};
};
class ACE_optic_LRPS_PIP: ACE_optic_LRPS_2D {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_optic_LRPS_PIP";
//scopeArsenal = 1;
scope = 1;
displayName = CSTRING(lrps_pip);
class ItemInfo: ItemInfo {
class OpticsModes: OpticsModes {
class Snip: Snip {
modelOptics[] = {QPATHTOF(models\ace_optics_pip.p3d), QPATHTOF(models\ace_optics_pip.p3d)};
modelOptics[] = {"\x\cba\addons\optics\cba_optic_big_pip.p3d"};
};
};
};
};
// Binocular
class Default;
class Binocular: Default {
opticsZoomInit = 0.056889; // 7x power IRL
opticsZoomMin = 0.056889; // but in order to make the stadiametric rangefinder useful, ~4.4x magnification has been set
opticsZoomMax = 0.056889; // 9 px/mil
modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 degrees horizontal field of view (Steiner M22)
// Fix AI using Binocs on short range - #18737
// minRange = 300; // 300 = uses Rangefinder often (runs a few meters, stops, uses RF, repeats)
minRange = 500; // 500 = seem almost never use it..?
minRangeProbab = 0.001;
midRange = 1000;
midRangeProbab = 0.01;
maxRange = 5000;
maxRangeProbab = 0.01;
};
};

View File

@ -1,3 +0,0 @@
PREP(handleFired);
PREP(onDrawScope);
PREP(onDrawScope2D);

View File

@ -1,31 +0,0 @@
// by commy2
#include "script_component.hpp"
if (!hasInterface) exitWith {};
GVAR(camera) = objNull;
// save control for fired EH
["ace_infoDisplayChanged", {
TRACE_1("ace_infoDisplayChanged",_this);
if (!isNull ((_this select 0) displayCtrl 1713001)) then {
uiNamespace setVariable [QGVAR(RscWeaponInfo2D), _this select 0];
};
}] call CBA_fnc_addEventHandler;
// camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent..
["featureCamera", {
params ["_player", "_featureCamera"];
TRACE_1("featureCamera",_featureCamera);
if (_featureCamera isEqualTo "") then {
// Destroy the camera, and it will be re-created in the onDrawScope2d helper
if (!isNull GVAR(camera)) then {
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
TRACE_1("destroying pip camera for restart",GVAR(camera));
};
};
}] call CBA_fnc_addPlayerEventHandler;
// Register fire event handler
["ace_firedPlayer", LINKFUNC(handleFired)] call CBA_fnc_addEventHandler;

View File

@ -1,9 +0,0 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
ADDON = true;

View File

@ -1,3 +0,0 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

View File

@ -10,12 +10,11 @@ class CfgPatches {
"ACE_optic_Arco_2D",
"ACE_optic_Arco_PIP",
"ACE_optic_MRCO_2D",
//"ACE_optic_MRCO_PIP",
"ACE_optic_MRCO_PIP",
"ACE_optic_SOS_2D",
"ACE_optic_SOS_PIP",
"ACE_optic_LRPS_2D",
"ACE_optic_LRPS_PIP"
//"ACE_optic_DMS"
};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
@ -26,12 +25,15 @@ class CfgPatches {
};
};
#include "CfgEventHandlers.hpp"
#include "CfgOpticsEffect.hpp"
#include "CfgRscTitles.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgJointRails.hpp"
#include "CfgPreloadTextures.hpp"
#include "CfgJointRails.hpp"
#include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"
class CBA_PIPItems {
ACE_optic_Hamr_2D = "ACE_optic_Hamr_PIP";
ACE_optic_Arco_2D = "ACE_optic_Arco_PIP";
ACE_optic_MRCO_2D = "ACE_optic_MRCO_PIP";
ACE_optic_SOS_2D = "ACE_optic_SOS_PIP";
ACE_optic_LRPS_2D = "ACE_optic_LRPS_PIP";
};

View File

@ -1,104 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: Taosenai
* Adapted By: KoffeinFlummi, commy2
*
* Animates the scope when firing. Called from the unified fired EH only for the local player.
*
* Arguments:
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
*
* Example:
* call ace_optics_fnc_handleFired
*
* Public: No
*/
// IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
disableSerialization;
// Check if compatible scope is used
private _display = uiNamespace getVariable [QGVAR(RscWeaponInfo2D), displayNull];
if (isNull _display) exitWith {};
// Reduce the reticle movement as the player drops into lower, supported stances.
private _recoilCoef = switch (true) do {
case (isWeaponDeployed _unit): {0.1};
case (isWeaponRested _unit): {0.4};
default {1};
};
// Constants which determine how the scope recoils
private _recoilScope = _recoilCoef * linearConversion [0, 1, random 1, SCOPE_RECOIL_MIN, SCOPE_RECOIL_MAX, false];
private _reticleShiftX = _recoilCoef * linearConversion [0, 1, random 1, RETICLE_SHIFT_X_MIN, RETICLE_SHIFT_X_MAX, false];
private _reticleShiftY = _recoilCoef * linearConversion [0, 1, random 1, RETICLE_SHIFT_Y_MIN, RETICLE_SHIFT_Y_MAX, false];
private _scopeShiftX = _recoilCoef * linearConversion [0, 1, random 1, SCOPE_SHIFT_X_MIN, SCOPE_SHIFT_X_MAX, false];
private _scopeShiftY = _recoilCoef * linearConversion [0, 1, random 1, SCOPE_SHIFT_Y_MIN, SCOPE_SHIFT_Y_MAX, false];
// Create and commit recoil effect
private _sizeX = (0.75 + _recoilScope) / (getResolution select 5);
private _sizeY = _sizeX * (4 / 3);
private _positionReticle = [
safezoneX + 0.5 * safezoneW - 0.5 * (_sizeX + _reticleShiftX),
safezoneY + 0.5 * safezoneH - 0.5 * (_sizeY + _reticleShiftY),
_sizeX,
_sizeY
];
(_display displayCtrl 1713001) ctrlSetPosition _positionReticle;
(_display displayCtrl 1713002) ctrlSetPosition _positionReticle;
private _positionBody = [
safezoneX + 0.5 * safezoneW - 0.5 * (2 * _sizeX + _scopeShiftX),
safezoneY + 0.5 * safezoneH - 0.5 * (2 * _sizeY + _scopeShiftY),
2 * _sizeX,
2 * _sizeY
];
(_display displayCtrl 1713005) ctrlSetPosition _positionBody;
(_display displayCtrl 1713006) ctrlSetPosition _positionBody;
(_display displayCtrl 1713001) ctrlCommit 0;
(_display displayCtrl 1713002) ctrlCommit 0;
(_display displayCtrl 1713005) ctrlCommit 0;
(_display displayCtrl 1713006) ctrlCommit 0;
// Bring them all back
_sizeX = 0.75 / (getResolution select 5);
_sizeY = _sizeX * (4 / 3);
_positionReticle = [
safezoneX + 0.5 * safezoneW - 0.5 * _sizeX,
safezoneY + 0.5 * safezoneH - 0.5 * _sizeY,
_sizeX,
_sizeY
];
(_display displayCtrl 1713001) ctrlSetPosition _positionReticle;
(_display displayCtrl 1713002) ctrlSetPosition _positionReticle;
_positionBody = [
safezoneX + 0.5 * safezoneW - 0.5 * 2 * _sizeX,
safezoneY + 0.5 * safezoneH - 0.5 * 2 * _sizeY,
2 * _sizeX,
2 * _sizeY
];
(_display displayCtrl 1713005) ctrlSetPosition _positionBody;
(_display displayCtrl 1713006) ctrlSetPosition _positionBody;
(_display displayCtrl 1713001) ctrlCommit RECENTER_TIME;
(_display displayCtrl 1713002) ctrlCommit RECENTER_TIME;
(_display displayCtrl 1713005) ctrlCommit RECENTER_TIME;
(_display displayCtrl 1713006) ctrlCommit RECENTER_TIME;

View File

@ -1,39 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: commy2
*
*
* Arguments:
* 0: Display <DISPLAY>
*
* Return Value:
* None
*
* Example:
* [DISPLAY] call ace_optics_fnc_onDrawScope
*
* Public: No
*/
disableSerialization;
params ["_display"];
private _control = _display displayCtrl 1713154;
if (!ctrlShown (_display displayCtrl 154)) exitWith {
_control ctrlShow false;
};
private _sizeX = (call EFUNC(common,getZoom)) / 4;
private _sizeY = _sizeX * safezoneW / safezoneH;
_control ctrlSetPosition [
safezoneX + 0.5 * safezoneW - 0.5 * _sizeX,
safezoneY + 0.5 * safezoneH - 0.5 * _sizeY,
_sizeX,
_sizeY
];
_control ctrlCommit 0;
_control ctrlShow true;

View File

@ -1,103 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: commy2
* Helper function for updating the 2d and 3d scope controls
* Called from a dummy map controls onDraw.
*
* Arguments:
* 0: Display (RscInGameUI for a weapon) <DISPLAY>
*
* Return Value:
* None
*
* Example:
* [ACE_RscWeapon_Arco's Display] call ace_optics_fnc_onDrawScope2D
*
* Public: No
*/
disableSerialization;
params ["_display"];
// @todo, all weapon types
private _optic = (primaryWeaponItems ACE_player) select 2;
private _isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QPATHTOF(models\ace_optics_pip.p3d);
if (_isPIP) then {
GVAR(pipLastFrame) = diag_frameno;
if (isNull GVAR(camera)) then {
if ((({_x != GVAR(camera)} count allMissionObjects "camera") > 0) || {!isNull curatorCamera}) exitWith {
TRACE_1("waiting for feature camera to end",GVAR(camera));
};
// PiP technique by BadBenson
GVAR(camera) = "camera" camCreate positionCameraToWorld [0, 0, 0];
GVAR(camera) camSetFov 0.7;
GVAR(camera) camSetTarget ACE_player;
GVAR(camera) camCommit 1;
QGVAR(rendertarget0) setPiPEffect [0];
GVAR(camera) cameraEffect ["INTERNAL", "BACK", QGVAR(rendertarget0)];
TRACE_2("created new pip camera",GVAR(camera),isNull GVAR(camera));
// Start a waitUntil to handle destruction after GVAR(pipLastFrame) is no longer updated
[{
(abs (diag_frameno - GVAR(pipLastFrame))) > 1
}, {
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
TRACE_2("destroyed pip camera",GVAR(camera),isNull GVAR(camera));
}, []] call CBA_fnc_waitUntilAndExecute;
};
};
//If we are not zoomed into the actual scope (not collimator)
if (!ctrlShown (_display displayCtrl 154)) exitWith {
(_display displayCtrl 1713001) ctrlShow false;
(_display displayCtrl 1713002) ctrlShow false;
(_display displayCtrl 1713005) ctrlShow false;
(_display displayCtrl 1713006) ctrlShow false;
(_display displayCtrl 1713010) ctrlShow false;
(_display displayCtrl 1713011) ctrlShow false;
};
if (_isPIP) then {
GVAR(camera) setPosATL positionCameraToWorld [0, 0, 0.4];
GVAR(camera) camPrepareTarget positionCameraToWorld [0, 0, 50];
GVAR(camera) camCommitPrepared 0;
// @todo, check if that needs to be done at all
if (cameraView == "GUNNER") then {
GVAR(camera) camsetFOV 0.7;
GVAR(camera) camcommit 0;
} else {
GVAR(camera) camsetFOV 0.01;
GVAR(camera) camcommit 0;
};
};
// Calculate lighting
private _dayOpacity = call EFUNC(common,ambientBrightness);
private _nightOpacity = parseNumber (_dayOpacity == 1);
// Apply lighting and make layers visible
(_display displayCtrl 1713001) ctrlSetTextColor [1, 1, 1, 1];
(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, parseNumber (_dayOpacity < 0.5)];
(_display displayCtrl 1713005) ctrlSetTextColor [1, 1, 1, _dayOpacity];
(_display displayCtrl 1713006) ctrlSetTextColor [1, 1, 1, _nightOpacity];
/*
(_display displayCtrl 1713001) ctrlCommit 0;
(_display displayCtrl 1713002) ctrlCommit 0;
(_display displayCtrl 1713005) ctrlCommit 0;
(_display displayCtrl 1713006) ctrlCommit 0;
*/
(_display displayCtrl 1713001) ctrlShow true;
(_display displayCtrl 1713002) ctrlShow true;
(_display displayCtrl 1713005) ctrlShow true;
(_display displayCtrl 1713006) ctrlShow true;
(_display displayCtrl 1713010) ctrlShow _isPIP;
(_display displayCtrl 1713011) ctrlShow _isPIP;

View File

@ -1,8 +0,0 @@
ambient[]={0,0,0,0.89999998};
diffuse[]={0,0,0,0.89999998};
forcedDiffuse[]={0,0,0,1};
emmisive[]={0,0,0,1};
specular[]={0,0,0,0};
specularPower=1;
PixelShaderID="Normal";
VertexShaderID="Basic";

View File

@ -1,20 +0,0 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={1,1,1,1};
specular[]={1,0.99956858,1,1};
specularPower=1;
PixelShaderID="Normal";
VertexShaderID="Basic";
class Stage1
{
texture="#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};

View File

@ -16,17 +16,10 @@
#include "\z\ace\addons\main\script_macros.hpp"
#define SCOPE_RECOIL_MIN 0.03
#define SCOPE_RECOIL_MAX 0.032
#define SCOPE_SHIFT_X_MIN 0.04
#define SCOPE_SHIFT_X_MAX 0.05
#define SCOPE_SHIFT_Y_MIN -0.02
#define SCOPE_SHIFT_Y_MAX -0.03
#define RETICLE_SHIFT_X_MIN 0.006
#define RETICLE_SHIFT_X_MAX 0.011
#define RETICLE_SHIFT_Y_MIN -0.009
#define RETICLE_SHIFT_Y_MAX -0.014
#define RECENTER_TIME 0.09
#define PRELOAD \
class CBA_ScriptedOptic {\
reticleTexture = "*";\
reticleTextureNight = "*";\
bodyTexture = "*";\
bodyTextureNight = "*";\
}

View File

@ -69,7 +69,7 @@
<Chinese>先進步槍戰鬥光學瞄準鏡(擬真版)</Chinese>
<Turkish>ARCO (PIP)</Turkish>
</Key>
<Key ID="STR_ACE_Optics_valdada">
<Key ID="STR_ACE_Optics_mrco">
<English>MRCO (2D)</English>
<Czech>MRCO (2D)</Czech>
<French>MRCO (2D)</French>
@ -86,7 +86,7 @@
<Chinese>多距離戰鬥瞄準鏡(2D)</Chinese>
<Turkish>MRCO (2D)</Turkish>
</Key>
<Key ID="STR_ACE_Optics_valdada_pip">
<Key ID="STR_ACE_Optics_mrco_pip">
<English>MRCO (PIP)</English>
<Czech>MRCO (PIP)</Czech>
<French>MRCO (PIP)</French>