diff --git a/.gitignore b/.gitignore
index 09810f9..7e8a5c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-target/
\ No newline at end of file
+target/
+out/
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..059361f
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+317
\ No newline at end of file
diff --git a/.idea/artifacts/317_jar.xml b/.idea/artifacts/317_jar.xml
new file mode 100644
index 0000000..cc8b7d5
--- /dev/null
+++ b/.idea/artifacts/317_jar.xml
@@ -0,0 +1,11 @@
+null to create a new one.
+ * @throws IOException if the stream content is malformed or an I/O error occurs.
+ */
+ public static byte[] decompress(byte[] src, int off, int len, byte[] dst) throws IOException {
+ ByteArrayOutputStream tmp = null;
+
+ if (dst == null) {
+ tmp = new ByteArrayOutputStream();
}
+
+ try(BZip2CompressorInputStream in = new BZip2CompressorInputStream(new BZip2(src, off, len))) {
+ if (tmp != null) {
+ IOUtils.copy(in, tmp);
+ } else {
+ IOUtils.readFully(in, dst);
+ }
+ }
+
+ if (tmp != null) {
+ return tmp.toByteArray();
+ }
+
+ return dst;
}
- public static void method226(BZip2Stream stream) {
- byte byte4 = stream.aByte573;
- int i = stream.anInt574;
- int j = stream.anInt584;
- int k = stream.anInt582;
- int[] ai = BZip2Stream.anIntArray587;
- int l = stream.anInt581;
- byte[] abyte0 = stream.aByteArray568;
- int i1 = stream.anInt569;
- int j1 = stream.anInt570;
- int k1 = j1;
- int l1 = stream.anInt601 + 1;
- label0:
- do {
- if (i > 0) {
- do {
- if (j1 == 0) {
- break label0;
- }
- if (i == 1) {
- break;
- }
- abyte0[i1] = byte4;
- i--;
- i1++;
- j1--;
- } while (true);
- if (j1 == 0) {
- i = 1;
- break;
- }
- abyte0[i1] = byte4;
- i1++;
- j1--;
- }
- boolean flag = true;
- while (flag) {
- flag = false;
- if (j == l1) {
- i = 0;
- break label0;
- }
- byte4 = (byte) k;
- l = ai[l];
- byte byte0 = (byte) (l & 0xff);
- l >>= 8;
- j++;
- if (byte0 != k) {
- k = byte0;
- if (j1 == 0) {
- i = 1;
- } else {
- abyte0[i1] = byte4;
- i1++;
- j1--;
- flag = true;
- continue;
- }
- break label0;
- }
- if (j != l1) {
- continue;
- }
- if (j1 == 0) {
- i = 1;
- break label0;
- }
- abyte0[i1] = byte4;
- i1++;
- j1--;
- flag = true;
- }
- i = 2;
- l = ai[l];
- byte byte1 = (byte) (l & 0xff);
- l >>= 8;
- if (++j != l1) {
- if (byte1 != k) {
- k = byte1;
- } else {
- i = 3;
- l = ai[l];
- byte byte2 = (byte) (l & 0xff);
- l >>= 8;
- if (++j != l1) {
- if (byte2 != k) {
- k = byte2;
- } else {
- l = ai[l];
- byte byte3 = (byte) (l & 0xff);
- l >>= 8;
- j++;
- i = (byte3 & 0xff) + 4;
- l = ai[l];
- k = (byte) (l & 0xff);
- l >>= 8;
- j++;
- }
- }
- }
- }
- } while (true);
- int i2 = stream.anInt571;
- stream.anInt571 += k1 - j1;
- if (stream.anInt571 < i2) {
- stream.anInt572++;
- }
- stream.aByte573 = byte4;
- stream.anInt574 = i;
- stream.anInt584 = j;
- stream.anInt582 = k;
- BZip2Stream.anIntArray587 = ai;
- stream.anInt581 = l;
- stream.aByteArray568 = abyte0;
- stream.anInt569 = i1;
- stream.anInt570 = j1;
+ /**
+ * The input.
+ */
+ private final ByteArrayInputStream in;
+ /**
+ * The position.
+ */
+ private int position;
+
+ /**
+ * Constructs a new helper class to fool that silly compressor.
+ *
+ * @param src the source.
+ * @param off the source offset.
+ * @param len the source length.
+ */
+ private BZip2(byte[] src, int off, int len) {
+ this.in = new ByteArrayInputStream(src, off, len);
}
- public static void decompress(BZip2Stream stream) {
- int k8 = 0;
- int[] ai = null;
- int[] ai1 = null;
- int[] ai2 = null;
- stream.anInt578 = 1;
- if (BZip2Stream.anIntArray587 == null) {
- BZip2Stream.anIntArray587 = new int[stream.anInt578 * 100000];
- }
- boolean flag19 = true;
- while (flag19) {
- byte byte0 = method228(stream);
- if (byte0 == 23) {
- return;
- }
- method228(stream);
- method228(stream);
- method228(stream);
- method228(stream);
- method228(stream);
- stream.anInt579++;
- method228(stream);
- method228(stream);
- method228(stream);
- method228(stream);
- byte0 = method229(stream);
- stream.aBoolean575 = byte0 != 0;
- if (stream.aBoolean575) {
- System.out.println("PANIC! RANDOMISED BLOCK!");
- }
- stream.anInt580 = 0;
- byte0 = method228(stream);
- stream.anInt580 = (stream.anInt580 << 8) | (byte0 & 0xff);
- byte0 = method228(stream);
- stream.anInt580 = (stream.anInt580 << 8) | (byte0 & 0xff);
- byte0 = method228(stream);
- stream.anInt580 = (stream.anInt580 << 8) | (byte0 & 0xff);
- for (int j = 0; j < 16; j++) {
- byte byte1 = method229(stream);
- stream.aBooleanArray590[j] = byte1 == 1;
- }
- for (int k = 0; k < 256; k++) {
- stream.aBooleanArray589[k] = false;
- }
- for (int l = 0; l < 16; l++) {
- if (stream.aBooleanArray590[l]) {
- for (int i3 = 0; i3 < 16; i3++) {
- byte byte2 = method229(stream);
- if (byte2 == 1) {
- stream.aBooleanArray589[(l * 16) + i3] = true;
- }
- }
- }
- }
- method231(stream);
- int i4 = stream.anInt588 + 2;
- int j4 = method230(3, stream);
- int k4 = method230(15, stream);
- for (int i1 = 0; i1 < k4; i1++) {
- int j3 = 0;
- do {
- byte byte3 = method229(stream);
- if (byte3 == 0) {
- break;
- }
- j3++;
- } while (true);
- stream.aByteArray595[i1] = (byte) j3;
- }
- byte[] abyte0 = new byte[6];
- for (byte byte16 = 0; byte16 < j4; byte16++) {
- abyte0[byte16] = byte16;
- }
- for (int j1 = 0; j1 < k4; j1++) {
- byte byte17 = stream.aByteArray595[j1];
- byte byte15 = abyte0[byte17];
- for (; byte17 > 0; byte17--) {
- abyte0[byte17] = abyte0[byte17 - 1];
- }
- abyte0[0] = byte15;
- stream.aByteArray594[j1] = byte15;
- }
- for (int k3 = 0; k3 < j4; k3++) {
- int l6 = method230(5, stream);
- for (int k1 = 0; k1 < i4; k1++) {
- do {
- byte byte4 = method229(stream);
- if (byte4 == 0) {
- break;
- }
- byte4 = method229(stream);
- if (byte4 == 0) {
- l6++;
- } else {
- l6--;
- }
- } while (true);
- stream.aByteArrayArray596[k3][k1] = (byte) l6;
- }
- }
- for (int l3 = 0; l3 < j4; l3++) {
- byte byte8 = 32;
- int i = 0;
- for (int l1 = 0; l1 < i4; l1++) {
- if (stream.aByteArrayArray596[l3][l1] > i) {
- i = stream.aByteArrayArray596[l3][l1];
- }
- if (stream.aByteArrayArray596[l3][l1] < byte8) {
- byte8 = stream.aByteArrayArray596[l3][l1];
- }
- }
- method232(stream.anIntArrayArray597[l3], stream.anIntArrayArray598[l3], stream.anIntArrayArray599[l3], stream.aByteArrayArray596[l3], byte8, i, i4);
- stream.anIntArray600[l3] = byte8;
- }
- int l4 = stream.anInt588 + 1;
- int i5 = -1;
- int j5 = 0;
- for (int i2 = 0; i2 <= 255; i2++) {
- stream.anIntArray583[i2] = 0;
- }
- int j9 = 4095;
- for (int l8 = 15; l8 >= 0; l8--) {
- for (int i9 = 15; i9 >= 0; i9--) {
- stream.aByteArray592[j9] = (byte) ((l8 * 16) + i9);
- j9--;
- }
- stream.anIntArray593[l8] = j9 + 1;
- }
- int i6 = 0;
- if (j5 == 0) {
- i5++;
- j5 = 50;
- byte byte12 = stream.aByteArray594[i5];
- k8 = stream.anIntArray600[byte12];
- ai = stream.anIntArrayArray597[byte12];
- ai2 = stream.anIntArrayArray599[byte12];
- ai1 = stream.anIntArrayArray598[byte12];
- }
- j5--;
- int i7 = k8;
- int l7;
- byte byte9;
- for (l7 = method230(i7, stream); l7 > ai[i7]; l7 = (l7 << 1) | byte9) {
- i7++;
- byte9 = method229(stream);
- }
- for (int k5 = ai2[l7 - ai1[i7]]; k5 != l4; ) {
- if ((k5 == 0) || (k5 == 1)) {
- int j6 = -1;
- int k6 = 1;
- do {
- if (k5 == 0) {
- j6 += k6;
- } else if (k5 == 1) {
- j6 += 2 * k6;
- }
- k6 *= 2;
- if (j5 == 0) {
- i5++;
- j5 = 50;
- byte byte13 = stream.aByteArray594[i5];
- k8 = stream.anIntArray600[byte13];
- ai = stream.anIntArrayArray597[byte13];
- ai2 = stream.anIntArrayArray599[byte13];
- ai1 = stream.anIntArrayArray598[byte13];
- }
- j5--;
- int j7 = k8;
- int i8;
- byte byte10;
- for (i8 = method230(j7, stream); i8 > ai[j7]; i8 = (i8 << 1) | byte10) {
- j7++;
- byte10 = method229(stream);
- }
- k5 = ai2[i8 - ai1[j7]];
- } while ((k5 == 0) || (k5 == 1));
- j6++;
- byte byte5 = stream.aByteArray591[stream.aByteArray592[stream.anIntArray593[0]] & 0xff];
- stream.anIntArray583[byte5 & 0xff] += j6;
- for (; j6 > 0; j6--) {
- BZip2Stream.anIntArray587[i6] = byte5 & 0xff;
- i6++;
- }
- } else {
- int j11 = k5 - 1;
- byte byte6;
- if (j11 < 16) {
- int j10 = stream.anIntArray593[0];
- byte6 = stream.aByteArray592[j10 + j11];
- for (; j11 > 3; j11 -= 4) {
- int k11 = j10 + j11;
- stream.aByteArray592[k11] = stream.aByteArray592[k11 - 1];
- stream.aByteArray592[k11 - 1] = stream.aByteArray592[k11 - 2];
- stream.aByteArray592[k11 - 2] = stream.aByteArray592[k11 - 3];
- stream.aByteArray592[k11 - 3] = stream.aByteArray592[k11 - 4];
- }
- for (; j11 > 0; j11--) {
- stream.aByteArray592[j10 + j11] = stream.aByteArray592[(j10 + j11) - 1];
- }
- stream.aByteArray592[j10] = byte6;
- } else {
- int l10 = j11 / 16;
- int i11 = j11 % 16;
- int k10 = stream.anIntArray593[l10] + i11;
- byte6 = stream.aByteArray592[k10];
- for (; k10 > stream.anIntArray593[l10]; k10--) {
- stream.aByteArray592[k10] = stream.aByteArray592[k10 - 1];
- }
- stream.anIntArray593[l10]++;
- for (; l10 > 0; l10--) {
- stream.anIntArray593[l10]--;
- stream.aByteArray592[stream.anIntArray593[l10]] = stream.aByteArray592[(stream.anIntArray593[l10 - 1] + 16) - 1];
- }
- stream.anIntArray593[0]--;
- stream.aByteArray592[stream.anIntArray593[0]] = byte6;
- if (stream.anIntArray593[0] == 0) {
- int i10 = 4095;
- for (int k9 = 15; k9 >= 0; k9--) {
- for (int l9 = 15; l9 >= 0; l9--) {
- stream.aByteArray592[i10] = stream.aByteArray592[stream.anIntArray593[k9] + l9];
- i10--;
- }
- stream.anIntArray593[k9] = i10 + 1;
- }
- }
- }
- stream.anIntArray583[stream.aByteArray591[byte6 & 0xff] & 0xff]++;
- BZip2Stream.anIntArray587[i6] = stream.aByteArray591[byte6 & 0xff] & 0xff;
- i6++;
- if (j5 == 0) {
- i5++;
- j5 = 50;
- byte byte14 = stream.aByteArray594[i5];
- k8 = stream.anIntArray600[byte14];
- ai = stream.anIntArrayArray597[byte14];
- ai2 = stream.anIntArrayArray599[byte14];
- ai1 = stream.anIntArrayArray598[byte14];
- }
- j5--;
- int k7 = k8;
- int j8;
- byte byte11;
- for (j8 = method230(k7, stream); j8 > ai[k7]; j8 = (j8 << 1) | byte11) {
- k7++;
- byte11 = method229(stream);
- }
- k5 = ai2[j8 - ai1[k7]];
- }
- }
- stream.anInt574 = 0;
- stream.aByte573 = 0;
- stream.anIntArray585[0] = 0;
- for (int j2 = 1; j2 <= 256; j2++) {
- stream.anIntArray585[j2] = stream.anIntArray583[j2 - 1];
- }
- for (int k2 = 1; k2 <= 256; k2++) {
- stream.anIntArray585[k2] += stream.anIntArray585[k2 - 1];
- }
- for (int l2 = 0; l2 < i6; l2++) {
- byte byte7 = (byte) (BZip2Stream.anIntArray587[l2] & 0xff);
- BZip2Stream.anIntArray587[stream.anIntArray585[byte7 & 0xff]] |= l2 << 8;
- stream.anIntArray585[byte7 & 0xff]++;
- }
- stream.anInt581 = BZip2Stream.anIntArray587[stream.anInt580] >> 8;
- stream.anInt584 = 0;
- stream.anInt581 = BZip2Stream.anIntArray587[stream.anInt581];
- stream.anInt582 = (byte) (stream.anInt581 & 0xff);
- stream.anInt581 >>= 8;
- stream.anInt584++;
- stream.anInt601 = i6;
- method226(stream);
- flag19 = (stream.anInt584 == (stream.anInt601 + 1)) && (stream.anInt574 == 0);
- }
- }
-
- public static byte method228(BZip2Stream stream) {
- return (byte) method230(8, stream);
- }
-
- public static byte method229(BZip2Stream stream) {
- return (byte) method230(1, stream);
- }
-
- public static int method230(int i, BZip2Stream stream) {
- int j;
- do {
- if (stream.anInt577 >= i) {
- int k = (stream.anInt576 >> (stream.anInt577 - i)) & ((1 << i) - 1);
- stream.anInt577 -= i;
- j = k;
- break;
- }
- stream.anInt576 = (stream.anInt576 << 8) | (stream.aByteArray563[stream.anInt564] & 0xff);
- stream.anInt577 += 8;
- stream.anInt564++;
- stream.anInt565--;
- stream.anInt566++;
- if (stream.anInt566 == 0) {
- stream.anInt567++;
- }
- } while (true);
- return j;
- }
-
- public static void method231(BZip2Stream stream) {
- stream.anInt588 = 0;
- for (int i = 0; i < 256; i++) {
- if (stream.aBooleanArray589[i]) {
- stream.aByteArray591[stream.anInt588] = (byte) i;
- stream.anInt588++;
- }
- }
- }
-
- public static void method232(int[] ai, int[] ai1, int[] ai2, byte[] abyte0, int i, int j, int k) {
- int l = 0;
- for (int i1 = i; i1 <= j; i1++) {
- for (int l2 = 0; l2 < k; l2++) {
- if (abyte0[l2] == i1) {
- ai2[l] = l2;
- l++;
- }
- }
- }
- for (int j1 = 0; j1 < 23; j1++) {
- ai1[j1] = 0;
- }
- for (int k1 = 0; k1 < k; k1++) {
- ai1[abyte0[k1] + 1]++;
- }
- for (int l1 = 1; l1 < 23; l1++) {
- ai1[l1] += ai1[l1 - 1];
- }
- for (int i2 = 0; i2 < 23; i2++) {
- ai[i2] = 0;
- }
- int i3 = 0;
- for (int j2 = i; j2 <= j; j2++) {
- i3 += ai1[j2 + 1] - ai1[j2];
- ai[j2] = i3 - 1;
- i3 <<= 1;
- }
- for (int k2 = i + 1; k2 <= j; k2++) {
- ai1[k2] = ((ai[k2 - 1] + 1) << 1) - ai1[k2];
+ @Override
+ public int read() throws IOException {
+ if (position < 4) {
+ return MAGIC[position++];
}
+ return in.read();
}
}
diff --git a/src/main/java/BZip2Stream.java b/src/main/java/BZip2Stream.java
deleted file mode 100644
index dda9f90..0000000
--- a/src/main/java/BZip2Stream.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
-// Jad home page: http://www.kpdus.com/jad.html
-// Decompiler options: packimports(3)
-
-public class BZip2Stream {
-
- public static int[] anIntArray587;
- public byte[] aByteArray563;
- public int anInt564;
- public int anInt565;
- public int anInt566;
- public int anInt567;
- public byte[] aByteArray568;
- public int anInt569;
- public int anInt570;
- public int anInt571;
- public int anInt572;
- public byte aByte573;
- public int anInt574;
- public boolean aBoolean575;
- public int anInt576;
- public int anInt577;
- public int anInt578;
- public int anInt579;
- public int anInt580;
- public int anInt581;
- public int anInt582;
- public final int[] anIntArray583 = new int[256];
- public int anInt584;
- public final int[] anIntArray585 = new int[257];
- public int anInt588;
- public final boolean[] aBooleanArray589 = new boolean[256];
- public final boolean[] aBooleanArray590 = new boolean[16];
- public final byte[] aByteArray591 = new byte[256];
- public final byte[] aByteArray592 = new byte[4096];
- public final int[] anIntArray593 = new int[16];
- public final byte[] aByteArray594 = new byte[18002];
- public final byte[] aByteArray595 = new byte[18002];
- public final byte[][] aByteArrayArray596 = new byte[6][258];
- public final int[][] anIntArrayArray597 = new int[6][258];
- public final int[][] anIntArrayArray598 = new int[6][258];
- public final int[][] anIntArrayArray599 = new int[6][258];
- public final int[] anIntArray600 = new int[6];
- public int anInt601;
-
- public BZip2Stream() {
- }
-
-}
diff --git a/src/main/java/BitmapFont.java b/src/main/java/BitmapFont.java
index f234640..cae0bcc 100644
--- a/src/main/java/BitmapFont.java
+++ b/src/main/java/BitmapFont.java
@@ -1,3 +1,4 @@
+import java.io.IOException;
import java.util.Random;
public class BitmapFont {
@@ -12,9 +13,9 @@ public class BitmapFont {
public int height;
public boolean strikethrough = false;
- public BitmapFont(FileArchive archive, String name, boolean quill) {
- Buffer dat = new Buffer(archive.read(name + ".dat", null));
- Buffer idx = new Buffer(archive.read("index.dat", null));
+ public BitmapFont(FileArchive archive, String name, boolean quill) throws IOException {
+ Buffer dat = new Buffer(archive.read(name + ".dat"));
+ Buffer idx = new Buffer(archive.read("index.dat"));
idx.position = dat.get2U() + 4;
int k = idx.get1U();
diff --git a/src/main/java/Buffer.java b/src/main/java/Buffer.java
index 8129036..76f5a99 100644
--- a/src/main/java/Buffer.java
+++ b/src/main/java/Buffer.java
@@ -1,3 +1,5 @@
+import org.apache.commons.math3.random.ISAACRandom;
+
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
@@ -8,7 +10,7 @@ import java.nio.charset.StandardCharsets;
*
* Types:
diff --git a/src/main/java/ModelHeader.java b/src/main/java/ModelHeader.java
deleted file mode 100644
index 4772ed1..0000000
--- a/src/main/java/ModelHeader.java
+++ /dev/null
@@ -1,24 +0,0 @@
-public class ModelHeader {
-
- public byte[] data;
- public int vertexCount;
- public int faceCount;
- public int texturedFaceCount;
- public int obPoint1Position;
- public int obPoint2Position;
- public int obPoint3Position;
- public int obPoint4Position;
- public int obPoint5Position;
- public int obVertex1Position;
- public int obVertex2Position;
- public int obFace1Position;
- public int obFace2Position;
- public int obFace3Position;
- public int obFace4Position;
- public int obFace5Position;
- public int obAxisPosition;
-
- public ModelHeader() {
- }
-
-}
diff --git a/src/main/java/NPCType.java b/src/main/java/NPCType.java
index e790759..76c801e 100644
--- a/src/main/java/NPCType.java
+++ b/src/main/java/NPCType.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import java.io.IOException;
+
public class NPCType {
public static int anInt56;
@@ -30,9 +32,9 @@ public class NPCType {
return type;
}
- public static void unpack(FileArchive archive) {
- aBuffer_60 = new Buffer(archive.read("npc.dat", null));
- Buffer buffer = new Buffer(archive.read("npc.idx", null));
+ public static void unpack(FileArchive archive) throws IOException {
+ aBuffer_60 = new Buffer(archive.read("npc.dat"));
+ Buffer buffer = new Buffer(archive.read("npc.idx"));
anInt62 = buffer.get2U();
anIntArray72 = new int[anInt62];
int i = 2;
@@ -153,7 +155,7 @@ public class NPCType {
return type.method164(j, k, ai);
}
}
- Model model = (Model) aCache_95.method222(aLong78);
+ Model model = (Model) aCache_95.get(aLong78);
if (model == null) {
boolean flag = false;
for (int value : anIntArray94) {
@@ -180,7 +182,7 @@ public class NPCType {
}
model.createLabelReferences();
model.calculateNormals(64 + anInt85, 850 + anInt92, -30, -50, -30, true);
- aCache_95.method223(model, aLong78);
+ aCache_95.put(aLong78, model);
}
Model model_1 = Model.EMPTY;
model_1.set(model, SeqFrame.isNull(k) & SeqFrame.isNull(j));
diff --git a/src/main/java/ObjType.java b/src/main/java/ObjType.java
index 53280d5..9386330 100644
--- a/src/main/java/ObjType.java
+++ b/src/main/java/ObjType.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import java.io.IOException;
+
public class ObjType {
public static LRUCache aCache_158 = new LRUCache(100);
@@ -64,9 +66,9 @@ public class ObjType {
aBuffer_183 = null;
}
- public static void unpack(FileArchive archive) {
- aBuffer_183 = new Buffer(archive.read("obj.dat", null));
- Buffer buffer = new Buffer(archive.read("obj.idx", null));
+ public static void unpack(FileArchive archive) throws IOException {
+ aBuffer_183 = new Buffer(archive.read("obj.dat"));
+ Buffer buffer = new Buffer(archive.read("obj.idx"));
anInt203 = buffer.get2U();
anIntArray195 = new int[anInt203];
int i = 2;
@@ -107,9 +109,9 @@ public class ObjType {
public static Image24 method200(int i, int j, int k) {
if (k == 0) {
- Image24 image = (Image24) aCache_158.method222(i);
+ Image24 image = (Image24) aCache_158.get(i);
if ((image != null) && (image.anInt1445 != j) && (image.anInt1445 != -1)) {
- image.method329();
+ image.unlink();
image = null;
}
if (image != null) {
@@ -217,7 +219,7 @@ public class ObjType {
class30_sub2_sub1_sub1_2.anInt1445 = j6;
}
if (k == 0) {
- aCache_158.method223(class30_sub2_sub1_sub1_1, i);
+ aCache_158.put(i, class30_sub2_sub1_sub1_1);
}
Draw2D.bind(ai1, i2, j2);
Draw2D.setBounds(j3, k2, l2, i3);
@@ -420,7 +422,7 @@ public class ObjType {
return method198(j).method201(1);
}
}
- Model model = (Model) aCache_159.method222(anInt157);
+ Model model = (Model) aCache_159.get(anInt157);
if (model != null) {
return model;
}
@@ -438,7 +440,7 @@ public class ObjType {
}
model.calculateNormals(64 + anInt196, 768 + anInt184, -50, -10, -50, true);
model.pickBounds = true;
- aCache_159.method223(model, anInt157);
+ aCache_159.put(anInt157, model);
return model;
}
diff --git a/src/main/java/OnDemand.java b/src/main/java/OnDemand.java
index f1b352b..244cce9 100644
--- a/src/main/java/OnDemand.java
+++ b/src/main/java/OnDemand.java
@@ -1,174 +1,189 @@
-// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
-// Jad home page: http://www.kpdus.com/jad.html
-// Decompiler options: packimports(3)
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.util.LinkedList;
import java.util.zip.CRC32;
import java.util.zip.GZIPInputStream;
public class OnDemand implements Runnable {
- public final LinkedList aList_1331 = new LinkedList();
+ public final DoublyLinkedList pending = new DoublyLinkedList();
public final CRC32 crc32 = new CRC32();
- public final byte[] aByteArray1339 = new byte[500];
- public final byte[][] storeFilePriority = new byte[4][];
- public final LinkedList aList_1344 = new LinkedList();
- public final LinkedList aList_1358 = new LinkedList();
+ public final byte[] bbuf = new byte[500];
+ public final byte[][] storeFilePriorities = new byte[4][];
+ public final DoublyLinkedList aList_1344 = new DoublyLinkedList();
+ public final DoublyLinkedList completed = new DoublyLinkedList();
public final byte[] aByteArray1359 = new byte[65000];
- public final DoublyLinkedList aDoublyLinkedList_1361 = new DoublyLinkedList();
+ public final LinkedList
* # — the number of bytes
- * Op — 1 byte which is modified by the {@link #cipher}
+ * Op — 1 byte which is modified by the {@link #random} number generator.
* Smart — 1 or 2 byte value [-16384...16383]
* USmart — 1 or 2 byte value [0...32768]
* String — {@link StandardCharsets#ISO_8859_1} encoding delimited by a newline character (\n)
@@ -24,37 +26,11 @@ import java.nio.charset.StandardCharsets;
* C — put(-v) — get returns (-v)
* S — put(128 - v) — get returns (128 - v)
*/
-public class Buffer extends DoublyLinkedListNode {
+public class Buffer extends DoublyLinkedList.Node {
- public static final LinkedList pool0 = new LinkedList();
- public static final LinkedList pool1 = new LinkedList();
- public static final LinkedList pool2 = new LinkedList();
private static final int[] BITMASK = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1};
- public static int poolSize0;
- public static int poolSize1;
- public static int poolSize2;
public static Buffer create(int sizeType) {
- synchronized (pool1) {
- Buffer buffer = null;
-
- if ((sizeType == 0) && (poolSize0 > 0)) {
- poolSize0--;
- buffer = (Buffer) pool0.method251();
- } else if ((sizeType == 1) && (poolSize1 > 0)) {
- poolSize1--;
- buffer = (Buffer) pool1.method251();
- } else if ((sizeType == 2) && (poolSize2 > 0)) {
- poolSize2--;
- buffer = (Buffer) pool2.method251();
- }
-
- if (buffer != null) {
- buffer.position = 0;
- return buffer;
- }
- }
-
Buffer buffer = new Buffer();
buffer.position = 0;
@@ -72,7 +48,7 @@ public class Buffer extends DoublyLinkedListNode {
public byte[] data;
public int position;
public int bitPosition;
- public ISAACCipher cipher;
+ public ISAACRandom random;
public Buffer() {
}
@@ -83,7 +59,7 @@ public class Buffer extends DoublyLinkedListNode {
}
public void putOp(int i) {
- data[position++] = (byte) (i + cipher.method246());
+ data[position++] = (byte) (i + random.nextInt());
}
public void putSize1(int i) {
diff --git a/src/main/java/Censor.java b/src/main/java/Censor.java
index 772bf63..98a21f5 100644
--- a/src/main/java/Censor.java
+++ b/src/main/java/Censor.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import java.io.IOException;
+
public class Censor {
public static final String[] aStringArray626 = {"cook", "cook's", "cooks", "seeks", "sheet", "woop", "woops", "faq", "noob", "noobs"};
@@ -12,11 +14,11 @@ public class Censor {
public static char[][] aCharArrayArray624;
public static int[] anIntArray625;
- public static void method487(FileArchive archive) {
- Buffer buffer = new Buffer(archive.read("fragmentsenc.txt", null));
- Buffer buffer_1 = new Buffer(archive.read("badenc.txt", null));
- Buffer class30_sub2_sub2_2 = new Buffer(archive.read("domainenc.txt", null));
- Buffer buffer_3 = new Buffer(archive.read("tldlist.txt", null));
+ public static void method487(FileArchive archive) throws IOException {
+ Buffer buffer = new Buffer(archive.read("fragmentsenc.txt"));
+ Buffer buffer_1 = new Buffer(archive.read("badenc.txt"));
+ Buffer class30_sub2_sub2_2 = new Buffer(archive.read("domainenc.txt"));
+ Buffer buffer_3 = new Buffer(archive.read("tldlist.txt"));
method488(buffer, buffer_1, class30_sub2_sub2_2, buffer_3);
}
diff --git a/src/main/java/Component.java b/src/main/java/Component.java
index edbb805..f37c296 100644
--- a/src/main/java/Component.java
+++ b/src/main/java/Component.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import java.io.IOException;
+
public class Component {
public static Component[] instances;
@@ -72,9 +74,9 @@ public class Component {
public Component() {
}
- public static void unpack(FileArchive archive, BitmapFont[] aclass30_sub2_sub1_sub4, FileArchive archive_1) {
+ public static void unpack(FileArchive archive, BitmapFont[] aclass30_sub2_sub1_sub4, FileArchive archive_1) throws IOException {
aCache_238 = new LRUCache(50000);
- Buffer buffer = new Buffer(archive.read("data", null));
+ Buffer buffer = new Buffer(archive.read("data"));
int i = -1;
int j = buffer.get2U();
instances = new Component[j];
@@ -279,13 +281,13 @@ public class Component {
public static Image24 method207(int i, FileArchive archive, String s) {
long l = (StringUtil.hashCode(s) << 8) + (long) i;
- Image24 image = (Image24) aCache_238.method222(l);
+ Image24 image = (Image24) aCache_238.get(l);
if (image != null) {
return image;
}
try {
image = new Image24(archive, s, i);
- aCache_238.method223(image, l);
+ aCache_238.put(l, image);
} catch (Exception _ex) {
return null;
}
@@ -293,9 +295,9 @@ public class Component {
}
public static void method208(int i, int j, Model model) {
- A_CACHE___264.method224();
+ A_CACHE___264.clear();
if ((model != null) && (j != 4)) {
- A_CACHE___264.method223(model, ((long) j << 16) + i);
+ A_CACHE___264.put(((long) j << 16) + i, model);
}
}
@@ -309,7 +311,7 @@ public class Component {
}
public Model method206(int i, int j) {
- Model model = (Model) A_CACHE___264.method222(((long) i << 16) + j);
+ Model model = (Model) A_CACHE___264.get(((long) i << 16) + j);
if (model != null) {
return model;
}
@@ -329,7 +331,7 @@ public class Component {
model = null;
}
if (model != null) {
- A_CACHE___264.method223(model, (i << 16) + j);
+ A_CACHE___264.put((i << 16) + j, model);
}
return model;
}
diff --git a/src/main/java/DoublyLinkedList.java b/src/main/java/DoublyLinkedList.java
index f397a2c..6df4e96 100644
--- a/src/main/java/DoublyLinkedList.java
+++ b/src/main/java/DoublyLinkedList.java
@@ -1,66 +1,114 @@
-// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
-// Jad home page: http://www.kpdus.com/jad.html
-// Decompiler options: packimports(3)
-
public class DoublyLinkedList {
- public final DoublyLinkedListNode aNode_43;
- public DoublyLinkedListNode aNode_44;
+ public static class Node {
+
+ public Node prev;
+ public Node next;
+
+ public void unlink() {
+ if (next != null) {
+ next.prev = prev;
+ prev.next = next;
+ prev = null;
+ next = null;
+ }
+ }
+
+ }
+
+ public final Node head;
+ public Node peeked;
public DoublyLinkedList() {
- aNode_43 = new DoublyLinkedListNode();
- aNode_43.aNode_1303 = aNode_43;
- aNode_43.aNode_1304 = aNode_43;
+ head = new Node();
+ head.prev = head;
+ head.next = head;
}
- public void method150(DoublyLinkedListNode node) {
- if (node.aNode_1304 != null) {
- node.method330();
+ public void pushBack(Node node) {
+ if (node.next != null) {
+ node.unlink();
}
- node.aNode_1304 = aNode_43.aNode_1304;
- node.aNode_1303 = aNode_43;
- node.aNode_1304.aNode_1303 = node;
- node.aNode_1303.aNode_1304 = node;
+ node.next = head.next;
+ node.prev = head;
+ node.next.prev = node;
+ node.prev.next = node;
}
- public DoublyLinkedListNode method151() {
- DoublyLinkedListNode node = aNode_43.aNode_1303;
- if (node == aNode_43) {
+ public void pushFront(Node node) {
+ if (node.next != null) {
+ node.unlink();
+ }
+ node.next = head;
+ node.prev = head.prev;
+ node.next.prev = node;
+ node.prev.next = node;
+ }
+
+ public Node pollFront() {
+ Node node = head.prev;
+ if (node == head) {
return null;
} else {
- node.method330();
+ node.unlink();
return node;
}
}
- public DoublyLinkedListNode method152() {
- DoublyLinkedListNode node = aNode_43.aNode_1303;
- if (node == aNode_43) {
- aNode_44 = null;
+ public Node peekFront() {
+ Node node = head.prev;
+ if (node == head) {
+ peeked = null;
return null;
} else {
- aNode_44 = node.aNode_1303;
+ peeked = node.prev;
return node;
}
}
- public DoublyLinkedListNode method153() {
- DoublyLinkedListNode node = aNode_44;
- if (node == aNode_43) {
- aNode_44 = null;
+ public Node peekBack() {
+ Node node = head.next;
+ if (node == head) {
+ peeked = null;
return null;
} else {
- aNode_44 = node.aNode_1303;
+ peeked = node.next;
return node;
}
}
- public int method154() {
- int i = 0;
- for (DoublyLinkedListNode node = aNode_43.aNode_1303; node != aNode_43; node = node.aNode_1303) {
- i++;
+ public Node prev() {
+ Node node = peeked;
+ if (node == head) {
+ peeked = null;
+ return null;
+ } else {
+ peeked = node.prev;
+ return node;
}
- return i;
+ }
+
+ public Node next() {
+ Node node = peeked;
+ if (node == head) {
+ peeked = null;
+ return null;
+ }
+ peeked = node.next;
+ return node;
+ }
+
+ public void clear() {
+ if (head.prev == head) {
+ return;
+ }
+ do {
+ Node node = head.prev;
+ if (node == head) {
+ return;
+ }
+ node.unlink();
+ } while (true);
}
}
diff --git a/src/main/java/DoublyLinkedListNode.java b/src/main/java/DoublyLinkedListNode.java
deleted file mode 100644
index cb03274..0000000
--- a/src/main/java/DoublyLinkedListNode.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
-// Jad home page: http://www.kpdus.com/jad.html
-// Decompiler options: packimports(3)
-
-public class DoublyLinkedListNode extends LinkedListNode {
-
- public DoublyLinkedListNode aNode_1303;
- public DoublyLinkedListNode aNode_1304;
-
- public DoublyLinkedListNode() {
- }
-
- public void method330() {
- if (aNode_1304 != null) {
- aNode_1304.aNode_1303 = aNode_1303;
- aNode_1303.aNode_1304 = aNode_1304;
- aNode_1303 = null;
- aNode_1304 = null;
- }
- }
-
-}
diff --git a/src/main/java/Draw2D.java b/src/main/java/Draw2D.java
index 394207e..454c93a 100644
--- a/src/main/java/Draw2D.java
+++ b/src/main/java/Draw2D.java
@@ -1,6 +1,6 @@
import java.util.Arrays;
-public class Draw2D extends DoublyLinkedListNode {
+public class Draw2D {
public static int[] pixels;
public static int width;
diff --git a/src/main/java/Entity.java b/src/main/java/Entity.java
index ec23c91..6fef21d 100644
--- a/src/main/java/Entity.java
+++ b/src/main/java/Entity.java
@@ -1,4 +1,4 @@
-public class Entity extends DoublyLinkedListNode {
+public class Entity extends DoublyLinkedList.Node {
public VertexNormal[] vertexNormal;
public int minY = 1000;
diff --git a/src/main/java/FileArchive.java b/src/main/java/FileArchive.java
index 9e95fb6..76e1143 100644
--- a/src/main/java/FileArchive.java
+++ b/src/main/java/FileArchive.java
@@ -1,3 +1,5 @@
+import java.io.IOException;
+
/**
* A simple file archive format.
*/
@@ -11,11 +13,11 @@ public class FileArchive {
public int[] fileOffset;
public boolean unpacked;
- public FileArchive(byte[] src) {
+ public FileArchive(byte[] src) throws IOException {
load(src);
}
- public void load(byte[] src) {
+ public void load(byte[] src) throws IOException {
Buffer buffer = new Buffer(src);
int unpackedSize = buffer.get3();
@@ -23,7 +25,7 @@ public class FileArchive {
if (packedSize != unpackedSize) {
data = new byte[unpackedSize];
- BZip2.decompress(data, unpackedSize, src, 6, packedSize);
+ BZip2.decompress(src, 6, packedSize, data);
buffer = new Buffer(data);
unpacked = true;
} else {
@@ -48,7 +50,7 @@ public class FileArchive {
}
}
- public byte[] read(String s, byte[] dst) {
+ public byte[] read(String s) throws IOException {
int hash = 0;
s = s.toUpperCase();
for (int j = 0; j < s.length(); j++) {
@@ -59,16 +61,13 @@ public class FileArchive {
if (fileHash[file] != hash) {
continue;
}
- if (dst == null) {
- dst = new byte[fileSizeInflated[file]];
- }
+
+ byte[] dst = new byte[fileSizeInflated[file]];
if (!unpacked) {
- BZip2.decompress(dst, fileSizeInflated[file], data, fileOffset[file], fileSizeDeflated[file]);
+ BZip2.decompress(data, fileOffset[file], fileSizeDeflated[file], dst);
} else {
- for (int i = 0; i < fileSizeInflated[file]; i++) {
- dst[i] = data[fileOffset[file] + i];
- }
+ System.arraycopy(data, fileOffset[file], dst, 0, fileSizeInflated[file]);
}
return dst;
}
diff --git a/src/main/java/FileStore.java b/src/main/java/FileStore.java
index 4be2b96..2cc67f3 100644
--- a/src/main/java/FileStore.java
+++ b/src/main/java/FileStore.java
@@ -30,7 +30,7 @@ public class FileStore {
int size = ((buf[0] & 0xff) << 16) + ((buf[1] & 0xff) << 8) + (buf[2] & 0xff);
int sector = ((buf[3] & 0xff) << 16) + ((buf[4] & 0xff) << 8) + (buf[5] & 0xff);
- if ((size < 0) || (size > maxFileSize)) {
+ if (size > maxFileSize) {
return null;
}
diff --git a/src/main/java/FloType.java b/src/main/java/FloType.java
index 4170417..e945675 100644
--- a/src/main/java/FloType.java
+++ b/src/main/java/FloType.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import java.io.IOException;
+
public class FloType {
public static int anInt387;
@@ -21,8 +23,8 @@ public class FloType {
public FloType() {
}
- public static void unpack(FileArchive archive) {
- Buffer buffer = new Buffer(archive.read("flo.dat", null));
+ public static void unpack(FileArchive archive) throws IOException {
+ Buffer buffer = new Buffer(archive.read("flo.dat"));
anInt387 = buffer.get2U();
if (instances == null) {
instances = new FloType[anInt387];
diff --git a/src/main/java/Game.java b/src/main/java/Game.java
index 9b9ed17..d3c9a2b 100644
--- a/src/main/java/Game.java
+++ b/src/main/java/Game.java
@@ -2,6 +2,8 @@
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
+import org.apache.commons.math3.random.ISAACRandom;
+
import java.applet.AppletContext;
import java.awt.*;
import java.io.DataInputStream;
@@ -21,20 +23,22 @@ public class Game extends GameShell {
public static final int[][] anIntArrayArray1003 = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}};
public static final int[] anIntArray1204 = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
public static final BigInteger RSA_MODULUS = new BigInteger("7162900525229798032761816791230527296329313291232324290237849263501208207972894053929065636522363163621000728841182238772712427862772219676577293600221789");
+ public static final int[] levelExperience;
+ public static final BigInteger RSA_PUBLIC_KEY = new BigInteger("58778699976184461502525193738213253649000149147835990136706041084440742975821");
+ public static final String aString1162 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
+ public static final int[] anIntArray1232;
+ public static final int MAX_PLAYER_COUNT = 2048;
+ public static final int LOCAL_PLAYER_INDEX = 2047;
public static int nodeId = 10;
public static int portOffset;
public static boolean members = true;
public static boolean lowmem;
public static boolean started;
- public static final int[] levelExperience;
- public static final BigInteger RSA_PUBLIC_KEY = new BigInteger("58778699976184461502525193738213253649000149147835990136706041084440742975821");
public static int drawCycle;
public static PlayerEntity aPlayer_1126;
public static boolean aBoolean1156;
public static int loopCycle;
- public static final String aString1162 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
public static boolean aBoolean1205;
- public static final int[] anIntArray1232;
static {
levelExperience = new int[99];
@@ -53,12 +57,158 @@ public class Game extends GameShell {
}
}
+ public static String method14(int i) {
+ String s = String.valueOf(i);
+ for (int k = s.length() - 3; k > 0; k -= 3) {
+ s = s.substring(0, k) + "," + s.substring(k);
+ }
+ if (s.length() > 8) {
+ s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
+ } else if (s.length() > 4) {
+ s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
+ }
+ return " " + s;
+ }
+
+ public static String method43(int j) {
+ if (j < 0x186a0) {
+ return String.valueOf(j);
+ }
+ if (j < 0x989680) {
+ return (j / 1000) + "K";
+ } else {
+ return (j / 0xf4240) + "M";
+ }
+ }
+
+ public static void setHighmem() {
+ Scene.lowmem = false;
+ Draw3D.lowmem = false;
+ lowmem = false;
+ SceneBuilder.lowmem = false;
+ LocType.lowmem = false;
+ }
+
+ public static void main(String[] args) throws UnknownHostException {
+ System.out.println("RS2 user client - release #" + 317);
+
+ if (args.length != 5) {
+ System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
+ return;
+ }
+
+ nodeId = Integer.parseInt(args[0]);
+ portOffset = Integer.parseInt(args[1]);
+
+ if (args[2].equals("lowmem")) {
+ setLowmem();
+ } else if (args[2].equals("highmem")) {
+ setHighmem();
+ } else {
+ System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
+ return;
+ }
+
+ if (args[3].equals("free")) {
+ members = false;
+ } else if (args[3].equals("members")) {
+ members = true;
+ } else {
+ System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
+ return;
+ }
+
+ Signlink.storeid = Integer.parseInt(args[4]);
+ Signlink.startpriv(InetAddress.getLocalHost());
+
+ Game game = new Game();
+ game.init(765, 503);
+ }
+
+ public static String method110(int i, int j) {
+ int d = i - j;
+ if (d < -9) {
+ return "@red@";
+ } else if (d < -6) {
+ return "@or3@";
+ } else if (d < -3) {
+ return "@or2@";
+ } else if (d < 0) {
+ return "@or1@";
+ } else if (d > 9) {
+ return "@gre@";
+ } else if (d > 6) {
+ return "@gr3@";
+ } else if (d > 3) {
+ return "@gr2@";
+ } else if (d > 0) {
+ return "@gr1@";
+ } else {
+ return "@yel@";
+ }
+ }
+
+ public static void setLowmem() {
+ Scene.lowmem = true;
+ Draw3D.lowmem = true;
+ lowmem = true;
+ SceneBuilder.lowmem = true;
+ LocType.lowmem = true;
+ }
+
public final int[] anIntArray1177 = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3};
+ public final int[] anIntArray864 = new int[SkillConstants.anInt733];
+ public final int[] anIntArray873 = new int[5];
+ public final boolean[] aBooleanArray876 = new boolean[5];
+ public final int anInt902 = 0x766654;
+ public final int[] anIntArray922 = new int[SkillConstants.anInt733];
+ public final long[] aLongArray925 = new long[100];
+ public final int anInt927 = 0x332d25;
+ public final int[] anIntArray928 = new int[5];
+ public final CRC32 aCRC32_930 = new CRC32();
+ public final int[] anIntArray942 = new int[100];
+ public final String[] aStringArray943 = new String[100];
+ public final String[] aStringArray944 = new String[100];
+ public final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff};
+ public final int[] anIntArray968 = new int[33];
+ public final int[] anIntArray969 = new int[256];
+ public final FileStore[] filestores = new FileStore[5];
+ public final int anInt975 = 50;
+ public final int[] anIntArray976 = new int[anInt975];
+ public final int[] anIntArray977 = new int[anInt975];
+ public final int[] anIntArray978 = new int[anInt975];
+ public final int[] anIntArray979 = new int[anInt975];
+ public final int[] anIntArray980 = new int[anInt975];
+ public final int[] anIntArray981 = new int[anInt975];
+ public final int[] anIntArray982 = new int[anInt975];
+ public final String[] aStringArray983 = new String[anInt975];
+ public final int[] anIntArray990 = new int[5];
+ public final int anInt1002 = 0x23201b;
+ public final int[] anIntArray1030 = new int[5];
+ public final int[] anIntArray1044 = new int[SkillConstants.anInt733];
+ public final int[] anIntArray1045 = new int[2000];
+ public final int[] anIntArray1052 = new int[151];
+ public final int[] anIntArray1057 = new int[33];
+ public final Component aComponent_1059 = new Component();
+ public final int anInt1063 = 0x4d4233;
+ public final int[] anIntArray1065 = new int[7];
+ public final int[] archiveChecksum = new int[9];
+ public final String[] aStringArray1127 = new String[5];
+ public final boolean[] aBooleanArray1128 = new boolean[5];
+ public final int[][][] sceneInstancedChunkBitset = new int[4][13][13];
+ public final int[] anIntArray1130 = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+ public final int[] anIntArray1203 = new int[5];
+ public final int[] anIntArray1207 = new int[50];
+ public final Image8[] aImageArray1219 = new Image8[2];
+ public final int[] anIntArray1229 = new int[151];
+ public final int[] anIntArray1240 = new int[100];
+ public final int[] anIntArray1241 = new int[50];
+ public final int[] anIntArray1250 = new int[50];
public int anInt822;
public long sceneLoadStartTime;
public int[][] anIntArrayArray825 = new int[104][104];
public int[] anIntArray826 = new int[200];
- public LinkedList[][][] aListArrayArrayArray827 = new LinkedList[4][104][104];
+ public DoublyLinkedList[][][] aListArrayArrayArray827 = new DoublyLinkedList[4][104][104];
public int[] anIntArray828;
public int[] anIntArray829;
public volatile boolean aBoolean831 = false;
@@ -88,8 +238,7 @@ public class Game extends GameShell {
public int anInt860;
public int anInt861;
public int anInt862;
- public int anInt863;
- public final int[] anIntArray864 = new int[SkillConstants.anInt733];
+ public int rights;
public Image8 aImage_865;
public Image8 aImage_866;
public Image8 aImage_867;
@@ -98,9 +247,7 @@ public class Game extends GameShell {
public Image24 imageMapmarker0;
public Image24 imageMapmarker1;
public boolean aBoolean872 = false;
- public final int[] anIntArray873 = new int[5];
public int anInt874 = -1;
- public final boolean[] aBooleanArray876 = new boolean[5];
public int anInt878;
public MouseRecorder aMouseRecorder_879;
public volatile boolean aBoolean880 = false;
@@ -109,8 +256,6 @@ public class Game extends GameShell {
public boolean aBoolean885 = false;
public int anInt886;
public String aString887 = "";
- public static final int MAX_PLAYER_COUNT = 2048;
- public static final int LOCAL_PLAYER_INDEX = 2047;
public PlayerEntity[] players = new PlayerEntity[MAX_PLAYER_COUNT];
public int anInt891;
public int[] anIntArray892 = new int[MAX_PLAYER_COUNT];
@@ -121,7 +266,6 @@ public class Game extends GameShell {
public int anInt899;
public int anInt900;
public int[][] anIntArrayArray901 = new int[104][104];
- public final int anInt902 = 0x766654;
public DrawArea aArea_903;
public DrawArea aArea_904;
public DrawArea aArea_905;
@@ -138,13 +282,8 @@ public class Game extends GameShell {
public int anInt916;
public int anInt917;
public int anInt918;
- public final int[] anIntArray922 = new int[SkillConstants.anInt733];
- public final long[] aLongArray925 = new long[100];
public boolean aBoolean926 = false;
- public final int anInt927 = 0x332d25;
- public final int[] anIntArray928 = new int[5];
public int[][] anIntArrayArray929 = new int[104][104];
- public final CRC32 aCRC32_930 = new CRC32();
public Image24 aImage_931;
public Image24 aImage_932;
public int anInt933;
@@ -153,9 +292,6 @@ public class Game extends GameShell {
public int anInt936;
public int anInt937;
public int anInt938;
- public final int[] anIntArray942 = new int[100];
- public final String[] aStringArray943 = new String[100];
- public final String[] aStringArray944 = new String[100];
public int anInt945;
public Scene scene;
public Image8[] imageSideicons = new Image8[13];
@@ -171,38 +307,23 @@ public class Game extends GameShell {
public volatile boolean aBoolean962 = false;
public int anInt963 = -1;
public int anInt964 = -1;
- public final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff};
public Image8 aImage_966;
public Image8 aImage_967;
- public final int[] anIntArray968 = new int[33];
- public final int[] anIntArray969 = new int[256];
- public final FileStore[] filestores = new FileStore[5];
public int[] anIntArray971 = new int[2000];
public boolean aBoolean972 = false;
public int anInt974;
- public final int anInt975 = 50;
- public final int[] anIntArray976 = new int[anInt975];
- public final int[] anIntArray977 = new int[anInt975];
- public final int[] anIntArray978 = new int[anInt975];
- public final int[] anIntArray979 = new int[anInt975];
- public final int[] anIntArray980 = new int[anInt975];
- public final int[] anIntArray981 = new int[anInt975];
- public final int[] anIntArray982 = new int[anInt975];
- public final String[] aStringArray983 = new String[anInt975];
public int anInt984;
public int anInt985 = -1;
public Image24[] imageHitmarks = new Image24[20];
public int anInt989;
- public final int[] anIntArray990 = new int[5];
public int anInt992;
public int anInt995;
public int anInt996;
public int anInt997;
public int anInt998;
public int anInt999;
- public ISAACCipher aISAACCipher_1000;
+ public ISAACRandom randomIn;
public Image24 imageMapedge;
- public final int anInt1002 = 0x23201b;
public String aString1004 = "";
public int anInt1006;
public int psize;
@@ -210,7 +331,7 @@ public class Game extends GameShell {
public int anInt1009;
public int anInt1010;
public int anInt1011;
- public LinkedList aList_1013 = new LinkedList();
+ public DoublyLinkedList aList_1013 = new DoublyLinkedList();
public int anInt1014;
public int anInt1015;
public int anInt1016;
@@ -225,7 +346,6 @@ public class Game extends GameShell {
public Image8 imageBackbase1;
public Image8 imageBackbase2;
public Image8 imageBackhmid1;
- public final int[] anIntArray1030 = new int[5];
public boolean aBoolean1031 = false;
public Image24[] imageMapfunction = new Image24[100];
public int sceneBaseTileX;
@@ -237,24 +357,17 @@ public class Game extends GameShell {
public int anInt1040;
public int anInt1041;
public int anInt1042 = -1;
- public final int[] anIntArray1044 = new int[SkillConstants.anInt733];
- public final int[] anIntArray1045 = new int[2000];
public int anInt1046;
public boolean aBoolean1047 = true;
public int anInt1048;
public String aString1049;
- public final int[] anIntArray1052 = new int[151];
public FileArchive archiveTitle;
public int anInt1054 = -1;
public int anInt1055;
- public LinkedList aList_1056 = new LinkedList();
- public final int[] anIntArray1057 = new int[33];
- public final Component aComponent_1059 = new Component();
+ public DoublyLinkedList aList_1056 = new DoublyLinkedList();
public Image8[] imageMapscene = new Image8[100];
public int anInt1062;
- public final int anInt1063 = 0x4d4233;
public int anInt1064;
- public final int[] anIntArray1065 = new int[7];
public int anInt1066;
public int anInt1067;
public OnDemand ondemand;
@@ -278,7 +391,6 @@ public class Game extends GameShell {
public int anInt1087;
public int anInt1088;
public int anInt1089;
- public final int[] archiveChecksum = new int[9];
public int[] anIntArray1091 = new int[500];
public int[] anIntArray1092 = new int[500];
public int[] anIntArray1093 = new int[500];
@@ -306,10 +418,6 @@ public class Game extends GameShell {
public DrawArea aArea_1123;
public DrawArea aArea_1124;
public DrawArea aArea_1125;
- public final String[] aStringArray1127 = new String[5];
- public final boolean[] aBooleanArray1128 = new boolean[5];
- public final int[][][] sceneInstancedChunkBitset = new int[4][13][13];
- public final int[] anIntArray1130 = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
public int anInt1131;
public int anInt1133;
public int anInt1136;
@@ -330,7 +438,7 @@ public class Game extends GameShell {
public Image8[] aImageArray1152;
public boolean aBoolean1153 = false;
public int anInt1154;
- public boolean aBoolean1157 = false;
+ public boolean ingame = false;
public boolean aBoolean1158 = false;
public boolean sceneInstanced = false;
public boolean aBoolean1160 = false;
@@ -347,7 +455,7 @@ public class Game extends GameShell {
public String aString1174 = "";
public boolean errInvalidHost = false;
public int anInt1178 = -1;
- public LinkedList listTemporaryLocs = new LinkedList();
+ public DoublyLinkedList listTemporaryLocs = new DoublyLinkedList();
public int[] anIntArray1180;
public int[] anIntArray1181;
public int[] anIntArray1182;
@@ -368,8 +476,6 @@ public class Game extends GameShell {
public String[] aStringArray1199 = new String[500];
public Image24 aImage_1201;
public Image24 aImage_1202;
- public final int[] anIntArray1203 = new int[5];
- public final int[] anIntArray1207 = new int[50];
public int flameCycle;
public int anInt1209;
public int anInt1211 = 78;
@@ -378,7 +484,6 @@ public class Game extends GameShell {
public int[][][] anIntArrayArrayArray1214;
public long aLong1215;
public int anInt1216;
- public final Image8[] aImageArray1219 = new Image8[2];
public long aLong1220;
public int anInt1221 = 3;
public int anInt1222;
@@ -386,7 +491,6 @@ public class Game extends GameShell {
public int anInt1225;
public int music;
public boolean musicFade = true;
- public final int[] anIntArray1229 = new int[151];
public SceneCollisionMap[] collisions = new SceneCollisionMap[4];
public boolean aBoolean1233 = false;
public int[] sceneMapIndex;
@@ -394,8 +498,6 @@ public class Game extends GameShell {
public int[] sceneMapLocFile;
public int anInt1237;
public int anInt1238;
- public final int[] anIntArray1240 = new int[100];
- public final int[] anIntArray1241 = new int[50];
public boolean aBoolean1242 = false;
public int anInt1243;
public int anInt1244;
@@ -404,7 +506,6 @@ public class Game extends GameShell {
public byte[][] sceneMapLocData;
public int anInt1248;
public int anInt1249;
- public final int[] anIntArray1250 = new int[50];
public int anInt1251;
public boolean errAlreadyStarted = false;
public int anInt1253;
@@ -499,7 +600,7 @@ public class Game extends GameShell {
}
@Override
- public void load() {
+ public void load() throws IOException {
showProgress(20, "Starting up");
if (Signlink.sunjava) {
@@ -588,7 +689,7 @@ public class Game extends GameShell {
ondemand = new OnDemand();
ondemand.load(archiveVersionlist, this);
- SeqFrame.init(ondemand.method557());
+ SeqFrame.init(ondemand.getSeqFrameCount());
Model.init(ondemand.getFileCount(0), ondemand);
if (!lowmem) {
@@ -731,7 +832,7 @@ public class Game extends GameShell {
byte0 = 3;
}
if (byte0 != 0) {
- ondemand.method563(byte0, 0, k2);
+ ondemand.prefetch(byte0, 0, k2);
}
}
ondemand.prefetchMaps(members);
@@ -739,7 +840,7 @@ public class Game extends GameShell {
int l = ondemand.getFileCount(2);
for (int i3 = 1; i3 < l; i3++) {
if (ondemand.method569(i3)) {
- ondemand.method563((byte) 1, 2, i3);
+ ondemand.prefetch((byte) 1, 2, i3);
}
}
}
@@ -870,7 +971,7 @@ public class Game extends GameShell {
ObjType.aBoolean182 = members;
if (!lowmem) {
showProgress(90, "Unpacking sounds");
- byte[] abyte0 = archiveSounds.read("sounds.dat", null);
+ byte[] abyte0 = archiveSounds.read("sounds.dat");
Buffer buffer = new Buffer(abyte0);
SoundTrack.method240(buffer);
}
@@ -939,6 +1040,7 @@ public class Game extends GameShell {
return;
} catch (Exception exception) {
Signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
+ exception.printStackTrace();
}
aBoolean926 = true;
}
@@ -949,7 +1051,7 @@ public class Game extends GameShell {
return;
}
loopCycle++;
- if (!aBoolean1157) {
+ if (!ingame) {
method140();
} else {
method62();
@@ -970,10 +1072,12 @@ public class Game extends GameShell {
method15();
if (aMouseRecorder_879 != null) {
aMouseRecorder_879.aBoolean808 = false;
+ aMouseRecorder_879 = null;
+ }
+ if (ondemand != null) {
+ ondemand.stop();
+ ondemand = null;
}
- aMouseRecorder_879 = null;
- ondemand.stop();
- ondemand = null;
aBuffer_834 = null;
aBuffer_1192 = null;
aBuffer_847 = null;
@@ -1090,13 +1194,13 @@ public class Game extends GameShell {
}
@Override
- public void draw() {
+ public void draw() throws IOException {
if (errAlreadyStarted || aBoolean926 || errInvalidHost) {
method94();
return;
}
drawCycle++;
- if (!aBoolean1157) {
+ if (!ingame) {
method135(false);
} else {
method102();
@@ -1134,7 +1238,7 @@ public class Game extends GameShell {
}
@Override
- public void showProgress(int percent, String message) {
+ public void showProgress(int percent, String message) throws IOException {
anInt1079 = percent;
aString1049 = message;
method64();
@@ -1169,118 +1273,12 @@ public class Game extends GameShell {
}
}
- public static String method14(int i) {
- String s = String.valueOf(i);
- for (int k = s.length() - 3; k > 0; k -= 3) {
- s = s.substring(0, k) + "," + s.substring(k);
- }
- if (s.length() > 8) {
- s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
- } else if (s.length() > 4) {
- s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
- }
- return " " + s;
- }
-
- public static String method43(int j) {
- if (j < 0x186a0) {
- return String.valueOf(j);
- }
- if (j < 0x989680) {
- return (j / 1000) + "K";
- } else {
- return (j / 0xf4240) + "M";
- }
- }
-
- public static void setHighmem() {
- Scene.lowmem = false;
- Draw3D.lowmem = false;
- lowmem = false;
- SceneBuilder.lowmem = false;
- LocType.lowmem = false;
- }
-
- public static void main(String[] args) throws UnknownHostException {
- System.out.println("RS2 user client - release #" + 317);
-
- if (args.length != 5) {
- System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
- return;
- }
-
- nodeId = Integer.parseInt(args[0]);
- portOffset = Integer.parseInt(args[1]);
-
- if (args[2].equals("lowmem")) {
- setLowmem();
- } else if (args[2].equals("highmem")) {
- setHighmem();
- } else {
- System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
- return;
- }
-
- if (args[3].equals("free")) {
- members = false;
- } else if (args[3].equals("members")) {
- members = true;
- } else {
- System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
- return;
- }
-
- Signlink.storeid = Integer.parseInt(args[4]);
- Signlink.startpriv(InetAddress.getLocalHost());
-
- Game game = new Game();
- game.init(765, 503);
- }
-
- public static String method110(int i, int j) {
- int d = i - j;
- if (d < -9) {
- return "@red@";
- } else
- if (d < -6) {
- return "@or3@";
- }else
- if (d < -3) {
- return "@or2@";
- } else
- if (d < 0) {
- return "@or1@";
- } else
- if (d > 9) {
- return "@gre@";
- } else
- if (d > 6) {
- return "@gr3@";
- } else
- if (d > 3) {
- return "@gr2@";
- } else
- if (d > 0) {
- return "@gr1@";
- } else {
- return "@yel@";
- }
- }
-
- public static void setLowmem() {
- Scene.lowmem = true;
- Draw3D.lowmem = true;
- lowmem = true;
- SceneBuilder.lowmem = true;
- LocType.lowmem = true;
- }
-
public void method15() {
Signlink.midifade = 0;
Signlink.midi = "stop";
}
- public void loadArchiveChecksums() {
+ public void loadArchiveChecksums() throws IOException {
int j = 5;
archiveChecksum[8] = 0;
int k = 0;
@@ -1355,7 +1353,7 @@ public class Game extends GameShell {
aArea_1166.bind();
Draw3D.lineOffset = anIntArray1180;
imageChatback.method361(0, 0);
-
+
if (aBoolean1256) {
fontBold12.drawStringCenter(aString1121, 239, 40, 0);
fontBold12.drawStringCenter(aString1212 + "*", 239, 60, 128);
@@ -1606,8 +1604,8 @@ public class Game extends GameShell {
public void method22() {
try {
anInt985 = -1;
- aList_1056.method256();
- aList_1013.method256();
+ aList_1056.clear();
+ aList_1013.clear();
Draw3D.disposePool();
method23();
scene.method274();
@@ -1728,7 +1726,7 @@ public class Game extends GameShell {
method63();
} catch (Exception ignored) {
}
- LocType.aCache_785.method224();
+ LocType.aCache_785.clear();
if (super.frame != null) {
aBuffer_1192.putOp(210);
aBuffer_1192.put4(0x3f008edd);
@@ -1776,13 +1774,13 @@ public class Game extends GameShell {
}
public void method23() {
- LocType.aCache_785.method224();
- LocType.aCache_780.method224();
- NPCType.aCache_95.method224();
- ObjType.aCache_159.method224();
- ObjType.aCache_158.method224();
- PlayerEntity.modelCache.method224();
- SpotAnimType.modelCache.method224();
+ LocType.aCache_785.clear();
+ LocType.aCache_780.clear();
+ NPCType.aCache_95.clear();
+ ObjType.aCache_159.clear();
+ ObjType.aCache_158.clear();
+ PlayerEntity.modelCache.clear();
+ SpotAnimType.modelCache.clear();
}
public void method24(int i) {
@@ -1858,14 +1856,14 @@ public class Game extends GameShell {
}
public void method25(int i, int j) {
- LinkedList list = aListArrayArrayArray827[anInt918][i][j];
+ DoublyLinkedList list = aListArrayArrayArray827[anInt918][i][j];
if (list == null) {
scene.method295(anInt918, i, j);
return;
}
int k = 0xfa0a1f01;
ObjStackEntity obj = null;
- for (ObjStackEntity objStack = (ObjStackEntity) list.method252(); objStack != null; objStack = (ObjStackEntity) list.method254()) {
+ for (ObjStackEntity objStack = (ObjStackEntity) list.peekFront(); objStack != null; objStack = (ObjStackEntity) list.prev()) {
ObjType type = ObjType.method198(objStack.anInt1558);
int l = type.anInt155;
if (type.aBoolean176) {
@@ -1876,10 +1874,10 @@ public class Game extends GameShell {
obj = objStack;
}
}
- list.method250(obj);
+ list.pushFront(obj);
ObjStackEntity obj1 = null;
Entity obj2 = null;
- for (ObjStackEntity objStack_1 = (ObjStackEntity) list.method252(); objStack_1 != null; objStack_1 = (ObjStackEntity) list.method254()) {
+ for (ObjStackEntity objStack_1 = (ObjStackEntity) list.peekFront(); objStack_1 != null; objStack_1 = (ObjStackEntity) list.prev()) {
if ((objStack_1.anInt1558 != obj.anInt1558) && (obj1 == null)) {
obj1 = objStack_1;
}
@@ -2250,7 +2248,7 @@ public class Game extends GameShell {
if (k == 4) {
Draw3D.setBrightness(0.59999999999999998D);
}
- ObjType.aCache_158.method224();
+ ObjType.aCache_158.clear();
aBoolean1255 = true;
}
if (j == 3) {
@@ -2840,7 +2838,7 @@ public class Game extends GameShell {
} catch (Exception ignored) {
}
connection = null;
- aBoolean1157 = false;
+ ingame = false;
anInt833 = 0;
aString1173 = "";
aString1174 = "";
@@ -3195,7 +3193,7 @@ public class Game extends GameShell {
}
}
- public void method51() {
+ public void method51() throws IOException {
aImage_966 = new Image8(archiveTitle, "titlebox", 0);
aImage_967 = new Image8(archiveTitle, "titlebutton", 0);
aImageArray1152 = new Image8[12];
@@ -3335,9 +3333,9 @@ public class Game extends GameShell {
}
public void method55() {
- for (ProjectileEntity projectile = (ProjectileEntity) aList_1013.method252(); projectile != null; projectile = (ProjectileEntity) aList_1013.method254()) {
+ for (ProjectileEntity projectile = (ProjectileEntity) aList_1013.peekFront(); projectile != null; projectile = (ProjectileEntity) aList_1013.prev()) {
if ((projectile.anInt1597 != anInt918) || (loopCycle > projectile.anInt1572)) {
- projectile.method329();
+ projectile.unlink();
} else if (loopCycle >= projectile.anInt1571) {
if (projectile.anInt1590 > 0) {
NPCEntity npc = npcs[projectile.anInt1590 - 1];
@@ -3363,8 +3361,8 @@ public class Game extends GameShell {
}
}
- public void method56() {
- byte[] abyte0 = archiveTitle.read("title.dat", null);
+ public void method56() throws IOException {
+ byte[] abyte0 = archiveTitle.read("title.dat");
Image24 image = new Image24(abyte0, this);
aArea_1110.bind();
image.method346(0, 0);
@@ -3570,7 +3568,7 @@ public class Game extends GameShell {
break;
}
}
- if (!aBoolean1157) {
+ if (!ingame) {
return;
}
synchronized (aMouseRecorder_879.lock) {
@@ -3839,18 +3837,18 @@ public class Game extends GameShell {
}
public void method63() {
- SceneLocTemporary loc = (SceneLocTemporary) listTemporaryLocs.method252();
- for (; loc != null; loc = (SceneLocTemporary) listTemporaryLocs.method254()) {
+ SceneLocTemporary loc = (SceneLocTemporary) listTemporaryLocs.peekFront();
+ for (; loc != null; loc = (SceneLocTemporary) listTemporaryLocs.prev()) {
if (loc.anInt1294 == -1) {
loc.anInt1302 = 0;
method89(loc);
} else {
- loc.method329();
+ loc.unlink();
}
}
}
- public void method64() {
+ public void method64() throws IOException {
if (aArea_1107 != null) {
return;
}
@@ -3952,7 +3950,7 @@ public class Game extends GameShell {
return true;
}
- public FileArchive loadArchive(int i, String s, String s1, int j, int k) {
+ public FileArchive loadArchive(int i, String s, String s1, int j, int k) throws IOException {
byte[] abyte0 = null;
int l = 5;
try {
@@ -4085,10 +4083,10 @@ public class Game extends GameShell {
anInt1021 = 0;
anInt1261 = 0;
Connection connection = this.connection;
- aBoolean1157 = false;
+ ingame = false;
anInt1038 = 0;
method84(aString1173, aString1174, true);
- if (!aBoolean1157) {
+ if (!ingame) {
method44();
}
try {
@@ -4999,9 +4997,9 @@ public class Game extends GameShell {
method88(i1, l1, player, j1);
}
if (k1 == 3) {
- LinkedList list = aListArrayArrayArray827[anInt918][i1][j1];
+ DoublyLinkedList list = aListArrayArrayArray827[anInt918][i1][j1];
if (list != null) {
- for (ObjStackEntity objStack = (ObjStackEntity) list.method253(); objStack != null; objStack = (ObjStackEntity) list.method255()) {
+ for (ObjStackEntity objStack = (ObjStackEntity) list.peekBack(); objStack != null; objStack = (ObjStackEntity) list.next()) {
ObjType type = ObjType.method198(objStack.anInt1558);
if (anInt1282 == 1) {
aStringArray1199[anInt1133] = "Use " + aString1286 + " with @lre@" + type.aString170;
@@ -5069,11 +5067,17 @@ public class Game extends GameShell {
System.out.println("flame-cycle:" + flameCycle);
if (ondemand != null) {
System.out.println("Od-cycle:" + ondemand.cycle);
+ System.out.println("Od-remaining:" + ondemand.remaining());
+ for (OnDemandRequest request : ondemand.requests) {
+ System.out.println(request);
+ }
}
System.out.println("loop-cycle:" + loopCycle);
System.out.println("draw-cycle:" + drawCycle);
System.out.println("ptype:" + ptype);
System.out.println("psize:" + psize);
+ System.out.println("scene-state:" + sceneState);
+ System.out.println("draw-state:" + method54());
if (connection != null) {
connection.method272();
}
@@ -5191,7 +5195,7 @@ public class Game extends GameShell {
aBoolean1223 = true;
}
if (((j == 13) || (j == 10)) && (aString887.length() > 0)) {
- if (anInt863 == 2) {
+ if (rights == 0) {
if (aString887.equals("::clientdrop")) {
method68();
}
@@ -5200,7 +5204,7 @@ public class Game extends GameShell {
}
if (aString887.equals("::prefetchmusic")) {
for (int j1 = 0; j1 < ondemand.getFileCount(2); j1++) {
- ondemand.method563((byte) 1, 2, j1);
+ ondemand.prefetch((byte) 1, 2, j1);
}
}
if (aString887.equals("::fpson")) {
@@ -5296,9 +5300,9 @@ public class Game extends GameShell {
aPlayer_1126.anInt1513 = j2;
aPlayer_1126.anInt1531 = i3;
aPlayer_1126.anInt1535 = 150;
- if (anInt863 == 2) {
+ if (rights == 2) {
method77(2, "@cr2@" + aPlayer_1126.aString1703, aPlayer_1126.aString1506);
- } else if (anInt863 == 1) {
+ } else if (rights == 1) {
method77(2, "@cr1@" + aPlayer_1126.aString1703, aPlayer_1126.aString1506);
} else {
method77(2, aPlayer_1126.aString1703, aPlayer_1126.aString1506);
@@ -5342,7 +5346,7 @@ public class Game extends GameShell {
}
if (((j1 == 1) || (j1 == 2)) && ((j1 == 1) || (anInt1287 == 0) || ((anInt1287 == 1) && method109(s)))) {
if ((j > (k1 - 14)) && (j <= k1) && !s.equals(aPlayer_1126.aString1703)) {
- if (anInt863 >= 1) {
+ if (rights >= 1) {
aStringArray1199[anInt1133] = "Report abuse @whi@" + s;
anIntArray1093[anInt1133] = 606;
anInt1133++;
@@ -5358,7 +5362,7 @@ public class Game extends GameShell {
}
if (((j1 == 3) || (j1 == 7)) && (anInt1195 == 0) && ((j1 == 7) || (anInt845 == 0) || ((anInt845 == 1) && method109(s)))) {
if ((j > (k1 - 14)) && (j <= k1)) {
- if (anInt863 >= 1) {
+ if (rights >= 1) {
aStringArray1199[anInt1133] = "Report abuse @whi@" + s;
anIntArray1093[anInt1133] = 606;
anInt1133++;
@@ -5568,7 +5572,7 @@ public class Game extends GameShell {
return;
}
if (j == 613) {
- if (anInt863 >= 1) {
+ if (rights >= 1) {
if (aBoolean1158) {
component.anInt232 = 0xff0000;
component.aString248 = "Moderator option: Mute player for 48 hours: null if not loaded.
+ */
+ public static Model tryGet(int id) {
+ if (headers == null) {
+ return null;
+ }
+
+ Header header = headers[id];
+
+ if (header != null) {
+ return new Model(id);
+ } else {
+ ondemand.method548(id);
+ return null;
+ }
+ }
+
+ /**
+ * Validates the provided model id. If the model is not loaded then a request is sent to the ondemand service.
+ *
+ * @param id the model id.
+ * @return true if the model is loaded.
+ */
+ public static boolean validate(int id) {
+ if (headers == null) {
+ return false;
+ }
+
+ Header header = headers[id];
+
+ if (header != null) {
+ return true;
+ } else {
+ ondemand.method548(id);
+ return false;
+ }
+ }
+
+ /**
+ * Utility function. Multiplies the input HSL lightness component by the provided scalar.
+ *
+ * @param hsl the color value.
+ * @param scalar the scalar. [0...127]
+ * @param faceInfo Provided face info to determine the type of color to return. Textured triangles (type 2) only have
+ * a lightness component.
+ * @return the color.
+ * @see #palette
+ */
+ public static int mulColorLightness(int hsl, int scalar, int faceInfo) {
+ if ((faceInfo & 2) == 2) {
+ if (scalar < 0) {
+ scalar = 0;
+ } else if (scalar > 127) {
+ scalar = 127;
+ }
+ scalar = 127 - scalar;
+ return scalar;
+ }
+ scalar = (scalar * (hsl & 0x7f)) >> 7;
+ if (scalar < 2) {
+ scalar = 2;
+ } else if (scalar > 126) {
+ scalar = 126;
+ }
+ return (hsl & 0xff80) + scalar;
+ }
+
public int vertexCount;
public int[] vertexX;
public int[] vertexY;
@@ -84,7 +282,6 @@ public class Model extends Entity {
public int radius;
public int minDepth;
public int maxDepth;
-
/**
* minDepth = (int) Math.sqrt((radius * radius) + (super.minY * super.minY));
* maxDepth = minDepth + (int) Math.sqrt((radius * radius) + (maxY * maxY));
@@ -112,7 +309,6 @@ public class Model extends Entity {
* @see #draw(int, int, int, int, int, int, int, int, int)
*/
public boolean pickBounds = false;
-
/**
* A storage for the original vertex normals to give {@link Scene#method308(Model, Model, int, int, int, boolean)}
* a reference.
@@ -136,7 +332,7 @@ public class Model extends Entity {
public Model(int id) {
counter++;
- ModelHeader header = headers[id];
+ Header header = headers[id];
vertexCount = header.vertexCount;
faceCount = header.faceCount;
texturedFaceCount = header.texturedFaceCount;
@@ -776,182 +972,6 @@ public class Model extends Entity {
maxX = model.maxX;
}
- public static void unload() {
- headers = null;
- faceClippedX = null;
- faceNearClipped = null;
- vertexScreenX = null;
- vertexScreenY = null;
- vertexScreenZ = null;
- vertexViewSpaceX = null;
- vertexViewSpaceY = null;
- vertexViewSpaceZ = null;
- tmpDepthFaceCount = null;
- tmpDepthFaces = null;
- tmpPriorityFaceCount = null;
- tmpPriorityFaces = null;
- tmpPriority10FaceDepth = null;
- tmpPriority11FaceDepth = null;
- tmpPriorityDepthSum = null;
- sin = null;
- cos = null;
- palette = null;
- reciprical16 = null;
- }
-
- public static void init(int count, OnDemand ondemand) {
- headers = new ModelHeader[count];
- Model.ondemand = ondemand;
- }
-
- public static void unpack(byte[] src, int id) {
- if (src == null) {
- ModelHeader header = headers[id] = new ModelHeader();
- header.vertexCount = 0;
- header.faceCount = 0;
- header.texturedFaceCount = 0;
- return;
- }
- Buffer buffer = new Buffer(src);
- buffer.position = src.length - 18;
- ModelHeader header = headers[id] = new ModelHeader();
- header.data = src;
- header.vertexCount = buffer.get2U();
- header.faceCount = buffer.get2U();
- header.texturedFaceCount = buffer.get1U();
- int k = buffer.get1U();
- int l = buffer.get1U();
- int i1 = buffer.get1U();
- int j1 = buffer.get1U();
- int k1 = buffer.get1U();
- int l1 = buffer.get2U();
- int i2 = buffer.get2U();
- //noinspection unused
- int j2 = buffer.get2U();
- int k2 = buffer.get2U();
- int offset = 0;
- header.obPoint1Position = offset;
- offset += header.vertexCount;
- header.obVertex2Position = offset;
- offset += header.faceCount;
- header.obFace3Position = offset;
- if (l == 255) {
- offset += header.faceCount;
- } else {
- header.obFace3Position = -l - 1;
- }
- header.obFace5Position = offset;
- if (j1 == 1) {
- offset += header.faceCount;
- } else {
- header.obFace5Position = -1;
- }
- header.obFace2Position = offset;
- if (k == 1) {
- offset += header.faceCount;
- } else {
- header.obFace2Position = -1;
- }
- header.obPoint5Position = offset;
- if (k1 == 1) {
- offset += header.vertexCount;
- } else {
- header.obPoint5Position = -1;
- }
- header.obFace4Position = offset;
- if (i1 == 1) {
- offset += header.faceCount;
- } else {
- header.obFace4Position = -1;
- }
- header.obVertex1Position = offset;
- offset += k2;
- header.obFace1Position = offset;
- offset += header.faceCount * 2;
- header.obAxisPosition = offset;
- offset += header.texturedFaceCount * 6;
- header.obPoint2Position = offset;
- offset += l1;
- header.obPoint3Position = offset;
- offset += i2;
- header.obPoint4Position = offset;
- }
-
- public static void unload(int id) {
- headers[id] = null;
- }
-
- /**
- * Tries to get the model. Sends a request to the ondemand service to load the model if it isn't loaded.
- *
- * @param id the model id.
- * @return the model, or null if not loaded.
- */
- public static Model tryGet(int id) {
- if (headers == null) {
- return null;
- }
-
- ModelHeader header = headers[id];
-
- if (header != null) {
- return new Model(id);
- } else {
- ondemand.method548(id);
- return null;
- }
- }
-
- /**
- * Validates the provided model id. If the model is not loaded then a request is sent to the ondemand service.
- *
- * @param id the model id.
- * @return true if the model is loaded.
- */
- public static boolean validate(int id) {
- if (headers == null) {
- return false;
- }
-
- ModelHeader header = headers[id];
-
- if (header != null) {
- return true;
- } else {
- ondemand.method548(id);
- return false;
- }
- }
-
- /**
- * Utility function. Multiplies the input HSL lightness component by the provided scalar.
- *
- * @param hsl the color value.
- * @param scalar the scalar. [0...127]
- * @param faceInfo Provided face info to determine the type of color to return. Textured triangles (type 2) only have
- * a lightness component.
- * @return the color.
- * @see #palette
- */
- public static int mulColorLightness(int hsl, int scalar, int faceInfo) {
- if ((faceInfo & 2) == 2) {
- if (scalar < 0) {
- scalar = 0;
- } else if (scalar > 127) {
- scalar = 127;
- }
- scalar = 127 - scalar;
- return scalar;
- }
- scalar = (scalar * (hsl & 0x7f)) >> 7;
- if (scalar < 2) {
- scalar = 2;
- } else if (scalar > 126) {
- scalar = 126;
- }
- return (hsl & 0xff80) + scalar;
- }
-
/**
* Sets this model to the provided model using a vertex pool.
*