From 14bc5d412ce020e951cd2d27e928d5cff6b8c58c Mon Sep 17 00:00:00 2001 From: Rampastring Date: Mon, 14 Oct 2024 02:11:27 +0300 Subject: [PATCH] Add EditorZAdjust for BuildingTypes --- src/TSMapEditor/Constants.cs | 2 +- src/TSMapEditor/Models/BuildingType.cs | 1 + src/TSMapEditor/Rendering/ObjectRenderers/BuildingRenderer.cs | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TSMapEditor/Constants.cs b/src/TSMapEditor/Constants.cs index b86d36412..8493bcd8b 100644 --- a/src/TSMapEditor/Constants.cs +++ b/src/TSMapEditor/Constants.cs @@ -5,7 +5,7 @@ namespace TSMapEditor { public static class Constants { - public const string ReleaseVersion = "1.3.1"; + public const string ReleaseVersion = "1.3.2"; public static int CellSizeX = 48; public static int CellSizeY = 24; diff --git a/src/TSMapEditor/Models/BuildingType.cs b/src/TSMapEditor/Models/BuildingType.cs index 97dd9817e..360e46c64 100644 --- a/src/TSMapEditor/Models/BuildingType.cs +++ b/src/TSMapEditor/Models/BuildingType.cs @@ -32,6 +32,7 @@ public BuildingType(string iniName) : base(iniName) public double LightRedTint { get; set; } public double LightGreenTint { get; set; } public double LightBlueTint { get; set; } + public int EditorZAdjust { get; set; } public BuildingArtConfig ArtConfig { get; set; } = new BuildingArtConfig(); public IArtConfig GetArtConfig() => ArtConfig; diff --git a/src/TSMapEditor/Rendering/ObjectRenderers/BuildingRenderer.cs b/src/TSMapEditor/Rendering/ObjectRenderers/BuildingRenderer.cs index f44e566ba..82d9ec622 100644 --- a/src/TSMapEditor/Rendering/ObjectRenderers/BuildingRenderer.cs +++ b/src/TSMapEditor/Rendering/ObjectRenderers/BuildingRenderer.cs @@ -110,7 +110,8 @@ protected override bool ShouldRenderReplacementText(Structure gameObject) protected override float GetDepthAddition(Structure gameObject) { - return Constants.DepthEpsilon * ObjectDepthAdjustments.Building; + float buildingAdditionalDepth = gameObject.ObjectType.EditorZAdjust / (float)Map.HeightInPixelsWithCellHeight; + return buildingAdditionalDepth + (Constants.DepthEpsilon * ObjectDepthAdjustments.Building); } private void DrawBibGraphics(Structure gameObject, ShapeImage bibGraphics, Point2D drawPoint, in CommonDrawParams drawParams, bool affectedByLighting)