cbafyied scopes

still lots of spawns and waitUntils in there
This commit is contained in:
bux578 2015-01-16 13:15:14 +01:00
parent 287144a691
commit b556097896
25 changed files with 445 additions and 414 deletions

View File

@ -1,39 +0,0 @@
/*
* Author: KoffeinFlummi
*
* Initializes vars needed for scope adjustment and watches for scope changes.
*
* Arguments:
* None
*
* Return Value:
* None
*/
AGM_Scopes_fadeScript = scriptNull;
// show overlay after changing weapon/optic
0 spawn {
_layer = ["AGM_Scope_Zeroing"] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {[AGM_player, 0,0] call AGM_Scopes_fnc_canAdjustScope};
_layer cutRsc ["AGM_Scope_Zeroing", "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
_weapon = currentWeapon AGM_player;
_optics = [AGM_player] call AGM_Scopes_fnc_getOptics;
waitUntil {sleep 0.05; !(_optics isEqualTo ([AGM_player] call AGM_Scopes_fnc_getOptics)) or (currentWeapon AGM_player != _weapon)};
};
};
// instantly hide when scoping in
0 spawn {
_layer = ["AGM_Scope_Zeroing"] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {sleep 0.05; cameraView == "GUNNER"};
if !(isNull AGM_Scopes_fadeScript) then {
terminate AGM_Scopes_fadeScript;
};
_layer cutText ["", "PLAIN", 0];
};
};

View File

@ -1,238 +0,0 @@
class CfgPatches {
class AGM_Scopes {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"KoffeinFlummi"};
authorUrl = "https://github.com/KoffeinFlummi";
};
};
class CfgFunctions {
class AGM_Scopes {
class AGM_Scopes {
file = "AGM_Scopes\functions";
class adjustScope;
class canAdjustScope;
class firedEH;
class getOptics;
class hideZeroing;
class inventoryCheck;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Scopes {
clientInit = "call compile preprocessFileLineNumbers '\AGM_Scopes\clientInit.sqf';";
};
};
class Extended_Fired_EventHandlers {
class CAManBase {
class AGM_Scopes {
clientFired = "if (_this select 0 == AGM_player) then {_this call AGM_Scopes_fnc_firedEH};";
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class AGM_Scopes {
clientTake = "if (_this select 0 == AGM_player) then {_this call AGM_Scopes_fnc_inventoryCheck};";
};
};
};
class Extended_Put_EventHandlers {
class CAManBase {
class AGM_Scopes {
clientPut = "if (_this select 0 == AGM_player) then {_this call AGM_Scopes_fnc_inventoryCheck};";
};
};
};
class Extended_InitPost_EventHandlers {
class CAManBase {
class AGM_Scopes {
init = "if (_this select 0 == call AGM_Core_fnc_player) then {_this call AGM_Scopes_fnc_inventoryCheck};";
};
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class AGM_Scopes {
respawn = "if (_this select 0 == call AGM_Core_fnc_player) then {_this call AGM_Scopes_fnc_inventoryCheck};";
};
};
};
class AGM_Core_Default_Keys {
class adjustScopeUp {
displayName = "$STR_AGM_Scopes_AdjustUp";
condition = "[_player] call AGM_Scopes_fnc_inventoryCheck; [_player, 0, 0.1] call AGM_Scopes_fnc_canAdjustScope";
statement = "[_player, 0, 0.1] call AGM_Scopes_fnc_adjustScope;";
allowHolding = 1;
key = 201;
shift = 0;
control = 0;
alt = 0;
};
class adjustScopeDown: adjustScopeUp {
displayName = "$STR_AGM_Scopes_AdjustDown";
condition = "[_player] call AGM_Scopes_fnc_inventoryCheck; [_player, 0, -0.1] call AGM_Scopes_fnc_canAdjustScope";
statement = "[_player, 0, -0.1] call AGM_Scopes_fnc_adjustScope;";
key = 209;
};
class adjustScopeLeft: adjustScopeUp {
displayName = "$STR_AGM_Scopes_AdjustLeft";
condition = "[_player] call AGM_Scopes_fnc_inventoryCheck; [_player, -0.1, 0] call AGM_Scopes_fnc_canAdjustScope";
statement = "[_player, -0.1, 0] call AGM_Scopes_fnc_adjustScope;";
key = 209;
control = 1;
};
class adjustScopeRight: adjustScopeLeft {
displayName = "$STR_AGM_Scopes_AdjustRight";
condition = "[_player] call AGM_Scopes_fnc_inventoryCheck; [_player, 0.1, 0] call AGM_Scopes_fnc_canAdjustScope";
statement = "[_player, 0.1, 0] call AGM_Scopes_fnc_adjustScope;";
key = 201;
};
};
class CfgSounds {
class AGM_Sound_Click;
class AGM_Scopes_Click_1: AGM_Sound_Click {
sound[] = {"\AGM_Scopes\sounds\agm_scopes_click.wav", 3, 2, 200};
};
class AGM_Scopes_Click_2: AGM_Scopes_Click_1 {
sound[] = {"\AGM_Scopes\sounds\agm_scopes_click.wav", 3.3, 1.8, 200};
};
class AGM_Scopes_Click_3: AGM_Scopes_Click_1 {
sound[] = {"\AGM_Scopes\sounds\agm_scopes_click.wav", 2.8, 2.3, 200};
};
};
class CfgWeapons {
class ItemCore;
class InventoryOpticsItem_Base_F;
class optic_LRPS: ItemCore {
AGM_ScopeAdjust_Horizontal[] = {-50,50};
AGM_ScopeAdjust_Vertical[] = {-70,70};
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = {1};
discreteDistanceInitIndex = 0;
};
};
};
};
class optic_SOS: ItemCore {
AGM_ScopeAdjust_Horizontal[] = {-50,50};
AGM_ScopeAdjust_Vertical[] = {-60,60};
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = {1};
discreteDistanceInitIndex = 0;
};
};
};
};
class optic_DMS: ItemCore {
AGM_ScopeAdjust_Horizontal[] = {-40,40};
AGM_ScopeAdjust_Vertical[] = {-40,40};
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = {1};
discreteDistanceInitIndex = 0;
};
};
};
};
};
class RscTitles {
class AGM_Scope_Zeroing {
idd = -1;
movingEnable = 0;
enableSimulation = 1;
enableDisplay = 1;
onLoad = "_this spawn compile preprocessFileLineNumbers '\AGM_Scopes\scripts\zeroingOnLoad.sqf'; uiNamespace setVariable ['AGM_Scope_Debug', _this];";
duration = 1e+011;
fadein = 0;
fadeout = 0;
name = "AGM_Scope_Zeroing";
class RscPicture;
class RscText;
class controls {
class AGM_Scope_Zeroing_BG: RscPicture {
idc = 925001;
type = 0;
text = "AGM_Scopes\UI\scopes_bg.paa";
style = 48 + 0x800;
scale = 1;
sizeEx = 1;
font = "PuristaMedium";
colorText[] = {1,1,1,1};
colorBackground[] = {1,1,1,1};
shadow = 1;
x = (0.5-0.4/2) * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.4 * safezoneW;
h = 0.3 * safezoneH;
};
class AGM_Scope_Zeroing_Vertical: RscText {
idc = 925002;
type = 0;
style = 2;
sizeEx = 0.04;
lineSpacing = 1;
font = "PuristaMedium";
text = "";
colorText[] = {1,1,1, 0.9};
colorBackground[] = {1,0,0, 0};
shadow = 0;
x = (0.5-0.4/2 + 0.45*0.4) * safezoneW + safezoneX;
y = (0 + 0.19*0.3) * safezoneH + safezoneY;
w = 0.04 * safezoneW;
h = 0.025 * safezoneH;
};
class AGM_Scope_Zeroing_Horizontal: RscText {
idc = 925003;
type = 0;
style = 0;
sizeEx = 0.04;
lineSpacing = 1;
font = "PuristaMedium";
text = "";
colorText[] = {1,1,1, 0.9};
colorBackground[] = {1,0,0, 0};
shadow = 0;
x = (0.5-0.4/2 + 0.6*0.4) * safezoneW + safezoneX;
y = (0 + 0.47*0.3) * safezoneH + safezoneY;
w = 0.04 * safezoneW;
h = 0.025 * safezoneH;
};
};
};
};
class RscInGameUI {
class RscUnitInfo;
class RscWeaponZeroing: RscUnitInfo {
onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['AGM_dlgWeaponZeroing', _this select 0];";
};
};

View File

@ -1,67 +0,0 @@
/*
* Author: KoffeinFlummi
*
* Changes the adjustment for the current scope
*
* Arguments:
* 0: Horizontal adjustment
* 1: Vertical adjustment
*
* Return Value:
* True
*/
private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"];
_unit = _this select 0;
_weapons = [
primaryWeapon _unit,
secondaryWeapon _unit,
handgunWeapon _unit
];
if (isNil "AGM_Scopes_Adjustment") then {
AGM_Scopes_Adjustment = [[0,0], [0,0], [0,0]];
};
_zeroing = AGM_Scopes_Adjustment select (_weapons find (currentWeapon _unit));
_zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10];
_zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10];
AGM_Scopes_Adjustment set [_weapons find (currentWeapon _unit), _zeroing];
playSound (["AGM_Scopes_Click_1", "AGM_Scopes_Click_2", "AGM_Scopes_Click_3"] select floor random 3);
// slightly rotate the player if looking through optic
if (cameraView == "GUNNER") then {
_pitchbankyaw = [_unit] call AGM_Core_fnc_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 AGM_Core_fnc_setPitchBankYaw;
};
_display = uiNamespace getVariable ["AGM_Scopes_ZeroingDisplay", displayNull];
if !(isNull _display) then {
_vertical = _display displayCtrl 925002;
_horizontal = _display displayCtrl 925003;
_vertical ctrlSetText (str (_zeroing select 1));
_horizontal ctrlSetText (str (_zeroing select 0));
};
if (!isNull (missionNamespace getVariable ["AGM_Scopes_fadeScript", scriptNull])) then {
terminate AGM_Scopes_fadeScript;
};
if (cameraView != "GUNNER") then {
AGM_Scopes_fadeScript = 0 spawn {
_layer = ["AGM_Scope_Zeroing"] call BIS_fnc_rscLayer;
_layer cutRsc ["AGM_Scope_Zeroing", "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
};
};
true

View File

@ -1,25 +0,0 @@
// by commy2
private ["_state", "_ctrl"];
_state = _this select 0;
disableSerialization;
_ctrl = (uiNamespace getVariable ['AGM_dlgWeaponZeroing', displayNull]) displayCtrl 168;
if (_state) then {
_ctrl ctrlSetPosition [0,0,0,0];
} else {
private "_config";
_config = configFile >> "RscInGameUI" >> "RscWeaponZeroing" >> "CA_Zeroing";
_ctrl ctrlSetPosition [
getNumber (_config >> "x"),
getNumber (_config >> "y"),
getNumber (_config >> "w"),
getNumber (_config >> "h")
];
};
_ctrl ctrlCommit 0;

View File

@ -1,21 +0,0 @@
// by KoffeinFlummi / commy2
private "_new";
_new = _this call AGM_Scopes_fnc_getOptics;
if (isNil "AGM_Scopes_Optics") then {
AGM_Scopes_Optics = ["", "", ""];
};
if (isNil "AGM_Scopes_Adjustment") then {
AGM_Scopes_Adjustment = [[0,0], [0,0], [0,0]];
};
{
if (_new select _forEachIndex != _x) then {
AGM_Scopes_Adjustment set [_forEachIndex, [0,0]];
};
} forEach AGM_Scopes_Optics;
AGM_Scopes_Optics = _new;

View File

@ -0,0 +1 @@
z\ace\addons\scopes

View File

@ -0,0 +1,51 @@
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));
};
};
class Extended_Fired_EventHandlers {
class CAManBase {
class ADDON {
clientFired = QUOTE(if (_this select 0 == ACE_player) then { _this call FUNC(firedEH) };);
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class ADDON {
clientTake = QUOTE(if (_this select 0 == ACE_player) then{ _this call FUNC(inventoryCheck) };);
};
};
};
class Extended_Put_EventHandlers {
class CAManBase {
class ADDON {
clientPut = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(inventoryCheck)};);
};
};
};
class Extended_InitPost_EventHandlers {
class CAManBase {
class ADDON {
init = QUOTE(if (_this select 0 == call EFUNC(common,player)) then{ _this call FUNC(inventoryCheck) };);
};
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {
respawn = QUOTE(if (_this select 0 == call EFUNC(common, player)) then{ _this call FUNC(inventoryCheck) };);
};
};
};

View File

@ -0,0 +1,12 @@
class CfgSounds {
class ACE_Sound_Click;
class ACE_Scopes_Click_1: ACE_Sound_Click {
sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)),3, 2, 200};
};
class ACE_Scopes_Click_2: ACE_Scopes_Click_1 {
sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)), 3.3, 1.8, 200};
};
class ACE_Scopes_Click_3: ACE_Scopes_Click_1 {
sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)), 2.8, 2.3, 200};
};
};

View File

@ -0,0 +1,43 @@
class CfgWeapons {
class ItemCore;
class InventoryOpticsItem_Base_F;
class optic_LRPS : ItemCore {
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
ACE_ScopeAdjust_Vertical[] = { -70, 70 };
class ItemInfo : InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = { 1 };
discreteDistanceInitIndex = 0;
};
};
};
};
class optic_SOS : ItemCore {
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
ACE_ScopeAdjust_Vertical[] = { -60, 60 };
class ItemInfo : InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = { 1 };
discreteDistanceInitIndex = 0;
};
};
};
};
class optic_DMS : ItemCore {
ACE_ScopeAdjust_Horizontal[] = { -40, 40 };
ACE_ScopeAdjust_Vertical[] = { -40, 40 };
class ItemInfo : InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {
discreteDistance[] = { 1 };
discreteDistanceInitIndex = 0;
};
};
};
};
};

View File

@ -0,0 +1,75 @@
class RscTitles {
class ACE_Scope_Zeroing {
idd = -1;
movingEnable = 0;
enableSimulation = 1;
enableDisplay = 1;
onLoad = QUOTE(_this spawn COMPILE_FILE(PATHTOF(scripts\zeroingOnLoad.sqf)); uiNamespace setVariable[QGVAR(Debug), _this];);
duration = 1e+011;
fadein = 0;
fadeout = 0;
name = QGVAR(Zeroing);
class RscPicture;
class RscText;
class controls {
class ACE_Scope_Zeroing_BG : RscPicture {
idc = 925001;
type = 0;
text = PATHTOF(UI\scopes_bg.paa);
style = 48 + 0x800;
scale = 1;
sizeEx = 1;
font = "PuristaMedium";
colorText[] = { 1, 1, 1, 1 };
colorBackground[] = { 1, 1, 1, 1 };
shadow = 1;
x = (0.5 - 0.4 / 2) * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.4 * safezoneW;
h = 0.3 * safezoneH;
};
class ACE_Scope_Zeroing_Vertical : RscText {
idc = 925002;
type = 0;
style = 2;
sizeEx = 0.04;
lineSpacing = 1;
font = "PuristaMedium";
text = "";
colorText[] = { 1, 1, 1, 0.9 };
colorBackground[] = { 1, 0, 0, 0 };
shadow = 0;
x = (0.5 - 0.4 / 2 + 0.45*0.4) * safezoneW + safezoneX;
y = (0 + 0.19*0.3) * safezoneH + safezoneY;
w = 0.04 * safezoneW;
h = 0.025 * safezoneH;
};
class ACE_Scope_Zeroing_Horizontal : RscText {
idc = 925003;
type = 0;
style = 0;
sizeEx = 0.04;
lineSpacing = 1;
font = "PuristaMedium";
text = "";
colorText[] = { 1, 1, 1, 0.9 };
colorBackground[] = { 1, 0, 0, 0 };
shadow = 0;
x = (0.5 - 0.4 / 2 + 0.6*0.4) * safezoneW + safezoneX;
y = (0 + 0.47*0.3) * safezoneH + safezoneY;
w = 0.04 * safezoneW;
h = 0.025 * safezoneH;
};
};
};
};
class RscInGameUI {
class RscUnitInfo;
class RscWeaponZeroing : RscUnitInfo {
onLoad = QUOTE(["onLoad", _this, "RscUnitInfo", "IGUI"] call COMPILE_FILE(PATHTOF(A3\ui_f\scripts\initDisplay.sqf)); uiNamespace setVariable["ACE_dlgWeaponZeroing", _this select 0];);
};
};

View File

@ -0,0 +1,39 @@
/*
* Author: KoffeinFlummi
*
* Initializes vars needed for scope adjustment and watches for scope changes.
*
* Arguments:
* None
*
* Return Value:
* None
*/
GVAR(fadeScript) = scriptNull;
// show overlay after changing weapon/optic
0 spawn {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)};
_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
_weapon = currentWeapon ACE_player;
_optics = [ACE_player] call FUNC(getOptics);
waitUntil {sleep 0.05; !(_optics isEqualTo ([ACE_player] call FUNC(getOptics))) or (currentWeapon ACE_player != _weapon)};
};
};
// instantly hide when scoping in
0 spawn {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {sleep 0.05; cameraView == "GUNNER"};
if !(isNull GVAR(fadeScript)) then {
terminate GVAR(fadeScript);
};
_layer cutText ["", "PLAIN", 0];
};
};

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
PREP(adjustScope);
PREP(canAdjustScope);
PREP(firedEH);
PREP(getOptics);
PREP(hideZeroing);
PREP(inventoryCheck);

54
addons/scopes/config.cpp Normal file
View File

@ -0,0 +1,54 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = { "ace_main", "ace_common" };
version = QUOTE(VERSION);
versionStr = QUOTE(VERSION);
versionAr[] = { VERSION_AR };
author[] = {"KoffeinFlummi"};
authorUrl = "https://github.com/KoffeinFlummi";
};
};
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgWeapons.hpp"
class ACE_Default_Keys {
class adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustUp";
condition = QUOTE([_player] call FUNC(inventoryCheck); [_player, 0, 0.1] call FUNC(canAdjustScope));
statement = QUOTE([_player, 0, 0.1] call FUNC(adjustScope));
allowHolding = 1;
key = 201;
shift = 0;
control = 0;
alt = 0;
};
class adjustScopeDown: adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustDown";
condition = QUOTE([_player] call FUNC(inventoryCheck); [_player, 0, -0.1] call FUNC(canAdjustScope));
statement = QUOTE([_player, 0, -0.1] call FUNC(adjustScope));
key = 209;
};
class adjustScopeLeft: adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustLeft";
condition = QUOTE([_player] call FUNC(inventoryCheck); [_player, -0.1, 0] call FUNC(canAdjustScope));
statement = QUOTE([_player, -0.1, 0] call FUNC(adjustScope));
key = 209;
control = 1;
};
class adjustScopeRight: adjustScopeLeft {
displayName = "$STR_ACE_Scopes_AdjustRight";
condition = QUOTE([_player] call FUNC(inventoryCheck); [_player, 0.1, 0] call FUNC(canAdjustScope));
statement = QUOTE([_player, 0.1, 0] call FUNC(adjustScope));
key = 201;
};
};
#include "RscTitles.hpp"
#include "RscInGameUI.hpp"

View File

@ -0,0 +1,69 @@
/*
* Author: KoffeinFlummi
*
* Changes the adjustment for the current scope
*
* Arguments:
* 0: Horizontal adjustment
* 1: Vertical adjustment
*
* Return Value:
* True
*/
#include "script_component.hpp"
private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"];
_unit = _this select 0;
_weapons = [
primaryWeapon _unit,
secondaryWeapon _unit,
handgunWeapon _unit
];
if (isNil QGVAR(Adjustment)) then {
GVAR(Adjustment) = [[0,0], [0,0], [0,0]];
};
_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit));
_zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10];
_zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10];
GVAR(Adjustment) set [_weapons find (currentWeapon _unit), _zeroing];
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)
};
_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull];
if !(isNull _display) then {
_vertical = _display displayCtrl 925002;
_horizontal = _display displayCtrl 925003;
_vertical ctrlSetText (str (_zeroing select 1));
_horizontal ctrlSetText (str (_zeroing select 0));
};
if (!isNull (missionNamespace getVariable [QGVAR(fadeScript), scriptNull])) then {
terminate GVAR(fadeScript);
};
if (cameraView != "GUNNER") then {
GVAR(fadeScript) = 0 spawn {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
};
};
true

View File

@ -11,6 +11,8 @@
* Can adjustment be done? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_weapons", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"];
_unit = _this select 0;
@ -23,21 +25,21 @@ _weapons = [
if !(currentWeapon _unit in _weapons) exitWith {false};
if (isNil "AGM_Scopes_Adjustment") then {
AGM_Scopes_Adjustment = [[0,0], [0,0], [0,0]];
if (isNil QGVAR(Adjustment)) then {
GVAR(Adjustment) = [[0,0], [0,0], [0,0]];
};
if (isNil "AGM_Scopes_Optics") then {
AGM_Scopes_Optics = ["", "", ""];
GVAR(Optics) = ["", "", ""];
};
_zeroing = AGM_Scopes_Adjustment select (_weapons find (currentWeapon _unit));
_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit));
_zeroX = (_zeroing select 0) + (_this select 1);
_zeroY = (_zeroing select 1) + (_this select 2);
_optic = AGM_Scopes_Optics select (_weapons find (currentWeapon _unit));
_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "AGM_ScopeAdjust_Horizontal");
_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "AGM_ScopeAdjust_Vertical");
_optic = GVAR(Optics) select (_weapons find (currentWeapon _unit));
_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};

View File

@ -10,6 +10,8 @@
* None
*/
#include "script_component.hpp"
private ["_unit", "_weaponType", "_ammoType", "_magazineType", "_round", "_weapons", "_zeroing", "_direction", "_azimuth", "_altitude", "_velocity"];
_unit = _this select 0;
@ -25,9 +27,9 @@ _weapons = [
];
if !(_weaponType in _weapons) exitWith {};
_zeroing = AGM_Scopes_Adjustment select (_weapons find _weaponType);
_zeroing = QGVAR(Adjustment) select (_weapons find _weaponType);
// convert zeroing from mils to degrees
_zeroing = [_zeroing, {_this * 0.05625}] call AGM_Core_fnc_map;
_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map);
[_round, _zeroing select 0, _zeroing select 1, 0] call AGM_Core_fnc_changeProjectileDirection;
[_round, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection);

View File

@ -10,6 +10,8 @@
* [optic of primary, optic of secondary, optic of handgun] (Array)
*/
#include "script_component.hpp"
private ["_unit", "_array"];
_unit = _this select 0;

View File

@ -0,0 +1,27 @@
// by commy2
#include "script_component.hpp"
private ["_state", "_ctrl"];
_state = _this select 0;
disableSerialization;
_ctrl = (uiNamespace getVariable ['ACE_dlgWeaponZeroing', displayNull]) displayCtrl 168;
if (_state) then {
_ctrl ctrlSetPosition [0,0,0,0];
} else {
private "_config";
_config = configFile >> "RscInGameUI" >> "RscWeaponZeroing" >> "CA_Zeroing";
_ctrl ctrlSetPosition [
getNumber (_config >> "x"),
getNumber (_config >> "y"),
getNumber (_config >> "w"),
getNumber (_config >> "h")
];
};
_ctrl ctrlCommit 0;

View File

@ -0,0 +1,23 @@
// by KoffeinFlummi / commy2
#include "script_component.hpp"
private "_new";
_new = _this call FUNC(getOptics);
if (isNil QGVAR(Optics)) then {
GVAR(Optics) = ["", "", ""];
};
if (isNil QGVAR(Adjustment)) then {
GVAR(Adjustment) = [[0,0], [0,0], [0,0]];
};
{
if (_new select _forEachIndex != _x) then {
GVAR(Adjustment) set [_forEachIndex, [0,0]];
};
} forEach GVAR(Optics);
GVAR(Optics) = _new;

View File

@ -0,0 +1 @@
#include "\z\ace\addons\scopes\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT scopes
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_SCOPES
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_SCOPES
#define DEBUG_SETTINGS DEBUG_SETTINGS_SCOPES
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-11 -->
<Project name="AGM">
<Project name="ACE">
<Package name="Scopes">
<Key ID="STR_AGM_Scopes_AdjustUp">
<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>
@ -13,7 +13,7 @@
<Spanish>Ajustar elevación arriba</Spanish>
<Russian>Вверх по вертикали</Russian>
</Key>
<Key ID="STR_AGM_Scopes_AdjustDown">
<Key ID="STR_ACE_Scopes_AdjustDown">
<English>Adjust Elevation Down</English>
<Hungarian>Magasság Állítása Lefelé</Hungarian>
<German>Optik-Elevation verringern</German>
@ -24,7 +24,7 @@
<Spanish>Ajustar elevación abajo</Spanish>
<Russian>Вниз по вертикали</Russian>
</Key>
<Key ID="STR_AGM_Scopes_AdjustRight">
<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>
@ -35,7 +35,7 @@
<Spanish>Ajustar deriva a la derecha</Spanish>
<Russian>Вправо на уровне</Russian>
</Key>
<Key ID="STR_AGM_Scopes_AdjustLeft">
<Key ID="STR_ACE_Scopes_AdjustLeft">
<English>Adjust Windage Left</English>
<Hungarian>Oldalirány Állítása Balra</Hungarian>
<German>Optik-Azimuth verringern</German>