diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_27.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_27.xml new file mode 100644 index 0000000..5f4b15d --- /dev/null +++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/317.iml b/317.iml index 42fd409..7e4e8c5 100644 --- a/317.iml +++ b/317.iml @@ -13,6 +13,7 @@ + diff --git a/pom.xml b/pom.xml index 01ee5e1..937a006 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,11 @@ + + org.yaml + snakeyaml + 1.27 + org.apache.commons diff --git a/src/main/java/Game.java b/src/main/java/Game.java index ec915cb..6b46866 100644 --- a/src/main/java/Game.java +++ b/src/main/java/Game.java @@ -15,6 +15,10 @@ import java.net.InetAddress; import java.net.Socket; import java.net.URL; import java.net.UnknownHostException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Arrays; import java.util.zip.CRC32; @@ -312,7 +316,7 @@ public class Game extends GameShell { public int anInt964 = -1; public Image8 imageTitlebox; public Image8 imageTitlebutton; - public int[] anIntArray971 = new int[2000]; + public int[] variables = new int[2000]; public boolean aBoolean972 = false; public int anInt974; public int anInt984; @@ -809,18 +813,36 @@ public class Game extends GameShell { if (filestores[0] != null) { showProgress(75, "Requesting maps"); - ondemand.request(3, ondemand.getMapFile(0, 47, 48)); - ondemand.request(3, ondemand.getMapFile(1, 47, 48)); - ondemand.request(3, ondemand.getMapFile(0, 48, 48)); - ondemand.request(3, ondemand.getMapFile(1, 48, 48)); - ondemand.request(3, ondemand.getMapFile(0, 49, 48)); - ondemand.request(3, ondemand.getMapFile(1, 49, 48)); - ondemand.request(3, ondemand.getMapFile(0, 47, 47)); - ondemand.request(3, ondemand.getMapFile(1, 47, 47)); - ondemand.request(3, ondemand.getMapFile(0, 48, 47)); - ondemand.request(3, ondemand.getMapFile(1, 48, 47)); - ondemand.request(3, ondemand.getMapFile(0, 48, 148)); - ondemand.request(3, ondemand.getMapFile(1, 48, 148)); + sceneMapLandFile = new int[ondemand.mapIndex.length]; + sceneMapLocFile = new int[ondemand.mapIndex.length]; + sceneMapIndex = new int[ondemand.mapIndex.length]; + sceneMapLandData = new byte[sceneMapIndex.length][]; + sceneMapLocData = new byte[sceneMapIndex.length][]; + + for (int i = 0; i < ondemand.mapIndex.length; i++) { + int landFile = ondemand.mapLandFile[i]; + int locFile = ondemand.mapLocFile[i]; + + sceneMapIndex[i] = ondemand.mapIndex[i]; + sceneMapLandFile[i] = landFile; + sceneMapLocFile[i] = locFile; + + ondemand.request(3, landFile); + ondemand.request(3, locFile); + } + +// ondemand.request(3, ondemand.getMapFile(0, 47, 48)); +// ondemand.request(3, ondemand.getMapFile(1, 47, 48)); +// ondemand.request(3, ondemand.getMapFile(0, 48, 48)); +// ondemand.request(3, ondemand.getMapFile(1, 48, 48)); +// ondemand.request(3, ondemand.getMapFile(0, 49, 48)); +// ondemand.request(3, ondemand.getMapFile(1, 49, 48)); +// ondemand.request(3, ondemand.getMapFile(0, 47, 47)); +// ondemand.request(3, ondemand.getMapFile(1, 47, 47)); +// ondemand.request(3, ondemand.getMapFile(0, 48, 47)); +// ondemand.request(3, ondemand.getMapFile(1, 48, 47)); +// ondemand.request(3, ondemand.getMapFile(0, 48, 148)); +// ondemand.request(3, ondemand.getMapFile(1, 48, 148)); total = ondemand.remaining(); @@ -1076,7 +1098,7 @@ public class Game extends GameShell { } @Override - public void update() { + public void update() throws IOException { if (errAlreadyStarted || aBoolean926 || errInvalidHost) { return; } @@ -1187,7 +1209,7 @@ public class Game extends GameShell { anIntArray1093 = null; anIntArray1094 = null; aStringArray1199 = null; - anIntArray971 = null; + variables = null; activeMapFunctionX = null; activeMapFunctionZ = null; activeMapFunctions = null; @@ -1758,7 +1780,7 @@ public class Game extends GameShell { } catch (Exception ignored) { } - LocType.aCache_785.clear(); + LocType.modelCache.clear(); if (super.frame != null) { aBuffer_1192.putOp(210); @@ -1807,7 +1829,7 @@ public class Game extends GameShell { } public void clearCaches() { - LocType.aCache_785.clear(); + LocType.modelCache.clear(); LocType.aCache_780.clear(); NPCType.modelCache.clear(); ObjType.modelCache.clear(); @@ -1867,16 +1889,16 @@ public class Game extends GameShell { bitset = (bitset >> 14) & 0x7fff; - int j3 = LocType.method572(bitset).anInt746; + int func = LocType.get(bitset).mapfunctionIcon; - if (j3 < 0) { + if (func < 0) { continue; } int stx = x; int stz = z; - if ((j3 != 22) && (j3 != 29) && (j3 != 34) && (j3 != 36) && (j3 != 46) && (j3 != 47) && (j3 != 48)) { + if ((func != 22) && (func != 29) && (func != 34) && (func != 36) && (func != 46) && (func != 47) && (func != 48)) { byte byte0 = 104; byte byte1 = 104; int[][] flags = collisions[currentPlane].flags; @@ -1896,7 +1918,7 @@ public class Game extends GameShell { } } } - activeMapFunctions[activeMapFunctionCount] = imageMapfunction[j3]; + activeMapFunctions[activeMapFunctionCount] = imageMapfunction[func]; activeMapFunctionX[activeMapFunctionCount] = stx; activeMapFunctionZ[activeMapFunctionCount] = stz; activeMapFunctionCount++; @@ -2301,7 +2323,7 @@ public class Game extends GameShell { return; } - int value = anIntArray971[varp]; + int value = variables[varp]; if (key == 1) { if (value == 1) { @@ -3165,13 +3187,13 @@ public class Game extends GameShell { int[] ai = imageMinimap.pixels; int k4 = 24624 + (l * 4) + ((103 - i) * 512 * 4); int i5 = (k1 >> 14) & 0x7fff; - LocType type_2 = LocType.method572(i5); - if (type_2.anInt758 != -1) { - Image8 class30_sub2_sub1_sub2_2 = imageMapscene[type_2.anInt758]; + LocType type_2 = LocType.get(i5); + if (type_2.mapsceneIcon != -1) { + Image8 class30_sub2_sub1_sub2_2 = imageMapscene[type_2.mapsceneIcon]; if (class30_sub2_sub1_sub2_2 != null) { - int i6 = ((type_2.anInt744 * 4) - class30_sub2_sub1_sub2_2.width) / 2; - int j6 = ((type_2.anInt761 * 4) - class30_sub2_sub1_sub2_2.height) / 2; - class30_sub2_sub1_sub2_2.blit(48 + (l * 4) + i6, 48 + ((104 - i - type_2.anInt761) * 4) + j6); + int i6 = ((type_2.sizeX * 4) - class30_sub2_sub1_sub2_2.width) / 2; + int j6 = ((type_2.sizeZ * 4) - class30_sub2_sub1_sub2_2.height) / 2; + class30_sub2_sub1_sub2_2.blit(48 + (l * 4) + i6, 48 + ((104 - i - type_2.sizeZ) * 4) + j6); } } else { if ((i3 == 0) || (i3 == 2)) { @@ -3239,13 +3261,13 @@ public class Game extends GameShell { int l2 = (i2 >> 6) & 3; int j3 = i2 & 0x1f; int l3 = (k1 >> 14) & 0x7fff; - LocType type_1 = LocType.method572(l3); - if (type_1.anInt758 != -1) { - Image8 class30_sub2_sub1_sub2_1 = imageMapscene[type_1.anInt758]; + LocType type_1 = LocType.get(l3); + if (type_1.mapsceneIcon != -1) { + Image8 class30_sub2_sub1_sub2_1 = imageMapscene[type_1.mapsceneIcon]; if (class30_sub2_sub1_sub2_1 != null) { - int j5 = ((type_1.anInt744 * 4) - class30_sub2_sub1_sub2_1.width) / 2; - int k5 = ((type_1.anInt761 * 4) - class30_sub2_sub1_sub2_1.height) / 2; - class30_sub2_sub1_sub2_1.blit(48 + (l * 4) + j5, 48 + ((104 - i - type_1.anInt761) * 4) + k5); + int j5 = ((type_1.sizeX * 4) - class30_sub2_sub1_sub2_1.width) / 2; + int k5 = ((type_1.sizeZ * 4) - class30_sub2_sub1_sub2_1.height) / 2; + class30_sub2_sub1_sub2_1.blit(48 + (l * 4) + j5, 48 + ((104 - i - type_1.sizeZ) * 4) + k5); } } else if (j3 == 9) { int l4 = 0xeeeeee; @@ -3270,13 +3292,13 @@ public class Game extends GameShell { k1 = scene.getGroundDecorationBitset(j1, l, i); if (k1 != 0) { int j2 = (k1 >> 14) & 0x7fff; - LocType type = LocType.method572(j2); - if (type.anInt758 != -1) { - Image8 image = imageMapscene[type.anInt758]; + LocType type = LocType.get(j2); + if (type.mapsceneIcon != -1) { + Image8 image = imageMapscene[type.mapsceneIcon]; if (image != null) { - int i4 = ((type.anInt744 * 4) - image.width) / 2; - int j4 = ((type.anInt761 * 4) - image.height) / 2; - image.blit(48 + (l * 4) + i4, 48 + ((104 - i - type.anInt761) * 4) + j4); + int i4 = ((type.sizeX * 4) - image.width) / 2; + int j4 = ((type.sizeZ * 4) - image.height) / 2; + image.blit(48 + (l * 4) + i4, 48 + ((104 - i - type.sizeZ) * 4) + j4); } } } @@ -3531,7 +3553,7 @@ public class Game extends GameShell { System.gc(); } - public void handleOnDemandRequests() { + public void handleOnDemandRequests() throws IOException { do { OnDemandRequest request; do { @@ -3559,19 +3581,27 @@ public class Game extends GameShell { midisave(musicFade, request.data); } - if ((request.store == 3) && (sceneState == 1)) { + if ((request.store == 3)) { for (int i = 0; i < sceneMapLandData.length; i++) { + int x = sceneMapIndex[i] >> 8; + int z = sceneMapIndex[i] & 0xFF; + if (sceneMapLandFile[i] == request.file) { sceneMapLandData[i] = request.data; if (request.data == null) { sceneMapLandFile[i] = -1; + } else { + Files.write(Paths.get("maps", String.format("m%d_%d", x, z)), request.data); } break; } + if (sceneMapLocFile[i] == request.file) { sceneMapLocData[i] = request.data; if (request.data == null) { sceneMapLocFile[i] = -1; + } else { + Files.write(Paths.get("maps", String.format("l%d_%d", x, z)), request.data); } break; } @@ -4070,17 +4100,17 @@ public class Game extends GameShell { int k1 = j1 & 0x1f; int l1 = (j1 >> 6) & 3; if ((k1 == 10) || (k1 == 11) || (k1 == 22)) { - LocType type = LocType.method572(i1); + LocType type = LocType.get(i1); int i2; int j2; if ((l1 == 0) || (l1 == 2)) { - i2 = type.anInt744; - j2 = type.anInt761; + i2 = type.sizeX; + j2 = type.sizeZ; } else { - i2 = type.anInt761; - j2 = type.anInt744; + i2 = type.sizeZ; + j2 = type.sizeX; } - int k2 = type.anInt768; + int k2 = type.interactionSideFlags; if (l1 != 0) { k2 = ((k2 << l1) & 0xf) + (k2 >> (4 - l1)); } @@ -4655,8 +4685,8 @@ public class Game extends GameShell { Component component_2 = Component.instances[k]; if ((component_2.anIntArrayArray226 != null) && (component_2.anIntArrayArray226[0][0] == 5)) { int i2 = component_2.anIntArrayArray226[0][1]; - if (anIntArray971[i2] != component_2.anIntArray212[0]) { - anIntArray971[i2] = component_2.anIntArray212[0]; + if (variables[i2] != component_2.anIntArray212[0]) { + variables[i2] = component_2.anIntArray212[0]; updateVarp(i2); redrawInvback = true; } @@ -4957,7 +4987,7 @@ public class Game extends GameShell { Component component_3 = Component.instances[k]; if ((component_3.anIntArrayArray226 != null) && (component_3.anIntArrayArray226[0][0] == 5)) { int l2 = component_3.anIntArrayArray226[0][1]; - anIntArray971[l2] = 1 - anIntArray971[l2]; + variables[l2] = 1 - variables[l2]; updateVarp(l2); redrawInvback = true; } @@ -4974,12 +5004,12 @@ public class Game extends GameShell { } if (l == 1226) { int j1 = (i1 >> 14) & 0x7fff; - LocType type = LocType.method572(j1); + LocType type = LocType.get(j1); String s10; - if (type.aByteArray777 != null) { - s10 = new String(type.aByteArray777); + if (type.description != null) { + s10 = type.description; } else { - s10 = "It's a " + type.aString739 + "."; + s10 = "It's a " + type.name + "."; } method77(0, "", s10); } @@ -5047,15 +5077,15 @@ public class Game extends GameShell { } j = l; if ((k1 == 2) && (scene.getInfo(currentPlane, i1, j1, l) >= 0)) { - LocType type = LocType.method572(l1); - if (type.anIntArray759 != null) { + LocType type = LocType.get(l1); + if (type.overrideIds != null) { type = type.method580(); } if (type == null) { continue; } if (anInt1282 == 1) { - aStringArray1199[anInt1133] = "Use " + aString1286 + " with @cya@" + type.aString739; + aStringArray1199[anInt1133] = "Use " + aString1286 + " with @cya@" + type.name; anIntArray1093[anInt1133] = 62; anIntArray1094[anInt1133] = l; anIntArray1091[anInt1133] = i1; @@ -5063,7 +5093,7 @@ public class Game extends GameShell { anInt1133++; } else if (anInt1136 == 1) { if ((anInt1138 & 4) == 4) { - aStringArray1199[anInt1133] = aString1139 + " @cya@" + type.aString739; + aStringArray1199[anInt1133] = aString1139 + " @cya@" + type.name; anIntArray1093[anInt1133] = 956; anIntArray1094[anInt1133] = l; anIntArray1091[anInt1133] = i1; @@ -5071,10 +5101,10 @@ public class Game extends GameShell { anInt1133++; } } else { - if (type.aStringArray786 != null) { + if (type.actions != null) { for (int i2 = 4; i2 >= 0; i2--) { - if (type.aStringArray786[i2] != null) { - aStringArray1199[anInt1133] = type.aStringArray786[i2] + " @cya@" + type.aString739; + if (type.actions[i2] != null) { + aStringArray1199[anInt1133] = type.actions[i2] + " @cya@" + type.name; if (i2 == 0) { anIntArray1093[anInt1133] = 502; } @@ -5097,9 +5127,9 @@ public class Game extends GameShell { } } } - aStringArray1199[anInt1133] = "Examine @cya@" + type.aString739; + aStringArray1199[anInt1133] = "Examine @cya@" + type.name; anIntArray1093[anInt1133] = 1226; - anIntArray1094[anInt1133] = type.anInt754 << 14; + anIntArray1094[anInt1133] = type.index << 14; anIntArray1091[anInt1133] = i1; anIntArray1092[anInt1133] = j1; anInt1133++; @@ -8762,13 +8792,13 @@ public class Game extends GameShell { } } if (j1 == 5) { - k1 = anIntArray971[ai[l++]]; + k1 = variables[ai[l++]]; } if (j1 == 6) { k1 = levelExperience[anIntArray1044[ai[l++]] - 1]; } if (j1 == 7) { - k1 = (anIntArray971[ai[l++]] * 100) / 46875; + k1 = (variables[ai[l++]] * 100) / 46875; } if (j1 == 8) { k1 = self.anInt1705; @@ -8800,7 +8830,7 @@ public class Game extends GameShell { k1 = anInt878; } if (j1 == 13) { - int i2 = anIntArray971[ai[l++]]; + int i2 = variables[ai[l++]]; int i3 = ai[l++]; k1 = ((i2 & (1 << i3)) == 0) ? 0 : 1; } @@ -8811,7 +8841,7 @@ public class Game extends GameShell { int i4 = varbit.lsb; int j4 = varbit.msb; int k4 = BITMASK[j4 - i4]; - k1 = (anIntArray971[l3] >> i4) & k4; + k1 = (variables[l3] >> i4) & k4; } if (j1 == 15) { byte0 = 1; @@ -9536,7 +9566,7 @@ public class Game extends GameShell { player = players[i10]; } if (player != null) { - LocType type = LocType.method572(l21); + LocType type = LocType.get(l21); int i22 = anIntArrayArrayArray1214[currentPlane][k4][j7]; int j22 = anIntArrayArrayArray1214[currentPlane][k4 + 1][j7]; int k22 = anIntArrayArrayArray1214[currentPlane][k4 + 1][j7 + 1]; @@ -9547,11 +9577,11 @@ public class Game extends GameShell { player.anInt1707 = l14 + loopCycle; player.anInt1708 = k17 + loopCycle; player.model = model; - int i23 = type.anInt744; - int j23 = type.anInt761; + int i23 = type.sizeX; + int j23 = type.sizeZ; if ((i20 == 1) || (i20 == 3)) { - i23 = type.anInt761; - j23 = type.anInt744; + i23 = type.sizeZ; + j23 = type.sizeX; } player.anInt1711 = (k4 * 128) + (i23 * 64); player.anInt1713 = (j7 * 128) + (j23 * 64); @@ -9854,12 +9884,12 @@ public class Game extends GameShell { int i3 = scene.getInfo(j, i1, i, i2); int j2 = (i2 >> 14) & 0x7fff; int k2 = i3 & 0x1f; - int l2 = i3 >> 6; + int rotation = i3 >> 6; if (j1 == 0) { scene.removeWall(i1, j, i); - LocType type = LocType.method572(j2); - if (type.aBoolean767) { - collisions[j].method215(l2, k2, type.aBoolean757, i1, i); + LocType type = LocType.get(j2); + if (type.solid) { + collisions[j].method215(rotation, k2, type.blocksProjectiles, i1, i); } } if (j1 == 1) { @@ -9867,18 +9897,18 @@ public class Game extends GameShell { } if (j1 == 2) { scene.removeLoc(j, i1, i); - LocType type_1 = LocType.method572(j2); - if (((i1 + type_1.anInt744) > 103) || ((i + type_1.anInt744) > 103) || ((i1 + type_1.anInt761) > 103) || ((i + type_1.anInt761) > 103)) { + LocType type_1 = LocType.get(j2); + if (((i1 + type_1.sizeX) > 103) || ((i + type_1.sizeX) > 103) || ((i1 + type_1.sizeZ) > 103) || ((i + type_1.sizeZ) > 103)) { return; } - if (type_1.aBoolean767) { - collisions[j].method216(l2, type_1.anInt744, i1, i, type_1.anInt761, type_1.aBoolean757); + if (type_1.solid) { + collisions[j].method216(rotation, type_1.sizeX, i1, i, type_1.sizeZ, type_1.blocksProjectiles); } } if (j1 == 3) { scene.removeGroundDecoration(j, i1, i); - LocType type_2 = LocType.method572(j2); - if (type_2.aBoolean767 && type_2.aBoolean778) { + LocType type_2 = LocType.get(j2); + if (type_2.solid && type_2.interactable) { collisions[j].method218(i, i1); } } @@ -10685,9 +10715,9 @@ public class Game extends GameShell { return true; } if (ptype == 68) { - for (int k5 = 0; k5 < anIntArray971.length; k5++) { - if (anIntArray971[k5] != anIntArray1045[k5]) { - anIntArray971[k5] = anIntArray1045[k5]; + for (int k5 = 0; k5 < variables.length; k5++) { + if (variables[k5] != anIntArray1045[k5]) { + variables[k5] = anIntArray1045[k5]; updateVarp(k5); redrawInvback = true; } @@ -10976,8 +11006,8 @@ public class Game extends GameShell { int j8 = in.get2ULE(); int l14 = in.get4RME(); anIntArray1045[j8] = l14; - if (anIntArray971[j8] != l14) { - anIntArray971[j8] = l14; + if (variables[j8] != l14) { + variables[j8] = l14; updateVarp(j8); redrawInvback = true; if (stickyChatbackComponentId != -1) { @@ -10991,8 +11021,8 @@ public class Game extends GameShell { int k8 = in.get2ULE(); byte byte0 = in.get1(); anIntArray1045[k8] = byte0; - if (anIntArray971[k8] != byte0) { - anIntArray971[k8] = byte0; + if (variables[k8] != byte0) { + variables[k8] = byte0; updateVarp(k8); redrawInvback = true; if (stickyChatbackComponentId != -1) { diff --git a/src/main/java/GameShell.java b/src/main/java/GameShell.java index fffa553..103626c 100644 --- a/src/main/java/GameShell.java +++ b/src/main/java/GameShell.java @@ -467,7 +467,7 @@ public abstract class GameShell extends Applet implements Runnable, MouseListene /** * @see #run() */ - public abstract void update(); + public abstract void update() throws IOException; /** * @see #run() diff --git a/src/main/java/LocEntity.java b/src/main/java/LocEntity.java index 4ccb707..f530ddd 100644 --- a/src/main/java/LocEntity.java +++ b/src/main/java/LocEntity.java @@ -36,10 +36,10 @@ public class LocEntity extends Entity { anInt1608 -= (int) (Math.random() * (double) aType_1607.getFrameDelay(anInt1599)); } } - LocType type = LocType.method572(anInt1610); - anInt1601 = type.anInt774; - anInt1602 = type.anInt749; - anIntArray1600 = type.anIntArray759; + LocType type = LocType.get(anInt1610); + anInt1601 = type.varbit; + anInt1602 = type.varp; + anIntArray1600 = type.overrideIds; } @Override @@ -72,7 +72,7 @@ public class LocEntity extends Entity { if (anIntArray1600 != null) { type = method457(); } else { - type = LocType.method572(anInt1610); + type = LocType.get(anInt1610); } if (type == null) { return null; @@ -89,14 +89,14 @@ public class LocEntity extends Entity { int l = varbit.lsb; int i1 = varbit.msb; int j1 = Game.BITMASK[i1 - l]; - i = (game.anIntArray971[k] >> l) & j1; + i = (game.variables[k] >> l) & j1; } else if (anInt1602 != -1) { - i = game.anIntArray971[anInt1602]; + i = game.variables[anInt1602]; } if ((i < 0) || (i >= anIntArray1600.length) || (anIntArray1600[i] == -1)) { return null; } else { - return LocType.method572(anIntArray1600[i]); + return LocType.get(anIntArray1600[i]); } } diff --git a/src/main/java/LocType.java b/src/main/java/LocType.java index 00db8af..7880aa7 100644 --- a/src/main/java/LocType.java +++ b/src/main/java/LocType.java @@ -8,161 +8,167 @@ import java.io.IOException; public class LocType { - public static final Model[] A_MODEL_ARRAY_741 = new Model[4]; + public static final Model[] TMP_MODELS = new Model[4]; public static boolean lowmem; - public static Buffer aBuffer_753; - public static int[] anIntArray755; - public static int anInt756; + public static Buffer dat; + public static int[] offsets; + public static int count; public static Game game; public static int anInt771; public static LRUMap aCache_780 = new LRUMap(30); - public static LocType[] aTypeArray782; - public static LRUMap aCache_785 = new LRUMap(500); + public static LocType[] cache; + public static LRUMap modelCache = new LRUMap(500); - public static LocType method572(int i) { + public static LocType get(int i) { for (int j = 0; j < 20; j++) { - if (aTypeArray782[j].anInt754 == i) { - return aTypeArray782[j]; + if (cache[j].index == i) { + return cache[j]; } } anInt771 = (anInt771 + 1) % 20; - LocType type = aTypeArray782[anInt771]; - aBuffer_753.position = anIntArray755[i]; - type.anInt754 = i; - type.method573(); - type.method582(aBuffer_753); + LocType type = cache[anInt771]; + dat.position = offsets[i]; + type.index = i; + type.reset(); + type.method582(dat); return type; } public static void unload() { - aCache_785 = null; + modelCache = null; aCache_780 = null; - anIntArray755 = null; - aTypeArray782 = null; - aBuffer_753 = null; + offsets = null; + cache = null; + dat = null; } public static void unpack(FileArchive archive) throws IOException { - aBuffer_753 = new Buffer(archive.read("loc.dat")); + dat = new Buffer(archive.read("loc.dat")); Buffer buffer = new Buffer(archive.read("loc.idx")); - anInt756 = buffer.get2U(); - anIntArray755 = new int[anInt756]; + count = buffer.get2U(); + offsets = new int[count]; int i = 2; - for (int j = 0; j < anInt756; j++) { - anIntArray755[j] = i; + for (int j = 0; j < count; j++) { + offsets[j] = i; i += buffer.get2U(); } - aTypeArray782 = new LocType[20]; + cache = new LocType[20]; for (int k = 0; k < 20; k++) { - aTypeArray782[k] = new LocType(); + cache[k] = new LocType(); } } - public boolean aBoolean736; - public byte aByte737; - public int anInt738; - public String aString739; - public int anInt740; - public byte aByte742; - public int anInt744; - public int anInt745; - public int anInt746; - public int[] anIntArray747; - public int anInt748; - public int anInt749; - public boolean aBoolean751; - public int anInt754 = -1; - public boolean aBoolean757; - public int anInt758; - public int[] anIntArray759; - public int anInt760; - public int anInt761; - public boolean aBoolean762; - public boolean aBoolean764; - public boolean aBoolean766; - public boolean aBoolean767; - public int anInt768; - public boolean aBoolean769; - public int anInt772; - public int[] anIntArray773; - public int anInt774; - public int anInt775; - public int[] anIntArray776; - public byte[] aByteArray777; - public boolean aBoolean778; - public boolean aBoolean779; - public int anInt781; - public int anInt783; - public int[] anIntArray784; - public String[] aStringArray786; + + public boolean important; + public byte lightAmbient; + public int translateX; + public String name; + public int scaleY; + public byte lightAttenuation; + public int sizeX; + public int translateY; + public int mapfunctionIcon; + public int[] dstColor; + public int scaleX; + public int varp; + public boolean invert; + public int index = -1; + public boolean blocksProjectiles; + public int mapsceneIcon; + public int[] overrideIds; + public int supportsObj; + public int sizeZ; + public boolean adjustToTerrain; + public boolean occludes; + public boolean decorative; + public boolean solid; + public int interactionSideFlags; + /** + * Models flagged as dynamic will always copy their models face information by making copyFaces + * equal true. + * @see Model#Model(boolean, boolean, Model) + */ + public boolean dynamic; + public int scaleZ; + public int[] modelIds; + public int varbit; + public int decorationPadding; + public int[] modelTypes; + public String description; + public boolean interactable; + public boolean castShadow; + public int seqId; + public int translateZ; + public int[] srcColor; + public String[] actions; public LocType() { } - public void method573() { - anIntArray773 = null; - anIntArray776 = null; - aString739 = null; - aByteArray777 = null; - anIntArray784 = null; - anIntArray747 = null; - anInt744 = 1; - anInt761 = 1; - aBoolean767 = true; - aBoolean757 = true; - aBoolean778 = false; - aBoolean762 = false; - aBoolean769 = false; - aBoolean764 = false; - anInt781 = -1; - anInt775 = 16; - aByte737 = 0; - aByte742 = 0; - aStringArray786 = null; - anInt746 = -1; - anInt758 = -1; - aBoolean751 = false; - aBoolean779 = true; - anInt748 = 128; - anInt772 = 128; - anInt740 = 128; - anInt768 = 0; - anInt738 = 0; - anInt745 = 0; - anInt783 = 0; - aBoolean736 = false; - aBoolean766 = false; - anInt760 = -1; - anInt774 = -1; - anInt749 = -1; - anIntArray759 = null; + public void reset() { + modelIds = null; + modelTypes = null; + name = null; + description = null; + srcColor = null; + dstColor = null; + sizeX = 1; + sizeZ = 1; + solid = true; + blocksProjectiles = true; + interactable = false; + adjustToTerrain = false; + dynamic = false; + occludes = false; + seqId = -1; + decorationPadding = 16; + lightAmbient = 0; + lightAttenuation = 0; + actions = null; + mapfunctionIcon = -1; + mapsceneIcon = -1; + invert = false; + castShadow = true; + scaleX = 128; + scaleZ = 128; + scaleY = 128; + interactionSideFlags = 0; + translateX = 0; + translateY = 0; + translateZ = 0; + important = false; + decorative = false; + supportsObj = -1; + varbit = -1; + varp = -1; + overrideIds = null; } public void method574(OnDemand onDemand) { - if (anIntArray773 == null) { + if (modelIds == null) { return; } - for (int k : anIntArray773) { + for (int k : modelIds) { onDemand.method560(k & 0xffff, 0); } } public boolean method577(int i) { - if (anIntArray776 == null) { - if (anIntArray773 == null) { + if (modelTypes == null) { + if (modelIds == null) { return true; } if (i != 10) { return true; } boolean flag1 = true; - for (int j : anIntArray773) { + for (int j : modelIds) { flag1 &= Model.validate(j & 0xffff); } return flag1; } - for (int j = 0; j < anIntArray776.length; j++) { - if (anIntArray776[j] == i) { - return Model.validate(anIntArray773[j] & 0xffff); + for (int j = 0; j < modelTypes.length; j++) { + if (modelTypes[j] == i) { + return Model.validate(modelIds[j] & 0xffff); } } return true; @@ -173,10 +179,10 @@ public class LocType { if (model == null) { return null; } - if (aBoolean762 || aBoolean769) { - model = new Model(aBoolean762, aBoolean769, model); + if (adjustToTerrain || dynamic) { + model = new Model(adjustToTerrain, dynamic, model); } - if (aBoolean762) { + if (adjustToTerrain) { int l1 = (k + l + i1 + j1) / 4; for (int i2 = 0; i2 < model.vertexCount; i2++) { int j2 = model.vertexX[i2]; @@ -192,11 +198,11 @@ public class LocType { } public boolean method579() { - if (anIntArray773 == null) { + if (modelIds == null) { return true; } boolean flag1 = true; - for (int j : anIntArray773) { + for (int j : modelIds) { flag1 &= Model.validate(j & 0xffff); } return flag1; @@ -204,86 +210,94 @@ public class LocType { public LocType method580() { int i = -1; - if (anInt774 != -1) { - VarbitType varbit = VarbitType.instances[anInt774]; + if (varbit != -1) { + VarbitType varbit = VarbitType.instances[this.varbit]; int j = varbit.varp; int k = varbit.lsb; int l = varbit.msb; int i1 = Game.BITMASK[l - k]; - i = (game.anIntArray971[j] >> k) & i1; - } else if (anInt749 != -1) { - i = game.anIntArray971[anInt749]; + i = (game.variables[j] >> k) & i1; + } else if (varp != -1) { + i = game.variables[varp]; } - if ((i < 0) || (i >= anIntArray759.length) || (anIntArray759[i] == -1)) { + if ((i < 0) || (i >= overrideIds.length) || (overrideIds[i] == -1)) { return null; } else { - return method572(anIntArray759[i]); + return get(overrideIds[i]); } } - public Model method581(int j, int k, int l) { + public Model method581(int type, int seqFrame, int rotation) { Model model = null; - long l1; - if (anIntArray776 == null) { - if (j != 10) { + long bitset; + if (modelTypes == null) { + if (type != 10) { return null; } - l1 = ((long) anInt754 << 6) + l + ((long) (k + 1) << 32); - Model model_1 = aCache_780.get(l1); + bitset = ((long) index << 6) + rotation + ((long) (seqFrame + 1) << 32); + Model model_1 = aCache_780.get(bitset); if (model_1 != null) { return model_1; } - if (anIntArray773 == null) { + if (modelIds == null) { return null; } - boolean flag1 = aBoolean751 ^ (l > 3); - int k1 = anIntArray773.length; - for (int i2 = 0; i2 < k1; i2++) { - int l2 = anIntArray773[i2]; - if (flag1) { - l2 += 0x10000; + boolean flip = invert ^ (rotation > 3); + int modelCount = modelIds.length; + + for (int i = 0; i < modelCount; i++) { + int modelId = modelIds[i]; + + if (flip) { + modelId += 0x10000; } - model = aCache_785.get(l2); + + model = modelCache.get(modelId); if (model == null) { - model = Model.tryGet(l2 & 0xffff); + model = Model.tryGet(modelId & 0xffff); if (model == null) { return null; } - if (flag1) { + if (flip) { model.rotateY180(); } - aCache_785.put((long) l2, model); + modelCache.put((long) modelId, model); } - if (k1 > 1) { - A_MODEL_ARRAY_741[i2] = model; + + if (modelCount > 1) { + TMP_MODELS[i] = model; } } - if (k1 > 1) { - model = new Model(k1, A_MODEL_ARRAY_741); + + if (modelCount > 1) { + model = new Model(modelCount, TMP_MODELS); } } else { - int i1 = -1; - for (int j1 = 0; j1 < anIntArray776.length; j1++) { - if (anIntArray776[j1] != j) { + int typeId = -1; + for (int i = 0; i < modelTypes.length; i++) { + if (modelTypes[i] != type) { continue; } - i1 = j1; + typeId = i; break; } - if (i1 == -1) { + + if (typeId == -1) { return null; } - l1 = ((long) anInt754 << 6) + ((long) i1 << 3) + l + ((long) (k + 1) << 32); - Model class30_sub2_sub4_sub6_2 = aCache_780.get(l1); + + bitset = ((long) index << 6) + ((long) typeId << 3) + rotation + ((long) (seqFrame + 1) << 32); + + Model class30_sub2_sub4_sub6_2 = aCache_780.get(bitset); if (class30_sub2_sub4_sub6_2 != null) { return class30_sub2_sub4_sub6_2; } - int j2 = anIntArray773[i1]; - boolean flag3 = aBoolean751 ^ (l > 3); + int j2 = modelIds[typeId]; + boolean flag3 = invert ^ (rotation > 3); if (flag3) { j2 += 0x10000; } - model = aCache_785.get(j2); + model = modelCache.get(j2); if (model == null) { model = Model.tryGet(j2 & 0xffff); if (model == null) { @@ -292,39 +306,41 @@ public class LocType { if (flag3) { model.rotateY180(); } - aCache_785.put((long) j2, model); + modelCache.put((long) j2, model); } } - boolean flag; - flag = (anInt748 != 128) || (anInt772 != 128) || (anInt740 != 128); - boolean flag2; - flag2 = (anInt738 != 0) || (anInt745 != 0) || (anInt783 != 0); - Model model_3 = new Model(anIntArray784 == null, SeqFrame.isNull(k), (l == 0) && (k == -1) && !flag && !flag2, model); - if (k != -1) { + + boolean scaled = (scaleX != 128) || (scaleZ != 128) || (scaleY != 128); + boolean translated = (translateX != 0) || (translateY != 0) || (translateZ != 0); + + Model model_3 = new Model(srcColor == null, SeqFrame.isNull(seqFrame), (rotation == 0) && (seqFrame == -1) && !scaled && !translated, model); + + if (seqFrame != -1) { model_3.createLabelReferences(); - model_3.applySequenceFrame(k); + model_3.applySequenceFrame(seqFrame); model_3.labelFaces = null; model_3.labelVertices = null; } - while (l-- > 0) { + + while (rotation-- > 0) { model_3.rotateY90(); } - if (anIntArray784 != null) { - for (int k2 = 0; k2 < anIntArray784.length; k2++) { - model_3.recolor(anIntArray784[k2], anIntArray747[k2]); + if (srcColor != null) { + for (int k2 = 0; k2 < srcColor.length; k2++) { + model_3.recolor(srcColor[k2], dstColor[k2]); } } - if (flag) { - model_3.scale(anInt748, anInt740, anInt772); + if (scaled) { + model_3.scale(scaleX, scaleY, scaleZ); } - if (flag2) { - model_3.translate(anInt738, anInt745, anInt783); + if (translated) { + model_3.translate(translateX, translateY, translateZ); } - model_3.calculateNormals(64 + aByte737, 768 + (aByte742 * 5), -50, -10, -50, !aBoolean769); - if (anInt760 == 1) { - model_3.anInt1654 = model_3.minY; + model_3.calculateNormals(64 + lightAmbient, 768 + (lightAttenuation * 5), -50, -10, -50, !dynamic); + if (supportsObj == 1) { + model_3.objRaise = model_3.minY; } - aCache_780.put(l1, model_3); + aCache_780.put(bitset, model_3); return model_3; } @@ -341,143 +357,143 @@ public class LocType { if (j == 1) { int k = buffer.get1U(); if (k > 0) { - if ((anIntArray773 == null) || lowmem) { - anIntArray776 = new int[k]; - anIntArray773 = new int[k]; + if ((modelIds == null) || lowmem) { + modelTypes = new int[k]; + modelIds = new int[k]; for (int k1 = 0; k1 < k; k1++) { - anIntArray773[k1] = buffer.get2U(); - anIntArray776[k1] = buffer.get1U(); + modelIds[k1] = buffer.get2U(); + modelTypes[k1] = buffer.get1U(); } } else { buffer.position += k * 3; } } } else if (j == 2) { - aString739 = buffer.getString(); + name = buffer.getString(); } else if (j == 3) { - aByteArray777 = buffer.getStringRaw(); + description = buffer.getString(); } else if (j == 5) { int l = buffer.get1U(); if (l > 0) { - if ((anIntArray773 == null) || lowmem) { - anIntArray776 = null; - anIntArray773 = new int[l]; + if ((modelIds == null) || lowmem) { + modelTypes = null; + modelIds = new int[l]; for (int l1 = 0; l1 < l; l1++) { - anIntArray773[l1] = buffer.get2U(); + modelIds[l1] = buffer.get2U(); } } else { buffer.position += l * 2; } } } else if (j == 14) { - anInt744 = buffer.get1U(); + sizeX = buffer.get1U(); } else if (j == 15) { - anInt761 = buffer.get1U(); + sizeZ = buffer.get1U(); } else if (j == 17) { - aBoolean767 = false; + solid = false; } else if (j == 18) { - aBoolean757 = false; + blocksProjectiles = false; } else if (j == 19) { i = buffer.get1U(); if (i == 1) { - aBoolean778 = true; + interactable = true; } } else if (j == 21) { - aBoolean762 = true; + adjustToTerrain = true; } else if (j == 22) { - aBoolean769 = true; + dynamic = true; } else if (j == 23) { - aBoolean764 = true; + occludes = true; } else if (j == 24) { - anInt781 = buffer.get2U(); - if (anInt781 == 65535) { - anInt781 = -1; + seqId = buffer.get2U(); + if (seqId == 65535) { + seqId = -1; } } else if (j == 28) { - anInt775 = buffer.get1U(); + decorationPadding = buffer.get1U(); } else if (j == 29) { - aByte737 = buffer.get1(); + lightAmbient = buffer.get1(); } else if (j == 39) { - aByte742 = buffer.get1(); + lightAttenuation = buffer.get1(); } else if ((j >= 30) && (j < 39)) { - if (aStringArray786 == null) { - aStringArray786 = new String[5]; + if (actions == null) { + actions = new String[5]; } - aStringArray786[j - 30] = buffer.getString(); - if (aStringArray786[j - 30].equalsIgnoreCase("hidden")) { - aStringArray786[j - 30] = null; + actions[j - 30] = buffer.getString(); + if (actions[j - 30].equalsIgnoreCase("hidden")) { + actions[j - 30] = null; } } else if (j == 40) { int i1 = buffer.get1U(); - anIntArray784 = new int[i1]; - anIntArray747 = new int[i1]; + srcColor = new int[i1]; + dstColor = new int[i1]; for (int i2 = 0; i2 < i1; i2++) { - anIntArray784[i2] = buffer.get2U(); - anIntArray747[i2] = buffer.get2U(); + srcColor[i2] = buffer.get2U(); + dstColor[i2] = buffer.get2U(); } } else if (j == 60) { - anInt746 = buffer.get2U(); + mapfunctionIcon = buffer.get2U(); } else if (j == 62) { - aBoolean751 = true; + invert = true; } else if (j == 64) { - aBoolean779 = false; + castShadow = false; } else if (j == 65) { - anInt748 = buffer.get2U(); + scaleX = buffer.get2U(); } else if (j == 66) { - anInt772 = buffer.get2U(); + scaleZ = buffer.get2U(); } else if (j == 67) { - anInt740 = buffer.get2U(); + scaleY = buffer.get2U(); } else if (j == 68) { - anInt758 = buffer.get2U(); + mapsceneIcon = buffer.get2U(); } else if (j == 69) { - anInt768 = buffer.get1U(); + interactionSideFlags = buffer.get1U(); } else if (j == 70) { - anInt738 = buffer.get2(); + translateX = buffer.get2(); } else if (j == 71) { - anInt745 = buffer.get2(); + translateY = buffer.get2(); } else if (j == 72) { - anInt783 = buffer.get2(); + translateZ = buffer.get2(); } else if (j == 73) { - aBoolean736 = true; + important = true; } else if (j == 74) { - aBoolean766 = true; + decorative = true; } else { if (j != 75) { continue; } - anInt760 = buffer.get1U(); + supportsObj = buffer.get1U(); } continue label0; } while (j != 77); - anInt774 = buffer.get2U(); - if (anInt774 == 65535) { - anInt774 = -1; + varbit = buffer.get2U(); + if (varbit == 65535) { + varbit = -1; } - anInt749 = buffer.get2U(); - if (anInt749 == 65535) { - anInt749 = -1; + varp = buffer.get2U(); + if (varp == 65535) { + varp = -1; } int j1 = buffer.get1U(); - anIntArray759 = new int[j1 + 1]; + overrideIds = new int[j1 + 1]; for (int j2 = 0; j2 <= j1; j2++) { - anIntArray759[j2] = buffer.get2U(); - if (anIntArray759[j2] == 65535) { - anIntArray759[j2] = -1; + overrideIds[j2] = buffer.get2U(); + if (overrideIds[j2] == 65535) { + overrideIds[j2] = -1; } } } while (true); if (i == -1) { - aBoolean778 = (anIntArray773 != null) && ((anIntArray776 == null) || (anIntArray776[0] == 10)); - if (aStringArray786 != null) { - aBoolean778 = true; + interactable = (modelIds != null) && ((modelTypes == null) || (modelTypes[0] == 10)); + if (actions != null) { + interactable = true; } } - if (aBoolean766) { - aBoolean767 = false; - aBoolean757 = false; + if (decorative) { + solid = false; + blocksProjectiles = false; } - if (anInt760 == -1) { - anInt760 = aBoolean767 ? 1 : 0; + if (supportsObj == -1) { + supportsObj = solid ? 1 : 0; } } diff --git a/src/main/java/Model.java b/src/main/java/Model.java index 286eaa6..70fe2e9 100644 --- a/src/main/java/Model.java +++ b/src/main/java/Model.java @@ -286,7 +286,7 @@ public class Model extends Entity { * minDepth = (int) Math.sqrt((radius * radius) + (super.minY * super.minY)); * maxDepth = minDepth + (int) Math.sqrt((radius * radius) + (maxY * maxY)); */ - public int anInt1654; + public int objRaise; /** * The label the vertex belongs to. */ diff --git a/src/main/java/NPCType.java b/src/main/java/NPCType.java index a9a8801..da82667 100644 --- a/src/main/java/NPCType.java +++ b/src/main/java/NPCType.java @@ -140,9 +140,9 @@ public class NPCType { int lsb = vb.lsb; int msb = vb.msb; int mask = Game.BITMASK[msb - lsb]; - value = (game.anIntArray971[varp] >> lsb) & mask; + value = (game.variables[varp] >> lsb) & mask; } else if (varp != -1) { - value = game.anIntArray971[varp]; + value = game.variables[varp]; } if ((value < 0) || (value >= overrides.length) || (overrides[value] == -1)) { diff --git a/src/main/java/OnDemand.java b/src/main/java/OnDemand.java index ec22f1d..44330b8 100644 --- a/src/main/java/OnDemand.java +++ b/src/main/java/OnDemand.java @@ -19,8 +19,8 @@ public class OnDemand implements Runnable { public final LinkedList requests = new LinkedList<>(); public final int[][] storeFileVersions = new int[4][]; public final int[][] storeFileChecksums = new int[4][]; - public final DoublyLinkedList aList_1368 = new DoublyLinkedList(); - public final DoublyLinkedList aList_1370 = new DoublyLinkedList(); + public final DoublyLinkedList missing = new DoublyLinkedList(); + public final DoublyLinkedList queue = new DoublyLinkedList(); private final Object lock = new Object(); public int totalPrefetchFiles; public int topPriority; @@ -54,6 +54,9 @@ public class OnDemand implements Runnable { } public boolean validate(int version, int crc, byte[] src) { + if (src != null) { + return true; + } if ((src == null) || (src.length < 2)) { return false; } @@ -312,7 +315,8 @@ public class OnDemand implements Runnable { heartbeatCycle = 0; anInt1349 = -10000; return; - } catch (IOException ignored) { + } catch (IOException e) { + e.printStackTrace(); } try { @@ -348,8 +352,8 @@ public class OnDemand implements Runnable { request.store = archive; request.file = file; request.important = true; - synchronized (aList_1370) { - aList_1370.pushBack(request); + synchronized (queue) { + queue.pushBack(request); } requests.addFirst(request); } @@ -385,7 +389,7 @@ public class OnDemand implements Runnable { aBoolean1357 = false; - method567(); + handleQueue(); method565(); if ((importantCount == 0) && (j >= 5)) { @@ -593,7 +597,7 @@ public class OnDemand implements Runnable { } while (importantCount < 10) { - OnDemandRequest request = (OnDemandRequest) aList_1368.pollFront(); + OnDemandRequest request = (OnDemandRequest) missing.pollFront(); if (request == null) { break; @@ -617,10 +621,10 @@ public class OnDemand implements Runnable { } } - public void method567() { + public void handleQueue() { OnDemandRequest request; - synchronized (aList_1370) { - request = (OnDemandRequest) aList_1370.pollFront(); + synchronized (queue) { + request = (OnDemandRequest) queue.pollFront(); } while (request != null) { @@ -635,16 +639,16 @@ public class OnDemand implements Runnable { data = null; } - synchronized (aList_1370) { + synchronized (queue) { if (data == null) { - aList_1368.pushBack(request); + missing.pushBack(request); } else { request.data = data; synchronized (completed) { completed.pushBack(request); } } - request = (OnDemandRequest) aList_1370.pollFront(); + request = (OnDemandRequest) queue.pollFront(); } } } diff --git a/src/main/java/Scene.java b/src/main/java/Scene.java index 9c11c14..420f25c 100644 --- a/src/main/java/Scene.java +++ b/src/main/java/Scene.java @@ -314,7 +314,7 @@ public class Scene { if (!(tile.locs[l].entity instanceof Model)) { continue; } - int height = ((Model) tile.locs[l].entity).anInt1654; + int height = ((Model) tile.locs[l].entity).objRaise; if (height > stackOffset) { stackOffset = height; } diff --git a/src/main/java/SceneBuilder.java b/src/main/java/SceneBuilder.java index ed89c36..7963e22 100644 --- a/src/main/java/SceneBuilder.java +++ b/src/main/java/SceneBuilder.java @@ -40,7 +40,7 @@ public class SceneBuilder { break; } i_110_ += i_111_; - LocType type = LocType.method572(i_110_); + LocType type = LocType.get(i_110_); type.method574(onDemand); for (; ; ) { int i_112_ = buffer.getSmartU(); @@ -67,7 +67,7 @@ public class SceneBuilder { } public static boolean method178(int i, int i_159_) { - LocType type = LocType.method572(i); + LocType type = LocType.get(i); if (i_159_ == 11) { i_159_ = 10; } @@ -109,10 +109,10 @@ public class SceneBuilder { int y01 = planeHeightmap[groundPlane][stx][stz + 1]; int y = (y00 + y10 + y11 + y01) >> 2; - LocType loc = LocType.method572(locId); + LocType loc = LocType.get(locId); int bitset = stx + (stz << 7) + (locId << 14) + 1073741824; - if (!loc.aBoolean778) { + if (!loc.interactable) { bitset += -2147483648; } @@ -121,24 +121,24 @@ public class SceneBuilder { if (type == 22) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(22, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, 22, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, 22, y10, y11, y00, y01, loc.seqId, true); } scene.addGroundDecoration(entity, locPlane, stx, stz, y, bitset, info); - if (loc.aBoolean767 && loc.aBoolean778) { + if (loc.solid && loc.interactable) { collisionMap.method213(stz, stx); } } else if ((type == 10) || (type == 11)) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(10, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, 10, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, 10, y10, y11, y00, y01, loc.seqId, true); } if (entity != null) { @@ -152,90 +152,90 @@ public class SceneBuilder { int i_242_; if ((rotation == 1) || (rotation == 3)) { - i_241_ = loc.anInt761; - i_242_ = loc.anInt744; + i_241_ = loc.sizeZ; + i_242_ = loc.sizeX; } else { - i_241_ = loc.anInt744; - i_242_ = loc.anInt761; + i_241_ = loc.sizeX; + i_242_ = loc.sizeZ; } scene.add(entity, locPlane, stx, stz, y, i_241_, i_242_, i_240_, bitset, info); } - if (loc.aBoolean767) { - collisionMap.method212(loc.aBoolean757, loc.anInt744, loc.anInt761, stx, stz, rotation); + if (loc.solid) { + collisionMap.method212(loc.blocksProjectiles, loc.sizeX, loc.sizeZ, stx, stz, rotation); } } else if (type >= 12) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(type, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, type, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, type, y10, y11, y00, y01, loc.seqId, true); } scene.add(entity, locPlane, stx, stz, y, 1, 1, 0, bitset, info); - if (loc.aBoolean767) { - collisionMap.method212(loc.aBoolean757, loc.anInt744, loc.anInt761, stx, stz, rotation); + if (loc.solid) { + collisionMap.method212(loc.blocksProjectiles, loc.sizeX, loc.sizeZ, stx, stz, rotation); } } else if (type == 0) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(0, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, 0, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, 0, y10, y11, y00, y01, loc.seqId, true); } scene.addWall(WALL_TYPE_0[rotation], entity, 0, null, locPlane, stx, stz, y, bitset, info); - if (loc.aBoolean767) { - collisionMap.method211(stz, rotation, stx, type, loc.aBoolean757); + if (loc.solid) { + collisionMap.method211(stz, rotation, stx, type, loc.blocksProjectiles); } } else if (type == 1) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(1, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, 1, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, 1, y10, y11, y00, y01, loc.seqId, true); } scene.addWall(WALL_TYPE_1[rotation], entity, 0, null, locPlane, stx, stz, y, bitset, info); - if (loc.aBoolean767) { - collisionMap.method211(stz, rotation, stx, type, loc.aBoolean757); + if (loc.solid) { + collisionMap.method211(stz, rotation, stx, type, loc.blocksProjectiles); } } else if (type == 2) { int i_243_ = (rotation + 1) & 0x3; Entity entity; Entity entity_244_; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(2, 4 + rotation, y00, y10, y11, y01, -1); entity_244_ = loc.method578(2, i_243_, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 4 + rotation, 2, y10, y11, y00, y01, loc.anInt781, true); - entity_244_ = new LocEntity(locId, i_243_, 2, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 4 + rotation, 2, y10, y11, y00, y01, loc.seqId, true); + entity_244_ = new LocEntity(locId, i_243_, 2, y10, y11, y00, y01, loc.seqId, true); } scene.addWall(WALL_TYPE_0[rotation], entity, WALL_TYPE_0[i_243_], entity_244_, locPlane, stx, stz, y, bitset, info); - if (loc.aBoolean767) { - collisionMap.method211(stz, rotation, stx, type, loc.aBoolean757); + if (loc.solid) { + collisionMap.method211(stz, rotation, stx, type, loc.blocksProjectiles); } } else if (type == 3) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(3, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, 3, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, 3, y10, y11, y00, y01, loc.seqId, true); } scene.addWall(WALL_TYPE_1[rotation], entity, 0, null, locPlane, stx, stz, y, bitset, info); - if (loc.aBoolean767) { - collisionMap.method211(stz, rotation, stx, type, loc.aBoolean757); + if (loc.solid) { + collisionMap.method211(stz, rotation, stx, type, loc.blocksProjectiles); } } else if (type == 9) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(type, rotation, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, rotation, type, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, rotation, type, y10, y11, y00, y01, loc.seqId, true); } scene.add(entity, locPlane, stx, stz, y, 1, 1, 0, bitset, info); - if (loc.aBoolean767) { - collisionMap.method212(loc.aBoolean757, loc.anInt744, loc.anInt761, stx, stz, rotation); + if (loc.solid) { + collisionMap.method212(loc.blocksProjectiles, loc.sizeX, loc.sizeZ, stx, stz, rotation); } } else { - if (loc.aBoolean762) { + if (loc.adjustToTerrain) { if (rotation == 1) { int i_245_ = y01; y01 = y11; @@ -259,47 +259,47 @@ public class SceneBuilder { } if (type == 4) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(4, 0, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.seqId, true); } scene.addWallDecoration(WALL_TYPE_0[rotation], entity, locPlane, stx, stz, y, rotation * 512, 0, 0, bitset, info); } else if (type == 5) { int i_248_ = 16; int i_249_ = scene.getWallBitset(locPlane, stx, stz); if (i_249_ > 0) { - i_248_ = LocType.method572((i_249_ >> 14) & 0x7fff).anInt775; + i_248_ = LocType.get((i_249_ >> 14) & 0x7fff).decorationPadding; } Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(4, 0, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.seqId, true); } scene.addWallDecoration(WALL_TYPE_0[rotation], entity, locPlane, stx, stz, y, rotation * 512, anIntArray137[rotation] * i_248_, anIntArray144[rotation] * i_248_, bitset, info); } else if (type == 6) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(4, 0, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.seqId, true); } scene.addWallDecoration(256, entity, locPlane, stx, stz, y, rotation, 0, 0, bitset, info); } else if (type == 7) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(4, 0, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.seqId, true); } scene.addWallDecoration(512, entity, locPlane, stx, stz, y, rotation, 0, 0, bitset, info); } else if (type == 8) { Entity entity; - if ((loc.anInt781 == -1) && (loc.anIntArray759 == null)) { + if ((loc.seqId == -1) && (loc.overrideIds == null)) { entity = loc.method578(4, 0, y00, y10, y11, y01, -1); } else { - entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.anInt781, true); + entity = new LocEntity(locId, 0, 4, y10, y11, y00, y01, loc.seqId, true); } scene.addWallDecoration(768, entity, locPlane, stx, stz, y, rotation, 0, 0, bitset, info); } @@ -337,8 +337,8 @@ public class SceneBuilder { int i_261_ = i_259_ + i; int i_262_ = i_258_ + i_250_; if ((i_261_ > 0) && (i_262_ > 0) && (i_261_ < 103) && (i_262_ < 103)) { - LocType type = LocType.method572(i_252_); - if ((i_260_ != 22) || !lowmem || type.aBoolean778 || type.aBoolean736) { + LocType type = LocType.get(i_252_); + if ((i_260_ != 22) || !lowmem || type.interactable || type.important) { bool &= type.method579(); bool_255_ = true; } @@ -763,32 +763,32 @@ public class SceneBuilder { int i_126_ = planeHeightmap[i_120_][i_121_ + 1][i + 1]; int i_127_ = planeHeightmap[i_120_][i_121_][i + 1]; int i_128_ = (i_124_ + i_125_ + i_126_ + i_127_) >> 2; - LocType type = LocType.method572(i_122_); + LocType type = LocType.get(i_122_); int i_129_ = i_121_ + (i << 7) + (i_122_ << 14) + 1073741824; - if (!type.aBoolean778) { + if (!type.interactable) { i_129_ += -2147483648; } byte i_130_ = (byte) ((i_123_ << 6) + i_119_); if (!bool) { if (i_119_ == 22) { - if (!lowmem || type.aBoolean778 || type.aBoolean736) { + if (!lowmem || type.interactable || type.important) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(22, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, 22, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, 22, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addGroundDecoration(entity, i_120_, i_121_, i, i_128_, i_129_, i_130_); - if (type.aBoolean767 && type.aBoolean778 && (collisionMap != null)) { + if (type.solid && type.interactable && (collisionMap != null)) { collisionMap.method213(i, i_121_); } } } else if ((i_119_ == 10) || (i_119_ == 11)) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(10, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, 10, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, 10, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } if (entity != null) { int i_131_ = 0; @@ -798,13 +798,13 @@ public class SceneBuilder { int i_132_; int i_133_; if ((i_123_ == 1) || (i_123_ == 3)) { - i_132_ = type.anInt761; - i_133_ = type.anInt744; + i_132_ = type.sizeZ; + i_133_ = type.sizeX; } else { - i_132_ = type.anInt744; - i_133_ = type.anInt761; + i_132_ = type.sizeX; + i_133_ = type.sizeZ; } - if (scene.add(entity, i_120_, i_121_, i, i_128_, i_132_, i_133_, i_131_, i_129_, i_130_) && type.aBoolean779) { + if (scene.add(entity, i_120_, i_121_, i, i_128_, i_132_, i_133_, i_131_, i_129_, i_130_) && type.castShadow) { Model model; if (entity instanceof Model) { model = (Model) entity; @@ -826,79 +826,79 @@ public class SceneBuilder { } } } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method212(type.aBoolean757, type.anInt744, type.anInt761, i_121_, i, i_123_); + if (type.solid && (collisionMap != null)) { + collisionMap.method212(type.blocksProjectiles, type.sizeX, type.sizeZ, i_121_, i, i_123_); } } else if (i_119_ >= 12) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(i_119_, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, i_119_, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, i_119_, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.add(entity, i_120_, i_121_, i, i_128_, 1, 1, 0, i_129_, i_130_); if ((i_119_ >= 12) && (i_119_ <= 17) && (i_119_ != 13) && (i_120_ > 0)) { anIntArrayArrayArray135[i_120_][i_121_][i] |= 0x924; } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method212(type.aBoolean757, type.anInt744, type.anInt761, i_121_, i, i_123_); + if (type.solid && (collisionMap != null)) { + collisionMap.method212(type.blocksProjectiles, type.sizeX, type.sizeZ, i_121_, i, i_123_); } } else if (i_119_ == 0) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(0, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, 0, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, 0, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWall(WALL_TYPE_0[i_123_], entity, 0, null, i_120_, i_121_, i, i_128_, i_129_, i_130_); if (i_123_ == 0) { - if (type.aBoolean779) { + if (type.castShadow) { aByteArrayArrayArray134[i_120_][i_121_][i] = (byte) 50; aByteArrayArrayArray134[i_120_][i_121_][i + 1] = (byte) 50; } - if (type.aBoolean764) { + if (type.occludes) { anIntArrayArrayArray135[i_120_][i_121_][i] |= 0x249; } } else if (i_123_ == 1) { - if (type.aBoolean779) { + if (type.castShadow) { aByteArrayArrayArray134[i_120_][i_121_][i + 1] = (byte) 50; aByteArrayArrayArray134[i_120_][i_121_ + 1][i + 1] = (byte) 50; } - if (type.aBoolean764) { + if (type.occludes) { anIntArrayArrayArray135[i_120_][i_121_][i + 1] |= 0x492; } } else if (i_123_ == 2) { - if (type.aBoolean779) { + if (type.castShadow) { aByteArrayArrayArray134[i_120_][i_121_ + 1][i] = (byte) 50; aByteArrayArrayArray134[i_120_][i_121_ + 1][i + 1] = (byte) 50; } - if (type.aBoolean764) { + if (type.occludes) { anIntArrayArrayArray135[i_120_][i_121_ + 1][i] |= 0x249; } } else if (i_123_ == 3) { - if (type.aBoolean779) { + if (type.castShadow) { aByteArrayArrayArray134[i_120_][i_121_][i] = (byte) 50; aByteArrayArrayArray134[i_120_][i_121_ + 1][i] = (byte) 50; } - if (type.aBoolean764) { + if (type.occludes) { anIntArrayArrayArray135[i_120_][i_121_][i] |= 0x492; } } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method211(i, i_123_, i_121_, i_119_, type.aBoolean757); + if (type.solid && (collisionMap != null)) { + collisionMap.method211(i, i_123_, i_121_, i_119_, type.blocksProjectiles); } - if (type.anInt775 != 16) { - scene.setWallDecorationOffset(i_120_, i_121_, i, type.anInt775); + if (type.decorationPadding != 16) { + scene.setWallDecorationOffset(i_120_, i_121_, i, type.decorationPadding); } } else if (i_119_ == 1) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(1, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, 1, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, 1, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWall(WALL_TYPE_1[i_123_], entity, 0, null, i_120_, i_121_, i, i_128_, i_129_, i_130_); - if (type.aBoolean779) { + if (type.castShadow) { if (i_123_ == 0) { aByteArrayArrayArray134[i_120_][i_121_][i + 1] = (byte) 50; } else if (i_123_ == 1) { @@ -909,22 +909,22 @@ public class SceneBuilder { aByteArrayArrayArray134[i_120_][i_121_][i] = (byte) 50; } } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method211(i, i_123_, i_121_, i_119_, type.aBoolean757); + if (type.solid && (collisionMap != null)) { + collisionMap.method211(i, i_123_, i_121_, i_119_, type.blocksProjectiles); } } else if (i_119_ == 2) { int i_137_ = (i_123_ + 1) & 0x3; Entity entity; Entity entity_138_; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(2, 4 + i_123_, i_124_, i_125_, i_126_, i_127_, -1); entity_138_ = type.method578(2, i_137_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 4 + i_123_, 2, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); - entity_138_ = new LocEntity(i_122_, i_137_, 2, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 4 + i_123_, 2, i_125_, i_126_, i_124_, i_127_, type.seqId, true); + entity_138_ = new LocEntity(i_122_, i_137_, 2, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWall(WALL_TYPE_0[i_123_], entity, WALL_TYPE_0[i_137_], entity_138_, i_120_, i_121_, i, i_128_, i_129_, i_130_); - if (type.aBoolean764) { + if (type.occludes) { if (i_123_ == 0) { anIntArrayArrayArray135[i_120_][i_121_][i] |= 0x249; anIntArrayArrayArray135[i_120_][i_121_][i + 1] |= 0x492; @@ -939,21 +939,21 @@ public class SceneBuilder { anIntArrayArrayArray135[i_120_][i_121_][i] |= 0x249; } } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method211(i, i_123_, i_121_, i_119_, type.aBoolean757); + if (type.solid && (collisionMap != null)) { + collisionMap.method211(i, i_123_, i_121_, i_119_, type.blocksProjectiles); } - if (type.anInt775 != 16) { - scene.setWallDecorationOffset(i_120_, i_121_, i, type.anInt775); + if (type.decorationPadding != 16) { + scene.setWallDecorationOffset(i_120_, i_121_, i, type.decorationPadding); } } else if (i_119_ == 3) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(3, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, 3, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, 3, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWall(WALL_TYPE_1[i_123_], entity, 0, null, i_120_, i_121_, i, i_128_, i_129_, i_130_); - if (type.aBoolean779) { + if (type.castShadow) { if (i_123_ == 0) { aByteArrayArrayArray134[i_120_][i_121_][i + 1] = (byte) 50; } else if (i_123_ == 1) { @@ -964,22 +964,22 @@ public class SceneBuilder { aByteArrayArrayArray134[i_120_][i_121_][i] = (byte) 50; } } - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method211(i, i_123_, i_121_, i_119_, type.aBoolean757); + if (type.solid && (collisionMap != null)) { + collisionMap.method211(i, i_123_, i_121_, i_119_, type.blocksProjectiles); } } else if (i_119_ == 9) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(i_119_, i_123_, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, i_123_, i_119_, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, i_123_, i_119_, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.add(entity, i_120_, i_121_, i, i_128_, 1, 1, 0, i_129_, i_130_); - if (type.aBoolean767 && (collisionMap != null)) { - collisionMap.method212(type.aBoolean757, type.anInt744, type.anInt761, i_121_, i, i_123_); + if (type.solid && (collisionMap != null)) { + collisionMap.method212(type.blocksProjectiles, type.sizeX, type.sizeZ, i_121_, i, i_123_); } } else { - if (type.aBoolean762) { + if (type.adjustToTerrain) { if (i_123_ == 1) { int i_139_ = i_127_; i_127_ = i_126_; @@ -1003,47 +1003,47 @@ public class SceneBuilder { } if (i_119_ == 4) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(4, 0, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWallDecoration(WALL_TYPE_0[i_123_], entity, i_120_, i_121_, i, i_128_, i_123_ * 512, 0, 0, i_129_, i_130_); } else if (i_119_ == 5) { int i_142_ = 16; int i_143_ = scene.getWallBitset(i_120_, i_121_, i); if (i_143_ > 0) { - i_142_ = LocType.method572((i_143_ >> 14) & 0x7fff).anInt775; + i_142_ = LocType.get((i_143_ >> 14) & 0x7fff).decorationPadding; } Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(4, 0, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWallDecoration(WALL_TYPE_0[i_123_], entity, i_120_, i_121_, i, i_128_, i_123_ * 512, anIntArray137[i_123_] * i_142_, anIntArray144[i_123_] * i_142_, i_129_, i_130_); } else if (i_119_ == 6) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(4, 0, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWallDecoration(256, entity, i_120_, i_121_, i, i_128_, i_123_, 0, 0, i_129_, i_130_); } else if (i_119_ == 7) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(4, 0, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWallDecoration(512, entity, i_120_, i_121_, i, i_128_, i_123_, 0, 0, i_129_, i_130_); } else if (i_119_ == 8) { Entity entity; - if ((type.anInt781 == -1) && (type.anIntArray759 == null)) { + if ((type.seqId == -1) && (type.overrideIds == null)) { entity = type.method578(4, 0, i_124_, i_125_, i_126_, i_127_, -1); } else { - entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.anInt781, true); + entity = new LocEntity(i_122_, 0, 4, i_125_, i_126_, i_124_, i_127_, type.seqId, true); } scene.addWallDecoration(768, entity, i_120_, i_121_, i, i_128_, i_123_, 0, 0, i_129_, i_130_); } @@ -1196,9 +1196,9 @@ public class SceneBuilder { int i_211_ = i_210_ >> 2; int i_212_ = i_210_ & 0x3; if ((i_209_ == i) && (i_208_ >= i_200_) && (i_208_ < (i_200_ + 8)) && (i_207_ >= i_198_) && (i_207_ < (i_198_ + 8))) { - LocType type = LocType.method572(i_203_); - int i_213_ = i_197_ + ZoneUtil.method157(i_201_, type.anInt761, i_208_ & 0x7, i_207_ & 0x7, type.anInt744); - int i_214_ = i_202_ + ZoneUtil.method158(i_207_ & 0x7, type.anInt761, i_201_, type.anInt744, i_208_ & 0x7); + LocType type = LocType.get(i_203_); + int i_213_ = i_197_ + ZoneUtil.method157(i_201_, type.sizeZ, i_208_ & 0x7, i_207_ & 0x7, type.sizeX); + int i_214_ = i_202_ + ZoneUtil.method158(i_207_ & 0x7, type.sizeZ, i_201_, type.sizeX, i_208_ & 0x7); if ((i_213_ > 0) && (i_214_ > 0) && (i_213_ < 103) && (i_214_ < 103)) { int i_215_ = i_209_; if ((planeTileFlags[1][i_213_][i_214_] & 0x2) == 2) { diff --git a/src/main/java/SceneCollisionMap.java b/src/main/java/SceneCollisionMap.java index 4672053..379a948 100644 --- a/src/main/java/SceneCollisionMap.java +++ b/src/main/java/SceneCollisionMap.java @@ -308,31 +308,31 @@ public class SceneCollisionMap { } } - public void method216(int i, int j, int k, int l, int i1, boolean flag) { - int j1 = 256; + public void method216(int rotation, int sizeX, int x0, int z0, int sizeZ, boolean flag) { + int flags = 256; if (flag) { - j1 += 0x20000; + flags += 0x20000; } - k -= anInt290; - l -= anInt291; - if ((i == 1) || (i == 3)) { - int k1 = j; - j = i1; - i1 = k1; + x0 -= anInt290; + z0 -= anInt291; + if ((rotation == 1) || (rotation == 3)) { + int tmp = sizeX; + sizeX = sizeZ; + sizeZ = tmp; } - for (int l1 = k; l1 < (k + j); l1++) { - if ((l1 >= 0) && (l1 < anInt292)) { - for (int i2 = l; i2 < (l + i1); i2++) { - if ((i2 >= 0) && (i2 < anInt293)) { - method217(j1, l1, i2); + for (int x = x0; x < (x0 + sizeX); x++) { + if ((x >= 0) && (x < anInt292)) { + for (int z = z0; z < (z0 + sizeZ); z++) { + if ((z >= 0) && (z < anInt293)) { + method217(flags, x, z); } } } } } - public void method217(int i, int j, int k) { - flags[j][k] &= 0xffffff - i; + public void method217(int flag, int x, int z) { + flags[x][z] &= 0xffffff - flag; } public void method218(int j, int k) {