Browse Source

Comment cleanup

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
fff16d2211
  1. 23
      src/engine/gameManager/ZoneManager.java

23
src/engine/gameManager/ZoneManager.java

@ -298,8 +298,6 @@ public enum ZoneManager {
localCoords = new Vector2f(worldLoc.x, worldLoc.z); localCoords = new Vector2f(worldLoc.x, worldLoc.z);
localCoords = localCoords.subtract(zoneOrigin); localCoords = localCoords.subtract(zoneOrigin);
// TODO : Make sure this value does not go outside the zone's bounds.
return localCoords; return localCoords;
} }
@ -320,9 +318,10 @@ public enum ZoneManager {
if (building.getBounds().getQuaternion() == null) if (building.getBounds().getQuaternion() == null)
return building.getLoc(); return building.getLoc();
// handle building rotation
Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion()); Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion());
// handle building rotation
// handle building translation // handle building translation
return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z); return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z);
@ -332,12 +331,10 @@ public enum ZoneManager {
//used for regions, Building bounds not set yet. //used for regions, Building bounds not set yet.
public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) { public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) {
// convert from SB rotation value to radians // handle building rotation
Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion()); Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion());
// handle building rotation
// handle building translation // handle building translation
return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z)); return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z));
@ -360,8 +357,6 @@ public enum ZoneManager {
public static City getCityAtLocation(Vector3fImmutable worldLoc) { public static City getCityAtLocation(Vector3fImmutable worldLoc) {
Zone currentZone; Zone currentZone;
ArrayList<Zone> zoneList;
City city;
currentZone = ZoneManager.findSmallestZone(worldLoc); currentZone = ZoneManager.findSmallestZone(worldLoc);
@ -408,27 +403,27 @@ public enum ZoneManager {
public static float calculateGlobalZoneHeight(Zone zone) { public static float calculateGlobalZoneHeight(Zone zone) {
float worldAlttitude = MBServerStatics.SEA_FLOOR_ALTITUDE; float worldAltitude = MBServerStatics.SEA_FLOOR_ALTITUDE;
// Seafloor // Seafloor
if (ZoneManager.seaFloor.equals(zone)) if (ZoneManager.seaFloor.equals(zone))
return worldAlttitude; return worldAltitude;
// Children of seafloor // Children of seafloor
if (ZoneManager.seaFloor.equals(zone.parent)) if (ZoneManager.seaFloor.equals(zone.parent))
return worldAlttitude + zone.yOffset; return worldAltitude + zone.yOffset;
// return height from heightmap engine at zone location // return height from heightmap engine at zone location
worldAlttitude = Terrain.getWorldHeight(zone.parent, zone.getLoc()); worldAltitude = Terrain.getWorldHeight(zone.parent, zone.getLoc());
// Add zone offset to value // Add zone offset to value
worldAlttitude += zone.yOffset; worldAltitude += zone.yOffset;
return worldAlttitude; return worldAltitude;
} }
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) { public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {

Loading…
Cancel
Save