SeqType
This commit is contained in:
1 parent
46203d5455
commit
2ed0f2a04d
5 files changed
+78
-38
No files matched your search
+11
-11
@@ -7267,7 +7267,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
public void startForceMovement(PathingEntity entity) {
|
||||
if ((entity.forceMoveStartCycle == loopCycle) || (entity.primarySeqID == -1) || (entity.primarySeqDelay != 0) || ((entity.primarySeqCycle + 1) > SeqType.instances[entity.primarySeqID].getFrameDelay(entity.primarySeqFrame))) {
|
||||
if ((entity.forceMoveStartCycle == loopCycle) || (entity.primarySeqID == -1) || (entity.primarySeqDelay != 0) || ((entity.primarySeqCycle + 1) > SeqType.instances[entity.primarySeqID].getFrameDuration(entity.primarySeqFrame))) {
|
||||
int duration = entity.forceMoveStartCycle - entity.forceMoveEndCycle;
|
||||
int delta = loopCycle - entity.forceMoveEndCycle;
|
||||
int dx0 = (entity.forceMoveStartSceneTileX * 128) + (entity.size * 64);
|
||||
@@ -7520,7 +7520,7 @@ public class Game extends GameShell {
|
||||
SeqType seq = SeqType.instances[e.secondarySeqID];
|
||||
e.secondarySeqCycle++;
|
||||
|
||||
if ((e.secondarySeqFrame < seq.frameCount) && (e.secondarySeqCycle > seq.getFrameDelay(e.secondarySeqFrame))) {
|
||||
if ((e.secondarySeqFrame < seq.frameCount) && (e.secondarySeqCycle > seq.getFrameDuration(e.secondarySeqFrame))) {
|
||||
e.secondarySeqCycle = 0;
|
||||
e.secondarySeqFrame++;
|
||||
}
|
||||
@@ -7538,8 +7538,8 @@ public class Game extends GameShell {
|
||||
|
||||
SeqType seq = SpotAnimType.instances[e.spotanim].seq;
|
||||
|
||||
for (e.spotanimCycle++; (e.spotanimFrame < seq.frameCount) && (e.spotanimCycle > seq.getFrameDelay(e.spotanimFrame)); e.spotanimFrame++) {
|
||||
e.spotanimCycle -= seq.getFrameDelay(e.spotanimFrame);
|
||||
for (e.spotanimCycle++; (e.spotanimFrame < seq.frameCount) && (e.spotanimCycle > seq.getFrameDuration(e.spotanimFrame)); e.spotanimFrame++) {
|
||||
e.spotanimCycle -= seq.getFrameDuration(e.spotanimFrame);
|
||||
}
|
||||
|
||||
if ((e.spotanimFrame >= seq.frameCount) && ((e.spotanimFrame < 0) || (e.spotanimFrame >= seq.frameCount))) {
|
||||
@@ -7561,12 +7561,12 @@ public class Game extends GameShell {
|
||||
if ((e.primarySeqID != -1) && (e.primarySeqDelay == 0)) {
|
||||
SeqType seq = SeqType.instances[e.primarySeqID];
|
||||
|
||||
for (e.primarySeqCycle++; (e.primarySeqFrame < seq.frameCount) && (e.primarySeqCycle > seq.getFrameDelay(e.primarySeqFrame)); e.primarySeqFrame++) {
|
||||
e.primarySeqCycle -= seq.getFrameDelay(e.primarySeqFrame);
|
||||
for (e.primarySeqCycle++; (e.primarySeqFrame < seq.frameCount) && (e.primarySeqCycle > seq.getFrameDuration(e.primarySeqFrame)); e.primarySeqFrame++) {
|
||||
e.primarySeqCycle -= seq.getFrameDuration(e.primarySeqFrame);
|
||||
}
|
||||
|
||||
if (e.primarySeqFrame >= seq.frameCount) {
|
||||
e.primarySeqFrame -= seq.speed;
|
||||
e.primarySeqFrame -= seq.loopFrameCount;
|
||||
e.primarySeqLoop++;
|
||||
|
||||
if (e.primarySeqLoop >= seq.loopCount) {
|
||||
@@ -7576,7 +7576,7 @@ public class Game extends GameShell {
|
||||
e.primarySeqID = -1;
|
||||
}
|
||||
}
|
||||
e.aBoolean1541 = seq.aBoolean358;
|
||||
e.aBoolean1541 = seq.forwardRenderPadding;
|
||||
}
|
||||
|
||||
if (e.primarySeqDelay > 0) {
|
||||
@@ -8791,11 +8791,11 @@ public class Game extends GameShell {
|
||||
|
||||
if (seqId != -1) {
|
||||
SeqType type = SeqType.instances[seqId];
|
||||
for (child.seqCycle += delta; child.seqCycle > type.getFrameDelay(child.seqFrame); ) {
|
||||
child.seqCycle -= type.getFrameDelay(child.seqFrame) + 1;
|
||||
for (child.seqCycle += delta; child.seqCycle > type.getFrameDuration(child.seqFrame); ) {
|
||||
child.seqCycle -= type.getFrameDuration(child.seqFrame) + 1;
|
||||
child.seqFrame++;
|
||||
if (child.seqFrame >= type.frameCount) {
|
||||
child.seqFrame -= type.speed;
|
||||
child.seqFrame -= type.loopFrameCount;
|
||||
if ((child.seqFrame < 0) || (child.seqFrame >= type.frameCount)) {
|
||||
child.seqFrame = 0;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ public class LocEntity extends Entity {
|
||||
seqFrame = 0;
|
||||
seqCycle = Game.loopCycle;
|
||||
|
||||
if (randomFrame && (seq.speed != -1)) {
|
||||
if (randomFrame && (seq.loopFrameCount != -1)) {
|
||||
seqFrame = (int) (Math.random() * (double) seq.frameCount);
|
||||
seqCycle -= (int) (Math.random() * (double) seq.getFrameDelay(seqFrame));
|
||||
seqCycle -= (int) (Math.random() * (double) seq.getFrameDuration(seqFrame));
|
||||
}
|
||||
}
|
||||
LocType type = LocType.get(this.id);
|
||||
@@ -51,19 +51,19 @@ public class LocEntity extends Entity {
|
||||
if (seq != null) {
|
||||
int delta = Game.loopCycle - seqCycle;
|
||||
|
||||
if ((delta > 100) && (seq.speed > 0)) {
|
||||
if ((delta > 100) && (seq.loopFrameCount > 0)) {
|
||||
delta = 100;
|
||||
}
|
||||
|
||||
while (delta > seq.getFrameDelay(seqFrame)) {
|
||||
delta -= seq.getFrameDelay(seqFrame);
|
||||
while (delta > seq.getFrameDuration(seqFrame)) {
|
||||
delta -= seq.getFrameDuration(seqFrame);
|
||||
seqFrame++;
|
||||
|
||||
if (seqFrame < seq.frameCount) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seqFrame -= seq.speed;
|
||||
seqFrame -= seq.loopFrameCount;
|
||||
|
||||
if ((seqFrame >= 0) && (seqFrame < seq.frameCount)) {
|
||||
continue;
|
||||
|
||||
@@ -96,8 +96,8 @@ public class ProjectileEntity extends Entity {
|
||||
anInt1595 = ((int) (Math.atan2(aDouble1574, aDouble1575) * 325.94900000000001D) + 1024) & 0x7ff;
|
||||
anInt1596 = (int) (Math.atan2(aDouble1577, aDouble1576) * 325.94900000000001D) & 0x7ff;
|
||||
if (aType_1592.seq != null) {
|
||||
for (anInt1594 += i; anInt1594 > aType_1592.seq.getFrameDelay(anInt1593); ) {
|
||||
anInt1594 -= aType_1592.seq.getFrameDelay(anInt1593) + 1;
|
||||
for (anInt1594 += i; anInt1594 > aType_1592.seq.getFrameDuration(anInt1593); ) {
|
||||
anInt1594 -= aType_1592.seq.getFrameDuration(anInt1593) + 1;
|
||||
anInt1593++;
|
||||
if (anInt1593 >= aType_1592.seq.frameCount) {
|
||||
anInt1593 = 0;
|
||||
|
||||
+57
-17
@@ -24,20 +24,60 @@ public class SeqType {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of frames in this {@link SeqType}.
|
||||
*/
|
||||
public int frameCount;
|
||||
|
||||
/**
|
||||
* The list of {@link SeqTransform} indices indexed by Frame ID.
|
||||
* @see SeqTransform
|
||||
*/
|
||||
public int[] transformIndices;
|
||||
|
||||
/**
|
||||
* Auxiliary transform indices appear to only be used by a {@link Component} of type <code>6</code> as seen in {@link Game#drawParentComponent(Component, int, int, int)}.
|
||||
*/
|
||||
public int[] auxiliaryTransformIndices;
|
||||
public int[] frameDelays;
|
||||
public int speed = -1;
|
||||
|
||||
/**
|
||||
* A list of durations indexed by Frame ID.
|
||||
*/
|
||||
public int[] frameDuration;
|
||||
|
||||
/**
|
||||
* The number of frames from the end of this {@link SeqType} used for looping.
|
||||
*/
|
||||
public int loopFrameCount = -1;
|
||||
|
||||
/**
|
||||
* Used to determine which transform bases a primary frame is allowed to use, and secondary not.
|
||||
* @see Model#applyTransforms(int, int, int[])
|
||||
*/
|
||||
public int[] mask;
|
||||
public boolean aBoolean358 = false;
|
||||
|
||||
/**
|
||||
* Adds additional space to the render bounds.
|
||||
* @see Scene#addTemporary(Entity, int, int, int, int, int, int, boolean, int)
|
||||
*/
|
||||
public boolean forwardRenderPadding = false;
|
||||
public int priority = 5;
|
||||
|
||||
/**
|
||||
* Allows this {@link SeqType} to override the right hand of a {@link PlayerEntity}.
|
||||
* @see PlayerEntity#getSequencedModel()
|
||||
*/
|
||||
public int rightHandOverride = -1;
|
||||
|
||||
/**
|
||||
* Allows this {@link SeqType} to override the left hand of a {@link PlayerEntity}.
|
||||
* @see PlayerEntity#getSequencedModel()
|
||||
*/
|
||||
public int leftHandOverride = -1;
|
||||
|
||||
/**
|
||||
* How many times this seq is allowed to loop before stopping.
|
||||
*/
|
||||
public int loopCount = 99;
|
||||
|
||||
/**
|
||||
@@ -59,7 +99,7 @@ public class SeqType {
|
||||
/**
|
||||
* If 0, restarts the sequence if already playing
|
||||
* If 1, does not restart if already playing
|
||||
* @see Game#method86(Buffer)
|
||||
* @see Game#method86(Buffer)
|
||||
*/
|
||||
public int replayStyle = 1;
|
||||
|
||||
@@ -68,21 +108,21 @@ public class SeqType {
|
||||
public SeqType() {
|
||||
}
|
||||
|
||||
public int getFrameDelay(int frame) {
|
||||
int delay = frameDelays[frame];
|
||||
public int getFrameDuration(int frame) {
|
||||
int duration = frameDuration[frame];
|
||||
|
||||
if (delay == 0) {
|
||||
if (duration == 0) {
|
||||
SeqTransform transform = SeqTransform.get(transformIndices[frame]);
|
||||
if (transform != null) {
|
||||
delay = frameDelays[frame] = transform.delay;
|
||||
duration = frameDuration[frame] = transform.delay;
|
||||
}
|
||||
}
|
||||
|
||||
if (delay == 0) {
|
||||
delay = 1;
|
||||
if (duration == 0) {
|
||||
duration = 1;
|
||||
}
|
||||
|
||||
return delay;
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void load(Buffer buffer) {
|
||||
@@ -94,17 +134,17 @@ public class SeqType {
|
||||
frameCount = buffer.get1U();
|
||||
transformIndices = new int[frameCount];
|
||||
auxiliaryTransformIndices = new int[frameCount];
|
||||
frameDelays = new int[frameCount];
|
||||
frameDuration = new int[frameCount];
|
||||
for (int f = 0; f < frameCount; f++) {
|
||||
transformIndices[f] = buffer.get2U();
|
||||
auxiliaryTransformIndices[f] = buffer.get2U();
|
||||
if (auxiliaryTransformIndices[f] == 65535) {
|
||||
auxiliaryTransformIndices[f] = -1;
|
||||
}
|
||||
frameDelays[f] = buffer.get2U();
|
||||
frameDuration[f] = buffer.get2U();
|
||||
}
|
||||
} else if (op == 2) {
|
||||
speed = buffer.get2U();
|
||||
loopFrameCount = buffer.get2U();
|
||||
} else if (op == 3) {
|
||||
int count = buffer.get1U();
|
||||
mask = new int[count + 1];
|
||||
@@ -113,7 +153,7 @@ public class SeqType {
|
||||
}
|
||||
mask[count] = 9999999;
|
||||
} else if (op == 4) {
|
||||
aBoolean358 = true;
|
||||
forwardRenderPadding = true;
|
||||
} else if (op == 5) {
|
||||
priority = buffer.get1U();
|
||||
} else if (op == 6) {
|
||||
@@ -141,8 +181,8 @@ public class SeqType {
|
||||
transformIndices[0] = -1;
|
||||
auxiliaryTransformIndices = new int[1];
|
||||
auxiliaryTransformIndices[0] = -1;
|
||||
frameDelays = new int[1];
|
||||
frameDelays[0] = -1;
|
||||
frameDuration = new int[1];
|
||||
frameDuration[0] = -1;
|
||||
}
|
||||
|
||||
if (moveStyle == -1) {
|
||||
|
||||
@@ -65,8 +65,8 @@ public class SpotAnimEntity extends Entity {
|
||||
}
|
||||
|
||||
public void update(int delta) {
|
||||
for (seqCycle += delta; seqCycle > type.seq.getFrameDelay(seqFrame); ) {
|
||||
seqCycle -= type.seq.getFrameDelay(seqFrame) + 1;
|
||||
for (seqCycle += delta; seqCycle > type.seq.getFrameDuration(seqFrame); ) {
|
||||
seqCycle -= type.seq.getFrameDuration(seqFrame) + 1;
|
||||
seqFrame++;
|
||||
|
||||
if (seqFrame >= type.seq.frameCount) {
|
||||
|
||||
Reference in new issue
Block a user