Skip to content

Commit

Permalink
Minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaren882 committed Aug 25, 2024
1 parent bbe7acd commit 9d8561d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
10 changes: 8 additions & 2 deletions addons/uh60_jvmf/functions/fnc_ctabToJvmf.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* vtx_uh60_jvmf_fnc_ctabToJvmf
*
* Convert data into Jvmf format
*
*/
params ["_index", "_marker"];
_marker params ["_position", "_iconIndex", "_size", "_direction", "_time", "_sender"];

Expand Down Expand Up @@ -32,7 +38,7 @@ private _positionType = switch (true) do {

#if __has_include("\z\ctab\addons\core\config.bin")
if ((_iconIndex >= 100) && (_size > 0)) then {
_time = format ["%1-%2", ["A","B","C","D","E","F"] # (_size - 1), _time];
_time = [["A","B","C","D","E","F"] # (_size - 1), _time] joinString "-";
};
#endif

Expand Down Expand Up @@ -101,7 +107,7 @@ private _messageComments = switch (_positionType) do {

private _gridZone = [] call ace_common_fnc_getMGRSdata;
private _gridStr = [_position3d] call ace_common_fnc_getMapGridFromPos;
private _fullPositionString = format ["%1 %2 %3 %4", _gridZone # 0, _gridZone # 1, _gridStr # 0, _gridStr # 1];
private _fullPositionString = [_gridZone # 0, _gridZone # 1, _gridStr # 0, _gridStr # 1] joinString " ";

// build the message
private _id = "CTAB" + str _index;
Expand Down
2 changes: 1 addition & 1 deletion addons/uh60_jvmf/functions/fnc_drawJVMF.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ switch (_type) do {

if (count _replies > 0) then {
private _lastReply = _replies # ((count _replies) - 1);
[_vehicle, 41, format["%1 %2 %3", _lastReply # 0, _lastReply # 1, _lastReply # 2]] call vtx_uh60_mfd_fnc_setUserText;
[_vehicle, 41, [_lastReply # 0, _lastReply # 1, _lastReply # 2] joinString " "] call vtx_uh60_mfd_fnc_setUserText;
};

private _messageCount = count VTX_JVMF_MESSAGES;
Expand Down
14 changes: 7 additions & 7 deletions addons/uh60_mfd/functions/fnc_slewTAC.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ private _zoomLevel = _vehicle getVariable ["MAP_ZoomMult", 1];
private _centered = _vehicle ammoOnPylon 4 == 0;
private _fixed = _vehicle ammoOnPylon 7 == 0;
private _selfAligned = _vehicle ammoOnPylon 5 == 0;
private _rotation = if (_selfAligned) then {getDir _vehicle} else {0};
private _rotation = if (_selfAligned) then {getDirVisual _vehicle} else {0};

private _center = if (_centered) then {
getPos _vehicle;
getPosVisual _vehicle;
} else {
private _cursorToMapRotated = [[0,_worldSize / _zoomLevel * 0.15], -(_rotation)] call BIS_fnc_rotateVector2D;
getPos _vehicle vectorAdd [_cursorToMapRotated # 0, _cursorToMapRotated # 1, 0];
getPosVisual _vehicle vectorAdd [_cursorToMapRotated # 0, _cursorToMapRotated # 1, 0];
};

private _movingCursor = (vtx_uh60_mfd_slewX != 0) || (vtx_uh60_mfd_slewY != 0);
Expand All @@ -34,7 +34,7 @@ if (_staticMap) then {
if (!isNil "vtx_uh60_tac_hookedObject") then {
private _position = switch (vtx_uh60_tac_hookedObject # 1) do {
case "ground": {
if (typeName (vtx_uh60_tac_hookedObject # 0) == "GROUP") then [{getPos leader (vtx_uh60_tac_hookedObject # 0)}, {getPos (vtx_uh60_tac_hookedObject # 0)}];
if (typeName (vtx_uh60_tac_hookedObject # 0) == "GROUP") then [{getPosVisual leader (vtx_uh60_tac_hookedObject # 0)}, {getPosVisual (vtx_uh60_tac_hookedObject # 0)}];
};
case "waypoint": {waypointPosition (vtx_uh60_tac_hookedObject # 0)};
default {[-10000,0,0]};
Expand All @@ -56,7 +56,7 @@ if (_movingCursor) then {
_moveVector = _moveVector vectorAdd [0,50 * (vtx_uh60_mfd_slewY / _zoomLevel),0];
};
if (_selfAligned) then {
_moveVector = [_moveVector, -(getDir _vehicle)] call BIS_fnc_rotateVector2D;
_moveVector = [_moveVector, -(getDirVisual _vehicle)] call BIS_fnc_rotateVector2D;
};
_center = _center vectorAdd _moveVector;

Expand All @@ -81,7 +81,7 @@ if (local _vehicle) then {

_vehicle animateSource ["MAP_X", _map_anim_x, true];
_vehicle animateSource ["MAP_Y", _map_anim_y, true];
private _rotation = if (_selfAligned) then {getDir _vehicle} else {0};
private _rotation = if (_selfAligned) then {getDirVisual _vehicle} else {0};
_vehicle animateSource ["MAP_Rotation", _rotation, true];
};

Expand All @@ -104,4 +104,4 @@ private _positionToMfd = {

};

[getPos _vehicle, 27, 28] call _positionToMfd;
[getPosVisual _vehicle, 27, 28] call _positionToMfd;
2 changes: 1 addition & 1 deletion addons/uh60_mfd/functions/fnc_tac_getHookInfo.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
params ["_object", "_type", "_side"];
private _position = switch (_this # 1) do {
case "ground": {
if (typeName (_this # 0) == "GROUP") then [{getPos leader (_this # 0)}, {getPos (_this # 0)}];
if (typeName (_this # 0) == "GROUP") then [{getPosVisual leader (_this # 0)}, {getPosVisual (_this # 0)}];
};
case "waypoint": {waypointPosition (_this # 0)};
default {[-10000,0,0]};
Expand Down

0 comments on commit 9d8561d

Please sign in to comment.