3 Commando Brigade

Realism. Tactics. Fun.

+ New Topic + Post Reply
4 posts in this topic
Posted: Tue Dec 31, 2013 6:00 pm     Super secret spam barrier
Quote
Offline
Marine
Marine
Other duties:
Modder
Founder

Posts: 6832
Ribbons:
Service Medal (7) Donator (1) Modding Team (1)
Frag of the match (1) Operation Medal (1)

Issue with @TMR on Triple Screen setups


Not too bad at maths, but I don't think there's enough info here to understand what is required.
Is it that your scope looks squashed in the horizontal plane (not circular)?
Can you post all of the text in tmr_optics.pbo if it's not too huge?


Posted: Wed Jan 01, 2014 11:45 am     Super secret spam barrier
Quote
Offline
Marine
Marine
Other duties:
Modder
Founder

Posts: 6832
Ribbons:
Service Medal (7) Donator (1) Modding Team (1)
Frag of the match (1) Operation Medal (1)
Ok, so here's a start for experimentation.

I'll assume that as you know how to un-pbo the mod, you also know how to re-pbo it.

1. Make a back-up copy of tmr_optics.pbo
2. Edit config.cpp, changing this section (adds a comment, and "3 *" to variables x and w):

class RscTitles {
   class TMR_Optics_Scope {
      idd = -1;
      onLoad = "with uiNameSpace do { TMR_Optics_Scope = _this select 0 };";
      onUnload = "";
      movingEnable = 1;
      duration = 10000;
      controls[] = {"Reticle", "ReticleNight", "BodyNight", "Body"};
      class Reticle : TMR_RscPicture {
         idc = 1;
         movingEnable = 1;
         colorBackground[] = {0, 0, 0, 0};
         colorText[] = {1,1,1,1};
         fade = 0;
         text = "";
         // x and w edited to work with triple screen, 1080p x 3  (1920x1080 ---> 5760x1080)
         x = (SafeZoneX + SafeZoneW/2 - (3 * SafeZoneW / (getResolution select 4))/2);
         y = SafeZoneY;
         w = 3 * SafeZoneW / (getResolution select 4);
         h = SafeZoneH;
      };


3. Re-pbo tmr_optics.pbo

Start ArmA and test - use a daytime setting.

-------

Can you confirm what your effective 3 screen resolution is? I've assumed it's 3x1080p, ie. 5760x1080.
You mentioned 5720x1050 - if that's not a typo then we may need to adjust the multipliers to get a perfect match on screen.

Also, there is another section in config.cpp for "Night", so a further edit may be required.

Note that editing the TMR mod in this way will invalidate the bisign and you won't be able to play on servers requiring mod authentication.
This is also a temporary fix only for 3 screen users, and a more elegant way to detect and correct for 3 screens should be found by the author.

Anyway, let me know what you find.


Posted: Wed Jan 01, 2014 3:16 pm     Super secret spam barrier
Quote
Offline
Marine
Marine
Other duties:
Modder
Founder

Posts: 6832
Ribbons:
Service Medal (7) Donator (1) Modding Team (1)
Frag of the match (1) Operation Medal (1)
Hi J2 Ninja,

It was nice to chat with you earlier, glad we're getting somewhere with this.
I think I've found the problem about it resetting after you fire. We also needed to change some code in init.sqf.

Basically everywhere there is a "getResolution" statement we need to add a "3 *" multiplier.

I've uploaded the packed tmr_optics.pbo to TS>File Transfer so you can just grab that and drop it in the folder.
Alternatively here are the full file contents for manual editing.

init.sqf 
TMR: Optics initialization and functions
// (C) 2013 Ryan Schultz. See LICENSE.
tmr_optics = false;
// Set global variables
tmr_optics_inScope = false; // Is the scope up?
tmr_optics_currentOptic = ""; // What optic is attached right now?
#define TMR_SCOPECTRL (uiNameSpace getVariable "TMR_Optics_Scope") displayCtrl
// -------------------------------------------------------------------------------
// Init the scope resources if they are not already available.
// -------------------------------------------------------------------------------
tmr_optics_fnc_initScope = {
   _initNeeded = false;
   _return = false;
   // Make sure we only cutRsc when the resource isn't already available
   if (isNil {uiNameSpace getVariable "TMR_Optics_Scope"}) then {
      _initNeeded = true;
   };
   if (isNull (uiNameSpace getVariable "TMR_Optics_Scope")) then {
      _initNeeded = true;
   };
   if (_initNeeded) then {
      tmr_optics_scopeRsc cutRsc ["TMR_Optics_Scope","PLAIN",0];
      (TMR_SCOPECTRL 1) ctrlSetTextColor [1,1,1,0]; 
      (TMR_SCOPECTRL 2) ctrlSetTextColor [1,1,1,0]; 
      (TMR_SCOPECTRL 5) ctrlSetTextColor [1,1,1,0]; 
      (TMR_SCOPECTRL 6) ctrlSetTextColor [1,1,1,0]; 
      (TMR_SCOPECTRL 1) ctrlCommit 0; 
      (TMR_SCOPECTRL 2) ctrlCommit 0; 
      (TMR_SCOPECTRL 5) ctrlCommit 0; 
      (TMR_SCOPECTRL 6) ctrlCommit 0; 
      _return = true;
   };
   _return;
};
// -------------------------------------------------------------------------------
// Instantly hide all scope elements.
// -------------------------------------------------------------------------------
tmr_optics_fnc_hideScope = {
   (TMR_SCOPECTRL 1) ctrlSetTextColor [1,1,1,0]; 
   (TMR_SCOPECTRL 2) ctrlSetTextColor [1,1,1,0]; 
   (TMR_SCOPECTRL 5) ctrlSetTextColor [1,1,1,0]; 
   (TMR_SCOPECTRL 6) ctrlSetTextColor [1,1,1,0]; 
   (TMR_SCOPECTRL 1) ctrlCommit 0; 
   (TMR_SCOPECTRL 2) ctrlCommit 0; 
   (TMR_SCOPECTRL 5) ctrlCommit 0; 
   (TMR_SCOPECTRL 6) ctrlCommit 0; 
   //"Radialblur" ppeffectenable false;
   //"Radialblur" ppEffectAdjust [0, 0, 0.24, 0.24];
   //"Radialblur" ppEffectCommit 0;
};
// -------------------------------------------------------------------------------
// Fired EH: Animate the scope and reticle on firing.
// -------------------------------------------------------------------------------
tmr_optics_fnc_scopeRecoil_firedEH = {
   _this spawn {
      // [unit, weapon, muzzle, mode, ammo, magazine, projectile]
      if (_this select 0 != player) exitwith {}; // Sanity check
         
      _weaponType = _this select 1;
      _config = configFile >> "CfgWeapons" >> _weaponType;
      _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;
      };  
      // 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
      _reticleX = (SafeZoneX + SafeZoneW/2 - (3 * SafeZoneW / (getResolution select 4))/2);
      _reticleY = SafeZoneY;
      _reticleW = 3 * SafeZoneW / (getResolution select 4);
      _reticleH = SafeZoneH;
      // Reticle
      (TMR_SCOPECTRL 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
      // Reticle night (illum)
      (TMR_SCOPECTRL 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
      _bodyX = (SafeZoneX + SafeZoneW/2 - (3 * SafeZoneW / (getResolution select 4)));
      _bodyY = SafeZoneY - (SafeZoneH/2);
      _bodyW = 3 * SafeZoneW / (getResolution select 4) * 2;
      _bodyH = SafeZoneH * 2; 
      // Body night
      (TMR_SCOPECTRL 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
      // Body
      (TMR_SCOPECTRL 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
      _centerDelay = 0.01;
      (TMR_SCOPECTRL 1) ctrlCommit _centerDelay; 
      (TMR_SCOPECTRL 2) ctrlCommit _centerDelay; 
      (TMR_SCOPECTRL 5) ctrlCommit _centerDelay; 
      (TMR_SCOPECTRL 6) ctrlCommit _centerDelay; 
      /////////
      // Create and commit recoil effect
      // Move reticle
      (TMR_SCOPECTRL 1) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope]; 
      (TMR_SCOPECTRL 2) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope]; 
      // Move body
      (TMR_SCOPECTRL 5) ctrlSetPosition [_bodyX - (_recoilScope/2) + _randomScopeShiftX, _bodyY - (_recoilScope/2), _bodyW + _recoilScope, _bodyH + _recoilScope]; 
      (TMR_SCOPECTRL 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;
      };
      (TMR_SCOPECTRL 1) ctrlCommit _recoilDelay; 
      (TMR_SCOPECTRL 2) ctrlCommit _recoilDelay; 
      (TMR_SCOPECTRL 5) ctrlCommit _recoilDelay; 
      (TMR_SCOPECTRL 6) ctrlCommit _recoilDelay; 
      //////////////
      waituntil {ctrlCommitted (TMR_SCOPECTRL 6)};
      //////////////
      //////
      // Bring them all back
      (TMR_SCOPECTRL 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
      (TMR_SCOPECTRL 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
      (TMR_SCOPECTRL 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
      (TMR_SCOPECTRL 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];  
      _recenterDelay = 0.09;
      if (_fa) then {
         _recenterDelay =  getNumber (_config >> _cwm >> "reloadTime")/2.2;
      };
      (TMR_SCOPECTRL 1) ctrlCommit _recenterDelay; 
      (TMR_SCOPECTRL 2) ctrlCommit _recenterDelay;
      (TMR_SCOPECTRL 5) ctrlCommit _recenterDelay;
      (TMR_SCOPECTRL 6) ctrlCommit _recenterDelay;
   };
};
/////////////////////////////////////////////////////////////////////////////////
// Request a resource layer from the game engine.
tmr_optics_scopeRsc = ["TMR_Optics_Scope"] call BIS_fnc_rscLayer;
// Display the resource layers 
[] call tmr_optics_fnc_initScope;
// This loop monitors the RscInGameUI tied to TMR-enhanced optics and
// displays the overlays when needed.
tmr_optics_loop = true;
[] spawn {
   while {tmr_optics_loop} do {
      sleep 0.03;
      if (cameraon == player && alive player && ctrlShown ((uinamespace getVariable "TMR_OpticsIGUI") displayCtrl 154)) then {  
         // Get the name of the attached optic
         _optic = (primaryWeaponItems player) select 2; 
         // Check if the optic has changed since we last drew it
         _doUpdateAllLayers = false;
         if (tmr_optics_currentOptic != _optic) then {
            tmr_optics_currentOptic = _optic;
            // Graphics layers will need updated for the new scope
            _doUpdateAllLayers = true;
         };
         // Check if Splendid Camera, unit switch, etc. has blanked out our displays for no good reason (grrr)
         if (ctrlText (TMR_SCOPECTRL 1) == "") then {
               _doUpdateAllLayers = true;
         };
         // Init the scope (if needed)
         [] call tmr_optics_fnc_initScope;
         // Draw the correct layers (don't show them)
         if (_doUpdateAllLayers) then { 
            (TMR_SCOPECTRL 1) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "tmr_optics_reticle");
            (TMR_SCOPECTRL 2) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "tmr_optics_reticleIllum");
            (TMR_SCOPECTRL 5) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "tmr_optics_bodyNight");
            (TMR_SCOPECTRL 6) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "tmr_optics_body");
         };
         // Show the optic layers
         //////////////////////////////////////
         // Stop processing if already in the scope view and FOV hasn't changed
         if (tmr_optics_inScope) exitwith {};
         // Mark that we're in enhanced scope view
         tmr_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
         (TMR_SCOPECTRL 1) ctrlSetTextColor [1,1,1,1]; 
         (TMR_SCOPECTRL 2) ctrlSetTextColor [1,1,1,_nightOpacity]; 
         (TMR_SCOPECTRL 5) ctrlSetTextColor [1,1,1,_nightOpacity]; 
         (TMR_SCOPECTRL 6) ctrlSetTextColor [1,1,1,_dayOpacity]; 
         (TMR_SCOPECTRL 1) ctrlCommit 0;
         (TMR_SCOPECTRL 2) ctrlCommit 0; 
         (TMR_SCOPECTRL 5) ctrlCommit 0; 
         (TMR_SCOPECTRL 6) ctrlCommit 0; 
      } else {
         // Failed the state check, hide the scope if it's up
         if (tmr_optics_inScope) then {
            // Hide the scope
            tmr_optics_inScope = false;
            tmr_optics_inScope_FOV = ([] call cba_fnc_getFOV) select 0;
            [] call tmr_optics_fnc_hideScope;
         };
      };
   };
};
/////////////////////////////////////////////////////////////////////////////////
// Initialization complete.
tmr_optics = true;


config.cpp
fine true   1
#define false   0
class CfgPatches {
   class tmr_optics {
      units[] = {};
      weapons[] = {};
      requiredVersion = 0.60;
      requiredAddons[] = {A3_Weapons_F, A3_Weapons_F_beta, A3_Weapons_F_gamma, A3_Weapons_F_Acc, A3_Weapons_F_Beta_Acc, A3_Characters_F, tmr_core};
      version = 0.1;
      author[] = {"Taosenai"};
      authorUrl = "http://www.ryanschultz.org/tmr/";
   };
};
class CfgMods {
   class tmr_optics {
      dir = "tmr_optics";
      name = "TMR: Optics Module";
      picture = "";
      hidePicture = "true";
      hideName = "true";
      actionName = "Website";
      action = "http://www.ryanschultz.org/tmr/";
   };
};
class Extended_PostInit_EventHandlers {
   class tmr_optics {
      clientInit = "call compile preProcessFileLineNumbers '\tmr_optics\init.sqf'";
   };
};
class Extended_FiredBIS_EventHandlers {
   class CAManBase {
      class tmr_optics {
         clientFiredBISPlayer = "_this call tmr_optics_fnc_scopeRecoil_firedEH;";
      };
   };
};
class CfgOpticsEffect {
   class TMR_OpticsRadBlur1 {
      type = "radialblur";
      params[] = {0.019, 0.019, 0.16, 0.70};
      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 = "RscWeaponTMR";
      tmr_optics_enhanced = 1;
      tmr_optics_reticle = "\tmr_optics\data\hamr\hamr-reticle65_ca.paa";
      tmr_optics_reticleIllum = "\tmr_optics\data\hamr\hamr-reticle65Illum_ca.paa";
      tmr_optics_body = "\tmr_optics\data\hamr\hamr-body_ca.paa";
      tmr_optics_bodyNight = "\tmr_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";
         class OpticsModes {  
            class Hamr2Collimator {
               tmr_optics_enhanced = 0;
               opticsID = 1;
               useModelOptics = 0;
               opticsPPEffects[] = {""};
               opticsFlare = false;
               opticsDisablePeripherialVision = false;
               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", "TMR_OpticsRadBlur1"};
               opticszoominit = 0.0872664626;
               opticszoommax = 0.0872664626;
               opticszoommin = 0.0872664626;
               discretefov[] = {0.0872664626};
               discreteinitindex = 0;
               usemodeloptics = 1;
               modeloptics = "\tmr_optics\data\tmr_optics_reticle80.p3d";
               visionmode[] = {"Normal"};
            };
         };
      };
   };
   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 = "RscWeaponTMR";
      model = "\A3\weapons_f\acc\acco_Arco_F";
      tmr_optics_enhanced = 1;
      tmr_optics_reticle = "\tmr_optics\data\arco\arco-reticle65_ca.paa";
      tmr_optics_reticleIllum = "\tmr_optics\data\arco\arco-reticle65Illum_ca.paa";
      tmr_optics_body = "\tmr_optics\data\arco\arco-body_ca.paa";
      tmr_optics_bodyNight = "\tmr_optics\data\arco\arco-bodyNight_ca.paa";
      class ItemInfo: InventoryOpticsItem_Base_F {
         mass = 4;
         optics = 1;
         optictype = 1;
         rmbhint = "ARCO";
         class OpticsModes {
            class ARCO2collimator {
               tmr_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", "TMR_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 = "\tmr_optics\data\tmr_optics_reticle80.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 = "RscWeaponTMR";
      tmr_optics_enhanced = 1;
      tmr_optics_reticle = "\tmr_optics\data\mrco\mrco-reticle556_ca.paa";
      tmr_optics_reticleIllum = "\tmr_optics\data\mrco\mrco-reticle556Illum_ca.paa";
      tmr_optics_body = "\tmr_optics\data\mrco\mrco-body_ca.paa";
      tmr_optics_bodyNight = "\tmr_optics\data\mrco\mrco-bodyNight_ca.paa";
     
      class ItemInfo : InventoryOpticsItem_Base_F {
         opticType = 1;
         mass = 4;
         optics = true;
         modelOptics = "\A3\Weapons_f_beta\acc\reticle_MRCO_F";
         class OpticsModes {
            class MRCOcq {
               tmr_optics_enhanced = 0;
               opticsID = 1;
               useModelOptics = 0;
               opticsPPEffects[] = {""};
               opticsFlare = false;
               opticsDisablePeripherialVision = false;
               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", "TMR_OpticsRadBlur1"};
               opticszoominit = 0.0872664626;
               opticszoommax = 0.0872664626;
               opticszoommin = 0.0872664626;
               discretefov[] = {0.0872664626};
               discreteinitindex = 0;
               usemodeloptics = 1;
               modeloptics = "\tmr_optics\data\tmr_optics_reticle80.p3d";
               visionmode[] = {"Normal"};
            };
         };
      };
   };
   class optic_SOS: ItemCore {
      descriptionshort = "Sniper Optical Sight<br />Magnification: 5.5-22x";
      displayname = "SOS 5.5-22x";
      weaponinfotype = "RscWeaponTMR";
      tmr_optics_enhanced = 1;
      tmr_optics_reticle = "\tmr_optics\data\sos\sos-reticleMLR_ca.paa";
      tmr_optics_reticleIllum = "\tmr_optics\data\sos\sos-reticleMLRIllum_ca.paa";
      tmr_optics_body = "\tmr_optics\data\sos\sos-body_ca.paa";
      tmr_optics_bodyNight = "\tmr_optics\data\sos\sos-bodyNight_ca.paa";
      class ItemInfo: InventoryOpticsItem_Base_F {
         modeloptics = "\tmr_optics\data\tmr_optics_reticle80.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 = "\tmr_optics\data\tmr_optics_reticle80.p3d";
               opticsdisableperipherialvision = 1;
               opticsdisplayname = "SOS";
               opticsflare = 1;
               opticsid = 1;
               opticsppeffects[] = {"OpticsCHAbera1", "OpticsBlur1", "TMR_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 Iron: Snip {
               discretefov[] = {};
               memorypointcamera = "eye";
               opticsdisableperipherialvision = 0;
               opticsdisplayname = "";
               opticsflare = 0;
               opticsid = 2;
               opticszoominit = 0.75;
               opticszoommax = 1.1;
               opticszoommin = 0.375;
               usemodeloptics = 0;
               visionmode[] = {};
               opticsppeffects[] = {};
            };
         };
      };
   };
};
class RscControlsGroup;
class RscOpticsText;
class RscOpticsValue;
class RscInGameUI {
   class RscUnitInfo;
   class RscWeaponZeroing;
   class RscWeaponTMR : RscWeaponZeroing {
      idd = -1;
      controls[] = {"CA_Zeroing",  "CA_FOVMode"};
      onLoad ="with uiNameSpace do { TMR_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 TMR_RscPicture {
   type = 0;
   style = 48;
   idc = -1;
   colorBackground[] = {1, 1, 1, 1};
   colorText[] = {1, 1, 1, 1};
   font = "PuristaMedium";
   size = 0;
   sizeEx = 1;
   lineSpacing = 1.0; 
};
class RscTitles {
   class TMR_Optics_Scope {
      idd = -1;
      onLoad = "with uiNameSpace do { TMR_Optics_Scope = _this select 0 };";
      onUnload = "";
      movingEnable = 1;
      duration = 10000;
      controls[] = {"Reticle", "ReticleNight", "BodyNight", "Body"};
      class Reticle : TMR_RscPicture {
         idc = 1;
         movingEnable = 1;
         colorBackground[] = {0, 0, 0, 0};
         colorText[] = {1,1,1,1};
         fade = 0;
         text = "";
         // x and w edited to work with triple screen, 1080p x 3  (1920x1080 ---> 5760x1080)        
         x = (SafeZoneX + SafeZoneW/2 - (3 * SafeZoneW / (getResolution select 4))/2);
         y = SafeZoneY;
         w = 3 * SafeZoneW / (getResolution select 4);
         h = SafeZoneH;
      };
      class ReticleNight : Reticle {
         idc = 2;
         text = "";
      };
      class BodyNight : Reticle {
         idc = 5;
         text = "";
         // x and w edited to work with triple screen, 1080p x 3  (1920x1080 ---> 5760x1080)        
         x = (SafeZoneX + SafeZoneW/2 - (3 * SafeZoneW / (getResolution select 4)));
         y = SafeZoneY - (SafeZoneH/2);
         w = 3 * SafeZoneW / (getResolution select 4) * 2;
         h = SafeZoneH * 2;
      };
      class Body : BodyNight {
         idc = 6;
         text = "";
      };
   };
};
class PreloadTextures {
   class CfgWeapons {
      class optic_hamr {
         tmr_optics_body= "*";
         tmr_optics_bodyNight = "*";
         tmr_optics_reticle = "*";
         tmr_optics_reticleIllum = "*";
      };
      class optic_arco {
         tmr_optics_body= "*";
         tmr_optics_bodyNight = "*";
         tmr_optics_reticle = "*";
         tmr_optics_reticleIllum = "*";
      };
      class optic_mrco {
         tmr_optics_body= "*";
         tmr_optics_bodyNight = "*";
         tmr_optics_reticle = "*";
         tmr_optics_reticleIllum = "*";
      };
      class optic_SOS {
         tmr_optics_body= "*";
         tmr_optics_bodyNight = "*";
         tmr_optics_reticle = "*";
         tmr_optics_reticleIllum = "*";
      };
   };
};


Posted: Fri Jan 03, 2014 1:04 pm     Super secret spam barrier
Quote
Offline
Marine
Marine
Other duties:
Modder
Founder

Posts: 6832
Ribbons:
Service Medal (7) Donator (1) Modding Team (1)
Frag of the match (1) Operation Medal (1)
That's very generous of you, thanks J2N!


+ New Topic + Post Reply


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

phpBB © Forum Software
© 3 Commando Brigade Gaming Community
All images belong to their respective owners


3CB Modern design by Jamie Goodson
WysiBB