mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Show leveled azimuth/elevation
This commit is contained in:
parent
f6973c61fa
commit
ba8c9186bb
@ -31,6 +31,8 @@ class CfgVehicles {
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
turretInfoType = "ACE_Mk6_RscWeaponRangeArtillery";
|
||||
discreteDistance[] = {};
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
class ACE_SelfActions {
|
||||
|
@ -16,10 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_chargeText", "_tubeWeaponName", "_fireModes"];
|
||||
|
||||
PARAMS_2(_player,_newVehicle);
|
||||
|
||||
private["_tubeWeaponName" ,"_fireModes"];
|
||||
|
||||
if (isNull _newVehicle) exitWith {};
|
||||
if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {};
|
||||
|
||||
@ -27,6 +27,7 @@ _tubeWeaponName = (weapons _newVehicle) select 0;
|
||||
_fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes");
|
||||
|
||||
[{
|
||||
private["_chargeText", "_currentChargeMode", "_currentFireMode", "_display", "_elevDeg", "_elevationDiff", "_lookVector", "_notGunnerView", "_realAzimuth", "_realElevation", "_upVectorDir", "_useMils", "_weaponDir"];
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_2_PVT(_args,_mortarVeh,_fireModes);
|
||||
|
||||
@ -54,21 +55,32 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
|
||||
//Hud should hidden in 3rd person
|
||||
_notGunnerView = cameraView != "GUNNER";
|
||||
|
||||
//Get a precise rotation from the vehicle / animation
|
||||
_rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360;
|
||||
|
||||
//BIS Fucked up math:
|
||||
_upAngleOffset = asin ((vectorUp _mortarVeh) vectorDotProduct [sin _rotationDegrees, cos _rotationDegrees, 0]);
|
||||
hintSilent format ["%1\n%2", _rotationDegrees, _upAngleOffset];
|
||||
//Calc real azimuth/elevation
|
||||
//(looking at the sky VS looking at ground will radicaly change fire direction because BIS)
|
||||
_realAzimuth = -1;
|
||||
_realElevation = -1;
|
||||
if ((ctrlText (_display displayCtrl 173)) == "--") then {
|
||||
//No range (looking at sky), it will follow weaponDir:
|
||||
_weaponDir = _mortarVeh weaponDirection (currentWeapon _mortarVeh);
|
||||
_realAzimuth = (_weaponDir select 0) atan2 (_weaponDir select 1);
|
||||
_realElevation = asin (_weaponDir select 2);
|
||||
} else {
|
||||
//Valid range, will fire at camera dir
|
||||
_lookVector = (ATLToASL (positionCameraToWorld [0,0,0])) vectorFromTo (ATLToASL (positionCameraToWorld [0,0,10]));
|
||||
_realAzimuth = ((_lookVector select 0) atan2 (_lookVector select 1));
|
||||
_upVectorDir = (((vectorUp z1) select 0) atan2 ((vectorUp z1) select 1));
|
||||
_elevationDiff = (cos (_realAzimuth - _upVectorDir)) * acos ((vectorUp z1) select 2);
|
||||
_realElevation = ((180 / PI) * (z1 animationPhase "mainGun")) + 75 - _elevationDiff;
|
||||
};
|
||||
|
||||
//Update Heading Display:
|
||||
if (_notGunnerView || (!GVAR(allowCompass))) then {
|
||||
(_display displayCtrl 80156) ctrlSetText "";
|
||||
} else {
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80156) ctrlSetText str ((round (_rotationDegrees * 6400 / 360)) % 6400);
|
||||
(_display displayCtrl 80156) ctrlSetText str (((round (_realAzimuth * 6400 / 360)) + 6400) % 6400);
|
||||
} else {
|
||||
(_display displayCtrl 80156) ctrlSetText (ctrlText (_display displayCtrl 156));
|
||||
(_display displayCtrl 80156) ctrlSetText str ((round (_realAzimuth + 360)) % 360);
|
||||
};
|
||||
};
|
||||
|
||||
@ -78,15 +90,11 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
|
||||
(_display displayCtrl 80175) ctrlSetText "";
|
||||
} else {
|
||||
(_display displayCtrl 80085) ctrlSetStructuredText parseText _chargeText;
|
||||
_elevDeg = parseNumber ctrlText (_display displayCtrl 175);
|
||||
|
||||
//Apply the offset (from vectorUp):
|
||||
_elevDeg = _elevDeg - _upAngleOffset;
|
||||
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80175) ctrlSetText str ((round (_elevDeg * 6400 / 360)) % 6400);
|
||||
(_display displayCtrl 80175) ctrlSetText str ((round (_realElevation * 6400 / 360)) % 6400);
|
||||
} else {
|
||||
(_display displayCtrl 80175) ctrlSetText str (((round (_elevDeg * 100)) / 100) % 360);
|
||||
(_display displayCtrl 80175) ctrlSetText str (((round (_realElevation * 100)) / 100) % 360);
|
||||
};
|
||||
};
|
||||
|
||||
@ -98,10 +106,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
|
||||
if (_elevDeg <= 0) then { //Bad data means "----" out of range
|
||||
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
|
||||
} else {
|
||||
|
||||
//Apply the offset (from vectorUp):
|
||||
_elevDeg = _elevDeg - _upAngleOffset;
|
||||
|
||||
_elevDeg = _elevDeg + (_realElevation - (parseNumber ctrlText (_display displayCtrl 175)));
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80176) ctrlSetText str round ((round (_elevDeg * 6400 / 360)) % 6400);
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ private ["_fnc_hideControl", "_xPos", "_yPos", "_wPos", "_hPos"];
|
||||
#define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED")
|
||||
|
||||
_fnc_hideControl = {
|
||||
private "_idc";
|
||||
private ["_idc", "_pos"];
|
||||
PARAMS_2(_path,_hideCtrl);
|
||||
_idc = getNumber (_path >> "IDC");
|
||||
_pos = [];
|
||||
|
Loading…
Reference in New Issue
Block a user