stuff in to merge folder

This commit is contained in:
commy2 2015-03-20 19:56:39 +01:00
parent a146be57f2
commit 955506dbe8
34 changed files with 794 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,25 @@
// TMR: Optics initialization and functions
// (C) 2013 Ryan Schultz. See LICENSE.
// Request a resource layer from the game engine.
AGM_Optics_scopeRSC = ["AGM_Optics_Scope"] call BIS_fnc_rscLayer;
// Set global variables
AGM_Optics_inScope = false; // Is the scope up?
AGM_Optics_currentOptic = ""; // What optic is attached right now?
0 = 0 spawn {
waituntil {!isNull (findDisplay 46)};
[] call AGM_Optics_fnc_initScope;
// PiP technique by BadBenson
AGM_Optics_Camera = "camera" camCreate (positioncameratoworld [0,0,0]);
AGM_Optics_Camera camSetFov 0.7;
AGM_Optics_Camera camSetTarget player;
AGM_Optics_Camera camCommit 1;
"agm_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]];
AGM_Optics_Camera cameraEffect ["INTERNAL", "BACK","agm_optics_rendertarget0"];
waitUntil {[] call AGM_Optics_fnc_mainLoop; False};
};

View File

@ -0,0 +1,454 @@
class CfgPatches {
class AGM_Optics {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = 0.1;
author[] = {"Taosenai"};
authorUrl = "http://www.ryanschultz.org/tmr/";
};
};
class CfgFunctions {
class AGM_Optics {
class AGM_Optics {
file = "AGM_Optics\functions";
class firedEH;
class hideScope;
class initScope;
class mainLoop;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Optics {
clientInit = "call compile preProcessFileLineNumbers '\AGM_Optics\clientInit.sqf'";
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_Optics {
clientFiredBIS = "_this call AGM_Optics_fnc_firedEH;";
};
};
};
class CfgOpticsEffect {
class AGM_OpticsRadBlur1 {
type = "radialblur";
params[] = {0.015, 0, 0.14, 0.2};
priority = 950;
};
};
class CfgWeapons {
class ItemCore;
class InventoryItem_Base_F;
class InventoryMuzzleItem_Base_F;
class InventoryOpticsItem_Base_F;
class optic_Hamr : ItemCore {
displayName = "HAMR 4x";
descriptionShort = "High Accuracy Multi-Range Optic<br />Magnification: 4x<br />Reticle: CM-RW 6.5mm";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\hamr\hamr-reticle65_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\hamr\hamr-reticle65Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\hamr\hamr-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\hamr\hamr-bodyNight_ca.paa";
model = "\A3\weapons_f\acc\acco_hamr_F";
class ItemInfo : InventoryOpticsItem_Base_F {
mass = 4;
optics = 1;
optictype = 1;
rmbhint = "HAMR";
modeloptics = "\AGM_Optics\agm_optics_pip.p3d";
class OpticsModes {
class Hamr2Collimator {
AGM_Optics_enhanced = 0;
opticsID = 1;
useModelOptics = 0;
opticsppeffects[] = {};
opticsFlare = 0;
opticsDisablePeripherialVision = 0;
opticsZoomMin = 0.375;
opticsZoomMax = 1;
opticsZoomInit = 0.75;
memoryPointCamera = "eye";
visionMode[] = {};
distanceZoomMin = 300;
distanceZoomMax = 300;
};
class Hamr2Scope {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "opticView";
opticsdisableperipherialvision = 0;
opticsdisplayname = "IHAMR";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur1", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626;
opticszoommax = 0.0872664626;
opticszoommin = 0.0872664626;
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\agm_optics_pip.p3d";
visionmode[] = {"Normal", "NVG"};
};
};
};
};
class optic_Arco : ItemCore {
descriptionshort = "Advanced Rifle Combat Optic<br />Magnification: 4x<br />Reticle: SpecterDR 6.5mm";
displayname = "ARCO 4x";
picture = "\A3\weapons_F\Data\UI\gear_acco_Arco_CA.paa";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
model = "\A3\weapons_f\acc\acco_Arco_F";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\arco\arco-reticle65_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\arco\arco-reticle65Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\arco\arco-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\arco\arco-bodyNight_ca.paa";
class ItemInfo: InventoryOpticsItem_Base_F {
mass = 4;
optics = 1;
optictype = 1;
rmbhint = "ARCO";
class OpticsModes {
class ARCO2collimator {
AGM_Optics_enhanced = 0;
cameradir = "";
distancezoommax = 300;
distancezoommin = 300;
memorypointcamera = "eye";
opticsdisableperipherialvision = 0;
opticsdisplayname = "CQB";
opticsflare = 0;
opticsid = 1;
opticsppeffects[] = {};
opticszoominit = 0.75;
opticszoommax = 1.1;
opticszoommin = 0.375;
usemodeloptics = 0;
visionmode[] = {};
};
class ARCO2scope: ARCO2collimator {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "opticView";
opticsdisableperipherialvision = 0;
opticsdisplayname = "ARCO";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur1", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626; // 0.0872664626 rad = 5 degrees
opticszoommax = 0.0872664626; // SpecterDR 4x is 6 degrees
opticszoommin = 0.0872664626; // Scope graphic in game covers 1 degree
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
visionmode[] = {"Normal"};
};
};
};
};
class optic_MRCO : ItemCore {
displayName = "MRCO 1x/4x";
descriptionShort = "Medium Range Combat Optic<br />Magnification: 1x/4x<br />Reticle: Pitbull Gen II 5.56mm";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\mrco\mrco-reticle556_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\mrco\mrco-reticle556Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\mrco\mrco-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\mrco\mrco-bodyNight_ca.paa";
class ItemInfo : InventoryOpticsItem_Base_F {
opticType = 1;
mass = 4;
optics = 1;
modelOptics = "\A3\Weapons_f_beta\acc\reticle_MRCO_F";
class OpticsModes {
class MRCOcq {
AGM_Optics_enhanced = 0;
opticsID = 1;
useModelOptics = 0;
opticsPPEffects[] = {};
opticsFlare = 0;
opticsDisablePeripherialVision = 0;
opticsZoomMin = 0.375;
opticsZoomMax = 1;
opticsZoomInit = 0.75;
memoryPointCamera = "eye";
visionMode[] = {};
distanceZoomMin = 100;
distanceZoomMax = 100;
};
class MRCOscope {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "eye";
opticsdisableperipherialvision = 0;
opticsdisplayname = "MRCO";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur2", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626;
opticszoommax = 0.0872664626;
opticszoommin = 0.0872664626;
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
visionmode[] = {"Normal"};
};
};
};
};
class optic_Nightstalker : ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class NCTALKEP {};
class Iron : NCTALKEP {
opticsppeffects[] = {}; // Fix Arma 3 bug
};
};
};
};
class optic_SOS: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
modelOptics = "\AGM_Optics\agm_optics_pip.p3d";
class OpticsModes {
class Snip {
visionMode[] = {"Normal","TI","NVG"};
thermalMode[] = {5,6};
opticsPPEffects[] = {"OpticsCHAbera1","radblur"};
modelOptics[] = {"\AGM_Optics\agm_optics_pip.p3d","\AGM_Optics\agm_optics_pip.p3d"};
};
};
};
};
class optic_DMS : ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {};
class Iron : Snip {
opticsppeffects[] = {}; // Fix Arma 3 bug
};
};
};
};
class optic_LRPS : ItemCore {
descriptionshort = "Nightforce NXS Riflescope<br />Magnification: 5.5-22x";
displayname = "NXS 5.5-22x";
weaponinfotype = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\sos\sos-reticleMLR_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\sos\sos-reticleMLRIllum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\sos\sos-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\sos\sos-bodyNight_ca.paa";
class ItemInfo: InventoryOpticsItem_Base_F {
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
weaponinfotype = "RscWeaponRangeZeroingFOV";
opticType = 2; // Sniper optics
class OpticsModes {
// Based on Nightforce NXS 5.5-22 scope
class Snip {
cameradir = "";
discretedistance[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300};
discretedistanceinitindex = 0;
discreteinitindex = 0;
distancezoommax = 2300;
distancezoommin = 100;
memorypointcamera = "opticView";
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
opticsdisableperipherialvision = 1;
opticsdisplayname = "SOS";
opticsflare = 1;
opticsid = 1;
opticsppeffects[] = {"OpticsCHAbera1", "OpticsBlur1", "AGM_OpticsRadBlur1"};
// How to determine opticszoom
// First do the basic math based on the listed FOV of the scope to
// get a baseline FOV
// 0.1 meter at 100 meters = 1 mrad
//
// 5.5x FOV -- 5.3 m at 100 m = 53 mrad
// = 0.053 rad = 3.037 deg FOV
// 22x FOV -- 1.4 m at 100m = 14 mrad
// = 0.014 rad = 0.802 deg
// The FOV you give the engine is based on a rather larger scope outline, so we
// have to do this extra work ourselves.
// At 1680x1050
// The width of a TMR optic viewfield is 864px
// The engine viewport width (which is what the below FOV is based on) is 980
// (864/980) = (FOV to give engine / true FOV of optic)
// 864/980 * 0.053 = 0.04673
// 864/980 * 0.014 = 0.01234
// Measured experimentally, these values seem quite right.
// Certainly they're close enough after you account for pixel density, etc.
opticszoominit = 0.01234;
opticszoommax = 0.04673;
opticszoommin = 0.01234;
discretefov[] = {};
usemodeloptics = 1;
visionmode[] = {"Normal"};
};
};
};
};
class optic_Yorris : ItemCore {
descriptionshort = "Burris FastFire II Red Dot Sight<br />Magnification: 1x";
displayname = "FastFire II";
};
class optic_MRD : ItemCore {
descriptionshort = "Eotech MRDS Red Dot Sight<br />Magnification: 1x";
displayname = "MRDS";
};
class optic_Holosight : ItemCore {
descriptionshort = "Eotech XPS3 Holographic Sight<br />Magnification: 1x";
displayname = "XPS3 Holo";
};
};
class RscOpticsText;
class RscOpticsValue;
class RscInGameUI {
class RscUnitInfo;
class RscWeaponZeroing;
class AGM_RscWeapon : RscWeaponZeroing {
idd = -1;
controls[] = {"CA_Zeroing", "CA_FOVMode"};
onLoad ="with uiNameSpace do { AGM_OpticsIGUI = _this select 0 }";
class CA_FOVMode : RscOpticsValue {
idc = 154;
style = 2;
colorText[] = {0, 0, 0, 0};
x = 0;
y = 0;
w = 0;
h = 0;
};
};
};
class RscTitles {
class AGM_Optics_Scope {
idd = -1;
onLoad = "with uiNameSpace do { AGM_Optics_Scope = _this select 0 };";
onUnload = "";
movingEnable = 1;
duration = 10000;
controls[] = {"Reticle", "ReticleNight", "BodyNight", "Body"};
class Reticle {
colorBackground[] = {0,0,0, 0};
colorText[] = {1,1,1, 1};
fade = 0;
font = "PuristaMedium";
h = SafeZoneH;
idc = 1;
lineSpacing = 1.0;
movingEnable = 1;
size = 0;
sizeEx = 1;
style = 48;
text = "";
type = 0;
w = SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1));
x = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1)))/2);
y = SafeZoneY;
};
class ReticleNight : Reticle {
idc = 2;
text = "";
};
class Body : Reticle {
idc = 6;
text = "";
x = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1))));
y = SafeZoneY - (SafeZoneH/2);
w = SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1)) * 2;
h = SafeZoneH * 2;
};
class BodyNight : Body {
idc = 5;
text = "";
};
};
};
class PreloadTextures {
class CfgWeapons {
class optic_hamr {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_arco {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_mrco {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_LRPS {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
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

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,149 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Animates the scope when firing.
*
* Arguments:
* 0: Unit
* 1: Weapon
* 2: Muzzle
* 3: Mode
* 4: Ammo
* 5: Magazine
* 6: Projectile
*
* Return Value:
* None
*/
if (_this select 0 != AGM_player) exitwith {}; // Sanity check
0 = _this spawn {
disableSerialization;
_weaponType = _this select 1;
_config = configFile >> "CfgWeapons" >> _weaponType;
_scope = uiNameSpace getVariable "AGM_Optics_Scope";
// @todo
_recoilMulti = getNumber (_config >> "tmr_smallarms_recoil_shakeMultiplier"); // Will be 0 if undefined
if (_recoilMulti == 0) then {
_recoilMulti = 1;
};
if (_recoilMulti > 2.6) then {
_recoilMulti = 2.6; // Don't get too high
};
// Reduce the reticle movement as the player drops into lower, supported stances.
_detectStance = (player selectionPosition "Neck" select 2);
if (_detectStance < 1.3) then {
_recoilMulti = _recoilMulti - 0.10;
};
if (_detectStance < 0.7) then {
_recoilMulti = _recoilMulti - 0.20;
};
// Reduce reticle movement if the player is rested (tmr_autorest).
if (player getVariable ["tmr_autorest_rested", false]) then {
_recoilMulti = _recoilMulti - 0.20;
};
// Reduce reticle movement if the player is deployed (tmr_autorest).
if (player getVariable ["tmr_autorest_deployed", false]) then {
_recoilMulti = _recoilMulti - 0.30;
};
_recoilMulti = 1;
// @endtodo
// Constants which determine how the scope recoils
_recoilScope = 0.03 * _recoilMulti + random 0.0015;
_recoilRing = 0.03 * _recoilMulti + random 0.0015;
_randomScopeShiftX = 0.005 * _recoilMulti - random 0.011;
_randomReticleShiftX = 0.0036 * _recoilMulti + random 0.0045; // Always tend up and right;
_randomReticleShiftY = -0.0046 * _recoilMulti - random 0.0055;
/////////
// Center everything
// getResolution select 4 should return the aspect ratio, but it's totally wrong
// for triple head displays. We'll compute it manually.
_aspectRatio = (getResolution select 0) / (getResolution select 1);
_reticleX = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / _aspectRatio)/2);
_reticleY = SafeZoneY;
_reticleW = SafeZoneWAbs / _aspectRatio;
_reticleH = SafeZoneH;
// Reticle
(_scope displayCtrl 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
// Reticle night (illum)
(_scope displayCtrl 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
_bodyX = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / _aspectRatio));
_bodyY = SafeZoneY - (SafeZoneH/2);
_bodyW = SafeZoneWAbs / _aspectRatio * 2;
_bodyH = SafeZoneH * 2;
// Body night
(_scope displayCtrl 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
// Body
(_scope displayCtrl 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
_centerDelay = 0.01;
(_scope displayCtrl 1) ctrlCommit _centerDelay;
(_scope displayCtrl 2) ctrlCommit _centerDelay;
(_scope displayCtrl 5) ctrlCommit _centerDelay;
(_scope displayCtrl 6) ctrlCommit _centerDelay;
/////////
// Create and commit recoil effect
// Move reticle
(_scope displayCtrl 1) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope];
(_scope displayCtrl 2) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope];
// Move body
(_scope displayCtrl 5) ctrlSetPosition [_bodyX - (_recoilScope/2) + _randomScopeShiftX, _bodyY - (_recoilScope/2), _bodyW + _recoilScope, _bodyH + _recoilScope];
(_scope displayCtrl 6) ctrlSetPosition [_bodyX - (_recoilScope/2) + _randomScopeShiftX, _bodyY - (_recoilScope/2), _bodyW + _recoilScope, _bodyH + _recoilScope];
_recoilDelay = 0.036;
_fa = false;
_cwm = currentWeaponMode player;
if (_cwm == "FullAuto" || _cwm == "manual" || _cwm == "Burst") then {
_recoilDelay = getNumber (_config >> _cwm >> "reloadTime")/2.2;
_fa = true;
};
(_scope displayCtrl 1) ctrlCommit _recoilDelay;
(_scope displayCtrl 2) ctrlCommit _recoilDelay;
(_scope displayCtrl 5) ctrlCommit _recoilDelay;
(_scope displayCtrl 6) ctrlCommit _recoilDelay;
//////////////
waituntil {sleep 0.01; ctrlCommitted (_scope displayCtrl 6)};
//////////////
//////
// Bring them all back
(_scope displayCtrl 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
(_scope displayCtrl 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
(_scope displayCtrl 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
(_scope displayCtrl 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
_recenterDelay = 0.09;
if (_fa) then {
_recenterDelay = getNumber (_config >> _cwm >> "reloadTime")/2.2;
};
(_scope displayCtrl 1) ctrlCommit _recenterDelay;
(_scope displayCtrl 2) ctrlCommit _recenterDelay;
(_scope displayCtrl 5) ctrlCommit _recenterDelay;
(_scope displayCtrl 6) ctrlCommit _recenterDelay;
};

View File

@ -0,0 +1,19 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Hides the scope.
*
*/
private ["_scope"];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlCommit 0;

View File

@ -0,0 +1,25 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Initializes the scope resources.
*
*/
private ["_display"];
// Make sure we only cutRsc when the resource isn't already available
if (isNil {uiNameSpace getVariable "AGM_Optics_Scope"} or {isNull (uiNameSpace getVariable "AGM_Optics_Scope")}) exitWith {
AGM_Optics_scopeRSC cutRsc ["AGM_Optics_Scope","PLAIN",0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlCommit 0;
True
};
False

View File

@ -0,0 +1,94 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Monitors the RscInGameUI and displays the overlays when needed.
*
* Arguments:
* None
*
* Return Value:
* None
*/
if !(cameraOn == AGM_player && {alive AGM_player} && {!visibleMap} && {ctrlShown ((uinamespace getVariable "AGM_OpticsIGUI") displayCtrl 154)}) exitWith {
// Failed the state check, hide the scope if it's up
if (AGM_Optics_inScope) then {
// Hide the scope
AGM_Optics_inScope = false;
AGM_Optics_inScope_FOV = ([] call cba_fnc_getFOV) select 0;
[] call AGM_Optics_fnc_hideScope;
};
};
AGM_Optics_Camera setposATL (positioncameratoworld [0,0,0.4]);
AGM_Optics_Camera camPrepareTarget (positioncameratoworld [0,0,50]);
AGM_Optics_Camera camCommitPrepared 0;
if (cameraView == "Gunner") then {
AGM_Optics_Camera camsetFOV 0.7;
AGM_Optics_Camera camcommit 0;
} else {
AGM_Optics_Camera camsetFOV 0.01;
AGM_Optics_Camera camcommit 0;
};
private ["_optic", "_scope"];
disableSerialization;
// Get the name of the attached optic
_optic = (primaryWeaponItems AGM_player) select 2;
_scope = uiNameSpace getVariable "AGM_Optics_Scope";
// Init the scope (if needed)
[] call AGM_Optics_fnc_initScope;
// Check if the optic has changed since we last drew it
_doUpdateAllLayers = false;
if (AGM_Optics_currentOptic != _optic) then {
AGM_Optics_currentOptic = _optic;
_doUpdateAllLayers = true;
};
// Check if Splendid Camera, unit switch, etc. has blanked out our displays for no good reason (grrr)
if (ctrlText (_scope displayCtrl 1) == "") then {
_doUpdateAllLayers = true;
};
// Draw the correct layers (don't show them)
if (_doUpdateAllLayers) then {
(_scope displayCtrl 1) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_reticle");
(_scope displayCtrl 2) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_reticleIllum");
(_scope displayCtrl 5) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_bodyNight");
(_scope displayCtrl 6) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_body");
};
// Stop processing if already in the scope view and FOV hasn't changed
if (AGM_Optics_inScope) exitwith {};
// Mark that we're in enhanced scope view
AGM_Optics_inScope = true;
// Calculate lighting
_lighting = sunOrMoon; // 1 is day, 0 is night
_nightOpacity = 1;
_dayOpacity = (0 max moonIntensity * (1 - (0 max overcast)))/5;
if (_lighting == 1) then {
_nightOpacity = 0;
_dayOpacity = 1;
};
// Apply lighting and make layers visible
(_scope displayCtrl 1) ctrlSetTextColor [1,1,1,1];
(_scope displayCtrl 2) ctrlSetTextColor [1,1,1,_nightOpacity];
(_scope displayCtrl 5) ctrlSetTextColor [1,1,1,_nightOpacity];
(_scope displayCtrl 6) ctrlSetTextColor [1,1,1,_dayOpacity];
(_scope displayCtrl 1) ctrlCommit 0;
(_scope displayCtrl 2) ctrlCommit 0;
(_scope displayCtrl 5) ctrlCommit 0;
(_scope displayCtrl 6) ctrlCommit 0;