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.

Merge branch 'master' of https://github.com/Promises/refactored-client-377 into theblackparade

+2809 -2836
+3 -1
README.md
··· 3 3 4 4 Refactoring the 377 deob. And extending it without adding rice. 5 5 6 + If you ever need to reach me, contact my discord at : "Henning B#4920" 7 + 6 8 ----- 7 9 8 10 ### Client Config ··· 16 18 17 19 * Mouse wheel zoom, scroll, and move view 18 20 * Sound engine thanks to galkon (will be replaced with proper 400+) 19 - * 508+ and legacy text rendering engine: supports 21 + * 400+ and the original legacy text rendering engine: supports 20 22 * all the old @red@ @str@ etc 21 23 * all the new : (credits to a 508 deob and stewie for his half assed work) 22 24 * <col=######></col> Custom colors
+8
build.gradle
··· 9 9 10 10 dependencies { 11 11 compile 'org.yaml:snakeyaml:1.25' 12 + testImplementation('org.junit.jupiter:junit-jupiter:5.5.2') 12 13 } 14 + 15 + test { 16 + useJUnitPlatform() 17 + testLogging { 18 + events "passed", "skipped", "failed" 19 + } 20 + }
+1
config/EXAMPLE-client-config.yaml
··· 16 16 password: Testing 17 17 game: 18 18 roofsEnabled: true 19 + freeTeleports: true
+729 -777
src/main/java/com/jagex/runescape/Game.java
··· 50 50 import com.jagex.runescape.util.*; 51 51 import com.jagex.runescape.config.Actions; 52 52 import com.jagex.runescape.config.Configuration; 53 + import com.jagex.runescape.world.GroundArray; 53 54 54 55 import static com.jagex.runescape.config.Configuration.*; 55 56 import static com.jagex.runescape.config.IncomingPacketIds.*; ··· 59 60 60 61 61 62 private final int[] soundVolume = new int[50]; 62 - private int archiveHashes[] = new int[9]; 63 - private byte terrainData[][]; 63 + private int[] archiveHashes = new int[9]; 64 + private byte[][] terrainData; 64 65 private String reportedName = ""; 65 - private int anIntArray842[] = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; 66 - private int skillExperience[] = new int[SkillConstants.SKILL_COUNT]; 66 + private int[] anIntArray842 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; 67 + private int[] skillExperience = new int[SkillConstants.SKILL_COUNT]; 67 68 private int anInt844; 68 69 private int anInt845; 69 70 private int anInt846; 70 71 private int anInt847; 71 72 private int anInt848; 72 - private String friendUsernames[] = new String[200]; 73 + private String[] friendUsernames = new String[200]; 73 74 private int anInt850; 74 75 public int chatboxScroll; 75 - public static int cameraZoom = 1200; 76 - private int cameraAmplitude[] = new int[5]; 76 + private int[] cameraAmplitude = new int[5]; 77 77 private int anInt853; 78 78 private int anInt854 = 2; 79 79 private int ignoresCount; 80 - private int mapCoordinates[]; 81 - private int terrainDataIds[]; 82 - private int objectDataIds[]; 80 + private int[] mapCoordinates; 81 + private int[] terrainDataIds; 82 + private int[] objectDataIds; 83 83 private int friendsCount; 84 84 private int friendListStatus; 85 85 private String aString861 = ""; 86 86 private int anInt862; 87 - private String aStringArray863[] = new String[100]; 88 - private int anIntArray864[] = new int[100]; 87 + private String[] aStringArray863 = new String[100]; 88 + private int[] anIntArray864 = new int[100]; 89 89 private int anInt865; 90 90 private boolean messagePromptRaised = false; 91 91 private int playerRights; 92 92 private static boolean fps; 93 93 private int packetSize; 94 94 public int opcode; 95 - private int timeoutCounter; 95 + private int packetReadAnticheat; 96 96 private int anInt872; 97 - private int anInt873; 97 + private int idleLogout; 98 98 private int anInt874; 99 99 private int anInt875; 100 100 private int anInt876; 101 101 private int anInt877; 102 102 private int anInt878; 103 - private int constructedMapPalette[][][] = new int[4][13][13]; 103 + private int[][][] constructedMapPalette = new int[4][13][13]; 104 104 private IndexedImage aClass50_Sub1_Sub1_Sub3_880; 105 105 private IndexedImage aClass50_Sub1_Sub1_Sub3_881; 106 106 private IndexedImage aClass50_Sub1_Sub1_Sub3_882; 107 107 private IndexedImage aClass50_Sub1_Sub1_Sub3_883; 108 108 private IndexedImage aClass50_Sub1_Sub1_Sub3_884; 109 - private int anIntArrayArray885[][] = new int[104][104]; 110 - private int anIntArrayArray886[][] = new int[104][104]; 109 + private int[][] anIntArrayArray885 = new int[104][104]; 110 + private int[][] tileRenderCount = new int[104][104]; 111 111 private int privateChatMode; 112 112 private Archive titleArchive; 113 113 private int chunkX; 114 114 private int chunkY; 115 - private int intGroundArray[][][]; 115 + private int[][][] intGroundArray; 116 116 private int anInt893; 117 117 private static int anInt895; 118 - private ImageRGB cursorCross[] = new ImageRGB[8]; 118 + private ImageRGB[] cursorCross = new ImageRGB[8]; 119 119 private ISAACCipher incomingRandom; 120 120 private boolean useJaggrab = Configuration.JAGGRAB_ENABLED; 121 - private long aLong902; 121 + private long lastClickTime; 122 122 private int lastOpcode; 123 123 private int secondLastOpcode; 124 124 private int thirdLastOpcode; ··· 134 134 private int anInt915; 135 135 private int anInt916; 136 136 private int anInt917 = 2; 137 - private int anIntArray920[] = new int[151]; 138 - private int anInt921 = 8; 139 - private static int world = 1; 140 - public static int portOffset; 141 - private static boolean memberServer = true; 142 - public static boolean lowMemory; 143 - private boolean customCameraActive[] = new boolean[5]; 144 - private int anInt928 = -188; 137 + private int[] anIntArray920 = new int[151]; 138 + private int world = 1; 139 + public int portOffset; 140 + private boolean memberServer = true; 141 + public boolean lowMemory; 142 + private boolean[] customCameraActive = new boolean[5]; 145 143 private Buffer tempBuffer = Buffer.allocate(1); 146 144 private long serverSeed; 147 145 private int anInt931 = 0x23201b; ··· 151 149 private String chatboxInputMessage = ""; 152 150 private int anInt939; 153 151 private int anInt940 = 50; 154 - private int anIntArray941[] = new int[anInt940]; 155 - private int anIntArray942[] = new int[anInt940]; 156 - private int anIntArray943[] = new int[anInt940]; 157 - private int anIntArray944[] = new int[anInt940]; 158 - private int anIntArray945[] = new int[anInt940]; 159 - private int anIntArray946[] = new int[anInt940]; 160 - private int anIntArray947[] = new int[anInt940]; 161 - private String aStringArray948[] = new String[anInt940]; 152 + private int[] anIntArray941 = new int[anInt940]; 153 + private int[] anIntArray942 = new int[anInt940]; 154 + private int[] anIntArray943 = new int[anInt940]; 155 + private int[] anIntArray944 = new int[anInt940]; 156 + private int[] anIntArray945 = new int[anInt940]; 157 + private int[] anIntArray946 = new int[anInt940]; 158 + private int[] anIntArray947 = new int[anInt940]; 159 + private String[] aStringArray948 = new String[anInt940]; 162 160 private String inputInputMessage = ""; 163 161 private boolean drawTabIcons = false; 164 162 private int tickDelta; 165 - private static int SKILL_EXPERIENCE[]; 166 - private boolean aBoolean953 = false; 167 - private ImageRGB aClass50_Sub1_Sub1_Sub1Array954[] = new ImageRGB[32]; 168 - private int anInt955; 169 - private byte aByte956 = 1; 163 + private static int[] SKILL_EXPERIENCE; 164 + private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array954 = new ImageRGB[32]; 165 + private int bankInsertMode; 170 166 private String statusLineOne = ""; 171 167 private String statusLineTwo = ""; 172 168 private boolean aBoolean959 = true; ··· 179 175 private IndexedImage anIndexedImage1054; 180 176 private int anInt968 = 2048; 181 177 private int thisPlayerId = 2047; 182 - private Player players[] = new Player[anInt968]; 178 + private Player[] players = new Player[anInt968]; 183 179 private int localPlayerCount; 184 - private int playerList[] = new int[anInt968]; 180 + private int[] playerList = new int[anInt968]; 185 181 private int updatedPlayerCount; 186 - private int updatedPlayers[] = new int[anInt968]; 187 - private Buffer cachedAppearances[] = new Buffer[anInt968]; 188 - private IndexedImage tabIcon[] = new IndexedImage[13]; 189 - private int anInt977; 182 + private int[] updatedPlayers = new int[anInt968]; 183 + private Buffer[] cachedAppearances = new Buffer[anInt968]; 184 + private IndexedImage[] tabIcon = new IndexedImage[13]; 185 + private int loginScreenFocus; 190 186 private static int anInt978; 191 - private int firstMenuOperand[] = new int[500]; 192 - private int secondMenuOperand[] = new int[500]; 193 - private int menuActionTypes[] = new int[500]; 194 - private int selectedMenuActions[] = new int[500]; 187 + private int[] firstMenuOperand = new int[500]; 188 + private int[] secondMenuOperand = new int[500]; 189 + private int[] menuActionTypes = new int[500]; 190 + private int[] selectedMenuActions = new int[500]; 195 191 private IndexedImage aClass50_Sub1_Sub1_Sub3_983; 196 192 private IndexedImage aClass50_Sub1_Sub1_Sub3_984; 197 193 private IndexedImage aClass50_Sub1_Sub1_Sub3_985; ··· 200 196 public int backDialogueId = -1; 201 197 private int placementX; 202 198 private int placementY; 203 - private int cameraFrequency[] = new int[5]; 199 + private int[] cameraFrequency = new int[5]; 204 200 private int anInt992; 205 201 private int anInt993; 206 202 private int anInt994; ··· 208 204 private int anInt996; 209 205 private int anInt997; 210 206 private int anInt998; 211 - private int chatboxLineOffsets[]; 212 - private int sidebarOffsets[]; 213 - private int viewportOffsets[]; 214 - private int anIntArray1003[]; 207 + private int[] chatboxLineOffsets; 208 + private int[] sidebarOffsets; 209 + private int[] viewportOffsets; 210 + private int[] anIntArray1003; 215 211 private int anInt1004; 216 - private int anIntArray1005[] = new int[2000]; 212 + private int[] anIntArray1005 = new int[2000]; 217 213 private int publicChatMode; 218 - public static final int playerColours[][] = { 214 + public static final int[][] playerColours = { 219 215 {6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, 220 216 {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, 221 217 {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, 222 218 {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}}; 223 219 private int anInt1009; 224 220 private int anInt1010 = 2; 225 - private int anInt1011; 226 - private int anInt1012; 227 - private boolean aBoolean1014 = false; 228 - public int anInt1015; 229 - private boolean aBoolean1016 = false; 221 + private int lastClickX; 222 + private int lastClickY; 223 + private boolean rsAlreadyLoaded = false; 230 224 private ImageRGB anImageRGB1226; 231 225 private ImageRGB anImageRGB1227; 232 - private int anIntArray1019[] = new int[151]; 233 - private int lastClickX; 234 - private int lastClickY; 226 + private int[] anIntArray1019 = new int[151]; 227 + private int crossX; 228 + private int crossY; 235 229 private int crossIndex; 236 230 private int crossType; 237 231 private BufferedConnection gameConnection; 238 232 private String chatMessage = ""; 239 233 private String aString1027; 240 - private int skillLevel[] = new int[SkillConstants.SKILL_COUNT]; 234 + private int[] skillLevel = new int[SkillConstants.SKILL_COUNT]; 241 235 private int userWeight; 242 - private ImageRGB worldMapHintIcons[] = new ImageRGB[100]; 243 - 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}; 236 + private ImageRGB[] worldMapHintIcons = new ImageRGB[100]; 237 + 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}; 244 238 private int anInt1034; 245 239 private int currentSound; 246 240 private ImageRGB mapFlagMarker; 247 241 private ImageRGB aClass50_Sub1_Sub1_Sub1_1037; 248 242 private boolean aBoolean1038 = true; 249 - public int widgetSettings[] = new int[2000]; 243 + public int[] widgetSettings = new int[2000]; 250 244 private int nextTopLeftTileX; 251 245 private int nextTopRightTileY; 252 246 private int topLeftTileX; ··· 259 253 private int minimapState; 260 254 private static int anInt1052; 261 255 private int anInt1053 = -1; 262 - private int skillMaxLevel[] = new int[SkillConstants.SKILL_COUNT]; 256 + private int[] skillMaxLevel = new int[SkillConstants.SKILL_COUNT]; 263 257 private int anInt1055 = 2; 264 258 private int anInt1056 = 3; 265 259 private int systemUpdateTime; ··· 274 268 private byte aByte1066 = 1; 275 269 private boolean aBoolean1067 = false; 276 270 private int playerMembers; 277 - private String aStringArray1069[] = new String[5]; 278 - private boolean aBooleanArray1070[] = new boolean[5]; 271 + private String[] aStringArray1069 = new String[5]; 272 + private boolean[] aBooleanArray1070 = new boolean[5]; 279 273 private int loadingStage; 280 - private int anInt1072 = 20411; 281 - private long ignores[] = new long[100]; 274 + private long[] ignores = new long[100]; 282 275 private int anInt1075; 283 276 private int minimapHintCount; 284 - private int minimapHintX[] = new int[1000]; 285 - private int minimapHintY[] = new int[1000]; 286 - private ImageRGB aClass50_Sub1_Sub1_Sub1Array1079[] = new ImageRGB[32]; 277 + private int[] minimapHintX = new int[1000]; 278 + private int[] minimapHintY = new int[1000]; 279 + private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array1079 = new ImageRGB[32]; 287 280 private int anInt1080 = 0x4d4233; 288 - public int tabInterfaceIDs[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 281 + public int[] tabInterfaceIDs = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 289 282 private static int anInt1082; 290 283 private int anInt1083; 291 - private int anIntArray1084[]; 292 - private int anIntArray1085[]; 284 + private int[] anIntArray1084; 285 + private int[] anIntArray1085; 293 286 private ImageRGB aClass50_Sub1_Sub1_Sub1_1086; 294 287 private CRC32 archiveCrc = new CRC32(); 295 288 private int openInvOverLayId = -1; 296 - public int sound[] = new int[50]; 289 + public int[] sound = new int[50]; 297 290 public int plane; 298 291 private String username; 299 292 private String password; 300 293 private int anInt1094; 301 294 private IndexedImage scrollbarUp; 302 295 private IndexedImage scrollbarDown; 303 - private boolean aBoolean1097 = false; 296 + private boolean genericLoadingError = false; 304 297 private boolean reportMutePlayer = false; 305 - private int characterEditColors[] = new int[5]; 298 + private int[] characterEditColors = new int[5]; 306 299 private static int anInt1100; 307 300 private int flameCycle; 308 301 private ImageRGB aClass50_Sub1_Sub1_Sub1_1102; 309 302 private ImageRGB aClass50_Sub1_Sub1_Sub1_1103; 310 303 private String chatboxInput = ""; 311 - private int cameraJitter[] = new int[5]; 304 + private int[] cameraJitter = new int[5]; 312 305 private int anInt1106; 313 306 private int chatboxScrollMax = 78; 314 307 private ProducingGraphicsBuffer aClass18_1108; ··· 320 313 private int anInt1114; 321 314 private int anInt1115; 322 315 private ImageRGB minimapCompass; 323 - private IndexedImage titleFlameEmblem[]; 316 + private IndexedImage[] titleFlameEmblem; 324 317 private int anInt1118; 325 318 private int anInt1119 = -30658; 326 319 private int destinationX; 327 320 private int destinationY; 328 321 private ImageRGB minimapImage; 329 - private int anIntArray1123[] = new int[4000]; 330 - private int anIntArray1124[] = new int[4000]; 331 - private byte currentSceneTileFlags[][][]; 322 + private int[] anIntArray1123 = new int[4000]; 323 + private int[] anIntArray1124 = new int[4000]; 324 + private byte[][][] currentSceneTileFlags; 332 325 private int anInt1126; 333 326 private boolean aBoolean1127 = false; 334 327 private int previousSong; 335 328 private int anInt1129; 336 - private long friends[] = new long[200]; 329 + private long[] friends = new long[200]; 337 330 private Buffer chatBuffer = new Buffer(new byte[5000]); 338 - private Npc npcs[] = new Npc[16384]; 339 - private int anInt1133; 340 - private int anIntArray1134[] = new int[16384]; 331 + private Npc[] npcs = new Npc[16384]; 332 + private int npcCount; 333 + private int[] npcIds = new int[16384]; 341 334 private int anInt1135 = 0x766654; 342 335 public boolean loggedIn = false; 343 336 private int renderCount; 344 337 private static int anInt1139; 345 338 private int anInt1140 = -110; 346 339 private long aLong1141; 347 - private ImageRGB moderatorIcon[] = new ImageRGB[2]; 340 + private ImageRGB[] moderatorIcon = new ImageRGB[2]; 348 341 private byte aByte1143 = -80; 349 342 private boolean characterEditChangeGenger = true; 350 - private int quakeTimes[] = new int[5]; 343 + private int[] quakeTimes = new int[5]; 351 344 private int itemSelected; 352 345 private int anInt1147; 353 346 private int anInt1148; ··· 355 348 private String selectedItemName; 356 349 private int otherPlayerId; 357 350 private int anInt1152; 358 - private IndexedImage aClass50_Sub1_Sub1_Sub3Array1153[] = new IndexedImage[100]; 359 - private boolean aBoolean1155 = false; 351 + private IndexedImage[] aClass50_Sub1_Sub1_Sub3Array1153 = new IndexedImage[100]; 352 + private boolean lastItemDragged = false; 360 353 private ProducingGraphicsBuffer tabImageProducer; 361 354 private ProducingGraphicsBuffer aClass18_1157; 362 355 private ProducingGraphicsBuffer gameScreenImageProducer; 363 356 private ProducingGraphicsBuffer chatboxProducingGraphicsBuffer; 364 357 private static int anInt1160; 365 358 private byte aByte1161 = 97; 366 - private boolean aBoolean1163 = false; 359 + private boolean loadGeneratedMap = false; 367 360 private Scene currentScene; 368 361 private static int anInt1165; 369 - private int anIntArray1166[] = new int[256]; 362 + private int[] anIntArray1166 = new int[256]; 370 363 public static Player localPlayer; 371 364 private static int anInt1168; 372 365 public int openInterfaceId = -1; ··· 376 369 private int anInt1173; 377 370 private String selectedWidgetName; 378 371 private int anInt1175 = -89; 379 - private int anIntArray1176[]; 380 - private int anIntArray1177[]; 372 + private int[] anIntArray1176; 373 + private int[] anIntArray1177; 381 374 private int anInt1178 = 300; 382 375 private int anInt1257; 383 - private int anIntArray1180[] = new int[33]; 376 + private int[] anIntArray1180 = new int[33]; 384 377 public boolean redrawTabArea = false; 385 - private ImageRGB aClass50_Sub1_Sub1_Sub1Array1182[] = new ImageRGB[20]; 378 + private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array1182 = new ImageRGB[20]; 386 379 private int menuActionRow; 387 - private String menuActionTexts[] = new String[500]; 380 + private String[] menuActionTexts = new String[500]; 388 381 private IndexedImage inventoryBackgroundImage; 389 382 private IndexedImage minimapBackgroundImage; 390 383 private IndexedImage chatboxBackgroundImage; 391 384 public Buffer buffer = Buffer.allocate(1); 392 - private int cost[][] = new int[104][104]; 385 + private int[][] cost = new int[104][104]; 393 386 private int dialogueId = -1; 394 387 private ImageRGB mapdotItem; 395 388 private ImageRGB mapdotActor; ··· 408 401 private ProducingGraphicsBuffer aClass18_1206; 409 402 private static boolean aBoolean1207; 410 403 private int anInt1208; 411 - private boolean aBoolean1209 = false; 412 - private LinkedList aClass6_1210 = new LinkedList(); 404 + private boolean loadingMap = false; 405 + private LinkedList gameAnimableObjectQueue = new LinkedList(); 413 406 private boolean cutsceneActive = false; 414 407 private boolean redrawChatMode = false; 415 408 private int flashingSidebarId = -1; 416 - public static int BITFIELD_MAX_VALUE[]; 409 + public static int[] BITFIELD_MAX_VALUE; 417 410 private int anInt1215; 418 411 private int cameraX; 419 412 private int cameraZ; ··· 427 420 private int loginScreenState; 428 421 private int anInt1226; 429 422 private int tradeMode; 430 - public Index stores[] = new Index[5]; 431 - private long aLong1229; 423 + public Index[] stores = new Index[5]; 424 + private long loadRegionTime; 432 425 private int reportAbuseInterfaceID = -1; 433 - private byte objectData[][]; 426 + private byte[][] objectData; 434 427 private int anInt1233; 435 428 private int anInt1234 = 1; 436 429 private static int anInt1235; ··· 441 434 public boolean redrawChatbox = false; 442 435 private int lastAddress; 443 436 private static boolean aBoolean1242 = true; 444 - private volatile boolean aBoolean1243 = false; 437 + private volatile boolean currentlyDrawingFlames = false; 445 438 private int inputType; 446 - private byte aByteArray1245[] = new byte[16384]; 439 + private byte[] aByteArray1245 = new byte[16384]; 447 440 private boolean inTutorialIsland; 448 441 private ImageRGB minimapEdge; 449 442 private MouseCapturer mouseCapturer; ··· 455 448 private int cameraVelocityVertical; 456 449 private int cameraRandomisationA; 457 450 private int anInt1256 = 1; 458 - private int anIntArray1258[] = new int[100]; 459 - private int soundDelay[] = new int[50]; 460 - private CollisionMap currentCollisionMap[] = new CollisionMap[4]; 451 + private int[] anIntArray1258 = new int[100]; 452 + private int[] soundDelay = new int[50]; 453 + private CollisionMap[] currentCollisionMap = new CollisionMap[4]; 461 454 private LinkedList spawnObjectList = new LinkedList(); 462 455 private int currentCameraPositionH; 463 456 private int currentCameraPositionV; 464 - private int anInt1264; 465 - private boolean aBoolean1265 = false; 457 + private int cameraMovedWriteDelay; 458 + private boolean cameraMovedWrite = false; 466 459 private boolean musicEnabled = true; 467 - private int friendWorlds[] = new int[200]; 468 - public static final int SKIN_COLOURS[] = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 460 + private int[] friendWorlds = new int[200]; 461 + public static final int[] SKIN_COLOURS = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 469 462 5027, 1457, 16565, 34991, 25486}; 470 - private int anInt1269; 463 + private int lastItemDragTime; 471 464 private int nextSong; 472 465 private boolean songChanging = true; 473 466 private int anInt1272 = -1; 474 467 private int anInt1273; 475 - private boolean aBoolean1275 = true; 476 - private int anInt1276 = -1; 477 - private boolean aBoolean1277 = false; 478 - private ImageRGB minimapHint[] = new ImageRGB[1000]; 468 + private boolean windowFocused = true; 469 + private int lastRegionId = -1; 470 + private boolean characterModelChanged = false; 471 + private ImageRGB[] minimapHint = new ImageRGB[1000]; 479 472 private int walkableWidgetId = -1; 480 473 private int anInt1280; 481 - private LinkedList aClass6_1282 = new LinkedList(); 482 - private boolean aBoolean1283 = false; 474 + private LinkedList projectileQueue = new LinkedList(); 475 + private boolean loadingError = false; 483 476 private int anInt1284; 484 477 public int currentTabId = 3; 485 - private int anIntArray1286[] = new int[33]; 478 + private int[] anIntArray1286 = new int[33]; 486 479 private int anInt1287 = 0x332d25; 487 - private ImageRGB aClass50_Sub1_Sub1_Sub1Array1288[] = new ImageRGB[32]; 480 + private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array1288 = new ImageRGB[32]; 488 481 private int secondaryCameraVertical; 489 - private int anIntArray1290[] = {17, 24, 34, 40}; 482 + private int[] anIntArray1290 = {17, 24, 34, 40}; 490 483 public OnDemandRequester onDemandRequester; 491 484 private IndexedImage titleboxImage; 492 485 private IndexedImage titleboxButtonImage; 493 486 private int removePlayerCount; 494 - private int removePlayers[] = new int[1000]; 495 - private int chatTypes[] = new int[100]; 496 - private String chatPlayerNames[] = new String[100]; 497 - private String chatMessages[] = new String[100]; 487 + private int[] removePlayers = new int[1000]; 488 + private int[] chatTypes = new int[100]; 489 + private String[] chatPlayerNames = new String[100]; 490 + private String[] chatMessages = new String[100]; 498 491 private int duplicateClickCount; 499 - private int anInt1300; 492 + private int oneMouseButton; 500 493 private boolean aBoolean1301 = true; 501 494 private int anInt1302; 502 495 private int anInt1303; ··· 506 499 private int anInt1307; 507 500 private int anInt1308; 508 501 private static int drawCycle; 509 - private int anIntArray1310[]; 510 - private int anIntArray1311[]; 511 - private int anIntArray1312[]; 512 - private int anIntArray1313[]; 502 + private int[] anIntArray1310; 503 + private int[] anIntArray1311; 504 + private int[] anIntArray1312; 505 + private int[] anIntArray1313; 513 506 private volatile boolean aBoolean1314 = false; 514 507 private int anInt1315; 515 508 private int anInt1319; 516 509 private volatile boolean aBoolean1320 = false; 517 - private int soundType[] = new int[50]; 510 + private int[] soundType = new int[50]; 518 511 private int anInt1322; 519 - private LinkedList groundItems[][][] = new LinkedList[4][104][104]; 512 + private GroundArray<LinkedList> groundItems = new GroundArray(); 520 513 private int runEnergy; 521 514 public static int pulseCycle; 522 - private int characterEditIdentityKits[] = new int[7]; 515 + private int[] characterEditIdentityKits = new int[7]; 523 516 private int currentSong = -1; 524 517 private int atInventoryLoopCycle; 525 518 private int anInt1330; ··· 568 561 return "@yel@"; 569 562 } 570 563 571 - public static void main(String args[]) { 564 + public static void main(String[] args) { 572 565 try { 573 566 System.out.println("RS2 user client - release #" + 377); 567 + Game game = new Game(); 574 568 Configuration.read(); 575 - world = 1; 576 - portOffset = 0; 577 - setHighMemory(); 578 - memberServer = true; 569 + game.world = 1; 570 + game.portOffset = 0; 571 + game.setHighMemory(); 572 + game.memberServer = true; 579 573 SignLink.storeId = 32; 580 574 SignLink.initialize(InetAddress.getLocalHost()); 581 - Game cl = new Game(); 582 - cl.initializeApplication(765, 503); 575 + game.initializeApplication(765, 503); 583 576 } catch (Exception exception) { 584 577 } 585 578 } 586 579 587 - private static void setHighMemory() { 580 + private void setHighMemory() { 588 581 Scene.lowMemory = false; 589 582 Rasterizer3D.lowMemory = false; 590 583 lowMemory = false; ··· 592 585 GameObjectDefinition.lowMemory = false; 593 586 } 594 587 595 - private static void setLowMemory() { 588 + private void setLowMemory() { 596 589 Scene.lowMemory = true; 597 590 Rasterizer3D.lowMemory = true; 598 591 lowMemory = true; ··· 724 717 return; 725 718 } 726 719 String s1 = s; 727 - String as[] = new String[100]; 720 + String[] as = new String[100]; 728 721 int j = 0; 729 722 do { 730 723 int k = s1.indexOf(" "); ··· 837 830 int cycle = 0; 838 831 int interval = 20; 839 832 840 - while (aBoolean1243) { 833 + while (currentlyDrawingFlames) { 841 834 flameCycle++; 842 835 843 836 calculateFlamePositions(); ··· 988 981 minimapHintY = null; 989 982 minimapHint = null; 990 983 npcs = null; 991 - anIntArray1134 = null; 984 + npcIds = null; 992 985 aByteArray1245 = null; 993 986 chatBuffer = null; 994 987 aClass50_Sub1_Sub1_Sub3Array1153 = null; 995 988 worldMapHintIcons = null; 996 - anIntArrayArray886 = null; 989 + tileRenderCount = null; 997 990 tabIcon = null; 998 - aClass6_1282 = null; 999 - aClass6_1210 = null; 991 + projectileQueue = null; 992 + gameAnimableObjectQueue = null; 1000 993 aClass50_Sub1_Sub1_Sub1_1086 = null; 1001 994 if (onDemandRequester != null) 1002 995 onDemandRequester.stop(); ··· 1224 1217 } 1225 1218 } 1226 1219 1227 - private void method24(boolean flag, byte abyte0[], int i) { 1228 - if (!musicEnabled) { 1229 - } else { 1220 + private void saveMidi(boolean flag, byte[] abyte0) { 1221 + if (musicEnabled) { 1230 1222 SignLink.fadeMidi = flag ? 1 : 0; 1231 1223 SignLink.saveMidi(abyte0, abyte0.length); 1232 - i = 71 / i; 1233 1224 } 1234 1225 } 1235 1226 1236 - private void method25() { 1237 - aBoolean1277 = true; 1238 - for (int j = 0; j < 7; j++) { 1239 - characterEditIdentityKits[j] = -1; 1240 - for (int k = 0; k < IdentityKit.count; k++) { 1241 - if (IdentityKit.cache[k].widgetDisplayed 1242 - || IdentityKit.cache[k].partId != j + (characterEditChangeGenger ? 0 : 7)) 1227 + private void changeGender() { 1228 + characterModelChanged = true; 1229 + for (int type = 0; type < 7; type++) { 1230 + characterEditIdentityKits[type] = -1; 1231 + for (int kit = 0; kit < IdentityKit.count; kit++) { 1232 + if (IdentityKit.cache[kit].widgetDisplayed 1233 + || IdentityKit.cache[kit].partId != type + (characterEditChangeGenger ? 0 : 7)) 1243 1234 continue; 1244 - characterEditIdentityKits[j] = k; 1235 + characterEditIdentityKits[type] = kit; 1245 1236 break; 1246 1237 } 1247 1238 ··· 1250 1241 } 1251 1242 1252 1243 private void processGroundItems(int x, int y) { 1253 - LinkedList linkedList = groundItems[plane][x][y]; 1244 + LinkedList linkedList = groundItems.getTile(plane, x, y); 1254 1245 if (linkedList == null) { 1255 1246 currentScene.clearGroundItem(plane, x, y); 1256 1247 return; ··· 1288 1279 } 1289 1280 1290 1281 1291 - private void processGame() { 1282 + private void updateGame() { 1292 1283 if (systemUpdateTime > 1) 1293 1284 systemUpdateTime--; 1294 - if (anInt873 > 0) 1295 - anInt873--; 1285 + if (idleLogout > 0) 1286 + idleLogout--; 1296 1287 for (int i = 0; i < 5; i++) 1297 1288 if (!parseIncomingPacket()) 1298 1289 break; ··· 1304 1295 if (super.clickType != 0 || mouseCapturer.coord >= 40) { 1305 1296 outBuffer.putOpcode(171); 1306 1297 outBuffer.putByte(0); 1307 - int i2 = outBuffer.currentPosition; 1308 - int i3 = 0; 1309 - for (int i4 = 0; i4 < mouseCapturer.coord; i4++) { 1310 - if (i2 - outBuffer.currentPosition >= 240) 1298 + int originalOffset = outBuffer.currentPosition; 1299 + int coordinateCount = 0; 1300 + for (int c = 0; c < mouseCapturer.coord; c++) { 1301 + if (originalOffset - outBuffer.currentPosition >= 240) 1311 1302 break; 1312 - i3++; 1313 - int k4 = mouseCapturer.coordsY[i4]; 1314 - if (k4 < 0) 1315 - k4 = 0; 1316 - else if (k4 > 502) 1317 - k4 = 502; 1318 - int j5 = mouseCapturer.coordsX[i4]; 1319 - if (j5 < 0) 1320 - j5 = 0; 1321 - else if (j5 > 764) 1322 - j5 = 764; 1323 - int l5 = k4 * 765 + j5; 1324 - if (mouseCapturer.coordsY[i4] == -1 && mouseCapturer.coordsX[i4] == -1) { 1325 - j5 = -1; 1326 - k4 = -1; 1327 - l5 = 0x7ffff; 1303 + coordinateCount++; 1304 + int y = mouseCapturer.coordsY[c]; 1305 + if (y < 0) 1306 + y = 0; 1307 + else if (y > 502) 1308 + y = 502; 1309 + int x = mouseCapturer.coordsX[c]; 1310 + if (x < 0) 1311 + x = 0; 1312 + else if (x > 764) 1313 + x = 764; 1314 + int pixelOffset = y * 765 + x; 1315 + if (mouseCapturer.coordsY[c] == -1 && mouseCapturer.coordsX[c] == -1) { 1316 + x = -1; 1317 + y = -1; 1318 + pixelOffset = 0x7ffff; 1328 1319 } 1329 - if (j5 == anInt1011 && k4 == anInt1012) { 1320 + if (x == lastClickX && y == lastClickY) { 1330 1321 if (duplicateClickCount < 2047) 1331 1322 duplicateClickCount++; 1332 1323 } else { 1333 - int i6 = j5 - anInt1011; 1334 - anInt1011 = j5; 1335 - int j6 = k4 - anInt1012; 1336 - anInt1012 = k4; 1337 - if (duplicateClickCount < 8 && i6 >= -32 && i6 <= 31 && j6 >= -32 && j6 <= 31) { 1338 - i6 += 32; 1339 - j6 += 32; 1340 - outBuffer.putShortBE((duplicateClickCount << 12) + (i6 << 6) + j6); 1324 + int differenceX = x - lastClickX; 1325 + lastClickX = x; 1326 + int differenceY = y - lastClickY; 1327 + lastClickY = y; 1328 + if (duplicateClickCount < 8 && differenceX >= -32 && differenceX <= 31 && differenceY >= -32 && differenceY <= 31) { 1329 + differenceX += 32; 1330 + differenceY += 32; 1331 + outBuffer.putShortBE((duplicateClickCount << 12) + (differenceX << 6) + differenceY); 1341 1332 duplicateClickCount = 0; 1342 1333 } else if (duplicateClickCount < 8) { 1343 - outBuffer.putMediumBE(0x800000 + (duplicateClickCount << 19) + l5); 1334 + outBuffer.putMediumBE(0x800000 + (duplicateClickCount << 19) + pixelOffset); 1344 1335 duplicateClickCount = 0; 1345 1336 } else { 1346 - outBuffer.putIntBE(0xc0000000 + (duplicateClickCount << 19) + l5); 1337 + outBuffer.putIntBE(0xc0000000 + (duplicateClickCount << 19) + pixelOffset); 1347 1338 duplicateClickCount = 0; 1348 1339 } 1349 1340 } 1350 1341 } 1351 1342 1352 - outBuffer.putLength(outBuffer.currentPosition - i2); 1353 - if (i3 >= mouseCapturer.coord) { 1343 + outBuffer.putLength(outBuffer.currentPosition - originalOffset); 1344 + if (coordinateCount >= mouseCapturer.coord) { 1354 1345 mouseCapturer.coord = 0; 1355 1346 } else { 1356 - mouseCapturer.coord -= i3; 1357 - for (int l4 = 0; l4 < mouseCapturer.coord; l4++) { 1358 - mouseCapturer.coordsX[l4] = mouseCapturer.coordsX[l4 + i3]; 1359 - mouseCapturer.coordsY[l4] = mouseCapturer.coordsY[l4 + i3]; 1347 + mouseCapturer.coord -= coordinateCount; 1348 + for (int c = 0; c < mouseCapturer.coord; c++) { 1349 + mouseCapturer.coordsX[c] = mouseCapturer.coordsX[c + coordinateCount]; 1350 + mouseCapturer.coordsY[c] = mouseCapturer.coordsY[c + coordinateCount]; 1360 1351 } 1361 1352 1362 1353 } ··· 1366 1357 } 1367 1358 } 1368 1359 if (super.clickType != 0) { 1369 - long l = (super.clickTime - aLong902) / 50L; 1370 - if (l > 4095L) 1371 - l = 4095L; 1372 - aLong902 = super.clickTime; 1373 - int j2 = super.clickY; 1374 - if (j2 < 0) 1375 - j2 = 0; 1376 - else if (j2 > 502) 1377 - j2 = 502; 1378 - int j3 = super.clickX; 1379 - if (j3 < 0) 1380 - j3 = 0; 1381 - else if (j3 > 764) 1382 - j3 = 764; 1383 - int j4 = j2 * 765 + j3; 1384 - int i5 = 0; 1360 + long timeBetweenClicks = (super.clickTime - lastClickTime) / 50L; 1361 + if (timeBetweenClicks > 4095L) 1362 + timeBetweenClicks = 4095L; 1363 + lastClickTime = super.clickTime; 1364 + int y = super.clickY; 1365 + if (y < 0) 1366 + y = 0; 1367 + else if (y > 502) 1368 + y = 502; 1369 + int x = super.clickX; 1370 + if (x < 0) 1371 + x = 0; 1372 + else if (x > 764) 1373 + x = 764; 1374 + int pixelOffset = y * 765 + x; 1375 + int rightClick = 0; 1385 1376 if (super.clickType == 2) 1386 - i5 = 1; 1387 - int k5 = (int) l; 1377 + rightClick = 1; 1378 + int timeDifference = (int) timeBetweenClicks; 1388 1379 outBuffer.putOpcode(19); 1389 - outBuffer.putIntBE((k5 << 20) + (i5 << 19) + j4); 1380 + outBuffer.putIntBE((timeDifference << 20) + (rightClick << 19) + pixelOffset); 1390 1381 } 1391 - if (anInt1264 > 0) 1392 - anInt1264--; 1382 + if (cameraMovedWriteDelay > 0) 1383 + cameraMovedWriteDelay--; 1393 1384 if (super.keyStatus[1] == 1 || super.keyStatus[2] == 1 || super.keyStatus[3] == 1 1394 1385 || super.keyStatus[4] == 1) 1395 - aBoolean1265 = true; 1396 - if (aBoolean1265 && anInt1264 <= 0) { 1397 - anInt1264 = 20; 1398 - aBoolean1265 = false; 1386 + cameraMovedWrite = true; 1387 + if (cameraMovedWrite && cameraMovedWriteDelay <= 0) { 1388 + cameraMovedWriteDelay = 20; 1389 + cameraMovedWrite = false; 1399 1390 outBuffer.putOpcode(140); 1400 1391 outBuffer.putShortLE(cameraVertical); 1401 1392 outBuffer.putShortLE(cameraHorizontal); 1402 1393 } 1403 - if (super.awtFocus && !aBoolean1275) { 1404 - aBoolean1275 = true; 1394 + if (super.awtFocus && !windowFocused) { 1395 + windowFocused = true; 1405 1396 outBuffer.putOpcode(187); 1406 1397 outBuffer.putByte(1); 1407 1398 } 1408 - if (!super.awtFocus && aBoolean1275) { 1409 - aBoolean1275 = false; 1399 + if (!super.awtFocus && windowFocused) { 1400 + windowFocused = false; 1410 1401 outBuffer.putOpcode(187); 1411 1402 outBuffer.putByte(0); 1412 1403 } 1413 - method143((byte) -40); 1404 + loadingStages(); 1414 1405 method36(); 1415 1406 method152(); 1416 - timeoutCounter++; 1417 - if (timeoutCounter > 750) 1407 + packetReadAnticheat++; 1408 + if (packetReadAnticheat > 750) 1418 1409 dropClient(); 1419 1410 method100(0); 1420 1411 method67(-37214); ··· 1436 1427 } 1437 1428 } 1438 1429 if (activeInterfaceType != 0) { 1439 - anInt1269++; 1430 + lastItemDragTime++; 1440 1431 if (super.mouseX > anInt1114 + 5 || super.mouseX < anInt1114 - 5 || super.mouseY > anInt1115 + 5 1441 1432 || super.mouseY < anInt1115 - 5) 1442 - aBoolean1155 = true; 1433 + lastItemDragged = true; 1443 1434 if (super.mouseButtonPressed == 0) { 1444 1435 if (activeInterfaceType == 2) 1445 1436 redrawTabArea = true; 1446 1437 if (activeInterfaceType == 3) 1447 1438 redrawChatbox = true; 1448 1439 activeInterfaceType = 0; 1449 - if (aBoolean1155 && anInt1269 >= 5) { 1440 + if (lastItemDragged && lastItemDragTime >= 5) { 1450 1441 lastActiveInvInterface = -1; 1451 1442 processRightClick(-521); 1452 1443 if (lastActiveInvInterface == modifiedWidgetId && mouseInvInterfaceIndex != selectedInventorySlot) { 1453 1444 Widget childInterface = Widget.forId(modifiedWidgetId); 1454 - int i1 = 0; 1455 - if (anInt955 == 1 && childInterface.contentType == 206) 1456 - i1 = 1; 1445 + int moveItemInsetionMode = 0; 1446 + if (bankInsertMode == 1 && childInterface.contentType == 206) 1447 + moveItemInsetionMode = 1; 1457 1448 if (childInterface.items[mouseInvInterfaceIndex] <= 0) 1458 - i1 = 0; 1449 + moveItemInsetionMode = 0; 1459 1450 if (childInterface.itemDeletesDraged) { 1460 - int k2 = selectedInventorySlot; 1461 - int k3 = mouseInvInterfaceIndex; 1462 - childInterface.items[k3] = childInterface.items[k2]; 1463 - childInterface.itemAmounts[k3] = childInterface.itemAmounts[k2]; 1464 - childInterface.items[k2] = -1; 1465 - childInterface.itemAmounts[k2] = 0; 1466 - } else if (i1 == 1) { 1467 - int l2 = selectedInventorySlot; 1468 - for (int l3 = mouseInvInterfaceIndex; l2 != l3; ) 1469 - if (l2 > l3) { 1470 - childInterface.swapItems(l2, l2 - 1); 1471 - l2--; 1472 - } else if (l2 < l3) { 1473 - childInterface.swapItems(l2, l2 + 1); 1474 - l2++; 1451 + int slotStart = selectedInventorySlot; 1452 + int slotEnd = mouseInvInterfaceIndex; 1453 + childInterface.items[slotEnd] = childInterface.items[slotStart]; 1454 + childInterface.itemAmounts[slotEnd] = childInterface.itemAmounts[slotStart]; 1455 + childInterface.items[slotStart] = -1; 1456 + childInterface.itemAmounts[slotStart] = 0; 1457 + } else if (moveItemInsetionMode == 1) { 1458 + int slotStart = selectedInventorySlot; 1459 + for (int slotPointer = mouseInvInterfaceIndex; slotStart != slotPointer; ) 1460 + if (slotStart > slotPointer) { 1461 + childInterface.swapItems(slotStart, slotStart - 1); 1462 + slotStart--; 1463 + } else if (slotStart < slotPointer) { 1464 + childInterface.swapItems(slotStart, slotStart + 1); 1465 + slotStart++; 1475 1466 } 1476 1467 1477 1468 } else { ··· 1479 1470 } 1480 1471 outBuffer.putOpcode(123); 1481 1472 outBuffer.putOffsetShortLE(mouseInvInterfaceIndex); 1482 - outBuffer.putOffsetByte(i1); 1473 + outBuffer.putOffsetByte(moveItemInsetionMode); 1483 1474 outBuffer.putOffsetShortBE(modifiedWidgetId); 1484 1475 outBuffer.putShortLE(selectedInventorySlot); 1485 1476 } 1486 - } else if ((anInt1300 == 1 || menuHasAddFriend(menuActionRow - 1, aByte1161)) && menuActionRow > 2) 1477 + } else if ((oneMouseButton == 1 || menuHasAddFriend(menuActionRow - 1, aByte1161)) && menuActionRow > 2) 1487 1478 determineMenuSize(); 1488 1479 else if (menuActionRow > 0) 1489 1480 processMenuActions(menuActionRow - 1); ··· 1498 1489 localPlayer.pathX[0]); 1499 1490 Scene.clickedTileX = -1; 1500 1491 if (flag) { 1501 - lastClickX = super.clickX; 1502 - lastClickY = super.clickY; 1492 + crossX = super.clickX; 1493 + crossY = super.clickY; 1503 1494 crossType = 1; 1504 1495 crossIndex = 0; 1505 1496 } ··· 1513 1504 if (anInt1053 == -1) { 1514 1505 method146((byte) 4); 1515 1506 method21(false); 1516 - method39(true); 1507 + method39(); 1517 1508 } 1518 1509 if (super.mouseButtonPressed == 1 || super.clickType == 1) 1519 1510 anInt1094++; ··· 1539 1530 manageTextInputs(); 1540 1531 super.idleTime++; 1541 1532 if (super.idleTime > 4500) { 1542 - anInt873 = 250; 1533 + idleLogout = 250; 1543 1534 super.idleTime -= 500; 1544 1535 outBuffer.putOpcode(202); 1545 1536 } ··· 1815 1806 for (int floorLevel = 0; floorLevel < 4; floorLevel++) { 1816 1807 for (int width = 1; width < 103; width++) { 1817 1808 for (int heigth = 1; heigth < 103; heigth++) 1818 - currentCollisionMap[floorLevel].adjacency[width][heigth] = 0; 1809 + currentCollisionMap[floorLevel].clippingData[width][heigth] = 0; 1819 1810 1820 1811 } 1821 1812 ··· 1927 1918 1928 1919 private DataInputStream openJaggrabStream(String request) throws IOException { 1929 1920 if (!useJaggrab) { 1930 - if (SignLink.applet != null) 1931 - return SignLink.openURL(request); 1932 - else 1933 - return new DataInputStream((new URL(getCodeBase(), request)).openStream()); 1921 + return SignLink.openURL(request); 1934 1922 } 1935 1923 1936 1924 if (jaggrabSocket != null) { ··· 1952 1940 } 1953 1941 1954 1942 public Socket openSocket(int port) throws IOException { 1955 - if (SignLink.applet != null) 1956 - return SignLink.openSocket(port); 1957 - 1958 1943 return new Socket(InetAddress.getByName(getCodeBase().getHost()), port); 1959 1944 } 1960 1945 ··· 1994 1979 return false; 1995 1980 buffer.currentPosition = 0; 1996 1981 gameConnection.read(buffer.buffer, 0, packetSize); 1997 - timeoutCounter = 0; 1982 + packetReadAnticheat = 0; 1998 1983 thirdLastOpcode = secondLastOpcode; 1999 1984 secondLastOpcode = lastOpcode; 2000 1985 lastOpcode = opcode; ··· 2540 2525 placementX = buffer.getUnsignedInvertedByte(); 2541 2526 for (int x = placementX; x < placementX + 8; x++) { 2542 2527 for (int y = placementY; y < placementY + 8; y++) 2543 - if (groundItems[plane][x][y] != null) { 2544 - groundItems[plane][x][y] = null; 2528 + if (!groundItems.isTileEmpty(plane, x, y)) { 2529 + groundItems.clearTile(plane, x, y); 2545 2530 processGroundItems(x, y); 2546 2531 } 2547 2532 ··· 2733 2718 if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2734 2719 tmpChunkY = buffer.getUnsignedShortBE(); 2735 2720 tmpChunkX = buffer.getUnsignedNegativeOffsetShortLE(); 2736 - aBoolean1163 = false; 2721 + loadGeneratedMap = false; 2737 2722 } 2738 2723 if (opcode == CONSTRUCT_MAP_REGION) { 2739 2724 tmpChunkX = buffer.getUnsignedNegativeOffsetShortBE(); ··· 2754 2739 2755 2740 buffer.finishBitAccess(); 2756 2741 tmpChunkY = buffer.getUnsignedNegativeOffsetShortBE(); 2757 - aBoolean1163 = true; 2742 + loadGeneratedMap = true; 2758 2743 } 2759 2744 if (chunkX == tmpChunkX && chunkY == tmpChunkY && loadingStage == 2) { 2760 2745 opcode = -1; ··· 2770 2755 if (chunkX / 8 == 48 && chunkY / 8 == 148) 2771 2756 aBoolean1067 = true; 2772 2757 loadingStage = 1; 2773 - aLong1229 = System.currentTimeMillis(); 2758 + loadRegionTime = System.currentTimeMillis(); 2774 2759 method125(null, "Loading - please wait."); 2775 2760 if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2776 2761 int count = 0; ··· 2810 2795 } 2811 2796 if (opcode == CONSTRUCT_MAP_REGION) { 2812 2797 int uniqueCount = 0; 2813 - int fileIndices[] = new int[676]; 2798 + int[] fileIndices = new int[676]; 2814 2799 for (int tileZ = 0; tileZ < 4; tileZ++) { 2815 2800 for (int tileX = 0; tileX < 13; tileX++) { 2816 2801 for (int tileY = 0; tileY < 13; tileY++) { ··· 2883 2868 } 2884 2869 } 2885 2870 2886 - aBoolean1209 = true; 2871 + loadingMap = true; 2887 2872 byte byte1 = 0; 2888 2873 byte byte2 = 104; 2889 2874 byte byte3 = 1; ··· 2904 2889 for (int j35 = byte4; j35 != byte5; j35 += byte6) { 2905 2890 int k35 = i35 + deltaX; 2906 2891 int l35 = j35 + deltaY; 2907 - for (int i36 = 0; i36 < 4; i36++) 2908 - if (k35 >= 0 && l35 >= 0 && k35 < 104 && l35 < 104) 2909 - groundItems[i36][i35][j35] = groundItems[i36][k35][l35]; 2910 - else 2911 - groundItems[i36][i35][j35] = null; 2892 + for (int i36 = 0; i36 < 4; i36++) { 2893 + if (k35 >= 0 && l35 >= 0 && k35 < 104 && l35 < 104) { 2894 + groundItems.setTile(i36, i35, j35, groundItems.getTile(i36, k35, l35)); 2895 + } else { 2896 + groundItems.clearTile(i36, i35, j35); 2897 + } 2898 + } 2912 2899 2913 2900 } 2914 2901 ··· 3113 3100 } 3114 3101 if (opcode == PLAYER_UPDATING) { 3115 3102 updatePlayers(packetSize, buffer); 3116 - aBoolean1209 = false; 3103 + loadingMap = false; 3117 3104 opcode = -1; 3118 3105 return true; 3119 3106 } ··· 3211 3198 anIntArray1124[k3++] = srcY; 3212 3199 boolean flag2 = false; 3213 3200 int i4 = anIntArray1123.length; 3214 - int masks[][] = currentCollisionMap[plane].adjacency; 3201 + int[][] masks = currentCollisionMap[plane].clippingData; 3215 3202 while (l3 != k3) { 3216 3203 curX = anIntArray1123[l3]; 3217 3204 curY = anIntArray1124[l3]; ··· 3402 3389 spawnObjectNode.anInt1390--; 3403 3390 if (spawnObjectNode.anInt1390 == 0) { 3404 3391 if (spawnObjectNode.anInt1387 < 0 3405 - || Region.method170(spawnObjectNode.anInt1389, aByte1143, spawnObjectNode.anInt1387)) { 3392 + || Region.method170(spawnObjectNode.anInt1389, spawnObjectNode.anInt1387)) { 3406 3393 method45(spawnObjectNode.anInt1388, spawnObjectNode.anInt1393, spawnObjectNode.anInt1387, 3407 3394 spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1389, 3408 3395 spawnObjectNode.anInt1392); ··· 3416 3403 && spawnObjectNode.anInt1394 >= 1 3417 3404 && spawnObjectNode.anInt1393 <= 102 3418 3405 && spawnObjectNode.anInt1394 <= 102 3419 - && (spawnObjectNode.anInt1384 < 0 || Region.method170(spawnObjectNode.anInt1386, aByte1143, 3406 + && (spawnObjectNode.anInt1384 < 0 || Region.method170(spawnObjectNode.anInt1386, 3420 3407 spawnObjectNode.anInt1384))) { 3421 3408 method45(spawnObjectNode.anInt1385, spawnObjectNode.anInt1393, spawnObjectNode.anInt1384, 3422 3409 spawnObjectNode.anInt1394, spawnObjectNode.anInt1391, spawnObjectNode.anInt1386, ··· 3435 3422 } 3436 3423 } 3437 3424 3438 - public String method37(int i) { 3439 - if (i != -42588) 3440 - opcode = buffer.getUnsignedByte(); 3441 - if (SignLink.applet != null) 3442 - return SignLink.applet.getDocumentBase().getHost().toLowerCase(); 3443 - else 3444 - return "runescape.com"; 3445 - 3446 - } 3447 - 3448 3425 private void method38(int i, int j, int k, Player player) { 3449 3426 if (player == localPlayer) 3450 3427 return; ··· 3513 3490 3514 3491 } 3515 3492 3516 - private void method39(boolean flag) { 3517 - if (!flag) 3518 - groundItems = null; 3493 + private void method39() { 3519 3494 if (super.clickType == 1) { 3520 3495 if (super.clickX >= 6 && super.clickX <= 106 && super.clickY >= 467 && super.clickY <= 499) { 3521 3496 publicChatMode = (publicChatMode + 1) % 4; ··· 3750 3725 if (npc.npcDefinition.boundaryDimension == 1 3751 3726 && (npc.worldX & 0x7f) == 64 3752 3727 && (npc.worldY & 0x7f) == 64) { 3753 - for (int i2 = 0; i2 < anInt1133; i2++) { 3754 - Npc npc1 = npcs[anIntArray1134[i2]]; 3728 + for (int i2 = 0; i2 < npcCount; i2++) { 3729 + Npc npc1 = npcs[npcIds[i2]]; 3755 3730 if (npc1 != null 3756 3731 && npc1 != npc 3757 3732 && npc1.npcDefinition.boundaryDimension == 1 3758 3733 && npc1.worldX == npc.worldX 3759 3734 && npc1.worldY == npc.worldY) 3760 - method82(npc1.npcDefinition, i1, l, anIntArray1134[i2]); 3735 + method82(npc1.npcDefinition, i1, l, npcIds[i2]); 3761 3736 } 3762 3737 3763 3738 for (int k2 = 0; k2 < localPlayerCount; k2++) { ··· 3775 3750 Player player1 = players[k1]; 3776 3751 if ((player1.worldX & 0x7f) == 64 3777 3752 && (player1.worldY & 0x7f) == 64) { 3778 - for (int j2 = 0; j2 < anInt1133; j2++) { 3779 - Npc npc = npcs[anIntArray1134[j2]]; 3753 + for (int j2 = 0; j2 < npcCount; j2++) { 3754 + Npc npc = npcs[npcIds[j2]]; 3780 3755 if (npc != null 3781 3756 && npc.npcDefinition.boundaryDimension == 1 3782 3757 && npc.worldX == player1.worldX 3783 3758 && npc.worldY == player1.worldY) 3784 - method82(npc.npcDefinition, i1, l, anIntArray1134[j2]); 3759 + method82(npc.npcDefinition, i1, l, npcIds[j2]); 3785 3760 } 3786 3761 3787 3762 for (int l2 = 0; l2 < localPlayerCount; l2++) { ··· 3797 3772 method38(k1, i1, l, player1); 3798 3773 } 3799 3774 if (j1 == 3) { 3800 - LinkedList itemList = groundItems[plane][l][i1]; 3775 + LinkedList itemList = groundItems.getTile(plane, l, i1); 3801 3776 if (itemList != null) { 3802 3777 for (Item item = (Item) itemList.last(); item != null; item = (Item) itemList 3803 3778 .previous()) { ··· 3870 3845 return; 3871 3846 int l1 = 0; 3872 3847 if (k1 == 0) 3873 - l1 = currentScene.method267(i1, j, l); 3848 + l1 = currentScene.getWallObjectHash(j, l, i1); 3874 3849 if (k1 == 1) 3875 - l1 = currentScene.method268(j, (byte) 4, i1, l); 3850 + l1 = currentScene.getWallDecorationHash(j, i1, l); 3876 3851 if (k1 == 2) 3877 3852 l1 = currentScene.method269(i1, j, l); 3878 3853 if (k1 == 3) ··· 3903 3878 if (k1 == 3) { 3904 3879 currentScene.method261(j, l, i1); 3905 3880 GameObjectDefinition class47_2 = GameObjectDefinition.getDefinition(i2); 3906 - if (class47_2.solid && class47_2.actionsBoolean) 3881 + if (class47_2.solid && class47_2.hasActions) 3907 3882 currentCollisionMap[i1].unmarkConcealed(j, l); 3908 3883 } 3909 3884 } ··· 3911 3886 int i3 = i1; 3912 3887 if (i3 < 3 && (currentSceneTileFlags[1][j][l] & 2) == 2) 3913 3888 i3++; 3914 - Region.method165(k, i3, j1, l, currentCollisionMap[i1], i, j, 0, i1, currentScene, 3889 + Region.forceRenderObject(j, l, i1, k, j1, i3, i, currentScene, currentCollisionMap[i1], 3915 3890 intGroundArray); 3916 3891 } 3917 3892 } ··· 3920 3895 private void method46(Buffer buffer) { 3921 3896 buffer.initBitAccess(); 3922 3897 int j = buffer.getBits(8); 3923 - if (j < anInt1133) { 3924 - for (int k = j; k < anInt1133; k++) 3925 - removePlayers[removePlayerCount++] = anIntArray1134[k]; 3898 + if (j < npcCount) { 3899 + for (int k = j; k < npcCount; k++) 3900 + removePlayers[removePlayerCount++] = npcIds[k]; 3926 3901 3927 3902 } 3928 - if (j > anInt1133) { 3903 + if (j > npcCount) { 3929 3904 SignLink.reportError(username + " Too many npcs"); 3930 3905 throw new RuntimeException("eek"); 3931 3906 } 3932 - anInt1133 = 0; 3907 + npcCount = 0; 3933 3908 for (int l = 0; l < j; l++) { 3934 - int i1 = anIntArray1134[l]; 3909 + int i1 = npcIds[l]; 3935 3910 Npc npc = npcs[i1]; 3936 3911 int updateRequired = buffer.getBits(1); 3937 3912 if (updateRequired == 0) { 3938 - anIntArray1134[anInt1133++] = i1; 3913 + npcIds[npcCount++] = i1; 3939 3914 npc.pulseCycle = pulseCycle; 3940 3915 } else { 3941 3916 int moveType = buffer.getBits(2); 3942 3917 if (moveType == 0) { 3943 - anIntArray1134[anInt1133++] = i1; 3918 + npcIds[npcCount++] = i1; 3944 3919 npc.pulseCycle = pulseCycle; 3945 3920 updatedPlayers[updatedPlayerCount++] = i1; 3946 3921 } else if (moveType == 1) { 3947 - anIntArray1134[anInt1133++] = i1; 3922 + npcIds[npcCount++] = i1; 3948 3923 npc.pulseCycle = pulseCycle; 3949 3924 int direction = buffer.getBits(3); 3950 3925 npc.move(direction, false); ··· 3952 3927 if (blockUpdateRequired == 1) 3953 3928 updatedPlayers[updatedPlayerCount++] = i1; 3954 3929 } else if (moveType == 2) { 3955 - anIntArray1134[anInt1133++] = i1; 3930 + npcIds[npcCount++] = i1; 3956 3931 npc.pulseCycle = pulseCycle; 3957 3932 int direction1 = buffer.getBits(3); 3958 3933 npc.move(direction1, true); ··· 3988 3963 + " psize:" + packetSize); 3989 3964 throw new RuntimeException("eek"); 3990 3965 } 3991 - for (int l = 0; l < anInt1133; l++) 3992 - if (npcs[anIntArray1134[l]] == null) { 3993 - SignLink.reportError(username + " null entry in npc list - coord:" + l + " size:" + anInt1133); 3966 + for (int l = 0; l < npcCount; l++) 3967 + if (npcs[npcIds[l]] == null) { 3968 + SignLink.reportError(username + " null entry in npc list - coord:" + l + " size:" + npcCount); 3994 3969 throw new RuntimeException("eek"); 3995 3970 } 3996 3971 ··· 4008 3983 4009 3984 4010 3985 private void renderProjectiles() { 4011 - Projectile class50_sub1_sub4_sub2 = (Projectile) aClass6_1282.first(); 4012 - for (; class50_sub1_sub4_sub2 != null; class50_sub1_sub4_sub2 = (Projectile) aClass6_1282 3986 + Projectile class50_sub1_sub4_sub2 = (Projectile) projectileQueue.first(); 3987 + for (; class50_sub1_sub4_sub2 != null; class50_sub1_sub4_sub2 = (Projectile) projectileQueue 4013 3988 .next()) 4014 3989 if (class50_sub1_sub4_sub2.sceneId != plane || pulseCycle > class50_sub1_sub4_sub2.endCycle) 4015 3990 class50_sub1_sub4_sub2.remove(); ··· 4117 4092 anIntArray1084 = new int[32768]; 4118 4093 anIntArray1085 = new int[32768]; 4119 4094 drawLoadingText(10, "Connecting to fileserver"); 4120 - if (!aBoolean1243) { 4095 + if (!currentlyDrawingFlames) { 4121 4096 aBoolean1314 = true; 4122 - aBoolean1243 = true; 4097 + currentlyDrawingFlames = true; 4123 4098 startRunnable(this, 2); 4124 4099 } 4125 4100 } ··· 4225 4200 int id = secondMenuOperand[menuActionRow - 1]; 4226 4201 Widget widget = Widget.forId(id); 4227 4202 if (widget.itemSwapable || widget.itemDeletesDraged) { 4228 - aBoolean1155 = false; 4229 - anInt1269 = 0; 4203 + lastItemDragged = false; 4204 + lastItemDragTime = 0; 4230 4205 modifiedWidgetId = id; 4231 4206 selectedInventorySlot = item; 4232 4207 activeInterfaceType = 2; ··· 4240 4215 } 4241 4216 } 4242 4217 } 4243 - if (meta == 1 && (anInt1300 == 1 || menuHasAddFriend(menuActionRow - 1, aByte1161)) && menuActionRow > 2) 4218 + if (meta == 1 && (oneMouseButton == 1 || menuHasAddFriend(menuActionRow - 1, aByte1161)) && menuActionRow > 2) 4244 4219 meta = 2; 4245 4220 if (meta == 1 && menuActionRow > 0) 4246 4221 processMenuActions(menuActionRow - 1); ··· 4280 4255 Rasterizer.drawFilledRectangle(j, i1 + 16 + k1, 16, j1, anInt1080); 4281 4256 Rasterizer.drawVerticalLine(j, i1 + 16 + k1, j1, anInt1135); 4282 4257 Rasterizer.drawVerticalLine(j + 1, i1 + 16 + k1, j1, anInt1135); 4283 - if (!flag) 4284 - anInt921 = -136; 4285 4258 Rasterizer.drawHorizontalLine(j, i1 + 16 + k1, 16, anInt1135); 4286 4259 Rasterizer.drawHorizontalLine(j, i1 + 17 + k1, 16, anInt1135); 4287 4260 Rasterizer.drawVerticalLine(j + 15, i1 + 16 + k1, j1, anInt1287); ··· 4290 4263 Rasterizer.drawHorizontalLine(j + 1, i1 + 14 + k1 + j1, 15, anInt1287); 4291 4264 } 4292 4265 4293 - private void renderNPCs(int i, boolean flag) { 4294 - i = 26 / i; 4295 - for (int j = 0; j < anInt1133; j++) { 4296 - Npc class50_sub1_sub4_sub3_sub1 = npcs[anIntArray1134[j]]; 4297 - int k = 0x20000000 + (anIntArray1134[j] << 14); 4298 - if (class50_sub1_sub4_sub3_sub1 == null || !class50_sub1_sub4_sub3_sub1.isVisible() 4299 - || class50_sub1_sub4_sub3_sub1.npcDefinition.visible != flag 4300 - || !class50_sub1_sub4_sub3_sub1.npcDefinition.method360()) 4266 + private void renderNPCs(boolean flag) { 4267 + for (int n = 0; n < npcCount; n++) { 4268 + Npc npc = npcs[npcIds[n]]; 4269 + int hash = 0x20000000 + (npcIds[n] << 14); 4270 + if (npc == null || !npc.isVisible() || npc.npcDefinition.visible != flag || !npc.npcDefinition.isVisible()) 4301 4271 continue; 4302 - int l = class50_sub1_sub4_sub3_sub1.worldX >> 7; 4303 - int i1 = class50_sub1_sub4_sub3_sub1.worldY >> 7; 4304 - if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) 4272 + int npcX = npc.worldX >> 7; 4273 + int npcY = npc.worldY >> 7; 4274 + if (npcX < 0 || npcX >= 104 || npcY < 0 || npcY >= 104) 4305 4275 continue; 4306 - if (class50_sub1_sub4_sub3_sub1.boundaryDimension == 1 4307 - && (class50_sub1_sub4_sub3_sub1.worldX & 0x7f) == 64 4308 - && (class50_sub1_sub4_sub3_sub1.worldY & 0x7f) == 64) { 4309 - if (anIntArrayArray886[l][i1] == renderCount) 4276 + if (npc.boundaryDimension == 1 4277 + && (npc.worldX & 0x7f) == 64 4278 + && (npc.worldY & 0x7f) == 64) { 4279 + if (tileRenderCount[npcX][npcY] == renderCount) 4310 4280 continue; 4311 - anIntArrayArray886[l][i1] = renderCount; 4281 + tileRenderCount[npcX][npcY] = renderCount; 4312 4282 } 4313 - if (!class50_sub1_sub4_sub3_sub1.npcDefinition.clickable) 4314 - k += 0x80000000; 4315 - currentScene.addEntity(plane, class50_sub1_sub4_sub3_sub1.worldX, class50_sub1_sub4_sub3_sub1.worldY, getFloorDrawHeight( 4316 - plane, class50_sub1_sub4_sub3_sub1.worldX, class50_sub1_sub4_sub3_sub1.worldY 4317 - ), class50_sub1_sub4_sub3_sub1, k, 4318 - (class50_sub1_sub4_sub3_sub1.boundaryDimension - 1) * 64 + 60, class50_sub1_sub4_sub3_sub1.aBoolean1592, 4319 - class50_sub1_sub4_sub3_sub1.anInt1612); 4283 + if (!npc.npcDefinition.clickable) 4284 + hash += 0x80000000; 4285 + currentScene.addEntity(plane, npc.worldX, npc.worldY, getFloorDrawHeight( 4286 + plane, npc.worldX, npc.worldY 4287 + ), npc, hash, 4288 + (npc.boundaryDimension - 1) * 64 + 60, npc.dynamic, 4289 + npc.currentRotation); 4320 4290 } 4321 4291 4322 4292 } ··· 4326 4296 } 4327 4297 4328 4298 private void dropClient() { 4329 - if (anInt873 > 0) { 4299 + if (idleLogout > 0) { 4330 4300 logout(); 4331 4301 return; 4332 4302 } ··· 4366 4336 } 4367 4337 } 4368 4338 if (type == 205) { 4369 - anInt873 = 250; 4339 + idleLogout = 250; 4370 4340 return true; 4371 4341 } 4372 4342 if (type == 501) { ··· 4398 4368 } while (IdentityKit.cache[i2].widgetDisplayed 4399 4369 || IdentityKit.cache[i2].partId != k + (characterEditChangeGenger ? 0 : 7)); 4400 4370 characterEditIdentityKits[k] = i2; 4401 - aBoolean1277 = true; 4371 + characterModelChanged = true; 4402 4372 } 4403 4373 } 4404 4374 if (type >= 314 && type <= 323) { ··· 4410 4380 if (k1 == 1 && ++j2 >= playerColours[l].length) 4411 4381 j2 = 0; 4412 4382 characterEditColors[l] = j2; 4413 - aBoolean1277 = true; 4383 + characterModelChanged = true; 4414 4384 } 4415 4385 if (type == 324 && !characterEditChangeGenger) { 4416 4386 characterEditChangeGenger = true; 4417 - method25(); 4387 + changeGender(); 4418 4388 } 4419 4389 if (type == 325 && characterEditChangeGenger) { 4420 4390 characterEditChangeGenger = false; 4421 - method25(); 4391 + changeGender(); 4422 4392 } 4423 4393 if (type == 326) { 4424 4394 outBuffer.putOpcode(163); ··· 4593 4563 j = 24 / j; 4594 4564 for (int k = 0; k < updatedPlayerCount; k++) { 4595 4565 int l = updatedPlayers[k]; 4596 - Npc class50_sub1_sub4_sub3_sub1 = npcs[l]; 4566 + Npc npc = npcs[l]; 4597 4567 int i1 = class50_sub1_sub2.getUnsignedByte(); 4598 4568 if ((i1 & 1) != 0) { 4599 - class50_sub1_sub4_sub3_sub1.npcDefinition = ActorDefinition.getDefinition(class50_sub1_sub2.getUnsignedNegativeOffsetShortBE()); 4600 - class50_sub1_sub4_sub3_sub1.boundaryDimension = class50_sub1_sub4_sub3_sub1.npcDefinition.boundaryDimension; 4601 - class50_sub1_sub4_sub3_sub1.anInt1600 = class50_sub1_sub4_sub3_sub1.npcDefinition.degreesToTurn; 4602 - class50_sub1_sub4_sub3_sub1.walkAnimationId = class50_sub1_sub4_sub3_sub1.npcDefinition.walkAnimationId; 4603 - class50_sub1_sub4_sub3_sub1.turnAroundAnimationId = class50_sub1_sub4_sub3_sub1.npcDefinition.turnAroundAnimationId; 4604 - class50_sub1_sub4_sub3_sub1.turnRightAnimationId = class50_sub1_sub4_sub3_sub1.npcDefinition.turnRightAnimationId; 4605 - class50_sub1_sub4_sub3_sub1.turnLeftAnimationId = class50_sub1_sub4_sub3_sub1.npcDefinition.turnLeftAnimationId; 4606 - class50_sub1_sub4_sub3_sub1.idleAnimation = class50_sub1_sub4_sub3_sub1.npcDefinition.standAnimationId; 4569 + npc.npcDefinition = ActorDefinition.getDefinition(class50_sub1_sub2.getUnsignedNegativeOffsetShortBE()); 4570 + npc.boundaryDimension = npc.npcDefinition.boundaryDimension; 4571 + npc.anInt1600 = npc.npcDefinition.degreesToTurn; 4572 + npc.walkAnimationId = npc.npcDefinition.walkAnimationId; 4573 + npc.turnAroundAnimationId = npc.npcDefinition.turnAroundAnimationId; 4574 + npc.turnRightAnimationId = npc.npcDefinition.turnRightAnimationId; 4575 + npc.turnLeftAnimationId = npc.npcDefinition.turnLeftAnimationId; 4576 + npc.idleAnimation = npc.npcDefinition.standAnimationId; 4607 4577 } 4608 4578 if ((i1 & 0x40) != 0) { 4609 - class50_sub1_sub4_sub3_sub1.anInt1609 = class50_sub1_sub2.getUnsignedShortLE(); 4610 - if (class50_sub1_sub4_sub3_sub1.anInt1609 == 65535) 4611 - class50_sub1_sub4_sub3_sub1.anInt1609 = -1; 4579 + npc.anInt1609 = class50_sub1_sub2.getUnsignedShortLE(); 4580 + if (npc.anInt1609 == 65535) 4581 + npc.anInt1609 = -1; 4612 4582 } 4613 4583 if ((i1 & 0x80) != 0) { 4614 4584 int j1 = class50_sub1_sub2.getUnsignedPostNegativeOffsetByte(); 4615 4585 int j2 = class50_sub1_sub2.getUnsignedPostNegativeOffsetByte(); 4616 - class50_sub1_sub4_sub3_sub1.updateHits(j2, j1, pulseCycle); 4617 - class50_sub1_sub4_sub3_sub1.endCycle = pulseCycle + 300; 4618 - class50_sub1_sub4_sub3_sub1.anInt1596 = class50_sub1_sub2.getUnsignedByte(); 4619 - class50_sub1_sub4_sub3_sub1.anInt1597 = class50_sub1_sub2.getUnsignedPreNegativeOffsetByte(); 4586 + npc.updateHits(j2, j1, pulseCycle); 4587 + npc.endCycle = pulseCycle + 300; 4588 + npc.anInt1596 = class50_sub1_sub2.getUnsignedByte(); 4589 + npc.anInt1597 = class50_sub1_sub2.getUnsignedPreNegativeOffsetByte(); 4620 4590 } 4621 4591 if ((i1 & 4) != 0) { 4622 - class50_sub1_sub4_sub3_sub1.graphic = class50_sub1_sub2.getUnsignedShortBE(); 4592 + npc.graphic = class50_sub1_sub2.getUnsignedShortBE(); 4623 4593 int k1 = class50_sub1_sub2.getIntME1(); 4624 - class50_sub1_sub4_sub3_sub1.spotAnimationDelay = k1 >> 16; 4625 - class50_sub1_sub4_sub3_sub1.anInt1617 = pulseCycle + (k1 & 0xffff); 4626 - class50_sub1_sub4_sub3_sub1.currentAnimation = 0; 4627 - class50_sub1_sub4_sub3_sub1.anInt1616 = 0; 4628 - if (class50_sub1_sub4_sub3_sub1.anInt1617 > pulseCycle) 4629 - class50_sub1_sub4_sub3_sub1.currentAnimation = -1; 4630 - if (class50_sub1_sub4_sub3_sub1.graphic == 65535) 4631 - class50_sub1_sub4_sub3_sub1.graphic = -1; 4594 + npc.spotAnimationDelay = k1 >> 16; 4595 + npc.anInt1617 = pulseCycle + (k1 & 0xffff); 4596 + npc.currentAnimation = 0; 4597 + npc.anInt1616 = 0; 4598 + if (npc.anInt1617 > pulseCycle) 4599 + npc.currentAnimation = -1; 4600 + if (npc.graphic == 65535) 4601 + npc.graphic = -1; 4632 4602 } 4633 4603 if ((i1 & 0x20) != 0) { 4634 - class50_sub1_sub4_sub3_sub1.forcedChat = class50_sub1_sub2.getString(); 4635 - class50_sub1_sub4_sub3_sub1.textCycle = 100; 4604 + npc.forcedChat = class50_sub1_sub2.getString(); 4605 + npc.textCycle = 100; 4636 4606 } 4637 4607 if ((i1 & 8) != 0) { 4638 - class50_sub1_sub4_sub3_sub1.anInt1598 = class50_sub1_sub2.getUnsignedNegativeOffsetShortLE(); 4639 - class50_sub1_sub4_sub3_sub1.anInt1599 = class50_sub1_sub2.getUnsignedShortLE(); 4608 + npc.anInt1598 = class50_sub1_sub2.getUnsignedNegativeOffsetShortLE(); 4609 + npc.anInt1599 = class50_sub1_sub2.getUnsignedShortLE(); 4640 4610 } 4641 4611 if ((i1 & 2) != 0) { 4642 4612 int l1 = class50_sub1_sub2.getUnsignedShortBE(); 4643 4613 if (l1 == 65535) 4644 4614 l1 = -1; 4645 4615 int k2 = class50_sub1_sub2.getUnsignedPreNegativeOffsetByte(); 4646 - if (l1 == class50_sub1_sub4_sub3_sub1.emoteAnimation && l1 != -1) { 4616 + if (l1 == npc.emoteAnimation && l1 != -1) { 4647 4617 int i3 = AnimationSequence.animations[l1].anInt307; 4648 4618 if (i3 == 1) { 4649 - class50_sub1_sub4_sub3_sub1.displayedEmoteFrames = 0; 4650 - class50_sub1_sub4_sub3_sub1.anInt1626 = 0; 4651 - class50_sub1_sub4_sub3_sub1.animationDelay = k2; 4652 - class50_sub1_sub4_sub3_sub1.anInt1628 = 0; 4619 + npc.displayedEmoteFrames = 0; 4620 + npc.anInt1626 = 0; 4621 + npc.animationDelay = k2; 4622 + npc.anInt1628 = 0; 4653 4623 } 4654 4624 if (i3 == 2) 4655 - class50_sub1_sub4_sub3_sub1.anInt1628 = 0; 4625 + npc.anInt1628 = 0; 4656 4626 } else if (l1 == -1 4657 - || class50_sub1_sub4_sub3_sub1.emoteAnimation == -1 4658 - || AnimationSequence.animations[l1].anInt301 >= AnimationSequence.animations[class50_sub1_sub4_sub3_sub1.emoteAnimation].anInt301) { 4659 - class50_sub1_sub4_sub3_sub1.emoteAnimation = l1; 4660 - class50_sub1_sub4_sub3_sub1.displayedEmoteFrames = 0; 4661 - class50_sub1_sub4_sub3_sub1.anInt1626 = 0; 4662 - class50_sub1_sub4_sub3_sub1.animationDelay = k2; 4663 - class50_sub1_sub4_sub3_sub1.anInt1628 = 0; 4664 - class50_sub1_sub4_sub3_sub1.anInt1613 = class50_sub1_sub4_sub3_sub1.pathLength; 4627 + || npc.emoteAnimation == -1 4628 + || AnimationSequence.animations[l1].anInt301 >= AnimationSequence.animations[npc.emoteAnimation].anInt301) { 4629 + npc.emoteAnimation = l1; 4630 + npc.displayedEmoteFrames = 0; 4631 + npc.anInt1626 = 0; 4632 + npc.animationDelay = k2; 4633 + npc.anInt1628 = 0; 4634 + npc.anInt1613 = npc.pathLength; 4665 4635 } 4666 4636 } 4667 4637 if ((i1 & 0x10) != 0) { 4668 4638 int i2 = class50_sub1_sub2.getUnsignedPreNegativeOffsetByte(); 4669 4639 int l2 = class50_sub1_sub2.getUnsignedPreNegativeOffsetByte(); 4670 - class50_sub1_sub4_sub3_sub1.updateHits(l2, i2, pulseCycle); 4671 - class50_sub1_sub4_sub3_sub1.endCycle = pulseCycle + 300; 4672 - class50_sub1_sub4_sub3_sub1.anInt1596 = class50_sub1_sub2.getUnsignedByte(); 4673 - class50_sub1_sub4_sub3_sub1.anInt1597 = class50_sub1_sub2.getUnsignedInvertedByte(); 4640 + npc.updateHits(l2, i2, pulseCycle); 4641 + npc.endCycle = pulseCycle + 300; 4642 + npc.anInt1596 = class50_sub1_sub2.getUnsignedByte(); 4643 + npc.anInt1597 = class50_sub1_sub2.getUnsignedInvertedByte(); 4674 4644 } 4675 4645 } 4676 4646 ··· 4764 4734 4765 4735 if ((mask & 4) != 0) { 4766 4736 int size = buffer.getUnsignedByte(); 4767 - byte bytes[] = new byte[size]; 4737 + byte[] bytes = new byte[size]; 4768 4738 Buffer appearance = new Buffer(bytes); 4769 4739 4770 4740 buffer.getBytesReverse(bytes, 0, size); ··· 4958 4928 onDemandRequester.request(2, nextSong); 4959 4929 4960 4930 while (onDemandRequester.method333() > 0) { 4961 - method77(false); 4931 + processOnDemandQueue(); 4962 4932 4963 4933 try { 4964 4934 Thread.sleep(100L); ··· 4985 4955 if (total > 0) 4986 4956 drawLoadingText(65, "Loading animations - " + (total * 100) / fileRequestCount + "%"); 4987 4957 4988 - method77(false); 4958 + processOnDemandQueue(); 4989 4959 4990 4960 try { 4991 4961 Thread.sleep(100L); ··· 5017 4987 if (total > 0) 5018 4988 drawLoadingText(70, "Loading models - " + (total * 100) / fileRequestCount + "%"); 5019 4989 5020 - method77(false); 4990 + processOnDemandQueue(); 5021 4991 5022 4992 try { 5023 4993 Thread.sleep(100L); ··· 5048 5018 if (total > 0) 5049 5019 drawLoadingText(75, "Loading maps - " + (total * 100) / fileRequestCount + "%"); 5050 5020 5051 - method77(false); 5021 + processOnDemandQueue(); 5052 5022 5053 5023 try { 5054 5024 Thread.sleep(100L); ··· 5260 5230 5261 5231 TypeFace[] typefaces = {fontSmall, fontNormal, fontBold, fontFancy}; 5262 5232 5263 - for(TypeFace typeFace: typefaces){ 5264 - typeFace.setNameIcons(moderatorIcon, (int[])null); 5233 + for (TypeFace typeFace : typefaces) { 5234 + typeFace.setNameIcons(moderatorIcon, (int[]) null); 5265 5235 } 5266 5236 5267 5237 Widget.load(archiveInterface, typefaces, archiveMedia); ··· 5326 5296 Rasterizer3D.method494(512, 334); 5327 5297 viewportOffsets = Rasterizer3D.lineOffsets; 5328 5298 5329 - int ai[] = new int[9]; 5299 + int[] ai = new int[9]; 5330 5300 5331 5301 for (int i = 0; i < 9; i++) { //TODO: Needs refactoring 5332 5302 int j9 = 128 + i * 32 + 15; ··· 5350 5320 SignLink.reportError("loaderror " + aString1027 + " " + anInt1322); 5351 5321 } 5352 5322 5353 - aBoolean1283 = true; 5323 + loadingError = true; 5354 5324 } 5355 5325 5356 5326 private void animateTexture(int i) { ··· 5361 5331 IndexedImage class50_sub1_sub1_sub3 = Rasterizer3D.aClass50_Sub1_Sub1_Sub3Array1540[l]; 5362 5332 int i1 = class50_sub1_sub1_sub3.width * class50_sub1_sub1_sub3.height - 1; 5363 5333 int j1 = class50_sub1_sub1_sub3.width * tickDelta * 2; 5364 - byte abyte0[] = class50_sub1_sub1_sub3.pixels; 5365 - byte abyte1[] = aByteArray1245; 5334 + byte[] abyte0 = class50_sub1_sub1_sub3.pixels; 5335 + byte[] abyte1 = aByteArray1245; 5366 5336 for (int k1 = 0; k1 <= i1; k1++) 5367 5337 abyte1[k1] = abyte0[k1 - j1 & i1]; 5368 5338 ··· 5585 5555 } 5586 5556 5587 5557 private void method67(int i) { 5588 - for (int j = 0; j < anInt1133; j++) { 5589 - int k = anIntArray1134[j]; 5558 + for (int j = 0; j < npcCount; j++) { 5559 + int k = npcIds[j]; 5590 5560 Npc class50_sub1_sub4_sub3_sub1 = npcs[k]; 5591 5561 if (class50_sub1_sub4_sub3_sub1 != null) 5592 5562 method68(class50_sub1_sub4_sub3_sub1.npcDefinition.boundaryDimension, (byte) -97, class50_sub1_sub4_sub3_sub1); ··· 5628 5598 method70(class50_sub1_sub4_sub3, -31135); 5629 5599 else 5630 5600 method71(class50_sub1_sub4_sub3, 0); 5631 - method72((byte) 8, class50_sub1_sub4_sub3); 5601 + method72(class50_sub1_sub4_sub3); 5632 5602 method73(class50_sub1_sub4_sub3); 5633 5603 if (byte0 == -97) 5634 5604 ; ··· 5675 5645 class50_sub1_sub4_sub3.nextStepOrientation = 0; 5676 5646 if (class50_sub1_sub4_sub3.anInt1608 == 3) 5677 5647 class50_sub1_sub4_sub3.nextStepOrientation = 512; 5678 - class50_sub1_sub4_sub3.anInt1612 = class50_sub1_sub4_sub3.nextStepOrientation; 5648 + class50_sub1_sub4_sub3.currentRotation = class50_sub1_sub4_sub3.nextStepOrientation; 5679 5649 if (i == -31135) 5680 5650 ; 5681 5651 } ··· 5726 5696 class50_sub1_sub4_sub3.nextStepOrientation = 1024; 5727 5697 else 5728 5698 class50_sub1_sub4_sub3.nextStepOrientation = 0; 5729 - int j1 = class50_sub1_sub4_sub3.nextStepOrientation - class50_sub1_sub4_sub3.anInt1612 & 0x7ff; 5699 + int j1 = class50_sub1_sub4_sub3.nextStepOrientation - class50_sub1_sub4_sub3.currentRotation & 0x7ff; 5730 5700 if (j1 > 1024) 5731 5701 j1 -= 2048; 5732 5702 int k1 = class50_sub1_sub4_sub3.turnAroundAnimationId; ··· 5742 5712 k1 = class50_sub1_sub4_sub3.walkAnimationId; 5743 5713 class50_sub1_sub4_sub3.movementAnimation = k1; 5744 5714 int l1 = 4; 5745 - if (class50_sub1_sub4_sub3.anInt1612 != class50_sub1_sub4_sub3.nextStepOrientation 5715 + if (class50_sub1_sub4_sub3.currentRotation != class50_sub1_sub4_sub3.nextStepOrientation 5746 5716 && class50_sub1_sub4_sub3.anInt1609 == -1 && class50_sub1_sub4_sub3.anInt1600 != 0) 5747 5717 l1 = 2; 5748 5718 if (class50_sub1_sub4_sub3.pathLength > 2) ··· 5783 5753 } 5784 5754 } 5785 5755 5786 - private void method72(byte byte0, Actor class50_sub1_sub4_sub3) { 5787 - if (byte0 != 8) 5788 - anInt928 = incomingRandom.nextInt(); 5789 - if (class50_sub1_sub4_sub3.anInt1600 == 0) 5756 + private void method72(Actor actor) { 5757 + if (actor.anInt1600 == 0) 5790 5758 return; 5791 - if (class50_sub1_sub4_sub3.anInt1609 != -1 && class50_sub1_sub4_sub3.anInt1609 < 32768) { 5792 - Npc class50_sub1_sub4_sub3_sub1 = npcs[class50_sub1_sub4_sub3.anInt1609]; 5759 + if (actor.anInt1609 != -1 && actor.anInt1609 < 32768) { 5760 + Npc class50_sub1_sub4_sub3_sub1 = npcs[actor.anInt1609]; 5793 5761 if (class50_sub1_sub4_sub3_sub1 != null) { 5794 - int l = class50_sub1_sub4_sub3.worldX - class50_sub1_sub4_sub3_sub1.worldX; 5795 - int j1 = class50_sub1_sub4_sub3.worldY - class50_sub1_sub4_sub3_sub1.worldY; 5762 + int l = actor.worldX - class50_sub1_sub4_sub3_sub1.worldX; 5763 + int j1 = actor.worldY - class50_sub1_sub4_sub3_sub1.worldY; 5796 5764 if (l != 0 || j1 != 0) 5797 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(l, j1) * 325.94900000000001D) & 0x7ff; 5765 + actor.nextStepOrientation = (int) (Math.atan2(l, j1) * 325.94900000000001D) & 0x7ff; 5798 5766 } 5799 5767 } 5800 - if (class50_sub1_sub4_sub3.anInt1609 >= 32768) { 5801 - int i = class50_sub1_sub4_sub3.anInt1609 - 32768; 5768 + if (actor.anInt1609 >= 32768) { 5769 + int i = actor.anInt1609 - 32768; 5802 5770 if (i == thisPlayerServerId) 5803 5771 i = thisPlayerId; 5804 5772 Player class50_sub1_sub4_sub3_sub2 = players[i]; 5805 5773 if (class50_sub1_sub4_sub3_sub2 != null) { 5806 - int k1 = class50_sub1_sub4_sub3.worldX - class50_sub1_sub4_sub3_sub2.worldX; 5807 - int l1 = class50_sub1_sub4_sub3.worldY - class50_sub1_sub4_sub3_sub2.worldY; 5774 + int k1 = actor.worldX - class50_sub1_sub4_sub3_sub2.worldX; 5775 + int l1 = actor.worldY - class50_sub1_sub4_sub3_sub2.worldY; 5808 5776 if (k1 != 0 || l1 != 0) 5809 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(k1, l1) * 325.94900000000001D) & 0x7ff; 5777 + actor.nextStepOrientation = (int) (Math.atan2(k1, l1) * 325.94900000000001D) & 0x7ff; 5810 5778 } 5811 5779 } 5812 - if ((class50_sub1_sub4_sub3.anInt1598 != 0 || class50_sub1_sub4_sub3.anInt1599 != 0) 5813 - && (class50_sub1_sub4_sub3.pathLength == 0 || class50_sub1_sub4_sub3.anInt1623 > 0)) { 5814 - int j = class50_sub1_sub4_sub3.worldX - (class50_sub1_sub4_sub3.anInt1598 - nextTopLeftTileX - nextTopLeftTileX) * 64; 5815 - int i1 = class50_sub1_sub4_sub3.worldY - (class50_sub1_sub4_sub3.anInt1599 - nextTopRightTileY - nextTopRightTileY) * 64; 5780 + if ((actor.anInt1598 != 0 || actor.anInt1599 != 0) 5781 + && (actor.pathLength == 0 || actor.anInt1623 > 0)) { 5782 + int j = actor.worldX - (actor.anInt1598 - nextTopLeftTileX - nextTopLeftTileX) * 64; 5783 + int i1 = actor.worldY - (actor.anInt1599 - nextTopRightTileY - nextTopRightTileY) * 64; 5816 5784 if (j != 0 || i1 != 0) 5817 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(j, i1) * 325.94900000000001D) & 0x7ff; 5818 - class50_sub1_sub4_sub3.anInt1598 = 0; 5819 - class50_sub1_sub4_sub3.anInt1599 = 0; 5785 + actor.nextStepOrientation = (int) (Math.atan2(j, i1) * 325.94900000000001D) & 0x7ff; 5786 + actor.anInt1598 = 0; 5787 + actor.anInt1599 = 0; 5820 5788 } 5821 - int k = class50_sub1_sub4_sub3.nextStepOrientation - class50_sub1_sub4_sub3.anInt1612 & 0x7ff; 5789 + int k = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5822 5790 if (k != 0) { 5823 - if (k < class50_sub1_sub4_sub3.anInt1600 || k > 2048 - class50_sub1_sub4_sub3.anInt1600) 5824 - class50_sub1_sub4_sub3.anInt1612 = class50_sub1_sub4_sub3.nextStepOrientation; 5791 + if (k < actor.anInt1600 || k > 2048 - actor.anInt1600) 5792 + actor.currentRotation = actor.nextStepOrientation; 5825 5793 else if (k > 1024) 5826 - class50_sub1_sub4_sub3.anInt1612 -= class50_sub1_sub4_sub3.anInt1600; 5794 + actor.currentRotation -= actor.anInt1600; 5827 5795 else 5828 - class50_sub1_sub4_sub3.anInt1612 += class50_sub1_sub4_sub3.anInt1600; 5829 - class50_sub1_sub4_sub3.anInt1612 &= 0x7ff; 5830 - if (class50_sub1_sub4_sub3.movementAnimation == class50_sub1_sub4_sub3.idleAnimation 5831 - && class50_sub1_sub4_sub3.anInt1612 != class50_sub1_sub4_sub3.nextStepOrientation) { 5832 - if (class50_sub1_sub4_sub3.standTurnAnimationId != -1) { 5833 - class50_sub1_sub4_sub3.movementAnimation = class50_sub1_sub4_sub3.standTurnAnimationId; 5796 + actor.currentRotation += actor.anInt1600; 5797 + actor.currentRotation &= 0x7ff; 5798 + if (actor.movementAnimation == actor.idleAnimation 5799 + && actor.currentRotation != actor.nextStepOrientation) { 5800 + if (actor.standTurnAnimationId != -1) { 5801 + actor.movementAnimation = actor.standTurnAnimationId; 5834 5802 return; 5835 5803 } 5836 - class50_sub1_sub4_sub3.movementAnimation = class50_sub1_sub4_sub3.walkAnimationId; 5804 + actor.movementAnimation = actor.walkAnimationId; 5837 5805 } 5838 5806 } 5839 5807 } 5840 5808 5841 5809 private void method73(Actor actor) { 5842 - actor.aBoolean1592 = false; 5810 + actor.dynamic = false; 5843 5811 if (actor.movementAnimation != -1) { 5844 5812 AnimationSequence class14 = AnimationSequence.animations[actor.movementAnimation]; 5845 5813 actor.anInt1590++; ··· 5891 5859 if (actor.displayedEmoteFrames < 0 || actor.displayedEmoteFrames >= class14_3.frameCount) 5892 5860 actor.emoteAnimation = -1; 5893 5861 } 5894 - actor.aBoolean1592 = class14_3.aBoolean300; 5862 + actor.dynamic = class14_3.aBoolean300; 5895 5863 } 5896 5864 if (actor.animationDelay > 0) 5897 5865 actor.animationDelay--; ··· 6235 6203 initializeApplet(765, 503); 6236 6204 } 6237 6205 6238 - private void renderStationaryGraphics(int i) { 6239 - while (i >= 0) 6240 - groundItems = null; 6241 - for (GameAnimableObject gameAnimableObject = (GameAnimableObject) aClass6_1210.first(); gameAnimableObject != null; gameAnimableObject = (GameAnimableObject) aClass6_1210 6206 + private void renderStationaryGraphics() { 6207 + for (GameAnimableObject gameAnimableObject = (GameAnimableObject) gameAnimableObjectQueue.first(); gameAnimableObject != null; gameAnimableObject = (GameAnimableObject) gameAnimableObjectQueue 6242 6208 .next()) 6243 6209 if (gameAnimableObject.plane != plane || gameAnimableObject.transformCompleted) 6244 6210 gameAnimableObject.remove(); ··· 6254 6220 6255 6221 } 6256 6222 6257 - private void method77(boolean flag) { 6258 - if (flag) 6259 - opcode = -1; 6223 + private void processOnDemandQueue() { 6260 6224 do { 6261 - OnDemandNode class50_sub1_sub3; 6225 + OnDemandNode onDemandNode; 6262 6226 do { 6263 - class50_sub1_sub3 = onDemandRequester.next(); 6264 - if (class50_sub1_sub3 == null) 6227 + onDemandNode = onDemandRequester.next(); 6228 + if (onDemandNode == null) 6265 6229 return; 6266 - if (class50_sub1_sub3.type == 0) { 6267 - Model.loadModelHeader(class50_sub1_sub3.buffer, class50_sub1_sub3.id); 6268 - if ((onDemandRequester.modelId(class50_sub1_sub3.id) & 0x62) != 0) { 6230 + if (onDemandNode.type == 0) { 6231 + Model.loadModelHeader(onDemandNode.buffer, onDemandNode.id); 6232 + if ((onDemandRequester.modelId(onDemandNode.id) & 0x62) != 0) { 6269 6233 redrawTabArea = true; 6270 6234 if (backDialogueId != -1 || dialogueId != -1) 6271 6235 redrawChatbox = true; 6272 6236 } 6273 6237 } 6274 - if (class50_sub1_sub3.type == 1 && class50_sub1_sub3.buffer != null) 6275 - Animation.method236(class50_sub1_sub3.buffer); 6276 - if (class50_sub1_sub3.type == 2 && class50_sub1_sub3.id == nextSong && class50_sub1_sub3.buffer != null) 6277 - method24(songChanging, class50_sub1_sub3.buffer, 659); 6278 - if (class50_sub1_sub3.type == 3 && loadingStage == 1) { 6238 + if (onDemandNode.type == 1 && onDemandNode.buffer != null) 6239 + Animation.method236(onDemandNode.buffer); 6240 + if (onDemandNode.type == 2 && onDemandNode.id == nextSong && onDemandNode.buffer != null) 6241 + saveMidi(songChanging, onDemandNode.buffer); 6242 + if (onDemandNode.type == 3 && loadingStage == 1) { 6279 6243 for (int i = 0; i < terrainData.length; i++) { 6280 - if (terrainDataIds[i] == class50_sub1_sub3.id) { 6281 - terrainData[i] = class50_sub1_sub3.buffer; 6282 - if (class50_sub1_sub3.buffer == null) 6244 + if (terrainDataIds[i] == onDemandNode.id) { 6245 + terrainData[i] = onDemandNode.buffer; 6246 + if (onDemandNode.buffer == null) 6283 6247 terrainDataIds[i] = -1; 6284 6248 break; 6285 6249 } 6286 - if (objectDataIds[i] != class50_sub1_sub3.id) 6250 + if (objectDataIds[i] != onDemandNode.id) 6287 6251 continue; 6288 - objectData[i] = class50_sub1_sub3.buffer; 6289 - if (class50_sub1_sub3.buffer == null) 6252 + objectData[i] = onDemandNode.buffer; 6253 + if (onDemandNode.buffer == null) 6290 6254 objectDataIds[i] = -1; 6291 6255 break; 6292 6256 } 6293 6257 6294 6258 } 6295 - } while (class50_sub1_sub3.type != 93 || !onDemandRequester.method334(class50_sub1_sub3.id, false)); 6296 - Region.passiveRequestGameObjectModels(onDemandRequester, new Buffer(class50_sub1_sub3.buffer)); 6259 + } while (onDemandNode.type != 93 || !onDemandRequester.method334(onDemandNode.id, false)); 6260 + Region.passiveRequestGameObjectModels(onDemandRequester, new Buffer(onDemandNode.buffer)); 6297 6261 } while (true); 6298 6262 } 6299 6263 ··· 6328 6292 6329 6293 buffer.currentPosition = 0; 6330 6294 serverSeed = buffer.getLongBE(); 6331 - int seed[] = new int[4]; 6295 + int[] seed = new int[4]; 6332 6296 6333 6297 seed[0] = (int) (Math.random() * 99999999D); 6334 6298 seed[1] = (int) (Math.random() * 99999999D); ··· 6391 6355 if (responseCode == 2) { 6392 6356 playerRights = gameConnection.read(); 6393 6357 accountFlagged = gameConnection.read() == 1; 6394 - aLong902 = 0L; 6358 + lastClickTime = 0L; 6395 6359 duplicateClickCount = 0; 6396 6360 mouseCapturer.coord = 0; 6397 6361 super.awtFocus = true; 6398 - aBoolean1275 = true; 6362 + windowFocused = true; 6399 6363 loggedIn = true; 6400 6364 outBuffer.currentPosition = 0; 6401 6365 buffer.currentPosition = 0; ··· 6404 6368 secondLastOpcode = -1; 6405 6369 thirdLastOpcode = -1; 6406 6370 packetSize = 0; 6407 - timeoutCounter = 0; 6371 + packetReadAnticheat = 0; 6408 6372 systemUpdateTime = 0; 6409 - anInt873 = 0; 6373 + idleLogout = 0; 6410 6374 headIconDrawType = 0; 6411 6375 menuActionRow = 0; 6412 6376 menuOpen = false; ··· 6426 6390 anInt1233 = (int) (Math.random() * 30D) - 20; 6427 6391 cameraHorizontal = (int) (Math.random() * 20D) - 10 & 0x7ff; 6428 6392 minimapState = 0; 6429 - anInt1276 = -1; 6393 + lastRegionId = -1; 6430 6394 destinationX = 0; 6431 6395 destinationY = 0; 6432 6396 localPlayerCount = 0; 6433 - anInt1133 = 0; 6397 + npcCount = 0; 6434 6398 6435 6399 for (int i2 = 0; i2 < anInt968; i2++) { 6436 6400 players[i2] = null; ··· 6442 6406 6443 6407 localPlayer = players[thisPlayerId] = new Player(); 6444 6408 6445 - aClass6_1282.getNodeCount(); 6446 - aClass6_1210.getNodeCount(); 6409 + projectileQueue.clear(); 6410 + gameAnimableObjectQueue.clear(); 6447 6411 6448 6412 for (int l2 = 0; l2 < 4; l2++) { 6449 6413 for (int i3 = 0; i3 < 104; i3++) { 6450 6414 for (int k3 = 0; k3 < 104; k3++) 6451 - groundItems[l2][i3][k3] = null; 6415 + groundItems.clearTile(l2, i3, k3); 6452 6416 } 6453 6417 } 6454 6418 ··· 6487 6451 flashingSidebarId = -1; 6488 6452 characterEditChangeGenger = true; 6489 6453 6490 - method25(); 6454 + changeGender(); 6491 6455 6492 6456 for (int j3 = 0; j3 < 5; j3++) 6493 6457 characterEditColors[j3] = 0; ··· 6582 6546 secondLastOpcode = -1; 6583 6547 thirdLastOpcode = -1; 6584 6548 packetSize = 0; 6585 - timeoutCounter = 0; 6549 + packetReadAnticheat = 0; 6586 6550 systemUpdateTime = 0; 6587 6551 menuActionRow = 0; 6588 6552 menuOpen = false; 6589 - aLong1229 = System.currentTimeMillis(); 6553 + loadRegionTime = System.currentTimeMillis(); 6590 6554 return; 6591 6555 } 6592 6556 ··· 6726 6690 walk(true, false, dstY, localPlayer.pathY[0], 0, 0, 2, objectType + 1, dstX, 0, l1, 6727 6691 localPlayer.pathX[0]); 6728 6692 } 6729 - lastClickX = super.clickX; 6730 - lastClickY = super.clickY; 6693 + crossX = super.clickX; 6694 + crossY = super.clickY; 6731 6695 crossType = 2; 6732 6696 crossIndex = 0; 6733 6697 packetSize += j; ··· 6904 6868 6905 6869 } 6906 6870 6907 - int ai[] = anIntArray1176; 6871 + int[] ai = anIntArray1176; 6908 6872 anIntArray1176 = anIntArray1177; 6909 6873 anIntArray1177 = ai; 6910 6874 } ··· 7135 7099 } 7136 7100 } 7137 7101 7138 - for (int i = 0; i < anInt1133; i++) { 7139 - int index = anIntArray1134[i]; 7102 + for (int i = 0; i < npcCount; i++) { 7103 + int index = npcIds[i]; 7140 7104 Npc npc = npcs[index]; 7141 7105 7142 7106 if (npc != null && npc.textCycle > 0) { ··· 7258 7222 7259 7223 for (int x = 0; x < 104; x++) { 7260 7224 for (int y = 0; y < 104; y++) { 7261 - LinkedList itemList = groundItems[plane][x][y]; 7225 + LinkedList itemList = groundItems.getTile(plane, x, y); 7262 7226 7263 7227 if (itemList != null) { 7264 7228 int itemX = (x * 4 + 2) - localPlayer.worldX / 32; ··· 7270 7234 7271 7235 } 7272 7236 7273 - for (int i = 0; i < anInt1133; i++) { 7274 - Npc npc = npcs[anIntArray1134[i]]; 7237 + for (int i = 0; i < npcCount; i++) { 7238 + Npc npc = npcs[npcIds[i]]; 7275 7239 7276 7240 if (npc != null && npc.isVisible()) { 7277 7241 ActorDefinition definition = npc.npcDefinition; ··· 7363 7327 } 7364 7328 7365 7329 public URL getCodeBase() { 7366 - if (SignLink.applet != null) 7367 - return SignLink.applet.getCodeBase(); 7368 - 7369 - 7370 7330 try { 7371 7331 return new URL("http://" + Configuration.SERVER_ADDRESS + ":" + (Configuration.HTTP_PORT + portOffset)); 7372 7332 } catch (MalformedURLException e) { ··· 7429 7389 return "*"; 7430 7390 } 7431 7391 7432 - public void doLogic() { 7433 - if (aBoolean1016 || aBoolean1283 || aBoolean1097) 7392 + public void processGameLoop() { 7393 + if (rsAlreadyLoaded || loadingError || genericLoadingError) 7434 7394 return; 7435 7395 pulseCycle++; 7436 7396 if (!loggedIn) 7437 - method149(-724); 7397 + updateLogin(); 7438 7398 else 7439 - processGame(); 7440 - method77(false); 7399 + updateGame(); 7400 + processOnDemandQueue(); 7441 7401 } 7442 7402 7443 7403 private void processRightClick(int i) { ··· 7530 7490 } 7531 7491 7532 7492 7533 - private void method93(int i) { 7493 + private void loadRegion() { 7534 7494 try { 7535 - anInt1276 = -1; 7536 - aClass6_1210.getNodeCount(); 7537 - aClass6_1282.getNodeCount(); 7538 - Rasterizer3D.method495((byte) 71); 7495 + lastRegionId = -1; 7496 + gameAnimableObjectQueue.clear(); 7497 + projectileQueue.clear(); 7498 + Rasterizer3D.clearTextureCache(); 7539 7499 resetModelCaches(); 7540 7500 currentScene.initToNull(); 7541 7501 System.gc(); 7542 7502 for (int plane = 0; plane < 4; plane++) 7543 7503 currentCollisionMap[plane].reset(); 7544 7504 7545 - for (int i1 = 0; i1 < 4; i1++) { 7546 - for (int l1 = 0; l1 < 104; l1++) { 7547 - for (int k2 = 0; k2 < 104; k2++) 7548 - currentSceneTileFlags[i1][l1][k2] = 0; 7505 + for (int z = 0; z < 4; z++) { 7506 + for (int x = 0; x < 104; x++) { 7507 + for (int y = 0; y < 104; y++) 7508 + currentSceneTileFlags[z][x][y] = 0; 7549 7509 7550 7510 } 7551 7511 7552 7512 } 7553 7513 7554 7514 Region region = new Region(currentSceneTileFlags, 104, 104, intGroundArray); 7555 - int l2 = terrainData.length; 7515 + int dataLength = terrainData.length; 7556 7516 outBuffer.putOpcode(40); 7557 - if (!aBoolean1163) { 7558 - for (int j3 = 0; j3 < l2; j3++) { 7559 - int j4 = (mapCoordinates[j3] >> 8) * 64 - nextTopLeftTileX; 7560 - int l5 = (mapCoordinates[j3] & 0xff) * 64 - nextTopRightTileY; 7561 - byte abyte0[] = terrainData[j3]; 7562 - if (abyte0 != null) 7563 - region.method174(l5, false, (chunkY - 6) * 8, j4, abyte0, (chunkX - 6) * 8, 7517 + if (!loadGeneratedMap) { 7518 + for (int pointer = 0; pointer < dataLength; pointer++) { 7519 + int offsetX = (mapCoordinates[pointer] >> 8) * 64 - nextTopLeftTileX; 7520 + int offsetY = (mapCoordinates[pointer] & 0xff) * 64 - nextTopRightTileY; 7521 + byte[] data = terrainData[pointer]; 7522 + if (data != null) 7523 + region.loadTerrainBlock(offsetX, (chunkX - 6) * 8, offsetY, (chunkY - 6) * 8, data, 7564 7524 currentCollisionMap); 7565 7525 } 7566 7526 7567 - for (int k4 = 0; k4 < l2; k4++) { 7568 - int i6 = (mapCoordinates[k4] >> 8) * 64 - nextTopLeftTileX; 7569 - int l7 = (mapCoordinates[k4] & 0xff) * 64 - nextTopRightTileY; 7570 - byte abyte2[] = terrainData[k4]; 7571 - if (abyte2 == null && chunkY < 800) 7572 - region.initiateVertexHeights(i6, 64, l7, 64); 7527 + for (int pointer = 0; pointer < dataLength; pointer++) { 7528 + int offsetX = (mapCoordinates[pointer] >> 8) * 64 - nextTopLeftTileX; 7529 + int offsetY = (mapCoordinates[pointer] & 0xff) * 64 - nextTopRightTileY; 7530 + byte[] data = terrainData[pointer]; 7531 + if (data == null && chunkY < 800) 7532 + region.initiateVertexHeights(offsetX, 64, offsetY, 64); 7573 7533 } 7574 7534 7575 7535 outBuffer.putOpcode(40); 7576 - for (int j6 = 0; j6 < l2; j6++) { 7577 - byte abyte1[] = objectData[j6]; 7578 - if (abyte1 != null) { 7579 - int l8 = (mapCoordinates[j6] >> 8) * 64 - nextTopLeftTileX; 7580 - int k9 = (mapCoordinates[j6] & 0xff) * 64 - nextTopRightTileY; 7581 - region.method179(k9, currentCollisionMap, l8, -571, currentScene, abyte1); 7536 + for (int _region = 0; _region < dataLength; _region++) { 7537 + byte[] data = objectData[_region]; 7538 + if (data != null) { 7539 + int offsetX = (mapCoordinates[_region] >> 8) * 64 - nextTopLeftTileX; 7540 + int offsetY = (mapCoordinates[_region] & 0xff) * 64 - nextTopRightTileY; 7541 + region.loadObjectBlock(offsetX, offsetY, currentCollisionMap, currentScene, data); 7582 7542 } 7583 7543 } 7584 7544 7585 7545 } 7586 - if (aBoolean1163) { 7546 + if (loadGeneratedMap) { 7587 7547 for (int k3 = 0; k3 < 4; k3++) { 7588 7548 for (int l4 = 0; l4 < 13; l4++) { 7589 7549 for (int k6 = 0; k6 < 13; k6++) { ··· 7606 7566 7607 7567 } 7608 7568 if (!flag) 7609 - region.method166(anInt1072, k3, k6 * 8, l4 * 8); 7569 + region.method166(k3, k6 * 8, l4 * 8); 7610 7570 } 7611 7571 7612 7572 } ··· 7696 7656 int k1 = (chunkX + 6) / 8 + 1; 7697 7657 int j2 = (chunkY - 6) / 8 - 1; 7698 7658 int i3 = (chunkY + 6) / 8 + 1; 7699 - i = 94 / i; 7700 7659 if (aBoolean1067) { 7701 7660 l = 49; 7702 7661 k1 = 50; ··· 8047 8006 if (i == 327) { 8048 8007 class13.rotationX = 150; 8049 8008 class13.rotationY = (int) (Math.sin((double) pulseCycle / 40D) * 256D) & 0x7ff; 8050 - if (aBoolean1277) { 8009 + if (characterModelChanged) { 8051 8010 for (int j1 = 0; j1 < 7; j1++) { 8052 8011 int i2 = characterEditIdentityKits[j1]; 8053 8012 if (i2 >= 0 && !IdentityKit.cache[i2].isBodyModelCached()) 8054 8013 return; 8055 8014 } 8056 8015 8057 - aBoolean1277 = false; 8058 - Model aclass50_sub1_sub4_sub4[] = new Model[7]; 8016 + characterModelChanged = false; 8017 + Model[] aclass50_sub1_sub4_sub4 = new Model[7]; 8059 8018 int j2 = 0; 8060 8019 for (int k2 = 0; k2 < 7; k2++) { 8061 8020 int l2 = characterEditIdentityKits[k2]; ··· 8292 8251 aBoolean1301 = false; 8293 8252 } 8294 8253 if (action == 5) 8295 - anInt1300 = config; 8254 + oneMouseButton = config; 8296 8255 if (action == 6) 8297 8256 anInt998 = config; 8298 8257 if (action == 8) { ··· 8300 8259 redrawChatbox = true; 8301 8260 } 8302 8261 if (action == 9) 8303 - anInt955 = config; 8262 + bankInsertMode = config; 8304 8263 } 8305 8264 8306 8265 private int method106(int i, int j, int k, int l) { ··· 8411 8370 renderSplitPrivateMessages(); 8412 8371 8413 8372 if (crossType == 1) 8414 - cursorCross[crossIndex / 100].drawImage(lastClickX - 8 - 4, lastClickY - 8 - 4); 8373 + cursorCross[crossIndex / 100].drawImage(crossX - 8 - 4, crossY - 8 - 4); 8415 8374 if (crossType == 2) 8416 - cursorCross[4 + crossIndex / 100].drawImage(lastClickX - 8 - 4, lastClickY - 8 - 4); 8375 + cursorCross[4 + crossIndex / 100].drawImage(crossX - 8 - 4, crossY - 8 - 4); 8417 8376 8418 8377 if (walkableWidgetId != -1) { 8419 8378 method88(tickDelta, walkableWidgetId); ··· 8711 8670 } 8712 8671 8713 8672 private void renderViewport(int plane) { 8714 - int pixels[] = minimapImage.pixels; 8673 + int[] pixels = minimapImage.pixels; 8715 8674 int pixelAmount = pixels.length; 8716 8675 for (int pixel = 0; pixel < pixelAmount; pixel++) 8717 8676 pixels[pixel] = 0; ··· 8765 8724 if (icon != 22 && icon != 29 && icon != 34 && icon != 36 && icon != 46 && icon != 47 && icon != 48) { 8766 8725 byte regionWidth = 104; 8767 8726 byte regionHeight = 104; 8768 - int flags[][] = currentCollisionMap[this.plane].adjacency; 8727 + int[][] flags = currentCollisionMap[this.plane].clippingData; 8769 8728 for (int off = 0; off < 10; off++) { 8770 8729 int randPlane = (int) (Math.random() * 4D); 8771 8730 if (randPlane == 0 && drawPointX > 0 && drawPointX > viewportX - 3 && (flags[drawPointX - 1][drawPointY] & 0x1280108) == 0) ··· 8889 8848 } 8890 8849 8891 8850 private int getCameraPlaneCutscene() { 8892 - if(!ROOFS_ENABLED){ 8851 + if (!ROOFS_ENABLED) { 8893 8852 return plane; 8894 8853 } 8895 8854 int j = getFloorDrawHeight(plane, cameraX, cameraY); ··· 8902 8861 public void startRunnable(Runnable runnable, int i) { 8903 8862 if (i > 10) 8904 8863 i = 10; 8905 - if (SignLink.applet != null) { 8906 - SignLink.startThread(runnable, i); 8907 - } else { 8908 - super.startRunnable(runnable, i); 8909 - } 8864 + super.startRunnable(runnable, i); 8910 8865 } 8911 8866 8912 8867 private void processPlayerAdditions(boolean priority) { // renderPlayers ··· 8943 8898 plane, player.worldX, player.worldY 8944 8899 ); 8945 8900 currentScene.addEntity(player.anInt1768, player.anInt1769, plane, player.worldX, player.worldY, player.drawHeight2, 8946 - player.anInt1612, player.anInt1771, player.anInt1770, player, 8901 + player.currentRotation, player.anInt1771, player.anInt1770, player, 8947 8902 hash); 8948 8903 continue; 8949 8904 } 8950 8905 if ((player.worldX & 0x7f) == 64 8951 8906 && (player.worldY & 0x7f) == 64) { 8952 - if (anIntArrayArray886[viewportX][viewportY] == renderCount) 8907 + if (tileRenderCount[viewportX][viewportY] == renderCount) 8953 8908 continue; 8954 - anIntArrayArray886[viewportX][viewportY] = renderCount; 8909 + tileRenderCount[viewportX][viewportY] = renderCount; 8955 8910 } 8956 8911 player.drawHeight2 = getFloorDrawHeight(plane, player.worldX, player.worldY 8957 8912 ); 8958 8913 currentScene.addEntity(plane, player.worldX, player.worldY, player.drawHeight2, player, hash, 8959 - 60, player.aBoolean1592, 8960 - player.anInt1612); 8914 + 60, player.dynamic, 8915 + player.currentRotation); 8961 8916 } 8962 8917 } 8963 8918 ··· 8981 8936 localPlayer.pathY[0], 1, 1, 2, 0, 8982 8937 player.pathX[0], 0, 0, 8983 8938 localPlayer.pathX[0]); 8984 - lastClickX = super.clickX; 8985 - lastClickY = super.clickY; 8939 + crossX = super.clickX; 8940 + crossY = super.clickY; 8986 8941 crossType = 2; 8987 8942 crossIndex = 0; 8988 8943 outBuffer.putOpcode(245); ··· 9016 8971 localPlayer.pathY[0], 1, 1, 2, 0, 9017 8972 player.pathX[0], 0, 0, 9018 8973 localPlayer.pathX[0]); 9019 - lastClickX = super.clickX; 9020 - lastClickY = super.clickY; 8974 + crossX = super.clickX; 8975 + crossY = super.clickY; 9021 8976 crossType = 2; 9022 8977 crossIndex = 0; 9023 8978 outBuffer.putOpcode(45); ··· 9031 8986 localPlayer.pathY[0], 1, 1, 2, 0, 9032 8987 npc.pathX[0], 0, 0, 9033 8988 localPlayer.pathX[0]); 9034 - lastClickX = super.clickX; 9035 - lastClickY = super.clickY; 8989 + crossX = super.clickX; 8990 + crossY = super.clickY; 9036 8991 crossType = 2; 9037 8992 crossIndex = 0; 9038 8993 outBuffer.putOpcode(67); ··· 9089 9044 localPlayer.pathY[0], 1, 1, 2, 0, 9090 9045 npc.pathX[0], 0, 0, 9091 9046 localPlayer.pathX[0]); 9092 - lastClickX = super.clickX; 9093 - lastClickY = super.clickY; 9047 + crossX = super.clickX; 9048 + crossY = super.clickY; 9094 9049 crossType = 2; 9095 9050 crossIndex = 0; 9096 9051 outBuffer.putOpcode(42); ··· 9104 9059 localPlayer.pathY[0], 1, 1, 2, 0, 9105 9060 player.pathX[0], 0, 0, 9106 9061 localPlayer.pathX[0]); 9107 - lastClickX = super.clickX; 9108 - lastClickY = super.clickY; 9062 + crossX = super.clickX; 9063 + crossY = super.clickY; 9109 9064 crossType = 2; 9110 9065 crossIndex = 0; 9111 9066 outBuffer.putOpcode(116); ··· 9136 9091 if (!flag) 9137 9092 flag = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9138 9093 localPlayer.pathX[0]); 9139 - lastClickX = super.clickX; 9140 - lastClickY = super.clickY; 9094 + crossX = super.clickX; 9095 + crossY = super.clickY; 9141 9096 crossType = 2; 9142 9097 crossIndex = 0; 9143 9098 outBuffer.putOpcode(54); ··· 9166 9121 localPlayer.pathY[0], 1, 1, 2, 0, 9167 9122 class50_sub1_sub4_sub3_sub1_2.pathX[0], 0, 0, 9168 9123 localPlayer.pathX[0]); 9169 - lastClickX = super.clickX; 9170 - lastClickY = super.clickY; 9124 + crossX = super.clickX; 9125 + crossY = super.clickY; 9171 9126 crossType = 2; 9172 9127 crossIndex = 0; 9173 9128 outBuffer.putOpcode(57); ··· 9195 9150 localPlayer.pathY[0], 1, 1, 2, 0, 9196 9151 class50_sub1_sub4_sub3_sub2_3.pathX[0], 0, 0, 9197 9152 localPlayer.pathX[0]); 9198 - lastClickX = super.clickX; 9199 - lastClickY = super.clickY; 9153 + crossX = super.clickX; 9154 + crossY = super.clickY; 9200 9155 crossType = 2; 9201 9156 crossIndex = 0; 9202 9157 outBuffer.putOpcode(233); ··· 9247 9202 localPlayer.pathY[0], 1, 1, 2, 0, 9248 9203 class50_sub1_sub4_sub3_sub1_3.pathX[0], 0, 0, 9249 9204 localPlayer.pathX[0]); 9250 - lastClickX = super.clickX; 9251 - lastClickY = super.clickY; 9205 + crossX = super.clickX; 9206 + crossY = super.clickY; 9252 9207 crossType = 2; 9253 9208 crossIndex = 0; 9254 9209 anInt1235 += clicked; ··· 9275 9230 localPlayer.pathY[0], 1, 1, 2, 0, 9276 9231 class50_sub1_sub4_sub3_sub1_4.pathX[0], 0, 0, 9277 9232 localPlayer.pathX[0]); 9278 - lastClickX = super.clickX; 9279 - lastClickY = super.clickY; 9233 + crossX = super.clickX; 9234 + crossY = super.clickY; 9280 9235 crossType = 2; 9281 9236 crossIndex = 0; 9282 9237 outBuffer.putOpcode(8); ··· 9292 9247 localPlayer.pathY[0], 1, 1, 2, 0, 9293 9248 class50_sub1_sub4_sub3_sub2_4.pathX[0], 0, 0, 9294 9249 localPlayer.pathX[0]); 9295 - lastClickX = super.clickX; 9296 - lastClickY = super.clickY; 9250 + crossX = super.clickX; 9251 + crossY = super.clickY; 9297 9252 crossType = 2; 9298 9253 crossIndex = 0; 9299 9254 outBuffer.putOpcode(31); ··· 9308 9263 localPlayer.pathY[0], 1, 1, 2, 0, 9309 9264 class50_sub1_sub4_sub3_sub1_5.pathX[0], 0, 0, 9310 9265 localPlayer.pathX[0]); 9311 - lastClickX = super.clickX; 9312 - lastClickY = super.clickY; 9266 + crossX = super.clickX; 9267 + crossY = super.clickY; 9313 9268 crossType = 2; 9314 9269 crossIndex = 0; 9315 9270 outBuffer.putOpcode(104); ··· 9323 9278 if (!flag1) 9324 9279 flag1 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9325 9280 localPlayer.pathX[0]); 9326 - lastClickX = super.clickX; 9327 - lastClickY = super.clickY; 9281 + crossX = super.clickX; 9282 + crossY = super.clickY; 9328 9283 crossType = 2; 9329 9284 crossIndex = 0; 9330 9285 outBuffer.putOpcode(77); ··· 9338 9293 if (!flag2) 9339 9294 flag2 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9340 9295 localPlayer.pathX[0]); 9341 - lastClickX = super.clickX; 9342 - lastClickY = super.clickY; 9296 + crossX = super.clickX; 9297 + crossY = super.clickY; 9343 9298 crossType = 2; 9344 9299 crossIndex = 0; 9345 9300 if ((clicked & 3) == 0) ··· 9534 9489 if (!flag3) 9535 9490 flag3 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9536 9491 localPlayer.pathX[0]); 9537 - lastClickX = super.clickX; 9538 - lastClickY = super.clickY; 9492 + crossX = super.clickX; 9493 + crossY = super.clickY; 9539 9494 crossType = 2; 9540 9495 crossIndex = 0; 9541 9496 outBuffer.putOpcode(230); ··· 9550 9505 localPlayer.pathY[0], 1, 1, 2, 0, 9551 9506 class50_sub1_sub4_sub3_sub2_5.pathX[0], 0, 0, 9552 9507 localPlayer.pathX[0]); 9553 - lastClickX = super.clickX; 9554 - lastClickY = super.clickY; 9508 + crossX = super.clickX; 9509 + crossY = super.clickY; 9555 9510 crossType = 2; 9556 9511 crossIndex = 0; 9557 9512 outBuffer.putOpcode(143); ··· 9567 9522 if (!flag4) 9568 9523 flag4 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9569 9524 localPlayer.pathX[0]); 9570 - lastClickX = super.clickX; 9571 - lastClickY = super.clickY; 9525 + crossX = super.clickX; 9526 + crossY = super.clickY; 9572 9527 crossType = 2; 9573 9528 crossIndex = 0; 9574 9529 outBuffer.putOpcode(211); ··· 9601 9556 if (!flag5) 9602 9557 flag5 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9603 9558 localPlayer.pathX[0]); 9604 - lastClickX = super.clickX; 9605 - lastClickY = super.clickY; 9559 + crossX = super.clickX; 9560 + crossY = super.clickY; 9606 9561 crossType = 2; 9607 9562 crossIndex = 0; 9608 9563 anInt1100++; ··· 9708 9663 localPlayer.pathY[0], 1, 1, 2, 0, 9709 9664 class50_sub1_sub4_sub3_sub1_7.pathX[0], 0, 0, 9710 9665 localPlayer.pathX[0]); 9711 - lastClickX = super.clickX; 9712 - lastClickY = super.clickY; 9666 + crossX = super.clickX; 9667 + crossY = super.clickY; 9713 9668 crossType = 2; 9714 9669 crossIndex = 0; 9715 9670 outBuffer.putOpcode(112); ··· 9722 9677 if (!flag6) 9723 9678 flag6 = walk(false, false, second, localPlayer.pathY[0], 1, 1, 2, 0, first, 0, 0, 9724 9679 localPlayer.pathX[0]); 9725 - lastClickX = super.clickX; 9726 - lastClickY = super.clickY; 9680 + crossX = super.clickX; 9681 + crossY = super.clickY; 9727 9682 crossType = 2; 9728 9683 crossIndex = 0; 9729 9684 outBuffer.putOpcode(83); ··· 9763 9718 localPlayer.pathY[0], 1, 1, 2, 0, 9764 9719 class50_sub1_sub4_sub3_sub2_6.pathX[0], 0, 0, 9765 9720 localPlayer.pathX[0]); 9766 - lastClickX = super.clickX; 9767 - lastClickY = super.clickY; 9721 + crossX = super.clickX; 9722 + crossY = super.clickY; 9768 9723 crossType = 2; 9769 9724 crossIndex = 0; 9770 9725 outBuffer.putOpcode(194); ··· 9778 9733 9779 9734 private void method121(boolean flag) { 9780 9735 anInt939 = 0; 9781 - for (int i = -1; i < localPlayerCount + anInt1133; i++) { 9736 + for (int i = -1; i < localPlayerCount + npcCount; i++) { 9782 9737 Object obj; 9783 9738 if (i == -1) 9784 9739 obj = localPlayer; 9785 9740 else if (i < localPlayerCount) 9786 9741 obj = players[playerList[i]]; 9787 9742 else 9788 - obj = npcs[anIntArray1134[i - localPlayerCount]]; 9743 + obj = npcs[npcIds[i - localPlayerCount]]; 9789 9744 if (obj == null || !((Actor) (obj)).isVisible()) 9790 9745 continue; 9791 9746 if (obj instanceof Npc) { ··· 9826 9781 aClass50_Sub1_Sub1_Sub1Array1079[class37_1.headIcon].drawImage(anInt932 - 12, anInt933 - 30 9827 9782 ); 9828 9783 } 9829 - if (headIconDrawType == 1 && anInt1226 == anIntArray1134[i - localPlayerCount] && pulseCycle % 20 < 10) { 9784 + if (headIconDrawType == 1 && anInt1226 == npcIds[i - localPlayerCount] && pulseCycle % 20 < 10) { 9830 9785 method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9831 9786 if (anInt932 > -1) 9832 9787 aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt932 - 12, anInt933 - 28); ··· 10030 9985 } 10031 9986 } 10032 9987 10033 - private void method123(int i) { 9988 + private void showErrorScreen() { 10034 9989 Graphics g = getParentComponent().getGraphics(); 10035 9990 g.setColor(Color.black); 10036 - i = 68 / i; 10037 9991 g.fillRect(0, 0, 765, 503); 10038 9992 setFrameRate(1); 10039 - if (aBoolean1283) { 10040 - aBoolean1243 = false; 9993 + if (loadingError) { 9994 + currentlyDrawingFlames = false; 10041 9995 g.setFont(new Font("Helvetica", 1, 16)); 10042 9996 g.setColor(Color.yellow); 10043 - int j = 35; 10044 - g.drawString("Sorry, an error has occured whilst loading RuneScape", 30, j); 10045 - j += 50; 9997 + int currentPositionY = 35; 9998 + g.drawString("Sorry, an error has occured whilst loading RuneScape", 30, currentPositionY); 9999 + currentPositionY += 50; 10046 10000 g.setColor(Color.white); 10047 - g.drawString("To fix this try the following (in order):", 30, j); 10048 - j += 50; 10001 + g.drawString("To fix this try the following (in order):", 30, currentPositionY); 10002 + currentPositionY += 50; 10049 10003 g.setColor(Color.white); 10050 10004 g.setFont(new Font("Helvetica", 1, 12)); 10051 - g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, j); 10052 - j += 30; 10053 - g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, j); 10054 - j += 30; 10055 - g.drawString("3: Try using a different game-world", 30, j); 10056 - j += 30; 10057 - g.drawString("4: Try rebooting your computer", 30, j); 10058 - j += 30; 10059 - g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, j); 10005 + g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, currentPositionY); 10006 + currentPositionY += 30; 10007 + g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, currentPositionY); 10008 + currentPositionY += 30; 10009 + g.drawString("3: Try using a different game-world", 30, currentPositionY); 10010 + currentPositionY += 30; 10011 + g.drawString("4: Try rebooting your computer", 30, currentPositionY); 10012 + currentPositionY += 30; 10013 + g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, currentPositionY); 10060 10014 } 10061 - if (aBoolean1097) { 10062 - aBoolean1243 = false; 10015 + if (genericLoadingError) { 10016 + currentlyDrawingFlames = false; 10063 10017 g.setFont(new Font("Helvetica", 1, 20)); 10064 10018 g.setColor(Color.white); 10065 10019 g.drawString("Error - unable to load game!", 50, 50); 10066 10020 g.drawString("To play RuneScape make sure you play from", 50, 100); 10067 10021 g.drawString("http://www.runescape.com", 50, 150); 10068 10022 } 10069 - if (aBoolean1016) { 10070 - aBoolean1243 = false; 10023 + if (rsAlreadyLoaded) { 10024 + currentlyDrawingFlames = false; 10071 10025 g.setColor(Color.yellow); 10072 - int k = 35; 10073 - g.drawString("Error a copy of RuneScape already appears to be loaded", 30, k); 10074 - k += 50; 10026 + int currentPositionY = 35; 10027 + g.drawString("Error a copy of RuneScape already appears to be loaded", 30, currentPositionY); 10028 + currentPositionY += 50; 10075 10029 g.setColor(Color.white); 10076 - g.drawString("To fix this try the following (in order):", 30, k); 10077 - k += 50; 10030 + g.drawString("To fix this try the following (in order):", 30, currentPositionY); 10031 + currentPositionY += 50; 10078 10032 g.setColor(Color.white); 10079 10033 g.setFont(new Font("Helvetica", 1, 12)); 10080 - g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k); 10081 - k += 30; 10082 - g.drawString("2: Try rebooting your computer, and reloading", 30, k); 10083 - k += 30; 10034 + g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, currentPositionY); 10035 + currentPositionY += 30; 10036 + g.drawString("2: Try rebooting your computer, and reloading", 30, currentPositionY); 10037 + currentPositionY += 30; 10084 10038 } 10085 10039 } 10086 10040 ··· 10163 10117 return j == 762; 10164 10118 } 10165 10119 10166 - private void method127(boolean flag) { 10167 - if (!flag) //never remove 10168 - anInt1056 = incomingRandom.nextInt(); 10120 + private void method127() { 10169 10121 if (headIconDrawType != 2) 10170 10122 return; 10171 10123 method137((anInt844 - nextTopLeftTileX << 7) + anInt847, anInt846 * 2, (anInt845 - nextTopRightTileY << 7) + anInt848, -214); ··· 10174 10126 } 10175 10127 10176 10128 public void repaintGame() { 10177 - if (aBoolean1016 || aBoolean1283 || aBoolean1097) { 10178 - method123(281); 10129 + if (rsAlreadyLoaded || loadingError || genericLoadingError) { 10130 + showErrorScreen(); 10179 10131 return; 10180 10132 } 10181 10133 drawCycle++; ··· 10224 10176 if (widget.cs1opcodes == null || id >= widget.cs1opcodes.length) 10225 10177 return -2; 10226 10178 try { 10227 - int opcodes[] = widget.cs1opcodes[id]; 10179 + int[] opcodes = widget.cs1opcodes[id]; 10228 10180 int result = 0; 10229 10181 int counter = 0; 10230 10182 int type = 0; ··· 10243 10195 if (opcode == 4) { 10244 10196 Widget widget1 = Widget.forId(opcodes[counter++]); 10245 10197 int itemId = opcodes[counter++]; 10198 + 10246 10199 if (itemId >= 0 && itemId < ItemDefinition.count && (!ItemDefinition.lookup(itemId).members || memberServer)) { 10247 10200 for (int item = 0; item < widget1.items.length; item++) 10248 - if (widget1.items[item] == itemId + 1) 10201 + if (widget1.items[item] == itemId + 1) { 10249 10202 value += widget1.itemAmounts[item]; 10250 10203 10204 + } 10205 + 10251 10206 } 10207 + 10252 10208 } 10253 10209 if (opcode == 5) 10254 10210 value = widgetSettings[opcodes[counter++]]; ··· 10272 10228 if (widget1.items[item] == itemId) { 10273 10229 continue; 10274 10230 } 10275 - value = 999999999; 10231 + value = 0; 10276 10232 break; 10277 10233 } 10278 10234 ··· 10380 10336 k += 30; 10381 10337 } 10382 10338 fontBold.drawShadowedString("Username: " + username 10383 - + ((anInt977 == 0) & (pulseCycle % 40 < 20) ? "@yel@|" : ""), c / 2 - 90, k, true, 0xffffff); 10339 + + ((loginScreenFocus == 0) & (pulseCycle % 40 < 20) ? "@yel@|" : ""), c / 2 - 90, k, true, 0xffffff); 10384 10340 k += 15; 10385 10341 fontBold.drawShadowedString("Password: " 10386 - + TextUtils.censorPassword(password) + ((anInt977 == 1) & (pulseCycle % 40 < 20) ? "@yel@|" : ""), c / 2 - 88, k, true, 0xffffff 10342 + + TextUtils.censorPassword(password) + ((loginScreenFocus == 1) & (pulseCycle % 40 < 20) ? "@yel@|" : ""), c / 2 - 88, k, true, 0xffffff 10387 10343 ); 10388 10344 k += 15; 10389 10345 if (!flag) { ··· 10439 10395 if (npcs[j] == null) 10440 10396 npcs[j] = new Npc(); 10441 10397 Npc class50_sub1_sub4_sub3_sub1 = npcs[j]; 10442 - anIntArray1134[anInt1133++] = j; 10398 + npcIds[npcCount++] = j; 10443 10399 class50_sub1_sub4_sub3_sub1.pulseCycle = pulseCycle; 10444 10400 int k = class50_sub1_sub2.getBits(1); 10445 10401 if (k == 1) ··· 10567 10523 Item item = new Item(); 10568 10524 item.itemId = itemId; 10569 10525 item.itemCount = amount; 10570 - if (groundItems[plane][x][y] == null) 10571 - groundItems[plane][x][y] = new LinkedList(); 10572 - groundItems[plane][x][y].pushBack(item); 10526 + if (groundItems.isTileEmpty(plane, x, y)) 10527 + groundItems.setTile(plane, x, y, new LinkedList()); 10528 + groundItems.getTile(plane, x, y).pushBack(item); 10573 10529 processGroundItems(x, y); 10574 10530 } 10575 10531 return; ··· 10636 10592 Item item = new Item(); 10637 10593 item.itemId = itemId; 10638 10594 item.itemCount = amount; 10639 - if (groundItems[plane][x][y] == null) 10640 - groundItems[plane][x][y] = new LinkedList(); 10641 - groundItems[plane][x][y].pushBack(item); 10595 + if (groundItems.isTileEmpty(plane, x, y)) 10596 + groundItems.setTile(plane, x, y, new LinkedList()); 10597 + groundItems.getTile(plane, x, y).pushBack(item); 10642 10598 processGroundItems(x, y); 10643 10599 } 10644 10600 return; ··· 10651 10607 int oldAmount = buf.getUnsignedShortBE(); 10652 10608 int newAmount = buf.getUnsignedShortBE(); 10653 10609 if (x >= 0 && y >= 0 && x < 104 && y < 104) { 10654 - LinkedList list = groundItems[plane][x][y]; 10610 + LinkedList list = groundItems.getTile(plane, x, y); 10655 10611 if (list != null) { 10656 10612 for (Item item = (Item) list.first(); item != null; item = (Item) list.next()) { 10657 10613 if (item.itemId != (itemId & 0x7fff) || item.itemCount != oldAmount) ··· 10689 10645 graphicsId, speed + pulseCycle, startSlope, entityIndex, getFloorDrawHeight(plane, startX, startY) - startHeight, startX, delay + pulseCycle); 10690 10646 projectile.trackTarget(endX, endY, getFloorDrawHeight(plane, endX, endY) - endHeight, delay 10691 10647 + pulseCycle); 10692 - aClass6_1282.pushBack(projectile); 10648 + projectileQueue.pushBack(projectile); 10693 10649 } 10694 10650 return; 10695 10651 } ··· 10723 10679 x = x * 128 + 64; 10724 10680 y = y * 128 + 64; 10725 10681 GameAnimableObject gameAnimableObject = new GameAnimableObject(plane, pulseCycle, delay, graphicsId, getFloorDrawHeight(plane, x, y) - graphicsHeight, y, x); 10726 - aClass6_1210.pushBack(gameAnimableObject); 10682 + gameAnimableObjectQueue.pushBack(gameAnimableObject); 10727 10683 } 10728 10684 return; 10729 10685 } ··· 10746 10702 int x = placementX + (offset >> 4 & 7); 10747 10703 int y = placementY + (offset & 7); 10748 10704 if (x >= 0 && y >= 0 && x < 104 && y < 104) { 10749 - LinkedList list = groundItems[plane][x][y]; 10705 + LinkedList list = groundItems.getTile(plane, x, y); 10750 10706 if (list != null) { 10751 10707 for (Item item = (Item) list.first(); item != null; item = (Item) list.next()) { 10752 10708 if (item.itemId != (itemId & 0x7fff)) ··· 10756 10712 } 10757 10713 10758 10714 if (list.first() == null) 10759 - groundItems[plane][x][y] = null; 10715 + groundItems.clearTile(plane, x, y); 10760 10716 processGroundItems(x, y); 10761 10717 } 10762 10718 } ··· 10843 10799 } 10844 10800 10845 10801 public Component getParentComponent() { 10846 - if (SignLink.applet != null) 10847 - return SignLink.applet; 10848 10802 if (super.gameFrame != null) 10849 10803 return super.gameFrame; 10850 10804 else ··· 10874 10828 aClass18_1200.drawGraphics(202, 171, super.gameGraphics); 10875 10829 if (aBoolean1046) { 10876 10830 aBoolean1046 = false; 10877 - if (!aBoolean1243) { 10831 + if (!currentlyDrawingFlames) { 10878 10832 flameLeftBackground.drawGraphics(0, 0, super.gameGraphics); 10879 10833 flameRightBackground.drawGraphics(637, 0, super.gameGraphics); 10880 10834 } ··· 10888 10842 } 10889 10843 10890 10844 private void prepareTitleBackground() { 10891 - byte abyte0[] = titleArchive.getFile("title.dat"); 10845 + byte[] abyte0 = titleArchive.getFile("title.dat"); 10892 10846 ImageRGB imageRGB = new ImageRGB(abyte0, this); 10893 10847 flameLeftBackground.createRasterizer(); 10894 10848 imageRGB.drawInverse(0, 0); ··· 10908 10862 imageRGB.drawInverse(-128, -171); 10909 10863 aClass18_1206.createRasterizer(); 10910 10864 imageRGB.drawInverse(-562, -171); 10911 - int ai[] = new int[imageRGB.width]; 10865 + int[] ai = new int[imageRGB.width]; 10912 10866 for (int i = 0; i < imageRGB.height; i++) { 10913 10867 for (int j = 0; j < imageRGB.width; j++) 10914 10868 ai[j] = imageRGB.pixels[(imageRGB.width - j - 1) ··· 10954 10908 if (byte0 != -61) 10955 10909 outBuffer.putByte(175); 10956 10910 if (spawnObjectNode.anInt1392 == 0) 10957 - i = currentScene.method267(spawnObjectNode.anInt1391, spawnObjectNode.anInt1393, spawnObjectNode.anInt1394); 10911 + i = currentScene.getWallObjectHash(spawnObjectNode.anInt1393, spawnObjectNode.anInt1394, spawnObjectNode.anInt1391); 10958 10912 if (spawnObjectNode.anInt1392 == 1) 10959 - i = currentScene.method268(spawnObjectNode.anInt1393, (byte) 4, spawnObjectNode.anInt1391, 10913 + i = currentScene.getWallDecorationHash(spawnObjectNode.anInt1393, spawnObjectNode.anInt1391, 10960 10914 spawnObjectNode.anInt1394); 10961 10915 if (spawnObjectNode.anInt1392 == 2) 10962 10916 i = currentScene.method269(spawnObjectNode.anInt1391, spawnObjectNode.anInt1393, spawnObjectNode.anInt1394); ··· 10974 10928 } 10975 10929 10976 10930 private void method141() { 10977 - aBoolean1243 = false; 10931 + currentlyDrawingFlames = false; 10978 10932 while (aBoolean1320) { 10979 - aBoolean1243 = false; 10933 + currentlyDrawingFlames = false; 10980 10934 try { 10981 10935 Thread.sleep(50L); 10982 10936 } catch (Exception _ex) { ··· 11059 11013 i7 = 0; 11060 11014 if (j8 < 5 && j8 > -5) 11061 11015 j8 = 0; 11062 - if (anInt1269 < 5) { 11016 + if (lastItemDragTime < 5) { 11063 11017 i7 = 0; 11064 11018 j8 = 0; 11065 11019 } ··· 11216 11170 imageRGB = child.enabledImage; 11217 11171 else 11218 11172 imageRGB = child.disabledImage; 11219 - switch (child.id) { 11220 - case 1164: 11221 - case 1167: 11222 - case 1170: 11223 - case 1174: 11224 - case 1540: 11225 - case 1541: 11226 - case 7455: 11227 - imageRGB = child.enabledImage; 11228 - break; 11229 - default: 11230 - break; 11173 + if (Configuration.FREE_TELEPORTS) { 11174 + 11175 + switch (child.id) { 11176 + case 1164: 11177 + case 1167: 11178 + case 1170: 11179 + case 1174: 11180 + case 1540: 11181 + case 1541: 11182 + case 7455: 11183 + imageRGB = child.enabledImage; 11184 + break; 11185 + default: 11186 + break; 11187 + } 11231 11188 } 11189 + 11232 11190 if (imageRGB != null) 11233 11191 imageRGB.drawImage(k2, l2); 11234 11192 } else if (child.type == 6) { ··· 11337 11295 Rasterizer.setCoordinates(j1, i1, l1, k1); 11338 11296 } 11339 11297 11340 - private void method143(byte byte0) { 11341 - if (byte0 != -40) 11342 - aBoolean1207 = !aBoolean1207; 11298 + private void loadingStages() { 11343 11299 if (lowMemory && loadingStage == 2 && Region.onBuildTimePlane != plane) { 11344 11300 method125(null, "Loading - please wait."); 11345 11301 loadingStage = 1; 11346 - aLong1229 = System.currentTimeMillis(); 11302 + loadRegionTime = System.currentTimeMillis(); 11347 11303 } 11348 11304 if (loadingStage == 1) { 11349 - int i = method144(5); 11350 - if (i != 0 && System.currentTimeMillis() - aLong1229 > 0x57e40L) { 11351 - SignLink.reportError(username + " glcfb " + serverSeed + "," + i + "," + lowMemory + "," 11305 + int loadingStages = initialiseRegionLoading(); 11306 + if (loadingStages != 0 && System.currentTimeMillis() - loadRegionTime > 0x57e40L) { 11307 + SignLink.reportError(username + " glcfb " + serverSeed + "," + loadingStages + "," + lowMemory + "," 11352 11308 + stores[0] + "," + onDemandRequester.method333() + "," + plane + "," 11353 11309 + chunkX + "," + chunkY); 11354 - aLong1229 = System.currentTimeMillis(); 11310 + loadRegionTime = System.currentTimeMillis(); 11355 11311 } 11356 11312 } 11357 - if (loadingStage == 2 && plane != anInt1276) { 11358 - anInt1276 = plane; 11313 + if (loadingStage == 2 && plane != lastRegionId) { 11314 + lastRegionId = plane; 11359 11315 renderViewport(plane); 11360 11316 } 11361 11317 } 11362 11318 11363 - private int method144(int i) { 11364 - for (int j = 0; j < terrainData.length; j++) { 11365 - if (terrainData[j] == null && terrainDataIds[j] != -1) 11319 + private int initialiseRegionLoading() { 11320 + for (int t = 0; t < terrainData.length; t++) { 11321 + if (terrainData[t] == null && terrainDataIds[t] != -1) 11366 11322 return -1; 11367 - if (objectData[j] == null && objectDataIds[j] != -1) 11323 + if (objectData[t] == null && objectDataIds[t] != -1) 11368 11324 return -2; 11369 11325 } 11370 11326 11371 - boolean flag = true; 11372 - if (i < 5 || i > 5) 11373 - aBoolean953 = !aBoolean953; 11374 - for (int k = 0; k < terrainData.length; k++) { 11375 - byte abyte0[] = objectData[k]; 11376 - if (abyte0 != null) { 11377 - int l = (mapCoordinates[k] >> 8) * 64 - nextTopLeftTileX; 11378 - int i1 = (mapCoordinates[k] & 0xff) * 64 - nextTopRightTileY; 11379 - if (aBoolean1163) { 11380 - l = 10; 11381 - i1 = 10; 11327 + boolean regionsCached = true; 11328 + for (int region = 0; region < terrainData.length; region++) { 11329 + byte[] objects = objectData[region]; 11330 + if (objects != null) { 11331 + int blockX = (mapCoordinates[region] >> 8) * 64 - nextTopLeftTileX; 11332 + int blockY = (mapCoordinates[region] & 0xff) * 64 - nextTopRightTileY; 11333 + if (loadGeneratedMap) { 11334 + blockX = 10; 11335 + blockY = 10; 11382 11336 } 11383 - flag &= Region.method181(l, i1, abyte0, 24515); 11337 + regionsCached &= Region.regionCached(blockX, blockY, objects); 11384 11338 } 11385 11339 } 11386 11340 11387 - if (!flag) 11341 + if (!regionsCached) 11388 11342 return -3; 11389 - if (aBoolean1209) { 11343 + if (loadingMap) { 11390 11344 return -4; 11391 11345 } else { 11392 11346 loadingStage = 2; 11393 11347 Region.onBuildTimePlane = plane; 11394 - method93(175); 11348 + loadRegion(); 11395 11349 outBuffer.putOpcode(6); 11396 11350 return 0; 11397 11351 } ··· 11499 11453 return s.equalsIgnoreCase(localPlayer.playerName); 11500 11454 } 11501 11455 11502 - private void method149(int i) { 11503 - while (i >= 0) 11504 - opcode = buffer.getUnsignedByte(); 11456 + private void updateLogin() { 11505 11457 if (loginScreenState == 0) { 11506 - int j = super.width / 2 - 80; 11507 - int i1 = super.height / 2 + 20; 11508 - i1 += 20; 11509 - if (super.clickType == 1 && super.clickX >= j - 75 && super.clickX <= j + 75 && super.clickY >= i1 - 20 11510 - && super.clickY <= i1 + 20) { 11458 + int x = super.width / 2 - 80; 11459 + int y = super.height / 2 + 20; 11460 + y += 20; 11461 + if (super.clickType == 1 && super.clickX >= x - 75 && super.clickX <= x + 75 && super.clickY >= y - 20 11462 + && super.clickY <= y + 20) { 11511 11463 loginScreenState = 3; 11512 - anInt977 = 0; 11464 + loginScreenFocus = 0; 11513 11465 } 11514 - j = super.width / 2 + 80; 11515 - if (super.clickType == 1 && super.clickX >= j - 75 && super.clickX <= j + 75 && super.clickY >= i1 - 20 11516 - && super.clickY <= i1 + 20) { 11466 + x = super.width / 2 + 80; 11467 + if (super.clickType == 1 && super.clickX >= x - 75 && super.clickX <= x + 75 && super.clickY >= y - 20 11468 + && super.clickY <= y + 20) { 11517 11469 statusLineOne = ""; 11518 11470 statusLineTwo = "Enter your username & password."; 11519 11471 loginScreenState = 2; 11520 - anInt977 = 0; 11472 + loginScreenFocus = 0; 11521 11473 } 11522 11474 } else { 11523 11475 if (loginScreenState == 2) { 11524 - int k = super.height / 2 - 40; 11525 - k += 30; 11526 - k += 25; 11527 - if (super.clickType == 1 && super.clickY >= k - 15 && super.clickY < k) 11528 - anInt977 = 0; 11529 - k += 15; 11530 - if (super.clickType == 1 && super.clickY >= k - 15 && super.clickY < k) 11531 - anInt977 = 1; 11532 - k += 15; 11476 + int y = super.height / 2 - 40; 11477 + y += 30; 11478 + y += 25; 11479 + if (super.clickType == 1 && super.clickY >= y - 15 && super.clickY < y) 11480 + loginScreenFocus = 0; 11481 + y += 15; 11482 + if (super.clickType == 1 && super.clickY >= y - 15 && super.clickY < y) 11483 + loginScreenFocus = 1; 11484 + y += 15; 11533 11485 int j1 = super.width / 2 - 80; 11534 11486 int l1 = super.height / 2 + 50; 11535 11487 l1 += 20; ··· 11553 11505 } 11554 11506 } 11555 11507 do { 11556 - int i2 = readCharacter(); 11557 - if (i2 == -1) 11508 + int character = readCharacter(); 11509 + if (character == -1) 11558 11510 break; 11559 - boolean flag = false; 11560 - for (int j2 = 0; j2 < VALID_CHARACTERS.length(); j2++) { 11561 - if (i2 != VALID_CHARACTERS.charAt(j2)) 11511 + boolean validCharacter = false; 11512 + for (int c = 0; c < VALID_CHARACTERS.length(); c++) { 11513 + if (character != VALID_CHARACTERS.charAt(c)) 11562 11514 continue; 11563 - flag = true; 11515 + validCharacter = true; 11564 11516 break; 11565 11517 } 11566 11518 11567 - if (anInt977 == 0) { 11568 - if (i2 == 8 && username.length() > 0) 11519 + if (loginScreenFocus == 0) { 11520 + if (character == 8 && username.length() > 0) 11569 11521 username = username.substring(0, username.length() - 1); 11570 - if (i2 == 9 || i2 == 10 || i2 == 13) 11571 - anInt977 = 1; 11572 - if (flag) 11573 - username += (char) i2; 11522 + if (character == 9 || character == 10 || character == 13) 11523 + loginScreenFocus = 1; 11524 + if (validCharacter) 11525 + username += (char) character; 11574 11526 if (username.length() > 12) 11575 11527 username = username.substring(0, 12); 11576 - } else if (anInt977 == 1) { 11577 - if (i2 == 8 && password.length() > 0) 11528 + } else if (loginScreenFocus == 1) { 11529 + if (character == 8 && password.length() > 0) 11578 11530 password = password.substring(0, password.length() - 1); 11579 - if (i2 == 9 || i2 == 10 || i2 == 13) 11580 - anInt977 = 0; 11581 - if (flag) 11582 - password += (char) i2; 11531 + if (character == 9 || character == 10 || character == 13) 11532 + loginScreenFocus = 0; 11533 + if (validCharacter) 11534 + password += (char) character; 11583 11535 if (password.length() > 20) 11584 11536 password = password.substring(0, 20); 11585 11537 } ··· 11587 11539 return; 11588 11540 } 11589 11541 if (loginScreenState == 3) { 11590 - int l = super.width / 2; 11591 - int k1 = super.height / 2 + 50; 11592 - k1 += 20; 11593 - if (super.clickType == 1 && super.clickX >= l - 75 && super.clickX <= l + 75 11594 - && super.clickY >= k1 - 20 && super.clickY <= k1 + 20) 11542 + int x = super.width / 2; 11543 + int y = super.height / 2 + 50; 11544 + y += 20; 11545 + if (super.clickType == 1 && super.clickX >= x - 75 && super.clickX <= x + 75 11546 + && super.clickY >= y - 20 && super.clickY <= y + 20) 11595 11547 loginScreenState = 0; 11596 11548 } 11597 11549 } 11598 11550 } 11599 11551 11600 11552 private void method150(int i, int j, int k, int l, int i1, int j1) { 11601 - int k1 = currentScene.method267(j, k, i); 11553 + int k1 = currentScene.getWallObjectHash(k, i, j); 11602 11554 i1 = 62 / i1; 11603 11555 if (k1 != 0) { 11604 11556 int l1 = currentScene.method271(j, k, i, k1); ··· 11607 11559 int k3 = j1; 11608 11560 if (k1 > 0) 11609 11561 k3 = l; 11610 - int ai[] = minimapImage.pixels; 11562 + int[] ai = minimapImage.pixels; 11611 11563 int k4 = 24624 + k * 4 + (103 - i) * 512 * 4; 11612 11564 int i5 = k1 >> 14 & 0x7fff; 11613 11565 GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(i5); ··· 11694 11646 int l4 = 0xeeeeee; 11695 11647 if (k1 > 0) 11696 11648 l4 = 0xee0000; 11697 - int ai1[] = minimapImage.pixels; 11649 + int[] ai1 = minimapImage.pixels; 11698 11650 int l5 = 24624 + k * 4 + (103 - i) * 512 * 4; 11699 11651 if (l2 == 0 || l2 == 2) { 11700 11652 ai1[l5 + 1536] = l4; ··· 11727 11679 private void renderGameView() { 11728 11680 this.renderCount++; 11729 11681 processPlayerAdditions(true); 11730 - renderNPCs(751, true); 11682 + renderNPCs(true); 11731 11683 processPlayerAdditions(false); 11732 - renderNPCs(751, false); 11684 + renderNPCs(false); 11733 11685 renderProjectiles(); 11734 - renderStationaryGraphics(-992); 11686 + renderStationaryGraphics(); 11735 11687 if (!cutsceneActive) { 11736 11688 int vertical = cameraVertical; 11737 11689 if (secondaryCameraVertical / 256 > vertical) ··· 11783 11735 currentScene.render(cameraX, cameraPlane, 0, cameraZ, cameraY, cameraHorizontalRotation, cameraVerticalRotation); 11784 11736 currentScene.clearInteractiveObjectCache(); 11785 11737 method121(false); 11786 - method127(true); 11738 + method127(); 11787 11739 animateTexture(textureId); 11788 11740 draw3dScreen(); 11789 11741 gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics);
+6 -5
src/main/java/com/jagex/runescape/GameShell.java
··· 17 17 public int mindel = 1; 18 18 private long optims[] = new long[10]; 19 19 public int fps; 20 + public int cameraZoom = 600; 20 21 public boolean dumpRequested = false; 21 22 public int width; 22 23 public int height; ··· 144 145 clickY = eventClickY; 145 146 clickTime = lastClick; 146 147 eventMouseButtonPressed = 0; 147 - doLogic(); 148 + processGameLoop(); 148 149 readIndex = writeIndex; 149 150 } 150 151 ··· 416 417 public void startup() { 417 418 } 418 419 419 - public void doLogic() { 420 + public void processGameLoop() { 420 421 } 421 422 422 423 public void shutdown() { ··· 445 446 int rotation = event.getWheelRotation(); 446 447 if (this instanceof Game) { 447 448 if(!handleInterfaceScrolling(event, (Game) this)) { 448 - if ((Game.cameraZoom <= 300 && rotation <= 0) 449 - || (Game.cameraZoom >= 1200 && rotation >= 0)) { 449 + if ((cameraZoom <= 300 && rotation <= 0) 450 + || (cameraZoom >= 1200 && rotation >= 0)) { 450 451 return; 451 452 } 452 453 int diff = rotation * 8; 453 - Game.cameraZoom = Game.cameraZoom + diff; 454 + cameraZoom = cameraZoom + diff; 454 455 } 455 456 } 456 457 }
+331 -341
src/main/java/com/jagex/runescape/cache/bzip/BZip2Decompressor.java
··· 4 4 5 5 public static Bzip2Context state = new Bzip2Context(); 6 6 7 - public static int decompress(byte output[], int lenght, byte compressed[], int decompressedLength, int minLen) { 7 + public static int decompress(byte[] output, int lenght, byte[] compressed, int decompressedLength, int minLen) { 8 8 synchronized (state) { 9 9 state.compressed = compressed; 10 10 state.nextIn = minLen; 11 - state.decompressed = output; 11 + state.buf = output; 12 12 state.nextOut = 0; 13 13 state.decompressedLength = decompressedLength; 14 - state.lenght = lenght; 14 + state.availOut = lenght; 15 15 state.bsLive = 0; 16 16 state.bsBuff = 0; 17 17 state.totalInLo32 = 0; ··· 20 20 state.totalOutHigh32 = 0; 21 21 state.currentBlock = 0; 22 22 decompress(state); 23 - lenght -= state.lenght; 23 + lenght -= state.availOut; 24 24 return lenght; 25 25 } 26 26 } 27 27 28 28 public static void method313(Bzip2Context bzip2Context) { 29 - byte byte4 = bzip2Context.aByte57; 30 - int i = bzip2Context.anInt58; 31 - int j = bzip2Context.anInt68; 32 - int k = bzip2Context.anInt66; 33 - int ai[] = Bzip2Context.anIntArray71; 34 - int l = bzip2Context.anInt65; 35 - byte abyte0[] = bzip2Context.decompressed; 36 - int i1 = bzip2Context.nextOut; 37 - int j1 = bzip2Context.lenght; 38 - int k1 = j1; 39 - int l1 = bzip2Context.anInt85 + 1; 40 - label0: do { 41 - if (i > 0) { 29 + byte stateOutCh = bzip2Context.stateOutCh; 30 + int stateOutLen = bzip2Context.stateOutLen; 31 + int nBlockUsed = bzip2Context.nBlockUsed; 32 + int k0 = bzip2Context.k0; 33 + int[] tt = Bzip2Context.tt; 34 + int tPos = bzip2Context.tPos; 35 + byte[] buf = bzip2Context.buf; 36 + int csNextOut = bzip2Context.nextOut; 37 + int csAvailOut = bzip2Context.availOut; 38 + int availOutInit = csAvailOut; 39 + int savedNBlockPP = bzip2Context.nBlock + 1; 40 + outer: do { 41 + if (stateOutLen > 0) { 42 42 do { 43 - if (j1 == 0) 44 - break label0; 45 - if (i == 1) 43 + if (csAvailOut == 0) 44 + break outer; 45 + if (stateOutLen == 1) 46 46 break; 47 - abyte0[i1] = byte4; 48 - i--; 49 - i1++; 50 - j1--; 47 + buf[csNextOut] = stateOutCh; 48 + stateOutLen--; 49 + csNextOut++; 50 + csAvailOut--; 51 51 } while (true); 52 - if (j1 == 0) { 53 - i = 1; 52 + if (csAvailOut == 0) { 53 + stateOutLen = 1; 54 54 break; 55 55 } 56 - abyte0[i1] = byte4; 57 - i1++; 58 - j1--; 56 + buf[csNextOut] = stateOutCh; 57 + csNextOut++; 58 + csAvailOut--; 59 59 } 60 60 boolean flag = true; 61 61 while (flag) { 62 62 flag = false; 63 - if (j == l1) { 64 - i = 0; 65 - break label0; 63 + if (nBlockUsed == savedNBlockPP) { 64 + stateOutLen = 0; 65 + break outer; 66 66 } 67 - byte4 = (byte) k; 68 - l = ai[l]; 69 - byte byte0 = (byte) (l & 0xff); 70 - l >>= 8; 71 - j++; 72 - if (byte0 != k) { 73 - k = byte0; 74 - if (j1 == 0) { 75 - i = 1; 67 + stateOutCh = (byte) k0; 68 + tPos = tt[tPos]; 69 + byte k1 = (byte) (tPos & 0xff); 70 + tPos >>= 8; 71 + nBlockUsed++; 72 + if (k1 != k0) { 73 + k0 = k1; 74 + if (csAvailOut == 0) { 75 + stateOutLen = 1; 76 76 } else { 77 - abyte0[i1] = byte4; 78 - i1++; 79 - j1--; 77 + buf[csNextOut] = stateOutCh; 78 + csNextOut++; 79 + csAvailOut--; 80 80 flag = true; 81 81 continue; 82 82 } 83 - break label0; 83 + break outer; 84 84 } 85 - if (j != l1) 85 + if (nBlockUsed != savedNBlockPP) 86 86 continue; 87 - if (j1 == 0) { 88 - i = 1; 89 - break label0; 87 + if (csAvailOut == 0) { 88 + stateOutLen = 1; 89 + break outer; 90 90 } 91 - abyte0[i1] = byte4; 92 - i1++; 93 - j1--; 91 + buf[csNextOut] = stateOutCh; 92 + csNextOut++; 93 + csAvailOut--; 94 94 flag = true; 95 95 } 96 - i = 2; 97 - l = ai[l]; 98 - byte byte1 = (byte) (l & 0xff); 99 - l >>= 8; 100 - if (++j != l1) 101 - if (byte1 != k) { 102 - k = byte1; 96 + stateOutLen = 2; 97 + tPos = tt[tPos]; 98 + byte k1 = (byte) (tPos & 0xff); 99 + tPos >>= 8; 100 + if (++nBlockUsed != savedNBlockPP) 101 + if (k1 != k0) { 102 + k0 = k1; 103 103 } else { 104 - i = 3; 105 - l = ai[l]; 106 - byte byte2 = (byte) (l & 0xff); 107 - l >>= 8; 108 - if (++j != l1) 109 - if (byte2 != k) { 110 - k = byte2; 104 + stateOutLen = 3; 105 + tPos = tt[tPos]; 106 + byte k1_ = (byte) (tPos & 0xff); 107 + tPos >>= 8; 108 + if (++nBlockUsed != savedNBlockPP) 109 + if (k1_ != k0) { 110 + k0 = k1_; 111 111 } else { 112 - l = ai[l]; 113 - byte byte3 = (byte) (l & 0xff); 114 - l >>= 8; 115 - j++; 116 - i = (byte3 & 0xff) + 4; 117 - l = ai[l]; 118 - k = (byte) (l & 0xff); 119 - l >>= 8; 120 - j++; 112 + tPos = tt[tPos]; 113 + byte byte3 = (byte) (tPos & 0xff); 114 + tPos >>= 8; 115 + nBlockUsed++; 116 + stateOutLen = (byte3 & 0xff) + 4; 117 + tPos = tt[tPos]; 118 + k0 = (byte) (tPos & 0xff); 119 + tPos >>= 8; 120 + nBlockUsed++; 121 121 } 122 122 } 123 123 } while (true); 124 - int i2 = bzip2Context.totalOutLo32; 125 - bzip2Context.totalOutLo32 += k1 - j1; 126 - if (bzip2Context.totalOutLo32 < i2) 124 + int oldTotalOutLo32 = bzip2Context.totalOutLo32; 125 + bzip2Context.totalOutLo32 += availOutInit - csAvailOut; 126 + if (bzip2Context.totalOutLo32 < oldTotalOutLo32) 127 127 bzip2Context.totalOutHigh32++; 128 - bzip2Context.aByte57 = byte4; 129 - bzip2Context.anInt58 = i; 130 - bzip2Context.anInt68 = j; 131 - bzip2Context.anInt66 = k; 132 - Bzip2Context.anIntArray71 = ai; 133 - bzip2Context.anInt65 = l; 134 - bzip2Context.decompressed = abyte0; 135 - bzip2Context.nextOut = i1; 136 - bzip2Context.lenght = j1; 128 + bzip2Context.stateOutCh = stateOutCh; 129 + bzip2Context.stateOutLen = stateOutLen; 130 + bzip2Context.nBlockUsed = nBlockUsed; 131 + bzip2Context.k0 = k0; 132 + Bzip2Context.tt = tt; 133 + bzip2Context.tPos = tPos; 134 + bzip2Context.buf = buf; 135 + bzip2Context.nextOut = csNextOut; 136 + bzip2Context.availOut = csAvailOut; 137 137 } 138 138 139 139 public static void decompress(Bzip2Context bzip2Context) { 140 - int k8 = 0; 141 - int ai[] = null; 142 - int ai1[] = null; 143 - int ai2[] = null; 144 - bzip2Context.anInt62 = 1; 145 - if (Bzip2Context.anIntArray71 == null) 146 - Bzip2Context.anIntArray71 = new int[bzip2Context.anInt62 * 0x186a0]; 140 + int gMinLen = 0; 141 + int[] gLimit = null; 142 + int[] gBase = null; 143 + int[] gPerm = null; 144 + bzip2Context.blockSize100k = 1; 145 + if (Bzip2Context.tt == null) 146 + Bzip2Context.tt = new int[bzip2Context.blockSize100k * 0x186a0]; 147 147 boolean flag19 = true; 148 148 while (flag19) { 149 - byte b = method315(bzip2Context); 150 - if (b == 23) 149 + byte uc = getUChar(bzip2Context); 150 + if (uc == 23) 151 151 return; 152 - b = method315(bzip2Context); 153 - b = method315(bzip2Context); 154 - b = method315(bzip2Context); 155 - b = method315(bzip2Context); 156 - b = method315(bzip2Context); 152 + uc = getUChar(bzip2Context); 153 + uc = getUChar(bzip2Context); 154 + uc = getUChar(bzip2Context); 155 + uc = getUChar(bzip2Context); 156 + uc = getUChar(bzip2Context); 157 157 bzip2Context.currentBlock++; 158 - b = method315(bzip2Context); 159 - b = method315(bzip2Context); 160 - b = method315(bzip2Context); 161 - b = method315(bzip2Context); 162 - b = method316(bzip2Context); 163 - if (b != 0) 164 - bzip2Context.aBoolean59 = true; 165 - else 166 - bzip2Context.aBoolean59 = false; 167 - if (bzip2Context.aBoolean59) 158 + uc = getUChar(bzip2Context); 159 + uc = getUChar(bzip2Context); 160 + uc = getUChar(bzip2Context); 161 + uc = getUChar(bzip2Context); 162 + uc = getBit(bzip2Context); 163 + bzip2Context.blockRandomised = uc != 0; 164 + if (bzip2Context.blockRandomised) 168 165 System.out.println("PANIC! RANDOMISED BLOCK!"); 169 - bzip2Context.anInt64 = 0; 170 - b = method315(bzip2Context); 171 - bzip2Context.anInt64 = bzip2Context.anInt64 << 8 | b & 0xff; 172 - b = method315(bzip2Context); 173 - bzip2Context.anInt64 = bzip2Context.anInt64 << 8 | b & 0xff; 174 - b = method315(bzip2Context); 175 - bzip2Context.anInt64 = bzip2Context.anInt64 << 8 | b & 0xff; 176 - for (int j = 0; j < 16; j++) { 177 - byte byte1 = method316(bzip2Context); 178 - if (byte1 == 1) 179 - bzip2Context.aBooleanArray74[j] = true; 180 - else 181 - bzip2Context.aBooleanArray74[j] = false; 166 + bzip2Context.origPtr = 0; 167 + uc = getUChar(bzip2Context); 168 + bzip2Context.origPtr = bzip2Context.origPtr << 8 | uc & 0xff; 169 + uc = getUChar(bzip2Context); 170 + bzip2Context.origPtr = bzip2Context.origPtr << 8 | uc & 0xff; 171 + uc = getUChar(bzip2Context); 172 + bzip2Context.origPtr = bzip2Context.origPtr << 8 | uc & 0xff; 173 + for (int i = 0; i < 16; i++) { 174 + byte bit = getBit(bzip2Context); 175 + bzip2Context.inUse16[i] = bit == 1; 182 176 } 183 177 184 - for (int k = 0; k < 256; k++) 185 - bzip2Context.aBooleanArray73[k] = false; 178 + for (int i = 0; i < 256; i++) 179 + bzip2Context.inUse[i] = false; 186 180 187 - for (int l = 0; l < 16; l++) 188 - if (bzip2Context.aBooleanArray74[l]) { 189 - for (int i3 = 0; i3 < 16; i3++) { 190 - byte byte2 = method316(bzip2Context); 181 + for (int i = 0; i < 16; i++) 182 + if (bzip2Context.inUse16[i]) { 183 + for (int j = 0; j < 16; j++) { 184 + byte byte2 = getBit(bzip2Context); 191 185 if (byte2 == 1) 192 - bzip2Context.aBooleanArray73[l * 16 + i3] = true; 186 + bzip2Context.inUse[i * 16 + j] = true; 193 187 } 194 188 195 189 } 196 190 197 - method318(bzip2Context); 198 - int i4 = bzip2Context.anInt72 + 2; 199 - int j4 = method317(3, bzip2Context); 200 - int k4 = method317(15, bzip2Context); 201 - for (int i1 = 0; i1 < k4; i1++) { 202 - int j3 = 0; 191 + makeMaps(bzip2Context); 192 + int alphaSize = bzip2Context.nInUse + 2; 193 + int nGroups = getBits(3, bzip2Context); 194 + int nSelectors = getBits(15, bzip2Context); 195 + for (int i = 0; i < nSelectors; i++) { 196 + int count = 0; 203 197 do { 204 - byte byte3 = method316(bzip2Context); 205 - if (byte3 == 0) 198 + byte terminator = getBit(bzip2Context); 199 + if (terminator == 0) 206 200 break; 207 - j3++; 201 + count++; 208 202 } while (true); 209 - bzip2Context.aByteArray79[i1] = (byte) j3; 203 + bzip2Context.selectorMtf[i] = (byte) count; 210 204 } 211 205 212 - byte abyte0[] = new byte[6]; 213 - for (byte byte16 = 0; byte16 < j4; byte16++) 214 - abyte0[byte16] = byte16; 206 + byte[] pos = new byte[6]; 207 + for (byte v = 0; v < nGroups; v++) 208 + pos[v] = v; 215 209 216 - for (int j1 = 0; j1 < k4; j1++) { 217 - byte byte17 = bzip2Context.aByteArray79[j1]; 218 - byte byte15 = abyte0[byte17]; 219 - for (; byte17 > 0; byte17--) 220 - abyte0[byte17] = abyte0[byte17 - 1]; 210 + for (int i = 0; i < nSelectors; i++) { 211 + byte v = bzip2Context.selectorMtf[i]; 212 + byte temp = pos[v]; 213 + for (; v > 0; v--) 214 + pos[v] = pos[v - 1]; 221 215 222 - abyte0[0] = byte15; 223 - bzip2Context.aByteArray78[j1] = byte15; 216 + pos[0] = temp; 217 + bzip2Context.selector[i] = temp; 224 218 } 225 219 226 - for (int k3 = 0; k3 < j4; k3++) { 227 - int l6 = method317(5, bzip2Context); 228 - for (int k1 = 0; k1 < i4; k1++) { 220 + for (int t = 0; t < nGroups; t++) { 221 + int curr = getBits(5, bzip2Context); 222 + for (int i = 0; i < alphaSize; i++) { 229 223 do { 230 - byte byte4 = method316(bzip2Context); 231 - if (byte4 == 0) 224 + byte bit = getBit(bzip2Context); 225 + if (bit == 0) 232 226 break; 233 - byte4 = method316(bzip2Context); 234 - if (byte4 == 0) 235 - l6++; 227 + bit = getBit(bzip2Context); 228 + if (bit == 0) 229 + curr++; 236 230 else 237 - l6--; 231 + curr--; 238 232 } while (true); 239 - bzip2Context.aByteArrayArray80[k3][k1] = (byte) l6; 233 + bzip2Context.len[t][i] = (byte) curr; 240 234 } 241 235 242 236 } 243 237 244 - for (int l3 = 0; l3 < j4; l3++) { 245 - byte byte8 = 32; 246 - int i = 0; 247 - for (int l1 = 0; l1 < i4; l1++) { 248 - if (bzip2Context.aByteArrayArray80[l3][l1] > i) 249 - i = bzip2Context.aByteArrayArray80[l3][l1]; 250 - if (bzip2Context.aByteArrayArray80[l3][l1] < byte8) 251 - byte8 = bzip2Context.aByteArrayArray80[l3][l1]; 238 + for (int t = 0; t < nGroups; t++) { 239 + byte minLen = 32; 240 + int maxLen = 0; 241 + for (int i = 0; i < alphaSize; i++) { 242 + if (bzip2Context.len[t][i] > maxLen) 243 + maxLen = bzip2Context.len[t][i]; 244 + if (bzip2Context.len[t][i] < minLen) 245 + minLen = bzip2Context.len[t][i]; 252 246 } 253 247 254 - method319(bzip2Context.anIntArrayArray81[l3], bzip2Context.anIntArrayArray82[l3], bzip2Context.anIntArrayArray83[l3], 255 - bzip2Context.aByteArrayArray80[l3], byte8, i, i4); 256 - bzip2Context.anIntArray84[l3] = byte8; 248 + createDecodeTables(bzip2Context.limit[t], bzip2Context.base[t], bzip2Context.perm[t], 249 + bzip2Context.len[t], minLen, maxLen, alphaSize); 250 + bzip2Context.minLens[t] = minLen; 257 251 } 258 252 259 - int l4 = bzip2Context.anInt72 + 1; 260 - //int l5 = 0x186a0 * class1.anInt62; 261 - int i5 = -1; 262 - int j5 = 0; 263 - for (int i2 = 0; i2 <= 255; i2++) 264 - bzip2Context.anIntArray67[i2] = 0; 253 + int eob = bzip2Context.nInUse + 1; 254 + //int l5 = 0x186a0 * class1.blockSize100k; 255 + int groupNo = -1; 256 + int groupPos = 0; 257 + for (int i = 0; i <= 255; i++) 258 + bzip2Context.unzftab[i] = 0; 265 259 266 - int j9 = 4095; 267 - for (int l8 = 15; l8 >= 0; l8--) { 268 - for (int i9 = 15; i9 >= 0; i9--) { 269 - bzip2Context.aByteArray76[j9] = (byte) (l8 * 16 + i9); 270 - j9--; 260 + int kk = 4095; 261 + for (int ii = 15; ii >= 0; ii--) { 262 + for (int jj = 15; jj >= 0; jj--) { 263 + bzip2Context.mtfa[kk] = (byte) (ii * 16 + jj); 264 + kk--; 271 265 } 272 266 273 - bzip2Context.anIntArray77[l8] = j9 + 1; 267 + bzip2Context.mtfbase[ii] = kk + 1; 274 268 } 275 269 276 - int i6 = 0; 277 - if (j5 == 0) { 278 - i5++; 279 - j5 = 50; 280 - byte byte12 = bzip2Context.aByteArray78[i5]; 281 - k8 = bzip2Context.anIntArray84[byte12]; 282 - ai = bzip2Context.anIntArrayArray81[byte12]; 283 - ai2 = bzip2Context.anIntArrayArray83[byte12]; 284 - ai1 = bzip2Context.anIntArrayArray82[byte12]; 270 + int nblock = 0; 271 + if (groupPos == 0) { 272 + groupNo++; 273 + groupPos = 50; 274 + byte gSel = bzip2Context.selector[groupNo]; 275 + gMinLen = bzip2Context.minLens[gSel]; 276 + gLimit = bzip2Context.limit[gSel]; 277 + gPerm = bzip2Context.perm[gSel]; 278 + gBase = bzip2Context.base[gSel]; 285 279 } 286 - j5--; 287 - int i7 = k8; 288 - int l7; 289 - byte byte9; 290 - for (l7 = method317(i7, bzip2Context); l7 > ai[i7]; l7 = l7 << 1 | byte9) { 291 - i7++; 292 - byte9 = method316(bzip2Context); 280 + groupPos--; 281 + int zn = gMinLen; 282 + int zvec; 283 + byte zj; 284 + for (zvec = getBits(zn, bzip2Context); zvec > gLimit[zn]; zvec = zvec << 1 | zj) { 285 + zn++; 286 + zj = getBit(bzip2Context); 293 287 } 294 288 295 - for (int k5 = ai2[l7 - ai1[i7]]; k5 != l4;) 296 - if (k5 == 0 || k5 == 1) { 297 - int j6 = -1; 298 - int k6 = 1; 289 + for (int nextSym = gPerm[zvec - gBase[zn]]; nextSym != eob;) 290 + if (nextSym == 0 || nextSym == 1) { 291 + int es = -1; 292 + int n = 1; 299 293 do { 300 - if (k5 == 0) 301 - j6 += k6; 302 - else if (k5 == 1) 303 - j6 += 2 * k6; 304 - k6 *= 2; 305 - if (j5 == 0) { 306 - i5++; 307 - j5 = 50; 308 - byte byte13 = bzip2Context.aByteArray78[i5]; 309 - k8 = bzip2Context.anIntArray84[byte13]; 310 - ai = bzip2Context.anIntArrayArray81[byte13]; 311 - ai2 = bzip2Context.anIntArrayArray83[byte13]; 312 - ai1 = bzip2Context.anIntArrayArray82[byte13]; 294 + if (nextSym == 0) 295 + es += n; 296 + else if (nextSym == 1) 297 + es += 2 * n; 298 + n *= 2; 299 + if (groupPos == 0) { 300 + groupNo++; 301 + groupPos = 50; 302 + byte gSel = bzip2Context.selector[groupNo]; 303 + gMinLen = bzip2Context.minLens[gSel]; 304 + gLimit = bzip2Context.limit[gSel]; 305 + gPerm = bzip2Context.perm[gSel]; 306 + gBase = bzip2Context.base[gSel]; 313 307 } 314 - j5--; 315 - int j7 = k8; 316 - int i8; 308 + groupPos--; 309 + int zn_ = gMinLen; 310 + int zvec_; 317 311 byte byte10; 318 - for (i8 = method317(j7, bzip2Context); i8 > ai[j7]; i8 = i8 << 1 | byte10) { 319 - j7++; 320 - byte10 = method316(bzip2Context); 312 + for (zvec_ = getBits(zn_, bzip2Context); zvec_ > gLimit[zn_]; zvec_ = zvec_ << 1 | byte10) { 313 + zn_++; 314 + byte10 = getBit(bzip2Context); 321 315 } 322 316 323 - k5 = ai2[i8 - ai1[j7]]; 324 - } while (k5 == 0 || k5 == 1); 325 - j6++; 326 - byte byte5 = bzip2Context.aByteArray75[bzip2Context.aByteArray76[bzip2Context.anIntArray77[0]] & 0xff]; 327 - bzip2Context.anIntArray67[byte5 & 0xff] += j6; 328 - for (; j6 > 0; j6--) { 329 - Bzip2Context.anIntArray71[i6] = byte5 & 0xff; 330 - i6++; 317 + nextSym = gPerm[zvec_ - gBase[zn_]]; 318 + } while (nextSym == 0 || nextSym == 1); 319 + es++; 320 + byte ec = bzip2Context.seqToUnseq[bzip2Context.mtfa[bzip2Context.mtfbase[0]] & 0xff]; 321 + bzip2Context.unzftab[ec & 0xff] += es; 322 + for (; es > 0; es--) { 323 + Bzip2Context.tt[nblock] = ec & 0xff; 324 + nblock++; 331 325 } 332 326 333 327 } else { 334 - int j11 = k5 - 1; 335 - byte byte6; 336 - if (j11 < 16) { 337 - int j10 = bzip2Context.anIntArray77[0]; 338 - byte6 = bzip2Context.aByteArray76[j10 + j11]; 339 - for (; j11 > 3; j11 -= 4) { 340 - int k11 = j10 + j11; 341 - bzip2Context.aByteArray76[k11] = bzip2Context.aByteArray76[k11 - 1]; 342 - bzip2Context.aByteArray76[k11 - 1] = bzip2Context.aByteArray76[k11 - 2]; 343 - bzip2Context.aByteArray76[k11 - 2] = bzip2Context.aByteArray76[k11 - 3]; 344 - bzip2Context.aByteArray76[k11 - 3] = bzip2Context.aByteArray76[k11 - 4]; 328 + int nn = nextSym - 1; 329 + byte uc_; 330 + if (nn < 16) { 331 + int j10 = bzip2Context.mtfbase[0]; 332 + uc_ = bzip2Context.mtfa[j10 + nn]; 333 + for (; nn > 3; nn -= 4) { 334 + int k11 = j10 + nn; 335 + bzip2Context.mtfa[k11] = bzip2Context.mtfa[k11 - 1]; 336 + bzip2Context.mtfa[k11 - 1] = bzip2Context.mtfa[k11 - 2]; 337 + bzip2Context.mtfa[k11 - 2] = bzip2Context.mtfa[k11 - 3]; 338 + bzip2Context.mtfa[k11 - 3] = bzip2Context.mtfa[k11 - 4]; 345 339 } 346 340 347 - for (; j11 > 0; j11--) 348 - bzip2Context.aByteArray76[j10 + j11] = bzip2Context.aByteArray76[(j10 + j11) - 1]; 341 + for (; nn > 0; nn--) 342 + bzip2Context.mtfa[j10 + nn] = bzip2Context.mtfa[(j10 + nn) - 1]; 349 343 350 - bzip2Context.aByteArray76[j10] = byte6; 344 + bzip2Context.mtfa[j10] = uc_; 351 345 } else { 352 - int l10 = j11 / 16; 353 - int i11 = j11 % 16; 354 - int k10 = bzip2Context.anIntArray77[l10] + i11; 355 - byte6 = bzip2Context.aByteArray76[k10]; 356 - for (; k10 > bzip2Context.anIntArray77[l10]; k10--) 357 - bzip2Context.aByteArray76[k10] = bzip2Context.aByteArray76[k10 - 1]; 346 + int l10 = nn / 16; 347 + int i11 = nn % 16; 348 + int k10 = bzip2Context.mtfbase[l10] + i11; 349 + uc_ = bzip2Context.mtfa[k10]; 350 + for (; k10 > bzip2Context.mtfbase[l10]; k10--) 351 + bzip2Context.mtfa[k10] = bzip2Context.mtfa[k10 - 1]; 358 352 359 - bzip2Context.anIntArray77[l10]++; 353 + bzip2Context.mtfbase[l10]++; 360 354 for (; l10 > 0; l10--) { 361 - bzip2Context.anIntArray77[l10]--; 362 - bzip2Context.aByteArray76[bzip2Context.anIntArray77[l10]] = bzip2Context.aByteArray76[(bzip2Context.anIntArray77[l10 - 1] + 16) - 1]; 355 + bzip2Context.mtfbase[l10]--; 356 + bzip2Context.mtfa[bzip2Context.mtfbase[l10]] = bzip2Context.mtfa[(bzip2Context.mtfbase[l10 - 1] + 16) - 1]; 363 357 } 364 358 365 - bzip2Context.anIntArray77[0]--; 366 - bzip2Context.aByteArray76[bzip2Context.anIntArray77[0]] = byte6; 367 - if (bzip2Context.anIntArray77[0] == 0) { 359 + bzip2Context.mtfbase[0]--; 360 + bzip2Context.mtfa[bzip2Context.mtfbase[0]] = uc_; 361 + if (bzip2Context.mtfbase[0] == 0) { 368 362 int i10 = 4095; 369 363 for (int k9 = 15; k9 >= 0; k9--) { 370 364 for (int l9 = 15; l9 >= 0; l9--) { 371 - bzip2Context.aByteArray76[i10] = bzip2Context.aByteArray76[bzip2Context.anIntArray77[k9] + l9]; 365 + bzip2Context.mtfa[i10] = bzip2Context.mtfa[bzip2Context.mtfbase[k9] + l9]; 372 366 i10--; 373 367 } 374 368 375 - bzip2Context.anIntArray77[k9] = i10 + 1; 369 + bzip2Context.mtfbase[k9] = i10 + 1; 376 370 } 377 371 378 372 } 379 373 } 380 - bzip2Context.anIntArray67[bzip2Context.aByteArray75[byte6 & 0xff] & 0xff]++; 381 - Bzip2Context.anIntArray71[i6] = bzip2Context.aByteArray75[byte6 & 0xff] & 0xff; 382 - i6++; 383 - if (j5 == 0) { 384 - i5++; 385 - j5 = 50; 386 - byte byte14 = bzip2Context.aByteArray78[i5]; 387 - k8 = bzip2Context.anIntArray84[byte14]; 388 - ai = bzip2Context.anIntArrayArray81[byte14]; 389 - ai2 = bzip2Context.anIntArrayArray83[byte14]; 390 - ai1 = bzip2Context.anIntArrayArray82[byte14]; 374 + bzip2Context.unzftab[bzip2Context.seqToUnseq[uc_ & 0xff] & 0xff]++; 375 + Bzip2Context.tt[nblock] = bzip2Context.seqToUnseq[uc_ & 0xff] & 0xff; 376 + nblock++; 377 + if (groupPos == 0) { 378 + groupNo++; 379 + groupPos = 50; 380 + byte byte14 = bzip2Context.selector[groupNo]; 381 + gMinLen = bzip2Context.minLens[byte14]; 382 + gLimit = bzip2Context.limit[byte14]; 383 + gPerm = bzip2Context.perm[byte14]; 384 + gBase = bzip2Context.base[byte14]; 391 385 } 392 - j5--; 393 - int k7 = k8; 386 + groupPos--; 387 + int k7 = gMinLen; 394 388 int j8; 395 389 byte byte11; 396 - for (j8 = method317(k7, bzip2Context); j8 > ai[k7]; j8 = j8 << 1 | byte11) { 390 + for (j8 = getBits(k7, bzip2Context); j8 > gLimit[k7]; j8 = j8 << 1 | byte11) { 397 391 k7++; 398 - byte11 = method316(bzip2Context); 392 + byte11 = getBit(bzip2Context); 399 393 } 400 394 401 - k5 = ai2[j8 - ai1[k7]]; 395 + nextSym = gPerm[j8 - gBase[k7]]; 402 396 } 403 397 404 - bzip2Context.anInt58 = 0; 405 - bzip2Context.aByte57 = 0; 406 - bzip2Context.anIntArray69[0] = 0; 407 - for (int j2 = 1; j2 <= 256; j2++) 408 - bzip2Context.anIntArray69[j2] = bzip2Context.anIntArray67[j2 - 1]; 398 + bzip2Context.stateOutLen = 0; 399 + bzip2Context.stateOutCh = 0; 400 + bzip2Context.cftab[0] = 0; 401 + System.arraycopy(bzip2Context.unzftab, 0, bzip2Context.cftab, 1, 256); 409 402 410 403 for (int k2 = 1; k2 <= 256; k2++) 411 - bzip2Context.anIntArray69[k2] += bzip2Context.anIntArray69[k2 - 1]; 404 + bzip2Context.cftab[k2] += bzip2Context.cftab[k2 - 1]; 412 405 413 - for (int l2 = 0; l2 < i6; l2++) { 414 - byte byte7 = (byte) (Bzip2Context.anIntArray71[l2] & 0xff); 415 - Bzip2Context.anIntArray71[bzip2Context.anIntArray69[byte7 & 0xff]] |= l2 << 8; 416 - bzip2Context.anIntArray69[byte7 & 0xff]++; 406 + for (int l2 = 0; l2 < nblock; l2++) { 407 + byte byte7 = (byte) (Bzip2Context.tt[l2] & 0xff); 408 + Bzip2Context.tt[bzip2Context.cftab[byte7 & 0xff]] |= l2 << 8; 409 + bzip2Context.cftab[byte7 & 0xff]++; 417 410 } 418 411 419 - bzip2Context.anInt65 = Bzip2Context.anIntArray71[bzip2Context.anInt64] >> 8; 420 - bzip2Context.anInt68 = 0; 421 - bzip2Context.anInt65 = Bzip2Context.anIntArray71[bzip2Context.anInt65]; 422 - bzip2Context.anInt66 = (byte) (bzip2Context.anInt65 & 0xff); 423 - bzip2Context.anInt65 >>= 8; 424 - bzip2Context.anInt68++; 425 - bzip2Context.anInt85 = i6; 412 + bzip2Context.tPos = Bzip2Context.tt[bzip2Context.origPtr] >> 8; 413 + bzip2Context.nBlockUsed = 0; 414 + bzip2Context.tPos = Bzip2Context.tt[bzip2Context.tPos]; 415 + bzip2Context.k0 = (byte) (bzip2Context.tPos & 0xff); 416 + bzip2Context.tPos >>= 8; 417 + bzip2Context.nBlockUsed++; 418 + bzip2Context.nBlock = nblock; 426 419 method313(bzip2Context); 427 - if (bzip2Context.anInt68 == bzip2Context.anInt85 + 1 && bzip2Context.anInt58 == 0) 428 - flag19 = true; 429 - else 430 - flag19 = false; 420 + flag19 = bzip2Context.nBlockUsed == bzip2Context.nBlock + 1 && bzip2Context.stateOutLen == 0; 431 421 } 432 422 } 433 423 434 - public static byte method315(Bzip2Context class1) { 435 - return (byte) method317(8, class1); 424 + public static byte getUChar(Bzip2Context bzip2Context) { 425 + return (byte) getBits(8, bzip2Context); 436 426 } 437 427 438 - public static byte method316(Bzip2Context class1) { 439 - return (byte) method317(1, class1); 428 + public static byte getBit(Bzip2Context bzip2Context) { 429 + return (byte) getBits(1, bzip2Context); 440 430 } 441 431 442 - public static int method317(int i, Bzip2Context class1) { 443 - int j; 432 + public static int getBits(int numBits, Bzip2Context bzip2Context) { 433 + int bits; 444 434 do { 445 - if (class1.bsLive >= i) { 446 - int k = class1.bsBuff >> class1.bsLive - i & (1 << i) - 1; 447 - class1.bsLive -= i; 448 - j = k; 435 + if (bzip2Context.bsLive >= numBits) { 436 + int k = bzip2Context.bsBuff >> bzip2Context.bsLive - numBits & (1 << numBits) - 1; 437 + bzip2Context.bsLive -= numBits; 438 + bits = k; 449 439 break; 450 440 } 451 - class1.bsBuff = class1.bsBuff << 8 | class1.compressed[class1.nextIn] & 0xff; 452 - class1.bsLive += 8; 453 - class1.nextIn++; 454 - class1.decompressedLength--; 455 - class1.totalInLo32++; 456 - if (class1.totalInLo32 == 0) 457 - class1.totalInHi32++; 441 + bzip2Context.bsBuff = bzip2Context.bsBuff << 8 | bzip2Context.compressed[bzip2Context.nextIn] & 0xff; 442 + bzip2Context.bsLive += 8; 443 + bzip2Context.nextIn++; 444 + bzip2Context.decompressedLength--; 445 + bzip2Context.totalInLo32++; 446 + if (bzip2Context.totalInLo32 == 0) 447 + bzip2Context.totalInHi32++; 458 448 } while (true); 459 - return j; 449 + return bits; 460 450 } 461 451 462 - public static void method318(Bzip2Context class1) { 463 - class1.anInt72 = 0; 452 + public static void makeMaps(Bzip2Context bzip2Context) { 453 + bzip2Context.nInUse = 0; 464 454 for (int i = 0; i < 256; i++) 465 - if (class1.aBooleanArray73[i]) { 466 - class1.aByteArray75[class1.anInt72] = (byte) i; 467 - class1.anInt72++; 455 + if (bzip2Context.inUse[i]) { 456 + bzip2Context.seqToUnseq[bzip2Context.nInUse] = (byte) i; 457 + bzip2Context.nInUse++; 468 458 } 469 459 470 460 } 471 461 472 - public static void method319(int ai[], int ai1[], int ai2[], byte abyte0[], int i, int j, int k) { 473 - int l = 0; 474 - for (int i1 = i; i1 <= j; i1++) { 475 - for (int l2 = 0; l2 < k; l2++) 476 - if (abyte0[l2] == i1) { 477 - ai2[l] = l2; 478 - l++; 462 + public static void createDecodeTables(int[] limit, int[] base, int[] ai2, byte[] len, int minLen, int maxLen, int alphaSize) { 463 + int pp = 0; 464 + for (int i = minLen; i <= maxLen; i++) { 465 + for (int j = 0; j < alphaSize; j++) 466 + if (len[j] == i) { 467 + ai2[pp] = j; 468 + pp++; 479 469 } 480 470 481 471 } 482 472 483 - for (int j1 = 0; j1 < 23; j1++) 484 - ai1[j1] = 0; 473 + for (int i = 0; i < 23; i++) 474 + base[i] = 0; 485 475 486 - for (int k1 = 0; k1 < k; k1++) 487 - ai1[abyte0[k1] + 1]++; 476 + for (int i = 0; i < alphaSize; i++) 477 + base[len[i] + 1]++; 488 478 489 - for (int l1 = 1; l1 < 23; l1++) 490 - ai1[l1] += ai1[l1 - 1]; 479 + for (int i = 1; i < 23; i++) 480 + base[i] += base[i - 1]; 491 481 492 - for (int i2 = 0; i2 < 23; i2++) 493 - ai[i2] = 0; 482 + for (int i = 0; i < 23; i++) 483 + limit[i] = 0; 494 484 495 - int i3 = 0; 496 - for (int j2 = i; j2 <= j; j2++) { 497 - i3 += ai1[j2 + 1] - ai1[j2]; 498 - ai[j2] = i3 - 1; 499 - i3 <<= 1; 485 + int vec = 0; 486 + for (int i = minLen; i <= maxLen; i++) { 487 + vec += base[i + 1] - base[i]; 488 + limit[i] = vec - 1; 489 + vec <<= 1; 500 490 } 501 491 502 - for (int k2 = i + 1; k2 <= j; k2++) 503 - ai1[k2] = (ai[k2 - 1] + 1 << 1) - ai1[k2]; 492 + for (int i = minLen + 1; i <= maxLen; i++) 493 + base[i] = (limit[i - 1] + 1 << 1) - base[i]; 504 494 505 495 } 506 496
+27 -27
src/main/java/com/jagex/runescape/cache/bzip/Bzip2Context.java
··· 6 6 public int decompressedLength; 7 7 public int totalInLo32; 8 8 public int totalInHi32; 9 - public byte decompressed[]; 9 + public byte buf[]; 10 10 public int nextOut; 11 - public int lenght; 11 + public int availOut; 12 12 public int totalOutLo32; 13 13 public int totalOutHigh32; 14 - public byte aByte57; 15 - public int anInt58; 16 - public boolean aBoolean59; 14 + public byte stateOutCh; 15 + public int stateOutLen; 16 + public boolean blockRandomised; 17 17 public int bsBuff; 18 18 public int bsLive; 19 - public int anInt62; 19 + public int blockSize100k; 20 20 public int currentBlock; 21 - public int anInt64; 22 - public int anInt65; 23 - public int anInt66; 24 - public int anIntArray67[] = new int[256]; 25 - public int anInt68; 26 - public int anIntArray69[] = new int[257]; 27 - public static int anIntArray71[]; 28 - public int anInt72; 29 - public boolean aBooleanArray73[] = new boolean[256]; 30 - public boolean aBooleanArray74[] = new boolean[16]; 31 - public byte aByteArray75[] = new byte[256]; 32 - public byte aByteArray76[] = new byte[4096]; 33 - public int anIntArray77[] = new int[16]; 34 - public byte aByteArray78[] = new byte[18002]; 35 - public byte aByteArray79[] = new byte[18002]; 36 - public byte aByteArrayArray80[][] = new byte[6][258]; 37 - public int anIntArrayArray81[][] = new int[6][258]; 38 - public int anIntArrayArray82[][] = new int[6][258]; 39 - public int anIntArrayArray83[][] = new int[6][258]; 40 - public int anIntArray84[] = new int[6]; 41 - public int anInt85; 21 + public int origPtr; 22 + public int tPos; 23 + public int k0; 24 + public int unzftab[] = new int[256]; 25 + public int nBlockUsed; 26 + public int cftab[] = new int[257]; 27 + public static int tt[]; 28 + public int nInUse; 29 + public boolean inUse[] = new boolean[256]; 30 + public boolean inUse16[] = new boolean[16]; 31 + public byte seqToUnseq[] = new byte[256]; 32 + public byte mtfa[] = new byte[4096]; 33 + public int mtfbase[] = new int[16]; 34 + public byte selector[] = new byte[18002]; 35 + public byte selectorMtf[] = new byte[18002]; 36 + public byte len[][] = new byte[6][258]; 37 + public int limit[][] = new int[6][258]; 38 + public int base[][] = new int[6][258]; 39 + public int perm[][] = new int[6][258]; 40 + public int minLens[] = new int[6]; 41 + public int nBlock; 42 42 }
+131 -194
src/main/java/com/jagex/runescape/cache/cfg/ChatCensor.java
··· 6 6 public class ChatCensor { 7 7 8 8 9 - public static int anInt728 = 3; 10 - public static int anInt729; 11 - public static boolean aBoolean731; 12 - public static boolean aBoolean732; 13 - public static int anInt733 = -48545; 14 - public static int anInt734; 15 - public static byte aByte735 = -113; 16 - public static int anInt736 = 3; 17 - public static boolean aBoolean738; 18 - public static int fragments[]; 19 - public static char badWords[][]; 20 - public static byte badBytes[][][]; 21 - public static char domains[][]; 22 - public static char topLevelDomains[][]; 23 - public static int topLevelDomainsType[]; 24 - public static final String toCharArray[] = { "cook", "cook's", "cooks", "seeks", "sheet", "woop", "woops", 25 - "faq", "noob", "noobs" }; 9 + private static int[] fragments; 10 + private static char[][] badWords; 11 + private static byte[][][] badBytes; 12 + private static char[][] domains; 13 + private static char[][] topLevelDomains; 14 + private static int[] topLevelDomainsType; 15 + private static final String[] exceptions = {"cook", "cook's", "cooks", "seeks", "sheet", "woop", "woops", 16 + "faq", "noob", "noobs"}; 26 17 27 18 public static void load(Archive archive) { 28 19 Buffer fragmentsEnc = new Buffer(archive.getFile("fragmentsenc.txt")); ··· 32 23 loadDictionaries(fragmentsEnc, badEnc, domainEnc, topLevelDomainsBuffer); 33 24 } 34 25 35 - public static void loadDictionaries(Buffer fragmentsEnc, Buffer badEnc, 36 - Buffer domainEnc, Buffer topLevelDomainsBuffer) { 26 + private static void loadDictionaries(Buffer fragmentsEnc, Buffer badEnc, 27 + Buffer domainEnc, Buffer topLevelDomainsBuffer) { 37 28 loadBadEnc(badEnc); 38 29 loadDomainEnc(domainEnc); 39 30 loadFragmentsEnc(fragmentsEnc); 40 31 loadTopLevelDomains(topLevelDomainsBuffer); 41 32 } 42 33 43 - public static void loadTopLevelDomains(Buffer buffer) { 34 + private static void loadTopLevelDomains(Buffer buffer) { 44 35 int length = buffer.getIntBE(); 45 36 topLevelDomains = new char[length][]; 46 37 topLevelDomainsType = new int[length]; ··· 55 46 56 47 } 57 48 58 - public static void loadBadEnc(Buffer buffer) { 49 + private static void loadBadEnc(Buffer buffer) { 59 50 int length = buffer.getIntBE(); 60 51 badWords = new char[length][]; 61 52 badBytes = new byte[length][][]; ··· 63 54 64 55 } 65 56 66 - public static void loadDomainEnc(Buffer buffer) { 57 + private static void loadDomainEnc(Buffer buffer) { 67 58 int length = buffer.getIntBE(); 68 59 domains = new char[length][]; 69 60 loadDomains(buffer, domains); 70 61 } 71 62 72 - public static void loadFragmentsEnc(Buffer buffer) { 63 + private static void loadFragmentsEnc(Buffer buffer) { 73 64 fragments = new int[buffer.getIntBE()]; 74 65 for (int index = 0; index < fragments.length; index++) 75 66 fragments[index] = buffer.getUnsignedShortBE(); 76 67 77 68 } 78 69 79 - public static void loadBadWords(Buffer buffer, char[][] badWords, byte[][][] badBytes) { 70 + private static void loadBadWords(Buffer buffer, char[][] badWords, byte[][][] badBytes) { 80 71 for (int index = 0; index < badWords.length; index++) { 81 72 char[] badWord = new char[buffer.getUnsignedByte()]; 82 - for (int k = 0; k < badWord.length; k++) 83 - badWord[k] = (char) buffer.getUnsignedByte(); 73 + for (int character = 0; character < badWord.length; character++) 74 + badWord[character] = (char) buffer.getUnsignedByte(); 84 75 85 76 badWords[index] = badWord; 86 77 byte[][] badByte = new byte[buffer.getUnsignedByte()][2]; ··· 95 86 96 87 } 97 88 98 - public static void loadDomains(Buffer buffer, char[][] cs) { 89 + private static void loadDomains(Buffer buffer, char[][] cs) { 99 90 for (int index = 0; index < cs.length; index++) { 100 91 char[] domainEnc = new char[buffer.getUnsignedByte()]; 101 92 for (int character = 0; character < domainEnc.length; character++) ··· 106 97 107 98 } 108 99 109 - public static void formatLegalCharacters(char[] characters) { 100 + private static void formatLegalCharacters(char[] characters) { 110 101 int character = 0; 111 102 for (int index = 0; index < characters.length; index++) { 112 103 if (isLegalCharacter(characters[index])) ··· 122 113 123 114 } 124 115 125 - public static boolean isLegalCharacter(char character) { 116 + private static boolean isLegalCharacter(char character) { 126 117 return character >= ' ' && character <= '\177' || character == ' ' || character == '\n' || character == '\t' || character == '\243' || character == '\u20AC'; 127 118 } 128 119 ··· 132 123 String censoredStringTrimmed = (new String(censoredString)).trim(); 133 124 censoredString = censoredStringTrimmed.toLowerCase().toCharArray(); 134 125 String censoredStringLowercased = censoredStringTrimmed.toLowerCase(); 135 - method391(censoredString, 0); 136 - method386(censoredString, anInt733); 137 - method387(3, censoredString); 138 - method400(3, censoredString); 139 - for (int i = 0; i < toCharArray.length; i++) { 140 - for (int j = -1; (j = censoredStringLowercased.indexOf(toCharArray[i], j + 1)) != -1;) { 141 - char ac1[] = toCharArray[i].toCharArray(); 142 - for (int k = 0; k < ac1.length; k++) 143 - censoredString[k + j] = ac1[k]; 126 + method391(censoredString); 127 + method386(censoredString); 128 + method387(censoredString); 129 + method400(censoredString); 130 + for (String exception : exceptions) { 131 + for (int index = -1; (index = censoredStringLowercased.indexOf(exception, index + 1)) != -1; ) { 132 + char[] ac1 = exception.toCharArray(); 133 + System.arraycopy(ac1, 0, censoredString, index, ac1.length); 144 134 145 135 } 146 136 147 137 } 148 138 149 - method384(0, censoredString, censoredStringTrimmed.toCharArray()); 150 - method385(1, censoredString); 139 + method384(censoredString, censoredStringTrimmed.toCharArray()); 140 + method385(censoredString); 151 141 return (new String(censoredString)).trim(); 152 142 } 153 143 154 - public static void method384(int i, char ac[], char ac1[]) { 144 + private static void method384(char[] ac, char[] ac1) { 155 145 for (int j = 0; j < ac1.length; j++) 156 - if (ac[j] != '*' && method408(-217, ac1[j])) 146 + if (ac[j] != '*' && method408(ac1[j])) 157 147 ac[j] = ac1[j]; 158 148 159 - if (i != 0) 160 - anInt728 = 271; 161 149 } 162 150 163 - public static void method385(int i, char ac[]) { 151 + private static void method385(char[] ac) { 164 152 boolean flag = true; 165 153 for (int j = 0; j < ac.length; j++) { 166 154 char c = ac[j]; 167 - if (method405(true, c)) { 155 + if (method405(c)) { 168 156 if (flag) { 169 157 if (method407(c)) 170 158 flag = false; 171 - } else if (method408(-217, c)) 159 + } else if (method408(c)) 172 160 ac[j] = (char) ((c + 97) - 65); 173 161 } else { 174 162 flag = true; 175 163 } 176 164 } 177 - 178 - if (i == 1) 179 - ; 180 165 } 181 166 182 - public static void method386(char ac[], int i) { 167 + private static void method386(char[] ac) { 183 168 for (int j = 0; j < 2; j++) { 184 169 for (int k = badWords.length - 1; k >= 0; k--) 185 - method395(badBytes[k], -939, badWords[k], ac); 170 + method395(badBytes[k], badWords[k], ac); 186 171 187 172 } 188 173 189 - if (i != -48545) 190 - aBoolean731 = !aBoolean731; 191 174 } 192 175 193 - public static void method387(int i, char ac[]) { 194 - char ac1[] = ac.clone(); 195 - char ac2[] = { '(', 'a', ')' }; 196 - method395(null, -939, ac2, ac1); 197 - if (i < 3 || i > 3) 198 - anInt728 = 382; 199 - char ac3[] = ac.clone(); 200 - char ac4[] = { 'd', 'o', 't' }; 201 - method395(null, -939, ac4, ac3); 176 + private static void method387(char[] ac) { 177 + char[] ac1 = ac.clone(); 178 + char[] ac2 = {'(', 'a', ')'}; 179 + method395(null, ac2, ac1); 180 + char[] ac3 = ac.clone(); 181 + char[] ac4 = {'d', 'o', 't'}; 182 + method395(null, ac4, ac3); 202 183 for (int j = domains.length - 1; j >= 0; j--) 203 - method388(ac, ac3, ac1, -65, domains[j]); 184 + method388(ac, ac3, ac1, domains[j]); 204 185 205 186 } 206 187 207 - public static void method388(char ac[], char ac1[], char ac2[], int i, char ac3[]) { 208 - if (i >= 0) 209 - return; 188 + private static void method388(char[] ac, char[] ac1, char[] ac2, char[] ac3) { 210 189 if (ac3.length > ac.length) 211 190 return; 212 191 int j; ··· 215 194 int i1 = 0; 216 195 j = 1; 217 196 while (l < ac.length) { 218 - int j1 = 0; 197 + int j1; 219 198 char c = ac[l]; 220 199 char c1 = '\0'; 221 200 if (l + 1 < ac.length) 222 201 c1 = ac[l + 1]; 223 - if (i1 < ac3.length && (j1 = method397(c, 0, ac3[i1], c1)) > 0) { 202 + if (i1 < ac3.length && (j1 = method397(c, ac3[i1], c1)) > 0) { 224 203 l += j1; 225 204 i1++; 226 205 continue; 227 206 } 228 207 if (i1 == 0) 229 208 break; 230 - if ((j1 = method397(c, 0, ac3[i1 - 1], c1)) > 0) { 209 + if ((j1 = method397(c, ac3[i1 - 1], c1)) > 0) { 231 210 l += j1; 232 211 if (i1 == 1) 233 212 j++; 234 213 continue; 235 214 } 236 - if (i1 >= ac3.length || !method403(c, false)) 215 + if (i1 >= ac3.length || !method403(c)) 237 216 break; 238 217 l++; 239 218 } 240 219 if (i1 >= ac3.length) { 241 220 boolean flag1 = false; 242 - int k1 = method389(ac, ac2, (byte) -72, k); 243 - int l1 = method390(ac1, 0, l - 1, ac); 221 + int k1 = method389(ac, ac2, k); 222 + int l1 = method390(ac1, l - 1, ac); 244 223 if (k1 > 2 || l1 > 2) 245 224 flag1 = true; 246 225 if (flag1) { ··· 253 232 254 233 } 255 234 256 - public static int method389(char ac[], char ac1[], byte byte0, int i) { 235 + private static int method389(char[] ac, char[] ac1, int i) { 257 236 if (i == 0) 258 237 return 2; 259 238 for (int j = i - 1; j >= 0; j--) { 260 - if (!method403(ac[j], false)) 239 + if (!method403(ac[j])) 261 240 break; 262 241 if (ac[j] == '@') 263 242 return 3; ··· 265 244 266 245 int k = 0; 267 246 for (int l = i - 1; l >= 0; l--) { 268 - if (!method403(ac1[l], false)) 247 + if (!method403(ac1[l])) 269 248 break; 270 249 if (ac1[l] == '*') 271 250 k++; 272 251 } 273 252 274 - if (byte0 != -72) 275 - return 3; 276 253 if (k >= 3) 277 254 return 4; 278 - return !method403(ac[i - 1], false) ? 0 : 1; 255 + return !method403(ac[i - 1]) ? 0 : 1; 279 256 } 280 257 281 - public static int method390(char ac[], int i, int j, char ac1[]) { 258 + private static int method390(char[] ac, int j, char[] ac1) { 282 259 if (j + 1 == ac1.length) 283 260 return 2; 284 261 for (int k = j + 1; k < ac1.length; k++) { 285 - if (!method403(ac1[k], false)) 262 + if (!method403(ac1[k])) 286 263 break; 287 264 if (ac1[k] == '.' || ac1[k] == ',') 288 265 return 3; 289 266 } 290 267 291 268 int l = 0; 292 - if (i != 0) 293 - return anInt733; 294 269 for (int i1 = j + 1; i1 < ac1.length; i1++) { 295 - if (!method403(ac[i1], false)) 270 + if (!method403(ac[i1])) 296 271 break; 297 272 if (ac[i1] == '*') 298 273 l++; ··· 300 275 301 276 if (l >= 3) 302 277 return 4; 303 - return !method403(ac1[j + 1], false) ? 0 : 1; 278 + return !method403(ac1[j + 1]) ? 0 : 1; 304 279 } 305 280 306 - public static void method391(char ac[], int i) { 307 - char ac1[] = ac.clone(); 308 - char ac2[] = { 'd', 'o', 't' }; 309 - method395(null, -939, ac2, ac1); 310 - char ac3[] = ac.clone(); 311 - char ac4[] = { 's', 'l', 'a', 's', 'h' }; 312 - if (i != 0) 313 - aBoolean732 = !aBoolean732; 314 - method395(null, -939, ac4, ac3); 281 + private static void method391(char[] ac) { 282 + char[] ac1 = ac.clone(); 283 + char[] ac2 = {'d', 'o', 't'}; 284 + method395(null, ac2, ac1); 285 + char[] ac3 = ac.clone(); 286 + char[] ac4 = {'s', 'l', 'a', 's', 'h'}; 287 + method395(null, ac4, ac3); 315 288 for (int j = 0; j < topLevelDomains.length; j++) 316 - method392(ac, (byte) 7, ac1, topLevelDomainsType[j], topLevelDomains[j], ac3); 289 + method392(ac, ac1, topLevelDomainsType[j], topLevelDomains[j], ac3); 317 290 318 291 } 319 292 320 - public static void method392(char ac[], byte byte0, char ac1[], int i, char ac2[], char ac3[]) { 293 + private static void method392(char[] ac, char[] ac1, int i, char[] ac2, char[] ac3) { 321 294 if (ac2.length > ac.length) 322 295 return; 323 296 int j; ··· 326 299 int i1 = 0; 327 300 j = 1; 328 301 while (l < ac.length) { 329 - int j1 = 0; 302 + int j1; 330 303 char c = ac[l]; 331 304 char c1 = '\0'; 332 305 if (l + 1 < ac.length) 333 306 c1 = ac[l + 1]; 334 - if (i1 < ac2.length && (j1 = method397(c, 0, ac2[i1], c1)) > 0) { 307 + if (i1 < ac2.length && (j1 = method397(c, ac2[i1], c1)) > 0) { 335 308 l += j1; 336 309 i1++; 337 310 continue; 338 311 } 339 312 if (i1 == 0) 340 313 break; 341 - if ((j1 = method397(c, 0, ac2[i1 - 1], c1)) > 0) { 314 + if ((j1 = method397(c, ac2[i1 - 1], c1)) > 0) { 342 315 l += j1; 343 316 if (i1 == 1) 344 317 j++; 345 318 continue; 346 319 } 347 - if (i1 >= ac2.length || !method403(c, false)) 320 + if (i1 >= ac2.length || !method403(c)) 348 321 break; 349 322 l++; 350 323 } 351 324 if (i1 >= ac2.length) { 352 325 boolean flag1 = false; 353 - int k1 = method393(ac1, k, ac, (byte) -113); 354 - int l1 = method394(ac3, l - 1, ac, 3); 326 + int k1 = method393(ac1, k, ac); 327 + int l1 = method394(ac3, l - 1, ac); 355 328 if (i == 1 && k1 > 0 && l1 > 0) 356 329 flag1 = true; 357 330 if (i == 2 && (k1 > 2 && l1 > 0 || k1 > 0 && l1 > 2)) ··· 379 352 boolean flag3 = false; 380 353 for (int i3 = i2 - 1; i3 >= 0; i3--) 381 354 if (flag3) { 382 - if (method403(ac[i3], false)) 355 + if (method403(ac[i3])) 383 356 break; 384 357 i2 = i3; 385 - } else if (!method403(ac[i3], false)) { 358 + } else if (!method403(ac[i3])) { 386 359 flag3 = true; 387 360 i2 = i3; 388 361 } ··· 405 378 boolean flag5 = false; 406 379 for (int k3 = j2 + 1; k3 < ac.length; k3++) 407 380 if (flag5) { 408 - if (method403(ac[k3], false)) 381 + if (method403(ac[k3])) 409 382 break; 410 383 j2 = k3; 411 - } else if (!method403(ac[k3], false)) { 384 + } else if (!method403(ac[k3])) { 412 385 flag5 = true; 413 386 j2 = k3; 414 387 } ··· 420 393 } 421 394 } 422 395 } 423 - 424 - if (byte0 == 7) 425 - byte0 = 0; 426 396 } 427 397 428 - public static int method393(char ac[], int i, char ac1[], byte byte0) { 429 - if (byte0 != aByte735) { 430 - for (int j = 1; j > 0; j++); 431 - } 398 + private static int method393(char[] ac, int i, char[] ac1) { 432 399 if (i == 0) 433 400 return 2; 434 401 for (int k = i - 1; k >= 0; k--) { 435 - if (!method403(ac1[k], false)) 402 + if (!method403(ac1[k])) 436 403 break; 437 404 if (ac1[k] == ',' || ac1[k] == '.') 438 405 return 3; ··· 440 407 441 408 int l = 0; 442 409 for (int i1 = i - 1; i1 >= 0; i1--) { 443 - if (!method403(ac[i1], false)) 410 + if (!method403(ac[i1])) 444 411 break; 445 412 if (ac[i1] == '*') 446 413 l++; ··· 448 415 449 416 if (l >= 3) 450 417 return 4; 451 - return !method403(ac1[i - 1], false) ? 0 : 1; 418 + return !method403(ac1[i - 1]) ? 0 : 1; 452 419 } 453 420 454 - public static int method394(char ac[], int i, char ac1[], int j) { 455 - if (j < anInt736 || j > anInt736) { 456 - for (int k = 1; k > 0; k++); 457 - } 421 + private static int method394(char[] ac, int i, char[] ac1) { 458 422 if (i + 1 == ac1.length) 459 423 return 2; 460 424 for (int l = i + 1; l < ac1.length; l++) { 461 - if (!method403(ac1[l], false)) 425 + if (!method403(ac1[l])) 462 426 break; 463 427 if (ac1[l] == '\\' || ac1[l] == '/') 464 428 return 3; ··· 466 430 467 431 int i1 = 0; 468 432 for (int j1 = i + 1; j1 < ac1.length; j1++) { 469 - if (!method403(ac[j1], false)) 433 + if (!method403(ac[j1])) 470 434 break; 471 435 if (ac[j1] == '*') 472 436 i1++; ··· 474 438 475 439 if (i1 >= 5) 476 440 return 4; 477 - return !method403(ac1[i + 1], false) ? 0 : 1; 441 + return !method403(ac1[i + 1]) ? 0 : 1; 478 442 } 479 443 480 - public static void method395(byte abyte0[][], int i, char ac[], char ac1[]) { 481 - while (i >= 0) 482 - return; 444 + private static void method395(byte[][] abyte0, char[] ac, char[] ac1) { 483 445 if (ac.length > ac1.length) 484 446 return; 485 447 int j; ··· 492 454 boolean flag2 = false; 493 455 boolean flag3 = false; 494 456 while (l < ac1.length && (!flag2 || !flag3)) { 495 - int k1 = 0; 457 + int k1; 496 458 char c = ac1[l]; 497 459 char c2 = '\0'; 498 460 if (l + 1 < ac1.length) 499 461 c2 = ac1[l + 1]; 500 - if (i1 < ac.length && (k1 = method398(ac[i1], c, c2, 7)) > 0) { 501 - if (k1 == 1 && method406(c, false)) 462 + if (i1 < ac.length && (k1 = method398(ac[i1], c, c2)) > 0) { 463 + if (k1 == 1 && method406(c)) 502 464 flag2 = true; 503 - if (k1 == 2 && (method406(c, false) || method406(c2, false))) 465 + if (k1 == 2 && (method406(c) || method406(c2))) 504 466 flag2 = true; 505 467 l += k1; 506 468 i1++; ··· 508 470 } 509 471 if (i1 == 0) 510 472 break; 511 - if ((k1 = method398(ac[i1 - 1], c, c2, 7)) > 0) { 473 + if ((k1 = method398(ac[i1 - 1], c, c2)) > 0) { 512 474 l += k1; 513 475 if (i1 == 1) 514 476 j++; 515 477 continue; 516 478 } 517 - if (i1 >= ac.length || !method404(2, c)) 479 + if (i1 >= ac.length || !method404(c)) 518 480 break; 519 - if (method403(c, false) && c != '\'') 481 + if (method403(c) && c != '\'') 520 482 flag1 = true; 521 - if (method406(c, false)) 483 + if (method406(c)) 522 484 flag3 = true; 523 485 l++; 524 486 if ((++j1 * 100) / (l - k) > 90) ··· 533 495 char c3 = ' '; 534 496 if (l < ac1.length) 535 497 c3 = ac1[l]; 536 - byte byte0 = method399(c1, (byte) 7); 537 - byte byte1 = method399(c3, (byte) 7); 538 - if (abyte0 != null && method396(byte1, abyte0, byte0, 4)) 498 + byte byte0 = method399(c1); 499 + byte byte1 = method399(c3); 500 + if (abyte0 != null && method396(byte1, abyte0, byte0)) 539 501 flag4 = false; 540 502 } else { 541 503 boolean flag5 = false; 542 504 boolean flag6 = false; 543 - if (k - 1 < 0 || method403(ac1[k - 1], false) && ac1[k - 1] != '\'') 505 + if (k - 1 < 0 || method403(ac1[k - 1]) && ac1[k - 1] != '\'') 544 506 flag5 = true; 545 - if (l >= ac1.length || method403(ac1[l], false) && ac1[l] != '\'') 507 + if (l >= ac1.length || method403(ac1[l]) && ac1[l] != '\'') 546 508 flag6 = true; 547 509 if (!flag5 || !flag6) { 548 510 boolean flag7 = false; ··· 550 512 if (flag5) 551 513 k2 = k; 552 514 for (; !flag7 && k2 < l; k2++) 553 - if (k2 >= 0 && (!method403(ac1[k2], false) || ac1[k2] == '\'')) { 554 - char ac2[] = new char[3]; 515 + if (k2 >= 0 && (!method403(ac1[k2]) || ac1[k2] == '\'')) { 516 + char[] ac2 = new char[3]; 555 517 int j3; 556 518 for (j3 = 0; j3 < 3; j3++) { 557 - if (k2 + j3 >= ac1.length || method403(ac1[k2 + j3], false) && ac1[k2 + j3] != '\'') 519 + if (k2 + j3 >= ac1.length || method403(ac1[k2 + j3]) && ac1[k2 + j3] != '\'') 558 520 break; 559 521 ac2[j3] = ac1[k2 + j3]; 560 522 } ··· 562 524 boolean flag8 = true; 563 525 if (j3 == 0) 564 526 flag8 = false; 565 - if (j3 < 3 && k2 - 1 >= 0 && (!method403(ac1[k2 - 1], false) || ac1[k2 - 1] == '\'')) 527 + if (j3 < 3 && k2 - 1 >= 0 && (!method403(ac1[k2 - 1]) || ac1[k2 - 1] == '\'')) 566 528 flag8 = false; 567 - if (flag8 && !method409(ac2, 463)) 529 + if (flag8 && !method409(ac2)) 568 530 flag7 = true; 569 531 } 570 532 ··· 577 539 int i2 = 0; 578 540 int j2 = -1; 579 541 for (int l2 = k; l2 < l; l2++) 580 - if (method406(ac1[l2], false)) 542 + if (method406(ac1[l2])) 581 543 l1++; 582 - else if (method405(true, ac1[l2])) { 544 + else if (method405(ac1[l2])) { 583 545 i2++; 584 546 j2 = l2; 585 547 } ··· 599 561 600 562 } 601 563 602 - public static boolean method396(byte byte0, byte abyte0[][], byte byte1, int i) { 564 + private static boolean method396(byte byte0, byte[][] abyte0, byte byte1) { 603 565 int j = 0; 604 - if (i < 4 || i > 4) 605 - throw new NullPointerException(); 606 566 if (abyte0[j][0] == byte1 && abyte0[j][1] == byte0) 607 567 return true; 608 568 int k = abyte0.length - 1; ··· 620 580 return false; 621 581 } 622 582 623 - public static int method397(char c, int i, char c1, char c2) { 624 - if (i != 0) 625 - return anInt733; 583 + private static int method397(char c, char c1, char c2) { 626 584 if (c1 == c) 627 585 return 1; 628 586 if (c1 == 'o' && c == '0') ··· 638 596 return c1 != 'l' || c != 'i' ? 0 : 1; 639 597 } 640 598 641 - public static int method398(char c, char c1, char c2, int i) { 642 - if (i != 7) 643 - return anInt728; 599 + private static int method398(char c, char c1, char c2) { 644 600 if (c == c1) 645 601 return 1; 646 602 if (c >= 'a' && c <= 'm') { ··· 738 694 return 0; 739 695 } 740 696 741 - public static byte method399(char c, byte byte0) { 742 - if (byte0 != 7) 743 - throw new NullPointerException(); 697 + private static byte method399(char c) { 744 698 if (c >= 'a' && c <= 'z') 745 699 return (byte) ((c - 97) + 1); 746 700 if (c == '\'') ··· 751 705 return 27; 752 706 } 753 707 754 - public static void method400(int i, char ac[]) { 755 - int j = 0; 708 + private static void method400(char[] ac) { 709 + int j; 756 710 int k = 0; 757 711 int l = 0; 758 - if (i < 3 || i > 3) 759 - return; 760 712 int i1 = 0; 761 - while ((j = method401(307, k, ac)) != -1) { 713 + while ((j = method401(k, ac)) != -1) { 762 714 boolean flag = false; 763 715 for (int j1 = k; j1 >= 0 && j1 < j && !flag; j1++) 764 - if (!method403(ac[j1], false) && !method404(2, ac[j1])) 716 + if (!method403(ac[j1]) && !method404(ac[j1])) 765 717 flag = true; 766 718 767 719 if (flag) 768 720 l = 0; 769 721 if (l == 0) 770 722 i1 = j; 771 - k = method402(j, 618, ac); 723 + k = method402(j, ac); 772 724 int k1 = 0; 773 725 for (int l1 = j; l1 < k; l1++) 774 726 k1 = (k1 * 10 + ac[l1]) - 48; ··· 786 738 } 787 739 } 788 740 789 - public static int method401(int i, int j, char ac[]) { 741 + private static int method401(int j, char[] ac) { 790 742 for (int k = j; k < ac.length && k >= 0; k++) 791 743 if (ac[k] >= '0' && ac[k] <= '9') 792 744 return k; 793 745 794 - if (i <= 0) 795 - aBoolean731 = !aBoolean731; 796 746 return -1; 797 747 } 798 748 799 - public static int method402(int i, int j, char ac[]) { 800 - if (j <= 0) { 801 - for (int k = 1; k > 0; k++); 802 - } 749 + private static int method402(int i, char[] ac) { 803 750 for (int l = i; l < ac.length && l >= 0; l++) 804 751 if (ac[l] < '0' || ac[l] > '9') 805 752 return l; ··· 807 754 return ac.length; 808 755 } 809 756 810 - public static boolean method403(char c, boolean flag) { 811 - if (flag) 812 - throw new NullPointerException(); 813 - return !method405(true, c) && !method406(c, false); 757 + private static boolean method403(char c) { 758 + return !method405(c) && !method406(c); 814 759 } 815 760 816 - public static boolean method404(int i, char c) { 817 - if (i != 2) 818 - aBoolean732 = !aBoolean732; 761 + private static boolean method404(char c) { 819 762 if (c < 'a' || c > 'z') 820 763 return true; 821 764 return c == 'v' || c == 'x' || c == 'j' || c == 'q' || c == 'z'; 822 765 } 823 766 824 - public static boolean method405(boolean flag, char c) { 767 + private static boolean method405(char c) { 825 768 return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; 826 769 } 827 770 828 - public static boolean method406(char c, boolean flag) { 829 - if (flag) 830 - throw new NullPointerException(); 771 + private static boolean method406(char c) { 831 772 return c >= '0' && c <= '9'; 832 773 } 833 774 834 - public static boolean method407(char c) { 775 + private static boolean method407(char c) { 835 776 return c >= 'a' && c <= 'z'; 836 777 } 837 778 838 - public static boolean method408(int i, char c) { 779 + private static boolean method408(char c) { 839 780 return c >= 'A' && c <= 'Z'; 840 781 } 841 782 842 - public static boolean method409(char ac[], int i) { 783 + private static boolean method409(char[] ac) { 843 784 boolean flag = true; 844 785 for (int j = 0; j < ac.length; j++) 845 - if (!method406(ac[j], false) && ac[j] != 0) 786 + if (!method406(ac[j]) && ac[j] != 0) 846 787 flag = false; 847 788 848 - i = 78 / i; 849 789 if (flag) 850 790 return true; 851 - int k = method410(ac, (byte) 5); 791 + int k = method410(ac); 852 792 int l = 0; 853 793 int i1 = fragments.length - 1; 854 794 if (k == fragments[l] || k == fragments[i1]) ··· 865 805 return false; 866 806 } 867 807 868 - public static int method410(char ac[], byte byte0) { 808 + private static int method410(char[] ac) { 869 809 if (ac.length > 6) 870 810 return 0; 871 811 int i = 0; 872 - if (byte0 == 5) 873 - byte0 = 0; 874 - else 875 - return 3; 812 + 876 813 for (int j = 0; j < ac.length; j++) { 877 814 char c = ac[ac.length - j - 1]; 878 815 if (c >= 'a' && c <= 'z')
+1 -1
src/main/java/com/jagex/runescape/cache/def/ActorDefinition.java
··· 195 195 return headModel; 196 196 } 197 197 198 - public boolean method360() { 198 + public boolean isVisible() { 199 199 if (childrenIds == null) 200 200 return true; 201 201 int j = -1;
+15 -15
src/main/java/com/jagex/runescape/cache/def/GameObjectDefinition.java
··· 12 12 public class GameObjectDefinition { 13 13 14 14 public static int bufferOffsets[]; 15 - public boolean actionsBoolean; 15 + public boolean hasActions; 16 16 public int modelSizeY; 17 17 public int translateX; 18 18 public static Cache animatedModelCache = new Cache(40); ··· 50 50 public int anInt794; 51 51 public int anInt795; 52 52 public int modelSizeZ; 53 - public boolean aBoolean797; 53 + public boolean wall; 54 54 public boolean unknown3; 55 55 public int modifiedModelColors[]; 56 56 public int sizeX; 57 - public int unknown4; 57 + public int offsetAmplifier; 58 58 public int animationId; 59 59 public boolean nonFlatShading; 60 60 public int childrenIds[]; 61 61 public int icon; 62 - public boolean unknown2; 62 + public boolean castsShadow; 63 63 public static int definitionCount; 64 64 public boolean walkable; 65 65 public boolean solid; ··· 106 106 sizeY = 1; 107 107 solid = true; 108 108 walkable = true; 109 - actionsBoolean = false; 109 + hasActions = false; 110 110 adjustToTerrain = false; 111 111 nonFlatShading = false; 112 - aBoolean797 = false; 112 + wall = false; 113 113 animationId = -1; 114 - unknown4 = 16; 114 + offsetAmplifier = 16; 115 115 modelLightFalloff = 0; 116 116 modelLightAmbient = 0; 117 117 options = null; 118 118 icon = -1; 119 119 anInt795 = -1; 120 120 unknown3 = false; 121 - unknown2 = true; 121 + castsShadow = true; 122 122 modelSizeX = 128; 123 123 modelSizeY = 128; 124 124 modelSizeZ = 128; ··· 327 327 case 19: 328 328 i = buf.getUnsignedByte(); 329 329 if (i == 1) 330 - actionsBoolean = true; 330 + hasActions = true; 331 331 break; 332 332 case 21: 333 333 adjustToTerrain = true; ··· 336 336 nonFlatShading = true; 337 337 break; 338 338 case 23: 339 - aBoolean797 = true; 339 + wall = true; 340 340 break; 341 341 case 24: 342 342 animationId = buf.getUnsignedShortBE(); ··· 344 344 animationId = -1; 345 345 break; 346 346 case 28: 347 - unknown4 = buf.getUnsignedByte(); 347 + offsetAmplifier = buf.getUnsignedByte(); 348 348 break; 349 349 case 29: 350 350 modelLightFalloff = buf.getByte(); ··· 372 372 unknown3 = true; 373 373 break; 374 374 case 64: 375 - unknown2 = false; 375 + castsShadow = false; 376 376 break; 377 377 case 65: 378 378 modelSizeX = buf.getUnsignedShortBE(); ··· 435 435 436 436 } 437 437 if (i == -1) { 438 - actionsBoolean = false; 438 + hasActions = false; 439 439 if (modelIds != null && (modelTypes == null || modelTypes[0] == 10)) 440 - actionsBoolean = true; 440 + hasActions = true; 441 441 if (options != null) 442 - actionsBoolean = true; 442 + hasActions = true; 443 443 } 444 444 if (aBoolean791) { 445 445 solid = false;
+4
src/main/java/com/jagex/runescape/cache/media/TypeFace.java
··· 276 276 } 277 277 278 278 public void drawShadowedString(String string, int x, int y, boolean shadow, int colour) { 279 + if (!shadow) { 280 + drawString(string, x, y, colour); 281 + return; 282 + } 279 283 if (this.moderatorIcon != null) { 280 284 this.drawString(string, x, y, colour, 0); 281 285 } else {
+8
src/main/java/com/jagex/runescape/config/Configuration.java
··· 8 8 9 9 public class Configuration { 10 10 11 + 11 12 public static void read() { 12 13 try { 13 14 final Yaml yaml = new Yaml(); ··· 33 34 USERNAME = (String) login.get("username"); 34 35 PASSWORD = (String) login.get("password"); 35 36 ROOFS_ENABLED = (boolean) game.get("roofsEnabled"); 37 + FREE_TELEPORTS = (boolean) game.get("freeTeleports"); 36 38 37 39 if(USERNAME == null) { 38 40 USERNAME = ""; ··· 113 115 * Do you want to render roofs 114 116 */ 115 117 public static boolean ROOFS_ENABLED = true; 118 + 119 + /** 120 + * Always light up teleports 121 + */ 122 + public static boolean FREE_TELEPORTS = true; 123 + 116 124 117 125 }
+22 -24
src/main/java/com/jagex/runescape/media/Rasterizer3D.java
··· 25 25 public static boolean aBooleanArray1541[] = new boolean[50]; 26 26 public static int anIntArray1542[] = new int[50]; 27 27 public static int anInt1543; 28 - public static int anIntArrayArray1544[][]; 29 - public static int anIntArrayArray1545[][] = new int[50][]; 28 + public static int texelArrayPool[][]; 29 + public static int texelCache[][] = new int[50][]; 30 30 public static int anIntArray1546[] = new int[50]; 31 31 public static int textureGetCount; 32 32 public static int getRgbLookupTableId[] = new int[0x10000]; ··· 42 42 aClass50_Sub1_Sub1_Sub3Array1540 = null; 43 43 aBooleanArray1541 = null; 44 44 anIntArray1542 = null; 45 - anIntArrayArray1544 = null; 46 - anIntArrayArray1545 = null; 45 + texelArrayPool = null; 46 + texelCache = null; 47 47 anIntArray1546 = null; 48 48 getRgbLookupTableId = null; 49 49 anIntArrayArray1549 = null; ··· 67 67 Rasterizer3D.centerY = height / 2; 68 68 } 69 69 70 - public static void method495(byte byte0) { 71 - if (byte0 != 71) 72 - return; 73 - anIntArrayArray1544 = null; 70 + public static void clearTextureCache() { 71 + texelArrayPool = null; 74 72 for (int i = 0; i < 50; i++) 75 - anIntArrayArray1545[i] = null; 73 + texelCache[i] = null; 76 74 77 75 } 78 76 79 77 public static void method496(int i) { 80 - if (anIntArrayArray1544 == null) { 78 + if (texelArrayPool == null) { 81 79 anInt1543 = i; 82 80 if (lowMemory) 83 - anIntArrayArray1544 = new int[anInt1543][16384]; 81 + texelArrayPool = new int[anInt1543][16384]; 84 82 else 85 - anIntArrayArray1544 = new int[anInt1543][0x10000]; 83 + texelArrayPool = new int[anInt1543][0x10000]; 86 84 for (int k = 0; k < 50; k++) 87 - anIntArrayArray1545[k] = null; 85 + texelCache[k] = null; 88 86 89 87 } 90 88 } ··· 130 128 public static void method499(int i, int j) { 131 129 if (j != 9) 132 130 anInt1524 = -48; 133 - if (anIntArrayArray1545[i] == null) { 131 + if (texelCache[i] == null) { 134 132 return; 135 133 } else { 136 - anIntArrayArray1544[anInt1543++] = anIntArrayArray1545[i]; 137 - anIntArrayArray1545[i] = null; 134 + texelArrayPool[anInt1543++] = texelCache[i]; 135 + texelCache[i] = null; 138 136 return; 139 137 } 140 138 } 141 139 142 140 public static int[] method500(int i) { 143 141 anIntArray1546[i] = textureGetCount++; 144 - if (anIntArrayArray1545[i] != null) 145 - return anIntArrayArray1545[i]; 142 + if (texelCache[i] != null) 143 + return texelCache[i]; 146 144 int ai[]; 147 145 if (anInt1543 > 0) { 148 - ai = anIntArrayArray1544[--anInt1543]; 149 - anIntArrayArray1544[anInt1543] = null; 146 + ai = texelArrayPool[--anInt1543]; 147 + texelArrayPool[anInt1543] = null; 150 148 } else { 151 149 int j = 0; 152 150 int k = -1; 153 151 for (int l = 0; l < anInt1539; l++) 154 - if (anIntArrayArray1545[l] != null && (anIntArray1546[l] < j || k == -1)) { 152 + if (texelCache[l] != null && (anIntArray1546[l] < j || k == -1)) { 155 153 j = anIntArray1546[l]; 156 154 k = l; 157 155 } 158 156 159 - ai = anIntArrayArray1545[k]; 160 - anIntArrayArray1545[k] = null; 157 + ai = texelCache[k]; 158 + texelCache[k] = null; 161 159 } 162 - anIntArrayArray1545[i] = ai; 160 + texelCache[i] = ai; 163 161 IndexedImage class50_sub1_sub1_sub3 = aClass50_Sub1_Sub1_Sub3Array1540[i]; 164 162 int ai1[] = anIntArrayArray1549[i]; 165 163 if (lowMemory) {
+2 -2
src/main/java/com/jagex/runescape/media/renderable/actor/Actor.java
··· 15 15 public int displayedMovementFrames; 16 16 public int anInt1590; 17 17 public boolean[] runningQueue = new boolean[10]; 18 - public boolean aBoolean1592 = false; 18 + public boolean dynamic = false; 19 19 public int textEffect; 20 20 public int modelHeight = 200; 21 21 public int endCycle = -1000; ··· 35 35 public int anInt1609 = -1; 36 36 public int worldX; 37 37 public int worldY; 38 - public int anInt1612; 38 + public int currentRotation; 39 39 public int anInt1613; 40 40 public int graphic = -1; 41 41 public int currentAnimation;
+20 -55
src/main/java/com/jagex/runescape/net/Buffer.java
··· 1 1 package com.jagex.runescape.net; 2 2 3 3 import com.jagex.runescape.collection.CacheableNode; 4 - import com.jagex.runescape.util.LinkedList; 5 4 6 5 import java.math.BigInteger; 7 6 8 7 public class Buffer extends CacheableNode { 9 8 10 9 11 - public byte buffer[]; 10 + public byte[] buffer; 12 11 public int currentPosition; 13 12 public int bitPosition; 14 - public static int CRC32_TABLE[] = new int[256]; 15 - public static final int BIT_MASKS[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 13 + private static final int[] BIT_MASKS = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 16 14 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 17 - 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1 }; 15 + 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1}; 18 16 public ISAACCipher random; 19 - public static int smallBufferCount; 20 - public static int mediumBufferCount; 21 - public static int largeBufferCount; 22 - public static LinkedList smallBuffers = new LinkedList(); 23 - public static LinkedList mediumBuffers = new LinkedList(); 24 - public static LinkedList largeBuffers = new LinkedList(); 25 17 26 18 27 19 public static Buffer allocate(int sizeMode) { 28 - synchronized (mediumBuffers) { 29 - Buffer buffer = null; 30 - if (sizeMode == 0 && smallBufferCount > 0) { 31 - smallBufferCount--; 32 - buffer = (Buffer) smallBuffers.pop(); 33 - } else if (sizeMode == 1 && mediumBufferCount > 0) { 34 - mediumBufferCount--; 35 - buffer = (Buffer) mediumBuffers.pop(); 36 - } else if (sizeMode == 2 && largeBufferCount > 0) { 37 - largeBufferCount--; 38 - buffer = (Buffer) largeBuffers.pop(); 39 - } 40 - if (buffer != null) { 41 - buffer.currentPosition = 0; 42 - return buffer; 43 - } 44 - } 45 20 Buffer buffer = new Buffer(); 46 21 buffer.currentPosition = 0; 47 22 if (sizeMode == 0) ··· 56 31 public Buffer() { 57 32 } 58 33 59 - public Buffer(byte buffer[]) { 34 + public Buffer(byte[] buffer) { 60 35 this.buffer = buffer; 61 36 this.currentPosition = 0; 62 37 } ··· 120 95 buffer[currentPosition++] = 10; 121 96 } 122 97 123 - public void putBytes(byte bytes[], int start, int length) { 98 + public void putBytes(byte[] bytes, int start, int length) { 124 99 for (int pos = start; pos < start + length; pos++) 125 100 buffer[currentPosition++] = bytes[pos]; 126 101 } ··· 170 145 171 146 public String getString() { 172 147 int start = currentPosition; 173 - while (buffer[currentPosition++] != 10); 148 + moveBufferToTarget((byte) 10); 174 149 return new String(buffer, start, currentPosition - start - 1); 175 150 } 176 151 152 + private void moveBufferToTarget(byte target) { 153 + if(buffer[currentPosition++] != target){ 154 + moveBufferToTarget(target); 155 + } 156 + } 157 + 177 158 public byte[] getStringBytes() { 178 159 int start = currentPosition; 179 - while (buffer[currentPosition++] != 10); 180 - byte bytes[] = new byte[currentPosition - start - 1]; 181 - for (int pos = start; pos < currentPosition - 1; pos++) 182 - bytes[pos - start] = buffer[pos]; 160 + moveBufferToTarget((byte) 10); 161 + byte[] bytes = new byte[currentPosition - start - 1]; 162 + if (currentPosition - 1 - start >= 0) 163 + System.arraycopy(buffer, start, bytes, 0, currentPosition - 1 - start); 183 164 return bytes; 184 165 } 185 166 186 - public void getBytes(byte bytes[], int start, int len) { 167 + public void getBytes(byte[] bytes, int start, int len) { 187 168 for (int pos = start; pos < start + len; pos++) 188 169 bytes[pos] = buffer[currentPosition++]; 189 170 } ··· 232 213 public void encrypt(BigInteger modulus, BigInteger key) { 233 214 int length = currentPosition; 234 215 currentPosition = 0; 235 - byte bytes[] = new byte[length]; 216 + byte[] bytes = new byte[length]; 236 217 237 218 getBytes(bytes, 0, length); 238 219 ··· 351 332 + ((buffer[currentPosition - 1] & 0xff) << 8) + (buffer[currentPosition - 2] & 0xff); 352 333 } 353 334 354 - public void getBytesReverse(byte bytes[], int start, int len) { 335 + public void getBytesReverse(byte[] bytes, int start, int len) { 355 336 for (int pos = (start + len) - 1; pos >= start; pos--) 356 337 bytes[pos] = buffer[currentPosition++]; 357 338 } 358 339 359 - public void getBytesAdded(byte bytes[], int start, int len) { 340 + public void getBytesAdded(byte[] bytes, int start, int len) { 360 341 for (int pos = start; pos < start + len; pos++) 361 342 bytes[pos] = (byte) (buffer[currentPosition++] - 128); 362 343 } 363 - 364 344 365 345 366 - 367 - static { 368 - int pos = 0; 369 - while (pos < 256) { 370 - int value = pos; 371 - for (int pass = 0; pass < 8; pass++) 372 - if ((value & 1) == 1) 373 - value = value >>> 1 ^ 0xedb88320; 374 - else 375 - value >>>= 1; 376 - CRC32_TABLE[pos] = value; 377 - pos++; 378 - } 379 - 380 - } 381 346 }
+2 -2
src/main/java/com/jagex/runescape/net/requester/OnDemandRequester.java
··· 498 498 499 499 public void immediateRequestCount() { 500 500 synchronized (immediateRequests) { 501 - immediateRequests.getNodeCount(); 501 + immediateRequests.clear(); 502 502 } 503 503 } 504 504 ··· 567 567 if (currentTime - lastSocketOpen < 4000L) 568 568 return; 569 569 lastSocketOpen = currentTime; 570 - socket = client.openSocket(Configuration.ONDEMAND_PORT + Game.portOffset); 570 + socket = client.openSocket(Configuration.ONDEMAND_PORT + client.portOffset); 571 571 inputStream = socket.getInputStream(); 572 572 outputStream = socket.getOutputStream(); 573 573 outputStream.write(15);
+1201 -1223
src/main/java/com/jagex/runescape/scene/Region.java
··· 12 12 import com.jagex.runescape.scene.util.TiledUtils; 13 13 14 14 public class Region { 15 - public byte[][][] renderRuleFlags; 16 - public byte aByte139 = 0; 17 - public boolean aBoolean140 = true; 18 - public static int hueRandomizer = (int) (Math.random() * 17.0) - 8; 19 - public byte[][][] overlayRotations; 20 - public static final int[] anIntArray143 = { 0, -1, 0, 1 }; 21 - public int[] blendedHue; 22 - public int[] blendedSaturation; 23 - public int[] blendedLightness; 24 - public int[] blendedHueDivisor; 25 - public int[] blendDirectionTracker; 26 - public int[][][] vertexHeights; 27 - public static int lowestPlane = 99; 28 - public int regionSizeX; 29 - public int regionSizeY; 30 - public byte[][][] overlayClippingPaths; 31 - public static byte aByte154 = -80; 32 - public byte[][][] overlayFloorIds; 33 - public byte aByte156 = 0; 34 - public boolean aBoolean157 = true; 35 - public static final int[] anIntArray158 = { 1, 2, 4, 8 }; 36 - public byte[][][] underlayFloorIds; 37 - public int anInt160 = 20411; 38 - public static final int[] anIntArray161 = { 1, 0, -1, 0 }; 39 - public static int onBuildTimePlane; 40 - public static int lightnessRandomizer = (int) (Math.random() * 33.0) - 16; 41 - public byte[][][] tileShadowIntensity; 42 - public int[][] tileLightingIntensity; 43 - public int anInt166 = 69; 44 - public static final int[] anIntArray167 = { 16, 32, 64, 128 }; 45 - public int[][][] tileCullingBitsets; 46 - public static boolean lowMemory = true; 15 + public byte[][][] renderRuleFlags; 16 + public static int hueRandomizer = (int) (Math.random() * 17.0) - 8; 17 + public byte[][][] overlayRotations; 18 + public static final int[] FACE_OFFSET_X = {1, 0, -1, 0}; 19 + public static final int[] FACE_OFFSET_Y = {0, -1, 0, 1}; 20 + public static final int[] WALL_CORNER_ORIENTATION = {16, 32, 64, 128}; 21 + public static final int[] POWERS_OF_TWO = {1, 2, 4, 8}; 22 + public int[] blendedHue; 23 + public int[] blendedSaturation; 24 + public int[] blendedLightness; 25 + public int[] blendedHueDivisor; 26 + public int[] blendDirectionTracker; 27 + public int[][][] vertexHeights; 28 + public static int lowestPlane = 99; 29 + public int regionSizeX; 30 + public int regionSizeY; 31 + public byte[][][] overlayClippingPaths; 32 + public byte[][][] overlayFloorIds; 33 + public byte[][][] underlayFloorIds; 34 + public int anInt160 = 20411; 35 + public static int onBuildTimePlane; 36 + public static int lightnessRandomizer = (int) (Math.random() * 33.0) - 16; 37 + public byte[][][] tileShadowIntensity; 38 + public int[][] tileLightingIntensity; 39 + public int anInt166 = 69; 40 + public int[][][] tileCullingBitsets; 41 + public static boolean lowMemory = true; 47 42 48 43 49 - public Region(byte[][][] renderRuleFlags, int regionSizeY, int regionSizeX, int[][][] vertexHeights) { 50 - lowestPlane = 99; 51 - this.regionSizeX = regionSizeX; 52 - this.regionSizeY = regionSizeY; 53 - this.vertexHeights = vertexHeights; 54 - this.renderRuleFlags = renderRuleFlags; 55 - underlayFloorIds = new byte[4][this.regionSizeX][this.regionSizeY]; 56 - overlayFloorIds = new byte[4][this.regionSizeX][this.regionSizeY]; 57 - overlayClippingPaths = new byte[4][this.regionSizeX][this.regionSizeY]; 58 - overlayRotations = new byte[4][this.regionSizeX][this.regionSizeY]; 59 - tileCullingBitsets = new int[4][this.regionSizeX + 1][this.regionSizeY + 1]; 60 - tileShadowIntensity = new byte[4][this.regionSizeX + 1][this.regionSizeY + 1]; 61 - tileLightingIntensity = new int[this.regionSizeX + 1][this.regionSizeY + 1]; 62 - blendedHue = new int[this.regionSizeY]; 63 - blendedSaturation = new int[this.regionSizeY]; 64 - blendedLightness = new int[this.regionSizeY]; 65 - blendedHueDivisor = new int[this.regionSizeY]; 66 - blendDirectionTracker = new int[this.regionSizeY]; 44 + public Region(byte[][][] renderRuleFlags, int regionSizeY, int regionSizeX, int[][][] vertexHeights) { 45 + lowestPlane = 99; 46 + this.regionSizeX = regionSizeX; 47 + this.regionSizeY = regionSizeY; 48 + this.vertexHeights = vertexHeights; 49 + this.renderRuleFlags = renderRuleFlags; 50 + underlayFloorIds = new byte[4][this.regionSizeX][this.regionSizeY]; 51 + overlayFloorIds = new byte[4][this.regionSizeX][this.regionSizeY]; 52 + overlayClippingPaths = new byte[4][this.regionSizeX][this.regionSizeY]; 53 + overlayRotations = new byte[4][this.regionSizeX][this.regionSizeY]; 54 + tileCullingBitsets = new int[4][this.regionSizeX + 1][this.regionSizeY + 1]; 55 + tileShadowIntensity = new byte[4][this.regionSizeX + 1][this.regionSizeY + 1]; 56 + tileLightingIntensity = new int[this.regionSizeX + 1][this.regionSizeY + 1]; 57 + blendedHue = new int[this.regionSizeY]; 58 + blendedSaturation = new int[this.regionSizeY]; 59 + blendedLightness = new int[this.regionSizeY]; 60 + blendedHueDivisor = new int[this.regionSizeY]; 61 + blendDirectionTracker = new int[this.regionSizeY]; 67 62 68 - } 63 + } 69 64 70 - public static int calculateNoise(int x, int seed) { 71 - int n = x + seed * 57; 72 - n = n << 13 ^ n; 73 - int noise = n * (n * n * 15731 + 789221) + 1376312589 & 0x7fffffff; 74 - return noise >> 19 & 0xff; 75 - } 65 + public static int calculateNoise(int x, int seed) { 66 + int n = x + seed * 57; 67 + n = n << 13 ^ n; 68 + int noise = n * (n * n * 15731 + 789221) + 1376312589 & 0x7fffffff; 69 + return noise >> 19 & 0xff; 70 + } 76 71 77 - public static int method163(int i, int i_0_, int i_1_) { 78 - int i_2_ = i / i_1_; 79 - int i_3_ = i & i_1_ - 1; 80 - int i_4_ = i_0_ / i_1_; 81 - int i_5_ = i_0_ & i_1_ - 1; 82 - int i_6_ = method178(i_2_, i_4_); 83 - int i_7_ = method178(i_2_ + 1, i_4_); 84 - int i_8_ = method178(i_2_, i_4_ + 1); 85 - int i_9_ = method178(i_2_ + 1, i_4_ + 1); 86 - int i_10_ = method176(i_6_, i_7_, i_3_, i_1_); 87 - int i_11_ = method176(i_8_, i_9_, i_3_, i_1_); 88 - return method176(i_10_, i_11_, i_5_, i_1_); 89 - } 72 + public static int method163(int deltaX, int deltaY, int deltaScale) { 73 + int x = deltaX / deltaScale; 74 + int deltaPrimary = deltaX & deltaScale - 1; 75 + int y = deltaY / deltaScale; 76 + int deltaSecondary = deltaY & deltaScale - 1; 77 + int noiseSW = randomNoiseWeighedSum(x, y); 78 + int noiseSE = randomNoiseWeighedSum(x + 1, y); 79 + int noiseNE = randomNoiseWeighedSum(x, y + 1); 80 + int noiseNW = randomNoiseWeighedSum(x + 1, y + 1); 81 + int interpolationA = interpolate(noiseSW, noiseSE, deltaPrimary, deltaScale); 82 + int interpolationB = interpolate(noiseNE, noiseNW, deltaPrimary, deltaScale); 83 + return interpolate(interpolationA, interpolationB, deltaSecondary, deltaScale); 84 + } 90 85 91 - public int getVisibilityPlaneFor(int i, int i_12_, int i_13_, byte i_14_) { 92 - if (i_14_ == aByte156) { 93 - // boolean bool = false; 94 - } else 95 - return 2; 96 - if ((renderRuleFlags[i_12_][i_13_][i] & 0x8) != 0) 97 - return 0; 98 - if (i_12_ > 0 && (renderRuleFlags[1][i_13_][i] & 0x2) != 0) 99 - return i_12_ - 1; 100 - return i_12_; 101 - } 86 + public int getVisibilityPlaneFor(int x, int y, int plane) { 87 + if ((this.renderRuleFlags[plane][x][y] & 8) != 0) { 88 + return 0; 89 + } 90 + if (plane > 0 && (this.renderRuleFlags[1][x][y] & 2) != 0) { 91 + return plane - 1; 92 + } else { 93 + return plane; 94 + } 95 + } 102 96 103 - public static void method165(int i, int i_15_, int i_16_, int i_17_, CollisionMap class46, int i_18_, int i_19_, 104 - int i_20_, int i_21_, Scene class22, int[][][] is) { 105 - int i_22_ = is[i_15_][i_19_][i_17_]; 106 - int i_23_ = is[i_15_][i_19_ + 1][i_17_]; 107 - int i_24_ = is[i_15_][i_19_ + 1][i_17_ + 1]; 108 - int i_25_ = is[i_15_][i_19_][i_17_ + 1]; 109 - int i_26_ = i_22_ + i_23_ + i_24_ + i_25_ >> 2; 110 - GameObjectDefinition class47 = GameObjectDefinition.getDefinition(i); 111 - if (i_20_ == 0) { 112 - int i_27_ = i_19_ + (i_17_ << 7) + (i << 14) + 1073741824; 113 - if (!class47.actionsBoolean) 114 - i_27_ += -2147483648; 115 - byte i_28_ = (byte) ((i_18_ << 6) + i_16_); 116 - if (i_16_ == 22) { 117 - Renderable class50_sub1_sub4; 118 - if (class47.animationId == -1 && class47.childrenIds == null) 119 - class50_sub1_sub4 = class47.getGameObjectModel(22, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 120 - else 121 - class50_sub1_sub4 = new GameObject(i, i_18_, 22, i_23_, i_24_, i_22_, i_25_, class47.animationId, 122 - true); 123 - class22.addGroundDecoration(i_19_, i_17_, i_21_, i_26_, i_27_, class50_sub1_sub4, i_28_); 124 - if (class47.solid && class47.actionsBoolean) 125 - class46.markBlocked(i_19_, i_17_); 126 - } else if (i_16_ == 10 || i_16_ == 11) { 127 - Renderable class50_sub1_sub4; 128 - if (class47.animationId == -1 && class47.childrenIds == null) 129 - class50_sub1_sub4 = class47.getGameObjectModel(10, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 130 - else 131 - class50_sub1_sub4 = new GameObject(i, i_18_, 10, i_23_, i_24_, i_22_, i_25_, class47.animationId, 132 - true); 133 - if (class50_sub1_sub4 != null) { 134 - int i_29_ = 0; 135 - if (i_16_ == 11) 136 - i_29_ += 256; 137 - int i_30_; 138 - int i_31_; 139 - if (i_18_ == 1 || i_18_ == 3) { 140 - i_30_ = class47.sizeY; 141 - i_31_ = class47.sizeX; 142 - } else { 143 - i_30_ = class47.sizeX; 144 - i_31_ = class47.sizeY; 145 - } 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 - } 149 - if (class47.solid) 150 - class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, 151 - (byte) 52); 152 - } else if (i_16_ >= 12) { 153 - Renderable class50_sub1_sub4; 154 - if (class47.animationId == -1 && class47.childrenIds == null) 155 - class50_sub1_sub4 = class47.getGameObjectModel(i_16_, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 156 - else 157 - class50_sub1_sub4 = new GameObject(i, i_18_, i_16_, i_23_, i_24_, i_22_, i_25_, class47.animationId, 158 - true); 159 - class22.addEntityB(i_19_, i_17_, i_21_, i_26_, 0, 1, 1, i_27_, class50_sub1_sub4, i_28_); 160 - if (class47.solid) 161 - class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, 162 - (byte) 52); 163 - } else if (i_16_ == 0) { 164 - Renderable class50_sub1_sub4; 165 - if (class47.animationId == -1 && class47.childrenIds == null) 166 - class50_sub1_sub4 = class47.getGameObjectModel(0, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 167 - else 168 - class50_sub1_sub4 = new GameObject(i, i_18_, 0, i_23_, i_24_, i_22_, i_25_, class47.animationId, 169 - true); 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 - if (class47.solid) 173 - class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 174 - } else if (i_16_ == 1) { 175 - Renderable class50_sub1_sub4; 176 - if (class47.animationId == -1 && class47.childrenIds == null) 177 - class50_sub1_sub4 = class47.getGameObjectModel(1, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 178 - else 179 - class50_sub1_sub4 = new GameObject(i, i_18_, 1, i_23_, i_24_, i_22_, i_25_, class47.animationId, 97 + public static void forceRenderObject(int x, int y, int z, int objectId, int type, int plane, int face, Scene scene, CollisionMap collisionMap, 98 + int[][][] groundArray) { 99 + int vertexHeightSW = groundArray[plane][x][y]; 100 + int vertexHeightSE = groundArray[plane][x + 1][y]; 101 + int vertexHeightNE = groundArray[plane][x + 1][y + 1]; 102 + int vertexHeightNW = groundArray[plane][x][y + 1]; 103 + int drawHeight = vertexHeightSW + vertexHeightSE + vertexHeightNE + vertexHeightNW >> 2; 104 + GameObjectDefinition definition = GameObjectDefinition.getDefinition(objectId); 105 + int hash = x + (y << 7) + (objectId << 14) + 1073741824; 106 + if (!definition.hasActions) 107 + hash += -2147483648; 108 + byte config = (byte) ((face << 6) + type); 109 + if (type == 22) { 110 + Renderable renderable; 111 + if (definition.animationId == -1 && definition.childrenIds == null) 112 + renderable = definition.getGameObjectModel(22, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 113 + else 114 + renderable = new GameObject(objectId, face, 22, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 115 + true); 116 + scene.addGroundDecoration(x, y, z, drawHeight, hash, renderable, config); 117 + if (definition.solid && definition.hasActions) 118 + collisionMap.markBlocked(x, y); 119 + } else if (type == 10 || type == 11) { 120 + Renderable renderable; 121 + if (definition.animationId == -1 && definition.childrenIds == null) 122 + renderable = definition.getGameObjectModel(10, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 123 + else 124 + renderable = new GameObject(objectId, face, 10, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 125 + true); 126 + if (renderable != null) { 127 + int rotation = 0; 128 + if (type == 11) 129 + rotation += 256; 130 + int sizeX; 131 + int sizeY; 132 + if (face == 1 || face == 3) { 133 + sizeX = definition.sizeY; 134 + sizeY = definition.sizeX; 135 + } else { 136 + sizeX = definition.sizeX; 137 + sizeY = definition.sizeY; 138 + } 139 + scene.addEntityB(x, y, z, drawHeight, rotation, sizeY, sizeX, hash, renderable, config 140 + ); 141 + } 142 + if (definition.solid) 143 + collisionMap.markSolidOccupant(y, face, definition.sizeY, definition.sizeX, definition.walkable, x, 144 + (byte) 52); 145 + } else if (type >= 12) { 146 + Renderable renderable; 147 + if (definition.animationId == -1 && definition.childrenIds == null) 148 + renderable = definition.getGameObjectModel(type, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 149 + else 150 + renderable = new GameObject(objectId, face, type, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 151 + true); 152 + scene.addEntityB(x, y, z, drawHeight, 0, 1, 1, hash, renderable, config); 153 + if (definition.solid) 154 + collisionMap.markSolidOccupant(y, face, definition.sizeY, definition.sizeX, definition.walkable, x, 155 + (byte) 52); 156 + } else if (type == 0) { 157 + Renderable renderable; 158 + if (definition.animationId == -1 && definition.childrenIds == null) 159 + renderable = definition.getGameObjectModel(0, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 160 + else 161 + renderable = new GameObject(objectId, face, 0, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 162 + true); 163 + scene.addWall(x, y, z, drawHeight, POWERS_OF_TWO[face], 0, hash, renderable, null, config 164 + ); 165 + if (definition.solid) 166 + collisionMap.markWall(x, y, type, face, definition.walkable); 167 + } else if (type == 1) { 168 + Renderable renderable; 169 + if (definition.animationId == -1 && definition.childrenIds == null) 170 + renderable = definition.getGameObjectModel(1, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 171 + else 172 + renderable = new GameObject(objectId, face, 1, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 173 + true); 174 + scene.addWall(x, y, z, drawHeight, WALL_CORNER_ORIENTATION[face], 0, hash, renderable, null, config 175 + ); 176 + if (definition.solid) 177 + collisionMap.markWall(x, y, type, face, definition.walkable); 178 + } else if (type == 2) { 179 + int _face = face + 1 & 0x3; 180 + Renderable renderable; 181 + Renderable renderable1; 182 + if (definition.animationId == -1 && definition.childrenIds == null) { 183 + renderable = definition.getGameObjectModel(2, 4 + face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 184 + renderable1 = definition.getGameObjectModel(2, _face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 185 + } else { 186 + renderable = new GameObject(objectId, 4 + face, 2, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 187 + true); 188 + renderable1 = new GameObject(objectId, _face, 2, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 189 + true); 190 + } 191 + scene.addWall(x, y, z, drawHeight, POWERS_OF_TWO[face], POWERS_OF_TWO[_face], hash, renderable, renderable1, config 192 + ); 193 + if (definition.solid) 194 + collisionMap.markWall(x, y, type, face, definition.walkable); 195 + } else if (type == 3) { 196 + Renderable renderable; 197 + if (definition.animationId == -1 && definition.childrenIds == null) 198 + renderable = definition.getGameObjectModel(3, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 199 + else 200 + renderable = new GameObject(objectId, face, 3, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 201 + true); 202 + scene.addWall(x, y, z, drawHeight, WALL_CORNER_ORIENTATION[face], 0, hash, renderable, null, config 203 + ); 204 + if (definition.solid) 205 + collisionMap.markWall(x, y, type, face, definition.walkable); 206 + } else if (type == 9) { 207 + Renderable renderable; 208 + if (definition.animationId == -1 && definition.childrenIds == null) 209 + renderable = definition.getGameObjectModel(type, face, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 210 + else 211 + renderable = new GameObject(objectId, face, type, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 212 + true); 213 + scene.addEntityB(x, y, z, drawHeight, 0, 1, 1, hash, renderable, config); 214 + if (definition.solid) 215 + collisionMap.markSolidOccupant(y, face, definition.sizeY, definition.sizeX, definition.walkable, x, 216 + (byte) 52); 217 + } else { 218 + if (definition.adjustToTerrain) { 219 + if (face == 1) { 220 + int temp = vertexHeightNW; 221 + vertexHeightNW = vertexHeightNE; 222 + vertexHeightNE = vertexHeightSE; 223 + vertexHeightSE = vertexHeightSW; 224 + vertexHeightSW = temp; 225 + } else if (face == 2) { 226 + int temp = vertexHeightNW; 227 + vertexHeightNW = vertexHeightSE; 228 + vertexHeightSE = temp; 229 + temp = vertexHeightNE; 230 + vertexHeightNE = vertexHeightSW; 231 + vertexHeightSW = temp; 232 + } else if (face == 3) { 233 + int temp = vertexHeightNW; 234 + vertexHeightNW = vertexHeightSW; 235 + vertexHeightSW = vertexHeightSE; 236 + vertexHeightSE = vertexHeightNE; 237 + vertexHeightNE = temp; 238 + } 239 + } 240 + if (type == 4) { 241 + Renderable renderable; 242 + if (definition.animationId == -1 && definition.childrenIds == null) 243 + renderable = definition.getGameObjectModel(4, 0, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 244 + else 245 + renderable = new GameObject(objectId, 0, 4, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 180 246 true); 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 - if (class47.solid) 184 - class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 185 - } else if (i_16_ == 2) { 186 - int i_32_ = i_18_ + 1 & 0x3; 187 - Renderable class50_sub1_sub4; 188 - Renderable class50_sub1_sub4_33_; 189 - if (class47.animationId == -1 && class47.childrenIds == null) { 190 - class50_sub1_sub4 = class47.getGameObjectModel(2, 4 + i_18_, i_22_, i_23_, i_24_, i_25_, -1); 191 - class50_sub1_sub4_33_ = class47.getGameObjectModel(2, i_32_, i_22_, i_23_, i_24_, i_25_, -1); 192 - } else { 193 - class50_sub1_sub4 = new GameObject(i, 4 + i_18_, 2, i_23_, i_24_, i_22_, i_25_, class47.animationId, 247 + scene.addWallDecoration(x, y, z, drawHeight, 0, 0, face * 512, hash, renderable, config, POWERS_OF_TWO[face] 248 + ); 249 + } else if (type == 5) { 250 + int offsetAmplifier = 16; 251 + int objectHash = scene.getWallObjectHash(x, y, z); 252 + if (objectHash > 0) 253 + offsetAmplifier = GameObjectDefinition.getDefinition(objectHash >> 14 & 0x7fff).offsetAmplifier; 254 + Renderable renderable; 255 + if (definition.animationId == -1 && definition.childrenIds == null) 256 + renderable = definition.getGameObjectModel(4, 0, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 257 + else 258 + renderable = new GameObject(objectId, 0, 4, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 194 259 true); 195 - class50_sub1_sub4_33_ = new GameObject(i, i_32_, 2, i_23_, i_24_, i_22_, i_25_, class47.animationId, 260 + scene.addWallDecoration(x, y, z, drawHeight, FACE_OFFSET_X[face] * offsetAmplifier, FACE_OFFSET_Y[face] * offsetAmplifier, face * 512, hash, renderable, config, POWERS_OF_TWO[face] 261 + ); 262 + } else if (type == 6) { 263 + Renderable renderable; 264 + if (definition.animationId == -1 && definition.childrenIds == null) 265 + renderable = definition.getGameObjectModel(4, 0, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 266 + else 267 + renderable = new GameObject(objectId, 0, 4, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 196 268 true); 197 - } 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 - if (class47.solid) 201 - class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 202 - } else if (i_16_ == 3) { 203 - Renderable class50_sub1_sub4; 204 - if (class47.animationId == -1 && class47.childrenIds == null) 205 - class50_sub1_sub4 = class47.getGameObjectModel(3, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 206 - else 207 - class50_sub1_sub4 = new GameObject(i, i_18_, 3, i_23_, i_24_, i_22_, i_25_, class47.animationId, 269 + scene.addWallDecoration(x, y, z, drawHeight, 0, 0, face, hash, renderable, config, 256 270 + ); 271 + } else if (type == 7) { 272 + Renderable renderable; 273 + if (definition.animationId == -1 && definition.childrenIds == null) 274 + renderable = definition.getGameObjectModel(4, 0, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 275 + else 276 + renderable = new GameObject(objectId, 0, 4, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 208 277 true); 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 - if (class47.solid) 212 - class46.markWall(i_19_, i_17_, i_16_, i_18_, class47.walkable); 213 - } else if (i_16_ == 9) { 214 - Renderable class50_sub1_sub4; 215 - if (class47.animationId == -1 && class47.childrenIds == null) 216 - class50_sub1_sub4 = class47.getGameObjectModel(i_16_, i_18_, i_22_, i_23_, i_24_, i_25_, -1); 217 - else 218 - class50_sub1_sub4 = new GameObject(i, i_18_, i_16_, i_23_, i_24_, i_22_, i_25_, class47.animationId, 278 + scene.addWallDecoration(x, y, z, drawHeight, 0, 0, face, hash, renderable, config, 512 279 + ); 280 + } else if (type == 8) { 281 + Renderable renderable; 282 + if (definition.animationId == -1 && definition.childrenIds == null) 283 + renderable = definition.getGameObjectModel(4, 0, vertexHeightSW, vertexHeightSE, vertexHeightNE, vertexHeightNW, -1); 284 + else 285 + renderable = new GameObject(objectId, 0, 4, vertexHeightSE, vertexHeightNE, vertexHeightSW, vertexHeightNW, definition.animationId, 219 286 true); 220 - class22.addEntityB(i_19_, i_17_, i_21_, i_26_, 0, 1, 1, i_27_, class50_sub1_sub4, i_28_); 221 - if (class47.solid) 222 - class46.method413(i_17_, i_18_, class47.sizeY, class47.sizeX, class47.walkable, i_19_, 223 - (byte) 52); 224 - } else { 225 - if (class47.adjustToTerrain) { 226 - if (i_18_ == 1) { 227 - int i_34_ = i_25_; 228 - i_25_ = i_24_; 229 - i_24_ = i_23_; 230 - i_23_ = i_22_; 231 - i_22_ = i_34_; 232 - } else if (i_18_ == 2) { 233 - int i_35_ = i_25_; 234 - i_25_ = i_23_; 235 - i_23_ = i_35_; 236 - i_35_ = i_24_; 237 - i_24_ = i_22_; 238 - i_22_ = i_35_; 239 - } else if (i_18_ == 3) { 240 - int i_36_ = i_25_; 241 - i_25_ = i_22_; 242 - i_22_ = i_23_; 243 - i_23_ = i_24_; 244 - i_24_ = i_36_; 245 - } 246 - } 247 - if (i_16_ == 4) { 248 - Renderable class50_sub1_sub4; 249 - if (class47.animationId == -1 && class47.childrenIds == null) 250 - class50_sub1_sub4 = class47.getGameObjectModel(4, 0, i_22_, i_23_, i_24_, i_25_, -1); 251 - else 252 - class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 253 - true); 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 - } else if (i_16_ == 5) { 257 - int i_37_ = 16; 258 - int i_38_ = class22.method267(i_21_, i_19_, i_17_); 259 - if (i_38_ > 0) 260 - i_37_ = GameObjectDefinition.getDefinition(i_38_ >> 14 & 0x7fff).unknown4; 261 - Renderable class50_sub1_sub4; 262 - if (class47.animationId == -1 && class47.childrenIds == null) 263 - class50_sub1_sub4 = class47.getGameObjectModel(4, 0, i_22_, i_23_, i_24_, i_25_, -1); 264 - else 265 - class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 266 - true); 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 - ); 269 - } else if (i_16_ == 6) { 270 - Renderable class50_sub1_sub4; 271 - if (class47.animationId == -1 && class47.childrenIds == null) 272 - class50_sub1_sub4 = class47.getGameObjectModel(4, 0, i_22_, i_23_, i_24_, i_25_, -1); 273 - else 274 - class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 275 - true); 276 - class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 256 277 - ); 278 - } else if (i_16_ == 7) { 279 - Renderable class50_sub1_sub4; 280 - if (class47.animationId == -1 && class47.childrenIds == null) 281 - class50_sub1_sub4 = class47.getGameObjectModel(4, 0, i_22_, i_23_, i_24_, i_25_, -1); 282 - else 283 - class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 284 - true); 285 - class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 512 286 - ); 287 - } else if (i_16_ == 8) { 288 - Renderable class50_sub1_sub4; 289 - if (class47.animationId == -1 && class47.childrenIds == null) 290 - class50_sub1_sub4 = class47.getGameObjectModel(4, 0, i_22_, i_23_, i_24_, i_25_, -1); 291 - else 292 - class50_sub1_sub4 = new GameObject(i, 0, 4, i_23_, i_24_, i_22_, i_25_, class47.animationId, 293 - true); 294 - class22.addWallDecoration(i_19_, i_17_, i_21_, i_26_, 0, 0, i_18_, i_27_, class50_sub1_sub4, i_28_, 768 295 - ); 296 - } 297 - } 298 - } 299 - } 287 + scene.addWallDecoration(x, y, z, drawHeight, 0, 0, face, hash, renderable, config, 768 288 + ); 289 + } 290 + } 291 + } 300 292 301 - public void method166(int i, int i_39_, int i_40_, int i_41_) { 302 - if (i == anInt160) { 303 - for (int i_42_ = 0; i_42_ < 8; i_42_++) { 304 - for (int i_43_ = 0; i_43_ < 8; i_43_++) 305 - vertexHeights[i_39_][i_41_ + i_42_][i_40_ + i_43_] = 0; 306 - } 307 - if (i_41_ > 0) { 308 - for (int i_44_ = 1; i_44_ < 8; i_44_++) 309 - vertexHeights[i_39_][i_41_][i_40_ + i_44_] = vertexHeights[i_39_][i_41_ - 1][i_40_ 310 - + i_44_]; 311 - } 312 - if (i_40_ > 0) { 313 - for (int i_45_ = 1; i_45_ < 8; i_45_++) 314 - vertexHeights[i_39_][i_41_ + i_45_][i_40_] = vertexHeights[i_39_][i_41_ + i_45_][i_40_ - 1]; 315 - } 316 - if (i_41_ > 0 && vertexHeights[i_39_][i_41_ - 1][i_40_] != 0) 317 - vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_ - 1][i_40_]; 318 - else if (i_40_ > 0 && vertexHeights[i_39_][i_41_][i_40_ - 1] != 0) 319 - vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_][i_40_ - 1]; 320 - else if (i_41_ > 0 && i_40_ > 0 && vertexHeights[i_39_][i_41_ - 1][i_40_ - 1] != 0) 321 - vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_ - 1][i_40_ - 1]; 322 - } 323 - } 293 + public void method166(int i_39_, int i_40_, int i_41_) { 294 + for (int i_42_ = 0; i_42_ < 8; i_42_++) { 295 + for (int i_43_ = 0; i_43_ < 8; i_43_++) 296 + vertexHeights[i_39_][i_41_ + i_42_][i_40_ + i_43_] = 0; 297 + } 298 + if (i_41_ > 0) { 299 + for (int i_44_ = 1; i_44_ < 8; i_44_++) 300 + vertexHeights[i_39_][i_41_][i_40_ + i_44_] = vertexHeights[i_39_][i_41_ - 1][i_40_ 301 + + i_44_]; 302 + } 303 + if (i_40_ > 0) { 304 + for (int i_45_ = 1; i_45_ < 8; i_45_++) 305 + vertexHeights[i_39_][i_41_ + i_45_][i_40_] = vertexHeights[i_39_][i_41_ + i_45_][i_40_ - 1]; 306 + } 307 + if (i_41_ > 0 && vertexHeights[i_39_][i_41_ - 1][i_40_] != 0) 308 + vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_ - 1][i_40_]; 309 + else if (i_40_ > 0 && vertexHeights[i_39_][i_41_][i_40_ - 1] != 0) 310 + vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_][i_40_ - 1]; 311 + else if (i_41_ > 0 && i_40_ > 0 && vertexHeights[i_39_][i_41_ - 1][i_40_ - 1] != 0) 312 + vertexHeights[i_39_][i_41_][i_40_] = vertexHeights[i_39_][i_41_ - 1][i_40_ - 1]; 313 + } 324 314 325 - public void createRegionScene(CollisionMap[] collisionMaps, Scene scene) { 326 - for (int plane = 0; plane < 4; plane++) { 327 - for (int x = 0; x < 104; x++) { 328 - for (int y = 0; y < 104; y++) { 329 - if ((renderRuleFlags[plane][x][y] & 0x1) == 1) { 330 - int originalPlane = plane; 331 - if ((renderRuleFlags[1][x][y] & 0x2) == 2) 332 - originalPlane--; 333 - if (originalPlane >= 0) 334 - collisionMaps[originalPlane].markBlocked(x, y); 335 - } 336 - } 337 - } 338 - } 339 - hueRandomizer += (int) (Math.random() * 5.0) - 2; 340 - if (hueRandomizer < -8) 341 - hueRandomizer = -8; 342 - if (hueRandomizer > 8) 343 - hueRandomizer = 8; 344 - lightnessRandomizer += (int) (Math.random() * 5.0) - 2; 345 - if (lightnessRandomizer < -16) 346 - lightnessRandomizer = -16; 347 - if (lightnessRandomizer > 16) 348 - lightnessRandomizer = 16; 349 - for (int plane = 0; plane < 4; plane++) { 350 - byte[][] shadowIntensity = tileShadowIntensity[plane]; 351 - int directionalLightInitialIntensity = 96; 352 - int specularDistributionFactor = 768; 353 - int directionalLightX = -50; 354 - int directionalLightY = -10; 355 - int directionalLightZ = -50; 356 - int directionalLightLength = (int) Math.sqrt((directionalLightX * directionalLightX + directionalLightY * directionalLightY + directionalLightZ * directionalLightZ)); 357 - int specularDistribution = specularDistributionFactor * directionalLightLength >> 8; 358 - for (int y = 1; y < regionSizeY - 1; y++) { 359 - for (int x = 1; x < regionSizeX - 1; x++) { 360 - int xHeightDifference = (vertexHeights[plane][x + 1][y] - vertexHeights[plane][x - 1][y]); 361 - int yHeightDifference = (vertexHeights[plane][x][y + 1] - vertexHeights[plane][x][y - 1]); 362 - int normalizedLength = (int) Math.sqrt((xHeightDifference * xHeightDifference + 65536 + yHeightDifference * yHeightDifference)); 363 - int normalizedNormalX = (xHeightDifference << 8) / normalizedLength; 364 - int normalizedNormalY = 65536 / normalizedLength; 365 - int normalizedNormalZ = (yHeightDifference << 8) / normalizedLength; 366 - int directionalLightIntensity = directionalLightInitialIntensity + (directionalLightX * normalizedNormalX + directionalLightY * normalizedNormalY + directionalLightZ * normalizedNormalZ) / specularDistribution; 367 - int weightedShadowIntensity = ((shadowIntensity[x - 1][y] >> 2) + (shadowIntensity[x + 1][y] >> 3) 368 - + (shadowIntensity[x][y - 1] >> 2) + (shadowIntensity[x][y + 1] >> 3) + (shadowIntensity[x][y] >> 1)); 369 - tileLightingIntensity[x][y] = directionalLightIntensity - weightedShadowIntensity; 370 - } 371 - } 372 - for (int y = 0; y < regionSizeY; y++) { 373 - blendedHue[y] = 0; 374 - blendedSaturation[y] = 0; 375 - blendedLightness[y] = 0; 376 - blendedHueDivisor[y] = 0; 377 - blendDirectionTracker[y] = 0; 378 - } 379 - for (int x = -5; x < regionSizeX + 5; x++) { 380 - for (int y = 0; y < regionSizeY; y++) { 381 - int xPositiveOffset = x + 5; 382 - if (xPositiveOffset >= 0 && xPositiveOffset < regionSizeX) { 383 - int floorId = underlayFloorIds[plane][xPositiveOffset][y] & 0xff; 384 - if (floorId > 0) { 385 - FloorDefinition floor = FloorDefinition.cache[floorId - 1]; 386 - blendedHue[y] += floor.hue; 387 - blendedSaturation[y] += floor.saturation; 388 - blendedLightness[y] += floor.lightness; 389 - blendedHueDivisor[y] += floor.hueDivisor; 390 - blendDirectionTracker[y]++; 391 - } 392 - } 393 - int xNegativeOffset = x - 5; 394 - if (xNegativeOffset >= 0 && xNegativeOffset < regionSizeX) { 395 - int floorId = underlayFloorIds[plane][xNegativeOffset][y] & 0xff; 396 - if (floorId > 0) { 397 - FloorDefinition floor = FloorDefinition.cache[floorId - 1]; 398 - blendedHue[y] -= floor.hue; 399 - blendedSaturation[y] -= floor.saturation; 400 - blendedLightness[y] -= floor.lightness; 401 - blendedHueDivisor[y] -= floor.hueDivisor; 402 - blendDirectionTracker[y]--; 403 - } 404 - } 405 - } 406 - if (x >= 1 && x < regionSizeX - 1) { 407 - int i_75_ = 0; 408 - int i_76_ = 0; 409 - int i_77_ = 0; 410 - int i_78_ = 0; 411 - int i_79_ = 0; 412 - for (int y = -5; y < regionSizeY + 5; y++) { 413 - int yPositiveOffset = y + 5; 414 - if (yPositiveOffset >= 0 && yPositiveOffset < regionSizeY) { 415 - i_75_ += blendedHue[yPositiveOffset]; 416 - i_76_ += blendedSaturation[yPositiveOffset]; 417 - i_77_ += blendedLightness[yPositiveOffset]; 418 - i_78_ += blendedHueDivisor[yPositiveOffset]; 419 - i_79_ += blendDirectionTracker[yPositiveOffset]; 420 - } 421 - int yNegativeOffset = y - 5; 422 - if (yNegativeOffset >= 0 && yNegativeOffset < regionSizeY) { 423 - i_75_ -= blendedHue[yNegativeOffset]; 424 - i_76_ -= blendedSaturation[yNegativeOffset]; 425 - i_77_ -= blendedLightness[yNegativeOffset]; 426 - i_78_ -= blendedHueDivisor[yNegativeOffset]; 427 - i_79_ -= blendDirectionTracker[yNegativeOffset]; 428 - } 429 - if (y >= 1 430 - && y < regionSizeY - 1 431 - && (!lowMemory || (renderRuleFlags[0][x][y] & 0x2) != 0 || ((renderRuleFlags[plane][x][y] & 0x10) == 0 && (getVisibilityPlaneFor( 432 - y, plane, x, (byte) 0) == onBuildTimePlane)))) { 433 - if (plane < lowestPlane) 434 - lowestPlane = plane; 435 - int underlayFloorId = (underlayFloorIds[plane][x][y] & 0xff); 436 - int overlayFloorId = (overlayFloorIds[plane][x][y] & 0xff); 437 - if (underlayFloorId > 0 || overlayFloorId > 0) { 438 - int vertexSouthWest = vertexHeights[plane][x][y]; 439 - int vertexSouthEast = (vertexHeights[plane][x + 1][y]); 440 - int vertexNorthEast = (vertexHeights[plane][x + 1][y + 1]); 441 - int vertexNorthWest = (vertexHeights[plane][x][y + 1]); 442 - int lightSouthWest = tileLightingIntensity[x][y]; 443 - int lightSouthEast = tileLightingIntensity[x + 1][y]; 444 - int lightNorthEast = tileLightingIntensity[x + 1][y + 1]; 445 - int lightNorthWest = tileLightingIntensity[x][y + 1]; 446 - int hslBitsetUnmodified = -1; 447 - int hslBitsetRandomized = -1; 448 - if (underlayFloorId > 0) { 449 - int hue = i_75_ * 256 / i_78_; 450 - int saturation = i_76_ / i_79_; 451 - int lightness = i_77_ / i_79_; 452 - hslBitsetUnmodified = getHSLBitset(hue, saturation, lightness); 453 - hue = hue + hueRandomizer & 0xff; 454 - lightness += lightnessRandomizer; 455 - if (lightness < 0) 456 - lightness = 0; 457 - else if (lightness > 255) 458 - lightness = 255; 459 - hslBitsetRandomized = getHSLBitset(hue, saturation, lightness); 460 - } 461 - if (plane > 0) { 462 - boolean bool = true; 463 - if (underlayFloorId == 0 && (overlayClippingPaths[plane][x][y]) != 0) 464 - bool = false; 465 - if (overlayFloorId > 0 && !(FloorDefinition.cache[overlayFloorId - 1].occlude)) 466 - bool = false; 467 - if (bool && vertexSouthWest == vertexSouthEast && vertexSouthWest == vertexNorthEast && vertexSouthWest == vertexNorthWest) 468 - tileCullingBitsets[plane][x][y] |= 0x924; 469 - } 470 - int rgbBitsetRandomized = 0; 471 - if (hslBitsetUnmodified != -1) 472 - rgbBitsetRandomized = (Rasterizer3D.getRgbLookupTableId[trimHSLLightness(hslBitsetRandomized, 96)]); 473 - if (overlayFloorId == 0) 474 - scene.renderTile(plane, x, y, 0, 0, -1, vertexSouthWest, vertexSouthEast, vertexNorthEast, vertexNorthWest, 475 - trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthEast), 476 - trimHSLLightness(hslBitsetUnmodified, lightNorthWest), 0, 0, 0, 0, rgbBitsetRandomized, 0); 477 - else { 478 - int clippingPath = ((overlayClippingPaths[plane][x][y]) + 1); 479 - byte clippingPathRotation = (overlayRotations[plane][x][y]); 480 - FloorDefinition floor = FloorDefinition.cache[overlayFloorId - 1]; 481 - int textureid = floor.textureId; 482 - int hslBitset; 483 - int rgbBitset; 484 - if (textureid >= 0) { 485 - rgbBitset = Rasterizer3D.getAverageRgbColorForTexture(textureid, 0); 486 - hslBitset = -1; 487 - } else if (floor.rgbColor == 16711935) { 488 - hslBitset = -2; 489 - textureid = -1; 490 - rgbBitset = (Rasterizer3D.getRgbLookupTableId[method182(floor.hslColor2, 96)]); 491 - } else { 492 - hslBitset = getHSLBitset(floor.hue2, floor.saturation, floor.lightness); 493 - rgbBitset = (Rasterizer3D.getRgbLookupTableId[method182(floor.hslColor2, 96)]); 494 - } 495 - scene.renderTile(plane, x, y, clippingPath, clippingPathRotation, textureid, vertexSouthWest, vertexSouthEast, vertexNorthEast, 496 - vertexNorthWest, trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, 497 - lightNorthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthWest), method182(hslBitset, lightSouthWest), 498 - method182(hslBitset, lightSouthEast), method182(hslBitset, lightNorthEast), 499 - method182(hslBitset, lightNorthWest), rgbBitsetRandomized, rgbBitset); 500 - } 501 - } 502 - } 503 - } 504 - } 505 - } 506 - for (int i_104_ = 1; i_104_ < regionSizeY - 1; i_104_++) { 507 - for (int i_105_ = 1; i_105_ < regionSizeX - 1; i_105_++) 508 - scene.setTileLogicHeight(plane, i_105_, i_104_, getVisibilityPlaneFor(i_104_, plane, i_105_, (byte) 0)); 509 - } 510 - } 511 - scene.shadeModels(-10, -50, -50); 512 - for (int y = 0; y < regionSizeX; y++) { 513 - for (int x = 0; x < regionSizeY; x++) { 514 - if ((renderRuleFlags[1][y][x] & 0x2) == 2) 515 - scene.setBridgeMode(y, x); 516 - } 517 - } 518 - int renderRule1 = 1; 519 - int renderRule2 = 2; 520 - int renderRule3 = 4; 521 - for (int currentPlane = 0; currentPlane < 4; currentPlane++) { 522 - if (currentPlane > 0) { 523 - renderRule1 <<= 3; 524 - renderRule2 <<= 3; 525 - renderRule3 <<= 3; 526 - } 527 - for (int plane = 0; plane <= currentPlane; plane++) { 528 - for (int y = 0; y <= regionSizeY; y++) { 529 - for (int x = 0; x <= regionSizeX; x++) { 530 - if ((tileCullingBitsets[plane][x][y] & renderRule1) != 0) { 531 - int lowestOcclussionY = y; 532 - int higestOcclussionY = y; 533 - int lowestOcclussionPlane = plane; 534 - int higestOcclussionPlane = plane; 535 - for (/**/; lowestOcclussionY > 0; lowestOcclussionY--) { 536 - if (((tileCullingBitsets[plane][x][lowestOcclussionY - 1]) & renderRule1) == 0) 537 - break; 538 - } 539 - for (/**/; higestOcclussionY < regionSizeY; higestOcclussionY++) { 540 - if (((tileCullingBitsets[plane][x][higestOcclussionY + 1]) & renderRule1) == 0) 541 - break; 542 - } 543 - while_0_: for (/**/; lowestOcclussionPlane > 0; lowestOcclussionPlane--) { 544 - for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) { 545 - if (((tileCullingBitsets[lowestOcclussionPlane - 1][x][occludedY]) & renderRule1) == 0) 546 - break while_0_; 547 - } 548 - } 549 - while_1_: for (/**/; higestOcclussionPlane < currentPlane; higestOcclussionPlane++) { 550 - for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) { 551 - if (((tileCullingBitsets[higestOcclussionPlane + 1][x][occludedY]) & renderRule1) == 0) 552 - break while_1_; 553 - } 554 - } 555 - int occlussionSurface = (higestOcclussionPlane + 1 - lowestOcclussionPlane) * (higestOcclussionY - lowestOcclussionY + 1); 556 - if (occlussionSurface >= 8) { 557 - int highestOcclussionVertexHeightOffset = 240; 558 - int highestOcclussionVertexHeight = ((vertexHeights[higestOcclussionPlane][x][lowestOcclussionY]) - highestOcclussionVertexHeightOffset); 559 - int lowestOcclussionVertexHeight = (vertexHeights[lowestOcclussionPlane][x][lowestOcclussionY]); 560 - Scene.createCullingCluster(currentPlane, x * 128, x * 128, higestOcclussionY * 128 + 128, lowestOcclussionY * 128, highestOcclussionVertexHeight, lowestOcclussionVertexHeight, 561 - 1); 562 - for (int occludedPlane = lowestOcclussionPlane; occludedPlane <= higestOcclussionPlane; occludedPlane++) { 563 - for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) 564 - tileCullingBitsets[occludedPlane][x][occludedY] &= renderRule1 ^ 0xffffffff; 565 - } 566 - } 567 - } 568 - if ((tileCullingBitsets[plane][x][y] & renderRule2) != 0) { 569 - int i_127_ = x; 570 - int i_128_ = x; 571 - int i_129_ = plane; 572 - int i_130_ = plane; 573 - for (/**/; i_127_ > 0; i_127_--) { 574 - if (((tileCullingBitsets[plane][i_127_ - 1][y]) & renderRule2) == 0) 575 - break; 576 - } 577 - for (/**/; i_128_ < regionSizeX; i_128_++) { 578 - if (((tileCullingBitsets[plane][i_128_ + 1][y]) & renderRule2) == 0) 579 - break; 580 - } 581 - while_2_: for (/**/; i_129_ > 0; i_129_--) { 582 - for (int i_131_ = i_127_; i_131_ <= i_128_; i_131_++) { 583 - if (((tileCullingBitsets[i_129_ - 1][i_131_][y]) & renderRule2) == 0) 584 - break while_2_; 585 - } 586 - } 587 - while_3_: for (/**/; i_130_ < currentPlane; i_130_++) { 588 - for (int i_132_ = i_127_; i_132_ <= i_128_; i_132_++) { 589 - if (((tileCullingBitsets[i_130_ + 1][i_132_][y]) & renderRule2) == 0) 590 - break while_3_; 591 - } 592 - } 593 - int i_133_ = (i_130_ + 1 - i_129_) * (i_128_ - i_127_ + 1); 594 - if (i_133_ >= 8) { 595 - int i_134_ = 240; 596 - int i_135_ = ((vertexHeights[i_130_][i_127_][y]) - i_134_); 597 - int i_136_ = (vertexHeights[i_129_][i_127_][y]); 598 - Scene.createCullingCluster(currentPlane, i_128_ * 128 + 128, i_127_ * 128, y * 128, y * 128, i_135_, i_136_, 599 - 2); 600 - for (int i_137_ = i_129_; i_137_ <= i_130_; i_137_++) { 601 - for (int i_138_ = i_127_; i_138_ <= i_128_; i_138_++) 602 - tileCullingBitsets[i_137_][i_138_][y] &= renderRule2 ^ 0xffffffff; 603 - } 604 - } 605 - } 606 - if ((tileCullingBitsets[plane][x][y] & renderRule3) != 0) { 607 - int i_139_ = x; 608 - int i_140_ = x; 609 - int i_141_ = y; 610 - int i_142_ = y; 611 - for (/**/; i_141_ > 0; i_141_--) { 612 - if (((tileCullingBitsets[plane][x][i_141_ - 1]) & renderRule3) == 0) 613 - break; 614 - } 615 - for (/**/; i_142_ < regionSizeY; i_142_++) { 616 - if (((tileCullingBitsets[plane][x][i_142_ + 1]) & renderRule3) == 0) 617 - break; 618 - } 619 - while_4_: for (/**/; i_139_ > 0; i_139_--) { 620 - for (int i_143_ = i_141_; i_143_ <= i_142_; i_143_++) { 621 - if (((tileCullingBitsets[plane][i_139_ - 1][i_143_]) & renderRule3) == 0) 622 - break while_4_; 623 - } 624 - } 625 - while_5_: for (/**/; i_140_ < regionSizeX; i_140_++) { 626 - for (int i_144_ = i_141_; i_144_ <= i_142_; i_144_++) { 627 - if (((tileCullingBitsets[plane][i_140_ + 1][i_144_]) & renderRule3) == 0) 628 - break while_5_; 629 - } 630 - } 631 - if ((i_140_ - i_139_ + 1) * (i_142_ - i_141_ + 1) >= 4) { 632 - int i_145_ = (vertexHeights[plane][i_139_][i_141_]); 633 - Scene.createCullingCluster(currentPlane, i_140_ * 128 + 128, i_139_ * 128, i_142_ * 128 + 128, i_141_ * 128, i_145_, i_145_, 634 - 4); 635 - for (int i_146_ = i_139_; i_146_ <= i_140_; i_146_++) { 636 - for (int i_147_ = i_141_; i_147_ <= i_142_; i_147_++) 637 - tileCullingBitsets[plane][i_146_][i_147_] &= renderRule3 ^ 0xffffffff; 638 - } 639 - } 640 - } 641 - } 642 - } 643 - } 644 - } 645 - } 315 + public void createRegionScene(CollisionMap[] collisionMaps, Scene scene) { 316 + for (int plane = 0; plane < 4; plane++) { 317 + for (int x = 0; x < 104; x++) { 318 + for (int y = 0; y < 104; y++) { 319 + if ((renderRuleFlags[plane][x][y] & 0x1) == 1) { 320 + int originalPlane = plane; 321 + if ((renderRuleFlags[1][x][y] & 0x2) == 2) 322 + originalPlane--; 323 + if (originalPlane >= 0) 324 + collisionMaps[originalPlane].markBlocked(x, y); 325 + } 326 + } 327 + } 328 + } 329 + hueRandomizer += (int) (Math.random() * 5.0) - 2; 330 + if (hueRandomizer < -8) 331 + hueRandomizer = -8; 332 + if (hueRandomizer > 8) 333 + hueRandomizer = 8; 334 + lightnessRandomizer += (int) (Math.random() * 5.0) - 2; 335 + if (lightnessRandomizer < -16) 336 + lightnessRandomizer = -16; 337 + if (lightnessRandomizer > 16) 338 + lightnessRandomizer = 16; 339 + for (int plane = 0; plane < 4; plane++) { 340 + byte[][] shadowIntensity = tileShadowIntensity[plane]; 341 + int directionalLightInitialIntensity = 96; 342 + int specularDistributionFactor = 768; 343 + int directionalLightX = -50; 344 + int directionalLightY = -10; 345 + int directionalLightZ = -50; 346 + int directionalLightLength = (int) Math.sqrt((directionalLightX * directionalLightX + directionalLightY * directionalLightY + directionalLightZ * directionalLightZ)); 347 + int specularDistribution = specularDistributionFactor * directionalLightLength >> 8; 348 + for (int y = 1; y < regionSizeY - 1; y++) { 349 + for (int x = 1; x < regionSizeX - 1; x++) { 350 + int xHeightDifference = (vertexHeights[plane][x + 1][y] - vertexHeights[plane][x - 1][y]); 351 + int yHeightDifference = (vertexHeights[plane][x][y + 1] - vertexHeights[plane][x][y - 1]); 352 + int normalizedLength = (int) Math.sqrt((xHeightDifference * xHeightDifference + 65536 + yHeightDifference * yHeightDifference)); 353 + int normalizedNormalX = (xHeightDifference << 8) / normalizedLength; 354 + int normalizedNormalY = 65536 / normalizedLength; 355 + int normalizedNormalZ = (yHeightDifference << 8) / normalizedLength; 356 + int directionalLightIntensity = directionalLightInitialIntensity + (directionalLightX * normalizedNormalX + directionalLightY * normalizedNormalY + directionalLightZ * normalizedNormalZ) / specularDistribution; 357 + int weightedShadowIntensity = ((shadowIntensity[x - 1][y] >> 2) + (shadowIntensity[x + 1][y] >> 3) 358 + + (shadowIntensity[x][y - 1] >> 2) + (shadowIntensity[x][y + 1] >> 3) + (shadowIntensity[x][y] >> 1)); 359 + tileLightingIntensity[x][y] = directionalLightIntensity - weightedShadowIntensity; 360 + } 361 + } 362 + for (int y = 0; y < regionSizeY; y++) { 363 + blendedHue[y] = 0; 364 + blendedSaturation[y] = 0; 365 + blendedLightness[y] = 0; 366 + blendedHueDivisor[y] = 0; 367 + blendDirectionTracker[y] = 0; 368 + } 369 + for (int x = -5; x < regionSizeX + 5; x++) { 370 + for (int y = 0; y < regionSizeY; y++) { 371 + int xPositiveOffset = x + 5; 372 + if (xPositiveOffset >= 0 && xPositiveOffset < regionSizeX) { 373 + int floorId = underlayFloorIds[plane][xPositiveOffset][y] & 0xff; 374 + if (floorId > 0) { 375 + FloorDefinition floor = FloorDefinition.cache[floorId - 1]; 376 + blendedHue[y] += floor.hue; 377 + blendedSaturation[y] += floor.saturation; 378 + blendedLightness[y] += floor.lightness; 379 + blendedHueDivisor[y] += floor.hueDivisor; 380 + blendDirectionTracker[y]++; 381 + } 382 + } 383 + int xNegativeOffset = x - 5; 384 + if (xNegativeOffset >= 0 && xNegativeOffset < regionSizeX) { 385 + int floorId = underlayFloorIds[plane][xNegativeOffset][y] & 0xff; 386 + if (floorId > 0) { 387 + FloorDefinition floor = FloorDefinition.cache[floorId - 1]; 388 + blendedHue[y] -= floor.hue; 389 + blendedSaturation[y] -= floor.saturation; 390 + blendedLightness[y] -= floor.lightness; 391 + blendedHueDivisor[y] -= floor.hueDivisor; 392 + blendDirectionTracker[y]--; 393 + } 394 + } 395 + } 396 + if (x >= 1 && x < regionSizeX - 1) { 397 + int i_75_ = 0; 398 + int i_76_ = 0; 399 + int i_77_ = 0; 400 + int i_78_ = 0; 401 + int i_79_ = 0; 402 + for (int y = -5; y < regionSizeY + 5; y++) { 403 + int yPositiveOffset = y + 5; 404 + if (yPositiveOffset >= 0 && yPositiveOffset < regionSizeY) { 405 + i_75_ += blendedHue[yPositiveOffset]; 406 + i_76_ += blendedSaturation[yPositiveOffset]; 407 + i_77_ += blendedLightness[yPositiveOffset]; 408 + i_78_ += blendedHueDivisor[yPositiveOffset]; 409 + i_79_ += blendDirectionTracker[yPositiveOffset]; 410 + } 411 + int yNegativeOffset = y - 5; 412 + if (yNegativeOffset >= 0 && yNegativeOffset < regionSizeY) { 413 + i_75_ -= blendedHue[yNegativeOffset]; 414 + i_76_ -= blendedSaturation[yNegativeOffset]; 415 + i_77_ -= blendedLightness[yNegativeOffset]; 416 + i_78_ -= blendedHueDivisor[yNegativeOffset]; 417 + i_79_ -= blendDirectionTracker[yNegativeOffset]; 418 + } 419 + if (y >= 1 420 + && y < regionSizeY - 1 421 + && (!lowMemory || (renderRuleFlags[0][x][y] & 0x2) != 0 || ((renderRuleFlags[plane][x][y] & 0x10) == 0 && (getVisibilityPlaneFor( 422 + x, y, plane) == onBuildTimePlane)))) { 423 + if (plane < lowestPlane) 424 + lowestPlane = plane; 425 + int underlayFloorId = (underlayFloorIds[plane][x][y] & 0xff); 426 + int overlayFloorId = (overlayFloorIds[plane][x][y] & 0xff); 427 + if (underlayFloorId > 0 || overlayFloorId > 0) { 428 + int vertexSouthWest = vertexHeights[plane][x][y]; 429 + int vertexSouthEast = (vertexHeights[plane][x + 1][y]); 430 + int vertexNorthEast = (vertexHeights[plane][x + 1][y + 1]); 431 + int vertexNorthWest = (vertexHeights[plane][x][y + 1]); 432 + int lightSouthWest = tileLightingIntensity[x][y]; 433 + int lightSouthEast = tileLightingIntensity[x + 1][y]; 434 + int lightNorthEast = tileLightingIntensity[x + 1][y + 1]; 435 + int lightNorthWest = tileLightingIntensity[x][y + 1]; 436 + int hslBitsetUnmodified = -1; 437 + int hslBitsetRandomized = -1; 438 + if (underlayFloorId > 0) { 439 + int hue = i_75_ * 256 / i_78_; 440 + int saturation = i_76_ / i_79_; 441 + int lightness = i_77_ / i_79_; 442 + hslBitsetUnmodified = getHSLBitset(hue, saturation, lightness); 443 + hue = hue + hueRandomizer & 0xff; 444 + lightness += lightnessRandomizer; 445 + if (lightness < 0) 446 + lightness = 0; 447 + else if (lightness > 255) 448 + lightness = 255; 449 + hslBitsetRandomized = getHSLBitset(hue, saturation, lightness); 450 + } 451 + if (plane > 0) { 452 + boolean bool = true; 453 + if (underlayFloorId == 0 && (overlayClippingPaths[plane][x][y]) != 0) 454 + bool = false; 455 + if (overlayFloorId > 0 && !(FloorDefinition.cache[overlayFloorId - 1].occlude)) 456 + bool = false; 457 + if (bool && vertexSouthWest == vertexSouthEast && vertexSouthWest == vertexNorthEast && vertexSouthWest == vertexNorthWest) 458 + tileCullingBitsets[plane][x][y] |= 0x924; 459 + } 460 + int rgbBitsetRandomized = 0; 461 + if (hslBitsetUnmodified != -1) 462 + rgbBitsetRandomized = (Rasterizer3D.getRgbLookupTableId[trimHSLLightness(hslBitsetRandomized, 96)]); 463 + if (overlayFloorId == 0) 464 + scene.renderTile(plane, x, y, 0, 0, -1, vertexSouthWest, vertexSouthEast, vertexNorthEast, vertexNorthWest, 465 + trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthEast), 466 + trimHSLLightness(hslBitsetUnmodified, lightNorthWest), 0, 0, 0, 0, rgbBitsetRandomized, 0); 467 + else { 468 + int clippingPath = ((overlayClippingPaths[plane][x][y]) + 1); 469 + byte clippingPathRotation = (overlayRotations[plane][x][y]); 470 + FloorDefinition floor = FloorDefinition.cache[overlayFloorId - 1]; 471 + int textureid = floor.textureId; 472 + int hslBitset; 473 + int rgbBitset; 474 + if (textureid >= 0) { 475 + rgbBitset = Rasterizer3D.getAverageRgbColorForTexture(textureid, 0); 476 + hslBitset = -1; 477 + } else if (floor.rgbColor == 16711935) { 478 + hslBitset = -2; 479 + textureid = -1; 480 + rgbBitset = (Rasterizer3D.getRgbLookupTableId[mixLightnessSigned(floor.hslColor2, 96)]); 481 + } else { 482 + hslBitset = getHSLBitset(floor.hue2, floor.saturation, floor.lightness); 483 + rgbBitset = (Rasterizer3D.getRgbLookupTableId[mixLightnessSigned(floor.hslColor2, 96)]); 484 + } 485 + scene.renderTile(plane, x, y, clippingPath, clippingPathRotation, textureid, vertexSouthWest, vertexSouthEast, vertexNorthEast, 486 + vertexNorthWest, trimHSLLightness(hslBitsetUnmodified, lightSouthWest), trimHSLLightness(hslBitsetUnmodified, lightSouthEast), trimHSLLightness(hslBitsetUnmodified, 487 + lightNorthEast), trimHSLLightness(hslBitsetUnmodified, lightNorthWest), mixLightnessSigned(hslBitset, lightSouthWest), 488 + mixLightnessSigned(hslBitset, lightSouthEast), mixLightnessSigned(hslBitset, lightNorthEast), 489 + mixLightnessSigned(hslBitset, lightNorthWest), rgbBitsetRandomized, rgbBitset); 490 + } 491 + } 492 + } 493 + } 494 + } 495 + } 496 + for (int i_104_ = 1; i_104_ < regionSizeY - 1; i_104_++) { 497 + for (int i_105_ = 1; i_105_ < regionSizeX - 1; i_105_++) 498 + scene.setTileLogicHeight(plane, i_105_, i_104_, getVisibilityPlaneFor(i_105_, i_104_, plane)); 499 + } 500 + } 501 + scene.shadeModels(-10, -50, -50); 502 + for (int y = 0; y < regionSizeX; y++) { 503 + for (int x = 0; x < regionSizeY; x++) { 504 + if ((renderRuleFlags[1][y][x] & 0x2) == 2) 505 + scene.setBridgeMode(y, x); 506 + } 507 + } 508 + int renderRule1 = 1; 509 + int renderRule2 = 2; 510 + int renderRule3 = 4; 511 + for (int currentPlane = 0; currentPlane < 4; currentPlane++) { 512 + if (currentPlane > 0) { 513 + renderRule1 <<= 3; 514 + renderRule2 <<= 3; 515 + renderRule3 <<= 3; 516 + } 517 + for (int plane = 0; plane <= currentPlane; plane++) { 518 + for (int y = 0; y <= regionSizeY; y++) { 519 + for (int x = 0; x <= regionSizeX; x++) { 520 + if ((tileCullingBitsets[plane][x][y] & renderRule1) != 0) { 521 + int lowestOcclussionY = y; 522 + int higestOcclussionY = y; 523 + int lowestOcclussionPlane = plane; 524 + int higestOcclussionPlane = plane; 525 + for (/**/; lowestOcclussionY > 0; lowestOcclussionY--) { 526 + if (((tileCullingBitsets[plane][x][lowestOcclussionY - 1]) & renderRule1) == 0) 527 + break; 528 + } 529 + for (/**/; higestOcclussionY < regionSizeY; higestOcclussionY++) { 530 + if (((tileCullingBitsets[plane][x][higestOcclussionY + 1]) & renderRule1) == 0) 531 + break; 532 + } 533 + while_0_: 534 + for (/**/; lowestOcclussionPlane > 0; lowestOcclussionPlane--) { 535 + for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) { 536 + if (((tileCullingBitsets[lowestOcclussionPlane - 1][x][occludedY]) & renderRule1) == 0) 537 + break while_0_; 538 + } 539 + } 540 + while_1_: 541 + for (/**/; higestOcclussionPlane < currentPlane; higestOcclussionPlane++) { 542 + for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) { 543 + if (((tileCullingBitsets[higestOcclussionPlane + 1][x][occludedY]) & renderRule1) == 0) 544 + break while_1_; 545 + } 546 + } 547 + int occlussionSurface = (higestOcclussionPlane + 1 - lowestOcclussionPlane) * (higestOcclussionY - lowestOcclussionY + 1); 548 + if (occlussionSurface >= 8) { 549 + int highestOcclussionVertexHeightOffset = 240; 550 + int highestOcclussionVertexHeight = ((vertexHeights[higestOcclussionPlane][x][lowestOcclussionY]) - highestOcclussionVertexHeightOffset); 551 + int lowestOcclussionVertexHeight = (vertexHeights[lowestOcclussionPlane][x][lowestOcclussionY]); 552 + Scene.createCullingCluster(currentPlane, x * 128, x * 128, higestOcclussionY * 128 + 128, lowestOcclussionY * 128, highestOcclussionVertexHeight, lowestOcclussionVertexHeight, 553 + 1); 554 + for (int occludedPlane = lowestOcclussionPlane; occludedPlane <= higestOcclussionPlane; occludedPlane++) { 555 + for (int occludedY = lowestOcclussionY; occludedY <= higestOcclussionY; occludedY++) 556 + tileCullingBitsets[occludedPlane][x][occludedY] &= renderRule1 ^ 0xffffffff; 557 + } 558 + } 559 + } 560 + if ((tileCullingBitsets[plane][x][y] & renderRule2) != 0) { 561 + int i_127_ = x; 562 + int i_128_ = x; 563 + int i_129_ = plane; 564 + int i_130_ = plane; 565 + for (/**/; i_127_ > 0; i_127_--) { 566 + if (((tileCullingBitsets[plane][i_127_ - 1][y]) & renderRule2) == 0) 567 + break; 568 + } 569 + for (/**/; i_128_ < regionSizeX; i_128_++) { 570 + if (((tileCullingBitsets[plane][i_128_ + 1][y]) & renderRule2) == 0) 571 + break; 572 + } 573 + while_2_: 574 + for (/**/; i_129_ > 0; i_129_--) { 575 + for (int i_131_ = i_127_; i_131_ <= i_128_; i_131_++) { 576 + if (((tileCullingBitsets[i_129_ - 1][i_131_][y]) & renderRule2) == 0) 577 + break while_2_; 578 + } 579 + } 580 + while_3_: 581 + for (/**/; i_130_ < currentPlane; i_130_++) { 582 + for (int i_132_ = i_127_; i_132_ <= i_128_; i_132_++) { 583 + if (((tileCullingBitsets[i_130_ + 1][i_132_][y]) & renderRule2) == 0) 584 + break while_3_; 585 + } 586 + } 587 + int i_133_ = (i_130_ + 1 - i_129_) * (i_128_ - i_127_ + 1); 588 + if (i_133_ >= 8) { 589 + int i_134_ = 240; 590 + int i_135_ = ((vertexHeights[i_130_][i_127_][y]) - i_134_); 591 + int i_136_ = (vertexHeights[i_129_][i_127_][y]); 592 + Scene.createCullingCluster(currentPlane, i_128_ * 128 + 128, i_127_ * 128, y * 128, y * 128, i_135_, i_136_, 593 + 2); 594 + for (int i_137_ = i_129_; i_137_ <= i_130_; i_137_++) { 595 + for (int i_138_ = i_127_; i_138_ <= i_128_; i_138_++) 596 + tileCullingBitsets[i_137_][i_138_][y] &= renderRule2 ^ 0xffffffff; 597 + } 598 + } 599 + } 600 + if ((tileCullingBitsets[plane][x][y] & renderRule3) != 0) { 601 + int i_139_ = x; 602 + int i_140_ = x; 603 + int i_141_ = y; 604 + int i_142_ = y; 605 + for (/**/; i_141_ > 0; i_141_--) { 606 + if (((tileCullingBitsets[plane][x][i_141_ - 1]) & renderRule3) == 0) 607 + break; 608 + } 609 + for (/**/; i_142_ < regionSizeY; i_142_++) { 610 + if (((tileCullingBitsets[plane][x][i_142_ + 1]) & renderRule3) == 0) 611 + break; 612 + } 613 + while_4_: 614 + for (/**/; i_139_ > 0; i_139_--) { 615 + for (int i_143_ = i_141_; i_143_ <= i_142_; i_143_++) { 616 + if (((tileCullingBitsets[plane][i_139_ - 1][i_143_]) & renderRule3) == 0) 617 + break while_4_; 618 + } 619 + } 620 + while_5_: 621 + for (/**/; i_140_ < regionSizeX; i_140_++) { 622 + for (int i_144_ = i_141_; i_144_ <= i_142_; i_144_++) { 623 + if (((tileCullingBitsets[plane][i_140_ + 1][i_144_]) & renderRule3) == 0) 624 + break while_5_; 625 + } 626 + } 627 + if ((i_140_ - i_139_ + 1) * (i_142_ - i_141_ + 1) >= 4) { 628 + int i_145_ = (vertexHeights[plane][i_139_][i_141_]); 629 + Scene.createCullingCluster(currentPlane, i_140_ * 128 + 128, i_139_ * 128, i_142_ * 128 + 128, i_141_ * 128, i_145_, i_145_, 630 + 4); 631 + for (int i_146_ = i_139_; i_146_ <= i_140_; i_146_++) { 632 + for (int i_147_ = i_141_; i_147_ <= i_142_; i_147_++) 633 + tileCullingBitsets[plane][i_146_][i_147_] &= renderRule3 ^ 0xffffffff; 634 + } 635 + } 636 + } 637 + } 638 + } 639 + } 640 + } 641 + } 646 642 647 - public void method168(int i, int i_148_, boolean bool, byte[] is, int i_149_, int i_150_, int i_151_, 643 + public void method168(int i, int i_148_, boolean bool, byte[] is, int i_149_, int i_150_, int i_151_, 648 644 CollisionMap[] class46s, int i_152_, int i_153_) { 649 - if (bool) 650 - anInt166 = 476; 651 - for (int i_154_ = 0; i_154_ < 8; i_154_++) { 652 - for (int i_155_ = 0; i_155_ < 8; i_155_++) { 653 - if (i_151_ + i_154_ > 0 && i_151_ + i_154_ < 103 && i_152_ + i_155_ > 0 && i_152_ + i_155_ < 103) 654 - class46s[i_149_].adjacency[i_151_ + i_154_][(i_152_ + i_155_)] &= ~0x1000000; 655 - } 656 - } 657 - Buffer class50_sub1_sub2 = new Buffer(is); 658 - for (int i_156_ = 0; i_156_ < 4; i_156_++) { 659 - for (int i_157_ = 0; i_157_ < 64; i_157_++) { 660 - for (int i_158_ = 0; i_158_ < 64; i_158_++) { 661 - if (i_156_ == i_150_ && i_157_ >= i_153_ && i_157_ < i_153_ + 8 && i_158_ >= i_148_ 662 - && i_158_ < i_148_ + 8) 663 - method183(0, (byte) -61, 0, class50_sub1_sub2, i, i_151_ 664 - + TiledUtils.getRotatedMapChunkX(i_157_ & 0x7, i_158_ & 0x7, i), i_149_, i_152_ 665 - + TiledUtils.getRotatedMapChunkY(i_157_ & 0x7, i_158_ & 0x7, i)); 666 - else 667 - method183(0, (byte) -61, 0, class50_sub1_sub2, 0, -1, 0, -1); 668 - } 669 - } 670 - } 671 - } 645 + if (bool) 646 + anInt166 = 476; 647 + for (int i_154_ = 0; i_154_ < 8; i_154_++) { 648 + for (int i_155_ = 0; i_155_ < 8; i_155_++) { 649 + if (i_151_ + i_154_ > 0 && i_151_ + i_154_ < 103 && i_152_ + i_155_ > 0 && i_152_ + i_155_ < 103) 650 + class46s[i_149_].clippingData[i_151_ + i_154_][(i_152_ + i_155_)] &= ~0x1000000; 651 + } 652 + } 653 + Buffer class50_sub1_sub2 = new Buffer(is); 654 + for (int i_156_ = 0; i_156_ < 4; i_156_++) { 655 + for (int i_157_ = 0; i_157_ < 64; i_157_++) { 656 + for (int i_158_ = 0; i_158_ < 64; i_158_++) { 657 + if (i_156_ == i_150_ && i_157_ >= i_153_ && i_157_ < i_153_ + 8 && i_158_ >= i_148_ 658 + && i_158_ < i_148_ + 8) 659 + loadTerrainTile(i_151_ 660 + + TiledUtils.getRotatedMapChunkX(i_157_ & 0x7, i_158_ & 0x7, i), 0, i_152_ 661 + + TiledUtils.getRotatedMapChunkY(i_157_ & 0x7, i_158_ & 0x7, i), 0, i_149_, class50_sub1_sub2, i); 662 + else 663 + loadTerrainTile(-1, 0, -1, 0, 0, class50_sub1_sub2, 0); 664 + } 665 + } 666 + } 667 + } 672 668 673 - public static void passiveRequestGameObjectModels(OnDemandRequester onDemandRequester, Buffer buffer) { 669 + public static void passiveRequestGameObjectModels(OnDemandRequester onDemandRequester, Buffer buffer) { 674 670 675 - int gameObjectId = -1; 676 - while (true) { 677 - int gameObjectIdOffset = buffer.getSmart(); 678 - if (gameObjectIdOffset == 0) 679 - break; 680 - gameObjectId += gameObjectIdOffset; 681 - GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(gameObjectId); 682 - gameObjectDefinition.passiveRequestModels(onDemandRequester); 683 - while (true) { 684 - int terminate = buffer.getSmart(); 685 - if (terminate == 0) 686 - break; 687 - buffer.getUnsignedByte(); 688 - } 671 + int gameObjectId = -1; 672 + while (true) { 673 + int gameObjectIdOffset = buffer.getSmart(); 674 + if (gameObjectIdOffset == 0) 675 + break; 676 + gameObjectId += gameObjectIdOffset; 677 + GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(gameObjectId); 678 + gameObjectDefinition.passiveRequestModels(onDemandRequester); 679 + while (true) { 680 + int terminate = buffer.getSmart(); 681 + if (terminate == 0) 682 + break; 683 + buffer.getUnsignedByte(); 684 + } 689 685 690 - } 691 - } 686 + } 687 + } 692 688 693 - public static boolean method170(int i, byte i_162_, int i_163_) { 694 - GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(i_163_); 695 - if (i_162_ != aByte154) { 696 - for (int i_164_ = 1; i_164_ > 0; i_164_++) { 697 - /* empty */ 698 - } 699 - } 700 - if (i == 11) 701 - i = 10; 702 - if (i >= 5 && i <= 8) 703 - i = 4; 704 - return gameObjectDefinition.method432(26261, i); 705 - } 689 + public static boolean method170(int i, int i_163_) { 690 + GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(i_163_); 691 + if (i == 11) 692 + i = 10; 693 + if (i >= 5 && i <= 8) 694 + i = 4; 695 + return gameObjectDefinition.method432(26261, i); 696 + } 706 697 707 - public static int trimHSLLightness(int i, int i_165_) { 708 - if (i == -1) 709 - return 12345678; 710 - i_165_ = i_165_ * (i & 0x7f) / 128; 711 - if (i_165_ < 2) 712 - i_165_ = 2; 713 - else if (i_165_ > 126) 714 - i_165_ = 126; 715 - return (i & 0xff80) + i_165_; 716 - } 698 + public static int trimHSLLightness(int i, int i_165_) { 699 + if (i == -1) 700 + return 12345678; 701 + i_165_ = i_165_ * (i & 0x7f) / 128; 702 + if (i_165_ < 2) 703 + i_165_ = 2; 704 + else if (i_165_ > 126) 705 + i_165_ = 126; 706 + return (i & 0xff80) + i_165_; 707 + } 717 708 718 - public void method172(int i, CollisionMap[] class46s, Scene class22, boolean bool, byte[] is, int i_166_, int i_167_, 719 - int i_168_, int i_169_, int i_170_, int i_171_) { 720 - Buffer class50_sub1_sub2 = new Buffer(is); 721 - if (!bool) { 722 - int i_172_ = -1; 723 - for (;;) { 724 - int i_173_ = class50_sub1_sub2.getSmart(); 725 - if (i_173_ == 0) 726 - break; 727 - i_172_ += i_173_; 728 - int i_174_ = 0; 729 - for (;;) { 730 - int i_175_ = class50_sub1_sub2.getSmart(); 731 - if (i_175_ == 0) 732 - break; 733 - i_174_ += i_175_ - 1; 734 - int i_176_ = i_174_ & 0x3f; 735 - int i_177_ = i_174_ >> 6 & 0x3f; 736 - int i_178_ = i_174_ >> 12; 737 - int i_179_ = class50_sub1_sub2.getUnsignedByte(); 738 - int i_180_ = i_179_ >> 2; 739 - int i_181_ = i_179_ & 0x3; 740 - if (i_178_ == i_171_ && i_177_ >= i_168_ && i_177_ < i_168_ + 8 && i_176_ >= i_170_ 741 - && i_176_ < i_170_ + 8) { 742 - GameObjectDefinition class47 = GameObjectDefinition.getDefinition(i_172_); 743 - int i_182_ = (i_169_ + TiledUtils.getRotatedLandscapeChunkX(i_167_, class47.sizeY, i_177_ & 0x7, 744 - i_176_ & 0x7, class47.sizeX)); 745 - int i_183_ = (i_166_ + TiledUtils.getRotatedLandscapeChunkY(i_176_ & 0x7, class47.sizeY, i_167_, class47.sizeX, i_177_ & 0x7 746 - )); 747 - if (i_182_ > 0 && i_183_ > 0 && i_182_ < 103 && i_183_ < 103) { 748 - int i_184_ = i; 749 - if ((renderRuleFlags[1][i_182_][i_183_] & 0x2) == 2) 750 - i_184_--; 751 - CollisionMap class46 = null; 752 - if (i_184_ >= 0) 753 - class46 = class46s[i_184_]; 754 - renderObject(class22, class46, i_183_, i, i_182_, aByte139, i_181_ + i_167_ & 0x3, i_180_, 755 - i_172_); 756 - } 757 - } 758 - } 759 - } 760 - } 761 - } 709 + public void method172(int i, CollisionMap[] class46s, Scene class22, boolean bool, byte[] is, int i_166_, int i_167_, 710 + int i_168_, int i_169_, int i_170_, int i_171_) { 711 + Buffer class50_sub1_sub2 = new Buffer(is); 712 + if (!bool) { 713 + int i_172_ = -1; 714 + for (; ; ) { 715 + int i_173_ = class50_sub1_sub2.getSmart(); 716 + if (i_173_ == 0) 717 + break; 718 + i_172_ += i_173_; 719 + int i_174_ = 0; 720 + for (; ; ) { 721 + int i_175_ = class50_sub1_sub2.getSmart(); 722 + if (i_175_ == 0) 723 + break; 724 + i_174_ += i_175_ - 1; 725 + int i_176_ = i_174_ & 0x3f; 726 + int i_177_ = i_174_ >> 6 & 0x3f; 727 + int i_178_ = i_174_ >> 12; 728 + int i_179_ = class50_sub1_sub2.getUnsignedByte(); 729 + int i_180_ = i_179_ >> 2; 730 + int i_181_ = i_179_ & 0x3; 731 + if (i_178_ == i_171_ && i_177_ >= i_168_ && i_177_ < i_168_ + 8 && i_176_ >= i_170_ 732 + && i_176_ < i_170_ + 8) { 733 + GameObjectDefinition class47 = GameObjectDefinition.getDefinition(i_172_); 734 + int i_182_ = (i_169_ + TiledUtils.getRotatedLandscapeChunkX(i_167_, class47.sizeY, i_177_ & 0x7, 735 + i_176_ & 0x7, class47.sizeX)); 736 + int i_183_ = (i_166_ + TiledUtils.getRotatedLandscapeChunkY(i_176_ & 0x7, class47.sizeY, i_167_, class47.sizeX, i_177_ & 0x7 737 + )); 738 + if (i_182_ > 0 && i_183_ > 0 && i_182_ < 103 && i_183_ < 103) { 739 + int i_184_ = i; 740 + if ((renderRuleFlags[1][i_182_][i_183_] & 0x2) == 2) 741 + i_184_--; 742 + CollisionMap class46 = null; 743 + if (i_184_ >= 0) 744 + class46 = class46s[i_184_]; 745 + renderObject(class22, class46, i_183_, i, i_182_, i_181_ + i_167_ & 0x3, i_180_, 746 + i_172_); 747 + } 748 + } 749 + } 750 + } 751 + } 752 + } 762 753 763 - public void renderObject(Scene scene, CollisionMap collisionMap, int y, int plane, int x, byte i_187_, int face, 764 - int type, int objectId) { 765 - if (!lowMemory 766 - || (renderRuleFlags[0][x][y] & 0x2) != 0 767 - || ((renderRuleFlags[plane][x][y] & 0x10) == 0 && getVisibilityPlaneFor(y, plane, x, (byte) 0) == onBuildTimePlane)) { 768 - if (plane < lowestPlane) 769 - lowestPlane = plane; 770 - int vertexHeight = vertexHeights[plane][x][y]; 771 - int vertexHeightRight = vertexHeights[plane][x + 1][y]; 772 - int vertexHeightTopRight = vertexHeights[plane][x + 1][y + 1]; 773 - int vertexHeightTop = vertexHeights[plane][x][y + 1]; 774 - int vertexMix = vertexHeight + vertexHeightRight + vertexHeightTopRight + vertexHeightTop >> 2; 775 - GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(objectId); 776 - int hash = x + (y << 7) + (objectId << 14) + 1073741824; 777 - if (!gameObjectDefinition.actionsBoolean) 778 - hash += -2147483648; 779 - byte objectConfig = (byte) ((face << 6) + type); 780 - if (type == 22) { 781 - if (!lowMemory || gameObjectDefinition.actionsBoolean || gameObjectDefinition.unknown) { 782 - Renderable renderable; 783 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 784 - renderable = gameObjectDefinition.getGameObjectModel(22, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 785 - else 786 - renderable = new GameObject(objectId, face, 22, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 754 + public void renderObject(Scene scene, CollisionMap collisionMap, int y, int plane, int x, int face, 755 + int type, int objectId) { 756 + if (!lowMemory 757 + || (renderRuleFlags[0][x][y] & 0x2) != 0 758 + || ((renderRuleFlags[plane][x][y] & 0x10) == 0 && getVisibilityPlaneFor(x, y, plane) == onBuildTimePlane)) { 759 + if (plane < lowestPlane) 760 + lowestPlane = plane; 761 + int vertexHeight = vertexHeights[plane][x][y]; 762 + int vertexHeightRight = vertexHeights[plane][x + 1][y]; 763 + int vertexHeightTopRight = vertexHeights[plane][x + 1][y + 1]; 764 + int vertexHeightTop = vertexHeights[plane][x][y + 1]; 765 + int vertexMix = vertexHeight + vertexHeightRight + vertexHeightTopRight + vertexHeightTop >> 2; 766 + GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(objectId); 767 + int hash = x + (y << 7) + (objectId << 14) + 1073741824; 768 + if (!gameObjectDefinition.hasActions) 769 + hash += -2147483648; 770 + byte objectConfig = (byte) ((face << 6) + type); 771 + if (type == 22) { 772 + if (!lowMemory || gameObjectDefinition.hasActions || gameObjectDefinition.unknown) { 773 + Renderable renderable; 774 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 775 + renderable = gameObjectDefinition.getGameObjectModel(22, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 776 + else 777 + renderable = new GameObject(objectId, face, 22, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 787 778 true); 788 - scene.addGroundDecoration(x, y, plane, vertexMix, hash, renderable, objectConfig); 789 - if (gameObjectDefinition.solid && gameObjectDefinition.actionsBoolean && collisionMap != null) 790 - collisionMap.markBlocked(x, y); 791 - } 792 - } else if (type == 10 || type == 11) { 793 - Renderable renderable; 794 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 795 - renderable = gameObjectDefinition.getGameObjectModel(10, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 796 - else 797 - renderable = new GameObject(objectId, face, 10, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 779 + scene.addGroundDecoration(x, y, plane, vertexMix, hash, renderable, objectConfig); 780 + if (gameObjectDefinition.solid && gameObjectDefinition.hasActions && collisionMap != null) 781 + collisionMap.markBlocked(x, y); 782 + } 783 + } else if (type == 10 || type == 11) { 784 + Renderable renderable; 785 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 786 + renderable = gameObjectDefinition.getGameObjectModel(10, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 787 + else 788 + renderable = new GameObject(objectId, face, 10, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 798 789 true); 799 - if (renderable != null) { 800 - int i_198_ = 0; 801 - if (type == 11) 802 - i_198_ += 256; 803 - int sizeX; 804 - int sizeY; 805 - if (face == 1 || face == 3) { 806 - sizeX = gameObjectDefinition.sizeY; 807 - sizeY = gameObjectDefinition.sizeX; 808 - } else { 809 - sizeX = gameObjectDefinition.sizeX; 810 - sizeY = gameObjectDefinition.sizeY; 811 - } 812 - if (scene.addEntityB(x, y, plane, vertexMix, i_198_, sizeY, sizeX, hash, renderable, objectConfig 813 - ) 814 - && gameObjectDefinition.unknown2) { 815 - Model model; 816 - if (renderable instanceof Model) 817 - model = (Model) renderable; 818 - else 819 - model = gameObjectDefinition.getGameObjectModel(10, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 820 - if (model != null) { 821 - for (int sizeXCounter = 0; sizeXCounter <= sizeX; sizeXCounter++) { 822 - for (int sizeYCounter = 0; sizeYCounter <= sizeY; sizeYCounter++) { 823 - int shadowIntensity = model.diagonal2DAboveOrigin / 4; 824 - if (shadowIntensity > 30) 825 - shadowIntensity = 30; 826 - if (shadowIntensity > (tileShadowIntensity[plane][x + sizeXCounter][y + sizeYCounter])) 827 - tileShadowIntensity[plane][x + sizeXCounter][y + sizeYCounter] = (byte) shadowIntensity; 828 - } 829 - } 830 - } 831 - } 832 - } 833 - if (gameObjectDefinition.solid && collisionMap != null) 834 - collisionMap.method413(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 835 - (byte) 52); 836 - } else if (type >= 12) { 837 - Renderable renderable; 838 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 839 - renderable = gameObjectDefinition.getGameObjectModel(type, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 840 - else 841 - renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 790 + if (renderable != null) { 791 + int i_198_ = 0; 792 + if (type == 11) 793 + i_198_ += 256; 794 + int sizeX; 795 + int sizeY; 796 + if (face == 1 || face == 3) { 797 + sizeX = gameObjectDefinition.sizeY; 798 + sizeY = gameObjectDefinition.sizeX; 799 + } else { 800 + sizeX = gameObjectDefinition.sizeX; 801 + sizeY = gameObjectDefinition.sizeY; 802 + } 803 + if (scene.addEntityB(x, y, plane, vertexMix, i_198_, sizeY, sizeX, hash, renderable, objectConfig 804 + ) 805 + && gameObjectDefinition.castsShadow) { 806 + Model model; 807 + if (renderable instanceof Model) 808 + model = (Model) renderable; 809 + else 810 + model = gameObjectDefinition.getGameObjectModel(10, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 811 + if (model != null) { 812 + for (int sizeXCounter = 0; sizeXCounter <= sizeX; sizeXCounter++) { 813 + for (int sizeYCounter = 0; sizeYCounter <= sizeY; sizeYCounter++) { 814 + int shadowIntensity = model.diagonal2DAboveOrigin / 4; 815 + if (shadowIntensity > 30) 816 + shadowIntensity = 30; 817 + if (shadowIntensity > (tileShadowIntensity[plane][x + sizeXCounter][y + sizeYCounter])) 818 + tileShadowIntensity[plane][x + sizeXCounter][y + sizeYCounter] = (byte) shadowIntensity; 819 + } 820 + } 821 + } 822 + } 823 + } 824 + if (gameObjectDefinition.solid && collisionMap != null) 825 + collisionMap.markSolidOccupant(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 826 + (byte) 52); 827 + } else if (type >= 12) { 828 + Renderable renderable; 829 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 830 + renderable = gameObjectDefinition.getGameObjectModel(type, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 831 + else 832 + renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 842 833 true); 843 - scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 844 - if (type >= 12 && type <= 17 && type != 13 && plane > 0) 845 - tileCullingBitsets[plane][x][y] |= 0x924; 846 - if (gameObjectDefinition.solid && collisionMap != null) 847 - collisionMap.method413(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 848 - (byte) 52); 849 - } else if (type == 0) { 850 - Renderable renderable; 851 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 852 - renderable = gameObjectDefinition.getGameObjectModel(0, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 853 - else 854 - renderable = new GameObject(objectId, face, 0, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 834 + scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 835 + if (type >= 12 && type <= 17 && type != 13 && plane > 0) 836 + tileCullingBitsets[plane][x][y] |= 0x924; 837 + if (gameObjectDefinition.solid && collisionMap != null) 838 + collisionMap.markSolidOccupant(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 839 + (byte) 52); 840 + } else if (type == 0) { 841 + Renderable renderable; 842 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 843 + renderable = gameObjectDefinition.getGameObjectModel(0, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 844 + else 845 + renderable = new GameObject(objectId, face, 0, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 855 846 true); 856 - scene.addWall(x, y, plane, vertexMix, anIntArray158[face], 0, hash, renderable, null, objectConfig 857 - ); 858 - if (face == 0) { 859 - if (gameObjectDefinition.unknown2) { 860 - tileShadowIntensity[plane][x][y] = (byte) 50; 861 - tileShadowIntensity[plane][x][y + 1] = (byte) 50; 862 - } 863 - if (gameObjectDefinition.aBoolean797) 864 - tileCullingBitsets[plane][x][y] |= 0x249; 865 - } else if (face == 1) { 866 - if (gameObjectDefinition.unknown2) { 867 - tileShadowIntensity[plane][x][y + 1] = (byte) 50; 868 - tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 869 - } 870 - if (gameObjectDefinition.aBoolean797) 871 - tileCullingBitsets[plane][x][y + 1] |= 0x492; 872 - } else if (face == 2) { 873 - if (gameObjectDefinition.unknown2) { 874 - tileShadowIntensity[plane][x + 1][y] = (byte) 50; 875 - tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 876 - } 877 - if (gameObjectDefinition.aBoolean797) 878 - tileCullingBitsets[plane][x + 1][y] |= 0x249; 879 - } else if (face == 3) { 880 - if (gameObjectDefinition.unknown2) { 881 - tileShadowIntensity[plane][x][y] = (byte) 50; 882 - tileShadowIntensity[plane][x + 1][y] = (byte) 50; 883 - } 884 - if (gameObjectDefinition.aBoolean797) 885 - tileCullingBitsets[plane][x][y] |= 0x492; 886 - } 887 - if (gameObjectDefinition.solid && collisionMap != null) 888 - collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 889 - if (gameObjectDefinition.unknown4 != 16) 890 - scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.unknown4); 891 - } else if (type == 1) { 892 - Renderable renderable; 893 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 894 - renderable = gameObjectDefinition.getGameObjectModel(1, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 895 - else 896 - renderable = new GameObject(objectId, face, 1, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 847 + scene.addWall(x, y, plane, vertexMix, POWERS_OF_TWO[face], 0, hash, renderable, null, objectConfig 848 + ); 849 + if (face == 0) { 850 + if (gameObjectDefinition.castsShadow) { 851 + tileShadowIntensity[plane][x][y] = (byte) 50; 852 + tileShadowIntensity[plane][x][y + 1] = (byte) 50; 853 + } 854 + if (gameObjectDefinition.wall) 855 + tileCullingBitsets[plane][x][y] |= 0x249; 856 + } else if (face == 1) { 857 + if (gameObjectDefinition.castsShadow) { 858 + tileShadowIntensity[plane][x][y + 1] = (byte) 50; 859 + tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 860 + } 861 + if (gameObjectDefinition.wall) 862 + tileCullingBitsets[plane][x][y + 1] |= 0x492; 863 + } else if (face == 2) { 864 + if (gameObjectDefinition.castsShadow) { 865 + tileShadowIntensity[plane][x + 1][y] = (byte) 50; 866 + tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 867 + } 868 + if (gameObjectDefinition.wall) 869 + tileCullingBitsets[plane][x + 1][y] |= 0x249; 870 + } else if (face == 3) { 871 + if (gameObjectDefinition.castsShadow) { 872 + tileShadowIntensity[plane][x][y] = (byte) 50; 873 + tileShadowIntensity[plane][x + 1][y] = (byte) 50; 874 + } 875 + if (gameObjectDefinition.wall) 876 + tileCullingBitsets[plane][x][y] |= 0x492; 877 + } 878 + if (gameObjectDefinition.solid && collisionMap != null) 879 + collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 880 + if (gameObjectDefinition.offsetAmplifier != 16) 881 + scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.offsetAmplifier); 882 + } else if (type == 1) { 883 + Renderable renderable; 884 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 885 + renderable = gameObjectDefinition.getGameObjectModel(1, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 886 + else 887 + renderable = new GameObject(objectId, face, 1, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 897 888 true); 898 - scene.addWall(x, y, plane, vertexMix, anIntArray167[face], 0, hash, renderable, null, objectConfig 899 - ); 900 - if (gameObjectDefinition.unknown2) { 901 - if (face == 0) 902 - tileShadowIntensity[plane][x][y + 1] = (byte) 50; 903 - else if (face == 1) 904 - tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 905 - else if (face == 2) 906 - tileShadowIntensity[plane][x + 1][y] = (byte) 50; 907 - else if (face == 3) 908 - tileShadowIntensity[plane][x][y] = (byte) 50; 909 - } 910 - if (gameObjectDefinition.solid && collisionMap != null) 911 - collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 912 - } else if (type == 2) { 913 - int i_204_ = face + 1 & 0x3; 914 - Renderable renderable; 915 - Renderable renderable1; 916 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) { 917 - renderable = gameObjectDefinition.getGameObjectModel(2, 4 + face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 918 - renderable1 = gameObjectDefinition.getGameObjectModel(2, i_204_, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 919 - } else { 920 - renderable = new GameObject(objectId, 4 + face, 2, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 889 + scene.addWall(x, y, plane, vertexMix, WALL_CORNER_ORIENTATION[face], 0, hash, renderable, null, objectConfig 890 + ); 891 + if (gameObjectDefinition.castsShadow) { 892 + if (face == 0) 893 + tileShadowIntensity[plane][x][y + 1] = (byte) 50; 894 + else if (face == 1) 895 + tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 896 + else if (face == 2) 897 + tileShadowIntensity[plane][x + 1][y] = (byte) 50; 898 + else if (face == 3) 899 + tileShadowIntensity[plane][x][y] = (byte) 50; 900 + } 901 + if (gameObjectDefinition.solid && collisionMap != null) 902 + collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 903 + } else if (type == 2) { 904 + int i_204_ = face + 1 & 0x3; 905 + Renderable renderable; 906 + Renderable renderable1; 907 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) { 908 + renderable = gameObjectDefinition.getGameObjectModel(2, 4 + face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 909 + renderable1 = gameObjectDefinition.getGameObjectModel(2, i_204_, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 910 + } else { 911 + renderable = new GameObject(objectId, 4 + face, 2, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 921 912 true); 922 - renderable1 = new GameObject(objectId, i_204_, 2, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 913 + renderable1 = new GameObject(objectId, i_204_, 2, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 923 914 true); 924 - } 925 - scene.addWall(x, y, plane, vertexMix, anIntArray158[face], anIntArray158[i_204_], hash, renderable, renderable1, objectConfig 926 - ); 927 - if (gameObjectDefinition.aBoolean797) { 928 - if (face == 0) { 929 - tileCullingBitsets[plane][x][y] |= 0x249; 930 - tileCullingBitsets[plane][x][y + 1] |= 0x492; 931 - } else if (face == 1) { 932 - tileCullingBitsets[plane][x][y + 1] |= 0x492; 933 - tileCullingBitsets[plane][x + 1][y] |= 0x249; 934 - } else if (face == 2) { 935 - tileCullingBitsets[plane][x + 1][y] |= 0x249; 936 - tileCullingBitsets[plane][x][y] |= 0x492; 937 - } else if (face == 3) { 938 - tileCullingBitsets[plane][x][y] |= 0x492; 939 - tileCullingBitsets[plane][x][y] |= 0x249; 940 - } 941 - } 942 - if (gameObjectDefinition.solid && collisionMap != null) 943 - collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 944 - if (gameObjectDefinition.unknown4 != 16) 945 - scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.unknown4); 946 - } else if (type == 3) { 947 - Renderable renderable; 948 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 949 - renderable = gameObjectDefinition.getGameObjectModel(3, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 950 - else 951 - renderable = new GameObject(objectId, face, 3, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 915 + } 916 + scene.addWall(x, y, plane, vertexMix, POWERS_OF_TWO[face], POWERS_OF_TWO[i_204_], hash, renderable, renderable1, objectConfig 917 + ); 918 + if (gameObjectDefinition.wall) { 919 + if (face == 0) { 920 + tileCullingBitsets[plane][x][y] |= 0x249; 921 + tileCullingBitsets[plane][x][y + 1] |= 0x492; 922 + } else if (face == 1) { 923 + tileCullingBitsets[plane][x][y + 1] |= 0x492; 924 + tileCullingBitsets[plane][x + 1][y] |= 0x249; 925 + } else if (face == 2) { 926 + tileCullingBitsets[plane][x + 1][y] |= 0x249; 927 + tileCullingBitsets[plane][x][y] |= 0x492; 928 + } else if (face == 3) { 929 + tileCullingBitsets[plane][x][y] |= 0x492; 930 + tileCullingBitsets[plane][x][y] |= 0x249; 931 + } 932 + } 933 + if (gameObjectDefinition.solid && collisionMap != null) 934 + collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 935 + if (gameObjectDefinition.offsetAmplifier != 16) 936 + scene.displaceWallDecoration(x, y, plane, gameObjectDefinition.offsetAmplifier); 937 + } else if (type == 3) { 938 + Renderable renderable; 939 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 940 + renderable = gameObjectDefinition.getGameObjectModel(3, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 941 + else 942 + renderable = new GameObject(objectId, face, 3, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 952 943 true); 953 - scene.addWall(x, y, plane, vertexMix, anIntArray167[face], 0, hash, renderable, null, objectConfig 954 - ); 955 - if (gameObjectDefinition.unknown2) { 956 - if (face == 0) 957 - tileShadowIntensity[plane][x][y + 1] = (byte) 50; 958 - else if (face == 1) 959 - tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 960 - else if (face == 2) 961 - tileShadowIntensity[plane][x + 1][y] = (byte) 50; 962 - else if (face == 3) 963 - tileShadowIntensity[plane][x][y] = (byte) 50; 964 - } 965 - if (gameObjectDefinition.solid && collisionMap != null) 966 - collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 967 - } else if (type == 9) { 968 - Renderable renderable; 969 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 970 - renderable = gameObjectDefinition.getGameObjectModel(type, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 971 - else 972 - renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 944 + scene.addWall(x, y, plane, vertexMix, WALL_CORNER_ORIENTATION[face], 0, hash, renderable, null, objectConfig 945 + ); 946 + if (gameObjectDefinition.castsShadow) { 947 + if (face == 0) 948 + tileShadowIntensity[plane][x][y + 1] = (byte) 50; 949 + else if (face == 1) 950 + tileShadowIntensity[plane][x + 1][y + 1] = (byte) 50; 951 + else if (face == 2) 952 + tileShadowIntensity[plane][x + 1][y] = (byte) 50; 953 + else if (face == 3) 954 + tileShadowIntensity[plane][x][y] = (byte) 50; 955 + } 956 + if (gameObjectDefinition.solid && collisionMap != null) 957 + collisionMap.markWall(x, y, type, face, gameObjectDefinition.walkable); 958 + } else if (type == 9) { 959 + Renderable renderable; 960 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 961 + renderable = gameObjectDefinition.getGameObjectModel(type, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 962 + else 963 + renderable = new GameObject(objectId, face, type, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 973 964 true); 974 - scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 975 - if (gameObjectDefinition.solid && collisionMap != null) 976 - collisionMap.method413(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 977 - (byte) 52); 978 - } else { 979 - if (gameObjectDefinition.adjustToTerrain) { 980 - if (face == 1) { 981 - int i_206_ = vertexHeightTop; 982 - vertexHeightTop = vertexHeightTopRight; 983 - vertexHeightTopRight = vertexHeightRight; 984 - vertexHeightRight = vertexHeight; 985 - vertexHeight = i_206_; 986 - } else if (face == 2) { 987 - int i_207_ = vertexHeightTop; 988 - vertexHeightTop = vertexHeightRight; 989 - vertexHeightRight = i_207_; 990 - i_207_ = vertexHeightTopRight; 991 - vertexHeightTopRight = vertexHeight; 992 - vertexHeight = i_207_; 993 - } else if (face == 3) { 994 - int i_208_ = vertexHeightTop; 995 - vertexHeightTop = vertexHeight; 996 - vertexHeight = vertexHeightRight; 997 - vertexHeightRight = vertexHeightTopRight; 998 - vertexHeightTopRight = i_208_; 999 - } 1000 - } 1001 - if (type == 4) { 1002 - Renderable renderable; 1003 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1004 - renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1005 - else 1006 - renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 965 + scene.addEntityB(x, y, plane, vertexMix, 0, 1, 1, hash, renderable, objectConfig); 966 + if (gameObjectDefinition.solid && collisionMap != null) 967 + collisionMap.markSolidOccupant(y, face, gameObjectDefinition.sizeY, gameObjectDefinition.sizeX, gameObjectDefinition.walkable, x, 968 + (byte) 52); 969 + } else { 970 + if (gameObjectDefinition.adjustToTerrain) { 971 + if (face == 1) { 972 + int temp = vertexHeightTop; 973 + vertexHeightTop = vertexHeightTopRight; 974 + vertexHeightTopRight = vertexHeightRight; 975 + vertexHeightRight = vertexHeight; 976 + vertexHeight = temp; 977 + } else if (face == 2) { 978 + int temp = vertexHeightTop; 979 + vertexHeightTop = vertexHeightRight; 980 + vertexHeightRight = temp; 981 + temp = vertexHeightTopRight; 982 + vertexHeightTopRight = vertexHeight; 983 + vertexHeight = temp; 984 + } else if (face == 3) { 985 + int temp = vertexHeightTop; 986 + vertexHeightTop = vertexHeight; 987 + vertexHeight = vertexHeightRight; 988 + vertexHeightRight = vertexHeightTopRight; 989 + vertexHeightTopRight = temp; 990 + } 991 + } 992 + if (type == 4) { 993 + Renderable renderable; 994 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 995 + renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 996 + else 997 + renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1007 998 true); 1008 - scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face * 512, hash, renderable, objectConfig, anIntArray158[face] 1009 - ); 1010 - } else if (type == 5) { 1011 - int offset = 16; 1012 - int i_210_ = scene.method267(plane, x, y); 1013 - if (i_210_ > 0) 1014 - offset = GameObjectDefinition.getDefinition(i_210_ >> 14 & 0x7fff).unknown4; 1015 - Renderable renderable; 1016 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1017 - renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1018 - else 1019 - renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 999 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face * 512, hash, renderable, objectConfig, POWERS_OF_TWO[face] 1000 + ); 1001 + } else if (type == 5) { 1002 + int offset = 16; 1003 + int i_210_ = scene.getWallObjectHash(x, y, plane); 1004 + if (i_210_ > 0) 1005 + offset = GameObjectDefinition.getDefinition(i_210_ >> 14 & 0x7fff).offsetAmplifier; 1006 + Renderable renderable; 1007 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1008 + renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1009 + else 1010 + renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1020 1011 true); 1021 - scene.addWallDecoration(x, y, plane, vertexMix, anIntArray161[face] * offset, anIntArray143[face] * offset, face * 512, hash, renderable, objectConfig, anIntArray158[face] 1022 - ); 1023 - } else if (type == 6) { 1024 - Renderable renderable; 1025 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1026 - renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1027 - else 1028 - renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1012 + scene.addWallDecoration(x, y, plane, vertexMix, FACE_OFFSET_X[face] * offset, FACE_OFFSET_Y[face] * offset, face * 512, hash, renderable, objectConfig, POWERS_OF_TWO[face] 1013 + ); 1014 + } else if (type == 6) { 1015 + Renderable renderable; 1016 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1017 + renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1018 + else 1019 + renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1029 1020 true); 1030 - scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 256 1031 - ); 1032 - } else if (type == 7) { 1033 - Renderable renderable; 1034 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1035 - renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1036 - else 1037 - renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1021 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 256 1022 + ); 1023 + } else if (type == 7) { 1024 + Renderable renderable; 1025 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1026 + renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1027 + else 1028 + renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1038 1029 true); 1039 - scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 512 1040 - ); 1041 - } else if (type == 8) { 1042 - Renderable renderable; 1043 - if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1044 - renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1045 - else 1046 - renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1030 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 512 1031 + ); 1032 + } else if (type == 8) { 1033 + Renderable renderable; 1034 + if (gameObjectDefinition.animationId == -1 && gameObjectDefinition.childrenIds == null) 1035 + renderable = gameObjectDefinition.getGameObjectModel(4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, -1); 1036 + else 1037 + renderable = new GameObject(objectId, 0, 4, vertexHeightRight, vertexHeightTopRight, vertexHeight, vertexHeightTop, gameObjectDefinition.animationId, 1047 1038 true); 1048 - scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 768 1049 - ); 1050 - } 1051 - } 1052 - } 1053 - } 1039 + scene.addWallDecoration(x, y, plane, vertexMix, 0, 0, face, hash, renderable, objectConfig, 768 1040 + ); 1041 + } 1042 + } 1043 + } 1044 + } 1054 1045 1055 - public void method174(int i, boolean bool, int i_211_, int i_212_, byte[] is, int i_213_, CollisionMap[] class46s) { 1056 - if (bool) 1057 - anInt166 = -379; 1058 - for (int i_214_ = 0; i_214_ < 4; i_214_++) { 1059 - for (int i_215_ = 0; i_215_ < 64; i_215_++) { 1060 - for (int i_216_ = 0; i_216_ < 64; i_216_++) { 1061 - if (i_212_ + i_215_ > 0 && i_212_ + i_215_ < 103 && i + i_216_ > 0 && i + i_216_ < 103) 1062 - class46s[i_214_].adjacency[i_212_ + i_215_][i + i_216_] &= ~0x1000000; 1063 - } 1064 - } 1065 - } 1066 - Buffer class50_sub1_sub2 = new Buffer(is); 1067 - for (int i_217_ = 0; i_217_ < 4; i_217_++) { 1068 - for (int i_218_ = 0; i_218_ < 64; i_218_++) { 1069 - for (int i_219_ = 0; i_219_ < 64; i_219_++) 1070 - method183(i_213_, (byte) -61, i_211_, class50_sub1_sub2, 0, i_218_ + i_212_, i_217_, i_219_ + i); 1071 - } 1072 - } 1073 - } 1046 + public void loadTerrainBlock(int blockX, int offsetX, int blockY, int offsetY, byte[] blockData, CollisionMap[] collisionMap) { 1047 + for (int plane = 0; plane < 4; plane++) { 1048 + for (int tileX = 0; tileX < 64; tileX++) { 1049 + for (int tileY = 0; tileY < 64; tileY++) { 1050 + if (blockX + tileX > 0 && blockX + tileX < 103 && blockY + tileY > 0 && blockY + tileY < 103) 1051 + collisionMap[plane].clippingData[blockX + tileX][blockY + tileY] &= ~0x1000000; 1052 + } 1053 + } 1054 + } 1055 + Buffer stream = new Buffer(blockData); 1056 + for (int plane = 0; plane < 4; plane++) { 1057 + for (int tileX = 0; tileX < 64; tileX++) { 1058 + for (int tileY = 0; tileY < 64; tileY++) 1059 + loadTerrainTile(tileX + blockX, offsetX, tileY + blockY, offsetY, plane, stream, 0); 1060 + } 1061 + } 1062 + } 1074 1063 1075 1064 1065 + public static int interpolate(int a, int b, int delta, int deltaScale) { 1066 + int f = (65536 - Rasterizer3D.COSINE[delta * 1024 / deltaScale] >> 1); 1067 + return (a * (65536 - f) >> 16) + (b * f >> 16); 1068 + } 1076 1069 1070 + public int getHSLBitset(int h, int s, int l) { 1071 + if (l > 179) 1072 + s /= 2; 1073 + if (l > 192) 1074 + s /= 2; 1075 + if (l > 217) 1076 + s /= 2; 1077 + if (l > 243) 1078 + s /= 2; 1079 + return (h / 4 << 10) + (s / 32 << 7) + l / 2; 1080 + } 1077 1081 1078 - 1079 - public static int method176(int i, int i_226_, int i_227_, int i_228_) { 1080 - int i_229_ = (65536 - Rasterizer3D.COSINE[i_227_ * 1024 / i_228_] >> 1); 1081 - return (i * (65536 - i_229_) >> 16) + (i_226_ * i_229_ >> 16); 1082 - } 1083 - 1084 - public int getHSLBitset(int i, int i_230_, int i_231_) { 1085 - if (i_231_ > 179) 1086 - i_230_ /= 2; 1087 - if (i_231_ > 192) 1088 - i_230_ /= 2; 1089 - if (i_231_ > 217) 1090 - i_230_ /= 2; 1091 - if (i_231_ > 243) 1092 - i_230_ /= 2; 1093 - int i_232_ = (i / 4 << 10) + (i_230_ / 32 << 7) + i_231_ / 2; 1094 - return i_232_; 1095 - } 1082 + public static int randomNoiseWeighedSum(int x, int y) { 1083 + int vDist2 = (calculateNoise(x - 1, y - 1) + calculateNoise(x + 1, y - 1) + calculateNoise(x - 1, y + 1) + calculateNoise( 1084 + x + 1, y + 1)); 1085 + int vDist1 = (calculateNoise(x - 1, y) + calculateNoise(x + 1, y) + calculateNoise(x, y - 1) + calculateNoise(x, 1086 + y + 1)); 1087 + int vLocal = calculateNoise(x, y); 1088 + return vDist2 / 16 + vDist1 / 8 + vLocal / 4; 1089 + } 1096 1090 1097 - public static int method178(int i, int i_233_) { 1098 - int i_234_ = (calculateNoise(i - 1, i_233_ - 1) + calculateNoise(i + 1, i_233_ - 1) + calculateNoise(i - 1, i_233_ + 1) + calculateNoise( 1099 - i + 1, i_233_ + 1)); 1100 - int i_235_ = (calculateNoise(i - 1, i_233_) + calculateNoise(i + 1, i_233_) + calculateNoise(i, i_233_ - 1) + calculateNoise(i, 1101 - i_233_ + 1)); 1102 - int i_236_ = calculateNoise(i, i_233_); 1103 - return i_234_ / 16 + i_235_ / 8 + i_236_ / 4; 1104 - } 1105 - 1106 - public void method179(int i, CollisionMap[] class46s, int i_237_, int i_238_, Scene class22, byte[] is) { 1107 - if (i_238_ < 0) { 1108 - Buffer class50_sub1_sub2 = new Buffer(is); 1109 - int i_239_ = -1; 1110 - for (;;) { 1111 - int i_240_ = class50_sub1_sub2.getSmart(); 1112 - if (i_240_ == 0) 1113 - break; 1114 - i_239_ += i_240_; 1115 - int i_241_ = 0; 1116 - for (;;) { 1117 - int i_242_ = class50_sub1_sub2.getSmart(); 1118 - if (i_242_ == 0) 1119 - break; 1120 - i_241_ += i_242_ - 1; 1121 - int i_243_ = i_241_ & 0x3f; 1122 - int i_244_ = i_241_ >> 6 & 0x3f; 1123 - int i_245_ = i_241_ >> 12; 1124 - int i_246_ = class50_sub1_sub2.getUnsignedByte(); 1125 - int i_247_ = i_246_ >> 2; 1126 - int i_248_ = i_246_ & 0x3; 1127 - int i_249_ = i_244_ + i_237_; 1128 - int i_250_ = i_243_ + i; 1129 - if (i_249_ > 0 && i_250_ > 0 && i_249_ < 103 && i_250_ < 103) { 1130 - int i_251_ = i_245_; 1131 - if ((renderRuleFlags[1][i_249_][i_250_] & 0x2) == 2) 1132 - i_251_--; 1133 - CollisionMap class46 = null; 1134 - if (i_251_ >= 0) 1135 - class46 = class46s[i_251_]; 1136 - renderObject(class22, class46, i_250_, i_245_, i_249_, aByte139, i_248_, i_247_, i_239_); 1137 - } 1138 - } 1139 - } 1140 - } 1141 - } 1091 + public void loadObjectBlock(int blockX, int blockY, CollisionMap[] collisionMap, Scene scene, byte[] blockData) { 1092 + Buffer stream = new Buffer(blockData); 1093 + int objectId = -1; 1094 + while (true) { 1095 + int objectIdOffset = stream.getSmart(); 1096 + if (objectIdOffset == 0) 1097 + break; 1098 + objectId += objectIdOffset; 1099 + int position = 0; 1100 + while (true) { 1101 + int positionOffset = stream.getSmart(); 1102 + if (positionOffset == 0) 1103 + break; 1104 + position += positionOffset - 1; 1105 + int tileY = position & 0x3f; 1106 + int tileX = position >> 6 & 0x3f; 1107 + int tilePlane = position >> 12; 1108 + int hash = stream.getUnsignedByte(); 1109 + int type = hash >> 2; 1110 + int orientation = hash & 0x3; 1111 + int x = tileX + blockX; 1112 + int y = tileY + blockY; 1113 + if (x > 0 && y > 0 && x < 103 && y < 103) { 1114 + int markingPlane = tilePlane; 1115 + if ((renderRuleFlags[1][x][y] & 0x2) == 2) 1116 + markingPlane--; 1117 + CollisionMap collisionMap_ = null; 1118 + if (markingPlane >= 0) 1119 + collisionMap_ = collisionMap[markingPlane]; 1120 + renderObject(scene, collisionMap_, y, tilePlane, x, orientation, type, objectId); 1121 + } 1122 + } 1123 + } 1124 + } 1142 1125 1143 - public void initiateVertexHeights(int xOffset, int xLength, int yOffset, int yLength) { 1144 - for (int y = yOffset; y <= yOffset + yLength; y++) { 1145 - for (int x = xOffset; x <= xOffset + xLength; x++) { 1146 - if (x >= 0 && x < regionSizeX && y >= 0 && y < regionSizeY) { 1147 - tileShadowIntensity[0][x][y] = (byte) 127; 1148 - if (x == xOffset && x > 0) 1149 - vertexHeights[0][x][y] = vertexHeights[0][x - 1][y]; 1150 - if (x == xOffset + xLength && x < regionSizeX - 1) 1151 - vertexHeights[0][x][y] = vertexHeights[0][x + 1][y]; 1152 - if (y == yOffset && y > 0) 1153 - vertexHeights[0][x][y] = vertexHeights[0][x][y - 1]; 1154 - if (y == yOffset + yLength && y < regionSizeY - 1) 1155 - vertexHeights[0][x][y] = vertexHeights[0][x][y + 1]; 1156 - } 1157 - } 1158 - } 1126 + public void initiateVertexHeights(int xOffset, int xLength, int yOffset, int yLength) { 1127 + for (int y = yOffset; y <= yOffset + yLength; y++) { 1128 + for (int x = xOffset; x <= xOffset + xLength; x++) { 1129 + if (x >= 0 && x < regionSizeX && y >= 0 && y < regionSizeY) { 1130 + tileShadowIntensity[0][x][y] = (byte) 127; 1131 + if (x == xOffset && x > 0) 1132 + vertexHeights[0][x][y] = vertexHeights[0][x - 1][y]; 1133 + if (x == xOffset + xLength && x < regionSizeX - 1) 1134 + vertexHeights[0][x][y] = vertexHeights[0][x + 1][y]; 1135 + if (y == yOffset && y > 0) 1136 + vertexHeights[0][x][y] = vertexHeights[0][x][y - 1]; 1137 + if (y == yOffset + yLength && y < regionSizeY - 1) 1138 + vertexHeights[0][x][y] = vertexHeights[0][x][y + 1]; 1139 + } 1140 + } 1141 + } 1159 1142 1160 - } 1143 + } 1161 1144 1162 - public static boolean method181(int i, int i_258_, byte[] is, int i_259_) { 1163 - boolean bool = true; 1164 - Buffer class50_sub1_sub2 = new Buffer(is); 1165 - if (i_259_ != 24515) 1166 - throw new NullPointerException(); 1167 - int i_260_ = -1; 1168 - for (;;) { 1169 - int i_261_ = class50_sub1_sub2.getSmart(); 1170 - if (i_261_ == 0) 1171 - break; 1172 - i_260_ += i_261_; 1173 - int i_262_ = 0; 1174 - boolean bool_263_ = false; 1175 - for (;;) { 1176 - if (bool_263_) { 1177 - int i_264_ = class50_sub1_sub2.getSmart(); 1178 - if (i_264_ == 0) 1179 - break; 1180 - class50_sub1_sub2.getUnsignedByte(); 1181 - } else { 1182 - int i_265_ = class50_sub1_sub2.getSmart(); 1183 - if (i_265_ == 0) 1184 - break; 1185 - i_262_ += i_265_ - 1; 1186 - int i_266_ = i_262_ & 0x3f; 1187 - int i_267_ = i_262_ >> 6 & 0x3f; 1188 - int i_268_ = class50_sub1_sub2.getUnsignedByte() >> 2; 1189 - int i_269_ = i_267_ + i; 1190 - int i_270_ = i_266_ + i_258_; 1191 - if (i_269_ > 0 && i_270_ > 0 && i_269_ < 103 && i_270_ < 103) { 1192 - GameObjectDefinition class47 = GameObjectDefinition.getDefinition(i_260_); 1193 - if (i_268_ != 22 || !lowMemory || class47.actionsBoolean || class47.unknown) { 1194 - bool &= class47.isModelCached(); 1195 - bool_263_ = true; 1196 - } 1197 - } 1198 - } 1199 - } 1200 - } 1201 - return bool; 1202 - } 1145 + public static boolean regionCached(int regionX, int regionY, byte[] objectData) { 1146 + boolean cached = true; 1147 + Buffer objectDataStream = new Buffer(objectData); 1148 + int objectId = -1; 1149 + while (true) { 1150 + int objectIdIncrement = objectDataStream.getSmart(); 1151 + if (objectIdIncrement == 0) 1152 + break; 1153 + objectId += objectIdIncrement; 1154 + int pos = 0; 1155 + boolean readSecondValue = false; 1156 + while (true) { 1157 + if (readSecondValue) { 1158 + int secondValue = objectDataStream.getSmart(); 1159 + if (secondValue == 0) 1160 + break; 1161 + objectDataStream.getUnsignedByte(); 1162 + } else { 1163 + int positionoffset = objectDataStream.getSmart(); 1164 + if (positionoffset == 0) 1165 + break; 1166 + pos += positionoffset - 1; 1167 + int regionOffsetY = pos & 0x3f; 1168 + int regionOffsetX = pos >> 6 & 0x3f; 1169 + int objectType = objectDataStream.getUnsignedByte() >> 2; 1170 + int objectX = regionOffsetX + regionX; 1171 + int objectY = regionOffsetY + regionY; 1172 + if (objectX > 0 && objectY > 0 && objectX < 103 && objectY < 103) { 1173 + GameObjectDefinition definition = GameObjectDefinition.getDefinition(objectId); 1174 + if (objectType != 22 || !lowMemory || definition.hasActions || definition.unknown) { 1175 + cached &= definition.isModelCached(); 1176 + readSecondValue = true; 1177 + } 1178 + } 1179 + } 1180 + } 1181 + } 1182 + return cached; 1183 + } 1203 1184 1204 - public int method182(int i, int i_271_) { 1205 - if (i == -2) 1206 - return 12345678; 1207 - if (i == -1) { 1208 - if (i_271_ < 0) 1209 - i_271_ = 0; 1210 - else if (i_271_ > 127) 1211 - i_271_ = 127; 1212 - i_271_ = 127 - i_271_; 1213 - return i_271_; 1214 - } 1215 - i_271_ = i_271_ * (i & 0x7f) / 128; 1216 - if (i_271_ < 2) 1217 - i_271_ = 2; 1218 - else if (i_271_ > 126) 1219 - i_271_ = 126; 1220 - return (i & 0xff80) + i_271_; 1221 - } 1185 + public int mixLightnessSigned(int hsl, int lightness) { 1186 + if (hsl == -2) 1187 + return 12345678; 1188 + if (hsl == -1) { 1189 + if (lightness < 0) 1190 + lightness = 0; 1191 + else if (lightness > 127) 1192 + lightness = 127; 1193 + lightness = 127 - lightness; 1194 + return lightness; 1195 + } 1196 + lightness = lightness * (hsl & 0x7f) / 128; 1197 + if (lightness < 2) 1198 + lightness = 2; 1199 + else if (lightness > 126) 1200 + lightness = 126; 1201 + return (hsl & 0xff80) + lightness; 1202 + } 1222 1203 1223 - public void method183(int i, byte i_272_, int i_273_, Buffer class50_sub1_sub2, int i_274_, int i_275_, 1224 - int i_276_, int i_277_) { 1225 - if (i_272_ != -61) 1226 - aBoolean140 = !aBoolean140; 1227 - if (i_275_ >= 0 && i_275_ < 104 && i_277_ >= 0 && i_277_ < 104) { 1228 - renderRuleFlags[i_276_][i_275_][i_277_] = (byte) 0; 1229 - for (;;) { 1230 - int i_278_ = class50_sub1_sub2.getUnsignedByte(); 1231 - if (i_278_ == 0) { 1232 - if (i_276_ == 0) 1233 - vertexHeights[0][i_275_][i_277_] = -calculateVertexHeight(932731 + i_275_ + i, 556238 + i_277_ 1234 - + i_273_) * 8; 1235 - else { 1236 - vertexHeights[i_276_][i_275_][i_277_] = (vertexHeights[i_276_ - 1][i_275_][i_277_] - 240); 1237 - break; 1238 - } 1239 - break; 1240 - } 1241 - if (i_278_ == 1) { 1242 - int i_279_ = class50_sub1_sub2.getUnsignedByte(); 1243 - if (i_279_ == 1) 1244 - i_279_ = 0; 1245 - if (i_276_ == 0) 1246 - vertexHeights[0][i_275_][i_277_] = -i_279_ * 8; 1247 - else { 1248 - vertexHeights[i_276_][i_275_][i_277_] = (vertexHeights[i_276_ - 1][i_275_][i_277_] - i_279_ * 8); 1249 - break; 1250 - } 1251 - break; 1252 - } 1253 - if (i_278_ <= 49) { 1254 - overlayFloorIds[i_276_][i_275_][i_277_] = class50_sub1_sub2.getByte(); 1255 - overlayClippingPaths[i_276_][i_275_][i_277_] = (byte) ((i_278_ - 2) / 4); 1256 - overlayRotations[i_276_][i_275_][i_277_] = (byte) (i_278_ - 2 + i_274_ & 0x3); 1257 - } else if (i_278_ <= 81) 1258 - renderRuleFlags[i_276_][i_275_][i_277_] = (byte) (i_278_ - 49); 1259 - else 1260 - underlayFloorIds[i_276_][i_275_][i_277_] = (byte) (i_278_ - 81); 1261 - } 1262 - } else { 1263 - for (;;) { 1264 - int i_280_ = class50_sub1_sub2.getUnsignedByte(); 1265 - if (i_280_ == 0) 1266 - break; 1267 - if (i_280_ == 1) { 1268 - class50_sub1_sub2.getUnsignedByte(); 1269 - break; 1270 - } 1271 - if (i_280_ <= 49) 1272 - class50_sub1_sub2.getUnsignedByte(); 1273 - } 1274 - } 1275 - } 1204 + public void loadTerrainTile(int tileX, int offsetX, int tileY, int offsetY, int tileZ, Buffer stream, int i1) { 1205 + if (tileX >= 0 && tileX < 104 && tileY >= 0 && tileY < 104) { 1206 + renderRuleFlags[tileZ][tileX][tileY] = (byte) 0; 1207 + for (; ; ) { 1208 + int value = stream.getUnsignedByte(); 1209 + if (value == 0) { 1210 + if (tileZ == 0) 1211 + vertexHeights[0][tileX][tileY] = -calculateVertexHeight(932731 + tileX + offsetX, 556238 + tileY 1212 + + offsetY) * 8; 1213 + else { 1214 + vertexHeights[tileZ][tileX][tileY] = (vertexHeights[tileZ - 1][tileX][tileY] - 240); 1215 + break; 1216 + } 1217 + break; 1218 + } 1219 + if (value == 1) { 1220 + int height = stream.getUnsignedByte(); 1221 + if (height == 1) 1222 + height = 0; 1223 + if (tileZ == 0) 1224 + vertexHeights[0][tileX][tileY] = -height * 8; 1225 + else { 1226 + vertexHeights[tileZ][tileX][tileY] = (vertexHeights[tileZ - 1][tileX][tileY] - height * 8); 1227 + break; 1228 + } 1229 + break; 1230 + } 1231 + if (value <= 49) { 1232 + overlayFloorIds[tileZ][tileX][tileY] = stream.getByte(); 1233 + overlayClippingPaths[tileZ][tileX][tileY] = (byte) ((value - 2) / 4); 1234 + overlayRotations[tileZ][tileX][tileY] = (byte) (value - 2 + i1 & 0x3); 1235 + } else if (value <= 81) 1236 + renderRuleFlags[tileZ][tileX][tileY] = (byte) (value - 49); 1237 + else 1238 + underlayFloorIds[tileZ][tileX][tileY] = (byte) (value - 81); 1239 + } 1240 + } else { 1241 + for (; ; ) { 1242 + int value = stream.getUnsignedByte(); 1243 + if (value == 0) 1244 + break; 1245 + if (value == 1) { 1246 + stream.getUnsignedByte(); 1247 + break; 1248 + } 1249 + if (value <= 49) 1250 + stream.getUnsignedByte(); 1251 + } 1252 + } 1253 + } 1276 1254 1277 - public static int calculateVertexHeight(int i, int i_281_) { 1278 - int mapHeight = (method163(i + 45365, i_281_ + 91923, 4) - 128 1279 - + (method163(i + 10294, i_281_ + 37821, 2) - 128 >> 1) + (method163(i, i_281_, 1) - 128 >> 2)); 1280 - mapHeight = (int) (mapHeight * 0.3) + 35; 1281 - if (mapHeight < 10) 1282 - mapHeight = 10; 1283 - else if (mapHeight > 60) 1284 - mapHeight = 60; 1285 - return mapHeight; 1286 - } 1255 + public static int calculateVertexHeight(int i, int i_281_) { 1256 + int mapHeight = (method163(i + 45365, i_281_ + 91923, 4) - 128 1257 + + (method163(i + 10294, i_281_ + 37821, 2) - 128 >> 1) + (method163(i, i_281_, 1) - 128 >> 2)); 1258 + mapHeight = (int) (mapHeight * 0.3) + 35; 1259 + if (mapHeight < 10) 1260 + mapHeight = 10; 1261 + else if (mapHeight > 60) 1262 + mapHeight = 60; 1263 + return mapHeight; 1264 + } 1287 1265 }
+120 -120
src/main/java/com/jagex/runescape/scene/Scene.java
··· 7 7 import com.jagex.runescape.media.renderable.Renderable; 8 8 import com.jagex.runescape.scene.tile.*; 9 9 import com.jagex.runescape.util.LinkedList; 10 + import com.jagex.runescape.world.GroundArray; 10 11 11 12 public class Scene { 12 13 ··· 15 16 private int mapSizeX; 16 17 private int mapSizeY; 17 18 private int[][][] heightMap; 18 - private SceneTile[][][] groundArray; 19 + private GroundArray<SceneTile> groundArray; 19 20 private int currentPositionZ; 20 21 private int sceneSpawnRequestsCacheCurrentPos; 21 22 private InteractiveObject[] sceneSpawnRequestsCache; ··· 95 96 mapSizeZ = height; 96 97 mapSizeX = width; 97 98 mapSizeY = length; 98 - groundArray = new SceneTile[height][width][length]; 99 + groundArray = new GroundArray<>(new SceneTile[height][width][length]); 99 100 anIntArrayArrayArray460 = new int[height][width + 1][length + 1]; 100 101 this.heightMap = heightMap; 101 102 initToNull(); ··· 115 116 for (int z = 0; z < mapSizeZ; z++) { 116 117 for (int x = 0; x < mapSizeX; x++) { 117 118 for (int y = 0; y < mapSizeY; y++) { 118 - groundArray[z][x][y] = null; 119 + groundArray.clearTile(z, x, y); 119 120 } 120 121 121 122 } ··· 145 146 currentPositionZ = z; 146 147 for (int x = 0; x < mapSizeX; x++) { 147 148 for (int y = 0; y < mapSizeY; y++) { 148 - if (groundArray[z][x][y] == null) { 149 - groundArray[z][x][y] = new SceneTile(x, y, z); 149 + if (groundArray.isTileEmpty(z, x, y)) { 150 + groundArray.setTile(z, x, y, new SceneTile(x, y, z)); 150 151 } 151 152 } 152 153 ··· 155 156 } 156 157 157 158 void setBridgeMode(int x, int y) { 158 - SceneTile scenetile = groundArray[0][x][y]; 159 + SceneTile scenetile = groundArray.getTile(0, x, y); 159 160 for (int z = 0; z < 3; z++) { 160 - SceneTile _tile = groundArray[z][x][y] = groundArray[z + 1][x][y]; 161 + SceneTile _tile = groundArray.setTile(z, x, y, groundArray.getTile(z + 1, x, y)); 161 162 if (_tile != null) { 162 163 _tile.z--; 163 164 for (int e = 0; e < _tile.entityCount; e++) { ··· 170 171 } 171 172 } 172 173 173 - if (groundArray[0][x][y] == null) { 174 - groundArray[0][x][y] = new SceneTile(x, y, 0); 174 + if (groundArray.isTileEmpty(0, x, y)) { 175 + groundArray.setTile(0, x, y, new SceneTile(x, y, 0)); 175 176 } 176 - groundArray[0][x][y].tileBelow = scenetile; 177 - groundArray[3][x][y] = null; 177 + groundArray.getTile(0, x, y).tileBelow = scenetile; 178 + groundArray.clearTile(3, x, y); 178 179 } 179 180 180 181 static void createCullingCluster(final int z, int highestX, int lowestX, int highestY, int lowestY, int highestZ, int lowestZ, int searchMask) { ··· 194 195 } 195 196 196 197 void setTileLogicHeight(int z, int x, int y, int logicHeight) { 197 - SceneTile sceneTile = groundArray[z][x][y]; 198 + SceneTile sceneTile = groundArray.getTile(z, x, y); 198 199 if (sceneTile != null) { 199 200 sceneTile.logicHeight = logicHeight; 200 201 } ··· 205 206 if (clippingPath == 0) { 206 207 GenericTile tile = new GenericTile(cA, cB, cC, cD, -1, underlayRGB, false); 207 208 for (int _z = plane; _z >= 0; _z--) { 208 - if (groundArray[_z][x][y] == null) { 209 - groundArray[_z][x][y] = new SceneTile(x, y, _z); 209 + if (groundArray.isTileEmpty(_z, x, y)) { 210 + groundArray.setTile(_z, x, y, new SceneTile(x, y, _z)); 210 211 } 211 212 } 212 213 213 - groundArray[plane][x][y].plainTile = tile; 214 + groundArray.getTile(plane, x, y).plainTile = tile; 214 215 return; 215 216 } 216 217 if (clippingPath == 1) { 217 218 GenericTile tile = new GenericTile(colourA, colourB, colourC, colourD, textureId, overlayRGB, vertexHeightSW == vertexHeightSE && vertexHeightSW == vertexHeightNE && vertexHeightSW == vertexHeightNW); 218 219 for (int _z = plane; _z >= 0; _z--) { 219 - if (groundArray[_z][x][y] == null) { 220 - groundArray[_z][x][y] = new SceneTile(x, y, _z); 220 + if (groundArray.isTileEmpty(_z, x, y)) { 221 + groundArray.setTile(_z, x, y, new SceneTile(x, y, _z)); 221 222 } 222 223 } 223 224 224 - groundArray[plane][x][y].plainTile = tile; 225 + groundArray.getTile(plane, x, y).plainTile = tile; 225 226 return; 226 227 } 227 228 ComplexTile tile = new ComplexTile(x, vertexHeightSW, vertexHeightSE, vertexHeightNW, vertexHeightNE, y, clippingPathRotation, textureId, clippingPath, cA, colourA, cB, colourB, cC, colourC, cD, colourD, overlayRGB, underlayRGB); 228 229 for (int _z = plane; _z >= 0; _z--) { 229 - if (groundArray[_z][x][y] == null) { 230 - groundArray[_z][x][y] = new SceneTile(x, y, _z); 230 + if (groundArray.isTileEmpty(_z, x, y)) { 231 + groundArray.setTile(_z, x, y, new SceneTile(x, y, _z)); 231 232 } 232 233 } 233 234 234 - groundArray[plane][x][y].shapedTile = tile; 235 + 236 + groundArray.getTile(plane, x, y).shapedTile = tile; 235 237 } 236 238 237 239 void addGroundDecoration(int x, int y, int z, int drawHeight, int uid, Renderable renderable, byte config) { ··· 245 247 floorDecoration.z = drawHeight; 246 248 floorDecoration.uid = uid; 247 249 floorDecoration.config = config; 248 - if (groundArray[z][x][y] == null) { 249 - groundArray[z][x][y] = new SceneTile(x, y, z); 250 + if (groundArray.isTileEmpty(z, x, y)) { 251 + groundArray.setTile(z, x, y, new SceneTile(x, y, z)); 250 252 } 251 - groundArray[z][x][y].floorDecoration = floorDecoration; 253 + groundArray.getTile(z, x, y).floorDecoration = floorDecoration; 252 254 } 253 255 254 256 public void addGroundItemTile(int x, int y, int z, int drawHeight, int uid, Renderable firstGroundItem, Renderable secondGroundItem, ··· 262 264 groundItemTile.secondGroundItem = secondGroundItem; 263 265 groundItemTile.thirdGroundItem = thirdGroundItem; 264 266 int k1 = 0; 265 - SceneTile sceneTile = groundArray[z][x][y]; 267 + SceneTile sceneTile = groundArray.getTile(z, x, y); 266 268 if (sceneTile != null) { 267 269 for (int e = 0; e < sceneTile.entityCount; e++) { 268 270 if (sceneTile.interactiveObjects[e].renderable instanceof Model) { ··· 275 277 276 278 } 277 279 groundItemTile.anInt180 = k1; 278 - if (groundArray[z][x][y] == null) { 279 - groundArray[z][x][y] = new SceneTile(x, y, z); 280 + if (groundArray.isTileEmpty(z, x, y)) { 281 + groundArray.setTile(z, x, y, new SceneTile(x, y, z)); 280 282 } 281 - groundArray[z][x][y].groundItemTile = groundItemTile; 283 + groundArray.getTile(z, x, y).groundItemTile = groundItemTile; 282 284 } 283 285 284 286 void addWall(int x, int y, int z, int drawHeight, int orientation, int orientation2, int uid, Renderable primary, Renderable secondary, byte config) { ··· 294 296 wall.orientation = orientation; 295 297 wall.orientation2 = orientation2; 296 298 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 + if (groundArray.isTileEmpty(_z, x, y)) { 300 + groundArray.setTile(_z, x, y, new SceneTile(x, y, _z)); 301 + 299 302 } 300 303 } 301 304 302 - groundArray[z][x][y].wall = wall; 305 + groundArray.getTile(z, x, y).wall = wall; 303 306 } 304 307 } 305 308 ··· 315 318 wallDecoration.configBits = faceBits; 316 319 wallDecoration.face = face; 317 320 for (int planeCounter = z; planeCounter >= 0; planeCounter--) { 318 - if (groundArray[planeCounter][x][y] == null) { 319 - groundArray[planeCounter][x][y] = new SceneTile(x, y, planeCounter); 321 + if (groundArray.isTileEmpty(planeCounter, x, y)) { 322 + groundArray.setTile(planeCounter, x, y, new SceneTile(x, y, planeCounter)); 323 + 320 324 } 321 325 } 322 326 323 - groundArray[z][x][y].wallDecoration = wallDecoration; 327 + groundArray.getTile(z, x, y).wallDecoration = wallDecoration; 324 328 } 325 329 } 326 330 ··· 378 382 if (x < 0 || y < 0 || x >= mapSizeX || y >= mapSizeY) { 379 383 return false; 380 384 } 381 - SceneTile tile = groundArray[z][x][y]; 385 + SceneTile tile = groundArray.getTile(z, x, y); 382 386 if (tile != null && tile.entityCount >= 5) { 383 387 return false; 384 388 } ··· 415 419 size += 2; 416 420 } 417 421 for (int _z = z; _z >= 0; _z--) { 418 - if (groundArray[_z][x][y] == null) { 419 - groundArray[_z][x][y] = new SceneTile(x, y, _z); 422 + if (groundArray.isTileEmpty(_z, x, y)) { 423 + groundArray.setTile(_z, x, y, new SceneTile(x, y, _z)); 420 424 } 421 425 } 422 426 423 - SceneTile sceneTile = groundArray[z][x][y]; 427 + SceneTile sceneTile = groundArray.getTile(z, x, y); 424 428 sceneTile.interactiveObjects[sceneTile.entityCount] = interactiveObject; 425 429 sceneTile.sceneSpawnRequestsSize[sceneTile.entityCount] = size; 426 430 sceneTile.interactiveObjectsSizeOR |= size; ··· 448 452 private void remove(InteractiveObject entity) { 449 453 for (int x = entity.tileLeft; x <= entity.tileRight; x++) { 450 454 for (int y = entity.tileTop; y <= entity.tileBottom; y++) { 451 - SceneTile tile = groundArray[entity.z][x][y]; 455 + SceneTile tile = groundArray.getTile(entity.z, x, y); 452 456 if (tile != null) { 453 457 for (int e = 0; e < tile.entityCount; e++) { 454 458 if (tile.interactiveObjects[e] != entity) { ··· 477 481 } 478 482 479 483 void displaceWallDecoration(int x, int y, int z, int displacement) { 480 - SceneTile sceneTile = groundArray[z][x][y]; 484 + SceneTile sceneTile = groundArray.getTile(z, x, y); 481 485 if (sceneTile == null) { 482 486 return; 483 487 } ··· 493 497 } 494 498 495 499 public void removeWallObject(int x, int y, int z) { 496 - SceneTile tile = groundArray[z][x][y]; 500 + SceneTile tile = groundArray.getTile(z, x, y); 497 501 if (tile != null) { 498 502 tile.wall = null; 499 503 } 500 504 } 501 505 502 506 public void removeWallDecoration(int x, int y, int z) { 503 - SceneTile tile = groundArray[z][x][y]; 507 + SceneTile tile = groundArray.getTile(z, x, y); 504 508 if (tile != null) { 505 509 tile.wallDecoration = null; 506 510 } 507 511 } 508 512 509 513 public void removeInteractiveObject(int x, int y, int z) { 510 - SceneTile tile = groundArray[z][x][y]; 514 + SceneTile tile = groundArray.getTile(z, x, y); 511 515 if (tile == null) { 512 516 return; 513 517 } ··· 522 526 } 523 527 524 528 public void method261(int x, int y, int z) { 525 - SceneTile sceneTile = groundArray[z][x][y]; 529 + SceneTile sceneTile = groundArray.getTile(z, x, y); 526 530 if (sceneTile == null) { 527 531 return; 528 532 } 529 533 sceneTile.floorDecoration = null; 530 534 } 531 535 532 - public void clearGroundItem(int i, int j, int k) { 533 - SceneTile sceneTile = groundArray[i][j][k]; 536 + public void clearGroundItem(int z, int x, int y) { 537 + SceneTile sceneTile = groundArray.getTile(z, x, y); 534 538 if (sceneTile != null) { 535 539 sceneTile.groundItemTile = null; 536 540 } 537 541 } 538 542 539 543 public Wall getWallObject(int level, int x, int y) { 540 - SceneTile sceneTile = groundArray[level][x][y]; 544 + SceneTile sceneTile = groundArray.getTile(level, x, y); 541 545 542 546 if (sceneTile == null) { 543 547 return null; ··· 547 551 } 548 552 549 553 public WallDecoration getWallDecoration(int level, int y, int x) { 550 - SceneTile sceneTile = groundArray[level][x][y]; 554 + SceneTile sceneTile = groundArray.getTile(level, x, y); 551 555 552 556 if (sceneTile == null) { 553 557 return null; ··· 557 561 } 558 562 559 563 public InteractiveObject method265(int x, int y, int level) { 560 - SceneTile sceneTile = groundArray[level][x][y]; 564 + SceneTile sceneTile = groundArray.getTile(level, x, y); 561 565 if (sceneTile == null) { 562 566 return null; 563 567 } ··· 572 576 } 573 577 574 578 public FloorDecoration getFloorDecoration(int level, int x, int y) { 575 - SceneTile sceneTile = groundArray[level][y][x]; 579 + SceneTile sceneTile = groundArray.getTile(level, x, y); 576 580 if (sceneTile == null || sceneTile.floorDecoration == null) { 577 581 return null; 578 582 } else { ··· 580 584 } 581 585 } 582 586 583 - public int method267(int i, int j, int k) { 584 - SceneTile sceneTile = groundArray[i][j][k]; 587 + public int getWallObjectHash(int x, int y, int z) { 588 + SceneTile sceneTile = groundArray.getTile(z, x, y); 585 589 if (sceneTile == null || sceneTile.wall == null) { 586 590 return 0; 587 591 } else { ··· 589 593 } 590 594 } 591 595 592 - public int method268(int i, byte byte0, int j, int k) { 593 - SceneTile sceneTile = groundArray[j][i][k]; 596 + public int getWallDecorationHash(int x, int z, int y) { 597 + SceneTile sceneTile = groundArray.getTile(z, x, y); 594 598 if (sceneTile == null || sceneTile.wallDecoration == null) { 595 599 return 0; 596 600 } else { ··· 598 602 } 599 603 } 600 604 601 - public int method269(int i, int j, int k) { 602 - SceneTile sceneTile = groundArray[i][j][k]; 605 + public int method269(int z, int x, int y) { 606 + SceneTile sceneTile = groundArray.getTile(z, x, y); 603 607 if (sceneTile == null) { 604 608 return 0; 605 609 } 606 610 for (int l = 0; l < sceneTile.entityCount; l++) { 607 611 InteractiveObject interactiveObject = sceneTile.interactiveObjects[l]; 608 - if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == j && interactiveObject.tileTop == k) { 612 + if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == x && interactiveObject.tileTop == y) { 609 613 return interactiveObject.uid; 610 614 } 611 615 } ··· 613 617 return 0; 614 618 } 615 619 616 - public int getFloorDecorationHash(int i, int j, int k) { 617 - SceneTile sceneTile = groundArray[i][j][k]; 620 + public int getFloorDecorationHash(int z, int x, int y) { 621 + SceneTile sceneTile = groundArray.getTile(z, x, y); 618 622 if (sceneTile == null || sceneTile.floorDecoration == null) { 619 623 return 0; 620 624 } else { ··· 622 626 } 623 627 } 624 628 625 - public int method271(int i, int j, int k, int l) { 626 - SceneTile sceneTile = groundArray[i][j][k]; 629 + public int method271(int z, int x, int y, int l) { 630 + SceneTile sceneTile = groundArray.getTile(z, x, y); 627 631 if (sceneTile == null) { 628 632 return -1; 629 633 } ··· 649 653 for (int _z = 0; _z < mapSizeZ; _z++) { 650 654 for (int _x = 0; _x < mapSizeX; _x++) { 651 655 for (int _y = 0; _y < mapSizeY; _y++) { 652 - SceneTile tile = groundArray[_z][_x][_y]; 656 + SceneTile tile = groundArray.getTile(_z, _x, _y); 653 657 if (tile != null) { 654 658 Wall wall = tile.wall; 655 659 if (wall != null && wall.primary != null ··· 689 693 690 694 } 691 695 692 - private void method273(int i, Model model, int j, int k, int l) { 696 + private void method273(int x, Model model, int y, int z, int l) { 693 697 if (l != 0) { 694 698 return; 695 699 } 696 - if (i < mapSizeX) { 697 - SceneTile sceneTile = groundArray[k][i + 1][j]; 700 + if (x < mapSizeX) { 701 + SceneTile sceneTile = groundArray.getTile(z, x + 1, y); 698 702 if (sceneTile != null && sceneTile.floorDecoration != null 699 703 && sceneTile.floorDecoration.renderable.verticesNormal != null) { 700 704 mergeNormals(model, 701 705 (Model) sceneTile.floorDecoration.renderable, 128, 0, 0, true); 702 706 } 703 707 } 704 - if (j < mapSizeX) { 705 - SceneTile sceneTile = groundArray[k][i][j + 1]; 708 + if (y < mapSizeX) { 709 + SceneTile sceneTile = groundArray.getTile(z, x, y + 1); 706 710 if (sceneTile != null && sceneTile.floorDecoration != null 707 711 && sceneTile.floorDecoration.renderable.verticesNormal != null) { 708 712 mergeNormals(model, 709 713 (Model) sceneTile.floorDecoration.renderable, 0, 0, 128, true); 710 714 } 711 715 } 712 - if (i < mapSizeX && j < mapSizeY) { 713 - SceneTile sceneTile = groundArray[k][i + 1][j + 1]; 716 + if (x < mapSizeX && y < mapSizeY) { 717 + SceneTile sceneTile = groundArray.getTile(z, x + 1, y + 1); 714 718 if (sceneTile != null && sceneTile.floorDecoration != null 715 719 && sceneTile.floorDecoration.renderable.verticesNormal != null) { 716 720 mergeNormals(model, 717 721 (Model) sceneTile.floorDecoration.renderable, 128, 0, 128, true); 718 722 } 719 723 } 720 - if (i < mapSizeX && j > 0) { 721 - SceneTile sceneTile = groundArray[k][i + 1][j - 1]; 724 + if (x < mapSizeX && y > 0) { 725 + SceneTile sceneTile = groundArray.getTile(z, x + 1, y - 1); 722 726 if (sceneTile != null && sceneTile.floorDecoration != null 723 727 && sceneTile.floorDecoration.renderable.verticesNormal != null) { 724 728 mergeNormals(model, ··· 734 738 int l1 = i1 + l; 735 739 int i2 = i - 1; 736 740 int j2 = i + j1; 737 - for (int k2 = j; k2 <= j + 1; k2++) { 738 - if (k2 != mapSizeZ) { 739 - for (int l2 = k1; l2 <= l1; l2++) { 740 - if (l2 >= 0 && l2 < mapSizeX) { 741 - for (int i3 = i2; i3 <= j2; i3++) { 742 - if (i3 >= 0 && i3 < mapSizeY && (!flag || l2 >= l1 || i3 >= j2 || i3 < i && l2 != i1)) { 743 - SceneTile class50_sub3 = groundArray[k2][l2][i3]; 741 + for (int z = j; z <= j + 1; z++) { 742 + if (z != mapSizeZ) { 743 + for (int x = k1; x <= l1; x++) { 744 + if (x >= 0 && x < mapSizeX) { 745 + for (int y = i2; y <= j2; y++) { 746 + if (y >= 0 && y < mapSizeY && (!flag || x >= l1 || y >= j2 || y < i && x != i1)) { 747 + SceneTile class50_sub3 = groundArray.getTile(z, x, y); 744 748 if (class50_sub3 != null) { 745 - int j3 = (heightMap[k2][l2][i3] 746 - + heightMap[k2][l2 + 1][i3] 747 - + heightMap[k2][l2][i3 + 1] + heightMap[k2][l2 + 1][i3 + 1]) 749 + int j3 = (heightMap[z][x][y] 750 + + heightMap[z][x + 1][y] 751 + + heightMap[z][x][y + 1] + heightMap[z][x + 1][y + 1]) 748 752 / 4 749 753 - (heightMap[j][i1][i] 750 754 + heightMap[j][i1 + 1][i] ··· 754 758 if (wall != null && wall.primary != null 755 759 && wall.primary.verticesNormal != null) { 756 760 mergeNormals(class50_sub1_sub4_sub4, 757 - (Model) wall.primary, (l2 - i1) 758 - * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 761 + (Model) wall.primary, (x - i1) 762 + * 128 + (1 - l) * 64, j3, (y - i) * 128 + (1 - j1) * 64, flag); 759 763 } 760 764 if (wall != null && wall.secondary != null 761 765 && wall.secondary.verticesNormal != null) { 762 766 mergeNormals(class50_sub1_sub4_sub4, 763 - (Model) wall.secondary, (l2 - i1) 764 - * 128 + (1 - l) * 64, j3, (i3 - i) * 128 + (1 - j1) * 64, flag); 767 + (Model) wall.secondary, (x - i1) 768 + * 128 + (1 - l) * 64, j3, (y - i) * 128 + (1 - j1) * 64, flag); 765 769 } 766 770 for (int k3 = 0; k3 < class50_sub3.entityCount; k3++) { 767 771 InteractiveObject interactiveObject = class50_sub3.interactiveObjects[k3]; ··· 858 862 859 863 } 860 864 861 - public void renderMinimapDot(int[] ai, int i, int j, int k, int l, int i1) { 862 - SceneTile sceneTile = groundArray[k][l][i1]; 865 + public void renderMinimapDot(int[] ai, int i, int j, int z, int x, int y) { 866 + SceneTile sceneTile = groundArray.getTile(z, x, y); 863 867 if (sceneTile == null) { 864 868 return; 865 869 } ··· 1061 1065 processCulling(); 1062 1066 anInt461 = 0; 1063 1067 for (int z = currentPositionZ; z < mapSizeZ; z++) { 1064 - SceneTile[][] tiles = groundArray[z]; 1065 1068 for (int x = currentPositionX; x < mapBoundsX; x++) { 1066 1069 for (int y = currentPositionY; y < mapBoundsY; y++) { 1067 - SceneTile tile = tiles[x][y]; 1070 + SceneTile tile = groundArray.getTile(z, x, y); 1068 1071 if (tile != null) { 1069 1072 if (tile.logicHeight > j 1070 1073 || !TILE_VISIBILITY_MAP[(x - cameraPositionTileX) + 25][(y - cameraPositionTileY) + 25] ··· 1086 1089 } 1087 1090 1088 1091 for (int z = currentPositionZ; z < mapSizeZ; z++) { 1089 - SceneTile[][] sceneTiles = groundArray[z]; 1090 1092 for (int offsetX = -25; offsetX <= 0; offsetX++) { 1091 1093 int x = cameraPositionTileX + offsetX; 1092 1094 int x2 = cameraPositionTileX - offsetX; ··· 1096 1098 int y2 = cameraPositionTileY - offsetY; 1097 1099 if (x >= currentPositionX) { 1098 1100 if (y >= currentPositionY) { 1099 - SceneTile sceneTile = sceneTiles[x][y]; 1101 + SceneTile sceneTile = groundArray.getTile(z, x, y); 1100 1102 if (sceneTile != null && sceneTile.draw) { 1101 1103 renderTile(sceneTile, true); 1102 1104 } 1103 1105 } 1104 1106 if (y2 < mapBoundsY) { 1105 - SceneTile sceneTile = sceneTiles[x][y2]; 1107 + SceneTile sceneTile = groundArray.getTile(z, x, y2); 1106 1108 if (sceneTile != null && sceneTile.draw) { 1107 1109 renderTile(sceneTile, true); 1108 1110 } ··· 1110 1112 } 1111 1113 if (x2 < mapBoundsX) { 1112 1114 if (y >= currentPositionY) { 1113 - SceneTile sceneTile = sceneTiles[x2][y]; 1115 + SceneTile sceneTile = groundArray.getTile(z, x2, y); 1114 1116 if (sceneTile != null && sceneTile.draw) { 1115 1117 renderTile(sceneTile, true); 1116 1118 } 1117 1119 } 1118 1120 if (y2 < mapBoundsY) { 1119 - SceneTile sceneTile = sceneTiles[x2][y2]; 1121 + SceneTile sceneTile = groundArray.getTile(z, x2, y2); 1120 1122 if (sceneTile != null && sceneTile.draw) { 1121 1123 renderTile(sceneTile, true); 1122 1124 } ··· 1134 1136 } 1135 1137 1136 1138 for (int z = currentPositionZ; z < mapSizeZ; z++) { 1137 - SceneTile[][] sceneTiles = groundArray[z]; 1138 1139 for (int offsetX = -25; offsetX <= 0; offsetX++) { 1139 1140 int x = cameraPositionTileX + offsetX; 1140 1141 int x2 = cameraPositionTileX - offsetX; ··· 1144 1145 int y2 = cameraPositionTileY - offsetY; 1145 1146 if (x >= currentPositionX) { 1146 1147 if (y >= currentPositionY) { 1147 - SceneTile tile = sceneTiles[x][y]; 1148 + SceneTile tile = groundArray.getTile(z, x, y); 1148 1149 if (tile != null && tile.draw) { 1149 1150 renderTile(tile, false); 1150 1151 } 1151 1152 } 1152 1153 if (y2 < mapBoundsY) { 1153 - SceneTile tile = sceneTiles[x][y2]; 1154 + SceneTile tile = groundArray.getTile(z, x, y2); 1154 1155 if (tile != null && tile.draw) { 1155 1156 renderTile(tile, false); 1156 1157 } ··· 1158 1159 } 1159 1160 if (x2 < mapBoundsX) { 1160 1161 if (y >= currentPositionY) { 1161 - SceneTile tile = sceneTiles[x2][y]; 1162 + SceneTile tile = groundArray.getTile(z, x2, y); 1162 1163 if (tile != null && tile.draw) { 1163 1164 renderTile(tile, false); 1164 1165 } 1165 1166 } 1166 1167 if (y2 < mapBoundsY) { 1167 - SceneTile tile = sceneTiles[x2][y2]; 1168 + SceneTile tile = groundArray.getTile(z, x2, y2); 1168 1169 if (tile != null && tile.draw) { 1169 1170 renderTile(tile, false); 1170 1171 } ··· 1198 1199 int y = groundTile.y; 1199 1200 int z = groundTile.z; 1200 1201 int level = groundTile.renderLevel; 1201 - SceneTile[][] tiles = groundArray[z]; 1202 1202 if (groundTile.draw) { 1203 1203 if (flag) { 1204 1204 if (z > 0) { 1205 - SceneTile tile = groundArray[z - 1][x][y]; 1205 + SceneTile tile = groundArray.getTile(z - 1, x, y); 1206 1206 if (tile != null && tile.visible) { 1207 1207 continue; 1208 1208 } 1209 1209 } 1210 1210 if (x <= cameraPositionTileX && x > currentPositionX) { 1211 - SceneTile tile = tiles[x - 1][y]; 1211 + SceneTile tile = groundArray.getTile(z, x - 1, y); 1212 1212 if (tile != null && tile.visible 1213 1213 && (tile.draw || (groundTile.interactiveObjectsSizeOR & 1) == 0)) { 1214 1214 continue; 1215 1215 } 1216 1216 } 1217 1217 if (x >= cameraPositionTileX && x < mapBoundsX - 1) { 1218 - SceneTile tile = tiles[x + 1][y]; 1218 + SceneTile tile = groundArray.getTile(z, x + 1, y); 1219 1219 if (tile != null && tile.visible 1220 1220 && (tile.draw || (groundTile.interactiveObjectsSizeOR & 4) == 0)) { 1221 1221 continue; 1222 1222 } 1223 1223 } 1224 1224 if (y <= cameraPositionTileY && y > currentPositionY) { 1225 - SceneTile tile = tiles[x][y - 1]; 1225 + SceneTile tile = groundArray.getTile(z, x, y - 1); 1226 1226 if (tile != null && tile.visible 1227 1227 && (tile.draw || (groundTile.interactiveObjectsSizeOR & 8) == 0)) { 1228 1228 continue; 1229 1229 } 1230 1230 } 1231 1231 if (y >= cameraPositionTileY && y < mapBoundsY - 1) { 1232 - SceneTile tile = tiles[x][y + 1]; 1232 + SceneTile tile = groundArray.getTile(z, x, y + 1); 1233 1233 if (tile != null && tile.visible 1234 1234 && (tile.draw || (groundTile.interactiveObjectsSizeOR & 2) == 0)) { 1235 1235 continue; ··· 1390 1390 int k4 = groundTile.interactiveObjectsSizeOR; 1391 1391 if (k4 != 0) { 1392 1392 if (x < cameraPositionTileX && (k4 & 4) != 0) { 1393 - SceneTile tile = tiles[x + 1][y]; 1393 + SceneTile tile = groundArray.getTile(z, x + 1, y); 1394 1394 if (tile != null && tile.visible) { 1395 1395 tileList.pushBack(tile); 1396 1396 } 1397 1397 } 1398 1398 if (y < cameraPositionTileY && (k4 & 2) != 0) { 1399 - SceneTile tile = tiles[x][y + 1]; 1399 + SceneTile tile = groundArray.getTile(z, x, y + 1); 1400 1400 if (tile != null && tile.visible) { 1401 1401 tileList.pushBack(tile); 1402 1402 } 1403 1403 } 1404 1404 if (x > cameraPositionTileX && (k4 & 1) != 0) { 1405 - SceneTile tile = tiles[x - 1][y]; 1405 + SceneTile tile = groundArray.getTile(z, x-1, y); 1406 1406 if (tile != null && tile.visible) { 1407 1407 tileList.pushBack(tile); 1408 1408 } 1409 1409 } 1410 1410 if (y > cameraPositionTileY && (k4 & 8) != 0) { 1411 - SceneTile tile = tiles[x][y - 1]; 1411 + SceneTile tile = groundArray.getTile(z, x, y-1); 1412 1412 if (tile != null && tile.visible) { 1413 1413 tileList.pushBack(tile); 1414 1414 } ··· 1449 1449 } 1450 1450 for (int _x = entity.tileLeft; _x <= entity.tileRight; _x++) { 1451 1451 for (int _y = entity.tileTop; _y <= entity.tileBottom; _y++) { 1452 - SceneTile tile = tiles[_x][_y]; 1452 + SceneTile tile = groundArray.getTile(z, _x, _y); 1453 1453 if (tile.draw) { 1454 1454 groundTile.drawEntities = true; 1455 1455 } else { ··· 1528 1528 } 1529 1529 for (int _x = entity.tileLeft; _x <= entity.tileRight; _x++) { 1530 1530 for (int _y = entity.tileTop; _y <= entity.tileBottom; _y++) { 1531 - SceneTile tile = tiles[_x][_y]; 1531 + SceneTile tile = groundArray.getTile(z, _x, _y); 1532 1532 if (tile.wallCullDirection != 0) { 1533 1533 tileList.pushBack(tile); 1534 1534 } else if ((_x != x || _y != y) && tile.visible) { ··· 1550 1550 continue; 1551 1551 } 1552 1552 if (x <= cameraPositionTileX && x > currentPositionX) { 1553 - SceneTile tile = tiles[x - 1][y]; 1553 + SceneTile tile = groundArray.getTile(z, x-1, y); 1554 1554 if (tile != null && tile.visible) { 1555 1555 continue; 1556 1556 } 1557 1557 } 1558 1558 if (x >= cameraPositionTileX && x < mapBoundsX - 1) { 1559 - SceneTile tile = tiles[x + 1][y]; 1559 + SceneTile tile = groundArray.getTile(z, x+1, y); 1560 1560 if (tile != null && tile.visible) { 1561 1561 continue; 1562 1562 } 1563 1563 } 1564 1564 if (y <= cameraPositionTileY && y > currentPositionY) { 1565 - SceneTile tile = tiles[x][y - 1]; 1565 + SceneTile tile = groundArray.getTile(z, x, y-1); 1566 1566 if (tile != null && tile.visible) { 1567 1567 continue; 1568 1568 } 1569 1569 } 1570 1570 if (y >= cameraPositionTileY && y < mapBoundsY - 1) { 1571 - SceneTile tile = tiles[x][y + 1]; 1571 + SceneTile tile = groundArray.getTile(z, x, y+1); 1572 1572 if (tile != null && tile.visible) { 1573 1573 continue; 1574 1574 } ··· 1646 1646 } 1647 1647 } 1648 1648 if (z < mapSizeZ - 1) { 1649 - SceneTile tile = groundArray[z + 1][x][y]; 1649 + SceneTile tile = groundArray.getTile(z+1, x, y); 1650 1650 if (tile != null && tile.visible) { 1651 1651 tileList.pushBack(tile); 1652 1652 } 1653 1653 } 1654 1654 if (x < cameraPositionTileX) { 1655 - SceneTile tile = tiles[x + 1][y]; 1655 + SceneTile tile = groundArray.getTile(z, x+1, y); 1656 1656 if (tile != null && tile.visible) { 1657 1657 tileList.pushBack(tile); 1658 1658 } 1659 1659 } 1660 1660 if (y < cameraPositionTileY) { 1661 - SceneTile tile = tiles[x][y + 1]; 1661 + SceneTile tile = groundArray.getTile(z, x, y+1); 1662 1662 if (tile != null && tile.visible) { 1663 1663 tileList.pushBack(tile); 1664 1664 } 1665 1665 } 1666 1666 if (x > cameraPositionTileX) { 1667 - SceneTile tile = tiles[x - 1][y]; 1667 + SceneTile tile = groundArray.getTile(z, x-1, y); 1668 1668 if (tile != null && tile.visible) { 1669 1669 tileList.pushBack(tile); 1670 1670 } 1671 1671 } 1672 1672 if (y > cameraPositionTileY) { 1673 - SceneTile tile = tiles[x][y - 1]; 1673 + SceneTile tile = groundArray.getTile(z, x, y-1); 1674 1674 if (tile != null && tile.visible) { 1675 1675 tileList.pushBack(tile); 1676 1676 }
+45 -45
src/main/java/com/jagex/runescape/scene/util/CollisionMap.java
··· 6 6 public int insetY; 7 7 public int width; 8 8 public int height; 9 - public int[][] adjacency; 9 + public int[][] clippingData; 10 10 11 11 public CollisionMap(int height, int width) { 12 12 insetX = 0; 13 13 insetY = 0; 14 14 this.width = width; 15 15 this.height = height; 16 - adjacency = new int[width][height]; 16 + clippingData = new int[width][height]; 17 17 reset(); 18 18 19 19 } ··· 22 22 for (int x = 0; x < width; x++) { 23 23 for (int y = 0; y < height; y++) 24 24 if (x == 0 || y == 0 || x == width - 1 || y == height - 1) 25 - adjacency[x][y] = 0xffffff; 25 + clippingData[x][y] = 0xffffff; 26 26 else 27 - adjacency[x][y] = 0x1000000; 27 + clippingData[x][y] = 0x1000000; 28 28 29 29 } 30 30 ··· 153 153 } 154 154 } 155 155 156 - public void method413(int y, int orient, int h, int w, boolean impenetrable, int x, byte byte0) { 156 + public void markSolidOccupant(int y, int orient, int h, int w, boolean impenetrable, int x, byte byte0) { 157 157 int occupied = 256; 158 158 if (impenetrable) 159 159 occupied += 0x20000; ··· 177 177 public void markBlocked(int x, int y) { 178 178 x -= insetX; 179 179 y -= insetY; 180 - adjacency[x][y] |= 0x200000; 180 + clippingData[x][y] |= 0x200000; 181 181 } 182 182 183 183 public void set(int x, int y, int flag) { 184 - adjacency[x][y] |= flag; 184 + clippingData[x][y] |= flag; 185 185 } 186 186 187 187 public void unmarkWall(int orientation, int x, int y, int position, boolean impenetrable) { ··· 327 327 } 328 328 329 329 public void unset(int x, int y, int flag) { 330 - adjacency[x][y] &= 0xffffff - flag; 330 + clippingData[x][y] &= 0xffffff - flag; 331 331 } 332 332 333 333 public void unmarkConcealed(int x, int y) { 334 334 x -= insetX; 335 335 y -= insetY; 336 - adjacency[x][y] &= 0xdfffff; 336 + clippingData[x][y] &= 0xdfffff; 337 337 } 338 338 339 339 public boolean reachedWall(int currentX, int currentY, int goalX, int goalY, int goalPosition, int goalOrientation) { ··· 347 347 if (goalOrientation == 0) { 348 348 if (currentX == goalX - 1 && currentY == goalY) 349 349 return true; 350 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x1280120) == 0) 350 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x1280120) == 0) 351 351 return true; 352 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 0x1280102) == 0) 352 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 0x1280102) == 0) 353 353 return true; 354 354 } else if (goalOrientation == 1) { 355 355 if (currentX == goalX && currentY == goalY + 1) 356 356 return true; 357 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280108) == 0) 357 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280108) == 0) 358 358 return true; 359 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280180) == 0) 359 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280180) == 0) 360 360 return true; 361 361 } else if (goalOrientation == 2) { 362 362 if (currentX == goalX + 1 && currentY == goalY) 363 363 return true; 364 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x1280120) == 0) 364 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x1280120) == 0) 365 365 return true; 366 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 0x1280102) == 0) 366 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 0x1280102) == 0) 367 367 return true; 368 368 } else if (goalOrientation == 3) { 369 369 if (currentX == goalX && currentY == goalY - 1) 370 370 return true; 371 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280108) == 0) 371 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280108) == 0) 372 372 return true; 373 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280180) == 0) 373 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280180) == 0) 374 374 return true; 375 375 } 376 376 if (goalPosition == 2) ··· 379 379 return true; 380 380 if (currentX == goalX && currentY == goalY + 1) 381 381 return true; 382 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280180) == 0) 382 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280180) == 0) 383 383 return true; 384 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 0x1280102) == 0) 384 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 0x1280102) == 0) 385 385 return true; 386 386 } else if (goalOrientation == 1) { 387 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280108) == 0) 387 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280108) == 0) 388 388 return true; 389 389 if (currentX == goalX && currentY == goalY + 1) 390 390 return true; 391 391 if (currentX == goalX + 1 && currentY == goalY) 392 392 return true; 393 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 0x1280102) == 0) 393 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 0x1280102) == 0) 394 394 return true; 395 395 } else if (goalOrientation == 2) { 396 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280108) == 0) 396 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280108) == 0) 397 397 return true; 398 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x1280120) == 0) 398 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x1280120) == 0) 399 399 return true; 400 400 if (currentX == goalX + 1 && currentY == goalY) 401 401 return true; ··· 404 404 } else if (goalOrientation == 3) { 405 405 if (currentX == goalX - 1 && currentY == goalY) 406 406 return true; 407 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x1280120) == 0) 407 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x1280120) == 0) 408 408 return true; 409 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x1280180) == 0) 409 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x1280180) == 0) 410 410 return true; 411 411 if (currentX == goalX && currentY == goalY - 1) 412 412 return true; 413 413 } 414 414 if (goalPosition == 9) { 415 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x20) == 0) 415 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x20) == 0) 416 416 return true; 417 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 2) == 0) 417 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 2) == 0) 418 418 return true; 419 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 8) == 0) 419 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 8) == 0) 420 420 return true; 421 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x80) == 0) 421 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x80) == 0) 422 422 return true; 423 423 } 424 424 return false; ··· 433 433 if (goalPosition == 7) 434 434 goalOrientation = goalOrientation + 2 & 3; 435 435 if (goalOrientation == 0) { 436 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x80) == 0) 436 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x80) == 0) 437 437 return true; 438 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 2) == 0) 438 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 2) == 0) 439 439 return true; 440 440 } else if (goalOrientation == 1) { 441 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 8) == 0) 441 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 8) == 0) 442 442 return true; 443 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 2) == 0) 443 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 2) == 0) 444 444 return true; 445 445 } else if (goalOrientation == 2) { 446 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 8) == 0) 446 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 8) == 0) 447 447 return true; 448 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x20) == 0) 448 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x20) == 0) 449 449 return true; 450 450 } else if (goalOrientation == 3) { 451 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x80) == 0) 451 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x80) == 0) 452 452 return true; 453 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x20) == 0) 453 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x20) == 0) 454 454 return true; 455 455 } 456 456 } 457 457 if (goalPosition == 8) { 458 - if (currentX == goalX && currentY == goalY + 1 && (adjacency[currentX][currentY] & 0x20) == 0) 458 + if (currentX == goalX && currentY == goalY + 1 && (clippingData[currentX][currentY] & 0x20) == 0) 459 459 return true; 460 - if (currentX == goalX && currentY == goalY - 1 && (adjacency[currentX][currentY] & 2) == 0) 460 + if (currentX == goalX && currentY == goalY - 1 && (clippingData[currentX][currentY] & 2) == 0) 461 461 return true; 462 - if (currentX == goalX - 1 && currentY == goalY && (adjacency[currentX][currentY] & 8) == 0) 462 + if (currentX == goalX - 1 && currentY == goalY && (clippingData[currentX][currentY] & 8) == 0) 463 463 return true; 464 - if (currentX == goalX + 1 && currentY == goalY && (adjacency[currentX][currentY] & 0x80) == 0) 464 + if (currentX == goalX + 1 && currentY == goalY && (clippingData[currentX][currentY] & 0x80) == 0) 465 465 return true; 466 466 } 467 467 return false; ··· 472 472 int goalY2 = (goalY + goalDY) - 1; 473 473 if (currentX >= goalX && currentX <= goalX2 && currentY >= goalY && currentY <= goalY2) 474 474 return true; 475 - if (currentX == goalX - 1 && currentY >= goalY && currentY <= goalY2 && (adjacency[currentX - insetX][currentY - insetY] & 8) == 0 475 + if (currentX == goalX - 1 && currentY >= goalY && currentY <= goalY2 && (clippingData[currentX - insetX][currentY - insetY] & 8) == 0 476 476 && (surroundings & 8) == 0) 477 477 return true; 478 - if (currentX == goalX2 + 1 && currentY >= goalY && currentY <= goalY2 && (adjacency[currentX - insetX][currentY - insetY] & 0x80) == 0 478 + if (currentX == goalX2 + 1 && currentY >= goalY && currentY <= goalY2 && (clippingData[currentX - insetX][currentY - insetY] & 0x80) == 0 479 479 && (surroundings & 2) == 0) 480 480 return true; 481 - if (currentY == goalY - 1 && currentX >= goalX && currentX <= goalX2 && (adjacency[currentX - insetX][currentY - insetY] & 2) == 0 481 + if (currentY == goalY - 1 && currentX >= goalX && currentX <= goalX2 && (clippingData[currentX - insetX][currentY - insetY] & 2) == 0 482 482 && (surroundings & 4) == 0) 483 483 return true; 484 - return currentY == goalY2 + 1 && currentX >= goalX && currentX <= goalX2 && (adjacency[currentX - insetX][currentY - insetY] & 0x20) == 0 484 + return currentY == goalY2 + 1 && currentX >= goalX && currentX <= goalX2 && (clippingData[currentX - insetX][currentY - insetY] & 0x20) == 0 485 485 && (surroundings & 1) == 0; 486 486 } 487 487
+1 -1
src/main/java/com/jagex/runescape/util/LinkedList.java
··· 83 83 } 84 84 } 85 85 86 - public void getNodeCount() { 86 + public void clear() { 87 87 if (head.next == head) 88 88 return; 89 89 do {
+3 -3
src/main/java/com/jagex/runescape/util/SignLink.java
··· 1 1 package com.jagex.runescape.util; 2 2 3 + import com.jagex.runescape.config.Configuration; 4 + 3 5 import javax.sound.midi.*; 4 6 import javax.sound.sampled.*; 5 - import java.applet.Applet; 6 7 import java.io.*; 7 8 import java.net.InetAddress; 8 9 import java.net.Socket; ··· 18 19 public static int storeId = 32; 19 20 public static RandomAccessFile cacheData = null; 20 21 public static final RandomAccessFile[] cacheIndex = new RandomAccessFile[5]; 21 - public static Applet applet = null; 22 22 private static boolean active; 23 23 private static int threadLiveId; 24 24 private static InetAddress inetAddress; ··· 205 205 try { 206 206 System.out.println("urlStream"); 207 207 208 - urlStream = new DataInputStream((new URL(applet.getCodeBase(), urlRequest)).openStream()); 208 + urlStream = new DataInputStream((new URL(new URL(Configuration.SERVER_ADDRESS), urlRequest)).openStream()); 209 209 } catch (Exception _ex) { 210 210 urlStream = null; 211 211 }
+65
src/main/java/com/jagex/runescape/world/GroundArray.java
··· 1 + package com.jagex.runescape.world; 2 + 3 + 4 + public class GroundArray<T> { 5 + private static final int MAX_HEIGHT = 4; 6 + private static final int MAX_TILES = 104; 7 + private Object[][][] groundArray; 8 + 9 + public GroundArray(T[][][] groundArray) { 10 + this.groundArray = groundArray; 11 + } 12 + 13 + public GroundArray() { 14 + this.groundArray = new Object[MAX_HEIGHT][MAX_TILES][MAX_TILES]; 15 + } 16 + 17 + private boolean checkIfIndexDoesNotExist(int plane, int x, int y) { 18 + if (plane < 0 || plane > this.groundArray.length - 1) { 19 + String error = String.format("Plane must be between 0 and %d, requested plane was: %d.\n", 20 + this.groundArray.length - 1, plane); 21 + new ArrayIndexOutOfBoundsException(error).printStackTrace(); 22 + return true; 23 + } 24 + if (x < 0 || x > MAX_TILES - 1) { 25 + String error = String.format("X must be between 0 and %d, requested x was: %d.\n", MAX_TILES - 1, x); 26 + new ArrayIndexOutOfBoundsException(error).printStackTrace(); 27 + return true; 28 + } 29 + if (y < 0 || y > MAX_TILES - 1) { 30 + String error = String.format("Y must be between 0 and %d, requested y was: %d.\n", MAX_TILES - 1, y); 31 + new ArrayIndexOutOfBoundsException(error).printStackTrace(); 32 + return true; 33 + } 34 + return false; 35 + } 36 + 37 + public boolean isTileEmpty(int plane, int x, int y) { 38 + if (checkIfIndexDoesNotExist(plane, x, y)) { 39 + return false; 40 + } 41 + return groundArray[plane][x][y] == null; 42 + } 43 + 44 + public void clearTile(int plane, int x, int y) { 45 + if (checkIfIndexDoesNotExist(plane, x, y)) { 46 + return; 47 + } 48 + groundArray[plane][x][y] = null; 49 + } 50 + 51 + public T getTile(int plane, int x, int y) { 52 + if (checkIfIndexDoesNotExist(plane, x, y)) { 53 + return null; 54 + } 55 + return (T) groundArray[plane][x][y]; 56 + } 57 + 58 + public T setTile(int plane, int x, int y, T tile) { 59 + if (checkIfIndexDoesNotExist(plane, x, y)) { 60 + return null; 61 + } 62 + groundArray[plane][x][y] = tile; 63 + return tile; 64 + } 65 + }
+64
src/test/java/com/jagex/runescape/net/BufferTests.java
··· 1 + package com.jagex.runescape.net; 2 + 3 + import org.junit.jupiter.api.Assertions; 4 + import org.junit.jupiter.api.DisplayName; 5 + import org.junit.jupiter.api.Test; 6 + import org.junit.jupiter.params.ParameterizedTest; 7 + import org.junit.jupiter.params.provider.CsvSource; 8 + 9 + import java.util.Random; 10 + 11 + public class BufferTests { 12 + 13 + @ParameterizedTest(name = "Buffer allocate") 14 + @CsvSource({ 15 + "0, 100", 16 + "1, 5000", 17 + "2, 30000", 18 + "3, 30000" 19 + }) 20 + void allocateBuffer(int sizeMode, int expectedBufferSize) { 21 + Buffer buffer = Buffer.allocate(sizeMode); 22 + Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0"); 23 + Assertions.assertArrayEquals(buffer.buffer, new byte[expectedBufferSize], "Buffer should be completely empty"); 24 + Assertions.assertEquals(expectedBufferSize, buffer.buffer.length, 25 + () -> "buffer length should be " + expectedBufferSize + " with sizeMode: " + sizeMode); 26 + 27 + } 28 + 29 + @Test 30 + @DisplayName("Byte test") 31 + void byteTest() { 32 + Buffer buffer = Buffer.allocate(0); 33 + Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0"); 34 + Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty"); 35 + 36 + Random random = new Random(); 37 + int input = random.nextInt((55 - 2) + 1) + 2; 38 + buffer.putByte(input); 39 + Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0"); 40 + buffer.currentPosition = 0; 41 + Assertions.assertEquals(input, buffer.getByte(), "getByte should be the same as putByte"); 42 + } 43 + 44 + 45 + @Test 46 + @DisplayName("ShortBE test") 47 + void smallTest() { 48 + Buffer buffer = Buffer.allocate(0); 49 + Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0"); 50 + Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty"); 51 + 52 + Random random = new Random(); 53 + int input = random.nextInt((55 - 2) + 1) + 2; 54 + buffer.putShortBE(input); 55 + Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0"); 56 + buffer.currentPosition = 0; 57 + Assertions.assertEquals(input, buffer.getShortBE(), "getShortBE should be the same as putShortBE"); 58 + buffer.putShortBE(0x2801); 59 + buffer.currentPosition--; 60 + Assertions.assertEquals(256, buffer.getShortBE(), "expect big endian behavior"); 61 + } 62 + 63 + 64 + }