iron out frame timing in attack tree

This commit is contained in:
austin 2022-05-05 01:48:41 -04:00
parent b24041f9a8
commit e35599606b
14 changed files with 156 additions and 63 deletions

View File

@ -265,30 +265,34 @@
"attackMoveId" : "Sword1HSlash1", "attackMoveId" : "Sword1HSlash1",
"type" : "MELEE_WEAPON_SWING_ONE_HAND", "type" : "MELEE_WEAPON_SWING_ONE_HAND",
"attackAnimationName" : "Armature|Sword1HSlash1", "attackAnimationName" : "Armature|Sword1HSlash1",
"damageStartFrame" : 30, "windupFrames" : 5,
"damageEndFrame" : 60, "attackFrames" : 5,
"cooldownFrames" : 25,
"firesProjectile" : false, "firesProjectile" : false,
"nextMoveId" : "Sword1HSlash2", "nextMoveId" : "Sword1HSlash2",
"nextAttackMoveWindowStart" : 0, "nextAttackMoveWindowStart" : 0,
"nextAttackMoveWindowEnd" : 1, "nextAttackMoveWindowEnd" : 1,
"movementStart" : 2, "moveChainWindowStart" : 12,
"movementEnd" : 10, "moveChainWindowEnd" : 18,
"movementGoal" : 0.1, "driftGoal" : 0.02,
"driftFrameStart" : 7,
"driftFrameEnd" : 15,
"initialMove" : true "initialMove" : true
}, },
{ {
"attackMoveId" : "Sword1HSlash2", "attackMoveId" : "Sword1HSlash2",
"type" : "MELEE_WEAPON_SWING_ONE_HAND", "type" : "MELEE_WEAPON_SWING_ONE_HAND",
"attackAnimationName" : "Armature|Sword1HSlash2", "attackAnimationName" : "Armature|Sword1HSlash2",
"damageStartFrame" : 30, "windupFrames" : 2,
"damageEndFrame" : 60, "attackFrames" : 5,
"cooldownFrames" : 28,
"firesProjectile" : false, "firesProjectile" : false,
"nextMoveId" : "Sword1HSlash1", "nextMoveId" : "Sword1HSlash1",
"nextAttackMoveWindowStart" : 0, "nextAttackMoveWindowStart" : 10,
"nextAttackMoveWindowEnd" : 1, "nextAttackMoveWindowEnd" : 18,
"movementStart" : 2, "driftGoal" : 0.03,
"movementEnd" : 10, "driftFrameStart" : 1,
"movementGoal" : 0.1, "driftFrameEnd" : 10,
"initialMove" : false "initialMove" : false
}, },
{ {

View File

@ -121,6 +121,8 @@ public class ControlHandler {
public static final String INPUT_CODE_INVENTORY_CLOSE = "inventoryClose"; public static final String INPUT_CODE_INVENTORY_CLOSE = "inventoryClose";
public static final String INPUT_CODE_INVENTORY_ITEM_MANIPULATE = "inventoryItemManipulate"; public static final String INPUT_CODE_INVENTORY_ITEM_MANIPULATE = "inventoryItemManipulate";
public static final String INPUT_CODE_INVENTORY_ITEM_DRAG = "inventoryDrag"; public static final String INPUT_CODE_INVENTORY_ITEM_DRAG = "inventoryDrag";
public static final String DEBUG_FRAMESTEP = "framestep";
public static enum ControlsState { public static enum ControlsState {
@ -252,6 +254,11 @@ public class ControlHandler {
handler.addControl(INPUT_CODE_INVENTORY_CLOSE, new Control(ControlType.KEY,GLFW_KEY_I)); handler.addControl(INPUT_CODE_INVENTORY_CLOSE, new Control(ControlType.KEY,GLFW_KEY_I));
handler.addControl(INPUT_CODE_INVENTORY_ITEM_MANIPULATE, new Control(ControlType.MOUSE_BUTTON,GLFW_MOUSE_BUTTON_1)); handler.addControl(INPUT_CODE_INVENTORY_ITEM_MANIPULATE, new Control(ControlType.MOUSE_BUTTON,GLFW_MOUSE_BUTTON_1));
handler.addControl(INPUT_CODE_INVENTORY_ITEM_DRAG, new Control(ControlType.MOUSE_MOVEMENT,0)); handler.addControl(INPUT_CODE_INVENTORY_ITEM_DRAG, new Control(ControlType.MOUSE_MOVEMENT,0));
/*
framestep controls
*/
handler.addControl(DEBUG_FRAMESTEP, new Control(ControlType.KEY, GLFW_KEY_P));
/* /*
set state set state
@ -790,6 +797,11 @@ public class ControlHandler {
// EntityUtils.getPosition(bow).set(1, 5, 2); // EntityUtils.getPosition(bow).set(1, 5, 2);
// CollisionObjUtils.positionCharacter(bow, new Vector3f(1, 5, 2)); // CollisionObjUtils.positionCharacter(bow, new Vector3f(1, 5, 2));
}}); }});
mainGameDebugControlList.add(controls.get(DEBUG_FRAMESTEP));
controls.get(DEBUG_FRAMESTEP).setOnRelease(new ControlMethod(){public void execute(){
Main.setFramestep(1);
}});
// RenderingEngine.incrementOutputFramebuffer(); // RenderingEngine.incrementOutputFramebuffer();
} }

View File

@ -661,9 +661,9 @@ public class LoadingThread extends Thread {
// OpportunisticAttacker.attachToCreature(goblin); // OpportunisticAttacker.attachToCreature(goblin);
//sword //sword
// Entity sword = ItemUtils.spawnBasicItem("Katana"); Entity sword = ItemUtils.spawnBasicItem("Katana");
// EntityUtils.getPosition(sword).set(new Vector3f(1,0.4f,2)); EntityUtils.getPosition(sword).set(new Vector3f(1,0.4f,2));
// EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0))); EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0)));

View File

@ -6,6 +6,7 @@ import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.collidable.Impulse; import electrosphere.entity.state.collidable.Impulse;
import electrosphere.entity.state.equip.EquipState; import electrosphere.entity.state.equip.EquipState;
import electrosphere.entity.state.rotator.RotatorTree; import electrosphere.entity.state.rotator.RotatorTree;
import electrosphere.entity.types.attach.AttachUtils;
import electrosphere.entity.types.collision.CollisionObjUtils; import electrosphere.entity.types.collision.CollisionObjUtils;
import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.types.hitbox.HitboxUtils; import electrosphere.entity.types.hitbox.HitboxUtils;
@ -15,6 +16,7 @@ import electrosphere.game.collision.collidable.Collidable;
import electrosphere.game.data.creature.type.attack.AttackMove; import electrosphere.game.data.creature.type.attack.AttackMove;
import electrosphere.game.data.creature.type.equip.EquipPoint; import electrosphere.game.data.creature.type.equip.EquipPoint;
import electrosphere.main.Globals; import electrosphere.main.Globals;
import electrosphere.main.Main;
import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.EntityMessage;
import electrosphere.renderer.actor.Actor; import electrosphere.renderer.actor.Actor;
import electrosphere.renderer.anim.Animation; import electrosphere.renderer.anim.Animation;
@ -36,8 +38,15 @@ public class AttackTree {
COOLDOWN, COOLDOWN,
IDLE, IDLE,
} }
//the state of drifting forward during the attack
public static enum AttackTreeDriftState {
DRIFT,
NO_DRIFT,
}
AttackTreeState state; AttackTreeState state;
AttackTreeDriftState driftState;
Entity parent; Entity parent;
@ -45,10 +54,7 @@ public class AttackTree {
long lastUpdateTime = 0; long lastUpdateTime = 0;
int frameCurrent; float frameCurrent;
int damageStartFrame = 1;
int damageEndFrame = 2;
String animationName = "SwingWeapon"; String animationName = "SwingWeapon";
@ -66,6 +72,7 @@ public class AttackTree {
public AttackTree(Entity e){ public AttackTree(Entity e){
state = AttackTreeState.IDLE; state = AttackTreeState.IDLE;
driftState = AttackTreeDriftState.NO_DRIFT;
parent = e; parent = e;
} }
@ -94,8 +101,6 @@ public class AttackTree {
currentMove = getNextMove(currentMoveset,currentMove.getNextMoveId()); currentMove = getNextMove(currentMoveset,currentMove.getNextMoveId());
} }
if(currentMove != null){ if(currentMove != null){
damageStartFrame = currentMove.getDamageStartFrame();
damageEndFrame = currentMove.getDamageEndFrame();
firesProjectile = currentMove.getFiresProjectile(); firesProjectile = currentMove.getFiresProjectile();
if(firesProjectile){ if(firesProjectile){
projectileToFire = ItemUtils.getWeaponDataRaw(currentWeapon).getProjectileModel(); projectileToFire = ItemUtils.getWeaponDataRaw(currentWeapon).getProjectileModel();
@ -138,6 +143,7 @@ public class AttackTree {
} }
public void simulate(){ public void simulate(){
frameCurrent = frameCurrent + Main.deltaFrames;
float velocity = CreatureUtils.getVelocity(parent); float velocity = CreatureUtils.getVelocity(parent);
Actor entityActor = EntityUtils.getActor(parent); Actor entityActor = EntityUtils.getActor(parent);
Vector3d position = EntityUtils.getPosition(parent); Vector3d position = EntityUtils.getPosition(parent);
@ -159,12 +165,12 @@ public class AttackTree {
// System.out.println("Set state STARTUP"); // System.out.println("Set state STARTUP");
break; break;
case 1: case 1:
frameCurrent = damageStartFrame+1; frameCurrent = currentMove.getWindupFrames()+1;
state = AttackTreeState.ATTACK; state = AttackTreeState.ATTACK;
// System.out.println("Set state MOVE"); // System.out.println("Set state MOVE");
break; break;
case 2: case 2:
frameCurrent = damageEndFrame+1; frameCurrent = currentMove.getWindupFrames()+currentMove.getAttackFrames()+1;
state = AttackTreeState.COOLDOWN; state = AttackTreeState.COOLDOWN;
// System.out.println("Set state SLOWDOWN"); // System.out.println("Set state SLOWDOWN");
break; break;
@ -187,10 +193,36 @@ public class AttackTree {
case SETFACING: case SETFACING:
case SETPOSITION: case SETPOSITION:
case SETPROPERTY: case SETPROPERTY:
case KILL:
case SPAWNCREATURE:
//silently ignore //silently ignore
break; break;
} }
} }
//handle the drifting if we're supposed to currently
switch(driftState){
case DRIFT:
if(currentMove != null){
//calculate the vector of movement
CollisionObjUtils.getCollidable(parent).addImpulse(new Impulse(new Vector3d(movementVector), new Vector3d(0,0,0), new Vector3d(0,0,0), currentMove.getDriftGoal() * Main.deltaFrames, "movement"));
if(frameCurrent > currentMove.getDriftFrameEnd()){
driftState = AttackTreeDriftState.NO_DRIFT;
}
}
break;
case NO_DRIFT:
if(currentMove != null){
if(frameCurrent > currentMove.getDriftFrameStart() && frameCurrent < currentMove.getDriftFrameEnd()){
driftState = AttackTreeDriftState.DRIFT;
}
}
break;
}
// if(state != AttackTreeState.IDLE){
// System.out.println(frameCurrent);
// }
//state machine //state machine
switch(state){ switch(state){
@ -201,11 +233,10 @@ public class AttackTree {
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationName)){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationName)){
entityActor.playAnimation(animationName,1); entityActor.playAnimation(animationName,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
frameCurrent++; if(frameCurrent > currentMove.getWindupFrames()){
if(frameCurrent > damageStartFrame){
if(currentMoveCanHold && stillHold){ if(currentMoveCanHold && stillHold){
state = AttackTreeState.HOLD; state = AttackTreeState.HOLD;
} else { } else {
@ -248,7 +279,7 @@ public class AttackTree {
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationName)){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationName)){
entityActor.playAnimation(animationName,1); entityActor.playAnimation(animationName,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
if(!stillHold){ if(!stillHold){
@ -288,7 +319,7 @@ public class AttackTree {
break; break;
case ATTACK: case ATTACK:
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
List<Entity> attachedEntities = (List<Entity>)parent.getData(EntityDataStrings.ATTACH_CHILDREN_LIST); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ for(Entity currentAttached : attachedEntities){
if(currentAttached.containsKey(EntityDataStrings.HITBOX_ASSOCIATED_LIST)){ if(currentAttached.containsKey(EntityDataStrings.HITBOX_ASSOCIATED_LIST)){
List<Entity> hitboxes = HitboxUtils.getHitboxAssociatedList(currentAttached); List<Entity> hitboxes = HitboxUtils.getHitboxAssociatedList(currentAttached);
@ -331,8 +362,7 @@ public class AttackTree {
ProjectileUtils.spawnBasicProjectile(projectileToFire, spawnPosition, arrowRotation, 750, initialVector, 0.03f); ProjectileUtils.spawnBasicProjectile(projectileToFire, spawnPosition, arrowRotation, 750, initialVector, 0.03f);
projectileToFire = null; projectileToFire = null;
} }
frameCurrent++; if(frameCurrent > currentMove.getWindupFrames() + currentMove.getAttackFrames()){
if(frameCurrent > damageEndFrame){
state = AttackTreeState.COOLDOWN; state = AttackTreeState.COOLDOWN;
} }
if(Globals.RUN_SERVER){ if(Globals.RUN_SERVER){
@ -369,7 +399,7 @@ public class AttackTree {
break; break;
case COOLDOWN: case COOLDOWN:
if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){ if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
List<Entity> attachedEntities = (List<Entity>)parent.getData(EntityDataStrings.ATTACH_CHILDREN_LIST); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ for(Entity currentAttached : attachedEntities){
if(currentAttached.containsKey(EntityDataStrings.HITBOX_ASSOCIATED_LIST)){ if(currentAttached.containsKey(EntityDataStrings.HITBOX_ASSOCIATED_LIST)){
List<Entity> hitboxes = HitboxUtils.getHitboxAssociatedList(currentAttached); List<Entity> hitboxes = HitboxUtils.getHitboxAssociatedList(currentAttached);
@ -379,8 +409,7 @@ public class AttackTree {
} }
} }
} }
frameCurrent++; if(frameCurrent > currentMove.getWindupFrames() + currentMove.getAttackFrames() + currentMove.getCooldownFrames()){
if(frameCurrent > 60){
state = AttackTreeState.IDLE; state = AttackTreeState.IDLE;
frameCurrent = 0; frameCurrent = 0;
if(parent.containsKey(EntityDataStrings.ROTATOR_TREE)){ if(parent.containsKey(EntityDataStrings.ROTATOR_TREE)){
@ -458,7 +487,12 @@ public class AttackTree {
if(attackType == null){ if(attackType == null){
return false; return false;
} else if(state != AttackTreeState.IDLE){ } else if(state != AttackTreeState.IDLE){
if(currentMove.getNextMoveId() != null && !currentMove.getNextMoveId().equals("")){ //checks if we have a next move and if we're in the specified range of frames when we're allowed to chain into it
if(
currentMove.getNextMoveId() != null &&
!currentMove.getNextMoveId().equals("") &&
frameCurrent >= currentMove.getMoveChainWindowStart() && frameCurrent <= currentMove.getMoveChainWindowEnd()
){
rVal = true; rVal = true;
} }
} else { } else {

View File

@ -108,7 +108,7 @@ public class IdleTree {
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(Animation.ANIMATION_IDLE_1)){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(Animation.ANIMATION_IDLE_1)){
entityActor.playAnimation(Animation.ANIMATION_IDLE_1,3); entityActor.playAnimation(Animation.ANIMATION_IDLE_1,3);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
isIdle = true; isIdle = true;

View File

@ -183,7 +183,7 @@ public class LifeState implements BehaviorTree {
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay) !entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
break; break;

View File

@ -38,7 +38,7 @@ public class FallTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) (jumpTree == null || !jumpTree.isJumping())
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
break; break;
@ -65,7 +65,7 @@ public class FallTree implements BehaviorTree {
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay) !entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
} }

View File

@ -228,7 +228,7 @@ public class GroundMovementTree {
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
//run startup code //run startup code
@ -313,7 +313,7 @@ public class GroundMovementTree {
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
if(velocity != maxNaturalVelocity){ if(velocity != maxNaturalVelocity){
@ -392,7 +392,7 @@ public class GroundMovementTree {
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
//velocity stuff //velocity stuff

View File

@ -57,7 +57,7 @@ public class JumpTree implements BehaviorTree {
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation();
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)){
entityActor.playAnimation(animationToPlay,1); entityActor.playAnimation(animationToPlay,1);
entityActor.incrementAnimationTime(0.01); entityActor.incrementAnimationTime(0.0001);
} }
} }
currentFrame++; currentFrame++;

View File

@ -24,19 +24,27 @@ public class AttackMove {
/* /*
Damage stuff Damage stuff
*/ */
int damageStartFrame; int windupFrames;
int damageEndFrame; int attackFrames;
int cooldownFrames;
boolean firesProjectile; boolean firesProjectile;
/* /*
move chaining stuff move chaining stuff
*/ */
String nextMoveId; String nextMoveId;
String movementStart; int moveChainWindowStart; //when do we open the posibility for a chained move
String movementEnd; int moveChainWindowEnd; // when do we close the opportunity to chain into the next move
float movementGoal; // this is the amount we want the animation to push us forward
boolean initialMove; // is this the initial move in its movelist? boolean initialMove; // is this the initial move in its movelist?
/*
move drift
this is the term to use when describing forward momentum generated by the attack move
*/
float driftGoal; // this is the amount we want the animation to push us forward
int driftFrameStart; //when do we start drifting
int driftFrameEnd; //when do we stop drifting
public String getAttackMoveId(){ public String getAttackMoveId(){
return attackMoveId; return attackMoveId;
} }
@ -57,20 +65,40 @@ public class AttackMove {
return attackAnimationName; return attackAnimationName;
} }
public int getDamageStartFrame() { public int getWindupFrames() {
return damageStartFrame; return windupFrames;
} }
public int getDamageEndFrame() { public int getAttackFrames() {
return damageEndFrame; return attackFrames;
}
public int getCooldownFrames(){
return cooldownFrames;
} }
public String getNextMoveId() { public String getNextMoveId() {
return nextMoveId; return nextMoveId;
} }
public float getMovementGoal(){ public int getMoveChainWindowStart(){
return movementGoal; return moveChainWindowStart;
}
public int getMoveChainWindowEnd(){
return moveChainWindowEnd;
}
public float getDriftGoal(){
return driftGoal;
}
public int getDriftFrameStart(){
return driftFrameStart;
}
public int getDriftFrameEnd(){
return driftFrameEnd;
} }
public boolean isInitialMove(){ public boolean isInitialMove(){

View File

@ -77,6 +77,9 @@ public class Main {
//target amount of time per frame //target amount of time per frame
public static float targetFrameRate = 60.0f; public static float targetFrameRate = 60.0f;
static float targetFramePeriod = 1.0f/targetFrameRate; static float targetFramePeriod = 1.0f/targetFrameRate;
//framestep variable
static int framestep = 2;
public static void main(String args[]){ public static void main(String args[]){
@ -242,6 +245,11 @@ public class Main {
Globals.clientConnection.parseMessages(); Globals.clientConnection.parseMessages();
} }
//handle framestep
if(framestep == 1){
framestep = 0;
}
/// ///
@ -258,20 +266,20 @@ public class Main {
/// ///
/// C L I E N T S I M U L A T I O N S T U F F /// C L I E N T S I M U L A T I O N S T U F F
/// ///
if(Globals.RUN_CLIENT){ if(Globals.RUN_CLIENT && framestep > 0){
ClientFunctions.runBeforeSimulationFunctions(); ClientFunctions.runBeforeSimulationFunctions();
} }
if(Globals.microSimulation != null && Globals.microSimulation.isReady()){ if(Globals.microSimulation != null && Globals.microSimulation.isReady() && framestep > 0){
Globals.microSimulation.simulate(); Globals.microSimulation.simulate();
} }
if(Globals.RUN_CLIENT){ if(Globals.RUN_CLIENT && framestep > 0){
ClientFunctions.runClientFunctions(); ClientFunctions.runClientFunctions();
} }
/// ///
/// M A C R O S I M U L A T I O N S T U F F /// M A C R O S I M U L A T I O N S T U F F
/// ///
if(Globals.macroSimulation != null && Globals.macroSimulation.isReady()){ if(Globals.macroSimulation != null && Globals.macroSimulation.isReady() && framestep > 0){
Globals.macroSimulation.simulate(); Globals.macroSimulation.simulate();
} }
@ -340,6 +348,14 @@ public class Main {
// Globals.controlHandler = FileLoadingUtils.loadModelObjectFromBakedJsonFile("/Config/keybinds.json",ControlHandler.class); // Globals.controlHandler = FileLoadingUtils.loadModelObjectFromBakedJsonFile("/Config/keybinds.json",ControlHandler.class);
} }
/**
* Sets the framestep state (2 to resume automatic, 1 to make single step)
* @param framestep 2 - automatic framestep, 1 - single step, 0 - no step
*/
public static void setFramestep(int framestep){
Main.framestep = framestep;
}

View File

@ -105,8 +105,10 @@ public class WindowUtils {
public static void focusWindow(String window){ public static void focusWindow(String window){
Element windowEl = Globals.elementManager.getWindow(window); Element windowEl = Globals.elementManager.getWindow(window);
Globals.elementManager.unregisterWindow(window); if(windowEl != null){
Globals.elementManager.registerWindow(window, windowEl); Globals.elementManager.unregisterWindow(window);
Globals.elementManager.registerWindow(window, windowEl);
}
} }
} }

View File

@ -635,7 +635,6 @@ public class RenderingEngine {
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
currentActor.incrementAnimationTime(0.001);
//calculate camera-modified vector3f //calculate camera-modified vector3f
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
//calculate and apply model transform //calculate and apply model transform
@ -675,7 +674,6 @@ public class RenderingEngine {
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
currentActor.incrementAnimationTime(0.001);
//calculate camera-modified vector3f //calculate camera-modified vector3f
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
//calculate and apply model transform //calculate and apply model transform
@ -899,7 +897,6 @@ public class RenderingEngine {
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
currentActor.incrementAnimationTime(0.001);
//calculate camera-modified vector3f //calculate camera-modified vector3f
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
//calculate and apply model transform //calculate and apply model transform

View File

@ -89,7 +89,7 @@ public class ActorPanel implements DrawableElement, DraggableElement {
if(currentAnim != null){ if(currentAnim != null){
if(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(currentAnim)){ if(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(currentAnim)){
actor.playAnimation(currentAnim,3); actor.playAnimation(currentAnim,3);
actor.incrementAnimationTime(Main.deltaFrames); actor.incrementAnimationTime(0.0001);
} }
} }