Implemented the dual inclination angle input method

This commit is contained in:
ulteq 2015-04-18 15:52:06 +02:00
parent 422e175f09
commit 5e45734cf4
4 changed files with 39 additions and 1 deletions

View File

@ -1271,12 +1271,14 @@ class ATragMX_Display {
w=0.045;
x=0.550*safezoneW+safezoneX+0.300;
y=0.265*safezoneH+safezoneY+0.440;
onKeyUp=QUOTE(if (_this select 1 == 28) then {0 call FUNC(update_inclination_angle)});
};
class TEXT_TARGET_DATA_INCLINATION_ANGLE_INPUT_DEGREE: TEXT_TARGET_DATA_LATITUDE_INPUT {
idc=140040;
w=0.045;
x=0.550*safezoneW+safezoneX+0.350;
y=0.265*safezoneH+safezoneY+0.440;
onKeyUp=QUOTE(if (_this select 1 == 28) then {1 call FUNC(update_inclination_angle)});
};
class TEXT_TARGET_DATA_TARGET_SPEED: TEXT_TARGET_DATA_LATITUDE {
idc=14005;

View File

@ -53,6 +53,7 @@ PREP(update_atmo_env_data);
PREP(update_atmo_selection);
PREP(update_gun);
PREP(update_gun_ammo_data);
PREP(update_inclination_angle);
PREP(update_range_card);
PREP(update_relative_click_memory);
PREP(update_result);

View File

@ -25,12 +25,21 @@ if (GVAR(currentUnit) == 1) then {
GVAR(barometricPressure) = GVAR(barometricPressure) * 33.86389;
};
private ["_inclinationAngleCosine", "_inclinationAngleDegree"];
GVAR(latitude) set [GVAR(currentTarget), -90 max Round(parseNumber(ctrlText 140000)) min 90];
GVAR(directionOfFire) set [GVAR(currentTarget), 0 max abs(Round(parseNumber(ctrlText 140010))) min 359];
GVAR(windSpeed1) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140020)) min 50];
GVAR(windSpeed2) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140021)) min 50];
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12];
GVAR(inclinationAngle) set [GVAR(currentTarget), -60 max parseNumber(ctrlText 140040) min 60];
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) max 1;
_inclinationAngleDegree = -60 max parseNumber(ctrlText 140040) min 60;
if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget)) then {
GVAR(inclinationAngle) set [GVAR(currentTarget), _inclinationAngleDegree];
} else {
if (_inclinationAngleCosine != cos(GVAR(inclinationAngle) select GVAR(currentTarget))) then {
GVAR(inclinationAngle) set [GVAR(currentTarget), acos(_inclinationAngleCosine)];
};
};
GVAR(targetSpeed) set [GVAR(currentTarget), -50 max abs(parseNumber(ctrlText 140050)) min 50];
GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000];
if (GVAR(currentUnit) != 2) then {

View File

@ -0,0 +1,26 @@
/*
* Author: Ruthberg
* Updates the inclination angle input fields
*
* Arguments:
* Reference input field ID <NUMBER>
*
* Return Value:
* Nothing
*
* Example:
* 0 call ace_atragmx_fnc_update_inclination_angle
*
* Public: No
*/
#include "script_component.hpp"
private ["_inclinationAngleCosine", "_inclinationAngleDegree"];
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) max 1;
_inclinationAngleDegree = -60 max parseNumber(ctrlText 140040) min 60;
if (_this == 0) then {
ctrlSetText [140040, Str(round(acos(_inclinationAngleCosine)))];
} else {
ctrlSetText [140041, Str(floor(cos(_inclinationAngleDegree) * 100) / 100)];
};