mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3 into ATragMX
This commit is contained in:
commit
983a36e52d
@ -70,9 +70,9 @@ class RscInGameUI {
|
||||
colorText[] = {1,1,1,0};
|
||||
colorBackground[] = {0,0,0,0};
|
||||
x = safezoneX+0.5*safezoneW-0.5*SIZEX;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
w = SIZEX;
|
||||
h = SIZEX*safezoneW/safezoneH;
|
||||
h = SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
};
|
||||
|
||||
class ReticleNight: ReticleDay {
|
||||
@ -86,9 +86,9 @@ class RscInGameUI {
|
||||
idc = 1713005;
|
||||
text = "";
|
||||
x = safezoneX+0.5*safezoneW-0.5*SIZEX;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
w = SIZEX;
|
||||
h = SIZEX*safezoneW/safezoneH;
|
||||
h = SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
};
|
||||
|
||||
class BodyNight: BodyDay {
|
||||
|
@ -215,6 +215,11 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class ACE_optic_SOS_2D: optic_SOS {
|
||||
GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa));
|
||||
GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa));
|
||||
GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa));
|
||||
GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa));
|
||||
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
_generalMacro = "ACE_optic_SOS_2D";
|
||||
displayName = "$STR_ACE_optic_sos";
|
||||
@ -232,11 +237,6 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class ACE_optic_SOS_PIP: ACE_optic_SOS_2D {
|
||||
GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa));
|
||||
GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa));
|
||||
GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa));
|
||||
GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa));
|
||||
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
_generalMacro = "ACE_optic_SOS_PIP";
|
||||
scopeArsenal = 1;
|
||||
|
@ -52,7 +52,7 @@ _scopeShiftY = _recoilCoef * linearConversion [0, 1, random 1, SCOPE_SHIFT_Y_MIN
|
||||
private ["_sizeX", "_sizeY"];
|
||||
|
||||
_sizeX = (0.75+_recoilScope)/(getResolution select 5);
|
||||
_sizeY = _sizeX*safezoneW/safezoneH;
|
||||
_sizeY = _sizeX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
|
||||
private "_positionReticle";
|
||||
_positionReticle = [
|
||||
@ -83,7 +83,7 @@ _positionBody = [
|
||||
|
||||
// Bring them all back
|
||||
_sizeX = 0.75/(getResolution select 5);
|
||||
_sizeY = _sizeX*safezoneW/safezoneH;
|
||||
_sizeY = _sizeX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
|
||||
_positionReticle = [
|
||||
safezoneX+0.5*safezoneW-0.5*_sizeX,
|
||||
|
@ -39,7 +39,7 @@ _nightOpacity = [1,0] select (_dayOpacity == 1);
|
||||
|
||||
// Apply lighting and make layers visible
|
||||
(_display displayCtrl 1713001) ctrlSetTextColor [1,1,1,1];
|
||||
(_display displayCtrl 1713002) ctrlSetTextColor [1,1,1,_nightOpacity];
|
||||
(_display displayCtrl 1713002) ctrlSetTextColor [1,1,1,[0,1] select (_dayOpacity < 0.5)];
|
||||
(_display displayCtrl 1713005) ctrlSetTextColor [1,1,1,_dayOpacity];
|
||||
(_display displayCtrl 1713006) ctrlSetTextColor [1,1,1,_nightOpacity];
|
||||
|
||||
|
@ -32,7 +32,7 @@ private ["_onSuccess", "_onFailure", "_condition"];
|
||||
|
||||
_onSuccess = {
|
||||
(_this select 0 select 0) removeMagazine (_this select 0 select 3);
|
||||
["reloadLauncher", _this select 0 select 0, _this select 0] call DEFUNC(common,targetEvent);
|
||||
["reloadLauncher", _this select 0 select 1, _this select 0] call DEFUNC(common,targetEvent);
|
||||
|
||||
[localize "STR_ACE_ReloadLaunchers_LauncherLoaded"] call DEFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
19
addons/scopes/CfgVehicles.hpp
Normal file
19
addons/scopes/CfgVehicles.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(adjustZero) {
|
||||
// Updates the zero reference
|
||||
displayName = "$STR_ACE_Scopes_AdjustZero";
|
||||
condition = QUOTE([ACE_player] call FUNC(canAdjustZero));
|
||||
statement = QUOTE([ACE_player] call FUNC(adjustZero));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
//icon = QUOTE(PATHTOF(UI\...)); // TODO
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,14 +1,15 @@
|
||||
class CfgWeapons {
|
||||
class ItemCore;
|
||||
class InventoryOpticsItem_Base_F;
|
||||
|
||||
|
||||
class optic_LRPS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -70, 70 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
@ -16,12 +17,13 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class optic_SOS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -60, 60 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
@ -29,12 +31,41 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class optic_DMS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -40, 40 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -40, 40 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 20 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class optic_AMS_base : ItemCore {
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class AMS {
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class optic_KHS_base : ItemCore {
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class KHS {
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi and esteldunedain
|
||||
* Author: KoffeinFlummi, esteldunedain, Ruthberg
|
||||
*
|
||||
* Watches for scope changes.
|
||||
* Defines key bindings
|
||||
@ -33,66 +33,118 @@ if !(hasInterface) exitWith {};
|
||||
|
||||
|
||||
// Add keybinds
|
||||
["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp",
|
||||
["ACE3", QGVAR(AdjustUpMinor), localize "STR_ACE_Scopes_AdjustUpMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0, 0.1] call FUNC(adjustScope);
|
||||
[ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [false, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown",
|
||||
["ACE3", QGVAR(AdjustDownMinor), localize "STR_ACE_Scopes_AdjustDownMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0, -0.1] call FUNC(adjustScope);
|
||||
[ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [false, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft",
|
||||
["ACE3", QGVAR(AdjustLeftMinor), localize "STR_ACE_Scopes_AdjustLeftMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, -0.1, 0] call FUNC(adjustScope);
|
||||
[ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [false, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight",
|
||||
["ACE3", QGVAR(AdjustRightMinor), localize "STR_ACE_Scopes_AdjustRightMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0.1, 0] call FUNC(adjustScope);
|
||||
[ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [false, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustUpMajor), localize "STR_ACE_Scopes_AdjustUpMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [true, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustDownMajor), localize "STR_ACE_Scopes_AdjustDownMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [true, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustLeftMajor), localize "STR_ACE_Scopes_AdjustLeftMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [true, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustRightMajor), localize "STR_ACE_Scopes_AdjustRightMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [true, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
// init shortdot
|
||||
GVAR(showShortdot) = false;
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(adjustScope);
|
||||
PREP(canAdjustScope);
|
||||
PREP(adjustZero);
|
||||
PREP(applyScopeAdjustment);
|
||||
PREP(canAdjustZero);
|
||||
PREP(firedEH);
|
||||
PREP(getOptics);
|
||||
PREP(inventoryCheck);
|
||||
|
@ -16,6 +16,8 @@ class CfgPatches {
|
||||
|
||||
#include "CfgSounds.hpp"
|
||||
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
#include "RscTitles.hpp"
|
||||
|
@ -1,56 +1,71 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Changes the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Horizontal adjustment <NUMBER>
|
||||
* 2: Vertical adjustment <NUMBER>
|
||||
* 1: Turret and Direction <NUMBER>
|
||||
* 2: Major Step <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* True <BOOL>
|
||||
* Did we adjust anything? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"];
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
|
||||
_unit = _this select 0;
|
||||
private ["_unit", "_turretAndDirection", "_majorStep", "_weaponIndex", "_zeroing", "_optic", "_increment", "_maxVertical", "_maxHorizontal", "_elevation", "_windage", "_zero"];
|
||||
|
||||
EXPLODE_3_PVT(_this,_unit,_turretAndDirection,_majorStep);
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
_unit setVariable [QGVAR(Adjustment), _adjustment];
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]]; // [Windage, Elevation, Zero]
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10];
|
||||
_zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10];
|
||||
|
||||
// Change the adjustment array
|
||||
_adjustment set [_weaponIndex, _zeroing];
|
||||
[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
|
||||
playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3);
|
||||
|
||||
// slightly rotate the player if looking through optic
|
||||
if (cameraView == "GUNNER") then {
|
||||
|
||||
_pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw);
|
||||
// these are not exact mil-to-degree conversions, but instead chosen
|
||||
// to minimize the effect of rounding errors
|
||||
_pitch = (_pitchbankyaw select 0) + ((_this select 2) * -0.04);
|
||||
_bank = _pitchbankyaw select 1;
|
||||
_yaw = (_pitchbankyaw select 2) + ((_this select 1) * -0.04);
|
||||
[_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw)
|
||||
|
||||
} else {
|
||||
|
||||
[] call FUNC(showZeroing);
|
||||
|
||||
if (isNil QGVAR(Optics)) then {
|
||||
GVAR(Optics) = ["", "", ""];
|
||||
};
|
||||
|
||||
true
|
||||
_optic = GVAR(Optics) select _weaponIndex;
|
||||
_increment = getNumber (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Increment");
|
||||
_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical");
|
||||
_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal");
|
||||
|
||||
if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_elevation = _zeroing select 0;
|
||||
_windage = _zeroing select 1;
|
||||
_zero = _zeroing select 2;
|
||||
|
||||
switch (_turretAndDirection) do
|
||||
{
|
||||
case ELEVATION_UP: { _elevation = _elevation + _increment };
|
||||
case ELEVATION_DOWN: { _elevation = _elevation - _increment };
|
||||
case WINDAGE_LEFT: { _windage = _windage - _increment };
|
||||
case WINDAGE_RIGHT: { _windage = _windage + _increment };
|
||||
};
|
||||
|
||||
if (_majorStep) then {
|
||||
switch (_turretAndDirection) do
|
||||
{
|
||||
case ELEVATION_UP: { _elevation = ceil(_elevation) };
|
||||
case ELEVATION_DOWN: { _elevation = floor(_elevation) };
|
||||
case WINDAGE_LEFT: { _windage = floor(_windage) };
|
||||
case WINDAGE_RIGHT: { _windage = ceil(_windage) };
|
||||
};
|
||||
};
|
||||
|
||||
_elevation = round(_elevation * 10) / 10;
|
||||
_windage = round(_windage * 10) / 10;
|
||||
|
||||
if ((_elevation + _zero) < _maxVertical select 0 or (_elevation + _zero) > _maxVertical select 1) exitWith {false};
|
||||
if (_windage < _maxHorizontal select 0 or _windage > _maxHorizontal select 1) exitWith {false};
|
||||
|
||||
[_unit, _elevation, _windage, _zero] call FUNC(applyScopeAdjustment);
|
||||
|
39
addons/scopes/functions/fnc_adjustZero.sqf
Normal file
39
addons/scopes/functions/fnc_adjustZero.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Updates the zero reference for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* true <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
|
||||
private ["_unit", "_adjustment", "_zeroing", "_elevation", "_windage", "_zero"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_elevation = _zeroing select 0;
|
||||
_windage = _zeroing select 1;
|
||||
_zero = _zeroing select 2;
|
||||
|
||||
_zero = round((_zero + _elevation) * 10) / 10;
|
||||
_elevation = 0;
|
||||
|
||||
[_unit, _elevation, _windage, _zero] call FUNC(applyScopeAdjustment);
|
||||
|
||||
true
|
51
addons/scopes/functions/fnc_applyScopeAdjustment.sqf
Normal file
51
addons/scopes/functions/fnc_applyScopeAdjustment.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Applies the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Absolute elevation <NUMBER>
|
||||
* 2: Absolute windage <NUMBER>
|
||||
* 3: Absolute zero reference <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* True <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_elevation", "_windage", "_zero", "_adjustmentDifference", "_pitchbankyaw", "_pitch", "_bank", "_yaw"];
|
||||
|
||||
EXPLODE_4_PVT(_this,_unit,_elevation,_windage,_zero);
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
_unit setVariable [QGVAR(Adjustment), _adjustment];
|
||||
};
|
||||
|
||||
_adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero];
|
||||
|
||||
_adjustment set [_weaponIndex, [_elevation, _windage, _zero]];
|
||||
[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
|
||||
playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3);
|
||||
|
||||
// slightly rotate the player if looking through optic
|
||||
if (cameraView == "GUNNER") then {
|
||||
// Convert adjustmentDifference from mils to degrees
|
||||
_adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map);
|
||||
_pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw);
|
||||
_pitch = (_pitchbankyaw select 0) + (_adjustmentDifference select 0);
|
||||
_bank = (_pitchbankyaw select 1);
|
||||
_yaw = (_pitchbankyaw select 2) + (_adjustmentDifference select 1);
|
||||
[_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw);
|
||||
} else {
|
||||
[] call FUNC(showZeroing);
|
||||
};
|
||||
|
||||
true
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Checks if a player can adjust his optic in the given way.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Horizontal adjustment <NUMBER>
|
||||
* 2: Vertical adjustment <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Can adjustment be done? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weaponIndex", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"];
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
};
|
||||
|
||||
if (isNil QGVAR(Optics)) then {
|
||||
GVAR(Optics) = ["", "", ""];
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_zeroX = (_zeroing select 0) + (_this select 1);
|
||||
_zeroY = (_zeroing select 1) + (_this select 2);
|
||||
|
||||
_optic = GVAR(Optics) select _weaponIndex;
|
||||
_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal");
|
||||
_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical");
|
||||
if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false};
|
||||
if ((_maxHorizontal isEqualTo [0,0]) or (_maxVertical isEqualTo [0,0])) exitWith {false};
|
||||
|
||||
if (_zeroX < _maxHorizontal select 0 or _zeroX > _maxHorizontal select 1) exitWith {false};
|
||||
if (_zeroY < _maxVertical select 0 or _zeroY > _maxVertical select 1) exitWith {false};
|
||||
|
||||
vehicle _unit == _unit
|
34
addons/scopes/functions/fnc_canAdjustZero.sqf
Normal file
34
addons/scopes/functions/fnc_canAdjustZero.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Changes the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can we update the zero reference? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (cameraView == "GUNNER") exitWith {false};
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {false};
|
||||
|
||||
private ["_unit", "_adjustment", "_elevation"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
_elevation = (_adjustment select _weaponIndex) select 0;
|
||||
|
||||
// You can only adjust your zero reference, if your relative elevation setting is not 0
|
||||
_elevation != 0
|
@ -39,4 +39,4 @@ _zeroing = _adjustment select _weaponIndex;
|
||||
// Convert zeroing from mils to degrees
|
||||
_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map);
|
||||
|
||||
[_projectile, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection);
|
||||
[_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection);
|
||||
|
@ -18,7 +18,8 @@ private ["_newOptics", "_adjustment"];
|
||||
|
||||
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
ACE_player setVariable [QGVAR(Adjustment), _adjustment];
|
||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
};
|
||||
@ -31,8 +32,8 @@ _newOptics = [_player] call FUNC(getOptics);
|
||||
{
|
||||
if (_newOptics select _forEachIndex != _x) then {
|
||||
// The optic for this weapon changed, set adjustment to zero
|
||||
if !((_adjustment select _foreachindex) isEqualTo [0,0]) then {
|
||||
_adjustment set [_forEachIndex, [0,0]];
|
||||
if !((_adjustment select _foreachindex) isEqualTo [0,0,0]) then {
|
||||
_adjustment set [_forEachIndex, [0,0,0]];
|
||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
};
|
||||
};
|
||||
|
@ -21,7 +21,8 @@ if (_weaponIndex < 0) exitWith {};
|
||||
|
||||
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
// Display the adjustment knobs
|
||||
@ -36,8 +37,8 @@ if (isNull _display) exitWith {};
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_vertical = _display displayCtrl 12;
|
||||
_horizontal = _display displayCtrl 13;
|
||||
_vertical ctrlSetText (str (_zeroing select 1));
|
||||
_horizontal ctrlSetText (str (_zeroing select 0));
|
||||
_vertical ctrlSetText (str (_zeroing select 0));
|
||||
_horizontal ctrlSetText (str (_zeroing select 1));
|
||||
|
||||
// Set the time when to hide the knobs
|
||||
GVAR(timeToHide) = diag_tickTime + 3.0;
|
||||
|
@ -1,6 +1,14 @@
|
||||
#define COMPONENT scopes
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#define ELEVATION_UP 0
|
||||
#define ELEVATION_DOWN 1
|
||||
#define WINDAGE_LEFT 2
|
||||
#define WINDAGE_RIGHT 3
|
||||
|
||||
#define MINOR_INCREMENT false
|
||||
#define MAJOR_INCREMENT true
|
||||
|
||||
#ifdef DEBUG_ENABLED_SCOPES
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
@ -2,49 +2,32 @@
|
||||
<!-- Edited with tabler - 2014-12-11 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Scopes">
|
||||
<Key ID="STR_ACE_Scopes_AdjustUp">
|
||||
<English>Adjust Elevation Up</English>
|
||||
<Hungarian>Magasság Állítása Felfelé</Hungarian>
|
||||
<German>Optik-Elevation erhöhen</German>
|
||||
<Portuguese>Ajustar Elevação Acima</Portuguese>
|
||||
<French>Hausse +</French>
|
||||
<Polish>Regulacja krzyża w pionie +</Polish>
|
||||
<Czech>Zvýšit náměr</Czech>
|
||||
<Spanish>Ajustar elevación arriba</Spanish>
|
||||
<Russian>Вверх по вертикали</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustUpMinor">
|
||||
<English>"Minor adjustment up</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDown">
|
||||
<English>Adjust Elevation Down</English>
|
||||
<Hungarian>Magasság Állítása Lefelé</Hungarian>
|
||||
<German>Optik-Elevation verringern</German>
|
||||
<Portuguese>Ajustar Elevação Abaixo</Portuguese>
|
||||
<French>Hausse -</French>
|
||||
<Polish>Regulacja krzyża w pionie -</Polish>
|
||||
<Czech>Snížit náměr</Czech>
|
||||
<Spanish>Ajustar elevación abajo</Spanish>
|
||||
<Russian>Вниз по вертикали</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDownMinor">
|
||||
<English>"Minor adjustment down</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRight">
|
||||
<English>Adjust Windage Right</English>
|
||||
<Hungarian>Oldalirány Állítása Jobbra</Hungarian>
|
||||
<German>Optik-Azimuth erhöhen</German>
|
||||
<Portuguese>Ajustar Azimute à Direita</Portuguese>
|
||||
<French>Dérive +</French>
|
||||
<Polish>Regulacja krzyża w poziomie +</Polish>
|
||||
<Czech>Náměr doprava (vítr)</Czech>
|
||||
<Spanish>Ajustar deriva a la derecha</Spanish>
|
||||
<Russian>Вправо на уровне</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRightMinor">
|
||||
<English>"Minor adjustment right</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeft">
|
||||
<English>Adjust Windage Left</English>
|
||||
<Hungarian>Oldalirány Állítása Balra</Hungarian>
|
||||
<German>Optik-Azimuth verringern</German>
|
||||
<Portuguese>Ajustar Azimute à Esquerda</Portuguese>
|
||||
<French>Dérive -</French>
|
||||
<Polish>Regulacja krzyża w poziomie -</Polish>
|
||||
<Czech>Náměr doleva (vítr)</Czech>
|
||||
<Spanish>Ajustar deriva a la izquierda</Spanish>
|
||||
<Russian>Влево на уровне</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeftMinor">
|
||||
<English>"Minor adjustment left</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustUpMajor">
|
||||
<English>Major adjustment up</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDownMajor">
|
||||
<English>Major adjustment down</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRightMajor">
|
||||
<English>Major adjustment right</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeftMajor">
|
||||
<English>Major adjustment left</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustZero">
|
||||
<English>Set zero adjustment</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -535,6 +535,10 @@ See the make.cfg file for additional build options.
|
||||
else:
|
||||
old_sha = ""
|
||||
|
||||
#We always build ACE_common so we can properly show the correct version stamp in the RPT file.
|
||||
if module == "common":
|
||||
old_sha = ""
|
||||
|
||||
# Hash the module
|
||||
new_sha = get_directory_hash(os.path.join(module_root, module))
|
||||
|
||||
|
@ -535,6 +535,10 @@ See the make.cfg file for additional build options.
|
||||
else:
|
||||
old_sha = ""
|
||||
|
||||
#We always build ACE_common so we can properly show the correct version stamp in the RPT file.
|
||||
if module == "common":
|
||||
old_sha = ""
|
||||
|
||||
# Hash the module
|
||||
new_sha = get_directory_hash(os.path.join(module_root, module))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user