diff --git a/addons/ui/$PBOPREFIX$ b/addons/ui/$PBOPREFIX$ index 601bbd5f60..9b6ac48f4f 100644 --- a/addons/ui/$PBOPREFIX$ +++ b/addons/ui/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\Addons\ui \ No newline at end of file +z\ace\addons\ui \ No newline at end of file diff --git a/addons/ui/ACE_Settings.hpp b/addons/ui/ACE_Settings.hpp new file mode 100644 index 0000000000..09bdb47634 --- /dev/null +++ b/addons/ui/ACE_Settings.hpp @@ -0,0 +1,37 @@ +class ACE_Settings { + class GVAR(weaponInfo) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(WeaponInfo); + }; + class GVAR(weaponName) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(WeaponName); + }; + /*class GVAR(ammoCount) { // Disabled in config by ace_reload + value = 1; + typeName = "BOOL"; + displayName = CSTRING(AmmoCount); + };*/ + class GVAR(magCount) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(MagCount); + }; + class GVAR(grenadeName) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(GrenadeName); + }; + class GVAR(grenadeCount) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(GrenadeCount); + }; + class GVAR(zeroing) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(Zeroing); + }; +}; diff --git a/addons/ui/CfgEventHandlers.hpp b/addons/ui/CfgEventHandlers.hpp new file mode 100644 index 0000000000..423993f757 --- /dev/null +++ b/addons/ui/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); + }; +}; diff --git a/addons/ui/CfgVehicles.hpp b/addons/ui/CfgVehicles.hpp new file mode 100644 index 0000000000..f918360518 --- /dev/null +++ b/addons/ui/CfgVehicles.hpp @@ -0,0 +1,58 @@ +class CfgVehicles { + class ACE_Module; + class ACE_ModuleUI: ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE"; + displayName = CSTRING(ModuleDisplayName); + function = QFUNC(moduleInit); + scope = 2; + isGlobal = 1; + //icon = QUOTE(PATHTOF(UI\Icon_Module_UI_ca.paa)); + class Arguments { + class weaponInfo { + displayName = CSTRING(WeaponInfo); + description = CSTRING(WeaponInfoDesc); + typeName = "BOOL"; + defaultValue = 1; + }; + class weaponName { + displayName = CSTRING(WeaponName); + description = CSTRING(WeaponNameDesc); + typeName = "BOOL"; + defaultValue = 1; + }; + /*class ammoCount { // Disabled in config by ace_reload + displayName = CSTRING(AmmoCount); + description = CSTRING(AmmoCountDesc); + typeName = "BOOL"; + defaultValue = 1; + };*/ + class magCount { + displayName = CSTRING(MagCount); + description = CSTRING(MagCountDesc); + typeName = "BOOL"; + defaultValue = 1; + }; + class grenadeName { + displayName = CSTRING(GrenadeName); + description = CSTRING(GrenadeNameDesc); + typeName = "BOOL"; + defaultValue = 1; + }; + class grenadeCount { + displayName = CSTRING(GrenadeCount); + description = CSTRING(GrenadeCountDesc); + typeName = "BOOL"; + defaultValue = 1; + }; + class zeroing { + displayName = CSTRING(Zeroing); + typeName = "BOOL"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = CSTRING(ModuleDescription); + }; + }; +}; diff --git a/addons/ui/README.md b/addons/ui/README.md index f11027038f..b3c2b3acb7 100644 --- a/addons/ui/README.md +++ b/addons/ui/README.md @@ -1,9 +1,10 @@ ace_ui ======= -Changes the chat contrast on the map to allow easier reading +Changes the chat contrast on the map to allow easier reading, removes vignette and provides settings to toggle different UI elements unavailable in Vanilla. ## Maintainers The people responsible for merging changes to this component or answering potential questions. +- [Jonpas] (https://github.com/jonpas) diff --git a/addons/ui/RscChat.hpp b/addons/ui/RscChat.hpp new file mode 100644 index 0000000000..6b091d73bc --- /dev/null +++ b/addons/ui/RscChat.hpp @@ -0,0 +1,15 @@ +class RscText; +class RscDisplayChat { + class controls { + delete Line; + delete Background; + class CA_Background: RscText { + colorBackground[] = {0.5,0.5,0.5,0.33}; // Make the chat entry field slightly darker + }; + }; +}; + +class RscChatListDefault { + colorBackground[] = {0,0,0,0.5}; // Make the chat background darker + colorMessageProtocol[] = {0.85,0.85,0.85,1}; // And the chat text brighter +}; diff --git a/addons/ui/RscVignette.hpp b/addons/ui/RscVignette.hpp new file mode 100644 index 0000000000..118fad96e6 --- /dev/null +++ b/addons/ui/RscVignette.hpp @@ -0,0 +1,4 @@ +class RscPicture; +class RscVignette: RscPicture { + colorText[] = {0, 0, 0, 0}; // Hide Vignette +}; diff --git a/addons/ui/XEH_clientInit.sqf b/addons/ui/XEH_clientInit.sqf new file mode 100644 index 0000000000..fec845d49a --- /dev/null +++ b/addons/ui/XEH_clientInit.sqf @@ -0,0 +1,63 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +// Exit on Headless +if !(hasInterface) exitWith {}; + +["SettingsInitialized", { + // On load and entering/exiting a vehicle + ["infoDisplayChanged", { + LOG("UI infoDisplayChanged"); + + private ["_elements", "_display"]; + + // All elements with their show/hide, IDD and IDC + _elements = [ + [GVAR(weaponInfo), 300, 2302], + [GVAR(weaponName), 300, 118], + //[GVAR(ammoCount), 300, 184], // Disabled in config by ace_reload + [GVAR(magCount), 300, 185], + [GVAR(grenadeName), 300, 152], + [GVAR(grenadeCount), 300, 151], + [GVAR(zeroing), 300, 168] + ]; + + disableSerialization; + { + _display = _x; + { + EXPLODE_3_PVT(_x,_show,_idd,_idc); + + //_idd = 300; //debug + //_idc = 122; //debug + if (_idd == ctrlIDD _display) then { + _show = if (_show) then {0} else {1}; + + (_display displayCtrl _idc) ctrlSetFade _show; + (_display displayCtrl _idc) ctrlCommit 0; + }; + } forEach _elements; + } forEach (uiNamespace getVariable "IGUI_displays"); // Those displays can be present several times for some reason + }] call EFUNC(common,addEventHandler); +}] call EFUNC(common,addEventHandler); + + +/* +RscUnitInfo = 300 +-------- +Alt = 122 (UNKNOWN) +Ammo = 119 (UNKNOWN) +AmmoCount = 184 (Ammo Count) +MagCount = 185 (Magazine Count) +CA_TextFlares = 151 (Grenade Count) +CA_TextFlaresMode = 152 (Grenade Name) +CA_Zeroing = 168 (Zeroing) +Weapon = 118 (Weapon Name) +WeaponInfoControlsGroupLeft = 2302 (entire Weapon Info without Zeroing and Stance) +WeaponInfoControlsGroupRight = 2303 (UNKNOWN) + + +RscStanceInfo = 303 +------- +StanceIndicator = 188 (UNKNOWN) +*/ diff --git a/addons/ui/XEH_preInit.sqf b/addons/ui/XEH_preInit.sqf new file mode 100644 index 0000000000..7e1c3ec9ed --- /dev/null +++ b/addons/ui/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(moduleInit); + +ADDON = true; diff --git a/addons/ui/config.cpp b/addons/ui/config.cpp index e7ea4b32eb..fa10420277 100644 --- a/addons/ui/config.cpp +++ b/addons/ui/config.cpp @@ -6,25 +6,15 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"VKing"}; - authorUrl = "https://github.com/ACEMod/"; + author[] = {"VKing", "Jonpas"}; + authorUrl = "https://github.com/acemod/ACE3"; VERSION_CONFIG; }; }; -class RscText; +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "ACE_Settings.hpp" -class RscDisplayChat { - class controls { - delete Line; - delete Background; - class CA_Background: RscText { - colorBackground[] = {0.5,0.5,0.5,0.33}; // Make the chat entry field slightly darker - }; - }; -}; - -class RscChatListDefault { - colorBackground[] = {0,0,0,0.5}; // Make the chat background darker - colorMessageProtocol[] = {0.85,0.85,0.85,1}; // And the chat text brighter -}; +#include "RscChat.hpp" +#include "RscVignette.hpp" diff --git a/addons/ui/functions/fnc_moduleInit.sqf b/addons/ui/functions/fnc_moduleInit.sqf new file mode 100644 index 0000000000..02d9c2ecbf --- /dev/null +++ b/addons/ui/functions/fnc_moduleInit.sqf @@ -0,0 +1,29 @@ +/* + * Author: Jonpas + * Initializes the UI module. + * + * Arguments: + * 0: Module Logic + * 1: Units + * 2: Activated + * + * Return Value: + * None + */ +#include "script_component.hpp" + +if !(isServer) exitWith {}; + +PARAMS_3(_logic,_units,_activated); + +if !(_activated) exitWith {}; + +[_logic, QGVAR(weaponInfo), "weaponInfo"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(weaponName), "weaponName"] call EFUNC(common,readSettingFromModule); +//[_logic, QGVAR(ammoCount), "ammoCount"] call EFUNC(common,readSettingFromModule); // Disabled in config by ace_reload +[_logic, QGVAR(magCount), "magCount"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(grenadeName), "grenadeName"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(grenadeCount), "grenadeCount"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(zeroing), "zeroing"] call EFUNC(common,readSettingFromModule); + +diag_log text "[ACE]: UI Module Initialized."; diff --git a/addons/ui/stringtable.xml b/addons/ui/stringtable.xml new file mode 100644 index 0000000000..b33c28292d --- /dev/null +++ b/addons/ui/stringtable.xml @@ -0,0 +1,50 @@ + + + + + Weapon Info + + + Entire weapon info interface (weapon name, firing mode, magazine info, ammo count, magazine count, grenade count) except zeroing. + + + Weapon Name + + + Requires enabled Weapon Info + + + Ammo Count + + + Requires enabled Weapon Info + + + Magazine Count + + + Requires enabled Weapon Info + + + Grenade Name + + + Requires enabled Weapon Info + + + Grenade Count + + + Requires enabled Weapon Info + + + Zeroing + + + User Interface + + + This module allows hiding of specific user interface parts. + + + \ No newline at end of file