From f1a2bea67c85125dbb4a66d48aad14591683cc61 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 17 Oct 2023 07:56:31 -0400 Subject: [PATCH] Pixel values are shorts for memory --- src/engine/InterestManagement/Terrain.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 16a6a4a2..1bf98daa 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -172,6 +172,8 @@ public class Terrain { if (this.zone.guild_zone) return 5.0f; + // Determine terrain and offset from top left vertex + Vector2f terrain_cell = getTerrainCell(terrain_loc); int pixel_x = (int) Math.floor(terrain_cell.x); @@ -181,10 +183,10 @@ public class Terrain { // 4 surrounding vertices from the pixel array. - float top_left_pixel = terrain_pixel_data[pixel_x][pixel_y]; - float top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y]; - float bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1]; - float bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1]; + short top_left_pixel = terrain_pixel_data[pixel_x][pixel_y]; + short top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y]; + short bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1]; + short bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1]; // Interpolate between the 4 vertices