Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final class SpotAnim {
- public static void unpackConfig(StreamLoader streamLoader) {
- Stream stream = new Stream(streamLoader.getDataForName("spotanim.dat"));
- int length = stream.getUShort();
- if (cache == null)
- cache = new SpotAnim[length];
- for (int j = 0; j < length; j++) {
- if (cache[j] == null)
- cache[j] = new SpotAnim();
- cache[j].index = j;
- cache[j].readValues(stream);
- }
- }
- public void readValues(Stream stream) {
- do {
- int i = stream.getUByte();
- if (i == 0)
- return;
- if (i == 1)
- modelId = stream.getUShort();
- else if (i == 2) {
- animationid = stream.getUShort();
- if (Animation.anims != null)
- animation = Animation.anims[animationid];
- } else if (i == 4)
- sizeXY = stream.getUShort();
- else if (i == 5)
- sizeZ = stream.getUShort();
- else if (i == 6)
- anInt412 = stream.getUShort();
- else if (i == 7)
- anInt413 = stream.getUByte();
- else if (i == 8)
- anInt414 = stream.getUByte();
- else if (i == 40) {
- int j = stream.getUByte();
- for (int k = 0; k < j; k++) {
- srcColours[k] = stream.getUShort();
- destColours[k] = stream.getUShort();
- }
- } else
- System.out.println("Error unrecognised spotanim config code: "
- + i);
- } while (true);
- }
- public Model getModel() {
- Model model = (Model) modelCache.insertFromCache(index);
- if (model != null) {
- if(animation != null) {
- if(Class36.getFrameList(animation.anIntArray353[0]) == null) {
- return null;
- }
- }
- return model;
- }
- model = Model.method462(modelId);
- if (model == null) {
- return null;
- }
- if (srcColours != null) {
- for (int i = 0; i < srcColours.length; i++) {
- model.method476(srcColours[i], destColours[i]);
- }
- }
- modelCache.removeFromCache(model, index);
- if(animation != null) {
- if(Class36.getFrameList(animation.anIntArray353[0]) == null) {
- return null;
- }
- }
- return model;
- }
- private SpotAnim() {
- animationid = -1;
- srcColours = new int[6];
- destColours = new int[6];
- sizeXY = 128;
- sizeZ = 128;
- }
- public static SpotAnim cache[];
- private int index;
- private int modelId;
- private int animationid;
- public Animation animation;
- private final int[] srcColours;
- private final int[] destColours;
- public int sizeXY;
- public int sizeZ;
- public int anInt412;
- public int anInt413;
- public int anInt414;
- public static MRUNodes modelCache = new MRUNodes(30);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement