Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final class AnimFrame {
- //public static java.util.Hashtable<Integer, AnimFrame> frameList = new java.util.Hashtable<Integer, AnimFrame>();
- // public static java.util.Hashtable<Integer, AnimFrame> frameListOSRS = new java.util.Hashtable<Integer, AnimFrame>();
- public static AnimFrame[][] frameList = new AnimFrame[8000][0];
- public static AnimFrame[][] frameListOSRS = new AnimFrame[8000][0];
- public static void loadOSRS(int file, byte[] array) {
- try {
- final Stream ay = new Stream(array);
- final Frames b2 = new Frames(ay, 317, file);
- final int n = ay.readUnsignedWord();
- frameListOSRS[file] = new AnimFrame[(int) (n * 1.5)];
- final int[] array2 = new int[500];
- final int[] array3 = new int[500];
- final int[] array4 = new int[500];
- final int[] array5 = new int[500];
- for (int j = 0; j < n; ++j) {
- final int k = ay.readUnsignedWord();
- final AnimFrame animFrame = new AnimFrame();
- frameListOSRS[file][k] = animFrame;
- animFrame.aClass18_637 = b2;
- final int f = ay.readUnsignedByte();
- int c2 = 0;
- int n3 = -1;
- for (int l = 0; l < f; ++l) {
- final int f2;
- if ((f2 = ay.readUnsignedByte()) > 0) {
- if (b2.anIntArray342[l] != 0) {
- for (int n4 = l - 1; n4 > n3; --n4) {
- if (b2.anIntArray342[n4] == 0) {
- array2[c2] = n4;
- array3[c2] = 0;
- array5[c2] = (array4[c2] = 0);
- ++c2;
- break;
- }
- }
- }
- array2[c2] = l;
- int n4 = 0;
- if (b2.anIntArray342[l] == 3) {
- n4 = 128;
- }
- if ((f2 & 0x1) != 0x0) {
- array3[c2] = ay.readShort2();
- } else {
- array3[c2] = n4;
- }
- if ((f2 & 0x2) != 0x0) {
- array4[c2] = ay.readShort2();
- } else {
- array4[c2] = n4;
- }
- if ((f2 & 0x4) != 0x0) {
- array5[c2] = ay.readShort2();
- } else {
- array5[c2] = n4;
- }
- n3 = l;
- ++c2;
- }
- }
- animFrame.anInt638 = c2;
- animFrame.anIntArray639 = new int[c2];
- animFrame.anIntArray640 = new int[c2];
- animFrame.anIntArray641 = new int[c2];
- animFrame.anIntArray642 = new int[c2];
- for (int l = 0; l < c2; ++l) {
- animFrame.anIntArray639[l] = array2[l];
- animFrame.anIntArray640[l] = array3[l];
- animFrame.anIntArray641[l] = array4[l];
- animFrame.anIntArray642[l] = array5[l];
- }
- }
- } catch (Exception ex) {
- System.err.println("This OSRS anim file is bugged: " + file);
- }
- }
- public static void load474(byte abyte0[], int fileId) {
- try {
- Stream stream = new Stream(abyte0);
- stream.currentOffset = abyte0.length - 12;
- int i = stream.readDWord();
- int j = stream.readDWord();
- int k = stream.readDWord();
- int i1 = 0;
- Stream stream_1 = new Stream(abyte0);
- stream_1.currentOffset = i1;
- i1 += i + 4;
- Stream stream_2 = new Stream(abyte0);
- stream_2.currentOffset = i1;
- i1 += j;
- Stream stream_3 = new Stream(abyte0);
- stream_3.currentOffset = i1;
- i1 += k;
- Stream stream_4 = new Stream(abyte0);
- stream_4.currentOffset = i1;
- //System.out.println("Fileid: "+fileId);
- Frames class18 = new Frames(stream_4, 474, fileId);
- int k1 = stream_1.readDWord();
- frameList[fileId] = new AnimFrame[(int) (k1 * 1.5)];
- int ai[] = new int[500];
- int ai1[] = new int[500];
- int ai2[] = new int[500];
- int ai3[] = new int[500];
- for (int l1 = 0; l1 < k1; l1++) {
- int i2 = stream_1.readDWord();
- AnimFrame class36 = new AnimFrame();
- frameList[fileId][i2] = class36;
- class36.aClass18_637 = class18;
- int j2 = stream_1.readUnsignedByte();
- int k2 = -1;
- int l2 = 0;
- for (int i3 = 0; i3 < j2; i3++) {
- int j3 = stream_2.readUnsignedByte();
- if (j3 > 0) {
- if (i3 < class18.anIntArray342.length && class18.anIntArray342[i3] != 0) {
- for (int l3 = i3 - 1; l3 > k2; l3--) {
- if (class18.anIntArray342[l3] != 0) {
- continue;
- }
- ai[l2] = l3;
- ai1[l2] = 0;
- ai2[l2] = 0;
- ai3[l2] = 0;
- l2++;
- break;
- }
- }
- ai[l2] = i3;
- char c = '\0';
- if (i3 < class18.anIntArray342.length && class18.anIntArray342[i3] == 3) {
- c = '\200';
- }
- if ((j3 & 1) != 0) {
- ai1[l2] = stream_3.method421();
- } else {
- ai1[l2] = c;
- }
- if ((j3 & 2) != 0) {
- ai2[l2] = stream_3.method421();
- } else {
- ai2[l2] = c;
- }
- if ((j3 & 4) != 0) {
- ai3[l2] = stream_3.method421();
- } else {
- ai3[l2] = c;
- }
- k2 = i3;
- l2++;
- }
- }
- class36.anInt638 = l2;
- class36.anIntArray639 = new int[l2];
- class36.anIntArray640 = new int[l2];
- class36.anIntArray641 = new int[l2];
- class36.anIntArray642 = new int[l2];
- for (int k3 = 0; k3 < l2; k3++) {
- class36.anIntArray639[k3] = ai[k3];
- class36.anIntArray640[k3] = ai1[k3];
- class36.anIntArray641[k3] = ai2[k3];
- class36.anIntArray642[k3] = ai3[k3];
- }
- }
- } catch (Exception e) {
- System.err.println("This 474 anim file is bugged: " + fileId);
- //e.printStackTrace();
- }
- }
- public static void nullLoader() {
- frameList = null;
- animationlist = null;
- }
- public static void init(int i) {
- animationlist = new AnimFrame[i][0];
- }
- static int[] lastAnim = {-1, -1};
- static int animFill = 0;
- static int lastFile;
- public static AnimFrame getAnim(int j) {
- int fileId = j >> 16;
- if (lastAnim[0] != fileId && lastAnim[1] != fileId) {
- if (Client.testAnimsAndGfx) {
- if (AnimDef.isOSRSFile(fileId)) {
- System.out.println("file id requested: " + fileId + " - osrs: " + AnimDef.isOSRSFile(fileId));
- }
- }
- lastAnim[animFill] = fileId;
- if (animFill == 1) {
- animFill = 0;
- } else {
- animFill++;
- }
- }
- if (AnimDef.isOSRSFile(fileId)) {
- return getAnimOSRS(j);
- }
- return getAnim474(j);
- }
- // lol wrong wait go to this method
- /*public static AnimFrame getAnimOSRS(int int1) {
- try {
- final String hexString;
- final int int2 = Integer.parseInt((hexString = Integer.toHexString(int1)).substring(0, hexString.length() - 4), 16);
- int1 = Integer.parseInt(hexString.substring(hexString.length() - 4), 16);
- if (animationlist[int2].length == 0) {
- System.out.println("[frames osrs] request: " +int2);
- //Client.instance.onDemandFetcher.loadToCache(4, int2);
- Client.instance.onDemandFetcher.loadToCache(6, int2);
- return null;
- }
- return animationlist[int2][int1];
- } catch (Exception ex) {
- ex.printStackTrace();
- return null;
- }
- }*/
- public static AnimFrame getAnimOSRS(int j) {
- int fileId = j >> 16;
- lastFile = fileId;
- try {
- int[] kkkGroup1 = getKKKGroupPeople(j);
- int file = kkkGroup1[0];
- int frame = kkkGroup[1];
- if (frameListOSRS[file].length == 0) {
- Client.instance.onDemandFetcher.loadToCache(6, fileId);
- return null;
- }
- return frameListOSRS[file][frame];
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- public static AnimFrame getAnim474(int j) {
- int fileId = j >> 16;
- lastFile = fileId;
- try {
- int[] kkkGroup1 = getKKKGroupPeople(j);
- int file = kkkGroup1[0];
- int frame = kkkGroup[1];
- if (frameList[file].length == 0) {
- Client.instance.onDemandFetcher.loadToCache(1, fileId);
- return null;
- }
- return frameList[file][frame];
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- public static int[] getKKKGroupPeople(int k){
- int[] kkkGroup1 = kkkGroup[k];
- if(kkkGroup1 == null){
- String hex = Integer.toHexString(j);
- int file = Integer.parseInt(hex.substring(0, (hex.length() - 4)), 16);
- int frame = Integer.parseInt(hex.substring((hex.length() - 4)), 16);
- kkkGroup1 = kkkGroup[k] = new int[]{file, frame};
- }
- return kkkGroup1;
- }
- public static boolean method532(int i) {
- return i == -1;
- }
- public AnimFrame() {
- }
- public static AnimFrame animationlist[][];
- private static int[][] kkkGroup = new int[8000][];
- public int anInt636;
- public Frames aClass18_637;
- public int anInt638;
- public int anIntArray639[];
- public int anIntArray640[];
- public int anIntArray641[];
- public int anIntArray642[];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement