Browse Source

Guild zone performance tweak

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
cbd8685d4b
  1. 13
      src/engine/InterestManagement/Terrain.java
  2. 11
      src/engine/util/MapLoader.java

13
src/engine/InterestManagement/Terrain.java

@ -35,14 +35,10 @@ public class Terrain { @@ -35,14 +35,10 @@ public class Terrain {
this.heightmap = this.zone.terrain_image;
// Configure PLANAR zones to use the same 16x16 pixel image
// that all similar terrains share. (See JSON) Guild zones
// use an inverted clone of this heightmap.
// that all similar terrains share. (See JSON)
if (this.zone.terrain_type.equals("PLANAR"))
if (this.zone.guild_zone)
this.heightmap = 1006301; // all 255
else
this.heightmap = 1006300; // all 0
this.heightmap = 1006301; // all 255
// Load pixel data for this terrain from cache
@ -170,6 +166,11 @@ public class Terrain { @@ -170,6 +166,11 @@ public class Terrain {
float interpolatedHeight;
// Early exit for guild zones
if (this.zone.guild_zone)
return 5.0f;
Vector2f terrain_cell = getTerrainCell(terrain_loc);
int pixel_x = (int) Math.floor(terrain_cell.x);

11
src/engine/util/MapLoader.java

@ -18,7 +18,6 @@ import java.io.IOException; @@ -18,7 +18,6 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.stream.Stream;
public enum MapLoader {
@ -138,16 +137,6 @@ public enum MapLoader { @@ -138,16 +137,6 @@ public enum MapLoader {
}); // Try with resources block
// Generate full white alternate to 1600300
// Declare and initialize an array of short[16][16]
short[][] heightMapEntry = new short[16][16];
for (short[] shorts : heightMapEntry)
Arrays.fill(shorts, (short) 255);
Terrain._heightmap_pixel_cache.put(1006301, heightMapEntry);
} catch (IOException e) {
Logger.error(e);
}

Loading…
Cancel
Save