From b44f22c262752c2e88b79da7ca31b022cf9191b8 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Fri, 10 Apr 2015 14:41:34 -0300 Subject: [PATCH 1/9] Add 1 mil scope adjustment keybinds --- addons/scopes/XEH_postInit.sqf | 60 +++++++++++++++++ addons/scopes/stringtable.xml | 116 +++++++++++++++++++++++---------- 2 files changed, 140 insertions(+), 36 deletions(-) diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 1084a41181..104024d5b7 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -93,6 +93,66 @@ if !(hasInterface) exitWith {}; {false}, [201, [false, true, false]], true] call cba_fnc_addKeybind; +["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp1mil", +{ + // 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); + true +}, +{false}, +[201, [true, false, false]], true] call cba_fnc_addKeybind; + +["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown1mil", +{ + // 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); + true +}, +{false}, +[209, [true, false, false]], true] call cba_fnc_addKeybind; + +["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft1mil", +{ + // Conditions: canInteract + if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + // Conditions: specific + [ACE_player] call FUNC(inventoryCheck); + if !([ACE_player, -1.0, 0] call FUNC(canAdjustScope)) exitWith {false}; + + // Statement + [ACE_player, -1.0, 0] call FUNC(adjustScope); + true +}, +{false}, +[209, [true, true, false]], true] call cba_fnc_addKeybind; + +["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight1mil", +{ + // Conditions: canInteract + if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + // Conditions: specific + [ACE_player] call FUNC(inventoryCheck); + if !([ACE_player, 1.0, 0] call FUNC(canAdjustScope)) exitWith {false}; + + // Statement + [ACE_player, 1.0, 0] call FUNC(adjustScope); + true +}, +{false}, +[201, [true, true, false]], true] call cba_fnc_addKeybind; + // init shortdot GVAR(showShortdot) = false; diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index 04f777241a..474167578e 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -3,48 +3,92 @@ - Adjust Elevation Up - Magasság Állítása Felfelé - Optik-Elevation erhöhen - Ajustar Elevação Acima - Hausse + - Regulacja krzyża w pionie + - Zvýšit náměr - Ajustar elevación arriba - Вверх по вертикали + Adjust Elevation Up 0.1 mil + Magasság Állítása Felfelé 0.1 mil + Optik-Elevation erhöhen 0.1 mil + Ajustar Elevação Acima 0.1 mil + Hausse + 0.1 mil + Regulacja krzyża w pionie + 0.1 mil + Zvýšit náměr 0.1 mil + Ajustar elevación arriba 0.1 mil + Вверх по вертикали 0.1 mil - Adjust Elevation Down - Magasság Állítása Lefelé - Optik-Elevation verringern - Ajustar Elevação Abaixo - Hausse - - Regulacja krzyża w pionie - - Snížit náměr - Ajustar elevación abajo - Вниз по вертикали + Adjust Elevation Down 0.1 mil + Magasság Állítása Lefelé 0.1 mil + Optik-Elevation verringern 0.1 mil + Ajustar Elevação Abaixo 0.1 mil + Hausse - 0.1 mil + Regulacja krzyża w pionie - 0.1 mil + Snížit náměr 0.1 mil + Ajustar elevación abajo 0.1 mil + Вниз по вертикали 0.1 mil - Adjust Windage Right - Oldalirány Állítása Jobbra - Optik-Azimuth erhöhen - Ajustar Azimute à Direita - Dérive + - Regulacja krzyża w poziomie + - Náměr doprava (vítr) - Ajustar deriva a la derecha - Вправо на уровне + Adjust Windage Right 0.1 mil + Oldalirány Állítása Jobbra 0.1 mil + Optik-Azimuth erhöhen 0.1 mil + Ajustar Azimute à Direita 0.1 mil + Dérive + 0.1 mil + Regulacja krzyża w poziomie + 0.1 mil + Náměr doprava (vítr) 0.1 mil + Ajustar deriva a la derecha 0.1 mil + Вправо на уровне 0.1 mil - Adjust Windage Left - Oldalirány Állítása Balra - Optik-Azimuth verringern - Ajustar Azimute à Esquerda - Dérive - - Regulacja krzyża w poziomie - - Náměr doleva (vítr) - Ajustar deriva a la izquierda - Влево на уровне + Adjust Windage Left 0.1 mil + Oldalirány Állítása Balra 0.1 mil + Optik-Azimuth verringern 0.1 mil + Ajustar Azimute à Esquerda 0.1 mil + Dérive - 0.1 mil + Regulacja krzyża w poziomie - 0.1 mil + Náměr doleva (vítr) 0.1 mil + Ajustar deriva a la izquierda 0.1 mil + Влево на уровне 0.1 mil + + + Adjust Elevation Up 1 mil + Magasság Állítása Felfelé 1 mil + Optik-Elevation erhöhen 1 mil + Ajustar Elevação Acima 1 mil + Hausse + 1 mil + Regulacja krzyża w pionie + 1 mil + Zvýšit náměr 1 mil + Ajustar elevación arriba 1 mil + Вверх по вертикали 1 mil + + + Adjust Elevation Down 1 mil + Magasság Állítása Lefelé 1 mil + Optik-Elevation verringern 1 mil + Ajustar Elevação Abaixo 1 mil + Hausse - 1 mil + Regulacja krzyża w pionie - 1 mil + Snížit náměr 1 mil + Ajustar elevación abajo 1 mil + Вниз по вертикали 1 mil + + + Adjust Windage Right 1 mil + Oldalirány Állítása Jobbra 1 mil + Optik-Azimuth erhöhen 1 mil + Ajustar Azimute à Direita 1 mil + Dérive + 1 mil + Regulacja krzyża w poziomie + 1 mil + Náměr doprava (vítr) 1 mil + Ajustar deriva a la derecha 1 mil + Вправо на уровне 1 mil + + + Adjust Windage Left 1 mil + Oldalirány Állítása Balra 1 mil + Optik-Azimuth verringern 1 mil + Ajustar Azimute à Esquerda 1 mil + Dérive - 1 mil + Regulacja krzyża w poziomie - 1 mil + Náměr doleva (vítr) 1 mil + Ajustar deriva a la izquierda 1 mil + Влево на уровне 1 mil \ No newline at end of file From 127d100628c3573df61d2833cb9238da03ddf7c0 Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 10 Apr 2015 20:17:26 +0200 Subject: [PATCH 2/9] Overworked the scope adjustment keybinds: *Fixed duplicate actionIDs *Introduced minor/major steps *Reset the stringtable.xml --- addons/scopes/XEH_postInit.sqf | 16 +++--- addons/scopes/stringtable.xml | 96 ++++++---------------------------- 2 files changed, 24 insertions(+), 88 deletions(-) diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 104024d5b7..50edd494cb 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -33,7 +33,7 @@ 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}; @@ -48,7 +48,7 @@ if !(hasInterface) exitWith {}; {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}; @@ -63,7 +63,7 @@ if !(hasInterface) exitWith {}; {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}; @@ -78,7 +78,7 @@ if !(hasInterface) exitWith {}; {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}; @@ -93,7 +93,7 @@ if !(hasInterface) exitWith {}; {false}, [201, [false, true, false]], true] call cba_fnc_addKeybind; -["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp1mil", +["ACE3", QGVAR(AdjustUpMajor), localize "STR_ACE_Scopes_AdjustUpMajor", { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -108,7 +108,7 @@ if !(hasInterface) exitWith {}; {false}, [201, [true, false, false]], true] call cba_fnc_addKeybind; -["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown1mil", +["ACE3", QGVAR(AdjustDownMajor), localize "STR_ACE_Scopes_AdjustDownMajor", { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -123,7 +123,7 @@ if !(hasInterface) exitWith {}; {false}, [209, [true, false, false]], true] call cba_fnc_addKeybind; -["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft1mil", +["ACE3", QGVAR(AdjustLeftMajor), localize "STR_ACE_Scopes_AdjustLeftMajor", { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -138,7 +138,7 @@ if !(hasInterface) exitWith {}; {false}, [209, [true, true, false]], true] call cba_fnc_addKeybind; -["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight1mil", +["ACE3", QGVAR(AdjustRightMajor), localize "STR_ACE_Scopes_AdjustRightMajor", { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index 474167578e..eb1ff4178c 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -2,93 +2,29 @@ - - Adjust Elevation Up 0.1 mil - Magasság Állítása Felfelé 0.1 mil - Optik-Elevation erhöhen 0.1 mil - Ajustar Elevação Acima 0.1 mil - Hausse + 0.1 mil - Regulacja krzyża w pionie + 0.1 mil - Zvýšit náměr 0.1 mil - Ajustar elevación arriba 0.1 mil - Вверх по вертикали 0.1 mil + + "Minor adjustment up - - Adjust Elevation Down 0.1 mil - Magasság Állítása Lefelé 0.1 mil - Optik-Elevation verringern 0.1 mil - Ajustar Elevação Abaixo 0.1 mil - Hausse - 0.1 mil - Regulacja krzyża w pionie - 0.1 mil - Snížit náměr 0.1 mil - Ajustar elevación abajo 0.1 mil - Вниз по вертикали 0.1 mil + + "Minor adjustment down - - Adjust Windage Right 0.1 mil - Oldalirány Állítása Jobbra 0.1 mil - Optik-Azimuth erhöhen 0.1 mil - Ajustar Azimute à Direita 0.1 mil - Dérive + 0.1 mil - Regulacja krzyża w poziomie + 0.1 mil - Náměr doprava (vítr) 0.1 mil - Ajustar deriva a la derecha 0.1 mil - Вправо на уровне 0.1 mil + + "Minor adjustment right - - Adjust Windage Left 0.1 mil - Oldalirány Állítása Balra 0.1 mil - Optik-Azimuth verringern 0.1 mil - Ajustar Azimute à Esquerda 0.1 mil - Dérive - 0.1 mil - Regulacja krzyża w poziomie - 0.1 mil - Náměr doleva (vítr) 0.1 mil - Ajustar deriva a la izquierda 0.1 mil - Влево на уровне 0.1 mil + + "Minor adjustment left - - Adjust Elevation Up 1 mil - Magasság Állítása Felfelé 1 mil - Optik-Elevation erhöhen 1 mil - Ajustar Elevação Acima 1 mil - Hausse + 1 mil - Regulacja krzyża w pionie + 1 mil - Zvýšit náměr 1 mil - Ajustar elevación arriba 1 mil - Вверх по вертикали 1 mil + + Major adjustment up - - Adjust Elevation Down 1 mil - Magasság Állítása Lefelé 1 mil - Optik-Elevation verringern 1 mil - Ajustar Elevação Abaixo 1 mil - Hausse - 1 mil - Regulacja krzyża w pionie - 1 mil - Snížit náměr 1 mil - Ajustar elevación abajo 1 mil - Вниз по вертикали 1 mil + + Major adjustment down - - Adjust Windage Right 1 mil - Oldalirány Állítása Jobbra 1 mil - Optik-Azimuth erhöhen 1 mil - Ajustar Azimute à Direita 1 mil - Dérive + 1 mil - Regulacja krzyża w poziomie + 1 mil - Náměr doprava (vítr) 1 mil - Ajustar deriva a la derecha 1 mil - Вправо на уровне 1 mil + + Major adjustment right - - Adjust Windage Left 1 mil - Oldalirány Állítása Balra 1 mil - Optik-Azimuth verringern 1 mil - Ajustar Azimute à Esquerda 1 mil - Dérive - 1 mil - Regulacja krzyża w poziomie - 1 mil - Náměr doleva (vítr) 1 mil - Ajustar deriva a la izquierda 1 mil - Влево на уровне 1 mil + + Major adjustment left \ No newline at end of file From fee65cd56f16bd4e707f0487ddad6eef885c946f Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 11 Apr 2015 14:02:44 +0200 Subject: [PATCH 3/9] Overhauled the scope adjustment module: *Added configs for the new marksmen scopes *Introduced minor and major steps *Introcuded a new increment config (ACE_ScopeAdjust_Increment) *Changed the default zero range to 100m *Added a zero reference setting *Added an interaction menu entry to update the zero reference setting --- addons/scopes/CfgVehicles.hpp | 19 +++++ addons/scopes/CfgWeapons.hpp | 51 +++++++++--- addons/scopes/XEH_postInit.sqf | 28 +++---- addons/scopes/XEH_preInit.sqf | 4 +- addons/scopes/config.cpp | 2 + addons/scopes/functions/fnc_adjustScope.sqf | 83 +++++++++++-------- addons/scopes/functions/fnc_adjustZero.sqf | 39 +++++++++ .../functions/fnc_applyScopeAdjustment.sqf | 51 ++++++++++++ .../scopes/functions/fnc_canAdjustScope.sqf | 46 ---------- addons/scopes/functions/fnc_canAdjustZero.sqf | 33 ++++++++ addons/scopes/functions/fnc_firedEH.sqf | 2 +- .../scopes/functions/fnc_inventoryCheck.sqf | 7 +- addons/scopes/functions/fnc_showZeroing.sqf | 7 +- addons/scopes/script_component.hpp | 8 ++ addons/scopes/stringtable.xml | 3 + 15 files changed, 267 insertions(+), 116 deletions(-) create mode 100644 addons/scopes/CfgVehicles.hpp create mode 100644 addons/scopes/functions/fnc_adjustZero.sqf create mode 100644 addons/scopes/functions/fnc_applyScopeAdjustment.sqf delete mode 100644 addons/scopes/functions/fnc_canAdjustScope.sqf create mode 100644 addons/scopes/functions/fnc_canAdjustZero.sqf diff --git a/addons/scopes/CfgVehicles.hpp b/addons/scopes/CfgVehicles.hpp new file mode 100644 index 0000000000..7653fe0443 --- /dev/null +++ b/addons/scopes/CfgVehicles.hpp @@ -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"}; + }; + }; + }; + }; +}; diff --git a/addons/scopes/CfgWeapons.hpp b/addons/scopes/CfgWeapons.hpp index 67898fb449..6ca522ced7 100644 --- a/addons/scopes/CfgWeapons.hpp +++ b/addons/scopes/CfgWeapons.hpp @@ -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; }; }; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 50edd494cb..f9d44cb5fa 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi and esteldunedain + * Author: KoffeinFlummi, esteldunedain, Ruthberg * * Watches for scope changes. * Defines key bindings @@ -39,10 +39,9 @@ if !(hasInterface) exitWith {}; 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}, @@ -54,10 +53,9 @@ if !(hasInterface) exitWith {}; 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}, @@ -69,10 +67,9 @@ if !(hasInterface) exitWith {}; 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}, @@ -84,10 +81,9 @@ if !(hasInterface) exitWith {}; 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}, @@ -99,10 +95,9 @@ if !(hasInterface) exitWith {}; 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, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope); true }, {false}, @@ -114,10 +109,9 @@ if !(hasInterface) exitWith {}; 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, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope); true }, {false}, @@ -129,10 +123,9 @@ if !(hasInterface) exitWith {}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific [ACE_player] call FUNC(inventoryCheck); - if !([ACE_player, -1.0, 0] call FUNC(canAdjustScope)) exitWith {false}; // Statement - [ACE_player, -1.0, 0] call FUNC(adjustScope); + [ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope); true }, {false}, @@ -144,10 +137,9 @@ if !(hasInterface) exitWith {}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific [ACE_player] call FUNC(inventoryCheck); - if !([ACE_player, 1.0, 0] call FUNC(canAdjustScope)) exitWith {false}; // Statement - [ACE_player, 1.0, 0] call FUNC(adjustScope); + [ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope); true }, {false}, diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index e574cc72d4..d45f50c1bb 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -3,7 +3,9 @@ ADDON = false; PREP(adjustScope); -PREP(canAdjustScope); +PREP(adjustZero); +PREP(applyScopeAdjustment); +PREP(canAdjustZero); PREP(firedEH); PREP(getOptics); PREP(inventoryCheck); diff --git a/addons/scopes/config.cpp b/addons/scopes/config.cpp index d94e066767..42be283044 100644 --- a/addons/scopes/config.cpp +++ b/addons/scopes/config.cpp @@ -16,6 +16,8 @@ class CfgPatches { #include "CfgSounds.hpp" +#include "CfgVehicles.hpp" + #include "CfgWeapons.hpp" #include "RscTitles.hpp" diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 6e71a391aa..aab44cc1d9 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -1,56 +1,71 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi, Ruthberg * Changes the adjustment for the current scope * * Argument: * 0: Unit - * 1: Horizontal adjustment - * 2: Vertical adjustment + * 1: Turret and Direction + * 2: Major Step * * Return value: - * True + * Did we adjust anything? * * 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 < _maxVertical select 0 or _elevation > _maxVertical select 1) exitWith {false}; +if (_windage < _maxHorizontal select 0 or _windage > _maxHorizontal select 1) exitWith {false}; + +[_unit, _elevation, _windage, _zero] call FUNC(applyScopeAdjustment); diff --git a/addons/scopes/functions/fnc_adjustZero.sqf b/addons/scopes/functions/fnc_adjustZero.sqf new file mode 100644 index 0000000000..4dbab48f49 --- /dev/null +++ b/addons/scopes/functions/fnc_adjustZero.sqf @@ -0,0 +1,39 @@ +/* + * Author: KoffeinFlummi, Ruthberg + * Updates the zero reference for the current scope + * + * Argument: + * 0: Unit + * + * Return value: + * true + * + * 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 diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf new file mode 100644 index 0000000000..6bb72558b1 --- /dev/null +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -0,0 +1,51 @@ +/* + * Author: KoffeinFlummi, Ruthberg + * Applies the adjustment for the current scope + * + * Argument: + * 0: Unit + * 1: Absolute elevation + * 2: Absolute windage + * 3: Absolute zero reference + * + * Return value: + * True + * + * 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 diff --git a/addons/scopes/functions/fnc_canAdjustScope.sqf b/addons/scopes/functions/fnc_canAdjustScope.sqf deleted file mode 100644 index eda08dc0ee..0000000000 --- a/addons/scopes/functions/fnc_canAdjustScope.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: KoffeinFlummi - * Checks if a player can adjust his optic in the given way. - * - * Argument: - * 0: Unit - * 1: Horizontal adjustment - * 2: Vertical adjustment - * - * Return value: - * Can adjustment be done? - * - * 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 diff --git a/addons/scopes/functions/fnc_canAdjustZero.sqf b/addons/scopes/functions/fnc_canAdjustZero.sqf new file mode 100644 index 0000000000..a61c8876be --- /dev/null +++ b/addons/scopes/functions/fnc_canAdjustZero.sqf @@ -0,0 +1,33 @@ +/* + * Author: KoffeinFlummi, Ruthberg + * Changes the adjustment for the current scope + * + * Argument: + * 0: Unit + * + * Return value: + * Can we update the zero reference? + * + * Public: No + */ +#include "script_component.hpp" + +if (cameraView == "GUNNER") exitWith {false}; +if !(vehicle _unit == _unit) 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 diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 8185e00ea0..8753019931 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -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); diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index c83112c8a6..af4b347124 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -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); }; }; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index bd1a04f326..a8df650374 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -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; diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index 8c4a2cb1cd..5cdb74207d 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -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 diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index eb1ff4178c..87cbdd7cf5 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -26,5 +26,8 @@ Major adjustment left + + Set zero adjustment + \ No newline at end of file From 9893d940dffcbe068550eec1e064a2a62981dd7a Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 11 Apr 2015 19:47:14 +0200 Subject: [PATCH 4/9] Disabled advanced scope zeroing if AB is not enabled --- addons/scopes/functions/fnc_canAdjustZero.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/scopes/functions/fnc_canAdjustZero.sqf b/addons/scopes/functions/fnc_canAdjustZero.sqf index a61c8876be..c9663ea711 100644 --- a/addons/scopes/functions/fnc_canAdjustZero.sqf +++ b/addons/scopes/functions/fnc_canAdjustZero.sqf @@ -14,6 +14,7 @@ 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; From 0214d891e1cca56c75d4a33277df44d5bc6b595e Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 13 Apr 2015 12:04:05 +0200 Subject: [PATCH 5/9] fix misc issues with optics, fix #537 --- addons/optics/CfgRscTitles.hpp | 8 ++++---- addons/optics/CfgWeapons.hpp | 10 +++++----- addons/optics/functions/fnc_handleFired.sqf | 4 ++-- addons/optics/functions/fnc_onDrawScope2D.sqf | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index 956a2c76c0..068bb0aa20 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -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 { diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index e42ae3780f..7749db0bc4 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -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; diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index d1b7531928..51da4c8ead 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -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, diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index 10c6eeff40..30cdb927c7 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -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]; From 1b2691ff1c66400610d8313b28770ee479927f3a Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 13 Apr 2015 21:17:30 +0200 Subject: [PATCH 6/9] Fixed incorrect calculation of the scope adjustment limits --- addons/scopes/functions/fnc_adjustScope.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index aab44cc1d9..5daed4b65e 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -65,7 +65,7 @@ if (_majorStep) then { _elevation = round(_elevation * 10) / 10; _windage = round(_windage * 10) / 10; -if (_elevation < _maxVertical select 0 or _elevation > _maxVertical select 1) exitWith {false}; +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); From ada62fca7dee01cd63873f055cc86f96f6ba4311 Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 13 Apr 2015 21:38:01 +0200 Subject: [PATCH 7/9] reloading launchers didn't work on remote clients --- addons/reloadlaunchers/functions/fnc_load.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/reloadlaunchers/functions/fnc_load.sqf b/addons/reloadlaunchers/functions/fnc_load.sqf index f6ad07e357..bf14b9b691 100644 --- a/addons/reloadlaunchers/functions/fnc_load.sqf +++ b/addons/reloadlaunchers/functions/fnc_load.sqf @@ -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); }; From f422d1059a4b16539ce9a531e96400dfa3cc2498 Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Mon, 13 Apr 2015 18:51:39 -0700 Subject: [PATCH 8/9] #572 - We now always build common.pbo to make sure we always display the accurate version number in the RPT. --- tools/make.py | 4 ++++ tools/make64.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tools/make.py b/tools/make.py index 6222932727..bd27f893f5 100644 --- a/tools/make.py +++ b/tools/make.py @@ -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)) diff --git a/tools/make64.py b/tools/make64.py index 24f8ea2b0b..b6635f884e 100644 --- a/tools/make64.py +++ b/tools/make64.py @@ -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)) From 2f39067cb38a5854c6fd7427593ef7d99855975e Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 14 Apr 2015 10:47:09 +0200 Subject: [PATCH 9/9] Removed TABs --- addons/scopes/functions/fnc_adjustScope.sqf | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 5daed4b65e..301b166559 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -46,20 +46,20 @@ _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 }; + 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) }; - }; + 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;