|
|
@ -11,6 +11,7 @@ package engine.objects; |
|
|
|
|
|
|
|
|
|
|
|
import engine.gameManager.BuildingManager; |
|
|
|
import engine.gameManager.BuildingManager; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
|
|
|
|
import engine.math.Quaternion; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
@ -25,9 +26,8 @@ public class BuildingLocation extends AbstractGameObject { |
|
|
|
private final int type; |
|
|
|
private final int type; |
|
|
|
private final int slot; |
|
|
|
private final int slot; |
|
|
|
private final int unknown; |
|
|
|
private final int unknown; |
|
|
|
private final Vector3fImmutable loc; |
|
|
|
private final Vector3fImmutable location; |
|
|
|
private final Vector3fImmutable rot; |
|
|
|
private final Quaternion rotation; |
|
|
|
private final float w; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -39,9 +39,8 @@ public class BuildingLocation extends AbstractGameObject { |
|
|
|
this.type = rs.getInt("type"); |
|
|
|
this.type = rs.getInt("type"); |
|
|
|
this.slot = rs.getInt("slot"); |
|
|
|
this.slot = rs.getInt("slot"); |
|
|
|
this.unknown = rs.getInt("unknown"); |
|
|
|
this.unknown = rs.getInt("unknown"); |
|
|
|
this.loc = new Vector3fImmutable(rs.getFloat("locX"), rs.getFloat("locY"), rs.getFloat("locZ")); |
|
|
|
this.location = new Vector3fImmutable(rs.getFloat("locX"), rs.getFloat("locY"), rs.getFloat("locZ")); |
|
|
|
this.rot = new Vector3fImmutable(rs.getFloat("rotX"), rs.getFloat("rotY"), rs.getFloat("rotZ")); |
|
|
|
this.rotation = new Quaternion(rs.getFloat("rotX"), rs.getFloat("rotY"), rs.getFloat("rotZ"), rs.getFloat("w")); |
|
|
|
this.w = rs.getFloat("w"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -52,24 +51,6 @@ public class BuildingLocation extends AbstractGameObject { |
|
|
|
return this.buildingUUID; |
|
|
|
return this.buildingUUID; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Vector3fImmutable rotatedLoc() { |
|
|
|
|
|
|
|
Vector3fImmutable convertLoc = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double rotY = 2.0 * Math.asin(this.rot.y); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// handle building rotation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
convertLoc = new Vector3fImmutable( |
|
|
|
|
|
|
|
(float) ((loc.z * Math.sin(rotY)) + (loc.x * Math.cos(rotY))), |
|
|
|
|
|
|
|
loc.y, |
|
|
|
|
|
|
|
(float) ((loc.z * Math.cos(rotY)) - (loc.x * Math.sin(rotY)))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return convertLoc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getType() { |
|
|
|
public int getType() { |
|
|
|
return this.type; |
|
|
|
return this.type; |
|
|
|
} |
|
|
|
} |
|
|
@ -83,42 +64,22 @@ public class BuildingLocation extends AbstractGameObject { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public float getLocX() { |
|
|
|
public float getLocX() { |
|
|
|
return this.loc.x; |
|
|
|
return this.location.x; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public float getLocY() { |
|
|
|
public float getLocY() { |
|
|
|
return this.loc.y; |
|
|
|
return this.location.y; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public float getLocZ() { |
|
|
|
|
|
|
|
return this.loc.z; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getRotX() { |
|
|
|
|
|
|
|
return this.rot.x; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getRotY() { |
|
|
|
|
|
|
|
return this.rot.y; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getRotZ() { |
|
|
|
|
|
|
|
return this.rot.z; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getW() { |
|
|
|
|
|
|
|
return this.w; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Vector3fImmutable getLoc() { |
|
|
|
public Vector3fImmutable getLocation() { |
|
|
|
return this.loc; |
|
|
|
return this.location; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Vector3fImmutable getRot() { |
|
|
|
public Quaternion getRotation() { |
|
|
|
return this.rot; |
|
|
|
return this.rotation; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void updateDatabase() { |
|
|
|
public void updateDatabase() { |
|
|
|
} |
|
|
|
} |
|
|
@ -141,7 +102,7 @@ public class BuildingLocation extends AbstractGameObject { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Add location to the collection in BuildingManager
|
|
|
|
// Add location to collection in BuildingManager
|
|
|
|
|
|
|
|
|
|
|
|
if (locationCollection.containsKey(buildingLocation.buildingUUID)) |
|
|
|
if (locationCollection.containsKey(buildingLocation.buildingUUID)) |
|
|
|
locationCollection.get(buildingLocation.buildingUUID).add(buildingLocation); |
|
|
|
locationCollection.get(buildingLocation.buildingUUID).add(buildingLocation); |
|
|
|