Browse Source

Blending configuration setup in SetParent()

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
a3a3070158
  1. 4
      src/engine/InterestManagement/HeightMap.java
  2. 17
      src/engine/objects/Zone.java

4
src/engine/InterestManagement/HeightMap.java

@ -55,8 +55,8 @@ public class HeightMap {
private float seaLevel = 0; private float seaLevel = 0;
private int[][] pixelColorValues; private int[][] pixelColorValues;
private float zone_minBlend; public float zone_minBlend;
private float zone_maxBlend; public float zone_maxBlend;
public HeightMap(ResultSet rs) throws SQLException { public HeightMap(ResultSet rs) throws SQLException {

17
src/engine/objects/Zone.java

@ -60,6 +60,10 @@ public class Zone extends AbstractGameObject {
private float seaLevel = 0f; private float seaLevel = 0f;
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
public static long lastRespawn = 0; public static long lastRespawn = 0;
public Bounds minBlend;
public Bounds maxBlend;
/** /**
* ResultSet Constructor * ResultSet Constructor
*/ */
@ -162,9 +166,6 @@ public class Zone extends AbstractGameObject {
*/ */
public void setBounds() { public void setBounds() {
float halfExtentX;
float halfExtentY;
// Set initial bounds object // Set initial bounds object
this.bounds = Bounds.borrow(); this.bounds = Bounds.borrow();
@ -185,6 +186,16 @@ public class Zone extends AbstractGameObject {
else else
bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f); bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f);
HeightMap heightMap = this.getHeightMap();
// Set heightmap blending bounds
if (heightMap != null) {
this.minBlend = Bounds.borrow();
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f);
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
}
} }
public int getPlayerCityUUID() { public int getPlayerCityUUID() {

Loading…
Cancel
Save