Skip to content

Commit

Permalink
Add Line Width Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jokoho48 committed Oct 21, 2024
1 parent 191c26d commit f8e1a72
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 9 deletions.
3 changes: 2 additions & 1 deletion addons/Streamator/Spectator/DrawCalls/fn_draw3dBullets.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
if ((_projectile distance (positionCameraToWorld [0, 0, 0])) < viewDistance) then {
private _segmentCount = count _segments - 1;
{
_x params ["_start", "_end"];
_color set [3, linearConversion [_segmentCount, 0, _forEachIndex, 1, 0]];
drawLine3D [_x select 0, _x select 1, _color];
drawLine3D [_start, _end, _color, GVAR(3DBulletTracerLineWidth)];
} forEach _segments;
};
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (floor(time) % 1 == 0) then {
private _pos = ASLToAGL getPosASL _x;
private _index = allPlayers findIf {(laserTarget _x) isEqualTo _x};
if (_index != -1) then {
drawLine3D [ASLToAGL (eyePos (allPlayers select _index)), _pos, [1, 0, 0, 1]];
drawLine3D [ASLToAGL (eyePos (allPlayers select _index)), _pos, [1, 0, 0, 1], GVAR(3DLaserTargetLineWidth)];
};
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];
drawIcon3D ["", [1, 1, 1, 1], _pos, 0.75, 0.75, 0, _text, 1, 0.05, TEXT_FONT];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _pos1,
drawIcon3D ["A3\ui_f\data\GUI\Cfg\Cursors\hc_move_gs.paa", [1, 1, 1, 1], _pos2, 1, 1, 0, "", 0];
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"];

drawLine3D [_pos1, _pos2, [0, 1, 0, 1]];
drawLine3D [_pos1, _pos2, [0, 1, 0, 1], 30];
3 changes: 2 additions & 1 deletion addons/Streamator/Spectator/DrawCalls/fn_drawBullets.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ params ["_map"];
_data params ["_color", "", "_projectile", ["_segments", []]];
private _segmentCount = count _segments - 1;
{
_x params ["_start", "_end"];
_color set [3, linearConversion [_segmentCount, 0, _forEachIndex, 1, 0]];
_map drawLine [_x select 0, _x select 1, _color];
_map drawLine [_start, _end, _color, GVAR(MapBulletTracerLineWidth)];
} forEach _segments;
}, {
_this params ["_projectile", "_map"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (floor(time) % 1 == 0) then {
private _pos = getPos _x;
private _index = allPlayers findIf {(laserTarget _x) isEqualTo _x};
if (_index != -1) then {
_map drawLine [_pos, getPos (allPlayers select _index), [1, 0, 0, 1]]
_map drawLine [_pos, getPos (allPlayers select _index), [1, 0, 0, 1], GVAR(MapLaserTargetLineWidth)]
};
_map drawIcon ["a3\ui_f_curator\Data\CfgCurator\laser_ca.paa", [1, 0, 0, 1], _pos, 18.75, 18.75, 0, "", 2];
_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];
Expand Down
2 changes: 1 addition & 1 deletion addons/Streamator/Spectator/DrawCalls/fn_drawMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private _fnc_DrawPolyLine = {
private _point = [_verts select _i, _verts select _i + 1];

_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)"]
// _map drawLine [_prevPoint, _point, _color];
// _map drawLine [_prevPoint, _point, _color, 10];
};
};

Expand Down
114 changes: 114 additions & 0 deletions addons/Streamator/Spectator/Menu/SubMenus/fn_lineSubMenus.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include "macros.hpp"
/*
Streamator
Author: joko // Jonas
Description:
Register Line Width SubMenus
Parameter(s):
Returns:
*/

private _fnc_doLineWidth = {
params ["_type"];
private _value = 3;
if (GVAR(CameraSpeedMode)) then {
_value = 6;
};
if (GVAR(CameraSmoothingMode)) then {
_value = 1;
};
if (GVAR(CameraZoomMode)) then {
_value = -_value;
};
switch (_type) do {
case ("3D Tracer"): {
GVAR(3DBulletTracerLineWidth) = ((GVAR(3DBulletTracerLineWidth) + _value) max 1) min 30;
};
case ("Map Tracer"): {
GVAR(MapBulletTracerLineWidth) = ((GVAR(MapBulletTracerLineWidth) + _value) max 1) min 30;
};
case ("3D Laser Target"): {
GVAR(3DLaserTargetLineWidth) = ((GVAR(3DLaserTargetLineWidth) + _value) max 1) min 30;
};
case ("Map Laser Target"): {
GVAR(MapLaserTargetLineWidth) = ((GVAR(MapLaserTargetLineWidth) + _value) max 1) min 30;
};
};
true
};

private _fnc_renderLineWidth = {
params ["_type"];
private _value = 3;
private _ret = true;
if (GVAR(CameraSpeedMode)) then {
_value = 6;
};
if (GVAR(CameraSmoothingMode)) then {
_value = 1;
};

private _mType = "Add";
if (GVAR(CameraZoomMode)) then {
_mType = "Substract";
};

private _current = switch (_type) do {
case ("3D Tracer"): {
if (GVAR(3DBulletTracerLineWidth) == 30 && _mType == "Add") then {
_ret = false;
};

if (GVAR(3DBulletTracerLineWidth) < 1 && _mType == "Substract") then {
_ret = false;
};

GVAR(3DBulletTracerLineWidth)
};
case ("Map Tracer"): {
if (GVAR(MapBulletTracerLineWidth) == 30 && _mType == "Add") then {
_ret = false;
};

if (GVAR(MapBulletTracerLineWidth) < 1 && _mType == "Substract") then {
_ret = false;
};

GVAR(MapBulletTracerLineWidth)
};
case ("3D Laser Target"): {
if (GVAR(3DLaserTargetLineWidth) == 30 && _mType == "Add") then {
_ret = false;
};

if (GVAR(3DLaserTargetLineWidth) < 1 && _mType == "Substract") then {
_ret = false;
};

GVAR(3DLaserTargetLineWidth)
};
case ("Map Laser Target"): {
if (GVAR(MapLaserTargetLineWidth) == 30 && _mType == "Add") then {
_ret = false;
};

if (GVAR(MapLaserTargetLineWidth) < 1 && _mType == "Substract") then {
_ret = false;
};

GVAR(MapLaserTargetLineWidth)
};
};
_name = format [_name, _mType, _value, _type, _current];
_ret
};

["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F1, _fnc_doLineWidth, _fnc_renderLineWidth, false, "3D Tracer"] call FUNC(addMenuItem);
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F2, _fnc_doLineWidth, _fnc_renderLineWidth, false, "Map Tracer"] call FUNC(addMenuItem);
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F3, _fnc_doLineWidth, _fnc_renderLineWidth, false, "3D Laser Target"] call FUNC(addMenuItem);
["%1 %2 to %3 Line Width (%4)", "MAIN/LINES", DIK_F4, _fnc_doLineWidth, _fnc_renderLineWidth, false, "Map Laser Target"] call FUNC(addMenuItem);
6 changes: 3 additions & 3 deletions addons/Streamator/Spectator/Menu/SubMenus/fn_miscSubMenus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ private _fnc_renderViewDistance = {
viewDistance;
};
};
_name = format ["%1 %2 %3 (%4)", _mType, _value, _type, _current];
_name = format [_name, _mType, _value, _type, _current];
_ret
};

["Add 100 ViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F1, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ViewDistance"] call FUNC(addMenuItem);
["Add 100 ObjectViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F2, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ObjectViewDistance"] call FUNC(addMenuItem);
["%1 %2 %3 (%4)", "MAIN/MISC/VIEWDISTANCE", DIK_F1, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ViewDistance"] call FUNC(addMenuItem);
["%1 %2 %3 (%4)", "MAIN/MISC/VIEWDISTANCE", DIK_F2, _fnc_doViewDistance, _fnc_renderViewDistance, false, "ObjectViewDistance"] call FUNC(addMenuItem);
["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);
["Reset ViewDistance", "MAIN/MISC/VIEWDISTANCE", DIK_F4, { setObjectViewDistance -1; setViewDistance -1; true }] call FUNC(addMenuItem);

Expand Down
5 changes: 5 additions & 0 deletions addons/Streamator/Spectator/Menu/fn_registerMenus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ call FUNC(crewSubMenus);
["Misc", "MAIN", DIK_F7, "MAIN/MISC", {true}, true] call FUNC(addMenuItem);
CREATE_BACK_ACTION_MAIN("MAIN/MISC");
call FUNC(miscSubMenus);

// Lines
["Lines", "MAIN", DIK_F8, "MAIN/LINES", {true}, true] call FUNC(addMenuItem);
CREATE_BACK_ACTION_MAIN("MAIN/LINES");
call FUNC(lineSubMenus);
7 changes: 7 additions & 0 deletions addons/Streamator/Spectator/fn_openSpectator.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ GVAR(TopDownOffset) = [0, 0, 100];
GVAR(SyncObjectViewDistance) = true;
GVAR(PlaningModeUpdateTime) = 0.05;

GVAR(3DBulletTracerLineWidth) = 3;
GVAR(MapBulletTracerLineWidth) = 3;

GVAR(3DLaserTargetLineWidth) = 3;
GVAR(MapLaserTargetLineWidth) = 3;

if (isNumber (missionConfigFile >> QUOTE(DOUBLE(PREFIX,PlaningModeUpdateTime)))) then {
GVAR(PlaningModeUpdateTime) = getNumber (missionConfigFile >> QUOTE(DOUBLE(PREFIX,PlaningModeUpdateTime)));
};
Expand Down Expand Up @@ -357,4 +363,5 @@ call FUNC(updateSpectatorArray);
[{
call FUNC(updateValidUnits);
}, 1] call CFUNC(addPerframeHandler);

call FUNC(updateValidUnits);
2 changes: 2 additions & 0 deletions addons/Streamator/modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ class CfgCLibModules {
MODULE(SubMenus) {
FNC(cameraSubMenus);
FNC(crewSubMenus);
FNC(lineSubMenus);
FNC(mapSubMenus);
FNC(miscSubMenus);
FNC(overlaySubMenus);
FNC(radioSubMenus);
FNC(visionSubMenus);

};
FNC(addMenuItem);
FNC(executeEntry);
Expand Down

0 comments on commit f8e1a72

Please sign in to comment.