Skip to content

Commit f8e1a72

Browse files
committed
Add Line Width Settings
1 parent 191c26d commit f8e1a72

11 files changed

+139
-9
lines changed

addons/Streamator/Spectator/DrawCalls/fn_draw3dBullets.sqf

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
if ((_projectile distance (positionCameraToWorld [0, 0, 0])) < viewDistance) then {
2020
private _segmentCount = count _segments - 1;
2121
{
22+
_x params ["_start", "_end"];
2223
_color set [3, linearConversion [_segmentCount, 0, _forEachIndex, 1, 0]];
23-
drawLine3D [_x select 0, _x select 1, _color];
24+
drawLine3D [_start, _end, _color, GVAR(3DBulletTracerLineWidth)];
2425
} forEach _segments;
2526
};
2627
}, {

addons/Streamator/Spectator/DrawCalls/fn_draw3dLaserTargets.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (floor(time) % 1 == 0) then {
2222
private _pos = ASLToAGL getPosASL _x;
2323
private _index = allPlayers findIf {(laserTarget _x) isEqualTo _x};
2424
if (_index != -1) then {
25-
drawLine3D [ASLToAGL (eyePos (allPlayers select _index)), _pos, [1, 0, 0, 1]];
25+
drawLine3D [ASLToAGL (eyePos (allPlayers select _index)), _pos, [1, 0, 0, 1], GVAR(3DLaserTargetLineWidth)];
2626
};
2727
drawIcon3D ["a3\ui_f_curator\Data\CfgCurator\laser_ca.paa", [1, 0, 0, 1], _pos, 0.75, 0.75, 0, "", 1, 0.05, TEXT_FONT];
2828
drawIcon3D ["", [1, 1, 1, 1], _pos, 0.75, 0.75, 0, _text, 1, 0.05, TEXT_FONT];

addons/Streamator/Spectator/DrawCalls/fn_draw3dMeasureDistance.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _pos1,
3030
drawIcon3D ["A3\ui_f\data\GUI\Cfg\Cursors\hc_move_gs.paa", [1, 1, 1, 1], _pos2, 1, 1, 0, "", 0];
3131
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _pos2, 1, 1, 0, format ["Distance %1m | %3 %2m", _distance toFixed 1, _heightDiff, _heightDiffChar], 2, PY(2.5), TEXT_FONT, "center"];
3232

33-
drawLine3D [_pos1, _pos2, [0, 1, 0, 1]];
33+
drawLine3D [_pos1, _pos2, [0, 1, 0, 1], 30];

addons/Streamator/Spectator/DrawCalls/fn_drawBullets.sqf

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ params ["_map"];
2020
_data params ["_color", "", "_projectile", ["_segments", []]];
2121
private _segmentCount = count _segments - 1;
2222
{
23+
_x params ["_start", "_end"];
2324
_color set [3, linearConversion [_segmentCount, 0, _forEachIndex, 1, 0]];
24-
_map drawLine [_x select 0, _x select 1, _color];
25+
_map drawLine [_start, _end, _color, GVAR(MapBulletTracerLineWidth)];
2526
} forEach _segments;
2627
}, {
2728
_this params ["_projectile", "_map"];

addons/Streamator/Spectator/DrawCalls/fn_drawLaserTargets.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (floor(time) % 1 == 0) then {
2424
private _pos = getPos _x;
2525
private _index = allPlayers findIf {(laserTarget _x) isEqualTo _x};
2626
if (_index != -1) then {
27-
_map drawLine [_pos, getPos (allPlayers select _index), [1, 0, 0, 1]]
27+
_map drawLine [_pos, getPos (allPlayers select _index), [1, 0, 0, 1], GVAR(MapLaserTargetLineWidth)]
2828
};
2929
_map drawIcon ["a3\ui_f_curator\Data\CfgCurator\laser_ca.paa", [1, 0, 0, 1], _pos, 18.75, 18.75, 0, "", 2];
3030
_map drawIcon ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _pos, 18.75, 18.75, 0, _text, 2, _textSize, TEXT_FONT];

addons/Streamator/Spectator/DrawCalls/fn_drawMarkers.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private _fnc_DrawPolyLine = {
2828
private _point = [_verts select _i, _verts select _i + 1];
2929

3030
_map drawRectangle [(_prevPoint vectorAdd _point) vectorMultiply 0.5, 15*_mapScale, (_prevPoint distance2D _point) * 0.5, _point getDir _prevPoint, _color, "#(rgb,8,8,3)color(1,1,1,1)"]
31-
// _map drawLine [_prevPoint, _point, _color];
31+
// _map drawLine [_prevPoint, _point, _color, 10];
3232
};
3333
};
3434

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#include "macros.hpp"
2+
/*
3+
Streamator
4+
5+
Author: joko // Jonas
6+
7+
Description:
8+
Register Line Width SubMenus
9+
10+
Parameter(s):
11+
12+
Returns:
13+
14+
*/
15+
16+
private _fnc_doLineWidth = {
17+
params ["_type"];
18+
private _value = 3;
19+
if (GVAR(CameraSpeedMode)) then {
20+
_value = 6;
21+
};
22+
if (GVAR(CameraSmoothingMode)) then {
23+
_value = 1;
24+
};
25+
if (GVAR(CameraZoomMode)) then {
26+
_value = -_value;
27+
};
28+
switch (_type) do {
29+
case ("3D Tracer"): {
30+
GVAR(3DBulletTracerLineWidth) = ((GVAR(3DBulletTracerLineWidth) + _value) max 1) min 30;
31+
};
32+
case ("Map Tracer"): {
33+
GVAR(MapBulletTracerLineWidth) = ((GVAR(MapBulletTracerLineWidth) + _value) max 1) min 30;
34+
};
35+
case ("3D Laser Target"): {
36+
GVAR(3DLaserTargetLineWidth) = ((GVAR(3DLaserTargetLineWidth) + _value) max 1) min 30;
37+
};
38+
case ("Map Laser Target"): {
39+
GVAR(MapLaserTargetLineWidth) = ((GVAR(MapLaserTargetLineWidth) + _value) max 1) min 30;
40+
};
41+
};
42+
true
43+
};
44+
45+
private _fnc_renderLineWidth = {
46+
params ["_type"];
47+
private _value = 3;
48+
private _ret = true;
49+
if (GVAR(CameraSpeedMode)) then {
50+
_value = 6;
51+
};
52+
if (GVAR(CameraSmoothingMode)) then {
53+
_value = 1;
54+
};
55+
56+
private _mType = "Add";
57+
if (GVAR(CameraZoomMode)) then {
58+
_mType = "Substract";
59+
};
60+
61+
private _current = switch (_type) do {
62+
case ("3D Tracer"): {
63+
if (GVAR(3DBulletTracerLineWidth) == 30 && _mType == "Add") then {
64+
_ret = false;
65+
};
66+
67+
if (GVAR(3DBulletTracerLineWidth) < 1 && _mType == "Substract") then {
68+
_ret = false;
69+
};
70+
71+
GVAR(3DBulletTracerLineWidth)
72+
};
73+
case ("Map Tracer"): {
74+
if (GVAR(MapBulletTracerLineWidth) == 30 && _mType == "Add") then {
75+
_ret = false;
76+
};
77+
78+
if (GVAR(MapBulletTracerLineWidth) < 1 && _mType == "Substract") then {
79+
_ret = false;
80+
};
81+
82+
GVAR(MapBulletTracerLineWidth)
83+
};
84+
case ("3D Laser Target"): {
85+
if (GVAR(3DLaserTargetLineWidth) == 30 && _mType == "Add") then {
86+
_ret = false;
87+
};
88+
89+
if (GVAR(3DLaserTargetLineWidth) < 1 && _mType == "Substract") then {
90+
_ret = false;
91+
};
92+
93+
GVAR(3DLaserTargetLineWidth)
94+
};
95+
case ("Map Laser Target"): {
96+
if (GVAR(MapLaserTargetLineWidth) == 30 && _mType == "Add") then {
97+
_ret = false;
98+
};
99+
100+
if (GVAR(MapLaserTargetLineWidth) < 1 && _mType == "Substract") then {
101+
_ret = false;
102+
};
103+
104+
GVAR(MapLaserTargetLineWidth)
105+
};
106+
};
107+
_name = format [_name, _mType, _value, _type, _current];
108+
_ret
109+
};
110+
111+
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F1, _fnc_doLineWidth, _fnc_renderLineWidth, false, "3D Tracer"] call FUNC(addMenuItem);
112+
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F2, _fnc_doLineWidth, _fnc_renderLineWidth, false, "Map Tracer"] call FUNC(addMenuItem);
113+
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F3, _fnc_doLineWidth, _fnc_renderLineWidth, false, "3D Laser Target"] call FUNC(addMenuItem);
114+
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F4, _fnc_doLineWidth, _fnc_renderLineWidth, false, "Map Laser Target"] call FUNC(addMenuItem);

addons/Streamator/Spectator/Menu/SubMenus/fn_miscSubMenus.sqf

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ private _fnc_renderViewDistance = {
117117
viewDistance;
118118
};
119119
};
120-
_name = format ["%1 %2 %3 (%4)", _mType, _value, _type, _current];
120+
_name = format [_name, _mType, _value, _type, _current];
121121
_ret
122122
};
123123

124-
["Add 100 ViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F1, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ViewDistance"] call FUNC(addMenuItem);
125-
["Add 100 ObjectViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F2, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ObjectViewDistance"] call FUNC(addMenuItem);
124+
["%1 %2 %3 (%4)", "MAIN/MISC/VIEWDISTANCE", DIK_F1, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ViewDistance"] call FUNC(addMenuItem);
125+
["%1 %2 %3 (%4)", "MAIN/MISC/VIEWDISTANCE", DIK_F2, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ObjectViewDistance"] call FUNC(addMenuItem);
126126
["Sync ObjectViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F3, { GVAR(SyncObjectViewDistance) = !GVAR(SyncObjectViewDistance); if (GVAR(SyncObjectViewDistance)) then {setObjectViewDistance viewDistance;}; }, { if (GVAR(SyncObjectViewDistance)) then { _color = "#3CB371"; }; true }] call FUNC(addMenuItem);
127127
["Reset ViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F4, { setObjectViewDistance -1; setViewDistance -1; true }] call FUNC(addMenuItem);
128128

addons/Streamator/Spectator/Menu/fn_registerMenus.sqf

+5
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ call FUNC(crewSubMenus);
5353
["Misc", "MAIN", DIK_F7, "MAIN/MISC", {true}, true] call FUNC(addMenuItem);
5454
CREATE_BACK_ACTION_MAIN("MAIN/MISC");
5555
call FUNC(miscSubMenus);
56+
57+
// Lines
58+
["Lines", "MAIN", DIK_F8, "MAIN/LINES", {true}, true] call FUNC(addMenuItem);
59+
CREATE_BACK_ACTION_MAIN("MAIN/LINES");
60+
call FUNC(lineSubMenus);

addons/Streamator/Spectator/fn_openSpectator.sqf

+7
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ GVAR(TopDownOffset) = [0, 0, 100];
151151
GVAR(SyncObjectViewDistance) = true;
152152
GVAR(PlaningModeUpdateTime) = 0.05;
153153

154+
GVAR(3DBulletTracerLineWidth) = 3;
155+
GVAR(MapBulletTracerLineWidth) = 3;
156+
157+
GVAR(3DLaserTargetLineWidth) = 3;
158+
GVAR(MapLaserTargetLineWidth) = 3;
159+
154160
if (isNumber (missionConfigFile >> QUOTE(DOUBLE(PREFIX,PlaningModeUpdateTime)))) then {
155161
GVAR(PlaningModeUpdateTime) = getNumber (missionConfigFile >> QUOTE(DOUBLE(PREFIX,PlaningModeUpdateTime)));
156162
};
@@ -357,4 +363,5 @@ call FUNC(updateSpectatorArray);
357363
[{
358364
call FUNC(updateValidUnits);
359365
}, 1] call CFUNC(addPerframeHandler);
366+
360367
call FUNC(updateValidUnits);

addons/Streamator/modules.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ class CfgCLibModules {
6363
MODULE(SubMenus) {
6464
FNC(cameraSubMenus);
6565
FNC(crewSubMenus);
66+
FNC(lineSubMenus);
6667
FNC(mapSubMenus);
6768
FNC(miscSubMenus);
6869
FNC(overlaySubMenus);
6970
FNC(radioSubMenus);
7071
FNC(visionSubMenus);
72+
7173
};
7274
FNC(addMenuItem);
7375
FNC(executeEntry);

0 commit comments

Comments
 (0)