mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1491 from acemod/Yardage450
Ported the ACE2 Yardage 450 laser rangefinder
This commit is contained in:
commit
52b40a50d9
1
addons/yardage450/$PBOPREFIX$
Normal file
1
addons/yardage450/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\yardage450
|
11
addons/yardage450/CfgEventHandlers.hpp
Normal file
11
addons/yardage450/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
};
|
||||
};
|
20
addons/yardage450/CfgVehicles.hpp
Normal file
20
addons/yardage450/CfgVehicles.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
class CfgVehicles {
|
||||
class Item_Base_F;
|
||||
class ACE_Item_Yardage450: Item_Base_F {
|
||||
author[] = {"Spooner", "tcp"};
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = "$STR_ACE_Yardage450_DisplayName";
|
||||
vehicleClass = "Items";
|
||||
class TransportWeapons {
|
||||
MACRO_ADDWEAPON(ACE_Yardage450,1);
|
||||
};
|
||||
};
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportWeapons {
|
||||
MACRO_ADDWEAPON(ACE_Yardage450,4);
|
||||
};
|
||||
};
|
||||
};
|
23
addons/yardage450/CfgWeapons.hpp
Normal file
23
addons/yardage450/CfgWeapons.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
class CfgWeapons {
|
||||
class Binocular;
|
||||
class ACE_Yardage450: Binocular {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
displayName = "$STR_ACE_Yardage450_DisplayName";
|
||||
descriptionShort = "$STR_ACE_Yardage450_Description";
|
||||
model = PATHTOF(data\ace_yardage_pro_450.p3d);
|
||||
modelOptics = PATHTOF(data\bushnell_optic.p3d);
|
||||
picture = PATHTOF(UI\w_bushnell_ca.paa);
|
||||
opticsZoomMin = 0.33333/4;
|
||||
opticsZoomMax = 0.33333/4;
|
||||
opticsZoomInit = 0.33333/4;
|
||||
distanceZoomMin = 400;
|
||||
distanceZoomMax = 400;
|
||||
discretefov[] = {0.33333/4};
|
||||
discreteInitIndex = 0;
|
||||
visionMode[] = {"Normal"};
|
||||
class WeaponSlotsInfo {
|
||||
mass = 12;
|
||||
};
|
||||
};
|
||||
};
|
10
addons/yardage450/README.md
Normal file
10
addons/yardage450/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
ace_yardage450
|
||||
==========
|
||||
|
||||
Adds the Bushnell Yardage Pro Sport 450 Laser Rangefinder.
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
75
addons/yardage450/RscTitles.hpp
Normal file
75
addons/yardage450/RscTitles.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
#define ST_LEFT 0
|
||||
#define ST_RIGHT 1
|
||||
#define ST_CENTER 2
|
||||
|
||||
class ACE_Yardage450_RscText {
|
||||
type = 0;
|
||||
idc = -1;
|
||||
style = ST_CENTER;
|
||||
font = "EtelkaMonospacePro";
|
||||
sizeEx = "0.027 * SafeZoneH";
|
||||
colorText[] = {0, 0, 0, 1};
|
||||
colorBackground[] = {0, 0, 0, 0};
|
||||
};
|
||||
|
||||
class RscTitles {
|
||||
class ACE_RscYardage450 {
|
||||
idd = -1;
|
||||
movingEnable = 0;
|
||||
duration = 100000;
|
||||
fadein = 0;
|
||||
fadeout = 0;
|
||||
name = "ACE_RscYardage450";
|
||||
onLoad = "with uiNameSpace do { ACE_RscYardage450 = _this select 0; };";
|
||||
onUnload = "with uiNameSpace do { ACE_RscYardage450 = displayNull; };";
|
||||
|
||||
class Controls {
|
||||
class ACE_Yardage450_RscTarget : ACE_Yardage450_RscText {
|
||||
idc = 720041;
|
||||
style = ST_CENTER;
|
||||
x = "0.5 - (0.18 * SafeZoneH)";
|
||||
y = "0.5 - (0.25 * SafeZoneH)";
|
||||
w = "0.4 * SafeZoneH";
|
||||
h = "0.05 * SafeZoneH";
|
||||
sizeEx = "0.05 * SafeZoneH";
|
||||
text = "TARGET ACQUIRED";
|
||||
};
|
||||
class ACE_Yardage450_RscLaser : ACE_Yardage450_RscTarget {
|
||||
idc = 720042;
|
||||
x = "0.5 - (0.14 * SafeZoneH)";
|
||||
y = "0.5 - (0.18 * SafeZoneH)";
|
||||
w = "0.045 * SafeZoneH";
|
||||
h = "0.02 * SafeZoneH";
|
||||
sizeEx = "0.02 * SafeZoneH";
|
||||
colorText[] = {1, 1, 1, 1};
|
||||
colorBackground[] = {0, 0, 0, 1};
|
||||
text = "LASER";
|
||||
};
|
||||
class ACE_Yardage450_RscRange : ACE_Yardage450_RscTarget {
|
||||
idc = 720043;
|
||||
style = ST_RIGHT;
|
||||
x = "0.5 - (0.02 * SafeZoneH)";
|
||||
y = "0.5 + (0.18 * SafeZoneH)";
|
||||
w = "0.08 * SafeZoneH";
|
||||
h = "0.06 * SafeZoneH";
|
||||
sizeEx = "0.06 * SafeZoneH";
|
||||
text = "---";
|
||||
};
|
||||
class ACE_Yardage450_RscMeters : ACE_Yardage450_RscLaser {
|
||||
idc = 720044;
|
||||
x = "0.5 + (0.06 * SafeZoneH)";
|
||||
y = "0.5 + (0.19 * SafeZoneH)";
|
||||
w = "0.05 * SafeZoneH";
|
||||
h = "0.018 * SafeZoneH";
|
||||
sizeEx = "0.018 * SafeZoneH";
|
||||
text = "METERS";
|
||||
};
|
||||
class ACE_Yardage450_RscYards : ACE_Yardage450_RscMeters {
|
||||
idc = 720045;
|
||||
y = "0.5 + (0.21 * SafeZoneH)";
|
||||
w = "0.0417 * SafeZoneH";
|
||||
text = "YARDS";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
BIN
addons/yardage450/UI/w_bushnell_ca.paa
Normal file
BIN
addons/yardage450/UI/w_bushnell_ca.paa
Normal file
Binary file not shown.
14
addons/yardage450/XEH_postInit.sqf
Normal file
14
addons/yardage450/XEH_postInit.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "initKeybinds.sqf"
|
||||
|
||||
GVAR(active) = false;
|
||||
|
||||
GVAR(useYards) = false;
|
||||
|
||||
GVAR(powerButtonPressed) = false;
|
||||
GVAR(powerOnTime) = 0;
|
||||
|
||||
GVAR(lasing) = false;
|
||||
GVAR(targetAcquired) = false;
|
||||
GVAR(targetRangeText) = "---";
|
8
addons/yardage450/XEH_preInit.sqf
Normal file
8
addons/yardage450/XEH_preInit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(acquireTarget);
|
||||
PREP(turnOn);
|
||||
|
||||
ADDON = true;
|
17
addons/yardage450/config.cpp
Normal file
17
addons/yardage450/config.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {"ACE_Item_Yardage450"};
|
||||
weapons[] = {"ACE_Yardage450"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_apl", "ace_laser"};
|
||||
author[] = {"Spooner", "tcp", "Ruthberg"};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "RscTitles.hpp"
|
66
addons/yardage450/data/Bushnell.rvmat
Normal file
66
addons/yardage450/data/Bushnell.rvmat
Normal file
@ -0,0 +1,66 @@
|
||||
ambient[]={1.000000,1.000000,1.000000,1.000000};
|
||||
diffuse[]={1.000000,1.000000,1.000000,1.000000};
|
||||
forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000};
|
||||
emmisive[]={0.000000,0.000000,0.000000,1.000000};
|
||||
specular[]={0.7000000,0.700000,0.700000,1.000000};
|
||||
specularPower=20.000000;
|
||||
PixelShaderID="Super";
|
||||
VertexShaderID="Super";
|
||||
class Stage1 {
|
||||
texture="z\ace\addons\yardage450\data\bushnell_nohq.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1.000000,0.000000,0.000000};
|
||||
up[]={0.000000,1.000000,0.000000};
|
||||
dir[]={0.000000,0.000000,0.000000};
|
||||
pos[]={0.000000,0.000000,0.000000};
|
||||
};
|
||||
};
|
||||
class Stage2 {
|
||||
texture="a3\weapons_f\data\detailmaps\plast_dt.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={3.0000,0.000000,0.000000};
|
||||
up[]={0.000000,3.0000,0.000000};
|
||||
dir[]={0.000000,0.000000,0.000000};
|
||||
pos[]={0.000000,0.000000,0.000000};
|
||||
};
|
||||
};
|
||||
class Stage3 {
|
||||
texture="#(argb,8,8,3)color(0,0,0,0)";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1.000000,0.000000,0.000000};
|
||||
up[]={0.000000,1.000000,0.000000};
|
||||
dir[]={0.000000,0.000000,0.000000};
|
||||
pos[]={0.000000,0.000000,0.000000};
|
||||
};
|
||||
};
|
||||
class Stage4 {
|
||||
texture="z\ace\addons\yardage450\data\bushnell_as.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1.000000,0.000000,0.000000};
|
||||
up[]={0.000000,1.000000,0.000000};
|
||||
dir[]={0.000000,0.000000,0.000000};
|
||||
pos[]={0.000000,0.000000,0.000000};
|
||||
};
|
||||
};
|
||||
class Stage5 {
|
||||
texture="z\ace\addons\yardage450\data\bushnell_smdi.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1.000000,0.000000,0.000000};
|
||||
up[]={0.000000,1.000000,0.000000};
|
||||
dir[]={0.000000,0.000000,0.000000};
|
||||
pos[]={0.000000,0.000000,0.000000};
|
||||
};
|
||||
};
|
||||
class Stage6 {
|
||||
texture="#(ai,64,64,1)fresnel(2,2)";
|
||||
uvSource="none";
|
||||
};
|
||||
class Stage7 {
|
||||
texture="a3\data_f\env_land_co.paa";
|
||||
uvSource="none";
|
||||
};
|
BIN
addons/yardage450/data/ace_yardage_pro_450.p3d
Normal file
BIN
addons/yardage450/data/ace_yardage_pro_450.p3d
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_as.paa
Normal file
BIN
addons/yardage450/data/bushnell_as.paa
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_co.paa
Normal file
BIN
addons/yardage450/data/bushnell_co.paa
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_nohq.paa
Normal file
BIN
addons/yardage450/data/bushnell_nohq.paa
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_optic.p3d
Normal file
BIN
addons/yardage450/data/bushnell_optic.p3d
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_optic_ca.paa
Normal file
BIN
addons/yardage450/data/bushnell_optic_ca.paa
Normal file
Binary file not shown.
BIN
addons/yardage450/data/bushnell_smdi.paa
Normal file
BIN
addons/yardage450/data/bushnell_smdi.paa
Normal file
Binary file not shown.
BIN
addons/yardage450/data/scope_view.paa
Normal file
BIN
addons/yardage450/data/scope_view.paa
Normal file
Binary file not shown.
60
addons/yardage450/functions/fnc_acquireTarget.sqf
Normal file
60
addons/yardage450/functions/fnc_acquireTarget.sqf
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Fires the laser to acquire the target
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Reference: http://www.optcorp.com/pdf/Bushnell/YardageProSport.pdf
|
||||
#define MIN_DISTANCE ([9, 10] select GVAR(useYards))
|
||||
#define MAX_DISTANCE ([732, 800] select GVAR(useYards))
|
||||
#define METERING_POINT_NUMBER 8
|
||||
|
||||
private ["_result", "_distance", "_min", "_max", "_range"];
|
||||
|
||||
GVAR(lasing) = true;
|
||||
GVAR(targetAcquired) = false;
|
||||
|
||||
GVAR(distances) = [];
|
||||
GVAR(distanceIndex) = -1;
|
||||
|
||||
[{
|
||||
if (GVAR(targetAcquired) || !GVAR(powerButtonPressed)) exitWith {
|
||||
GVAR(lasing) = false;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_result = [eyePos ACE_player, ACE_player weaponDirection (currentWeapon ACE_player)] call EFUNC(laser,shootRay);
|
||||
_distance = _result select 1;
|
||||
|
||||
_distance = _distance - 1 + (random 2);
|
||||
|
||||
GVAR(distanceIndex) = (GVAR(distanceIndex) + 1) % METERING_POINT_NUMBER;
|
||||
GVAR(distances) set [GVAR(distanceIndex), _distance];
|
||||
|
||||
if (count GVAR(distances) == METERING_POINT_NUMBER) then {
|
||||
_min = MAX_DISTANCE;
|
||||
_max = MIN_DISTANCE;
|
||||
{
|
||||
_min = _x min _min;
|
||||
_max = _max max _x;
|
||||
} forEach GVAR(distances);
|
||||
|
||||
if (abs(_max - _min) < 5) then {
|
||||
_range = (_min + _max) / 2;
|
||||
if (_range >= MIN_DISTANCE && _range <= MAX_DISTANCE) then {
|
||||
GVAR(targetAcquired) = true;
|
||||
GVAR(targetRangeText) = Str(round(_range));
|
||||
};
|
||||
};
|
||||
};
|
||||
}, 0.1, []] call CBA_fnc_addPerFrameHandler;
|
56
addons/yardage450/functions/fnc_turnOn.sqf
Normal file
56
addons/yardage450/functions/fnc_turnOn.sqf
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows the Yardage 450 screen elements
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define __dsp (uiNamespace getVariable "ACE_RscYardage450")
|
||||
#define __ctrlTarget (__dsp displayCtrl 720041)
|
||||
#define __ctrlLaser (__dsp displayCtrl 720042)
|
||||
#define __ctrlRange (__dsp displayCtrl 720043)
|
||||
#define __ctrlMeters (__dsp displayCtrl 720044)
|
||||
#define __ctrlYards (__dsp displayCtrl 720045)
|
||||
|
||||
if (currentWeapon ACE_player != "ACE_Yardage450" || cameraView != "GUNNER") exitWith {};
|
||||
|
||||
GVAR(powerOnTime) = ACE_time;
|
||||
|
||||
if (GVAR(active)) exitWith {};
|
||||
|
||||
GVAR(active) = true;
|
||||
|
||||
[{
|
||||
if (ACE_time - GVAR(powerOnTime) > 30) exitWith {
|
||||
GVAR(active) = false;
|
||||
74210 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (currentWeapon ACE_player == "ACE_Yardage450" && cameraView == "GUNNER") then {
|
||||
74210 cutRsc ["ACE_RscYardage450", "PLAIN", 1, false];
|
||||
|
||||
__ctrlLaser ctrlShow GVAR(lasing);
|
||||
if (GVAR(targetAcquired)) then {
|
||||
__ctrlTarget ctrlSetText "Target Acquired";
|
||||
__ctrlRange ctrlSetText GVAR(targetRangeText);
|
||||
} else {
|
||||
__ctrlTarget ctrlSetText "";
|
||||
__ctrlRange ctrlSetText "---";
|
||||
};
|
||||
__ctrlMeters ctrlShow !GVAR(useYards);
|
||||
__ctrlYards ctrlShow GVAR(useYards);
|
||||
} else {
|
||||
74210 cutText ["", "PLAIN"];
|
||||
};
|
||||
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
1
addons/yardage450/functions/script_component.hpp
Normal file
1
addons/yardage450/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\yardage450\script_component.hpp"
|
28
addons/yardage450/initKeybinds.sqf
Normal file
28
addons/yardage450/initKeybinds.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
["ACE3 Equipment", QGVAR(DistanceKey), localize "STR_ACE_Yardage450_PowerButtonKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(GVAR(active)) exitWith {false};
|
||||
if (currentWeapon ACE_player != "ACE_Yardage450" || cameraView != "GUNNER") exitWith {false};
|
||||
|
||||
// Statement
|
||||
if !(GVAR(powerButtonPressed)) then {
|
||||
GVAR(powerButtonPressed) = true;
|
||||
call FUNC(acquireTarget);
|
||||
};
|
||||
true
|
||||
},
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if (currentWeapon ACE_player != "ACE_Yardage450" || cameraView != "GUNNER") exitWith {false};
|
||||
|
||||
// Statement
|
||||
GVAR(powerButtonPressed) = false;
|
||||
call FUNC(turnOn);
|
||||
true
|
||||
},
|
||||
[19, [false, false, false]], false] call CBA_fnc_addKeybind; //R Key
|
12
addons/yardage450/script_component.hpp
Normal file
12
addons/yardage450/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT yardage450
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_YARDAGE450
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_YARDAGE450
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_YARDAGE450
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
19
addons/yardage450/stringtable.xml
Normal file
19
addons/yardage450/stringtable.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="MX2A">
|
||||
<Key ID="STR_ACE_Yardage450_DisplayName">
|
||||
<English>Yardage 450</English>
|
||||
<Polish>Yardage 450</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Yardage450_Description">
|
||||
<English>Laser Rangefinder</English>
|
||||
<German>Laserentfernungsmesser</German>
|
||||
<Polish>Dalmierz laserowy</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Yardage450_PowerButtonKey">
|
||||
<English>Yardage 450 - Power Button</English>
|
||||
<German>Yardage 450 - Einschalt-Taste</German>
|
||||
<Polish>Yardage 450 - Przycisk zasilania</Polish>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
BIN
extras/YardageProSport.pdf
Normal file
BIN
extras/YardageProSport.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user