add testing scope

This commit is contained in:
commy2 2015-04-02 22:40:21 +02:00
parent f2d802eb90
commit 35ad71bbfd
9 changed files with 116 additions and 0 deletions

View File

@ -40,4 +40,29 @@ class CfgWeapons {
};
};
};
class ACE_optic_DMS: optic_DMS {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_DMS";
displayName = "LOCALIZE ACE DMR";
//descriptionShort = "$STR_A3_CFGWEAPONS_ACC_DMS1";
class ItemInfo: ItemInfo {
modelOptics = QUOTE(PATHTOF(ace_shortdot_optics.p3d));
class OpticsModes: OpticsModes {
class Snip: Snip {
opticsZoomMin = 0.05;
opticsZoomMax = 0.3;
opticsZoomInit = 0.3;
discretefov[] = {};
modelOptics[] = {};
};
};
};
};
};
class SlotInfo;
class CowsSlot: SlotInfo {
compatibleItems[] += {"ACE_optic_DMS"};
};

View File

@ -1,3 +1,6 @@
class RscText;
class RscTitles {
class ACE_Scopes_Zeroing {
idd = -1;
@ -65,6 +68,30 @@ class RscTitles {
};
};
};
class ACE_Shortdot_Reticle {
idd = -1;
onLoad = "uiNamespace setVariable ['ACE_ctrlShortdotReticle', (_this select 0) displayCtrl 1];";
duration = 999999;
fadeIn = 0;
fadeOut = 0;
name = "ACE_Shortdot_Reticle";
class controlsBackground {
class Debug_RscElement: RscText {
idc = 1;
style = 48;
size = 1;
sizeEx = 0;
font = "TahomaB";
text = "";
x = 0;
y = 0;
w = 0;
h = 0;
};
};
};
};
class RscInGameUI {

View File

@ -92,3 +92,13 @@ if !(hasInterface) exitWith {};
},
{false},
[201, [false, true, false]], false] call cba_fnc_addKeybind;
// init shortdot
["playerInventoryChanged", {
private "_optic";
_optic = _this select 1 select 9 select 2;
if (_optic == "ACE_optic_DMS" && {!(GETGVAR(shownShortdot,false))}) then {
[_optic] call FUNC(onShowShortdot);
};
}] call EFUNC(common,addEventHandler);

View File

@ -7,6 +7,8 @@ PREP(canAdjustScope);
PREP(firedEH);
PREP(getOptics);
PREP(inventoryCheck);
PREP(onDrawShortdot);
PREP(onShowShortdot);
PREP(showZeroing);
GVAR(fadeScript) = scriptNull;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
// by commy2
#include "script_component.hpp"
private ["_control", "_scope"];
_control = _this select 0 select 0;
_scope = _this select 0 select 1;
if (currentWeapon ACE_player != primaryWeapon ACE_player || {_scope != primaryWeaponItems ACE_player select 2}) exitWith {
_control ctrlShow false;
GVAR(shownShortdot) = 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
];
_control ctrlCommit 0;
_control ctrlShow true;

View File

@ -0,0 +1,18 @@
// by commy2
disableSerialization;
#include "script_component.hpp"
private ["_scope", "_control"];
_scope = _this select 0;
([QGVAR(reticle)] call BIS_fnc_rscLayer) cutRsc ["ACE_Shortdot_Reticle", "PLAIN", 0, false];
_control = uiNamespace getVariable "ACE_ctrlShortdotReticle";
_control ctrlSetText QUOTE(PATHTOF(data\reticles\ace_shortdot_reticle_1.paa));
GVAR(shownShortdot) = true;
[FUNC(onDrawShortdot), 0, [_control, _scope]] call CBA_fnc_addPerFrameHandler;