get a pip scope to work

This commit is contained in:
commy2 2015-04-03 22:30:29 +02:00
parent 025c1ef63f
commit 9968bc132c
14 changed files with 208 additions and 5 deletions

View File

@ -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

View File

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

View File

@ -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
*/

View File

@ -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"};
};

View File

@ -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};
};

View File

@ -3,5 +3,6 @@
ADDON = false;
PREP(onDrawScope);
PREP(onDrawScopePIP);
ADDON = true;

View File

@ -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"

View File

@ -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;

Binary file not shown.

View File

@ -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};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.