Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.20 KB | None | 0 0
  1.  
  2. public final class AnimFrame {
  3.  
  4.     //public static java.util.Hashtable<Integer, AnimFrame> frameList = new java.util.Hashtable<Integer, AnimFrame>();
  5.     // public static java.util.Hashtable<Integer, AnimFrame> frameListOSRS = new java.util.Hashtable<Integer, AnimFrame>();
  6.     public static AnimFrame[][] frameList = new AnimFrame[8000][0];
  7.     public static AnimFrame[][] frameListOSRS = new AnimFrame[8000][0];
  8.  
  9.     public static void loadOSRS(int file, byte[] array) {
  10.  
  11.         try {
  12.             final Stream ay = new Stream(array);
  13.             final Frames b2 = new Frames(ay, 317, file);
  14.             final int n = ay.readUnsignedWord();
  15.             frameListOSRS[file] = new AnimFrame[(int) (n * 1.5)];
  16.             final int[] array2 = new int[500];
  17.             final int[] array3 = new int[500];
  18.             final int[] array4 = new int[500];
  19.             final int[] array5 = new int[500];
  20.             for (int j = 0; j < n; ++j) {
  21.                 final int k = ay.readUnsignedWord();
  22.                 final AnimFrame animFrame = new AnimFrame();
  23.                 frameListOSRS[file][k] = animFrame;
  24.                 animFrame.aClass18_637 = b2;
  25.                 final int f = ay.readUnsignedByte();
  26.                 int c2 = 0;
  27.                 int n3 = -1;
  28.                 for (int l = 0; l < f; ++l) {
  29.                     final int f2;
  30.                     if ((f2 = ay.readUnsignedByte()) > 0) {
  31.                         if (b2.anIntArray342[l] != 0) {
  32.                             for (int n4 = l - 1; n4 > n3; --n4) {
  33.                                 if (b2.anIntArray342[n4] == 0) {
  34.                                     array2[c2] = n4;
  35.                                     array3[c2] = 0;
  36.                                     array5[c2] = (array4[c2] = 0);
  37.                                     ++c2;
  38.                                     break;
  39.                                 }
  40.                             }
  41.                         }
  42.                         array2[c2] = l;
  43.                         int n4 = 0;
  44.                         if (b2.anIntArray342[l] == 3) {
  45.                             n4 = 128;
  46.                         }
  47.                         if ((f2 & 0x1) != 0x0) {
  48.                             array3[c2] = ay.readShort2();
  49.                         } else {
  50.                             array3[c2] = n4;
  51.                         }
  52.                         if ((f2 & 0x2) != 0x0) {
  53.                             array4[c2] = ay.readShort2();
  54.                         } else {
  55.                             array4[c2] = n4;
  56.                         }
  57.                         if ((f2 & 0x4) != 0x0) {
  58.                             array5[c2] = ay.readShort2();
  59.                         } else {
  60.                             array5[c2] = n4;
  61.                         }
  62.                         n3 = l;
  63.                         ++c2;
  64.                     }
  65.                 }
  66.                 animFrame.anInt638 = c2;
  67.                 animFrame.anIntArray639 = new int[c2];
  68.                 animFrame.anIntArray640 = new int[c2];
  69.                 animFrame.anIntArray641 = new int[c2];
  70.                 animFrame.anIntArray642 = new int[c2];
  71.                 for (int l = 0; l < c2; ++l) {
  72.                     animFrame.anIntArray639[l] = array2[l];
  73.                     animFrame.anIntArray640[l] = array3[l];
  74.                     animFrame.anIntArray641[l] = array4[l];
  75.                     animFrame.anIntArray642[l] = array5[l];
  76.                 }
  77.             }
  78.         } catch (Exception ex) {
  79.             System.err.println("This OSRS anim file is bugged: " + file);
  80.         }
  81.     }
  82.  
  83.     public static void load474(byte abyte0[], int fileId) {
  84.         try {
  85.             Stream stream = new Stream(abyte0);
  86.             stream.currentOffset = abyte0.length - 12;
  87.             int i = stream.readDWord();
  88.             int j = stream.readDWord();
  89.             int k = stream.readDWord();
  90.             int i1 = 0;
  91.             Stream stream_1 = new Stream(abyte0);
  92.             stream_1.currentOffset = i1;
  93.             i1 += i + 4;
  94.             Stream stream_2 = new Stream(abyte0);
  95.             stream_2.currentOffset = i1;
  96.             i1 += j;
  97.             Stream stream_3 = new Stream(abyte0);
  98.             stream_3.currentOffset = i1;
  99.             i1 += k;
  100.             Stream stream_4 = new Stream(abyte0);
  101.             stream_4.currentOffset = i1;
  102.             //System.out.println("Fileid: "+fileId);
  103.             Frames class18 = new Frames(stream_4, 474, fileId);
  104.             int k1 = stream_1.readDWord();
  105.  
  106.             frameList[fileId] = new AnimFrame[(int) (k1 * 1.5)];
  107.             int ai[] = new int[500];
  108.             int ai1[] = new int[500];
  109.             int ai2[] = new int[500];
  110.             int ai3[] = new int[500];
  111.             for (int l1 = 0; l1 < k1; l1++) {
  112.                 int i2 = stream_1.readDWord();
  113.                 AnimFrame class36 = new AnimFrame();
  114.                 frameList[fileId][i2] = class36;
  115.                 class36.aClass18_637 = class18;
  116.                 int j2 = stream_1.readUnsignedByte();
  117.                 int k2 = -1;
  118.                 int l2 = 0;
  119.                 for (int i3 = 0; i3 < j2; i3++) {
  120.                     int j3 = stream_2.readUnsignedByte();
  121.                     if (j3 > 0) {
  122.                         if (i3 < class18.anIntArray342.length && class18.anIntArray342[i3] != 0) {
  123.                             for (int l3 = i3 - 1; l3 > k2; l3--) {
  124.                                 if (class18.anIntArray342[l3] != 0) {
  125.                                     continue;
  126.                                 }
  127.                                 ai[l2] = l3;
  128.                                 ai1[l2] = 0;
  129.                                 ai2[l2] = 0;
  130.                                 ai3[l2] = 0;
  131.                                 l2++;
  132.                                 break;
  133.                             }
  134.  
  135.                         }
  136.                         ai[l2] = i3;
  137.                         char c = '\0';
  138.                         if (i3 < class18.anIntArray342.length && class18.anIntArray342[i3] == 3) {
  139.                             c = '\200';
  140.                         }
  141.                         if ((j3 & 1) != 0) {
  142.                             ai1[l2] = stream_3.method421();
  143.                         } else {
  144.                             ai1[l2] = c;
  145.                         }
  146.                         if ((j3 & 2) != 0) {
  147.                             ai2[l2] = stream_3.method421();
  148.                         } else {
  149.                             ai2[l2] = c;
  150.                         }
  151.                         if ((j3 & 4) != 0) {
  152.                             ai3[l2] = stream_3.method421();
  153.                         } else {
  154.                             ai3[l2] = c;
  155.                         }
  156.                         k2 = i3;
  157.                         l2++;
  158.                     }
  159.                 }
  160.  
  161.                 class36.anInt638 = l2;
  162.                 class36.anIntArray639 = new int[l2];
  163.                 class36.anIntArray640 = new int[l2];
  164.                 class36.anIntArray641 = new int[l2];
  165.                 class36.anIntArray642 = new int[l2];
  166.                 for (int k3 = 0; k3 < l2; k3++) {
  167.                     class36.anIntArray639[k3] = ai[k3];
  168.                     class36.anIntArray640[k3] = ai1[k3];
  169.                     class36.anIntArray641[k3] = ai2[k3];
  170.                     class36.anIntArray642[k3] = ai3[k3];
  171.                 }
  172.  
  173.             }
  174.         } catch (Exception e) {
  175.             System.err.println("This 474 anim file is bugged: " + fileId);
  176.             //e.printStackTrace();
  177.         }
  178.     }
  179.  
  180.     public static void nullLoader() {
  181.         frameList = null;
  182.         animationlist = null;
  183.     }
  184.  
  185.     public static void init(int i) {
  186.         animationlist = new AnimFrame[i][0];
  187.     }
  188.  
  189.     static int[] lastAnim = {-1, -1};
  190.     static int animFill = 0;
  191.     static int lastFile;
  192.  
  193.     public static AnimFrame getAnim(int j) {
  194.         int fileId = j >> 16;
  195.         if (lastAnim[0] != fileId && lastAnim[1] != fileId) {
  196.             if (Client.testAnimsAndGfx) {
  197.                 if (AnimDef.isOSRSFile(fileId)) {
  198.                     System.out.println("file id requested: " + fileId + " - osrs: " + AnimDef.isOSRSFile(fileId));
  199.                 }
  200.             }
  201.  
  202.             lastAnim[animFill] = fileId;
  203.             if (animFill == 1) {
  204.                 animFill = 0;
  205.             } else {
  206.                 animFill++;
  207.             }
  208.         }
  209.         if (AnimDef.isOSRSFile(fileId)) {
  210.             return getAnimOSRS(j);
  211.         }
  212.         return getAnim474(j);
  213.     }
  214. // lol wrong wait go to this method
  215.     /*public static AnimFrame getAnimOSRS(int int1) {
  216.      try {
  217.      final String hexString;
  218.      final int int2 = Integer.parseInt((hexString = Integer.toHexString(int1)).substring(0, hexString.length() - 4), 16);
  219.      int1 = Integer.parseInt(hexString.substring(hexString.length() - 4), 16);
  220.      if (animationlist[int2].length == 0) {
  221.      System.out.println("[frames osrs] request: " +int2);
  222.        
  223.      //Client.instance.onDemandFetcher.loadToCache(4, int2);
  224.      Client.instance.onDemandFetcher.loadToCache(6, int2);
  225.      return null;
  226.      }
  227.      return animationlist[int2][int1];
  228.      } catch (Exception ex) {
  229.      ex.printStackTrace();
  230.      return null;
  231.      }
  232.      }*/
  233.  
  234.    public static AnimFrame getAnimOSRS(int j) {
  235.         int fileId = j >> 16;
  236.         lastFile = fileId;
  237.         try {
  238.             int[] kkkGroup1 = getKKKGroupPeople(j);
  239.             int file = kkkGroup1[0];
  240.             int frame = kkkGroup[1];
  241.             if (frameListOSRS[file].length == 0) {
  242.                 Client.instance.onDemandFetcher.loadToCache(6, fileId);
  243.                 return null;
  244.             }
  245.             return frameListOSRS[file][frame];
  246.         } catch (Exception e) {
  247.             e.printStackTrace();
  248.         }
  249.         return null;
  250.     }
  251.     public static AnimFrame getAnim474(int j) {
  252.         int fileId = j >> 16;
  253.         lastFile = fileId;
  254.         try {
  255.             int[] kkkGroup1 = getKKKGroupPeople(j);
  256.             int file = kkkGroup1[0];
  257.             int frame = kkkGroup[1];
  258.             if (frameList[file].length == 0) {
  259.                 Client.instance.onDemandFetcher.loadToCache(1, fileId);
  260.                 return null;
  261.             }
  262.             return frameList[file][frame];
  263.         } catch (Exception e) {
  264.             e.printStackTrace();
  265.         }
  266.         return null;
  267.     }
  268.    
  269.     public static int[] getKKKGroupPeople(int k){
  270.         int[] kkkGroup1 = kkkGroup[k];
  271.         if(kkkGroup1 == null){
  272.         String hex = Integer.toHexString(j);
  273.             int file = Integer.parseInt(hex.substring(0, (hex.length() - 4)), 16);
  274.             int frame = Integer.parseInt(hex.substring((hex.length() - 4)), 16);
  275.             kkkGroup1 = kkkGroup[k] = new int[]{file, frame};
  276.         }
  277.         return kkkGroup1;
  278.     }
  279.  
  280.     public static boolean method532(int i) {
  281.         return i == -1;
  282.     }
  283.  
  284.     public AnimFrame() {
  285.     }
  286.  
  287.     public static AnimFrame animationlist[][];
  288.     private static int[][] kkkGroup = new int[8000][];
  289.     public int anInt636;
  290.     public Frames aClass18_637;
  291.     public int anInt638;
  292.     public int anIntArray639[];
  293.     public int anIntArray640[];
  294.     public int anIntArray641[];
  295.     public int anIntArray642[];
  296.  
  297. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement