Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final class Sequence {
- public static void unpackConfig(JagexArchive jagexArchive) {
- //717seq 717 seq length = 16858
- //seq.dat 600 seq length = 13798
- ByteBuffer byteBuffer = new ByteBuffer(jagexArchive.getDataForName("seq.dat"));
- int length600 = byteBuffer.readUnsignedWord();
- System.out.println("sequence length = "+length600);
- cache600 = new Sequence[length600];
- for (int j = 0; j < length600; j++) {
- cache600[j] = new Sequence();
- cache600[j].readValues(byteBuffer);
- }
- byteBuffer = new ByteBuffer(jagexArchive.getDataForName("717seq"));
- int length717 = byteBuffer.readUnsignedWord();
- System.out.println("sequence length = "+length717);
- cache700 = new Sequence[length717];
- for (int j = 0; j < length717; j++) {
- cache700[j] = new Sequence();
- cache700[j].readValues(byteBuffer);
- }
- }
- public static Sequence forID(int id) {
- if (id > 13798)
- return cache700[id];
- else
- return cache600[id];
- }
- public static void destruct() {
- cache700 = null;
- cache600 = null;
- }
- public static int length() {
- return cache700.length;
- }
- public int getFrameCount(int i) {
- if (i > frameTimes.length)
- return 0;
- int j = frameTimes[i];
- if (j == 0) {
- Animation animation = Animation.forID(frameIds[i]);
- if (animation != null)
- j = frameTimes[i] = animation.displayLength;
- }
- if (j == 0)
- j = 1;
- return j;
- }
- public void readValues(ByteBuffer byteBuffer) {
- do {
- int i = byteBuffer.readUnsignedByte();
- if (i == 0)
- break;
- if (i == 1) {
- frameCount = byteBuffer.readUnsignedWord();
- frameIds = new int[frameCount];
- interfaceFrames = new int[frameCount];
- frameTimes = new int[frameCount];
- for (int i_ = 0; i_ < frameCount; i_++) {
- frameIds[i_] = byteBuffer.readDWord();
- interfaceFrames[i_] = -1;
- }
- for (int i_ = 0; i_ < frameCount; i_++)
- frameTimes[i_] = byteBuffer.readUnsignedByte();
- } else if (i == 2)
- frameStep = byteBuffer.readUnsignedWord();
- else if (i == 3) {
- int k = byteBuffer.readUnsignedByte();
- flowControl = new int[k + 1];
- for (int l = 0; l < k; l++)
- flowControl[l] = byteBuffer.readUnsignedByte();
- flowControl[k] = 0x98967f;
- } else if (i == 4)
- isTurnAnim = true;
- else if (i == 5)
- interuptebleSignificance = byteBuffer.readUnsignedByte();
- else if (i == 6)
- rightHandItem = byteBuffer.readUnsignedWord();
- else if (i == 7)
- leftHandItem = byteBuffer.readUnsignedWord();
- else if (i == 8)
- shutdownMovement = byteBuffer.readUnsignedByte();
- else if (i == 9)
- priority2 = byteBuffer.readUnsignedByte();
- else if (i == 10)
- priority = byteBuffer.readUnsignedByte();
- else if (i == 11)
- type = byteBuffer.readUnsignedByte();
- else
- System.out.println("Unrecognized seq.dat config code: " + i);
- } while (true);
- if (frameCount == 0) {
- frameCount = 1;
- frameIds = new int[1];
- frameIds[0] = -1;
- interfaceFrames = new int[1];
- interfaceFrames[0] = -1;
- frameTimes = new int[1];
- frameTimes[0] = -1;
- }
- if (priority2 == -1)
- if (flowControl != null)
- priority2 = 2;
- else
- priority2 = 0;
- if (priority == -1) {
- if (flowControl != null) {
- priority = 2;
- return;
- }
- priority = 0;
- }
- if(rightHandItem == 65535)
- rightHandItem = 0;
- if(leftHandItem == 65535)
- leftHandItem = 0;
- if (rightHandItem > 0)
- rightHandItem += 3584;
- if (leftHandItem > 0)
- leftHandItem += 3584;
- }
- private Sequence() {
- frameStep = -1;
- isTurnAnim = false;
- interuptebleSignificance = 5;
- rightHandItem = -1;
- leftHandItem = -1;
- shutdownMovement = 99;
- priority2 = -1;
- priority = -1;
- type = 2;
- }
- static Sequence cache700[];
- static Sequence cache600[];
- public int frameCount;
- public int frameIds[];
- public int interfaceFrames[];
- private int[] frameTimes;
- public int frameStep;
- public int flowControl[];
- public boolean isTurnAnim;
- public int interuptebleSignificance;
- public int rightHandItem;
- public int leftHandItem;
- public int shutdownMovement;
- public int priority2;
- public int priority;
- public int type;
- }
Add Comment
Please, Sign In to add comment