Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. public final class SpotAnim {
  2.  
  3. public static void unpackConfig(StreamLoader streamLoader) {
  4. Stream stream = new Stream(streamLoader.getDataForName("spotanim.dat"));
  5. int length = stream.getUShort();
  6. if (cache == null)
  7. cache = new SpotAnim[length];
  8. for (int j = 0; j < length; j++) {
  9. if (cache[j] == null)
  10. cache[j] = new SpotAnim();
  11. cache[j].index = j;
  12. cache[j].readValues(stream);
  13. }
  14.  
  15. }
  16.  
  17. public void readValues(Stream stream) {
  18. do {
  19. int i = stream.getUByte();
  20. if (i == 0)
  21. return;
  22. if (i == 1)
  23. modelId = stream.getUShort();
  24. else if (i == 2) {
  25. animationid = stream.getUShort();
  26. if (Animation.anims != null)
  27. animation = Animation.anims[animationid];
  28. } else if (i == 4)
  29. sizeXY = stream.getUShort();
  30. else if (i == 5)
  31. sizeZ = stream.getUShort();
  32. else if (i == 6)
  33. anInt412 = stream.getUShort();
  34. else if (i == 7)
  35. anInt413 = stream.getUByte();
  36. else if (i == 8)
  37. anInt414 = stream.getUByte();
  38. else if (i == 40) {
  39. int j = stream.getUByte();
  40. for (int k = 0; k < j; k++) {
  41. srcColours[k] = stream.getUShort();
  42. destColours[k] = stream.getUShort();
  43. }
  44. } else
  45. System.out.println("Error unrecognised spotanim config code: "
  46. + i);
  47. } while (true);
  48. }
  49.  
  50. public Model getModel() {
  51. Model model = (Model) modelCache.insertFromCache(index);
  52. if (model != null) {
  53. if(animation != null) {
  54. if(Class36.getFrameList(animation.anIntArray353[0]) == null) {
  55. return null;
  56. }
  57. }
  58. return model;
  59. }
  60. model = Model.method462(modelId);
  61. if (model == null) {
  62. return null;
  63. }
  64. if (srcColours != null) {
  65. for (int i = 0; i < srcColours.length; i++) {
  66. model.method476(srcColours[i], destColours[i]);
  67. }
  68. }
  69.  
  70. modelCache.removeFromCache(model, index);
  71. if(animation != null) {
  72. if(Class36.getFrameList(animation.anIntArray353[0]) == null) {
  73. return null;
  74. }
  75. }
  76. return model;
  77. }
  78.  
  79. private SpotAnim() {
  80. animationid = -1;
  81. srcColours = new int[6];
  82. destColours = new int[6];
  83. sizeXY = 128;
  84. sizeZ = 128;
  85. }
  86.  
  87. public static SpotAnim cache[];
  88. private int index;
  89. private int modelId;
  90. private int animationid;
  91. public Animation animation;
  92. private final int[] srcColours;
  93. private final int[] destColours;
  94. public int sizeXY;
  95. public int sizeZ;
  96. public int anInt412;
  97. public int anInt413;
  98. public int anInt414;
  99. public static MRUNodes modelCache = new MRUNodes(30);
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement