Skip to content

Commit

Permalink
Various - Fix position types (#10741)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored Feb 11, 2025
1 parent ce5282d commit 829a0c0
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 64 deletions.
10 changes: 5 additions & 5 deletions addons/advanced_fatigue/functions/fnc_renderDebugLines.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ addMissionEventHandler ["Draw3D", {
private _normal = surfaceNormal (getPosWorld ACE_player);
private _beg = (getPosWorld ACE_player) vectorAdd (_normal vectorMultiply 0.5);
private _end = _beg vectorAdd (_normal vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 1, 0, 1]];
drawLine3D [ASLToAGL _beg, ASLToAGL _end, [0, 1, 0, 1]];

private _side = vectorNormalized (_normal vectorCrossProduct [0, 0, 1]);
private _end = _beg vectorAdd (_side vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 0, 1, 1]];
drawLine3D [ASLToAGL _beg, ASLToAGL _end, [0, 0, 1, 1]];

private _up = vectorNormalized (_normal vectorCrossProduct _side);
private _end = _beg vectorAdd (_up vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [1, 0, 0, 1]];
drawLine3D [ASLToAGL _beg, ASLToAGL _end, [1, 0, 0, 1]];

private _movementVector = vectorNormalized (velocity ACE_player);
private _end = _beg vectorAdd (_movementVector vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [1, 1, 0, 1]];
drawLine3D [ASLToAGL _beg, ASLToAGL _end, [1, 1, 0, 1]];

private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal);
_sideVector set [2, 0];
private _end = _beg vectorAdd (_sideVector vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 1, 1, 1]];
drawLine3D [ASLToAGL _beg, ASLToAGL _end, [0, 1, 1, 1]];
}];
31 changes: 3 additions & 28 deletions addons/ai/functions/fnc_drawCuratorGarrisonPathing.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,8 @@ private _unitMoveList = missionNamespace getVariable [QGVAR(garrison_unitMoveLis
{
_x params ["_unit", "_pos"];

switch (true) do {
case (surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], (AGLToASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLToASL _pos), 0.75, 0.75, 0.75];
};

case (!surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
};

case (!surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], (AGLToASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLToASL _pos), 0.75, 0.75, 0.75];
};

case (surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
};
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
} forEach _unitMoveList;
1 change: 0 additions & 1 deletion addons/common/functions/fnc_checkPBOs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ if (!_checkAll) exitWith {};
if (!isServer) then {
["ace_versioning_clientCheckDone", {
// Don't let this event get triggered again
//IGNORE_PRIVATE_WARNING ["_thisType", "_thisId", "_thisArgs"];
[_thisType, _thisId] call CBA_fnc_removeEventHandler;

params ["_clientErrors"];
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_getMGRSdata.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private _UTM = [_long, _lat] call BIS_fnc_posDegToUTM;
private _easting = _UTM select 0;
private _northing = _UTM select 1;
//private _zone = _UTM select 2;
TRACE_4("",_UTM,_easting,_northing,_zone);
TRACE_3("",_UTM,_easting,_northing);

/*
private _band = switch (true) do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* Public: Yes
*/

private _position = ATLToASL positionCameraToWorld [0, 0, 0];
private _direction = ATLToASL positionCameraToWorld [0, 0, 1];
private _position = AGLToASL positionCameraToWorld [0, 0, 0];
private _direction = AGLToASL positionCameraToWorld [0, 0, 1];

private _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1));
private _inclination = asin ((_direction select 2) - (_position select 2));
Expand Down
6 changes: 2 additions & 4 deletions addons/common/functions/fnc_getTargetObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

params ["_maxDistance"];

private _position = ATLToASL positionCameraToWorld [0, 0, 0];
_position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)];
private _position = AGLToASL positionCameraToWorld [0, 0, 0];

private _laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance];
_laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)];
private _laser = AGLToASL positionCameraToWorld [0, 0, _maxDistance];

private _intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2];

Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_showHud.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (_reason != "") then {
};

private _masks = values GVAR(showHudHash);
private _resultMask = []; //IGNORE_PRIVATE_WARNING ["_resultMask"];
private _resultMask = [];

for "_index" from 0 to 9 do {
private _set = true; //Default to true
Expand Down
2 changes: 1 addition & 1 deletion addons/huntir/functions/fnc_cam.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (!hasInterface) exitWith {};
params ["_huntIR"];

GVAR(huntIR) = _huntIR;
GVAR(pos) = getPosVisual GVAR(huntIR);
GVAR(pos) = ASLToAGL getPosASLVisual GVAR(huntIR);

GVAR(ZOOM) = 0;
GVAR(NV) = 0;
Expand Down
12 changes: 6 additions & 6 deletions addons/map/functions/fnc_initMainMap.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ GVAR(mousePos) = [0.5, 0.5];
GVAR(rightMouseButtonLastPos) = [];

_control ctrlAddEventHandler ["Draw", {call FUNC(updateMapEffects)}];
_control ctrlAddEventHandler ["MouseButtonDown", {
params ["", "_button", "_x", "_y"];
if (_button == 1) then {
GVAR(rightMouseButtonLastPos) = [_x, _y];
};
}];
_control ctrlAddEventHandler ["MouseMoving", {
params ["_control", "_x", "_y"];
if (GVAR(isShaking) && {count GVAR(rightMouseButtonLastPos) == 2}) then {
Expand All @@ -41,12 +47,6 @@ _control ctrlAddEventHandler ["MouseMoving", {
};
}];

_control ctrlAddEventHandler ["MouseButtonDown", {
params ["", "_button", "_x", "_y"];
if (_button == 1) then {
GVAR(rightMouseButtonLastPos) = [_x, _y];
};
}];

_control ctrlAddEventHandler ["MouseButtonUp", {
params ["", "_button"];
Expand Down
1 change: 0 additions & 1 deletion addons/medical/functions/fnc_deserializeState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ if (!local _unit) exitWith { ERROR_1("unit [%1] is not local",_unit) };
if !(_unit getVariable [QGVAR(initialized), false]) exitWith {
[QEGVAR(medical_status,initialized), {
params ["_unit"];
//IGNORE_PRIVATE_WARNING ["_thisArgs", "_thisId", "_thisType"];
_thisArgs params ["_target"];

if (_unit == _target) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
params ["_projectile"];

private _camera = "camera" camCreate getPosATL _projectile;
private _camera = "camera" camCreate ASLToAGL getPosASL _projectile;
_camera camPrepareFov 0.7;
_camera cameraEffect ["internal", "back"];

Expand Down
12 changes: 6 additions & 6 deletions addons/movement/functions/fnc_canClimb.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3);
[_idPFH] call CBA_fnc_removePerFrameHandler;
};

drawLine3D [ASLToATL (_args select 1), ASLToATL (_args select 2), [0,1,0,1]];
drawLine3D [ASLToATL (_args select 3), ASLToATL (_args select 4), [1,0,0,1]];
drawLine3D [ASLToATL (_args select 5), ASLToATL (_args select 6), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 7), ASLToATL (_args select 8), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 9), ASLToATL (_args select 10), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 11), ASLToATL (_args select 12), [1,0.5,0.5,1]];
drawLine3D [ASLToAGL (_args select 1), ASLToAGL (_args select 2), [0,1,0,1]];
drawLine3D [ASLToAGL (_args select 3), ASLToAGL (_args select 4), [1,0,0,1]];
drawLine3D [ASLToAGL (_args select 5), ASLToAGL (_args select 6), [1,0.5,0.5,1]];
drawLine3D [ASLToAGL (_args select 7), ASLToAGL (_args select 8), [1,0.5,0.5,1]];
drawLine3D [ASLToAGL (_args select 9), ASLToAGL (_args select 10), [1,0.5,0.5,1]];
drawLine3D [ASLToAGL (_args select 11), ASLToAGL (_args select 12), [1,0.5,0.5,1]];
}, 0, [ diag_tickTime,
_checkPos0beg, _checkPos0end,
_checkPos1beg, _checkPos1end,
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_cam.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if (_init) then {
GVAR(camAgentFree) enableSimulation false; // Prevent falling into water

// Create dummy target used for follow camera
GVAR(camDummy) = "Logic" createVehicleLocal getPosASLVisual GVAR(camFocus);
GVAR(camDummy) = "Logic" createVehicleLocal ASLToAGL getPosASLVisual GVAR(camFocus);

// Handle initial camera mode limitation
if !(GVAR(camMode) in GVAR(availableModes)) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/spectator/functions/fnc_ui_draw3D.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if !(GVAR(uiMapVisible)) then {
private _grenadeVelocityMagnitude = vectorMagnitude velocity _x;

// Draw grenade (rotate icon to represent spinning)
drawIcon3D [ICON_GRENADE, [1,0,0,1], getPosVisual _x, 0.6, 0.6, if (_grenadeVelocityMagnitude > 0) then { time * 100 * _grenadeVelocityMagnitude } else { 0 }, "", 0, 0.05, "TahomaB"];
drawIcon3D [ICON_GRENADE, [1,0,0,1], ASLToAGL getPosASLVisual _x, 0.6, 0.6, if (_grenadeVelocityMagnitude > 0) then { time * 100 * _grenadeVelocityMagnitude } else { 0 }, "", 0, 0.05, "TahomaB"];

// Store grenade for next frame
_grenadesNew pushBack _x;
Expand Down
4 changes: 2 additions & 2 deletions addons/spectator/functions/fnc_ui_handleKeyDown.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ if (_key == DIK_L) exitWith {
deleteVehicle GVAR(camLights);
GVAR(camLights) = [];
} else {
private _cameraLight = "#lightpoint" createVehicleLocal getPosASL GVAR(camera);
private _cameraLight = "#lightpoint" createVehicleLocal ASLToAGL getPosASL GVAR(camera);
_cameraLight setLightBrightness 2;
_cameraLight setLightAmbient [1,1,1];
_cameraLight setLightColor [0,0,0];
_cameraLight lightAttachObject [GVAR(camera), [0,0,0]];

private _pointerLight = "#lightpoint" createVehicleLocal getPosASL GVAR(camera);
private _pointerLight = "#lightpoint" createVehicleLocal ASLToAGL getPosASL GVAR(camera);
_pointerLight setLightBrightness 1;
_pointerLight setLightAmbient [1,1,1];
_pointerLight setLightColor [0,0,0];
Expand Down
4 changes: 2 additions & 2 deletions addons/vector/functions/fnc_getDirection.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ private _dlgVector = GETUVAR(ACE_dlgVector, displayNull);

#define MAX_ABSINCLINATION 45

private _position = ATLToASL positionCameraToWorld [0,0,0];
private _direction = ATLToASL positionCameraToWorld [0,0,1];
private _position = AGLToASL positionCameraToWorld [0,0,0];
private _direction = AGLToASL positionCameraToWorld [0,0,1];

private _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1));
_azimuth = _azimuth call EFUNC(common,getMagneticBearing);
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if (_activated && local _logic && !isNull curatorCamera) then {
_blur ppEffectAdjust [0.03,0.03,0.1,0.1];
_blur ppEffectCommit 1;

_cam = "camera" camCreate getPosATL curatorCamera;
_cam = "camera" camCreate ASLToAGL getPosASL curatorCamera;
_cam cameraEffect ["internal","back"];
_cam camPrepareTarget (screenToWorld [0.5,0.5]);
_cam camCommitPrepared 0;
Expand Down

0 comments on commit 829a0c0

Please sign in to comment.