public static void load(Archive archive) {
   Buffer buffer = new Buffer(archive.getFile("idk.dat"));
   IdentityKit.count = buffer.getUnsignedLEShort();
   if (IdentityKit.cache == null) {
     IdentityKit.cache = new IdentityKit[IdentityKit.count];
   }
   for (int identityKit = 0; identityKit < IdentityKit.count; identityKit++) {
     if (IdentityKit.cache[identityKit] == null) {
       IdentityKit.cache[identityKit] = new IdentityKit();
     }
     IdentityKit.cache[identityKit].loadDefinition(buffer);
   }
 }
Esempio n. 2
0
 public ImageRGB(Archive archive, String string, int archiveIndex) {
   Buffer dataBuffer = new Buffer(archive.getFile(string + ".dat"));
   Buffer indexBuffer = new Buffer(archive.getFile("index.dat"));
   indexBuffer.offset = dataBuffer.getUnsignedLEShort();
   maxWidth = indexBuffer.getUnsignedLEShort();
   maxHeight = indexBuffer.getUnsignedLEShort();
   int length = indexBuffer.getUnsignedByte();
   int[] pixels = new int[length];
   for (int pixel = 0; pixel < (length - 1); pixel++) {
     pixels[pixel + 1] = indexBuffer.get24BitInt();
     if (pixels[pixel + 1] == 0) {
       pixels[pixel + 1] = 1;
     }
   }
   for (int index = 0; index < archiveIndex; index++) {
     indexBuffer.offset += 2;
     dataBuffer.offset += indexBuffer.getUnsignedLEShort() * indexBuffer.getUnsignedLEShort();
     indexBuffer.offset++;
   }
   offsetX = indexBuffer.getUnsignedByte();
   offsetY = indexBuffer.getUnsignedByte();
   width = indexBuffer.getUnsignedLEShort();
   height = indexBuffer.getUnsignedLEShort();
   int type = indexBuffer.getUnsignedByte();
   int pixelCount = width * height;
   this.pixels = new int[pixelCount];
   if (type == 0) {
     for (int pixel = 0; pixel < pixelCount; pixel++) {
       this.pixels[pixel] = pixels[dataBuffer.getUnsignedByte()];
     }
   } else if (type == 1) {
     for (int x = 0; x < width; x++) {
       for (int y = 0; y < height; y++) {
         this.pixels[x + (y * width)] = pixels[dataBuffer.getUnsignedByte()];
       }
     }
   }
 }
Esempio n. 3
0
 public final void init(Archive archive, Game client) {
   String[] versionFiles = {"model_version", "anim_version", "midi_version", "map_version"};
   for (int version = 0; version < 4; version++) {
     byte[] data = archive.getFile(versionFiles[version]);
     int versionCount = data.length / 2;
     Buffer buffer = new Buffer(data);
     fileVersions[version] = new int[versionCount];
     filePriorities[version] = new byte[versionCount];
     for (int file = 0; file < versionCount; file++) {
       fileVersions[version][file] = buffer.getUnsignedLEShort();
     }
   }
   String[] crcFiles = {"model_crc", "anim_crc", "midi_crc", "map_crc"};
   for (int crc = 0; crc < 4; crc++) {
     byte[] data = archive.getFile(crcFiles[crc]);
     int crcCount = data.length / 4;
     Buffer buffer = new Buffer(data);
     fileCrc[crc] = new int[crcCount];
     for (int file = 0; file < crcCount; file++) {
       fileCrc[crc][file] = buffer.getInt();
     }
   }
   byte[] data = archive.getFile("model_index");
   int count = fileVersions[0].length;
   modelIndex = new byte[count];
   for (int i = 0; i < count; i++) {
     if (i < data.length) {
       modelIndex[i] = data[i];
     } else {
       modelIndex[i] = (byte) 0;
     }
   }
   data = archive.getFile("map_index");
   Buffer buffer = new Buffer(data);
   count = data.length / 7;
   regHash = new int[count];
   regMapIndex = new int[count];
   regLandIndex = new int[count];
   regShouldPreload = new int[count];
   for (int reg = 0; reg < count; reg++) {
     regHash[reg] = buffer.getUnsignedLEShort();
     regMapIndex[reg] = buffer.getUnsignedLEShort();
     regLandIndex[reg] = buffer.getUnsignedLEShort();
     regShouldPreload[reg] = buffer.getUnsignedByte();
   }
   data = archive.getFile("anim_index");
   buffer = new Buffer(data);
   count = data.length / 2;
   animIndex = new int[count];
   for (int i = 0; i < count; i++) {
     animIndex[i] = buffer.getUnsignedLEShort();
   }
   data = archive.getFile("midi_index");
   buffer = new Buffer(data);
   count = data.length;
   midiIndex = new int[count];
   for (int i = 0; i < count; i++) {
     midiIndex[i] = buffer.getUnsignedByte();
   }
   this.client = client;
   running = true;
   this.client.startRunnable(this, 2);
 }