mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-03-06 07:30:41 +07:00
Created AnimDataKeyframeEvent
AnimStepper will generate Keyframe events for non-zero keyframes Created constants for keyframe values and debug toString method Added logging to AnimStepper
This commit is contained in:
parent
37a4df94d9
commit
a51e4f0b47
@ -37,6 +37,20 @@ public class Engine {
|
|||||||
return COMPOSITE_NAME[component];
|
return COMPOSITE_NAME[component];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final byte KEYFRAME_NIL = 0;
|
||||||
|
public static final byte KEYFRAME_ATK = 1;
|
||||||
|
public static final byte KEYFRAME_MIS = 2;
|
||||||
|
public static final byte KEYFRAME_SND = 3;
|
||||||
|
public static final byte KEYFRAME_SKL = 4;
|
||||||
|
|
||||||
|
private static final String[] KEYFRAME_NAME = {
|
||||||
|
"", "ATK", "MIS", "SND", "SKL"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static String getKeyframe(byte keyframe) {
|
||||||
|
return KEYFRAME_NAME[keyframe];
|
||||||
|
}
|
||||||
|
|
||||||
public static final class Object {
|
public static final class Object {
|
||||||
public static final int SUBCLASS_SHRINE = 1 << 0; // displays "<shrine_type> Shrine"
|
public static final int SUBCLASS_SHRINE = 1 << 0; // displays "<shrine_type> Shrine"
|
||||||
public static final int SUBCLASS_OBELISH = 1 << 1; // does nothing
|
public static final int SUBCLASS_OBELISH = 1 << 1; // does nothing
|
||||||
|
@ -4,13 +4,16 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
import com.artemis.ComponentMapper;
|
import com.artemis.ComponentMapper;
|
||||||
import net.mostlyoriginal.api.event.common.EventSystem;
|
import net.mostlyoriginal.api.event.common.EventSystem;
|
||||||
|
import net.mostlyoriginal.api.event.common.Subscribe;
|
||||||
import net.mostlyoriginal.api.system.core.PassiveSystem;
|
import net.mostlyoriginal.api.system.core.PassiveSystem;
|
||||||
|
|
||||||
import com.riiablo.Riiablo;
|
import com.riiablo.Riiablo;
|
||||||
import com.riiablo.codec.excel.Skills;
|
import com.riiablo.codec.excel.Skills;
|
||||||
|
import com.riiablo.engine.Engine;
|
||||||
import com.riiablo.engine.server.component.Class;
|
import com.riiablo.engine.server.component.Class;
|
||||||
import com.riiablo.engine.server.component.MovementModes;
|
import com.riiablo.engine.server.component.MovementModes;
|
||||||
import com.riiablo.engine.server.component.Sequence;
|
import com.riiablo.engine.server.component.Sequence;
|
||||||
|
import com.riiablo.engine.server.event.AnimDataKeyframeEvent;
|
||||||
import com.riiablo.engine.server.event.SkillCastEvent;
|
import com.riiablo.engine.server.event.SkillCastEvent;
|
||||||
import com.riiablo.log.LogManager;
|
import com.riiablo.log.LogManager;
|
||||||
|
|
||||||
@ -42,6 +45,12 @@ public class Actioneer extends PassiveSystem {
|
|||||||
srvstfunc(entityId, skill.srvstfunc);
|
srvstfunc(entityId, skill.srvstfunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onKeyframe(AnimDataKeyframeEvent event) {
|
||||||
|
log.debug("onKeyframe: {}, {} ({})", event.entityId, event.keyframe, Engine.getKeyframe(event.keyframe));
|
||||||
|
// if isCasting(id): srvdofunc(id, spell.srcdofunc)
|
||||||
|
}
|
||||||
|
|
||||||
// start func
|
// start func
|
||||||
private void srvstfunc(int entityId, int srvstfunc) {
|
private void srvstfunc(int entityId, int srvstfunc) {
|
||||||
log.trace("srvstfunc({},{})", entityId, srvstfunc);
|
log.trace("srvstfunc({},{})", entityId, srvstfunc);
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
package com.riiablo.engine.server;
|
package com.riiablo.engine.server;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.artemis.ComponentMapper;
|
import com.artemis.ComponentMapper;
|
||||||
import com.artemis.annotations.All;
|
import com.artemis.annotations.All;
|
||||||
import com.artemis.systems.IntervalIteratingSystem;
|
import com.artemis.systems.IntervalIteratingSystem;
|
||||||
|
import net.mostlyoriginal.api.event.common.EventSystem;
|
||||||
|
|
||||||
import com.riiablo.codec.Animation;
|
import com.riiablo.codec.Animation;
|
||||||
|
import com.riiablo.engine.Engine;
|
||||||
import com.riiablo.engine.server.component.AnimData;
|
import com.riiablo.engine.server.component.AnimData;
|
||||||
import com.riiablo.engine.server.event.AnimDataFinishedEvent;
|
import com.riiablo.engine.server.event.AnimDataFinishedEvent;
|
||||||
|
import com.riiablo.engine.server.event.AnimDataKeyframeEvent;
|
||||||
import net.mostlyoriginal.api.event.common.EventSystem;
|
import com.riiablo.log.LogManager;
|
||||||
|
|
||||||
@All(AnimData.class)
|
@All(AnimData.class)
|
||||||
public class AnimStepper extends IntervalIteratingSystem {
|
public class AnimStepper extends IntervalIteratingSystem {
|
||||||
|
private static final Logger log = LogManager.getLogger(AnimStepper.class);
|
||||||
|
|
||||||
protected ComponentMapper<AnimData> mAnimData;
|
protected ComponentMapper<AnimData> mAnimData;
|
||||||
|
|
||||||
protected EventSystem events;
|
protected EventSystem events;
|
||||||
@ -27,5 +34,11 @@ public class AnimStepper extends IntervalIteratingSystem {
|
|||||||
animData.frame -= animData.numFrames;
|
animData.frame -= animData.numFrames;
|
||||||
events.dispatch(AnimDataFinishedEvent.obtain(entityId));
|
events.dispatch(AnimDataFinishedEvent.obtain(entityId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final byte keyframe = animData.keyframes[animData.frame >>> 8];
|
||||||
|
if (keyframe > Engine.KEYFRAME_NIL) {
|
||||||
|
log.debug("broadcasting AnimDataKeyframeEvent({},{})", entityId, Engine.getKeyframe(keyframe));
|
||||||
|
events.dispatch(AnimDataKeyframeEvent.obtain(entityId, keyframe));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.riiablo.engine.server.event;
|
||||||
|
|
||||||
|
import com.artemis.annotations.EntityId;
|
||||||
|
import net.mostlyoriginal.api.event.common.Event;
|
||||||
|
|
||||||
|
public class AnimDataKeyframeEvent implements Event {
|
||||||
|
@EntityId
|
||||||
|
public int entityId;
|
||||||
|
|
||||||
|
public byte keyframe;
|
||||||
|
|
||||||
|
public static AnimDataKeyframeEvent obtain(int entityId, byte keyframe) {
|
||||||
|
AnimDataKeyframeEvent event = new AnimDataKeyframeEvent();
|
||||||
|
event.entityId = entityId;
|
||||||
|
event.keyframe = keyframe;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user