Browse Source

Reformat file.

combat-2
MagicBot 1 year ago
parent
commit
2af08d6823
  1. 55
      src/engine/InterestManagement/HeightMap.java

55
src/engine/InterestManagement/HeightMap.java

@ -44,17 +44,17 @@ public class HeightMap { @@ -44,17 +44,17 @@ public class HeightMap {
public BufferedImage heightmapImage;
private int heightMapID;
private int maxHeight;
private int fullExtentsX;
private int fullExtentsY;
private final int heightMapID;
private final int maxHeight;
private final int fullExtentsX;
private final int fullExtentsY;
private float bucketWidthX;
private float bucketWidthY;
private int zoneLoadID;
private final int zoneLoadID;
private float seaLevel = 0;
private float outsetX;
private float outsetZ;
private final float outsetX;
private final float outsetZ;
private int[][] pixelColorValues;
public HeightMap(ResultSet rs) throws SQLException {
@ -87,7 +87,7 @@ public class HeightMap { @@ -87,7 +87,7 @@ public class HeightMap {
try {
this.heightmapImage = ImageIO.read(imageFile);
} catch (IOException e) {
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e);
}
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
@ -334,10 +334,25 @@ public class HeightMap { @@ -334,10 +334,25 @@ public class HeightMap {
float localAltitude = HeightMap.getWorldHeight(currentLoc);
Zone zone = ZoneManager.findSmallestZone(currentLoc);
if (localAltitude < zone.getSeaLevel())
return true;
return localAltitude < zone.getSeaLevel();
}
private static void generatePixelData(HeightMap heightMap) {
Color color;
// Generate altitude lookup table for this heightmap
heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()];
for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
color = new Color(heightMap.heightmapImage.getRGB(x, y));
heightMap.pixelColorValues[x][y] = color.getRed();
}
}
return false;
}
public Vector2f getGridSquare(Vector2f zoneLoc) {
@ -423,24 +438,6 @@ public class HeightMap { @@ -423,24 +438,6 @@ public class HeightMap {
return interpolatedHeight;
}
private static void generatePixelData(HeightMap heightMap) {
Color color;
// Generate altitude lookup table for this heightmap
heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()];
for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
color = new Color(heightMap.heightmapImage.getRGB(x, y));
heightMap.pixelColorValues[x][y] = color.getRed();
}
}
}
public float getBucketWidthX() {
return bucketWidthX;
}

Loading…
Cancel
Save