Spotting scope - New reticle using CBA scripted optics (#6964)

* new reticle for spotting scope

* reticle b

* illuminated reticle for night

* use orig spotting scope reticle, bigger occular

* fix spotting scope attenuation
This commit is contained in:
commy2 2019-05-27 17:46:21 +02:00 committed by PabstMirror
parent 33602df517
commit 4e04100ea9
26 changed files with 59 additions and 132 deletions

View File

@ -0,0 +1,7 @@
class CfgOpticsEffect {
class GVAR(OpticsRadBlur1) {
type = "radialblur";
params[] = {0.01,0.01,0.18,0.36};
priority = 950;
};
};

View File

@ -27,23 +27,16 @@ class CfgVehicles {
class LandVehicle;
class StaticWeapon: LandVehicle {
class Turrets;
class Turrets {
class MainTurret;
};
class ACE_Actions {
class ACE_MainActions;
};
};
class StaticATWeapon: StaticWeapon {
class Turrets: Turrets {
class MainTurret;
};
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {};
};
};
class ACE_SpottingScopeObject: StaticATWeapon {
class ACE_SpottingScopeObject: StaticWeapon {
EGVAR(dragging,canDrag) = 1;
EGVAR(dragging,dragPosition)[] = {0,1,0};
EGVAR(dragging,dragDirection) = 0;
@ -68,6 +61,8 @@ class CfgVehicles {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {};
};
CBA_ScriptedOpticClass = "ACE_SpottingScopeOptic";
author = ECSTRING(common,ACETeam);
scope = 1;
side = 1;
@ -84,6 +79,7 @@ class CfgVehicles {
accuracy = 0.12;
cost = 10000;
icon = "\A3\Static_F_Gamma\data\UI\map_StaticTurret_AT_CA.paa";
attenuationEffectType = "";
class SpeechVariants {
class Default {
@ -123,15 +119,15 @@ class CfgVehicles {
initAngleY = 0;
minAngleY = -100;
maxAngleY = 100;
minFov = 0.0025;
maxFov = 0.05;
initFov= 0.05;
minFov = "0.25/35"; // real one is 15x-45x, but max mag in game is 37x
maxFov = "0.25/5";
initFov= "0.25/5";
};
weapons[] = {};
magazines[] = {};
gunnerOpticsColor[] = {1,1,1,1};
gunnerOpticsModel = "\A3\Weapons_F\empty";
gunnerOpticsModel = "\A3\Weapons_F\empty.p3d";
gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"};
gunnerOutOpticsShowCursor = 0;
gunnerOpticsShowCursor = 0;
@ -140,7 +136,7 @@ class CfgVehicles {
gunnerGetOutAction = "PlayerProne";
gunnerForceOptics = 0;
ejectDeadGunner = 0;
turretInfoType = QGVAR(RscUnitInfo);
turretInfoType = "CBA_ScriptedOptic_zooming";
opticsDisablePeripherialVision = 1;
};
};

View File

@ -1,4 +1,3 @@
class CfgWeapons {
class ACE_ItemCore;
class CBA_MiscItem_ItemInfo;
@ -15,4 +14,31 @@ class CfgWeapons {
mass = 40;
};
};
class ItemCore;
class ACE_SpottingScopeOptic: ItemCore {
scope = 1;
class CBA_ScriptedOptic {
minMagnificationReticleScale[] = {5,1};
maxMagnificationReticleScale[] = {25,5};
reticleDetailTextures[] = {
// start at > this magnification, reticleTexture, reticleTextureSize, reticleTextureNight (optional)
{0, PATHTOF(data\ace_spottingscope_reticle_b1_ca.paa), 1, PATHTOF(data\ace_spottingscope_reticle_b1_ca.paa)},
{9, PATHTOF(data\ace_spottingscope_reticle_b2_ca.paa), 1/2, PATHTOF(data\ace_spottingscope_reticle_b2_ca.paa)},
{14, PATHTOF(data\ace_spottingscope_reticle_b3_ca.paa), 1/3, PATHTOF(data\ace_spottingscope_reticle_b3_ca.paa)},
{19, PATHTOF(data\ace_spottingscope_reticle_b4_ca.paa), 1/4, PATHTOF(data\ace_spottingscope_reticle_b4_ca.paa)},
{24, PATHTOF(data\ace_spottingscope_reticle_b5_ca.paa), 1/5, PATHTOF(data\ace_spottingscope_reticle_b5_ca.paa)}
};
fadeReticleInterval[] = {10.5,9.5};
bodyTexture = QPATHTOF(data\ace_spottingscope_body_co.paa);
//bodyTextureNight = QPATHTOF(data\ace_spottingscope_body_co.paa);
bodyTextureSize = 1.5;
reticleSafezoneSize = 1;
hidePeripheralVision = 1;
opticsPPEffects[] = {QGVAR(OpticsRadBlur1)};
};
};
};

View File

@ -1,56 +0,0 @@
class RscOpticsValue;
class RscMapControl;
class RscText;
class RscPicture;
class RscInGameUI {
class RscUnitInfo;
class GVAR(RscUnitInfo): RscUnitInfo {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); {((_this select 0) displayCtrl _x) ctrlShow false} forEach [ARR_4(IDC_RETICLE,IDC_BODY,IDC_BLACK_LEFT,IDC_BLACK_RIGHT)]);
controls[] = {"CA_FOVMode","ScriptedReticleHelper","trippleHeadLeft","trippleHeadRight","Reticle","Body"}; // 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;
w = 0;
h = 0;
};
class ScriptedReticleHelper: RscMapControl {
onDraw = QUOTE(ctrlParent (_this select 0) call FUNC(animateReticle));
idc = -1;
w = 0;
h = 0;
};
class Reticle: RscPicture {
idc = IDC_RETICLE;
text = QPATHTOF(rsc\spotting_scope_reticle_co.paa);
x = POS_X;
y = POS_Y;
w = POS_W;
h = POS_H;
};
class Body: Reticle {
idc = IDC_BODY;
text = QPATHTOF(rsc\spotting_scope_body_co.paa);
};
//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
class trippleHeadLeft: RscText {
idc = IDC_BLACK_LEFT;
x = "safeZoneXAbs";
Y = "safezoneY";
w = QUOTE(POS_X_BASE(SIZEX) - safeZoneXAbs);
h = "safeZoneH";
colorBackground[] = {0,0,0,1};
};
class trippleHeadRight: trippleHeadLeft {
idc = IDC_BLACK_RIGHT;
x = QUOTE(safeZoneXAbs + safeZoneWAbs - (POS_X_BASE(SIZEX) - safeZoneXABS));
};
};
};

View File

@ -1,4 +1,2 @@
PREP(pickup);
PREP(place);
PREP(animateReticle);

View File

@ -16,4 +16,12 @@ PREP_RECOMPILE_END;
_tube addTorque (vectorNormalized [1 - random 2, 1 - random 2, 1 - random 2] vectorMultiply 4);
}] call CBA_fnc_addClassEventHandler;
["ACE_SpottingScopeObject", "GetOut", {
params ["_vehicle", "", "_unit"];
if (local _unit) then {
_unit setDir getDir _vehicle;
};
}] call CBA_fnc_addClassEventHandler;
ADDON = true;

View File

@ -18,5 +18,8 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgMoves.hpp"
#include "CfgOpticsEffect.hpp"
#include "RscInGameUI.hpp"
class CBA_PIPItems {
GVAR(enable) = "-";
};

View File

@ -1,47 +0,0 @@
#include "script_component.hpp"
/*
* Author: commy2
* Animate scripted reticle of spotting scope.
*
* Arguments:
* 0: Reticles RSC info display <DISPLAY>
*
* Return Value:
* None
*
* Example:
* [DISPLAY] call ace_spottingscope_fnc_animateReticle
*
* Public: No
*/
disableSerialization;
params ["_display"];
uinamespace setVariable [QGVAR(dlgSpottingScope), _display];
private _ctrlReticle = _display displayCtrl IDC_RETICLE;
private _ctrlBody = _display displayCtrl IDC_BODY;
private _ctrlBlackLeft = _display displayCtrl IDC_BLACK_LEFT;
private _ctrlBlackRight = _display displayCtrl IDC_BLACK_RIGHT;
// check if optics are used
// hide all controls otherwise
private _isUsingOptic = ctrlShown (_display displayCtrl 154);
_ctrlReticle ctrlShow _isUsingOptic;
_ctrlBody ctrlShow _isUsingOptic;
_ctrlBlackLeft ctrlShow _isUsingOptic;
_ctrlBlackRight ctrlShow _isUsingOptic;
// animate reticle
private _zoom = ([] call EFUNC(common,getZoom)) * MAGIC_SCOPE_NUMBER;
_ctrlReticle ctrlSetPosition [
POS_X_BASE(_zoom),
POS_Y_BASE(_zoom),
POS_W_BASE(_zoom),
POS_H_BASE(_zoom)
];
_ctrlReticle ctrlCommit 0;

View File

@ -16,14 +16,6 @@
#include "\z\ace\addons\main\script_macros.hpp"
#define IDC_RETICLE 10000
#define IDC_BODY 10001
#define IDC_BLACK_LEFT 10002
#define IDC_BLACK_RIGHT 10003
#define MAGIC_SCOPE_NUMBER 0.0235
//#define MAGIC_SCOPE_NUMBER (uiNamespace getVariable ['magic', 1])
#define POS_X_BASE(size) safezoneX + 0.5 * safezoneW - 0.5 * (size) / (getResolution select 5)
#define POS_Y_BASE(size) safezoneY + 0.5 * safezoneH - 0.5 * (size) / (getResolution select 5) * 4/3
#define POS_W_BASE(size) (size) / (getResolution select 5)