From afb1ad8e9497af140bae86e5422c78e2382266f3 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 11 Sep 2023 15:36:59 -0400 Subject: [PATCH] Grid flip testing --- src/engine/InterestManagement/HeightMap.java | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 3904107a..e6a78c6b 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -15,7 +15,6 @@ import engine.gameManager.ZoneManager; import engine.math.Vector2f; import engine.math.Vector3fImmutable; import engine.objects.Zone; -import engine.util.MapLoader; import org.pmw.tinylog.Logger; import javax.imageio.ImageIO; @@ -92,7 +91,7 @@ public class HeightMap { // We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin. - this.heightmapImage = MapLoader.flipImage(this.heightmapImage); + // this.heightmapImage = MapLoader.flipImage(this.heightmapImage); // Calculate the data we do not load from table @@ -122,14 +121,11 @@ public class HeightMap { this.outsetX = 128; this.outsetZ = 128; - // Cache the full extents to avoid the calculation this.fullExtentsX = halfExtentsX * 2; this.fullExtentsY = halfExtentsY * 2; - // We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin. - this.heightmapImage = null; // Calculate the data we do not load from table @@ -163,8 +159,6 @@ public class HeightMap { this.fullExtentsX = halfExtentsX * 2; this.fullExtentsY = halfExtentsY * 2; - // We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin. - this.heightmapImage = null; // Calculate the data we do not load from table @@ -325,7 +319,6 @@ public class HeightMap { HeightMap.GeneratePlayerCityHeightMap(); - // Clear all heightmap image data as it's no longer needed. for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) { @@ -351,14 +344,18 @@ public class HeightMap { if (zoneLoc.x < 0) zoneLoc.setX(0); - if (zoneLoc.x > this.fullExtentsX - 1) - zoneLoc.setX((this.fullExtentsX - 1) + .9999999f); + if (zoneLoc.x >= this.fullExtentsX) + zoneLoc.setX(this.fullExtentsX); if (zoneLoc.y < 0) zoneLoc.setY(0); - if (zoneLoc.y > this.fullExtentsY - 1) - zoneLoc.setY((this.fullExtentsY - 1) + .9999999f); + if (zoneLoc.y > this.fullExtentsY) + zoneLoc.setY(this.fullExtentsY); + + // Flip Y coordinates + + zoneLoc.setY(this.fullExtentsY - zoneLoc.y); float xBucket = (zoneLoc.x / this.bucketWidthX); float yBucket = (zoneLoc.y / this.bucketWidthY);