A RuneTek3 client (377) that is deobfuscated, converted to Kotlin, and includes QoL improvements.
0

Configure Feed

Select the types of activity you want to include in your feed.

major refactoring

+4096 -3848
+829 -861
src/com/jagex/runescape/Game.java
··· 39 39 import com.jagex.runescape.net.requester.OnDemandRequester; 40 40 import com.jagex.runescape.scene.Region; 41 41 import com.jagex.runescape.scene.Scene; 42 - import com.jagex.runescape.scene.SceneSpawnRequest; 42 + import com.jagex.runescape.scene.InteractiveObject; 43 43 import com.jagex.runescape.scene.SpawnObjectNode; 44 44 import com.jagex.runescape.scene.tile.FloorDecoration; 45 45 import com.jagex.runescape.scene.tile.Wall; ··· 59 59 60 60 private final int[] soundVolume = new int[50]; 61 61 private int archiveHashes[] = new int[9]; 62 - private byte aByteArrayArray838[][]; 62 + private byte terrainData[][]; 63 63 private String reportedName = ""; 64 64 private int anIntArray842[] = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; 65 - private int anIntArray843[] = new int[SkillConstants.SKILL_COUNT]; 65 + private int skillExperience[] = new int[SkillConstants.SKILL_COUNT]; 66 66 private int anInt844; 67 67 private int anInt845; 68 68 private int anInt846; ··· 71 71 private String friendUsernames[] = new String[200]; 72 72 private int anInt850; 73 73 private int anInt851; 74 - private int anIntArray852[] = new int[5]; 74 + private int cameraAmplitude[] = new int[5]; 75 75 private int anInt853; 76 76 private int anInt854 = 2; 77 77 private int ignoresCount; 78 - private int coordinates[]; 79 - private int anIntArray857[]; 80 - private int anIntArray858[]; 78 + private int mapCoordinates[]; 79 + private int terrainDataIds[]; 80 + private int objectDataIds[]; 81 81 private int friendsCount; 82 82 private int friendListStatus; 83 83 private String aString861 = ""; ··· 110 110 private Archive titleArchive; 111 111 private int chunkX; 112 112 private int chunkY; 113 - private int anIntArrayArrayArray891[][][]; 113 + private int intGroundArray[][][]; 114 114 private int anInt893; 115 115 private static int anInt895; 116 116 private ImageRGB cursorCross[] = new ImageRGB[8]; ··· 138 138 public static int portOffset; 139 139 private static boolean memberServer = true; 140 140 public static boolean lowMemory; 141 - private boolean aBooleanArray927[] = new boolean[5]; 141 + private boolean customCameraActive[] = new boolean[5]; 142 142 private int anInt928 = -188; 143 143 private Buffer tempBuffer = Buffer.allocate(1); 144 144 private long serverSeed; ··· 198 198 private int backDialogueId = -1; 199 199 private int placementX; 200 200 private int placementY; 201 - private int anIntArray991[] = new int[5]; 201 + private int cameraFrequency[] = new int[5]; 202 202 private int anInt992; 203 203 private int anInt993; 204 204 private int anInt994; ··· 207 207 private int anInt997; 208 208 private int anInt998; 209 209 private int chatboxLineOffsets[]; 210 - private int anIntArray1001[]; 211 - private int anIntArray1002[]; 210 + private int sidebarOffsets[]; 211 + private int viewportOffsets[]; 212 212 private int anIntArray1003[]; 213 213 private int anInt1004; 214 214 private int anIntArray1005[] = new int[2000]; ··· 228 228 private ImageRGB anImageRGB1226; 229 229 private ImageRGB anImageRGB1227; 230 230 private int anIntArray1019[] = new int[151]; 231 - private int anInt1020; 232 - private int anInt1021; 231 + private int lastClickX; 232 + private int lastClickY; 233 233 private int crossIndex; 234 234 private int crossType; 235 235 private BufferedConnection gameConnection; 236 236 private String chatMessage = ""; 237 237 private String aString1027; 238 - private int anIntArray1029[] = new int[SkillConstants.SKILL_COUNT]; 238 + private int skillLevel[] = new int[SkillConstants.SKILL_COUNT]; 239 239 private int userWeight; 240 240 private ImageRGB worldMapHintIcons[] = new ImageRGB[100]; 241 - private final int anIntArray1032[] = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3}; 241 + private final int objectTypes[] = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3}; 242 242 private int anInt1034; 243 243 private int currentSound; 244 244 private ImageRGB mapFlagMarker; ··· 257 257 private int minimapState; 258 258 private static int anInt1052; 259 259 private int anInt1053 = -1; 260 - private int anIntArray1054[] = new int[SkillConstants.SKILL_COUNT]; 260 + private int skillMaxLevel[] = new int[SkillConstants.SKILL_COUNT]; 261 261 private int anInt1055 = 2; 262 262 private int anInt1056 = 3; 263 263 private int systemUpdateTime; ··· 283 283 private int minimapHintY[] = new int[1000]; 284 284 private ImageRGB aClass50_Sub1_Sub1_Sub1Array1079[] = new ImageRGB[32]; 285 285 private int anInt1080 = 0x4d4233; 286 - private int anIntArray1081[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 286 + private int tabInterfaceIDs[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 287 287 private static int anInt1082; 288 288 private int anInt1083; 289 289 private int anIntArray1084[]; ··· 306 306 private ImageRGB aClass50_Sub1_Sub1_Sub1_1102; 307 307 private ImageRGB aClass50_Sub1_Sub1_Sub1_1103; 308 308 private String chatboxInput = ""; 309 - private int anIntArray1105[] = new int[5]; 309 + private int cameraJitter[] = new int[5]; 310 310 private int anInt1106; 311 311 private int anInt1107 = 78; 312 312 private ProducingGraphicsBuffer aClass18_1108; ··· 338 338 private int anIntArray1134[] = new int[16384]; 339 339 private int anInt1135 = 0x766654; 340 340 public boolean loggedIn = false; 341 - private int anInt1138; 341 + private int renderCount; 342 342 private static int anInt1139; 343 343 private int anInt1140 = -110; 344 344 private long aLong1141; ··· 350 350 private int anInt1147; 351 351 private int anInt1148; 352 352 private int anInt1149; 353 - private String aString1150; 353 + private String selectedItemName; 354 354 private int otherPlayerId; 355 355 private int anInt1152; 356 356 private IndexedImage aClass50_Sub1_Sub1_Sub3Array1153[] = new IndexedImage[100]; 357 357 private boolean aBoolean1155 = false; 358 - private ProducingGraphicsBuffer aClass18_1156; 358 + private ProducingGraphicsBuffer tabImageProducer; 359 359 private ProducingGraphicsBuffer aClass18_1157; 360 - private ProducingGraphicsBuffer aClass18_1158; 360 + private ProducingGraphicsBuffer gameScreenImageProducer; 361 361 private ProducingGraphicsBuffer chatboxProducingGraphicsBuffer; 362 362 private static int anInt1160; 363 363 private byte aByte1161 = 97; ··· 408 408 private int anInt1208; 409 409 private boolean aBoolean1209 = false; 410 410 private LinkedList aClass6_1210 = new LinkedList(); 411 - private boolean oriented = false; 412 - private boolean aBoolean1212 = false; 411 + private boolean cutsceneActive = false; 412 + private boolean redrawChatMode = false; 413 413 private int anInt1213 = -1; 414 414 public static int BITFIELD_MAX_VALUE[]; 415 415 private int anInt1215; 416 416 private int cameraX; 417 417 private int cameraZ; 418 418 private int cameraY; 419 - private int anInt1219; 420 - private int anInt1220; 419 + private int cameraVerticalRotation; 420 + private int cameraHorizontalRotation; 421 421 private int friendsListAction; 422 422 private int anInt1222; 423 423 private int anInt1223; ··· 428 428 public Index stores[] = new Index[5]; 429 429 private long aLong1229; 430 430 private int reportAbuseInterfaceID = -1; 431 - private byte aByteArrayArray1232[][]; 431 + private byte objectData[][]; 432 432 private int anInt1233; 433 433 private int anInt1234 = 1; 434 434 private static int anInt1235; ··· 447 447 private MouseCapturer mouseCapturer; 448 448 private Widget aClass13_1249 = new Widget(); 449 449 private long aLong1172; 450 - private int anInt1251 = 128; 450 + private int cameraVertical = 128; 451 451 private int cameraHorizontal; 452 452 private int anInt1186; 453 453 private int anInt1187; 454 - private int anInt1255; 454 + private int cameraRandomisationA; 455 455 private int anInt1256 = 1; 456 456 private int anIntArray1258[] = new int[100]; 457 457 private int soundDelay[] = new int[50]; 458 458 private CollisionMap currentCollisionMap[] = new CollisionMap[4]; 459 - private LinkedList aClass6_1261 = new LinkedList(); 460 - private int anInt1262; 461 - private int anInt1263; 459 + private LinkedList spawnObjectList = new LinkedList(); 460 + private int currentCameraPositionH; 461 + private int currentCameraPositionV; 462 462 private int anInt1264; 463 463 private boolean aBoolean1265 = false; 464 464 private boolean musicEnabled = true; ··· 474 474 private int anInt1276 = -1; 475 475 private boolean aBoolean1277 = false; 476 476 private ImageRGB minimapHint[] = new ImageRGB[1000]; 477 - private int anInt1279 = -1; 477 + private int walkableWidgetId = -1; 478 478 private int anInt1280; 479 479 private LinkedList aClass6_1282 = new LinkedList(); 480 480 private boolean aBoolean1283 = false; 481 481 private int anInt1284; 482 - private int anInt1285 = 3; 482 + private int currentTabId = 3; 483 483 private int anIntArray1286[] = new int[33]; 484 484 private int anInt1287 = 0x332d25; 485 485 private ImageRGB aClass50_Sub1_Sub1_Sub1Array1288[] = new ImageRGB[32]; 486 - private int anInt1289; 486 + private int secondaryCameraVertical; 487 487 private int anIntArray1290[] = {17, 24, 34, 40}; 488 488 public OnDemandRequester onDemandRequester; 489 489 private IndexedImage titleboxImage; ··· 498 498 private boolean aBoolean1301 = true; 499 499 private int anInt1302; 500 500 private int anInt1303; 501 - private int anInt1304; 502 - private int menuClickX; 503 - private int menuClickY; 501 + private int menuScreenArea; 502 + private int menuOffsetX; 503 + private int menuOffsetY; 504 504 private int anInt1307; 505 505 private int anInt1308; 506 506 private static int drawCycle; ··· 868 868 private void method18(byte byte0) { 869 869 if (byte0 != 3) 870 870 return; 871 - for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) aClass6_1261.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) aClass6_1261 871 + for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) spawnObjectList.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) spawnObjectList 872 872 .next()) 873 873 if (spawnObjectNode.anInt1390 == -1) { 874 874 spawnObjectNode.anInt1395 = 0; ··· 921 921 aClass18_1109 = null; 922 922 aClass18_1110 = null; 923 923 widgetSettings = null; 924 - coordinates = null; 925 - aByteArrayArray838 = null; 926 - aByteArrayArray1232 = null; 927 - anIntArray857 = null; 928 - anIntArray858 = null; 924 + mapCoordinates = null; 925 + terrainData = null; 926 + objectData = null; 927 + terrainDataIds = null; 928 + objectDataIds = null; 929 929 aClass18_1203 = null; 930 930 aClass18_1204 = null; 931 931 aClass18_1205 = null; ··· 950 950 aClass18_912 = null; 951 951 aClass18_913 = null; 952 952 aClass18_914 = null; 953 - anIntArrayArrayArray891 = null; 953 + intGroundArray = null; 954 954 currentSceneTileFlags = null; 955 955 currentScene = null; 956 956 currentCollisionMap = null; ··· 970 970 outBuffer = null; 971 971 tempBuffer = null; 972 972 buffer = null; 973 - aClass18_1156 = null; 973 + tabImageProducer = null; 974 974 aClass18_1157 = null; 975 - aClass18_1158 = null; 975 + gameScreenImageProducer = null; 976 976 chatboxProducingGraphicsBuffer = null; 977 977 inventoryBackgroundImage = null; 978 978 minimapBackgroundImage = null; ··· 1006 1006 selectedMenuActions = null; 1007 1007 menuActionTexts = null; 1008 1008 groundItems = null; 1009 - aClass6_1261 = null; 1009 + spawnObjectList = null; 1010 1010 method141(); 1011 1011 GameObjectDefinition.method433(false); 1012 1012 ActorDefinition.reset(); ··· 1021 1021 super.imageProducer = null; 1022 1022 Player.modelCache = null; 1023 1023 Rasterizer3D.reset(); 1024 - Scene.method240(); 1024 + Scene.nullLoader(); 1025 1025 Model.reset(); 1026 1026 Animation.reset(); 1027 1027 System.gc(); ··· 1032 1032 return; 1033 1033 if (super.clickType == 1) { 1034 1034 if (super.clickX >= 539 && super.clickX <= 573 && super.clickY >= 169 && super.clickY < 205 1035 - && anIntArray1081[0] != -1) { 1035 + && tabInterfaceIDs[0] != -1) { 1036 1036 redrawTabArea = true; 1037 - anInt1285 = 0; 1037 + currentTabId = 0; 1038 1038 aBoolean950 = true; 1039 1039 } 1040 1040 if (super.clickX >= 569 && super.clickX <= 599 && super.clickY >= 168 && super.clickY < 205 1041 - && anIntArray1081[1] != -1) { 1041 + && tabInterfaceIDs[1] != -1) { 1042 1042 redrawTabArea = true; 1043 - anInt1285 = 1; 1043 + currentTabId = 1; 1044 1044 aBoolean950 = true; 1045 1045 } 1046 1046 if (super.clickX >= 597 && super.clickX <= 627 && super.clickY >= 168 && super.clickY < 205 1047 - && anIntArray1081[2] != -1) { 1047 + && tabInterfaceIDs[2] != -1) { 1048 1048 redrawTabArea = true; 1049 - anInt1285 = 2; 1049 + currentTabId = 2; 1050 1050 aBoolean950 = true; 1051 1051 } 1052 1052 if (super.clickX >= 625 && super.clickX <= 669 && super.clickY >= 168 && super.clickY < 203 1053 - && anIntArray1081[3] != -1) { 1053 + && tabInterfaceIDs[3] != -1) { 1054 1054 redrawTabArea = true; 1055 - anInt1285 = 3; 1055 + currentTabId = 3; 1056 1056 aBoolean950 = true; 1057 1057 } 1058 1058 if (super.clickX >= 666 && super.clickX <= 696 && super.clickY >= 168 && super.clickY < 205 1059 - && anIntArray1081[4] != -1) { 1059 + && tabInterfaceIDs[4] != -1) { 1060 1060 redrawTabArea = true; 1061 - anInt1285 = 4; 1061 + currentTabId = 4; 1062 1062 aBoolean950 = true; 1063 1063 } 1064 1064 if (super.clickX >= 694 && super.clickX <= 724 && super.clickY >= 168 && super.clickY < 205 1065 - && anIntArray1081[5] != -1) { 1065 + && tabInterfaceIDs[5] != -1) { 1066 1066 redrawTabArea = true; 1067 - anInt1285 = 5; 1067 + currentTabId = 5; 1068 1068 aBoolean950 = true; 1069 1069 } 1070 1070 if (super.clickX >= 722 && super.clickX <= 756 && super.clickY >= 169 && super.clickY < 205 1071 - && anIntArray1081[6] != -1) { 1071 + && tabInterfaceIDs[6] != -1) { 1072 1072 redrawTabArea = true; 1073 - anInt1285 = 6; 1073 + currentTabId = 6; 1074 1074 aBoolean950 = true; 1075 1075 } 1076 1076 if (super.clickX >= 540 && super.clickX <= 574 && super.clickY >= 466 && super.clickY < 502 1077 - && anIntArray1081[7] != -1) { 1077 + && tabInterfaceIDs[7] != -1) { 1078 1078 redrawTabArea = true; 1079 - anInt1285 = 7; 1079 + currentTabId = 7; 1080 1080 aBoolean950 = true; 1081 1081 } 1082 1082 if (super.clickX >= 572 && super.clickX <= 602 && super.clickY >= 466 && super.clickY < 503 1083 - && anIntArray1081[8] != -1) { 1083 + && tabInterfaceIDs[8] != -1) { 1084 1084 redrawTabArea = true; 1085 - anInt1285 = 8; 1085 + currentTabId = 8; 1086 1086 aBoolean950 = true; 1087 1087 } 1088 1088 if (super.clickX >= 599 && super.clickX <= 629 && super.clickY >= 466 && super.clickY < 503 1089 - && anIntArray1081[9] != -1) { 1089 + && tabInterfaceIDs[9] != -1) { 1090 1090 redrawTabArea = true; 1091 - anInt1285 = 9; 1091 + currentTabId = 9; 1092 1092 aBoolean950 = true; 1093 1093 } 1094 1094 if (super.clickX >= 627 && super.clickX <= 671 && super.clickY >= 467 && super.clickY < 502 1095 - && anIntArray1081[10] != -1) { 1095 + && tabInterfaceIDs[10] != -1) { 1096 1096 redrawTabArea = true; 1097 - anInt1285 = 10; 1097 + currentTabId = 10; 1098 1098 aBoolean950 = true; 1099 1099 } 1100 1100 if (super.clickX >= 669 && super.clickX <= 699 && super.clickY >= 466 && super.clickY < 503 1101 - && anIntArray1081[11] != -1) { 1101 + && tabInterfaceIDs[11] != -1) { 1102 1102 redrawTabArea = true; 1103 - anInt1285 = 11; 1103 + currentTabId = 11; 1104 1104 aBoolean950 = true; 1105 1105 } 1106 1106 if (super.clickX >= 696 && super.clickX <= 726 && super.clickY >= 466 && super.clickY < 503 1107 - && anIntArray1081[12] != -1) { 1107 + && tabInterfaceIDs[12] != -1) { 1108 1108 redrawTabArea = true; 1109 - anInt1285 = 12; 1109 + currentTabId = 12; 1110 1110 aBoolean950 = true; 1111 1111 } 1112 1112 if (super.clickX >= 724 && super.clickX <= 758 && super.clickY >= 466 && super.clickY < 502 1113 - && anIntArray1081[13] != -1) { 1113 + && tabInterfaceIDs[13] != -1) { 1114 1114 redrawTabArea = true; 1115 - anInt1285 = 13; 1115 + currentTabId = 13; 1116 1116 aBoolean950 = true; 1117 1117 } 1118 1118 } ··· 1130 1130 try { 1131 1131 int j = localPlayer.worldX + anInt853; 1132 1132 int k = localPlayer.worldY + anInt1009; 1133 - if (anInt1262 - j < -500 || anInt1262 - j > 500 || anInt1263 - k < -500 || anInt1263 - k > 500) { 1134 - anInt1262 = j; 1135 - anInt1263 = k; 1133 + if (currentCameraPositionH - j < -500 || currentCameraPositionH - j > 500 || currentCameraPositionV - k < -500 || currentCameraPositionV - k > 500) { 1134 + currentCameraPositionH = j; 1135 + currentCameraPositionV = k; 1136 1136 } 1137 - if (anInt1262 != j) 1138 - anInt1262 += (j - anInt1262) / 16; 1139 - if (anInt1263 != k) 1140 - anInt1263 += (k - anInt1263) / 16; 1137 + if (currentCameraPositionH != j) 1138 + currentCameraPositionH += (j - currentCameraPositionH) / 16; 1139 + if (currentCameraPositionV != k) 1140 + currentCameraPositionV += (k - currentCameraPositionV) / 16; 1141 1141 if (super.keyStatus[1] == 1) 1142 1142 anInt1186 += (-24 - anInt1186) / 2; 1143 1143 else if (super.keyStatus[2] == 1) ··· 1151 1151 else 1152 1152 anInt1187 /= 2; 1153 1153 cameraHorizontal = cameraHorizontal + anInt1186 / 2 & 0x7ff; 1154 - anInt1251 += anInt1187 / 2; 1155 - if (anInt1251 < 128) 1156 - anInt1251 = 128; 1157 - if (anInt1251 > 383) 1158 - anInt1251 = 383; 1159 - int l = anInt1262 >> 7; 1160 - int i1 = anInt1263 >> 7; 1161 - int j1 = method110(anInt1263, anInt1262, (byte) 9, plane); 1154 + cameraVertical += anInt1187 / 2; 1155 + if (cameraVertical < 128) 1156 + cameraVertical = 128; 1157 + if (cameraVertical > 383) 1158 + cameraVertical = 383; 1159 + int l = currentCameraPositionH >> 7; 1160 + int i1 = currentCameraPositionV >> 7; 1161 + int j1 = getFloorDrawHeight(plane, currentCameraPositionH, currentCameraPositionV); 1162 1162 int k1 = 0; 1163 1163 if (l > 3 && i1 > 3 && l < 100 && i1 < 100) { 1164 1164 for (int l1 = l - 4; l1 <= l + 4; l1++) { ··· 1166 1166 int k2 = plane; 1167 1167 if (k2 < 3 && (currentSceneTileFlags[1][l1][j2] & 2) == 2) 1168 1168 k2++; 1169 - int l2 = j1 - anIntArrayArrayArray891[k2][l1][j2]; 1169 + int l2 = j1 - intGroundArray[k2][l1][j2]; 1170 1170 if (l2 > k1) 1171 1171 k1 = l2; 1172 1172 } ··· 1179 1179 i2 = 0x17f00; 1180 1180 if (i2 < 32768) 1181 1181 i2 = 32768; 1182 - if (i2 > anInt1289) { 1183 - anInt1289 += (i2 - anInt1289) / 24; 1182 + if (i2 > secondaryCameraVertical) { 1183 + secondaryCameraVertical += (i2 - secondaryCameraVertical) / 24; 1184 1184 return; 1185 1185 } 1186 - if (i2 < anInt1289) { 1187 - anInt1289 += (i2 - anInt1289) / 80; 1186 + if (i2 < secondaryCameraVertical) { 1187 + secondaryCameraVertical += (i2 - secondaryCameraVertical) / 80; 1188 1188 return; 1189 1189 } 1190 1190 } catch (Exception _ex) { 1191 1191 SignLink.reportError("glfc_ex " + localPlayer.worldX + "," 1192 - + localPlayer.worldY + "," + anInt1262 + "," + anInt1263 + "," + chunkX + "," 1192 + + localPlayer.worldY + "," + currentCameraPositionH + "," + currentCameraPositionV + "," + chunkX + "," 1193 1193 + chunkY + "," + nextTopLeftTileX + "," + nextTopRightTileY); 1194 1194 throw new RuntimeException("eek"); 1195 1195 } ··· 1271 1271 } 1272 1272 } 1273 1273 1274 - linkedList.addFirst(((Node) (mostValuable))); 1274 + linkedList.push(((Node) (mostValuable))); 1275 1275 Object first = null; 1276 1276 Object second = null; 1277 1277 for (Item item = (Item) linkedList.first(); item != null; item = (Item) linkedList ··· 1285 1285 } 1286 1286 1287 1287 int key = x + (y << 7) + 0x60000000; 1288 - currentScene.method248(method110(y * 128 + 64, x * 128 + 64, (byte) 9, plane), plane, 1289 - ((Renderable) (mostValuable)), ((Renderable) (first)), key, ((Renderable) (second)), 2, y, x); 1288 + currentScene.addGroundItemTile(x, y, plane, getFloorDrawHeight(plane, x * 128 + 64, y * 128 + 64), 1289 + key, ((Renderable) (mostValuable)), ((Renderable) (first)), ((Renderable) (second))); 1290 1290 } 1291 1291 1292 1292 ··· 1399 1399 anInt1264 = 20; 1400 1400 aBoolean1265 = false; 1401 1401 outBuffer.putOpcode(140); 1402 - outBuffer.putLEShortDup(anInt1251); 1402 + outBuffer.putLEShortDup(cameraVertical); 1403 1403 outBuffer.putLEShortDup(cameraHorizontal); 1404 1404 } 1405 1405 if (super.awtFocus && !aBoolean1275) { ··· 1495 1495 } 1496 1496 if (Scene.clickedTileX != -1) { 1497 1497 int dstX = Scene.clickedTileX; 1498 - int dstY = Scene.anInt486; 1498 + int dstY = Scene.clickedTileY; 1499 1499 boolean flag = walk(true, false, dstY, localPlayer.pathY[0], 0, 0, 0, 0, dstX, 0, 0, 1500 1500 localPlayer.pathX[0]); 1501 1501 Scene.clickedTileX = -1; 1502 1502 if (flag) { 1503 - anInt1020 = super.clickX; 1504 - anInt1021 = super.clickY; 1503 + lastClickX = super.clickX; 1504 + lastClickY = super.clickY; 1505 1505 crossType = 1; 1506 1506 crossIndex = 0; 1507 1507 } ··· 1533 1533 anInt893--; 1534 1534 if (loadingStage == 2) 1535 1535 checkForGameUsages(409); 1536 - if (loadingStage == 2 && oriented) 1536 + if (loadingStage == 2 && cutsceneActive) 1537 1537 calculateCameraPosition(); 1538 1538 for (int k = 0; k < 5; k++) 1539 1539 quakeTimes[k]++; ··· 1554 1554 if ((k1 & 2) == 2) 1555 1555 anInt1009 += anInt1010; 1556 1556 if ((k1 & 4) == 4) 1557 - anInt1255 += anInt1256; 1557 + cameraRandomisationA += anInt1256; 1558 1558 } 1559 1559 if (anInt853 < -50) 1560 1560 anInt854 = 2; ··· 1564 1564 anInt1010 = 2; 1565 1565 if (anInt1009 > 55) 1566 1566 anInt1010 = -2; 1567 - if (anInt1255 < -40) 1567 + if (cameraRandomisationA < -40) 1568 1568 anInt1256 = 1; 1569 - if (anInt1255 > 40) 1569 + if (cameraRandomisationA > 40) 1570 1570 anInt1256 = -1; 1571 1571 anInt1045++; 1572 1572 if (anInt1045 > 500) { ··· 1606 1606 private void calculateCameraPosition() { 1607 1607 int i = anInt874 * 128 + 64; 1608 1608 int j = anInt875 * 128 + 64; 1609 - int k = method110(j, i, (byte) 9, plane) - anInt876; 1609 + int k = getFloorDrawHeight(plane, i, j) - anInt876; 1610 1610 if (cameraX < i) { 1611 1611 cameraX += anInt877 + ((i - cameraX) * anInt878) / 1000; 1612 1612 if (cameraX > i) ··· 1639 1639 } 1640 1640 i = anInt993 * 128 + 64; 1641 1641 j = anInt994 * 128 + 64; 1642 - k = method110(j, i, (byte) 9, plane) - anInt995; 1642 + k = getFloorDrawHeight(plane, i, j) - anInt995; 1643 1643 int l = i - cameraX; 1644 1644 int i1 = k - cameraZ; 1645 1645 int j1 = j - cameraY; ··· 1650 1650 l1 = 128; 1651 1651 if (l1 > 383) 1652 1652 l1 = 383; 1653 - if (anInt1219 < l1) { 1654 - anInt1219 += anInt996 + ((l1 - anInt1219) * anInt997) / 1000; 1655 - if (anInt1219 > l1) 1656 - anInt1219 = l1; 1653 + if (cameraVerticalRotation < l1) { 1654 + cameraVerticalRotation += anInt996 + ((l1 - cameraVerticalRotation) * anInt997) / 1000; 1655 + if (cameraVerticalRotation > l1) 1656 + cameraVerticalRotation = l1; 1657 1657 } 1658 - if (anInt1219 > l1) { 1659 - anInt1219 -= anInt996 + ((anInt1219 - l1) * anInt997) / 1000; 1660 - if (anInt1219 < l1) 1661 - anInt1219 = l1; 1658 + if (cameraVerticalRotation > l1) { 1659 + cameraVerticalRotation -= anInt996 + ((cameraVerticalRotation - l1) * anInt997) / 1000; 1660 + if (cameraVerticalRotation < l1) 1661 + cameraVerticalRotation = l1; 1662 1662 } 1663 - int k2 = j2 - anInt1220; 1663 + int k2 = j2 - cameraHorizontalRotation; 1664 1664 if (k2 > 1024) 1665 1665 k2 -= 2048; 1666 1666 if (k2 < -1024) 1667 1667 k2 += 2048; 1668 1668 if (k2 > 0) { 1669 - anInt1220 += anInt996 + (k2 * anInt997) / 1000; 1670 - anInt1220 &= 0x7ff; 1669 + cameraHorizontalRotation += anInt996 + (k2 * anInt997) / 1000; 1670 + cameraHorizontalRotation &= 0x7ff; 1671 1671 } 1672 1672 if (k2 < 0) { 1673 - anInt1220 -= anInt996 + (-k2 * anInt997) / 1000; 1674 - anInt1220 &= 0x7ff; 1673 + cameraHorizontalRotation -= anInt996 + (-k2 * anInt997) / 1000; 1674 + cameraHorizontalRotation &= 0x7ff; 1675 1675 } 1676 - int l2 = j2 - anInt1220; 1676 + int l2 = j2 - cameraHorizontalRotation; 1677 1677 if (l2 > 1024) 1678 1678 l2 -= 2048; 1679 1679 if (l2 < -1024) 1680 1680 l2 += 2048; 1681 1681 if (l2 < 0 && k2 > 0 || l2 > 0 && k2 < 0) 1682 - anInt1220 = j2; 1682 + cameraHorizontalRotation = j2; 1683 1683 } 1684 1684 1685 1685 private void manageTextInputs() { ··· 1726 1726 chatMessage, 6); 1727 1727 if (privateChatMode == 2) { 1728 1728 privateChatMode = 1; 1729 - aBoolean1212 = true; 1729 + redrawChatMode = true; 1730 1730 outBuffer.putOpcode(176); 1731 1731 outBuffer.putByte(publicChatMode); 1732 1732 outBuffer.putByte(privateChatMode); ··· 1734 1734 } 1735 1735 } 1736 1736 if (friendsListAction == 4 && ignoresCount < 100) { 1737 - long l2 = TextUtils.nameToLong(chatMessage); 1738 - addIgnore(l2); 1737 + long nameAsLong = TextUtils.nameToLong(chatMessage); 1738 + addIgnore(nameAsLong); 1739 1739 } 1740 1740 if (friendsListAction == 5 && ignoresCount > 0) { 1741 - long l3 = TextUtils.nameToLong(chatMessage); 1742 - removeIgnore(325, l3); 1741 + long nameAsLong = TextUtils.nameToLong(chatMessage); 1742 + removeIgnore(nameAsLong); 1743 1743 } 1744 1744 } 1745 1745 } else if (inputType == 1) { ··· 1753 1753 } 1754 1754 if (key == 13 || key == 10) { 1755 1755 if (inputInputMessage.length() > 0) { 1756 - int k = 0; 1756 + int inputValue = 0; 1757 1757 try { 1758 - k = Integer.parseInt(inputInputMessage); 1758 + inputValue = Integer.parseInt(inputInputMessage); 1759 1759 } catch (Exception _ex) { 1760 + /* empty */ 1760 1761 } 1761 1762 outBuffer.putOpcode(75); 1762 - outBuffer.putInt(k); 1763 + outBuffer.putInt(inputValue); 1763 1764 } 1764 1765 inputType = 0; 1765 1766 redrawChatbox = true; ··· 1890 1891 } 1891 1892 outBuffer.putOpcode(49); 1892 1893 outBuffer.putByte(0); 1893 - int bufPos = outBuffer.currentPosition; 1894 + int bufferPos = outBuffer.currentPosition; 1894 1895 outBuffer.putByteNegated(colourCode); 1895 1896 outBuffer.putByteAdded(effectCode); 1896 1897 chatBuffer.currentPosition = 0; 1897 1898 ChatEncoder.put(chatboxInput, chatBuffer); 1898 1899 outBuffer.putBytes(chatBuffer.buffer, 0, 1899 1900 chatBuffer.currentPosition); 1900 - outBuffer.putLength(outBuffer.currentPosition - bufPos); 1901 + outBuffer.putLength(outBuffer.currentPosition - bufferPos); 1901 1902 chatboxInput = ChatEncoder.formatChatMessage(chatboxInput); 1902 1903 chatboxInput = ChatCensor.censorString(chatboxInput); 1903 1904 localPlayer.forcedChat = chatboxInput; ··· 1914 1915 addChatMessage(localPlayer.playerName, localPlayer.forcedChat, 2); 1915 1916 if (publicChatMode == 2) { 1916 1917 publicChatMode = 3; 1917 - aBoolean1212 = true; 1918 + redrawChatMode = true; 1918 1919 outBuffer.putOpcode(176); 1919 1920 outBuffer.putByte(publicChatMode); 1920 1921 outBuffer.putByte(privateChatMode); ··· 2190 2191 publicChatMode = buffer.getUnsignedByte(); 2191 2192 privateChatMode = buffer.getUnsignedByte(); 2192 2193 tradeMode = buffer.getUnsignedByte(); 2193 - aBoolean1212 = true; 2194 + redrawChatMode = true; 2194 2195 redrawChatbox = true; 2195 2196 opcode = -1; 2196 2197 return true; ··· 2231 2232 return true; 2232 2233 } 2233 2234 if (opcode == 167) { 2234 - oriented = true; 2235 + cutsceneActive = true; 2235 2236 anInt993 = buffer.getUnsignedByte(); 2236 2237 anInt994 = buffer.getUnsignedByte(); 2237 2238 anInt995 = buffer.getUnsignedLEShort(); ··· 2240 2241 if (anInt997 >= 100) { 2241 2242 int i4 = anInt993 * 128 + 64; 2242 2243 int l12 = anInt994 * 128 + 64; 2243 - int l17 = method110(l12, i4, (byte) 9, plane) - anInt995; 2244 + int l17 = getFloorDrawHeight(plane, i4, l12) - anInt995; 2244 2245 int k22 = i4 - cameraX; 2245 2246 int i25 = l17 - cameraZ; 2246 2247 int k27 = l12 - cameraY; 2247 2248 int i30 = (int) Math.sqrt(k22 * k22 + k27 * k27); 2248 - anInt1219 = (int) (Math.atan2(i25, i30) * 325.94900000000001D) & 0x7ff; 2249 - anInt1220 = (int) (Math.atan2(k22, k27) * -325.94900000000001D) & 0x7ff; 2250 - if (anInt1219 < 128) 2251 - anInt1219 = 128; 2252 - if (anInt1219 > 383) 2253 - anInt1219 = 383; 2249 + cameraVerticalRotation = (int) (Math.atan2(i25, i30) * 325.94900000000001D) & 0x7ff; 2250 + cameraHorizontalRotation = (int) (Math.atan2(k22, k27) * -325.94900000000001D) & 0x7ff; 2251 + if (cameraVerticalRotation < 128) 2252 + cameraVerticalRotation = 128; 2253 + if (cameraVerticalRotation > 383) 2254 + cameraVerticalRotation = 383; 2254 2255 } 2255 2256 opcode = -1; 2256 2257 return true; ··· 2376 2377 int k4 = buffer.getSignedShort(); 2377 2378 if (k4 >= 0) 2378 2379 method112((byte) 36, k4); 2379 - if (k4 != anInt1279) { 2380 - method44(anInt1279); 2381 - anInt1279 = k4; 2380 + if (k4 != walkableWidgetId) { 2381 + method44(walkableWidgetId); 2382 + walkableWidgetId = k4; 2382 2383 } 2383 2384 opcode = -1; 2384 2385 return true; ··· 2391 2392 return true; 2392 2393 } 2393 2394 if (opcode == 174) { 2394 - if (anInt1285 == 12) 2395 + if (currentTabId == 12) 2395 2396 redrawTabArea = true; 2396 2397 userWeight = buffer.getSignedShort(); 2397 2398 opcode = -1; ··· 2447 2448 int l13 = buffer.getUnsignedByte(); 2448 2449 int i18 = buffer.getUnsignedByte(); 2449 2450 int l22 = buffer.getUnsignedByte(); 2450 - aBooleanArray927[i5] = true; 2451 - anIntArray1105[i5] = l13; 2452 - anIntArray852[i5] = i18; 2453 - anIntArray991[i5] = l22; 2451 + customCameraActive[i5] = true; 2452 + cameraJitter[i5] = l13; 2453 + cameraAmplitude[i5] = i18; 2454 + cameraFrequency[i5] = l22; 2454 2455 quakeTimes[i5] = 0; 2455 2456 opcode = -1; 2456 2457 return true; ··· 2531 2532 return true; 2532 2533 } 2533 2534 if (opcode == 252) { 2534 - anInt1285 = buffer.getByteNegated(); 2535 + currentTabId = buffer.getByteNegated(); 2535 2536 redrawTabArea = true; 2536 2537 aBoolean950 = true; 2537 2538 opcode = -1; ··· 2549 2550 2550 2551 } 2551 2552 2552 - for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) aClass6_1261.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) aClass6_1261 2553 + for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) spawnObjectList.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) spawnObjectList 2553 2554 .next()) 2554 2555 if (spawnObjectNode.anInt1393 >= placementX && spawnObjectNode.anInt1393 < placementX + 8 2555 2556 && spawnObjectNode.anInt1394 >= placementY && spawnObjectNode.anInt1394 < placementY + 8 ··· 2695 2696 } 2696 2697 if (opcode == 49) { 2697 2698 redrawTabArea = true; 2698 - int j7 = buffer.getByteNegated(); 2699 - int j14 = buffer.getUnsignedByte(); 2700 - int j19 = buffer.getInt(); 2701 - anIntArray843[j7] = j19; 2702 - anIntArray1029[j7] = j14; 2703 - anIntArray1054[j7] = 1; 2704 - for (int k23 = 0; k23 < 98; k23++) 2705 - if (j19 >= SKILL_EXPERIENCE[k23]) 2706 - anIntArray1054[j7] = k23 + 2; 2699 + int _skillId = buffer.getByteNegated(); 2700 + int _skillLevel = buffer.getUnsignedByte(); 2701 + int _skillExp = buffer.getInt(); 2702 + skillExperience[_skillId] = _skillExp; 2703 + skillLevel[_skillId] = _skillLevel; 2704 + skillMaxLevel[_skillId] = 1; 2705 + for (int level = 0; level < 98; level++) 2706 + if (_skillExp >= SKILL_EXPERIENCE[level]) 2707 + skillMaxLevel[_skillId] = level + 2; 2707 2708 2708 2709 opcode = -1; 2709 2710 return true; ··· 2782 2783 2783 2784 } 2784 2785 2785 - aByteArrayArray838 = new byte[count][]; 2786 - aByteArrayArray1232 = new byte[count][]; 2787 - coordinates = new int[count]; 2788 - anIntArray857 = new int[count]; 2789 - anIntArray858 = new int[count]; 2786 + terrainData = new byte[count][]; 2787 + objectData = new byte[count][]; 2788 + mapCoordinates = new int[count]; 2789 + terrainDataIds = new int[count]; 2790 + objectDataIds = new int[count]; 2790 2791 count = 0; 2791 2792 for (int fileX = (chunkX - 6) / 8; fileX <= (chunkX + 6) / 8; fileX++) { 2792 2793 for (int fileY = (chunkY - 6) / 8; fileY <= (chunkY + 6) / 8; fileY++) { 2793 - coordinates[count] = (fileX << 8) + fileY; 2794 + mapCoordinates[count] = (fileX << 8) + fileY; 2794 2795 if (aBoolean1067 2795 2796 && (fileY == 49 || fileY == 149 || fileY == 147 || fileX == 50 || fileX == 49 && fileY == 47)) { 2796 - anIntArray857[count] = -1; 2797 - anIntArray858[count] = -1; 2797 + terrainDataIds[count] = -1; 2798 + objectDataIds[count] = -1; 2798 2799 count++; 2799 2800 } else { 2800 - int l30 = anIntArray857[count] = onDemandRequester.regId(0, fileX, fileY, 0); 2801 + int l30 = terrainDataIds[count] = onDemandRequester.regId(0, fileX, fileY, 0); 2801 2802 if (l30 != -1) 2802 2803 onDemandRequester.request(3, l30); 2803 - int i32 = anIntArray858[count] = onDemandRequester.regId(0, fileX, fileY, 1); 2804 + int i32 = objectDataIds[count] = onDemandRequester.regId(0, fileX, fileY, 1); 2804 2805 if (i32 != -1) 2805 2806 onDemandRequester.request(3, i32); 2806 2807 count++; ··· 2837 2838 2838 2839 } 2839 2840 2840 - aByteArrayArray838 = new byte[uniqueCount][]; 2841 - aByteArrayArray1232 = new byte[uniqueCount][]; 2842 - coordinates = new int[uniqueCount]; 2843 - anIntArray857 = new int[uniqueCount]; 2844 - anIntArray858 = new int[uniqueCount]; 2841 + terrainData = new byte[uniqueCount][]; 2842 + objectData = new byte[uniqueCount][]; 2843 + mapCoordinates = new int[uniqueCount]; 2844 + terrainDataIds = new int[uniqueCount]; 2845 + objectDataIds = new int[uniqueCount]; 2845 2846 for (int pos = 0; pos < uniqueCount; pos++) { 2846 - int j31 = coordinates[pos] = fileIndices[pos]; 2847 + int j31 = mapCoordinates[pos] = fileIndices[pos]; 2847 2848 int fileX = j31 >> 8 & 0xff; 2848 2849 int fileY = j31 & 0xff; 2849 - int i34 = anIntArray857[pos] = onDemandRequester.regId(0, fileX, fileY, 0); 2850 + int i34 = terrainDataIds[pos] = onDemandRequester.regId(0, fileX, fileY, 0); 2850 2851 if (i34 != -1) 2851 2852 onDemandRequester.request(3, i34); 2852 - int k34 = anIntArray858[pos] = onDemandRequester.regId(0, fileX, fileY, 1); 2853 + int k34 = objectDataIds[pos] = onDemandRequester.regId(0, fileX, fileY, 1); 2853 2854 if (k34 != -1) 2854 2855 onDemandRequester.request(3, k34); 2855 2856 } ··· 2916 2917 2917 2918 } 2918 2919 2919 - for (SpawnObjectNode spawnObjectNode_1 = (SpawnObjectNode) aClass6_1261.first(); spawnObjectNode_1 != null; spawnObjectNode_1 = (SpawnObjectNode) aClass6_1261 2920 + for (SpawnObjectNode spawnObjectNode_1 = (SpawnObjectNode) spawnObjectList.first(); spawnObjectNode_1 != null; spawnObjectNode_1 = (SpawnObjectNode) spawnObjectList 2920 2921 .next()) { 2921 2922 spawnObjectNode_1.anInt1393 -= deltaX; 2922 2923 spawnObjectNode_1.anInt1394 -= deltaY; ··· 2929 2930 destinationX -= deltaX; 2930 2931 destinationY -= deltaY; 2931 2932 } 2932 - oriented = false; 2933 + cutsceneActive = false; 2933 2934 opcode = -1; 2934 2935 return true; 2935 2936 } ··· 2945 2946 return true; 2946 2947 } 2947 2948 if (opcode == 125) { 2948 - if (anInt1285 == 12) 2949 + if (currentTabId == 12) 2949 2950 redrawTabArea = true; 2950 2951 anInt1324 = buffer.getUnsignedByte(); 2951 2952 opcode = -1; ··· 2971 2972 } 2972 2973 } 2973 2974 if (opcode == 3) { 2974 - oriented = true; 2975 + cutsceneActive = true; 2975 2976 anInt874 = buffer.getUnsignedByte(); 2976 2977 anInt875 = buffer.getUnsignedByte(); 2977 2978 anInt876 = buffer.getUnsignedLEShort(); ··· 2980 2981 if (anInt878 >= 100) { 2981 2982 cameraX = anInt874 * 128 + 64; 2982 2983 cameraY = anInt875 * 128 + 64; 2983 - cameraZ = method110(cameraY, cameraX, (byte) 9, plane) - anInt876; 2984 + cameraZ = getFloorDrawHeight(plane, cameraX, cameraY) - anInt876; 2984 2985 } 2985 2986 opcode = -1; 2986 2987 return true; ··· 2991 2992 Widget class13_3 = Widget.forId(interfaceId); 2992 2993 if (class13_3.disabledAnimation != animationId || animationId == -1) { 2993 2994 class13_3.disabledAnimation = animationId; 2994 - class13_3.anInt235 = 0; 2995 - class13_3.anInt227 = 0; 2995 + class13_3.animationFrame = 0; 2996 + class13_3.animationDuration = 0; 2996 2997 } 2997 2998 opcode = -1; 2998 2999 return true; ··· 3015 3016 int interfaceId = buffer.getShortUnsingedAdded(); 3016 3017 if (interfaceId == 65535) 3017 3018 interfaceId = -1; 3018 - if (anIntArray1081[sidebarIcon] != interfaceId) { 3019 - method44(anIntArray1081[sidebarIcon]); 3020 - anIntArray1081[sidebarIcon] = interfaceId; 3019 + if (tabInterfaceIDs[sidebarIcon] != interfaceId) { 3020 + method44(tabInterfaceIDs[sidebarIcon]); 3021 + tabInterfaceIDs[sidebarIcon] = interfaceId; 3021 3022 } 3022 3023 redrawTabArea = true; 3023 3024 aBoolean950 = true; ··· 3037 3038 } 3038 3039 if (opcode == 238) { 3039 3040 anInt1213 = buffer.getUnsignedByte(); 3040 - if (anInt1213 == anInt1285) { 3041 + if (anInt1213 == currentTabId) { 3041 3042 if (anInt1213 == 3) 3042 - anInt1285 = 1; 3043 + currentTabId = 1; 3043 3044 else 3044 - anInt1285 = 3; 3045 + currentTabId = 3; 3045 3046 redrawTabArea = true; 3046 3047 } 3047 3048 opcode = -1; 3048 3049 return true; 3049 3050 } 3050 3051 if (opcode == 148) { 3051 - oriented = false; 3052 + cutsceneActive = false; 3052 3053 for (int j9 = 0; j9 < 5; j9++) 3053 - aBooleanArray927[j9] = false; 3054 + customCameraActive[j9] = false; 3054 3055 3055 3056 opcode = -1; 3056 3057 return true; ··· 3133 3134 int j10 = buffer.getLittleShortA(); 3134 3135 String s6 = buffer.getString(); 3135 3136 Widget.forId(j10).disabledText = s6; 3136 - if (Widget.forId(j10).parentId == anIntArray1081[anInt1285]) 3137 + if (Widget.forId(j10).parentId == tabInterfaceIDs[currentTabId]) 3137 3138 redrawTabArea = true; 3138 3139 opcode = -1; 3139 3140 return true; ··· 3178 3179 String str; 3179 3180 3180 3181 if (itemSelected == 1 && menuActionRow < 2) 3181 - str = "Use " + aString1150 + " with..."; 3182 + str = "Use " + selectedItemName + " with..."; 3182 3183 else if (widgetSelected == 1 && menuActionRow < 2) 3183 3184 str = selectedWidgetName + "..."; 3184 3185 else ··· 3397 3398 3398 3399 private void method36() { 3399 3400 if (loadingStage == 2) { 3400 - for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) aClass6_1261.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) aClass6_1261 3401 + for (SpawnObjectNode spawnObjectNode = (SpawnObjectNode) spawnObjectList.first(); spawnObjectNode != null; spawnObjectNode = (SpawnObjectNode) spawnObjectList 3401 3402 .next()) { 3402 3403 if (spawnObjectNode.anInt1390 > 0) 3403 3404 spawnObjectNode.anInt1390--; ··· 3405 3406 if (spawnObjectNode.anInt1387 < 0 3406 3407 || Region.method170(spawnObjectNode.anInt1389, aByte1143, spawnObjectNode.anInt1387)) { 3407 3408 method45(spawnObjectNode.anInt1388, spawnObjectNode.anInt1393, spawnObjectNode.anInt1387, 3408 - spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1389, (byte) 1, 3409 + spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1389, 3409 3410 spawnObjectNode.anInt1392); 3410 3411 spawnObjectNode.remove(); 3411 3412 } ··· 3420 3421 && (spawnObjectNode.anInt1384 < 0 || Region.method170(spawnObjectNode.anInt1386, aByte1143, 3421 3422 spawnObjectNode.anInt1384))) { 3422 3423 method45(spawnObjectNode.anInt1385, spawnObjectNode.anInt1393, spawnObjectNode.anInt1384, 3423 - spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1386, (byte) 1, 3424 + spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1386, 3424 3425 spawnObjectNode.anInt1392); 3425 3426 spawnObjectNode.anInt1395 = -1; 3426 3427 if (spawnObjectNode.anInt1384 == spawnObjectNode.anInt1387 && spawnObjectNode.anInt1387 == -1) ··· 3447 3448 return super.getDocumentBase().getHost().toLowerCase(); 3448 3449 } 3449 3450 3450 - private void method38(int i, int j, int k, Player class50_sub1_sub4_sub3_sub2) { 3451 - if (class50_sub1_sub4_sub3_sub2 == localPlayer) 3451 + private void method38(int i, int j, int k, Player player) { 3452 + if (player == localPlayer) 3452 3453 return; 3453 3454 if (menuActionRow >= 400) 3454 3455 return; 3455 3456 String s; 3456 - if (class50_sub1_sub4_sub3_sub2.anInt1759 == 0) 3457 - s = class50_sub1_sub4_sub3_sub2.playerName 3458 - + getCombatLevelColour(localPlayer.combatLevel, class50_sub1_sub4_sub3_sub2.combatLevel) + " (level-" 3459 - + class50_sub1_sub4_sub3_sub2.combatLevel + ")"; 3457 + if (player.skillLevel == 0) 3458 + s = player.playerName 3459 + + getCombatLevelColour(localPlayer.combatLevel, player.combatLevel) + " (level-" 3460 + + player.combatLevel + ")"; 3460 3461 else 3461 - s = class50_sub1_sub4_sub3_sub2.playerName + " (skill-" + class50_sub1_sub4_sub3_sub2.anInt1759 + ")"; 3462 + s = player.playerName + " (skill-" + player.skillLevel + ")"; 3462 3463 if (itemSelected == 1) { 3463 - menuActionTexts[menuActionRow] = "Use " + aString1150 + " with @whi@" + s; 3464 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s; 3464 3465 menuActionTypes[menuActionRow] = 596; 3465 3466 selectedMenuActions[menuActionRow] = i; 3466 3467 firstMenuOperand[menuActionRow] = k; ··· 3481 3482 menuActionTexts[menuActionRow] = aStringArray1069[i1] + " @whi@" + s; 3482 3483 char c = '\0'; 3483 3484 if (aStringArray1069[i1].equalsIgnoreCase("attack")) { 3484 - if (class50_sub1_sub4_sub3_sub2.combatLevel > localPlayer.combatLevel) 3485 + if (player.combatLevel > localPlayer.combatLevel) 3485 3486 c = '\u07D0'; 3486 - if (localPlayer.teamId != 0 && class50_sub1_sub4_sub3_sub2.teamId != 0) 3487 - if (localPlayer.teamId == class50_sub1_sub4_sub3_sub2.teamId) 3487 + if (localPlayer.teamId != 0 && player.teamId != 0) 3488 + if (localPlayer.teamId == player.teamId) 3488 3489 c = '\u07D0'; 3489 3490 else 3490 3491 c = '\0'; ··· 3521 3522 if (super.clickType == 1) { 3522 3523 if (super.clickX >= 6 && super.clickX <= 106 && super.clickY >= 467 && super.clickY <= 499) { 3523 3524 publicChatMode = (publicChatMode + 1) % 4; 3524 - aBoolean1212 = true; 3525 + redrawChatMode = true; 3525 3526 redrawChatbox = true; 3526 3527 outBuffer.putOpcode(176); 3527 3528 outBuffer.putByte(publicChatMode); ··· 3530 3531 } 3531 3532 if (super.clickX >= 135 && super.clickX <= 235 && super.clickY >= 467 && super.clickY <= 499) { 3532 3533 privateChatMode = (privateChatMode + 1) % 3; 3533 - aBoolean1212 = true; 3534 + redrawChatMode = true; 3534 3535 redrawChatbox = true; 3535 3536 outBuffer.putOpcode(176); 3536 3537 outBuffer.putByte(publicChatMode); ··· 3539 3540 } 3540 3541 if (super.clickX >= 273 && super.clickX <= 373 && super.clickY >= 467 && super.clickY <= 499) { 3541 3542 tradeMode = (tradeMode + 1) % 3; 3542 - aBoolean1212 = true; 3543 + redrawChatMode = true; 3543 3544 redrawChatbox = true; 3544 3545 outBuffer.putOpcode(176); 3545 3546 outBuffer.putByte(publicChatMode); ··· 3685 3686 int i = -1; 3686 3687 if (byte0 != 7) 3687 3688 opcode = -1; 3688 - for (int j = 0; j < Model.anInt1708; j++) { 3689 + for (int j = 0; j < Model.resourceCount; j++) { 3689 3690 int k = Model.anIntArray1709[j]; 3690 3691 int l = k & 0x7f; 3691 3692 int i1 = k >> 7 & 0x7f; ··· 3701 3702 if (class47 == null) 3702 3703 continue; 3703 3704 if (itemSelected == 1) { 3704 - menuActionTexts[menuActionRow] = "Use " + aString1150 + " with @cya@" + class47.name; 3705 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class47.name; 3705 3706 menuActionTypes[menuActionRow] = 467; 3706 3707 selectedMenuActions[menuActionRow] = k; 3707 3708 firstMenuOperand[menuActionRow] = l; ··· 3748 3749 } 3749 3750 } 3750 3751 if (j1 == 1) { 3751 - Npc class50_sub1_sub4_sub3_sub1 = npcs[k1]; 3752 - if (class50_sub1_sub4_sub3_sub1.npcDefinition.boundaryDimension == 1 3753 - && (class50_sub1_sub4_sub3_sub1.worldX & 0x7f) == 64 3754 - && (class50_sub1_sub4_sub3_sub1.worldY & 0x7f) == 64) { 3752 + Npc npc = npcs[k1]; 3753 + if (npc.npcDefinition.boundaryDimension == 1 3754 + && (npc.worldX & 0x7f) == 64 3755 + && (npc.worldY & 0x7f) == 64) { 3755 3756 for (int i2 = 0; i2 < anInt1133; i2++) { 3756 - Npc class50_sub1_sub4_sub3_sub1_1 = npcs[anIntArray1134[i2]]; 3757 - if (class50_sub1_sub4_sub3_sub1_1 != null 3758 - && class50_sub1_sub4_sub3_sub1_1 != class50_sub1_sub4_sub3_sub1 3759 - && class50_sub1_sub4_sub3_sub1_1.npcDefinition.boundaryDimension == 1 3760 - && class50_sub1_sub4_sub3_sub1_1.worldX == class50_sub1_sub4_sub3_sub1.worldX 3761 - && class50_sub1_sub4_sub3_sub1_1.worldY == class50_sub1_sub4_sub3_sub1.worldY) 3762 - method82(class50_sub1_sub4_sub3_sub1_1.npcDefinition, i1, l, anIntArray1134[i2], (byte) -76); 3757 + Npc npc1 = npcs[anIntArray1134[i2]]; 3758 + if (npc1 != null 3759 + && npc1 != npc 3760 + && npc1.npcDefinition.boundaryDimension == 1 3761 + && npc1.worldX == npc.worldX 3762 + && npc1.worldY == npc.worldY) 3763 + method82(npc1.npcDefinition, i1, l, anIntArray1134[i2]); 3763 3764 } 3764 3765 3765 3766 for (int k2 = 0; k2 < localPlayerCount; k2++) { 3766 - Player class50_sub1_sub4_sub3_sub2_1 = players[playerList[k2]]; 3767 - if (class50_sub1_sub4_sub3_sub2_1 != null 3768 - && class50_sub1_sub4_sub3_sub2_1.worldX == class50_sub1_sub4_sub3_sub1.worldX 3769 - && class50_sub1_sub4_sub3_sub2_1.worldY == class50_sub1_sub4_sub3_sub1.worldY) 3770 - method38(playerList[k2], i1, l, class50_sub1_sub4_sub3_sub2_1); 3767 + Player player = players[playerList[k2]]; 3768 + if (player != null 3769 + && player.worldX == npc.worldX 3770 + && player.worldY == npc.worldY) 3771 + method38(playerList[k2], i1, l, player); 3771 3772 } 3772 3773 3773 3774 } 3774 - method82(class50_sub1_sub4_sub3_sub1.npcDefinition, i1, l, k1, (byte) -76); 3775 + method82(npc.npcDefinition, i1, l, k1); 3775 3776 } 3776 3777 if (j1 == 0) { 3777 - Player class50_sub1_sub4_sub3_sub2 = players[k1]; 3778 - if ((class50_sub1_sub4_sub3_sub2.worldX & 0x7f) == 64 3779 - && (class50_sub1_sub4_sub3_sub2.worldY & 0x7f) == 64) { 3778 + Player player1 = players[k1]; 3779 + if ((player1.worldX & 0x7f) == 64 3780 + && (player1.worldY & 0x7f) == 64) { 3780 3781 for (int j2 = 0; j2 < anInt1133; j2++) { 3781 - Npc class50_sub1_sub4_sub3_sub1_2 = npcs[anIntArray1134[j2]]; 3782 - if (class50_sub1_sub4_sub3_sub1_2 != null 3783 - && class50_sub1_sub4_sub3_sub1_2.npcDefinition.boundaryDimension == 1 3784 - && class50_sub1_sub4_sub3_sub1_2.worldX == class50_sub1_sub4_sub3_sub2.worldX 3785 - && class50_sub1_sub4_sub3_sub1_2.worldY == class50_sub1_sub4_sub3_sub2.worldY) 3786 - method82(class50_sub1_sub4_sub3_sub1_2.npcDefinition, i1, l, anIntArray1134[j2], (byte) -76); 3782 + Npc npc = npcs[anIntArray1134[j2]]; 3783 + if (npc != null 3784 + && npc.npcDefinition.boundaryDimension == 1 3785 + && npc.worldX == player1.worldX 3786 + && npc.worldY == player1.worldY) 3787 + method82(npc.npcDefinition, i1, l, anIntArray1134[j2]); 3787 3788 } 3788 3789 3789 3790 for (int l2 = 0; l2 < localPlayerCount; l2++) { 3790 - Player class50_sub1_sub4_sub3_sub2_2 = players[playerList[l2]]; 3791 - if (class50_sub1_sub4_sub3_sub2_2 != null 3792 - && class50_sub1_sub4_sub3_sub2_2 != class50_sub1_sub4_sub3_sub2 3793 - && class50_sub1_sub4_sub3_sub2_2.worldX == class50_sub1_sub4_sub3_sub2.worldX 3794 - && class50_sub1_sub4_sub3_sub2_2.worldY == class50_sub1_sub4_sub3_sub2.worldY) 3795 - method38(playerList[l2], i1, l, class50_sub1_sub4_sub3_sub2_2); 3791 + Player player = players[playerList[l2]]; 3792 + if (player != null 3793 + && player != player1 3794 + && player.worldX == player1.worldX 3795 + && player.worldY == player1.worldY) 3796 + method38(playerList[l2], i1, l, player); 3796 3797 } 3797 3798 3798 3799 } 3799 - method38(k1, i1, l, class50_sub1_sub4_sub3_sub2); 3800 + method38(k1, i1, l, player1); 3800 3801 } 3801 3802 if (j1 == 3) { 3802 - LinkedList class6 = groundItems[plane][l][i1]; 3803 - if (class6 != null) { 3804 - for (Item class50_sub1_sub4_sub1 = (Item) class6.last(); class50_sub1_sub4_sub1 != null; class50_sub1_sub4_sub1 = (Item) class6 3803 + LinkedList itemList = groundItems[plane][l][i1]; 3804 + if (itemList != null) { 3805 + for (Item item = (Item) itemList.last(); item != null; item = (Item) itemList 3805 3806 .previous()) { 3806 - ItemDefinition class16 = ItemDefinition.lookup(class50_sub1_sub4_sub1.itemId); 3807 + ItemDefinition itemDefinition = ItemDefinition.lookup(item.itemId); 3807 3808 if (itemSelected == 1) { 3808 - menuActionTexts[menuActionRow] = "Use " + aString1150 + " with @lre@" + class16.name; 3809 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDefinition.name; 3809 3810 menuActionTypes[menuActionRow] = 100; 3810 - selectedMenuActions[menuActionRow] = class50_sub1_sub4_sub1.itemId; 3811 + selectedMenuActions[menuActionRow] = item.itemId; 3811 3812 firstMenuOperand[menuActionRow] = l; 3812 3813 secondMenuOperand[menuActionRow] = i1; 3813 3814 menuActionRow++; 3814 3815 } else if (widgetSelected == 1) { 3815 3816 if ((anInt1173 & 1) == 1) { 3816 - menuActionTexts[menuActionRow] = selectedWidgetName + " @lre@" + class16.name; 3817 + menuActionTexts[menuActionRow] = selectedWidgetName + " @lre@" + itemDefinition.name; 3817 3818 menuActionTypes[menuActionRow] = 199; 3818 - selectedMenuActions[menuActionRow] = class50_sub1_sub4_sub1.itemId; 3819 + selectedMenuActions[menuActionRow] = item.itemId; 3819 3820 firstMenuOperand[menuActionRow] = l; 3820 3821 secondMenuOperand[menuActionRow] = i1; 3821 3822 menuActionRow++; 3822 3823 } 3823 3824 } else { 3824 3825 for (int i3 = 4; i3 >= 0; i3--) 3825 - if (class16.groundActions != null && class16.groundActions[i3] != null) { 3826 - menuActionTexts[menuActionRow] = class16.groundActions[i3] + " @lre@" + class16.name; 3826 + if (itemDefinition.groundActions != null && itemDefinition.groundActions[i3] != null) { 3827 + menuActionTexts[menuActionRow] = itemDefinition.groundActions[i3] + " @lre@" + itemDefinition.name; 3827 3828 if (i3 == 0) 3828 3829 menuActionTypes[menuActionRow] = 68; 3829 3830 if (i3 == 1) ··· 3834 3835 menuActionTypes[menuActionRow] = 930; 3835 3836 if (i3 == 4) 3836 3837 menuActionTypes[menuActionRow] = 270; 3837 - selectedMenuActions[menuActionRow] = class50_sub1_sub4_sub1.itemId; 3838 + selectedMenuActions[menuActionRow] = item.itemId; 3838 3839 firstMenuOperand[menuActionRow] = l; 3839 3840 secondMenuOperand[menuActionRow] = i1; 3840 3841 menuActionRow++; 3841 3842 } else if (i3 == 2) { 3842 - menuActionTexts[menuActionRow] = "Take @lre@" + class16.name; 3843 + menuActionTexts[menuActionRow] = "Take @lre@" + itemDefinition.name; 3843 3844 menuActionTypes[menuActionRow] = 684; 3844 - selectedMenuActions[menuActionRow] = class50_sub1_sub4_sub1.itemId; 3845 + selectedMenuActions[menuActionRow] = item.itemId; 3845 3846 firstMenuOperand[menuActionRow] = l; 3846 3847 secondMenuOperand[menuActionRow] = i1; 3847 3848 menuActionRow++; 3848 3849 } 3849 3850 3850 - menuActionTexts[menuActionRow] = "Examine @lre@" + class16.name; 3851 + menuActionTexts[menuActionRow] = "Examine @lre@" + itemDefinition.name; 3851 3852 menuActionTypes[menuActionRow] = 1564; 3852 - selectedMenuActions[menuActionRow] = class50_sub1_sub4_sub1.itemId; 3853 + selectedMenuActions[menuActionRow] = item.itemId; 3853 3854 firstMenuOperand[menuActionRow] = l; 3854 3855 secondMenuOperand[menuActionRow] = i1; 3855 3856 menuActionRow++; ··· 3866 3867 Widget.method200(i); 3867 3868 } 3868 3869 3869 - private void method45(int i, int j, int k, int l, int i1, int j1, byte byte0, int k1) { 3870 - if (byte0 != aByte1066) 3871 - anInt1175 = -380; 3870 + private void method45(int i, int j, int k, int l, int i1, int j1, int k1) { 3872 3871 if (j >= 1 && l >= 1 && j <= 102 && l <= 102) { 3873 3872 if (lowMemory && i1 != plane) 3874 3873 return; ··· 3887 3886 int j2 = l2 & 0x1f; 3888 3887 int k2 = l2 >> 6; 3889 3888 if (k1 == 0) { 3890 - currentScene.method258(l, i1, j, true); 3889 + currentScene.removeWallObject(j, l, i1); 3891 3890 GameObjectDefinition class47 = GameObjectDefinition.getDefinition(i2); 3892 3891 if (class47.solid) 3893 3892 currentCollisionMap[i1].unmarkWall(k2, j, l, j2, class47.walkable); 3894 3893 } 3895 3894 if (k1 == 1) 3896 - currentScene.method259(false, j, l, i1); 3895 + currentScene.removeWallDecoration(j, l, i1); 3897 3896 if (k1 == 2) { 3898 - currentScene.method260(l, i1, -779, j); 3897 + currentScene.removeInteractiveObject(j, l, i1); 3899 3898 GameObjectDefinition class47_1 = GameObjectDefinition.getDefinition(i2); 3900 3899 if (j + class47_1.sizeX > 103 || l + class47_1.sizeX > 103 || j + class47_1.sizeY > 103 3901 3900 || l + class47_1.sizeY > 103) ··· 3905 3904 class47_1.sizeX); 3906 3905 } 3907 3906 if (k1 == 3) { 3908 - currentScene.method261(j, l, true, i1); 3907 + currentScene.method261(j, l, i1); 3909 3908 GameObjectDefinition class47_2 = GameObjectDefinition.getDefinition(i2); 3910 3909 if (class47_2.solid && class47_2.actionsBoolean) 3911 3910 currentCollisionMap[i1].unmarkConcealed(j, l); ··· 3916 3915 if (i3 < 3 && (currentSceneTileFlags[1][j][l] & 2) == 2) 3917 3916 i3++; 3918 3917 Region.method165(k, i3, j1, l, currentCollisionMap[i1], i, j, 0, i1, currentScene, 3919 - anIntArrayArrayArray891); 3918 + intGroundArray); 3920 3919 } 3921 3920 } 3922 3921 } ··· 4011 4010 } 4012 4011 4013 4012 4014 - private void method51() { 4013 + private void renderProjectiles() { 4015 4014 Projectile class50_sub1_sub4_sub2 = (Projectile) aClass6_1282.first(); 4016 4015 for (; class50_sub1_sub4_sub2 != null; class50_sub1_sub4_sub2 = (Projectile) aClass6_1282 4017 4016 .next()) ··· 4026 4025 && class50_sub1_sub4_sub3_sub1.worldY >= 0 4027 4026 && class50_sub1_sub4_sub3_sub1.worldY < 13312) 4028 4027 class50_sub1_sub4_sub2.trackTarget(class50_sub1_sub4_sub3_sub1.worldX, 4029 - class50_sub1_sub4_sub3_sub1.worldY, method110( 4030 - class50_sub1_sub4_sub3_sub1.worldY, 4031 - class50_sub1_sub4_sub3_sub1.worldX, (byte) 9, 4032 - class50_sub1_sub4_sub2.sceneId) 4028 + class50_sub1_sub4_sub3_sub1.worldY, getFloorDrawHeight( 4029 + class50_sub1_sub4_sub2.sceneId, class50_sub1_sub4_sub3_sub1.worldX, class50_sub1_sub4_sub3_sub1.worldY 4030 + ) 4033 4031 - class50_sub1_sub4_sub2.endHeight, pulseCycle); 4034 4032 } 4035 4033 if (class50_sub1_sub4_sub2.targetedEntityId < 0) { ··· 4045 4043 && class50_sub1_sub4_sub3_sub2.worldY >= 0 4046 4044 && class50_sub1_sub4_sub3_sub2.worldY < 13312) 4047 4045 class50_sub1_sub4_sub2.trackTarget(class50_sub1_sub4_sub3_sub2.worldX, 4048 - class50_sub1_sub4_sub3_sub2.worldY, method110( 4049 - class50_sub1_sub4_sub3_sub2.worldY, 4050 - class50_sub1_sub4_sub3_sub2.worldX, (byte) 9, 4051 - class50_sub1_sub4_sub2.sceneId) 4046 + class50_sub1_sub4_sub3_sub2.worldY, getFloorDrawHeight( 4047 + class50_sub1_sub4_sub2.sceneId, class50_sub1_sub4_sub3_sub2.worldX, class50_sub1_sub4_sub3_sub2.worldY 4048 + ) 4052 4049 - class50_sub1_sub4_sub2.endHeight, pulseCycle); 4053 4050 } 4054 4051 class50_sub1_sub4_sub2.move(tickDelta); 4055 - currentScene.addEntity(-1, class50_sub1_sub4_sub2, (int) class50_sub1_sub4_sub2.currentX, 4056 - (int) class50_sub1_sub4_sub2.currentHeight, false, 0, plane, 60, 4057 - (int) class50_sub1_sub4_sub2.currentY, class50_sub1_sub4_sub2.anInt1562); 4052 + currentScene.addEntity(plane, (int) class50_sub1_sub4_sub2.currentX, (int) class50_sub1_sub4_sub2.currentY, (int) class50_sub1_sub4_sub2.currentHeight, class50_sub1_sub4_sub2, -1, 4053 + 60, false, 4054 + class50_sub1_sub4_sub2.anInt1562); 4058 4055 } 4059 4056 4060 4057 anInt1168++; ··· 4167 4164 if (meta != 1) { 4168 4165 int x = super.mouseX; 4169 4166 int y = super.mouseY; 4170 - if (anInt1304 == 0) { 4167 + if (menuScreenArea == 0) { 4171 4168 x -= 4; 4172 4169 y -= 4; 4173 4170 } 4174 - if (anInt1304 == 1) { 4171 + if (menuScreenArea == 1) { 4175 4172 x -= 553; 4176 4173 y -= 205; 4177 4174 } 4178 - if (anInt1304 == 2) { 4175 + if (menuScreenArea == 2) { 4179 4176 x -= 17; 4180 4177 y -= 357; 4181 4178 } 4182 - if (x < menuClickX - 10 || x > menuClickX + anInt1307 + 10 || y < menuClickY - 10 4183 - || y > menuClickY + anInt1308 + 10) { 4179 + if (x < menuOffsetX - 10 || x > menuOffsetX + anInt1307 + 10 || y < menuOffsetY - 10 4180 + || y > menuOffsetY + anInt1308 + 10) { 4184 4181 menuOpen = false; 4185 - if (anInt1304 == 1) 4182 + if (menuScreenArea == 1) 4186 4183 redrawTabArea = true; 4187 - if (anInt1304 == 2) 4184 + if (menuScreenArea == 2) 4188 4185 redrawChatbox = true; 4189 4186 } 4190 4187 } 4191 4188 if (meta == 1) { 4192 - int menuX = menuClickX; 4193 - int menuY = menuClickY; 4189 + int menuX = menuOffsetX; 4190 + int menuY = menuOffsetY; 4194 4191 int dx = anInt1307; 4195 4192 int x = super.clickX; 4196 4193 int y = super.clickY; 4197 - if (anInt1304 == 0) { 4194 + if (menuScreenArea == 0) { 4198 4195 x -= 4; 4199 4196 y -= 4; 4200 4197 } 4201 - if (anInt1304 == 1) { 4198 + if (menuScreenArea == 1) { 4202 4199 x -= 553; 4203 4200 y -= 205; 4204 4201 } 4205 - if (anInt1304 == 2) { 4202 + if (menuScreenArea == 2) { 4206 4203 x -= 17; 4207 4204 y -= 357; 4208 4205 } ··· 4216 4213 if (id != -1) 4217 4214 processMenuActions(id); 4218 4215 menuOpen = false; 4219 - if (anInt1304 == 1) 4216 + if (menuScreenArea == 1) 4220 4217 redrawTabArea = true; 4221 - if (anInt1304 == 2) { 4218 + if (menuScreenArea == 2) { 4222 4219 redrawChatbox = true; 4223 4220 return; 4224 4221 } ··· 4299 4296 Rasterizer.drawHorizontalLine(j + 1, i1 + 14 + k1 + j1, 15, anInt1287); 4300 4297 } 4301 4298 4302 - private void method57(int i, boolean flag) { 4299 + private void renderNPCs(int i, boolean flag) { 4303 4300 i = 26 / i; 4304 4301 for (int j = 0; j < anInt1133; j++) { 4305 4302 Npc class50_sub1_sub4_sub3_sub1 = npcs[anIntArray1134[j]]; ··· 4315 4312 if (class50_sub1_sub4_sub3_sub1.boundaryDimension == 1 4316 4313 && (class50_sub1_sub4_sub3_sub1.worldX & 0x7f) == 64 4317 4314 && (class50_sub1_sub4_sub3_sub1.worldY & 0x7f) == 64) { 4318 - if (anIntArrayArray886[l][i1] == anInt1138) 4315 + if (anIntArrayArray886[l][i1] == renderCount) 4319 4316 continue; 4320 - anIntArrayArray886[l][i1] = anInt1138; 4317 + anIntArrayArray886[l][i1] = renderCount; 4321 4318 } 4322 4319 if (!class50_sub1_sub4_sub3_sub1.npcDefinition.clickable) 4323 4320 k += 0x80000000; 4324 - currentScene.addEntity(k, class50_sub1_sub4_sub3_sub1, 4325 - class50_sub1_sub4_sub3_sub1.worldX, method110( 4326 - class50_sub1_sub4_sub3_sub1.worldY, 4327 - class50_sub1_sub4_sub3_sub1.worldX, (byte) 9, plane), 4328 - class50_sub1_sub4_sub3_sub1.aBoolean1592, 0, plane, 4329 - (class50_sub1_sub4_sub3_sub1.boundaryDimension - 1) * 64 + 60, 4330 - class50_sub1_sub4_sub3_sub1.worldY, 4321 + currentScene.addEntity(plane, class50_sub1_sub4_sub3_sub1.worldX, class50_sub1_sub4_sub3_sub1.worldY, getFloorDrawHeight( 4322 + plane, class50_sub1_sub4_sub3_sub1.worldX, class50_sub1_sub4_sub3_sub1.worldY 4323 + ), class50_sub1_sub4_sub3_sub1, k, 4324 + (class50_sub1_sub4_sub3_sub1.boundaryDimension - 1) * 64 + 60, class50_sub1_sub4_sub3_sub1.aBoolean1592, 4331 4325 class50_sub1_sub4_sub3_sub1.anInt1612); 4332 4326 } 4333 4327 ··· 4867 4861 super.imageProducer = null; 4868 4862 chatboxProducingGraphicsBuffer = null; 4869 4863 aClass18_1157 = null; 4870 - aClass18_1156 = null; 4871 - aClass18_1158 = null; 4864 + tabImageProducer = null; 4865 + gameScreenImageProducer = null; 4872 4866 aClass18_1108 = null; 4873 4867 aClass18_1109 = null; 4874 4868 ··· 4919 4913 if (Configuration.JAGGRAB_ENABLED) 4920 4914 requestArchiveCrcs(); 4921 4915 4922 - if(USE_STATIC_DETAILS) { 4916 + if (USE_STATIC_DETAILS) { 4923 4917 username = USERNAME; 4924 4918 password = PASSWORD; 4925 4919 } else { ··· 4942 4936 Archive chatArchive = requestArchive(7, "wordenc", archiveHashes[7], 50, "chat system"); 4943 4937 Archive soundArchive = requestArchive(8, "sounds", archiveHashes[8], 55, "sound effects"); 4944 4938 currentSceneTileFlags = new byte[4][104][104]; 4945 - anIntArrayArrayArray891 = new int[4][105][105]; 4946 - currentScene = new Scene(anIntArrayArrayArray891, 104, 4, 104, (byte) 5); 4939 + intGroundArray = new int[4][105][105]; 4940 + currentScene = new Scene(intGroundArray); 4947 4941 4948 4942 for (int j = 0; j < 4; j++) 4949 4943 currentCollisionMap[j] = new CollisionMap(104, 104); ··· 5331 5325 chatboxLineOffsets = Rasterizer3D.lineOffsets; 5332 5326 5333 5327 Rasterizer3D.method494(190, 261); 5334 - anIntArray1001 = Rasterizer3D.lineOffsets; 5328 + sidebarOffsets = Rasterizer3D.lineOffsets; 5335 5329 5336 5330 Rasterizer3D.method494(512, 334); 5337 - anIntArray1002 = Rasterizer3D.lineOffsets; 5331 + viewportOffsets = Rasterizer3D.lineOffsets; 5338 5332 5339 5333 int ai[] = new int[9]; 5340 5334 ··· 5363 5357 aBoolean1283 = true; 5364 5358 } 5365 5359 5366 - private void method65(int i) { 5360 + private void animateTexture(int i) { 5367 5361 if (!lowMemory) { 5368 5362 for (int k = 0; k < anIntArray1290.length; k++) { 5369 5363 int l = anIntArray1290[k]; ··· 5484 5478 ItemDefinition definition = ItemDefinition.lookup(child.items[l2] - 1); 5485 5479 if (itemSelected == 1 && child.isInventory) { 5486 5480 if (child.id != anInt1148 || l2 != anInt1147) { 5487 - menuActionTexts[menuActionRow] = "Use " + aString1150 + " with @lre@" 5481 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @lre@" 5488 5482 + definition.name; 5489 5483 menuActionTypes[menuActionRow] = 903; 5490 5484 selectedMenuActions[menuActionRow] = definition.id; ··· 5910 5904 private void method74(int i) { 5911 5905 if (anInt1053 != -1 && (loadingStage == 2 || super.imageProducer != null)) { 5912 5906 if (loadingStage == 2) { 5913 - method88(tickDelta, anInt1053, (byte) 5); 5907 + method88(tickDelta, anInt1053); 5914 5908 if (anInt960 != -1) 5915 - method88(tickDelta, anInt960, (byte) 5); 5909 + method88(tickDelta, anInt960); 5916 5910 tickDelta = 0; 5917 5911 method147(anInt1140); 5918 5912 super.imageProducer.createRasterizer(); ··· 5924 5918 class13.width = 765; 5925 5919 class13.height = 503; 5926 5920 } 5927 - method142(0, 0, class13, 0, 8); 5921 + drawInterface(0, 0, class13, 0, 8); 5928 5922 if (anInt960 != -1) { 5929 5923 Widget class13_1 = Widget.forId(anInt960); 5930 5924 if (class13_1.width == 512 && class13_1.height == 334 && class13_1.type == 0) { 5931 5925 class13_1.width = 765; 5932 5926 class13_1.height = 503; 5933 5927 } 5934 - method142(0, 0, class13_1, 0, 8); 5928 + drawInterface(0, 0, class13_1, 0, 8); 5935 5929 } 5936 5930 if (!menuOpen) { 5937 5931 processRightClick(-521); 5938 5932 drawMenuTooltip(); 5939 5933 } else { 5940 - method128(false); 5934 + drawMenu(); 5941 5935 } 5942 5936 } 5943 5937 super.imageProducer.drawGraphics(0, 0, super.gameGraphics); ··· 5958 5952 redrawTabArea = true; 5959 5953 redrawChatbox = true; 5960 5954 aBoolean950 = true; 5961 - aBoolean1212 = true; 5955 + redrawChatMode = true; 5962 5956 if (loadingStage != 2) { 5963 - aClass18_1158.drawGraphics(4, 4, super.gameGraphics); 5957 + gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics); 5964 5958 aClass18_1157.drawGraphics(550, 4, super.gameGraphics); 5965 5959 } 5966 5960 anInt1237++; ··· 5970 5964 } 5971 5965 } 5972 5966 if (loadingStage == 2) 5973 - method151(2); 5974 - if (menuOpen && anInt1304 == 1) 5967 + renderGameView(); 5968 + if (menuOpen && menuScreenArea == 1) 5975 5969 redrawTabArea = true; 5976 5970 if (openInvOverLayId != -1) { 5977 - boolean flag = method88(tickDelta, openInvOverLayId, (byte) 5); 5971 + boolean flag = method88(tickDelta, openInvOverLayId); 5978 5972 if (flag) 5979 5973 redrawTabArea = true; 5980 5974 } ··· 5983 5977 if (activeInterfaceType == 2) 5984 5978 redrawTabArea = true; 5985 5979 if (redrawTabArea) { 5986 - method134((byte) 7); 5980 + method134(); 5987 5981 redrawTabArea = false; 5988 5982 } 5989 5983 if (backDialogueId == -1 && inputType == 0) { ··· 6016 6010 } 6017 6011 } 6018 6012 if (backDialogueId != -1) { 6019 - boolean flag1 = method88(tickDelta, backDialogueId, (byte) 5); 6013 + boolean flag1 = method88(tickDelta, backDialogueId); 6020 6014 if (flag1) 6021 6015 redrawChatbox = true; 6022 6016 } ··· 6026 6020 redrawChatbox = true; 6027 6021 if (clickToContinueString != null) 6028 6022 redrawChatbox = true; 6029 - if (menuOpen && anInt1304 == 2) 6023 + if (menuOpen && menuScreenArea == 2) 6030 6024 redrawChatbox = true; 6031 6025 if (redrawChatbox) { 6032 6026 renderChatbox(); ··· 6039 6033 if (anInt1213 != -1) 6040 6034 aBoolean950 = true; 6041 6035 if (aBoolean950) { 6042 - if (anInt1213 != -1 && anInt1213 == anInt1285) { 6036 + if (anInt1213 != -1 && anInt1213 == currentTabId) { 6043 6037 anInt1213 = -1; 6044 6038 outBuffer.putOpcode(119); 6045 - outBuffer.putByte(anInt1285); 6039 + outBuffer.putByte(currentTabId); 6046 6040 } 6047 6041 aBoolean950 = false; 6048 6042 aClass18_1110.createRasterizer(); 6049 6043 anIndexedImage1054.drawImage(0, 0); 6050 6044 if (openInvOverLayId == -1) { 6051 - if (anIntArray1081[anInt1285] != -1) { 6052 - if (anInt1285 == 0) 6045 + if (tabInterfaceIDs[currentTabId] != -1) { 6046 + if (currentTabId == 0) 6053 6047 aClass50_Sub1_Sub1_Sub3_880.drawImage(22, 10); 6054 - if (anInt1285 == 1) 6048 + if (currentTabId == 1) 6055 6049 aClass50_Sub1_Sub1_Sub3_881.drawImage(54, 8); 6056 - if (anInt1285 == 2) 6050 + if (currentTabId == 2) 6057 6051 aClass50_Sub1_Sub1_Sub3_881.drawImage(82, 8); 6058 - if (anInt1285 == 3) 6052 + if (currentTabId == 3) 6059 6053 aClass50_Sub1_Sub1_Sub3_882.drawImage(110, 8); 6060 - if (anInt1285 == 4) 6054 + if (currentTabId == 4) 6061 6055 aClass50_Sub1_Sub1_Sub3_884.drawImage(153, 8); 6062 - if (anInt1285 == 5) 6056 + if (currentTabId == 5) 6063 6057 aClass50_Sub1_Sub1_Sub3_884.drawImage(181, 8); 6064 - if (anInt1285 == 6) 6058 + if (currentTabId == 6) 6065 6059 aClass50_Sub1_Sub1_Sub3_883.drawImage(209, 9); 6066 6060 } 6067 - if (anIntArray1081[0] != -1 && (anInt1213 != 0 || pulseCycle % 20 < 10)) 6061 + if (tabInterfaceIDs[0] != -1 && (anInt1213 != 0 || pulseCycle % 20 < 10)) 6068 6062 tabIcon[0].drawImage(29, 13); 6069 - if (anIntArray1081[1] != -1 && (anInt1213 != 1 || pulseCycle % 20 < 10)) 6063 + if (tabInterfaceIDs[1] != -1 && (anInt1213 != 1 || pulseCycle % 20 < 10)) 6070 6064 tabIcon[1].drawImage(53, 11); 6071 - if (anIntArray1081[2] != -1 && (anInt1213 != 2 || pulseCycle % 20 < 10)) 6065 + if (tabInterfaceIDs[2] != -1 && (anInt1213 != 2 || pulseCycle % 20 < 10)) 6072 6066 tabIcon[2].drawImage(82, 11); 6073 - if (anIntArray1081[3] != -1 && (anInt1213 != 3 || pulseCycle % 20 < 10)) 6067 + if (tabInterfaceIDs[3] != -1 && (anInt1213 != 3 || pulseCycle % 20 < 10)) 6074 6068 tabIcon[3].drawImage(115, 12); 6075 - if (anIntArray1081[4] != -1 && (anInt1213 != 4 || pulseCycle % 20 < 10)) 6069 + if (tabInterfaceIDs[4] != -1 && (anInt1213 != 4 || pulseCycle % 20 < 10)) 6076 6070 tabIcon[4].drawImage(153, 13); 6077 - if (anIntArray1081[5] != -1 && (anInt1213 != 5 || pulseCycle % 20 < 10)) 6071 + if (tabInterfaceIDs[5] != -1 && (anInt1213 != 5 || pulseCycle % 20 < 10)) 6078 6072 tabIcon[5].drawImage(180, 11); 6079 - if (anIntArray1081[6] != -1 && (anInt1213 != 6 || pulseCycle % 20 < 10)) 6073 + if (tabInterfaceIDs[6] != -1 && (anInt1213 != 6 || pulseCycle % 20 < 10)) 6080 6074 tabIcon[6].drawImage(208, 13); 6081 6075 } 6082 6076 aClass18_1110.drawGraphics(516, 160, super.gameGraphics); 6083 6077 aClass18_1109.createRasterizer(); 6084 6078 anIndexedImage1053.drawImage(0, 0); 6085 6079 if (openInvOverLayId == -1) { 6086 - if (anIntArray1081[anInt1285] != -1) { 6087 - if (anInt1285 == 7) 6080 + if (tabInterfaceIDs[currentTabId] != -1) { 6081 + if (currentTabId == 7) 6088 6082 aClass50_Sub1_Sub1_Sub3_983.drawImage(42, 0); 6089 - if (anInt1285 == 8) 6083 + if (currentTabId == 8) 6090 6084 aClass50_Sub1_Sub1_Sub3_984.drawImage(74, 0); 6091 - if (anInt1285 == 9) 6085 + if (currentTabId == 9) 6092 6086 aClass50_Sub1_Sub1_Sub3_984.drawImage(102, 0); 6093 - if (anInt1285 == 10) 6087 + if (currentTabId == 10) 6094 6088 aClass50_Sub1_Sub1_Sub3_985.drawImage(130, 1); 6095 - if (anInt1285 == 11) 6089 + if (currentTabId == 11) 6096 6090 aClass50_Sub1_Sub1_Sub3_987.drawImage(173, 0); 6097 - if (anInt1285 == 12) 6091 + if (currentTabId == 12) 6098 6092 aClass50_Sub1_Sub1_Sub3_987.drawImage(201, 0); 6099 - if (anInt1285 == 13) 6093 + if (currentTabId == 13) 6100 6094 aClass50_Sub1_Sub1_Sub3_986.drawImage(229, 0); 6101 6095 } 6102 - if (anIntArray1081[8] != -1 && (anInt1213 != 8 || pulseCycle % 20 < 10)) 6096 + if (tabInterfaceIDs[8] != -1 && (anInt1213 != 8 || pulseCycle % 20 < 10)) 6103 6097 tabIcon[7].drawImage(74, 2); 6104 - if (anIntArray1081[9] != -1 && (anInt1213 != 9 || pulseCycle % 20 < 10)) 6098 + if (tabInterfaceIDs[9] != -1 && (anInt1213 != 9 || pulseCycle % 20 < 10)) 6105 6099 tabIcon[8].drawImage(102, 3); 6106 - if (anIntArray1081[10] != -1 && (anInt1213 != 10 || pulseCycle % 20 < 10)) 6100 + if (tabInterfaceIDs[10] != -1 && (anInt1213 != 10 || pulseCycle % 20 < 10)) 6107 6101 tabIcon[9].drawImage(137, 4); 6108 - if (anIntArray1081[11] != -1 && (anInt1213 != 11 || pulseCycle % 20 < 10)) 6102 + if (tabInterfaceIDs[11] != -1 && (anInt1213 != 11 || pulseCycle % 20 < 10)) 6109 6103 tabIcon[10].drawImage(174, 2); 6110 - if (anIntArray1081[12] != -1 && (anInt1213 != 12 || pulseCycle % 20 < 10)) 6104 + if (tabInterfaceIDs[12] != -1 && (anInt1213 != 12 || pulseCycle % 20 < 10)) 6111 6105 tabIcon[11].drawImage(201, 2); 6112 - if (anIntArray1081[13] != -1 && (anInt1213 != 13 || pulseCycle % 20 < 10)) 6106 + if (tabInterfaceIDs[13] != -1 && (anInt1213 != 13 || pulseCycle % 20 < 10)) 6113 6107 tabIcon[12].drawImage(226, 2); 6114 6108 } 6115 6109 aClass18_1109.drawGraphics(496, 466, super.gameGraphics); 6116 - aClass18_1158.createRasterizer(); 6117 - Rasterizer3D.lineOffsets = anIntArray1002; 6110 + gameScreenImageProducer.createRasterizer(); 6111 + Rasterizer3D.lineOffsets = viewportOffsets; 6118 6112 } 6119 - if (aBoolean1212) { 6120 - aBoolean1212 = false; 6113 + if (redrawChatMode) { 6114 + redrawChatMode = false; 6121 6115 aClass18_1108.createRasterizer(); 6122 6116 anIndexedImage1052.drawImage(0, 0); 6123 6117 fontNormal.drawStringCenter("Public chat", 55, 28, 0xffffff, true); ··· 6145 6139 fontNormal.drawStringCenter("Off", 324, 41, 0xff0000, true); 6146 6140 fontNormal.drawStringCenter("Report abuse", 458, 33, 0xffffff, true); 6147 6141 aClass18_1108.drawGraphics(0, 453, super.gameGraphics); 6148 - aClass18_1158.createRasterizer(); 6149 - Rasterizer3D.lineOffsets = anIntArray1002; 6142 + gameScreenImageProducer.createRasterizer(); 6143 + Rasterizer3D.lineOffsets = viewportOffsets; 6150 6144 } 6151 6145 tickDelta = 0; 6152 6146 if (i != 7) { ··· 6245 6239 initializeApplet(765, 503); 6246 6240 } 6247 6241 6248 - private void method76(int i) { 6242 + private void renderStationaryGraphics(int i) { 6249 6243 while (i >= 0) 6250 6244 groundItems = null; 6251 6245 for (GameAnimableObject gameAnimableObject = (GameAnimableObject) aClass6_1210.first(); gameAnimableObject != null; gameAnimableObject = (GameAnimableObject) aClass6_1210 ··· 6257 6251 if (gameAnimableObject.transformCompleted) 6258 6252 gameAnimableObject.remove(); 6259 6253 else 6260 - currentScene.addEntity(-1, gameAnimableObject, gameAnimableObject.x, 6261 - gameAnimableObject.z, false, 0, gameAnimableObject.plane, 60, 6262 - gameAnimableObject.y, 0); 6254 + currentScene.addEntity(gameAnimableObject.plane, gameAnimableObject.x, gameAnimableObject.y, gameAnimableObject.z, gameAnimableObject, -1, 6255 + 60, false, 6256 + 0); 6263 6257 } 6264 6258 6265 6259 } ··· 6286 6280 if (class50_sub1_sub3.type == 2 && class50_sub1_sub3.id == nextSong && class50_sub1_sub3.buffer != null) 6287 6281 method24(songChanging, class50_sub1_sub3.buffer, 659); 6288 6282 if (class50_sub1_sub3.type == 3 && loadingStage == 1) { 6289 - for (int i = 0; i < aByteArrayArray838.length; i++) { 6290 - if (anIntArray857[i] == class50_sub1_sub3.id) { 6291 - aByteArrayArray838[i] = class50_sub1_sub3.buffer; 6283 + for (int i = 0; i < terrainData.length; i++) { 6284 + if (terrainDataIds[i] == class50_sub1_sub3.id) { 6285 + terrainData[i] = class50_sub1_sub3.buffer; 6292 6286 if (class50_sub1_sub3.buffer == null) 6293 - anIntArray857[i] = -1; 6287 + terrainDataIds[i] = -1; 6294 6288 break; 6295 6289 } 6296 - if (anIntArray858[i] != class50_sub1_sub3.id) 6290 + if (objectDataIds[i] != class50_sub1_sub3.id) 6297 6291 continue; 6298 - aByteArrayArray1232[i] = class50_sub1_sub3.buffer; 6292 + objectData[i] = class50_sub1_sub3.buffer; 6299 6293 if (class50_sub1_sub3.buffer == null) 6300 - anIntArray858[i] = -1; 6294 + objectDataIds[i] = -1; 6301 6295 break; 6302 6296 } 6303 6297 ··· 6431 6425 currentSound = 0; 6432 6426 anInt853 = (int) (Math.random() * 100D) - 50; 6433 6427 anInt1009 = (int) (Math.random() * 110D) - 55; 6434 - anInt1255 = (int) (Math.random() * 80D) - 40; 6428 + cameraRandomisationA = (int) (Math.random() * 80D) - 40; 6435 6429 anInt916 = (int) (Math.random() * 120D) - 60; 6436 6430 anInt1233 = (int) (Math.random() * 30D) - 20; 6437 6431 cameraHorizontal = (int) (Math.random() * 20D) - 10 & 0x7ff; ··· 6462 6456 } 6463 6457 } 6464 6458 6465 - aClass6_1261 = new LinkedList(); 6459 + spawnObjectList = new LinkedList(); 6466 6460 friendListStatus = 0; 6467 6461 friendsCount = 0; 6468 6462 ··· 6484 6478 method44(openInvOverLayId); 6485 6479 openInvOverLayId = -1; 6486 6480 6487 - method44(anInt1279); 6488 - anInt1279 = -1; 6481 + method44(walkableWidgetId); 6482 + walkableWidgetId = -1; 6489 6483 6490 6484 aBoolean1239 = false; 6491 - anInt1285 = 3; 6485 + currentTabId = 3; 6492 6486 inputType = 0; 6493 6487 menuOpen = false; 6494 6488 messagePromptRaised = false; ··· 6736 6730 walk(true, false, dstY, localPlayer.pathY[0], 0, 0, 2, objectType + 1, dstX, 0, l1, 6737 6731 localPlayer.pathX[0]); 6738 6732 } 6739 - anInt1020 = super.clickX; 6740 - anInt1021 = super.clickY; 6733 + lastClickX = super.clickX; 6734 + lastClickY = super.clickY; 6741 6735 crossType = 2; 6742 6736 crossIndex = 0; 6743 6737 packetSize += j; ··· 6809 6803 } 6810 6804 } 6811 6805 6812 - private void method82(ActorDefinition class37, int i, int j, int k, byte byte0) { 6813 - if (byte0 != -76) 6814 - groundItems = null; 6806 + private void method82(ActorDefinition actorDefinition, int i, int j, int k) { 6815 6807 if (menuActionRow >= 400) 6816 6808 return; 6817 - if (class37.childrenIds != null) 6818 - class37 = class37.getChildDefinition(); 6819 - if (class37 == null) 6809 + if (actorDefinition.childrenIds != null) 6810 + actorDefinition = actorDefinition.getChildDefinition(); 6811 + if (actorDefinition == null) 6820 6812 return; 6821 - if (!class37.clickable) 6813 + if (!actorDefinition.clickable) 6822 6814 return; 6823 - String s = class37.name; 6824 - if (class37.combatLevel != 0) 6825 - s = s + getCombatLevelColour(localPlayer.combatLevel, class37.combatLevel) + " (level-" + class37.combatLevel + ")"; 6815 + String s = actorDefinition.name; 6816 + if (actorDefinition.combatLevel != 0) 6817 + s = s + getCombatLevelColour(localPlayer.combatLevel, actorDefinition.combatLevel) + " (level-" + actorDefinition.combatLevel + ")"; 6826 6818 if (itemSelected == 1) { 6827 - menuActionTexts[menuActionRow] = "Use " + aString1150 + " with @yel@" + s; 6819 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s; 6828 6820 menuActionTypes[menuActionRow] = 347; 6829 6821 selectedMenuActions[menuActionRow] = k; 6830 6822 firstMenuOperand[menuActionRow] = j; ··· 6843 6835 return; 6844 6836 } 6845 6837 } else { 6846 - if (class37.actions != null) { 6838 + if (actorDefinition.actions != null) { 6847 6839 for (int l = 4; l >= 0; l--) 6848 - if (class37.actions[l] != null && !class37.actions[l].equalsIgnoreCase("attack")) { 6849 - menuActionTexts[menuActionRow] = class37.actions[l] + " @yel@" + s; 6840 + if (actorDefinition.actions[l] != null && !actorDefinition.actions[l].equalsIgnoreCase("attack")) { 6841 + menuActionTexts[menuActionRow] = actorDefinition.actions[l] + " @yel@" + s; 6850 6842 if (l == 0) 6851 6843 menuActionTypes[menuActionRow] = 318; 6852 6844 if (l == 1) ··· 6864 6856 } 6865 6857 6866 6858 } 6867 - if (class37.actions != null) { 6859 + if (actorDefinition.actions != null) { 6868 6860 for (int i1 = 4; i1 >= 0; i1--) 6869 - if (class37.actions[i1] != null && class37.actions[i1].equalsIgnoreCase("attack")) { 6861 + if (actorDefinition.actions[i1] != null && actorDefinition.actions[i1].equalsIgnoreCase("attack")) { 6870 6862 char c = '\0'; 6871 - if (class37.combatLevel > localPlayer.combatLevel) 6863 + if (actorDefinition.combatLevel > localPlayer.combatLevel) 6872 6864 c = '\u07D0'; 6873 - menuActionTexts[menuActionRow] = class37.actions[i1] + " @yel@" + s; 6865 + menuActionTexts[menuActionRow] = actorDefinition.actions[i1] + " @yel@" + s; 6874 6866 if (i1 == 0) 6875 6867 menuActionTypes[menuActionRow] = 318 + c; 6876 6868 if (i1 == 1) ··· 6987 6979 fontBold.drawStringLeft(clickToContinueString, 239, 40, 0); 6988 6980 fontBold.drawStringLeft("Click to continue", 239, 60, 128); 6989 6981 } else if (backDialogueId != -1) { 6990 - method142(0, 0, Widget.forId(backDialogueId), 0, 8); 6982 + drawInterface(0, 0, Widget.forId(backDialogueId), 0, 8); 6991 6983 } else if (dialogueId != -1) { 6992 - method142(0, 0, Widget.forId(dialogueId), 0, 8); 6984 + drawInterface(0, 0, Widget.forId(dialogueId), 0, 8); 6993 6985 } else { 6994 6986 TypeFace typeFace = fontNormal; 6995 6987 int line = 0; ··· 7126 7118 Rasterizer.drawHorizontalLine(0, 77, 479, 0); 7127 7119 } 7128 7120 7129 - if (menuOpen && anInt1304 == 2) 7130 - method128(false); 7121 + if (menuOpen && menuScreenArea == 2) 7122 + drawMenu(); 7131 7123 7132 7124 chatboxProducingGraphicsBuffer.drawGraphics(17, 357, super.gameGraphics); 7133 - aClass18_1158.createRasterizer(); 7125 + gameScreenImageProducer.createRasterizer(); 7134 7126 7135 - Rasterizer3D.lineOffsets = anIntArray1002; 7127 + Rasterizer3D.lineOffsets = viewportOffsets; 7136 7128 } 7137 7129 7138 7130 private void processActorOverheadText() { ··· 7247 7239 7248 7240 minimapCompass.shapeImageToPixels(0, 33, 25, 33, anIntArray1286, 0, cameraHorizontal, 256, 7249 7241 anIntArray1180, 25); 7250 - aClass18_1158.createRasterizer(); 7242 + gameScreenImageProducer.createRasterizer(); 7251 7243 7252 - Rasterizer3D.lineOffsets = anIntArray1002; 7244 + Rasterizer3D.lineOffsets = viewportOffsets; 7253 7245 return; 7254 7246 } 7255 7247 ··· 7370 7362 } 7371 7363 7372 7364 Rasterizer.drawFilledRectangle(97, 78, 3, 3, 0xffffff); 7373 - aClass18_1158.createRasterizer(); 7365 + gameScreenImageProducer.createRasterizer(); 7374 7366 7375 - Rasterizer3D.lineOffsets = anIntArray1002; 7367 + Rasterizer3D.lineOffsets = viewportOffsets; 7376 7368 } 7377 7369 7378 7370 public URL getCodeBase() { ··· 7388 7380 return super.getCodeBase(); 7389 7381 } 7390 7382 7391 - private boolean method88(int i, int j, byte byte0) { 7383 + private boolean method88(int tickDelta, int interfaceId) { 7392 7384 boolean flag = false; 7393 - Widget class13 = Widget.forId(j); 7394 - for (int k = 0; k < class13.children.length; k++) { 7395 - if (class13.children[k] == -1) 7385 + Widget widget = Widget.forId(interfaceId); 7386 + for (int k = 0; k < widget.children.length; k++) { 7387 + if (widget.children[k] == -1) 7396 7388 break; 7397 - Widget class13_1 = Widget.forId(class13.children[k]); 7398 - if (class13_1.type == 0) 7399 - flag |= method88(i, class13_1.id, (byte) 5); 7400 - if (class13_1.type == 6 && (class13_1.disabledAnimation != -1 || class13_1.enabledAnimation != -1)) { 7401 - boolean flag1 = method95(class13_1, -693); 7402 - int i1; 7389 + Widget widgetChild = Widget.forId(widget.children[k]); 7390 + if (widgetChild.type == 0) 7391 + flag |= method88(tickDelta, widgetChild.id); 7392 + if (widgetChild.type == 6 && (widgetChild.disabledAnimation != -1 || widgetChild.enabledAnimation != -1)) { 7393 + boolean flag1 = method95(widgetChild); 7394 + int enabledState; 7403 7395 if (flag1) 7404 - i1 = class13_1.enabledAnimation; 7396 + enabledState = widgetChild.enabledAnimation; 7405 7397 else 7406 - i1 = class13_1.disabledAnimation; 7407 - if (i1 != -1) { 7408 - AnimationSequence class14 = AnimationSequence.animations[i1]; 7409 - for (class13_1.anInt227 += i; class13_1.anInt227 > class14.getFrameLength(class13_1.anInt235); ) { 7410 - class13_1.anInt227 -= class14.getFrameLength(class13_1.anInt235); 7411 - class13_1.anInt235++; 7412 - if (class13_1.anInt235 >= class14.frameCount) { 7413 - class13_1.anInt235 -= class14.frameStep; 7414 - if (class13_1.anInt235 < 0 || class13_1.anInt235 >= class14.frameCount) 7415 - class13_1.anInt235 = 0; 7398 + enabledState = widgetChild.disabledAnimation; 7399 + if (enabledState != -1) { 7400 + AnimationSequence animationSequence = AnimationSequence.animations[enabledState]; 7401 + for (widgetChild.animationDuration += tickDelta; widgetChild.animationDuration > animationSequence.getFrameLength(widgetChild.animationFrame); ) { 7402 + widgetChild.animationDuration -= animationSequence.getFrameLength(widgetChild.animationFrame); 7403 + widgetChild.animationFrame++; 7404 + if (widgetChild.animationFrame >= animationSequence.frameCount) { 7405 + widgetChild.animationFrame -= animationSequence.frameStep; 7406 + if (widgetChild.animationFrame < 0 || widgetChild.animationFrame >= animationSequence.frameCount) 7407 + widgetChild.animationFrame = 0; 7416 7408 } 7417 7409 flag = true; 7418 7410 } 7419 7411 7420 7412 } 7421 7413 } 7422 - if (class13_1.type == 6 && class13_1.anInt218 != 0) { 7423 - int l = class13_1.anInt218 >> 16; 7424 - int j1 = (class13_1.anInt218 << 16) >> 16; 7425 - l *= i; 7426 - j1 *= i; 7427 - class13_1.rotationX = class13_1.rotationX + l & 0x7ff; 7428 - class13_1.rotationY = class13_1.rotationY + j1 & 0x7ff; 7414 + if (widgetChild.type == 6 && widgetChild.anInt218 != 0) { 7415 + int l = widgetChild.anInt218 >> 16; 7416 + int j1 = (widgetChild.anInt218 << 16) >> 16; 7417 + l *= tickDelta; 7418 + j1 *= tickDelta; 7419 + widgetChild.rotationX = widgetChild.rotationX + l & 0x7ff; 7420 + widgetChild.rotationY = widgetChild.rotationY + j1 & 0x7ff; 7429 7421 flag = true; 7430 7422 } 7431 7423 } 7432 7424 7433 - if (byte0 == 5) 7434 - byte0 = 0; 7435 - else 7436 - anInt1236 = -424; 7437 7425 return flag; 7438 7426 } 7439 7427 ··· 7492 7480 if (super.mouseX > 553 && super.mouseY > 205 && super.mouseX < 743 && super.mouseY < 466) 7493 7481 if (openInvOverLayId != -1) 7494 7482 method66(205, Widget.forId(openInvOverLayId), 1, 0, 553, super.mouseX, 23658, super.mouseY); 7495 - else if (anIntArray1081[anInt1285] != -1) 7496 - method66(205, Widget.forId(anIntArray1081[anInt1285]), 1, 0, 553, super.mouseX, 23658, 7483 + else if (tabInterfaceIDs[currentTabId] != -1) 7484 + method66(205, Widget.forId(tabInterfaceIDs[currentTabId]), 1, 0, 553, super.mouseX, 23658, 7497 7485 super.mouseY); 7498 7486 if (anInt915 != anInt1280) { 7499 7487 redrawTabArea = true; ··· 7554 7542 aClass6_1282.getNodeCount(); 7555 7543 Rasterizer3D.method495((byte) 71); 7556 7544 resetModelCaches(); 7557 - currentScene.method241(); 7545 + currentScene.initToNull(); 7558 7546 System.gc(); 7559 7547 for (int plane = 0; plane < 4; plane++) 7560 7548 currentCollisionMap[plane].reset(); ··· 7568 7556 7569 7557 } 7570 7558 7571 - Region class8 = new Region(currentSceneTileFlags, 104, 104, anIntArrayArrayArray891); 7572 - int l2 = aByteArrayArray838.length; 7559 + Region region = new Region(currentSceneTileFlags, 104, 104, intGroundArray); 7560 + int l2 = terrainData.length; 7573 7561 outBuffer.putOpcode(40); 7574 7562 if (!aBoolean1163) { 7575 7563 for (int j3 = 0; j3 < l2; j3++) { 7576 - int j4 = (coordinates[j3] >> 8) * 64 - nextTopLeftTileX; 7577 - int l5 = (coordinates[j3] & 0xff) * 64 - nextTopRightTileY; 7578 - byte abyte0[] = aByteArrayArray838[j3]; 7564 + int j4 = (mapCoordinates[j3] >> 8) * 64 - nextTopLeftTileX; 7565 + int l5 = (mapCoordinates[j3] & 0xff) * 64 - nextTopRightTileY; 7566 + byte abyte0[] = terrainData[j3]; 7579 7567 if (abyte0 != null) 7580 - class8.method174(l5, false, (chunkY - 6) * 8, j4, abyte0, (chunkX - 6) * 8, 7568 + region.method174(l5, false, (chunkY - 6) * 8, j4, abyte0, (chunkX - 6) * 8, 7581 7569 currentCollisionMap); 7582 7570 } 7583 7571 7584 7572 for (int k4 = 0; k4 < l2; k4++) { 7585 - int i6 = (coordinates[k4] >> 8) * 64 - nextTopLeftTileX; 7586 - int l7 = (coordinates[k4] & 0xff) * 64 - nextTopRightTileY; 7587 - byte abyte2[] = aByteArrayArray838[k4]; 7573 + int i6 = (mapCoordinates[k4] >> 8) * 64 - nextTopLeftTileX; 7574 + int l7 = (mapCoordinates[k4] & 0xff) * 64 - nextTopRightTileY; 7575 + byte abyte2[] = terrainData[k4]; 7588 7576 if (abyte2 == null && chunkY < 800) 7589 - class8.initiateVertexHeights(i6, 64, l7, 64); 7577 + region.initiateVertexHeights(i6, 64, l7, 64); 7590 7578 } 7591 7579 7592 7580 outBuffer.putOpcode(40); 7593 7581 for (int j6 = 0; j6 < l2; j6++) { 7594 - byte abyte1[] = aByteArrayArray1232[j6]; 7582 + byte abyte1[] = objectData[j6]; 7595 7583 if (abyte1 != null) { 7596 - int l8 = (coordinates[j6] >> 8) * 64 - nextTopLeftTileX; 7597 - int k9 = (coordinates[j6] & 0xff) * 64 - nextTopRightTileY; 7598 - class8.method179(k9, currentCollisionMap, l8, -571, currentScene, abyte1); 7584 + int l8 = (mapCoordinates[j6] >> 8) * 64 - nextTopLeftTileX; 7585 + int k9 = (mapCoordinates[j6] & 0xff) * 64 - nextTopRightTileY; 7586 + region.method179(k9, currentCollisionMap, l8, -571, currentScene, abyte1); 7599 7587 } 7600 7588 } 7601 7589 ··· 7612 7600 int l10 = i9 >> 14 & 0x3ff; 7613 7601 int j11 = i9 >> 3 & 0x7ff; 7614 7602 int l11 = (l10 / 8 << 8) + j11 / 8; 7615 - for (int j12 = 0; j12 < coordinates.length; j12++) { 7616 - if (coordinates[j12] != l11 || aByteArrayArray838[j12] == null) 7603 + for (int j12 = 0; j12 < mapCoordinates.length; j12++) { 7604 + if (mapCoordinates[j12] != l11 || terrainData[j12] == null) 7617 7605 continue; 7618 - class8.method168(j10, (j11 & 7) * 8, false, aByteArrayArray838[j12], k3, l9, 7606 + region.method168(j10, (j11 & 7) * 8, false, terrainData[j12], k3, l9, 7619 7607 l4 * 8, currentCollisionMap, k6 * 8, (l10 & 7) * 8); 7620 7608 flag = true; 7621 7609 break; ··· 7623 7611 7624 7612 } 7625 7613 if (!flag) 7626 - class8.method166(anInt1072, k3, k6 * 8, l4 * 8); 7614 + region.method166(anInt1072, k3, k6 * 8, l4 * 8); 7627 7615 } 7628 7616 7629 7617 } ··· 7634 7622 for (int l6 = 0; l6 < 13; l6++) { 7635 7623 int i8 = constructedMapPalette[0][i5][l6]; 7636 7624 if (i8 == -1) 7637 - class8.initiateVertexHeights(i5 * 8, 8, l6 * 8, 8); 7625 + region.initiateVertexHeights(i5 * 8, 8, l6 * 8, 8); 7638 7626 } 7639 7627 7640 7628 } ··· 7650 7638 int k11 = i10 >> 14 & 0x3ff; 7651 7639 int i12 = i10 >> 3 & 0x7ff; 7652 7640 int k12 = (k11 / 8 << 8) + i12 / 8; 7653 - for (int l12 = 0; l12 < coordinates.length; l12++) { 7654 - if (coordinates[l12] != k12 || aByteArrayArray1232[l12] == null) 7641 + for (int l12 = 0; l12 < mapCoordinates.length; l12++) { 7642 + if (mapCoordinates[l12] != k12 || objectData[l12] == null) 7655 7643 continue; 7656 - class8.method172(i7, currentCollisionMap, currentScene, false, 7657 - aByteArrayArray1232[l12], j9 * 8, i11, (k11 & 7) * 8, j8 * 8, 7644 + region.method172(i7, currentCollisionMap, currentScene, false, 7645 + objectData[l12], j9 * 8, i11, (k11 & 7) * 8, j8 * 8, 7658 7646 (i12 & 7) * 8, k10); 7659 7647 break; 7660 7648 } ··· 7668 7656 7669 7657 } 7670 7658 outBuffer.putOpcode(40); 7671 - class8.createRegionScene(currentCollisionMap, currentScene); 7672 - if (aClass18_1158 != null) { 7673 - aClass18_1158.createRasterizer(); 7674 - Rasterizer3D.lineOffsets = anIntArray1002; 7659 + region.createRegionScene(currentCollisionMap, currentScene); 7660 + if (gameScreenImageProducer != null) { 7661 + gameScreenImageProducer.createRasterizer(); 7662 + Rasterizer3D.lineOffsets = viewportOffsets; 7675 7663 } 7676 7664 outBuffer.putOpcode(40); 7677 7665 int l3 = Region.lowestPlane; ··· 7680 7668 if (l3 < plane - 1) 7681 7669 l3 = plane - 1; 7682 7670 if (lowMemory) 7683 - currentScene.method242(Region.lowestPlane); 7671 + currentScene.setHeightLevel(Region.lowestPlane); 7684 7672 else 7685 - currentScene.method242(0); 7673 + currentScene.setHeightLevel(0); 7686 7674 for (int j5 = 0; j5 < 104; j5++) { 7687 7675 for (int j7 = 0; j7 < 104; j7++) 7688 7676 processGroundItems(j5, j7); ··· 7761 7749 cameraX = x - xOffset; 7762 7750 cameraZ = z - zOffset; 7763 7751 cameraY = y - yOffset; 7764 - anInt1219 = pitch; 7765 - anInt1220 = yaw; 7752 + cameraVerticalRotation = pitch; 7753 + cameraHorizontalRotation = yaw; 7766 7754 } 7767 7755 7768 - private boolean method95(Widget class13, int i) { 7769 - if (i >= 0) 7770 - anInt1175 = 276; 7771 - if (class13.conditionTypes == null) 7756 + private boolean method95(Widget widget) { 7757 + if (widget.conditionTypes == null) 7772 7758 return false; 7773 - for (int j = 0; j < class13.conditionTypes.length; j++) { 7774 - int k = method129(3, j, class13); 7775 - int l = class13.conditionValues[j]; 7776 - if (class13.conditionTypes[j] == 2) { 7759 + for (int j = 0; j < widget.conditionTypes.length; j++) { 7760 + int k = method129(3, j, widget); 7761 + int l = widget.conditionValues[j]; 7762 + if (widget.conditionTypes[j] == 2) { 7777 7763 if (k >= l) 7778 7764 return false; 7779 - } else if (class13.conditionTypes[j] == 3) { 7765 + } else if (widget.conditionTypes[j] == 3) { 7780 7766 if (k <= l) 7781 7767 return false; 7782 - } else if (class13.conditionTypes[j] == 4) { 7768 + } else if (widget.conditionTypes[j] == 4) { 7783 7769 if (k == l) 7784 7770 return false; 7785 7771 } else if (k != l) ··· 7818 7804 } 7819 7805 } 7820 7806 7821 - private void removeIgnore(int i, long l) { 7807 + private void removeIgnore(long l) { 7822 7808 try { 7823 7809 if (l == 0L) 7824 7810 return; 7825 - for (int j = 0; j < ignoresCount; j++) { 7826 - if (ignores[j] != l) 7811 + for (int i = 0; i < ignoresCount; i++) { 7812 + if (ignores[i] != l) 7827 7813 continue; 7828 7814 ignoresCount--; 7829 7815 redrawTabArea = true; 7830 - for (int k = j; k < ignoresCount; k++) 7831 - ignores[k] = ignores[k + 1]; 7816 + for (int j = i; j < ignoresCount; j++) 7817 + ignores[j] = ignores[j + 1]; 7832 7818 7833 7819 outBuffer.putOpcode(160); 7834 7820 outBuffer.putLong(l); 7835 7821 break; 7836 7822 } 7837 7823 7838 - i = 42 / i; 7839 7824 return; 7840 7825 } catch (RuntimeException runtimeexception) { 7841 - SignLink.reportError("45745, " + i + ", " + l + ", " + runtimeexception.toString()); 7826 + SignLink.reportError("45745, " + 325 + ", " + l + ", " + runtimeexception.toString()); 7842 7827 } 7843 7828 throw new RuntimeException(); 7844 7829 } ··· 8372 8357 y = 0; 8373 8358 8374 8359 menuOpen = true; 8375 - anInt1304 = 0; 8376 - menuClickX = x; 8377 - menuClickY = y; 8360 + menuScreenArea = 0; 8361 + menuOffsetX = x; 8362 + menuOffsetY = y; 8378 8363 anInt1307 = width; 8379 8364 anInt1308 = height + 1; 8380 8365 } ··· 8395 8380 y = 261 - height; 8396 8381 8397 8382 menuOpen = true; 8398 - anInt1304 = 1; 8399 - menuClickX = x; 8400 - menuClickY = y; 8383 + menuScreenArea = 1; 8384 + menuOffsetX = x; 8385 + menuOffsetY = y; 8401 8386 anInt1307 = width; 8402 8387 anInt1308 = height + 1; 8403 8388 } ··· 8418 8403 y = 96 - height; 8419 8404 8420 8405 menuOpen = true; 8421 - anInt1304 = 2; 8422 - menuClickX = x; 8423 - menuClickY = y; 8406 + menuScreenArea = 2; 8407 + menuOffsetX = x; 8408 + menuOffsetY = y; 8424 8409 anInt1307 = width; 8425 8410 anInt1308 = height + 1; 8426 8411 } 8427 8412 } 8428 8413 8429 - private void renderGameView() { 8414 + private void draw3dScreen() { 8430 8415 renderSplitPrivateMessages(); 8431 8416 8432 8417 if (crossType == 1) 8433 - cursorCross[crossIndex / 100].drawImage(anInt1021 - 8 - 4, anInt1020 - 8 - 4); 8418 + cursorCross[crossIndex / 100].drawImage(lastClickX - 8 - 4, lastClickY - 8 - 4); 8434 8419 if (crossType == 2) 8435 - cursorCross[4 + crossIndex / 100].drawImage(anInt1021 - 8 - 4, anInt1020 - 8 - 4); 8420 + cursorCross[4 + crossIndex / 100].drawImage(lastClickX - 8 - 4, lastClickY - 8 - 4); 8436 8421 8437 - if (anInt1279 != -1) { 8438 - method88(tickDelta, anInt1279, (byte) 5); 8439 - method142(0, 0, Widget.forId(anInt1279), 0, 8); 8422 + if (walkableWidgetId != -1) { 8423 + method88(tickDelta, walkableWidgetId); 8424 + drawInterface(0, 0, Widget.forId(walkableWidgetId), 0, 8); 8440 8425 } 8441 8426 8442 8427 if (openInterfaceId != -1) { 8443 - method88(tickDelta, openInterfaceId, (byte) 5); 8444 - method142(0, 0, Widget.forId(openInterfaceId), 0, 8); 8428 + method88(tickDelta, openInterfaceId); 8429 + drawInterface(0, 0, Widget.forId(openInterfaceId), 0, 8); 8445 8430 } 8446 8431 8447 8432 setTutorialIslandFlag(); ··· 8449 8434 if (!menuOpen) { 8450 8435 processRightClick(-521); 8451 8436 drawMenuTooltip(); 8452 - } else if (anInt1304 == 0) { 8453 - method128(false); 8437 + } else if (menuScreenArea == 0) { 8438 + drawMenu(); 8454 8439 } 8455 8440 8456 8441 if (anInt1319 == 1) 8457 - aClass50_Sub1_Sub1_Sub1_1086.drawImage(296, 472); 8442 + aClass50_Sub1_Sub1_Sub1_1086.drawImage(472, 296); 8458 8443 8459 8444 if (fps) { 8460 8445 int y = 20; ··· 8508 8493 } 8509 8494 } 8510 8495 8511 - private int method110(int i, int j, byte byte0, int k) { 8512 - int l = j >> 7; 8513 - int i1 = i >> 7; 8514 - if (l < 0 || i1 < 0 || l > 103 || i1 > 103) 8496 + private int getFloorDrawHeight(int plane, int x, int y) { 8497 + int groundX = x >> 7; 8498 + int groundY = y >> 7; 8499 + if (groundX < 0 || groundY < 0 || groundX > 103 || groundY > 103) 8515 8500 return 0; 8516 - int j1 = k; 8517 - if (j1 < 3 && (currentSceneTileFlags[1][l][i1] & 2) == 2) 8518 - j1++; 8519 - int k1 = j & 0x7f; 8520 - int l1 = i & 0x7f; 8521 - if (byte0 != 9) 8522 - aBoolean953 = !aBoolean953; 8523 - int i2 = anIntArrayArrayArray891[j1][l][i1] * (128 - k1) + anIntArrayArrayArray891[j1][l + 1][i1] * k1 >> 7; 8524 - int j2 = anIntArrayArrayArray891[j1][l][i1 + 1] * (128 - k1) + anIntArrayArrayArray891[j1][l + 1][i1 + 1] * k1 >> 7; 8525 - return i2 * (128 - l1) + j2 * l1 >> 7; 8501 + int groundZ = plane; 8502 + if (groundZ < 3 && (currentSceneTileFlags[1][groundX][groundY] & 2) == 2) 8503 + groundZ++; 8504 + int _x = x & 0x7f; 8505 + int _y = y & 0x7f; 8506 + int i2 = intGroundArray[groundZ][groundX][groundY] * (128 - _x) + intGroundArray[groundZ][groundX + 1][groundY] * _x >> 7; 8507 + int j2 = intGroundArray[groundZ][groundX][groundY + 1] * (128 - _x) + intGroundArray[groundZ][groundX + 1][groundY + 1] * _x >> 7; 8508 + return i2 * (128 - _y) + j2 * _y >> 7; 8526 8509 } 8527 8510 8528 8511 public AppletContext getAppletContext() { ··· 8588 8571 Widget class13_1 = Widget.forId(class13.children[j]); 8589 8572 if (class13_1.type == 1) 8590 8573 method112((byte) 36, class13_1.id); 8591 - class13_1.anInt235 = 0; 8592 - class13_1.anInt227 = 0; 8574 + class13_1.animationFrame = 0; 8575 + class13_1.animationDuration = 0; 8593 8576 } 8594 8577 8595 8578 } ··· 8763 8746 8764 8747 } 8765 8748 8766 - if (aClass18_1158 != null) { 8767 - aClass18_1158.createRasterizer(); 8768 - Rasterizer3D.lineOffsets = anIntArray1002; 8749 + if (gameScreenImageProducer != null) { 8750 + gameScreenImageProducer.createRasterizer(); 8751 + Rasterizer3D.lineOffsets = viewportOffsets; 8769 8752 } 8770 8753 anInt1082++; 8771 8754 if (anInt1082 > 177) { ··· 8819 8802 return SignLink.saveWave(abyte0, j); 8820 8803 } 8821 8804 8822 - private int method117(byte byte0) { 8805 + private int getWorldDrawPlane(byte byte0) { 8823 8806 int i = 3; 8824 8807 if (byte0 == aByte956) { 8825 8808 byte0 = 0; 8826 8809 // System.out.println("byte"); 8827 - } 8828 - else { 8810 + } else { 8829 8811 startup(); 8830 8812 // System.out.println("startup"); 8831 8813 } 8832 - if (anInt1219 < 310) { 8814 + if (cameraVerticalRotation < 310) { 8833 8815 anInt978++; 8834 8816 if (anInt978 > 1457) { 8835 8817 anInt978 = 0; ··· 8914 8896 return i; 8915 8897 } 8916 8898 8917 - private int method118(int i) { 8918 - int j = method110(cameraY, cameraX, (byte) 9, plane); 8899 + private int getCameraPlaneCutscene(int i) { 8900 + int j = getFloorDrawHeight(plane, cameraX, cameraY); 8919 8901 while (i >= 0) 8920 8902 opcode = buffer.getUnsignedByte(); 8921 8903 if (j - cameraZ < 800 && (currentSceneTileFlags[plane][cameraX >> 7][cameraY >> 7] & 4) != 0) ··· 8936 8918 } 8937 8919 } 8938 8920 8939 - private void processPlayerAdditions(boolean priority) { 8921 + private void processPlayerAdditions(boolean priority) { // renderPlayers 8940 8922 if (localPlayer.worldX >> 7 == destinationX 8941 8923 && localPlayer.worldY >> 7 == destinationY) 8942 8924 destinationX = 0; 8943 - int count = localPlayerCount; 8925 + int playersToRender = localPlayerCount; 8944 8926 if (priority) 8945 - count = 1; 8946 - for (int index = 0; index < count; index++) { 8927 + playersToRender = 1; 8928 + for (int p = 0; p < playersToRender; p++) { 8947 8929 Player player; 8948 - int key; 8930 + int hash; 8949 8931 if (priority) { 8950 8932 player = localPlayer; 8951 - key = thisPlayerId << 14; 8933 + hash = thisPlayerId << 14; 8952 8934 } else { 8953 - player = players[playerList[index]]; 8954 - key = playerList[index] << 14; 8935 + player = players[playerList[p]]; 8936 + hash = playerList[p] << 14; 8955 8937 } 8956 8938 if (player == null || !player.isVisible()) 8957 8939 continue; 8958 - player.aBoolean1763 = false; 8959 - if ((lowMemory && localPlayerCount > 50 || localPlayerCount > 200) 8940 + player.preventRotation = (lowMemory && localPlayerCount > 50 || localPlayerCount > 200) 8960 8941 && !priority 8961 - && player.movementAnimation == player.idleAnimation) 8962 - player.aBoolean1763 = true; 8942 + && player.movementAnimation == player.idleAnimation; 8963 8943 int viewportX = player.worldX >> 7; 8964 8944 int viewportY = player.worldY >> 7; 8965 8945 if (viewportX < 0 || viewportX >= 104 || viewportY < 0 || viewportY >= 104) ··· 8967 8947 if (player.playerModel != null 8968 8948 && pulseCycle >= player.objectAppearanceStartTick 8969 8949 && pulseCycle < player.objectAppearanceEndTick) { 8970 - player.aBoolean1763 = false; 8971 - player.anInt1750 = method110( 8972 - player.worldY, 8973 - player.worldX, (byte) 9, plane); 8974 - currentScene.addRenderable(player.anInt1750, player.anInt1769, 8975 - 60, 7, player, player.anInt1768, 8976 - player.worldY, player.anInt1771, 8977 - player.worldX, 8978 - player.anInt1612, player.anInt1770, 8979 - plane, key); 8950 + player.preventRotation = false; 8951 + player.drawHeight2 = getFloorDrawHeight( 8952 + plane, player.worldX, player.worldY 8953 + ); 8954 + currentScene.addEntity(player.anInt1768, player.anInt1769, plane, player.worldX, player.worldY, player.drawHeight2, 8955 + player.anInt1612, player.anInt1771, player.anInt1770, player, 8956 + hash); 8980 8957 continue; 8981 8958 } 8982 8959 if ((player.worldX & 0x7f) == 64 8983 8960 && (player.worldY & 0x7f) == 64) { 8984 - if (anIntArrayArray886[viewportX][viewportY] == anInt1138) 8961 + if (anIntArrayArray886[viewportX][viewportY] == renderCount) 8985 8962 continue; 8986 - anIntArrayArray886[viewportX][viewportY] = anInt1138; 8963 + anIntArrayArray886[viewportX][viewportY] = renderCount; 8987 8964 } 8988 - player.anInt1750 = method110(player.worldY, 8989 - player.worldX, (byte) 9, plane); 8990 - currentScene.addEntity(key, player, 8991 - player.worldX, player.anInt1750, 8992 - player.aBoolean1592, 0, plane, 60, 8993 - player.worldY, 8965 + player.drawHeight2 = getFloorDrawHeight(plane, player.worldX, player.worldY 8966 + ); 8967 + currentScene.addEntity(plane, player.worldX, player.worldY, player.drawHeight2, player, hash, 8968 + 60, player.aBoolean1592, 8994 8969 player.anInt1612); 8995 8970 } 8996 8971 } ··· 9015 8990 localPlayer.pathY[0], 1, 1, 2, 0, 9016 8991 player.pathX[0], 0, 0, 9017 8992 localPlayer.pathX[0]); 9018 - anInt1020 = super.clickX; 9019 - anInt1021 = super.clickY; 8993 + lastClickX = super.clickX; 8994 + lastClickY = super.clickY; 9020 8995 crossType = 2; 9021 8996 crossIndex = 0; 9022 8997 outBuffer.putOpcode(245); ··· 9050 9025 localPlayer.pathY[0], 1, 1, 2, 0, 9051 9026 player.pathX[0], 0, 0, 9052 9027 localPlayer.pathX[0]); 9053 - anInt1020 = super.clickX; 9054 - anInt1021 = super.clickY; 9028 + lastClickX = super.clickX; 9029 + lastClickY = super.clickY; 9055 9030 crossType = 2; 9056 9031 crossIndex = 0; 9057 9032 outBuffer.putOpcode(45); ··· 9065 9040 localPlayer.pathY[0], 1, 1, 2, 0, 9066 9041 npc.pathX[0], 0, 0, 9067 9042 localPlayer.pathX[0]); 9068 - anInt1020 = super.clickX; 9069 - anInt1021 = super.clickY; 9043 + lastClickX = super.clickX; 9044 + lastClickY = super.clickY; 9070 9045 crossType = 2; 9071 9046 crossIndex = 0; 9072 9047 outBuffer.putOpcode(67); ··· 9123 9098 localPlayer.pathY[0], 1, 1, 2, 0, 9124 9099 npc.pathX[0], 0, 0, 9125 9100 localPlayer.pathX[0]); 9126 - anInt1020 = super.clickX; 9127 - anInt1021 = super.clickY; 9101 + lastClickX = super.clickX; 9102 + lastClickY = super.clickY; 9128 9103 crossType = 2; 9129 9104 crossIndex = 0; 9130 9105 outBuffer.putOpcode(42); ··· 9138 9113 localPlayer.pathY[0], 1, 1, 2, 0, 9139 9114 player.pathX[0], 0, 0, 9140 9115 localPlayer.pathX[0]); 9141 - anInt1020 = super.clickX; 9142 - anInt1021 = super.clickY; 9116 + lastClickX = super.clickX; 9117 + lastClickY = super.clickY; 9143 9118 crossType = 2; 9144 9119 crossIndex = 0; 9145 9120 outBuffer.putOpcode(116); ··· 9161 9136 if (action == Actions.REMOVE_FRIEND) 9162 9137 removeFriend(l3); 9163 9138 if (action == Actions.REMOVE_IGNORE) 9164 - removeIgnore(325, l3); 9139 + removeIgnore(l3); 9165 9140 } 9166 9141 } 9167 9142 if (action == 930) { ··· 9170 9145 if (!flag) 9171 9146 flag = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9172 9147 localPlayer.pathX[0]); 9173 - anInt1020 = super.clickX; 9174 - anInt1021 = super.clickY; 9148 + lastClickX = super.clickX; 9149 + lastClickY = super.clickY; 9175 9150 crossType = 2; 9176 9151 crossIndex = 0; 9177 9152 outBuffer.putOpcode(54); ··· 9200 9175 localPlayer.pathY[0], 1, 1, 2, 0, 9201 9176 class50_sub1_sub4_sub3_sub1_2.pathX[0], 0, 0, 9202 9177 localPlayer.pathX[0]); 9203 - anInt1020 = super.clickX; 9204 - anInt1021 = super.clickY; 9178 + lastClickX = super.clickX; 9179 + lastClickY = super.clickY; 9205 9180 crossType = 2; 9206 9181 crossIndex = 0; 9207 9182 outBuffer.putOpcode(57); ··· 9229 9204 localPlayer.pathY[0], 1, 1, 2, 0, 9230 9205 class50_sub1_sub4_sub3_sub2_3.pathX[0], 0, 0, 9231 9206 localPlayer.pathX[0]); 9232 - anInt1020 = super.clickX; 9233 - anInt1021 = super.clickY; 9207 + lastClickX = super.clickX; 9208 + lastClickY = super.clickY; 9234 9209 crossType = 2; 9235 9210 crossIndex = 0; 9236 9211 outBuffer.putOpcode(233); ··· 9281 9256 localPlayer.pathY[0], 1, 1, 2, 0, 9282 9257 class50_sub1_sub4_sub3_sub1_3.pathX[0], 0, 0, 9283 9258 localPlayer.pathX[0]); 9284 - anInt1020 = super.clickX; 9285 - anInt1021 = super.clickY; 9259 + lastClickX = super.clickX; 9260 + lastClickY = super.clickY; 9286 9261 crossType = 2; 9287 9262 crossIndex = 0; 9288 9263 anInt1235 += clicked; ··· 9309 9284 localPlayer.pathY[0], 1, 1, 2, 0, 9310 9285 class50_sub1_sub4_sub3_sub1_4.pathX[0], 0, 0, 9311 9286 localPlayer.pathX[0]); 9312 - anInt1020 = super.clickX; 9313 - anInt1021 = super.clickY; 9287 + lastClickX = super.clickX; 9288 + lastClickY = super.clickY; 9314 9289 crossType = 2; 9315 9290 crossIndex = 0; 9316 9291 outBuffer.putOpcode(8); ··· 9326 9301 localPlayer.pathY[0], 1, 1, 2, 0, 9327 9302 class50_sub1_sub4_sub3_sub2_4.pathX[0], 0, 0, 9328 9303 localPlayer.pathX[0]); 9329 - anInt1020 = super.clickX; 9330 - anInt1021 = super.clickY; 9304 + lastClickX = super.clickX; 9305 + lastClickY = super.clickY; 9331 9306 crossType = 2; 9332 9307 crossIndex = 0; 9333 9308 outBuffer.putOpcode(31); ··· 9342 9317 localPlayer.pathY[0], 1, 1, 2, 0, 9343 9318 class50_sub1_sub4_sub3_sub1_5.pathX[0], 0, 0, 9344 9319 localPlayer.pathX[0]); 9345 - anInt1020 = super.clickX; 9346 - anInt1021 = super.clickY; 9320 + lastClickX = super.clickX; 9321 + lastClickY = super.clickY; 9347 9322 crossType = 2; 9348 9323 crossIndex = 0; 9349 9324 outBuffer.putOpcode(104); ··· 9357 9332 if (!flag1) 9358 9333 flag1 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9359 9334 localPlayer.pathX[0]); 9360 - anInt1020 = super.clickX; 9361 - anInt1021 = super.clickY; 9335 + lastClickX = super.clickX; 9336 + lastClickY = super.clickY; 9362 9337 crossType = 2; 9363 9338 crossIndex = 0; 9364 9339 outBuffer.putOpcode(77); ··· 9372 9347 if (!flag2) 9373 9348 flag2 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9374 9349 localPlayer.pathX[0]); 9375 - anInt1020 = super.clickX; 9376 - anInt1021 = super.clickY; 9350 + lastClickX = super.clickX; 9351 + lastClickY = super.clickY; 9377 9352 crossType = 2; 9378 9353 crossIndex = 0; 9379 9354 if ((clicked & 3) == 0) ··· 9450 9425 selectedWidgetName = prefix + " " + widget.optionText + " " + suffix; 9451 9426 if (anInt1173 == 16) { 9452 9427 redrawTabArea = true; 9453 - anInt1285 = 3; 9428 + currentTabId = 3; 9454 9429 aBoolean950 = true; 9455 9430 } 9456 9431 return; ··· 9568 9543 if (!flag3) 9569 9544 flag3 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9570 9545 localPlayer.pathX[0]); 9571 - anInt1020 = super.clickX; 9572 - anInt1021 = super.clickY; 9546 + lastClickX = super.clickX; 9547 + lastClickY = super.clickY; 9573 9548 crossType = 2; 9574 9549 crossIndex = 0; 9575 9550 outBuffer.putOpcode(230); ··· 9584 9559 localPlayer.pathY[0], 1, 1, 2, 0, 9585 9560 class50_sub1_sub4_sub3_sub2_5.pathX[0], 0, 0, 9586 9561 localPlayer.pathX[0]); 9587 - anInt1020 = super.clickX; 9588 - anInt1021 = super.clickY; 9562 + lastClickX = super.clickX; 9563 + lastClickY = super.clickY; 9589 9564 crossType = 2; 9590 9565 crossIndex = 0; 9591 9566 outBuffer.putOpcode(143); ··· 9601 9576 if (!flag4) 9602 9577 flag4 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9603 9578 localPlayer.pathX[0]); 9604 - anInt1020 = super.clickX; 9605 - anInt1021 = super.clickY; 9579 + lastClickX = super.clickX; 9580 + lastClickY = super.clickY; 9606 9581 crossType = 2; 9607 9582 crossIndex = 0; 9608 9583 outBuffer.putOpcode(211); ··· 9635 9610 if (!flag5) 9636 9611 flag5 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9637 9612 localPlayer.pathX[0]); 9638 - anInt1020 = super.clickX; 9639 - anInt1021 = super.clickY; 9613 + lastClickX = super.clickX; 9614 + lastClickY = super.clickY; 9640 9615 crossType = 2; 9641 9616 crossIndex = 0; 9642 9617 anInt1100++; ··· 9742 9717 localPlayer.pathY[0], 1, 1, 2, 0, 9743 9718 class50_sub1_sub4_sub3_sub1_7.pathX[0], 0, 0, 9744 9719 localPlayer.pathX[0]); 9745 - anInt1020 = super.clickX; 9746 - anInt1021 = super.clickY; 9720 + lastClickX = super.clickX; 9721 + lastClickY = super.clickY; 9747 9722 crossType = 2; 9748 9723 crossIndex = 0; 9749 9724 outBuffer.putOpcode(112); ··· 9756 9731 if (!flag6) 9757 9732 flag6 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9758 9733 localPlayer.pathX[0]); 9759 - anInt1020 = super.clickX; 9760 - anInt1021 = super.clickY; 9734 + lastClickX = super.clickX; 9735 + lastClickY = super.clickY; 9761 9736 crossType = 2; 9762 9737 crossIndex = 0; 9763 9738 outBuffer.putOpcode(83); ··· 9776 9751 anInt1147 = first; 9777 9752 anInt1148 = second; 9778 9753 anInt1149 = clicked; 9779 - aString1150 = String.valueOf(ItemDefinition.lookup(clicked).name); 9754 + selectedItemName = String.valueOf(ItemDefinition.lookup(clicked).name); 9780 9755 widgetSelected = 0; 9781 9756 redrawTabArea = true; 9782 9757 return; ··· 9797 9772 localPlayer.pathY[0], 1, 1, 2, 0, 9798 9773 class50_sub1_sub4_sub3_sub2_6.pathX[0], 0, 0, 9799 9774 localPlayer.pathX[0]); 9800 - anInt1020 = super.clickX; 9801 - anInt1021 = super.clickY; 9775 + lastClickX = super.clickX; 9776 + lastClickY = super.clickY; 9802 9777 crossType = 2; 9803 9778 crossIndex = 0; 9804 9779 outBuffer.putOpcode(194); ··· 9832 9807 if (i < localPlayerCount) { 9833 9808 int k = 30; 9834 9809 Player class50_sub1_sub4_sub3_sub2 = (Player) obj; 9835 - if (class50_sub1_sub4_sub3_sub2.anInt1756 != -1 || class50_sub1_sub4_sub3_sub2.anInt1748 != -1) { 9810 + if (class50_sub1_sub4_sub3_sub2.isSkulled != -1 || class50_sub1_sub4_sub3_sub2.headIcon != -1) { 9836 9811 method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9837 9812 if (anInt932 > -1) { 9838 - if (class50_sub1_sub4_sub3_sub2.anInt1756 != -1) { 9839 - aClass50_Sub1_Sub1_Sub1Array1288[class50_sub1_sub4_sub3_sub2.anInt1756].drawImage(anInt933 9840 - - k, anInt932 - 12); 9813 + if (class50_sub1_sub4_sub3_sub2.isSkulled != -1) { 9814 + aClass50_Sub1_Sub1_Sub1Array1288[class50_sub1_sub4_sub3_sub2.isSkulled].drawImage(anInt932 - 12, anInt933 9815 + - k); 9841 9816 k += 25; 9842 9817 } 9843 - if (class50_sub1_sub4_sub3_sub2.anInt1748 != -1) { 9844 - aClass50_Sub1_Sub1_Sub1Array1079[class50_sub1_sub4_sub3_sub2.anInt1748].drawImage(anInt933 9845 - - k, anInt932 - 12); 9818 + if (class50_sub1_sub4_sub3_sub2.headIcon != -1) { 9819 + aClass50_Sub1_Sub1_Sub1Array1079[class50_sub1_sub4_sub3_sub2.headIcon].drawImage(anInt932 - 12, anInt933 9820 + - k); 9846 9821 k += 25; 9847 9822 } 9848 9823 } ··· 9850 9825 if (i >= 0 && headIconDrawType == 10 && otherPlayerId == playerList[i]) { 9851 9826 method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9852 9827 if (anInt932 > -1) 9853 - aClass50_Sub1_Sub1_Sub1Array954[1].drawImage(anInt933 - k, anInt932 - 12); 9828 + aClass50_Sub1_Sub1_Sub1Array954[1].drawImage(anInt932 - 12, anInt933 - k); 9854 9829 } 9855 9830 } else { 9856 9831 ActorDefinition class37_1 = ((Npc) obj).npcDefinition; 9857 9832 if (class37_1.headIcon >= 0 && class37_1.headIcon < aClass50_Sub1_Sub1_Sub1Array1079.length) { 9858 9833 method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9859 9834 if (anInt932 > -1) 9860 - aClass50_Sub1_Sub1_Sub1Array1079[class37_1.headIcon].drawImage(anInt933 - 30, anInt932 - 12 9835 + aClass50_Sub1_Sub1_Sub1Array1079[class37_1.headIcon].drawImage(anInt932 - 12, anInt933 - 30 9861 9836 ); 9862 9837 } 9863 9838 if (headIconDrawType == 1 && anInt1226 == anIntArray1134[i - localPlayerCount] && pulseCycle % 20 < 10) { 9864 9839 method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9865 9840 if (anInt932 > -1) 9866 - aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt933 - 28, anInt932 - 12); 9841 + aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt932 - 12, anInt933 - 28); 9867 9842 } 9868 9843 } 9869 9844 if (((Actor) (obj)).forcedChat != null ··· 9915 9890 anInt933 -= 10; 9916 9891 } 9917 9892 aClass50_Sub1_Sub1_Sub1Array1182[((Actor) (obj)).hitTypes[i1]].drawImage( 9918 - anInt933 - 12, anInt932 - 12); 9893 + anInt932 - 12, anInt933 - 12); 9919 9894 fontSmall.drawStringLeft(String 9920 9895 .valueOf(((Actor) (obj)).hitDamages[i1]), anInt932, anInt933 + 4, 0); 9921 9896 fontSmall.drawStringLeft(String ··· 9951 9926 if (anIntArray945[j] < 6) 9952 9927 k2 = anIntArray842[anIntArray945[j]]; 9953 9928 if (anIntArray945[j] == 6) 9954 - k2 = anInt1138 % 20 >= 10 ? 0xffff00 : 0xff0000; 9929 + k2 = renderCount % 20 >= 10 ? 0xffff00 : 0xff0000; 9955 9930 if (anIntArray945[j] == 7) 9956 - k2 = anInt1138 % 20 >= 10 ? 65535 : 255; 9931 + k2 = renderCount % 20 >= 10 ? 65535 : 255; 9957 9932 if (anIntArray945[j] == 8) 9958 - k2 = anInt1138 % 20 >= 10 ? 0x80ff80 : 45056; 9933 + k2 = renderCount % 20 >= 10 ? 0x80ff80 : 45056; 9959 9934 if (anIntArray945[j] == 9) { 9960 9935 int l2 = 150 - anIntArray947[j]; 9961 9936 if (l2 < 50) ··· 9988 9963 fontBold.drawStringLeft(s, anInt932, anInt933, k2); 9989 9964 } 9990 9965 if (anIntArray946[j] == 1) { 9991 - fontBold.drawCenteredStringWaveY(s, anInt932, anInt933 + 1, anInt1138, 0); 9992 - fontBold.drawCenteredStringWaveY(s, anInt932, anInt933, anInt1138, k2); 9966 + fontBold.drawCenteredStringWaveY(s, anInt932, anInt933 + 1, renderCount, 0); 9967 + fontBold.drawCenteredStringWaveY(s, anInt932, anInt933, renderCount, k2); 9993 9968 } 9994 9969 if (anIntArray946[j] == 2) { 9995 - fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933 + 1, anInt1138, 0); 9996 - fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933, anInt1138, k2); 9970 + fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933 + 1, renderCount, 0); 9971 + fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933, renderCount, k2); 9997 9972 } 9998 9973 if (anIntArray946[j] == 3) { 9999 - fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933 + 1, anInt1138, 150 - anIntArray947[j], 0 9974 + fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933 + 1, renderCount, 150 - anIntArray947[j], 0 10000 9975 ); 10001 - fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933, anInt1138, 150 - anIntArray947[j], k2 9976 + fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933, renderCount, 150 - anIntArray947[j], k2 10002 9977 ); 10003 9978 } 10004 9979 if (anIntArray946[j] == 4) { ··· 10053 10028 aClass18_1157 = new ProducingGraphicsBuffer(172, 156, getParentComponent()); 10054 10029 Rasterizer.resetPixels(); 10055 10030 minimapBackgroundImage.drawImage(0, 0); 10056 - aClass18_1156 = new ProducingGraphicsBuffer(190, 261, getParentComponent()); 10057 - aClass18_1158 = new ProducingGraphicsBuffer(512, 334, getParentComponent()); 10031 + tabImageProducer = new ProducingGraphicsBuffer(190, 261, getParentComponent()); 10032 + gameScreenImageProducer = new ProducingGraphicsBuffer(512, 334, getParentComponent()); 10058 10033 Rasterizer.resetPixels(); 10059 10034 aClass18_1108 = new ProducingGraphicsBuffer(496, 50, getParentComponent()); 10060 10035 aClass18_1109 = new ProducingGraphicsBuffer(269, 37, getParentComponent()); 10061 10036 aClass18_1110 = new ProducingGraphicsBuffer(249, 45, getParentComponent()); 10062 10037 aBoolean1046 = true; 10063 - aClass18_1158.createRasterizer(); 10064 - Rasterizer3D.lineOffsets = anIntArray1002; 10038 + gameScreenImageProducer.createRasterizer(); 10039 + Rasterizer3D.lineOffsets = viewportOffsets; 10065 10040 return; 10066 10041 } 10067 10042 } ··· 10129 10104 gameConnection = null; 10130 10105 loggedIn = false; 10131 10106 loginScreenState = 0; 10132 - if(USE_STATIC_DETAILS) { 10107 + if (USE_STATIC_DETAILS) { 10133 10108 username = USERNAME; 10134 10109 password = PASSWORD; 10135 10110 } else { ··· 10138 10113 } 10139 10114 10140 10115 resetModelCaches(); 10141 - currentScene.method241(); 10116 + currentScene.initToNull(); 10142 10117 for (int plane = 0; plane < 4; plane++) 10143 10118 currentCollisionMap[plane].reset(); 10144 10119 ··· 10151 10126 } 10152 10127 10153 10128 private void method125(String s, String s1) { 10154 - if (aClass18_1158 != null) { 10155 - aClass18_1158.createRasterizer(); 10156 - Rasterizer3D.lineOffsets = anIntArray1002; 10129 + if (gameScreenImageProducer != null) { 10130 + gameScreenImageProducer.createRasterizer(); 10131 + Rasterizer3D.lineOffsets = viewportOffsets; 10157 10132 int j = 151; 10158 10133 if (s != null) 10159 10134 j -= 7; ··· 10164 10139 fontNormal.drawStringLeft(s, 257, j, 0); 10165 10140 fontNormal.drawStringLeft(s, 256, j - 1, 0xffffff); 10166 10141 } 10167 - aClass18_1158.drawGraphics(4, 4, super.gameGraphics); 10142 + gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics); 10168 10143 return; 10169 10144 } 10170 10145 if (super.imageProducer != null) { ··· 10206 10181 return; 10207 10182 method137((anInt844 - nextTopLeftTileX << 7) + anInt847, anInt846 * 2, (anInt845 - nextTopRightTileY << 7) + anInt848, -214); 10208 10183 if (anInt932 > -1 && pulseCycle % 20 < 10) 10209 - aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt933 - 28, anInt932 - 12); 10184 + aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt932 - 12, anInt933 - 28); 10210 10185 } 10211 10186 10212 10187 public void repaintGame() { ··· 10222 10197 anInt1094 = 0; 10223 10198 } 10224 10199 10225 - private void method128(boolean flag) { 10226 - if (flag) 10227 - outBuffer.putByte(23); 10228 - int i = menuClickX; 10229 - int j = menuClickY; 10230 - int k = anInt1307; 10231 - int l = anInt1308; 10232 - int i1 = 0x5d5447; 10233 - Rasterizer.drawFilledRectangle(i, j, k, l, i1); 10234 - Rasterizer.drawFilledRectangle(i + 1, j + 1, k - 2, 16, 0); 10235 - Rasterizer.drawUnfilledRectangle(i + 1, j + 18, k - 2, l - 19, 0); 10236 - fontBold.drawString("Choose Option", i + 3, j + 14, i1); 10237 - int j1 = super.mouseX; 10238 - int k1 = super.mouseY; 10239 - if (anInt1304 == 0) { 10240 - j1 -= 4; 10241 - k1 -= 4; 10200 + private void drawMenu() { 10201 + int offsetX = menuOffsetX; 10202 + int offsetY = menuOffsetY; 10203 + int width = anInt1307; 10204 + int height = anInt1308; 10205 + int colour = 0x5d5447; 10206 + Rasterizer.drawFilledRectangle(offsetX, offsetY, width, height, colour); 10207 + Rasterizer.drawFilledRectangle(offsetX + 1, offsetY + 1, width - 2, 16, 0); 10208 + Rasterizer.drawUnfilledRectangle(offsetX + 1, offsetY + 18, width - 2, height - 19, 0); 10209 + fontBold.drawString("Choose Option", offsetX + 3, offsetY + 14, colour); 10210 + int x = super.mouseX; 10211 + int y = super.mouseY; 10212 + if (menuScreenArea == 0) { 10213 + x -= 4; 10214 + y -= 4; 10242 10215 } 10243 - if (anInt1304 == 1) { 10244 - j1 -= 553; 10245 - k1 -= 205; 10216 + if (menuScreenArea == 1) { 10217 + x -= 553; 10218 + y -= 205; 10246 10219 } 10247 - if (anInt1304 == 2) { 10248 - j1 -= 17; 10249 - k1 -= 357; 10220 + if (menuScreenArea == 2) { 10221 + x -= 17; 10222 + y -= 357; 10250 10223 } 10251 - for (int l1 = 0; l1 < menuActionRow; l1++) { 10252 - int i2 = j + 31 + (menuActionRow - 1 - l1) * 15; 10253 - int j2 = 0xffffff; 10254 - if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) 10255 - j2 = 0xffff00; 10256 - fontBold.drawShadowedString(menuActionTexts[l1], i + 3, i2, true, j2); 10224 + for (int action = 0; action < menuActionRow; action++) { 10225 + int actionY = offsetY + 31 + (menuActionRow - 1 - action) * 15; 10226 + int actionColour = 0xffffff; 10227 + if (x > offsetX && x < offsetX + width && y > actionY - 13 && y < actionY + 3) 10228 + actionColour = 0xffff00; 10229 + fontBold.drawShadowedString(menuActionTexts[action], offsetX + 3, actionY, true, actionColour); 10257 10230 } 10258 10231 10259 10232 } ··· 10275 10248 if (j1 == 0) 10276 10249 return k; 10277 10250 if (j1 == 1) 10278 - k1 = anIntArray1029[ai[l++]]; 10251 + k1 = skillLevel[ai[l++]]; 10279 10252 if (j1 == 2) 10280 - k1 = anIntArray1054[ai[l++]]; 10253 + k1 = skillMaxLevel[ai[l++]]; 10281 10254 if (j1 == 3) 10282 - k1 = anIntArray843[ai[l++]]; 10255 + k1 = skillExperience[ai[l++]]; 10283 10256 if (j1 == 4) { 10284 10257 Widget class13_1 = Widget.forId(ai[l++]); 10285 10258 int k2 = ai[l++]; ··· 10293 10266 if (j1 == 5) 10294 10267 k1 = widgetSettings[ai[l++]]; 10295 10268 if (j1 == 6) 10296 - k1 = SKILL_EXPERIENCE[anIntArray1054[ai[l++]] - 1]; 10269 + k1 = SKILL_EXPERIENCE[skillMaxLevel[ai[l++]] - 1]; 10297 10270 if (j1 == 7) 10298 10271 k1 = (widgetSettings[ai[l++]] * 100) / 46875; 10299 10272 if (j1 == 8) ··· 10301 10274 if (j1 == 9) { 10302 10275 for (int l1 = 0; l1 < SkillConstants.SKILL_COUNT; l1++) 10303 10276 if (SkillConstants.SKILL_TOGGLES[l1]) 10304 - k1 += anIntArray1054[l1]; 10277 + k1 += skillMaxLevel[l1]; 10305 10278 10306 10279 } 10307 10280 if (j1 == 10) { ··· 10384 10357 / 2 - 4, -49993, ((94 + k1) - sprite.maxWidth / 2) + 4); 10385 10358 return; 10386 10359 } else { 10387 - sprite.drawImage(83 - l1 - sprite.maxHeight / 2 - 4, 10388 - ((94 + k1) - sprite.maxWidth / 2) + 4); 10360 + sprite.drawImage(((94 + k1) - sprite.maxWidth / 2) + 4, 83 - l1 - sprite.maxHeight / 2 - 4 10361 + ); 10389 10362 return; 10390 10363 } 10391 10364 } ··· 10538 10511 10539 10512 private void parsePlacementPacket(Buffer buf, int opcode) { 10540 10513 if (opcode == 203) { 10541 - int k = buf.getUnsignedLEShort(); 10514 + int objectId = buf.getUnsignedLEShort(); 10542 10515 int j3 = buf.getUnsignedByte(); 10543 - int i6 = j3 >> 2; 10544 - int rotation = j3 & 3; 10545 - int k11 = anIntArray1032[i6]; 10516 + int modelType = j3 >> 2; 10517 + int modelOrientation = j3 & 3; 10518 + int type = objectTypes[modelType]; 10546 10519 byte byte0 = buf.getSignedByteNegated(); 10547 10520 int offset = buf.getByteAdded(); 10548 10521 int x = placementX + (offset >> 4 & 7); 10549 10522 int y = placementY + (offset & 7); 10550 10523 byte byte1 = buf.getSignedByteAdded(); 10551 - int l19 = buf.getShortUnsingedAdded(); 10524 + int duration = buf.getShortUnsingedAdded(); 10552 10525 int id = buf.getLEUnsignedShort(); 10553 10526 byte byte2 = buf.getSignedByte(); 10554 10527 byte byte3 = buf.getSignedByteAdded(); 10555 - int l21 = buf.getUnsignedLEShort(); 10528 + int startDelay = buf.getUnsignedLEShort(); 10556 10529 Player player; 10557 10530 if (id == thisPlayerServerId) 10558 10531 player = localPlayer; 10559 10532 else 10560 10533 player = players[id]; 10561 10534 if (player != null) { 10562 - GameObjectDefinition class47 = GameObjectDefinition.getDefinition(k); 10563 - int i22 = anIntArrayArrayArray891[plane][x][y]; 10564 - int j22 = anIntArrayArrayArray891[plane][x + 1][y]; 10565 - int k22 = anIntArrayArrayArray891[plane][x + 1][y + 1]; 10566 - int l22 = anIntArrayArrayArray891[plane][x][y + 1]; 10567 - Model class50_sub1_sub4_sub4 = class47.getGameObjectModel(i6, rotation, i22, j22, k22, l22, -1); 10568 - if (class50_sub1_sub4_sub4 != null) { 10569 - method145(true, plane, x, 0, l19 + 1, 0, -1, l21 + 1, k11, y); 10570 - player.objectAppearanceStartTick = l21 + pulseCycle; 10571 - player.objectAppearanceEndTick = l19 + pulseCycle; 10572 - player.playerModel = class50_sub1_sub4_sub4; 10573 - int i23 = class47.sizeX; 10574 - int j23 = class47.sizeY; 10575 - if (rotation == 1 || rotation == 3) { 10576 - i23 = class47.sizeY; 10577 - j23 = class47.sizeX; 10535 + GameObjectDefinition object = GameObjectDefinition.getDefinition(objectId); 10536 + int vertexHeight = this.intGroundArray[plane][x][y]; 10537 + int vertexHeightRight = this.intGroundArray[plane][x + 1][y]; 10538 + int vertexHeightTopRight = this.intGroundArray[plane][x + 1][y + 1]; 10539 + int vertexHeightTop = this.intGroundArray[plane][x][y + 1]; 10540 + Model model = object.getGameObjectModel(modelType, modelOrientation, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 10541 + if (model != null) { 10542 + createObjectSpawnRequest(plane, x, 0, duration + 1, 0, -1, startDelay + 1, type, y); 10543 + player.objectAppearanceStartTick = startDelay + pulseCycle; 10544 + player.objectAppearanceEndTick = duration + pulseCycle; 10545 + player.playerModel = model; 10546 + int i23 = object.sizeX; 10547 + int j23 = object.sizeY; 10548 + if (modelOrientation == 1 || modelOrientation == 3) { 10549 + i23 = object.sizeY; 10550 + j23 = object.sizeX; 10578 10551 } 10579 10552 player.anInt1743 = x * 128 + i23 * 64; 10580 10553 player.anInt1745 = y * 128 + j23 * 64; 10581 - player.anInt1744 = method110(player.anInt1745, 10582 - player.anInt1743, (byte) 9, plane); 10554 + player.drawHeight = getFloorDrawHeight(plane, player.anInt1743, player.anInt1745 10555 + ); 10583 10556 if (byte1 > byte0) { 10584 10557 byte byte4 = byte1; 10585 10558 byte1 = byte0; ··· 10610 10583 item.itemCount = amount; 10611 10584 if (groundItems[plane][x][y] == null) 10612 10585 groundItems[plane][x][y] = new LinkedList(); 10613 - groundItems[plane][x][y].insertBack(item); 10586 + groundItems[plane][x][y].pushBack(item); 10614 10587 processGroundItems(x, y); 10615 10588 } 10616 10589 return; ··· 10620 10593 int l3 = buf.getByteAdded(); 10621 10594 int k6 = l3 >> 2; 10622 10595 int j9 = l3 & 3; 10623 - int i12 = anIntArray1032[k6]; 10596 + int i12 = objectTypes[k6]; 10624 10597 int j14 = buf.getUnsignedByte(); 10625 10598 int x = placementX + (j14 >> 4 & 7); 10626 10599 int y = placementY + (j14 & 7); 10627 10600 if (x >= 0 && y >= 0 && x < 103 && y < 103) { 10628 - int l18 = anIntArrayArrayArray891[plane][x][y]; 10629 - int j19 = anIntArrayArrayArray891[plane][x + 1][y]; 10630 - int i20 = anIntArrayArrayArray891[plane][x + 1][y + 1]; 10631 - int l20 = anIntArrayArrayArray891[plane][x][y + 1]; 10601 + int l18 = intGroundArray[plane][x][y]; 10602 + int j19 = intGroundArray[plane][x + 1][y]; 10603 + int i20 = intGroundArray[plane][x + 1][y + 1]; 10604 + int l20 = intGroundArray[plane][x][y + 1]; 10632 10605 if (i12 == 0) { 10633 10606 Wall wall = currentScene.method263(plane, 17734, x, y); 10634 10607 if (wall != null) { 10635 - int k21 = wall.hash >> 14 & 0x7fff; 10608 + int k21 = wall.uid >> 14 & 0x7fff; 10636 10609 if (k6 == 2) { 10637 - wall.aRenderable769 = new GameObject(k21, 4 + j9, 2, j19, i20, l18, l20, i1, 10610 + wall.primary = new GameObject(k21, 4 + j9, 2, j19, i20, l18, l20, i1, 10638 10611 false); 10639 - wall.aRenderable770 = new GameObject(k21, j9 + 1 & 3, 2, j19, i20, l18, l20, i1, 10612 + wall.secondary = new GameObject(k21, j9 + 1 & 3, 2, j19, i20, l18, l20, i1, 10640 10613 false); 10641 10614 } else { 10642 - wall.aRenderable769 = new GameObject(k21, j9, k6, j19, i20, l18, l20, i1, 10615 + wall.primary = new GameObject(k21, j9, k6, j19, i20, l18, l20, i1, 10643 10616 false); 10644 10617 } 10645 10618 } ··· 10647 10620 if (i12 == 1) { 10648 10621 WallDecoration wallDecoration = currentScene.method264(plane, y, x, false); 10649 10622 if (wallDecoration != null) 10650 - wallDecoration.renderable = new GameObject(wallDecoration.hash >> 14 & 0x7fff, 0, 4, j19, i20, l18, l20, i1, 10623 + wallDecoration.renderable = new GameObject(wallDecoration.uid >> 14 & 0x7fff, 0, 4, j19, i20, l18, l20, i1, 10651 10624 false); 10652 10625 } 10653 10626 if (i12 == 2) { 10654 - SceneSpawnRequest sceneSpawnRequest = currentScene.method265(x, (byte) 32, y, plane); 10627 + InteractiveObject interactiveObject = currentScene.method265(x, (byte) 32, y, plane); 10655 10628 if (k6 == 11) 10656 10629 k6 = 10; 10657 - if (sceneSpawnRequest != null) 10658 - sceneSpawnRequest.aRenderable601 = new GameObject(sceneSpawnRequest.anInt125 >> 14 & 0x7fff, j9, k6, j19, i20, l18, l20, i1, 10630 + if (interactiveObject != null) 10631 + interactiveObject.renderable = new GameObject(interactiveObject.uid >> 14 & 0x7fff, j9, k6, j19, i20, l18, l20, i1, 10659 10632 false); 10660 10633 } 10661 10634 if (i12 == 3) { 10662 10635 FloorDecoration floorDecoration = currentScene.method266(plane, y, 0, x); 10663 10636 if (floorDecoration != null) 10664 - floorDecoration.renderable = new GameObject(floorDecoration.hash >> 14 & 0x7fff, j9, 22, j19, i20, l18, l20, i1, 10637 + floorDecoration.renderable = new GameObject(floorDecoration.uid >> 14 & 0x7fff, j9, 22, j19, i20, l18, l20, i1, 10665 10638 false); 10666 10639 } 10667 10640 } ··· 10679 10652 item.itemCount = amount; 10680 10653 if (groundItems[plane][x][y] == null) 10681 10654 groundItems[plane][x][y] = new LinkedList(); 10682 - groundItems[plane][x][y].insertBack(item); 10655 + groundItems[plane][x][y].pushBack(item); 10683 10656 processGroundItems(x, y); 10684 10657 } 10685 10658 return; ··· 10727 10700 i10 = i10 * 128 + 64; 10728 10701 l12 = l12 * 128 + 64; 10729 10702 Projectile class50_sub1_sub4_sub2 = new Projectile(plane, i19, j21, y, 10730 - k16, j20 + pulseCycle, i21, l14, method110(y, x, (byte) 9, plane) - i18, x, k19 + pulseCycle); 10731 - class50_sub1_sub4_sub2.trackTarget(i10, l12, method110(l12, i10, (byte) 9, plane) - i19, k19 10703 + k16, j20 + pulseCycle, i21, l14, getFloorDrawHeight(plane, x, y) - i18, x, k19 + pulseCycle); 10704 + class50_sub1_sub4_sub2.trackTarget(i10, l12, getFloorDrawHeight(plane, i10, l12) - i19, k19 10732 10705 + pulseCycle); 10733 - aClass6_1282.insertBack(class50_sub1_sub4_sub2); 10706 + aClass6_1282.pushBack(class50_sub1_sub4_sub2); 10734 10707 } 10735 10708 return; 10736 10709 } ··· 10763 10736 if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) { 10764 10737 i5 = i5 * 128 + 64; 10765 10738 l7 = l7 * 128 + 64; 10766 - GameAnimableObject gameAnimableObject = new GameAnimableObject(plane, pulseCycle, j15, k10, method110(l7, i5, (byte) 9, plane) - j13, l7, i5); 10767 - aClass6_1210.insertBack(gameAnimableObject); 10739 + GameAnimableObject gameAnimableObject = new GameAnimableObject(plane, pulseCycle, j15, k10, getFloorDrawHeight(plane, i5, l7) - j13, l7, i5); 10740 + aClass6_1210.pushBack(gameAnimableObject); 10768 10741 } 10769 10742 return; 10770 10743 } ··· 10772 10745 int k2 = buf.getByteNegated(); 10773 10746 int j5 = k2 >> 2; 10774 10747 int i8 = k2 & 3; 10775 - int l10 = anIntArray1032[j5]; 10748 + int l10 = objectTypes[j5]; 10776 10749 int k13 = buf.getLittleShortA(); 10777 10750 int k15 = buf.getByteAdded(); 10778 10751 int i17 = placementX + (k15 >> 4 & 7); 10779 10752 int j18 = placementY + (k15 & 7); 10780 10753 if (i17 >= 0 && j18 >= 0 && i17 < 104 && j18 < 104) 10781 - method145(true, plane, i17, i8, -1, j5, k13, 0, l10, j18); 10754 + createObjectSpawnRequest(plane, i17, i8, -1, j5, k13, 0, l10, j18); 10782 10755 return; 10783 10756 } 10784 10757 if (opcode == 208) { // remove ground item ··· 10804 10777 return; 10805 10778 } 10806 10779 if (opcode == 88) { 10807 - int i3 = buf.getByteSubtracted(); 10808 - int l5 = placementX + (i3 >> 4 & 7); 10809 - int k8 = placementY + (i3 & 7); 10810 - int j11 = buf.getByteSubtracted(); 10811 - int l13 = j11 >> 2; 10812 - int l15 = j11 & 3; 10813 - int j17 = anIntArray1032[l13]; 10814 - if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104) 10815 - method145(true, plane, l5, l15, -1, l13, -1, 0, j17, k8); 10780 + int positionOffset = buf.getByteSubtracted(); 10781 + int x = placementX + (positionOffset >> 4 & 7); 10782 + int y = placementY + (positionOffset & 7); 10783 + int data = buf.getByteSubtracted(); 10784 + int objectType = data >> 2; 10785 + int orientation = data & 3; 10786 + int type = objectTypes[objectType]; 10787 + if (x >= 0 && y >= 0 && x < 104 && y < 104) 10788 + createObjectSpawnRequest(plane, x, orientation, -1, objectType, -1, 0, type, y); 10816 10789 } 10817 10790 } 10818 10791 10819 - private void method134(byte byte0) { 10820 - aClass18_1156.createRasterizer(); 10821 - Rasterizer3D.lineOffsets = anIntArray1001; 10792 + private void method134() { 10793 + tabImageProducer.createRasterizer(); 10794 + Rasterizer3D.lineOffsets = sidebarOffsets; 10822 10795 inventoryBackgroundImage.drawImage(0, 0); 10823 10796 if (openInvOverLayId != -1) 10824 - method142(0, 0, Widget.forId(openInvOverLayId), 0, 8); 10825 - else if (anIntArray1081[anInt1285] != -1) 10826 - method142(0, 0, Widget.forId(anIntArray1081[anInt1285]), 0, 8); 10827 - if (menuOpen && anInt1304 == 1) 10828 - method128(false); 10829 - aClass18_1156.drawGraphics(553, 205, super.gameGraphics); 10830 - aClass18_1158.createRasterizer(); 10831 - Rasterizer3D.lineOffsets = anIntArray1002; 10832 - if (byte0 == 7) 10833 - ; 10797 + drawInterface(0, 0, Widget.forId(openInvOverLayId), 0, 8); 10798 + else if (tabInterfaceIDs[currentTabId] != -1) 10799 + drawInterface(0, 0, Widget.forId(tabInterfaceIDs[currentTabId]), 0, 8); 10800 + if (menuOpen && menuScreenArea == 1) 10801 + drawMenu(); 10802 + tabImageProducer.drawGraphics(553, 205, super.gameGraphics); 10803 + gameScreenImageProducer.createRasterizer(); 10804 + Rasterizer3D.lineOffsets = viewportOffsets; 10834 10805 } 10835 10806 10836 10807 ··· 10846 10817 anInt933 = -1; 10847 10818 return; 10848 10819 } 10849 - int i1 = method110(k, i, (byte) 9, plane) - j; 10820 + int i1 = getFloorDrawHeight(plane, i, k) - j; 10850 10821 i -= cameraX; 10851 10822 i1 -= cameraZ; 10852 10823 k -= cameraY; 10853 - int j1 = Model.SINE[anInt1219]; 10854 - int k1 = Model.COSINE[anInt1219]; 10855 - int l1 = Model.SINE[anInt1220]; 10856 - int i2 = Model.COSINE[anInt1220]; 10824 + int j1 = Model.SINE[cameraVerticalRotation]; 10825 + int k1 = Model.COSINE[cameraVerticalRotation]; 10826 + int l1 = Model.SINE[cameraHorizontalRotation]; 10827 + int i2 = Model.COSINE[cameraHorizontalRotation]; 10857 10828 int j2 = k * l1 + i * i2 >> 16; 10858 10829 k = k * i2 - i * l1 >> 16; 10859 10830 i = j2; ··· 10984 10955 class50_sub1_sub1_sub1.drawInverse(-180, -171); 10985 10956 class50_sub1_sub1_sub1 = new ImageRGB(titleArchive, "logo", 0); 10986 10957 aClass18_1198.createRasterizer(); 10987 - class50_sub1_sub1_sub1.drawImage(18, 382 - class50_sub1_sub1_sub1.width / 2 - 128); 10958 + class50_sub1_sub1_sub1.drawImage(382 - class50_sub1_sub1_sub1.width / 2 - 128, 18); 10988 10959 class50_sub1_sub1_sub1 = null; 10989 10960 abyte0 = null; 10990 10961 ai = null; ··· 11042 11013 anImageRGB1227 = null; 11043 11014 } 11044 11015 11045 - private void method142(int i, int j, Widget class13, int k, int l) { 11016 + private void drawInterface(int i, int j, Widget class13, int k, int l) { 11046 11017 if (class13.type != 0 || class13.children == null) 11047 11018 return; 11048 11019 if (class13.hiddenUntilHovered && anInt1302 != class13.id && anInt1280 != class13.id ··· 11069 11040 child.scrollPosition = child.scrollLimit - child.height; 11070 11041 if (child.scrollPosition < 0) 11071 11042 child.scrollPosition = 0; 11072 - method142(l2, k2, child, child.scrollPosition, 8); 11043 + drawInterface(l2, k2, child, child.scrollPosition, 8); 11073 11044 if (child.scrollLimit > child.height) 11074 11045 method56(true, child.scrollPosition, k2 + child.width, child.height, child.scrollLimit, 11075 11046 l2); ··· 11131 11102 } else if (atInventoryInterfaceType != 0 && anInt1331 == i3 && anInt1330 == child.id) 11132 11103 class50_sub1_sub1_sub1_2.drawImageAlpha(i6, l6, 128); 11133 11104 else 11134 - class50_sub1_sub1_sub1_2.drawImage(l6, i6); 11105 + class50_sub1_sub1_sub1_2.drawImage(i6, l6); 11135 11106 if (class50_sub1_sub1_sub1_2.maxWidth == 33 || child.itemAmounts[i3] != 1) { 11136 11107 int k12 = child.itemAmounts[i3]; 11137 11108 fontSmall.drawString(getShortenedAmountText(k12), i6 + 1 + i7, l6 + 10 + j8, 0 ··· 11144 11115 } else if (child.images != null && i3 < 20) { 11145 11116 ImageRGB class50_sub1_sub1_sub1_1 = child.images[i3]; 11146 11117 if (class50_sub1_sub1_sub1_1 != null) 11147 - class50_sub1_sub1_sub1_1.drawImage(l6, i6); 11118 + class50_sub1_sub1_sub1_1.drawImage(i6, l6); 11148 11119 } 11149 11120 i3++; 11150 11121 } ··· 11157 11128 || anInt1302 == child.id) 11158 11129 flag = true; 11159 11130 int j3; 11160 - if (method95(child, -693)) { 11131 + if (method95(child)) { 11161 11132 j3 = child.enabledColor; 11162 11133 if (flag && child.enabledHoveredColor != 0) 11163 11134 j3 = child.enabledHoveredColor; ··· 11185 11156 || anInt1302 == child.id) 11186 11157 flag1 = true; 11187 11158 int j4; 11188 - if (method95(child, -693)) { 11159 + if (method95(child)) { 11189 11160 j4 = child.enabledColor; 11190 11161 if (flag1 && child.enabledHoveredColor != 0) 11191 11162 j4 = child.enabledHoveredColor; ··· 11257 11228 11258 11229 } else if (child.type == 5) { 11259 11230 ImageRGB class50_sub1_sub1_sub1; 11260 - if (method95(child, -693)) 11231 + if (method95(child)) 11261 11232 class50_sub1_sub1_sub1 = child.enabledImage; 11262 11233 else 11263 11234 class50_sub1_sub1_sub1 = child.disabledImage; ··· 11275 11246 break; 11276 11247 } 11277 11248 if (class50_sub1_sub1_sub1 != null) 11278 - class50_sub1_sub1_sub1.drawImage(l2, k2); 11249 + class50_sub1_sub1_sub1.drawImage(k2, l2); 11279 11250 } else if (child.type == 6) { 11280 11251 int k3 = Rasterizer3D.centerX; 11281 11252 int k4 = Rasterizer3D.centerY; ··· 11283 11254 Rasterizer3D.centerY = l2 + child.height / 2; 11284 11255 int k5 = Rasterizer3D.SINE[child.rotationX] * child.zoom >> 16; 11285 11256 int j6 = Rasterizer3D.COSINE[child.rotationX] * child.zoom >> 16; 11286 - boolean flag2 = method95(child, -693); 11257 + boolean flag2 = method95(child); 11287 11258 int k7; 11288 11259 if (flag2) 11289 11260 k7 = child.enabledAnimation; ··· 11294 11265 class50_sub1_sub4_sub4 = child.getAnimatedModel(-1, -1, flag2); 11295 11266 } else { 11296 11267 AnimationSequence class14 = AnimationSequence.animations[k7]; 11297 - class50_sub1_sub4_sub4 = child.getAnimatedModel(class14.frame1Ids[child.anInt235], class14.getPrimaryFrame[child.anInt235], 11268 + class50_sub1_sub4_sub4 = child.getAnimatedModel(class14.frame1Ids[child.animationFrame], class14.getPrimaryFrame[child.animationFrame], 11298 11269 flag2); 11299 11270 } 11300 11271 if (class50_sub1_sub4_sub4 != null) ··· 11406 11377 } 11407 11378 11408 11379 private int method144(int i) { 11409 - for (int j = 0; j < aByteArrayArray838.length; j++) { 11410 - if (aByteArrayArray838[j] == null && anIntArray857[j] != -1) 11380 + for (int j = 0; j < terrainData.length; j++) { 11381 + if (terrainData[j] == null && terrainDataIds[j] != -1) 11411 11382 return -1; 11412 - if (aByteArrayArray1232[j] == null && anIntArray858[j] != -1) 11383 + if (objectData[j] == null && objectDataIds[j] != -1) 11413 11384 return -2; 11414 11385 } 11415 11386 11416 11387 boolean flag = true; 11417 11388 if (i < 5 || i > 5) 11418 11389 aBoolean953 = !aBoolean953; 11419 - for (int k = 0; k < aByteArrayArray838.length; k++) { 11420 - byte abyte0[] = aByteArrayArray1232[k]; 11390 + for (int k = 0; k < terrainData.length; k++) { 11391 + byte abyte0[] = objectData[k]; 11421 11392 if (abyte0 != null) { 11422 - int l = (coordinates[k] >> 8) * 64 - nextTopLeftTileX; 11423 - int i1 = (coordinates[k] & 0xff) * 64 - nextTopRightTileY; 11393 + int l = (mapCoordinates[k] >> 8) * 64 - nextTopLeftTileX; 11394 + int i1 = (mapCoordinates[k] & 0xff) * 64 - nextTopRightTileY; 11424 11395 if (aBoolean1163) { 11425 11396 l = 10; 11426 11397 i1 = 10; ··· 11442 11413 } 11443 11414 } 11444 11415 11445 - private void method145(boolean flag, int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 11446 - SpawnObjectNode spawnObjectNode = null; 11447 - for (SpawnObjectNode spawnObjectNode_1 = (SpawnObjectNode) aClass6_1261.first(); spawnObjectNode_1 != null; spawnObjectNode_1 = (SpawnObjectNode) aClass6_1261 11416 + private void createObjectSpawnRequest(int plane, int x, int orientation, int duration, int objectType, int objectId, int startDelay, int type, int y) { 11417 + SpawnObjectNode request = null; 11418 + for (SpawnObjectNode request2 = (SpawnObjectNode) spawnObjectList.first(); request2 != null; request2 = (SpawnObjectNode) spawnObjectList 11448 11419 .next()) { 11449 - if (spawnObjectNode_1.anInt1391 != i || spawnObjectNode_1.anInt1393 != j || spawnObjectNode_1.anInt1394 != i2 11450 - || spawnObjectNode_1.anInt1392 != l1) 11420 + if (request2.anInt1391 != plane || request2.anInt1393 != x || request2.anInt1394 != y 11421 + || request2.anInt1392 != type) 11451 11422 continue; 11452 - spawnObjectNode = spawnObjectNode_1; 11423 + request = request2; 11453 11424 break; 11454 11425 } 11455 11426 11456 - if (spawnObjectNode == null) { 11457 - spawnObjectNode = new SpawnObjectNode(); 11458 - spawnObjectNode.anInt1391 = i; 11459 - spawnObjectNode.anInt1392 = l1; 11460 - spawnObjectNode.anInt1393 = j; 11461 - spawnObjectNode.anInt1394 = i2; 11462 - method140((byte) -61, spawnObjectNode); 11463 - aClass6_1261.insertBack(spawnObjectNode); 11427 + if (request == null) { 11428 + request = new SpawnObjectNode(); 11429 + request.anInt1391 = plane; 11430 + request.anInt1392 = type; 11431 + request.anInt1393 = x; 11432 + request.anInt1394 = y; 11433 + method140((byte) -61, request); 11434 + spawnObjectList.pushBack(request); 11464 11435 } 11465 - spawnObjectNode.anInt1384 = j1; 11466 - spawnObjectNode.anInt1386 = i1; 11467 - spawnObjectNode.anInt1385 = k; 11468 - spawnObjectNode.anInt1395 = k1; 11469 - spawnObjectNode.anInt1390 = l; 11470 - loggedIn &= flag; 11436 + request.anInt1384 = objectId; 11437 + request.anInt1386 = objectType; 11438 + request.anInt1385 = orientation; 11439 + request.anInt1395 = startDelay; 11440 + request.anInt1390 = duration; 11471 11441 } 11472 11442 11473 11443 private void method146(byte byte0) { ··· 11526 11496 aClass18_1206 = null; 11527 11497 chatboxProducingGraphicsBuffer = null; 11528 11498 aClass18_1157 = null; 11529 - aClass18_1156 = null; 11530 - aClass18_1158 = null; 11499 + tabImageProducer = null; 11500 + gameScreenImageProducer = null; 11531 11501 aClass18_1108 = null; 11532 11502 aClass18_1109 = null; 11533 11503 aClass18_1110 = null; ··· 11593 11563 if (super.clickType == 1 && super.clickX >= j1 - 75 && super.clickX <= j1 + 75 11594 11564 && super.clickY >= l1 - 20 && super.clickY <= l1 + 20) { 11595 11565 loginScreenState = 0; 11596 - if(USE_STATIC_DETAILS) { 11566 + if (USE_STATIC_DETAILS) { 11597 11567 username = USERNAME; 11598 11568 password = PASSWORD; 11599 11569 } else { ··· 11773 11743 } 11774 11744 } 11775 11745 11776 - private void method151(int i) { 11777 - anInt1138++; 11746 + private void renderGameView() { 11747 + this.renderCount++; 11778 11748 processPlayerAdditions(true); 11779 - method57(751, true); 11749 + renderNPCs(751, true); 11780 11750 processPlayerAdditions(false); 11781 - method57(751, false); 11782 - method51(); 11783 - method76(-992); 11784 - if (!oriented) { 11785 - int j = anInt1251; 11786 - if (anInt1289 / 256 > j) 11787 - j = anInt1289 / 256; 11788 - if (aBooleanArray927[4] && anIntArray852[4] + 128 > j) 11789 - j = anIntArray852[4] + 128; 11790 - int l = cameraHorizontal + anInt1255 & 0x7ff; 11791 - setCameraPosition(anInt1262, anInt1263, method110(localPlayer.worldY, localPlayer.worldX, (byte) 9, 11792 - plane) - 50, j, l); 11751 + renderNPCs(751, false); 11752 + renderProjectiles(); 11753 + renderStationaryGraphics(-992); 11754 + if (!cutsceneActive) { 11755 + int vertical = cameraVertical; 11756 + if (secondaryCameraVertical / 256 > vertical) 11757 + vertical = secondaryCameraVertical / 256; 11758 + if (customCameraActive[4] && cameraAmplitude[4] + 128 > vertical) 11759 + vertical = cameraAmplitude[4] + 128; 11760 + int horizontal = cameraHorizontal + cameraRandomisationA & 0x7ff; 11761 + setCameraPosition(currentCameraPositionH, currentCameraPositionV, getFloorDrawHeight(plane, localPlayer.worldX, localPlayer.worldY 11762 + ) - 50, vertical, horizontal); 11793 11763 } 11794 - int k; 11795 - if (!oriented) 11796 - k = method117((byte) 1); 11764 + int cameraPlane; 11765 + if (!cutsceneActive) 11766 + cameraPlane = getWorldDrawPlane((byte) 1); 11797 11767 else 11798 - k = method118(-276); 11799 - int i1 = cameraX; 11800 - int j1 = cameraZ; 11801 - int k1 = cameraY; 11802 - int l1 = anInt1219; 11803 - int i2 = anInt1220; 11804 - if (i != 2) 11805 - anInt1004 = incomingRandom.nextInt(); 11806 - for (int j2 = 0; j2 < 5; j2++) 11807 - if (aBooleanArray927[j2]) { 11808 - int k2 = (int) ((Math.random() * (double) (anIntArray1105[j2] * 2 + 1) - (double) anIntArray1105[j2]) + Math 11809 - .sin((double) quakeTimes[j2] * ((double) anIntArray991[j2] / 100D)) 11810 - * (double) anIntArray852[j2]); 11811 - if (j2 == 0) 11812 - cameraX += k2; 11813 - if (j2 == 1) 11814 - cameraZ += k2; 11815 - if (j2 == 2) 11816 - cameraY += k2; 11817 - if (j2 == 3) 11818 - anInt1220 = anInt1220 + k2 & 0x7ff; 11819 - if (j2 == 4) { 11820 - anInt1219 += k2; 11821 - if (anInt1219 < 128) 11822 - anInt1219 = 128; 11823 - if (anInt1219 > 383) 11824 - anInt1219 = 383; 11768 + cameraPlane = getCameraPlaneCutscene(-276); 11769 + int x = cameraX; 11770 + int y = cameraY; 11771 + int z = cameraZ; 11772 + int l1 = cameraVerticalRotation; 11773 + int i2 = cameraHorizontalRotation; 11774 + for (int i = 0; i < 5; i++) 11775 + if (customCameraActive[i]) { 11776 + int randomisation = (int) ((Math.random() * (double) (cameraJitter[i] * 2 + 1) - (double) cameraJitter[i]) + Math 11777 + .sin((double) quakeTimes[i] * ((double) cameraFrequency[i] / 100D)) 11778 + * (double) cameraAmplitude[i]); 11779 + if (i == 0) 11780 + cameraX += randomisation; 11781 + if (i == 1) 11782 + cameraZ += randomisation; 11783 + if (i == 2) 11784 + cameraY += randomisation; 11785 + if (i == 3) 11786 + cameraHorizontalRotation = cameraHorizontalRotation + randomisation & 0x7ff; 11787 + if (i == 4) { 11788 + cameraVerticalRotation += randomisation; 11789 + if (cameraVerticalRotation < 128) 11790 + cameraVerticalRotation = 128; 11791 + if (cameraVerticalRotation > 383) 11792 + cameraVerticalRotation = 383; 11825 11793 } 11826 11794 } 11827 11795 11828 - int l2 = Rasterizer3D.anInt1547; 11796 + int textureId = Rasterizer3D.textureGetCount; 11829 11797 Model.aBoolean1705 = true; 11830 - Model.anInt1708 = 0; 11831 - Model.anInt1706 = super.mouseX - 4; 11832 - Model.anInt1707 = super.mouseY - 4; 11798 + Model.resourceCount = 0; 11799 + Model.cursorX = super.mouseX - 4; 11800 + Model.cursorY = super.mouseY - 4; 11833 11801 Rasterizer.resetPixels(); 11834 - currentScene.method280(cameraX, k, 0, cameraZ, cameraY, anInt1220, anInt1219); 11835 - currentScene.method255(); 11802 + currentScene.render(cameraX, cameraPlane, 0, cameraZ, cameraY, cameraHorizontalRotation, cameraVerticalRotation); 11803 + currentScene.clearInteractiveObjectCache(); 11836 11804 method121(false); 11837 11805 method127(true); 11838 - method65(l2); 11839 - renderGameView(); 11840 - aClass18_1158.drawGraphics(4, 4, super.gameGraphics); 11841 - cameraX = i1; 11842 - cameraZ = j1; 11843 - cameraY = k1; 11844 - anInt1219 = l1; 11845 - anInt1220 = i2; 11806 + animateTexture(textureId); 11807 + draw3dScreen(); 11808 + gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics); 11809 + cameraX = x; 11810 + cameraZ = z; 11811 + cameraY = y; 11812 + cameraVerticalRotation = l1; 11813 + cameraHorizontalRotation = i2; 11846 11814 } 11847 11815 11848 11816 private void method152() {
-1
src/com/jagex/runescape/GameShell.java
··· 228 228 eventClickX = mouseX; 229 229 eventClickY = mouseY; 230 230 lastClick = System.currentTimeMillis(); 231 - System.out.println(mouseevent.getButton()); 232 231 if (mouseevent.getButton() == MouseEvent.BUTTON2) { 233 232 mouseWheelDown = true; 234 233 mouseWheelX = mouseX;
+14 -14
src/com/jagex/runescape/cache/def/GameObjectDefinition.java
··· 231 231 needsTranslation = true; 232 232 else 233 233 needsTranslation = false; 234 - Model animtedModel = new Model(modifiedModelColors == null, subModel, Animation.exists(animationId)); 234 + Model animatedModel = new Model(modifiedModelColors == null, subModel, Animation.exists(animationId)); 235 235 if (animationId != -1) { 236 - animtedModel.createBones(); 237 - animtedModel.applyTransform(animationId); 238 - animtedModel.triangleSkin = null; 239 - animtedModel.vectorSkin = null; 236 + animatedModel.createBones(); 237 + animatedModel.applyTransform(animationId); 238 + animatedModel.triangleSkin = null; 239 + animatedModel.vectorSkin = null; 240 240 } 241 241 while (face-- > 0) 242 - animtedModel.rotate90Degrees(); 242 + animatedModel.rotate90Degrees(); 243 243 if (modifiedModelColors != null) { 244 244 for (int k2 = 0; k2 < modifiedModelColors.length; k2++) 245 - animtedModel.replaceColor(modifiedModelColors[k2], anIntArray792[k2]); 245 + animatedModel.replaceColor(modifiedModelColors[k2], anIntArray792[k2]); 246 246 247 247 } 248 248 if (scale) 249 - animtedModel.scaleT(modelSizeY, modelSizeZ, 9, modelSizeX); 249 + animatedModel.scaleT(modelSizeY, modelSizeZ, 9, modelSizeX); 250 250 if (needsTranslation) 251 - animtedModel.translate(translateX, translateZ, translateY); 252 - animtedModel.applyLighting(64 + modelLightFalloff, 768 + modelLightAmbient * 5, -50, -10, -50, !nonFlatShading); 251 + animatedModel.translate(translateX, translateZ, translateY); 252 + animatedModel.applyLighting(64 + modelLightFalloff, 768 + modelLightAmbient * 5, -50, -10, -50, !nonFlatShading); 253 253 if (anInt794 == 1) 254 - animtedModel.anInt1675 = animtedModel.modelHeight; 255 - animatedModelCache.put(animtedModel, hash); 256 - return animtedModel; 254 + animatedModel.anInt1675 = animatedModel.modelHeight; 255 + animatedModelCache.put(animatedModel, hash); 256 + return animatedModel; 257 257 } 258 258 259 259 public boolean isModelCached() { ··· 454 454 if (model == null) 455 455 return null; 456 456 if (adjustToTerrain || nonFlatShading) 457 - model = new Model(adjustToTerrain, nonFlatShading, 0, model); 457 + model = new Model(adjustToTerrain, nonFlatShading, model); 458 458 if (adjustToTerrain) { 459 459 int l1 = (vertexHeight + vertexHeightRight + vertexHeightTopRight + vertexHeightTop) / 4; 460 460 for (int i2 = 0; i2 < model.vertexCount; i2++) {
+1 -1
src/com/jagex/runescape/cache/media/ImageRGB.java
··· 199 199 200 200 } 201 201 202 - public void drawImage(int y, int x) { 202 + public void drawImage(int x, int y) { 203 203 x += offsetX; 204 204 y += offsetY; 205 205 int rasterizerOffset = x + y * Rasterizer.width;
+2 -2
src/com/jagex/runescape/cache/media/Widget.java
··· 28 28 public int itemAmounts[]; 29 29 public int unknownOne; 30 30 public int enabledHoveredColor; 31 - public int anInt227; 31 + public int animationDuration; 32 32 public int xOffset; 33 33 public boolean isInventory; 34 34 public String disabledText; ··· 36 36 public int childrenX[]; 37 37 public boolean unknownTwo; 38 38 public int opcodes[][]; 39 - public int anInt235; 39 + public int animationFrame; 40 40 public int type; 41 41 public TypeFace typeFaces; 42 42 public int height;
+20 -20
src/com/jagex/runescape/media/Rasterizer3D.java
··· 9 9 public static int anInt1525; 10 10 public static boolean aBoolean1526; 11 11 public static boolean lowMemory = true; 12 - public static boolean aBoolean1528; 12 + public static boolean restrictEdges; 13 13 public static boolean aBoolean1529; 14 14 public static boolean approximateAlphaBlending = true; 15 - public static int anInt1531; 15 + public static int alpha; 16 16 public static int centerX; 17 17 public static int centerY; 18 18 public static int[] anIntArray1534 = new int[512]; ··· 28 28 public static int anIntArrayArray1544[][]; 29 29 public static int anIntArrayArray1545[][] = new int[50][]; 30 30 public static int anIntArray1546[] = new int[50]; 31 - public static int anInt1547; 31 + public static int textureGetCount; 32 32 public static int getRgbLookupTableId[] = new int[0x10000]; 33 33 public static int anIntArrayArray1549[][] = new int[50][]; 34 34 ··· 140 140 } 141 141 142 142 public static int[] method500(int i) { 143 - anIntArray1546[i] = anInt1547++; 143 + anIntArray1546[i] = textureGetCount++; 144 144 if (anIntArrayArray1545[i] != null) 145 145 return anIntArrayArray1545[i]; 146 146 int ai[]; ··· 293 293 return (j << 16) + (k << 8) + l; 294 294 } 295 295 296 - public static void method503(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 296 + public static void drawShadedTriangle(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 297 297 int j2 = 0; 298 298 int k2 = 0; 299 299 if (j != i) { ··· 680 680 public static void method504(int ai[], int i, int j, int k, int l, int i1, int j1, int k1) { 681 681 if (approximateAlphaBlending) { 682 682 int l1; 683 - if (aBoolean1528) { 683 + if (restrictEdges) { 684 684 if (i1 - l > 3) 685 685 l1 = (k1 - j1) / (i1 - l); 686 686 else ··· 706 706 else 707 707 l1 = 0; 708 708 } 709 - if (anInt1531 == 0) { 709 + if (alpha == 0) { 710 710 while (--k >= 0) { 711 711 j = getRgbLookupTableId[j1 >> 8]; 712 712 j1 += l1; ··· 724 724 return; 725 725 } 726 726 } else { 727 - int j2 = anInt1531; 728 - int l2 = 256 - anInt1531; 727 + int j2 = alpha; 728 + int l2 = 256 - alpha; 729 729 while (--k >= 0) { 730 730 j = getRgbLookupTableId[j1 >> 8]; 731 731 j1 += l1; ··· 749 749 if (l >= i1) 750 750 return; 751 751 int i2 = (k1 - j1) / (i1 - l); 752 - if (aBoolean1528) { 752 + if (restrictEdges) { 753 753 if (i1 > Rasterizer.virtualBottomX) 754 754 i1 = Rasterizer.virtualBottomX; 755 755 if (l < 0) { ··· 761 761 } 762 762 i += l; 763 763 k = i1 - l; 764 - if (anInt1531 == 0) { 764 + if (alpha == 0) { 765 765 do { 766 766 ai[i++] = getRgbLookupTableId[j1 >> 8]; 767 767 j1 += i2; 768 768 } while (--k > 0); 769 769 return; 770 770 } 771 - int k2 = anInt1531; 772 - int i3 = 256 - anInt1531; 771 + int k2 = alpha; 772 + int i3 = 256 - alpha; 773 773 do { 774 774 j = getRgbLookupTableId[j1 >> 8]; 775 775 j1 += i2; ··· 1076 1076 } 1077 1077 1078 1078 public static void method506(int ai[], int i, int j, int k, int l, int i1) { 1079 - if (aBoolean1528) { 1079 + if (restrictEdges) { 1080 1080 if (i1 > Rasterizer.virtualBottomX) 1081 1081 i1 = Rasterizer.virtualBottomX; 1082 1082 if (l < 0) ··· 1086 1086 return; 1087 1087 i += l; 1088 1088 k = i1 - l >> 2; 1089 - if (anInt1531 == 0) { 1089 + if (alpha == 0) { 1090 1090 while (--k >= 0) { 1091 1091 ai[i++] = j; 1092 1092 ai[i++] = j; ··· 1098 1098 1099 1099 return; 1100 1100 } 1101 - int j1 = anInt1531; 1102 - int k1 = 256 - anInt1531; 1101 + int j1 = alpha; 1102 + int k1 = 256 - alpha; 1103 1103 j = ((j & 0xff00ff) * k1 >> 8 & 0xff00ff) + ((j & 0xff00) * k1 >> 8 & 0xff00); 1104 1104 while (--k >= 0) { 1105 1105 ai[i++] = j + ((ai[i] & 0xff00ff) * j1 >> 8 & 0xff00ff) + ((ai[i] & 0xff00) * j1 >> 8 & 0xff00); ··· 1112 1112 1113 1113 } 1114 1114 1115 - public static void method507(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2, 1116 - int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4) { 1115 + public static void drawTexturedTriangle(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2, 1116 + int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4) { 1117 1117 int ai[] = method500(k4); 1118 1118 aBoolean1529 = !aBooleanArray1541[k4]; 1119 1119 k2 = j2 - k2; ··· 1652 1652 return; 1653 1653 int j3; 1654 1654 int k3; 1655 - if (aBoolean1528) { 1655 + if (restrictEdges) { 1656 1656 j3 = (k1 - j1) / (i1 - l); 1657 1657 if (i1 > Rasterizer.virtualBottomX) 1658 1658 i1 = Rasterizer.virtualBottomX;
+670 -588
src/com/jagex/runescape/media/renderable/Model.java
··· 7 7 public class Model extends Renderable { 8 8 9 9 10 - public int anInt1636 = 932; 11 - public int anInt1637 = 426; 12 - public boolean aBoolean1638 = false; 13 - public boolean aBoolean1639 = true; 14 - public int anInt1640 = -252; 15 - ; 16 - public boolean aBoolean1641 = false; 17 - public static int anInt1642; 10 + public boolean singleTile = false; 18 11 public static Model EMPTY_MODEL = new Model(); 19 12 public static int anIntArray1644[] = new int[2000]; 20 13 public static int anIntArray1645[] = new int[2000]; ··· 28 21 public int trianglePointsX[]; 29 22 public int trianglePointsY[]; 30 23 public int trianglePointsZ[]; 31 - public int anIntArray1656[]; 32 - public int anIntArray1657[]; 33 - public int anIntArray1658[]; 34 - public int texturePoints[]; 24 + public int triangleHSLA[]; 25 + public int triangleHSLB[]; 26 + public int triangleHSLC[]; 27 + public int triangleDrawType[]; 35 28 public int trianglePriorities[]; 36 29 public int triangleAlphaValues[]; 37 30 public int triangleColorValues[]; 38 - public int anInt1663; 31 + public int trianglePriority; 39 32 public int texturedTriangleCount; 40 33 public int texturedTrianglePointsX[]; 41 34 public int texturedTrianglePointsY[]; 42 35 public int texturedTrianglePointsZ[]; 43 36 public int anInt1668; 44 - public int anInt1669; 45 - public int anInt1670; 46 - public int shadowIntensity; 37 + public int worldX; 38 + public int worldZ; 39 + public int diagonal2DAboveOrigin; 47 40 public int maxY; 48 - public int anInt1673; 49 - public int anInt1674; 41 + public int diagonal3D; 42 + public int diagonal3DAboveOrigin; 50 43 public int anInt1675; 51 44 public int vertexSkins[]; 52 45 public int triangleSkinValues[]; 53 46 public int vectorSkin[][]; 54 47 public int triangleSkin[][]; 55 48 public boolean oneSquareModel = false; 56 - public VertexNormal aClass40Array1681[]; 49 + public VertexNormal vertexNormalOffset[]; 57 50 public static ModelHeader modelHeaders[]; 58 51 public static Requester requester; 59 - public static boolean aBooleanArray1684[] = new boolean[4096]; 52 + public static boolean restrictEdges[] = new boolean[4096]; 60 53 public static boolean aBooleanArray1685[] = new boolean[4096]; 61 - public static int anIntArray1686[] = new int[4096]; 62 - public static int anIntArray1687[] = new int[4096]; 63 - public static int anIntArray1688[] = new int[4096]; 64 - public static int anIntArray1689[] = new int[4096]; 65 - public static int anIntArray1690[] = new int[4096]; 66 - public static int anIntArray1691[] = new int[4096]; 54 + public static int vertexScreenX[] = new int[4096]; 55 + public static int vertexScreenY[] = new int[4096]; 56 + public static int vertexScreenZ[] = new int[4096]; 57 + public static int vertexMovedX[] = new int[4096]; 58 + public static int vertexMovedY[] = new int[4096]; 59 + public static int vertexMovedZ[] = new int[4096]; 67 60 public static int anIntArray1692[] = new int[1500]; 68 61 public static int anIntArrayArray1693[][] = new int[1500][512]; 69 62 public static int anIntArray1694[] = new int[12]; ··· 78 71 public static int vertexYModifier; 79 72 public static int vertexZModifier; 80 73 public static boolean aBoolean1705; 81 - public static int anInt1706; 82 - public static int anInt1707; 83 - public static int anInt1708; 74 + public static int cursorX; 75 + public static int cursorY; 76 + public static int resourceCount; 84 77 public static int anIntArray1709[] = new int[1000]; 85 78 public static int SINE[]; 86 79 public static int COSINE[]; 87 - public static int anIntArray1712[]; 80 + public static int HSLtoRGB[]; 88 81 public static int anIntArray1713[]; 89 82 90 83 public Model() { ··· 93 86 94 87 public static void reset() { 95 88 Model.modelHeaders = null; 96 - Model.aBooleanArray1684 = null; 89 + Model.restrictEdges = null; 97 90 Model.aBooleanArray1685 = null; 98 - Model.anIntArray1686 = null; 99 - Model.anIntArray1687 = null; 100 - Model.anIntArray1688 = null; 101 - Model.anIntArray1689 = null; 102 - Model.anIntArray1690 = null; 103 - Model.anIntArray1691 = null; 91 + Model.vertexScreenX = null; 92 + Model.vertexScreenY = null; 93 + Model.vertexScreenZ = null; 94 + Model.vertexMovedX = null; 95 + Model.vertexMovedY = null; 96 + Model.vertexMovedZ = null; 104 97 Model.anIntArray1692 = null; 105 98 Model.anIntArrayArray1693 = null; 106 99 Model.anIntArray1694 = null; ··· 110 103 Model.anIntArray1698 = null; 111 104 Model.SINE = null; 112 105 Model.COSINE = null; 113 - Model.anIntArray1712 = null; 106 + Model.HSLtoRGB = null; 114 107 Model.anIntArray1713 = null; 115 108 116 109 } ··· 150 143 modelHeader.triangleTypeOffset = offset; 151 144 offset += modelHeader.triangleCount; 152 145 modelHeader.trianglePriorityOffset = offset; 153 - if (useTrianglePriority == 255) 146 + if (useTrianglePriority == 255) { 154 147 offset += modelHeader.triangleCount; 155 - else 148 + } else { 156 149 modelHeader.trianglePriorityOffset = -useTrianglePriority - 1; 150 + } 157 151 modelHeader.triangleSkinOffset = offset; 158 - if (useTriangleSkinning == 1) 152 + if (useTriangleSkinning == 1) { 159 153 offset += modelHeader.triangleCount; 160 - else 154 + } else { 161 155 modelHeader.triangleSkinOffset = -1; 156 + } 162 157 modelHeader.texturePointerOffset = offset; 163 - if (useTextures == 1) 158 + if (useTextures == 1) { 164 159 offset += modelHeader.triangleCount; 165 - else 160 + } else { 166 161 modelHeader.texturePointerOffset = -1; 162 + } 167 163 modelHeader.vertexSkinOffset = offset; 168 - if (useVertexSkinning == 1) 164 + if (useVertexSkinning == 1) { 169 165 offset += modelHeader.vertexCount; 170 - else 166 + } else { 171 167 modelHeader.vertexSkinOffset = -1; 168 + } 172 169 modelHeader.triangleAlphaOffset = offset; 173 - if (useTransparency == 1) 170 + if (useTransparency == 1) { 174 171 offset += modelHeader.triangleCount; 175 - else 172 + } else { 176 173 modelHeader.triangleAlphaOffset = -1; 174 + } 177 175 modelHeader.triangleDataOffset = offset; 178 176 offset += triangleDataLength; 179 177 modelHeader.colorDataOffset = offset; ··· 193 191 } 194 192 195 193 public static Model getModel(int model) { 196 - if (Model.modelHeaders == null) 194 + if (Model.modelHeaders == null) { 197 195 return null; 196 + } 198 197 ModelHeader modelHeader = Model.modelHeaders[model]; 199 198 if (modelHeader == null) { 200 199 Model.requester.requestModel(model); ··· 205 204 } 206 205 207 206 public static boolean loaded(int id) { 208 - if (Model.modelHeaders == null) 207 + if (Model.modelHeaders == null) { 209 208 return false; 209 + } 210 210 ModelHeader modelHeader = Model.modelHeaders[id]; 211 211 if (modelHeader == null) { 212 212 Model.requester.requestModel(id); ··· 218 218 219 219 220 220 public Model(int modelId) { 221 - aBoolean1638 = false; 222 - aBoolean1639 = true; 223 - anInt1640 = -252; 224 - anInt1642++; 221 + singleTile = false; 225 222 ModelHeader modelHeader = modelHeaders[modelId]; 226 223 vertexCount = modelHeader.vertexCount; 227 224 triangleCount = modelHeader.triangleCount; ··· 235 232 texturedTrianglePointsX = new int[texturedTriangleCount]; 236 233 texturedTrianglePointsY = new int[texturedTriangleCount]; 237 234 texturedTrianglePointsZ = new int[texturedTriangleCount]; 238 - if (modelHeader.vertexSkinOffset >= 0) 235 + if (modelHeader.vertexSkinOffset >= 0) { 239 236 vertexSkins = new int[vertexCount]; 240 - if (modelHeader.texturePointerOffset >= 0) 241 - texturePoints = new int[triangleCount]; 242 - if (modelHeader.trianglePriorityOffset >= 0) 237 + } 238 + if (modelHeader.texturePointerOffset >= 0) { 239 + triangleDrawType = new int[triangleCount]; 240 + } 241 + if (modelHeader.trianglePriorityOffset >= 0) { 243 242 trianglePriorities = new int[triangleCount]; 244 - else 245 - anInt1663 = -modelHeader.trianglePriorityOffset - 1; 246 - if (modelHeader.triangleAlphaOffset >= 0) 243 + } else { 244 + trianglePriority = -modelHeader.trianglePriorityOffset - 1; 245 + } 246 + if (modelHeader.triangleAlphaOffset >= 0) { 247 247 triangleAlphaValues = new int[triangleCount]; 248 - if (modelHeader.triangleSkinOffset >= 0) 248 + } 249 + if (modelHeader.triangleSkinOffset >= 0) { 249 250 triangleSkinValues = new int[triangleCount]; 251 + } 250 252 triangleColorValues = new int[triangleCount]; 251 253 Buffer vertexDirectionOffsetBuffer = new Buffer(modelHeader.modelData); 252 254 vertexDirectionOffsetBuffer.currentPosition = modelHeader.vertexDirectionOffset; ··· 264 266 for (int vertex = 0; vertex < vertexCount; vertex++) { 265 267 int flag = vertexDirectionOffsetBuffer.getUnsignedByte(); 266 268 int currentOffsetX = 0; 267 - if ((flag & 1) != 0) 269 + if ((flag & 1) != 0) { 268 270 currentOffsetX = xDataOffsetBuffer.getSignedSmart(); 271 + } 269 272 int currentOffsetY = 0; 270 - if ((flag & 2) != 0) 273 + if ((flag & 2) != 0) { 271 274 currentOffsetY = yDataOffsetBuffer.getSignedSmart(); 275 + } 272 276 int currentOffsetZ = 0; 273 - if ((flag & 4) != 0) 277 + if ((flag & 4) != 0) { 274 278 currentOffsetZ = zDataOffsetBuffer.getSignedSmart(); 279 + } 275 280 verticesX[vertex] = baseOffsetX + currentOffsetX; 276 281 verticesY[vertex] = baseOffsetY + currentOffsetY; 277 282 verticesZ[vertex] = baseOffsetz + currentOffsetZ; 278 283 baseOffsetX = verticesX[vertex]; 279 284 baseOffsetY = verticesY[vertex]; 280 285 baseOffsetz = verticesZ[vertex]; 281 - if (vertexSkins != null) 286 + if (vertexSkins != null) { 282 287 vertexSkins[vertex] = vertexSkinOffsetBuffer.getUnsignedByte(); 288 + } 283 289 } 284 290 285 291 vertexDirectionOffsetBuffer.currentPosition = modelHeader.colorDataOffset; ··· 289 295 vertexSkinOffsetBuffer.currentPosition = modelHeader.triangleSkinOffset; 290 296 for (int l1 = 0; l1 < triangleCount; l1++) { 291 297 triangleColorValues[l1] = vertexDirectionOffsetBuffer.getUnsignedLEShort(); 292 - if (texturePoints != null) 293 - texturePoints[l1] = xDataOffsetBuffer.getUnsignedByte(); 294 - if (trianglePriorities != null) 298 + if (triangleDrawType != null) { 299 + triangleDrawType[l1] = xDataOffsetBuffer.getUnsignedByte(); 300 + } 301 + if (trianglePriorities != null) { 295 302 trianglePriorities[l1] = yDataOffsetBuffer.getUnsignedByte(); 296 - if (triangleAlphaValues != null) 303 + } 304 + if (triangleAlphaValues != null) { 297 305 triangleAlphaValues[l1] = zDataOffsetBuffer.getUnsignedByte(); 298 - if (triangleSkinValues != null) 306 + } 307 + if (triangleSkinValues != null) { 299 308 triangleSkinValues[l1] = vertexSkinOffsetBuffer.getUnsignedByte(); 309 + } 300 310 } 301 311 302 312 vertexDirectionOffsetBuffer.currentPosition = modelHeader.triangleDataOffset; ··· 355 365 356 366 } 357 367 358 - public Model(int i, Model subModels[]) { 359 - aBoolean1638 = false; 360 - aBoolean1639 = true; 361 - anInt1640 = -252; 362 - anInt1642++; 363 - boolean flag = false; 364 - boolean flag1 = false; 365 - boolean flag2 = false; 366 - boolean flag3 = false; 368 + public Model(int modelCount, Model subModels[]) { 369 + singleTile = false; 370 + boolean setDrawType = false; 371 + boolean setPriority = false; 372 + boolean setAlpha = false; 373 + boolean setSkins = false; 367 374 vertexCount = 0; 368 375 triangleCount = 0; 369 376 texturedTriangleCount = 0; 370 - anInt1663 = -1; 371 - for (int j = 0; j < i; j++) { 372 - Model class50_sub1_sub4_sub4 = subModels[j]; 373 - if (class50_sub1_sub4_sub4 != null) { 374 - vertexCount += class50_sub1_sub4_sub4.vertexCount; 375 - triangleCount += class50_sub1_sub4_sub4.triangleCount; 376 - texturedTriangleCount += class50_sub1_sub4_sub4.texturedTriangleCount; 377 - flag |= class50_sub1_sub4_sub4.texturePoints != null; 378 - if (class50_sub1_sub4_sub4.trianglePriorities != null) { 379 - flag1 = true; 377 + trianglePriority = -1; 378 + for (int m = 0; m < modelCount; m++) { 379 + Model model = subModels[m]; 380 + if (model != null) { 381 + vertexCount += model.vertexCount; 382 + triangleCount += model.triangleCount; 383 + texturedTriangleCount += model.texturedTriangleCount; 384 + setDrawType |= model.triangleDrawType != null; 385 + if (model.trianglePriorities != null) { 386 + setPriority = true; 380 387 } else { 381 - if (anInt1663 == -1) 382 - anInt1663 = class50_sub1_sub4_sub4.anInt1663; 383 - if (anInt1663 != class50_sub1_sub4_sub4.anInt1663) 384 - flag1 = true; 388 + if (trianglePriority == -1) { 389 + trianglePriority = model.trianglePriority; 390 + } 391 + if (trianglePriority != model.trianglePriority) { 392 + setPriority = true; 393 + } 385 394 } 386 - flag2 |= class50_sub1_sub4_sub4.triangleAlphaValues != null; 387 - flag3 |= class50_sub1_sub4_sub4.triangleSkinValues != null; 395 + setAlpha |= model.triangleAlphaValues != null; 396 + setSkins |= model.triangleSkinValues != null; 388 397 } 389 398 } 390 399 ··· 398 407 texturedTrianglePointsX = new int[texturedTriangleCount]; 399 408 texturedTrianglePointsY = new int[texturedTriangleCount]; 400 409 texturedTrianglePointsZ = new int[texturedTriangleCount]; 401 - if (flag) 402 - texturePoints = new int[triangleCount]; 403 - if (flag1) 410 + if (setDrawType) { 411 + triangleDrawType = new int[triangleCount]; 412 + } 413 + if (setPriority) { 404 414 trianglePriorities = new int[triangleCount]; 405 - if (flag2) 415 + } 416 + if (setAlpha) { 406 417 triangleAlphaValues = new int[triangleCount]; 407 - if (flag3) 418 + } 419 + if (setSkins) { 408 420 triangleSkinValues = new int[triangleCount]; 421 + } 409 422 triangleColorValues = new int[triangleCount]; 410 423 vertexCount = 0; 411 424 triangleCount = 0; 412 425 texturedTriangleCount = 0; 413 - int k = 0; 414 - for (int l = 0; l < i; l++) { 415 - Model model_44_ = subModels[l]; 416 - if (model_44_ != null) { 417 - for (int i1 = 0; i1 < model_44_.triangleCount; i1++) { 418 - if (flag) 419 - if (model_44_.texturePoints == null) { 420 - texturePoints[triangleCount] = 0; 426 + int count = 0; 427 + for (int m = 0; m < modelCount; m++) { 428 + Model model = subModels[m]; 429 + if (model != null) { 430 + for (int triangle = 0; triangle < model.triangleCount; triangle++) { 431 + if (setDrawType) { 432 + if (model.triangleDrawType == null) { 433 + triangleDrawType[triangleCount] = 0; 434 + } else { 435 + int drawType = model.triangleDrawType[triangle]; 436 + if ((drawType & 2) == 2) { 437 + drawType += count << 2; 438 + } 439 + triangleDrawType[triangleCount] = drawType; 440 + } 441 + } 442 + if (setPriority) { 443 + if (model.trianglePriorities == null) { 444 + trianglePriorities[triangleCount] = model.trianglePriority; 421 445 } else { 422 - int j1 = model_44_.texturePoints[i1]; 423 - if ((j1 & 2) == 2) 424 - j1 += k << 2; 425 - texturePoints[triangleCount] = j1; 446 + trianglePriorities[triangleCount] = model.trianglePriorities[triangle]; 426 447 } 427 - if (flag1) 428 - if (model_44_.trianglePriorities == null) 429 - trianglePriorities[triangleCount] = model_44_.anInt1663; 430 - else 431 - trianglePriorities[triangleCount] = model_44_.trianglePriorities[i1]; 432 - if (flag2) 433 - if (model_44_.triangleAlphaValues == null) 448 + } 449 + if (setAlpha) { 450 + if (model.triangleAlphaValues == null) { 434 451 triangleAlphaValues[triangleCount] = 0; 435 - else 436 - triangleAlphaValues[triangleCount] = model_44_.triangleAlphaValues[i1]; 437 - if (flag3 && model_44_.triangleSkinValues != null) 438 - triangleSkinValues[triangleCount] = model_44_.triangleSkinValues[i1]; 439 - triangleColorValues[triangleCount] = model_44_.triangleColorValues[i1]; 440 - trianglePointsX[triangleCount] = getFirstIdenticalVertexIndex(model_44_, 441 - model_44_.trianglePointsX[i1]); 442 - trianglePointsY[triangleCount] = getFirstIdenticalVertexIndex(model_44_, 443 - model_44_.trianglePointsY[i1]); 444 - trianglePointsZ[triangleCount] = getFirstIdenticalVertexIndex(model_44_, 445 - model_44_.trianglePointsZ[i1]); 452 + } else { 453 + triangleAlphaValues[triangleCount] = model.triangleAlphaValues[triangle]; 454 + } 455 + } 456 + if (setSkins && model.triangleSkinValues != null) { 457 + triangleSkinValues[triangleCount] = model.triangleSkinValues[triangle]; 458 + } 459 + triangleColorValues[triangleCount] = model.triangleColorValues[triangle]; 460 + trianglePointsX[triangleCount] = getFirstIdenticalVertexIndex(model, 461 + model.trianglePointsX[triangle]); 462 + trianglePointsY[triangleCount] = getFirstIdenticalVertexIndex(model, 463 + model.trianglePointsY[triangle]); 464 + trianglePointsZ[triangleCount] = getFirstIdenticalVertexIndex(model, 465 + model.trianglePointsZ[triangle]); 446 466 triangleCount++; 447 467 } 448 468 449 - for (int k1 = 0; k1 < model_44_.texturedTriangleCount; k1++) { 450 - texturedTrianglePointsX[texturedTriangleCount] = getFirstIdenticalVertexIndex(model_44_, 451 - model_44_.texturedTrianglePointsX[k1]); 452 - texturedTrianglePointsY[texturedTriangleCount] = getFirstIdenticalVertexIndex(model_44_, 453 - model_44_.texturedTrianglePointsY[k1]); 454 - texturedTrianglePointsZ[texturedTriangleCount] = getFirstIdenticalVertexIndex(model_44_, 455 - model_44_.texturedTrianglePointsZ[k1]); 469 + for (int triangle = 0; triangle < model.texturedTriangleCount; triangle++) { 470 + texturedTrianglePointsX[texturedTriangleCount] = getFirstIdenticalVertexIndex(model, 471 + model.texturedTrianglePointsX[triangle]); 472 + texturedTrianglePointsY[texturedTriangleCount] = getFirstIdenticalVertexIndex(model, 473 + model.texturedTrianglePointsY[triangle]); 474 + texturedTrianglePointsZ[texturedTriangleCount] = getFirstIdenticalVertexIndex(model, 475 + model.texturedTrianglePointsZ[triangle]); 456 476 texturedTriangleCount++; 457 477 } 458 478 459 - k += model_44_.texturedTriangleCount; 479 + count += model.texturedTriangleCount; 460 480 } 461 481 } 462 482 463 483 } 464 484 465 - public Model(int i, int j, Model[] models) { 466 - aBoolean1638 = false; 467 - aBoolean1639 = true; 468 - anInt1640 = -252; 469 - anInt1642++; 485 + public Model(Model[] models) { 486 + final int modelCount = 2;// was parameter 487 + singleTile = false; 470 488 boolean flag1 = false; 471 489 boolean flag2 = false; 472 490 boolean flag3 = false; ··· 474 492 vertexCount = 0; 475 493 triangleCount = 0; 476 494 texturedTriangleCount = 0; 477 - anInt1663 = -1; 478 - for (int k = 0; k < i; k++) { 479 - Model class50_sub1_sub4_sub4 = models[k]; 480 - if (class50_sub1_sub4_sub4 != null) { 481 - vertexCount += class50_sub1_sub4_sub4.vertexCount; 482 - triangleCount += class50_sub1_sub4_sub4.triangleCount; 483 - texturedTriangleCount += class50_sub1_sub4_sub4.texturedTriangleCount; 484 - flag1 |= class50_sub1_sub4_sub4.texturePoints != null; 485 - if (class50_sub1_sub4_sub4.trianglePriorities != null) { 495 + trianglePriority = -1; 496 + for (int m = 0; m < modelCount; m++) { 497 + Model model = models[m]; 498 + if (model != null) { 499 + vertexCount += model.vertexCount; 500 + triangleCount += model.triangleCount; 501 + texturedTriangleCount += model.texturedTriangleCount; 502 + flag1 |= model.triangleDrawType != null; 503 + if (model.trianglePriorities != null) { 486 504 flag2 = true; 487 505 } else { 488 - if (anInt1663 == -1) 489 - anInt1663 = class50_sub1_sub4_sub4.anInt1663; 490 - if (anInt1663 != class50_sub1_sub4_sub4.anInt1663) 506 + if (trianglePriority == -1) { 507 + trianglePriority = model.trianglePriority; 508 + } 509 + if (trianglePriority != model.trianglePriority) { 491 510 flag2 = true; 511 + } 492 512 } 493 - flag3 |= class50_sub1_sub4_sub4.triangleAlphaValues != null; 494 - flag4 |= class50_sub1_sub4_sub4.triangleColorValues != null; 513 + flag3 |= model.triangleAlphaValues != null; 514 + flag4 |= model.triangleColorValues != null; 495 515 } 496 516 } 497 517 ··· 501 521 trianglePointsX = new int[triangleCount]; 502 522 trianglePointsY = new int[triangleCount]; 503 523 trianglePointsZ = new int[triangleCount]; 504 - anIntArray1656 = new int[triangleCount]; 505 - anIntArray1657 = new int[triangleCount]; 506 - anIntArray1658 = new int[triangleCount]; 524 + triangleHSLA = new int[triangleCount]; 525 + triangleHSLB = new int[triangleCount]; 526 + triangleHSLC = new int[triangleCount]; 507 527 texturedTrianglePointsX = new int[texturedTriangleCount]; 508 528 texturedTrianglePointsY = new int[texturedTriangleCount]; 509 529 texturedTrianglePointsZ = new int[texturedTriangleCount]; 510 - if (flag1) 511 - texturePoints = new int[triangleCount]; 512 - if (flag2) 530 + if (flag1) { 531 + triangleDrawType = new int[triangleCount]; 532 + } 533 + if (flag2) { 513 534 trianglePriorities = new int[triangleCount]; 514 - if (flag3) 535 + } 536 + if (flag3) { 515 537 triangleAlphaValues = new int[triangleCount]; 516 - if (flag4) 538 + } 539 + if (flag4) { 517 540 triangleColorValues = new int[triangleCount]; 541 + } 518 542 vertexCount = 0; 519 - if (j != 0) 520 - throw new NullPointerException(); 521 543 triangleCount = 0; 522 544 texturedTriangleCount = 0; 523 - int l = 0; 524 - for (int i1 = 0; i1 < i; i1++) { 525 - Model class50_sub1_sub4_sub4_1 = models[i1]; 526 - if (class50_sub1_sub4_sub4_1 != null) { 527 - int j1 = vertexCount; 528 - for (int k1 = 0; k1 < class50_sub1_sub4_sub4_1.vertexCount; k1++) { 529 - verticesX[vertexCount] = class50_sub1_sub4_sub4_1.verticesX[k1]; 530 - verticesY[vertexCount] = class50_sub1_sub4_sub4_1.verticesY[k1]; 531 - verticesZ[vertexCount] = class50_sub1_sub4_sub4_1.verticesZ[k1]; 545 + int count = 0; 546 + for (int m = 0; m < modelCount; m++) { 547 + Model model = models[m]; 548 + if (model != null) { 549 + int v = vertexCount; 550 + for (int vertex = 0; vertex < model.vertexCount; vertex++) { 551 + verticesX[vertexCount] = model.verticesX[vertex]; 552 + verticesY[vertexCount] = model.verticesY[vertex]; 553 + verticesZ[vertexCount] = model.verticesZ[vertex]; 532 554 vertexCount++; 533 555 } 534 556 535 - for (int l1 = 0; l1 < class50_sub1_sub4_sub4_1.triangleCount; l1++) { 536 - trianglePointsX[triangleCount] = class50_sub1_sub4_sub4_1.trianglePointsX[l1] + j1; 537 - trianglePointsY[triangleCount] = class50_sub1_sub4_sub4_1.trianglePointsY[l1] + j1; 538 - trianglePointsZ[triangleCount] = class50_sub1_sub4_sub4_1.trianglePointsZ[l1] + j1; 539 - anIntArray1656[triangleCount] = class50_sub1_sub4_sub4_1.anIntArray1656[l1]; 540 - anIntArray1657[triangleCount] = class50_sub1_sub4_sub4_1.anIntArray1657[l1]; 541 - anIntArray1658[triangleCount] = class50_sub1_sub4_sub4_1.anIntArray1658[l1]; 542 - if (flag1) 543 - if (class50_sub1_sub4_sub4_1.texturePoints == null) { 544 - texturePoints[triangleCount] = 0; 557 + for (int triangle = 0; triangle < model.triangleCount; triangle++) { 558 + trianglePointsX[triangleCount] = model.trianglePointsX[triangle] + v; 559 + trianglePointsY[triangleCount] = model.trianglePointsY[triangle] + v; 560 + trianglePointsZ[triangleCount] = model.trianglePointsZ[triangle] + v; 561 + triangleHSLA[triangleCount] = model.triangleHSLA[triangle]; 562 + triangleHSLB[triangleCount] = model.triangleHSLB[triangle]; 563 + triangleHSLC[triangleCount] = model.triangleHSLC[triangle]; 564 + if (flag1) { 565 + if (model.triangleDrawType == null) { 566 + triangleDrawType[triangleCount] = 0; 567 + } else { 568 + int drawtype = model.triangleDrawType[triangle]; 569 + if ((drawtype & 2) == 2) { 570 + drawtype += count << 2; 571 + } 572 + triangleDrawType[triangleCount] = drawtype; 573 + } 574 + } 575 + if (flag2) { 576 + if (model.trianglePriorities == null) { 577 + trianglePriorities[triangleCount] = model.trianglePriority; 545 578 } else { 546 - int i2 = class50_sub1_sub4_sub4_1.texturePoints[l1]; 547 - if ((i2 & 2) == 2) 548 - i2 += l << 2; 549 - texturePoints[triangleCount] = i2; 579 + trianglePriorities[triangleCount] = model.trianglePriorities[triangle]; 550 580 } 551 - if (flag2) 552 - if (class50_sub1_sub4_sub4_1.trianglePriorities == null) 553 - trianglePriorities[triangleCount] = class50_sub1_sub4_sub4_1.anInt1663; 554 - else 555 - trianglePriorities[triangleCount] = class50_sub1_sub4_sub4_1.trianglePriorities[l1]; 556 - if (flag3) 557 - if (class50_sub1_sub4_sub4_1.triangleAlphaValues == null) 581 + } 582 + if (flag3) { 583 + if (model.triangleAlphaValues == null) { 558 584 triangleAlphaValues[triangleCount] = 0; 559 - else 560 - triangleAlphaValues[triangleCount] = class50_sub1_sub4_sub4_1.triangleAlphaValues[l1]; 561 - if (flag4 && class50_sub1_sub4_sub4_1.triangleColorValues != null) 562 - triangleColorValues[triangleCount] = class50_sub1_sub4_sub4_1.triangleColorValues[l1]; 585 + } else { 586 + triangleAlphaValues[triangleCount] = model.triangleAlphaValues[triangle]; 587 + } 588 + } 589 + if (flag4 && model.triangleColorValues != null) { 590 + triangleColorValues[triangleCount] = model.triangleColorValues[triangle]; 591 + } 563 592 triangleCount++; 564 593 } 565 594 566 - for (int j2 = 0; j2 < class50_sub1_sub4_sub4_1.texturedTriangleCount; j2++) { 567 - texturedTrianglePointsX[texturedTriangleCount] = class50_sub1_sub4_sub4_1.texturedTrianglePointsX[j2] + j1; 568 - texturedTrianglePointsY[texturedTriangleCount] = class50_sub1_sub4_sub4_1.texturedTrianglePointsY[j2] + j1; 569 - texturedTrianglePointsZ[texturedTriangleCount] = class50_sub1_sub4_sub4_1.texturedTrianglePointsZ[j2] + j1; 595 + for (int triangle = 0; triangle < model.texturedTriangleCount; triangle++) { 596 + texturedTrianglePointsX[texturedTriangleCount] = model.texturedTrianglePointsX[triangle] + v; 597 + texturedTrianglePointsY[texturedTriangleCount] = model.texturedTrianglePointsY[triangle] + v; 598 + texturedTrianglePointsZ[texturedTriangleCount] = model.texturedTrianglePointsZ[triangle] + v; 570 599 texturedTriangleCount++; 571 600 } 572 601 573 - l += class50_sub1_sub4_sub4_1.texturedTriangleCount; 602 + count += model.texturedTriangleCount; 574 603 } 575 604 } 576 605 ··· 579 608 580 609 public Model(boolean flag2, 581 610 Model model, boolean flag3) { 582 - aBoolean1638 = false; 583 - aBoolean1639 = true; 584 - anInt1640 = -252; 585 - anInt1642++; 611 + singleTile = false; 586 612 vertexCount = model.vertexCount; 587 613 triangleCount = model.triangleCount; 588 614 texturedTriangleCount = model.texturedTriangleCount; ··· 596 622 } 597 623 598 624 599 - if (flag2) 600 - 601 - { 625 + if (flag2) { 602 626 triangleColorValues = model.triangleColorValues; 603 - } else 604 - 605 - { 627 + } else { 606 628 triangleColorValues = new int[triangleCount]; 607 - for (int j = 0; j < triangleCount; j++) 608 - triangleColorValues[j] = model.triangleColorValues[j]; 629 + System.arraycopy(model.triangleColorValues, 0, triangleColorValues, 0, triangleCount); 609 630 610 631 } 611 - if (flag3) 612 - 613 - { 632 + if (flag3) { 614 633 triangleAlphaValues = model.triangleAlphaValues; 615 - } else 616 - 617 - { 634 + } else { 618 635 triangleAlphaValues = new int[triangleCount]; 619 636 if (model.triangleAlphaValues == null) { 620 - for (int k = 0; k < triangleCount; k++) 621 - triangleAlphaValues[k] = 0; 637 + for (int triangle = 0; triangle < triangleCount; triangle++) { 638 + triangleAlphaValues[triangle] = 0; 639 + } 622 640 623 641 } else { 624 - for (int l = 0; l < triangleCount; l++) 625 - triangleAlphaValues[l] = model.triangleAlphaValues[l]; 642 + System.arraycopy(model.triangleAlphaValues, 0, triangleAlphaValues, 0, triangleCount); 626 643 627 644 } 628 645 } 629 646 630 647 vertexSkins = model.vertexSkins; 631 648 triangleSkinValues = model.triangleSkinValues; 632 - texturePoints = model.texturePoints; 649 + triangleDrawType = model.triangleDrawType; 633 650 trianglePointsX = model.trianglePointsX; 634 651 trianglePointsY = model.trianglePointsY; 635 652 trianglePointsZ = model.trianglePointsZ; 636 653 trianglePriorities = model.trianglePriorities; 637 - anInt1663 = model.anInt1663; 654 + trianglePriority = model.trianglePriority; 638 655 texturedTrianglePointsX = model.texturedTrianglePointsX; 639 656 texturedTrianglePointsY = model.texturedTrianglePointsY; 640 657 texturedTrianglePointsZ = model.texturedTrianglePointsZ; 641 658 } 642 659 643 - public Model(boolean flag, boolean flag1, int i, Model class50_sub1_sub4_sub4) { 644 - aBoolean1638 = false; 645 - aBoolean1639 = true; 646 - anInt1640 = -252; 647 - anInt1642++; 648 - vertexCount = class50_sub1_sub4_sub4.vertexCount; 649 - triangleCount = class50_sub1_sub4_sub4.triangleCount; 650 - texturedTriangleCount = class50_sub1_sub4_sub4.texturedTriangleCount; 660 + public Model(boolean flag, boolean flag1, Model model) { 661 + singleTile = false; 662 + vertexCount = model.vertexCount; 663 + triangleCount = model.triangleCount; 664 + texturedTriangleCount = model.texturedTriangleCount; 651 665 if (flag) { 652 666 verticesY = new int[vertexCount]; 653 - for (int j = 0; j < vertexCount; j++) 654 - verticesY[j] = class50_sub1_sub4_sub4.verticesY[j]; 667 + System.arraycopy(model.verticesY, 0, verticesY, 0, vertexCount); 655 668 656 669 } else { 657 - verticesY = class50_sub1_sub4_sub4.verticesY; 670 + verticesY = model.verticesY; 658 671 } 659 672 if (flag1) { 660 - anIntArray1656 = new int[triangleCount]; 661 - anIntArray1657 = new int[triangleCount]; 662 - anIntArray1658 = new int[triangleCount]; 663 - for (int k = 0; k < triangleCount; k++) { 664 - anIntArray1656[k] = class50_sub1_sub4_sub4.anIntArray1656[k]; 665 - anIntArray1657[k] = class50_sub1_sub4_sub4.anIntArray1657[k]; 666 - anIntArray1658[k] = class50_sub1_sub4_sub4.anIntArray1658[k]; 673 + triangleHSLA = new int[triangleCount]; 674 + triangleHSLB = new int[triangleCount]; 675 + triangleHSLC = new int[triangleCount]; 676 + for (int triangle = 0; triangle < triangleCount; triangle++) { 677 + triangleHSLA[triangle] = model.triangleHSLA[triangle]; 678 + triangleHSLB[triangle] = model.triangleHSLB[triangle]; 679 + triangleHSLC[triangle] = model.triangleHSLC[triangle]; 667 680 } 668 681 669 - texturePoints = new int[triangleCount]; 670 - if (class50_sub1_sub4_sub4.texturePoints == null) { 671 - for (int l = 0; l < triangleCount; l++) 672 - texturePoints[l] = 0; 682 + triangleDrawType = new int[triangleCount]; 683 + if (model.triangleDrawType == null) { 684 + for (int triangle = 0; triangle < triangleCount; triangle++) { 685 + triangleDrawType[triangle] = 0; 686 + } 673 687 674 688 } else { 675 - for (int i1 = 0; i1 < triangleCount; i1++) 676 - texturePoints[i1] = class50_sub1_sub4_sub4.texturePoints[i1]; 689 + System.arraycopy(model.triangleDrawType, 0, triangleDrawType, 0, triangleCount); 677 690 678 691 } 679 692 super.verticesNormal = new VertexNormal[vertexCount]; 680 - for (int j1 = 0; j1 < vertexCount; j1++) { 681 - VertexNormal class40 = super.verticesNormal[j1] = new VertexNormal(); 682 - VertexNormal class40_1 = ((Renderable) (class50_sub1_sub4_sub4)).verticesNormal[j1]; 683 - class40.x = class40_1.x; 684 - class40.y = class40_1.y; 685 - class40.z = class40_1.z; 686 - class40.magnitude = class40_1.magnitude; 693 + for (int vertex = 0; vertex < vertexCount; vertex++) { 694 + VertexNormal vertexNormalNew = super.verticesNormal[vertex] = new VertexNormal(); 695 + VertexNormal vertexNormalOld = model.verticesNormal[vertex]; 696 + vertexNormalNew.x = vertexNormalOld.x; 697 + vertexNormalNew.y = vertexNormalOld.y; 698 + vertexNormalNew.z = vertexNormalOld.z; 699 + vertexNormalNew.magnitude = vertexNormalOld.magnitude; 687 700 } 688 701 689 - aClass40Array1681 = class50_sub1_sub4_sub4.aClass40Array1681; 702 + vertexNormalOffset = model.vertexNormalOffset; 690 703 } else { 691 - anIntArray1656 = class50_sub1_sub4_sub4.anIntArray1656; 692 - anIntArray1657 = class50_sub1_sub4_sub4.anIntArray1657; 693 - anIntArray1658 = class50_sub1_sub4_sub4.anIntArray1658; 694 - texturePoints = class50_sub1_sub4_sub4.texturePoints; 704 + triangleHSLA = model.triangleHSLA; 705 + triangleHSLB = model.triangleHSLB; 706 + triangleHSLC = model.triangleHSLC; 707 + triangleDrawType = model.triangleDrawType; 695 708 } 696 - verticesX = class50_sub1_sub4_sub4.verticesX; 697 - verticesZ = class50_sub1_sub4_sub4.verticesZ; 698 - if (i != 0) 699 - aBoolean1638 = !aBoolean1638; 700 - triangleColorValues = class50_sub1_sub4_sub4.triangleColorValues; 701 - triangleAlphaValues = class50_sub1_sub4_sub4.triangleAlphaValues; 702 - trianglePriorities = class50_sub1_sub4_sub4.trianglePriorities; 703 - anInt1663 = class50_sub1_sub4_sub4.anInt1663; 704 - trianglePointsX = class50_sub1_sub4_sub4.trianglePointsX; 705 - trianglePointsY = class50_sub1_sub4_sub4.trianglePointsY; 706 - trianglePointsZ = class50_sub1_sub4_sub4.trianglePointsZ; 707 - texturedTrianglePointsX = class50_sub1_sub4_sub4.texturedTrianglePointsX; 708 - texturedTrianglePointsY = class50_sub1_sub4_sub4.texturedTrianglePointsY; 709 - texturedTrianglePointsZ = class50_sub1_sub4_sub4.texturedTrianglePointsZ; 710 - super.modelHeight = ((Renderable) (class50_sub1_sub4_sub4)).modelHeight; 711 - maxY = class50_sub1_sub4_sub4.maxY; 712 - shadowIntensity = class50_sub1_sub4_sub4.shadowIntensity; 713 - anInt1674 = class50_sub1_sub4_sub4.anInt1674; 714 - anInt1673 = class50_sub1_sub4_sub4.anInt1673; 715 - anInt1669 = class50_sub1_sub4_sub4.anInt1669; 716 - anInt1670 = class50_sub1_sub4_sub4.anInt1670; 717 - anInt1668 = class50_sub1_sub4_sub4.anInt1668; 709 + verticesX = model.verticesX; 710 + verticesZ = model.verticesZ; 711 + triangleColorValues = model.triangleColorValues; 712 + triangleAlphaValues = model.triangleAlphaValues; 713 + trianglePriorities = model.trianglePriorities; 714 + trianglePriority = model.trianglePriority; 715 + trianglePointsX = model.trianglePointsX; 716 + trianglePointsY = model.trianglePointsY; 717 + trianglePointsZ = model.trianglePointsZ; 718 + texturedTrianglePointsX = model.texturedTrianglePointsX; 719 + texturedTrianglePointsY = model.texturedTrianglePointsY; 720 + texturedTrianglePointsZ = model.texturedTrianglePointsZ; 721 + super.modelHeight = model.modelHeight; 722 + maxY = model.maxY; 723 + diagonal2DAboveOrigin = model.diagonal2DAboveOrigin; 724 + diagonal3DAboveOrigin = model.diagonal3DAboveOrigin; 725 + diagonal3D = model.diagonal3D; 726 + worldX = model.worldX; 727 + worldZ = model.worldZ; 728 + anInt1668 = model.anInt1668; 718 729 } 719 730 720 731 public void replaceWithModel(Model model, boolean replaceAlphaValues) { ··· 738 749 if (replaceAlphaValues) { 739 750 triangleAlphaValues = model.triangleAlphaValues; 740 751 } else { 741 - if (Model.anIntArray1647.length < triangleCount) 752 + if (Model.anIntArray1647.length < triangleCount) { 742 753 Model.anIntArray1647 = new int[triangleCount + 100]; 754 + } 743 755 triangleAlphaValues = Model.anIntArray1647; 744 756 if (model.triangleAlphaValues == null) { 745 - for (int triangle = 0; triangle < triangleCount; triangle++) 757 + for (int triangle = 0; triangle < triangleCount; triangle++) { 746 758 triangleAlphaValues[triangle] = 0; 759 + } 747 760 748 761 } else { 749 - for (int triangle = 0; triangle < triangleCount; triangle++) 750 - triangleAlphaValues[triangle] = model.triangleAlphaValues[triangle]; 762 + if (triangleCount >= 0) { 763 + System.arraycopy(model.triangleAlphaValues, 0, triangleAlphaValues, 0, triangleCount); 764 + } 751 765 752 766 } 753 767 } 754 - texturePoints = model.texturePoints; 768 + triangleDrawType = model.triangleDrawType; 755 769 triangleColorValues = model.triangleColorValues; 756 770 trianglePriorities = model.trianglePriorities; 757 - anInt1663 = model.anInt1663; 771 + trianglePriority = model.trianglePriority; 758 772 triangleSkin = model.triangleSkin; 759 773 vectorSkin = model.vectorSkin; 760 774 trianglePointsX = model.trianglePointsX; 761 775 trianglePointsY = model.trianglePointsY; 762 776 trianglePointsZ = model.trianglePointsZ; 763 - anIntArray1656 = model.anIntArray1656; 764 - anIntArray1657 = model.anIntArray1657; 765 - anIntArray1658 = model.anIntArray1658; 777 + triangleHSLA = model.triangleHSLA; 778 + triangleHSLB = model.triangleHSLB; 779 + triangleHSLC = model.triangleHSLC; 766 780 texturedTrianglePointsX = model.texturedTrianglePointsX; 767 781 texturedTrianglePointsY = model.texturedTrianglePointsY; 768 782 texturedTrianglePointsZ = model.texturedTrianglePointsZ; ··· 774 788 int vertexY = model.verticesY[vertex]; 775 789 int vertexZ = model.verticesZ[vertex]; 776 790 for (int index = 0; index < vertexCount; index++) { 777 - if (vertexX != verticesX[index] || vertexY != verticesY[index] || vertexZ != verticesZ[index]) 791 + if (vertexX != verticesX[index] || vertexY != verticesY[index] || vertexZ != verticesZ[index]) { 778 792 continue; 793 + } 779 794 identicalVertexIndex = index; 780 795 break; 781 796 } ··· 784 799 verticesX[vertexCount] = vertexX; 785 800 verticesY[vertexCount] = vertexY; 786 801 verticesZ[vertexCount] = vertexZ; 787 - if (model.vertexSkins != null) 802 + if (model.vertexSkins != null) { 788 803 vertexSkins[vertexCount] = model.vertexSkins[vertex]; 804 + } 789 805 identicalVertexIndex = vertexCount++; 790 806 } 791 807 return identicalVertexIndex; ··· 793 809 794 810 public void calculateDiagonals() { 795 811 super.modelHeight = 0; 796 - shadowIntensity = 0; 812 + diagonal2DAboveOrigin = 0; 797 813 maxY = 0; 798 814 for (int vertex = 0; vertex < vertexCount; vertex++) { 799 815 int vertexX = verticesX[vertex]; 800 816 int vertexY = verticesY[vertex]; 801 817 int vertexZ = verticesZ[vertex]; 802 - if (-vertexY > super.modelHeight) 818 + if (-vertexY > super.modelHeight) { 803 819 super.modelHeight = -vertexY; 804 - if (vertexY > maxY) 820 + } 821 + if (vertexY > maxY) { 805 822 maxY = vertexY; 823 + } 806 824 int j1 = vertexX * vertexX + vertexZ * vertexZ; 807 - if (j1 > shadowIntensity) 808 - shadowIntensity = j1; 825 + if (j1 > diagonal2DAboveOrigin) { 826 + diagonal2DAboveOrigin = j1; 827 + } 809 828 } 810 829 811 - shadowIntensity = (int) (Math.sqrt(shadowIntensity) + 0.98999999999999999D); 812 - anInt1674 = (int) (Math.sqrt(shadowIntensity * shadowIntensity + super.modelHeight * super.modelHeight) + 0.98999999999999999D); 813 - anInt1673 = anInt1674 + (int) (Math.sqrt(shadowIntensity * shadowIntensity + maxY * maxY) + 0.98999999999999999D); 830 + diagonal2DAboveOrigin = (int) (Math.sqrt(diagonal2DAboveOrigin) + 0.98999999999999999D); 831 + diagonal3DAboveOrigin = (int) (Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + super.modelHeight * super.modelHeight) + 0.98999999999999999D); 832 + diagonal3D = diagonal3DAboveOrigin + (int) (Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + maxY * maxY) + 0.98999999999999999D); 814 833 } 815 834 816 835 public void normalise() { ··· 818 837 maxY = 0; 819 838 for (int j = 0; j < vertexCount; j++) { 820 839 int k = verticesY[j]; 821 - if (-k > super.modelHeight) 840 + if (-k > super.modelHeight) { 822 841 super.modelHeight = -k; 823 - if (k > maxY) 842 + } 843 + if (k > maxY) { 824 844 maxY = k; 845 + } 825 846 } 826 847 827 - anInt1674 = (int) (Math.sqrt(shadowIntensity * shadowIntensity + super.modelHeight * super.modelHeight) + 0.98999999999999999D); 828 - anInt1673 = anInt1674 + (int) (Math.sqrt(shadowIntensity * shadowIntensity + maxY * maxY) + 0.98999999999999999D); 848 + diagonal3DAboveOrigin = (int) (Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + super.modelHeight * super.modelHeight) + 0.98999999999999999D); 849 + diagonal3D = diagonal3DAboveOrigin + (int) (Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + maxY * maxY) + 0.98999999999999999D); 829 850 } 830 851 831 - public void method583(int i) { 852 + public void calculateDiagonalsAndBounds() { 832 853 super.modelHeight = 0; 833 - shadowIntensity = 0; 854 + diagonal2DAboveOrigin = 0; 834 855 maxY = 0; 835 - int j = 32767; 836 - int k = -32767; 837 - int l = -32767; 838 - int i1 = 32767; 839 - for (int j1 = 0; j1 < vertexCount; j1++) { 840 - int k1 = verticesX[j1]; 841 - int l1 = verticesY[j1]; 842 - int i2 = verticesZ[j1]; 843 - if (k1 < j) 844 - j = k1; 845 - if (k1 > k) 846 - k = k1; 847 - if (i2 < i1) 848 - i1 = i2; 849 - if (i2 > l) 850 - l = i2; 851 - if (-l1 > super.modelHeight) 852 - super.modelHeight = -l1; 853 - if (l1 > maxY) 854 - maxY = l1; 855 - int j2 = k1 * k1 + i2 * i2; 856 - if (j2 > shadowIntensity) 857 - shadowIntensity = j2; 856 + int minX; 857 + int maxX; 858 + int maxZ; 859 + int minZ; 860 + minX = 32767; 861 + maxX = -32767; 862 + maxZ = -32767; 863 + minZ = 32767; 864 + for (int vertex = 0; vertex < vertexCount; vertex++) { 865 + int x = verticesX[vertex]; 866 + int y = verticesY[vertex]; 867 + int z = verticesZ[vertex]; 868 + if (x < minX) { 869 + minX = x; 870 + } 871 + if (x > maxX) { 872 + maxX = x; 873 + } 874 + if (z < minZ) { 875 + minZ = z; 876 + } 877 + if (z > maxZ) { 878 + maxZ = z; 879 + } 880 + if (-y > super.modelHeight) { 881 + super.modelHeight = -y; 882 + } 883 + if (y > maxY) { 884 + maxY = y; 885 + } 886 + int bounds = x * x + z * z; 887 + if (bounds > diagonal2DAboveOrigin) { 888 + diagonal2DAboveOrigin = bounds; 889 + } 858 890 } 859 891 860 - shadowIntensity = (int) Math.sqrt(shadowIntensity); 861 - anInt1674 = (int) Math.sqrt(shadowIntensity * shadowIntensity + super.modelHeight * super.modelHeight); 862 - anInt1673 = anInt1674 + (int) Math.sqrt(shadowIntensity * shadowIntensity + maxY * maxY); 863 - anInt1669 = (j << 16) + (k & 0xffff); 864 - if (i <= 0) 865 - anInt1637 = 50; 866 - anInt1670 = (l << 16) + (i1 & 0xffff); 892 + diagonal2DAboveOrigin = (int) Math.sqrt(diagonal2DAboveOrigin); 893 + diagonal3DAboveOrigin = (int) Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + super.modelHeight * super.modelHeight); 894 + diagonal3D = diagonal3DAboveOrigin + (int) Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + maxY * maxY); 895 + worldX = (minX << 16) + (maxX & 0xffff); 896 + worldZ = (maxZ << 16) + (minZ & 0xffff); 867 897 } 868 898 869 899 public void createBones() { ··· 873 903 for (int l = 0; l < vertexCount; l++) { 874 904 int j1 = vertexSkins[l]; 875 905 ai[j1]++; 876 - if (j1 > j) 906 + if (j1 > j) { 877 907 j = j1; 908 + } 878 909 } 879 910 880 911 vectorSkin = new int[j + 1][]; ··· 896 927 for (int i1 = 0; i1 < triangleCount; i1++) { 897 928 int l1 = triangleSkinValues[i1]; 898 929 ai1[l1]++; 899 - if (l1 > k) 930 + if (l1 > k) { 900 931 k = l1; 932 + } 901 933 } 902 934 903 935 triangleSkin = new int[k + 1][]; ··· 916 948 } 917 949 918 950 public void applyTransform(int frameId) { 919 - if (vectorSkin == null) 951 + if (vectorSkin == null) { 920 952 return; 921 - if (frameId == -1) 953 + } 954 + if (frameId == -1) { 922 955 return; 956 + } 923 957 Animation animation = Animation.getAnimation(frameId); 924 - if (animation == null) 958 + if (animation == null) { 925 959 return; 960 + } 926 961 Skins skins = animation.animationSkins; 927 962 vertexXModifier = 0; 928 963 vertexYModifier = 0; ··· 936 971 } 937 972 938 973 public void mixAnimationFrames(int i, int j, int k, int ai[]) { 939 - if (k == -1) 974 + if (k == -1) { 940 975 return; 976 + } 941 977 if (ai == null || i == -1) { 942 978 applyTransform(k); 943 979 return; 944 980 } 945 981 Animation animation = Animation.getAnimation(k); 946 - if (animation == null) 982 + if (animation == null) { 947 983 return; 984 + } 948 985 Animation animation_1 = Animation.getAnimation(i); 949 986 if (animation_1 == null) { 950 987 applyTransform(k); ··· 952 989 } 953 990 Skins skins = animation.animationSkins; 954 991 vertexXModifier = 0; 955 - if (j != 0) 956 - aBoolean1641 = !aBoolean1641; 957 992 vertexYModifier = 0; 958 993 vertexZModifier = 0; 959 994 int l = 0; 960 995 int i1 = ai[l++]; 961 996 for (int j1 = 0; j1 < animation.anInt433; j1++) { 962 997 int k1; 963 - for (k1 = animation.opcodeTable[j1]; k1 > i1; i1 = ai[l++]) ; 964 - if (k1 != i1 || skins.opcodes[k1] == 0) 998 + for (k1 = animation.opcodeTable[j1]; k1 > i1; i1 = ai[l++]) { 999 + ; 1000 + } 1001 + if (k1 != i1 || skins.opcodes[k1] == 0) { 965 1002 transformStep(skins.opcodes[k1], skins.skinList[k1], animation.modifier1[j1], 966 1003 animation.modifier2[j1], animation.modifier3[j1]); 1004 + } 967 1005 } 968 1006 969 1007 vertexXModifier = 0; ··· 973 1011 i1 = ai[l++]; 974 1012 for (int l1 = 0; l1 < animation_1.anInt433; l1++) { 975 1013 int i2; 976 - for (i2 = animation_1.opcodeTable[l1]; i2 > i1; i1 = ai[l++]) ; 977 - if (i2 == i1 || skins.opcodes[i2] == 0) 1014 + for (i2 = animation_1.opcodeTable[l1]; i2 > i1; i1 = ai[l++]) { 1015 + ; 1016 + } 1017 + if (i2 == i1 || skins.opcodes[i2] == 0) { 978 1018 transformStep(skins.opcodes[i2], skins.skinList[i2], animation_1.modifier1[l1], 979 1019 animation_1.modifier2[l1], animation_1.modifier3[l1]); 1020 + } 980 1021 } 981 1022 982 1023 } ··· 1107 1148 for (int l4 = 0; l4 < ai4.length; l4++) { 1108 1149 int i6 = ai4[l4]; 1109 1150 triangleAlphaValues[i6] += j * 8; 1110 - if (triangleAlphaValues[i6] < 0) 1151 + if (triangleAlphaValues[i6] < 0) { 1111 1152 triangleAlphaValues[i6] = 0; 1112 - if (triangleAlphaValues[i6] > 255) 1153 + } 1154 + if (triangleAlphaValues[i6] > 255) { 1113 1155 triangleAlphaValues[i6] = 255; 1156 + } 1114 1157 } 1115 1158 1116 1159 } ··· 1149 1192 } 1150 1193 1151 1194 public void replaceColor(int oldColor, int newColor) { 1152 - for (int i = 0; i < triangleCount; i++) 1153 - if (triangleColorValues[i] == oldColor) 1195 + for (int i = 0; i < triangleCount; i++) { 1196 + if (triangleColorValues[i] == oldColor) { 1154 1197 triangleColorValues[i] = newColor; 1198 + } 1199 + } 1155 1200 1156 1201 } 1157 1202 1158 1203 public void mirror(int i) { 1159 1204 if (i != 0) { 1160 - for (int j = 1; j > 0; j++) ; 1205 + for (int j = 1; j > 0; j++) { 1206 + ; 1207 + } 1161 1208 } 1162 - for (int k = 0; k < vertexCount; k++) 1209 + for (int k = 0; k < vertexCount; k++) { 1163 1210 verticesZ[k] = -verticesZ[k]; 1211 + } 1164 1212 1165 1213 for (int l = 0; l < triangleCount; l++) { 1166 1214 int i1 = trianglePointsX[l]; ··· 1177 1225 verticesZ[i1] = (verticesZ[i1] * j) / 128; 1178 1226 } 1179 1227 1180 - if (k != 9) 1181 - anInt1636 = 322; 1182 1228 } 1183 1229 1184 1230 public void applyLighting(int i, int j, int k, int l, int i1, boolean flag) { 1185 1231 int j1 = (int) Math.sqrt(k * k + l * l + i1 * i1); 1186 1232 int k1 = j * j1 >> 8; 1187 - if (anIntArray1656 == null) { 1188 - anIntArray1656 = new int[triangleCount]; 1189 - anIntArray1657 = new int[triangleCount]; 1190 - anIntArray1658 = new int[triangleCount]; 1233 + if (triangleHSLA == null) { 1234 + triangleHSLA = new int[triangleCount]; 1235 + triangleHSLB = new int[triangleCount]; 1236 + triangleHSLC = new int[triangleCount]; 1191 1237 } 1192 1238 if (super.verticesNormal == null) { 1193 1239 super.verticesNormal = new VertexNormal[vertexCount]; 1194 - for (int l1 = 0; l1 < vertexCount; l1++) 1240 + for (int l1 = 0; l1 < vertexCount; l1++) { 1195 1241 super.verticesNormal[l1] = new VertexNormal(); 1242 + } 1196 1243 1197 1244 } 1198 1245 for (int i2 = 0; i2 < triangleCount; i2++) { ··· 1214 1261 } 1215 1262 1216 1263 int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5); 1217 - if (k5 <= 0) 1264 + if (k5 <= 0) { 1218 1265 k5 = 1; 1266 + } 1219 1267 l4 = (l4 * 256) / k5; 1220 1268 i5 = (i5 * 256) / k5; 1221 1269 j5 = (j5 * 256) / k5; 1222 - if (texturePoints == null || (texturePoints[i2] & 1) == 0) { 1270 + if (triangleDrawType == null || (triangleDrawType[i2] & 1) == 0) { 1223 1271 VertexNormal class40_2 = super.verticesNormal[j2]; 1224 1272 class40_2.x += l4; 1225 1273 class40_2.y += i5; ··· 1237 1285 class40_2.magnitude++; 1238 1286 } else { 1239 1287 int l5 = i + (k * l4 + l * i5 + i1 * j5) / (k1 + k1 / 2); 1240 - anIntArray1656[i2] = method597(triangleColorValues[i2], l5, texturePoints[i2]); 1288 + triangleHSLA[i2] = method597(triangleColorValues[i2], l5, triangleDrawType[i2]); 1241 1289 } 1242 1290 } 1243 1291 1244 1292 if (flag) { 1245 1293 method596(i, k1, k, l, i1); 1246 1294 } else { 1247 - aClass40Array1681 = new VertexNormal[vertexCount]; 1295 + vertexNormalOffset = new VertexNormal[vertexCount]; 1248 1296 for (int k2 = 0; k2 < vertexCount; k2++) { 1249 1297 VertexNormal class40 = super.verticesNormal[k2]; 1250 - VertexNormal class40_1 = aClass40Array1681[k2] = new VertexNormal(); 1298 + VertexNormal class40_1 = vertexNormalOffset[k2] = new VertexNormal(); 1251 1299 class40_1.x = class40.x; 1252 1300 class40_1.y = class40.y; 1253 1301 class40_1.z = class40.z; ··· 1260 1308 calculateDiagonals(); 1261 1309 return; 1262 1310 } else { 1263 - method583(426); 1311 + calculateDiagonalsAndBounds(); 1264 1312 return; 1265 1313 } 1266 1314 } 1267 1315 1268 - public void method595(int i, int j, int k, int l) { 1316 + public void handleShading(int i, int j, int k, int l) { 1269 1317 int i1 = anInt1668 >> 16; 1270 1318 int j1 = (anInt1668 << 16) >> 16; 1271 1319 if (k != 0) { 1272 - for (int k1 = 1; k1 > 0; k1++) ; 1320 + for (int k1 = 1; k1 > 0; k1++) { 1321 + ; 1322 + } 1273 1323 } 1274 1324 method596(i1, j1, l, i, j); 1275 1325 } ··· 1279 1329 int k1 = trianglePointsX[j1]; 1280 1330 int i2 = trianglePointsY[j1]; 1281 1331 int j2 = trianglePointsZ[j1]; 1282 - if (texturePoints == null) { 1332 + if (triangleDrawType == null) { 1283 1333 int i3 = triangleColorValues[j1]; 1284 1334 VertexNormal class40 = super.verticesNormal[k1]; 1285 1335 int k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) 1286 1336 / (j * class40.magnitude); 1287 - anIntArray1656[j1] = method597(i3, k2, 0); 1337 + triangleHSLA[j1] = method597(i3, k2, 0); 1288 1338 class40 = super.verticesNormal[i2]; 1289 1339 k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) / (j * class40.magnitude); 1290 - anIntArray1657[j1] = method597(i3, k2, 0); 1340 + triangleHSLB[j1] = method597(i3, k2, 0); 1291 1341 class40 = super.verticesNormal[j2]; 1292 1342 k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) / (j * class40.magnitude); 1293 - anIntArray1658[j1] = method597(i3, k2, 0); 1294 - } else if ((texturePoints[j1] & 1) == 0) { 1343 + triangleHSLC[j1] = method597(i3, k2, 0); 1344 + } else if ((triangleDrawType[j1] & 1) == 0) { 1295 1345 int j3 = triangleColorValues[j1]; 1296 - int k3 = texturePoints[j1]; 1346 + int k3 = triangleDrawType[j1]; 1297 1347 VertexNormal class40_1 = super.verticesNormal[k1]; 1298 1348 int l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1299 1349 / (j * class40_1.magnitude); 1300 - anIntArray1656[j1] = method597(j3, l2, k3); 1350 + triangleHSLA[j1] = method597(j3, l2, k3); 1301 1351 class40_1 = super.verticesNormal[i2]; 1302 1352 l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1303 1353 / (j * class40_1.magnitude); 1304 - anIntArray1657[j1] = method597(j3, l2, k3); 1354 + triangleHSLB[j1] = method597(j3, l2, k3); 1305 1355 class40_1 = super.verticesNormal[j2]; 1306 1356 l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1307 1357 / (j * class40_1.magnitude); 1308 - anIntArray1658[j1] = method597(j3, l2, k3); 1358 + triangleHSLC[j1] = method597(j3, l2, k3); 1309 1359 } 1310 1360 } 1311 1361 1312 1362 super.verticesNormal = null; 1313 - aClass40Array1681 = null; 1363 + vertexNormalOffset = null; 1314 1364 vertexSkins = null; 1315 1365 triangleSkinValues = null; 1316 - if (texturePoints != null) { 1317 - for (int l1 = 0; l1 < triangleCount; l1++) 1318 - if ((texturePoints[l1] & 2) == 2) 1366 + if (triangleDrawType != null) { 1367 + for (int l1 = 0; l1 < triangleCount; l1++) { 1368 + if ((triangleDrawType[l1] & 2) == 2) { 1319 1369 return; 1370 + } 1371 + } 1320 1372 1321 1373 } 1322 1374 triangleColorValues = null; ··· 1324 1376 1325 1377 public static int method597(int i, int j, int k) { 1326 1378 if ((k & 2) == 2) { 1327 - if (j < 0) 1379 + if (j < 0) { 1328 1380 j = 0; 1329 - else if (j > 127) 1381 + } else if (j > 127) { 1330 1382 j = 127; 1383 + } 1331 1384 j = 127 - j; 1332 1385 return j; 1333 1386 } 1334 1387 j = j * (i & 0x7f) >> 7; 1335 - if (j < 2) 1388 + if (j < 2) { 1336 1389 j = 2; 1337 - else if (j > 126) 1390 + } else if (j > 126) { 1338 1391 j = 126; 1392 + } 1339 1393 return (i & 0xff80) + j; 1340 1394 } 1341 1395 ··· 1376 1430 int j6 = i5 * i4 - j5 * l3 >> 16; 1377 1431 j5 = i5 * l3 + j5 * i4 >> 16; 1378 1432 i5 = j6; 1379 - anIntArray1688[k4] = j5 - j4; 1380 - anIntArray1686[k4] = l1 + (l4 << 9) / j5; 1381 - anIntArray1687[k4] = i2 + (i5 << 9) / j5; 1433 + vertexScreenZ[k4] = j5 - j4; 1434 + vertexScreenX[k4] = l1 + (l4 << 9) / j5; 1435 + vertexScreenY[k4] = i2 + (i5 << 9) / j5; 1382 1436 if (texturedTriangleCount > 0) { 1383 - anIntArray1689[k4] = l4; 1384 - anIntArray1690[k4] = i5; 1385 - anIntArray1691[k4] = j5; 1437 + vertexMovedX[k4] = l4; 1438 + vertexMovedY[k4] = i5; 1439 + vertexMovedZ[k4] = j5; 1386 1440 } 1387 1441 } 1388 1442 ··· 1398 1452 public void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 1399 1453 int j2 = l1 * i1 - j1 * l >> 16; 1400 1454 int k2 = k1 * j + j2 * k >> 16; 1401 - int l2 = shadowIntensity * k >> 16; 1455 + int l2 = diagonal2DAboveOrigin * k >> 16; 1402 1456 int i3 = k2 + l2; 1403 - if (i3 <= 50 || k2 >= 3500) 1457 + if (i3 <= 50 || k2 >= 3500) { 1404 1458 return; 1459 + } 1405 1460 int j3 = l1 * l + j1 * i1 >> 16; 1406 - int k3 = j3 - shadowIntensity << 9; 1407 - if (k3 / i3 >= Rasterizer.centerX) 1461 + int k3 = j3 - diagonal2DAboveOrigin << 9; 1462 + if (k3 / i3 >= Rasterizer.centerX) { 1408 1463 return; 1409 - int l3 = j3 + shadowIntensity << 9; 1410 - if (l3 / i3 <= -Rasterizer.centerX) 1464 + } 1465 + int l3 = j3 + diagonal2DAboveOrigin << 9; 1466 + if (l3 / i3 <= -Rasterizer.centerX) { 1411 1467 return; 1468 + } 1412 1469 int i4 = k1 * k - j2 * j >> 16; 1413 - int j4 = shadowIntensity * j >> 16; 1470 + int j4 = diagonal2DAboveOrigin * j >> 16; 1414 1471 int k4 = i4 + j4 << 9; 1415 - if (k4 / i3 <= -Rasterizer.centerY) 1472 + if (k4 / i3 <= -Rasterizer.centerY) { 1416 1473 return; 1474 + } 1417 1475 int l4 = j4 + (super.modelHeight * k >> 16); 1418 1476 int i5 = i4 - l4 << 9; 1419 - if (i5 / i3 >= Rasterizer.centerY) 1477 + if (i5 / i3 >= Rasterizer.centerY) { 1420 1478 return; 1479 + } 1421 1480 int j5 = l2 + (super.modelHeight * j >> 16); 1422 1481 boolean flag = false; 1423 - if (k2 - j5 <= 50) 1482 + if (k2 - j5 <= 50) { 1424 1483 flag = true; 1484 + } 1425 1485 boolean flag1 = false; 1426 1486 if (i2 > 0 && aBoolean1705) { 1427 1487 int k5 = k2 - l2; 1428 - if (k5 <= 50) 1488 + if (k5 <= 50) { 1429 1489 k5 = 50; 1490 + } 1430 1491 if (j3 > 0) { 1431 1492 k3 /= i3; 1432 1493 l3 /= k5; ··· 1441 1502 k4 /= i3; 1442 1503 i5 /= k5; 1443 1504 } 1444 - int i6 = anInt1706 - Rasterizer3D.centerX; 1445 - int k6 = anInt1707 - Rasterizer3D.centerY; 1446 - if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) 1447 - if (oneSquareModel) 1448 - anIntArray1709[anInt1708++] = i2; 1449 - else 1505 + int i6 = cursorX - Rasterizer3D.centerX; 1506 + int k6 = cursorY - Rasterizer3D.centerY; 1507 + if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) { 1508 + if (oneSquareModel) { 1509 + anIntArray1709[resourceCount++] = i2; 1510 + } else { 1450 1511 flag1 = true; 1512 + } 1513 + } 1451 1514 } 1452 1515 int l5 = Rasterizer3D.centerX; 1453 1516 int j6 = Rasterizer3D.centerY; ··· 1475 1538 k8 = l7 * k - i8 * j >> 16; 1476 1539 i8 = l7 * j + i8 * k >> 16; 1477 1540 l7 = k8; 1478 - anIntArray1688[j7] = i8 - k2; 1541 + vertexScreenZ[j7] = i8 - k2; 1479 1542 if (i8 >= 50) { 1480 - anIntArray1686[j7] = l5 + (k7 << 9) / i8; 1481 - anIntArray1687[j7] = j6 + (l7 << 9) / i8; 1543 + vertexScreenX[j7] = l5 + (k7 << 9) / i8; 1544 + vertexScreenY[j7] = j6 + (l7 << 9) / i8; 1482 1545 } else { 1483 - anIntArray1686[j7] = -5000; 1546 + vertexScreenX[j7] = -5000; 1484 1547 flag = true; 1485 1548 } 1486 1549 if (flag || texturedTriangleCount > 0) { 1487 - anIntArray1689[j7] = k7; 1488 - anIntArray1690[j7] = l7; 1489 - anIntArray1691[j7] = i8; 1550 + vertexMovedX[j7] = k7; 1551 + vertexMovedY[j7] = l7; 1552 + vertexMovedZ[j7] = i8; 1490 1553 } 1491 1554 } 1492 1555 ··· 1499 1562 } 1500 1563 1501 1564 public void method599(boolean flag, boolean flag1, int i) { 1502 - for (int j = 0; j < anInt1673; j++) 1565 + for (int j = 0; j < diagonal3D; j++) { 1503 1566 anIntArray1692[j] = 0; 1567 + } 1504 1568 1505 - for (int k = 0; k < triangleCount; k++) 1506 - if (texturePoints == null || texturePoints[k] != -1) { 1569 + for (int k = 0; k < triangleCount; k++) { 1570 + if (triangleDrawType == null || triangleDrawType[k] != -1) { 1507 1571 int l = trianglePointsX[k]; 1508 1572 int k1 = trianglePointsY[k]; 1509 1573 int j2 = trianglePointsZ[k]; 1510 - int i3 = anIntArray1686[l]; 1511 - int l3 = anIntArray1686[k1]; 1512 - int k4 = anIntArray1686[j2]; 1574 + int i3 = vertexScreenX[l]; 1575 + int l3 = vertexScreenX[k1]; 1576 + int k4 = vertexScreenX[j2]; 1513 1577 if (flag && (i3 == -5000 || l3 == -5000 || k4 == -5000)) { 1514 1578 aBooleanArray1685[k] = true; 1515 - int j5 = (anIntArray1688[l] + anIntArray1688[k1] + anIntArray1688[j2]) / 3 + anInt1674; 1579 + int j5 = (vertexScreenZ[l] + vertexScreenZ[k1] + vertexScreenZ[j2]) / 3 + diagonal3DAboveOrigin; 1516 1580 anIntArrayArray1693[j5][anIntArray1692[j5]++] = k; 1517 1581 } else { 1518 1582 if (flag1 1519 - && method602(anInt1706, anInt1707, anIntArray1687[l], anIntArray1687[k1], 1520 - anIntArray1687[j2], i3, l3, k4)) { 1521 - anIntArray1709[anInt1708++] = i; 1583 + && method602(cursorX, cursorY, vertexScreenY[l], vertexScreenY[k1], 1584 + vertexScreenY[j2], i3, l3, k4)) { 1585 + anIntArray1709[resourceCount++] = i; 1522 1586 flag1 = false; 1523 1587 } 1524 - if ((i3 - l3) * (anIntArray1687[j2] - anIntArray1687[k1]) 1525 - - (anIntArray1687[l] - anIntArray1687[k1]) * (k4 - l3) > 0) { 1588 + if ((i3 - l3) * (vertexScreenY[j2] - vertexScreenY[k1]) 1589 + - (vertexScreenY[l] - vertexScreenY[k1]) * (k4 - l3) > 0) { 1526 1590 aBooleanArray1685[k] = false; 1527 1591 if (i3 < 0 || l3 < 0 || k4 < 0 || i3 > Rasterizer.virtualBottomX 1528 - || l3 > Rasterizer.virtualBottomX || k4 > Rasterizer.virtualBottomX) 1529 - aBooleanArray1684[k] = true; 1530 - else 1531 - aBooleanArray1684[k] = false; 1532 - int k5 = (anIntArray1688[l] + anIntArray1688[k1] + anIntArray1688[j2]) / 3 + anInt1674; 1592 + || l3 > Rasterizer.virtualBottomX || k4 > Rasterizer.virtualBottomX) { 1593 + restrictEdges[k] = true; 1594 + } else { 1595 + restrictEdges[k] = false; 1596 + } 1597 + int k5 = (vertexScreenZ[l] + vertexScreenZ[k1] + vertexScreenZ[j2]) / 3 + diagonal3DAboveOrigin; 1533 1598 anIntArrayArray1693[k5][anIntArray1692[k5]++] = k; 1534 1599 } 1535 1600 } 1536 1601 } 1602 + } 1537 1603 1538 1604 if (trianglePriorities == null) { 1539 - for (int i1 = anInt1673 - 1; i1 >= 0; i1--) { 1605 + for (int i1 = diagonal3D - 1; i1 >= 0; i1--) { 1540 1606 int l1 = anIntArray1692[i1]; 1541 1607 if (l1 > 0) { 1542 1608 int ai[] = anIntArrayArray1693[i1]; 1543 - for (int j3 = 0; j3 < l1; j3++) 1609 + for (int j3 = 0; j3 < l1; j3++) { 1544 1610 method600(ai[j3]); 1611 + } 1545 1612 1546 1613 } 1547 1614 } ··· 1553 1620 anIntArray1698[j1] = 0; 1554 1621 } 1555 1622 1556 - for (int i2 = anInt1673 - 1; i2 >= 0; i2--) { 1623 + for (int i2 = diagonal3D - 1; i2 >= 0; i2--) { 1557 1624 int k2 = anIntArray1692[i2]; 1558 1625 if (k2 > 0) { 1559 1626 int ai1[] = anIntArrayArray1693[i2]; ··· 1562 1629 int l5 = trianglePriorities[l4]; 1563 1630 int j6 = anIntArray1694[l5]++; 1564 1631 anIntArrayArray1695[l5][j6] = l4; 1565 - if (l5 < 10) 1632 + if (l5 < 10) { 1566 1633 anIntArray1698[l5] += i2; 1567 - else if (l5 == 10) 1634 + } else if (l5 == 10) { 1568 1635 anIntArray1696[j6] = i2; 1569 - else 1636 + } else { 1570 1637 anIntArray1697[j6] = i2; 1638 + } 1571 1639 } 1572 1640 1573 1641 } 1574 1642 } 1575 1643 1576 1644 int l2 = 0; 1577 - if (anIntArray1694[1] > 0 || anIntArray1694[2] > 0) 1645 + if (anIntArray1694[1] > 0 || anIntArray1694[2] > 0) { 1578 1646 l2 = (anIntArray1698[1] + anIntArray1698[2]) / (anIntArray1694[1] + anIntArray1694[2]); 1647 + } 1579 1648 int k3 = 0; 1580 - if (anIntArray1694[3] > 0 || anIntArray1694[4] > 0) 1649 + if (anIntArray1694[3] > 0 || anIntArray1694[4] > 0) { 1581 1650 k3 = (anIntArray1698[3] + anIntArray1698[4]) / (anIntArray1694[3] + anIntArray1694[4]); 1651 + } 1582 1652 int j4 = 0; 1583 - if (anIntArray1694[6] > 0 || anIntArray1694[8] > 0) 1653 + if (anIntArray1694[6] > 0 || anIntArray1694[8] > 0) { 1584 1654 j4 = (anIntArray1698[6] + anIntArray1698[8]) / (anIntArray1694[6] + anIntArray1694[8]); 1655 + } 1585 1656 int i6 = 0; 1586 1657 int k6 = anIntArray1694[10]; 1587 1658 int ai2[] = anIntArrayArray1695[10]; ··· 1593 1664 ai3 = anIntArray1697; 1594 1665 } 1595 1666 int i5; 1596 - if (i6 < k6) 1667 + if (i6 < k6) { 1597 1668 i5 = ai3[i6]; 1598 - else 1669 + } else { 1599 1670 i5 = -1000; 1671 + } 1600 1672 for (int l6 = 0; l6 < 10; l6++) { 1601 1673 while (l6 == 0 && i5 > l2) { 1602 1674 method600(ai2[i6++]); ··· 1606 1678 ai2 = anIntArrayArray1695[11]; 1607 1679 ai3 = anIntArray1697; 1608 1680 } 1609 - if (i6 < k6) 1681 + if (i6 < k6) { 1610 1682 i5 = ai3[i6]; 1611 - else 1683 + } else { 1612 1684 i5 = -1000; 1685 + } 1613 1686 } 1614 1687 while (l6 == 3 && i5 > k3) { 1615 1688 method600(ai2[i6++]); ··· 1619 1692 ai2 = anIntArrayArray1695[11]; 1620 1693 ai3 = anIntArray1697; 1621 1694 } 1622 - if (i6 < k6) 1695 + if (i6 < k6) { 1623 1696 i5 = ai3[i6]; 1624 - else 1697 + } else { 1625 1698 i5 = -1000; 1699 + } 1626 1700 } 1627 1701 while (l6 == 5 && i5 > j4) { 1628 1702 method600(ai2[i6++]); ··· 1632 1706 ai2 = anIntArrayArray1695[11]; 1633 1707 ai3 = anIntArray1697; 1634 1708 } 1635 - if (i6 < k6) 1709 + if (i6 < k6) { 1636 1710 i5 = ai3[i6]; 1637 - else 1711 + } else { 1638 1712 i5 = -1000; 1713 + } 1639 1714 } 1640 1715 int i7 = anIntArray1694[l6]; 1641 1716 int ai4[] = anIntArrayArray1695[l6]; 1642 - for (int j7 = 0; j7 < i7; j7++) 1717 + for (int j7 = 0; j7 < i7; j7++) { 1643 1718 method600(ai4[j7]); 1719 + } 1644 1720 1645 1721 } 1646 1722 ··· 1652 1728 k6 = anIntArray1694[11]; 1653 1729 ai3 = anIntArray1697; 1654 1730 } 1655 - if (i6 < k6) 1731 + if (i6 < k6) { 1656 1732 i5 = ai3[i6]; 1657 - else 1733 + } else { 1658 1734 i5 = -1000; 1735 + } 1659 1736 } 1660 1737 } 1661 1738 ··· 1667 1744 int j = trianglePointsX[i]; 1668 1745 int k = trianglePointsY[i]; 1669 1746 int l = trianglePointsZ[i]; 1670 - Rasterizer3D.aBoolean1528 = aBooleanArray1684[i]; 1671 - if (triangleAlphaValues == null) 1672 - Rasterizer3D.anInt1531 = 0; 1673 - else 1674 - Rasterizer3D.anInt1531 = triangleAlphaValues[i]; 1747 + Rasterizer3D.restrictEdges = restrictEdges[i]; 1748 + if (triangleAlphaValues == null) { 1749 + Rasterizer3D.alpha = 0; 1750 + } else { 1751 + Rasterizer3D.alpha = triangleAlphaValues[i]; 1752 + } 1675 1753 int i1; 1676 - if (texturePoints == null) 1754 + if (triangleDrawType == null) { 1677 1755 i1 = 0; 1678 - else 1679 - i1 = texturePoints[i] & 3; 1756 + } else { 1757 + i1 = triangleDrawType[i] & 3; 1758 + } 1680 1759 if (i1 == 0) { 1681 - Rasterizer3D.method503(anIntArray1687[j], anIntArray1687[k], anIntArray1687[l], 1682 - anIntArray1686[j], anIntArray1686[k], anIntArray1686[l], anIntArray1656[i], anIntArray1657[i], 1683 - anIntArray1658[i]); 1760 + Rasterizer3D.drawShadedTriangle(vertexScreenY[j], vertexScreenY[k], vertexScreenY[l], 1761 + vertexScreenX[j], vertexScreenX[k], vertexScreenX[l], triangleHSLA[i], triangleHSLB[i], 1762 + triangleHSLC[i]); 1684 1763 return; 1685 1764 } 1686 1765 if (i1 == 1) { 1687 - Rasterizer3D.method505(anIntArray1687[j], anIntArray1687[k], anIntArray1687[l], 1688 - anIntArray1686[j], anIntArray1686[k], anIntArray1686[l], anIntArray1712[anIntArray1656[i]]); 1766 + Rasterizer3D.method505(vertexScreenY[j], vertexScreenY[k], vertexScreenY[l], 1767 + vertexScreenX[j], vertexScreenX[k], vertexScreenX[l], HSLtoRGB[triangleHSLA[i]]); 1689 1768 return; 1690 1769 } 1691 1770 if (i1 == 2) { 1692 - int j1 = texturePoints[i] >> 2; 1771 + int j1 = triangleDrawType[i] >> 2; 1693 1772 int l1 = texturedTrianglePointsX[j1]; 1694 1773 int j2 = texturedTrianglePointsY[j1]; 1695 1774 int l2 = texturedTrianglePointsZ[j1]; 1696 - Rasterizer3D.method507(anIntArray1687[j], anIntArray1687[k], anIntArray1687[l], 1697 - anIntArray1686[j], anIntArray1686[k], anIntArray1686[l], anIntArray1656[i], anIntArray1657[i], 1698 - anIntArray1658[i], anIntArray1689[l1], anIntArray1689[j2], anIntArray1689[l2], anIntArray1690[l1], 1699 - anIntArray1690[j2], anIntArray1690[l2], anIntArray1691[l1], anIntArray1691[j2], anIntArray1691[l2], 1775 + Rasterizer3D.drawTexturedTriangle(vertexScreenY[j], vertexScreenY[k], vertexScreenY[l], 1776 + vertexScreenX[j], vertexScreenX[k], vertexScreenX[l], triangleHSLA[i], triangleHSLB[i], 1777 + triangleHSLC[i], vertexMovedX[l1], vertexMovedX[j2], vertexMovedX[l2], vertexMovedY[l1], 1778 + vertexMovedY[j2], vertexMovedY[l2], vertexMovedZ[l1], vertexMovedZ[j2], vertexMovedZ[l2], 1700 1779 triangleColorValues[i]); 1701 1780 return; 1702 1781 } 1703 - if (i1 == 3) { 1704 - int k1 = texturePoints[i] >> 2; 1705 - int i2 = texturedTrianglePointsX[k1]; 1706 - int k2 = texturedTrianglePointsY[k1]; 1707 - int i3 = texturedTrianglePointsZ[k1]; 1708 - Rasterizer3D.method507(anIntArray1687[j], anIntArray1687[k], anIntArray1687[l], 1709 - anIntArray1686[j], anIntArray1686[k], anIntArray1686[l], anIntArray1656[i], anIntArray1656[i], 1710 - anIntArray1656[i], anIntArray1689[i2], anIntArray1689[k2], anIntArray1689[i3], anIntArray1690[i2], 1711 - anIntArray1690[k2], anIntArray1690[i3], anIntArray1691[i2], anIntArray1691[k2], anIntArray1691[i3], 1712 - triangleColorValues[i]); 1713 - } 1782 + int k1 = triangleDrawType[i] >> 2; 1783 + int i2 = texturedTrianglePointsX[k1]; 1784 + int k2 = texturedTrianglePointsY[k1]; 1785 + int i3 = texturedTrianglePointsZ[k1]; 1786 + Rasterizer3D.drawTexturedTriangle(vertexScreenY[j], vertexScreenY[k], vertexScreenY[l], 1787 + vertexScreenX[j], vertexScreenX[k], vertexScreenX[l], triangleHSLA[i], triangleHSLA[i], 1788 + triangleHSLA[i], vertexMovedX[i2], vertexMovedX[k2], vertexMovedX[i3], vertexMovedY[i2], 1789 + vertexMovedY[k2], vertexMovedY[i3], vertexMovedZ[i2], vertexMovedZ[k2], vertexMovedZ[i3], 1790 + triangleColorValues[i]); 1714 1791 } 1715 1792 1716 1793 public void method601(int i) { ··· 1720 1797 int i1 = trianglePointsX[i]; 1721 1798 int j1 = trianglePointsY[i]; 1722 1799 int k1 = trianglePointsZ[i]; 1723 - int l1 = anIntArray1691[i1]; 1724 - int i2 = anIntArray1691[j1]; 1725 - int j2 = anIntArray1691[k1]; 1800 + int l1 = vertexMovedZ[i1]; 1801 + int i2 = vertexMovedZ[j1]; 1802 + int j2 = vertexMovedZ[k1]; 1726 1803 if (l1 >= 50) { 1727 - anIntArray1699[l] = anIntArray1686[i1]; 1728 - anIntArray1700[l] = anIntArray1687[i1]; 1729 - anIntArray1701[l++] = anIntArray1656[i]; 1804 + anIntArray1699[l] = vertexScreenX[i1]; 1805 + anIntArray1700[l] = vertexScreenY[i1]; 1806 + anIntArray1701[l++] = triangleHSLA[i]; 1730 1807 } else { 1731 - int k2 = anIntArray1689[i1]; 1732 - int k3 = anIntArray1690[i1]; 1733 - int k4 = anIntArray1656[i]; 1808 + int k2 = vertexMovedX[i1]; 1809 + int k3 = vertexMovedY[i1]; 1810 + int k4 = triangleHSLA[i]; 1734 1811 if (j2 >= 50) { 1735 1812 int k5 = (50 - l1) * anIntArray1713[j2 - l1]; 1736 - anIntArray1699[l] = j + (k2 + ((anIntArray1689[k1] - k2) * k5 >> 16) << 9) / 50; 1737 - anIntArray1700[l] = k + (k3 + ((anIntArray1690[k1] - k3) * k5 >> 16) << 9) / 50; 1738 - anIntArray1701[l++] = k4 + ((anIntArray1658[i] - k4) * k5 >> 16); 1813 + anIntArray1699[l] = j + (k2 + ((vertexMovedX[k1] - k2) * k5 >> 16) << 9) / 50; 1814 + anIntArray1700[l] = k + (k3 + ((vertexMovedY[k1] - k3) * k5 >> 16) << 9) / 50; 1815 + anIntArray1701[l++] = k4 + ((triangleHSLC[i] - k4) * k5 >> 16); 1739 1816 } 1740 1817 if (i2 >= 50) { 1741 1818 int l5 = (50 - l1) * anIntArray1713[i2 - l1]; 1742 - anIntArray1699[l] = j + (k2 + ((anIntArray1689[j1] - k2) * l5 >> 16) << 9) / 50; 1743 - anIntArray1700[l] = k + (k3 + ((anIntArray1690[j1] - k3) * l5 >> 16) << 9) / 50; 1744 - anIntArray1701[l++] = k4 + ((anIntArray1657[i] - k4) * l5 >> 16); 1819 + anIntArray1699[l] = j + (k2 + ((vertexMovedX[j1] - k2) * l5 >> 16) << 9) / 50; 1820 + anIntArray1700[l] = k + (k3 + ((vertexMovedY[j1] - k3) * l5 >> 16) << 9) / 50; 1821 + anIntArray1701[l++] = k4 + ((triangleHSLB[i] - k4) * l5 >> 16); 1745 1822 } 1746 1823 } 1747 1824 if (i2 >= 50) { 1748 - anIntArray1699[l] = anIntArray1686[j1]; 1749 - anIntArray1700[l] = anIntArray1687[j1]; 1750 - anIntArray1701[l++] = anIntArray1657[i]; 1825 + anIntArray1699[l] = vertexScreenX[j1]; 1826 + anIntArray1700[l] = vertexScreenY[j1]; 1827 + anIntArray1701[l++] = triangleHSLB[i]; 1751 1828 } else { 1752 - int l2 = anIntArray1689[j1]; 1753 - int l3 = anIntArray1690[j1]; 1754 - int l4 = anIntArray1657[i]; 1829 + int l2 = vertexMovedX[j1]; 1830 + int l3 = vertexMovedY[j1]; 1831 + int l4 = triangleHSLB[i]; 1755 1832 if (l1 >= 50) { 1756 1833 int i6 = (50 - i2) * anIntArray1713[l1 - i2]; 1757 - anIntArray1699[l] = j + (l2 + ((anIntArray1689[i1] - l2) * i6 >> 16) << 9) / 50; 1758 - anIntArray1700[l] = k + (l3 + ((anIntArray1690[i1] - l3) * i6 >> 16) << 9) / 50; 1759 - anIntArray1701[l++] = l4 + ((anIntArray1656[i] - l4) * i6 >> 16); 1834 + anIntArray1699[l] = j + (l2 + ((vertexMovedX[i1] - l2) * i6 >> 16) << 9) / 50; 1835 + anIntArray1700[l] = k + (l3 + ((vertexMovedY[i1] - l3) * i6 >> 16) << 9) / 50; 1836 + anIntArray1701[l++] = l4 + ((triangleHSLA[i] - l4) * i6 >> 16); 1760 1837 } 1761 1838 if (j2 >= 50) { 1762 1839 int j6 = (50 - i2) * anIntArray1713[j2 - i2]; 1763 - anIntArray1699[l] = j + (l2 + ((anIntArray1689[k1] - l2) * j6 >> 16) << 9) / 50; 1764 - anIntArray1700[l] = k + (l3 + ((anIntArray1690[k1] - l3) * j6 >> 16) << 9) / 50; 1765 - anIntArray1701[l++] = l4 + ((anIntArray1658[i] - l4) * j6 >> 16); 1840 + anIntArray1699[l] = j + (l2 + ((vertexMovedX[k1] - l2) * j6 >> 16) << 9) / 50; 1841 + anIntArray1700[l] = k + (l3 + ((vertexMovedY[k1] - l3) * j6 >> 16) << 9) / 50; 1842 + anIntArray1701[l++] = l4 + ((triangleHSLC[i] - l4) * j6 >> 16); 1766 1843 } 1767 1844 } 1768 1845 if (j2 >= 50) { 1769 - anIntArray1699[l] = anIntArray1686[k1]; 1770 - anIntArray1700[l] = anIntArray1687[k1]; 1771 - anIntArray1701[l++] = anIntArray1658[i]; 1846 + anIntArray1699[l] = vertexScreenX[k1]; 1847 + anIntArray1700[l] = vertexScreenY[k1]; 1848 + anIntArray1701[l++] = triangleHSLC[i]; 1772 1849 } else { 1773 - int i3 = anIntArray1689[k1]; 1774 - int i4 = anIntArray1690[k1]; 1775 - int i5 = anIntArray1658[i]; 1850 + int i3 = vertexMovedX[k1]; 1851 + int i4 = vertexMovedY[k1]; 1852 + int i5 = triangleHSLC[i]; 1776 1853 if (i2 >= 50) { 1777 1854 int k6 = (50 - j2) * anIntArray1713[i2 - j2]; 1778 - anIntArray1699[l] = j + (i3 + ((anIntArray1689[j1] - i3) * k6 >> 16) << 9) / 50; 1779 - anIntArray1700[l] = k + (i4 + ((anIntArray1690[j1] - i4) * k6 >> 16) << 9) / 50; 1780 - anIntArray1701[l++] = i5 + ((anIntArray1657[i] - i5) * k6 >> 16); 1855 + anIntArray1699[l] = j + (i3 + ((vertexMovedX[j1] - i3) * k6 >> 16) << 9) / 50; 1856 + anIntArray1700[l] = k + (i4 + ((vertexMovedY[j1] - i4) * k6 >> 16) << 9) / 50; 1857 + anIntArray1701[l++] = i5 + ((triangleHSLB[i] - i5) * k6 >> 16); 1781 1858 } 1782 1859 if (l1 >= 50) { 1783 1860 int l6 = (50 - j2) * anIntArray1713[l1 - j2]; 1784 - anIntArray1699[l] = j + (i3 + ((anIntArray1689[i1] - i3) * l6 >> 16) << 9) / 50; 1785 - anIntArray1700[l] = k + (i4 + ((anIntArray1690[i1] - i4) * l6 >> 16) << 9) / 50; 1786 - anIntArray1701[l++] = i5 + ((anIntArray1656[i] - i5) * l6 >> 16); 1861 + anIntArray1699[l] = j + (i3 + ((vertexMovedX[i1] - i3) * l6 >> 16) << 9) / 50; 1862 + anIntArray1700[l] = k + (i4 + ((vertexMovedY[i1] - i4) * l6 >> 16) << 9) / 50; 1863 + anIntArray1701[l++] = i5 + ((triangleHSLA[i] - i5) * l6 >> 16); 1787 1864 } 1788 1865 } 1789 1866 int j3 = anIntArray1699[0]; ··· 1793 1870 int j7 = anIntArray1700[1]; 1794 1871 int k7 = anIntArray1700[2]; 1795 1872 if ((j3 - j4) * (k7 - j7) - (i7 - j7) * (j5 - j4) > 0) { 1796 - Rasterizer3D.aBoolean1528 = false; 1873 + Rasterizer3D.restrictEdges = false; 1797 1874 if (l == 3) { 1798 1875 if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer.virtualBottomX || j4 > Rasterizer.virtualBottomX 1799 - || j5 > Rasterizer.virtualBottomX) 1800 - Rasterizer3D.aBoolean1528 = true; 1876 + || j5 > Rasterizer.virtualBottomX) { 1877 + Rasterizer3D.restrictEdges = true; 1878 + } 1801 1879 int l7; 1802 - if (texturePoints == null) 1880 + if (triangleDrawType == null) { 1803 1881 l7 = 0; 1804 - else 1805 - l7 = texturePoints[i] & 3; 1806 - if (l7 == 0) 1807 - Rasterizer3D.method503(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1882 + } else { 1883 + l7 = triangleDrawType[i] & 3; 1884 + } 1885 + if (l7 == 0) { 1886 + Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1808 1887 anIntArray1701[2]); 1809 - else if (l7 == 1) 1810 - Rasterizer3D.method505(i7, j7, k7, j3, j4, j5, anIntArray1712[anIntArray1656[i]]); 1811 - else if (l7 == 2) { 1812 - int j8 = texturePoints[i] >> 2; 1888 + } else if (l7 == 1) { 1889 + Rasterizer3D.method505(i7, j7, k7, j3, j4, j5, HSLtoRGB[triangleHSLA[i]]); 1890 + } else if (l7 == 2) { 1891 + int j8 = triangleDrawType[i] >> 2; 1813 1892 int k9 = texturedTrianglePointsX[j8]; 1814 1893 int k10 = texturedTrianglePointsY[j8]; 1815 1894 int k11 = texturedTrianglePointsZ[j8]; 1816 - Rasterizer3D.method507(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1817 - anIntArray1701[2], anIntArray1689[k9], anIntArray1689[k10], anIntArray1689[k11], 1818 - anIntArray1690[k9], anIntArray1690[k10], anIntArray1690[k11], anIntArray1691[k9], 1819 - anIntArray1691[k10], anIntArray1691[k11], triangleColorValues[i]); 1820 - } else if (l7 == 3) { 1821 - int k8 = texturePoints[i] >> 2; 1895 + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1896 + anIntArray1701[2], vertexMovedX[k9], vertexMovedX[k10], vertexMovedX[k11], 1897 + vertexMovedY[k9], vertexMovedY[k10], vertexMovedY[k11], vertexMovedZ[k9], 1898 + vertexMovedZ[k10], vertexMovedZ[k11], triangleColorValues[i]); 1899 + } else { 1900 + int k8 = triangleDrawType[i] >> 2; 1822 1901 int l9 = texturedTrianglePointsX[k8]; 1823 1902 int l10 = texturedTrianglePointsY[k8]; 1824 1903 int l11 = texturedTrianglePointsZ[k8]; 1825 - Rasterizer3D.method507(i7, j7, k7, j3, j4, j5, anIntArray1656[i], anIntArray1656[i], 1826 - anIntArray1656[i], anIntArray1689[l9], anIntArray1689[l10], anIntArray1689[l11], 1827 - anIntArray1690[l9], anIntArray1690[l10], anIntArray1690[l11], anIntArray1691[l9], 1828 - anIntArray1691[l10], anIntArray1691[l11], triangleColorValues[i]); 1904 + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, triangleHSLA[i], triangleHSLA[i], 1905 + triangleHSLA[i], vertexMovedX[l9], vertexMovedX[l10], vertexMovedX[l11], 1906 + vertexMovedY[l9], vertexMovedY[l10], vertexMovedY[l11], vertexMovedZ[l9], 1907 + vertexMovedZ[l10], vertexMovedZ[l11], triangleColorValues[i]); 1829 1908 } 1830 1909 } 1831 1910 if (l == 4) { 1832 1911 if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer.virtualBottomX || j4 > Rasterizer.virtualBottomX 1833 1912 || j5 > Rasterizer.virtualBottomX || anIntArray1699[3] < 0 1834 - || anIntArray1699[3] > Rasterizer.virtualBottomX) 1835 - Rasterizer3D.aBoolean1528 = true; 1913 + || anIntArray1699[3] > Rasterizer.virtualBottomX) { 1914 + Rasterizer3D.restrictEdges = true; 1915 + } 1836 1916 int i8; 1837 - if (texturePoints == null) 1917 + if (triangleDrawType == null) { 1838 1918 i8 = 0; 1839 - else 1840 - i8 = texturePoints[i] & 3; 1919 + } else { 1920 + i8 = triangleDrawType[i] & 3; 1921 + } 1841 1922 if (i8 == 0) { 1842 - Rasterizer3D.method503(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1923 + Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1843 1924 anIntArray1701[2]); 1844 - Rasterizer3D.method503(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1925 + Rasterizer3D.drawShadedTriangle(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1845 1926 anIntArray1701[0], anIntArray1701[2], anIntArray1701[3]); 1846 1927 return; 1847 1928 } 1848 1929 if (i8 == 1) { 1849 - int l8 = anIntArray1712[anIntArray1656[i]]; 1930 + int l8 = HSLtoRGB[triangleHSLA[i]]; 1850 1931 Rasterizer3D.method505(i7, j7, k7, j3, j4, j5, l8); 1851 1932 Rasterizer3D.method505(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], l8); 1852 1933 return; 1853 1934 } 1854 1935 if (i8 == 2) { 1855 - int i9 = texturePoints[i] >> 2; 1936 + int i9 = triangleDrawType[i] >> 2; 1856 1937 int i10 = texturedTrianglePointsX[i9]; 1857 1938 int i11 = texturedTrianglePointsY[i9]; 1858 1939 int i12 = texturedTrianglePointsZ[i9]; 1859 - Rasterizer3D.method507(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1860 - anIntArray1701[2], anIntArray1689[i10], anIntArray1689[i11], anIntArray1689[i12], 1861 - anIntArray1690[i10], anIntArray1690[i11], anIntArray1690[i12], anIntArray1691[i10], 1862 - anIntArray1691[i11], anIntArray1691[i12], triangleColorValues[i]); 1863 - Rasterizer3D.method507(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1864 - anIntArray1701[0], anIntArray1701[2], anIntArray1701[3], anIntArray1689[i10], 1865 - anIntArray1689[i11], anIntArray1689[i12], anIntArray1690[i10], anIntArray1690[i11], 1866 - anIntArray1690[i12], anIntArray1691[i10], anIntArray1691[i11], anIntArray1691[i12], 1940 + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1701[0], anIntArray1701[1], 1941 + anIntArray1701[2], vertexMovedX[i10], vertexMovedX[i11], vertexMovedX[i12], 1942 + vertexMovedY[i10], vertexMovedY[i11], vertexMovedY[i12], vertexMovedZ[i10], 1943 + vertexMovedZ[i11], vertexMovedZ[i12], triangleColorValues[i]); 1944 + Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1945 + anIntArray1701[0], anIntArray1701[2], anIntArray1701[3], vertexMovedX[i10], 1946 + vertexMovedX[i11], vertexMovedX[i12], vertexMovedY[i10], vertexMovedY[i11], 1947 + vertexMovedY[i12], vertexMovedZ[i10], vertexMovedZ[i11], vertexMovedZ[i12], 1867 1948 triangleColorValues[i]); 1868 1949 return; 1869 1950 } 1870 - if (i8 == 3) { 1871 - int j9 = texturePoints[i] >> 2; 1872 - int j10 = texturedTrianglePointsX[j9]; 1873 - int j11 = texturedTrianglePointsY[j9]; 1874 - int j12 = texturedTrianglePointsZ[j9]; 1875 - Rasterizer3D.method507(i7, j7, k7, j3, j4, j5, anIntArray1656[i], anIntArray1656[i], 1876 - anIntArray1656[i], anIntArray1689[j10], anIntArray1689[j11], anIntArray1689[j12], 1877 - anIntArray1690[j10], anIntArray1690[j11], anIntArray1690[j12], anIntArray1691[j10], 1878 - anIntArray1691[j11], anIntArray1691[j12], triangleColorValues[i]); 1879 - Rasterizer3D.method507(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1880 - anIntArray1656[i], anIntArray1656[i], anIntArray1656[i], anIntArray1689[j10], 1881 - anIntArray1689[j11], anIntArray1689[j12], anIntArray1690[j10], anIntArray1690[j11], 1882 - anIntArray1690[j12], anIntArray1691[j10], anIntArray1691[j11], anIntArray1691[j12], 1883 - triangleColorValues[i]); 1884 - } 1951 + int j9 = triangleDrawType[i] >> 2; 1952 + int j10 = texturedTrianglePointsX[j9]; 1953 + int j11 = texturedTrianglePointsY[j9]; 1954 + int j12 = texturedTrianglePointsZ[j9]; 1955 + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, triangleHSLA[i], triangleHSLA[i], 1956 + triangleHSLA[i], vertexMovedX[j10], vertexMovedX[j11], vertexMovedX[j12], 1957 + vertexMovedY[j10], vertexMovedY[j11], vertexMovedY[j12], vertexMovedZ[j10], 1958 + vertexMovedZ[j11], vertexMovedZ[j12], triangleColorValues[i]); 1959 + Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1700[3], j3, j5, anIntArray1699[3], 1960 + triangleHSLA[i], triangleHSLA[i], triangleHSLA[i], vertexMovedX[j10], 1961 + vertexMovedX[j11], vertexMovedX[j12], vertexMovedY[j10], vertexMovedY[j11], 1962 + vertexMovedY[j12], vertexMovedZ[j10], vertexMovedZ[j11], vertexMovedZ[j12], 1963 + triangleColorValues[i]); 1885 1964 } 1886 1965 } 1887 1966 } 1888 1967 1889 1968 public boolean method602(int i, int j, int k, int l, int i1, int j1, int k1, int l1) { 1890 - if (j < k && j < l && j < i1) 1969 + if (j < k && j < l && j < i1) { 1891 1970 return false; 1892 - if (j > k && j > l && j > i1) 1971 + } 1972 + if (j > k && j > l && j > i1) { 1893 1973 return false; 1894 - if (i < j1 && i < k1 && i < l1) 1974 + } 1975 + if (i < j1 && i < k1 && i < l1) { 1895 1976 return false; 1977 + } 1896 1978 return i <= j1 || i <= k1 || i <= l1; 1897 1979 } 1898 1980 ··· 1900 1982 static { 1901 1983 SINE = Rasterizer3D.SINE; 1902 1984 COSINE = Rasterizer3D.COSINE; 1903 - anIntArray1712 = Rasterizer3D.getRgbLookupTableId; 1985 + HSLtoRGB = Rasterizer3D.getRgbLookupTableId; 1904 1986 anIntArray1713 = Rasterizer3D.anIntArray1535; 1905 1987 } 1906 1988 }
+1 -1
src/com/jagex/runescape/media/renderable/actor/Npc.java
··· 47 47 animationModel.scaleT(spotanimation.resizeZ, spotanimation.resizeXY, 9, spotanimation.resizeXY); 48 48 animationModel.applyLighting(64 + spotanimation.modelLightFalloff, 850 + spotanimation.modelLightAmbient, -30, -50, -30, true); 49 49 Model[] models = { model, animationModel }; 50 - model = new Model(2, 0, models); 50 + model = new Model(models); 51 51 } 52 52 } 53 53 if (npcDefinition.boundaryDimension == 1)
+20 -20
src/com/jagex/runescape/media/renderable/actor/Player.java
··· 15 15 public class Player extends Actor { 16 16 17 17 public int anInt1743; 18 - public int anInt1744; 18 + public int drawHeight; 19 19 public int anInt1745; 20 20 public Model playerModel; 21 - public int anInt1748 = -1; 22 - public long cachedModel = -1L; 23 - public int anInt1750; 21 + public int headIcon = -1; 22 + private long cachedModel = -1L; 23 + public int drawHeight2; 24 24 public String playerName; 25 - public int appearance[] = new int[12]; 25 + public int[] appearance = new int[12]; 26 26 public int combatLevel; 27 - public long appearanceHash; 28 - public int gender; 29 - public int anInt1756 = -1; 27 + private long appearanceHash; 28 + private int gender; 29 + public int isSkulled = -1; 30 30 public ActorDefinition npcDefinition; 31 31 public boolean visible = false; 32 - public int anInt1759; 33 - public int appearanceColors[] = new int[5]; 32 + public int skillLevel; 33 + public int[] appearanceColors = new int[5]; 34 34 public static Cache modelCache = new Cache(260); 35 - public boolean aBoolean1763 = false; 35 + public boolean preventRotation = false; 36 36 public int objectAppearanceStartTick; 37 37 public int objectAppearanceEndTick; 38 38 public int teamId; ··· 175 175 modelCache.put(model, hash); 176 176 cachedModel = hash; 177 177 } 178 - if (aBoolean1763) 178 + if (preventRotation) 179 179 return model; 180 180 Model empty = Model.EMPTY_MODEL; 181 181 empty.replaceWithModel(model, Animation.exists(primaryFrame) & Animation.exists(secondaryFrame) ··· 204 204 return null; 205 205 modelHeight = appearanceModel.modelHeight; 206 206 appearanceModel.oneSquareModel = true; 207 - if (aBoolean1763) 207 + if (preventRotation) 208 208 return appearanceModel; 209 209 if (super.graphic != -1 && super.currentAnimation != -1) { 210 210 SpotAnimation spotAnimation = SpotAnimation.cache[super.graphic]; ··· 221 221 spotAnimationModel2.scaleT(spotAnimation.resizeZ, spotAnimation.resizeXY, 9, spotAnimation.resizeXY); 222 222 spotAnimationModel2.applyLighting(64 + spotAnimation.modelLightFalloff, 850 + spotAnimation.modelLightAmbient, -30, -50, -30, true); 223 223 Model[] models = { appearanceModel, spotAnimationModel2 }; 224 - appearanceModel = new Model(2, 0, models); 224 + appearanceModel = new Model(models); 225 225 } 226 226 } 227 227 if (playerModel != null) { ··· 230 230 if (Game.pulseCycle >= objectAppearanceStartTick && Game.pulseCycle < objectAppearanceEndTick) { 231 231 Model model = playerModel; 232 232 model.translate(anInt1743 - super.worldX, anInt1745 - super.worldY, 233 - anInt1744 - anInt1750); 233 + drawHeight - drawHeight2); 234 234 if (super.nextStepOrientation == 512) { 235 235 model.rotate90Degrees(); 236 236 model.rotate90Degrees(); ··· 241 241 } else if (super.nextStepOrientation == 1536) 242 242 model.rotate90Degrees(); 243 243 Model[] models = { appearanceModel, model }; 244 - appearanceModel = new Model(2, 0, models); 244 + appearanceModel = new Model(models); 245 245 if (super.nextStepOrientation == 512) 246 246 model.rotate90Degrees(); 247 247 else if (super.nextStepOrientation == 1024) { ··· 253 253 model.rotate90Degrees(); 254 254 } 255 255 model.translate(super.worldX - anInt1743, super.worldY - anInt1745, 256 - anInt1750 - anInt1744); 256 + drawHeight2 - drawHeight); 257 257 } 258 258 } 259 259 appearanceModel.oneSquareModel = true; ··· 263 263 public void updateAppearance(Buffer buffer) { 264 264 buffer.currentPosition = 0; 265 265 gender = buffer.getUnsignedByte(); 266 - anInt1756 = buffer.getSignedByte(); 267 - anInt1748 = buffer.getSignedByte(); 266 + isSkulled = buffer.getSignedByte(); 267 + headIcon = buffer.getSignedByte(); 268 268 npcDefinition = null; 269 269 teamId = 0; 270 270 for (int index = 0; index < 12; index++) { ··· 316 316 super.runAnimationId = -1; 317 317 playerName = TextUtils.formatName(TextUtils.longToName(buffer.getLong())); 318 318 combatLevel = buffer.getUnsignedByte(); 319 - anInt1759 = buffer.getUnsignedLEShort(); 319 + skillLevel = buffer.getUnsignedLEShort(); 320 320 visible = true; 321 321 appearanceHash = 0L; 322 322 int k1 = appearance[5];
+3 -3
src/com/jagex/runescape/net/Buffer.java
··· 29 29 Buffer buffer = null; 30 30 if (sizeMode == 0 && smallBufferCount > 0) { 31 31 smallBufferCount--; 32 - buffer = (Buffer) smallBuffers.removeFirst(); 32 + buffer = (Buffer) smallBuffers.pop(); 33 33 } else if (sizeMode == 1 && mediumBufferCount > 0) { 34 34 mediumBufferCount--; 35 - buffer = (Buffer) mediumBuffers.removeFirst(); 35 + buffer = (Buffer) mediumBuffers.pop(); 36 36 } else if (sizeMode == 2 && largeBufferCount > 0) { 37 37 largeBufferCount--; 38 - buffer = (Buffer) largeBuffers.removeFirst(); 38 + buffer = (Buffer) largeBuffers.pop(); 39 39 } 40 40 if (buffer != null) { 41 41 buffer.currentPosition = 0;
+15 -15
src/com/jagex/runescape/net/requester/OnDemandRequester.java
··· 99 99 onDemandNode.buffer = null; 100 100 if (onDemandNode.immediate) 101 101 synchronized (completed) { 102 - completed.insertBack(onDemandNode); 102 + completed.pushBack(onDemandNode); 103 103 } 104 104 else 105 105 onDemandNode.remove(); ··· 135 135 } 136 136 if (onDemandNode.immediate) 137 137 synchronized (completed) { 138 - completed.insertBack(onDemandNode); 138 + completed.pushBack(onDemandNode); 139 139 } 140 140 else 141 141 onDemandNode.remove(); ··· 172 172 break; 173 173 OnDemandNode class50_sub1_sub3; 174 174 synchronized (immediateRequests) { 175 - class50_sub1_sub3 = (OnDemandNode) immediateRequests.removeFirst(); 175 + class50_sub1_sub3 = (OnDemandNode) immediateRequests.pop(); 176 176 } 177 177 while (class50_sub1_sub3 != null) { 178 178 if (filePriorities[class50_sub1_sub3.type][class50_sub1_sub3.id] != 0) { 179 179 filePriorities[class50_sub1_sub3.type][class50_sub1_sub3.id] = 0; 180 - toRequest.insertBack(class50_sub1_sub3); 180 + toRequest.pushBack(class50_sub1_sub3); 181 181 sendRequest(class50_sub1_sub3); 182 182 expectData = true; 183 183 if (anInt1334 < anInt1350) ··· 188 188 return; 189 189 } 190 190 synchronized (immediateRequests) { 191 - class50_sub1_sub3 = (OnDemandNode) immediateRequests.removeFirst(); 191 + class50_sub1_sub3 = (OnDemandNode) immediateRequests.pop(); 192 192 } 193 193 } 194 194 for (int j = 0; j < 4; j++) { ··· 201 201 class50_sub1_sub3_1.type = j; 202 202 class50_sub1_sub3_1.id = l; 203 203 class50_sub1_sub3_1.immediate = false; 204 - toRequest.insertBack(class50_sub1_sub3_1); 204 + toRequest.pushBack(class50_sub1_sub3_1); 205 205 sendRequest(class50_sub1_sub3_1); 206 206 expectData = true; 207 207 if (anInt1334 < anInt1350) ··· 252 252 onDemandNode.id = id; 253 253 onDemandNode.immediate = true; 254 254 synchronized (wanted) { 255 - wanted.insertBack(onDemandNode); 255 + wanted.pushBack(onDemandNode); 256 256 } 257 257 immediateRequests1.push(onDemandNode); 258 258 } ··· 261 261 public OnDemandNode next() { 262 262 OnDemandNode onDemandNode; 263 263 synchronized (completed) { 264 - onDemandNode = (OnDemandNode) completed.removeFirst(); 264 + onDemandNode = (OnDemandNode) completed.pop(); 265 265 } 266 266 if (onDemandNode == null) 267 267 return null; ··· 390 390 anInt1343++; 391 391 392 392 while (immediateRequestsSent < 10) { 393 - OnDemandNode class50_sub1_sub3_1 = (OnDemandNode) aClass6_1351.removeFirst(); 393 + OnDemandNode class50_sub1_sub3_1 = (OnDemandNode) aClass6_1351.pop(); 394 394 if (class50_sub1_sub3_1 == null) 395 395 break; 396 396 if (filePriorities[class50_sub1_sub3_1.type][class50_sub1_sub3_1.id] != 0) 397 397 anInt1334++; 398 398 filePriorities[class50_sub1_sub3_1.type][class50_sub1_sub3_1.id] = 0; 399 - toRequest.insertBack(class50_sub1_sub3_1); 399 + toRequest.pushBack(class50_sub1_sub3_1); 400 400 immediateRequestsSent++; 401 401 sendRequest(class50_sub1_sub3_1); 402 402 expectData = true; ··· 515 515 class50_sub1_sub3.id = i; 516 516 class50_sub1_sub3.immediate = false; 517 517 synchronized (immediateRequests) { 518 - immediateRequests.insertBack(class50_sub1_sub3); 518 + immediateRequests.pushBack(class50_sub1_sub3); 519 519 } 520 520 } 521 521 522 522 public void localComplete(boolean flag) { 523 523 OnDemandNode class50_sub1_sub3; 524 524 synchronized (wanted) { 525 - class50_sub1_sub3 = (OnDemandNode) wanted.removeFirst(); 525 + class50_sub1_sub3 = (OnDemandNode) wanted.pop(); 526 526 } 527 527 if (!flag) { 528 528 for (int i = 1; i > 0; i++); ··· 537 537 abyte0 = null; 538 538 synchronized (wanted) { 539 539 if (abyte0 == null) { 540 - aClass6_1351.insertBack(class50_sub1_sub3); 540 + aClass6_1351.pushBack(class50_sub1_sub3); 541 541 } else { 542 542 class50_sub1_sub3.buffer = abyte0; 543 543 synchronized (completed) { 544 - completed.insertBack(class50_sub1_sub3); 544 + completed.pushBack(class50_sub1_sub3); 545 545 } 546 546 } 547 - class50_sub1_sub3 = (OnDemandNode) wanted.removeFirst(); 547 + class50_sub1_sub3 = (OnDemandNode) wanted.pop(); 548 548 } 549 549 } 550 550 }
-18
src/com/jagex/runescape/scene/CameraAngle.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class CameraAngle { 6 - 7 - public CameraAngle() { 8 - } 9 - 10 - public int x; 11 - public int y; 12 - public int z; 13 - public Renderable aRenderable150; 14 - public Renderable aRenderable151; 15 - public Renderable aRenderable152; 16 - public int anInt179; 17 - public int anInt180; 18 - }
+18
src/com/jagex/runescape/scene/GroundItemTile.java
··· 1 + package com.jagex.runescape.scene; 2 + 3 + import com.jagex.runescape.media.renderable.Renderable; 4 + 5 + public class GroundItemTile { 6 + 7 + public GroundItemTile() { 8 + } 9 + 10 + public int z; 11 + public int x; 12 + public int y; 13 + public Renderable firstGroundItem; 14 + public Renderable secondGroundItem; 15 + public Renderable thirdGroundItem; 16 + public int uid; 17 + public int anInt180; 18 + }
+21
src/com/jagex/runescape/scene/InteractiveObject.java
··· 1 + package com.jagex.runescape.scene; 2 + 3 + import com.jagex.runescape.media.renderable.Renderable; 4 + 5 + public class InteractiveObject { 6 + 7 + public int z; 8 + public int worldZ; 9 + public int worldX; 10 + public int worldY; 11 + public Renderable renderable; 12 + public int rotation; 13 + public int tileLeft; 14 + public int tileRight; 15 + public int tileTop; 16 + public int tileBottom; 17 + public int anInt123; 18 + public int cycle; 19 + public int uid; 20 + public byte config; 21 + }
+59 -61
src/com/jagex/runescape/scene/Region.java
··· 120 120 else 121 121 class50_sub1_sub4 = new GameObject(i, i_18_, 22, i_23_, i_24_, i_22_, i_25_, class47.animationId, 122 122 true); 123 - class22.addGroundDecoration(i_19_, i_17_, 669, i_28_, i_27_, i_26_, i_21_, class50_sub1_sub4); 123 + class22.addGroundDecoration(i_19_, i_17_, i_21_, i_26_, i_27_, class50_sub1_sub4, i_28_); 124 124 if (class47.solid && class47.actionsBoolean) 125 125 class46.markBlocked(i_19_, i_17_); 126 126 } else if (i_16_ == 10 || i_16_ == 11) { ··· 143 143 i_30_ = class47.sizeX; 144 144 i_31_ = class47.sizeY; 145 145 } 146 - class22.method251(i_21_, i_30_, i_17_, class50_sub1_sub4, i_28_, i_29_, i_19_, -896, i_31_, i_26_, 147 - i_27_); 146 + class22.addEntityB(i_19_, i_17_, i_21_, i_26_, i_29_, i_31_, i_30_, i_27_, class50_sub1_sub4, i_28_ 147 + ); 148 148 } 149 149 if (class47.solid) 150 150 class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, ··· 156 156 else 157 157 class50_sub1_sub4 = new GameObject(i, i_18_, i_16_, i_23_, i_24_, i_22_, i_25_, class47.animationId, 158 158 true); 159 - class22.method251(i_21_, 1, i_17_, class50_sub1_sub4, i_28_, 0, i_19_, -896, 1, i_26_, i_27_); 159 + class22.addEntityB(i_19_, i_17_, i_21_, i_26_, 0, 1, 1, i_27_, class50_sub1_sub4, i_28_); 160 160 if (class47.solid) 161 161 class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, 162 162 (byte) 52); ··· 167 167 else 168 168 class50_sub1_sub4 = new GameObject(i, i_18_, 0, i_23_, i_24_, i_22_, i_25_, class47.animationId, 169 169 true); 170 - class22.method249(anIntArray158[i_18_], class50_sub1_sub4, i_27_, i_17_, i_28_, i_19_, null, i_26_, 0, 171 - i_21_); 170 + class22.addWall(i_19_, i_17_, i_21_, i_26_, anIntArray158[i_18_], 0, i_27_, class50_sub1_sub4, null, i_28_ 171 + ); 172 172 if (class47.solid) 173 173 class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 174 174 } else if (i_16_ == 1) { ··· 178 178 else 179 179 class50_sub1_sub4 = new GameObject(i, i_18_, 1, i_23_, i_24_, i_22_, i_25_, class47.animationId, 180 180 true); 181 - class22.method249(anIntArray167[i_18_], class50_sub1_sub4, i_27_, i_17_, i_28_, i_19_, null, i_26_, 0, 182 - i_21_); 181 + class22.addWall(i_19_, i_17_, i_21_, i_26_, anIntArray167[i_18_], 0, i_27_, class50_sub1_sub4, null, i_28_ 182 + ); 183 183 if (class47.solid) 184 184 class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 185 185 } else if (i_16_ == 2) { ··· 195 195 class50_sub1_sub4_33_ = new GameObject(i, i_32_, 2, i_23_, i_24_, i_22_, i_25_, class47.animationId, 196 196 true); 197 197 } 198 - class22.method249(anIntArray158[i_18_], class50_sub1_sub4, i_27_, i_17_, i_28_, i_19_, class50_sub1_sub4_33_, i_26_, anIntArray158[i_32_], 199 - i_21_); 198 + class22.addWall(i_19_, i_17_, i_21_, i_26_, anIntArray158[i_18_], anIntArray158[i_32_], i_27_, class50_sub1_sub4, class50_sub1_sub4_33_, i_28_ 199 + ); 200 200 if (class47.solid) 201 201 class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 202 202 } else if (i_16_ == 3) { ··· 206 206 else 207 207 class50_sub1_sub4 = new GameObject(i, i_18_, 3, i_23_, i_24_, i_22_, i_25_, class47.animationId, 208 208 true); 209 - class22.method249(anIntArray167[i_18_], class50_sub1_sub4, i_27_, i_17_, i_28_, i_19_, null, i_26_, 0, 210 - i_21_); 209 + class22.addWall(i_19_, i_17_, i_21_, i_26_, anIntArray167[i_18_], 0, i_27_, class50_sub1_sub4, null, i_28_ 210 + ); 211 211 if (class47.solid) 212 212 class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 213 213 } else if (i_16_ == 9) { ··· 217 217 else 218 218 class50_sub1_sub4 = new GameObject(i, i_18_, i_16_, i_23_, i_24_, i_22_, i_25_, class47.animationId, 219 219 true); 220 - class22.method251(i_21_, 1, i_17_, class50_sub1_sub4, i_28_, 0, i_19_, -896, 1, i_26_, i_27_); 220 + class22.addEntityB(i_19_, i_17_, i_21_, i_26_, 0, 1, 1, i_27_, class50_sub1_sub4, i_28_); 221 221 if (class47.solid) 222 222 class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, 223 223 (byte) 52); ··· 251 251 else 252 252 class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 253 253 true); 254 - class22.addWallDecoration(i_21_, anIntArray158[i_18_], i_18_ * 512, i_27_, i_28_, i_19_, 0, i_17_, 0, 255 - i_26_, class50_sub1_sub4, -930); 254 + class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_ * 512, i_27_, class50_sub1_sub4, i_28_, anIntArray158[i_18_] 255 + ); 256 256 } else if (i_16_ == 5) { 257 257 int i_37_ = 16; 258 258 int i_38_ = class22.method267(i_21_, i_19_, i_17_); ··· 264 264 else 265 265 class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 266 266 true); 267 - class22.addWallDecoration(i_21_, anIntArray158[i_18_], i_18_ * 512, i_27_, i_28_, i_19_, 268 - anIntArray143[i_18_] * i_37_, i_17_, anIntArray161[i_18_] * i_37_, i_26_, 269 - class50_sub1_sub4, -930); 267 + class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, anIntArray161[i_18_] * i_37_, anIntArray143[i_18_] * i_37_, i_18_ * 512, i_27_, class50_sub1_sub4, i_28_, anIntArray158[i_18_] 268 + ); 270 269 } else if (i_16_ == 6) { 271 270 Renderable class50_sub1_sub4; 272 271 if (class47.animationId == -1 && class47.childrenIds == null) ··· 274 273 else 275 274 class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 276 275 true); 277 - class22.addWallDecoration(i_21_, 256, i_18_, i_27_, i_28_, i_19_, 0, i_17_, 0, i_26_, class50_sub1_sub4, 278 - -930); 276 + class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 256 277 + ); 279 278 } else if (i_16_ == 7) { 280 279 Renderable class50_sub1_sub4; 281 280 if (class47.animationId == -1 && class47.childrenIds == null) ··· 283 282 else 284 283 class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 285 284 true); 286 - class22.addWallDecoration(i_21_, 512, i_18_, i_27_, i_28_, i_19_, 0, i_17_, 0, i_26_, class50_sub1_sub4, 287 - -930); 285 + class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 512 286 + ); 288 287 } else if (i_16_ == 8) { 289 288 Renderable class50_sub1_sub4; 290 289 if (class47.animationId == -1 && class47.childrenIds == null) ··· 292 291 else 293 292 class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 294 293 true); 295 - class22.addWallDecoration(i_21_, 768, i_18_, i_27_, i_28_, i_19_, 0, i_17_, 0, i_26_, class50_sub1_sub4, 296 - -930); 294 + class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 768 295 + ); 297 296 } 298 297 } 299 298 } ··· 472 471 if (hslBitsetUnmodified != -1) 473 472 rgbBitsetRandomized = (Rasterizer3D.getRgbLookupTableId[trimHSLLightness(hslBitsetRandomized, 96)]); 474 473 if (overlayFloorId == 0) 475 - scene.method246(plane, x, y, 0, 0, -1, vertexSouthWest, vertexSouthEast, vertexNorthEast, vertexNorthWest, 474 + scene.renderTile(plane, x, y, 0, 0, -1, vertexSouthWest, vertexSouthEast, vertexNorthEast, vertexNorthWest, 476 475 trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthEast), 477 476 trimHSLLightness(hslBitsetUnmodified, lightNorthWest), 0, 0, 0, 0, rgbBitsetRandomized, 0); 478 477 else { ··· 493 492 hslBitset = getHSLBitset(floor.hue2, floor.saturation, floor.lightness); 494 493 rgbBitset = (Rasterizer3D.getRgbLookupTableId[method182(floor.hslColor2, 96)]); 495 494 } 496 - scene.method246(plane, x, y, clippingPath, clippingPathRotation, textureid, vertexSouthWest, vertexSouthEast, vertexNorthEast, 495 + scene.renderTile(plane, x, y, clippingPath, clippingPathRotation, textureid, vertexSouthWest, vertexSouthEast, vertexNorthEast, 497 496 vertexNorthWest, trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, 498 497 lightNorthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthWest), method182(hslBitset, lightSouthWest), 499 498 method182(hslBitset, lightSouthEast), method182(hslBitset, lightNorthEast), ··· 506 505 } 507 506 for (int i_104_ = 1; i_104_ < regionSizeY - 1; i_104_++) { 508 507 for (int i_105_ = 1; i_105_ < regionSizeX - 1; i_105_++) 509 - scene.method245(plane, i_105_, i_104_, getVisibilityPlaneFor(i_104_, plane, i_105_, (byte) 0)); 508 + scene.setTileLogicHeight(plane, i_105_, i_104_, getVisibilityPlaneFor(i_104_, plane, i_105_, (byte) 0)); 510 509 } 511 510 } 512 - scene.method272((byte) 2, -10, -50, -50); 511 + scene.shadeModels(-10, -50, -50); 513 512 for (int y = 0; y < regionSizeX; y++) { 514 513 for (int x = 0; x < regionSizeY; x++) { 515 514 if ((renderRuleFlags[1][y][x] & 0x2) == 2) ··· 558 557 int highestOcclussionVertexHeightOffset = 240; 559 558 int highestOcclussionVertexHeight = ((vertexHeights[higestOcclussionPlane][x][lowestOcclussionY]) - highestOcclussionVertexHeightOffset); 560 559 int lowestOcclussionVertexHeight = (vertexHeights[lowestOcclussionPlane][x][lowestOcclussionY]); 561 - Scene.createCullingOcclussionBox(x * 128, lowestOcclussionVertexHeight, x * 128, higestOcclussionY * 128 + 128, 562 - currentPlane, lowestOcclussionY * 128, highestOcclussionVertexHeight, 1); 560 + Scene.createCullingCluster(currentPlane, x * 128, x * 128, higestOcclussionY * 128 + 128, lowestOcclussionY * 128, highestOcclussionVertexHeight, lowestOcclussionVertexHeight, 561 + 1); 563 562 for (int occludedPlane = lowestOcclussionPlane; occludedPlane <= higestOcclussionPlane; occludedPlane++) { 564 563 for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) 565 564 tileCullingBitsets[occludedPlane][x][occludedY] &= renderRule1 ^ 0xffffffff; ··· 596 595 int i_134_ = 240; 597 596 int i_135_ = ((vertexHeights[i_130_][i_127_][y]) - i_134_); 598 597 int i_136_ = (vertexHeights[i_129_][i_127_][y]); 599 - Scene.createCullingOcclussionBox(i_127_ * 128, i_136_, i_128_ * 128 + 128, y * 128, 600 - currentPlane, y * 128, i_135_, 2); 598 + Scene.createCullingCluster(currentPlane, i_128_ * 128 + 128, i_127_ * 128, y * 128, y * 128, i_135_, i_136_, 599 + 2); 601 600 for (int i_137_ = i_129_; i_137_ <= i_130_; i_137_++) { 602 601 for (int i_138_ = i_127_; i_138_ <= i_128_; i_138_++) 603 602 tileCullingBitsets[i_137_][i_138_][y] &= renderRule2 ^ 0xffffffff; ··· 631 630 } 632 631 if ((i_140_ - i_139_ + 1) * (i_142_ - i_141_ + 1) >= 4) { 633 632 int i_145_ = (vertexHeights[plane][i_139_][i_141_]); 634 - Scene.createCullingOcclussionBox(i_139_ * 128, i_145_, i_140_ * 128 + 128, i_142_ * 128 + 128, 635 - currentPlane, i_141_ * 128, i_145_, 4); 633 + Scene.createCullingCluster(currentPlane, i_140_ * 128 + 128, i_139_ * 128, i_142_ * 128 + 128, i_141_ * 128, i_145_, i_145_, 634 + 4); 636 635 for (int i_146_ = i_139_; i_146_ <= i_140_; i_146_++) { 637 636 for (int i_147_ = i_141_; i_147_ <= i_142_; i_147_++) 638 637 tileCullingBitsets[plane][i_146_][i_147_] &= renderRule3 ^ 0xffffffff; ··· 786 785 else 787 786 renderable = new GameObject(objectId, face, 22, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 788 787 true); 789 - scene.addGroundDecoration(x, y, 669, objectConfig, hash, vertexMix, plane, renderable); 788 + scene.addGroundDecoration(x, y, plane, vertexMix, hash, renderable, objectConfig); 790 789 if (gameObjectDefinition.solid && gameObjectDefinition.actionsBoolean && collisionMap != null) 791 790 collisionMap.markBlocked(x, y); 792 791 } ··· 810 809 sizeX = gameObjectDefinition.sizeX; 811 810 sizeY = gameObjectDefinition.sizeY; 812 811 } 813 - if (scene.method251(plane, sizeX, y, renderable, objectConfig, i_198_, x, -896, sizeY, 814 - vertexMix, hash) 812 + if (scene.addEntityB(x, y, plane, vertexMix, i_198_, sizeY, sizeX, hash, renderable, objectConfig 813 + ) 815 814 && gameObjectDefinition.unknown2) { 816 815 Model model; 817 816 if (renderable instanceof Model) ··· 821 820 if (model != null) { 822 821 for (int sizeXCounter = 0; sizeXCounter <= sizeX; sizeXCounter++) { 823 822 for (int sizeYCounter = 0; sizeYCounter <= sizeY; sizeYCounter++) { 824 - int shadowIntensity = model.shadowIntensity / 4; 823 + int shadowIntensity = model.diagonal2DAboveOrigin / 4; 825 824 if (shadowIntensity > 30) 826 825 shadowIntensity = 30; 827 826 if (shadowIntensity > (tileShadowIntensity[plane][x + sizeXCounter][y + sizeYCounter])) ··· 841 840 else 842 841 renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 843 842 true); 844 - scene.method251(plane, 1, y, renderable, objectConfig, 0, x, -896, 1, vertexMix, hash); 843 + scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 845 844 if (type >= 12 && type <= 17 && type != 13 && plane > 0) 846 845 tileCullingBitsets[plane][x][y] |= 0x924; 847 846 if (gameObjectDefinition.solid && collisionMap != null) ··· 854 853 else 855 854 renderable = new GameObject(objectId, face, 0, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 856 855 true); 857 - scene.method249(anIntArray158[face], renderable, hash, y, objectConfig, x, null, vertexMix, 0, 858 - plane); 856 + scene.addWall(x, y, plane, vertexMix, anIntArray158[face], 0, hash, renderable, null, objectConfig 857 + ); 859 858 if (face == 0) { 860 859 if (gameObjectDefinition.unknown2) { 861 860 tileShadowIntensity[plane][x][y] = (byte) 50; ··· 888 887 if (gameObjectDefinition.solid && collisionMap != null) 889 888 collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 890 889 if (gameObjectDefinition.unknown4 != 16) 891 - scene.method257(y, gameObjectDefinition.unknown4, plane, x); 890 + scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.unknown4); 892 891 } else if (type == 1) { 893 892 Renderable renderable; 894 893 if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) ··· 896 895 else 897 896 renderable = new GameObject(objectId, face, 1, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 898 897 true); 899 - scene.method249(anIntArray167[face], renderable, hash, y, objectConfig, x, null, vertexMix, 0, 900 - plane); 898 + scene.addWall(x, y, plane, vertexMix, anIntArray167[face], 0, hash, renderable, null, objectConfig 899 + ); 901 900 if (gameObjectDefinition.unknown2) { 902 901 if (face == 0) 903 902 tileShadowIntensity[plane][x][y + 1] = (byte) 50; ··· 923 922 renderable1 = new GameObject(objectId, i_204_, 2, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 924 923 true); 925 924 } 926 - scene.method249(anIntArray158[face], renderable, hash, y, objectConfig, x, renderable1, vertexMix, anIntArray158[i_204_], 927 - plane); 925 + scene.addWall(x, y, plane, vertexMix, anIntArray158[face], anIntArray158[i_204_], hash, renderable, renderable1, objectConfig 926 + ); 928 927 if (gameObjectDefinition.aBoolean797) { 929 928 if (face == 0) { 930 929 tileCullingBitsets[plane][x][y] |= 0x249; ··· 943 942 if (gameObjectDefinition.solid && collisionMap != null) 944 943 collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 945 944 if (gameObjectDefinition.unknown4 != 16) 946 - scene.method257(y, gameObjectDefinition.unknown4, plane, x); 945 + scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.unknown4); 947 946 } else if (type == 3) { 948 947 Renderable renderable; 949 948 if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) ··· 951 950 else 952 951 renderable = new GameObject(objectId, face, 3, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 953 952 true); 954 - scene.method249(anIntArray167[face], renderable, hash, y, objectConfig, x, null, vertexMix, 0, 955 - plane); 953 + scene.addWall(x, y, plane, vertexMix, anIntArray167[face], 0, hash, renderable, null, objectConfig 954 + ); 956 955 if (gameObjectDefinition.unknown2) { 957 956 if (face == 0) 958 957 tileShadowIntensity[plane][x][y + 1] = (byte) 50; ··· 972 971 else 973 972 renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 974 973 true); 975 - scene.method251(plane, 1, y, renderable, objectConfig, 0, x, -896, 1, vertexMix, hash); 974 + scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 976 975 if (gameObjectDefinition.solid && collisionMap != null) 977 976 collisionMap.method413(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 978 977 (byte) 52); ··· 1006 1005 else 1007 1006 renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1008 1007 true); 1009 - scene.addWallDecoration(plane, anIntArray158[face], face * 512, hash, objectConfig, x, 0, y, 0, 1010 - vertexMix, renderable, -930); 1008 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face * 512, hash, renderable, objectConfig, anIntArray158[face] 1009 + ); 1011 1010 } else if (type == 5) { 1012 1011 int offset = 16; 1013 1012 int i_210_ = scene.method267(plane, x, y); ··· 1019 1018 else 1020 1019 renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1021 1020 true); 1022 - scene.addWallDecoration(plane, anIntArray158[face], face * 512, hash, objectConfig, x, 1023 - anIntArray143[face] * offset, y, anIntArray161[face] * offset, vertexMix, 1024 - renderable, -930); 1021 + scene.addWallDecoration(x, y, plane, vertexMix, anIntArray161[face] * offset, anIntArray143[face] * offset, face * 512, hash, renderable, objectConfig, anIntArray158[face] 1022 + ); 1025 1023 } else if (type == 6) { 1026 1024 Renderable renderable; 1027 1025 if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) ··· 1029 1027 else 1030 1028 renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1031 1029 true); 1032 - scene.addWallDecoration(plane, 256, face, hash, objectConfig, x, 0, y, 0, vertexMix, renderable, 1033 - -930); 1030 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 256 1031 + ); 1034 1032 } else if (type == 7) { 1035 1033 Renderable renderable; 1036 1034 if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) ··· 1038 1036 else 1039 1037 renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1040 1038 true); 1041 - scene.addWallDecoration(plane, 512, face, hash, objectConfig, x, 0, y, 0, vertexMix, renderable, 1042 - -930); 1039 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 512 1040 + ); 1043 1041 } else if (type == 8) { 1044 1042 Renderable renderable; 1045 1043 if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) ··· 1047 1045 else 1048 1046 renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1049 1047 true); 1050 - scene.addWallDecoration(plane, 768, face, hash, objectConfig, x, 0, y, 0, vertexMix, renderable, 1051 - -930); 1048 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 768 1049 + ); 1052 1050 } 1053 1051 } 1054 1052 }
+2143 -1940
src/com/jagex/runescape/scene/Scene.java
··· 10 10 11 11 public class Scene { 12 12 13 - public static int anInt444; 14 - public int anInt450; 15 - public static boolean lowMemory = true; 16 - public int anInt452; 17 - public int anInt453; 18 - public int anInt454; 19 - public int anIntArrayArrayArray455[][][]; 20 - public SceneTile tiles[][][]; 21 - public int anInt457; 22 - public int anInt458; 23 - public SceneSpawnRequest aSceneSpawnRequestArray459[]; 24 - public int anIntArrayArrayArray460[][][]; 25 - public static int anInt461; 26 - public static int anInt462; 27 - public static int anInt463; 28 - public static int anInt464; 29 - public static int anInt465; 30 - public static int anInt466; 31 - public static int anInt467; 32 - public static int anInt468; 33 - public static int anInt469; 34 - public static int anInt470; 35 - public static int anInt471; 36 - public static int anInt472; 37 - public static int anInt473; 38 - public static int anInt474; 39 - public static int anInt475; 40 - public static int anInt476; 41 - public static SceneSpawnRequest aSceneSpawnRequestArray477[] = new SceneSpawnRequest[100]; 42 - public static final int anIntArray478[] = { 53, -53, -53, 53 }; 43 - public static final int anIntArray479[] = { -53, -53, 53, 53 }; 44 - public static final int anIntArray480[] = { -45, 45, 45, -45 }; 45 - public static final int anIntArray481[] = { 45, 45, -45, -45 }; 46 - public static boolean aBoolean482; 47 - public static int anInt483; 48 - public static int anInt484; 49 - public static int clickedTileX = -1; 50 - public static int anInt486 = -1; 51 - public static int anInt487 = 4; 52 - public static int anIntArray488[] = new int[anInt487]; 53 - public static SceneCluster aSceneClusterArrayArray554[][] = new SceneCluster[anInt487][500]; 54 - public static int anInt490; 55 - public static SceneCluster aClass39Array491[] = new SceneCluster[500]; 56 - public static LinkedList aClass6_492 = new LinkedList(); 57 - public static final int anIntArray493[] = { 19, 55, 38, 155, 255, 110, 137, 205, 76 }; 58 - public static final int anIntArray494[] = { 160, 192, 80, 96, 0, 144, 80, 48, 160 }; 59 - public static final int anIntArray495[] = { 76, 8, 137, 4, 0, 1, 38, 2, 19 }; 60 - public static final int anIntArray496[] = { 0, 0, 2, 0, 0, 2, 1, 1, 0 }; 61 - public static final int anIntArray497[] = { 2, 0, 0, 2, 0, 0, 0, 4, 4 }; 62 - public static final int anIntArray498[] = { 0, 4, 4, 8, 0, 0, 8, 0, 0 }; 63 - public static final int anIntArray499[] = { 1, 1, 0, 0, 0, 8, 0, 0, 8 }; 64 - public static final int anIntArray500[] = { 41, 39248, 41, 4643, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43086, 65 - 41, 41, 41, 41, 41, 41, 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079, 41, 41, 41, 41, 66 - 41, 41, 41, 41, 41, 41, 3131, 41, 41, 41 }; 67 - public int anIntArray501[]; 68 - public int anIntArray502[]; 69 - public int anInt503; 70 - public int anIntArrayArray504[][] = { new int[16], { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 71 - { 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1 }, { 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 }, 72 - { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1 }, { 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 73 - { 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 }, 74 - { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1 }, 75 - { 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 }, 76 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1 } }; 77 - public int anIntArrayArray505[][] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, 78 - { 12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3 }, 79 - { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, 80 - { 3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12 } }; 81 - public static boolean aBooleanArrayArrayArrayArray506[][][][] = new boolean[8][32][51][51]; 82 - public static boolean aBooleanArrayArray507[][]; 83 - public static int anInt508; 84 - public static int anInt509; 85 - public static int anInt510; 86 - public static int anInt511; 87 - public static int anInt512; 88 - public static int anInt513; 13 + public static boolean lowMemory = true; 14 + private int mapSizeZ; 15 + private int mapSizeX; 16 + private int mapSizeY; 17 + private int[][][] heightMap; 18 + private SceneTile[][][] groundArray; 19 + private int currentPositionZ; 20 + private int sceneSpawnRequestsCacheCurrentPos; 21 + private InteractiveObject[] sceneSpawnRequestsCache; 22 + private int[][][] anIntArrayArrayArray460; 23 + private static int anInt461; 24 + private static int plane; 25 + private static int cycle; 26 + private static int currentPositionX; 27 + private static int mapBoundsX; 28 + private static int currentPositionY; 29 + private static int mapBoundsY; 30 + private static int cameraPositionTileX; 31 + private static int cameraPositionTileY; 32 + private static int cameraPosX; 33 + private static int cameraPosZ; 34 + private static int cameraPosY; 35 + private static int curveSineY; 36 + private static int curveCosineY; 37 + private static int curveSineX; 38 + private static int curveCosineX; 39 + private static InteractiveObject[] interactiveObjects = new InteractiveObject[100]; 40 + private static final int[] faceOffsetX2 = {53, -53, -53, 53}; 41 + private static final int[] faceOffsetY2 = {-53, -53, 53, 53}; 42 + private static final int[] faceOffsetX3 = {-45, 45, 45, -45}; 43 + private static final int[] faceOffsetY3 = {45, 45, -45, -45}; 44 + private static boolean clicked; 45 + private static int clickX; 46 + private static int clickY; 47 + public static int clickedTileX = -1; 48 + public static int clickedTileY = -1; 49 + private static int anInt487 = 4; 50 + private static int[] cullingClusterPointer = new int[anInt487]; 51 + private static SceneCluster[][] cullingClusters = new SceneCluster[anInt487][500]; 52 + private static int processedCullingClustersPointer; 53 + private static SceneCluster[] processedCullingClusters = new SceneCluster[500]; 54 + private static LinkedList tileList = new LinkedList(); 55 + private static final int[] anIntArray493 = {19, 55, 38, 155, 255, 110, 137, 205, 76}; 56 + private static final int[] anIntArray494 = {160, 192, 80, 96, 0, 144, 80, 48, 160}; 57 + private static final int[] TILE_WALL_DRAW_FLAGS_1 = {76, 8, 137, 4, 0, 1, 38, 2, 19}; 58 + private static final int[] WALL_UNCULL_FLAGS_0 = {0, 0, 2, 0, 0, 2, 1, 1, 0}; 59 + private static final int[] anIntArray497 = {2, 0, 0, 2, 0, 0, 0, 4, 4}; 60 + private static final int[] anIntArray498 = {0, 4, 4, 8, 0, 0, 8, 0, 0}; 61 + private static final int[] anIntArray499 = {1, 1, 0, 0, 0, 8, 0, 0, 8}; 62 + private static final int[] textureRGB = {41, 39248, 41, 4643, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43086, 63 + 41, 41, 41, 41, 41, 41, 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079, 41, 41, 41, 41, 64 + 41, 41, 41, 41, 41, 41, 3131, 41, 41, 41}; 65 + private int[] anIntArray501; 66 + private int[] anIntArray502; 67 + private int anInt503; 68 + private int[][] tileShapePoints = {new int[16], {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 69 + {1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, 70 + {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 71 + {1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}, 72 + {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1}, 73 + {1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1}, 74 + {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1}}; 75 + private int[][] tileShapeIndices = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 76 + {12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3}, 77 + {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, 78 + {3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12}}; 79 + private static boolean[][][][] TILE_VISIBILITY_MAPS = new boolean[8][32][51][51]; 80 + private static boolean[][] TILE_VISIBILITY_MAP; 81 + private static int anInt508; 82 + private static int anInt509; 83 + private static int anInt510; 84 + private static int anInt511; 85 + private static int anInt512; 86 + private static int anInt513; 89 87 90 - public Scene(int ai[][][], int i, int j, int k, byte byte0) { 91 - aSceneSpawnRequestArray459 = new SceneSpawnRequest[5000]; 92 - anIntArray501 = new int[10000]; 93 - anIntArray502 = new int[10000]; 94 - anInt452 = j; 95 - anInt453 = k; 96 - anInt454 = i; 97 - tiles = new SceneTile[j][k][i]; 98 - anIntArrayArrayArray460 = new int[j][k + 1][i + 1]; 99 - anIntArrayArrayArray455 = ai; 100 - method241(); 101 - } 88 + public Scene(int[][][] heightMap) { 89 + final int length = 104;// was parameter 90 + final int width = 104;// was parameter 91 + final int height = 4;// was parameter 92 + sceneSpawnRequestsCache = new InteractiveObject[5000]; 93 + anIntArray501 = new int[10000]; 94 + anIntArray502 = new int[10000]; 95 + mapSizeZ = height; 96 + mapSizeX = width; 97 + mapSizeY = length; 98 + groundArray = new SceneTile[height][width][length]; 99 + anIntArrayArrayArray460 = new int[height][width + 1][length + 1]; 100 + this.heightMap = heightMap; 101 + initToNull(); 102 + } 102 103 103 - public static void method240() { 104 - aSceneSpawnRequestArray477 = null; 105 - anIntArray488 = null; 106 - aSceneClusterArrayArray554 = null; 107 - aClass6_492 = null; 108 - aBooleanArrayArrayArrayArray506 = null; 109 - aBooleanArrayArray507 = null; 104 + public static void nullLoader() { 105 + interactiveObjects = null; 106 + cullingClusterPointer = null; 107 + cullingClusters = null; 108 + tileList = null; 109 + TILE_VISIBILITY_MAPS = null; 110 + TILE_VISIBILITY_MAP = null; 110 111 111 - } 112 + } 112 113 113 - public void method241() { 114 - for (int i = 0; i < anInt452; i++) { 115 - for (int j = 0; j < anInt453; j++) { 116 - for (int i1 = 0; i1 < anInt454; i1++) 117 - tiles[i][j][i1] = null; 114 + public void initToNull() { 115 + for (int z = 0; z < mapSizeZ; z++) { 116 + for (int x = 0; x < mapSizeX; x++) { 117 + for (int y = 0; y < mapSizeY; y++) { 118 + groundArray[z][x][y] = null; 119 + } 118 120 119 - } 121 + } 120 122 121 - } 123 + } 122 124 123 - for (int l = 0; l < anInt487; l++) { 124 - for (int j1 = 0; j1 < anIntArray488[l]; j1++) 125 - aSceneClusterArrayArray554[l][j1] = null; 125 + for (int l = 0; l < anInt487; l++) { 126 + for (int j1 = 0; j1 < cullingClusterPointer[l]; j1++) { 127 + cullingClusters[l][j1] = null; 128 + } 126 129 127 - anIntArray488[l] = 0; 128 - } 130 + cullingClusterPointer[l] = 0; 131 + } 129 132 130 - for (int k1 = 0; k1 < anInt458; k1++) 131 - aSceneSpawnRequestArray459[k1] = null; 133 + for (int k1 = 0; k1 < sceneSpawnRequestsCacheCurrentPos; k1++) { 134 + sceneSpawnRequestsCache[k1] = null; 135 + } 132 136 133 - anInt458 = 0; 134 - for (int l1 = 0; l1 < aSceneSpawnRequestArray477.length; l1++) 135 - aSceneSpawnRequestArray477[l1] = null; 137 + sceneSpawnRequestsCacheCurrentPos = 0; 138 + for (int l1 = 0; l1 < interactiveObjects.length; l1++) { 139 + interactiveObjects[l1] = null; 140 + } 136 141 137 - } 142 + } 138 143 139 - public void method242(int i) { 140 - anInt457 = i; 141 - for (int j = 0; j < anInt453; j++) { 142 - for (int k = 0; k < anInt454; k++) 143 - if (tiles[i][j][k] == null) 144 - tiles[i][j][k] = new SceneTile(i, j, k); 144 + public void setHeightLevel(int z) { 145 + currentPositionZ = z; 146 + for (int x = 0; x < mapSizeX; x++) { 147 + for (int y = 0; y < mapSizeY; y++) { 148 + if (groundArray[z][x][y] == null) { 149 + groundArray[z][x][y] = new SceneTile(x, y, z); 150 + } 151 + } 145 152 146 - } 153 + } 147 154 148 - } 155 + } 149 156 150 - public void setBridgeMode(int i, int j) { 151 - SceneTile scenetile = tiles[0][i][j]; 152 - for (int k = 0; k < 3; k++) { 153 - SceneTile scenetile_15_ = tiles[k][i][j] = tiles[k + 1][i][j]; 154 - if (scenetile_15_ != null) { 155 - scenetile_15_.anInt1397--; 156 - for (int i1 = 0; i1 < scenetile_15_.sceneSpawnRequestCount; i1++) { 157 - SceneSpawnRequest sceneSpawnRequest = scenetile_15_.sceneSpawnRequests[i1]; 158 - if ((sceneSpawnRequest.anInt125 >> 29 & 3) == 2 && sceneSpawnRequest.x == i && sceneSpawnRequest.y == j) 159 - sceneSpawnRequest.anInt113--; 160 - } 157 + void setBridgeMode(int x, int y) { 158 + SceneTile scenetile = groundArray[0][x][y]; 159 + for (int z = 0; z < 3; z++) { 160 + SceneTile _tile = groundArray[z][x][y] = groundArray[z + 1][x][y]; 161 + if (_tile != null) { 162 + _tile.z--; 163 + for (int e = 0; e < _tile.entityCount; e++) { 164 + InteractiveObject entity = _tile.interactiveObjects[e]; 165 + if ((entity.uid >> 29 & 3) == 2 && entity.tileLeft == x && entity.tileTop == y) { 166 + entity.z--; 167 + } 168 + } 161 169 162 - } 163 - } 170 + } 171 + } 164 172 165 - if (tiles[0][i][j] == null) 166 - tiles[0][i][j] = new SceneTile(0, i, j); 167 - tiles[0][i][j].aClass50_Sub3_1419 = scenetile; 168 - tiles[3][i][j] = null; 169 - } 173 + if (groundArray[0][x][y] == null) { 174 + groundArray[0][x][y] = new SceneTile(x, y, 0); 175 + } 176 + groundArray[0][x][y].tileBelow = scenetile; 177 + groundArray[3][x][y] = null; 178 + } 170 179 171 - public static void createCullingOcclussionBox(int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { 172 - SceneCluster scenecluster = new SceneCluster(); 173 - scenecluster.anInt675 = j / 128; 174 - scenecluster.anInt676 = l / 128; 175 - scenecluster.anInt677 = k1 / 128; 176 - scenecluster.anInt678 = i1 / 128; 177 - scenecluster.anInt679 = i2; 178 - scenecluster.anInt680 = j; 179 - scenecluster.anInt681 = l; 180 - scenecluster.anInt682 = k1; 181 - scenecluster.anInt683 = i1; 182 - scenecluster.anInt684 = l1; 183 - scenecluster.anInt685 = k; 184 - aSceneClusterArrayArray554[j1][anIntArray488[j1]++] = scenecluster; 185 - } 180 + static void createCullingCluster(final int z, int highestX, int lowestX, int highestY, int lowestY, int highestZ, int lowestZ, int searchMask) { 181 + SceneCluster scenecluster = new SceneCluster(); 182 + scenecluster.tileStartX = lowestX / 128; 183 + scenecluster.tileEndX = highestX / 128; 184 + scenecluster.tileStartY = lowestY / 128; 185 + scenecluster.tileEndY = highestY / 128; 186 + scenecluster.searchMask = searchMask; 187 + scenecluster.worldStartX = lowestX; 188 + scenecluster.worldEndX = highestX; 189 + scenecluster.worldStartY = lowestY; 190 + scenecluster.worldEndY = highestY; 191 + scenecluster.worldEndZ = highestZ; 192 + scenecluster.worldStartZ = lowestZ; 193 + cullingClusters[z][cullingClusterPointer[z]++] = scenecluster; 194 + } 186 195 187 - public void method245(int i, int j, int k, int l) { 188 - SceneTile sceneTile = tiles[i][j][k]; 189 - if (sceneTile != null) { 190 - sceneTile.anInt1411 = l; 191 - } 192 - } 196 + void setTileLogicHeight(int z, int x, int y, int logicHeight) { 197 + SceneTile sceneTile = groundArray[z][x][y]; 198 + if (sceneTile != null) { 199 + sceneTile.logicHeight = logicHeight; 200 + } 201 + } 193 202 194 - public void method246(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, 195 - int i3, int j3, int k3, int l3, int i4, int j4, int k4, int l4) { 196 - if (l == 0) { 197 - GenericTile genericTile = new GenericTile(k2, l2, i3, j3, -1, k4, false); 198 - for (int i5 = i; i5 >= 0; i5--) 199 - if (tiles[i5][j][k] == null) 200 - tiles[i5][j][k] = new SceneTile(i5, j, k); 203 + void renderTile(int plane, int x, int y, int clippingPath, int clippingPathRotation, int textureId, int vertexHeightSW, int vertexHeightSE, int vertexHeightNE, int vertexHeightNW, int cA, int cB, 204 + int cD, int cC, int colourA, int colourB, int colourD, int colourC, int underlayRGB, int overlayRGB) { 205 + if (clippingPath == 0) { 206 + GenericTile tile = new GenericTile(cA, cB, cC, cD, -1, underlayRGB, false); 207 + for (int _z = plane; _z >= 0; _z--) { 208 + if (groundArray[_z][x][y] == null) { 209 + groundArray[_z][x][y] = new SceneTile(x, y, _z); 210 + } 211 + } 201 212 202 - tiles[i][j][k].genericTile = genericTile; 203 - return; 204 - } 205 - if (l == 1) { 206 - GenericTile genericTile_1 = new GenericTile(k3, l3, i4, j4, j1, l4, k1 == l1 && k1 == i2 && k1 == j2); 207 - for (int j5 = i; j5 >= 0; j5--) 208 - if (tiles[j5][j][k] == null) 209 - tiles[j5][j][k] = new SceneTile(j5, j, k); 213 + groundArray[plane][x][y].plainTile = tile; 214 + return; 215 + } 216 + if (clippingPath == 1) { 217 + GenericTile tile = new GenericTile(colourA, colourB, colourC, colourD, textureId, overlayRGB, vertexHeightSW == vertexHeightSE && vertexHeightSW == vertexHeightNE && vertexHeightSW == vertexHeightNW); 218 + for (int _z = plane; _z >= 0; _z--) { 219 + if (groundArray[_z][x][y] == null) { 220 + groundArray[_z][x][y] = new SceneTile(x, y, _z); 221 + } 222 + } 210 223 211 - tiles[i][j][k].genericTile = genericTile_1; 212 - return; 213 - } 214 - ComplexTile complexTile = new ComplexTile(j2, k3, i2, k1, j, i3, j3, l4, l2, i4, 0, k2, l, l1, j4, j1, k4, l3, k, i1); 215 - for (int k5 = i; k5 >= 0; k5--) 216 - if (tiles[k5][j][k] == null) 217 - tiles[k5][j][k] = new SceneTile(k5, j, k); 224 + groundArray[plane][x][y].plainTile = tile; 225 + return; 226 + } 227 + ComplexTile tile = new ComplexTile(x, vertexHeightSW, vertexHeightSE, vertexHeightNW, vertexHeightNE, y, clippingPathRotation, textureId, clippingPath, cA, colourA, cB, colourB, cC, colourC, cD, colourD, overlayRGB, underlayRGB); 228 + for (int _z = plane; _z >= 0; _z--) { 229 + if (groundArray[_z][x][y] == null) { 230 + groundArray[_z][x][y] = new SceneTile(x, y, _z); 231 + } 232 + } 218 233 219 - tiles[i][j][k].complexTile = complexTile; 220 - } 234 + groundArray[plane][x][y].shapedTile = tile; 235 + } 221 236 222 - public void addGroundDecoration(int i, int j, int k, byte byte0, int l, int i1, int j1, Renderable renderable) { 223 - if (k <= 0) 224 - return; 225 - if (renderable == null) 226 - return; 227 - FloorDecoration floorDecoration = new FloorDecoration(); 228 - floorDecoration.renderable = renderable; 229 - floorDecoration.y = i * 128 + 64; 230 - floorDecoration.z = j * 128 + 64; 231 - floorDecoration.x = i1; 232 - floorDecoration.hash = l; 233 - floorDecoration.config = byte0; 234 - if (tiles[j1][i][j] == null) 235 - tiles[j1][i][j] = new SceneTile(j1, i, j); 236 - tiles[j1][i][j].floorDecoration = floorDecoration; 237 - } 237 + void addGroundDecoration(int x, int y, int z, int drawHeight, int uid, Renderable renderable, byte config) { 238 + if (renderable == null) { 239 + return; 240 + } 241 + FloorDecoration floorDecoration = new FloorDecoration(); 242 + floorDecoration.renderable = renderable; 243 + floorDecoration.x = x * 128 + 64; 244 + floorDecoration.y = y * 128 + 64; 245 + floorDecoration.z = drawHeight; 246 + floorDecoration.uid = uid; 247 + floorDecoration.config = config; 248 + if (groundArray[z][x][y] == null) { 249 + groundArray[z][x][y] = new SceneTile(x, y, z); 250 + } 251 + groundArray[z][x][y].floorDecoration = floorDecoration; 252 + } 238 253 239 - public void method248(int i, int plane, Renderable renderable_59_, Renderable renderable, 240 - int k, Renderable renderable_58_, int l, int y, int x) { 241 - CameraAngle cameraAngle = new CameraAngle(); 242 - cameraAngle.aRenderable150 = renderable_59_; 243 - cameraAngle.y = x * 128 + 64; 244 - cameraAngle.z = y * 128 + 64; 245 - cameraAngle.x = i; 246 - cameraAngle.anInt179 = k; 247 - cameraAngle.aRenderable151 = renderable; 248 - cameraAngle.aRenderable152 = renderable_58_; 249 - int k1 = 0; 250 - SceneTile sceneTile = tiles[plane][x][y]; 251 - if (sceneTile != null) { 252 - for (int l1 = 0; l1 < sceneTile.sceneSpawnRequestCount; l1++) 253 - if (sceneTile.sceneSpawnRequests[l1].aRenderable601 instanceof Model) { 254 - int i2 = ((Model) sceneTile.sceneSpawnRequests[l1].aRenderable601).anInt1675; 255 - if (i2 > k1) 256 - k1 = i2; 257 - } 254 + public void addGroundItemTile(int x, int y, int z, int drawHeight, int uid, Renderable firstGroundItem, Renderable secondGroundItem, 255 + Renderable thirdGroundItem) { 256 + GroundItemTile groundItemTile = new GroundItemTile(); 257 + groundItemTile.firstGroundItem = firstGroundItem; 258 + groundItemTile.x = x * 128 + 64; 259 + groundItemTile.y = y * 128 + 64; 260 + groundItemTile.z = drawHeight; 261 + groundItemTile.uid = uid; 262 + groundItemTile.secondGroundItem = secondGroundItem; 263 + groundItemTile.thirdGroundItem = thirdGroundItem; 264 + int k1 = 0; 265 + SceneTile sceneTile = groundArray[z][x][y]; 266 + if (sceneTile != null) { 267 + for (int e = 0; e < sceneTile.entityCount; e++) { 268 + if (sceneTile.interactiveObjects[e].renderable instanceof Model) { 269 + int i2 = ((Model) sceneTile.interactiveObjects[e].renderable).anInt1675; 270 + if (i2 > k1) { 271 + k1 = i2; 272 + } 273 + } 274 + } 258 275 259 - } 260 - cameraAngle.anInt180 = k1; 261 - if (tiles[plane][x][y] == null) 262 - tiles[plane][x][y] = new SceneTile(plane, x, y); 263 - tiles[plane][x][y].cameraAngle = cameraAngle; 264 - } 276 + } 277 + groundItemTile.anInt180 = k1; 278 + if (groundArray[z][x][y] == null) { 279 + groundArray[z][x][y] = new SceneTile(x, y, z); 280 + } 281 + groundArray[z][x][y].groundItemTile = groundItemTile; 282 + } 265 283 266 - public void method249(int faceUnknown, Renderable renderable, int hash, int y, byte config, int x, Renderable renderable_68_, int plane, int face, 267 - int l1) { 268 - if (renderable != null || renderable_68_ != null) { 269 - Wall wall = new Wall(); 270 - wall.hash = hash; 271 - wall.config = config; 272 - wall.x = x * 128 + 64; 273 - wall.y = y * 128 + 64; 274 - wall.plane = plane; 275 - wall.aRenderable769 = renderable; 276 - wall.aRenderable770 = renderable_68_; 277 - wall.faceUnknown = faceUnknown; 278 - wall.face = face; 279 - for (int j2 = l1; j2 >= 0; j2--) 280 - if (tiles[j2][x][y] == null) 281 - tiles[j2][x][y] = new SceneTile(j2, x, y); 284 + void addWall(int x, int y, int z, int drawHeight, int orientation, int orientation2, int uid, Renderable primary, Renderable secondary, byte config) { 285 + if (primary != null || secondary != null) { 286 + Wall wall = new Wall(); 287 + wall.uid = uid; 288 + wall.config = config; 289 + wall.x = x * 128 + 64; 290 + wall.y = y * 128 + 64; 291 + wall.z = drawHeight; 292 + wall.primary = primary; 293 + wall.secondary = secondary; 294 + wall.orientation = orientation; 295 + wall.orientation2 = orientation2; 296 + for (int _z = z; _z >= 0; _z--) { 297 + if (groundArray[_z][x][y] == null) { 298 + groundArray[_z][x][y] = new SceneTile(x, y, _z); 299 + } 300 + } 282 301 283 - tiles[l1][x][y].wall = wall; 284 - } 285 - } 302 + groundArray[z][x][y].wall = wall; 303 + } 304 + } 286 305 287 - public void addWallDecoration(int plane, int faceUnknown, int face, int hash, byte config, int x, int j1, int y, int l1, int z, 288 - Renderable renderable, int j2) { 289 - if (renderable != null) { 290 - WallDecoration wallDecoration = new WallDecoration(); 291 - wallDecoration.hash = hash; 292 - wallDecoration.config = config; 293 - wallDecoration.y = x * 128 + 64 + l1; 294 - wallDecoration.x = y * 128 + 64 + j1; 295 - wallDecoration.plane = z; 296 - wallDecoration.renderable = renderable; 297 - wallDecoration.faceUnknown = faceUnknown; 298 - wallDecoration.face = face; 299 - for (int planeCounter = plane; planeCounter >= 0; planeCounter--) 300 - if (tiles[planeCounter][x][y] == null) 301 - tiles[planeCounter][x][y] = new SceneTile(planeCounter, x, y); 306 + void addWallDecoration(int x, int y, int z, int drawHeight, int offsetX, int offsetY, int face, int uid, Renderable renderable, byte config, int faceBits) { 307 + if (renderable != null) { 308 + WallDecoration wallDecoration = new WallDecoration(); 309 + wallDecoration.uid = uid; 310 + wallDecoration.config = config; 311 + wallDecoration.x = x * 128 + 64 + offsetX; 312 + wallDecoration.y = y * 128 + 64 + offsetY; 313 + wallDecoration.z = drawHeight; 314 + wallDecoration.renderable = renderable; 315 + wallDecoration.configBits = faceBits; 316 + wallDecoration.face = face; 317 + for (int planeCounter = z; planeCounter >= 0; planeCounter--) { 318 + if (groundArray[planeCounter][x][y] == null) { 319 + groundArray[planeCounter][x][y] = new SceneTile(x, y, planeCounter); 320 + } 321 + } 302 322 303 - tiles[plane][x][y].wallDecoration = wallDecoration; 304 - } 305 - } 323 + groundArray[z][x][y].wallDecoration = wallDecoration; 324 + } 325 + } 306 326 307 - public boolean method251(int i, int j, int k, Renderable class50_sub1_sub4, byte byte0, int l, int i1, 308 - int j1, int k1, int l1, int i2) { 309 - while (j1 >= 0) 310 - throw new NullPointerException(); 311 - if (class50_sub1_sub4 == null) { 312 - return true; 313 - } else { 314 - int j2 = i1 * 128 + 64 * j; 315 - int k2 = k * 128 + 64 * k1; 316 - return method254(i, i1, k, j, k1, j2, k2, l1, class50_sub1_sub4, l, false, i2, byte0); 317 - } 318 - } 327 + boolean addEntityB(int x, int y, int z, int worldZ, int rotation, int tileWidth, int tileHeight, int uid, Renderable entity, byte config) { 328 + if (entity == null) { 329 + return true; 330 + } else { 331 + int worldX = x * 128 + 64 * tileHeight; 332 + int worldY = y * 128 + 64 * tileWidth; 333 + return addRenderableC(x, y, z, worldX, worldY, worldZ, rotation, tileWidth, tileHeight, uid, entity, false, config); 334 + } 335 + } 319 336 320 - public boolean addEntity(int i, Renderable class50_sub1_sub4, int j, int k, boolean flag, int l, int i1, 321 - int j1, int k1, int l1) { 322 - if (class50_sub1_sub4 == null) 323 - return true; 324 - int i2 = j - j1; 325 - int j2 = k1 - j1; 326 - int k2 = j + j1; 327 - int l2 = k1 + j1; 328 - if (flag) { 329 - if (l1 > 640 && l1 < 1408) 330 - l2 += 128; 331 - if (l1 > 1152 && l1 < 1920) 332 - k2 += 128; 333 - if (l1 > 1664 || l1 < 384) 334 - j2 -= 128; 335 - if (l1 > 128 && l1 < 896) 336 - i2 -= 128; 337 - } 338 - i2 /= 128; 339 - j2 /= 128; 340 - k2 /= 128; 341 - l2 /= 128; 342 - return method254(i1, i2, j2, (k2 - i2) + 1, (l2 - j2) + 1, j, k1, k, class50_sub1_sub4, l1, true, i, (byte) 0); 343 - } 337 + public boolean addEntity(int z, int worldX, int worldY, int worldZ, Renderable entity, int uid, int delta, boolean accountForYaw, 338 + int yaw) { 339 + if (entity == null) { 340 + return true; 341 + } 342 + int minX = worldX - delta; 343 + int minY = worldY - delta; 344 + int maxX = worldX + delta; 345 + int maxY = worldY + delta; 346 + if (accountForYaw) { 347 + if (yaw > 640 && yaw < 1408) { 348 + maxY += 128; 349 + } 350 + if (yaw > 1152 && yaw < 1920) { 351 + maxX += 128; 352 + } 353 + if (yaw > 1664 || yaw < 384) { 354 + minY -= 128; 355 + } 356 + if (yaw > 128 && yaw < 896) { 357 + minX -= 128; 358 + } 359 + } 360 + minX /= 128; 361 + minY /= 128; 362 + maxX /= 128; 363 + maxY /= 128; 364 + return addRenderableC(minX, minY, z, worldX, worldY, worldZ, yaw, (maxY - minY) + 1, (maxX - minX) + 1, uid, entity, true, (byte) 0); 365 + } 344 366 345 - public boolean addRenderable(int i, int j, int k, int l, Renderable class50_sub1_sub4, int i1, int j1, int k1, 346 - int l1, int i2, int j2, int k2, int l2) { 347 - if (class50_sub1_sub4 == null) 348 - return true; 349 - else 350 - return method254(k2, i1, j, (j2 - i1) + 1, (k1 - j) + 1, l1, j1, i, class50_sub1_sub4, i2, true, l2, 351 - (byte) 0); 352 - } 367 + public boolean addEntity(int x, int y, int z, int worldX, int worldY, int worldZ, int rotation, int tileWidth, int tileHeight, Renderable entity, 368 + int uid) { 353 369 354 - public boolean method254(int i, int j, int k, int l, int i1, int j1, int k1, int l1, 355 - Renderable renderable, int i2, boolean flag, int j2, byte byte0) { 356 - for (int k2 = j; k2 < j + l; k2++) { 357 - for (int l2 = k; l2 < k + i1; l2++) { 358 - if (k2 < 0 || l2 < 0 || k2 >= anInt453 || l2 >= anInt454) 359 - return false; 360 - SceneTile class50_sub3 = tiles[i][k2][l2]; 361 - if (class50_sub3 != null && class50_sub3.sceneSpawnRequestCount >= 5) 362 - return false; 363 - } 370 + return entity == null || addRenderableC(x, y, z, worldX, worldY, worldZ, rotation, (tileWidth - y) + 1, (tileHeight - x) + 1, uid, entity, true, 371 + (byte) 0); 372 + } 364 373 365 - } 374 + private boolean addRenderableC(int minX, int minY, int z, int worldX, int worldY, int worldZ, int rotation, int tileWidth, int tileHeight, 375 + int uid, Renderable renderable, boolean isDynamic, byte config) { 376 + for (int x = minX; x < minX + tileHeight; x++) { 377 + for (int y = minY; y < minY + tileWidth; y++) { 378 + if (x < 0 || y < 0 || x >= mapSizeX || y >= mapSizeY) { 379 + return false; 380 + } 381 + SceneTile tile = groundArray[z][x][y]; 382 + if (tile != null && tile.entityCount >= 5) { 383 + return false; 384 + } 385 + } 366 386 367 - SceneSpawnRequest sceneSpawnRequest = new SceneSpawnRequest(); 368 - sceneSpawnRequest.anInt125 = j2; 369 - sceneSpawnRequest.config = byte0; 370 - sceneSpawnRequest.anInt113 = i; 371 - sceneSpawnRequest.anInt115 = j1; 372 - sceneSpawnRequest.anInt116 = k1; 373 - sceneSpawnRequest.anInt114 = l1; 374 - sceneSpawnRequest.aRenderable601 = renderable; 375 - sceneSpawnRequest.anInt118 = i2; 376 - sceneSpawnRequest.x = j; 377 - sceneSpawnRequest.y = k; 378 - sceneSpawnRequest.anInt120 = (j + l) - 1; 379 - sceneSpawnRequest.anInt122 = (k + i1) - 1; 380 - for (int i3 = j; i3 < j + l; i3++) { 381 - for (int j3 = k; j3 < k + i1; j3++) { 382 - int k3 = 0; 383 - if (i3 > j) 384 - k3++; 385 - if (i3 < (j + l) - 1) 386 - k3 += 4; 387 - if (j3 > k) 388 - k3 += 8; 389 - if (j3 < (k + i1) - 1) 390 - k3 += 2; 391 - for (int l3 = i; l3 >= 0; l3--) 392 - if (tiles[l3][i3][j3] == null) 393 - tiles[l3][i3][j3] = new SceneTile(l3, i3, j3); 387 + } 394 388 395 - SceneTile sceneTile = tiles[i][i3][j3]; 396 - sceneTile.sceneSpawnRequests[sceneTile.sceneSpawnRequestCount] = sceneSpawnRequest; 397 - sceneTile.anIntArray1409[sceneTile.sceneSpawnRequestCount] = k3; 398 - sceneTile.anInt1410 |= k3; 399 - sceneTile.sceneSpawnRequestCount++; 400 - } 389 + InteractiveObject interactiveObject = new InteractiveObject(); 390 + interactiveObject.uid = uid; 391 + interactiveObject.config = config; 392 + interactiveObject.z = z; 393 + interactiveObject.worldX = worldX; 394 + interactiveObject.worldY = worldY; 395 + interactiveObject.worldZ = worldZ; 396 + interactiveObject.renderable = renderable; 397 + interactiveObject.rotation = rotation; 398 + interactiveObject.tileLeft = minX; 399 + interactiveObject.tileTop = minY; 400 + interactiveObject.tileRight = (minX + tileHeight) - 1; 401 + interactiveObject.tileBottom = (minY + tileWidth) - 1; 402 + for (int x = minX; x < minX + tileHeight; x++) { 403 + for (int y = minY; y < minY + tileWidth; y++) { 404 + int size = 0; 405 + if (x > minX) { 406 + size++; 407 + } 408 + if (x < (minX + tileHeight) - 1) { 409 + size += 4; 410 + } 411 + if (y > minY) { 412 + size += 8; 413 + } 414 + if (y < (minY + tileWidth) - 1) { 415 + size += 2; 416 + } 417 + for (int _z = z; _z >= 0; _z--) { 418 + if (groundArray[_z][x][y] == null) { 419 + groundArray[_z][x][y] = new SceneTile(x, y, _z); 420 + } 421 + } 401 422 402 - } 423 + SceneTile sceneTile = groundArray[z][x][y]; 424 + sceneTile.interactiveObjects[sceneTile.entityCount] = interactiveObject; 425 + sceneTile.sceneSpawnRequestsSize[sceneTile.entityCount] = size; 426 + sceneTile.interactiveObjectsSizeOR |= size; 427 + sceneTile.entityCount++; 428 + } 403 429 404 - if (flag) 405 - aSceneSpawnRequestArray459[anInt458++] = sceneSpawnRequest; 406 - return true; 407 - } 430 + } 408 431 409 - public void method255() { 410 - for (int j = 0; j < anInt458; j++) { 411 - SceneSpawnRequest sceneSpawnRequest = aSceneSpawnRequestArray459[j]; 412 - method256(sceneSpawnRequest); 413 - aSceneSpawnRequestArray459[j] = null; 414 - } 432 + if (isDynamic) { 433 + sceneSpawnRequestsCache[sceneSpawnRequestsCacheCurrentPos++] = interactiveObject; 434 + } 435 + return true; 436 + } 415 437 416 - anInt458 = 0; 417 - } 438 + public void clearInteractiveObjectCache() { 439 + for (int j = 0; j < sceneSpawnRequestsCacheCurrentPos; j++) { 440 + InteractiveObject interactiveObject = sceneSpawnRequestsCache[j]; 441 + remove(interactiveObject); 442 + sceneSpawnRequestsCache[j] = null; 443 + } 418 444 419 - public void method256(SceneSpawnRequest sceneSpawnRequest) { 420 - for (int j = sceneSpawnRequest.x; j <= sceneSpawnRequest.anInt120; j++) { 421 - for (int k = sceneSpawnRequest.y; k <= sceneSpawnRequest.anInt122; k++) { 422 - SceneTile class50_sub3 = tiles[sceneSpawnRequest.anInt113][j][k]; 423 - if (class50_sub3 != null) { 424 - for (int l = 0; l < class50_sub3.sceneSpawnRequestCount; l++) { 425 - if (class50_sub3.sceneSpawnRequests[l] != sceneSpawnRequest) 426 - continue; 427 - class50_sub3.sceneSpawnRequestCount--; 428 - for (int i1 = l; i1 < class50_sub3.sceneSpawnRequestCount; i1++) { 429 - class50_sub3.sceneSpawnRequests[i1] = class50_sub3.sceneSpawnRequests[i1 + 1]; 430 - class50_sub3.anIntArray1409[i1] = class50_sub3.anIntArray1409[i1 + 1]; 431 - } 445 + sceneSpawnRequestsCacheCurrentPos = 0; 446 + } 432 447 433 - class50_sub3.sceneSpawnRequests[class50_sub3.sceneSpawnRequestCount] = null; 434 - break; 435 - } 448 + private void remove(InteractiveObject entity) { 449 + for (int x = entity.tileLeft; x <= entity.tileRight; x++) { 450 + for (int y = entity.tileTop; y <= entity.tileBottom; y++) { 451 + SceneTile tile = groundArray[entity.z][x][y]; 452 + if (tile != null) { 453 + for (int e = 0; e < tile.entityCount; e++) { 454 + if (tile.interactiveObjects[e] != entity) { 455 + continue; 456 + } 457 + tile.entityCount--; 458 + for (int e2 = e; e2 < tile.entityCount; e2++) { 459 + tile.interactiveObjects[e2] = tile.interactiveObjects[e2 + 1]; 460 + tile.sceneSpawnRequestsSize[e2] = tile.sceneSpawnRequestsSize[e2 + 1]; 461 + } 436 462 437 - class50_sub3.anInt1410 = 0; 438 - for (int j1 = 0; j1 < class50_sub3.sceneSpawnRequestCount; j1++) 439 - class50_sub3.anInt1410 |= class50_sub3.anIntArray1409[j1]; 463 + tile.interactiveObjects[tile.entityCount] = null; 464 + break; 465 + } 440 466 441 - } 442 - } 467 + tile.interactiveObjectsSizeOR = 0; 468 + for (int j1 = 0; j1 < tile.entityCount; j1++) { 469 + tile.interactiveObjectsSizeOR |= tile.sceneSpawnRequestsSize[j1]; 470 + } 443 471 444 - } 472 + } 473 + } 445 474 446 - } 475 + } 447 476 448 - public void method257(int i, int j, int k, int l) { 449 - SceneTile sceneTile = tiles[k][l][i]; 450 - if (sceneTile == null) 451 - return; 452 - WallDecoration wallDecoration = sceneTile.wallDecoration; 453 - if (wallDecoration == null) 454 - return; 455 - int j1 = l * 128 + 64; 456 - int k1 = i * 128 + 64; 457 - wallDecoration.y = j1 + ((wallDecoration.y - j1) * j) / 16; 458 - wallDecoration.x = k1 + ((wallDecoration.x - k1) * j) / 16; 477 + } 459 478 460 - } 479 + void displaceWallDecoration(int x, int y, int z, int displacement) { 480 + SceneTile sceneTile = groundArray[z][x][y]; 481 + if (sceneTile == null) { 482 + return; 483 + } 484 + WallDecoration wallDecoration = sceneTile.wallDecoration; 485 + if (wallDecoration == null) { 486 + return; 487 + } 488 + int absX = x * 128 + 64; 489 + int absY = y * 128 + 64; 490 + wallDecoration.x = absX + ((wallDecoration.x - absX) * displacement) / 16; 491 + wallDecoration.y = absY + ((wallDecoration.y - absY) * displacement) / 16; 461 492 462 - public void method258(int i, int j, int k, boolean flag) { 463 - SceneTile class50_sub3 = tiles[j][k][i]; 464 - if (class50_sub3 == null) 465 - return; 466 - class50_sub3.wall = null; 467 - } 493 + } 468 494 469 - public void method259(boolean flag, int i, int j, int k) { 470 - SceneTile class50_sub3 = tiles[k][i][j]; 471 - if (flag) 472 - return; 473 - if (class50_sub3 == null) { 474 - return; 475 - } else { 476 - class50_sub3.wallDecoration = null; 477 - return; 478 - } 479 - } 495 + public void removeWallObject(int x, int y, int z) { 496 + SceneTile tile = groundArray[z][x][y]; 497 + if (tile != null) { 498 + tile.wall = null; 499 + } 500 + } 480 501 481 - public void method260(int i, int j, int k, int l) { 482 - if (k >= 0) 483 - return; 484 - SceneTile class50_sub3 = tiles[j][l][i]; 485 - if (class50_sub3 == null) 486 - return; 487 - for (int i1 = 0; i1 < class50_sub3.sceneSpawnRequestCount; i1++) { 488 - SceneSpawnRequest sceneSpawnRequest = class50_sub3.sceneSpawnRequests[i1]; 489 - if ((sceneSpawnRequest.anInt125 >> 29 & 3) == 2 && sceneSpawnRequest.x == l && sceneSpawnRequest.y == i) { 490 - method256(sceneSpawnRequest); 491 - return; 492 - } 493 - } 502 + public void removeWallDecoration(int x, int y, int z) { 503 + SceneTile tile = groundArray[z][x][y]; 504 + if (tile != null) { 505 + tile.wallDecoration = null; 506 + } 507 + } 494 508 495 - } 509 + public void removeInteractiveObject(int x, int y, int z) { 510 + SceneTile tile = groundArray[z][x][y]; 511 + if (tile == null) { 512 + return; 513 + } 514 + for (int e = 0; e < tile.entityCount; e++) { 515 + InteractiveObject interactiveObject = tile.interactiveObjects[e]; 516 + if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == x && interactiveObject.tileTop == y) { 517 + remove(interactiveObject); 518 + return; 519 + } 520 + } 496 521 497 - public void method261(int i, int j, boolean flag, int k) { 498 - SceneTile class50_sub3 = tiles[k][i][j]; 499 - if (class50_sub3 == null) 500 - return; 501 - class50_sub3.floorDecoration = null; 502 - if (!flag) { 503 - for (int l = 1; l > 0; l++); 504 - } 505 - } 522 + } 506 523 507 - public void clearGroundItem(int i, int j, int k) { 508 - SceneTile class50_sub3 = tiles[i][j][k]; 509 - if (class50_sub3 == null) { 510 - return; 511 - } else { 512 - class50_sub3.cameraAngle = null; 513 - return; 514 - } 515 - } 524 + public void method261(int x, int y, int z) { 525 + SceneTile tile = groundArray[z][x][y]; 526 + if (tile == null) { 527 + return; 528 + } 529 + tile.floorDecoration = null; 530 + } 516 531 517 - public Wall method263(int i, int j, int k, int l) { 518 - SceneTile class50_sub3 = tiles[i][k][l]; 519 - if (j != 17734) 520 - throw new NullPointerException(); 521 - if (class50_sub3 == null) 522 - return null; 523 - else 524 - return class50_sub3.wall; 525 - } 532 + public void clearGroundItem(int i, int j, int k) { 533 + SceneTile class50_sub3 = groundArray[i][j][k]; 534 + if (class50_sub3 != null) { 535 + class50_sub3.groundItemTile = null; 536 + } 537 + } 526 538 527 - public WallDecoration method264(int i, int j, int k, boolean flag) { 528 - SceneTile class50_sub3 = tiles[i][k][j]; 529 - if (flag) 530 - throw new NullPointerException(); 531 - if (class50_sub3 == null) 532 - return null; 533 - else 534 - return class50_sub3.wallDecoration; 535 - } 539 + public Wall method263(int i, int j, int k, int l) { 540 + SceneTile class50_sub3 = groundArray[i][k][l]; 541 + if (j != 17734) { 542 + throw new NullPointerException(); 543 + } 544 + if (class50_sub3 == null) { 545 + return null; 546 + } else { 547 + return class50_sub3.wall; 548 + } 549 + } 536 550 537 - public SceneSpawnRequest method265(int i, byte byte0, int j, int k) { 538 - if (byte0 != 32) { 539 - for (int l = 1; l > 0; l++); 540 - } 541 - SceneTile class50_sub3 = tiles[k][i][j]; 542 - if (class50_sub3 == null) 543 - return null; 544 - for (int i1 = 0; i1 < class50_sub3.sceneSpawnRequestCount; i1++) { 545 - SceneSpawnRequest sceneSpawnRequest = class50_sub3.sceneSpawnRequests[i1]; 546 - if ((sceneSpawnRequest.anInt125 >> 29 & 3) == 2 && sceneSpawnRequest.x == i && sceneSpawnRequest.y == j) 547 - return sceneSpawnRequest; 548 - } 551 + public WallDecoration method264(int i, int j, int k, boolean flag) { 552 + SceneTile class50_sub3 = groundArray[i][k][j]; 553 + if (flag) { 554 + throw new NullPointerException(); 555 + } 556 + if (class50_sub3 == null) { 557 + return null; 558 + } else { 559 + return class50_sub3.wallDecoration; 560 + } 561 + } 549 562 550 - return null; 551 - } 563 + public InteractiveObject method265(int i, byte byte0, int j, int k) { 564 + if (byte0 != 32) { 565 + for (int l = 1; l > 0; l++) { 566 + } 567 + } 568 + SceneTile class50_sub3 = groundArray[k][i][j]; 569 + if (class50_sub3 == null) { 570 + return null; 571 + } 572 + for (int i1 = 0; i1 < class50_sub3.entityCount; i1++) { 573 + InteractiveObject interactiveObject = class50_sub3.interactiveObjects[i1]; 574 + if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == i && interactiveObject.tileTop == j) { 575 + return interactiveObject; 576 + } 577 + } 552 578 553 - public FloorDecoration method266(int i, int j, int k, int l) { 554 - if (k != 0) 555 - throw new NullPointerException(); 556 - SceneTile class50_sub3 = tiles[i][l][j]; 557 - if (class50_sub3 == null || class50_sub3.floorDecoration == null) 558 - return null; 559 - else 560 - return class50_sub3.floorDecoration; 561 - } 579 + return null; 580 + } 562 581 563 - public int method267(int i, int j, int k) { 564 - SceneTile class50_sub3 = tiles[i][j][k]; 565 - if (class50_sub3 == null || class50_sub3.wall == null) 566 - return 0; 567 - else 568 - return class50_sub3.wall.hash; 569 - } 582 + public FloorDecoration method266(int i, int j, int k, int l) { 583 + if (k != 0) { 584 + throw new NullPointerException(); 585 + } 586 + SceneTile class50_sub3 = groundArray[i][l][j]; 587 + if (class50_sub3 == null || class50_sub3.floorDecoration == null) { 588 + return null; 589 + } else { 590 + return class50_sub3.floorDecoration; 591 + } 592 + } 570 593 571 - public int method268(int i, byte byte0, int j, int k) { 572 - SceneTile class50_sub3 = tiles[j][i][k]; 573 - if (class50_sub3 == null || class50_sub3.wallDecoration == null) 574 - return 0; 575 - else 576 - return class50_sub3.wallDecoration.hash; 577 - } 594 + public int method267(int i, int j, int k) { 595 + SceneTile class50_sub3 = groundArray[i][j][k]; 596 + if (class50_sub3 == null || class50_sub3.wall == null) { 597 + return 0; 598 + } else { 599 + return class50_sub3.wall.uid; 600 + } 601 + } 578 602 579 - public int method269(int i, int j, int k) { 580 - SceneTile class50_sub3 = tiles[i][j][k]; 581 - if (class50_sub3 == null) 582 - return 0; 583 - for (int l = 0; l < class50_sub3.sceneSpawnRequestCount; l++) { 584 - SceneSpawnRequest sceneSpawnRequest = class50_sub3.sceneSpawnRequests[l]; 585 - if ((sceneSpawnRequest.anInt125 >> 29 & 3) == 2 && sceneSpawnRequest.x == j && sceneSpawnRequest.y == k) 586 - return sceneSpawnRequest.anInt125; 587 - } 603 + public int method268(int i, byte byte0, int j, int k) { 604 + SceneTile class50_sub3 = groundArray[j][i][k]; 605 + if (class50_sub3 == null || class50_sub3.wallDecoration == null) { 606 + return 0; 607 + } else { 608 + return class50_sub3.wallDecoration.uid; 609 + } 610 + } 588 611 589 - return 0; 590 - } 612 + public int method269(int i, int j, int k) { 613 + SceneTile class50_sub3 = groundArray[i][j][k]; 614 + if (class50_sub3 == null) { 615 + return 0; 616 + } 617 + for (int l = 0; l < class50_sub3.entityCount; l++) { 618 + InteractiveObject interactiveObject = class50_sub3.interactiveObjects[l]; 619 + if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == j && interactiveObject.tileTop == k) { 620 + return interactiveObject.uid; 621 + } 622 + } 591 623 592 - public int getFloorDecorationHash(int i, int j, int k) { 593 - SceneTile class50_sub3 = tiles[i][j][k]; 594 - if (class50_sub3 == null || class50_sub3.floorDecoration == null) 595 - return 0; 596 - else 597 - return class50_sub3.floorDecoration.hash; 598 - } 624 + return 0; 625 + } 599 626 600 - public int method271(int i, int j, int k, int l) { 601 - SceneTile class50_sub3 = tiles[i][j][k]; 602 - if (class50_sub3 == null) 603 - return -1; 604 - if (class50_sub3.wall != null && class50_sub3.wall.hash == l) 605 - return class50_sub3.wall.config & 0xff; 606 - if (class50_sub3.wallDecoration != null && class50_sub3.wallDecoration.hash == l) 607 - return class50_sub3.wallDecoration.config & 0xff; 608 - if (class50_sub3.floorDecoration != null && class50_sub3.floorDecoration.hash == l) 609 - return class50_sub3.floorDecoration.config & 0xff; 610 - for (int i1 = 0; i1 < class50_sub3.sceneSpawnRequestCount; i1++) 611 - if (class50_sub3.sceneSpawnRequests[i1].anInt125 == l) 612 - return class50_sub3.sceneSpawnRequests[i1].config & 0xff; 627 + public int getFloorDecorationHash(int i, int j, int k) { 628 + SceneTile class50_sub3 = groundArray[i][j][k]; 629 + if (class50_sub3 == null || class50_sub3.floorDecoration == null) { 630 + return 0; 631 + } else { 632 + return class50_sub3.floorDecoration.uid; 633 + } 634 + } 613 635 614 - return -1; 615 - } 636 + public int method271(int i, int j, int k, int l) { 637 + SceneTile class50_sub3 = groundArray[i][j][k]; 638 + if (class50_sub3 == null) { 639 + return -1; 640 + } 641 + if (class50_sub3.wall != null && class50_sub3.wall.uid == l) { 642 + return class50_sub3.wall.config & 0xff; 643 + } 644 + if (class50_sub3.wallDecoration != null && class50_sub3.wallDecoration.uid == l) { 645 + return class50_sub3.wallDecoration.config & 0xff; 646 + } 647 + if (class50_sub3.floorDecoration != null && class50_sub3.floorDecoration.uid == l) { 648 + return class50_sub3.floorDecoration.config & 0xff; 649 + } 650 + for (int i1 = 0; i1 < class50_sub3.entityCount; i1++) { 651 + if (class50_sub3.interactiveObjects[i1].uid == l) { 652 + return class50_sub3.interactiveObjects[i1].config & 0xff; 653 + } 654 + } 616 655 617 - public void method272(byte byte0, int i, int j, int k) { 618 - for (int l = 0; l < anInt452; l++) { 619 - for (int i1 = 0; i1 < anInt453; i1++) { 620 - for (int j1 = 0; j1 < anInt454; j1++) { 621 - SceneTile class50_sub3 = tiles[l][i1][j1]; 622 - if (class50_sub3 != null) { 623 - Wall wall = class50_sub3.wall; 624 - if (wall != null && wall.aRenderable769 != null 625 - && wall.aRenderable769.verticesNormal != null) { 626 - method274(j1, l, 0, 1, (Model) wall.aRenderable769, i1, 1); 627 - if (wall.aRenderable770 != null 628 - && wall.aRenderable770.verticesNormal != null) { 629 - method274(j1, l, 0, 1, (Model) wall.aRenderable770, i1, 1); 630 - method275((Model) wall.aRenderable769, 631 - (Model) wall.aRenderable770, 0, 0, 0, false); 632 - ((Model) wall.aRenderable770).method595(i, j, 0, k); 633 - } 634 - ((Model) wall.aRenderable769).method595(i, j, 0, k); 635 - } 636 - for (int k1 = 0; k1 < class50_sub3.sceneSpawnRequestCount; k1++) { 637 - SceneSpawnRequest sceneSpawnRequest = class50_sub3.sceneSpawnRequests[k1]; 638 - if (sceneSpawnRequest != null && sceneSpawnRequest.aRenderable601 != null 639 - && sceneSpawnRequest.aRenderable601.verticesNormal != null) { 640 - method274(j1, l, 0, (sceneSpawnRequest.anInt120 - sceneSpawnRequest.x) + 1, 641 - (Model) sceneSpawnRequest.aRenderable601, i1, 642 - (sceneSpawnRequest.anInt122 - sceneSpawnRequest.y) + 1); 643 - ((Model) sceneSpawnRequest.aRenderable601).method595(i, j, 0, k); 644 - } 645 - } 656 + return -1; 657 + } 646 658 647 - FloorDecoration floorDecoration = class50_sub3.floorDecoration; 648 - if (floorDecoration != null && floorDecoration.renderable.verticesNormal != null) { 649 - method273(i1, (Model) floorDecoration.renderable, j1, l, 0); 650 - ((Model) floorDecoration.renderable).method595(i, j, 0, k); 651 - } 652 - } 653 - } 659 + void shadeModels(int i, int j, int k) { 660 + for (int _z = 0; _z < mapSizeZ; _z++) { 661 + for (int _x = 0; _x < mapSizeX; _x++) { 662 + for (int _y = 0; _y < mapSizeY; _y++) { 663 + SceneTile tile = groundArray[_z][_x][_y]; 664 + if (tile != null) { 665 + Wall wall = tile.wall; 666 + if (wall != null && wall.primary != null 667 + && wall.primary.verticesNormal != null) { 668 + method274(_y, _z, 0, 1, (Model) wall.primary, _x, 1); 669 + if (wall.secondary != null 670 + && wall.secondary.verticesNormal != null) { 671 + method274(_y, _z, 0, 1, (Model) wall.secondary, _x, 1); 672 + mergeNormals((Model) wall.primary, 673 + (Model) wall.secondary, 0, 0, 0, false); 674 + ((Model) wall.secondary).handleShading(i, j, 0, k); 675 + } 676 + ((Model) wall.primary).handleShading(i, j, 0, k); 677 + } 678 + for (int k1 = 0; k1 < tile.entityCount; k1++) { 679 + InteractiveObject interactiveObject = tile.interactiveObjects[k1]; 680 + if (interactiveObject != null && interactiveObject.renderable != null 681 + && interactiveObject.renderable.verticesNormal != null) { 682 + method274(_y, _z, 0, (interactiveObject.tileRight - interactiveObject.tileLeft) + 1, 683 + (Model) interactiveObject.renderable, _x, 684 + (interactiveObject.tileBottom - interactiveObject.tileTop) + 1); 685 + ((Model) interactiveObject.renderable).handleShading(i, j, 0, k); 686 + } 687 + } 654 688 655 - } 689 + FloorDecoration floorDecoration = tile.floorDecoration; 690 + if (floorDecoration != null && floorDecoration.renderable.verticesNormal != null) { 691 + method273(_x, (Model) floorDecoration.renderable, _y, _z, 0); 692 + ((Model) floorDecoration.renderable).handleShading(i, j, 0, k); 693 + } 694 + } 695 + } 656 696 657 - } 697 + } 658 698 659 - if (byte0 == 2) 660 - byte0 = 0; 661 - } 699 + } 662 700 663 - public void method273(int i, Model class50_sub1_sub4_sub4, int j, int k, int l) { 664 - if (l != 0) 665 - return; 666 - if (i < anInt453) { 667 - SceneTile class50_sub3 = tiles[k][i + 1][j]; 668 - if (class50_sub3 != null && class50_sub3.floorDecoration != null 669 - && class50_sub3.floorDecoration.renderable.verticesNormal != null) 670 - method275(class50_sub1_sub4_sub4, 671 - (Model) class50_sub3.floorDecoration.renderable, 128, 0, 0, true); 672 - } 673 - if (j < anInt453) { 674 - SceneTile class50_sub3_1 = tiles[k][i][j + 1]; 675 - if (class50_sub3_1 != null && class50_sub3_1.floorDecoration != null 676 - && class50_sub3_1.floorDecoration.renderable.verticesNormal != null) 677 - method275(class50_sub1_sub4_sub4, 678 - (Model) class50_sub3_1.floorDecoration.renderable, 0, 0, 128, true); 679 - } 680 - if (i < anInt453 && j < anInt454) { 681 - SceneTile class50_sub3_2 = tiles[k][i + 1][j + 1]; 682 - if (class50_sub3_2 != null && class50_sub3_2.floorDecoration != null 683 - && class50_sub3_2.floorDecoration.renderable.verticesNormal != null) 684 - method275(class50_sub1_sub4_sub4, 685 - (Model) class50_sub3_2.floorDecoration.renderable, 128, 0, 128, true); 686 - } 687 - if (i < anInt453 && j > 0) { 688 - SceneTile class50_sub3_3 = tiles[k][i + 1][j - 1]; 689 - if (class50_sub3_3 != null && class50_sub3_3.floorDecoration != null 690 - && class50_sub3_3.floorDecoration.renderable.verticesNormal != null) 691 - method275(class50_sub1_sub4_sub4, 692 - (Model) class50_sub3_3.floorDecoration.renderable, 128, 0, -128, 693 - true); 694 - } 695 - } 701 + } 696 702 697 - public void method274(int i, int j, int k, int l, Model class50_sub1_sub4_sub4, int i1, int j1) { 698 - boolean flag = true; 699 - int k1 = i1; 700 - int l1 = i1 + l; 701 - int i2 = i - 1; 702 - int j2 = i + j1; 703 - for (int k2 = j; k2 <= j + 1; k2++) 704 - if (k2 != anInt452) { 705 - for (int l2 = k1; l2 <= l1; l2++) 706 - if (l2 >= 0 && l2 < anInt453) { 707 - for (int i3 = i2; i3 <= j2; i3++) 708 - if (i3 >= 0 && i3 < anInt454 && (!flag || l2 >= l1 || i3 >= j2 || i3 < i && l2 != i1)) { 709 - SceneTile class50_sub3 = tiles[k2][l2][i3]; 710 - if (class50_sub3 != null) { 711 - int j3 = (anIntArrayArrayArray455[k2][l2][i3] 712 - + anIntArrayArrayArray455[k2][l2 + 1][i3] 713 - + anIntArrayArrayArray455[k2][l2][i3 + 1] + anIntArrayArrayArray455[k2][l2 + 1][i3 + 1]) 714 - / 4 715 - - (anIntArrayArrayArray455[j][i1][i] 716 - + anIntArrayArrayArray455[j][i1 + 1][i] 717 - + anIntArrayArrayArray455[j][i1][i + 1] + anIntArrayArrayArray455[j][i1 + 1][i + 1]) 718 - / 4; 719 - Wall wall = class50_sub3.wall; 720 - if (wall != null && wall.aRenderable769 != null 721 - && wall.aRenderable769.verticesNormal != null) 722 - method275(class50_sub1_sub4_sub4, 723 - (Model) wall.aRenderable769, (l2 - i1) 724 - * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 725 - if (wall != null && wall.aRenderable770 != null 726 - && wall.aRenderable770.verticesNormal != null) 727 - method275(class50_sub1_sub4_sub4, 728 - (Model) wall.aRenderable770, (l2 - i1) 729 - * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 730 - for (int k3 = 0; k3 < class50_sub3.sceneSpawnRequestCount; k3++) { 731 - SceneSpawnRequest sceneSpawnRequest = class50_sub3.sceneSpawnRequests[k3]; 732 - if (sceneSpawnRequest != null && sceneSpawnRequest.aRenderable601 != null 733 - && sceneSpawnRequest.aRenderable601.verticesNormal != null) { 734 - int l3 = (sceneSpawnRequest.anInt120 - sceneSpawnRequest.x) + 1; 735 - int i4 = (sceneSpawnRequest.anInt122 - sceneSpawnRequest.y) + 1; 736 - method275(class50_sub1_sub4_sub4, 737 - (Model) sceneSpawnRequest.aRenderable601, 738 - (sceneSpawnRequest.x - i1) * 128 + (l3 - l) * 64, j3, 739 - (sceneSpawnRequest.y - i) * 128 + (i4 - j1) * 64, flag); 740 - } 741 - } 703 + private void method273(int i, Model class50_sub1_sub4_sub4, int j, int k, int l) { 704 + if (l != 0) { 705 + return; 706 + } 707 + if (i < mapSizeX) { 708 + SceneTile class50_sub3 = groundArray[k][i + 1][j]; 709 + if (class50_sub3 != null && class50_sub3.floorDecoration != null 710 + && class50_sub3.floorDecoration.renderable.verticesNormal != null) { 711 + mergeNormals(class50_sub1_sub4_sub4, 712 + (Model) class50_sub3.floorDecoration.renderable, 128, 0, 0, true); 713 + } 714 + } 715 + if (j < mapSizeX) { 716 + SceneTile class50_sub3_1 = groundArray[k][i][j + 1]; 717 + if (class50_sub3_1 != null && class50_sub3_1.floorDecoration != null 718 + && class50_sub3_1.floorDecoration.renderable.verticesNormal != null) { 719 + mergeNormals(class50_sub1_sub4_sub4, 720 + (Model) class50_sub3_1.floorDecoration.renderable, 0, 0, 128, true); 721 + } 722 + } 723 + if (i < mapSizeX && j < mapSizeY) { 724 + SceneTile class50_sub3_2 = groundArray[k][i + 1][j + 1]; 725 + if (class50_sub3_2 != null && class50_sub3_2.floorDecoration != null 726 + && class50_sub3_2.floorDecoration.renderable.verticesNormal != null) { 727 + mergeNormals(class50_sub1_sub4_sub4, 728 + (Model) class50_sub3_2.floorDecoration.renderable, 128, 0, 128, true); 729 + } 730 + } 731 + if (i < mapSizeX && j > 0) { 732 + SceneTile class50_sub3_3 = groundArray[k][i + 1][j - 1]; 733 + if (class50_sub3_3 != null && class50_sub3_3.floorDecoration != null 734 + && class50_sub3_3.floorDecoration.renderable.verticesNormal != null) { 735 + mergeNormals(class50_sub1_sub4_sub4, 736 + (Model) class50_sub3_3.floorDecoration.renderable, 128, 0, -128, 737 + true); 738 + } 739 + } 740 + } 741 + 742 + private void method274(int i, int j, int k, int l, Model class50_sub1_sub4_sub4, int i1, int j1) { 743 + boolean flag = true; 744 + int k1 = i1; 745 + int l1 = i1 + l; 746 + int i2 = i - 1; 747 + int j2 = i + j1; 748 + for (int k2 = j; k2 <= j + 1; k2++) { 749 + if (k2 != mapSizeZ) { 750 + for (int l2 = k1; l2 <= l1; l2++) { 751 + if (l2 >= 0 && l2 < mapSizeX) { 752 + for (int i3 = i2; i3 <= j2; i3++) { 753 + if (i3 >= 0 && i3 < mapSizeY && (!flag || l2 >= l1 || i3 >= j2 || i3 < i && l2 != i1)) { 754 + SceneTile class50_sub3 = groundArray[k2][l2][i3]; 755 + if (class50_sub3 != null) { 756 + int j3 = (heightMap[k2][l2][i3] 757 + + heightMap[k2][l2 + 1][i3] 758 + + heightMap[k2][l2][i3 + 1] + heightMap[k2][l2 + 1][i3 + 1]) 759 + / 4 760 + - (heightMap[j][i1][i] 761 + + heightMap[j][i1 + 1][i] 762 + + heightMap[j][i1][i + 1] + heightMap[j][i1 + 1][i + 1]) 763 + / 4; 764 + Wall wall = class50_sub3.wall; 765 + if (wall != null && wall.primary != null 766 + && wall.primary.verticesNormal != null) { 767 + mergeNormals(class50_sub1_sub4_sub4, 768 + (Model) wall.primary, (l2 - i1) 769 + * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 770 + } 771 + if (wall != null && wall.secondary != null 772 + && wall.secondary.verticesNormal != null) { 773 + mergeNormals(class50_sub1_sub4_sub4, 774 + (Model) wall.secondary, (l2 - i1) 775 + * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 776 + } 777 + for (int k3 = 0; k3 < class50_sub3.entityCount; k3++) { 778 + InteractiveObject interactiveObject = class50_sub3.interactiveObjects[k3]; 779 + if (interactiveObject != null && interactiveObject.renderable != null 780 + && interactiveObject.renderable.verticesNormal != null) { 781 + int l3 = (interactiveObject.tileRight - interactiveObject.tileLeft) + 1; 782 + int i4 = (interactiveObject.tileBottom - interactiveObject.tileTop) + 1; 783 + mergeNormals(class50_sub1_sub4_sub4, 784 + (Model) interactiveObject.renderable, 785 + (interactiveObject.tileLeft - i1) * 128 + (l3 - l) * 64, j3, 786 + (interactiveObject.tileTop - i) * 128 + (i4 - j1) * 64, flag); 787 + } 788 + } 742 789 743 - } 744 - } 790 + } 791 + } 792 + } 745 793 746 - } 794 + } 795 + } 747 796 748 - k1--; 749 - flag = false; 750 - } 797 + k1--; 798 + flag = false; 799 + } 800 + } 751 801 752 - if (k == 0) 753 - ; 754 - } 802 + if (k == 0) { 803 + } 804 + } 755 805 756 - public void method275(Model class50_sub1_sub4_sub4, 757 - Model class50_sub1_sub4_sub4_1, int i, int j, int k, boolean flag) { 758 - anInt503++; 759 - int l = 0; 760 - int ai[] = class50_sub1_sub4_sub4_1.verticesX; 761 - int i1 = class50_sub1_sub4_sub4_1.vertexCount; 762 - int j1 = class50_sub1_sub4_sub4_1.anInt1669 >> 16; 763 - int k1 = (class50_sub1_sub4_sub4_1.anInt1669 << 16) >> 16; 764 - int l1 = class50_sub1_sub4_sub4_1.anInt1670 >> 16; 765 - int i2 = (class50_sub1_sub4_sub4_1.anInt1670 << 16) >> 16; 766 - for (int j2 = 0; j2 < class50_sub1_sub4_sub4.vertexCount; j2++) { 767 - VertexNormal class40 = ((Renderable) (class50_sub1_sub4_sub4)).verticesNormal[j2]; 768 - VertexNormal class40_1 = class50_sub1_sub4_sub4.aClass40Array1681[j2]; 769 - if (class40_1.magnitude != 0) { 770 - int i3 = class50_sub1_sub4_sub4.verticesY[j2] - j; 771 - if (i3 <= class50_sub1_sub4_sub4_1.maxY) { 772 - int j3 = class50_sub1_sub4_sub4.verticesX[j2] - i; 773 - if (j3 >= j1 && j3 <= k1) { 774 - int k3 = class50_sub1_sub4_sub4.verticesZ[j2] - k; 775 - if (k3 >= i2 && k3 <= l1) { 776 - for (int l3 = 0; l3 < i1; l3++) { 777 - VertexNormal class40_2 = ((Renderable) (class50_sub1_sub4_sub4_1)).verticesNormal[l3]; 778 - VertexNormal class40_3 = class50_sub1_sub4_sub4_1.aClass40Array1681[l3]; 779 - if (j3 == ai[l3] && k3 == class50_sub1_sub4_sub4_1.verticesZ[l3] 780 - && i3 == class50_sub1_sub4_sub4_1.verticesY[l3] && class40_3.magnitude != 0) { 781 - class40.x += class40_3.x; 782 - class40.y += class40_3.y; 783 - class40.z += class40_3.z; 784 - class40.magnitude += class40_3.magnitude; 785 - class40_2.x += class40_1.x; 786 - class40_2.y += class40_1.y; 787 - class40_2.z += class40_1.z; 788 - class40_2.magnitude += class40_1.magnitude; 789 - l++; 790 - anIntArray501[j2] = anInt503; 791 - anIntArray502[l3] = anInt503; 792 - } 793 - } 806 + private void mergeNormals(Model modelA, 807 + Model modelB, int i, int j, int k, boolean flag) { 808 + anInt503++; 809 + int count = 0; 810 + int[] vertices = modelB.verticesX; 811 + int vertexCount = modelB.vertexCount; 812 + int minX = modelB.worldX >> 16; 813 + int maxX = (modelB.worldX << 16) >> 16; 814 + int maxZ = modelB.worldZ >> 16; 815 + int minZ = (modelB.worldZ << 16) >> 16; 816 + for (int vertex = 0; vertex < modelA.vertexCount; vertex++) { 817 + VertexNormal vertexNormal = modelA.verticesNormal[vertex]; 818 + VertexNormal offsetVertexNormal = modelA.vertexNormalOffset[vertex]; 819 + if (offsetVertexNormal.magnitude != 0) { 820 + int y = modelA.verticesY[vertex] - j; 821 + if (y <= modelB.maxY) { 822 + int x = modelA.verticesX[vertex] - i; 823 + if (x >= minX && x <= maxX) { 824 + int z = modelA.verticesZ[vertex] - k; 825 + if (z >= minZ && z <= maxZ) { 826 + for (int v = 0; v < vertexCount; v++) { 827 + VertexNormal class40_2 = modelB.verticesNormal[v]; 828 + VertexNormal class40_3 = modelB.vertexNormalOffset[v]; 829 + if (x == vertices[v] && z == modelB.verticesZ[v] 830 + && y == modelB.verticesY[v] && class40_3.magnitude != 0) { 831 + vertexNormal.x += class40_3.x; 832 + vertexNormal.y += class40_3.y; 833 + vertexNormal.z += class40_3.z; 834 + vertexNormal.magnitude += class40_3.magnitude; 835 + class40_2.x += offsetVertexNormal.x; 836 + class40_2.y += offsetVertexNormal.y; 837 + class40_2.z += offsetVertexNormal.z; 838 + class40_2.magnitude += offsetVertexNormal.magnitude; 839 + count++; 840 + anIntArray501[vertex] = anInt503; 841 + anIntArray502[v] = anInt503; 842 + } 843 + } 794 844 795 - } 796 - } 797 - } 798 - } 799 - } 845 + } 846 + } 847 + } 848 + } 849 + } 800 850 801 - if (l < 3 || !flag) 802 - return; 803 - for (int k2 = 0; k2 < class50_sub1_sub4_sub4.triangleCount; k2++) 804 - if (anIntArray501[class50_sub1_sub4_sub4.trianglePointsX[k2]] == anInt503 805 - && anIntArray501[class50_sub1_sub4_sub4.trianglePointsY[k2]] == anInt503 806 - && anIntArray501[class50_sub1_sub4_sub4.trianglePointsZ[k2]] == anInt503) 807 - class50_sub1_sub4_sub4.texturePoints[k2] = -1; 851 + if (count < 3 || !flag) { 852 + return; 853 + } 854 + for (int k2 = 0; k2 < modelA.triangleCount; k2++) { 855 + if (anIntArray501[modelA.trianglePointsX[k2]] == anInt503 856 + && anIntArray501[modelA.trianglePointsY[k2]] == anInt503 857 + && anIntArray501[modelA.trianglePointsZ[k2]] == anInt503) { 858 + modelA.triangleDrawType[k2] = -1; 859 + } 860 + } 808 861 809 - for (int l2 = 0; l2 < class50_sub1_sub4_sub4_1.triangleCount; l2++) 810 - if (anIntArray502[class50_sub1_sub4_sub4_1.trianglePointsX[l2]] == anInt503 811 - && anIntArray502[class50_sub1_sub4_sub4_1.trianglePointsY[l2]] == anInt503 812 - && anIntArray502[class50_sub1_sub4_sub4_1.trianglePointsZ[l2]] == anInt503) 813 - class50_sub1_sub4_sub4_1.texturePoints[l2] = -1; 862 + for (int l2 = 0; l2 < modelB.triangleCount; l2++) { 863 + if (anIntArray502[modelB.trianglePointsX[l2]] == anInt503 864 + && anIntArray502[modelB.trianglePointsY[l2]] == anInt503 865 + && anIntArray502[modelB.trianglePointsZ[l2]] == anInt503) { 866 + modelB.triangleDrawType[l2] = -1; 867 + } 868 + } 814 869 815 - } 870 + } 816 871 817 - public void renderMinimapDot(int ai[], int i, int j, int k, int l, int i1) { 818 - SceneTile class50_sub3 = tiles[k][l][i1]; 819 - if (class50_sub3 == null) 820 - return; 821 - GenericTile genericTile = class50_sub3.genericTile; 822 - if (genericTile != null) { 823 - int j1 = genericTile.rgbColor; 824 - if (j1 == 0) 825 - return; 826 - for (int k1 = 0; k1 < 4; k1++) { 827 - ai[i] = j1; 828 - ai[i + 1] = j1; 829 - ai[i + 2] = j1; 830 - ai[i + 3] = j1; 831 - i += j; 832 - } 872 + public void renderMinimapDot(int[] ai, int i, int j, int k, int l, int i1) { 873 + SceneTile class50_sub3 = groundArray[k][l][i1]; 874 + if (class50_sub3 == null) { 875 + return; 876 + } 877 + GenericTile genericTile = class50_sub3.plainTile; 878 + if (genericTile != null) { 879 + int j1 = genericTile.rgbColor; 880 + if (j1 == 0) { 881 + return; 882 + } 883 + for (int k1 = 0; k1 < 4; k1++) { 884 + ai[i] = j1; 885 + ai[i + 1] = j1; 886 + ai[i + 2] = j1; 887 + ai[i + 3] = j1; 888 + i += j; 889 + } 833 890 834 - return; 835 - } 836 - ComplexTile complexTile = class50_sub3.complexTile; 837 - if (complexTile == null) 838 - return; 839 - int l1 = complexTile.anInt414; 840 - int i2 = complexTile.anInt415; 841 - int j2 = complexTile.anInt416; 842 - int k2 = complexTile.anInt417; 843 - int ai1[] = anIntArrayArray504[l1]; 844 - int ai2[] = anIntArrayArray505[i2]; 845 - int l2 = 0; 846 - if (j2 != 0) { 847 - for (int i3 = 0; i3 < 4; i3++) { 848 - ai[i] = ai1[ai2[l2++]] != 0 ? k2 : j2; 849 - ai[i + 1] = ai1[ai2[l2++]] != 0 ? k2 : j2; 850 - ai[i + 2] = ai1[ai2[l2++]] != 0 ? k2 : j2; 851 - ai[i + 3] = ai1[ai2[l2++]] != 0 ? k2 : j2; 852 - i += j; 853 - } 891 + return; 892 + } 893 + ComplexTile complexTile = class50_sub3.shapedTile; 894 + if (complexTile == null) { 895 + return; 896 + } 897 + int l1 = complexTile.shape; 898 + int i2 = complexTile.rotation; 899 + int j2 = complexTile.underlayRGB; 900 + int k2 = complexTile.overlayRGB; 901 + int[] ai1 = tileShapePoints[l1]; 902 + int[] ai2 = tileShapeIndices[i2]; 903 + int l2 = 0; 904 + if (j2 != 0) { 905 + for (int i3 = 0; i3 < 4; i3++) { 906 + ai[i] = ai1[ai2[l2++]] != 0 ? k2 : j2; 907 + ai[i + 1] = ai1[ai2[l2++]] != 0 ? k2 : j2; 908 + ai[i + 2] = ai1[ai2[l2++]] != 0 ? k2 : j2; 909 + ai[i + 3] = ai1[ai2[l2++]] != 0 ? k2 : j2; 910 + i += j; 911 + } 854 912 855 - return; 856 - } 857 - for (int j3 = 0; j3 < 4; j3++) { 858 - if (ai1[ai2[l2++]] != 0) 859 - ai[i] = k2; 860 - if (ai1[ai2[l2++]] != 0) 861 - ai[i + 1] = k2; 862 - if (ai1[ai2[l2++]] != 0) 863 - ai[i + 2] = k2; 864 - if (ai1[ai2[l2++]] != 0) 865 - ai[i + 3] = k2; 866 - i += j; 867 - } 913 + return; 914 + } 915 + for (int j3 = 0; j3 < 4; j3++) { 916 + if (ai1[ai2[l2++]] != 0) { 917 + ai[i] = k2; 918 + } 919 + if (ai1[ai2[l2++]] != 0) { 920 + ai[i + 1] = k2; 921 + } 922 + if (ai1[ai2[l2++]] != 0) { 923 + ai[i + 2] = k2; 924 + } 925 + if (ai1[ai2[l2++]] != 0) { 926 + ai[i + 3] = k2; 927 + } 928 + i += j; 929 + } 868 930 869 - } 931 + } 870 932 871 - public static void method277(int l, int k, int i1, int i, int[] ai) { 872 - anInt510 = 0; 873 - anInt511 = 0; 874 - anInt512 = i1; 875 - anInt513 = i; 876 - anInt508 = i1 / 2; 877 - anInt509 = i / 2; 878 - boolean aflag[][][][] = new boolean[9][32][53][53]; 879 - for (int j1 = 128; j1 <= 384; j1 += 32) { 880 - for (int k1 = 0; k1 < 2048; k1 += 64) { 881 - anInt473 = Model.SINE[j1]; 882 - anInt474 = Model.COSINE[j1]; 883 - anInt475 = Model.SINE[k1]; 884 - anInt476 = Model.COSINE[k1]; 885 - int i2 = (j1 - 128) / 32; 886 - int k2 = k1 / 64; 887 - for (int i3 = -26; i3 <= 26; i3++) { 888 - for (int k3 = -26; k3 <= 26; k3++) { 889 - int l3 = i3 * 128; 890 - int j4 = k3 * 128; 891 - boolean flag1 = false; 892 - for (int l4 = -l; l4 <= k; l4 += 128) { 893 - if (!method278(j4, l3, anInt444, ai[i2] + l4)) 894 - continue; 895 - flag1 = true; 896 - break; 897 - } 933 + public static void method277(int l, int k, int i1, int i, int[] ai) { 934 + anInt510 = 0; 935 + anInt511 = 0; 936 + anInt512 = i1; 937 + anInt513 = i; 938 + anInt508 = i1 / 2; 939 + anInt509 = i / 2; 940 + boolean[][][][] aflag = new boolean[9][32][53][53]; 941 + for (int j1 = 128; j1 <= 384; j1 += 32) { 942 + for (int k1 = 0; k1 < 2048; k1 += 64) { 943 + curveSineY = Model.SINE[j1]; 944 + curveCosineY = Model.COSINE[j1]; 945 + curveSineX = Model.SINE[k1]; 946 + curveCosineX = Model.COSINE[k1]; 947 + int i2 = (j1 - 128) / 32; 948 + int k2 = k1 / 64; 949 + for (int i3 = -26; i3 <= 26; i3++) { 950 + for (int k3 = -26; k3 <= 26; k3++) { 951 + int l3 = i3 * 128; 952 + int j4 = k3 * 128; 953 + boolean flag1 = false; 954 + for (int l4 = -l; l4 <= k; l4 += 128) { 955 + if (!method278(j4, l3, ai[i2] + l4)) { 956 + continue; 957 + } 958 + flag1 = true; 959 + break; 960 + } 898 961 899 - aflag[i2][k2][i3 + 25 + 1][k3 + 25 + 1] = flag1; 900 - } 962 + aflag[i2][k2][i3 + 25 + 1][k3 + 25 + 1] = flag1; 963 + } 901 964 902 - } 965 + } 903 966 904 - } 967 + } 905 968 906 - } 969 + } 907 970 908 - for (int l1 = 0; l1 < 8; l1++) { 909 - for (int j2 = 0; j2 < 32; j2++) { 910 - for (int l2 = -25; l2 < 25; l2++) { 911 - for (int j3 = -25; j3 < 25; j3++) { 912 - boolean flag = false; 913 - label0: for (int i4 = -1; i4 <= 1; i4++) { 914 - for (int k4 = -1; k4 <= 1; k4++) { 915 - if (aflag[l1][j2][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) 916 - flag = true; 917 - else if (aflag[l1][(j2 + 1) % 31][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) 918 - flag = true; 919 - else if (aflag[l1 + 1][j2][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) { 920 - flag = true; 921 - } else { 922 - if (!aflag[l1 + 1][(j2 + 1) % 31][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) 923 - continue; 924 - flag = true; 925 - } 926 - break label0; 927 - } 971 + for (int l1 = 0; l1 < 8; l1++) { 972 + for (int j2 = 0; j2 < 32; j2++) { 973 + for (int l2 = -25; l2 < 25; l2++) { 974 + for (int j3 = -25; j3 < 25; j3++) { 975 + boolean flag = false; 976 + label0: 977 + for (int i4 = -1; i4 <= 1; i4++) { 978 + for (int k4 = -1; k4 <= 1; k4++) { 979 + if (aflag[l1][j2][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) { 980 + flag = true; 981 + } else if (aflag[l1][(j2 + 1) % 31][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) { 982 + flag = true; 983 + } else if (aflag[l1 + 1][j2][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) { 984 + flag = true; 985 + } else { 986 + if (!aflag[l1 + 1][(j2 + 1) % 31][l2 + i4 + 25 + 1][j3 + k4 + 25 + 1]) { 987 + continue; 988 + } 989 + flag = true; 990 + } 991 + break label0; 992 + } 928 993 929 - } 994 + } 930 995 931 - aBooleanArrayArrayArrayArray506[l1][j2][l2 + 25][j3 + 25] = flag; 932 - } 996 + TILE_VISIBILITY_MAPS[l1][j2][l2 + 25][j3 + 25] = flag; 997 + } 933 998 934 - } 999 + } 935 1000 936 - } 1001 + } 937 1002 938 - } 939 - } 1003 + } 1004 + } 940 1005 941 - public static boolean method278(int i, int j, int k, int l) { 942 - int i1 = i * anInt475 + j * anInt476 >> 16; 943 - int j1 = i * anInt476 - j * anInt475 >> 16; 944 - int k1 = l * anInt473 + j1 * anInt474 >> 16; 945 - int l1 = l * anInt474 - j1 * anInt473 >> 16; 946 - if (k1 < 50 || k1 > 3500) 947 - return false; 948 - int i2 = anInt508 + (i1 << 9) / k1; 949 - int j2 = anInt509 + (l1 << 9) / k1; 950 - return i2 >= anInt510 && i2 <= anInt512 && j2 >= anInt511 && j2 <= anInt513; 951 - } 1006 + private static boolean method278(int i, int j, int l) { 1007 + int i1 = i * curveSineX + j * curveCosineX >> 16; 1008 + int j1 = i * curveCosineX - j * curveSineX >> 16; 1009 + int k1 = l * curveSineY + j1 * curveCosineY >> 16; 1010 + int l1 = l * curveCosineY - j1 * curveSineY >> 16; 1011 + if (k1 < 50 || k1 > 3500) { 1012 + return false; 1013 + } 1014 + int i2 = anInt508 + (i1 << 9) / k1; 1015 + int j2 = anInt509 + (l1 << 9) / k1; 1016 + return i2 >= anInt510 && i2 <= anInt512 && j2 >= anInt511 && j2 <= anInt513; 1017 + } 952 1018 953 - public void method279(int i, int j, int k) { 954 - aBoolean482 = true; 955 - anInt483 = j; 956 - anInt484 = k; 957 - clickedTileX = -1; 958 - if (i != 0) { 959 - return; 960 - } else { 961 - anInt486 = -1; 962 - return; 963 - } 964 - } 1019 + public void method279(int i, int j, int k) { 1020 + clicked = true; 1021 + clickX = j; 1022 + clickY = k; 1023 + clickedTileX = -1; 1024 + if (i != 0) { 1025 + } else { 1026 + clickedTileY = -1; 1027 + } 1028 + } 965 1029 966 - public void method280(int i, int j, int k, int l, int i1, int j1, int k1) { 967 - if (i < 0) 968 - i = 0; 969 - else if (i >= anInt453 * 128) 970 - i = anInt453 * 128 - 1; 971 - if (i1 < 0) 972 - i1 = 0; 973 - else if (i1 >= anInt454 * 128) 974 - i1 = anInt454 * 128 - 1; 975 - anInt463++; 976 - anInt473 = Model.SINE[k1]; 977 - anInt474 = Model.COSINE[k1]; 978 - anInt475 = Model.SINE[j1]; 979 - anInt476 = Model.COSINE[j1]; 980 - aBooleanArrayArray507 = aBooleanArrayArrayArrayArray506[(k1 - 128) / 32][j1 / 64]; 981 - anInt470 = i; 982 - anInt471 = l; 983 - anInt472 = i1; 984 - anInt468 = i / 128; 985 - anInt469 = i1 / 128; 986 - anInt462 = j; 987 - anInt464 = anInt468 - 25; 988 - if (k != 0) 989 - return; 990 - if (anInt464 < 0) 991 - anInt464 = 0; 992 - anInt466 = anInt469 - 25; 993 - if (anInt466 < 0) 994 - anInt466 = 0; 995 - anInt465 = anInt468 + 25; 996 - if (anInt465 > anInt453) 997 - anInt465 = anInt453; 998 - anInt467 = anInt469 + 25; 999 - if (anInt467 > anInt454) 1000 - anInt467 = anInt454; 1001 - method286(); 1002 - anInt461 = 0; 1003 - for (int l1 = anInt457; l1 < anInt452; l1++) { 1004 - SceneTile aclass50_sub3[][] = tiles[l1]; 1005 - for (int j2 = anInt464; j2 < anInt465; j2++) { 1006 - for (int l2 = anInt466; l2 < anInt467; l2++) { 1007 - SceneTile class50_sub3 = aclass50_sub3[j2][l2]; 1008 - if (class50_sub3 != null) 1009 - if (class50_sub3.anInt1411 > j 1010 - || !aBooleanArrayArray507[(j2 - anInt468) + 25][(l2 - anInt469) + 25] 1011 - && anIntArrayArrayArray455[l1][j2][l2] - l < 2000) { 1012 - class50_sub3.aBoolean1412 = false; 1013 - class50_sub3.aBoolean1413 = false; 1014 - class50_sub3.anInt1415 = 0; 1015 - } else { 1016 - class50_sub3.aBoolean1412 = true; 1017 - class50_sub3.aBoolean1413 = true; 1018 - if (class50_sub3.sceneSpawnRequestCount > 0) 1019 - class50_sub3.aBoolean1414 = true; 1020 - else 1021 - class50_sub3.aBoolean1414 = false; 1022 - anInt461++; 1023 - } 1024 - } 1030 + public void render(int cameraPosX, int j, int k, int l, int cameraPosY, int curveX, int curveY) { 1031 + if (cameraPosX < 0) { 1032 + cameraPosX = 0; 1033 + } else if (cameraPosX >= mapSizeX * 128) { 1034 + cameraPosX = mapSizeX * 128 - 1; 1035 + } 1036 + if (cameraPosY < 0) { 1037 + cameraPosY = 0; 1038 + } else if (cameraPosY >= mapSizeY * 128) { 1039 + cameraPosY = mapSizeY * 128 - 1; 1040 + } 1041 + cycle++; 1042 + curveSineY = Model.SINE[curveY]; 1043 + curveCosineY = Model.COSINE[curveY]; 1044 + curveSineX = Model.SINE[curveX]; 1045 + curveCosineX = Model.COSINE[curveX]; 1046 + TILE_VISIBILITY_MAP = TILE_VISIBILITY_MAPS[(curveY - 128) / 32][curveX / 64]; 1047 + Scene.cameraPosX = cameraPosX; 1048 + cameraPosZ = l; 1049 + Scene.cameraPosY = cameraPosY; 1050 + cameraPositionTileX = cameraPosX / 128; 1051 + cameraPositionTileY = cameraPosY / 128; 1052 + plane = j; 1053 + currentPositionX = cameraPositionTileX - 25; 1054 + if (k != 0) { 1055 + return; 1056 + } 1057 + if (currentPositionX < 0) { 1058 + currentPositionX = 0; 1059 + } 1060 + currentPositionY = cameraPositionTileY - 25; 1061 + if (currentPositionY < 0) { 1062 + currentPositionY = 0; 1063 + } 1064 + mapBoundsX = cameraPositionTileX + 25; 1065 + if (mapBoundsX > mapSizeX) { 1066 + mapBoundsX = mapSizeX; 1067 + } 1068 + mapBoundsY = cameraPositionTileY + 25; 1069 + if (mapBoundsY > mapSizeY) { 1070 + mapBoundsY = mapSizeY; 1071 + } 1072 + processCulling(); 1073 + anInt461 = 0; 1074 + for (int z = currentPositionZ; z < mapSizeZ; z++) { 1075 + SceneTile[][] tiles = groundArray[z]; 1076 + for (int x = currentPositionX; x < mapBoundsX; x++) { 1077 + for (int y = currentPositionY; y < mapBoundsY; y++) { 1078 + SceneTile tile = tiles[x][y]; 1079 + if (tile != null) { 1080 + if (tile.logicHeight > j 1081 + || !TILE_VISIBILITY_MAP[(x - cameraPositionTileX) + 25][(y - cameraPositionTileY) + 25] 1082 + && heightMap[z][x][y] - l < 2000) { 1083 + tile.draw = false; 1084 + tile.visible = false; 1085 + tile.wallCullDirection = 0; 1086 + } else { 1087 + tile.draw = true; 1088 + tile.visible = true; 1089 + tile.drawEntities = tile.entityCount > 0; 1090 + anInt461++; 1091 + } 1092 + } 1093 + } 1025 1094 1026 - } 1095 + } 1027 1096 1028 - } 1097 + } 1029 1098 1030 - for (int i2 = anInt457; i2 < anInt452; i2++) { 1031 - SceneTile aclass50_sub3_1[][] = tiles[i2]; 1032 - for (int i3 = -25; i3 <= 0; i3++) { 1033 - int j3 = anInt468 + i3; 1034 - int l3 = anInt468 - i3; 1035 - if (j3 >= anInt464 || l3 < anInt465) { 1036 - for (int j4 = -25; j4 <= 0; j4++) { 1037 - int l4 = anInt469 + j4; 1038 - int j5 = anInt469 - j4; 1039 - if (j3 >= anInt464) { 1040 - if (l4 >= anInt466) { 1041 - SceneTile class50_sub3_1 = aclass50_sub3_1[j3][l4]; 1042 - if (class50_sub3_1 != null && class50_sub3_1.aBoolean1412) 1043 - method281(class50_sub3_1, true); 1044 - } 1045 - if (j5 < anInt467) { 1046 - SceneTile class50_sub3_2 = aclass50_sub3_1[j3][j5]; 1047 - if (class50_sub3_2 != null && class50_sub3_2.aBoolean1412) 1048 - method281(class50_sub3_2, true); 1049 - } 1050 - } 1051 - if (l3 < anInt465) { 1052 - if (l4 >= anInt466) { 1053 - SceneTile class50_sub3_3 = aclass50_sub3_1[l3][l4]; 1054 - if (class50_sub3_3 != null && class50_sub3_3.aBoolean1412) 1055 - method281(class50_sub3_3, true); 1056 - } 1057 - if (j5 < anInt467) { 1058 - SceneTile class50_sub3_4 = aclass50_sub3_1[l3][j5]; 1059 - if (class50_sub3_4 != null && class50_sub3_4.aBoolean1412) 1060 - method281(class50_sub3_4, true); 1061 - } 1062 - } 1063 - if (anInt461 == 0) { 1064 - aBoolean482 = false; 1065 - return; 1066 - } 1067 - } 1099 + for (int z = currentPositionZ; z < mapSizeZ; z++) { 1100 + SceneTile[][] tiles = groundArray[z]; 1101 + for (int offsetX = -25; offsetX <= 0; offsetX++) { 1102 + int x = cameraPositionTileX + offsetX; 1103 + int x2 = cameraPositionTileX - offsetX; 1104 + if (x >= currentPositionX || x2 < mapBoundsX) { 1105 + for (int offsetY = -25; offsetY <= 0; offsetY++) { 1106 + int y = cameraPositionTileY + offsetY; 1107 + int y2 = cameraPositionTileY - offsetY; 1108 + if (x >= currentPositionX) { 1109 + if (y >= currentPositionY) { 1110 + SceneTile tile = tiles[x][y]; 1111 + if (tile != null && tile.draw) { 1112 + renderTile(tile, true); 1113 + } 1114 + } 1115 + if (y2 < mapBoundsY) { 1116 + SceneTile tile = tiles[x][y2]; 1117 + if (tile != null && tile.draw) { 1118 + renderTile(tile, true); 1119 + } 1120 + } 1121 + } 1122 + if (x2 < mapBoundsX) { 1123 + if (y >= currentPositionY) { 1124 + SceneTile class50_sub3_3 = tiles[x2][y]; 1125 + if (class50_sub3_3 != null && class50_sub3_3.draw) { 1126 + renderTile(class50_sub3_3, true); 1127 + } 1128 + } 1129 + if (y2 < mapBoundsY) { 1130 + SceneTile class50_sub3_4 = tiles[x2][y2]; 1131 + if (class50_sub3_4 != null && class50_sub3_4.draw) { 1132 + renderTile(class50_sub3_4, true); 1133 + } 1134 + } 1135 + } 1136 + if (anInt461 == 0) { 1137 + clicked = false; 1138 + return; 1139 + } 1140 + } 1068 1141 1069 - } 1070 - } 1142 + } 1143 + } 1071 1144 1072 - } 1145 + } 1073 1146 1074 - for (int k2 = anInt457; k2 < anInt452; k2++) { 1075 - SceneTile aclass50_sub3_2[][] = tiles[k2]; 1076 - for (int k3 = -25; k3 <= 0; k3++) { 1077 - int i4 = anInt468 + k3; 1078 - int k4 = anInt468 - k3; 1079 - if (i4 >= anInt464 || k4 < anInt465) { 1080 - for (int i5 = -25; i5 <= 0; i5++) { 1081 - int k5 = anInt469 + i5; 1082 - int l5 = anInt469 - i5; 1083 - if (i4 >= anInt464) { 1084 - if (k5 >= anInt466) { 1085 - SceneTile class50_sub3_5 = aclass50_sub3_2[i4][k5]; 1086 - if (class50_sub3_5 != null && class50_sub3_5.aBoolean1412) 1087 - method281(class50_sub3_5, false); 1088 - } 1089 - if (l5 < anInt467) { 1090 - SceneTile class50_sub3_6 = aclass50_sub3_2[i4][l5]; 1091 - if (class50_sub3_6 != null && class50_sub3_6.aBoolean1412) 1092 - method281(class50_sub3_6, false); 1093 - } 1094 - } 1095 - if (k4 < anInt465) { 1096 - if (k5 >= anInt466) { 1097 - SceneTile class50_sub3_7 = aclass50_sub3_2[k4][k5]; 1098 - if (class50_sub3_7 != null && class50_sub3_7.aBoolean1412) 1099 - method281(class50_sub3_7, false); 1100 - } 1101 - if (l5 < anInt467) { 1102 - SceneTile class50_sub3_8 = aclass50_sub3_2[k4][l5]; 1103 - if (class50_sub3_8 != null && class50_sub3_8.aBoolean1412) 1104 - method281(class50_sub3_8, false); 1105 - } 1106 - } 1107 - if (anInt461 == 0) { 1108 - aBoolean482 = false; 1109 - return; 1110 - } 1111 - } 1147 + for (int z = currentPositionZ; z < mapSizeZ; z++) { 1148 + SceneTile[][] tiles = groundArray[z]; 1149 + for (int offsetX = -25; offsetX <= 0; offsetX++) { 1150 + int x = cameraPositionTileX + offsetX; 1151 + int x2 = cameraPositionTileX - offsetX; 1152 + if (x >= currentPositionX || x2 < mapBoundsX) { 1153 + for (int offsetY = -25; offsetY <= 0; offsetY++) { 1154 + int y = cameraPositionTileY + offsetY; 1155 + int y2 = cameraPositionTileY - offsetY; 1156 + if (x >= currentPositionX) { 1157 + if (y >= currentPositionY) { 1158 + SceneTile tile = tiles[x][y]; 1159 + if (tile != null && tile.draw) { 1160 + renderTile(tile, false); 1161 + } 1162 + } 1163 + if (y2 < mapBoundsY) { 1164 + SceneTile tile = tiles[x][y2]; 1165 + if (tile != null && tile.draw) { 1166 + renderTile(tile, false); 1167 + } 1168 + } 1169 + } 1170 + if (x2 < mapBoundsX) { 1171 + if (y >= currentPositionY) { 1172 + SceneTile tile = tiles[x2][y]; 1173 + if (tile != null && tile.draw) { 1174 + renderTile(tile, false); 1175 + } 1176 + } 1177 + if (y2 < mapBoundsY) { 1178 + SceneTile tile = tiles[x2][y2]; 1179 + if (tile != null && tile.draw) { 1180 + renderTile(tile, false); 1181 + } 1182 + } 1183 + } 1184 + if (anInt461 == 0) { 1185 + clicked = false; 1186 + return; 1187 + } 1188 + } 1112 1189 1113 - } 1114 - } 1190 + } 1191 + } 1115 1192 1116 - } 1193 + } 1117 1194 1118 - aBoolean482 = false; 1119 - } 1195 + clicked = false; 1196 + } 1120 1197 1121 - public void method281(SceneTile class50_sub3, boolean flag) { 1122 - aClass6_492.insertBack(class50_sub3); 1123 - do { 1124 - SceneTile class50_sub3_1; 1125 - do { 1126 - class50_sub3_1 = (SceneTile) aClass6_492.removeFirst(); 1127 - if (class50_sub3_1 == null) 1128 - return; 1129 - } while (!class50_sub3_1.aBoolean1413); 1130 - int i = class50_sub3_1.anInt1398; 1131 - int j = class50_sub3_1.anInt1399; 1132 - int k = class50_sub3_1.anInt1397; 1133 - int l = class50_sub3_1.anInt1400; 1134 - SceneTile aclass50_sub3[][] = tiles[k]; 1135 - if (class50_sub3_1.aBoolean1412) { 1136 - if (flag) { 1137 - if (k > 0) { 1138 - SceneTile class50_sub3_2 = tiles[k - 1][i][j]; 1139 - if (class50_sub3_2 != null && class50_sub3_2.aBoolean1413) 1140 - continue; 1141 - } 1142 - if (i <= anInt468 && i > anInt464) { 1143 - SceneTile class50_sub3_3 = aclass50_sub3[i - 1][j]; 1144 - if (class50_sub3_3 != null && class50_sub3_3.aBoolean1413 1145 - && (class50_sub3_3.aBoolean1412 || (class50_sub3_1.anInt1410 & 1) == 0)) 1146 - continue; 1147 - } 1148 - if (i >= anInt468 && i < anInt465 - 1) { 1149 - SceneTile class50_sub3_4 = aclass50_sub3[i + 1][j]; 1150 - if (class50_sub3_4 != null && class50_sub3_4.aBoolean1413 1151 - && (class50_sub3_4.aBoolean1412 || (class50_sub3_1.anInt1410 & 4) == 0)) 1152 - continue; 1153 - } 1154 - if (j <= anInt469 && j > anInt466) { 1155 - SceneTile class50_sub3_5 = aclass50_sub3[i][j - 1]; 1156 - if (class50_sub3_5 != null && class50_sub3_5.aBoolean1413 1157 - && (class50_sub3_5.aBoolean1412 || (class50_sub3_1.anInt1410 & 8) == 0)) 1158 - continue; 1159 - } 1160 - if (j >= anInt469 && j < anInt467 - 1) { 1161 - SceneTile class50_sub3_6 = aclass50_sub3[i][j + 1]; 1162 - if (class50_sub3_6 != null && class50_sub3_6.aBoolean1413 1163 - && (class50_sub3_6.aBoolean1412 || (class50_sub3_1.anInt1410 & 2) == 0)) 1164 - continue; 1165 - } 1166 - } else { 1167 - flag = true; 1168 - } 1169 - class50_sub3_1.aBoolean1412 = false; 1170 - if (class50_sub3_1.aClass50_Sub3_1419 != null) { 1171 - SceneTile class50_sub3_7 = class50_sub3_1.aClass50_Sub3_1419; 1172 - if (class50_sub3_7.genericTile != null) { 1173 - if (!method287(0, i, j)) 1174 - method282(class50_sub3_7.genericTile, 0, anInt473, anInt474, anInt475, anInt476, i, j); 1175 - } else if (class50_sub3_7.complexTile != null && !method287(0, i, j)) 1176 - method283(anInt474, anInt476, class50_sub3_7.complexTile, anInt473, j, i, anInt475, (byte) 3); 1177 - Wall wall = class50_sub3_7.wall; 1178 - if (wall != null) 1179 - wall.aRenderable769.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1180 - wall.x - anInt470, wall.plane - anInt471, wall.y - anInt472, 1181 - wall.hash); 1182 - for (int i2 = 0; i2 < class50_sub3_7.sceneSpawnRequestCount; i2++) { 1183 - SceneSpawnRequest sceneSpawnRequest = class50_sub3_7.sceneSpawnRequests[i2]; 1184 - if (sceneSpawnRequest != null) 1185 - sceneSpawnRequest.aRenderable601.renderAtPoint(sceneSpawnRequest.anInt118, anInt473, anInt474, anInt475, 1186 - anInt476, sceneSpawnRequest.anInt115 - anInt470, sceneSpawnRequest.anInt114 - anInt471, sceneSpawnRequest.anInt116 1187 - - anInt472, sceneSpawnRequest.anInt125); 1188 - } 1198 + private void renderTile(SceneTile _tile, boolean flag) { 1199 + tileList.pushBack(_tile); 1200 + do { 1201 + SceneTile groundTile; 1202 + do { 1203 + groundTile = (SceneTile) tileList.pop(); 1204 + if (groundTile == null) { 1205 + return; 1206 + } 1207 + } while (!groundTile.visible); 1208 + int x = groundTile.x; 1209 + int y = groundTile.y; 1210 + int z = groundTile.z; 1211 + int level = groundTile.renderLevel; 1212 + SceneTile[][] tiles = groundArray[z]; 1213 + if (groundTile.draw) { 1214 + if (flag) { 1215 + if (z > 0) { 1216 + SceneTile tile = groundArray[z - 1][x][y]; 1217 + if (tile != null && tile.visible) { 1218 + continue; 1219 + } 1220 + } 1221 + if (x <= cameraPositionTileX && x > currentPositionX) { 1222 + SceneTile tile = tiles[x - 1][y]; 1223 + if (tile != null && tile.visible 1224 + && (tile.draw || (groundTile.interactiveObjectsSizeOR & 1) == 0)) { 1225 + continue; 1226 + } 1227 + } 1228 + if (x >= cameraPositionTileX && x < mapBoundsX - 1) { 1229 + SceneTile tile = tiles[x + 1][y]; 1230 + if (tile != null && tile.visible 1231 + && (tile.draw || (groundTile.interactiveObjectsSizeOR & 4) == 0)) { 1232 + continue; 1233 + } 1234 + } 1235 + if (y <= cameraPositionTileY && y > currentPositionY) { 1236 + SceneTile tile = tiles[x][y - 1]; 1237 + if (tile != null && tile.visible 1238 + && (tile.draw || (groundTile.interactiveObjectsSizeOR & 8) == 0)) { 1239 + continue; 1240 + } 1241 + } 1242 + if (y >= cameraPositionTileY && y < mapBoundsY - 1) { 1243 + SceneTile tile = tiles[x][y + 1]; 1244 + if (tile != null && tile.visible 1245 + && (tile.draw || (groundTile.interactiveObjectsSizeOR & 2) == 0)) { 1246 + continue; 1247 + } 1248 + } 1249 + } else { 1250 + flag = true; 1251 + } 1252 + groundTile.draw = false; 1253 + if (groundTile.tileBelow != null) { 1254 + SceneTile tile = groundTile.tileBelow; 1255 + if (tile.plainTile != null) { 1256 + if (!isTileOccluded(x, y, 0)) { 1257 + renderPlainTile(tile.plainTile, x, y, 0, curveSineX, curveCosineX, curveSineY, curveCosineY); 1258 + } 1259 + } else if (tile.shapedTile != null && !isTileOccluded(x, y, 0)) { 1260 + renderShapedTile(tile.shapedTile, x, y, curveSineX, curveCosineX, curveSineY, curveCosineY); 1261 + } 1262 + Wall wall = tile.wall; 1263 + if (wall != null) { 1264 + wall.primary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1265 + wall.x - cameraPosX, wall.z - cameraPosZ, wall.y - cameraPosY, 1266 + wall.uid); 1267 + } 1268 + for (int i2 = 0; i2 < tile.entityCount; i2++) { 1269 + InteractiveObject interactiveObject = tile.interactiveObjects[i2]; 1270 + if (interactiveObject != null) { 1271 + interactiveObject.renderable.renderAtPoint(interactiveObject.rotation, curveSineY, curveCosineY, curveSineX, 1272 + curveCosineX, interactiveObject.worldX - cameraPosX, interactiveObject.worldZ - cameraPosZ, interactiveObject.worldY 1273 + - cameraPosY, interactiveObject.uid); 1274 + } 1275 + } 1189 1276 1190 - } 1191 - boolean flag1 = false; 1192 - if (class50_sub3_1.genericTile != null) { 1193 - if (!method287(l, i, j)) { 1194 - flag1 = true; 1195 - method282(class50_sub3_1.genericTile, l, anInt473, anInt474, anInt475, anInt476, i, j); 1196 - } 1197 - } else if (class50_sub3_1.complexTile != null && !method287(l, i, j)) { 1198 - flag1 = true; 1199 - method283(anInt474, anInt476, class50_sub3_1.complexTile, anInt473, j, i, anInt475, (byte) 3); 1200 - } 1201 - int j1 = 0; 1202 - int j2 = 0; 1203 - Wall wall_3 = class50_sub3_1.wall; 1204 - WallDecoration wallDecoration_1 = class50_sub3_1.wallDecoration; 1205 - if (wall_3 != null || wallDecoration_1 != null) { 1206 - if (anInt468 == i) 1207 - j1++; 1208 - else if (anInt468 < i) 1209 - j1 += 2; 1210 - if (anInt469 == j) 1211 - j1 += 3; 1212 - else if (anInt469 > j) 1213 - j1 += 6; 1214 - j2 = anIntArray493[j1]; 1215 - class50_sub3_1.anInt1418 = anIntArray495[j1]; 1216 - } 1217 - if (wall_3 != null) { 1218 - if ((wall_3.faceUnknown & anIntArray494[j1]) != 0) { 1219 - if (wall_3.faceUnknown == 16) { 1220 - class50_sub3_1.anInt1415 = 3; 1221 - class50_sub3_1.anInt1416 = anIntArray496[j1]; 1222 - class50_sub3_1.anInt1417 = 3 - class50_sub3_1.anInt1416; 1223 - } else if (wall_3.faceUnknown == 32) { 1224 - class50_sub3_1.anInt1415 = 6; 1225 - class50_sub3_1.anInt1416 = anIntArray497[j1]; 1226 - class50_sub3_1.anInt1417 = 6 - class50_sub3_1.anInt1416; 1227 - } else if (wall_3.faceUnknown == 64) { 1228 - class50_sub3_1.anInt1415 = 12; 1229 - class50_sub3_1.anInt1416 = anIntArray498[j1]; 1230 - class50_sub3_1.anInt1417 = 12 - class50_sub3_1.anInt1416; 1231 - } else { 1232 - class50_sub3_1.anInt1415 = 9; 1233 - class50_sub3_1.anInt1416 = anIntArray499[j1]; 1234 - class50_sub3_1.anInt1417 = 9 - class50_sub3_1.anInt1416; 1235 - } 1236 - } else { 1237 - class50_sub3_1.anInt1415 = 0; 1238 - } 1239 - if ((wall_3.faceUnknown & j2) != 0 && !method288(l, i, j, wall_3.faceUnknown)) 1240 - wall_3.aRenderable769.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1241 - wall_3.x - anInt470, wall_3.plane - anInt471, wall_3.y 1242 - - anInt472, wall_3.hash); 1243 - if ((wall_3.face & j2) != 0 && !method288(l, i, j, wall_3.face)) 1244 - wall_3.aRenderable770.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1245 - wall_3.x - anInt470, wall_3.plane - anInt471, wall_3.y 1246 - - anInt472, wall_3.hash); 1247 - } 1248 - if (wallDecoration_1 != null && !method289(l, i, j, wallDecoration_1.renderable.modelHeight)) 1249 - if ((wallDecoration_1.faceUnknown & j2) != 0) 1250 - wallDecoration_1.renderable.renderAtPoint(wallDecoration_1.face, anInt473, anInt474, anInt475, 1251 - anInt476, wallDecoration_1.y - anInt470, wallDecoration_1.plane - anInt471, 1252 - wallDecoration_1.x - anInt472, wallDecoration_1.hash); 1253 - else if ((wallDecoration_1.faceUnknown & 0x300) != 0) { 1254 - int j4 = wallDecoration_1.y - anInt470; 1255 - int l5 = wallDecoration_1.plane - anInt471; 1256 - int k6 = wallDecoration_1.x - anInt472; 1257 - int i8 = wallDecoration_1.face; 1258 - int k9; 1259 - if (i8 == 1 || i8 == 2) 1260 - k9 = -j4; 1261 - else 1262 - k9 = j4; 1263 - int k10; 1264 - if (i8 == 2 || i8 == 3) 1265 - k10 = -k6; 1266 - else 1267 - k10 = k6; 1268 - if ((wallDecoration_1.faceUnknown & 0x100) != 0 && k10 < k9) { 1269 - int i11 = j4 + anIntArray478[i8]; 1270 - int k11 = k6 + anIntArray479[i8]; 1271 - wallDecoration_1.renderable.renderAtPoint(i8 * 512 + 256, anInt473, anInt474, anInt475, 1272 - anInt476, i11, l5, k11, wallDecoration_1.hash); 1273 - } 1274 - if ((wallDecoration_1.faceUnknown & 0x200) != 0 && k10 > k9) { 1275 - int j11 = j4 + anIntArray480[i8]; 1276 - int l11 = k6 + anIntArray481[i8]; 1277 - wallDecoration_1.renderable.renderAtPoint(i8 * 512 + 1280 & 0x7ff, anInt473, anInt474, 1278 - anInt475, anInt476, j11, l5, l11, wallDecoration_1.hash); 1279 - } 1280 - } 1281 - if (flag1) { 1282 - FloorDecoration floorDecoration = class50_sub3_1.floorDecoration; 1283 - if (floorDecoration != null) 1284 - floorDecoration.renderable.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1285 - floorDecoration.y - anInt470, floorDecoration.x - anInt471, floorDecoration.z - anInt472, 1286 - floorDecoration.hash); 1287 - CameraAngle cameraAngle_1 = class50_sub3_1.cameraAngle; 1288 - if (cameraAngle_1 != null && cameraAngle_1.anInt180 == 0) { 1289 - if (cameraAngle_1.aRenderable151 != null) 1290 - cameraAngle_1.aRenderable151.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1291 - cameraAngle_1.y - anInt470, cameraAngle_1.x - anInt471, cameraAngle_1.z 1292 - - anInt472, cameraAngle_1.anInt179); 1293 - if (cameraAngle_1.aRenderable152 != null) 1294 - cameraAngle_1.aRenderable152.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1295 - cameraAngle_1.y - anInt470, cameraAngle_1.x - anInt471, cameraAngle_1.z 1296 - - anInt472, cameraAngle_1.anInt179); 1297 - if (cameraAngle_1.aRenderable150 != null) 1298 - cameraAngle_1.aRenderable150.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1299 - cameraAngle_1.y - anInt470, cameraAngle_1.x - anInt471, cameraAngle_1.z 1300 - - anInt472, cameraAngle_1.anInt179); 1301 - } 1302 - } 1303 - int k4 = class50_sub3_1.anInt1410; 1304 - if (k4 != 0) { 1305 - if (i < anInt468 && (k4 & 4) != 0) { 1306 - SceneTile class50_sub3_17 = aclass50_sub3[i + 1][j]; 1307 - if (class50_sub3_17 != null && class50_sub3_17.aBoolean1413) 1308 - aClass6_492.insertBack(class50_sub3_17); 1309 - } 1310 - if (j < anInt469 && (k4 & 2) != 0) { 1311 - SceneTile class50_sub3_18 = aclass50_sub3[i][j + 1]; 1312 - if (class50_sub3_18 != null && class50_sub3_18.aBoolean1413) 1313 - aClass6_492.insertBack(class50_sub3_18); 1314 - } 1315 - if (i > anInt468 && (k4 & 1) != 0) { 1316 - SceneTile class50_sub3_19 = aclass50_sub3[i - 1][j]; 1317 - if (class50_sub3_19 != null && class50_sub3_19.aBoolean1413) 1318 - aClass6_492.insertBack(class50_sub3_19); 1319 - } 1320 - if (j > anInt469 && (k4 & 8) != 0) { 1321 - SceneTile class50_sub3_20 = aclass50_sub3[i][j - 1]; 1322 - if (class50_sub3_20 != null && class50_sub3_20.aBoolean1413) 1323 - aClass6_492.insertBack(class50_sub3_20); 1324 - } 1325 - } 1326 - } 1327 - if (class50_sub3_1.anInt1415 != 0) { 1328 - boolean flag2 = true; 1329 - for (int k1 = 0; k1 < class50_sub3_1.sceneSpawnRequestCount; k1++) { 1330 - if (class50_sub3_1.sceneSpawnRequests[k1].anInt124 == anInt463 1331 - || (class50_sub3_1.anIntArray1409[k1] & class50_sub3_1.anInt1415) != class50_sub3_1.anInt1416) 1332 - continue; 1333 - flag2 = false; 1334 - break; 1335 - } 1277 + } 1278 + boolean flag1 = false; 1279 + if (groundTile.plainTile != null) { 1280 + if (!isTileOccluded(x, y, level)) { 1281 + flag1 = true; 1282 + renderPlainTile(groundTile.plainTile, x, y, level, curveSineX, curveCosineX, curveSineY, curveCosineY); 1283 + } 1284 + } else if (groundTile.shapedTile != null && !isTileOccluded(x, y, level)) { 1285 + flag1 = true; 1286 + renderShapedTile(groundTile.shapedTile, x, y, curveSineX, curveCosineX, curveSineY, curveCosineY); 1287 + } 1288 + int j1 = 0; 1289 + int j2 = 0; 1290 + Wall wallObject = groundTile.wall; 1291 + WallDecoration wallDecoration = groundTile.wallDecoration; 1292 + if (wallObject != null || wallDecoration != null) { 1293 + if (cameraPositionTileX == x) { 1294 + j1++; 1295 + } else if (cameraPositionTileX < x) { 1296 + j1 += 2; 1297 + } 1298 + if (cameraPositionTileY == y) { 1299 + j1 += 3; 1300 + } else if (cameraPositionTileY > y) { 1301 + j1 += 6; 1302 + } 1303 + j2 = anIntArray493[j1]; 1304 + groundTile.wallDrawFlags = TILE_WALL_DRAW_FLAGS_1[j1]; 1305 + } 1306 + if (wallObject != null) { 1307 + if ((wallObject.orientation & anIntArray494[j1]) != 0) { 1308 + if (wallObject.orientation == 16) { 1309 + groundTile.wallCullDirection = 3; 1310 + groundTile.wallUncullDirection = WALL_UNCULL_FLAGS_0[j1]; 1311 + groundTile.wallCullOppositeDirection = 3 - groundTile.wallUncullDirection; 1312 + } else if (wallObject.orientation == 32) { 1313 + groundTile.wallCullDirection = 6; 1314 + groundTile.wallUncullDirection = anIntArray497[j1]; 1315 + groundTile.wallCullOppositeDirection = 6 - groundTile.wallUncullDirection; 1316 + } else if (wallObject.orientation == 64) { 1317 + groundTile.wallCullDirection = 12; 1318 + groundTile.wallUncullDirection = anIntArray498[j1]; 1319 + groundTile.wallCullOppositeDirection = 12 - groundTile.wallUncullDirection; 1320 + } else { 1321 + groundTile.wallCullDirection = 9; 1322 + groundTile.wallUncullDirection = anIntArray499[j1]; 1323 + groundTile.wallCullOppositeDirection = 9 - groundTile.wallUncullDirection; 1324 + } 1325 + } else { 1326 + groundTile.wallCullDirection = 0; 1327 + } 1328 + if ((wallObject.orientation & j2) != 0 && !isWallOccluded(x, y, level, wallObject.orientation)) { 1329 + wallObject.primary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1330 + wallObject.x - cameraPosX, wallObject.z - cameraPosZ, wallObject.y 1331 + - cameraPosY, wallObject.uid); 1332 + } 1333 + if ((wallObject.orientation2 & j2) != 0 && !isWallOccluded(x, y, level, wallObject.orientation2)) { 1334 + wallObject.secondary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1335 + wallObject.x - cameraPosX, wallObject.z - cameraPosZ, wallObject.y 1336 + - cameraPosY, wallObject.uid); 1337 + } 1338 + } 1339 + if (wallDecoration != null && !isOccluded(level, x, y, wallDecoration.renderable.modelHeight)) { 1340 + if ((wallDecoration.configBits & j2) != 0) { 1341 + wallDecoration.renderable.renderAtPoint(wallDecoration.face, curveSineY, curveCosineY, curveSineX, 1342 + curveCosineX, wallDecoration.x - cameraPosX, wallDecoration.z - cameraPosZ, 1343 + wallDecoration.y - cameraPosY, wallDecoration.uid); 1344 + } else if ((wallDecoration.configBits & 0x300) != 0) { 1345 + int j4 = wallDecoration.x - cameraPosX; 1346 + int l5 = wallDecoration.z - cameraPosZ; 1347 + int k6 = wallDecoration.y - cameraPosY; 1348 + int i8 = wallDecoration.face; 1349 + int k9; 1350 + if (i8 == 1 || i8 == 2) { 1351 + k9 = -j4; 1352 + } else { 1353 + k9 = j4; 1354 + } 1355 + int k10; 1356 + if (i8 == 2 || i8 == 3) { 1357 + k10 = -k6; 1358 + } else { 1359 + k10 = k6; 1360 + } 1361 + if ((wallDecoration.configBits & 0x100) != 0 && k10 < k9) { 1362 + int i11 = j4 + faceOffsetX2[i8]; 1363 + int k11 = k6 + faceOffsetY2[i8]; 1364 + wallDecoration.renderable.renderAtPoint(i8 * 512 + 256, curveSineY, curveCosineY, curveSineX, 1365 + curveCosineX, i11, l5, k11, wallDecoration.uid); 1366 + } 1367 + if ((wallDecoration.configBits & 0x200) != 0 && k10 > k9) { 1368 + int j11 = j4 + faceOffsetX3[i8]; 1369 + int l11 = k6 + faceOffsetY3[i8]; 1370 + wallDecoration.renderable.renderAtPoint(i8 * 512 + 1280 & 0x7ff, curveSineY, curveCosineY, 1371 + curveSineX, curveCosineX, j11, l5, l11, wallDecoration.uid); 1372 + } 1373 + } 1374 + } 1375 + if (flag1) { 1376 + FloorDecoration floorDecoration = groundTile.floorDecoration; 1377 + if (floorDecoration != null) { 1378 + floorDecoration.renderable.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1379 + floorDecoration.x - cameraPosX, floorDecoration.z - cameraPosZ, floorDecoration.y - cameraPosY, 1380 + floorDecoration.uid); 1381 + } 1382 + GroundItemTile groundItemTile_1 = groundTile.groundItemTile; 1383 + if (groundItemTile_1 != null && groundItemTile_1.anInt180 == 0) { 1384 + if (groundItemTile_1.secondGroundItem != null) { 1385 + groundItemTile_1.secondGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1386 + groundItemTile_1.x - cameraPosX, groundItemTile_1.z - cameraPosZ, groundItemTile_1.y 1387 + - cameraPosY, groundItemTile_1.uid); 1388 + } 1389 + if (groundItemTile_1.thirdGroundItem != null) { 1390 + groundItemTile_1.thirdGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1391 + groundItemTile_1.x - cameraPosX, groundItemTile_1.z - cameraPosZ, groundItemTile_1.y 1392 + - cameraPosY, groundItemTile_1.uid); 1393 + } 1394 + if (groundItemTile_1.firstGroundItem != null) { 1395 + groundItemTile_1.firstGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1396 + groundItemTile_1.x - cameraPosX, groundItemTile_1.z - cameraPosZ, groundItemTile_1.y 1397 + - cameraPosY, groundItemTile_1.uid); 1398 + } 1399 + } 1400 + } 1401 + int k4 = groundTile.interactiveObjectsSizeOR; 1402 + if (k4 != 0) { 1403 + if (x < cameraPositionTileX && (k4 & 4) != 0) { 1404 + SceneTile tile = tiles[x + 1][y]; 1405 + if (tile != null && tile.visible) { 1406 + tileList.pushBack(tile); 1407 + } 1408 + } 1409 + if (y < cameraPositionTileY && (k4 & 2) != 0) { 1410 + SceneTile tile = tiles[x][y + 1]; 1411 + if (tile != null && tile.visible) { 1412 + tileList.pushBack(tile); 1413 + } 1414 + } 1415 + if (x > cameraPositionTileX && (k4 & 1) != 0) { 1416 + SceneTile tile = tiles[x - 1][y]; 1417 + if (tile != null && tile.visible) { 1418 + tileList.pushBack(tile); 1419 + } 1420 + } 1421 + if (y > cameraPositionTileY && (k4 & 8) != 0) { 1422 + SceneTile tile = tiles[x][y - 1]; 1423 + if (tile != null && tile.visible) { 1424 + tileList.pushBack(tile); 1425 + } 1426 + } 1427 + } 1428 + } 1429 + if (groundTile.wallCullDirection != 0) { 1430 + boolean flag2 = true; 1431 + for (int e = 0; e < groundTile.entityCount; e++) { 1432 + if (groundTile.interactiveObjects[e].cycle == cycle 1433 + || (groundTile.sceneSpawnRequestsSize[e] & groundTile.wallCullDirection) != groundTile.wallUncullDirection) { 1434 + continue; 1435 + } 1436 + flag2 = false; 1437 + break; 1438 + } 1336 1439 1337 - if (flag2) { 1338 - Wall wall_1 = class50_sub3_1.wall; 1339 - if (!method288(l, i, j, wall_1.faceUnknown)) 1340 - wall_1.aRenderable769.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1341 - wall_1.x - anInt470, wall_1.plane - anInt471, wall_1.y 1342 - - anInt472, wall_1.hash); 1343 - class50_sub3_1.anInt1415 = 0; 1344 - } 1345 - } 1346 - if (class50_sub3_1.aBoolean1414) 1347 - try { 1348 - int i1 = class50_sub3_1.sceneSpawnRequestCount; 1349 - class50_sub3_1.aBoolean1414 = false; 1350 - int l1 = 0; 1351 - label0: for (int k2 = 0; k2 < i1; k2++) { 1352 - SceneSpawnRequest sceneSpawnRequest_1 = class50_sub3_1.sceneSpawnRequests[k2]; 1353 - if (sceneSpawnRequest_1.anInt124 == anInt463) 1354 - continue; 1355 - for (int k3 = sceneSpawnRequest_1.x; k3 <= sceneSpawnRequest_1.anInt120; k3++) { 1356 - for (int l4 = sceneSpawnRequest_1.y; l4 <= sceneSpawnRequest_1.anInt122; l4++) { 1357 - SceneTile class50_sub3_21 = aclass50_sub3[k3][l4]; 1358 - if (class50_sub3_21.aBoolean1412) { 1359 - class50_sub3_1.aBoolean1414 = true; 1360 - } else { 1361 - if (class50_sub3_21.anInt1415 == 0) 1362 - continue; 1363 - int l6 = 0; 1364 - if (k3 > sceneSpawnRequest_1.x) 1365 - l6++; 1366 - if (k3 < sceneSpawnRequest_1.anInt120) 1367 - l6 += 4; 1368 - if (l4 > sceneSpawnRequest_1.y) 1369 - l6 += 8; 1370 - if (l4 < sceneSpawnRequest_1.anInt122) 1371 - l6 += 2; 1372 - if ((l6 & class50_sub3_21.anInt1415) != class50_sub3_1.anInt1417) 1373 - continue; 1374 - class50_sub3_1.aBoolean1414 = true; 1375 - } 1376 - continue label0; 1377 - } 1440 + if (flag2) { 1441 + Wall wall_1 = groundTile.wall; 1442 + if (!isWallOccluded(x, y, level, wall_1.orientation)) { 1443 + wall_1.primary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1444 + wall_1.x - cameraPosX, wall_1.z - cameraPosZ, wall_1.y 1445 + - cameraPosY, wall_1.uid); 1446 + } 1447 + groundTile.wallCullDirection = 0; 1448 + } 1449 + } 1450 + if (groundTile.drawEntities) { 1451 + try { 1452 + int entityCount = groundTile.entityCount; 1453 + groundTile.drawEntities = false; 1454 + int l1 = 0; 1455 + label0: 1456 + for (int e = 0; e < entityCount; e++) { 1457 + InteractiveObject entity = groundTile.interactiveObjects[e]; 1458 + if (entity.cycle == cycle) { 1459 + continue; 1460 + } 1461 + for (int _x = entity.tileLeft; _x <= entity.tileRight; _x++) { 1462 + for (int _y = entity.tileTop; _y <= entity.tileBottom; _y++) { 1463 + SceneTile tile = tiles[_x][_y]; 1464 + if (tile.draw) { 1465 + groundTile.drawEntities = true; 1466 + } else { 1467 + if (tile.wallCullDirection == 0) { 1468 + continue; 1469 + } 1470 + int l6 = 0; 1471 + if (_x > entity.tileLeft) { 1472 + l6++; 1473 + } 1474 + if (_x < entity.tileRight) { 1475 + l6 += 4; 1476 + } 1477 + if (_y > entity.tileTop) { 1478 + l6 += 8; 1479 + } 1480 + if (_y < entity.tileBottom) { 1481 + l6 += 2; 1482 + } 1483 + if ((l6 & tile.wallCullDirection) != groundTile.wallCullOppositeDirection) { 1484 + continue; 1485 + } 1486 + groundTile.drawEntities = true; 1487 + } 1488 + continue label0; 1489 + } 1378 1490 1379 - } 1491 + } 1380 1492 1381 - aSceneSpawnRequestArray477[l1++] = sceneSpawnRequest_1; 1382 - int i5 = anInt468 - sceneSpawnRequest_1.x; 1383 - int i6 = sceneSpawnRequest_1.anInt120 - anInt468; 1384 - if (i6 > i5) 1385 - i5 = i6; 1386 - int i7 = anInt469 - sceneSpawnRequest_1.y; 1387 - int j8 = sceneSpawnRequest_1.anInt122 - anInt469; 1388 - if (j8 > i7) 1389 - sceneSpawnRequest_1.anInt123 = i5 + j8; 1390 - else 1391 - sceneSpawnRequest_1.anInt123 = i5 + i7; 1392 - } 1493 + interactiveObjects[l1++] = entity; 1494 + int i5 = cameraPositionTileX - entity.tileLeft; 1495 + int i6 = entity.tileRight - cameraPositionTileX; 1496 + if (i6 > i5) { 1497 + i5 = i6; 1498 + } 1499 + int i7 = cameraPositionTileY - entity.tileTop; 1500 + int j8 = entity.tileBottom - cameraPositionTileY; 1501 + if (j8 > i7) { 1502 + entity.anInt123 = i5 + j8; 1503 + } else { 1504 + entity.anInt123 = i5 + i7; 1505 + } 1506 + } 1393 1507 1394 - while (l1 > 0) { 1395 - int i3 = -50; 1396 - int l3 = -1; 1397 - for (int j5 = 0; j5 < l1; j5++) { 1398 - SceneSpawnRequest sceneSpawnRequest_2 = aSceneSpawnRequestArray477[j5]; 1399 - if (sceneSpawnRequest_2.anInt124 != anInt463) 1400 - if (sceneSpawnRequest_2.anInt123 > i3) { 1401 - i3 = sceneSpawnRequest_2.anInt123; 1402 - l3 = j5; 1403 - } else if (sceneSpawnRequest_2.anInt123 == i3) { 1404 - int j7 = sceneSpawnRequest_2.anInt115 - anInt470; 1405 - int k8 = sceneSpawnRequest_2.anInt116 - anInt472; 1406 - int l9 = aSceneSpawnRequestArray477[l3].anInt115 - anInt470; 1407 - int l10 = aSceneSpawnRequestArray477[l3].anInt116 - anInt472; 1408 - if (j7 * j7 + k8 * k8 > l9 * l9 + l10 * l10) 1409 - l3 = j5; 1410 - } 1411 - } 1508 + while (l1 > 0) { 1509 + int i3 = -50; 1510 + int l3 = -1; 1511 + for (int j5 = 0; j5 < l1; j5++) { 1512 + InteractiveObject entity = interactiveObjects[j5]; 1513 + if (entity.cycle != cycle) { 1514 + if (entity.anInt123 > i3) { 1515 + i3 = entity.anInt123; 1516 + l3 = j5; 1517 + } else if (entity.anInt123 == i3) { 1518 + int j7 = entity.worldX - cameraPosX; 1519 + int k8 = entity.worldY - cameraPosY; 1520 + int l9 = interactiveObjects[l3].worldX - cameraPosX; 1521 + int l10 = interactiveObjects[l3].worldY - cameraPosY; 1522 + if (j7 * j7 + k8 * k8 > l9 * l9 + l10 * l10) { 1523 + l3 = j5; 1524 + } 1525 + } 1526 + } 1527 + } 1412 1528 1413 - if (l3 == -1) 1414 - break; 1415 - SceneSpawnRequest sceneSpawnRequest_3 = aSceneSpawnRequestArray477[l3]; 1416 - sceneSpawnRequest_3.anInt124 = anInt463; 1417 - if (!method290(l, sceneSpawnRequest_3.x, sceneSpawnRequest_3.anInt120, sceneSpawnRequest_3.y, sceneSpawnRequest_3.anInt122, 1418 - sceneSpawnRequest_3.aRenderable601.modelHeight)) 1419 - sceneSpawnRequest_3.aRenderable601.renderAtPoint(sceneSpawnRequest_3.anInt118, anInt473, anInt474, anInt475, 1420 - anInt476, sceneSpawnRequest_3.anInt115 - anInt470, sceneSpawnRequest_3.anInt114 - anInt471, 1421 - sceneSpawnRequest_3.anInt116 - anInt472, sceneSpawnRequest_3.anInt125); 1422 - for (int k7 = sceneSpawnRequest_3.x; k7 <= sceneSpawnRequest_3.anInt120; k7++) { 1423 - for (int l8 = sceneSpawnRequest_3.y; l8 <= sceneSpawnRequest_3.anInt122; l8++) { 1424 - SceneTile class50_sub3_22 = aclass50_sub3[k7][l8]; 1425 - if (class50_sub3_22.anInt1415 != 0) 1426 - aClass6_492.insertBack(class50_sub3_22); 1427 - else if ((k7 != i || l8 != j) && class50_sub3_22.aBoolean1413) 1428 - aClass6_492.insertBack(class50_sub3_22); 1429 - } 1529 + if (l3 == -1) { 1530 + break; 1531 + } 1532 + InteractiveObject entity = interactiveObjects[l3]; 1533 + entity.cycle = cycle; 1534 + if (!isAreaOccluded(entity.tileLeft, entity.tileRight, entity.tileTop, entity.tileBottom, level, 1535 + entity.renderable.modelHeight)) { 1536 + entity.renderable.renderAtPoint(entity.rotation, curveSineY, curveCosineY, curveSineX, 1537 + curveCosineX, entity.worldX - cameraPosX, entity.worldZ - cameraPosZ, 1538 + entity.worldY - cameraPosY, entity.uid); 1539 + } 1540 + for (int _x = entity.tileLeft; _x <= entity.tileRight; _x++) { 1541 + for (int _y = entity.tileTop; _y <= entity.tileBottom; _y++) { 1542 + SceneTile tile = tiles[_x][_y]; 1543 + if (tile.wallCullDirection != 0) { 1544 + tileList.pushBack(tile); 1545 + } else if ((_x != x || _y != y) && tile.visible) { 1546 + tileList.pushBack(tile); 1547 + } 1548 + } 1430 1549 1431 - } 1550 + } 1432 1551 1433 - } 1434 - if (class50_sub3_1.aBoolean1414) 1435 - continue; 1436 - } catch (Exception _ex) { 1437 - class50_sub3_1.aBoolean1414 = false; 1438 - } 1439 - if (!class50_sub3_1.aBoolean1413 || class50_sub3_1.anInt1415 != 0) 1440 - continue; 1441 - if (i <= anInt468 && i > anInt464) { 1442 - SceneTile class50_sub3_8 = aclass50_sub3[i - 1][j]; 1443 - if (class50_sub3_8 != null && class50_sub3_8.aBoolean1413) 1444 - continue; 1445 - } 1446 - if (i >= anInt468 && i < anInt465 - 1) { 1447 - SceneTile class50_sub3_9 = aclass50_sub3[i + 1][j]; 1448 - if (class50_sub3_9 != null && class50_sub3_9.aBoolean1413) 1449 - continue; 1450 - } 1451 - if (j <= anInt469 && j > anInt466) { 1452 - SceneTile class50_sub3_10 = aclass50_sub3[i][j - 1]; 1453 - if (class50_sub3_10 != null && class50_sub3_10.aBoolean1413) 1454 - continue; 1455 - } 1456 - if (j >= anInt469 && j < anInt467 - 1) { 1457 - SceneTile class50_sub3_11 = aclass50_sub3[i][j + 1]; 1458 - if (class50_sub3_11 != null && class50_sub3_11.aBoolean1413) 1459 - continue; 1460 - } 1461 - class50_sub3_1.aBoolean1413 = false; 1462 - anInt461--; 1463 - CameraAngle cameraAngle = class50_sub3_1.cameraAngle; 1464 - if (cameraAngle != null && cameraAngle.anInt180 != 0) { 1465 - if (cameraAngle.aRenderable151 != null) 1466 - cameraAngle.aRenderable151.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1467 - cameraAngle.y - anInt470, cameraAngle.x - anInt471 - cameraAngle.anInt180, 1468 - cameraAngle.z - anInt472, cameraAngle.anInt179); 1469 - if (cameraAngle.aRenderable152 != null) 1470 - cameraAngle.aRenderable152.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1471 - cameraAngle.y - anInt470, cameraAngle.x - anInt471 - cameraAngle.anInt180, 1472 - cameraAngle.z - anInt472, cameraAngle.anInt179); 1473 - if (cameraAngle.aRenderable150 != null) 1474 - cameraAngle.aRenderable150.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1475 - cameraAngle.y - anInt470, cameraAngle.x - anInt471 - cameraAngle.anInt180, 1476 - cameraAngle.z - anInt472, cameraAngle.anInt179); 1477 - } 1478 - if (class50_sub3_1.anInt1418 != 0) { 1479 - WallDecoration wallDecoration = class50_sub3_1.wallDecoration; 1480 - if (wallDecoration != null && !method289(l, i, j, wallDecoration.renderable.modelHeight)) 1481 - if ((wallDecoration.faceUnknown & class50_sub3_1.anInt1418) != 0) 1482 - wallDecoration.renderable.renderAtPoint(wallDecoration.face, anInt473, anInt474, anInt475, 1483 - anInt476, wallDecoration.y - anInt470, wallDecoration.plane - anInt471, wallDecoration.x 1484 - - anInt472, wallDecoration.hash); 1485 - else if ((wallDecoration.faceUnknown & 0x300) != 0) { 1486 - int l2 = wallDecoration.y - anInt470; 1487 - int j3 = wallDecoration.plane - anInt471; 1488 - int i4 = wallDecoration.x - anInt472; 1489 - int k5 = wallDecoration.face; 1490 - int j6; 1491 - if (k5 == 1 || k5 == 2) 1492 - j6 = -l2; 1493 - else 1494 - j6 = l2; 1495 - int l7; 1496 - if (k5 == 2 || k5 == 3) 1497 - l7 = -i4; 1498 - else 1499 - l7 = i4; 1500 - if ((wallDecoration.faceUnknown & 0x100) != 0 && l7 >= j6) { 1501 - int i9 = l2 + anIntArray478[k5]; 1502 - int i10 = i4 + anIntArray479[k5]; 1503 - wallDecoration.renderable.renderAtPoint(k5 * 512 + 256, anInt473, anInt474, anInt475, 1504 - anInt476, i9, j3, i10, wallDecoration.hash); 1505 - } 1506 - if ((wallDecoration.faceUnknown & 0x200) != 0 && l7 <= j6) { 1507 - int j9 = l2 + anIntArray480[k5]; 1508 - int j10 = i4 + anIntArray481[k5]; 1509 - wallDecoration.renderable.renderAtPoint(k5 * 512 + 1280 & 0x7ff, anInt473, anInt474, 1510 - anInt475, anInt476, j9, j3, j10, wallDecoration.hash); 1511 - } 1512 - } 1513 - Wall wall_2 = class50_sub3_1.wall; 1514 - if (wall_2 != null) { 1515 - if ((wall_2.face & class50_sub3_1.anInt1418) != 0 && !method288(l, i, j, wall_2.face)) 1516 - wall_2.aRenderable770.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1517 - wall_2.x - anInt470, wall_2.plane - anInt471, wall_2.y 1518 - - anInt472, wall_2.hash); 1519 - if ((wall_2.faceUnknown & class50_sub3_1.anInt1418) != 0 && !method288(l, i, j, wall_2.faceUnknown)) 1520 - wall_2.aRenderable769.renderAtPoint(0, anInt473, anInt474, anInt475, anInt476, 1521 - wall_2.x - anInt470, wall_2.plane - anInt471, wall_2.y 1522 - - anInt472, wall_2.hash); 1523 - } 1524 - } 1525 - if (k < anInt452 - 1) { 1526 - SceneTile class50_sub3_12 = tiles[k + 1][i][j]; 1527 - if (class50_sub3_12 != null && class50_sub3_12.aBoolean1413) 1528 - aClass6_492.insertBack(class50_sub3_12); 1529 - } 1530 - if (i < anInt468) { 1531 - SceneTile class50_sub3_13 = aclass50_sub3[i + 1][j]; 1532 - if (class50_sub3_13 != null && class50_sub3_13.aBoolean1413) 1533 - aClass6_492.insertBack(class50_sub3_13); 1534 - } 1535 - if (j < anInt469) { 1536 - SceneTile class50_sub3_14 = aclass50_sub3[i][j + 1]; 1537 - if (class50_sub3_14 != null && class50_sub3_14.aBoolean1413) 1538 - aClass6_492.insertBack(class50_sub3_14); 1539 - } 1540 - if (i > anInt468) { 1541 - SceneTile class50_sub3_15 = aclass50_sub3[i - 1][j]; 1542 - if (class50_sub3_15 != null && class50_sub3_15.aBoolean1413) 1543 - aClass6_492.insertBack(class50_sub3_15); 1544 - } 1545 - if (j > anInt469) { 1546 - SceneTile class50_sub3_16 = aclass50_sub3[i][j - 1]; 1547 - if (class50_sub3_16 != null && class50_sub3_16.aBoolean1413) 1548 - aClass6_492.insertBack(class50_sub3_16); 1549 - } 1550 - } while (true); 1551 - } 1552 + } 1553 + if (groundTile.drawEntities) { 1554 + continue; 1555 + } 1556 + } catch (Exception _ex) { 1557 + groundTile.drawEntities = false; 1558 + } 1559 + } 1560 + if (!groundTile.visible || groundTile.wallCullDirection != 0) { 1561 + continue; 1562 + } 1563 + if (x <= cameraPositionTileX && x > currentPositionX) { 1564 + SceneTile tile = tiles[x - 1][y]; 1565 + if (tile != null && tile.visible) { 1566 + continue; 1567 + } 1568 + } 1569 + if (x >= cameraPositionTileX && x < mapBoundsX - 1) { 1570 + SceneTile tile = tiles[x + 1][y]; 1571 + if (tile != null && tile.visible) { 1572 + continue; 1573 + } 1574 + } 1575 + if (y <= cameraPositionTileY && y > currentPositionY) { 1576 + SceneTile tile = tiles[x][y - 1]; 1577 + if (tile != null && tile.visible) { 1578 + continue; 1579 + } 1580 + } 1581 + if (y >= cameraPositionTileY && y < mapBoundsY - 1) { 1582 + SceneTile tile = tiles[x][y + 1]; 1583 + if (tile != null && tile.visible) { 1584 + continue; 1585 + } 1586 + } 1587 + groundTile.visible = false; 1588 + anInt461--; 1589 + GroundItemTile groundItemTile = groundTile.groundItemTile; 1590 + if (groundItemTile != null && groundItemTile.anInt180 != 0) { 1591 + if (groundItemTile.secondGroundItem != null) { 1592 + groundItemTile.secondGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1593 + groundItemTile.x - cameraPosX, groundItemTile.z - cameraPosZ - groundItemTile.anInt180, 1594 + groundItemTile.y - cameraPosY, groundItemTile.uid); 1595 + } 1596 + if (groundItemTile.thirdGroundItem != null) { 1597 + groundItemTile.thirdGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1598 + groundItemTile.x - cameraPosX, groundItemTile.z - cameraPosZ - groundItemTile.anInt180, 1599 + groundItemTile.y - cameraPosY, groundItemTile.uid); 1600 + } 1601 + if (groundItemTile.firstGroundItem != null) { 1602 + groundItemTile.firstGroundItem.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1603 + groundItemTile.x - cameraPosX, groundItemTile.z - cameraPosZ - groundItemTile.anInt180, 1604 + groundItemTile.y - cameraPosY, groundItemTile.uid); 1605 + } 1606 + } 1607 + if (groundTile.wallDrawFlags != 0) { 1608 + WallDecoration wallDecoration = groundTile.wallDecoration; 1609 + if (wallDecoration != null && !isOccluded(level, x, y, wallDecoration.renderable.modelHeight)) { 1610 + if ((wallDecoration.configBits & groundTile.wallDrawFlags) != 0) { 1611 + wallDecoration.renderable.renderAtPoint(wallDecoration.face, curveSineY, curveCosineY, curveSineX, 1612 + curveCosineX, wallDecoration.x - cameraPosX, wallDecoration.z - cameraPosZ, wallDecoration.y 1613 + - cameraPosY, wallDecoration.uid); 1614 + } else if ((wallDecoration.configBits & 0x300) != 0) { 1615 + int l2 = wallDecoration.x - cameraPosX; 1616 + int j3 = wallDecoration.z - cameraPosZ; 1617 + int i4 = wallDecoration.y - cameraPosY; 1618 + int k5 = wallDecoration.face; 1619 + int j6; 1620 + if (k5 == 1 || k5 == 2) { 1621 + j6 = -l2; 1622 + } else { 1623 + j6 = l2; 1624 + } 1625 + int l7; 1626 + if (k5 == 2 || k5 == 3) { 1627 + l7 = -i4; 1628 + } else { 1629 + l7 = i4; 1630 + } 1631 + if ((wallDecoration.configBits & 0x100) != 0 && l7 >= j6) { 1632 + int i9 = l2 + faceOffsetX2[k5]; 1633 + int i10 = i4 + faceOffsetY2[k5]; 1634 + wallDecoration.renderable.renderAtPoint(k5 * 512 + 256, curveSineY, curveCosineY, curveSineX, 1635 + curveCosineX, i9, j3, i10, wallDecoration.uid); 1636 + } 1637 + if ((wallDecoration.configBits & 0x200) != 0 && l7 <= j6) { 1638 + int j9 = l2 + faceOffsetX3[k5]; 1639 + int j10 = i4 + faceOffsetY3[k5]; 1640 + wallDecoration.renderable.renderAtPoint(k5 * 512 + 1280 & 0x7ff, curveSineY, curveCosineY, 1641 + curveSineX, curveCosineX, j9, j3, j10, wallDecoration.uid); 1642 + } 1643 + } 1644 + } 1645 + Wall wallObject = groundTile.wall; 1646 + if (wallObject != null) { 1647 + if ((wallObject.orientation2 & groundTile.wallDrawFlags) != 0 && !isWallOccluded(x, y, level, wallObject.orientation2)) { 1648 + wallObject.secondary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1649 + wallObject.x - cameraPosX, wallObject.z - cameraPosZ, wallObject.y 1650 + - cameraPosY, wallObject.uid); 1651 + } 1652 + if ((wallObject.orientation & groundTile.wallDrawFlags) != 0 && !isWallOccluded(x, y, level, wallObject.orientation)) { 1653 + wallObject.primary.renderAtPoint(0, curveSineY, curveCosineY, curveSineX, curveCosineX, 1654 + wallObject.x - cameraPosX, wallObject.z - cameraPosZ, wallObject.y 1655 + - cameraPosY, wallObject.uid); 1656 + } 1657 + } 1658 + } 1659 + if (z < mapSizeZ - 1) { 1660 + SceneTile tile = groundArray[z + 1][x][y]; 1661 + if (tile != null && tile.visible) { 1662 + tileList.pushBack(tile); 1663 + } 1664 + } 1665 + if (x < cameraPositionTileX) { 1666 + SceneTile tile = tiles[x + 1][y]; 1667 + if (tile != null && tile.visible) { 1668 + tileList.pushBack(tile); 1669 + } 1670 + } 1671 + if (y < cameraPositionTileY) { 1672 + SceneTile tile = tiles[x][y + 1]; 1673 + if (tile != null && tile.visible) { 1674 + tileList.pushBack(tile); 1675 + } 1676 + } 1677 + if (x > cameraPositionTileX) { 1678 + SceneTile tile = tiles[x - 1][y]; 1679 + if (tile != null && tile.visible) { 1680 + tileList.pushBack(tile); 1681 + } 1682 + } 1683 + if (y > cameraPositionTileY) { 1684 + SceneTile tile = tiles[x][y - 1]; 1685 + if (tile != null && tile.visible) { 1686 + tileList.pushBack(tile); 1687 + } 1688 + } 1689 + } while (true); 1690 + } 1552 1691 1553 - public void method282(GenericTile genericTile, int i, int j, int k, int l, int i1, int j1, int k1) { 1554 - int l1; 1555 - int i2 = l1 = (j1 << 7) - anInt470; 1556 - int j2; 1557 - int k2 = j2 = (k1 << 7) - anInt472; 1558 - int l2; 1559 - int i3 = l2 = i2 + 128; 1560 - int j3; 1561 - int k3 = j3 = k2 + 128; 1562 - int l3 = anIntArrayArrayArray455[i][j1][k1] - anInt471; 1563 - int i4 = anIntArrayArrayArray455[i][j1 + 1][k1] - anInt471; 1564 - int j4 = anIntArrayArrayArray455[i][j1 + 1][k1 + 1] - anInt471; 1565 - int k4 = anIntArrayArrayArray455[i][j1][k1 + 1] - anInt471; 1566 - int l4 = k2 * l + i2 * i1 >> 16; 1567 - k2 = k2 * i1 - i2 * l >> 16; 1568 - i2 = l4; 1569 - l4 = l3 * k - k2 * j >> 16; 1570 - k2 = l3 * j + k2 * k >> 16; 1571 - l3 = l4; 1572 - if (k2 < 50) 1573 - return; 1574 - l4 = j2 * l + i3 * i1 >> 16; 1575 - j2 = j2 * i1 - i3 * l >> 16; 1576 - i3 = l4; 1577 - l4 = i4 * k - j2 * j >> 16; 1578 - j2 = i4 * j + j2 * k >> 16; 1579 - i4 = l4; 1580 - if (j2 < 50) 1581 - return; 1582 - l4 = k3 * l + l2 * i1 >> 16; 1583 - k3 = k3 * i1 - l2 * l >> 16; 1584 - l2 = l4; 1585 - l4 = j4 * k - k3 * j >> 16; 1586 - k3 = j4 * j + k3 * k >> 16; 1587 - j4 = l4; 1588 - if (k3 < 50) 1589 - return; 1590 - l4 = j3 * l + l1 * i1 >> 16; 1591 - j3 = j3 * i1 - l1 * l >> 16; 1592 - l1 = l4; 1593 - l4 = k4 * k - j3 * j >> 16; 1594 - j3 = k4 * j + j3 * k >> 16; 1595 - k4 = l4; 1596 - if (j3 < 50) 1597 - return; 1598 - int i5 = Rasterizer3D.centerX + (i2 << 9) / k2; 1599 - int j5 = Rasterizer3D.centerY + (l3 << 9) / k2; 1600 - int k5 = Rasterizer3D.centerX + (i3 << 9) / j2; 1601 - int l5 = Rasterizer3D.centerY + (i4 << 9) / j2; 1602 - int i6 = Rasterizer3D.centerX + (l2 << 9) / k3; 1603 - int j6 = Rasterizer3D.centerY + (j4 << 9) / k3; 1604 - int k6 = Rasterizer3D.centerX + (l1 << 9) / j3; 1605 - int l6 = Rasterizer3D.centerY + (k4 << 9) / j3; 1606 - Rasterizer3D.anInt1531 = 0; 1607 - if ((i6 - k6) * (l5 - l6) - (j6 - l6) * (k5 - k6) > 0) { 1608 - Rasterizer3D.aBoolean1528 = false; 1609 - if (i6 < 0 || k6 < 0 || k5 < 0 || i6 > Rasterizer.virtualBottomX || k6 > Rasterizer.virtualBottomX 1610 - || k5 > Rasterizer.virtualBottomX) 1611 - Rasterizer3D.aBoolean1528 = true; 1612 - if (aBoolean482 && method285(anInt483, anInt484, j6, l6, l5, i6, k6, k5)) { 1613 - clickedTileX = j1; 1614 - anInt486 = k1; 1615 - } 1616 - if (genericTile.texture == -1) { 1617 - if (genericTile.anInt97 != 0xbc614e) 1618 - Rasterizer3D.method503(j6, l6, l5, i6, k6, k5, genericTile.anInt97, genericTile.anInt98, 1619 - genericTile.anInt96); 1620 - } else if (!lowMemory) { 1621 - if (genericTile.flat) 1622 - Rasterizer3D.method507(j6, l6, l5, i6, k6, k5, genericTile.anInt97, genericTile.anInt98, 1623 - genericTile.anInt96, i2, i3, l1, l3, i4, k4, k2, j2, j3, genericTile.texture); 1624 - else 1625 - Rasterizer3D.method507(j6, l6, l5, i6, k6, k5, genericTile.anInt97, genericTile.anInt98, 1626 - genericTile.anInt96, l2, l1, i3, j4, k4, i4, k3, j3, j2, genericTile.texture); 1627 - } else { 1628 - int i7 = anIntArray500[genericTile.texture]; 1629 - Rasterizer3D.method503(j6, l6, l5, i6, k6, k5, method284(genericTile.anInt97, i7, 0), method284( 1630 - genericTile.anInt98, i7, 0), method284(genericTile.anInt96, i7, 0)); 1631 - } 1632 - } 1633 - if ((i5 - k5) * (l6 - l5) - (j5 - l5) * (k6 - k5) > 0) { 1634 - Rasterizer3D.aBoolean1528 = false; 1635 - if (i5 < 0 || k5 < 0 || k6 < 0 || i5 > Rasterizer.virtualBottomX || k5 > Rasterizer.virtualBottomX 1636 - || k6 > Rasterizer.virtualBottomX) 1637 - Rasterizer3D.aBoolean1528 = true; 1638 - if (aBoolean482 && method285(anInt483, anInt484, j5, l5, l6, i5, k5, k6)) { 1639 - clickedTileX = j1; 1640 - anInt486 = k1; 1641 - } 1642 - if (genericTile.texture == -1) { 1643 - if (genericTile.anInt95 != 0xbc614e) { 1644 - Rasterizer3D.method503(j5, l5, l6, i5, k5, k6, genericTile.anInt95, genericTile.anInt96, 1645 - genericTile.anInt98); 1646 - return; 1647 - } 1648 - } else { 1649 - if (!lowMemory) { 1650 - Rasterizer3D.method507(j5, l5, l6, i5, k5, k6, genericTile.anInt95, genericTile.anInt96, 1651 - genericTile.anInt98, i2, i3, l1, l3, i4, k4, k2, j2, j3, genericTile.texture); 1652 - return; 1653 - } 1654 - int j7 = anIntArray500[genericTile.texture]; 1655 - Rasterizer3D.method503(j5, l5, l6, i5, k5, k6, method284(genericTile.anInt95, j7, 0), method284( 1656 - genericTile.anInt96, j7, 0), method284(genericTile.anInt98, j7, 0)); 1657 - } 1658 - } 1659 - } 1692 + private void renderPlainTile(GenericTile plainTile, int tileX, int tileY, int tileZ, int sinX, int cosineX, int sinY, int cosineY) { 1693 + int xC; 1694 + int xA = xC = (tileX << 7) - cameraPosX; 1695 + int yB; 1696 + int yA = yB = (tileY << 7) - cameraPosY; 1697 + int xD; 1698 + int xB = xD = xA + 128; 1699 + int yC; 1700 + int yD = yC = yA + 128; 1701 + int zA = heightMap[tileZ][tileX][tileY] - cameraPosZ; 1702 + int zB = heightMap[tileZ][tileX + 1][tileY] - cameraPosZ; 1703 + int zC = heightMap[tileZ][tileX + 1][tileY + 1] - cameraPosZ; 1704 + int zD = heightMap[tileZ][tileX][tileY + 1] - cameraPosZ; 1705 + int temp = yA * sinX + xA * cosineX >> 16; 1706 + yA = yA * cosineX - xA * sinX >> 16; 1707 + xA = temp; 1708 + temp = zA * cosineY - yA * sinY >> 16; 1709 + yA = zA * sinY + yA * cosineY >> 16; 1710 + zA = temp; 1711 + if (yA < 50) { 1712 + return; 1713 + } 1714 + temp = yB * sinX + xB * cosineX >> 16; 1715 + yB = yB * cosineX - xB * sinX >> 16; 1716 + xB = temp; 1717 + temp = zB * cosineY - yB * sinY >> 16; 1718 + yB = zB * sinY + yB * cosineY >> 16; 1719 + zB = temp; 1720 + if (yB < 50) { 1721 + return; 1722 + } 1723 + temp = yD * sinX + xD * cosineX >> 16; 1724 + yD = yD * cosineX - xD * sinX >> 16; 1725 + xD = temp; 1726 + temp = zC * cosineY - yD * sinY >> 16; 1727 + yD = zC * sinY + yD * cosineY >> 16; 1728 + zC = temp; 1729 + if (yD < 50) { 1730 + return; 1731 + } 1732 + temp = yC * sinX + xC * cosineX >> 16; 1733 + yC = yC * cosineX - xC * sinX >> 16; 1734 + xC = temp; 1735 + temp = zD * cosineY - yC * sinY >> 16; 1736 + yC = zD * sinY + yC * cosineY >> 16; 1737 + zD = temp; 1738 + if (yC < 50) { 1739 + return; 1740 + } 1741 + int screenXA = Rasterizer3D.centerX + (xA << 9) / yA; 1742 + int screenYA = Rasterizer3D.centerY + (zA << 9) / yA; 1743 + int screenXB = Rasterizer3D.centerX + (xB << 9) / yB; 1744 + int screenYB = Rasterizer3D.centerY + (zB << 9) / yB; 1745 + int screenXD = Rasterizer3D.centerX + (xD << 9) / yD; 1746 + int screenYD = Rasterizer3D.centerY + (zC << 9) / yD; 1747 + int screenXC = Rasterizer3D.centerX + (xC << 9) / yC; 1748 + int screenYC = Rasterizer3D.centerY + (zD << 9) / yC; 1749 + Rasterizer3D.alpha = 0; 1750 + if ((screenXD - screenXC) * (screenYB - screenYC) - (screenYD - screenYC) * (screenXB - screenXC) > 0) { 1751 + Rasterizer3D.restrictEdges = screenXD < 0 || screenXC < 0 || screenXB < 0 || 1752 + screenXD > Rasterizer.virtualBottomX || 1753 + screenXC > Rasterizer.virtualBottomX || 1754 + screenXB > Rasterizer.virtualBottomX; 1755 + if (clicked && isMouseWithinTriangle(clickX, clickY, screenYD, screenYC, screenYB, screenXD, screenXC, screenXB)) { 1756 + clickedTileX = tileX; 1757 + clickedTileY = tileY; 1758 + } 1759 + if (plainTile.texture == -1) { 1760 + if (plainTile.colourD != 0xbc614e) { 1761 + Rasterizer3D.drawShadedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.colourC, 1762 + plainTile.colourB); 1763 + } 1764 + } else if (!lowMemory) { 1765 + if (plainTile.flat) { 1766 + Rasterizer3D.drawTexturedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.colourC, 1767 + plainTile.colourB, xA, xB, xC, zA, zB, zD, yA, yB, yC, plainTile.texture); 1768 + } else { 1769 + Rasterizer3D.drawTexturedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.colourC, 1770 + plainTile.colourB, xD, xC, xB, zC, zD, zB, yD, yC, yB, plainTile.texture); 1771 + } 1772 + } else { 1773 + int rgb = textureRGB[plainTile.texture]; 1774 + Rasterizer3D.drawShadedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, mixColours(rgb, plainTile.colourD), mixColours( 1775 + rgb, plainTile.colourC), mixColours(rgb, plainTile.colourB)); 1776 + } 1777 + } 1778 + if ((screenXA - screenXB) * (screenYC - screenYB) - (screenYA - screenYB) * (screenXC - screenXB) > 0) { 1779 + Rasterizer3D.restrictEdges = screenXA < 0 || screenXB < 0 || screenXC < 0 || screenXA > Rasterizer.virtualBottomX || screenXB > Rasterizer.virtualBottomX 1780 + || screenXC > Rasterizer.virtualBottomX; 1781 + if (clicked && isMouseWithinTriangle(clickX, clickY, screenYA, screenYB, screenYC, screenXA, screenXB, screenXC)) { 1782 + clickedTileX = tileX; 1783 + clickedTileY = tileY; 1784 + } 1785 + if (plainTile.texture == -1) { 1786 + if (plainTile.colourA != 0xbc614e) { 1787 + Rasterizer3D.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.colourB, 1788 + plainTile.colourC); 1789 + } 1790 + } else { 1791 + if (!lowMemory) { 1792 + Rasterizer3D.drawTexturedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.colourB, 1793 + plainTile.colourC, xA, xB, xC, zA, zB, zD, yA, yB, yC, plainTile.texture); 1794 + return; 1795 + } 1796 + int rgb = textureRGB[plainTile.texture]; 1797 + Rasterizer3D.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, mixColours(rgb, plainTile.colourA), mixColours( 1798 + rgb, plainTile.colourB), mixColours(rgb, plainTile.colourC)); 1799 + } 1800 + } 1801 + } 1660 1802 1661 - public void method283(int i, int j, ComplexTile complexTile, int k, int l, int i1, int j1, byte byte0) { 1662 - int k1 = complexTile.anIntArray403.length; 1663 - for (int l1 = 0; l1 < k1; l1++) { 1664 - int i2 = complexTile.anIntArray403[l1] - anInt470; 1665 - int k2 = complexTile.anIntArray404[l1] - anInt471; 1666 - int i3 = complexTile.anIntArray405[l1] - anInt472; 1667 - int k3 = i3 * j1 + i2 * j >> 16; 1668 - i3 = i3 * j - i2 * j1 >> 16; 1669 - i2 = k3; 1670 - k3 = k2 * i - i3 * k >> 16; 1671 - i3 = k2 * k + i3 * i >> 16; 1672 - k2 = k3; 1673 - if (i3 < 50) 1674 - return; 1675 - if (complexTile.anIntArray412 != null) { 1676 - ComplexTile.anIntArray420[l1] = i2; 1677 - ComplexTile.anIntArray421[l1] = k2; 1678 - ComplexTile.anIntArray422[l1] = i3; 1679 - } 1680 - ComplexTile.anIntArray418[l1] = Rasterizer3D.centerX + (i2 << 9) / i3; 1681 - ComplexTile.anIntArray419[l1] = Rasterizer3D.centerY + (k2 << 9) / i3; 1682 - } 1803 + private void renderShapedTile(ComplexTile shapedTile, int tileX, int tileY, int sineX, int cosineX, int sineY, int cosineY) { 1804 + int triangleCount = shapedTile.originalVertexX.length; 1805 + for (int triangle = 0; triangle < triangleCount; triangle++) { 1806 + int viewspaceX = shapedTile.originalVertexX[triangle] - cameraPosX; 1807 + int viewspaceY = shapedTile.originalVertexY[triangle] - cameraPosZ; 1808 + int viewspaceZ = shapedTile.originalVertexZ[triangle] - cameraPosY; 1809 + int temp = viewspaceZ * sineX + viewspaceX * cosineX >> 16; 1810 + viewspaceZ = viewspaceZ * cosineX - viewspaceX * sineX >> 16; 1811 + viewspaceX = temp; 1812 + temp = viewspaceY * cosineY - viewspaceZ * sineY >> 16; 1813 + viewspaceZ = viewspaceY * sineY + viewspaceZ * cosineY >> 16; 1814 + viewspaceY = temp; 1815 + if (viewspaceZ < 50) { 1816 + return; 1817 + } 1818 + if (shapedTile.triangleTexture != null) { 1819 + ComplexTile.viewspaceX[triangle] = viewspaceX; 1820 + ComplexTile.viewspaceY[triangle] = viewspaceY; 1821 + ComplexTile.viewspaceZ[triangle] = viewspaceZ; 1822 + } 1823 + ComplexTile.screenX[triangle] = Rasterizer3D.centerX + (viewspaceX << 9) / viewspaceZ; 1824 + ComplexTile.screenY[triangle] = Rasterizer3D.centerY + (viewspaceY << 9) / viewspaceZ; 1825 + } 1683 1826 1684 - Rasterizer3D.anInt1531 = 0; 1685 - k1 = complexTile.anIntArray409.length; 1686 - if (byte0 != 3) 1687 - return; 1688 - for (int j2 = 0; j2 < k1; j2++) { 1689 - int l2 = complexTile.anIntArray409[j2]; 1690 - int j3 = complexTile.anIntArray410[j2]; 1691 - int l3 = complexTile.anIntArray411[j2]; 1692 - int i4 = ComplexTile.anIntArray418[l2]; 1693 - int j4 = ComplexTile.anIntArray418[j3]; 1694 - int k4 = ComplexTile.anIntArray418[l3]; 1695 - int l4 = ComplexTile.anIntArray419[l2]; 1696 - int i5 = ComplexTile.anIntArray419[j3]; 1697 - int j5 = ComplexTile.anIntArray419[l3]; 1698 - if ((i4 - j4) * (j5 - i5) - (l4 - i5) * (k4 - j4) > 0) { 1699 - Rasterizer3D.aBoolean1528 = false; 1700 - if (i4 < 0 || j4 < 0 || k4 < 0 || i4 > Rasterizer.virtualBottomX || j4 > Rasterizer.virtualBottomX 1701 - || k4 > Rasterizer.virtualBottomX) 1702 - Rasterizer3D.aBoolean1528 = true; 1703 - if (aBoolean482 && method285(anInt483, anInt484, l4, i5, j5, i4, j4, k4)) { 1704 - clickedTileX = i1; 1705 - anInt486 = l; 1706 - } 1707 - if (complexTile.anIntArray412 == null || complexTile.anIntArray412[j2] == -1) { 1708 - if (complexTile.anIntArray406[j2] != 0xbc614e) 1709 - Rasterizer3D.method503(l4, i5, j5, i4, j4, k4, complexTile.anIntArray406[j2], 1710 - complexTile.anIntArray407[j2], complexTile.anIntArray408[j2]); 1711 - } else if (!lowMemory) { 1712 - if (complexTile.aBoolean413) 1713 - Rasterizer3D.method507(l4, i5, j5, i4, j4, k4, complexTile.anIntArray406[j2], 1714 - complexTile.anIntArray407[j2], complexTile.anIntArray408[j2], ComplexTile.anIntArray420[0], 1715 - ComplexTile.anIntArray420[1], ComplexTile.anIntArray420[3], ComplexTile.anIntArray421[0], 1716 - ComplexTile.anIntArray421[1], ComplexTile.anIntArray421[3], ComplexTile.anIntArray422[0], 1717 - ComplexTile.anIntArray422[1], ComplexTile.anIntArray422[3], complexTile.anIntArray412[j2]); 1718 - else 1719 - Rasterizer3D.method507(l4, i5, j5, i4, j4, k4, complexTile.anIntArray406[j2], 1720 - complexTile.anIntArray407[j2], complexTile.anIntArray408[j2], ComplexTile.anIntArray420[l2], 1721 - ComplexTile.anIntArray420[j3], ComplexTile.anIntArray420[l3], ComplexTile.anIntArray421[l2], 1722 - ComplexTile.anIntArray421[j3], ComplexTile.anIntArray421[l3], ComplexTile.anIntArray422[l2], 1723 - ComplexTile.anIntArray422[j3], ComplexTile.anIntArray422[l3], complexTile.anIntArray412[j2]); 1724 - } else { 1725 - int k5 = anIntArray500[complexTile.anIntArray412[j2]]; 1726 - Rasterizer3D.method503(l4, i5, j5, i4, j4, k4, 1727 - method284(complexTile.anIntArray406[j2], k5, 0), method284(complexTile.anIntArray407[j2], k5, 0), 1728 - method284(complexTile.anIntArray408[j2], k5, 0)); 1729 - } 1730 - } 1731 - } 1827 + Rasterizer3D.alpha = 0; 1828 + triangleCount = shapedTile.triangleA.length; 1829 + for (int tirangle = 0; tirangle < triangleCount; tirangle++) { 1830 + int a = shapedTile.triangleA[tirangle]; 1831 + int b = shapedTile.triangleB[tirangle]; 1832 + int c = shapedTile.triangleC[tirangle]; 1833 + int screenXA = ComplexTile.screenX[a]; 1834 + int screenXB = ComplexTile.screenX[b]; 1835 + int screenXC = ComplexTile.screenX[c]; 1836 + int screenYA = ComplexTile.screenY[a]; 1837 + int screenYB = ComplexTile.screenY[b]; 1838 + int screenYC = ComplexTile.screenY[c]; 1839 + if ((screenXA - screenXB) * (screenYC - screenYB) - (screenYA - screenYB) * (screenXC - screenXB) > 0) { 1840 + Rasterizer3D.restrictEdges = screenXA < 0 || screenXB < 0 || screenXC < 0 || screenXA > Rasterizer.virtualBottomX || screenXB > Rasterizer.virtualBottomX 1841 + || screenXC > Rasterizer.virtualBottomX; 1842 + if (clicked && isMouseWithinTriangle(clickX, clickY, screenYA, screenYB, screenYC, screenXA, screenXB, screenXC)) { 1843 + clickedTileX = tileX; 1844 + clickedTileY = tileY; 1845 + } 1846 + if (shapedTile.triangleTexture == null || shapedTile.triangleTexture[tirangle] == -1) { 1847 + if (shapedTile.triangleHSLA[tirangle] != 0xbc614e) { 1848 + Rasterizer3D.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, shapedTile.triangleHSLA[tirangle], 1849 + shapedTile.triangleHSLB[tirangle], shapedTile.triangleHSLC[tirangle]); 1850 + } 1851 + } else if (!lowMemory) { 1852 + if (shapedTile.flat) { 1853 + Rasterizer3D.drawTexturedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, shapedTile.triangleHSLA[tirangle], 1854 + shapedTile.triangleHSLB[tirangle], shapedTile.triangleHSLC[tirangle], ComplexTile.viewspaceX[0], 1855 + ComplexTile.viewspaceX[1], ComplexTile.viewspaceX[3], ComplexTile.viewspaceY[0], 1856 + ComplexTile.viewspaceY[1], ComplexTile.viewspaceY[3], ComplexTile.viewspaceZ[0], 1857 + ComplexTile.viewspaceZ[1], ComplexTile.viewspaceZ[3], shapedTile.triangleTexture[tirangle]); 1858 + } else { 1859 + Rasterizer3D.drawTexturedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, shapedTile.triangleHSLA[tirangle], 1860 + shapedTile.triangleHSLB[tirangle], shapedTile.triangleHSLC[tirangle], ComplexTile.viewspaceX[a], 1861 + ComplexTile.viewspaceX[b], ComplexTile.viewspaceX[c], ComplexTile.viewspaceY[a], 1862 + ComplexTile.viewspaceY[b], ComplexTile.viewspaceY[c], ComplexTile.viewspaceZ[a], 1863 + ComplexTile.viewspaceZ[b], ComplexTile.viewspaceZ[c], shapedTile.triangleTexture[tirangle]); 1864 + } 1865 + } else { 1866 + int k5 = textureRGB[shapedTile.triangleTexture[tirangle]]; 1867 + Rasterizer3D.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, 1868 + mixColours(k5, shapedTile.triangleHSLA[tirangle]), mixColours(k5, shapedTile.triangleHSLB[tirangle]), 1869 + mixColours(k5, shapedTile.triangleHSLC[tirangle])); 1870 + } 1871 + } 1872 + } 1732 1873 1733 - } 1874 + } 1734 1875 1735 - public int method284(int i, int j, int k) { 1736 - i = 127 - i; 1737 - i = (i * (j & 0x7f)) / 160; 1738 - if (i < 2) 1739 - i = 2; 1740 - else if (i > 126) 1741 - i = 126; 1742 - return (j & 0xff80) + i; 1743 - } 1876 + private int mixColours(int colourA, int colourB) { 1877 + colourB = 127 - colourB; 1878 + colourB = (colourB * (colourA & 0x7f)) / 160; 1879 + if (colourB < 2) { 1880 + colourB = 2; 1881 + } else if (colourB > 126) { 1882 + colourB = 126; 1883 + } 1884 + return (colourA & 0xff80) + colourB; 1885 + } 1744 1886 1745 - public boolean method285(int i, int j, int k, int l, int i1, int j1, int k1, int l1) { 1746 - if (j < k && j < l && j < i1) 1747 - return false; 1748 - if (j > k && j > l && j > i1) 1749 - return false; 1750 - if (i < j1 && i < k1 && i < l1) 1751 - return false; 1752 - if (i > j1 && i > k1 && i > l1) 1753 - return false; 1754 - int i2 = (j - k) * (k1 - j1) - (i - j1) * (l - k); 1755 - int j2 = (j - i1) * (j1 - l1) - (i - l1) * (k - i1); 1756 - int k2 = (j - l) * (l1 - k1) - (i - k1) * (i1 - l); 1757 - return i2 * k2 > 0 && k2 * j2 > 0; 1758 - } 1887 + private boolean isMouseWithinTriangle(int mouseX, int mouseY, int pointAY, int pointBY, int pointCY, int pointAX, int pointBX, int pointCX) { 1888 + if (mouseY < pointAY && mouseY < pointBY && mouseY < pointCY) { 1889 + return false; 1890 + } 1891 + if (mouseY > pointAY && mouseY > pointBY && mouseY > pointCY) { 1892 + return false; 1893 + } 1894 + if (mouseX < pointAX && mouseX < pointBX && mouseX < pointCX) { 1895 + return false; 1896 + } 1897 + if (mouseX > pointAX && mouseX > pointBX && mouseX > pointCX) { 1898 + return false; 1899 + } 1900 + int b1 = (mouseY - pointAY) * (pointBX - pointAX) - (mouseX - pointAX) * (pointBY - pointAY); 1901 + int b2 = (mouseY - pointCY) * (pointAX - pointCX) - (mouseX - pointCX) * (pointAY - pointCY); 1902 + int b3 = (mouseY - pointBY) * (pointCX - pointBX) - (mouseX - pointBX) * (pointCY - pointBY); 1903 + return b1 * b3 > 0 && b3 * b2 > 0; 1904 + } 1759 1905 1760 - public void method286() { 1761 - int j = anIntArray488[anInt462]; 1762 - SceneCluster aclass39[] = aSceneClusterArrayArray554[anInt462]; 1763 - anInt490 = 0; 1764 - for (int k = 0; k < j; k++) { 1765 - SceneCluster class39 = aclass39[k]; 1766 - if (class39.anInt679 == 1) { 1767 - int l = (class39.anInt675 - anInt468) + 25; 1768 - if (l < 0 || l > 50) 1769 - continue; 1770 - int k1 = (class39.anInt677 - anInt469) + 25; 1771 - if (k1 < 0) 1772 - k1 = 0; 1773 - int j2 = (class39.anInt678 - anInt469) + 25; 1774 - if (j2 > 50) 1775 - j2 = 50; 1776 - boolean flag = false; 1777 - while (k1 <= j2) 1778 - if (aBooleanArrayArray507[l][k1++]) { 1779 - flag = true; 1780 - break; 1781 - } 1782 - if (!flag) 1783 - continue; 1784 - int j3 = anInt470 - class39.anInt680; 1785 - if (j3 > 32) { 1786 - class39.anInt686 = 1; 1787 - } else { 1788 - if (j3 >= -32) 1789 - continue; 1790 - class39.anInt686 = 2; 1791 - j3 = -j3; 1792 - } 1793 - class39.anInt689 = (class39.anInt682 - anInt472 << 8) / j3; 1794 - class39.anInt690 = (class39.anInt683 - anInt472 << 8) / j3; 1795 - class39.anInt691 = (class39.anInt684 - anInt471 << 8) / j3; 1796 - class39.anInt692 = (class39.anInt685 - anInt471 << 8) / j3; 1797 - aClass39Array491[anInt490++] = class39; 1798 - continue; 1799 - } 1800 - if (class39.anInt679 == 2) { 1801 - int i1 = (class39.anInt677 - anInt469) + 25; 1802 - if (i1 < 0 || i1 > 50) 1803 - continue; 1804 - int l1 = (class39.anInt675 - anInt468) + 25; 1805 - if (l1 < 0) 1806 - l1 = 0; 1807 - int k2 = (class39.anInt676 - anInt468) + 25; 1808 - if (k2 > 50) 1809 - k2 = 50; 1810 - boolean flag1 = false; 1811 - while (l1 <= k2) 1812 - if (aBooleanArrayArray507[l1++][i1]) { 1813 - flag1 = true; 1814 - break; 1815 - } 1816 - if (!flag1) 1817 - continue; 1818 - int k3 = anInt472 - class39.anInt682; 1819 - if (k3 > 32) { 1820 - class39.anInt686 = 3; 1821 - } else { 1822 - if (k3 >= -32) 1823 - continue; 1824 - class39.anInt686 = 4; 1825 - k3 = -k3; 1826 - } 1827 - class39.anInt687 = (class39.anInt680 - anInt470 << 8) / k3; 1828 - class39.anInt688 = (class39.anInt681 - anInt470 << 8) / k3; 1829 - class39.anInt691 = (class39.anInt684 - anInt471 << 8) / k3; 1830 - class39.anInt692 = (class39.anInt685 - anInt471 << 8) / k3; 1831 - aClass39Array491[anInt490++] = class39; 1832 - } else if (class39.anInt679 == 4) { 1833 - int j1 = class39.anInt684 - anInt471; 1834 - if (j1 > 128) { 1835 - int i2 = (class39.anInt677 - anInt469) + 25; 1836 - if (i2 < 0) 1837 - i2 = 0; 1838 - int l2 = (class39.anInt678 - anInt469) + 25; 1839 - if (l2 > 50) 1840 - l2 = 50; 1841 - if (i2 <= l2) { 1842 - int i3 = (class39.anInt675 - anInt468) + 25; 1843 - if (i3 < 0) 1844 - i3 = 0; 1845 - int l3 = (class39.anInt676 - anInt468) + 25; 1846 - if (l3 > 50) 1847 - l3 = 50; 1848 - boolean flag2 = false; 1849 - label0: for (int i4 = i3; i4 <= l3; i4++) { 1850 - for (int j4 = i2; j4 <= l2; j4++) { 1851 - if (!aBooleanArrayArray507[i4][j4]) 1852 - continue; 1853 - flag2 = true; 1854 - break label0; 1855 - } 1906 + private void processCulling() { 1907 + int clusterCount = cullingClusterPointer[plane]; 1908 + SceneCluster[] clusters = cullingClusters[plane]; 1909 + processedCullingClustersPointer = 0; 1910 + for (int c = 0; c < clusterCount; c++) { 1911 + SceneCluster cluster = clusters[c]; 1912 + if (cluster.searchMask == 1) { 1913 + int distanceFromCameraStartX = (cluster.tileStartX - cameraPositionTileX) + 25; 1914 + if (distanceFromCameraStartX < 0 || distanceFromCameraStartX > 50) { 1915 + continue; 1916 + } 1917 + int distanceFromCameraStartY = (cluster.tileStartY - cameraPositionTileY) + 25; 1918 + if (distanceFromCameraStartY < 0) { 1919 + distanceFromCameraStartY = 0; 1920 + } 1921 + int cameraPositionTileY = (cluster.tileEndY - Scene.cameraPositionTileY) + 25; 1922 + if (cameraPositionTileY > 50) { 1923 + cameraPositionTileY = 50; 1924 + } 1925 + boolean visible = false; 1926 + while (distanceFromCameraStartY <= cameraPositionTileY) { 1927 + if (TILE_VISIBILITY_MAP[distanceFromCameraStartX][distanceFromCameraStartY++]) { 1928 + visible = true; 1929 + break; 1930 + } 1931 + } 1932 + if (!visible) { 1933 + continue; 1934 + } 1935 + int realDistanceFromCameraStartX = cameraPosX - cluster.worldStartX; 1936 + if (realDistanceFromCameraStartX > 32) { 1937 + cluster.tileDistanceEnum = 1; 1938 + } else { 1939 + if (realDistanceFromCameraStartX >= -32) { 1940 + continue; 1941 + } 1942 + cluster.tileDistanceEnum = 2; 1943 + realDistanceFromCameraStartX = -realDistanceFromCameraStartX; 1944 + } 1945 + cluster.worldDistanceFromCameraStartY = (cluster.worldStartY - cameraPosY << 8) / realDistanceFromCameraStartX; 1946 + cluster.worldDistanceFromCameraEndY = (cluster.worldEndY - cameraPosY << 8) / realDistanceFromCameraStartX; 1947 + cluster.worldDistanceFromCameraStartZ = (cluster.worldEndZ - cameraPosZ << 8) / realDistanceFromCameraStartX; 1948 + cluster.worldDistanceFromCameraEndZ = (cluster.worldStartZ - cameraPosZ << 8) / realDistanceFromCameraStartX; 1949 + processedCullingClusters[processedCullingClustersPointer++] = cluster; 1950 + continue; 1951 + } 1952 + if (cluster.searchMask == 2) { 1953 + int distanceFromCameraStartY = (cluster.tileStartY - cameraPositionTileY) + 25; 1954 + if (distanceFromCameraStartY < 0 || distanceFromCameraStartY > 50) { 1955 + continue; 1956 + } 1957 + int distanceFromCameraStartX = (cluster.tileStartX - cameraPositionTileX) + 25; 1958 + if (distanceFromCameraStartX < 0) { 1959 + distanceFromCameraStartX = 0; 1960 + } 1961 + int distanceFromCameraEndX = (cluster.tileEndX - cameraPositionTileX) + 25; 1962 + if (distanceFromCameraEndX > 50) { 1963 + distanceFromCameraEndX = 50; 1964 + } 1965 + boolean visible = false; 1966 + while (distanceFromCameraStartX <= distanceFromCameraEndX) { 1967 + if (TILE_VISIBILITY_MAP[distanceFromCameraStartX++][distanceFromCameraStartY]) { 1968 + visible = true; 1969 + break; 1970 + } 1971 + } 1972 + if (!visible) { 1973 + continue; 1974 + } 1975 + int realDistanceFromCameraStartY = cameraPosY - cluster.worldStartY; 1976 + if (realDistanceFromCameraStartY > 32) { 1977 + cluster.tileDistanceEnum = 3; 1978 + } else { 1979 + if (realDistanceFromCameraStartY >= -32) { 1980 + continue; 1981 + } 1982 + cluster.tileDistanceEnum = 4; 1983 + realDistanceFromCameraStartY = -realDistanceFromCameraStartY; 1984 + } 1985 + cluster.worldDistanceFromCameraStartX = (cluster.worldStartX - cameraPosX << 8) / realDistanceFromCameraStartY; 1986 + cluster.worldDistanceFromCameraEndX = (cluster.worldEndX - cameraPosX << 8) / realDistanceFromCameraStartY; 1987 + cluster.worldDistanceFromCameraStartZ = (cluster.worldEndZ - cameraPosZ << 8) / realDistanceFromCameraStartY; 1988 + cluster.worldDistanceFromCameraEndZ = (cluster.worldStartZ - cameraPosZ << 8) / realDistanceFromCameraStartY; 1989 + processedCullingClusters[processedCullingClustersPointer++] = cluster; 1990 + } else if (cluster.searchMask == 4) { 1991 + int realDistanceFromCameraStartZ = cluster.worldEndZ - cameraPosZ; 1992 + if (realDistanceFromCameraStartZ > 128) { 1993 + int distanceFromCameraStartY = (cluster.tileStartY - cameraPositionTileY) + 25; 1994 + if (distanceFromCameraStartY < 0) { 1995 + distanceFromCameraStartY = 0; 1996 + } 1997 + int distanceFromCameraEndY = (cluster.tileEndY - cameraPositionTileY) + 25; 1998 + if (distanceFromCameraEndY > 50) { 1999 + distanceFromCameraEndY = 50; 2000 + } 2001 + if (distanceFromCameraStartY <= distanceFromCameraEndY) { 2002 + int distanceFromCameraStartX = (cluster.tileStartX - cameraPositionTileX) + 25; 2003 + if (distanceFromCameraStartX < 0) { 2004 + distanceFromCameraStartX = 0; 2005 + } 2006 + int distanceFromCameraEndX = (cluster.tileEndX - cameraPositionTileX) + 25; 2007 + if (distanceFromCameraEndX > 50) { 2008 + distanceFromCameraEndX = 50; 2009 + } 2010 + boolean visible = false; 2011 + label0: 2012 + for (int x = distanceFromCameraStartX; x <= distanceFromCameraEndX; x++) { 2013 + for (int y = distanceFromCameraStartY; y <= distanceFromCameraEndY; y++) { 2014 + if (!TILE_VISIBILITY_MAP[x][y]) { 2015 + continue; 2016 + } 2017 + visible = true; 2018 + break label0; 2019 + } 1856 2020 1857 - } 2021 + } 1858 2022 1859 - if (flag2) { 1860 - class39.anInt686 = 5; 1861 - class39.anInt687 = (class39.anInt680 - anInt470 << 8) / j1; 1862 - class39.anInt688 = (class39.anInt681 - anInt470 << 8) / j1; 1863 - class39.anInt689 = (class39.anInt682 - anInt472 << 8) / j1; 1864 - class39.anInt690 = (class39.anInt683 - anInt472 << 8) / j1; 1865 - aClass39Array491[anInt490++] = class39; 1866 - } 1867 - } 1868 - } 1869 - } 1870 - } 2023 + if (visible) { 2024 + cluster.tileDistanceEnum = 5; 2025 + cluster.worldDistanceFromCameraStartX = (cluster.worldStartX - cameraPosX << 8) / realDistanceFromCameraStartZ; 2026 + cluster.worldDistanceFromCameraEndX = (cluster.worldEndX - cameraPosX << 8) / realDistanceFromCameraStartZ; 2027 + cluster.worldDistanceFromCameraStartY = (cluster.worldStartY - cameraPosY << 8) / realDistanceFromCameraStartZ; 2028 + cluster.worldDistanceFromCameraEndY = (cluster.worldEndY - cameraPosY << 8) / realDistanceFromCameraStartZ; 2029 + processedCullingClusters[processedCullingClustersPointer++] = cluster; 2030 + } 2031 + } 2032 + } 2033 + } 2034 + } 1871 2035 1872 - } 2036 + } 1873 2037 1874 - public boolean method287(int i, int j, int k) { 1875 - int l = anIntArrayArrayArray460[i][j][k]; 1876 - if (l == -anInt463) 1877 - return false; 1878 - if (l == anInt463) 1879 - return true; 1880 - int i1 = j << 7; 1881 - int j1 = k << 7; 1882 - if (method291(i1 + 1, anIntArrayArrayArray455[i][j][k], j1 + 1) 1883 - && method291((i1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][k], j1 + 1) 1884 - && method291((i1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][k + 1], (j1 + 128) - 1) 1885 - && method291(i1 + 1, anIntArrayArrayArray455[i][j][k + 1], (j1 + 128) - 1)) { 1886 - anIntArrayArrayArray460[i][j][k] = anInt463; 1887 - return true; 1888 - } else { 1889 - anIntArrayArrayArray460[i][j][k] = -anInt463; 1890 - return false; 1891 - } 1892 - } 2038 + private boolean isTileOccluded(int x, int y, int z) { 2039 + int l = anIntArrayArrayArray460[z][x][y]; 2040 + if (l == -cycle) { 2041 + return false; 2042 + } 2043 + if (l == cycle) { 2044 + return true; 2045 + } 2046 + int worldX = x << 7; 2047 + int worldY = y << 7; 2048 + if (method291(worldX + 1, worldY + 1, heightMap[z][x][y]) 2049 + && method291((worldX + 128) - 1, worldY + 1, heightMap[z][x + 1][y]) 2050 + && method291((worldX + 128) - 1, (worldY + 128) - 1, heightMap[z][x + 1][y + 1]) 2051 + && method291(worldX + 1, (worldY + 128) - 1, heightMap[z][x][y + 1])) { 2052 + anIntArrayArrayArray460[z][x][y] = cycle; 2053 + return true; 2054 + } else { 2055 + anIntArrayArrayArray460[z][x][y] = -cycle; 2056 + return false; 2057 + } 2058 + } 1893 2059 1894 - public boolean method288(int i, int j, int k, int l) { 1895 - if (!method287(i, j, k)) 1896 - return false; 1897 - int i1 = j << 7; 1898 - int j1 = k << 7; 1899 - int k1 = anIntArrayArrayArray455[i][j][k] - 1; 1900 - int l1 = k1 - 120; 1901 - int i2 = k1 - 230; 1902 - int j2 = k1 - 238; 1903 - if (l < 16) { 1904 - if (l == 1) { 1905 - if (i1 > anInt470) { 1906 - if (!method291(i1, k1, j1)) 1907 - return false; 1908 - if (!method291(i1, k1, j1 + 128)) 1909 - return false; 1910 - } 1911 - if (i > 0) { 1912 - if (!method291(i1, l1, j1)) 1913 - return false; 1914 - if (!method291(i1, l1, j1 + 128)) 1915 - return false; 1916 - } 1917 - if (!method291(i1, i2, j1)) 1918 - return false; 1919 - return method291(i1, i2, j1 + 128); 1920 - } 1921 - if (l == 2) { 1922 - if (j1 < anInt472) { 1923 - if (!method291(i1, k1, j1 + 128)) 1924 - return false; 1925 - if (!method291(i1 + 128, k1, j1 + 128)) 1926 - return false; 1927 - } 1928 - if (i > 0) { 1929 - if (!method291(i1, l1, j1 + 128)) 1930 - return false; 1931 - if (!method291(i1 + 128, l1, j1 + 128)) 1932 - return false; 1933 - } 1934 - if (!method291(i1, i2, j1 + 128)) 1935 - return false; 1936 - return method291(i1 + 128, i2, j1 + 128); 1937 - } 1938 - if (l == 4) { 1939 - if (i1 < anInt470) { 1940 - if (!method291(i1 + 128, k1, j1)) 1941 - return false; 1942 - if (!method291(i1 + 128, k1, j1 + 128)) 1943 - return false; 1944 - } 1945 - if (i > 0) { 1946 - if (!method291(i1 + 128, l1, j1)) 1947 - return false; 1948 - if (!method291(i1 + 128, l1, j1 + 128)) 1949 - return false; 1950 - } 1951 - if (!method291(i1 + 128, i2, j1)) 1952 - return false; 1953 - return method291(i1 + 128, i2, j1 + 128); 1954 - } 1955 - if (l == 8) { 1956 - if (j1 > anInt472) { 1957 - if (!method291(i1, k1, j1)) 1958 - return false; 1959 - if (!method291(i1 + 128, k1, j1)) 1960 - return false; 1961 - } 1962 - if (i > 0) { 1963 - if (!method291(i1, l1, j1)) 1964 - return false; 1965 - if (!method291(i1 + 128, l1, j1)) 1966 - return false; 1967 - } 1968 - if (!method291(i1, i2, j1)) 1969 - return false; 1970 - return method291(i1 + 128, i2, j1); 1971 - } 1972 - } 1973 - if (!method291(i1 + 64, j2, j1 + 64)) 1974 - return false; 1975 - if (l == 16) 1976 - return method291(i1, i2, j1 + 128); 1977 - if (l == 32) 1978 - return method291(i1 + 128, i2, j1 + 128); 1979 - if (l == 64) 1980 - return method291(i1 + 128, i2, j1); 1981 - if (l == 128) { 1982 - return method291(i1, i2, j1); 1983 - } else { 1984 - System.out.println("Warning unsupported wall type"); 1985 - return true; 1986 - } 1987 - } 2060 + private boolean isWallOccluded(int x, int y, int level, int wallType) { 2061 + if (!isTileOccluded(x, y, level)) { 2062 + return false; 2063 + } 2064 + int posX = x << 7; 2065 + int posY = y << 7; 2066 + int posZ = heightMap[level][x][y] - 1; 2067 + int z1 = posZ - 120; 2068 + int z2 = posZ - 230; 2069 + int z3 = posZ - 238; 2070 + if (wallType < 16) { 2071 + if (wallType == 1) { 2072 + if (posX > cameraPosX) { 2073 + if (!method291(posX, posY, posZ)) { 2074 + return false; 2075 + } 2076 + if (!method291(posX, posY + 128, posZ)) { 2077 + return false; 2078 + } 2079 + } 2080 + if (level > 0) { 2081 + if (!method291(posX, posY, z1)) { 2082 + return false; 2083 + } 2084 + if (!method291(posX, posY + 128, z1)) { 2085 + return false; 2086 + } 2087 + } 2088 + if (!method291(posX, posY, z2)) { 2089 + return false; 2090 + } 2091 + return method291(posX, posY + 128, z2); 2092 + } 2093 + if (wallType == 2) { 2094 + if (posY < cameraPosY) { 2095 + if (!method291(posX, posY + 128, posZ)) { 2096 + return false; 2097 + } 2098 + if (!method291(posX + 128, posY + 128, posZ)) { 2099 + return false; 2100 + } 2101 + } 2102 + if (level > 0) { 2103 + if (!method291(posX, posY + 128, z1)) { 2104 + return false; 2105 + } 2106 + if (!method291(posX + 128, posY + 128, z1)) { 2107 + return false; 2108 + } 2109 + } 2110 + if (!method291(posX, posY + 128, z2)) { 2111 + return false; 2112 + } 2113 + return method291(posX + 128, posY + 128, z2); 2114 + } 2115 + if (wallType == 4) { 2116 + if (posX < cameraPosX) { 2117 + if (!method291(posX + 128, posY, posZ)) { 2118 + return false; 2119 + } 2120 + if (!method291(posX + 128, posY + 128, posZ)) { 2121 + return false; 2122 + } 2123 + } 2124 + if (level > 0) { 2125 + if (!method291(posX + 128, posY, z1)) { 2126 + return false; 2127 + } 2128 + if (!method291(posX + 128, posY + 128, z1)) { 2129 + return false; 2130 + } 2131 + } 2132 + if (!method291(posX + 128, posY, z2)) { 2133 + return false; 2134 + } 2135 + return method291(posX + 128, posY + 128, z2); 2136 + } 2137 + if (wallType == 8) { 2138 + if (posY > cameraPosY) { 2139 + if (!method291(posX, posY, posZ)) { 2140 + return false; 2141 + } 2142 + if (!method291(posX + 128, posY, posZ)) { 2143 + return false; 2144 + } 2145 + } 2146 + if (level > 0) { 2147 + if (!method291(posX, posY, z1)) { 2148 + return false; 2149 + } 2150 + if (!method291(posX + 128, posY, z1)) { 2151 + return false; 2152 + } 2153 + } 2154 + if (!method291(posX, posY, z2)) { 2155 + return false; 2156 + } 2157 + return method291(posX + 128, posY, z2); 2158 + } 2159 + } 2160 + if (!method291(posX + 64, posY + 64, z3)) { 2161 + return false; 2162 + } 2163 + if (wallType == 16) { 2164 + return method291(posX, posY + 128, z2); 2165 + } 2166 + if (wallType == 32) { 2167 + return method291(posX + 128, posY + 128, z2); 2168 + } 2169 + if (wallType == 64) { 2170 + return method291(posX + 128, posY, z2); 2171 + } 2172 + if (wallType == 128) { 2173 + return method291(posX, posY, z2); 2174 + } else { 2175 + System.out.println("Warning unsupported wall type"); 2176 + return true; 2177 + } 2178 + } 1988 2179 1989 - public boolean method289(int i, int j, int k, int l) { 1990 - if (!method287(i, j, k)) 1991 - return false; 1992 - int i1 = j << 7; 1993 - int j1 = k << 7; 1994 - return method291(i1 + 1, anIntArrayArrayArray455[i][j][k] - l, j1 + 1) 1995 - && method291((i1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][k] - l, j1 + 1) 1996 - && method291((i1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][k + 1] - l, (j1 + 128) - 1) 1997 - && method291(i1 + 1, anIntArrayArrayArray455[i][j][k + 1] - l, (j1 + 128) - 1); 1998 - } 2180 + private boolean isOccluded(int i, int j, int k, int l) { 2181 + if (!isTileOccluded(j, k, i)) { 2182 + return false; 2183 + } 2184 + int i1 = j << 7; 2185 + int j1 = k << 7; 2186 + return method291(i1 + 1, j1 + 1, heightMap[i][j][k] - l) 2187 + && method291((i1 + 128) - 1, j1 + 1, heightMap[i][j + 1][k] - l) 2188 + && method291((i1 + 128) - 1, (j1 + 128) - 1, heightMap[i][j + 1][k + 1] - l) 2189 + && method291(i1 + 1, (j1 + 128) - 1, heightMap[i][j][k + 1] - l); 2190 + } 1999 2191 2000 - public boolean method290(int i, int j, int k, int l, int i1, int j1) { 2001 - if (j == k && l == i1) { 2002 - if (!method287(i, j, l)) 2003 - return false; 2004 - int k1 = j << 7; 2005 - int i2 = l << 7; 2006 - return method291(k1 + 1, anIntArrayArrayArray455[i][j][l] - j1, i2 + 1) 2007 - && method291((k1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][l] - j1, i2 + 1) 2008 - && method291((k1 + 128) - 1, anIntArrayArrayArray455[i][j + 1][l + 1] - j1, (i2 + 128) - 1) 2009 - && method291(k1 + 1, anIntArrayArrayArray455[i][j][l + 1] - j1, (i2 + 128) - 1); 2010 - } 2011 - for (int l1 = j; l1 <= k; l1++) { 2012 - for (int j2 = l; j2 <= i1; j2++) 2013 - if (anIntArrayArrayArray460[i][l1][j2] == -anInt463) 2014 - return false; 2192 + private boolean isAreaOccluded(int minimumX, int maximumX, int minimumY, int maximumY, int z, int offsetZ) { 2193 + if (minimumX == maximumX && minimumY == maximumY) { 2194 + if (!isTileOccluded(minimumX, minimumY, z)) { 2195 + return false; 2196 + } 2197 + int _x = minimumX << 7; 2198 + int _y = minimumY << 7; 2199 + return method291(_x + 1, _y + 1, heightMap[z][minimumX][minimumY] - offsetZ) 2200 + && method291((_x + 128) - 1, _y + 1, heightMap[z][minimumX + 1][minimumY] - offsetZ) 2201 + && method291((_x + 128) - 1, (_y + 128) - 1, heightMap[z][minimumX + 1][minimumY + 1] - offsetZ) 2202 + && method291(_x + 1, (_y + 128) - 1, heightMap[z][minimumX][minimumY + 1] - offsetZ); 2203 + } 2204 + for (int x = minimumX; x <= maximumX; x++) { 2205 + for (int y = minimumY; y <= maximumY; y++) { 2206 + if (anIntArrayArrayArray460[z][x][y] == -cycle) { 2207 + return false; 2208 + } 2209 + } 2015 2210 2016 - } 2211 + } 2017 2212 2018 - int k2 = (j << 7) + 1; 2019 - int l2 = (l << 7) + 2; 2020 - int i3 = anIntArrayArrayArray455[i][j][l] - j1; 2021 - if (!method291(k2, i3, l2)) 2022 - return false; 2023 - int j3 = (k << 7) - 1; 2024 - if (!method291(j3, i3, l2)) 2025 - return false; 2026 - int k3 = (i1 << 7) - 1; 2027 - if (!method291(k2, i3, k3)) 2028 - return false; 2029 - return method291(j3, i3, k3); 2030 - } 2213 + int _x = (minimumX << 7) + 1; 2214 + int _y = (minimumY << 7) + 2; 2215 + int _z = heightMap[z][minimumX][minimumY] - offsetZ; 2216 + if (!method291(_x, _y, _z)) { 2217 + return false; 2218 + } 2219 + int j3 = (maximumX << 7) - 1; 2220 + if (!method291(j3, _y, _z)) { 2221 + return false; 2222 + } 2223 + int k3 = (maximumY << 7) - 1; 2224 + if (!method291(_x, k3, _z)) { 2225 + return false; 2226 + } 2227 + return method291(j3, k3, _z); 2228 + } 2031 2229 2032 - public boolean method291(int i, int j, int k) { 2033 - for (int l = 0; l < anInt490; l++) { 2034 - SceneCluster class39 = aClass39Array491[l]; 2035 - if (class39.anInt686 == 1) { 2036 - int i1 = class39.anInt680 - i; 2037 - if (i1 > 0) { 2038 - int j2 = class39.anInt682 + (class39.anInt689 * i1 >> 8); 2039 - int k3 = class39.anInt683 + (class39.anInt690 * i1 >> 8); 2040 - int l4 = class39.anInt684 + (class39.anInt691 * i1 >> 8); 2041 - int i6 = class39.anInt685 + (class39.anInt692 * i1 >> 8); 2042 - if (k >= j2 && k <= k3 && j >= l4 && j <= i6) 2043 - return true; 2044 - } 2045 - } else if (class39.anInt686 == 2) { 2046 - int j1 = i - class39.anInt680; 2047 - if (j1 > 0) { 2048 - int k2 = class39.anInt682 + (class39.anInt689 * j1 >> 8); 2049 - int l3 = class39.anInt683 + (class39.anInt690 * j1 >> 8); 2050 - int i5 = class39.anInt684 + (class39.anInt691 * j1 >> 8); 2051 - int j6 = class39.anInt685 + (class39.anInt692 * j1 >> 8); 2052 - if (k >= k2 && k <= l3 && j >= i5 && j <= j6) 2053 - return true; 2054 - } 2055 - } else if (class39.anInt686 == 3) { 2056 - int k1 = class39.anInt682 - k; 2057 - if (k1 > 0) { 2058 - int l2 = class39.anInt680 + (class39.anInt687 * k1 >> 8); 2059 - int i4 = class39.anInt681 + (class39.anInt688 * k1 >> 8); 2060 - int j5 = class39.anInt684 + (class39.anInt691 * k1 >> 8); 2061 - int k6 = class39.anInt685 + (class39.anInt692 * k1 >> 8); 2062 - if (i >= l2 && i <= i4 && j >= j5 && j <= k6) 2063 - return true; 2064 - } 2065 - } else if (class39.anInt686 == 4) { 2066 - int l1 = k - class39.anInt682; 2067 - if (l1 > 0) { 2068 - int i3 = class39.anInt680 + (class39.anInt687 * l1 >> 8); 2069 - int j4 = class39.anInt681 + (class39.anInt688 * l1 >> 8); 2070 - int k5 = class39.anInt684 + (class39.anInt691 * l1 >> 8); 2071 - int l6 = class39.anInt685 + (class39.anInt692 * l1 >> 8); 2072 - if (i >= i3 && i <= j4 && j >= k5 && j <= l6) 2073 - return true; 2074 - } 2075 - } else if (class39.anInt686 == 5) { 2076 - int i2 = j - class39.anInt684; 2077 - if (i2 > 0) { 2078 - int j3 = class39.anInt680 + (class39.anInt687 * i2 >> 8); 2079 - int k4 = class39.anInt681 + (class39.anInt688 * i2 >> 8); 2080 - int l5 = class39.anInt682 + (class39.anInt689 * i2 >> 8); 2081 - int i7 = class39.anInt683 + (class39.anInt690 * i2 >> 8); 2082 - if (i >= j3 && i <= k4 && k >= l5 && k <= i7) 2083 - return true; 2084 - } 2085 - } 2086 - } 2230 + private boolean method291(int posX, int posY, int posZ) { 2231 + for (int c = 0; c < processedCullingClustersPointer; c++) { 2232 + SceneCluster cluster = processedCullingClusters[c]; 2233 + if (cluster.tileDistanceEnum == 1) { 2234 + int i1 = cluster.worldStartX - posX; 2235 + if (i1 > 0) { 2236 + int j2 = cluster.worldStartY + (cluster.worldDistanceFromCameraStartY * i1 >> 8); 2237 + int k3 = cluster.worldEndY + (cluster.worldDistanceFromCameraEndY * i1 >> 8); 2238 + int l4 = cluster.worldEndZ + (cluster.worldDistanceFromCameraStartZ * i1 >> 8); 2239 + int i6 = cluster.worldStartZ + (cluster.worldDistanceFromCameraEndZ * i1 >> 8); 2240 + if (posY >= j2 && posY <= k3 && posZ >= l4 && posZ <= i6) { 2241 + return true; 2242 + } 2243 + } 2244 + } else if (cluster.tileDistanceEnum == 2) { 2245 + int j1 = posX - cluster.worldStartX; 2246 + if (j1 > 0) { 2247 + int k2 = cluster.worldStartY + (cluster.worldDistanceFromCameraStartY * j1 >> 8); 2248 + int l3 = cluster.worldEndY + (cluster.worldDistanceFromCameraEndY * j1 >> 8); 2249 + int i5 = cluster.worldEndZ + (cluster.worldDistanceFromCameraStartZ * j1 >> 8); 2250 + int j6 = cluster.worldStartZ + (cluster.worldDistanceFromCameraEndZ * j1 >> 8); 2251 + if (posY >= k2 && posY <= l3 && posZ >= i5 && posZ <= j6) { 2252 + return true; 2253 + } 2254 + } 2255 + } else if (cluster.tileDistanceEnum == 3) { 2256 + int k1 = cluster.worldStartY - posY; 2257 + if (k1 > 0) { 2258 + int l2 = cluster.worldStartX + (cluster.worldDistanceFromCameraStartX * k1 >> 8); 2259 + int i4 = cluster.worldEndX + (cluster.worldDistanceFromCameraEndX * k1 >> 8); 2260 + int j5 = cluster.worldEndZ + (cluster.worldDistanceFromCameraStartZ * k1 >> 8); 2261 + int k6 = cluster.worldStartZ + (cluster.worldDistanceFromCameraEndZ * k1 >> 8); 2262 + if (posX >= l2 && posX <= i4 && posZ >= j5 && posZ <= k6) { 2263 + return true; 2264 + } 2265 + } 2266 + } else if (cluster.tileDistanceEnum == 4) { 2267 + int l1 = posY - cluster.worldStartY; 2268 + if (l1 > 0) { 2269 + int i3 = cluster.worldStartX + (cluster.worldDistanceFromCameraStartX * l1 >> 8); 2270 + int j4 = cluster.worldEndX + (cluster.worldDistanceFromCameraEndX * l1 >> 8); 2271 + int k5 = cluster.worldEndZ + (cluster.worldDistanceFromCameraStartZ * l1 >> 8); 2272 + int l6 = cluster.worldStartZ + (cluster.worldDistanceFromCameraEndZ * l1 >> 8); 2273 + if (posX >= i3 && posX <= j4 && posZ >= k5 && posZ <= l6) { 2274 + return true; 2275 + } 2276 + } 2277 + } else if (cluster.tileDistanceEnum == 5) { 2278 + int i2 = posZ - cluster.worldEndZ; 2279 + if (i2 > 0) { 2280 + int j3 = cluster.worldStartX + (cluster.worldDistanceFromCameraStartX * i2 >> 8); 2281 + int k4 = cluster.worldEndX + (cluster.worldDistanceFromCameraEndX * i2 >> 8); 2282 + int l5 = cluster.worldStartY + (cluster.worldDistanceFromCameraStartY * i2 >> 8); 2283 + int i7 = cluster.worldEndY + (cluster.worldDistanceFromCameraEndY * i2 >> 8); 2284 + if (posX >= j3 && posX <= k4 && posY >= l5 && posY <= i7) { 2285 + return true; 2286 + } 2287 + } 2288 + } 2289 + } 2087 2290 2088 - return false; 2089 - } 2291 + return false; 2292 + } 2090 2293 2091 2294 } 2092 2295 //TODO:Needs more refactoring
+18 -18
src/com/jagex/runescape/scene/SceneCluster.java
··· 2 2 3 3 public class SceneCluster { 4 4 5 - public int anInt675; 6 - public int anInt676; 7 - public int anInt677; 8 - public int anInt678; 9 - public int anInt679; 10 - public int anInt680; 11 - public int anInt681; 12 - public int anInt682; 13 - public int anInt683; 14 - public int anInt684; 15 - public int anInt685; 16 - public int anInt686; 17 - public int anInt687; 18 - public int anInt688; 19 - public int anInt689; 20 - public int anInt690; 21 - public int anInt691; 22 - public int anInt692; 5 + public int tileStartX; 6 + public int tileEndX; 7 + public int tileStartY; 8 + public int tileEndY; 9 + public int searchMask; 10 + public int worldStartX; 11 + public int worldEndX; 12 + public int worldStartY; 13 + public int worldEndY; 14 + public int worldEndZ; 15 + public int worldStartZ; 16 + public int tileDistanceEnum; 17 + public int worldDistanceFromCameraStartX; 18 + public int worldDistanceFromCameraEndX; 19 + public int worldDistanceFromCameraStartY; 20 + public int worldDistanceFromCameraEndY; 21 + public int worldDistanceFromCameraStartZ; 22 + public int worldDistanceFromCameraEndZ; 23 23 }
-21
src/com/jagex/runescape/scene/SceneSpawnRequest.java
··· 1 - package com.jagex.runescape.scene; 2 - 3 - import com.jagex.runescape.media.renderable.Renderable; 4 - 5 - public class SceneSpawnRequest { 6 - 7 - public int anInt113; 8 - public int anInt114; 9 - public int anInt115; 10 - public int anInt116; 11 - public Renderable aRenderable601; 12 - public int anInt118; 13 - public int x; 14 - public int anInt120; 15 - public int y; 16 - public int anInt122; 17 - public int anInt123; 18 - public int anInt124; 19 - public int anInt125; 20 - public byte config; 21 - }
+212 -214
src/com/jagex/runescape/scene/tile/ComplexTile.java
··· 2 2 3 3 public class ComplexTile { 4 4 5 - public ComplexTile(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, int i3, 6 - int j3, int k3, int l3, int i4, int j4, int k4, int l4) { 7 - aBoolean413 = true; 8 - if (l != j3 || l != k || l != i) 9 - aBoolean413 = false; 10 - anInt414 = i3; 11 - anInt415 = l4; 12 - anInt416 = i4; 13 - anInt417 = l1; 5 + public ComplexTile(int tileX, int yA, int yB, int yC, int yD, int tileZ, int rotation, int texture, int shape, int cA, int cAA, int cB, int cBA, int cC, int cCA, int cD, int cDA, int overlayRGB, 6 + int underlayRGB) { 7 + flat = yA == yB && yA == yD && yA == yC; 8 + this.shape = shape; 9 + this.rotation = rotation; 10 + this.underlayRGB = underlayRGB; 11 + this.overlayRGB = overlayRGB; 14 12 char c = '\200'; 15 13 int i5 = c / 2; 16 14 int j5 = c / 4; 17 15 int k5 = (c * 3) / 4; 18 - int ai[] = anIntArrayArray426[i3]; 19 - int l5 = ai.length; 20 - anIntArray403 = new int[l5]; 21 - anIntArray404 = new int[l5]; 22 - anIntArray405 = new int[l5]; 23 - int ai1[] = new int[l5]; 24 - int ai2[] = new int[l5]; 25 - int i6 = i1 * c; 26 - int j6 = k4 * c; 27 - for (int k6 = 0; k6 < l5; k6++) { 28 - int l6 = ai[k6]; 29 - if ((l6 & 1) == 0 && l6 <= 8) 30 - l6 = (l6 - l4 - l4 - 1 & 7) + 1; 31 - if (l6 > 8 && l6 <= 12) 32 - l6 = (l6 - 9 - l4 & 3) + 9; 33 - if (l6 > 12 && l6 <= 16) 34 - l6 = (l6 - 13 - l4 & 3) + 13; 35 - int i7; 36 - int k7; 37 - int i8; 38 - int k8; 39 - int j9; 40 - if (l6 == 1) { 41 - i7 = i6; 42 - k7 = j6; 43 - i8 = l; 44 - k8 = l2; 45 - j9 = j; 46 - } else if (l6 == 2) { 47 - i7 = i6 + i5; 48 - k7 = j6; 49 - i8 = l + j3 >> 1; 50 - k8 = l2 + i2 >> 1; 51 - j9 = j + j4 >> 1; 52 - } else if (l6 == 3) { 53 - i7 = i6 + c; 54 - k7 = j6; 55 - i8 = j3; 56 - k8 = i2; 57 - j9 = j4; 58 - } else if (l6 == 4) { 59 - i7 = i6 + c; 60 - k7 = j6 + i5; 61 - i8 = j3 + k >> 1; 62 - k8 = i2 + j1 >> 1; 63 - j9 = j4 + j2 >> 1; 64 - } else if (l6 == 5) { 65 - i7 = i6 + c; 66 - k7 = j6 + c; 67 - i8 = k; 68 - k8 = j1; 69 - j9 = j2; 70 - } else if (l6 == 6) { 71 - i7 = i6 + i5; 72 - k7 = j6 + c; 73 - i8 = k + i >> 1; 74 - k8 = j1 + k1 >> 1; 75 - j9 = j2 + k3 >> 1; 76 - } else if (l6 == 7) { 77 - i7 = i6; 78 - k7 = j6 + c; 79 - i8 = i; 80 - k8 = k1; 81 - j9 = k3; 82 - } else if (l6 == 8) { 83 - i7 = i6; 84 - k7 = j6 + i5; 85 - i8 = i + l >> 1; 86 - k8 = k1 + l2 >> 1; 87 - j9 = k3 + j >> 1; 88 - } else if (l6 == 9) { 89 - i7 = i6 + i5; 90 - k7 = j6 + j5; 91 - i8 = l + j3 >> 1; 92 - k8 = l2 + i2 >> 1; 93 - j9 = j + j4 >> 1; 94 - } else if (l6 == 10) { 95 - i7 = i6 + k5; 96 - k7 = j6 + i5; 97 - i8 = j3 + k >> 1; 98 - k8 = i2 + j1 >> 1; 99 - j9 = j4 + j2 >> 1; 100 - } else if (l6 == 11) { 101 - i7 = i6 + i5; 102 - k7 = j6 + k5; 103 - i8 = k + i >> 1; 104 - k8 = j1 + k1 >> 1; 105 - j9 = j2 + k3 >> 1; 106 - } else if (l6 == 12) { 107 - i7 = i6 + j5; 108 - k7 = j6 + i5; 109 - i8 = i + l >> 1; 110 - k8 = k1 + l2 >> 1; 111 - j9 = k3 + j >> 1; 112 - } else if (l6 == 13) { 113 - i7 = i6 + j5; 114 - k7 = j6 + j5; 115 - i8 = l; 116 - k8 = l2; 117 - j9 = j; 118 - } else if (l6 == 14) { 119 - i7 = i6 + k5; 120 - k7 = j6 + j5; 121 - i8 = j3; 122 - k8 = i2; 123 - j9 = j4; 124 - } else if (l6 == 15) { 125 - i7 = i6 + k5; 126 - k7 = j6 + k5; 127 - i8 = k; 128 - k8 = j1; 129 - j9 = j2; 16 + int[] shapedTileMesh = shapedTilePointData[shape]; 17 + int shapedTileMeshLength = shapedTileMesh.length; 18 + originalVertexX = new int[shapedTileMeshLength]; 19 + originalVertexY = new int[shapedTileMeshLength]; 20 + originalVertexZ = new int[shapedTileMeshLength]; 21 + int[] vertexColourOverlay = new int[shapedTileMeshLength]; 22 + int[] vertexColourUnderlay = new int[shapedTileMeshLength]; 23 + int i6 = tileX * c; 24 + int j6 = tileZ * c; 25 + for (int vertex = 0; vertex < shapedTileMeshLength; vertex++) { 26 + int vertexType = shapedTileMesh[vertex]; 27 + if ((vertexType & 1) == 0 && vertexType <= 8) 28 + vertexType = (vertexType - rotation - rotation - 1 & 7) + 1; 29 + if (vertexType > 8 && vertexType <= 12) 30 + vertexType = (vertexType - 9 - rotation & 3) + 9; 31 + if (vertexType > 12 && vertexType <= 16) 32 + vertexType = (vertexType - 13 - rotation & 3) + 13; 33 + int vertexX; 34 + int vertexZ; 35 + int vertexY; 36 + int vertexCOverlay; 37 + int vertexCUnderlay; 38 + if (vertexType == 1) { 39 + vertexX = i6; 40 + vertexZ = j6; 41 + vertexY = yA; 42 + vertexCOverlay = cA; 43 + vertexCUnderlay = cAA; 44 + } else if (vertexType == 2) { 45 + vertexX = i6 + i5; 46 + vertexZ = j6; 47 + vertexY = yA + yB >> 1; 48 + vertexCOverlay = cA + cB >> 1; 49 + vertexCUnderlay = cAA + cBA >> 1; 50 + } else if (vertexType == 3) { 51 + vertexX = i6 + c; 52 + vertexZ = j6; 53 + vertexY = yB; 54 + vertexCOverlay = cB; 55 + vertexCUnderlay = cBA; 56 + } else if (vertexType == 4) { 57 + vertexX = i6 + c; 58 + vertexZ = j6 + i5; 59 + vertexY = yB + yD >> 1; 60 + vertexCOverlay = cB + cD >> 1; 61 + vertexCUnderlay = cBA + cDA >> 1; 62 + } else if (vertexType == 5) { 63 + vertexX = i6 + c; 64 + vertexZ = j6 + c; 65 + vertexY = yD; 66 + vertexCOverlay = cD; 67 + vertexCUnderlay = cDA; 68 + } else if (vertexType == 6) { 69 + vertexX = i6 + i5; 70 + vertexZ = j6 + c; 71 + vertexY = yD + yC >> 1; 72 + vertexCOverlay = cD + cC >> 1; 73 + vertexCUnderlay = cDA + cCA >> 1; 74 + } else if (vertexType == 7) { 75 + vertexX = i6; 76 + vertexZ = j6 + c; 77 + vertexY = yC; 78 + vertexCOverlay = cC; 79 + vertexCUnderlay = cCA; 80 + } else if (vertexType == 8) { 81 + vertexX = i6; 82 + vertexZ = j6 + i5; 83 + vertexY = yC + yA >> 1; 84 + vertexCOverlay = cC + cA >> 1; 85 + vertexCUnderlay = cCA + cAA >> 1; 86 + } else if (vertexType == 9) { 87 + vertexX = i6 + i5; 88 + vertexZ = j6 + j5; 89 + vertexY = yA + yB >> 1; 90 + vertexCOverlay = cA + cB >> 1; 91 + vertexCUnderlay = cAA + cBA >> 1; 92 + } else if (vertexType == 10) { 93 + vertexX = i6 + k5; 94 + vertexZ = j6 + i5; 95 + vertexY = yB + yD >> 1; 96 + vertexCOverlay = cB + cD >> 1; 97 + vertexCUnderlay = cBA + cDA >> 1; 98 + } else if (vertexType == 11) { 99 + vertexX = i6 + i5; 100 + vertexZ = j6 + k5; 101 + vertexY = yD + yC >> 1; 102 + vertexCOverlay = cD + cC >> 1; 103 + vertexCUnderlay = cDA + cCA >> 1; 104 + } else if (vertexType == 12) { 105 + vertexX = i6 + j5; 106 + vertexZ = j6 + i5; 107 + vertexY = yC + yA >> 1; 108 + vertexCOverlay = cC + cA >> 1; 109 + vertexCUnderlay = cCA + cAA >> 1; 110 + } else if (vertexType == 13) { 111 + vertexX = i6 + j5; 112 + vertexZ = j6 + j5; 113 + vertexY = yA; 114 + vertexCOverlay = cA; 115 + vertexCUnderlay = cAA; 116 + } else if (vertexType == 14) { 117 + vertexX = i6 + k5; 118 + vertexZ = j6 + j5; 119 + vertexY = yB; 120 + vertexCOverlay = cB; 121 + vertexCUnderlay = cBA; 122 + } else if (vertexType == 15) { 123 + vertexX = i6 + k5; 124 + vertexZ = j6 + k5; 125 + vertexY = yD; 126 + vertexCOverlay = cD; 127 + vertexCUnderlay = cDA; 130 128 } else { 131 - i7 = i6 + j5; 132 - k7 = j6 + k5; 133 - i8 = i; 134 - k8 = k1; 135 - j9 = k3; 129 + vertexX = i6 + j5; 130 + vertexZ = j6 + k5; 131 + vertexY = yC; 132 + vertexCOverlay = cC; 133 + vertexCUnderlay = cCA; 136 134 } 137 - anIntArray403[k6] = i7; 138 - anIntArray404[k6] = i8; 139 - anIntArray405[k6] = k7; 140 - ai1[k6] = k8; 141 - ai2[k6] = j9; 135 + originalVertexX[vertex] = vertexX; 136 + originalVertexY[vertex] = vertexY; 137 + originalVertexZ[vertex] = vertexZ; 138 + vertexColourOverlay[vertex] = vertexCOverlay; 139 + vertexColourUnderlay[vertex] = vertexCUnderlay; 142 140 } 143 141 144 - int ai3[] = anIntArrayArray427[i3]; 145 - int j7 = ai3.length / 4; 146 - anIntArray409 = new int[j7]; 147 - anIntArray410 = new int[j7]; 148 - anIntArray411 = new int[j7]; 149 - anIntArray406 = new int[j7]; 150 - anIntArray407 = new int[j7]; 151 - anIntArray408 = new int[j7]; 152 - if (l3 != -1) 153 - anIntArray412 = new int[j7]; 154 - int l7 = 0; 155 - for (int j8 = 0; j8 < j7; j8++) { 156 - int l8 = ai3[l7]; 157 - int k9 = ai3[l7 + 1]; 158 - int i10 = ai3[l7 + 2]; 159 - int j10 = ai3[l7 + 3]; 160 - l7 += 4; 161 - if (k9 < 4) 162 - k9 = k9 - l4 & 3; 163 - if (i10 < 4) 164 - i10 = i10 - l4 & 3; 165 - if (j10 < 4) 166 - j10 = j10 - l4 & 3; 167 - anIntArray409[j8] = k9; 168 - anIntArray410[j8] = i10; 169 - anIntArray411[j8] = j10; 170 - if (l8 == 0) { 171 - anIntArray406[j8] = ai1[k9]; 172 - anIntArray407[j8] = ai1[i10]; 173 - anIntArray408[j8] = ai1[j10]; 174 - if (anIntArray412 != null) 175 - anIntArray412[j8] = -1; 142 + int[] shapedTileElements = shapedTileElementData[shape]; 143 + int vertexCount = shapedTileElements.length / 4; 144 + triangleA = new int[vertexCount]; 145 + triangleB = new int[vertexCount]; 146 + triangleC = new int[vertexCount]; 147 + triangleHSLA = new int[vertexCount]; 148 + triangleHSLB = new int[vertexCount]; 149 + triangleHSLC = new int[vertexCount]; 150 + if (texture != -1) 151 + triangleTexture = new int[vertexCount]; 152 + int offset = 0; 153 + for (int vertex = 0; vertex < vertexCount; vertex++) { 154 + int overlayOrUnderlay = shapedTileElements[offset]; 155 + int idxA = shapedTileElements[offset + 1]; 156 + int idxB = shapedTileElements[offset + 2]; 157 + int idxC = shapedTileElements[offset + 3]; 158 + offset += 4; 159 + if (idxA < 4) 160 + idxA = idxA - rotation & 3; 161 + if (idxB < 4) 162 + idxB = idxB - rotation & 3; 163 + if (idxC < 4) 164 + idxC = idxC - rotation & 3; 165 + triangleA[vertex] = idxA; 166 + triangleB[vertex] = idxB; 167 + triangleC[vertex] = idxC; 168 + if (overlayOrUnderlay == 0) { 169 + triangleHSLA[vertex] = vertexColourOverlay[idxA]; 170 + triangleHSLB[vertex] = vertexColourOverlay[idxB]; 171 + triangleHSLC[vertex] = vertexColourOverlay[idxC]; 172 + if (triangleTexture != null) 173 + triangleTexture[vertex] = -1; 176 174 } else { 177 - anIntArray406[j8] = ai2[k9]; 178 - anIntArray407[j8] = ai2[i10]; 179 - anIntArray408[j8] = ai2[j10]; 180 - if (anIntArray412 != null) 181 - anIntArray412[j8] = l3; 175 + triangleHSLA[vertex] = vertexColourUnderlay[idxA]; 176 + triangleHSLB[vertex] = vertexColourUnderlay[idxB]; 177 + triangleHSLC[vertex] = vertexColourUnderlay[idxC]; 178 + if (triangleTexture != null) 179 + triangleTexture[vertex] = texture; 182 180 } 183 181 } 184 182 185 - int i9 = l; 186 - int l9 = j3; 187 - if (j3 < i9) 188 - i9 = j3; 189 - if (j3 > l9) 190 - l9 = j3; 191 - if (k < i9) 192 - i9 = k; 193 - if (k > l9) 194 - l9 = k; 195 - if (i < i9) 196 - i9 = i; 197 - if (i > l9) 198 - l9 = i; 183 + int i9 = yA; 184 + int l9 = yB; 185 + if (yB < i9) 186 + i9 = yB; 187 + if (yB > l9) 188 + l9 = yB; 189 + if (yD < i9) 190 + i9 = yD; 191 + if (yD > l9) 192 + l9 = yD; 193 + if (yC < i9) 194 + i9 = yC; 195 + if (yC > l9) 196 + l9 = yC; 199 197 } 200 198 201 - public int anIntArray403[]; 202 - public int anIntArray404[]; 203 - public int anIntArray405[]; 204 - public int anIntArray406[]; 205 - public int anIntArray407[]; 206 - public int anIntArray408[]; 207 - public int anIntArray409[]; 208 - public int anIntArray410[]; 209 - public int anIntArray411[]; 210 - public int anIntArray412[]; 211 - public boolean aBoolean413; 212 - public int anInt414; 213 - public int anInt415; 214 - public int anInt416; 215 - public int anInt417; 216 - public static int anIntArray418[] = new int[6]; 217 - public static int anIntArray419[] = new int[6]; 218 - public static int anIntArray420[] = new int[6]; 219 - public static int anIntArray421[] = new int[6]; 220 - public static int anIntArray422[] = new int[6]; 221 - public static final int anIntArrayArray426[][] = { { 1, 3, 5, 7 }, { 1, 3, 5, 7 }, { 1, 3, 5, 7 }, 222 - { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 2, 6 }, 223 - { 1, 3, 5, 7, 2, 8 }, { 1, 3, 5, 7, 2, 8 }, { 1, 3, 5, 7, 11, 12 }, { 1, 3, 5, 7, 11, 12 }, 224 - { 1, 3, 5, 7, 13, 14 } }; 225 - public static final int anIntArrayArray427[][] = { { 0, 1, 2, 3, 0, 0, 1, 3 }, { 1, 1, 2, 3, 1, 0, 1, 3 }, 226 - { 0, 1, 2, 3, 1, 0, 1, 3 }, { 0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3 }, { 0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4 }, 227 - { 0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4 }, { 0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3 }, 228 - { 0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3 }, { 0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5 }, 229 - { 0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5 }, 230 - { 0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3 }, 231 - { 1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3 }, 232 - { 1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5 } }; 199 + public int[] originalVertexX; 200 + public int[] originalVertexY; 201 + public int[] originalVertexZ; 202 + public int[] triangleHSLA; 203 + public int[] triangleHSLB; 204 + public int[] triangleHSLC; 205 + public int[] triangleA; 206 + public int[] triangleB; 207 + public int[] triangleC; 208 + public int[] triangleTexture; 209 + public boolean flat; 210 + public int shape; 211 + public int rotation; 212 + public int underlayRGB; 213 + public int overlayRGB; 214 + public static int[] screenX = new int[6]; 215 + public static int[] screenY = new int[6]; 216 + public static int[] viewspaceX = new int[6]; 217 + public static int[] viewspaceY = new int[6]; 218 + public static int[] viewspaceZ = new int[6]; 219 + public static final int[][] shapedTilePointData = {{1, 3, 5, 7}, {1, 3, 5, 7}, {1, 3, 5, 7}, 220 + {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 2, 6}, 221 + {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 11, 12}, {1, 3, 5, 7, 11, 12}, 222 + {1, 3, 5, 7, 13, 14}}; 223 + public static final int[][] shapedTileElementData = {{0, 1, 2, 3, 0, 0, 1, 3}, {1, 1, 2, 3, 1, 0, 1, 3}, 224 + {0, 1, 2, 3, 1, 0, 1, 3}, {0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3}, {0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4}, 225 + {0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4}, {0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3}, 226 + {0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3}, {0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5}, 227 + {0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5}, 228 + {0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3}, 229 + {1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3}, 230 + {1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5}}; 233 231 234 232 }
+2 -2
src/com/jagex/runescape/scene/tile/FloorDecoration.java
··· 3 3 import com.jagex.runescape.media.renderable.Renderable; 4 4 5 5 public class FloorDecoration { 6 + public int z; 6 7 public int x; 7 8 public int y; 8 - public int z; 9 9 public Renderable renderable; 10 - public int hash; 10 + public int uid; 11 11 public byte config; 12 12 }
+9 -9
src/com/jagex/runescape/scene/tile/GenericTile.java
··· 2 2 3 3 public class GenericTile { 4 4 5 - public GenericTile(int i, int j, int k, int l, int texture, int rgbColor, boolean flat) { 6 - anInt95 = i; 7 - anInt96 = j; 8 - anInt97 = k; 9 - anInt98 = l; 5 + public GenericTile(int colourA, int colourB, int colourC, int colourD, int texture, int rgbColor, boolean flat) { 6 + this.colourA = colourA; 7 + this.colourB = colourB; 8 + this.colourC = colourC; 9 + this.colourD = colourD; 10 10 this.texture = texture; 11 11 this.rgbColor = rgbColor; 12 12 this.flat = flat; 13 13 } 14 14 15 - public int anInt95; 16 - public int anInt96; 17 - public int anInt97; 18 - public int anInt98; 15 + public int colourA; 16 + public int colourB; 17 + public int colourD; 18 + public int colourC; 19 19 public int texture; 20 20 public boolean flat; 21 21 public int rgbColor;
+26 -26
src/com/jagex/runescape/scene/tile/SceneTile.java
··· 1 1 package com.jagex.runescape.scene.tile; 2 - import com.jagex.runescape.scene.CameraAngle; 3 - import com.jagex.runescape.scene.SceneSpawnRequest; 2 + import com.jagex.runescape.scene.GroundItemTile; 3 + import com.jagex.runescape.scene.InteractiveObject; 4 4 import com.jagex.runescape.collection.Node; 5 5 6 6 public class SceneTile extends Node { 7 7 8 - public SceneTile(int i, int j, int k) { 9 - anInt1400 = anInt1397 = i; 10 - anInt1398 = j; 11 - anInt1399 = k; 8 + public SceneTile(int x, int y, int z) { 9 + renderLevel = this.z = z; 10 + this.x = x; 11 + this.y = y; 12 12 } 13 13 14 - public int anInt1397; 15 - public int anInt1398; 16 - public int anInt1399; 17 - public int anInt1400; 18 - public GenericTile genericTile; 19 - public ComplexTile complexTile; 14 + public int z; 15 + public int x; 16 + public int y; 17 + public int renderLevel; 18 + public GenericTile plainTile; 19 + public ComplexTile shapedTile; 20 20 public Wall wall; 21 21 public WallDecoration wallDecoration; 22 22 public FloorDecoration floorDecoration; 23 - public CameraAngle cameraAngle; 24 - public int sceneSpawnRequestCount; 25 - public SceneSpawnRequest[] sceneSpawnRequests = new SceneSpawnRequest[5]; 26 - public int[] anIntArray1409 = new int[5]; 27 - public int anInt1410; 28 - public int anInt1411; 29 - public boolean aBoolean1412; 30 - public boolean aBoolean1413; 31 - public boolean aBoolean1414; 32 - public int anInt1415; 33 - public int anInt1416; 34 - public int anInt1417; 35 - public int anInt1418; 36 - public SceneTile aClass50_Sub3_1419; 23 + public GroundItemTile groundItemTile; 24 + public int entityCount; 25 + public InteractiveObject[] interactiveObjects = new InteractiveObject[5]; 26 + public int[] sceneSpawnRequestsSize = new int[5]; 27 + public int interactiveObjectsSizeOR; 28 + public int logicHeight; 29 + public boolean draw; 30 + public boolean visible; 31 + public boolean drawEntities; 32 + public int wallCullDirection; 33 + public int wallUncullDirection; 34 + public int wallCullOppositeDirection; 35 + public int wallDrawFlags; 36 + public SceneTile tileBelow; 37 37 }
+6 -6
src/com/jagex/runescape/scene/tile/Wall.java
··· 4 4 5 5 public class Wall { 6 6 7 - public int plane; 7 + public int z; 8 8 public int x; 9 9 public int y; 10 - public int faceUnknown; 11 - public int face; 12 - public Renderable aRenderable769; 13 - public Renderable aRenderable770; 14 - public int hash; 10 + public int orientation; 11 + public int orientation2; 12 + public Renderable primary; 13 + public Renderable secondary; 14 + public int uid; 15 15 public byte config; 16 16 }
+4 -4
src/com/jagex/runescape/scene/tile/WallDecoration.java
··· 7 7 public WallDecoration() { 8 8 } 9 9 10 - public int plane; 11 - public int y; 10 + public int z; 12 11 public int x; 13 - public int faceUnknown; 12 + public int y; 13 + public int configBits; 14 14 public int face; 15 15 public Renderable renderable; 16 - public int hash; 16 + public int uid; 17 17 public byte config; 18 18 }
+3 -3
src/com/jagex/runescape/util/LinkedList.java
··· 12 12 head.previous = head; 13 13 } 14 14 15 - public void insertBack(Node node) { 15 + public void pushBack(Node node) { 16 16 if (node.previous != null) 17 17 node.remove(); 18 18 node.previous = head.previous; ··· 21 21 node.next.previous = node; 22 22 } 23 23 24 - public void addFirst(Node node) { 24 + public void push(Node node) { 25 25 if (node.previous != null) 26 26 node.remove(); 27 27 node.previous = head; ··· 30 30 node.next.previous = node; 31 31 } 32 32 33 - public Node removeFirst() { 33 + public Node pop() { 34 34 Node node = head.next; 35 35 if (node == head) { 36 36 return null;