From 552fe202e544e22c8af2073cbaa0805668e1970a Mon Sep 17 00:00:00 2001 From: kaczy Date: Thu, 30 Jan 2025 19:34:37 +0100 Subject: [PATCH] Fix missing constant --- CentrED/Map/StaticObject.cs | 2 +- CentrED/Map/TileObject.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CentrED/Map/StaticObject.cs b/CentrED/Map/StaticObject.cs index 02cb2d6..2c3b61e 100644 --- a/CentrED/Map/StaticObject.cs +++ b/CentrED/Map/StaticObject.cs @@ -85,7 +85,7 @@ public void UpdatePos(ushort newX, ushort newY, sbyte newZ) var posY = newY * TILE_SIZE; var posZ = flatStatics ? 0 : newZ * TILE_Z_SCALE; - var projectedWidth = (TextureBounds.Width / 2f) * INVERSE_SQRT2; + var projectedWidth = (TextureBounds.Width / 2f) * RSQRT2; Vertices[0].Position = new Vector3(posX - projectedWidth, posY + projectedWidth, posZ + TextureBounds.Height); Vertices[1].Position = new Vector3(posX + projectedWidth, posY - projectedWidth, posZ + TextureBounds.Height); diff --git a/CentrED/Map/TileObject.cs b/CentrED/Map/TileObject.cs index 107b8e5..bc95279 100644 --- a/CentrED/Map/TileObject.cs +++ b/CentrED/Map/TileObject.cs @@ -2,7 +2,8 @@ public abstract class TileObject : MapObject { - public static readonly float TILE_SIZE = (float)(44 / Math.Sqrt(2)); + public static readonly float RSQRT2 = (float)(1 / Math.Sqrt(2)); + public static readonly float TILE_SIZE = 44 * RSQRT2; public const float TILE_Z_SCALE = 4.0f; public BaseTile Tile; public bool? Walkable;