From b0575bad21a2647a7b1ffa06db7a10eaff993d74 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 3 Apr 2015 17:50:52 +0200 Subject: [PATCH] improve infoDisplayChanged EH --- addons/common/RscInfoType.hpp | 98 +++++++++++++++++-- addons/common/XEH_preInit.sqf | 4 +- addons/common/functions/fnc_getAllGear.sqf | 59 ++++++----- addons/fcs/CfgOptics.hpp | 41 ++------ addons/fcs/XEH_clientInit.sqf | 10 ++ addons/optics/CfgRscTitles.hpp | 3 - addons/optics/XEH_preInit.sqf | 1 + .../functions/fnc_drawShortdotScript.sqf | 20 ++++ .../fnc_handlePlayerInventoryChanged.sqf | 6 +- addons/optics/functions/fnc_onDraw3D.sqf | 28 +----- addons/scopes/RscTitles.hpp | 2 + addons/vector/config.cpp | 2 + 12 files changed, 179 insertions(+), 95 deletions(-) create mode 100644 addons/optics/functions/fnc_drawShortdotScript.sqf diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index fe21b05265..2c79c4d8d6 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -1,23 +1,107 @@ class RscInGameUI { - class RscUnitInfo; + class RscUnitInfo { + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscUnitInfoNoHUD { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + class RscUnitInfoSoldier: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent);); }; + class RscUnitInfoTank: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent);); }; + class RscUnitInfoAir: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); }; + + class RscUnitInfo_AH64D_gunner { + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + }; + + class RscUnitInfoUAV { + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgUAV', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'UAV')])] call FUNC(localEvent);); + }; + class RscUnitInfoSubmarine: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent);); }; + class RscUnitInfoShip: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent);); }; + + class RscWeaponEmpty { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinder { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeArtillery { + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeArtilleryAuto { + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinderPAS13 { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_LaserDesignator { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinderMAAWS { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinderAbramsCom { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinderAbramsGun { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscWeaponRangeFinderStrykerMGSGun { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_strider_commander { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_titan { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_punisher { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_SDV_periscope { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + class RscUnitInfoParachute: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent);); + }; + + class RscUnitVehicle { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + }; + + class RscOptics_LaserDesignator_02 { + onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); }; }; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 345bc7873c..fc9b50a1d5 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -258,10 +258,10 @@ ACE_player = player; if (hasInterface) then { // PFH to update the ACE_player variable [{ - if !(ACE_player isEqualTo (missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player])) then { + if !(ACE_player isEqualTo (call FUNC(player))) then { _oldPlayer = ACE_player; - ACE_player = missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player]; + ACE_player = call FUNC(player); uiNamespace setVariable ["ACE_player", ACE_player]; // Raise ACE event diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf index efb58a0b9d..1b1d7e03fa 100644 --- a/addons/common/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -1,5 +1,5 @@ /* - * Author: bux578 + * Author: bux578, commy2 * * Returns an array containing all items of a given unit * @@ -7,32 +7,45 @@ * 0: Unit (Object) * * Return value: - * Array with all the gear + * Array with all the gear, format: + * 0: headgear (String) + * 1: goggles (String) + * 2,3: uniform (String, Array) + * 4,5: vest (String, Array) + * 6,7: backpack (String, Array) + * 8-10: rifle (String, Array, Array) + * 11-13: launcher (String, Array, Array) + * 14-16: pistol (String, Array, Array) + * 17: map, compass, watch, etc. (Array) + * 18: binocluar (String) + * */ #include "script_component.hpp" EXPLODE_1_PVT(_this,_unit); -if (isNull _unit) exitWith {[]}; +if (isNull _unit) exitWith {[ + "", + "", + "", [], + "", [], + "", [], + "", ["","","",""], [], + "", ["","","",""], [], + "", ["","","",""], [], + [], + "" +]}; [ - (headgear _unit), - (goggles _unit), - (uniform _unit), - (uniformItems _unit), - (vest _unit), - (vestItems _unit), - (backpack _unit), - (backpackItems _unit), - (primaryWeapon _unit), - (primaryWeaponItems _unit), - (primaryWeaponMagazine _unit), - (secondaryWeapon _unit), - (secondaryWeaponItems _unit), - (secondaryWeaponMagazine _unit), - (handgunWeapon _unit), - (handgunItems _unit), - (handgunMagazine _unit), - (assignedItems _unit), - (binocular _unit) -] \ No newline at end of file + headgear _unit, + goggles _unit, + uniform _unit, uniformItems _unit, + vest _unit, vestItems _unit, + backpack _unit, backpackItems _unit, + primaryWeapon _unit, primaryWeaponItems _unit, primaryWeaponMagazine _unit, + secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit, + handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, + assignedItems _unit, + binocular _unit +] diff --git a/addons/fcs/CfgOptics.hpp b/addons/fcs/CfgOptics.hpp index 3c17e760f0..b6e090af3b 100644 --- a/addons/fcs/CfgOptics.hpp +++ b/addons/fcs/CfgOptics.hpp @@ -17,22 +17,18 @@ class RscMapControl; class RscInGameUI { class RscUnitInfo; class RscUnitInfo_AH64D_gunner { - onLoad = ""; controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinder { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderPAS13 { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; MACRO_RANGEFINDER }; class RscOptics_Rangefinder: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -40,7 +36,6 @@ class RscInGameUI { }; }; class RscOptics_LaserDesignator { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -48,7 +43,6 @@ class RscInGameUI { }; }; class RscWeaponRangeFinderMAAWS { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -56,22 +50,18 @@ class RscInGameUI { }; }; class RscWeaponRangeFinderAbramsCom { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderAbramsGun { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderStrykerMGSGun { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscOptics_crows: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -79,7 +69,6 @@ class RscInGameUI { }; }; class RscOptics_strider_commander { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -88,12 +77,10 @@ class RscInGameUI { }; class RscWeaponRangeZeroing: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; controls[] = {"CA_Zeroing", "CA_DistanceText", "CA_Distance","ACE_CA_Distance", "ACE_Rangehelper"}; MACRO_RANGEFINDER }; class RscOptics_sos: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -101,7 +88,6 @@ class RscInGameUI { }; }; class RscOptics_nightstalker: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -109,7 +95,6 @@ class RscInGameUI { }; }; class RscOptics_tws: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -117,7 +102,6 @@ class RscInGameUI { }; }; class RscOptics_punisher { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -125,7 +109,6 @@ class RscInGameUI { }; }; class RscOptics_tws_sniper: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -133,7 +116,6 @@ class RscInGameUI { }; }; class RscOptics_SDV_periscope { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -141,7 +123,6 @@ class RscInGameUI { }; }; class RscOptics_Heli_Attack_02_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -149,7 +130,6 @@ class RscInGameUI { }; }; class RscOptics_Heli_Attack_01_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -157,7 +137,6 @@ class RscInGameUI { }; }; class RscOptics_UAV_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -165,7 +144,6 @@ class RscInGameUI { }; }; class RscOptics_UGV_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -173,7 +151,6 @@ class RscInGameUI { }; }; class RscOptics_APC_Tracked_01_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -181,7 +158,6 @@ class RscInGameUI { }; }; class RscOptics_APC_Tracked_03_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -189,7 +165,6 @@ class RscInGameUI { }; }; class RscOptics_APC_Wheeled_01_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -197,7 +172,6 @@ class RscInGameUI { }; }; class RscOptics_APC_Wheeled_03_commander: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -205,7 +179,6 @@ class RscInGameUI { }; }; class RscOptics_APC_Wheeled_03_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -213,7 +186,6 @@ class RscInGameUI { }; }; class RscOptics_MBT_01_commander: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -221,7 +193,6 @@ class RscInGameUI { }; }; class RscOptics_MBT_01_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -229,7 +200,6 @@ class RscInGameUI { }; }; class RscOptics_MBT_02_commander: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -237,7 +207,6 @@ class RscInGameUI { }; }; class RscOptics_MBT_02_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER @@ -245,7 +214,15 @@ class RscInGameUI { }; }; class RscOptics_MBT_03_gunner: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; + class CA_IGUI_elements_group: RscControlsGroup { + class controls { + MACRO_RANGEFINDER + }; + }; + }; + + // marksmen + class RscOptics_LaserDesignator_02 { class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_clientInit.sqf index 17faa70f17..c0c76cfdbe 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_clientInit.sqf @@ -5,3 +5,13 @@ GVAR(time) = 0; GVAR(position) = [0,0,0]; #include "initKeybinds.sqf" + +["infoDisplayChanged", { + private "_control"; + _control = (_this select 0) displayCtrl 151; + + if (!isNull _control && {_this select 1 == "Any"}) then { + uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; + _control ctrlSetTextColor [0, 0, 0, 0]; + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index 9cfde5faba..0581994bfa 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -1,7 +1,4 @@ -class RscText; - - class RscText; class RscTitles { diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index 77dd28e272..3c137c6da4 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(drawShortdotScript); PREP(handleCameraViewChanged); PREP(handlePlayerInventoryChanged); PREP(onDraw3D); diff --git a/addons/optics/functions/fnc_drawShortdotScript.sqf b/addons/optics/functions/fnc_drawShortdotScript.sqf new file mode 100644 index 0000000000..9e360388e1 --- /dev/null +++ b/addons/optics/functions/fnc_drawShortdotScript.sqf @@ -0,0 +1,20 @@ +// by commy2 +#include "script_component.hpp" + +private ["_control", "_zoom"]; + +_control = _this select 0; +_zoom = _this select 1; + +private ["_sizeX", "_sizeY"]; + +_sizeX = _zoom/4; +_sizeY = _sizeX*safezoneW/safezoneH; + +_control ctrlSetPosition [ + safezoneX+0.5*safezoneW-0.5*_sizeX, + safezoneY+0.5*safezoneH-0.5*_sizeY, + _sizeX, + _sizeY +]; +_control ctrlCommit 0; diff --git a/addons/optics/functions/fnc_handlePlayerInventoryChanged.sqf b/addons/optics/functions/fnc_handlePlayerInventoryChanged.sqf index 5ed49457fd..a8a66cf144 100644 --- a/addons/optics/functions/fnc_handlePlayerInventoryChanged.sqf +++ b/addons/optics/functions/fnc_handlePlayerInventoryChanged.sqf @@ -19,12 +19,10 @@ _usedOptics = if (isNull (_this select 0)) then {["","",""]} else { //@todo fix _opticsScript = {}; if (_x != "") then { // @todo - _opticsTexture = ""; - _opticsScript = {}; + _opticsTexture = QUOTE(PATHTOF(reticles\ace_shortdot_reticle_1.paa)); + _opticsScript = FUNC(drawShortdotScript); }; GVAR(usedOptics) set [_forEachIndex, [_x, _opticsTexture, _opticsScript]]; }; } forEach _usedOptics; - -//(uiNamespace getVariable "ACE_ctrlShortdotReticle") ctrlSetText QUOTE(PATHTOF(reticles\ace_shortdot_reticle_1.paa)); diff --git a/addons/optics/functions/fnc_onDraw3D.sqf b/addons/optics/functions/fnc_onDraw3D.sqf index 415ef18ab7..fa557bec16 100644 --- a/addons/optics/functions/fnc_onDraw3D.sqf +++ b/addons/optics/functions/fnc_onDraw3D.sqf @@ -1,34 +1,14 @@ // by commy2 #include "script_component.hpp" - - - - -if (GVAR(showShortdot)) then { - - - - private "_control"; _control = uiNamespace getVariable ["ACE_ctrlShortdotReticle", controlNull]; -if (cameraView != "GUNNER" || {currentWeapon ACE_player != primaryWeapon ACE_player}) exitWith { +if !(GVAR(isUsingOptic) || {currentWeapon ACE_player != primaryWeapon ACE_player}) exitWith { _control ctrlShow false; }; -private ["_size", "_sizeX", "_sizeY"]; - -_size = call EFUNC(common,getZoom); - -_sizeX = _size/4; -_sizeY = _sizeX*safezoneW/safezoneH; - -_control ctrlSetPosition [ - safezoneX+0.5*safezoneW-0.5*_sizeX, - safezoneY+0.5*safezoneH-0.5*_sizeY, - _sizeX, - _sizeY -]; -_control ctrlCommit 0; +_control ctrlSetText (GVAR(usedOptics) select 0 select 1); _control ctrlShow true; + +[_control, call EFUNC(common,getZoom)] call (GVAR(usedOptics) select 0 select 2); diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 87223fc75a..3b83022dcb 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -70,6 +70,7 @@ class RscTitles { }; }; +/* class RscInGameUI { class RscUnitInfo; class RscWeaponZeroing : RscUnitInfo { @@ -77,3 +78,4 @@ class RscInGameUI { //onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['ACE_dlgWeaponZeroing', _this select 0];"; }; }; +*/ diff --git a/addons/vector/config.cpp b/addons/vector/config.cpp index 926bfda58d..e2a52b47ef 100644 --- a/addons/vector/config.cpp +++ b/addons/vector/config.cpp @@ -13,6 +13,8 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" + #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + #include "RscInGameUI.hpp"