mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
animated reticle for spotting scope
This commit is contained in:
parent
fe03272dc6
commit
be260e896b
@ -7,13 +7,13 @@ class Extended_PreStart_EventHandlers {
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,8 @@ class CfgVehicles {
|
||||
getOutAction = "GetOutLow";
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
turretInfoType = QGVAR(RscUnitInfo_SpottingScope);
|
||||
|
||||
minTurn = -45;
|
||||
maxTurn = 45;
|
||||
initTurn = 0;
|
||||
@ -78,7 +80,7 @@ class CfgVehicles {
|
||||
weapons[] = {};
|
||||
magazines[] = {};
|
||||
gunnerOpticsColor[] = {1,1,1,1};
|
||||
gunnerOpticsmodel = QPATHTOF(data\m144_optic.p3d);
|
||||
gunnerOpticsmodel = "\A3\Weapons_F\empty"; //QPATHTOF(data\m144_optic.p3d);
|
||||
gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"};
|
||||
gunnerOutOpticsShowCursor = 0;
|
||||
gunnerOpticsShowCursor = 0;
|
||||
|
68
addons/spottingscope/RscInGameUI.hpp
Normal file
68
addons/spottingscope/RscInGameUI.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
class RscOpticsValue;
|
||||
class RscMapControl;
|
||||
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 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;
|
||||
style = 2;
|
||||
colorText[] = {0,0,0,0};
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = 0;
|
||||
h = 0;
|
||||
};
|
||||
|
||||
class ScriptedReticleHelper: RscMapControl {
|
||||
onDraw = QUOTE(ctrlParent (_this select 0) call FUNC(animateReticle));
|
||||
idc = -1;
|
||||
w = 0;
|
||||
h = 0;
|
||||
};
|
||||
|
||||
class Reticle: RscText {
|
||||
idc = IDC_RETICLE;
|
||||
style = 48;
|
||||
size = 0;
|
||||
sizeEx = 1;
|
||||
text = QPATHTOF(rsc\spotting_scope_body_co.paa);
|
||||
colorText[] = {1,1,1,1};
|
||||
colorBackground[] = {0,0,0,0};
|
||||
x = POS_X;
|
||||
y = POS_Y;
|
||||
w = POS_W;
|
||||
h = POS_H;
|
||||
};
|
||||
|
||||
class Body: Reticle {
|
||||
idc = IDC_BODY;
|
||||
text = QPATHTOF(rsc\spotting_scope_reticle_co.paa);
|
||||
x = POS_X;
|
||||
y = POS_Y;
|
||||
w = POS_W;
|
||||
h = POS_H;
|
||||
};
|
||||
|
||||
//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 = "(safezoneX - safeZoneXAbs) * ((getResolution select 4)/(16/3))";
|
||||
H = "safeZoneH";
|
||||
colorBackground[] = {0,0,0,1};
|
||||
};
|
||||
|
||||
class trippleHeadRight: trippleHeadLeft {
|
||||
idc = IDC_BLACK_RIGHT;
|
||||
x = "safeZoneXAbs + safeZoneWAbs - (safezoneX - safeZoneXABS) * ((getResolution select 4)/(16/3))";
|
||||
};
|
||||
};
|
||||
};
|
@ -1,3 +1,4 @@
|
||||
|
||||
PREP(pickup);
|
||||
PREP(place);
|
||||
PREP(animateReticle);
|
||||
|
@ -17,3 +17,5 @@ class CfgPatches {
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgMoves.hpp"
|
||||
|
||||
#include "RscInGameUI.hpp"
|
||||
|
Binary file not shown.
Binary file not shown.
65
addons/spottingscope/functions/fnc_animateReticle.sqf
Normal file
65
addons/spottingscope/functions/fnc_animateReticle.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Animate scripted reticle of spotting scope.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Reticles RSC info display <DISPLAY>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
|
||||
params ["_display"]; systemChat str _display;
|
||||
|
||||
// check if optics are used
|
||||
// hide all controls otherwise
|
||||
private _isUsingOptic = ctrlShown (_display displayCtrl 154);
|
||||
|
||||
(_display displayCtrl IDC_BLACK_LEFT) ctrlShow _isUsingOptic;
|
||||
(_display displayCtrl IDC_BLACK_RIGHT) ctrlShow _isUsingOptic;
|
||||
|
||||
// animate reticle
|
||||
private _ctrlReticle = _display displayCtrl IDC_RETICLE;
|
||||
private _ctrlBody = _display displayCtrl IDC_BODY;
|
||||
|
||||
_ctrlReticle ctrlShow _isUsingOptic;
|
||||
_ctrlBody ctrlShow _isUsingOptic;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
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
|
||||
];
|
||||
_control ctrlCommit 0;
|
||||
_control ctrlShow true;
|
||||
|
||||
|
BIN
addons/spottingscope/rsc/spotting_scope_body_co.paa
Normal file
BIN
addons/spottingscope/rsc/spotting_scope_body_co.paa
Normal file
Binary file not shown.
BIN
addons/spottingscope/rsc/spotting_scope_reticle_co.paa
Normal file
BIN
addons/spottingscope/rsc/spotting_scope_reticle_co.paa
Normal file
Binary file not shown.
@ -15,3 +15,15 @@
|
||||
#endif
|
||||
|
||||
#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 SIZEX 0.75/(getResolution select 5)
|
||||
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user