animate the scope

This commit is contained in:
commy2 2016-06-06 19:22:24 +02:00
parent be260e896b
commit cd43c17f80
4 changed files with 28 additions and 42 deletions

View File

@ -66,9 +66,10 @@ class CfgVehicles {
transportSoldier = 0;
getInAction = "GetInLow";
getOutAction = "GetOutLow";
opticsDisablePeripherialVision = 1;
class Turrets: Turrets {
class MainTurret: MainTurret {
turretInfoType = QGVAR(RscUnitInfo_SpottingScope);
turretInfoType = QGVAR(RscUnitInfo);
minTurn = -45;
maxTurn = 45;

View File

@ -5,9 +5,8 @@ class RscText;
class RscInGameUI {
class RscUnitInfo;
class GVAR(RscUnitInfo_SpottingScope): RscUnitInfo {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uinamespace setVariable [ARR_2(QUOTE(QUOTE(dlgSpottingScope)),_this select 0)]);
controls[] = {"CA_FOVMode","ScriptedReticleHelper","Body","Reticle","trippleHeadLeft","trippleHeadRight"}; // don't change this order
class GVAR(RscUnitInfo): RscUnitInfo {
controls[] = {"CA_FOVMode","ScriptedReticleHelper","Reticle","Body","trippleHeadLeft","trippleHeadRight"}; // 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;
@ -31,7 +30,7 @@ class RscInGameUI {
style = 48;
size = 0;
sizeEx = 1;
text = QPATHTOF(rsc\spotting_scope_body_co.paa);
text = QPATHTOF(rsc\spotting_scope_reticle_co.paa);
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0};
x = POS_X;
@ -42,7 +41,7 @@ class RscInGameUI {
class Body: Reticle {
idc = IDC_BODY;
text = QPATHTOF(rsc\spotting_scope_reticle_co.paa);
text = QPATHTOF(rsc\spotting_scope_body_co.paa);
x = POS_X;
y = POS_Y;
w = POS_W;

View File

@ -14,7 +14,9 @@
disableSerialization;
params ["_display"]; systemChat str _display;
params ["_display"];
//uinamespace setVariable [QGVAR(dlgSpottingScope), _display];
// check if optics are used
// hide all controls otherwise
@ -30,36 +32,13 @@ private _ctrlBody = _display displayCtrl IDC_BODY;
_ctrlReticle ctrlShow _isUsingOptic;
_ctrlBody ctrlShow _isUsingOptic;
private _zoom = ([] call EFUNC(common,getZoom)) * MAGIC_SCOPE_NUMBER;
/*
private _unit = call CBA_fnc_currentUnit;
if (currentWeapon _unit != primaryWeapon _unit || {_scope != primaryWeaponItems _unit select 2}) exitWith {
_control ctrlShow false;
[_this select 1] call CBA_fnc_removePerFrameHandler
};
if (cameraView != "GUNNER") exitWith {
_control ctrlShow false;
};
private ["_size", "_sizeX", "_sizeY"];
_size = ([0.5,0.5] distance worldToScreen positionCameraToWorld [0,1,1]) * (getResolution select 5);
_sizeX = _size/4;
_sizeY = _sizeX*safezoneW/safezoneH;
_control ctrlSetPosition [
safezoneX+0.5*safezoneW-0.5*_sizeX,
safezoneY+0.5*safezoneH-0.5*_sizeY,
_sizeX,
_sizeY
_ctrlReticle ctrlSetPosition [
POS_X_BASE(_zoom),
POS_Y_BASE(_zoom),
POS_W_BASE(_zoom),
POS_H_BASE(_zoom)
];
_control ctrlCommit 0;
_control ctrlShow true;
_ctrlReticle ctrlCommit 0;

View File

@ -21,9 +21,16 @@
#define IDC_BLACK_LEFT 10002
#define IDC_BLACK_RIGHT 10003
#define SIZEX 0.75/(getResolution select 5)
#define MAGIC_SCOPE_NUMBER 0.0775
#define POS_X QUOTE(safezoneX + 0.5 * safezoneW - 0.5 * SIZEX)
#define POS_Y QUOTE(safezoneY + 0.5 * safezoneH - 0.5 * SIZEX * 4/3)
#define POS_W QUOTE(SIZEX)
#define POS_H QUOTE(SIZEX * 4/3)
#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)
#define POS_H_BASE(size) (size) * (getResolution select 5) * 4/3
#define SIZEX 3.5
#define POS_X QUOTE(POS_X_BASE(SIZEX))
#define POS_Y QUOTE(POS_Y_BASE(SIZEX))
#define POS_W QUOTE(POS_W_BASE(SIZEX))
#define POS_H QUOTE(POS_H_BASE(SIZEX))