spring cleaning
This commit is contained in:
parent
de77ead36e
commit
aec9a58f12
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,7 +15,8 @@
|
||||
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
#want to allow .settings/org.eclipse.jdt.core.prefs
|
||||
#.settings
|
||||
|
||||
.dbeaver
|
||||
|
||||
|
||||
1
.settings/org.eclipse.jdt.core.prefs
Normal file
1
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1 @@
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
|
||||
@ -7,9 +7,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.ALC;
|
||||
//import org.lwjgl.openal.*;
|
||||
|
||||
@ -5,9 +5,7 @@ import electrosphere.controls.Control.ControlType;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.state.AttackTree;
|
||||
import electrosphere.entity.state.equip.EquipState;
|
||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||
import electrosphere.entity.state.ironsight.IronSightTree;
|
||||
@ -17,22 +15,15 @@ import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFa
|
||||
import electrosphere.entity.state.movement.GroundMovementTree.MovementTreeState;
|
||||
import electrosphere.entity.state.movement.SprintTree;
|
||||
import electrosphere.entity.types.camera.CameraEntityUtils;
|
||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
import electrosphere.game.client.targeting.crosshair.Crosshair;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.main.Globals;
|
||||
import electrosphere.main.Main;
|
||||
import electrosphere.menu.WindowStrings;
|
||||
import electrosphere.menu.WindowUtils;
|
||||
import electrosphere.menu.MenuCallbacks;
|
||||
import electrosphere.menu.MenuGenerators;
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
import electrosphere.renderer.ui.DrawableElement;
|
||||
import electrosphere.renderer.ui.Element;
|
||||
import electrosphere.renderer.ui.Window;
|
||||
import electrosphere.renderer.ui.events.ClickEvent;
|
||||
import electrosphere.renderer.ui.events.DragEvent;
|
||||
import electrosphere.renderer.ui.events.KeyboardEvent;
|
||||
import electrosphere.renderer.ui.events.MouseEvent;
|
||||
|
||||
@ -47,7 +38,6 @@ import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetMouseButton;
|
||||
import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
|
||||
|
||||
/**
|
||||
@ -644,7 +634,7 @@ public class ControlHandler {
|
||||
mainGameControlList.add(controls.get(INPUT_CODE_INTERACT));
|
||||
controls.get(INPUT_CODE_INTERACT).setOnPress(new ControlMethod(){public void execute(){
|
||||
if(Globals.playerCharacter != null){
|
||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){
|
||||
if(Globals.playerCharacter.containsKey(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){
|
||||
if(InventoryUtils.hasNaturalInventory(Globals.playerCharacter)){
|
||||
InventoryUtils.attemptStoreItem(Globals.playerCharacter, Crosshair.getTarget());
|
||||
// UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter);
|
||||
@ -662,7 +652,7 @@ public class ControlHandler {
|
||||
mainGameControlList.add(controls.get(INPUT_CODE_DROP));
|
||||
controls.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(){
|
||||
if(Globals.playerCharacter != null){
|
||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){
|
||||
if(Globals.playerCharacter.containsKey(EntityDataStrings.EQUIP_STATE)){
|
||||
// EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
|
||||
// equipState.drop();
|
||||
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter);
|
||||
|
||||
@ -20,9 +20,6 @@ public class Entity {
|
||||
|
||||
HashMap<String,Object> data;
|
||||
|
||||
LinkedList<String> dataKeys;
|
||||
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@ -38,11 +35,6 @@ public class Entity {
|
||||
|
||||
public void putData(String key, Object o){
|
||||
data.put(key,o);
|
||||
dataKeys.add(key);
|
||||
}
|
||||
|
||||
public List<String> getDataKeys(){
|
||||
return dataKeys;
|
||||
}
|
||||
|
||||
public boolean containsKey(String key){
|
||||
@ -55,7 +47,6 @@ public class Entity {
|
||||
|
||||
public Entity(){
|
||||
data = new HashMap<String,Object>();
|
||||
dataKeys = new LinkedList<String>();
|
||||
while(Globals.entityManager.getEntityFromId(entity_id_iterator)!=null){
|
||||
entity_id_iterator++;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.main.Globals;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import org.joml.Vector3d;
|
||||
@ -18,24 +19,24 @@ import org.joml.Vector3f;
|
||||
public class EntityManager {
|
||||
|
||||
|
||||
static ConcurrentHashMap entityIdMap = new ConcurrentHashMap();
|
||||
static CopyOnWriteArrayList<Entity> entityList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> drawableList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> moveableList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> lightList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> uiList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> itemList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> boneAttachedList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> attackerList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> creatureList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> lifeStateList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> particleList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> gravityList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> collidableList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> targetableList = new CopyOnWriteArrayList();
|
||||
static CopyOnWriteArrayList<Entity> sprintableList = new CopyOnWriteArrayList();
|
||||
static Map<Integer,Entity> entityIdMap = new ConcurrentHashMap<Integer,Entity>();
|
||||
static List<Entity> entityList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> drawableList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> moveableList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> lightList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> uiList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> itemList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> boneAttachedList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> attackerList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> creatureList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> lifeStateList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> particleList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> gravityList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> collidableList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> targetableList = new CopyOnWriteArrayList<Entity>();
|
||||
static List<Entity> sprintableList = new CopyOnWriteArrayList<Entity>();
|
||||
|
||||
static CopyOnWriteArrayList<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>();
|
||||
static List<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>();
|
||||
|
||||
public EntityManager(){
|
||||
|
||||
@ -50,7 +51,7 @@ public class EntityManager {
|
||||
drawableList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getDrawable(){
|
||||
public List<Entity> getDrawable(){
|
||||
return drawableList;
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ public class EntityManager {
|
||||
moveableList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getMoveable(){
|
||||
public List<Entity> getMoveable(){
|
||||
return moveableList;
|
||||
}
|
||||
|
||||
@ -66,7 +67,7 @@ public class EntityManager {
|
||||
lightList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getLights(){
|
||||
public List<Entity> getLights(){
|
||||
return lightList;
|
||||
}
|
||||
|
||||
@ -74,7 +75,7 @@ public class EntityManager {
|
||||
uiList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getUIElements(){
|
||||
public List<Entity> getUIElements(){
|
||||
return uiList;
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ public class EntityManager {
|
||||
itemList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getItemEntities(){
|
||||
public List<Entity> getItemEntities(){
|
||||
return itemList;
|
||||
}
|
||||
|
||||
@ -90,7 +91,7 @@ public class EntityManager {
|
||||
boneAttachedList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getBoneAttachedEntities(){
|
||||
public List<Entity> getBoneAttachedEntities(){
|
||||
return boneAttachedList;
|
||||
}
|
||||
|
||||
@ -98,7 +99,7 @@ public class EntityManager {
|
||||
attackerList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getAttackerEntities(){
|
||||
public List<Entity> getAttackerEntities(){
|
||||
return attackerList;
|
||||
}
|
||||
|
||||
@ -106,7 +107,7 @@ public class EntityManager {
|
||||
creatureList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getCreatureEntities(){
|
||||
public List<Entity> getCreatureEntities(){
|
||||
return creatureList;
|
||||
}
|
||||
|
||||
@ -114,7 +115,7 @@ public class EntityManager {
|
||||
lifeStateList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getLifeStateEntities(){
|
||||
public List<Entity> getLifeStateEntities(){
|
||||
return lifeStateList;
|
||||
}
|
||||
|
||||
@ -122,7 +123,7 @@ public class EntityManager {
|
||||
particleList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getParticles(){
|
||||
public List<Entity> getParticles(){
|
||||
return particleList;
|
||||
}
|
||||
|
||||
@ -130,7 +131,7 @@ public class EntityManager {
|
||||
gravityList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getGravityEntities(){
|
||||
public List<Entity> getGravityEntities(){
|
||||
return gravityList;
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ public class EntityManager {
|
||||
collidableList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getCollidables(){
|
||||
public List<Entity> getCollidables(){
|
||||
return collidableList;
|
||||
}
|
||||
|
||||
@ -146,7 +147,7 @@ public class EntityManager {
|
||||
targetableList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getTargetables(){
|
||||
public List<Entity> getTargetables(){
|
||||
return targetableList;
|
||||
}
|
||||
|
||||
@ -154,7 +155,7 @@ public class EntityManager {
|
||||
sprintableList.add(e);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Entity> getSprintables(){
|
||||
public List<Entity> getSprintables(){
|
||||
return sprintableList;
|
||||
}
|
||||
|
||||
@ -249,7 +250,7 @@ public class EntityManager {
|
||||
|
||||
public void overrideEntityId(Entity e, int id){
|
||||
LoggerInterface.loggerGameLogic.DEBUG("Overriding entity ID " + e.getId() + " => " + id);
|
||||
if(entityIdMap.contains(e.getId())){
|
||||
if(entityIdMap.containsKey(e.getId())){
|
||||
entityIdMap.remove(e.getId());
|
||||
}
|
||||
e.setId(id);
|
||||
@ -267,7 +268,7 @@ public class EntityManager {
|
||||
int playerCharacterWorldY = Globals.commonWorldData.convertRealToWorld(playerCharacterPos.z);
|
||||
if(playerCharacterWorldX != Globals.clientPlayerData.getWorldPositionX() || playerCharacterWorldY != Globals.clientPlayerData.getWorldPositionY()){
|
||||
for(Entity entity : entityList){
|
||||
if(entity.getDataKeys().contains(EntityDataStrings.TERRAIN_IS_TERRAIN) || entity.getDataKeys().contains(EntityDataStrings.ATTACH_PARENT) || entity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_PARENT)){
|
||||
if(entity.containsKey(EntityDataStrings.TERRAIN_IS_TERRAIN) || entity.containsKey(EntityDataStrings.ATTACH_PARENT) || entity.containsKey(EntityDataStrings.COLLISION_ENTITY_PARENT)){
|
||||
|
||||
} else {
|
||||
Vector3d position = EntityUtils.getPosition(entity);
|
||||
|
||||
@ -57,13 +57,13 @@ public class IdleTree {
|
||||
public void simulate(){
|
||||
Actor entityActor = EntityUtils.getActor(parent);
|
||||
|
||||
boolean hasMovementTree = parent.getDataKeys().contains(EntityDataStrings.DATA_STRING_MOVEMENT_BT);
|
||||
boolean hasMovementTree = parent.containsKey(EntityDataStrings.DATA_STRING_MOVEMENT_BT);
|
||||
GroundMovementTree movementTree = null;
|
||||
if(hasMovementTree){
|
||||
movementTree = CreatureUtils.getEntityMovementTree(parent);
|
||||
}
|
||||
|
||||
boolean hasAttackTree = parent.getDataKeys().contains(EntityDataStrings.ATTACK_TREE);
|
||||
boolean hasAttackTree = parent.containsKey(EntityDataStrings.ATTACK_TREE);
|
||||
AttackTree attackTree = null;
|
||||
if(hasAttackTree){
|
||||
attackTree = CreatureUtils.getAttackTree(parent);
|
||||
|
||||
@ -63,13 +63,13 @@ public class CollidableTree {
|
||||
// System.out.println("Position: " + position);
|
||||
}
|
||||
if(impulse.type.matches(Collidable.TYPE_ITEM)){
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.GRAVITY_TREE)){
|
||||
if(parent.containsKey(EntityDataStrings.GRAVITY_TREE)){
|
||||
((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start();
|
||||
}
|
||||
}
|
||||
if(impulse.type.matches(Collidable.TYPE_CREATURE)){
|
||||
// System.out.println(System.currentTimeMillis() + " creature hit!");
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.GRAVITY_TREE)){
|
||||
if(parent.containsKey(EntityDataStrings.GRAVITY_TREE)){
|
||||
((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class EquipState {
|
||||
//attach to parent bone
|
||||
AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone());
|
||||
//make uncollidable
|
||||
if(toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||
Globals.collisionEngine.deregisterPhysicsObject(rigidBody);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class EquipState {
|
||||
//since we're not replacing meshes we must be attaching to a bone
|
||||
equipMap.put(point.getEquipPointId(),toEquip);
|
||||
AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone());
|
||||
if(toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||
Globals.collisionEngine.deregisterPhysicsObject(rigidBody);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import electrosphere.main.Globals;
|
||||
import electrosphere.net.parser.net.message.EntityMessage;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3d;
|
||||
@ -42,7 +43,7 @@ public class GravityTree {
|
||||
CollisionObject body;
|
||||
Collidable collidable;
|
||||
|
||||
CopyOnWriteArrayList<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList();
|
||||
List<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
|
||||
|
||||
public GravityTree(Entity e, Collidable collidable, CollisionObject body, int fallFrame){
|
||||
state = GravityTreeState.ACTIVE;
|
||||
|
||||
@ -6,14 +6,14 @@ import electrosphere.entity.EntityDataStrings;
|
||||
public class GravityUtils {
|
||||
|
||||
public static void attemptActivateGravity(Entity target){
|
||||
if(target.getDataKeys().contains(EntityDataStrings.GRAVITY_ENTITY)){
|
||||
if(target.containsKey(EntityDataStrings.GRAVITY_ENTITY)){
|
||||
GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE);
|
||||
tree.start();
|
||||
}
|
||||
}
|
||||
|
||||
public static void attemptDeactivateGravity(Entity target){
|
||||
if(target.getDataKeys().contains(EntityDataStrings.GRAVITY_ENTITY)){
|
||||
if(target.containsKey(EntityDataStrings.GRAVITY_ENTITY)){
|
||||
GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE);
|
||||
tree.stop();
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public class InventoryUtils {
|
||||
|
||||
|
||||
public static boolean hasNaturalInventory(Entity target){
|
||||
return target.getDataKeys().contains(EntityDataStrings.NATURAL_INVENTORY);
|
||||
return target.containsKey(EntityDataStrings.NATURAL_INVENTORY);
|
||||
}
|
||||
|
||||
public static UnrelationalInventoryState getNaturalInventory(Entity target){
|
||||
@ -24,7 +24,7 @@ public class InventoryUtils {
|
||||
}
|
||||
|
||||
public static boolean hasEquipInventory(Entity target){
|
||||
return target.getDataKeys().contains(EntityDataStrings.EQUIP_INVENTORY);
|
||||
return target.containsKey(EntityDataStrings.EQUIP_INVENTORY);
|
||||
}
|
||||
|
||||
public static RelationalInventoryState getEquipInventory(Entity target){
|
||||
|
||||
@ -93,7 +93,6 @@ public class GroundMovementTree {
|
||||
}
|
||||
|
||||
public void start(MovementRelativeFacing facing){
|
||||
//TODO: check if can start moving
|
||||
if(canStartMoving()){
|
||||
this.facing = facing;
|
||||
state = MovementTreeState.STARTUP;
|
||||
@ -490,7 +489,7 @@ public class GroundMovementTree {
|
||||
|
||||
public boolean canStartMoving(){
|
||||
boolean rVal = true;
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.ATTACK_TREE) && ((AttackTree)parent.getData(EntityDataStrings.ATTACK_TREE)).getState() != AttackTreeState.IDLE){
|
||||
if(parent.containsKey(EntityDataStrings.ATTACK_TREE) && ((AttackTree)parent.getData(EntityDataStrings.ATTACK_TREE)).getState() != AttackTreeState.IDLE){
|
||||
rVal = false;
|
||||
}
|
||||
return rVal;
|
||||
|
||||
@ -9,6 +9,8 @@ import electrosphere.renderer.Model;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3d;
|
||||
@ -26,7 +28,7 @@ public class AttachUtils {
|
||||
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName);
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
getChildrenList(parent).add(toAttach);
|
||||
} else {
|
||||
LinkedList<Entity> childrenEntities = new LinkedList<Entity> ();
|
||||
@ -64,18 +66,15 @@ public class AttachUtils {
|
||||
public static void detatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
||||
Globals.entityManager.registerBoneAttachedEntity(toAttach);
|
||||
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
||||
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_PARENT);
|
||||
toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE);
|
||||
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_TARGET_BONE);
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
getChildrenList(parent).remove(toAttach);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAttached(Entity e){
|
||||
return e.getDataKeys().contains(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||
return e.containsKey(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||
}
|
||||
|
||||
public static String getTargetBone(Entity e){
|
||||
@ -87,7 +86,7 @@ public class AttachUtils {
|
||||
}
|
||||
|
||||
public static boolean hasChildren(Entity e){
|
||||
return e.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty();
|
||||
return e.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty();
|
||||
}
|
||||
|
||||
public static LinkedList<Entity> getChildrenList(Entity e){
|
||||
@ -97,10 +96,10 @@ public class AttachUtils {
|
||||
public static void attachEntityToEntity(Entity parent, Entity child){
|
||||
child.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||
child.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
|
||||
getChildrenList(parent).add(child);
|
||||
} else {
|
||||
LinkedList<Entity> childrenEntities = new LinkedList();
|
||||
List<Entity> childrenEntities = new LinkedList<Entity>();
|
||||
childrenEntities.add(child);
|
||||
parent.putData(EntityDataStrings.ATTACH_CHILDREN_LIST, childrenEntities);
|
||||
}
|
||||
|
||||
@ -43,7 +43,6 @@ public class CameraEntityUtils {
|
||||
BehaviorTree entityTrackingTree = new BehaviorTree() {
|
||||
@Override
|
||||
public void simulate() {
|
||||
// TODO Auto-generated method stub
|
||||
if(toTrack != null){
|
||||
Vector3d entityPos = EntityUtils.getPosition(toTrack);
|
||||
CameraEntityUtils.setCameraCenter(rVal, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(getOrbitalCameraRadialOffset(rVal)));
|
||||
|
||||
@ -406,11 +406,11 @@ public class CreatureUtils {
|
||||
}
|
||||
|
||||
public static boolean hasControllerPlayerId(Entity e){
|
||||
return e.getDataKeys().contains(EntityDataStrings.DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID);
|
||||
return e.containsKey(EntityDataStrings.DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID);
|
||||
}
|
||||
|
||||
public static boolean isCreature(Entity e){
|
||||
return e.getDataKeys().contains(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE);
|
||||
return e.containsKey(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE);
|
||||
}
|
||||
|
||||
public static AttackTree getAttackTree(Entity e){
|
||||
|
||||
@ -121,7 +121,7 @@ public class HitboxUtils {
|
||||
|
||||
//if the entity is attached to is an item, we need to compare with the parent of the item
|
||||
//to make sure you don't stab yourself for instance
|
||||
boolean isItem = hitboxParent.getDataKeys().contains(EntityDataStrings.ITEM_IS_ITEM);
|
||||
boolean isItem = hitboxParent.containsKey(EntityDataStrings.ITEM_IS_ITEM);
|
||||
Entity hitboxAttachParent = AttachUtils.getParent(hitboxParent);
|
||||
|
||||
if(isItem){
|
||||
|
||||
@ -168,19 +168,19 @@ public class ItemUtils {
|
||||
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE,collidable);
|
||||
rVal.putData(EntityDataStrings.COLLIDABLE_TREE, new CollidableTree(rVal,collidable,rigidBody));
|
||||
*/
|
||||
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY)){
|
||||
if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY)){
|
||||
item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||
}
|
||||
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET)){
|
||||
if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET)){
|
||||
item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET);
|
||||
}
|
||||
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_MODEL_TEMPLATE)){
|
||||
if(item.containsKey(EntityDataStrings.PHYSICS_MODEL_TEMPLATE)){
|
||||
item.removeData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE);
|
||||
}
|
||||
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
if(item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
item.removeData(EntityDataStrings.PHYSICS_COLLIDABLE);
|
||||
}
|
||||
if(item.getDataKeys().contains(EntityDataStrings.COLLIDABLE_TREE)){
|
||||
if(item.containsKey(EntityDataStrings.COLLIDABLE_TREE)){
|
||||
item.removeData(EntityDataStrings.COLLIDABLE_TREE);
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ public class ItemUtils {
|
||||
}
|
||||
|
||||
public static boolean isItem(Entity item){
|
||||
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_ITEM);
|
||||
return item.containsKey(EntityDataStrings.ITEM_IS_ITEM);
|
||||
}
|
||||
|
||||
public static String getType(Entity item){
|
||||
@ -221,15 +221,15 @@ public class ItemUtils {
|
||||
}
|
||||
|
||||
public static boolean isWeapon(Entity item){
|
||||
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_WEAPON);
|
||||
return item.containsKey(EntityDataStrings.ITEM_IS_WEAPON);
|
||||
}
|
||||
|
||||
public static boolean isArmor(Entity item){
|
||||
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_ARMOR);
|
||||
return item.containsKey(EntityDataStrings.ITEM_IS_ARMOR);
|
||||
}
|
||||
|
||||
public static boolean hasEquipList(Entity item){
|
||||
return item.getDataKeys().contains(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
||||
return item.containsKey(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
||||
}
|
||||
|
||||
public static List<EquipWhitelist> getEquipWhitelist(Entity item){
|
||||
@ -259,7 +259,7 @@ public class ItemUtils {
|
||||
public static void destroyInWorldItem(Entity item){
|
||||
if(isItem(item)){
|
||||
//destroy physics
|
||||
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
//destroy physics
|
||||
//this deregisters from all four & unhooks rigid bodies from the physics runtime
|
||||
Globals.collisionEngine.destroyEntityThatHasPhysics(item);
|
||||
|
||||
@ -51,7 +51,7 @@ public class StructureUtils {
|
||||
}
|
||||
|
||||
public static boolean isStructure(Entity entity){
|
||||
return entity.getDataKeys().contains(EntityDataStrings.STRUCTURE_IS_STRUCTURE);
|
||||
return entity.containsKey(EntityDataStrings.STRUCTURE_IS_STRUCTURE);
|
||||
}
|
||||
|
||||
public static String getType(Entity structure){
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.List;
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class ClientDataCell {
|
||||
List<Entity> entities = new LinkedList();
|
||||
List<Entity> entities = new LinkedList<Entity>();
|
||||
|
||||
|
||||
public ClientDataCell(){
|
||||
|
||||
@ -5,6 +5,8 @@ import electrosphere.game.server.terrain.models.TerrainModel;
|
||||
import electrosphere.game.terrain.processing.TerrainInterpolator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@ -21,8 +23,8 @@ public class ClientTerrainCache {
|
||||
|
||||
|
||||
int cacheSize;
|
||||
ConcurrentHashMap<String,float[][]> cacheMap = new ConcurrentHashMap();
|
||||
CopyOnWriteArrayList<String> cacheList = new CopyOnWriteArrayList();
|
||||
Map<String,float[][]> cacheMap = new ConcurrentHashMap<String,float[][]> ();
|
||||
List<String> cacheList = new CopyOnWriteArrayList<String>();
|
||||
|
||||
|
||||
public ClientTerrainCache(int cacheSize, ClientWorldData clientWorldData){
|
||||
|
||||
@ -19,7 +19,7 @@ public class LoadingChunk {
|
||||
|
||||
float[][] macroValues;
|
||||
long[][] randomizer;
|
||||
List<ChunkModification> modification = new ArrayList();
|
||||
List<ChunkModification> modification = new ArrayList<ChunkModification>();
|
||||
|
||||
public LoadingChunk(int worldX, int worldY, int numMessages, ClientWorldData clientWorldData){
|
||||
this.worldX = worldX;
|
||||
|
||||
@ -2,6 +2,8 @@ package electrosphere.game.client.terrain.cache;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@ -10,8 +12,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class LoadingChunkCache {
|
||||
ConcurrentHashMap<String,LoadingChunk> cacheMap = new ConcurrentHashMap();
|
||||
CopyOnWriteArrayList<String> cacheList = new CopyOnWriteArrayList();
|
||||
Map<String,LoadingChunk> cacheMap = new ConcurrentHashMap<String,LoadingChunk>();
|
||||
List<String> cacheList = new CopyOnWriteArrayList<String>();
|
||||
|
||||
|
||||
public LoadingChunkCache(){
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
public class ClientTerrainManager {
|
||||
|
||||
//queues messages from server
|
||||
CopyOnWriteArrayList<WorldMessage> messageQueue = new CopyOnWriteArrayList();
|
||||
List<WorldMessage> messageQueue = new CopyOnWriteArrayList<WorldMessage>();
|
||||
|
||||
|
||||
//caches chunks from server
|
||||
@ -37,7 +37,7 @@ public class ClientTerrainManager {
|
||||
|
||||
|
||||
public void handleMessages(){
|
||||
List<WorldMessage> bouncedMessages = new LinkedList();
|
||||
List<WorldMessage> bouncedMessages = new LinkedList<WorldMessage>();
|
||||
for(WorldMessage message : messageQueue){
|
||||
messageQueue.remove(message);
|
||||
switch(message.getMessageSubtype()){
|
||||
@ -198,7 +198,7 @@ public class ClientTerrainManager {
|
||||
}
|
||||
|
||||
public void ejectLoadedChunks(){
|
||||
List<LoadingChunk> chunksToEject = new LinkedList();
|
||||
List<LoadingChunk> chunksToEject = new LinkedList<LoadingChunk>();
|
||||
for(LoadingChunk chunk : loadingChunkCache.getChunks()){
|
||||
if(chunk.isComplete()){
|
||||
float[][] heightMap = chunk.exportFloats();
|
||||
|
||||
@ -50,12 +50,12 @@ public class CollisionEngine {
|
||||
CollisionDispatcher dispatcher;
|
||||
InternalTickCallback callback;
|
||||
|
||||
List<Entity> collisionEntities = new ArrayList();
|
||||
List<Entity> physicsEntities = new ArrayList();
|
||||
List<Entity> dynamicPhysicsEntities = new ArrayList();
|
||||
List<Entity> structurePhysicsEntities = new ArrayList();
|
||||
List<CollisionObject> collisionObject = new ArrayList();
|
||||
List<Collidable> collidableList = new ArrayList();
|
||||
List<Entity> collisionEntities = new ArrayList<Entity>();
|
||||
List<Entity> physicsEntities = new ArrayList<Entity>();
|
||||
List<Entity> dynamicPhysicsEntities = new ArrayList<Entity>();
|
||||
List<Entity> structurePhysicsEntities = new ArrayList<Entity>();
|
||||
List<CollisionObject> collisionObject = new ArrayList<CollisionObject>();
|
||||
List<Collidable> collidableList = new ArrayList<Collidable>();
|
||||
|
||||
static final float linearDamping = 0.02f;
|
||||
|
||||
@ -98,7 +98,7 @@ public class CollisionEngine {
|
||||
if (contactPoint.getDistance() < 0.0f) {
|
||||
magnitude = -contactPoint.getDistance();
|
||||
//linear dampen
|
||||
magnitude = magnitude;// * (float)Math.pow(1.0f - linearDamping,deltaTime * 2);
|
||||
// magnitude = magnitude;// * (float)Math.pow(1.0f - linearDamping,deltaTime * 2);
|
||||
hit = true;
|
||||
// System.out.println(contactPoint.positionWorldOnA + " " + contactPoint.positionWorldOnB);
|
||||
normal = new Vector3d(contactPoint.normalWorldOnB.x,contactPoint.normalWorldOnB.y,contactPoint.normalWorldOnB.z);
|
||||
@ -486,7 +486,7 @@ public class CollisionEngine {
|
||||
|
||||
public void destroyEntityThatHasPhysics(Entity e){
|
||||
//make uncollidable
|
||||
if(e.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && e.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
if(e.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && e.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||
CollisionObject rigidBody = (CollisionObject)e.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||
deregisterPhysicsObject(rigidBody);
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ public class MovementSystemSerializer implements JsonDeserializer<MovementSystem
|
||||
@Override
|
||||
public MovementSystem deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
// TODO Auto-generated method stub
|
||||
switch(json.getAsJsonObject().get("type").getAsString()){
|
||||
case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM:
|
||||
return context.deserialize(json, GroundMovementSystem.class);
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.List;
|
||||
*/
|
||||
public class AIManager {
|
||||
|
||||
List<AI> aiList = new LinkedList();
|
||||
List<AI> aiList = new LinkedList<AI>();
|
||||
|
||||
public AIManager(){
|
||||
|
||||
|
||||
@ -206,7 +206,8 @@ public class OpportunisticAttacker extends AI {
|
||||
|
||||
boolean hasWeapon(){
|
||||
boolean rVal = false;
|
||||
if(character.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){
|
||||
if(character.containsKey(EntityDataStrings.EQUIP_STATE)){
|
||||
//TODO:fix hasWeapon
|
||||
EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE);
|
||||
// if(equipState.hasEquipPrimary()){
|
||||
// rVal = true;
|
||||
@ -242,7 +243,7 @@ public class OpportunisticAttacker extends AI {
|
||||
}
|
||||
|
||||
void pickupWeapon(){
|
||||
if(character.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){
|
||||
if(character.containsKey(EntityDataStrings.EQUIP_STATE)){
|
||||
EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE);
|
||||
// if(!equipState.hasEquipPrimary()){
|
||||
// equipState.attemptEquip(target);
|
||||
|
||||
@ -4,15 +4,14 @@ import electrosphere.game.server.character.diety.Diety;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Character {
|
||||
static int character_id_iterator = 0;
|
||||
|
||||
int id;
|
||||
|
||||
HashMap<String,Object> data = new HashMap();
|
||||
|
||||
LinkedList<String> dataKeys = new LinkedList();
|
||||
Map<String,Object> data = new HashMap<String,Object>();
|
||||
|
||||
|
||||
|
||||
@ -26,11 +25,10 @@ public class Character {
|
||||
|
||||
public void putData(String key, Object o){
|
||||
data.put(key,o);
|
||||
dataKeys.add(key);
|
||||
}
|
||||
|
||||
public List<String> getDataKeys(){
|
||||
return dataKeys;
|
||||
|
||||
public boolean containsKey(String key){
|
||||
return data.containsKey(key);
|
||||
}
|
||||
|
||||
public Object getData(String key){
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Random;
|
||||
|
||||
public class Diety {
|
||||
|
||||
List<Symbol> symbols = new LinkedList();
|
||||
List<Symbol> symbols = new LinkedList<Symbol>();
|
||||
|
||||
//TODO: eventually add function where we can pass intial symbol to seed rest of diety off of
|
||||
//this lets us create a "good" diety" and a "bad" diety to guarentee a more balanced pantheon
|
||||
|
||||
@ -19,11 +19,11 @@ import org.joml.Vector3f;
|
||||
*/
|
||||
public class DataCellManager {
|
||||
|
||||
List<ServerDataCell> loadedDataCells = new LinkedList();
|
||||
List<ServerDataCell> loadedDataCells = new LinkedList<ServerDataCell>();
|
||||
ServerDataCell[][] dataCells;
|
||||
int discreteWorldSize;
|
||||
|
||||
List<Player> playerList = new LinkedList();
|
||||
List<Player> playerList = new LinkedList<Player>();
|
||||
|
||||
public DataCellManager(ServerWorldData data) {
|
||||
discreteWorldSize = data.getWorldSizeDiscrete();
|
||||
@ -63,8 +63,8 @@ public class DataCellManager {
|
||||
player.setWorldX(newX);
|
||||
player.setWorldY(newY);
|
||||
// System.out.println("=======" + "SET" + newX + " " + newY + " FROM " + oldX + " " + oldY + "========");
|
||||
int removals = 0;
|
||||
int additions = 0;
|
||||
// int removals = 0;
|
||||
// int additions = 0;
|
||||
for(int x = oldX - playerSimulationRadius; x < oldX + playerSimulationRadius + 1; x++){
|
||||
for(int y = oldY - playerSimulationRadius; y < oldY + playerSimulationRadius + 1; y++){
|
||||
if(
|
||||
@ -74,7 +74,7 @@ public class DataCellManager {
|
||||
){
|
||||
if(dataCells[x][y] != null){
|
||||
if(dataCells[x][y].containsPlayer(player)){
|
||||
removals++;
|
||||
// removals++;
|
||||
dataCells[x][y].removePlayer(player);
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class DataCellManager {
|
||||
//add player
|
||||
dataCells[x][y].addPlayer(player);
|
||||
}
|
||||
additions++;
|
||||
// additions++;
|
||||
} else {
|
||||
// System.out.println(x + "\t" + (oldX - playerSimulationRadius) + "\t" + (oldX + playerSimulationRadius));
|
||||
// System.out.println(y + "\t" + (oldY - playerSimulationRadius) + "\t" + (oldY + playerSimulationRadius));
|
||||
|
||||
@ -22,8 +22,8 @@ import java.util.List;
|
||||
*/
|
||||
public class ServerDataCell {
|
||||
|
||||
List<Entity> loadedEntities = new LinkedList();
|
||||
List<Player> activePlayers = new LinkedList();
|
||||
List<Entity> loadedEntities = new LinkedList<Entity>();
|
||||
List<Player> activePlayers = new LinkedList<Player>();
|
||||
NavMesh navMesh;
|
||||
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import java.util.List;
|
||||
public class ChunkMeshList {
|
||||
|
||||
ServerTerrainChunk chunk;
|
||||
List<NavMesh> meshes = new LinkedList();
|
||||
List<NavMesh> meshes = new LinkedList<NavMesh>();
|
||||
|
||||
public ChunkMeshList(ServerTerrainChunk parent){
|
||||
chunk = parent;
|
||||
|
||||
@ -18,8 +18,8 @@ import org.joml.Vector3d;
|
||||
*/
|
||||
public class NavMeshManager {
|
||||
|
||||
List<NavMesh> meshes = new LinkedList();
|
||||
Map<ServerTerrainChunk,ChunkMeshList> chunkToMeshListMap = new HashMap();
|
||||
List<NavMesh> meshes = new LinkedList<NavMesh>();
|
||||
Map<ServerTerrainChunk,ChunkMeshList> chunkToMeshListMap = new HashMap<ServerTerrainChunk,ChunkMeshList>();
|
||||
NavTerrainBlockerCache blockerCache = new NavTerrainBlockerCache();
|
||||
|
||||
public NavMesh createNavMesh(){
|
||||
|
||||
@ -23,7 +23,7 @@ public class NavMeshPathfinder {
|
||||
//TODO: add movement type mask to this function
|
||||
public static List<Waypoint> navigatePointToPointInMesh(NavMesh mesh, Vector3d start, Vector3d end){
|
||||
|
||||
List<Waypoint> rVal = new LinkedList();
|
||||
List<Waypoint> rVal = new LinkedList<Waypoint>();
|
||||
|
||||
NavShape startNode = null;
|
||||
NavShape endNode = null;
|
||||
@ -46,10 +46,10 @@ public class NavMeshPathfinder {
|
||||
}
|
||||
|
||||
//theta *
|
||||
List<NavShape> openSet = new LinkedList();
|
||||
List<NavShape> closedSet = new LinkedList();
|
||||
PriorityQueue<SetItem> pathItemsQueue = new PriorityQueue();
|
||||
Map<NavShape,SetItem> pathItems = new HashMap();
|
||||
List<NavShape> openSet = new LinkedList<NavShape>();
|
||||
List<NavShape> closedSet = new LinkedList<NavShape>();
|
||||
PriorityQueue<SetItem> pathItemsQueue = new PriorityQueue<SetItem>();
|
||||
Map<NavShape,SetItem> pathItems = new HashMap<NavShape,SetItem>();
|
||||
|
||||
openSet.add(startNode);
|
||||
SetItem startSetItem = new SetItem(null,startNode,0,start);
|
||||
@ -393,7 +393,7 @@ public class NavMeshPathfinder {
|
||||
|
||||
|
||||
|
||||
static class SetItem implements Comparable {
|
||||
static class SetItem implements Comparable<SetItem> {
|
||||
SetItem parent;
|
||||
NavShape node;
|
||||
float cost;
|
||||
@ -424,8 +424,7 @@ public class NavMeshPathfinder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
SetItem target = (SetItem)o;
|
||||
public int compareTo(SetItem target) {
|
||||
if(this.cost < target.cost){
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class NavMeshUtils {
|
||||
NavMesh rVal = Globals.navMeshManager.createNavMesh();
|
||||
float[][] heightMap = chunk.getHeightMap();
|
||||
boolean[][] navMeshGeneratorMask = navBlocker.getHeightfieldBlocker();
|
||||
List<FirstPhaseBox> firstPassBoxes = new LinkedList();
|
||||
List<FirstPhaseBox> firstPassBoxes = new LinkedList<FirstPhaseBox>();
|
||||
int numInCurrent = 0;
|
||||
float currentMin = 0;
|
||||
float currentMax = 0;
|
||||
@ -103,8 +103,8 @@ public class NavMeshUtils {
|
||||
|
||||
//phase two
|
||||
//???
|
||||
List<SecondPhaseBox> secondPhaseBoxes = new LinkedList();
|
||||
List<SecondPhaseBox> toRemove = new LinkedList();
|
||||
List<SecondPhaseBox> secondPhaseBoxes = new LinkedList<SecondPhaseBox>();
|
||||
List<SecondPhaseBox> toRemove = new LinkedList<SecondPhaseBox>();
|
||||
for(FirstPhaseBox firstPhaseBox : firstPassBoxes){
|
||||
SecondPhaseBox newBox = new SecondPhaseBox(
|
||||
firstPhaseBox.x,firstPhaseBox.yStart,
|
||||
@ -272,7 +272,7 @@ public class NavMeshUtils {
|
||||
int boundMinY;
|
||||
int boundMaxX;
|
||||
int boundMaxY;
|
||||
List<SecondPhaseBox> neighbors = new LinkedList();
|
||||
List<SecondPhaseBox> neighbors = new LinkedList<SecondPhaseBox>();
|
||||
int id = -1;
|
||||
|
||||
SecondPhaseBox(int boundMinX, int boundMinY, int boundMaxX, int boundMaxY, float minHeight, float maxHeight){
|
||||
|
||||
@ -2,6 +2,8 @@ package electrosphere.game.server.pathfinding.blocker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -15,8 +17,8 @@ public class NavTerrainBlockerCache {
|
||||
//While we incur a penalty with converting ints -> string, think this will
|
||||
//offset regenerating the array every time we want a new one
|
||||
int cacheSize = 50;
|
||||
HashMap<String, NavBlocker> navBlockerMapCache = new HashMap();
|
||||
ArrayList<String> navBlockerMapCacheContents = new ArrayList();
|
||||
Map<String, NavBlocker> navBlockerMapCache = new HashMap<String, NavBlocker>();
|
||||
List<String> navBlockerMapCacheContents = new ArrayList<String>();
|
||||
|
||||
|
||||
public String getKey(int x, int y){
|
||||
|
||||
@ -19,7 +19,7 @@ public class NavCube extends NavShape {
|
||||
Vector3d minPoint;
|
||||
Vector3d maxPoint;
|
||||
|
||||
List<NavShape> neighbors = new LinkedList();
|
||||
List<NavShape> neighbors = new LinkedList<NavShape>();
|
||||
|
||||
|
||||
public NavCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ){
|
||||
|
||||
@ -12,8 +12,8 @@ public class NavMesh {
|
||||
//nav method, ie walking, flying, climbing, swimming, etc
|
||||
String method;
|
||||
|
||||
List<NavShape> navNodes = new LinkedList();
|
||||
List<NavMesh> meshNeighbors = new LinkedList();
|
||||
List<NavShape> navNodes = new LinkedList<NavShape>();
|
||||
List<NavMesh> meshNeighbors = new LinkedList<NavMesh>();
|
||||
|
||||
public void addMeshNeighbor(NavMesh neighbor){
|
||||
meshNeighbors.add(neighbor);
|
||||
|
||||
@ -15,9 +15,9 @@ public class Structure {
|
||||
float locationY;
|
||||
String type;
|
||||
|
||||
HashMap<String,Object> data = new HashMap();
|
||||
HashMap<String,Object> data = new HashMap<String,Object>();
|
||||
|
||||
LinkedList<String> dataKeys = new LinkedList();
|
||||
LinkedList<String> dataKeys = new LinkedList<String>();
|
||||
|
||||
public Structure(int worldX, int worldY, float locationX, float locationY, String type) {
|
||||
this.worldX = worldX;
|
||||
|
||||
@ -27,7 +27,6 @@ public class StructureManager {
|
||||
|
||||
|
||||
public static Structure createStructure(int worldX, int worldY, float localX, float localY, String type){
|
||||
int id = structIDIterator;
|
||||
structIDIterator++;
|
||||
Structure rVal = new Structure(worldX, worldY, localX, localY, type);
|
||||
Globals.dbController.executeStatement("INSERT INTO structWorldPositions (structID,posX,posY) VALUES (" + structIDIterator + "," + worldX + "," + worldY + ");");
|
||||
@ -37,9 +36,9 @@ public class StructureManager {
|
||||
}
|
||||
|
||||
public static List<Structure> getStructuresInChunk(int worldX, int worldY){
|
||||
List<Structure> rVal = new LinkedList();
|
||||
List<Structure> rVal = new LinkedList<Structure>();
|
||||
DatabaseResult result = Globals.dbController.executeStatement("SELECT * FROM structWorldPositions WHERE posX = " + worldX + " AND posY = " + worldY + ";");
|
||||
List<Integer> returnedIDs = new LinkedList();
|
||||
List<Integer> returnedIDs = new LinkedList<Integer>();
|
||||
if(result.hasResultSet()){
|
||||
ResultSet positionSet = result.getResultSet();
|
||||
try {
|
||||
|
||||
@ -58,15 +58,15 @@ public class VirtualStructureUtils {
|
||||
public static void addResident(Structure structure, Character character){
|
||||
List<Character> residents = null;
|
||||
if(structure.getDataKeys().contains(StructureDataStrings.RESIDENTS)){
|
||||
residents = (List)structure.getData(StructureDataStrings.RESIDENTS);
|
||||
residents = (List<Character>)structure.getData(StructureDataStrings.RESIDENTS);
|
||||
} else {
|
||||
residents = new LinkedList();
|
||||
residents = new LinkedList<Character>();
|
||||
structure.putData(StructureDataStrings.RESIDENTS, residents);
|
||||
}
|
||||
residents.add(character);
|
||||
}
|
||||
|
||||
public static List<Character> getResidents(Structure structure){
|
||||
return (List)structure.getData(StructureDataStrings.RESIDENTS);
|
||||
return (List<Character>)structure.getData(StructureDataStrings.RESIDENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
@ -67,7 +68,7 @@ public class TerrainGen {
|
||||
public static int numberContinents = 0;
|
||||
public static int[][] continentIdField;
|
||||
|
||||
public static ArrayList<Continent> continents = new ArrayList();
|
||||
public static List<Continent> continents = new ArrayList<Continent>();
|
||||
|
||||
public static int current_Continent = 1;
|
||||
public static int current_Region_X = 0;
|
||||
@ -534,7 +535,7 @@ public class TerrainGen {
|
||||
0,1,2,1
|
||||
};
|
||||
boolean simulate_Drainage = true;
|
||||
ArrayList<Region> open_Set = new ArrayList();
|
||||
List<Region> open_Set = new ArrayList<Region>();
|
||||
open_Set.add(region_Current);
|
||||
if(simulate_Drainage){
|
||||
while(!open_Set.isEmpty()){
|
||||
@ -1352,34 +1353,31 @@ public class TerrainGen {
|
||||
|
||||
static int[][] load_Data(String path){
|
||||
int rVal[][] = null;
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(path));
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(path));){
|
||||
String line;
|
||||
try {
|
||||
line = br.readLine();
|
||||
int dim_x = Integer.parseInt(line);
|
||||
DIMENSION = dim_x;
|
||||
line = br.readLine();
|
||||
int dim_y = Integer.parseInt(line);
|
||||
rVal = new int[dim_x][dim_y];
|
||||
int incrementer_x = 0;
|
||||
int incrementer_y = 0;
|
||||
while ((line = br.readLine()) != null) {
|
||||
incrementer_y = 0;
|
||||
while(line != ""){
|
||||
rVal[incrementer_x][incrementer_y] = Integer.parseInt(Utilities.string_To_First_Space(line));
|
||||
if(line.contains(" ")){
|
||||
line = line.substring(Utilities.get_Position_Of_Next_Instance_Of_Char_In_String(line, ' ') + 1);
|
||||
} else {
|
||||
line = "";
|
||||
}
|
||||
incrementer_y++;
|
||||
line = br.readLine();
|
||||
int dim_x = Integer.parseInt(line);
|
||||
DIMENSION = dim_x;
|
||||
line = br.readLine();
|
||||
int dim_y = Integer.parseInt(line);
|
||||
rVal = new int[dim_x][dim_y];
|
||||
int incrementer_x = 0;
|
||||
int incrementer_y = 0;
|
||||
while ((line = br.readLine()) != null) {
|
||||
incrementer_y = 0;
|
||||
while(line != ""){
|
||||
rVal[incrementer_x][incrementer_y] = Integer.parseInt(Utilities.string_To_First_Space(line));
|
||||
if(line.contains(" ")){
|
||||
line = line.substring(Utilities.get_Position_Of_Next_Instance_Of_Char_In_String(line, ' ') + 1);
|
||||
} else {
|
||||
line = "";
|
||||
}
|
||||
incrementer_x++;
|
||||
incrementer_y++;
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
incrementer_x++;
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package electrosphere.game.server.terrain.generation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ class TerrainGenerator {
|
||||
static int[][] smoothed_elevation;
|
||||
static int new_Elevation[][];
|
||||
static Vector[][] currents;
|
||||
static ArrayList<Hotspot> spots = new ArrayList();
|
||||
static List<Hotspot> spots = new ArrayList<Hotspot>();
|
||||
static int Time = 0;
|
||||
static final int ELEVATION_DATA_LENGTH = 50;
|
||||
static int[] elevation_Data;
|
||||
@ -61,7 +62,7 @@ class TerrainGenerator {
|
||||
while(true){
|
||||
Time++;
|
||||
if(spots.size() >= 1){
|
||||
ArrayList<Hotspot> to_Remove = new ArrayList();
|
||||
List<Hotspot> to_Remove = new ArrayList<Hotspot>();
|
||||
Iterator<Hotspot> spot_Iterator = spots.iterator();
|
||||
while(spot_Iterator.hasNext()){
|
||||
Hotspot current_Spot = spot_Iterator.next();
|
||||
|
||||
@ -83,7 +83,7 @@ class Utilities {
|
||||
|
||||
|
||||
public static Point centerpoint_Of_Circle_From_Three_Points(Point p1, Point p2, Point p3){
|
||||
Point rVal = null;
|
||||
// Point rVal = null;
|
||||
|
||||
final double offset = Math.pow(p2.x, 2) + Math.pow(p2.y, 2);
|
||||
final double bc = (Math.pow(p1.x, 2) + Math.pow(p1.y, 2) - offset) / 2.0;
|
||||
@ -112,8 +112,7 @@ class Utilities {
|
||||
public static String pull_Random_String_From_File(File source){
|
||||
String rVal = "";
|
||||
int line_To_Go_To;
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(source));
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(source));){
|
||||
line_To_Go_To = random_Integer(1,Integer.parseInt(reader.readLine()));
|
||||
int i = 0;
|
||||
while(i<line_To_Go_To - 1){
|
||||
@ -134,8 +133,7 @@ class Utilities {
|
||||
|
||||
public static String pull_Ordered_String_From_File(File source, int dest){
|
||||
String rVal = "";
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(source));
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(source));){
|
||||
int i = 0;
|
||||
while(i<dest){
|
||||
reader.readLine();
|
||||
|
||||
@ -11,7 +11,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ServerTerrainChunk {
|
||||
int worldX, worldY;
|
||||
List<TerrainModification> modifications = new LinkedList();
|
||||
List<TerrainModification> modifications = new LinkedList<TerrainModification>();
|
||||
float[][] heightMap;
|
||||
float[][] macroValues;
|
||||
long[][] randomizer;
|
||||
|
||||
@ -14,6 +14,8 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -41,8 +43,8 @@ public class ServerTerrainManager {
|
||||
//While we incur a penalty with converting ints -> string, think this will
|
||||
//offset regenerating the array every time we want a new one
|
||||
int cacheSize = 50;
|
||||
HashMap<String, ServerTerrainChunk> elevationMapCache;
|
||||
ArrayList<String> elevationMapCacheContents;
|
||||
Map<String, ServerTerrainChunk> elevationMapCache;
|
||||
List<String> elevationMapCacheContents;
|
||||
|
||||
|
||||
|
||||
@ -50,8 +52,8 @@ public class ServerTerrainManager {
|
||||
this.worldSizeDiscrete = worldSizeDiscrete;
|
||||
this.verticalInterpolationRatio = verticalInterpolationRatio;
|
||||
this.dynamicInterpolationRatio = dynamicInterpolationRatio;
|
||||
this.elevationMapCache = new HashMap();
|
||||
this.elevationMapCacheContents = new ArrayList();
|
||||
this.elevationMapCache = new HashMap<String, ServerTerrainChunk>();
|
||||
this.elevationMapCacheContents = new ArrayList<String>();
|
||||
this.interpolationRandomDampener = interpolationRandomDampener;
|
||||
this.seed = seed;
|
||||
}
|
||||
@ -65,8 +67,8 @@ public class ServerTerrainManager {
|
||||
rVal.worldSizeDiscrete = 2;
|
||||
rVal.verticalInterpolationRatio = 0;
|
||||
rVal.dynamicInterpolationRatio = 100;
|
||||
rVal.elevationMapCache = new HashMap();
|
||||
rVal.elevationMapCacheContents = new ArrayList();
|
||||
rVal.elevationMapCache = new HashMap<String, ServerTerrainChunk>();
|
||||
rVal.elevationMapCacheContents = new ArrayList<String>();
|
||||
rVal.interpolationRandomDampener = 0.0f;
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ModificationList {
|
||||
|
||||
List<TerrainModification> modifications = new ArrayList();
|
||||
List<TerrainModification> modifications = new ArrayList<TerrainModification>();
|
||||
|
||||
public List<TerrainModification> getModifications() {
|
||||
return modifications;
|
||||
|
||||
@ -3,6 +3,7 @@ package electrosphere.game.server.terrain.models;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class TerrainModel {
|
||||
@ -17,11 +18,11 @@ public class TerrainModel {
|
||||
float realMountainThreshold;
|
||||
float realOceanThreshold;
|
||||
|
||||
HashMap<String,ModificationList> modifications;
|
||||
Map<String,ModificationList> modifications;
|
||||
|
||||
|
||||
TerrainModel() {
|
||||
this.modifications = new HashMap();
|
||||
this.modifications = new HashMap<String,ModificationList>();
|
||||
}
|
||||
|
||||
public TerrainModel(
|
||||
@ -39,7 +40,7 @@ public class TerrainModel {
|
||||
this.chunkRandomizer = chunkRandomizer;
|
||||
this.realMountainThreshold = realMountainThreshold;
|
||||
this.realOceanThreshold = realOceanThreshold;
|
||||
this.modifications = new HashMap();
|
||||
this.modifications = new HashMap<String,ModificationList>();
|
||||
}
|
||||
|
||||
public static TerrainModel constructTerrainModel(int dimension, int dynamicInterpolationRatio){
|
||||
|
||||
@ -25,10 +25,10 @@ public class Town {
|
||||
int id;
|
||||
static int idIncrementer = 0;
|
||||
|
||||
List<Vector2i> positions = new LinkedList();
|
||||
List<Vector2i> positions = new LinkedList<Vector2i> ();
|
||||
|
||||
List<Structure> structures = new LinkedList();
|
||||
List<Character> residents = new LinkedList();
|
||||
List<Structure> structures = new LinkedList<Structure>();
|
||||
List<Character> residents = new LinkedList<Character>();
|
||||
|
||||
final static int avgDiffThreshold = 10;
|
||||
|
||||
|
||||
@ -22,13 +22,13 @@ import org.joml.Vector2i;
|
||||
*/
|
||||
public class MacroData {
|
||||
|
||||
List<Character> initialDieties = new LinkedList();
|
||||
List<Race> races = new LinkedList();
|
||||
List<Character> characters = new LinkedList();
|
||||
List<Character> aliveCharacters = new LinkedList();
|
||||
List<Civilization> civilizations = new LinkedList();
|
||||
List<Town> towns = new LinkedList();
|
||||
List<Structure> structures = new LinkedList();
|
||||
List<Character> initialDieties = new LinkedList<Character>();
|
||||
List<Race> races = new LinkedList<Race>();
|
||||
List<Character> characters = new LinkedList<Character>();
|
||||
List<Character> aliveCharacters = new LinkedList<Character>();
|
||||
List<Civilization> civilizations = new LinkedList<Civilization>();
|
||||
List<Town> towns = new LinkedList<Town>();
|
||||
List<Structure> structures = new LinkedList<Structure>();
|
||||
|
||||
|
||||
static Character generateInitialDiety(long seed){
|
||||
@ -75,7 +75,7 @@ public class MacroData {
|
||||
//find initial positions to place characters at per race
|
||||
//generate initial characters
|
||||
//place them
|
||||
List<Vector2i> occupiedStartingPositions = new LinkedList();
|
||||
List<Vector2i> occupiedStartingPositions = new LinkedList<Vector2i>();
|
||||
for(Race race : rVal.races){
|
||||
boolean foundPlacementLocation = false;
|
||||
while(!foundPlacementLocation){
|
||||
@ -159,7 +159,7 @@ public class MacroData {
|
||||
int numCharsOfRace = 0;
|
||||
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
||||
for(Character chara : characters){
|
||||
if(chara.getDataKeys().contains(CharacterDataStrings.RACE)){
|
||||
if(chara.containsKey(CharacterDataStrings.RACE)){
|
||||
if(CharacterUtils.getRace(chara).equals(race)){
|
||||
numCharsOfRace++;
|
||||
}
|
||||
|
||||
@ -71,11 +71,11 @@ public class MacroSimulation {
|
||||
If no town
|
||||
fashion makeshift shelter
|
||||
*/
|
||||
if(!chara.getDataKeys().contains(CharacterDataStrings.SHELTER)){
|
||||
if(!chara.containsKey(CharacterDataStrings.SHELTER)){
|
||||
Vector2i charPos = CharacterUtils.getDiscretePosition(chara);
|
||||
Town nearbyTown = Town.getTownAtPosition(charPos.x,charPos.y);
|
||||
if(nearbyTown != null){
|
||||
//if town has a place to day
|
||||
//if town has a place to stay
|
||||
if(false){
|
||||
|
||||
} else {
|
||||
@ -117,14 +117,14 @@ public class MacroSimulation {
|
||||
static void checkTownMembership(Character chara){
|
||||
//TODO: eventually exclude people who shouldn't belong to a town (traders, bandits, etc)
|
||||
// for(Character chara : Globals.macroData.getAliveCharacters()){
|
||||
boolean hasHometown = chara.getDataKeys().contains(CharacterDataStrings.HOMETOWN);
|
||||
boolean hasShelter = chara.getDataKeys().contains(CharacterDataStrings.SHELTER);
|
||||
boolean hasHometown = chara.containsKey(CharacterDataStrings.HOMETOWN);
|
||||
boolean hasShelter = chara.containsKey(CharacterDataStrings.SHELTER);
|
||||
//if has structure & no hometown
|
||||
if(!hasHometown && hasShelter){
|
||||
Structure shelter = CharacterUtils.getShelter(chara);
|
||||
//if there's at least one other structure nearby
|
||||
Vector2i shelterDiscretePos = new Vector2i(shelter.getWorldX(),shelter.getWorldY());
|
||||
List<Structure> nearbyPopulatedStructures = new LinkedList();
|
||||
List<Structure> nearbyPopulatedStructures = new LinkedList<Structure>();
|
||||
for(Structure currentStruct : Globals.macroData.getStructures()){
|
||||
if(currentStruct.getWorldX() == shelterDiscretePos.x && currentStruct.getWorldY() == shelterDiscretePos.y && currentStruct != shelter){
|
||||
//if has a resident
|
||||
|
||||
@ -605,11 +605,11 @@ public class MenuGenerators {
|
||||
toggleDrawPlayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
if(Globals.playerCharacter != null){
|
||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.DATA_STRING_DRAW)){
|
||||
if(Globals.playerCharacter.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
|
||||
boolean draw = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DATA_STRING_DRAW);
|
||||
Globals.playerCharacter.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
|
||||
}
|
||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.DRAW_CAST_SHADOW)){
|
||||
if(Globals.playerCharacter.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
|
||||
boolean drawShadow = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DRAW_CAST_SHADOW);
|
||||
Globals.playerCharacter.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
|
||||
}
|
||||
@ -916,7 +916,7 @@ public class MenuGenerators {
|
||||
|
||||
List<String> slots = inventory.getSlots();
|
||||
int numSlots = slots.size();
|
||||
int numRows = (numSlots / 2) + (numSlots % 2 == 1 ? 1 : 0);
|
||||
// int numRows = (numSlots / 2) + (numSlots % 2 == 1 ? 1 : 0);
|
||||
|
||||
int incrementer = 0;
|
||||
for(int i = 0; i < numSlots; i++){
|
||||
|
||||
@ -266,7 +266,7 @@ public class EntityMessage extends NetworkMessage {
|
||||
|
||||
public static boolean canParseCreateMessage(List<Byte> byteStream){
|
||||
int currentStreamLength = byteStream.size();
|
||||
List<Byte> temporaryByteQueue = new LinkedList();
|
||||
List<Byte> temporaryByteQueue = new LinkedList<Byte>();
|
||||
if(currentStreamLength < 6){
|
||||
return false;
|
||||
}
|
||||
@ -508,7 +508,7 @@ public class EntityMessage extends NetworkMessage {
|
||||
|
||||
public static boolean canParseattachEntityToEntityMessage(List<Byte> byteStream){
|
||||
int currentStreamLength = byteStream.size();
|
||||
List<Byte> temporaryByteQueue = new LinkedList();
|
||||
List<Byte> temporaryByteQueue = new LinkedList<Byte>();
|
||||
if(currentStreamLength < 6){
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import electrosphere.net.parser.net.message.NetworkMessage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class NetworkParser {
|
||||
@ -11,11 +12,11 @@ public class NetworkParser {
|
||||
InputStream incomingStream;
|
||||
OutputStream outgoingStream;
|
||||
|
||||
CopyOnWriteArrayList<NetworkMessage> incomingMessageQueue = new CopyOnWriteArrayList();
|
||||
CopyOnWriteArrayList<NetworkMessage> outgoingMessageQueue = new CopyOnWriteArrayList();
|
||||
List<NetworkMessage> incomingMessageQueue = new CopyOnWriteArrayList<NetworkMessage>();
|
||||
List<NetworkMessage> outgoingMessageQueue = new CopyOnWriteArrayList<NetworkMessage>();
|
||||
|
||||
CopyOnWriteArrayList<Byte> incomingByteQueue = new CopyOnWriteArrayList();
|
||||
CopyOnWriteArrayList<Byte> outgoingByteQueue = new CopyOnWriteArrayList();
|
||||
List<Byte> incomingByteQueue = new CopyOnWriteArrayList<Byte>();
|
||||
List<Byte> outgoingByteQueue = new CopyOnWriteArrayList<Byte>();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package electrosphere.net.server;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -10,8 +11,8 @@ import java.util.List;
|
||||
*/
|
||||
public class PlayerManager {
|
||||
|
||||
List<Player> playerList = new LinkedList();
|
||||
HashMap<Integer,Player> idMap = new HashMap();
|
||||
List<Player> playerList = new LinkedList<Player>();
|
||||
Map<Integer,Player> idMap = new HashMap<Integer,Player>();
|
||||
|
||||
public PlayerManager(){
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -23,13 +24,13 @@ public class Server implements Runnable{
|
||||
|
||||
ServerSocket serverSocket;
|
||||
|
||||
HashMap<String,ServerConnectionHandler> clientMap;
|
||||
Map<String,ServerConnectionHandler> clientMap;
|
||||
|
||||
|
||||
|
||||
|
||||
void initServer(){
|
||||
clientMap = new HashMap();
|
||||
clientMap = new HashMap<String,ServerConnectionHandler>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -35,13 +35,13 @@ public class Material {
|
||||
//basically useless because blender doesn't support exporting mats with fbx
|
||||
public static Material load_material_from_aimaterial(AIMaterial input){
|
||||
Material rVal = new Material();
|
||||
if(input.mNumProperties() > 0){
|
||||
PointerBuffer property_buffer = input.mProperties();
|
||||
while(property_buffer.hasRemaining()){
|
||||
AIMaterialProperty new_property = AIMaterialProperty.create(property_buffer.get());
|
||||
// System.out.println("Property: " + new_property.mKey().dataString());
|
||||
}
|
||||
}
|
||||
// if(input.mNumProperties() > 0){
|
||||
// PointerBuffer property_buffer = input.mProperties();
|
||||
// while(property_buffer.hasRemaining()){
|
||||
// AIMaterialProperty new_property = AIMaterialProperty.create(property_buffer.get());
|
||||
// // System.out.println("Property: " + new_property.mKey().dataString());
|
||||
// }
|
||||
// }
|
||||
return rVal;
|
||||
}
|
||||
public String get_diffuse(){
|
||||
|
||||
@ -241,7 +241,7 @@ public class Model {
|
||||
ActorShaderMask specificMask = shaderMask.get(mesh.nodeID);
|
||||
ShaderProgram overwriteShader = null;
|
||||
if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getGeometryShaderPath(), specificMask.getFragmentShaderPath())) != null){
|
||||
ShaderProgram oldProgram = mesh.shader;
|
||||
// ShaderProgram oldProgram = mesh.shader;
|
||||
rVal = overwriteShader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +143,8 @@ public class RenderUtils {
|
||||
|
||||
|
||||
|
||||
boolean apply_lighting = false;
|
||||
boolean has_bones = false;
|
||||
// boolean apply_lighting = false;
|
||||
// boolean has_bones = false;
|
||||
|
||||
Mesh skyboxmesh = new Mesh(){
|
||||
@Override
|
||||
@ -849,7 +849,7 @@ public class RenderUtils {
|
||||
}
|
||||
|
||||
int incrementer = 0;
|
||||
int numFaces = (actualWidth - 1) * (actualHeight - 1) * 2 * 3;
|
||||
// int numFaces = (actualWidth - 1) * (actualHeight - 1) * 2 * 3;
|
||||
for(int x = 0; x < width - 1; x = x + stride){
|
||||
for(int y = 0; y < height - 1; y = y + stride){
|
||||
//deal with vertex
|
||||
@ -1063,7 +1063,6 @@ public class RenderUtils {
|
||||
QuadToGenerate quadCurrent = null;
|
||||
float minVal = 0;
|
||||
float maxVal = 0;
|
||||
int textureVal = -1;
|
||||
for(int x = 0; x < width - 1; x = x + stride){
|
||||
quadCurrent = null;
|
||||
for(int y = 0; y < height - 1; y = y + stride){
|
||||
@ -1074,7 +1073,6 @@ public class RenderUtils {
|
||||
if(quadCurrent == null){
|
||||
minVal = 100000000;
|
||||
maxVal = 0;
|
||||
textureVal = -1;
|
||||
//minval
|
||||
if(heightfield[x][y] < minVal){
|
||||
minVal = heightfield[x][y];
|
||||
|
||||
@ -562,7 +562,7 @@ public class RenderingEngine {
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
||||
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
|
||||
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_CAST_SHADOW)
|
||||
currentEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)
|
||||
){
|
||||
//fetch actor
|
||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||
@ -776,7 +776,7 @@ public class RenderingEngine {
|
||||
case "CUBE":
|
||||
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){
|
||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||
Vector3f scale = EntityUtils.getScale(physicsEntity);
|
||||
// Vector3f scale = EntityUtils.getScale(physicsEntity);
|
||||
Quaternionf rotation = EntityUtils.getRotation(physicsEntity);
|
||||
//calculate camera-modified vector3f
|
||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
@ -794,7 +794,7 @@ public class RenderingEngine {
|
||||
}
|
||||
for(Entity physicsEntity : Globals.collisionEngine.getStructurePhysicsEntities()){
|
||||
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){
|
||||
if(physicsEntity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){
|
||||
if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){
|
||||
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitplane.fbx")) != null){
|
||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||
Vector3f scale = EntityUtils.getScale(physicsEntity);
|
||||
@ -809,7 +809,7 @@ public class RenderingEngine {
|
||||
physicsGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
physicsGraphicsModel.draw(true, true, false, true, true, true, true);
|
||||
}
|
||||
} else if(physicsEntity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){
|
||||
} else if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){
|
||||
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){
|
||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||
Vector3f scale = EntityUtils.getScale(physicsEntity);
|
||||
@ -1119,7 +1119,7 @@ public class RenderingEngine {
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
||||
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
|
||||
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
){
|
||||
//fetch actor
|
||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||
@ -1157,7 +1157,7 @@ public class RenderingEngine {
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
||||
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
|
||||
!currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
!currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
){
|
||||
//fetch actor
|
||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||
@ -1206,7 +1206,7 @@ public class RenderingEngine {
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
|
||||
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
|
||||
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
|
||||
){
|
||||
//fetch actor
|
||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||
|
||||
@ -10,6 +10,9 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
@ -43,13 +46,13 @@ public class ShaderProgram {
|
||||
|
||||
//Uniforms
|
||||
//list of names of all uniforms in the shader
|
||||
public ArrayList<String> uniformList;
|
||||
// public List<String> uniformList;
|
||||
//map
|
||||
//string -> tuple
|
||||
//tuple: a string describing the type of the data,the current value,location
|
||||
//ie arrayVec3,[<1,0,0>,<2,0,0>],colors
|
||||
// Mat4,[Matrix4f],modelMatrix
|
||||
public HashMap<String,ArrayList> uniformMap;
|
||||
// public Map<String,List> uniformMap;
|
||||
|
||||
public static ShaderProgram smart_assemble_shader(boolean ContainsBones, boolean apply_lighting){
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package electrosphere.renderer.actor;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ActorAnimationMask implements Comparable {
|
||||
public class ActorAnimationMask implements Comparable<ActorAnimationMask> {
|
||||
|
||||
int priority;
|
||||
String animationName;
|
||||
@ -52,7 +52,7 @@ public class ActorAnimationMask implements Comparable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
public int compareTo(ActorAnimationMask o) {
|
||||
ActorAnimationMask otherMask = (ActorAnimationMask)o;
|
||||
if(otherMask.priority > this.priority){
|
||||
return -1;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package electrosphere.renderer.anim;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.assimp.AINode;
|
||||
|
||||
@ -12,13 +14,13 @@ public class AnimNode {
|
||||
public String id;
|
||||
public Matrix4f transform;
|
||||
public AnimNode parent;
|
||||
public ArrayList<AnimNode> children;
|
||||
public List<AnimNode> children;
|
||||
public boolean is_bone;
|
||||
public AINode raw_data;
|
||||
public AnimNode(String id, AnimNode parent, AINode raw_data){
|
||||
this.id = id;
|
||||
this.parent = parent;
|
||||
this.children = new ArrayList();
|
||||
this.children = new ArrayList<AnimNode>();
|
||||
this.transform = new Matrix4f();
|
||||
is_bone = false;
|
||||
this.raw_data = raw_data;
|
||||
|
||||
@ -7,7 +7,7 @@ import org.joml.Vector3f;
|
||||
*
|
||||
* @author amaterasu
|
||||
*/
|
||||
public class Keyframe implements Comparable{
|
||||
public class Keyframe implements Comparable<Keyframe>{
|
||||
double time;
|
||||
Vector3f position;
|
||||
Quaternionf rotation;
|
||||
@ -18,10 +18,10 @@ public class Keyframe implements Comparable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object t) {
|
||||
if(time > ((Keyframe)t).getTime()){
|
||||
public int compareTo(Keyframe frame) {
|
||||
if(time > frame.getTime()){
|
||||
return 1;
|
||||
} else if(time < ((Keyframe)t).getTime()){
|
||||
} else if(time < frame.getTime()){
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@ -135,7 +135,7 @@ public class LightManager {
|
||||
|
||||
void bufferData(){
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, uboIndex);
|
||||
int offset = 0;
|
||||
// int offset = 0;
|
||||
glBufferData(GL_UNIFORM_BUFFER, dataBuffer, GL_DYNAMIC_DRAW);
|
||||
// glBufferSubData(GL_UNIFORM_BUFFER, offset, dataBuffer);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
@ -2,6 +2,7 @@ package electrosphere.renderer.texture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -17,13 +18,13 @@ public class TextureMap {
|
||||
//if either the diffuse or the specular isn't included then it should
|
||||
//instead contain and empty string - ""
|
||||
//this convention must be followed
|
||||
Map<String,Map<String,ArrayList<String>>> texture_map = new HashMap();
|
||||
Map<String,Map<String,List<String>>> texture_map = new HashMap<String,Map<String,List<String>>>();
|
||||
|
||||
public Map<String,ArrayList<String>> get_mesh_map(String name){
|
||||
public Map<String,List<String>> get_mesh_map(String name){
|
||||
return texture_map.get(name);
|
||||
}
|
||||
|
||||
public static ArrayList<String> get_mesh_textures(Map<String,ArrayList<String>> input, String name){
|
||||
public static List<String> get_mesh_textures(Map<String,List<String>> input, String name){
|
||||
if(input == null){
|
||||
//TODO: Add big fuckin' error here
|
||||
return null;
|
||||
@ -32,7 +33,7 @@ public class TextureMap {
|
||||
}
|
||||
|
||||
//for the lazy
|
||||
public static String get_diffuse_path(ArrayList<String> input){
|
||||
public static String get_diffuse_path(List<String> input){
|
||||
if(input == null || input.size() < 2){
|
||||
//TODO: Add big fuckin' error here
|
||||
return null;
|
||||
@ -41,7 +42,7 @@ public class TextureMap {
|
||||
}
|
||||
|
||||
//for the lazy
|
||||
public static String get_specular_path(ArrayList<String> input){
|
||||
public static String get_specular_path(List<String> input){
|
||||
if(input == null || input.size() < 2){
|
||||
//TODO: Add big fuckin' error here
|
||||
return null;
|
||||
@ -50,13 +51,13 @@ public class TextureMap {
|
||||
}
|
||||
|
||||
public TextureMap(){
|
||||
texture_map = new HashMap();
|
||||
texture_map = new HashMap<String,Map<String,List<String>>>();
|
||||
}
|
||||
public void add_model(String model_name){
|
||||
texture_map.put(model_name, new HashMap());
|
||||
texture_map.put(model_name, new HashMap<String, List<String>>());
|
||||
}
|
||||
public void add_mesh_to_model(String model_name, String mesh_name){
|
||||
ArrayList temp = new ArrayList();
|
||||
List<String> temp = new ArrayList<String>();
|
||||
temp.add("");
|
||||
temp.add("");
|
||||
texture_map.get(model_name).put(mesh_name, temp);
|
||||
|
||||
@ -157,26 +157,22 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
|
||||
@Override
|
||||
public void setPositionX(int positionX) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.positionX = positionX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionY(int positionY) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.positionY = positionY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentWidth(int width) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentHeight(int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -175,7 +175,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
|
||||
}
|
||||
|
||||
void onFocus(FocusEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
if(onFocusCallback != null){
|
||||
onFocusCallback.execute(event);
|
||||
} else {
|
||||
@ -189,7 +188,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
|
||||
}
|
||||
|
||||
void onLoseFocus(FocusEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
if(onLoseFocusCallback != null){
|
||||
onLoseFocusCallback.execute(event);
|
||||
} else {
|
||||
@ -203,7 +201,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
|
||||
}
|
||||
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
// TODO Auto-generated method stub
|
||||
for(Element child : childList){
|
||||
if(child instanceof DrawableElement){
|
||||
DrawableElement drawableChild = (DrawableElement) child;
|
||||
@ -235,19 +232,16 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
|
||||
|
||||
@Override
|
||||
public void setOnFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onFocusCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLoseFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onLoseFocusCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClick(ClickEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
clickCallback = callback;
|
||||
}
|
||||
|
||||
|
||||
@ -157,13 +157,11 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
// TODO Auto-generated method stub
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height) {
|
||||
// TODO Auto-generated method stub
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@ -187,13 +185,11 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
|
||||
|
||||
@Override
|
||||
public void setParentWidth(int width) {
|
||||
// TODO Auto-generated method stub
|
||||
this.parentWidth = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentHeight(int height) {
|
||||
// TODO Auto-generated method stub
|
||||
this.parentHeight = height;
|
||||
}
|
||||
|
||||
@ -234,43 +230,36 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
|
||||
|
||||
@Override
|
||||
public boolean isFocused() {
|
||||
// TODO Auto-generated method stub
|
||||
return focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onFocus = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLoseFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onLoseFocus = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragStart(DragEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onDragStart = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDrag(DragEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onDrag = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragRelease(DragEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onDragRelease = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClick(ClickEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
this.onClick = callback;
|
||||
}
|
||||
|
||||
@ -330,19 +319,16 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
|
||||
|
||||
@Override
|
||||
public boolean getVisible() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean draw) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.visible = draw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
// TODO Auto-generated method stub
|
||||
for(Element child : childList){
|
||||
if(child instanceof DrawableElement){
|
||||
DrawableElement drawableChild = (DrawableElement) child;
|
||||
@ -353,7 +339,6 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
|
||||
|
||||
@Override
|
||||
public void setOnNavigationCallback(NavigationEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onNavigate = callback;
|
||||
}
|
||||
|
||||
|
||||
@ -83,31 +83,26 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
// TODO Auto-generated method stub
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height) {
|
||||
// TODO Auto-generated method stub
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionX(int positionX) {
|
||||
// TODO Auto-generated method stub
|
||||
this.positionX = positionX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionY(int positionY) {
|
||||
// TODO Auto-generated method stub
|
||||
this.positionY = positionY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentWidth(int width) {
|
||||
// TODO Auto-generated method stub
|
||||
parentWidth = width;
|
||||
float ndcX = (float)positionX/parentWidth;
|
||||
float ndcY = (float)positionY/parentHeight;
|
||||
@ -119,7 +114,6 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
|
||||
|
||||
@Override
|
||||
public void setParentHeight(int height) {
|
||||
// TODO Auto-generated method stub
|
||||
parentHeight = height;
|
||||
float ndcX = (float)positionX/parentWidth;
|
||||
float ndcY = (float)positionY/parentHeight;
|
||||
@ -163,19 +157,16 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(Event event) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getVisible() {
|
||||
// TODO Auto-generated method stub
|
||||
return visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
// TODO Auto-generated method stub
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
@ -258,25 +258,21 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle
|
||||
|
||||
@Override
|
||||
public boolean isFocused() {
|
||||
// TODO Auto-generated method stub
|
||||
return focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onFocusCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLoseFocus(FocusEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onLoseFocusCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnPress(KeyboardEventCallback callback) {
|
||||
// TODO Auto-generated method stub
|
||||
onKeyPressCallback = callback;
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ public class FormElement implements DrawableElement, ContainerElement {
|
||||
List<Element> childList = new LinkedList<Element>();
|
||||
|
||||
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
|
||||
// TODO Auto-generated method stub
|
||||
for(Element child : childList){
|
||||
if(child instanceof DrawableElement){
|
||||
DrawableElement drawableChild = (DrawableElement) child;
|
||||
|
||||
@ -233,7 +233,7 @@ public class FileUtils {
|
||||
|
||||
|
||||
public static List<String> listDirectory(String directoryName){
|
||||
List<String> rVal = new LinkedList();
|
||||
List<String> rVal = new LinkedList<String>();
|
||||
String sanitizedPath = sanitizeFilePath(directoryName);
|
||||
File targetDir = new File(sanitizedPath);
|
||||
String[] files = targetDir.list();
|
||||
|
||||
@ -17,6 +17,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -52,7 +53,7 @@ public class ModelLoader {
|
||||
TextureMap global_map = Globals.textureMapDefault;
|
||||
LoggerInterface.loggerRenderer.DEBUG(path);
|
||||
//then we try to get the path of our model from the map
|
||||
Map<String,ArrayList<String>> mesh_map = global_map.get_mesh_map(path);
|
||||
Map<String,List<String>> mesh_map = global_map.get_mesh_map(path);
|
||||
//if it exists..
|
||||
if(mesh_map != null){
|
||||
//iterate through each mesh in the model that was provided as input
|
||||
@ -65,7 +66,7 @@ public class ModelLoader {
|
||||
//we create a new material, check if the diffuse or specular is not null,
|
||||
//and if they aren't we add that path as a new texture of respective type to the material
|
||||
Material final_material = new Material();
|
||||
ArrayList<String> texture_path_list = mesh_map.get(current_mesh.nodeID);
|
||||
List<String> texture_path_list = mesh_map.get(current_mesh.nodeID);
|
||||
String diffuse_path = TextureMap.get_diffuse_path(texture_path_list);
|
||||
LoggerInterface.loggerRenderer.DEBUG(current_mesh.nodeID + "->" + diffuse_path);
|
||||
if(diffuse_path != null){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user