Skip to content

Commit

Permalink
endofday7-20
Browse files Browse the repository at this point in the history
break from 0.4.1
added: GS flag implimentation
fine LocNeedle Mode
remove ADI when in fine loc mode
  • Loading branch information
kujuman committed Jul 21, 2014
1 parent 196e43c commit 293e4c3
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 21 deletions.
Binary file modified GameData/KerbalScienceFoundation/NavInstruments/NavUtilGUI.dll
Binary file not shown.
Binary file modified GameData/KerbalScienceFoundation/NavInstruments/NavUtilLib.dll
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GameData/KerbalScienceFoundation/NavInstruments/RPMHSI.dll
Binary file not shown.
70 changes: 62 additions & 8 deletions KSP Navigation/NavUtilLib/GlobalV_DisplayData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public static void DrawHSI(RenderTexture screen, float aspectRatio)
{
var.FlightData.updateNavigationData();

locFlag = gsFlag = bcFlag = false;
locFlag = bcFlag = false;
gsFlag = true;



if (var.FlightData.locDeviation > 10 && var.FlightData.locDeviation < 170 || var.FlightData.locDeviation < -10 && var.FlightData.locDeviation > -170)
locFlag = true;
Expand All @@ -66,8 +69,16 @@ public static void DrawHSI(RenderTexture screen, float aspectRatio)
screen = NavUtilLib.Graphics.drawCenterRotatedImage(360 - FlightGlobals.ship_heading + (float)var.FlightData.bearing, new Vector2(.5f, .5f), var.Materials.Instance.NDBneedle, screen, 0, 0);
screen = NavUtilLib.Graphics.drawCenterRotatedImage(360 - FlightGlobals.ship_heading + (float)var.FlightData.selectedRwy.hdg, new Vector2(.5f, .5f), var.Materials.Instance.course, screen, 0, 0);

bool fineLoc = false;

if (!locFlag)
{

if (NavUtilLib.GlobalVariables.Settings.enableFineLoc && NavUtilLib.GlobalVariables.FlightData.dme < 7500)
{
fineLoc = true;
}

float deviationCorrection;
if (bcFlag)
{
Expand All @@ -78,28 +89,67 @@ public static void DrawHSI(RenderTexture screen, float aspectRatio)
{
deviationCorrection = var.FlightData.locDeviation * -.078125f;
}
//if fineLoc == false then we use course guidance mode. In this mode each tick on Loc is 1°. in fine guidance mode each tick is 0.25°

string locMode = "Loc→Coarse Mode";

if (fineLoc && Mathf.Abs(NavUtilLib.GlobalVariables.FlightData.locDeviation) < 0.75f)
{
deviationCorrection *= 4; //we're magnifying the needle deflection, which increases sensetivity

//now to inform the user that fine control is enabled
locMode = "Loc→Fine Mode";

//change the color of the localizer needle/font?
NavUtilLib.GlobalVariables.Materials.Instance.whiteFont.color = Color.magenta;
screen = NavUtilLib.TextWriter.addTextToRT(screen, locMode, new Vector2(380, screen.height - 570), NavUtilLib.GlobalVariables.Materials.Instance.whiteFont, 0.5f);
NavUtilLib.GlobalVariables.Materials.Instance.whiteFont.color = Color.white;

NavUtilLib.GlobalVariables.Materials.Instance.localizer.color = Color.yellow;

NavUtilLib.GlobalVariables.Materials.Instance.NDBneedle.color = Color.clear;
}
else
{
fineLoc = false;

NavUtilLib.GlobalVariables.Materials.Instance.localizer.color = Color.magenta;
screen = NavUtilLib.TextWriter.addTextToRT(screen, locMode, new Vector2(380, screen.height - 570), NavUtilLib.GlobalVariables.Materials.Instance.whiteFont, 0.5f);
}

deviationCorrection = Mathf.Clamp(deviationCorrection, -0.234375f, 0.234375f);


screen = NavUtilLib.Graphics.drawCenterRotatedImage(360 - FlightGlobals.ship_heading + (float)var.FlightData.selectedRwy.hdg, new Vector2(.5f, .5f), var.Materials.Instance.localizer, screen, deviationCorrection, 0);
}
else //draw flag
{
screen = NavUtilLib.Graphics.drawMovedImagePortion(var.Materials.Instance.flag, .34375f, .65625f, 0, 1, screen, new Vector2(.821875f, 0.2046875f), false);
}

if(locFlag || !fineLoc)
NavUtilLib.GlobalVariables.Materials.Instance.NDBneedle.color = Color.white;


screen = NavUtilLib.Graphics.drawMovedImage(var.Materials.Instance.overlay, screen, new Vector2(0, 0), false, false);
//marker beacons
//imageBox takes bottom x,
if (var.FlightData.dme < 30000)
if (var.FlightData.dme < 200000)
{
var fB = NavUtilLib.Utils.CalcBearingTo(Utils.CalcRadiansFromDeg(var.FlightData.selectedRwy.gsLongitude - var.FlightData.currentVessel.longitude),
Utils.CalcRadiansFromDeg(var.FlightData.currentVessel.latitude),
Utils.CalcRadiansFromDeg(var.FlightData.selectedRwy.gsLatitude));

var gsHorDev = Utils.CalcLocalizerDeviation(fB,var.FlightData.selectedRwy);

if (Math.Abs(gsHorDev) < 25)
gsFlag = false;


//checkmkrbcn
lastBcnCode = bcnCode;

var fB = NavUtilLib.Utils.CalcBearingTo(Utils.CalcRadiansFromDeg(var.FlightData.selectedRwy.gsLongitude - var.FlightData.currentVessel.longitude),
Utils.CalcRadiansFromDeg(var.FlightData.currentVessel.latitude),
Utils.CalcRadiansFromDeg(var.FlightData.selectedRwy.gsLatitude));

bcnCode = inBeaconArea(Utils.CalcLocalizerDeviation(fB, var.FlightData.selectedRwy), var.FlightData.currentVessel,var.FlightData.selectedRwy);
bcnCode = inBeaconArea(gsHorDev, var.FlightData.currentVessel,var.FlightData.selectedRwy);

bool drawUnlit = false;

Expand Down Expand Up @@ -189,7 +239,11 @@ public static void DrawHSI(RenderTexture screen, float aspectRatio)
yO = Mathf.Clamp(yO, -0.21875f, 0.21875f); //.7 degrees either direction
yO += 0.3609375f;

screen = NavUtilLib.Graphics.drawMovedImage(var.Materials.Instance.pointer, screen, new Vector2(0.5f, yO), true, false);

if (gsFlag)
screen = NavUtilLib.Graphics.drawMovedImagePortion(var.Materials.Instance.flag, .65625f, 1, 0, 1, screen, new Vector2(.821875f, 0.2390625f), false);
else
screen = NavUtilLib.Graphics.drawMovedImage(var.Materials.Instance.pointer, screen, new Vector2(0.5f, yO), true, false);

GL.PopMatrix();
}
Expand Down
2 changes: 2 additions & 0 deletions KSP Navigation/NavUtilLib/GlobalVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public static class Settings

public static bool navAidsIsLoaded = false;

public static bool enableFineLoc = true;

public static void loadNavAids()
{
Debug.Log("NavUtilLib: Loading NavAid database...");
Expand Down
10 changes: 5 additions & 5 deletions KSP Navigation/NavUtilLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HSI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("NavUtilLib")]
[assembly: AssemblyDescription("A library+ of tools for land based navigation in Kerbal Space Program")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HSI")]
[assembly: AssemblyProduct("NavUtilLib")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.4.1")]
//[assembly: AssemblyFileVersion("0.4.*")]
6 changes: 3 additions & 3 deletions KSP Navigation/RPM/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RPMHSI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Addon for Kerbal Space Program to interface with RasterPropMonitor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RPMHSI")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.4.1")]
//[assembly: AssemblyFileVersion("0.4.*")]
11 changes: 6 additions & 5 deletions KSP Navigation/StandAlone/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KSF_NavInstruments")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("NavUtilGUI")]
[assembly: AssemblyDescription("An addon for Kerbal Space Program to create a GUI between NavUtilLib and Toolbar")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KSF_NavInstruments")]
[assembly: AssemblyProduct("NavUtilGUI")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.4.1")]
//[assembly: AssemblyFileVersion("0.4.*")]

0 comments on commit 293e4c3

Please # to comment.