Fix calculation issue when not on NAV area & Increment version

* Incremented to Version 1.3.1.3 as well as .NET 7
* When not standing inside of a NAV area and setting the position via button, it didn't find a NAV area and disregarded the player's height. Now we just check if Z value was set (not null)
* Also fixed comment
(Holy shit I wish I had motivation to refactor the main window)
This commit is contained in:
Mathias Lui 2023-03-07 00:16:37 +01:00
parent 81b2b98394
commit 8edbd31b94
5 changed files with 35 additions and 15 deletions

View file

@ -3,18 +3,34 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigManagerV2", "ConfigManagerV2\ConfigManagerV2.csproj", "{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigManagerV2", "ConfigManagerV2\ConfigManagerV2.csproj", "{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamShared", "..\SteamShared\SteamShared\SteamShared\SteamShared.csproj", "{A1C22F5E-D102-4236-9BD0-1D57147FED18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Debug|x64.ActiveCfg = Debug|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Debug|x64.Build.0 = Debug|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Release|Any CPU.Build.0 = Release|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Release|x64.ActiveCfg = Release|Any CPU
{0C1DD2D0-F373-43A3-9B2D-F42BCA33D95A}.Release|x64.Build.0 = Release|Any CPU
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Debug|x64.ActiveCfg = Debug|x64
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Debug|x64.Build.0 = Debug|x64
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Release|Any CPU.Build.0 = Release|Any CPU
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Release|x64.ActiveCfg = Release|x64
{A1C22F5E-D102-4236-9BD0-1D57147FED18}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

View file

@ -11,8 +11,8 @@
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>27.ico</ApplicationIcon>
<FileVersion>1.3.1.2</FileVersion>
<AssemblyVersion>1.3.1.2</AssemblyVersion>
<FileVersion>1.3.1.3</FileVersion>
<AssemblyVersion>1.3.1.3</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />

View file

@ -1113,18 +1113,18 @@ namespace Damage_Calculator
}
// Manage height
if (this.playerPoint.AssociatedAreaID < 0 ||
((this.DrawMode == eDrawMode.Shooting && this.targetPoint.AssociatedAreaID < 0)
|| (this.DrawMode == eDrawMode.Bomb && this.bombPoint.AssociatedAreaID < 0)))
if (this.playerPoint.Z == null ||
((this.DrawMode == eDrawMode.Shooting && this.targetPoint.Z == null)
|| (this.DrawMode == eDrawMode.Bomb && this.bombPoint.Z == null)))
{
// One of the points has no area ID, and thus no Z coordinate
// One of the points has no Z coordinate set
leftZ = 0;
rightZ = 0;
}
else
{
leftZ = this.DrawMode == eDrawMode.Shooting ? this.targetPoint.Z : this.bombPoint.Z;
rightZ = this.playerPoint.Z;
leftZ = (this.DrawMode == eDrawMode.Shooting ? this.targetPoint.Z : this.bombPoint.Z) ?? 0;
rightZ = this.playerPoint.Z ?? 0;
}
// Distance in units in 2D
@ -1136,9 +1136,10 @@ namespace Damage_Calculator
float maxFactor = 1.0f;
// Add the appropriate height
// They use the middle of the oriented bounding box,
// which should be equal to the axis-aligned bounding box, but with additional yaw in the normal sense
// Since we already have the X-Y middle, we just add half of the height to get the Z-middle as well
// They use a random value,
// which should be between the player's origin + 0.7 times their eye level and 1 times their eye level
// Since we already have the X-Y middle, we just add 0.7 or 1 as a factor for the eye level,
// depending on if it's the min or max possible value we want to get
if (radioPlayerStanding.IsChecked == true)
rightZ += isMax ? eyeLevelStanding * maxFactor : eyeLevelStanding * minFactor;
else if(radioPlayerCrouched.IsChecked == true)
@ -1900,6 +1901,7 @@ namespace Damage_Calculator
this.targetPoint.PercentageX = newPointPosPixels.X * 100f / this.mapCanvas.ActualWidth;
this.targetPoint.PercentageY = newPointPosPixels.Y * 100f / this.mapCanvas.ActualHeight;
this.targetPoint.PercentageScale = circle.Width * 100f / this.mapCanvas.ActualWidth;
this.targetPoint.Z = null; // Initialise with null, just in case
this.targetPoint.Z = givenCoords == null ? this.currentMouseCoord.Z : givenCoords.Z;
if (this.currentHeightLayer >= 0 && givenCoords == null)
{
@ -1937,6 +1939,7 @@ namespace Damage_Calculator
this.bombPoint.PercentageX = newPointPosPixels.X * 100f / this.mapCanvas.ActualWidth;
this.bombPoint.PercentageY = newPointPosPixels.Y * 100f / this.mapCanvas.ActualHeight;
this.bombPoint.PercentageScale = circle.Width * 100f / this.mapCanvas.ActualWidth;
this.bombPoint.Z = null; // Initialise with null, just in case
this.bombPoint.Z = givenCoords == null ? this.currentMouseCoord.Z : givenCoords.Z;
if (this.currentHeightLayer >= 0 && givenCoords == null)
{
@ -1977,6 +1980,7 @@ namespace Damage_Calculator
this.playerPoint.PercentageX = newPointPosPixels.X * 100f / this.mapCanvas.ActualWidth;
this.playerPoint.PercentageY = newPointPosPixels.Y * 100f / this.mapCanvas.ActualHeight;
this.playerPoint.PercentageScale = circle.Width * 100f / this.mapCanvas.ActualWidth;
this.playerPoint.Z = null; // Initialise with null, just in case
this.playerPoint.Z = givenCoords == null ? this.currentMouseCoord.Z : givenCoords.Z;
if (this.currentHeightLayer >= 0 && givenCoords == null)

View file

@ -25,9 +25,9 @@ namespace SteamShared.Models
public double Y { get; set; }
/// <summary>
/// The in-game Z-coordinate.
/// The in-game Z-coordinate, if any.
/// </summary>
public double Z { get; set; }
public double? Z { get; set; }
public int AssociatedAreaID { get; set; } = -1;