| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -44,17 +44,17 @@ public class HeightMap { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public BufferedImage heightmapImage; | 
					 | 
					 | 
					 | 
					    public BufferedImage heightmapImage; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int heightMapID; | 
					 | 
					 | 
					 | 
					    private final int heightMapID; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int maxHeight; | 
					 | 
					 | 
					 | 
					    private final int maxHeight; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int fullExtentsX; | 
					 | 
					 | 
					 | 
					    private final int fullExtentsX; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int fullExtentsY; | 
					 | 
					 | 
					 | 
					    private final int fullExtentsY; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float bucketWidthX; | 
					 | 
					 | 
					 | 
					    private float bucketWidthX; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float bucketWidthY; | 
					 | 
					 | 
					 | 
					    private float bucketWidthY; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int zoneLoadID; | 
					 | 
					 | 
					 | 
					    private final int zoneLoadID; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float seaLevel = 0; | 
					 | 
					 | 
					 | 
					    private float seaLevel = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float outsetX; | 
					 | 
					 | 
					 | 
					    private final float outsetX; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float outsetZ; | 
					 | 
					 | 
					 | 
					    private final float outsetZ; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int[][] pixelColorValues; | 
					 | 
					 | 
					 | 
					    private int[][] pixelColorValues; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public HeightMap(ResultSet rs) throws SQLException { | 
					 | 
					 | 
					 | 
					    public HeightMap(ResultSet rs) throws SQLException { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -87,7 +87,7 @@ public class HeightMap { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        try { | 
					 | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.heightmapImage = ImageIO.read(imageFile); | 
					 | 
					 | 
					 | 
					            this.heightmapImage = ImageIO.read(imageFile); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } catch (IOException e) { | 
					 | 
					 | 
					 | 
					        } 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.
 | 
					 | 
					 | 
					 | 
					        // 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 { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        float localAltitude = HeightMap.getWorldHeight(currentLoc); | 
					 | 
					 | 
					 | 
					        float localAltitude = HeightMap.getWorldHeight(currentLoc); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Zone zone = ZoneManager.findSmallestZone(currentLoc); | 
					 | 
					 | 
					 | 
					        Zone zone = ZoneManager.findSmallestZone(currentLoc); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (localAltitude < zone.getSeaLevel()) | 
					 | 
					 | 
					 | 
					        return localAltitude < zone.getSeaLevel(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return true; | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    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) { | 
					 | 
					 | 
					 | 
					    public Vector2f getGridSquare(Vector2f zoneLoc) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -423,24 +438,6 @@ public class HeightMap { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return interpolatedHeight; | 
					 | 
					 | 
					 | 
					        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() { | 
					 | 
					 | 
					 | 
					    public float getBucketWidthX() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return bucketWidthX; | 
					 | 
					 | 
					 | 
					        return bucketWidthX; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |