mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-06 16:27:34 +07:00
Added support for setting animation speeds
This commit is contained in:
@ -57,6 +57,8 @@ public class CofComponent implements Component, Pool.Poolable {
|
||||
Arrays.fill(DEFAULT_ALPHA, ALPHA_NULL);
|
||||
}
|
||||
|
||||
public static final int SPEED_NULL = -1;
|
||||
|
||||
public String token;
|
||||
public int mode;
|
||||
public int wclass;
|
||||
@ -64,6 +66,7 @@ public class CofComponent implements Component, Pool.Poolable {
|
||||
public int dirty; // cof layers need to be loaded
|
||||
public int load; // cof layers loading
|
||||
public int update; // update component
|
||||
public int speed;
|
||||
|
||||
public final int component[];
|
||||
public final byte transform[];
|
||||
@ -88,6 +91,7 @@ public class CofComponent implements Component, Pool.Poolable {
|
||||
dirty = Dirty.NONE;
|
||||
load = Dirty.NONE;
|
||||
update = Dirty.NONE;
|
||||
speed = SPEED_NULL;
|
||||
System.arraycopy(DEFAULT_COMPONENT, 0, component, 0, COF.Component.NUM_COMPONENTS);
|
||||
System.arraycopy(DEFAULT_TRANSFORM, 0, transform, 0, COF.Component.NUM_COMPONENTS);
|
||||
System.arraycopy(DEFAULT_ALPHA, 0, alpha, 0, COF.Component.NUM_COMPONENTS);
|
||||
|
@ -45,7 +45,11 @@ public class AnimationLoaderSystem extends IteratingSystem {
|
||||
boolean changed = false;
|
||||
COF cof = cofComponent.cof;
|
||||
if (cof == null) return;
|
||||
anim.setCOF(cof);
|
||||
// FIXME: logic here needs to be looked into -- should below operations be performed when cof didn't change?
|
||||
boolean newCof = anim.setCOF(cof);
|
||||
if (newCof && cofComponent.speed != CofComponent.SPEED_NULL) {
|
||||
anim.setFrameDelta(cofComponent.speed);
|
||||
}
|
||||
for (int l = 0, numLayers = cof.getNumLayers(); l < numLayers; l++) {
|
||||
COF.Layer layer = cof.getLayer(l);
|
||||
if (!Dirty.isDirty(cofComponent.load, layer.component)) continue;
|
||||
|
Reference in New Issue
Block a user