diff --git a/addons/common/functions/fnc_ambientBrightness.sqf b/addons/common/functions/fnc_ambientBrightness.sqf index f29ff9e8e5..f15b34c2ca 100644 --- a/addons/common/functions/fnc_ambientBrightness.sqf +++ b/addons/common/functions/fnc_ambientBrightness.sqf @@ -11,4 +11,4 @@ */ #include "script_component.hpp" -sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5 min 1) * (1 - overcast) +sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + moonIntensity / 5 * (1 - overcast) min 1 diff --git a/addons/optics/CfgOpticsEffect.hpp b/addons/optics/CfgOpticsEffect.hpp new file mode 100644 index 0000000000..a1bf62d6e3 --- /dev/null +++ b/addons/optics/CfgOpticsEffect.hpp @@ -0,0 +1,8 @@ + +class CfgOpticsEffect { + class ACE_OpticsRadBlur1 { + type = "radialblur"; + params[] = {0.015,0,0.14,0.2}; + priority = 950; + }; +}; diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index 8fb335ffce..2f6703dd42 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -41,4 +41,64 @@ class RscInGameUI { h = 0; }; }; + + class ACE_RscWeaponZeroingPIP: ACE_RscWeaponZeroing { + controls[] = {"CA_Zeroing","CA_FOVMode","ACE_DrawReticleHelper","ReticleDay","ReticleNight","BodyNight","BodyDay"}; // don't change this order + + class ACE_DrawReticleHelper: ACE_DrawReticleHelper { + onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawScopePIP)); + }; + + #define SIZEX 0.76/(getResolution select 5) + class ReticleDay: RscText { + idc = 1713001; + style = 48; + size = 0; + sizeEx = 1; + text = QUOTE(PATHTOF(reticles\hamr-reticle65_ca.paa)); + colorText[] = {1,1,1,0}; + colorBackground[] = {0,0,0,0}; + x = safezoneX+0.5*safezoneW-0.5*SIZEX; + y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH; + w = SIZEX; + h = SIZEX*safezoneW/safezoneH; + }; + + class ReticleNight: ReticleDay { + idc = 1713002; + text = QUOTE(PATHTOF(reticles\hamr-reticle65Illum_ca.paa)); + }; + + #define SIZEX 1.54/(getResolution select 5) + class BodyDay: ReticleDay { + idc = 1713005; + text = QUOTE(PATHTOF(reticles\hamr-body_ca.paa)); + x = safezoneX+0.5*safezoneW-0.5*SIZEX; + y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH; + w = SIZEX; + h = SIZEX*safezoneW/safezoneH; + }; + + class BodyNight: BodyDay { + idc = 1713006; + text = QUOTE(PATHTOF(reticles\hamr-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 + +*/ diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index a586793e38..60f52e5a1b 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -3,6 +3,7 @@ class CfgWeapons { class ItemCore; class InventoryOpticsItem_Base_F; + // zooming reticle scopes class optic_DMS: ItemCore { class ItemInfo: InventoryOpticsItem_Base_F { class OpticsModes { @@ -35,9 +36,48 @@ class CfgWeapons { }; }; }; + + // PIP scopes + class optic_Hamr: ItemCore { + class ItemInfo: InventoryOpticsItem_Base_F { + class OpticsModes { + class Hamr2Collimator; + class Hamr2Scope; + }; + }; + }; + + class ACE_optic_Hamr_PIP: optic_Hamr { + author = "$STR_ACE_Common_ACETeam"; + _generalMacro = "ACE_optic_Hamr_PIP"; + displayName = "$STR_A3_cfgWeapons_optic_Hamr0"; //@todo + picture = "\A3\weapons_F\Data\UI\gear_acco_hamr_CA.paa"; //@todo + model = "\A3\weapons_f_beta\acc\acco_hamr_F"; //@todo + descriptionShort = "$STR_A3_cfgWeapons_optic_Hamr1"; //@todo + weaponInfoType = "ACE_RscWeaponZeroingPIP"; + + class ItemInfo: ItemInfo { + modelOptics = QUOTE(PATHTOF(models\ace_optics_pip.p3d)); + + class OpticsModes: OpticsModes { + class Hamr2Collimator: Hamr2Collimator {}; + + class Hamr2Scope: Hamr2Scope { + // zoom 0.0872664626 to all + opticsDisplayName = "IHAMR"; // test?? + modelOptics = QUOTE(PATHTOF(models\ace_optics_pip.p3d)); + useModelOptics = 1; + opticsPPEffects[] += {"ACE_OpticsRadBlur1"}; + opticsDisablePeripherialVision = 0; + visionMode[] = {"Normal","NVG"}; + }; + }; + }; + }; + }; class SlotInfo; class CowsSlot: SlotInfo { - compatibleItems[] += {"ACE_optic_DMS"}; + compatibleItems[] += {"ACE_optic_DMS","ACE_optic_Hamr_PIP"}; }; diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index b7c879fe66..de8d6c28da 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -1,2 +1,20 @@ // by commy2 #include "script_component.hpp" + +0 = 0 spawn { + + // @todo + //[] call AGM_Optics_fnc_initScope; + + // PiP technique by BadBenson + GVAR(camera) = "camera" camCreate (positioncameratoworld [0,0,0]); + GVAR(camera) camSetFov 0.7; + GVAR(camera) camSetTarget ACE_player; // handle player changed?? + GVAR(camera) camCommit 1; + + "ace_optics_rendertarget0" setPiPEffect [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]]; + GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; + + // @todo + //waitUntil {[] call AGM_Optics_fnc_mainLoop; False}; +}; diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index 401355b698..e4b7bbe2e0 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -3,5 +3,6 @@ ADDON = false; PREP(onDrawScope); +PREP(onDrawScopePIP); ADDON = true; diff --git a/addons/optics/config.cpp b/addons/optics/config.cpp index b15e239b66..40814fd1d0 100644 --- a/addons/optics/config.cpp +++ b/addons/optics/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { units[] = {}; - weapons[] = {}; + weapons[] = {"ACE_optic_DMS","ACE_optic_Hamr_PIP"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; author[] = {""}; @@ -14,6 +14,6 @@ class CfgPatches { #include "CfgEventHandlers.hpp" -#include "CfgWeapons.hpp" - +#include "CfgOpticsEffect.hpp" #include "CfgRscTitles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/optics/functions/fnc_onDrawScopePIP.sqf b/addons/optics/functions/fnc_onDrawScopePIP.sqf new file mode 100644 index 0000000000..10c6eeff40 --- /dev/null +++ b/addons/optics/functions/fnc_onDrawScopePIP.sqf @@ -0,0 +1,56 @@ +// by commy2 +#include "script_component.hpp" + +disableSerialization; + +private "_display"; + +_display = _this select 0; + +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; +}; + +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; +}; + +// @todo, all weapon types +private "_optic"; +_optic = (primaryWeaponItems ACE_player) select 2; + +// calculate lighting +private ["_dayOpacity", "_nightOpacity"]; + +_dayOpacity = call EFUNC(common,ambientBrightness); +_nightOpacity = [1,0] select (_dayOpacity == 1); + +// Apply lighting and make layers visible +(_display displayCtrl 1713001) ctrlSetTextColor [1,1,1,1]; +(_display displayCtrl 1713002) ctrlSetTextColor [1,1,1,_nightOpacity]; +(_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; diff --git a/addons/optics/models/ace_optics_pip.p3d b/addons/optics/models/ace_optics_pip.p3d new file mode 100644 index 0000000000..9ec6765294 Binary files /dev/null and b/addons/optics/models/ace_optics_pip.p3d differ diff --git a/addons/optics/reticles/em.rvmat b/addons/optics/reticles/em.rvmat new file mode 100644 index 0000000000..a491df4b9a --- /dev/null +++ b/addons/optics/reticles/em.rvmat @@ -0,0 +1,20 @@ +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}; + }; +}; diff --git a/addons/optics/reticles/hamr-bodyNight_ca.paa b/addons/optics/reticles/hamr-bodyNight_ca.paa new file mode 100644 index 0000000000..422b13f7f1 Binary files /dev/null and b/addons/optics/reticles/hamr-bodyNight_ca.paa differ diff --git a/addons/optics/reticles/hamr-body_ca.paa b/addons/optics/reticles/hamr-body_ca.paa new file mode 100644 index 0000000000..6b55916c5f Binary files /dev/null and b/addons/optics/reticles/hamr-body_ca.paa differ diff --git a/addons/optics/reticles/hamr-reticle65Illum_ca.paa b/addons/optics/reticles/hamr-reticle65Illum_ca.paa new file mode 100644 index 0000000000..7af73234fc Binary files /dev/null and b/addons/optics/reticles/hamr-reticle65Illum_ca.paa differ diff --git a/addons/optics/reticles/hamr-reticle65_ca.paa b/addons/optics/reticles/hamr-reticle65_ca.paa new file mode 100644 index 0000000000..2cbf329c89 Binary files /dev/null and b/addons/optics/reticles/hamr-reticle65_ca.paa differ