diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 1e56b046..50f2cf0a 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -97,12 +97,14 @@ public class HeightMap { // Calculate the data we do not load from table - try { - calculateBucketWidth(); + float numOfBuckets = this.heightmapImage.getWidth() - 1; + float calculatedWidth = this.fullExtentsX / numOfBuckets; + this.bucketWidthX = calculatedWidth; - } catch (Exception e) { - e.printStackTrace(); - } + numOfBuckets = this.heightmapImage.getHeight() - 1; + calculatedWidth = this.fullExtentsY / numOfBuckets; + + this.bucketWidthY = calculatedWidth; // This makes no sense. // Generate pixel array from image data @@ -674,381 +676,6 @@ public class HeightMap { return (color / 256) * this.maxHeight; } - - private void calculateBucketWidth() { - - - switch (this.zoneLoadID) { - case 100: - this.bucketWidthX = 64.12524414f; - this.bucketWidthY = 64.12524414f; - break; - case 200: - this.bucketWidthX = 145.9599152f; - this.bucketWidthY = 145.9599152f; - break; - case 3033: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3011: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3026: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3017: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3007: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3020: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3025: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3016: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3021: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3018: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3024: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3010: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3012: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3022: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3030: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3019: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3014: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 10500: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10501: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10503: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 10504: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 10505: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 10506: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 10507: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 10502: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 11006: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 11008: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 11036: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10200: - this.bucketWidthX = 2.000977039f; - this.bucketWidthY = 2.000977039f; - break; - - - case 10120: - this.bucketWidthX = 1.00048852f; - this.bucketWidthY = 1.00048852f; - break; - - case 10001: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10002: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10003: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10004: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10005: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10100: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - - case 10006: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10007: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10008: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10009: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - - case 10010: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - - case 10201: - this.bucketWidthX = 2.000977039f; - this.bucketWidthY = 2.000977039f; - break; - - case 10011: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10012: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10013: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10014: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - case 10015: - this.bucketWidthX = 17.06666756f; - this.bucketWidthY = 17.06666756f; - break; - - case 3004: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3005: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - - case 3003: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - - case 400: - this.bucketWidthX = 64.06256104f; - this.bucketWidthY = 64.06256104f; - break; - - case 3032: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3009: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - case 3023: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - case 3008: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - case 11009: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - case 500: - this.bucketWidthX = 128.4012604f; - this.bucketWidthY = 128.4012604f; - break; - - case 3013: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - case 3006: - this.bucketWidthX = 2.001116753f; - this.bucketWidthY = 2.001116753f; - break; - - case 3015: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 11010: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10130: - this.bucketWidthX = 1.00048852f; - this.bucketWidthY = 1.00048852f; - break; - - - case 501: - this.bucketWidthX = 130.0317535f; - this.bucketWidthY = 130.0317535f; - break; - - case 11032: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 300: - this.bucketWidthX = 100.5235596f; - this.bucketWidthY = 100.5235596f; - break; - - case 3027: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3028: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 11016: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 310: - this.bucketWidthX = 100.5235596f; - this.bucketWidthY = 100.5235596f; - break; - - case 3034: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 3035: - this.bucketWidthX = 4.003910065f; - this.bucketWidthY = 4.003910065f; - break; - - case 11039: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10066: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 10401: - this.bucketWidthX = 51.20000076f; - this.bucketWidthY = 51.20000076f; - break; - - case 502: - this.bucketWidthX = 130.0317535f; - this.bucketWidthY = 130.0317535f; - break; - - default: - // Re-enable for debugging. Spammy in console. - // Logger.info("Setting Zone : " + this.zoneLoadID + " with heightmap ID : " + heightMapID + " to default bucketwidth"); - break; - } - } - public static void loadAlHeightMaps() { // Load the heightmaps into staging hashmap keyed by HashMapID