From c110ffc4b16ca69f0e4bbfdb4bc81986ae9ba0ad Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 2 Nov 2023 09:08:28 -0400 Subject: [PATCH 01/10] Dev cmd updated --- src/engine/devcmd/cmds/GetHeightCmd.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 2b6a16af..873ae29d 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -53,11 +53,19 @@ public class GetHeightCmd extends AbstractDevCmd { gridSquare.x = (float) Math.floor(gridSquare.x); gridSquare.y = (float) Math.floor(gridSquare.y); + short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x][(int) gridSquare.y]; + short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x + 1][(int) gridSquare.y]; + short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x][(int) gridSquare.y + 1]; + short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x + 1][(int) gridSquare.y + 1]; + this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName); this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName); this.throwbackInfo(playerCharacter, "Grid : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]"); + this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]"); + this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]"); + this.throwbackInfo(playerCharacter, "offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]"); this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]"); this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.min_blend + " /" + heightmapZone.template.max_blend); From fe9c6437d87463c114a3d6515a0025ff72447cb5 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 7 Nov 2023 12:32:25 -0500 Subject: [PATCH 02/10] Dev cmd updated --- src/engine/devcmd/cmds/GetHeightCmd.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 873ae29d..647ee661 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -49,20 +49,24 @@ public class GetHeightCmd extends AbstractDevCmd { float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc()); - Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(childZoneLoc); - gridSquare.x = (float) Math.floor(gridSquare.x); - gridSquare.y = (float) Math.floor(gridSquare.y); + Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc); - short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x][(int) gridSquare.y]; - short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x + 1][(int) gridSquare.y]; - short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x][(int) gridSquare.y + 1]; - short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) gridSquare.x + 1][(int) gridSquare.y + 1]; + terrainCell.x = (float) Math.floor(terrainCell.x); + terrainCell.y = (float) Math.floor(terrainCell.y); + + Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1); + + short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y]; + short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y]; + short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y + 1]; + short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y + 1]; this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName); this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName); - this.throwbackInfo(playerCharacter, "Grid : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]"); + this.throwbackInfo(playerCharacter, "Terrain Cell : " + "[" + terrainCell.x + "]" + "[" + terrainCell.y + "]"); + this.throwbackInfo(playerCharacter, "Cell Offset : " + "[" + cell_offset.x + "]" + "[" + cell_offset.y + "]"); this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]"); this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]"); From f93573177ad3cc89d1959b46591b83ef8ab67b03 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 7 Nov 2023 12:33:26 -0500 Subject: [PATCH 03/10] Dev cmd updated --- src/engine/devcmd/cmds/GetHeightCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 647ee661..bbc67d64 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -70,7 +70,7 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]"); this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]"); - this.throwbackInfo(playerCharacter, "offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]"); + this.throwbackInfo(playerCharacter, "Child Zone Offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]"); this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]"); this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.min_blend + " /" + heightmapZone.template.max_blend); this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y); From c73fcc19f273367ab65e5406891f7ea45259f3db Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 8 Nov 2023 11:34:33 -0500 Subject: [PATCH 04/10] Dev cmd updated --- src/engine/devcmd/cmds/GetHeightCmd.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index bbc67d64..01326245 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -65,6 +65,8 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName); + this.throwbackInfo(playerCharacter, "Player loc: " + "[" + playerCharacter.loc.x + "]" + "[" + playerCharacter.loc.y + "]" + "[" + playerCharacter.loc.z + "]"); + this.throwbackInfo(playerCharacter, "Terrain Cell : " + "[" + terrainCell.x + "]" + "[" + terrainCell.y + "]"); this.throwbackInfo(playerCharacter, "Cell Offset : " + "[" + cell_offset.x + "]" + "[" + cell_offset.y + "]"); this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]"); From 8300c47e4ae0c61d0c5a9b15e76f6d8d62b20cde Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 8 Nov 2023 11:59:52 -0500 Subject: [PATCH 05/10] Dev cmd updated --- src/engine/devcmd/cmds/GetHeightCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 01326245..5438960a 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -74,7 +74,7 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Child Zone Offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]"); this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]"); - this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.min_blend + " /" + heightmapZone.template.max_blend); + this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend); this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y); this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset)); From 9bf0d3f7d1c33d1db8d76089601719023e2abaf9 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 11 Nov 2023 07:03:35 -0500 Subject: [PATCH 06/10] Devcmd updated. --- src/engine/devcmd/cmds/GetHeightCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 5438960a..83c0fb99 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -50,11 +50,11 @@ public class GetHeightCmd extends AbstractDevCmd { float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc()); Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc); + Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1); terrainCell.x = (float) Math.floor(terrainCell.x); terrainCell.y = (float) Math.floor(terrainCell.y); - Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1); short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y]; short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y]; From b58049968fc3a187d72d6a6dd02a096181be4eeb Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 12 Nov 2023 07:36:56 -0500 Subject: [PATCH 07/10] IDA says 256. --- src/engine/InterestManagement/Terrain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index abd0e638..8c98d117 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -84,7 +84,7 @@ public class Terrain { // Scale coefficient for this terrain - this.terrain_scale = this.zone.template.terrain_max_y / 255f; + this.terrain_scale = this.zone.template.terrain_max_y / 256f; } public static Zone getNextZoneWithTerrain(Zone zone) { From 9b0f4d5aef2ed3b333ba9f31a4851fab1cc84fc7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 12 Nov 2023 11:09:29 -0500 Subject: [PATCH 08/10] Height and width flipped. --- src/engine/InterestManagement/Terrain.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 8c98d117..6db45144 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -53,8 +53,8 @@ public class Terrain { this.terrain_size.x = this.zone.major_radius * 2; this.terrain_size.y = this.zone.minor_radius * 2; - this.cell_count.x = this.terrain_pixel_data.length - 1; - this.cell_count.y = this.terrain_pixel_data[0].length - 1; + this.cell_count.x = this.terrain_pixel_data[0].length - 1; + this.cell_count.y = this.terrain_pixel_data.length - 1; this.cell_size.x = terrain_size.x / this.cell_count.x; this.cell_size.y = terrain_size.y / this.cell_count.y; From 7e99e8c7a4c9f9dfa964bf5b62a3a03a80771ae8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 12 Nov 2023 11:13:27 -0500 Subject: [PATCH 09/10] Height and width flipped. --- src/engine/InterestManagement/Terrain.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 6db45144..8c98d117 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -53,8 +53,8 @@ public class Terrain { this.terrain_size.x = this.zone.major_radius * 2; this.terrain_size.y = this.zone.minor_radius * 2; - this.cell_count.x = this.terrain_pixel_data[0].length - 1; - this.cell_count.y = this.terrain_pixel_data.length - 1; + this.cell_count.x = this.terrain_pixel_data.length - 1; + this.cell_count.y = this.terrain_pixel_data[0].length - 1; this.cell_size.x = terrain_size.x / this.cell_count.x; this.cell_size.y = terrain_size.y / this.cell_count.y; From eb5bc1497483943357043422b9b91d0587d75419 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 12 Nov 2023 11:21:30 -0500 Subject: [PATCH 10/10] Revert needs new branch. --- src/engine/InterestManagement/Terrain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 8c98d117..abd0e638 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -84,7 +84,7 @@ public class Terrain { // Scale coefficient for this terrain - this.terrain_scale = this.zone.template.terrain_max_y / 256f; + this.terrain_scale = this.zone.template.terrain_max_y / 255f; } public static Zone getNextZoneWithTerrain(Zone zone) {