forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
missile_hud - Move HUD feature from
laser
to new component (acemod#…
…10306) * init commit * show hud * Dynamically add information to the HUD * Remove HUD from Laser * get feature parity with laser * turn off debug * fix header * fix nameLocked config * Update addons/missile_hud/XEH_postInit.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
- Loading branch information
1 parent
c884126
commit 61e6d10
Showing
22 changed files
with
628 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z\ace\addons\missile_hud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class EGVAR(missileguidance,SeekerTypes) { | ||
class SALH { | ||
hudInfo = QFUNC(info_salh); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Extended_PreStart_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); | ||
}; | ||
}; | ||
|
||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); | ||
}; | ||
}; | ||
|
||
class Extended_PostInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ace_missile_hud | ||
=================== | ||
|
||
Displays information about missile to player through their in-game HUD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class RscTitles { | ||
class GVAR(infoDisplay) { | ||
idd = -1; | ||
onLoad = QUOTE(with uiNameSpace do { GVAR(display) = _this select 0 };); | ||
movingEnable = 0; | ||
duration = 60; | ||
fadeIn = "false"; | ||
fadeOut = "false"; | ||
class controls {}; | ||
class controlPrefabs { | ||
class line: RscControlsGroupNoScrollbars { | ||
idc = -1; | ||
x = "3.8 * (((safeZoneW / safeZoneH) min 1.2) / 40) + (profilenamespace getvariable ['IGUI_GRID_WEAPON_X',((safeZoneX + safeZoneW) - (10 * (((safeZoneW / safeZoneH) min 1.2) / 40)) - 4.3 * (((safeZoneW / safeZoneH) min 1.2) / 40))])"; | ||
y = "2.5 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25) + (profilenamespace getVariable ['IGUI_GRID_WEAPON_Y', (safeZoneY + 0.5 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25))])"; | ||
w = "10 * (((safeZoneW / safeZoneH) min 1.2) / 40)"; | ||
h = "1 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
}; | ||
class text: RscText { | ||
idc = -1; | ||
colorText[] = {1, 1, 1, 1}; | ||
colorBackground[] = {0, 0, 0, 0}; | ||
x = "0"; | ||
y = "0"; | ||
w = "1 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
h = "1 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
sizeEx = "0.8 * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
}; | ||
class icon: RscPictureKeepAspect { | ||
idc = -1; | ||
colorText[] = {1, 1, 1, 1}; | ||
colorBackground[] = {0, 0, 0, 0}; | ||
text = "\a3\Ui_F_Curator\Data\CfgCurator\laser_ca.paa"; | ||
x = "0"; | ||
y = "0"; | ||
w = "(1) * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
h = "(1) * ((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)"; | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PREP(createCtrlFromElement); | ||
PREP(getCurrentWeapon); | ||
PREP(info_salh); | ||
PREP(isElementValid); | ||
PREP(registerDefaultHud); | ||
PREP(registerElement); | ||
PREP(shouldAdjustHud); | ||
PREP(showVehicleHud); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "script_component.hpp" | ||
|
||
if (hasInterface) then { | ||
GVAR(pfID) = -1; | ||
GVAR(generators) = []; | ||
|
||
GVAR(config) = configFile >> "RscTitles" >> QGVAR(infoDisplay) >> "controlPrefabs"; | ||
GVAR(config_line) = GVAR(config) >> "line"; | ||
GVAR(lineHeight) = getNumber (GVAR(config_line) >> "h"); | ||
GVAR(lineWidth) = getNumber (GVAR(config_line) >> "w"); | ||
GVAR(itemWidth) = getNumber (GVAR(config) >> "icon" >> "w") / 1.25; | ||
|
||
["CBA_settingsInitialized", { | ||
["turret", LINKFUNC(showVehicleHud), false] call CBA_fnc_addPlayerEventHandler; | ||
["vehicle", LINKFUNC(showVehicleHud), true] call CBA_fnc_addPlayerEventHandler; // only one of these needs the retro flag | ||
|
||
// Add UAV Control Compatibility | ||
["ACE_controlledUAV", { | ||
params ["_UAV", "_seatAI", "_turret", "_position"]; | ||
TRACE_4("ACE_controlledUAV EH",_UAV,_seatAI,_turret,_position); | ||
if (isNull _seatAI) then { | ||
[ace_player] call FUNC(showVehicleHud); | ||
} else { | ||
[_seatAI] call FUNC(showVehicleHud); | ||
}; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
[] call FUNC(registerDefaultHud); | ||
}] call CBA_fnc_addEventHandler; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
PREP_RECOMPILE_START; | ||
#include "XEH_PREP.hpp" | ||
PREP_RECOMPILE_END; | ||
|
||
ADDON = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"ace_common", "ace_missileguidance"}; | ||
author = ECSTRING(common,ACETeam); | ||
authors[] = {"tcvm"}; | ||
url = ECSTRING(main,URL); | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
#include "ACE_GuidanceConfig.hpp" | ||
|
||
class RscText; | ||
class RscControlsGroupNoScrollbars; | ||
class RscPictureKeepAspect; | ||
|
||
#include "RscTitles.hpp" |
49 changes: 49 additions & 0 deletions
49
addons/missile_hud/functions/fnc_createCtrlFromElement.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* Create a UI control to be added to the display. | ||
* | ||
* Arguments: | ||
* 0: Display <DISPLAY> | ||
* 1: Line <CONTROL> | ||
* 2: Element <ARRAY> | ||
* | ||
* Return Value: | ||
* Control <CONTROL> | ||
* | ||
* Example: | ||
* [findDisplay 46, ["TEXT", "Hello, world!", [1, 1, 0]]] call ace_missile_hud_fnc_createCtrlFromElement | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_display", "_line", "_element"]; | ||
TRACE_1("createCtrlFromElement",_this); | ||
|
||
private _ctrl = controlNull; | ||
switch (_element select 0) do { | ||
case "TEXT": { | ||
_element params ["", "_text", "_color"]; | ||
private _controlConfig = GVAR(config) >> "text"; | ||
_ctrl = _display ctrlCreate [_controlConfig, -1, _line]; | ||
_ctrl ctrlSetText _text; | ||
if (3 == count _color) then { _color pushBack 1; }; | ||
_ctrl ctrlSetTextColor _color; | ||
}; | ||
case "ICON": { | ||
_element params ["", "_path", "_color"]; | ||
private _controlConfig = GVAR(config) >> "icon"; | ||
_ctrl = _display ctrlCreate [_controlConfig, -1, _line]; | ||
_ctrl ctrlSetText _path; | ||
if (3 == count _color) then { _color pushBack 1; }; | ||
_ctrl ctrlSetTextColor _color; | ||
}; | ||
case "SPACER": { | ||
private _controlConfig = GVAR(config) >> "icon"; | ||
_ctrl = _display ctrlCreate [_controlConfig, -1, _line]; | ||
_ctrl ctrlSetText "\A3\ui_f\data\map\markers\system\empty_ca.paa"; | ||
_ctrl ctrlSetTextColor [0, 0, 0, 0]; | ||
}; | ||
}; | ||
|
||
_ctrl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* Get the current weapon of the unit. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Vehicle <OBJECT> | ||
* 2: Turret path <ARRAY> | ||
* | ||
* Return Value: | ||
* Current weapon <STRING> | ||
* | ||
* Example: | ||
* [player, vehicle player, [0]] call ace_missile_hud_fnc_getCurrentWeapon | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_unit", "_vehicle", "_turretPath"]; | ||
TRACE_2("registerElement",_condition,_generator); | ||
|
||
private _currentWeapon = if (_unit isEqualTo _vehicle) then { | ||
currentWeapon _unit | ||
} else { | ||
_vehicle currentWeaponTurret _turretPath | ||
}; | ||
|
||
_currentWeapon |
Oops, something went wrong.