Merge pull request #3880 from acemod/spotting_scope_animated_reticle

Update Spotting Scope
This commit is contained in:
commy2 2016-06-07 19:41:09 +02:00
commit 24ce8b7753
23 changed files with 274 additions and 334 deletions

View File

@ -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));
};
};

View File

@ -1,5 +1,5 @@
class CBA_Extended_EventHandlers;
class CBA_Extended_EventHandlers_base;
class CfgVehicles {
class Man;
@ -18,6 +18,140 @@ class CfgVehicles {
};
};
class LandVehicle;
class StaticWeapon: LandVehicle {
class Turrets;
class ACE_Actions {
class ACE_MainActions;
};
};
class StaticATWeapon: StaticWeapon {
class Turrets: Turrets {
class MainTurret;
};
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {};
};
};
class ACE_SpottingScopeObject: StaticATWeapon {
EGVAR(dragging,canDrag) = 1;
EGVAR(dragging,dragPosition)[] = {0,1,0};
EGVAR(dragging,dragDirection) = 0;
class ACE_Actions: ACE_Actions{
class ACE_MainActions: ACE_MainActions {
selection = "main_gun";
class ACE_Pickup {
selection = "";
displayName = CSTRING(PickUp);
distance = 5;
condition = QUOTE((alive _target) && (count (crew _target) == 0));
statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup));
showDisabled = 0;
exceptions[] = {};
priority = 5;
icon = QPATHTOF(UI\w_spottingscope_ca.paa);
};
};
};
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {};
};
author = ECSTRING(common,ACETeam);
scope = 1;
side = 1;
typicalCargo[] = {"Soldier"};
displayName = CSTRING(DisplayName);
model = QPATHTOF(data\ace_spottingscope.p3d);
mapSize = 0.5;
transportSoldier = 0;
getInAction = "GetInLow";
getOutAction = "GetOutLow";
editorSubcategory = "EdSubcat_Turrets";
class Turrets: Turrets {
class MainTurret: MainTurret {
minTurn = -45;
maxTurn = 45;
initTurn = 0;
minElev = -10;
maxElev = 40;
initElev = 0;
class ViewGunner {
initAngleX = 5;
minAngleX = -30;
maxAngleX = 30;
initAngleY = 0;
minAngleY = -100;
maxAngleY = 100;
initFov = 0.75;
minFov = 0.25;
maxFov = 1.25;
};
class ViewOptics {
initAngleX = 0;
minAngleX = -30;
maxAngleX = 30;
initAngleY = 0;
minAngleY = -100;
maxAngleY = 100;
minFov = 0.0025;
maxFov = 0.05;
initFov= 0.05;
};
weapons[] = {};
magazines[] = {};
gunnerOpticsColor[] = {1,1,1,1};
gunnerOpticsModel = "\A3\Weapons_F\empty"; //QPATHTOF(data\m144_optic.p3d);
gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"};
gunnerOutOpticsShowCursor = 0;
gunnerOpticsShowCursor = 0;
gunnerAction = "ACE_SpottingScope";
gunnerGetInAction = "GetInLow";
gunnerGetOutAction = "GetOutLow";
gunnerForceOptics = 0;
ejectDeadGunner = 0;
turretInfoType = QGVAR(RscUnitInfo);
opticsDisablePeripherialVision = 1;
};
};
};
class ACE_B_SpottingScope: ACE_SpottingScopeObject {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_B_SpottingScope";
scope = 2;
side = 1;
faction = "BLU_F";
crew = "B_spotter_F";
};
class ACE_O_SpottingScope: ACE_SpottingScopeObject {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_O_SpottingScope";
scope = 2;
side = 0;
faction = "OPF_F";
crew = "O_spotter_F";
};
class ACE_I_SpottingScope: ACE_SpottingScopeObject {
author = ECSTRING(common,ACETeam);
_generalMacro = "ACE_I_SpottingScope";
scope = 2;
side = 2;
faction = "IND_F";
crew = "I_spotter_F";
};
class Item_Base_F;
class ACE_Item_SpottingScope: Item_Base_F {
author[] = {"Rocko", "Scubaman3D"};
@ -36,99 +170,4 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_SpottingScope,2);
};
};
class LandVehicle;
class StaticWeapon: LandVehicle {
class Turrets;
class ACE_Actions {
class ACE_MainActions {};
};
};
class StaticATWeapon: StaticWeapon {
class Turrets: Turrets {
class MainTurret;
};
class ACE_Actions: ACE_Actions{
class ACE_MainActions: ACE_MainActions {};
};
};
class ACE_SpottingScopeObject: StaticATWeapon {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
scope = 1;
side = 1;
typicalCargo[] = {"Soldier"};
displayName = CSTRING(DisplayName);
model = QPATHTOF(data\ace_spottingscope.p3d);
mapSize = 0.5;
transportSoldier = 0;
getInAction = "GetInLow";
getOutAction = "GetOutLow";
class Turrets: Turrets {
class MainTurret: MainTurret {
minTurn = -45;
maxTurn = 45;
initTurn = 0;
minElev = -10;
maxElev = 40;
initElev = 0;
weapons[] = {};
magazines[] = {};
gunnerOpticsColor[] = {1,1,1,1};
gunnerOpticsmodel = QPATHTOF(data\m144_optic.p3d);
gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"};
gunnerOutOpticsShowCursor = 0;
gunnerOpticsShowCursor = 0;
gunnerAction = "ACE_SpottingScope";
gunnerGetInAction = "GetInLow";
gunnerGetOutAction = "GetOutLow";
gunnerForceOptics = 0;
ejectDeadGunner = 0;
class ViewGunner {
initAngleX = 5;
minAngleX = -30;
maxAngleX = 30;
initAngleY = 0;
minAngleY = -100;
maxAngleY = 100;
initFov = 0.75;
minFov = 0.25;
maxFov = 1.25;
};
class ViewOptics {
initAngleX = 0;
minAngleX = -30;
maxAngleX = 30;
initAngleY = 0;
minAngleY = -100;
maxAngleY = 100;
minFov = 0.0025;
maxFov = 0.05;
initFov= 0.05;
};
};
};
EGVAR(dragging,canDrag) = 1;
EGVAR(dragging,dragPosition)[] = {0,1,0};
EGVAR(dragging,dragDirection) = 0;
class ACE_Actions: ACE_Actions{
class ACE_MainActions: ACE_MainActions {
selection = "main_turret";
class ACE_Pickup {
selection = "";
displayName = CSTRING(PickUp);
distance = 5;
condition = QUOTE((alive _target) && (count (crew _target) == 0));
statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup));
showDisabled = 0;
exceptions[] = {};
priority = 5;
icon = QPATHTOF(UI\w_spottingscope_ca.paa);
};
};
};
};
};

View File

@ -0,0 +1,56 @@
class RscOpticsValue;
class RscMapControl;
class RscText;
class RscPicture;
class RscInGameUI {
class RscUnitInfo;
class GVAR(RscUnitInfo): RscUnitInfo {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); {((_this select 0) displayCtrl _x) ctrlShow false} forEach [ARR_4(IDC_RETICLE,IDC_BODY,IDC_BLACK_LEFT,IDC_BLACK_RIGHT)]);
controls[] = {"CA_FOVMode","ScriptedReticleHelper","trippleHeadLeft","trippleHeadRight","Reticle","Body"}; // 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;
w = 0;
h = 0;
};
class ScriptedReticleHelper: RscMapControl {
onDraw = QUOTE(ctrlParent (_this select 0) call FUNC(animateReticle));
idc = -1;
w = 0;
h = 0;
};
class Reticle: RscPicture {
idc = IDC_RETICLE;
text = QPATHTOF(rsc\spotting_scope_reticle_co.paa);
x = POS_X;
y = POS_Y;
w = POS_W;
h = POS_H;
};
class Body: Reticle {
idc = IDC_BODY;
text = QPATHTOF(rsc\spotting_scope_body_co.paa);
};
//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 = QUOTE(POS_X_BASE(SIZEX) - safeZoneXAbs);
h = "safeZoneH";
colorBackground[] = {0,0,0,1};
};
class trippleHeadRight: trippleHeadLeft {
idc = IDC_BLACK_RIGHT;
x = QUOTE(safeZoneXAbs + safeZoneWAbs - (POS_X_BASE(SIZEX) - safeZoneXABS));
};
};
};

View File

@ -1,3 +1,4 @@
PREP(pickup);
PREP(place);
PREP(animateReticle);

View File

@ -2,7 +2,8 @@
class CfgPatches {
class ADDON {
units[] = {"ACE_Item_SpottingScope"};
name = CSTRING(component);
units[] = {"ACE_B_SpottingScope", "ACE_O_SpottingScope", "ACE_I_SpottingScope", "ACE_Item_SpottingScope"};
weapons[] = {"ACE_SpottingScope"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_apl", "ace_interaction"};
@ -17,3 +18,5 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgMoves.hpp"
#include "RscInGameUI.hpp"

View File

@ -1,78 +0,0 @@
ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 0.0};
specularPower = 0.0;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture = "z\ace\addons\spottingscope\data\sniper_peri_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture = "z\ace\addons\apl\data\metal4_weapons_vehicles_int_512_dt.paa";
uvSource = "tex";
class uvTransform {
aside[] = {6.0, 0.0, 0.0};
up[] = {0.0, 6.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0)";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage4 {
texture = "#(argb,8,8,3)color(0,1,1,1)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage5 {
texture = "z\ace\addons\spottingscope\data\sniper_peri_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture = "#(ai,32,128,1)fresnel(1.58,0.01)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage7 {
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};

View File

@ -1,78 +0,0 @@
ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 0.0};
specularPower = 0.0;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture = "z\ace\addons\spottingscope\data\spot_scope_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture = "z\ace\addons\apl\data\plastic_512_dt.paa";
uvSource = "tex";
class uvTransform {
aside[] = {6.0, 0.0, 0.0};
up[] = {0.0, 6.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0)";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage4 {
texture = "#(argb,8,8,3)color(0,1,1,1)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage5 {
texture = "z\ace\addons\spottingscope\data\spot_scope_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture = "#(ai,32,128,1)fresnel(1.58,0.01)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage7 {
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};

View File

@ -1,79 +0,0 @@
ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 0.0};
specularPower = 0.0;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture = "z\ace\addons\spottingscope\data\spot_scope_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture = "z\ace\addons\apl\data\metal4_weapons_vehicles_int_512_dt.paa";
uvSource = "tex";
class uvTransform {
aside[] = {6.0, 0.0, 0.0};
up[] = {0.0, 6.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0)";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage4 {
texture = "#(argb,8,8,3)color(0,1,1,1)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage5 {
texture = "z\ace\addons\spottingscope\data\spot_scope_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture = "#(ai,32,128,1)fresnel(1.58,0.01)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage7 {
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};

View File

@ -0,0 +1,44 @@
/*
* 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"];
uinamespace setVariable [QGVAR(dlgSpottingScope), _display];
private _ctrlReticle = _display displayCtrl IDC_RETICLE;
private _ctrlBody = _display displayCtrl IDC_BODY;
private _ctrlBlackLeft = _display displayCtrl IDC_BLACK_LEFT;
private _ctrlBlackRight = _display displayCtrl IDC_BLACK_RIGHT;
// check if optics are used
// hide all controls otherwise
private _isUsingOptic = ctrlShown (_display displayCtrl 154);
_ctrlReticle ctrlShow _isUsingOptic;
_ctrlBody ctrlShow _isUsingOptic;
_ctrlBlackLeft ctrlShow _isUsingOptic;
_ctrlBlackRight ctrlShow _isUsingOptic;
// animate reticle
private _zoom = ([] call EFUNC(common,getZoom)) * MAGIC_SCOPE_NUMBER;
_ctrlReticle ctrlSetPosition [
POS_X_BASE(_zoom),
POS_Y_BASE(_zoom),
POS_W_BASE(_zoom),
POS_H_BASE(_zoom)
];
_ctrlReticle ctrlCommit 0;

Binary file not shown.

Binary file not shown.

View File

@ -15,3 +15,23 @@
#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 MAGIC_SCOPE_NUMBER 0.0235
//#define MAGIC_SCOPE_NUMBER (uiNamespace getVariable ['magic', 1])
#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 1.05
#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))

View File

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="tripod">
<Key ID="STR_ACE_SpottingScope_Component">
<English>Advanced Combat Environment 3 - Spotting Scope</English>
<German>Advanced Combat Environment 3 - Teleskop</German>
<Russian>Advanced Combat Environment 3 - Зрительная труба</Russian>
<Polish>Advanced Combat Environment 3 - Teleskop</Polish>
<Spanish>Advanced Combat Environment 3 - Telescopio</Spanish>
<French>Advanced Combat Environment 3 - Téléscope de visée</French>
<Czech>Advanced Combat Environment 3 - Zaměřovací dalekohled</Czech>
<Italian>Advanced Combat Environment 3 - Spotting Scope</Italian>
<Hungarian>Advanced Combat Environment 3 - Megfigyelő távcső</Hungarian>
<Portuguese>Advanced Combat Environment 3 - Luneta de observador</Portuguese>
</Key>
<Key ID="STR_ACE_SpottingScope_DisplayName">
<English>Spotting Scope</English>
<German>Teleskop</German>