Skip to content

Commit

Permalink
Fix missing constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Jan 30, 2025
1 parent 2dad16c commit 552fe20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CentrED/Map/StaticObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion CentrED/Map/TileObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 552fe20

Please sign in to comment.