Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Line Compass as an Alternative to the Compass Radar #237

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .hemtt/missions/dui.vr/initPlayerLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ diwako_dui_special_track = [shall,shall2,shall3,farted];

diwako_dui_special_track pushBack hank;
hank setVariable ["diwako_dui_radar_customIcon", "yes.paa"];
hank setVariable ["diwako_dui_linecompass_customIcon", ["yes.paa", 2]];
hank setVariable ["diwako_dui_nametags_customGroup", "Custom group name"];

[] spawn {
Expand Down
6 changes: 6 additions & 0 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ folder = "diwako_dui"

[lints.stringtables.sorted]
options.only-lang = true

[lints.sqf.var_all_caps]
enabled = true
options.ignore = [
"ACRE_IS_SPECTATOR"
]
1 change: 1 addition & 0 deletions addons/linecompass/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\diwako_dui\addons\linecompass
16 changes: 16 additions & 0 deletions addons/linecompass/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//diwako_dui_linecompass eventhandlers
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));
};
};
224 changes: 224 additions & 0 deletions addons/linecompass/CfgRscTitles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
#define LINE(var) \
class Line##var : Line1 {\
idc = LINE_IDC_START + var - 1;\
x = QUOTE(PX(0.15 + 2.5 * (var - 1)));\
}

#define BEARING(var,textVar,textSize) \
class Bearing##var : Bearing1 {\
idc = BEARING_IDC_START + var - 1 ;\
sizeEx = QUOTE(PY(textSize));\
x = QUOTE(PX(-0.25 + 7.5 * (var - 1)));\
text = textVar;\
}

class RscControlsGroupNoScrollbars;
class RscPicture;
class RscText;
class RscTitles {
class GVAR(Compass) {
idd = -1;
duration = 1e10;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(Compass),_this select 0)];);
class Controls {
class CtrlGroup : RscControlsGroupNoScrollbars {
idc = CONTAINER_IDC;
x = QUOTE(GET_POS_X);
y = QUOTE(GET_POS_Y);
w = QUOTE(GET_POS_W);
h = QUOTE(GET_POS_H);

class Controls {
class Needle : RscPicture {
idc = NEEDLE_IDC;
text = "\a3\ui_f\data\map\markers\military\triangle_ca.paa";
angle = 180;
x = QUOTE(PX(46.25 - 1));
y = QUOTE(PY(1.6));
w = QUOTE(PX(2));
h = QUOTE(PY(1));
colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0};
};
class CtrlGroup : RscControlsGroupNoScrollbars {
idc = HOLDER_IDC;
x = 0;
y = 0;
w = QUOTE(PX(272.5)); // 360° + 185°
h = QUOTE(PY(5));

class Controls {
class Line1 : RscPicture {
idc = LINE_IDC_START;
text = "#(argb,8,8,3)color(1,1,1,1)";
x = QUOTE(PX(0.15));
y = QUOTE(PY(0.6));
w = QUOTE(PX(2.2));
h = QUOTE(PY(0.3));
colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0};
};
LINE(2);
LINE(3);
LINE(4);
LINE(5);
LINE(6);
LINE(7);
LINE(8);
LINE(9);
LINE(10);
LINE(11);
LINE(12);
LINE(13);
LINE(14);
LINE(15);
LINE(16);
LINE(17);
LINE(18);
LINE(19);
LINE(20);
LINE(21);
LINE(22);
LINE(23);
LINE(24);
LINE(25);
LINE(26);
LINE(27);
LINE(28);
LINE(29);
LINE(30);
LINE(31);
LINE(32);
LINE(33);
LINE(34);
LINE(35);
LINE(36);
LINE(37);
LINE(38);
LINE(39);
LINE(40);
LINE(41);
LINE(42);
LINE(43);
LINE(44);
LINE(45);
LINE(46);
LINE(47);
LINE(48);
LINE(49);
LINE(50);
LINE(51);
LINE(52);
LINE(53);
LINE(54);
LINE(55);
LINE(56);
LINE(57);
LINE(58);
LINE(59);
LINE(60);
LINE(61);
LINE(62);
LINE(63);
LINE(64);
LINE(65);
LINE(66);
LINE(67);
LINE(68);
LINE(69);
LINE(70);
LINE(71);
LINE(72);
LINE(73);
LINE(74);
LINE(75);
LINE(76);
LINE(77);
LINE(78);
LINE(79);
LINE(80);
LINE(81);
LINE(82);
LINE(83);
LINE(84);
LINE(85);
LINE(86);
LINE(87);
LINE(88);
LINE(89);
LINE(90);
LINE(91);
LINE(92);
LINE(93);
LINE(94);
LINE(95);
LINE(96);
LINE(97);
LINE(98);
LINE(99);
LINE(100);
LINE(101);
LINE(102);
LINE(103);
LINE(104);
LINE(105);
LINE(106);
LINE(107);
LINE(108);
LINE(109);
class Bearing1 : RscText {
idc = BEARING_IDC_START;
text = "W";
font = "PuristaMedium";
sizeEx = QUOTE(PY(2.4));
style = 0x02;
colorBackground[] = {0,0,0,0};
colorText[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0};
shadow = 0;
x = QUOTE(PX(-0.25));
y = QUOTE(PY(2));
w = QUOTE(PX(3));
h = QUOTE(PY(1.5));
};
BEARING(2,"285",1.8);
BEARING(3,"300",1.8);
BEARING(4,"NW",2.4);
BEARING(5,"330",1.8);
BEARING(6,"345",1.8);
BEARING(7,"N",2.4);
BEARING(8,"015",1.8);
BEARING(9,"030",1.8);
BEARING(10,"NE",2.4);
BEARING(11,"060",1.8);
BEARING(12,"075",1.8);
BEARING(13,"E",2.4);
BEARING(14,"105",1.8);
BEARING(15,"120",1.8);
BEARING(16,"SE",2.4);
BEARING(17,"150",1.8);
BEARING(18,"165",1.8);
BEARING(19,"S",2.4);
BEARING(20,"195",1.8);
BEARING(21,"210",1.8);
BEARING(22,"SW",2.4);
BEARING(23,"240",1.8);
BEARING(24,"255",1.8);
BEARING(25,"W",2.4);
BEARING(26,"285",1.8);
BEARING(27,"300",1.8);
BEARING(28,"NW",2.4);
BEARING(29,"330",1.8);
BEARING(30,"345",1.8);
BEARING(31,"N",2.4);
BEARING(32,"015",1.8);
BEARING(33,"030",1.8);
BEARING(34,"NE",2.4);
BEARING(35,"060",1.8);
BEARING(36,"075",1.8);
BEARING(37,"E",2.4);
};
};
};
};
};
};

};
30 changes: 30 additions & 0 deletions addons/linecompass/CfgUIGrids.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class CfgUIGrids {
class IGUI {
class Presets {
class Arma3 {
class Variables {
ADDON[] = {
{
QUOTE(POS_X),
QUOTE(POS_Y),
QUOTE(POS_W),
QUOTE(POS_H)
},
"(((safezoneW / safezoneH) min 1.2) / 40)",
"((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"
};
};
};
};

class Variables {
class ADDON {
displayName = "$STR_dui_addon_linecompass";
description = "$STR_dui_linecompass_UIGrids_desc";
preview = QPATHTO_T(UI\line_compass_ui_editor.paa);
saveToProfile[] = {0,1,2,3};
canResize = 0;
};
};
};
};
Binary file added addons/linecompass/UI/buddy_dot.paa
Binary file not shown.
Binary file added addons/linecompass/UI/line_compass_ui_editor.paa
Binary file not shown.
8 changes: 8 additions & 0 deletions addons/linecompass/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PREP(addLineMarker);
PREP(cacheLoop);
PREP(getAlphaFromX);
PREP(getUnitIcon);
PREP(hideCompass);
PREP(onDraw);
PREP(removeLineMarker);
PREP(showCompass);
5 changes: 5 additions & 0 deletions addons/linecompass/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "script_component.hpp"

if (is3DEN || (!hasInterface || {side player == sideLogic}) && {player isKindOf "VirtualSpectator_F"}) exitWith {};

FUNC(cacheLoop) call CBA_fnc_directCall;
43 changes: 43 additions & 0 deletions addons/linecompass/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "script_component.hpp"
ADDON = false;
#include "XEH_PREP.hpp"

if (hasInterface) then {

GVAR(drawEh) = -1;

GVAR(lineMarkers) = createHashMap;

// Use pools to store the controls for the markers
GVAR(lineMarkerControlPool) = [];
GVAR(iconMarkerControlPool) = [];

// Caches for alpha values
GVAR(lineAlphaCache) = [];
GVAR(lineAlphaCache) resize 109;
GVAR(bearingAlphaCache) = [];
GVAR(bearingAlphaCache) resize 37;

GVAR(customWaypointPosition) = customWaypointPosition;

GVAR(UnitsToRender) = [];

if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then {

["ace_finger_fingered", {

params ["_player", "_pos"];

private _key = format ["ACE_Fingering_%1", hashValue _player];
[_key, _pos, GVAR(ACEFingeringColor)] call FUNC(addLineMarker);

[{
_this call FUNC(removeLineMarker);
}, _key, 2.5] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addEventhandler;
};
};

#include "settings.inc.sqf"

ADDON = true;
3 changes: 3 additions & 0 deletions addons/linecompass/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//diwako_dui_indicators prestart
#include "script_component.hpp"
#include "XEH_PREP.hpp"
17 changes: 17 additions & 0 deletions addons/linecompass/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"diwako_dui_main", "diwako_dui_radar"};
author = "joko // Jonas";
VERSION_CONFIG;
license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike";
};
};

#include "CfgUIGrids.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgRscTitles.hpp"
4 changes: 4 additions & 0 deletions addons/linecompass/functions/fnc_addLineMarker.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "..\script_component.hpp"

params [["_id", "", [""]], ["_position", [0,0,0], [[]], 3], ["_color", GVAR(WaypointColor), [[]], [3, 4]]];
GVAR(lineMarkers) set [_id, [_color, _position]];
Loading