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.

more refactoring

+581 -593
+455 -478
src/main/java/com/jagex/runescape/Game.java
··· 54 54 import com.jagex.runescape.world.GroundArray; 55 55 56 56 import static com.jagex.runescape.config.Configuration.*; 57 - import static com.jagex.runescape.config.IncomingPacketIds.*; 57 + import static com.jagex.runescape.config.IncomingPacket.*; 58 58 59 - @SuppressWarnings("serial") 60 59 public class Game extends GameShell { 61 60 62 61 ··· 64 63 private int[] archiveHashes = new int[9]; 65 64 private byte[][] terrainData; 66 65 private String reportedName = ""; 67 - private int[] anIntArray842 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; 66 + private int[] anIntArray842 = {0xffff00, 0xff0000, 0x00ff00, 0x00ffff, 0xff00ff, 0xffffff}; 68 67 private int[] skillExperience = new int[SkillConstants.SKILL_COUNT]; 69 - private int anInt844; 70 - private int anInt845; 71 - private int anInt846; 72 - private int anInt847; 73 - private int anInt848; 68 + private int hintIconX; 69 + private int hintIconY; 70 + private int hintIconOffset; 71 + private int markerOffsetX; 72 + private int markerOffsetY; 74 73 private String[] friendUsernames = new String[200]; 75 74 private int anInt850; 76 75 public int chatboxScroll; ··· 102 101 private int anInt877; 103 102 private int anInt878; 104 103 private int[][][] constructedMapPalette = new int[4][13][13]; 105 - private IndexedImage aClass50_Sub1_Sub1_Sub3_880; 106 - private IndexedImage aClass50_Sub1_Sub1_Sub3_881; 107 - private IndexedImage aClass50_Sub1_Sub1_Sub3_882; 108 - private IndexedImage aClass50_Sub1_Sub1_Sub3_883; 109 - private IndexedImage aClass50_Sub1_Sub1_Sub3_884; 104 + private IndexedImage imageRedstone1; 105 + private IndexedImage imageRedstone2; 106 + private IndexedImage imageRedstone3; 107 + private IndexedImage imageFlippedRedstone1; 108 + private IndexedImage imageFlippedRedstone2; 110 109 private int[][] anIntArrayArray885 = new int[104][104]; 111 110 private int[][] tileRenderCount = new int[104][104]; 112 111 private int privateChatMode; ··· 143 142 private boolean[] customCameraActive = new boolean[5]; 144 143 private Buffer tempBuffer = Buffer.allocate(1); 145 144 private long serverSeed; 146 - private int anInt931 = 0x23201b; 147 - private int anInt932 = -1; 148 - private int anInt933 = -1; 145 + private int drawX = -1; 146 + private int drawY = -1; 149 147 private int anInt935 = -1; 150 148 private String chatboxInputMessage = ""; 151 149 private int anInt939; ··· 162 160 private boolean drawTabIcons = false; 163 161 private int tickDelta; 164 162 private static int[] SKILL_EXPERIENCE; 165 - private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array954 = new ImageRGB[32]; 163 + private ImageRGB[] imageHeadIcons = new ImageRGB[32]; 166 164 private int bankInsertMode; 167 165 private String statusLineOne = ""; 168 166 private String statusLineTwo = ""; 169 - private boolean aBoolean959 = true; 170 167 private int fullscreenWidgetChildId = -1; 171 168 private int thisPlayerServerId = -1; 172 169 private static boolean accountFlagged; ··· 271 268 private boolean[] aBooleanArray1070 = new boolean[5]; 272 269 private int loadingStage; 273 270 private long[] ignores = new long[100]; 274 - private int anInt1075; 275 271 private int minimapHintCount; 276 272 private int[] minimapHintX = new int[1000]; 277 273 private int[] minimapHintY = new int[1000]; ··· 330 326 private Npc[] npcs = new Npc[16384]; 331 327 private int npcCount; 332 328 private int[] npcIds = new int[16384]; 333 - private int anInt1135 = 0x766654; 334 329 public boolean loggedIn = false; 335 330 private int renderCount; 336 331 private static int anInt1139; 337 332 private int anInt1140 = -110; 338 333 private long aLong1141; 339 334 private ImageRGB[] moderatorIcon = new ImageRGB[2]; 340 - private byte aByte1143 = -80; 341 335 private boolean characterEditChangeGenger = true; 342 336 private int[] quakeTimes = new int[5]; 343 337 private int itemSelected; ··· 367 361 private int anInt1172; 368 362 private int anInt1173; 369 363 private String selectedWidgetName; 370 - private int anInt1175 = -89; 371 364 private int[] anIntArray1176; 372 365 private int[] anIntArray1177; 373 - private int anInt1178 = 300; 374 366 private int anInt1257; 375 367 private int[] anIntArray1180 = new int[33]; 376 368 public boolean redrawTabArea = false; ··· 411 403 private int cameraVerticalRotation; 412 404 private int cameraHorizontalRotation; 413 405 private int friendsListAction; 414 - private int anInt1222; 415 406 private int anInt1223; 416 407 private Socket jaggrabSocket; 417 408 private int loginScreenState; ··· 424 415 private int anInt1233; 425 416 private int anInt1234 = 1; 426 417 private static int anInt1235; 427 - private int anInt1236 = 326; 428 418 private static int anInt1237; 429 419 private int anInt1238; 430 420 private boolean aBoolean1239 = false; ··· 473 463 private int anInt1284; 474 464 public int currentTabId = 3; 475 465 private int[] anIntArray1286 = new int[33]; 476 - private int anInt1287 = 0x332d25; 477 466 private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array1288 = new ImageRGB[32]; 478 467 private int secondaryCameraVertical; 479 468 private int[] anIntArray1290 = {17, 24, 34, 40}; ··· 708 697 SignLink.midi = "voladjust"; 709 698 } 710 699 711 - private void method14(String s, int i) { 700 + private void method14(String s) { 712 701 if (s == null || s.length() == 0) { 713 702 anInt862 = 0; 714 703 return; ··· 729 718 if (s1.length() > 0) 730 719 as[j++] = s1.toLowerCase(); 731 720 anInt862 = 0; 732 - if (i != 2) 733 - aBoolean959 = !aBoolean959; 734 721 label0: 735 722 for (int l = 0; l < ItemDefinition.count; l++) { 736 723 ItemDefinition class16 = ItemDefinition.lookup(l); ··· 895 882 aClass18_907 = null; 896 883 aClass18_908 = null; 897 884 aClass18_909 = null; 898 - aClass50_Sub1_Sub1_Sub3_880 = null; 899 - aClass50_Sub1_Sub1_Sub3_881 = null; 900 - aClass50_Sub1_Sub1_Sub3_882 = null; 901 - aClass50_Sub1_Sub1_Sub3_883 = null; 902 - aClass50_Sub1_Sub1_Sub3_884 = null; 885 + imageRedstone1 = null; 886 + imageRedstone2 = null; 887 + imageRedstone3 = null; 888 + imageFlippedRedstone1 = null; 889 + imageFlippedRedstone2 = null; 903 890 aClass50_Sub1_Sub1_Sub3_983 = null; 904 891 aClass50_Sub1_Sub1_Sub3_984 = null; 905 892 aClass50_Sub1_Sub1_Sub3_985 = null; ··· 955 942 aClass50_Sub1_Sub1_Sub1Array1182 = null; 956 943 aClass50_Sub1_Sub1_Sub1Array1288 = null; 957 944 aClass50_Sub1_Sub1_Sub1Array1079 = null; 958 - aClass50_Sub1_Sub1_Sub1Array954 = null; 945 + imageHeadIcons = null; 959 946 cursorCross = null; 960 947 stopMidi(); 961 948 outBuffer = null; ··· 1404 1391 packetReadAnticheat++; 1405 1392 if (packetReadAnticheat > 750) 1406 1393 dropClient(); 1407 - method100(0); 1408 - method67(-37214); 1394 + processPlayers(); 1395 + processNPCs(); 1409 1396 processActorOverheadText(); 1410 1397 tickDelta++; 1411 1398 if (crossType != 0) { ··· 1982 1969 thirdLastOpcode = secondLastOpcode; 1983 1970 secondLastOpcode = lastOpcode; 1984 1971 lastOpcode = opcode; 1985 - if (opcode == UPDATE_WIDGET_POSITION) { 1972 + if (UPDATE_WIDGET_POSITION.equals(opcode)) { 1986 1973 int yOffset = buffer.getShortLE(); 1987 1974 int xOffset = buffer.getShortLE(); 1988 1975 int widgetId = buffer.getUnsignedShortBE(); ··· 1992 1979 opcode = -1; 1993 1980 return true; 1994 1981 } 1995 - if (opcode == UPDATE_WIDGET_MODEL_DISPLAY) { 1982 + if (UPDATE_WIDGET_MODEL_DISPLAY.equals(opcode)) { 1996 1983 int rotationX = buffer.getUnsignedNegativeOffsetShortBE(); 1997 1984 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 1998 1985 int zoom = buffer.getUnsignedNegativeOffsetShortBE(); ··· 2003 1990 opcode = -1; 2004 1991 return true; 2005 1992 } 2006 - if (opcode == SET_WIDGET_MODEL_1) { 1993 + if (SET_WIDGET_MODEL_1.equals(opcode)) { 2007 1994 int j1 = buffer.getUnsignedNegativeOffsetShortLE(); 2008 1995 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2009 1996 Widget.forId(widgetId).modelType = 1; ··· 2011 1998 opcode = -1; 2012 1999 return true; 2013 2000 } 2014 - if (opcode == PLAY_SOUND) { 2001 + if (PLAY_SOUND.equals(opcode)) { 2015 2002 int soundId = buffer.getUnsignedShortBE(); 2016 2003 int type = buffer.getUnsignedByte(); 2017 2004 int delay = buffer.getUnsignedShortBE(); ··· 2031 2018 opcode = -1; 2032 2019 return true; 2033 2020 } 2034 - if (opcode == UPDATE_WIDGET_SETTING_SMALL) { 2021 + if (UPDATE_WIDGET_SETTING_SMALL.equals(opcode)) { 2035 2022 int settingIndex = buffer.getUnsignedNegativeOffsetShortBE(); 2036 2023 byte settingValue = buffer.getPreNegativeOffsetByte(); 2037 2024 anIntArray1005[settingIndex] = settingValue; ··· 2045 2032 opcode = -1; 2046 2033 return true; 2047 2034 } 2048 - if (opcode == RESET_MOB_ANIMATIONS) { 2035 + if (RESET_MOB_ANIMATIONS.equals(opcode)) { 2049 2036 for (int p = 0; p < players.length; p++) 2050 2037 if (players[p] != null) 2051 2038 players[p].emoteAnimation = -1; ··· 2057 2044 opcode = -1; 2058 2045 return true; 2059 2046 } 2060 - if (opcode == SET_MINIMAP_STATE) { 2047 + if (SET_MINIMAP_STATE.equals(opcode)) { 2061 2048 minimapState = buffer.getUnsignedByte(); 2062 2049 opcode = -1; 2063 2050 return true; 2064 2051 } 2065 - if (opcode == SET_WIDGET_MODEL_2) { 2052 + if (SET_WIDGET_MODEL_2.equals(opcode)) { 2066 2053 int modelId = buffer.getUnsignedNegativeOffsetShortBE(); 2067 2054 int widgetId = buffer.getUnsignedShortLE(); 2068 2055 Widget.forId(widgetId).modelType = 2; ··· 2070 2057 opcode = -1; 2071 2058 return true; 2072 2059 } 2073 - if (opcode == SHOW_CHATBOX_WIDGET) { 2060 + if (SHOW_CHATBOX_WIDGET.equals(opcode)) { 2074 2061 int chatboxWidgetId = buffer.getUnsignedShortBE(); 2075 2062 method112((byte) 36, chatboxWidgetId); 2076 2063 if (tabAreaOverlayWidgetId != -1) { ··· 2101 2088 opcode = -1; 2102 2089 return true; 2103 2090 } 2104 - if (opcode == PLAY_SONG) { 2091 + if (PLAY_SONG.equals(opcode)) { 2105 2092 int songID = buffer.getUnsignedNegativeOffsetShortLE(); 2106 2093 if (songID == 65535) 2107 2094 songID = -1; ··· 2114 2101 opcode = -1; 2115 2102 return true; 2116 2103 } 2117 - if (opcode == PLAY_TEMP_SONG) { 2104 + if (PLAY_TEMP_SONG.equals(opcode)) { 2118 2105 int temporarySong = buffer.getUnsignedShortLE(); 2119 2106 int previousSong = buffer.getMediumME(); 2120 2107 if (musicEnabled && !lowMemory) { ··· 2126 2113 opcode = -1; 2127 2114 return true; 2128 2115 } 2129 - if (opcode == SHOW_DIALOG) { 2116 + if (SHOW_DIALOG.equals(opcode)) { 2130 2117 int widgetId = buffer.getShortLE(); 2131 2118 if (widgetId != dialogueId) { 2132 2119 method44(dialogueId); ··· 2136 2123 opcode = -1; 2137 2124 return true; 2138 2125 } 2139 - if (opcode == UPDATE_WIDGET_COLOR) { 2126 + if (UPDATE_WIDGET_COLOR.equals(opcode)) { 2140 2127 int widgetId = buffer.getUnsignedShortBE(); 2141 2128 int rgb = buffer.getUnsignedNegativeOffsetShortBE(); 2142 2129 int j17 = rgb >> 10 & 0x1f; ··· 2146 2133 opcode = -1; 2147 2134 return true; 2148 2135 } 2149 - if (opcode == UPDATE_PLAYER_CONTEXT_OPTION) { 2136 + if (UPDATE_PLAYER_CONTEXT_OPTION.equals(opcode)) { 2150 2137 int slot = buffer.getUnsignedInvertedByte(); 2151 2138 String option = buffer.getString(); 2152 2139 int alwaysOnTop = buffer.getUnsignedByte(); ··· 2159 2146 opcode = -1; 2160 2147 return true; 2161 2148 } 2162 - if (opcode == SET_CHAT_INPUT_TYPE_2) { 2149 + if (SET_CHAT_INPUT_TYPE_2.equals(opcode)) { 2163 2150 messagePromptRaised = false; 2164 2151 inputType = 2; 2165 2152 inputInputMessage = ""; ··· 2167 2154 opcode = -1; 2168 2155 return true; 2169 2156 } 2170 - if (opcode == UPDATE_CHAT_SETTINGS) { 2157 + if (UPDATE_CHAT_SETTINGS.equals(opcode)) { 2171 2158 publicChatMode = buffer.getUnsignedByte(); 2172 2159 privateChatMode = buffer.getUnsignedByte(); 2173 2160 tradeMode = buffer.getUnsignedByte(); ··· 2176 2163 opcode = -1; 2177 2164 return true; 2178 2165 } 2179 - if (opcode == SHOW_HINT_ICON) { 2166 + if (SHOW_HINT_ICON.equals(opcode)) { 2180 2167 headIconDrawType = buffer.getUnsignedByte(); 2181 2168 if (headIconDrawType == 1) 2182 2169 anInt1226 = buffer.getUnsignedShortBE(); 2183 2170 if (headIconDrawType >= 2 && headIconDrawType <= 6) { 2184 2171 if (headIconDrawType == 2) { 2185 - anInt847 = 64; 2186 - anInt848 = 64; 2172 + markerOffsetX = 64; 2173 + markerOffsetY = 64; 2187 2174 } 2188 2175 if (headIconDrawType == 3) { 2189 - anInt847 = 0; 2190 - anInt848 = 64; 2176 + markerOffsetX = 0; 2177 + markerOffsetY = 64; 2191 2178 } 2192 2179 if (headIconDrawType == 4) { 2193 - anInt847 = 128; 2194 - anInt848 = 64; 2180 + markerOffsetX = 128; 2181 + markerOffsetY = 64; 2195 2182 } 2196 2183 if (headIconDrawType == 5) { 2197 - anInt847 = 64; 2198 - anInt848 = 0; 2184 + markerOffsetX = 64; 2185 + markerOffsetY = 0; 2199 2186 } 2200 2187 if (headIconDrawType == 6) { 2201 - anInt847 = 64; 2202 - anInt848 = 128; 2188 + markerOffsetX = 64; 2189 + markerOffsetY = 128; 2203 2190 } 2204 2191 headIconDrawType = 2; 2205 - anInt844 = buffer.getUnsignedShortBE(); 2206 - anInt845 = buffer.getUnsignedShortBE(); 2207 - anInt846 = buffer.getUnsignedByte(); 2192 + hintIconX = buffer.getUnsignedShortBE(); 2193 + hintIconY = buffer.getUnsignedShortBE(); 2194 + hintIconOffset = buffer.getUnsignedByte(); 2208 2195 } 2209 2196 if (headIconDrawType == 10) 2210 2197 otherPlayerId = buffer.getUnsignedShortBE(); 2211 2198 opcode = -1; 2212 2199 return true; 2213 2200 } 2214 - if (opcode == MOVE_CUTSCENE_CAMERA) { 2201 + if (MOVE_CUTSCENE_CAMERA.equals(opcode)) { 2215 2202 cutsceneActive = true; 2216 2203 anInt993 = buffer.getUnsignedByte(); 2217 2204 anInt994 = buffer.getUnsignedByte(); ··· 2236 2223 opcode = -1; 2237 2224 return true; 2238 2225 } 2239 - if (opcode == SEND_LOGOUT) { 2226 + if (SEND_LOGOUT.equals(opcode)) { 2240 2227 logout(); 2241 2228 opcode = -1; 2242 2229 return false; 2243 2230 } 2244 - if (opcode == UPDATE_WIDGET_SETTING_LARGE) { 2231 + if (UPDATE_WIDGET_SETTING_LARGE.equals(opcode)) { 2245 2232 int settingValue = buffer.getIntME2(); 2246 2233 int settingIndex = buffer.getUnsignedShortLE(); 2247 2234 anIntArray1005[settingIndex] = settingValue; ··· 2255 2242 opcode = -1; 2256 2243 return true; 2257 2244 } 2258 - if (opcode == CLOSE_ALL_WIDGETS) { 2245 + if (CLOSE_ALL_WIDGETS.equals(opcode)) { 2259 2246 if (tabAreaOverlayWidgetId != -1) { 2260 2247 method44(tabAreaOverlayWidgetId); 2261 2248 tabAreaOverlayWidgetId = -1; ··· 2288 2275 opcode = -1; 2289 2276 return true; 2290 2277 } 2291 - if (opcode == UPDATE_WELCOME_SCREEN) { // @TODO rename all these vars 2278 + if (UPDATE_WELCOME_SCREEN.equals(opcode)) { 2292 2279 lastPasswordChangeTime = buffer.getUnsignedShortLE(); 2293 2280 buffer.getUnsignedNegativeOffsetShortLE(); // Never read anywhere... Junk?... 2294 2281 buffer.getUnsignedShortBE(); // junk... ··· 2304 2291 opcode = -1; 2305 2292 return true; 2306 2293 } 2307 - if (opcode == CHATBOX_MESSAGE) { // server message 2294 + if (CHATBOX_MESSAGE.equals(opcode)) { // server message 2308 2295 String message = buffer.getString(); 2309 2296 if (message.endsWith(":tradereq:")) { 2310 2297 String s3 = message.substring(0, message.indexOf(":")); ··· 2353 2340 opcode = -1; 2354 2341 return true; 2355 2342 } 2356 - if (opcode == SHOW_WALKABLE_WIDGET) { 2343 + if (SHOW_WALKABLE_WIDGET.equals(opcode)) { 2357 2344 int widgetId = buffer.getShortBE(); 2358 2345 if (widgetId >= 0) 2359 2346 method112((byte) 36, widgetId); ··· 2364 2351 opcode = -1; 2365 2352 return true; 2366 2353 } 2367 - if (opcode == HIDE_WIDGET) { 2354 + if (HIDE_WIDGET.equals(opcode)) { 2368 2355 boolean hiddenUntilHovered = buffer.getUnsignedByte() == 1; 2369 2356 int widgetId = buffer.getUnsignedShortBE(); 2370 2357 Widget.forId(widgetId).hiddenUntilHovered = hiddenUntilHovered; 2371 2358 opcode = -1; 2372 2359 return true; 2373 2360 } 2374 - if (opcode == UPDATE_CARRY_WEIGHT) { 2361 + if (UPDATE_CARRY_WEIGHT.equals(opcode)) { 2375 2362 if (currentTabId == 12) 2376 2363 redrawTabArea = true; 2377 2364 userWeight = buffer.getShortBE(); ··· 2388 2375 opcode = -1; 2389 2376 return true; 2390 2377 } 2391 - if (opcode == SHOW_SIDEBAR_AND_GAME_WIDGET) { 2378 + if (SHOW_SIDEBAR_AND_GAME_WIDGET.equals(opcode)) { 2392 2379 int screenWidgetId = buffer.getUnsignedNegativeOffsetShortBE(); 2393 2380 int tabWidgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2394 2381 if (openChatboxWidgetId != -1) { ··· 2423 2410 opcode = -1; 2424 2411 return true; 2425 2412 } 2426 - if (opcode == CAMERA_SHAKE) { 2413 + if (CAMERA_SHAKE.equals(opcode)) { 2427 2414 int slot = buffer.getUnsignedByte(); 2428 2415 int jitter = buffer.getUnsignedByte(); 2429 2416 int amplitude = buffer.getUnsignedByte(); ··· 2436 2423 opcode = -1; 2437 2424 return true; 2438 2425 } 2439 - if (opcode == UPDATE_WIDGET_ITEMS_BY_SLOT) { 2426 + if (UPDATE_WIDGET_ITEMS_BY_SLOT.equals(opcode)) { 2440 2427 redrawTabArea = true; 2441 2428 int widgetId = buffer.getUnsignedShortBE(); 2442 2429 Widget widget = Widget.forId(widgetId); ··· 2454 2441 opcode = -1; 2455 2442 return true; 2456 2443 } 2457 - if (opcode == UPDATE_FRIEND) { // update friend status 2444 + if (UPDATE_FRIEND.equals(opcode)) { 2458 2445 long friendNameLong = buffer.getLongBE(); 2459 2446 int worldId = buffer.getUnsignedByte(); 2460 2447 String friendName = TextUtils.formatName(TextUtils.longToName(friendNameLong)); ··· 2512 2499 opcode = -1; 2513 2500 return true; 2514 2501 } 2515 - if (opcode == SET_ACTIVE_TAB) { 2502 + if (SET_ACTIVE_TAB.equals(opcode)) { 2516 2503 currentTabId = buffer.getUnsignedInvertedByte(); 2517 2504 redrawTabArea = true; 2518 2505 drawTabIcons = true; 2519 2506 opcode = -1; 2520 2507 return true; 2521 2508 } 2522 - if (opcode == CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS) { 2509 + if (CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS.equals(opcode)) { 2523 2510 placementY = buffer.getUnsignedPreNegativeOffsetByte(); 2524 2511 placementX = buffer.getUnsignedInvertedByte(); 2525 2512 for (int x = placementX; x < placementX + 8; x++) { ··· 2541 2528 opcode = -1; 2542 2529 return true; 2543 2530 } 2544 - if (opcode == SET_WIDGET_PLAYER_HEAD) { 2531 + if (SET_WIDGET_PLAYER_HEAD.equals(opcode)) { 2545 2532 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2546 2533 Widget.forId(widgetId).modelType = 3; 2547 2534 if (localPlayer.npcDefinition == null) // maybe that is the appear as npc thing? ··· 2553 2540 opcode = -1; 2554 2541 return true; 2555 2542 } 2556 - if (opcode == PRIVATE_MESSAGE_RECEIVED) { 2543 + if (PRIVATE_MESSAGE_RECEIVED.equals(opcode)) { 2557 2544 long fromPlayerIndex = buffer.getLongBE(); 2558 2545 int chatId = buffer.getIntBE(); 2559 2546 int fromPlayerRights = buffer.getUnsignedByte(); ··· 2595 2582 opcode = -1; 2596 2583 return true; 2597 2584 } 2598 - if (opcode == UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS) { 2585 + if (UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS.equals(opcode)) { 2599 2586 placementX = buffer.getUnsignedByte(); 2600 2587 placementY = buffer.getUnsignedPostNegativeOffsetByte(); 2601 2588 while (buffer.currentPosition < packetSize) { ··· 2605 2592 opcode = -1; 2606 2593 return true; 2607 2594 } 2608 - if (opcode == SHOW_GAME_WIDGET) { 2595 + if (SHOW_GAME_WIDGET.equals(opcode)) { 2609 2596 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2610 2597 method112((byte) 36, widgetId); 2611 2598 if (tabAreaOverlayWidgetId != -1) { ··· 2640 2627 opcode = -1; 2641 2628 return true; 2642 2629 } 2643 - if (opcode == SHOW_SIDEBAR_OVERLAY_WIDGET) { 2630 + if (SHOW_SIDEBAR_OVERLAY_WIDGET.equals(opcode)) { 2644 2631 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2645 2632 method112((byte) 36, widgetId); 2646 2633 if (openChatboxWidgetId != -1) { ··· 2675 2662 opcode = -1; 2676 2663 return true; 2677 2664 } 2678 - if (opcode == UPDATE_SKILL) { 2665 + if (UPDATE_SKILL.equals(opcode)) { 2679 2666 redrawTabArea = true; 2680 2667 int skillIndex = buffer.getUnsignedInvertedByte(); 2681 2668 int level = buffer.getUnsignedByte(); ··· 2690 2677 opcode = -1; 2691 2678 return true; 2692 2679 } 2693 - if (opcode == UPDATE_ALL_WIDGET_ITEMS) { // update all items in interface 2680 + if (UPDATE_ALL_WIDGET_ITEMS.equals(opcode)) { 2694 2681 redrawTabArea = true; 2695 2682 int widgetId = buffer.getUnsignedShortBE(); 2696 2683 Widget widget = Widget.forId(widgetId); ··· 2711 2698 opcode = -1; 2712 2699 return true; 2713 2700 } 2714 - if (opcode == UPDATE_ACTIVE_MAP_REGION || opcode == CONSTRUCT_MAP_REGION) { 2701 + if (UPDATE_ACTIVE_MAP_REGION.equals(opcode) || CONSTRUCT_MAP_REGION.equals(opcode)) { 2715 2702 int tmpChunkX = chunkX; 2716 2703 int tmpChunkY = chunkY; 2717 - if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2704 + if (UPDATE_ACTIVE_MAP_REGION.equals(opcode)) { 2718 2705 tmpChunkY = buffer.getUnsignedShortBE(); 2719 2706 tmpChunkX = buffer.getUnsignedNegativeOffsetShortLE(); 2720 2707 loadGeneratedMap = false; 2721 2708 } 2722 - if (opcode == CONSTRUCT_MAP_REGION) { 2709 + if (CONSTRUCT_MAP_REGION.equals(opcode)) { 2723 2710 tmpChunkX = buffer.getUnsignedNegativeOffsetShortBE(); 2724 2711 buffer.initBitAccess(); 2725 2712 for (int z = 0; z < 4; z++) { ··· 2756 2743 loadingStage = 1; 2757 2744 loadRegionTime = System.currentTimeMillis(); 2758 2745 method125(null, "Loading - please wait."); 2759 - if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2746 + if (UPDATE_ACTIVE_MAP_REGION.equals(opcode)) { 2760 2747 int count = 0; 2761 2748 for (int fileX = (chunkX - 6) / 8; fileX <= (chunkX + 6) / 8; fileX++) { 2762 2749 for (int fileY = (chunkY - 6) / 8; fileY <= (chunkY + 6) / 8; fileY++) ··· 2792 2779 } 2793 2780 2794 2781 } 2795 - if (opcode == CONSTRUCT_MAP_REGION) { 2782 + if (CONSTRUCT_MAP_REGION.equals(opcode)) { 2796 2783 int uniqueCount = 0; 2797 2784 int[] fileIndices = new int[676]; 2798 2785 for (int tileZ = 0; tileZ < 4; tileZ++) { ··· 2917 2904 opcode = -1; 2918 2905 return true; 2919 2906 } 2920 - if (opcode == SYSTEM_UPDATE) { 2907 + if (SYSTEM_UPDATE.equals(opcode)) { 2921 2908 systemUpdateTime = buffer.getUnsignedShortLE() * 30; 2922 2909 opcode = -1; 2923 2910 return true; 2924 2911 } 2925 - if (opcode == PLAY_POSITION_SOUND || opcode == UPDATE_GROUND_ITEM_AMOUNT || opcode == 203 || opcode == SET_PLAYER_GROUND_ITEM 2926 - || opcode == SHOW_STILL_GRAPHICS || opcode == SHOW_PROJECTILE || opcode == REMOVE_GROUND_ITEM 2927 - || opcode == SET_GROUND_ITEM || opcode == 142 || opcode == REMOVE_LANDSCAPE_OBJECT || opcode == SET_LANDSCAPE_OBJECT) { 2912 + if (PLAY_POSITION_SOUND.equals(opcode) || UPDATE_GROUND_ITEM_AMOUNT.equals(opcode) || opcode == 203 || SET_PLAYER_GROUND_ITEM.equals(opcode) 2913 + || SHOW_STILL_GRAPHICS.equals(opcode) || SHOW_PROJECTILE.equals(opcode) || REMOVE_GROUND_ITEM.equals(opcode) 2914 + || SET_GROUND_ITEM.equals(opcode) || opcode == 142 || REMOVE_LANDSCAPE_OBJECT.equals(opcode) || SET_LANDSCAPE_OBJECT.equals(opcode)) { 2928 2915 parsePlacementPacket(buffer, opcode); 2929 2916 opcode = -1; 2930 2917 return true; 2931 2918 } 2932 - if (opcode == UPDATE_RUN_ENERGY) { 2919 + if (UPDATE_RUN_ENERGY.equals(opcode)) { 2933 2920 if (currentTabId == 12) 2934 2921 redrawTabArea = true; 2935 2922 runEnergy = buffer.getUnsignedByte(); 2936 2923 opcode = -1; 2937 2924 return true; 2938 2925 } 2939 - if (opcode == SET_WIDGET_ITEM_MODEL) { 2926 + if (SET_WIDGET_ITEM_MODEL.equals(opcode)) { 2940 2927 int scale = buffer.getUnsignedShortBE(); 2941 2928 int itemId = buffer.getUnsignedShortLE(); 2942 2929 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); ··· 2970 2957 opcode = -1; 2971 2958 return true; 2972 2959 } 2973 - if (opcode == SET_WIDGET_ANIMATION) { 2960 + if (SET_WIDGET_ANIMATION.equals(opcode)) { 2974 2961 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 2975 2962 int animationId = buffer.getNegativeOffsetShortBE(); 2976 2963 Widget widget = Widget.forId(widgetId); ··· 2982 2969 opcode = -1; 2983 2970 return true; 2984 2971 } 2985 - if (opcode == NPC_UPDATING) { 2972 + if (NPC_UPDATING.equals(opcode)) { 2986 2973 updateNpcs(buffer, aBoolean1038, packetSize); 2987 2974 opcode = -1; 2988 2975 return true; 2989 2976 } 2990 - if (opcode == UPDATE_IGNORE_LIST) { 2977 + if (UPDATE_IGNORE_LIST.equals(opcode)) { 2991 2978 ignoresCount = packetSize / 8; 2992 2979 for (int i = 0; i < ignoresCount; i++) 2993 2980 ignores[i] = buffer.getLongBE(); ··· 2995 2982 opcode = -1; 2996 2983 return true; 2997 2984 } 2998 - if (opcode == SET_TAB_WIDGET) { 2985 + if (SET_TAB_WIDGET.equals(opcode)) { 2999 2986 int sidebarIndex = buffer.getUnsignedPreNegativeOffsetByte(); 3000 2987 int widgetId = buffer.getUnsignedNegativeOffsetShortBE(); 3001 2988 if (widgetId == 65535) ··· 3009 2996 opcode = -1; 3010 2997 return true; 3011 2998 } 3012 - if (opcode == CLEAR_WIDGET_ITEMS) { 2999 + if (CLEAR_WIDGET_ITEMS.equals(opcode)) { 3013 3000 int widgetId = buffer.getUnsignedShortLE(); 3014 3001 Widget widget = Widget.forId(widgetId); 3015 3002 for (int k21 = 0; k21 < widget.items.length; k21++) { ··· 3020 3007 opcode = -1; 3021 3008 return true; 3022 3009 } 3023 - if (opcode == FLASH_TAB_ICON) { 3010 + if (FLASH_TAB_ICON.equals(opcode)) { 3024 3011 flashingTabId = buffer.getUnsignedByte(); 3025 3012 if (flashingTabId == currentTabId) { 3026 3013 if (flashingTabId == 3) ··· 3032 3019 opcode = -1; 3033 3020 return true; 3034 3021 } 3035 - if (opcode == RESET_CUTSCENE_CAMERA) { 3022 + if (RESET_CUTSCENE_CAMERA.equals(opcode)) { 3036 3023 cutsceneActive = false; 3037 3024 for (int j9 = 0; j9 < 5; j9++) 3038 3025 customCameraActive[j9] = false; ··· 3040 3027 opcode = -1; 3041 3028 return true; 3042 3029 } 3043 - if (opcode == UPDATE_MEMBERSHIP_AND_WORLD_INDEX) { 3030 + if (UPDATE_MEMBERSHIP_AND_WORLD_INDEX.equals(opcode)) { 3044 3031 playerMembers = buffer.getUnsignedByte(); 3045 3032 thisPlayerServerId = buffer.getUnsignedShortLE(); 3046 3033 opcode = -1; 3047 3034 return true; 3048 3035 } 3049 - if (opcode == SEND_REFERENCE_POSITION) { 3036 + if (SEND_REFERENCE_POSITION.equals(opcode)) { 3050 3037 placementX = buffer.getUnsignedInvertedByte(); 3051 3038 placementY = buffer.getUnsignedPostNegativeOffsetByte(); 3052 3039 opcode = -1; 3053 3040 return true; 3054 3041 } 3055 - if (opcode == SHOW_FULLSCREEN_WIDGET) { 3042 + if (SHOW_FULLSCREEN_WIDGET.equals(opcode)) { 3056 3043 int fullscreenWidgetChildId = buffer.getUnsignedShortLE(); 3057 3044 int fullscreenWidgetId = buffer.getUnsignedNegativeOffsetShortBE(); 3058 3045 method112((byte) 36, fullscreenWidgetId); ··· 3083 3070 opcode = -1; 3084 3071 return true; 3085 3072 } 3086 - if (opcode == UPDATE_FRIEND_LIST_STATUS) { 3073 + if (UPDATE_FRIEND_LIST_STATUS.equals(opcode)) { 3087 3074 friendListStatus = buffer.getUnsignedByte(); 3088 3075 redrawTabArea = true; 3089 3076 opcode = -1; ··· 3097 3084 opcode = -1; 3098 3085 return true; 3099 3086 } 3100 - if (opcode == PLAYER_UPDATING) { 3087 + if (PLAYER_UPDATING.equals(opcode)) { 3101 3088 updatePlayers(packetSize, buffer); 3102 3089 loadingMap = false; 3103 3090 opcode = -1; 3104 3091 return true; 3105 3092 } 3106 - if (opcode == RESET_WIDGET_SETTINGS) { 3093 + if (RESET_WIDGET_SETTINGS.equals(opcode)) { 3107 3094 for (int i = 0; i < widgetSettings.length; i++) 3108 3095 if (widgetSettings[i] != anIntArray1005[i]) { 3109 3096 widgetSettings[i] = anIntArray1005[i]; ··· 3114 3101 opcode = -1; 3115 3102 return true; 3116 3103 } 3117 - if (opcode == UPDATE_WIDGET_STRING) { 3104 + if (UPDATE_WIDGET_STRING.equals(opcode)) { 3118 3105 int widgetId = buffer.getUnsignedNegativeOffsetShortLE(); 3119 3106 String newText = buffer.getString(); 3120 3107 Widget.forId(widgetId).disabledText = newText; ··· 3123 3110 opcode = -1; 3124 3111 return true; 3125 3112 } 3126 - if (opcode == UPDATE_WIDGET_SCROLL_POSITION) { 3113 + if (UPDATE_WIDGET_SCROLL_POSITION.equals(opcode)) { 3127 3114 int widgetId = buffer.getUnsignedShortBE(); 3128 3115 int scrollPosition = buffer.getUnsignedNegativeOffsetShortLE(); 3129 3116 Widget widget = Widget.forId(widgetId); ··· 4276 4263 private void method56(boolean flag, int i, int j, int k, int l, int i1) { 4277 4264 scrollbarUp.drawImage(j, i1); 4278 4265 scrollbarDown.drawImage(j, (i1 + k) - 16); 4266 + int anInt931 = 0x23201b; 4279 4267 Rasterizer.drawFilledRectangle(j, i1 + 16, 16, k - 32, anInt931); 4280 4268 int j1 = ((k - 32) * k) / l; 4281 4269 if (j1 < 8) 4282 4270 j1 = 8; 4283 4271 int k1 = ((k - 32 - j1) * i) / (l - k); 4284 4272 Rasterizer.drawFilledRectangle(j, i1 + 16 + k1, 16, j1, anInt1080); 4273 + int anInt1135 = 0x766654; 4285 4274 Rasterizer.drawVerticalLine(j, i1 + 16 + k1, j1, anInt1135); 4286 4275 Rasterizer.drawVerticalLine(j + 1, i1 + 16 + k1, j1, anInt1135); 4287 4276 Rasterizer.drawHorizontalLine(j, i1 + 16 + k1, 16, anInt1135); 4288 4277 Rasterizer.drawHorizontalLine(j, i1 + 17 + k1, 16, anInt1135); 4289 - Rasterizer.drawVerticalLine(j + 15, i1 + 16 + k1, j1, anInt1287); 4290 - Rasterizer.drawVerticalLine(j + 14, i1 + 17 + k1, j1 - 1, anInt1287); 4291 - Rasterizer.drawHorizontalLine(j, i1 + 15 + k1 + j1, 16, anInt1287); 4292 - Rasterizer.drawHorizontalLine(j + 1, i1 + 14 + k1 + j1, 15, anInt1287); 4278 + Rasterizer.drawVerticalLine(j + 15, i1 + 16 + k1, j1, 0x332d25); 4279 + Rasterizer.drawVerticalLine(j + 14, i1 + 17 + k1, j1 - 1, 0x332d25); 4280 + Rasterizer.drawHorizontalLine(j, i1 + 15 + k1 + j1, 16, 0x332d25); 4281 + Rasterizer.drawHorizontalLine(j + 1, i1 + 14 + k1 + j1, 15, 0x332d25); 4293 4282 } 4294 4283 4295 4284 private void renderNPCs(boolean flag) { ··· 4597 4586 if ((i1 & 1) != 0) { 4598 4587 npc.npcDefinition = ActorDefinition.getDefinition(buffer.getUnsignedNegativeOffsetShortBE()); 4599 4588 npc.boundaryDimension = npc.npcDefinition.boundaryDimension; 4600 - npc.anInt1600 = npc.npcDefinition.degreesToTurn; 4589 + npc.turnSpeed = npc.npcDefinition.degreesToTurn; 4601 4590 npc.walkAnimationId = npc.npcDefinition.walkAnimationId; 4602 4591 npc.turnAroundAnimationId = npc.npcDefinition.turnAroundAnimationId; 4603 4592 npc.turnRightAnimationId = npc.npcDefinition.turnRightAnimationId; ··· 4623 4612 npc.spotGraphicHeight = k1 >> 16; 4624 4613 npc.spotGraphicDelay = pulseCycle + (k1 & 0xffff); 4625 4614 npc.currentAnimation = 0; 4626 - npc.anInt1616 = 0; 4615 + npc.animationCycle = 0; 4627 4616 if (npc.spotGraphicDelay > pulseCycle) 4628 4617 npc.currentAnimation = -1; 4629 4618 if (npc.graphic == 65535) ··· 4634 4623 npc.textCycle = 100; 4635 4624 } 4636 4625 if ((i1 & 8) != 0) { 4637 - npc.anInt1598 = buffer.getUnsignedNegativeOffsetShortLE(); 4638 - npc.anInt1599 = buffer.getUnsignedShortLE(); 4626 + npc.faceX = buffer.getUnsignedNegativeOffsetShortLE(); 4627 + npc.faceY = buffer.getUnsignedShortLE(); 4639 4628 } 4640 4629 if ((i1 & 2) != 0) { 4641 4630 int l1 = buffer.getUnsignedShortBE(); ··· 4646 4635 int i3 = AnimationSequence.animations[l1].anInt307; 4647 4636 if (i3 == 1) { 4648 4637 npc.displayedEmoteFrames = 0; 4649 - npc.anInt1626 = 0; 4638 + npc.animationSequence = 0; 4650 4639 npc.animationDelay = k2; 4651 - npc.anInt1628 = 0; 4640 + npc.animationResetCycle = 0; 4652 4641 } 4653 4642 if (i3 == 2) 4654 - npc.anInt1628 = 0; 4643 + npc.animationResetCycle = 0; 4655 4644 } else if (l1 == -1 4656 4645 || npc.emoteAnimation == -1 4657 4646 || AnimationSequence.animations[l1].anInt301 >= AnimationSequence.animations[npc.emoteAnimation].anInt301) { 4658 4647 npc.emoteAnimation = l1; 4659 4648 npc.displayedEmoteFrames = 0; 4660 - npc.anInt1626 = 0; 4649 + npc.animationSequence = 0; 4661 4650 npc.animationDelay = k2; 4662 - npc.anInt1628 = 0; 4663 - npc.anInt1613 = npc.pathLength; 4651 + npc.animationResetCycle = 0; 4652 + npc.stillPathPosition = npc.pathLength; 4664 4653 } 4665 4654 } 4666 4655 if ((i1 & 0x10) != 0) { ··· 4689 4678 4690 4679 if (mode == 1) { 4691 4680 player.displayedEmoteFrames = 0; 4692 - player.anInt1626 = 0; 4681 + player.animationSequence = 0; 4693 4682 player.animationDelay = delay; 4694 - player.anInt1628 = 0; 4683 + player.animationResetCycle = 0; 4695 4684 } 4696 4685 4697 4686 if (mode == 2) 4698 - player.anInt1628 = 0; 4687 + player.animationResetCycle = 0; 4699 4688 } else if (animation == -1 || player.emoteAnimation == -1 4700 4689 || AnimationSequence.animations[animation].anInt301 >= AnimationSequence.animations[player.emoteAnimation].anInt301) { 4701 4690 player.emoteAnimation = animation; 4702 4691 player.displayedEmoteFrames = 0; 4703 - player.anInt1626 = 0; 4692 + player.animationSequence = 0; 4704 4693 player.animationDelay = delay; 4705 - player.anInt1628 = 0; 4706 - player.anInt1613 = player.pathLength; 4694 + player.animationResetCycle = 0; 4695 + player.stillPathPosition = player.pathLength; 4707 4696 } 4708 4697 } 4709 4698 ··· 4723 4712 } 4724 4713 4725 4714 if ((mask & 0x100) != 0) { 4726 - player.anInt1602 = buffer.getUnsignedPostNegativeOffsetByte(); 4727 - player.anInt1604 = buffer.getUnsignedInvertedByte(); 4728 - player.anInt1603 = buffer.getUnsignedPreNegativeOffsetByte(); 4729 - player.anInt1605 = buffer.getUnsignedByte(); 4730 - player.anInt1606 = buffer.getUnsignedShortBE() + pulseCycle; 4731 - player.anInt1607 = buffer.getUnsignedNegativeOffsetShortBE() + pulseCycle; 4732 - player.anInt1608 = buffer.getUnsignedByte(); 4715 + player.movementStartX = buffer.getUnsignedPostNegativeOffsetByte(); 4716 + player.movementStartY = buffer.getUnsignedInvertedByte(); 4717 + player.movementEndX = buffer.getUnsignedPreNegativeOffsetByte(); 4718 + player.movementEndY = buffer.getUnsignedByte(); 4719 + player.moveCycleEnd = buffer.getUnsignedShortBE() + pulseCycle; 4720 + player.moveCycleStart = buffer.getUnsignedNegativeOffsetShortBE() + pulseCycle; 4721 + player.moveDirection = buffer.getUnsignedByte(); 4733 4722 4734 4723 player.resetPath(); 4735 4724 } ··· 4742 4731 } 4743 4732 4744 4733 if ((mask & 2) != 0) { 4745 - player.anInt1598 = buffer.getUnsignedShortBE(); 4746 - player.anInt1599 = buffer.getUnsignedShortBE(); 4734 + player.faceX = buffer.getUnsignedShortBE(); 4735 + player.faceY = buffer.getUnsignedShortBE(); 4747 4736 } 4748 4737 4749 4738 if ((mask & 0x200) != 0) { ··· 4752 4741 player.spotGraphicHeight = heightAndDelay >> 16; 4753 4742 player.spotGraphicDelay = pulseCycle + (heightAndDelay & 0xffff); 4754 4743 player.currentAnimation = 0; 4755 - player.anInt1616 = 0; 4744 + player.animationCycle = 0; 4756 4745 4757 4746 if (player.spotGraphicDelay > pulseCycle) 4758 4747 player.currentAnimation = -1; ··· 5135 5124 aClass50_Sub1_Sub1_Sub1Array1079[i] = new ImageRGB(archiveMedia, "headicons_prayer", i); 5136 5125 5137 5126 for (int i = 0; i < 6; i++) 5138 - aClass50_Sub1_Sub1_Sub1Array954[i] = new ImageRGB(archiveMedia, "headicons_hint", i); 5127 + imageHeadIcons[i] = new ImageRGB(archiveMedia, "headicons_hint", i); 5139 5128 5140 5129 aClass50_Sub1_Sub1_Sub1_1086 = new ImageRGB(archiveMedia, "overlay_multiway", 0); 5141 5130 mapFlagMarker = new ImageRGB(archiveMedia, "mapmarker", 0); ··· 5151 5140 mapdotTeammate = new ImageRGB(archiveMedia, "mapdots", 4); 5152 5141 scrollbarUp = new IndexedImage(archiveMedia, "scrollbar", 0); 5153 5142 scrollbarDown = new IndexedImage(archiveMedia, "scrollbar", 1); 5154 - aClass50_Sub1_Sub1_Sub3_880 = new IndexedImage(archiveMedia, "redstone1", 0); 5155 - aClass50_Sub1_Sub1_Sub3_881 = new IndexedImage(archiveMedia, "redstone2", 0); 5156 - aClass50_Sub1_Sub1_Sub3_882 = new IndexedImage(archiveMedia, "redstone3", 0); 5157 - aClass50_Sub1_Sub1_Sub3_883 = new IndexedImage(archiveMedia, "redstone1", 0); 5158 - aClass50_Sub1_Sub1_Sub3_883.flipHorizontal(); 5143 + imageRedstone1 = new IndexedImage(archiveMedia, "redstone1", 0); 5144 + imageRedstone2 = new IndexedImage(archiveMedia, "redstone2", 0); 5145 + imageRedstone3 = new IndexedImage(archiveMedia, "redstone3", 0); 5146 + imageFlippedRedstone1 = new IndexedImage(archiveMedia, "redstone1", 0); 5147 + imageFlippedRedstone1.flipHorizontal(); 5159 5148 5160 - aClass50_Sub1_Sub1_Sub3_884 = new IndexedImage(archiveMedia, "redstone2", 0); 5161 - aClass50_Sub1_Sub1_Sub3_884.flipHorizontal(); 5149 + imageFlippedRedstone2 = new IndexedImage(archiveMedia, "redstone2", 0); 5150 + imageFlippedRedstone2.flipHorizontal(); 5162 5151 5163 5152 aClass50_Sub1_Sub1_Sub3_983 = new IndexedImage(archiveMedia, "redstone1", 0); 5164 5153 aClass50_Sub1_Sub1_Sub3_983.flipVertical(); ··· 5594 5583 5595 5584 } 5596 5585 5597 - private void method67(int i) { 5598 - for (int j = 0; j < npcCount; j++) { 5599 - int k = npcIds[j]; 5600 - Npc class50_sub1_sub4_sub3_sub1 = npcs[k]; 5601 - if (class50_sub1_sub4_sub3_sub1 != null) 5602 - method68(class50_sub1_sub4_sub3_sub1.npcDefinition.boundaryDimension, (byte) -97, class50_sub1_sub4_sub3_sub1); 5586 + private void processNPCs() { 5587 + for (int i = 0; i < npcCount; i++) { 5588 + int npcIndex = npcIds[i]; 5589 + Npc npc = npcs[npcIndex]; 5590 + if (npc != null) 5591 + processActor(npc); 5603 5592 } 5604 - 5605 - if (i != -37214) 5606 - outBuffer.putByte(41); 5607 5593 } 5608 5594 5609 - private void method68(int i, byte byte0, Actor class50_sub1_sub4_sub3) { 5610 - if (class50_sub1_sub4_sub3.worldX < 128 || class50_sub1_sub4_sub3.worldY < 128 5611 - || class50_sub1_sub4_sub3.worldX >= 13184 || class50_sub1_sub4_sub3.worldY >= 13184) { 5612 - class50_sub1_sub4_sub3.emoteAnimation = -1; 5613 - class50_sub1_sub4_sub3.graphic = -1; 5614 - class50_sub1_sub4_sub3.anInt1606 = 0; 5615 - class50_sub1_sub4_sub3.anInt1607 = 0; 5616 - class50_sub1_sub4_sub3.worldX = class50_sub1_sub4_sub3.pathX[0] * 128 5617 - + class50_sub1_sub4_sub3.boundaryDimension * 64; 5618 - class50_sub1_sub4_sub3.worldY = class50_sub1_sub4_sub3.pathY[0] * 128 5619 - + class50_sub1_sub4_sub3.boundaryDimension * 64; 5620 - class50_sub1_sub4_sub3.resetPath(); 5595 + private void processActor(Actor actor) { 5596 + if (actor.worldX < 128 || actor.worldY < 128 5597 + || actor.worldX >= 13184 || actor.worldY >= 13184) { 5598 + actor.emoteAnimation = -1; 5599 + actor.graphic = -1; 5600 + actor.moveCycleEnd = 0; 5601 + actor.moveCycleStart = 0; 5602 + actor.worldX = actor.pathX[0] * 128 5603 + + actor.boundaryDimension * 64; 5604 + actor.worldY = actor.pathY[0] * 128 5605 + + actor.boundaryDimension * 64; 5606 + actor.resetPath(); 5621 5607 } 5622 - if (class50_sub1_sub4_sub3 == localPlayer 5623 - && (class50_sub1_sub4_sub3.worldX < 1536 || class50_sub1_sub4_sub3.worldY < 1536 5624 - || class50_sub1_sub4_sub3.worldX >= 11776 || class50_sub1_sub4_sub3.worldY >= 11776)) { 5625 - class50_sub1_sub4_sub3.emoteAnimation = -1; 5626 - class50_sub1_sub4_sub3.graphic = -1; 5627 - class50_sub1_sub4_sub3.anInt1606 = 0; 5628 - class50_sub1_sub4_sub3.anInt1607 = 0; 5629 - class50_sub1_sub4_sub3.worldX = class50_sub1_sub4_sub3.pathX[0] * 128 5630 - + class50_sub1_sub4_sub3.boundaryDimension * 64; 5631 - class50_sub1_sub4_sub3.worldY = class50_sub1_sub4_sub3.pathY[0] * 128 5632 - + class50_sub1_sub4_sub3.boundaryDimension * 64; 5633 - class50_sub1_sub4_sub3.resetPath(); 5608 + if (actor == localPlayer 5609 + && (actor.worldX < 1536 || actor.worldY < 1536 5610 + || actor.worldX >= 11776 || actor.worldY >= 11776)) { 5611 + actor.emoteAnimation = -1; 5612 + actor.graphic = -1; 5613 + actor.moveCycleEnd = 0; 5614 + actor.moveCycleStart = 0; 5615 + actor.worldX = actor.pathX[0] * 128 5616 + + actor.boundaryDimension * 64; 5617 + actor.worldY = actor.pathY[0] * 128 5618 + + actor.boundaryDimension * 64; 5619 + actor.resetPath(); 5634 5620 } 5635 - if (class50_sub1_sub4_sub3.anInt1606 > pulseCycle) 5636 - method69(class50_sub1_sub4_sub3); 5637 - else if (class50_sub1_sub4_sub3.anInt1607 >= pulseCycle) 5638 - method70(class50_sub1_sub4_sub3, -31135); 5621 + if (actor.moveCycleEnd > pulseCycle) 5622 + processActorLateMovement(actor); 5623 + else if (actor.moveCycleStart >= pulseCycle) 5624 + processActorMovementVariables(actor); 5639 5625 else 5640 - method71(class50_sub1_sub4_sub3, 0); 5641 - method72(class50_sub1_sub4_sub3); 5642 - method73(class50_sub1_sub4_sub3); 5643 - if (byte0 == -97) 5644 - ; 5626 + processActorMovement(actor, 0); 5627 + processActorRotation(actor); 5628 + processActorSequence(actor); 5629 + 5645 5630 } 5646 5631 5647 - private void method69(Actor class50_sub1_sub4_sub3) { 5648 - int i = class50_sub1_sub4_sub3.anInt1606 - pulseCycle; 5649 - int j = class50_sub1_sub4_sub3.anInt1602 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5650 - int k = class50_sub1_sub4_sub3.anInt1604 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5651 - class50_sub1_sub4_sub3.worldX += (j - class50_sub1_sub4_sub3.worldX) / i; 5652 - class50_sub1_sub4_sub3.worldY += (k - class50_sub1_sub4_sub3.worldY) / i; 5653 - class50_sub1_sub4_sub3.anInt1623 = 0; 5654 - if (class50_sub1_sub4_sub3.anInt1608 == 0) 5655 - class50_sub1_sub4_sub3.nextStepOrientation = 1024; 5656 - if (class50_sub1_sub4_sub3.anInt1608 == 1) 5657 - class50_sub1_sub4_sub3.nextStepOrientation = 1536; 5658 - if (class50_sub1_sub4_sub3.anInt1608 == 2) 5659 - class50_sub1_sub4_sub3.nextStepOrientation = 0; 5660 - if (class50_sub1_sub4_sub3.anInt1608 == 3) 5661 - class50_sub1_sub4_sub3.nextStepOrientation = 512; 5632 + private void processActorLateMovement(Actor actor) { 5633 + int dt = actor.moveCycleEnd - pulseCycle; 5634 + int destX = actor.movementStartX * 128 + actor.boundaryDimension * 64; 5635 + int destY = actor.movementStartY * 128 + actor.boundaryDimension * 64; 5636 + actor.worldX += (destX - actor.worldX) / dt; 5637 + actor.worldY += (destY - actor.worldY) / dt; 5638 + actor.resyncWalkCycle = 0; 5639 + if (actor.moveDirection == 0) 5640 + actor.nextStepOrientation = 1024; 5641 + if (actor.moveDirection == 1) 5642 + actor.nextStepOrientation = 1536; 5643 + if (actor.moveDirection == 2) 5644 + actor.nextStepOrientation = 0; 5645 + if (actor.moveDirection == 3) 5646 + actor.nextStepOrientation = 512; 5662 5647 } 5663 5648 5664 - private void method70(Actor class50_sub1_sub4_sub3, int i) { 5665 - if (class50_sub1_sub4_sub3.anInt1607 == pulseCycle 5666 - || class50_sub1_sub4_sub3.emoteAnimation == -1 5667 - || class50_sub1_sub4_sub3.animationDelay != 0 5668 - || class50_sub1_sub4_sub3.anInt1626 + 1 > AnimationSequence.animations[class50_sub1_sub4_sub3.emoteAnimation] 5669 - .getFrameLength(class50_sub1_sub4_sub3.displayedEmoteFrames)) { 5670 - int j = class50_sub1_sub4_sub3.anInt1607 - class50_sub1_sub4_sub3.anInt1606; 5671 - int k = pulseCycle - class50_sub1_sub4_sub3.anInt1606; 5672 - int l = class50_sub1_sub4_sub3.anInt1602 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5673 - int i1 = class50_sub1_sub4_sub3.anInt1604 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5674 - int j1 = class50_sub1_sub4_sub3.anInt1603 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5675 - int k1 = class50_sub1_sub4_sub3.anInt1605 * 128 + class50_sub1_sub4_sub3.boundaryDimension * 64; 5676 - class50_sub1_sub4_sub3.worldX = (l * (j - k) + j1 * k) / j; 5677 - class50_sub1_sub4_sub3.worldY = (i1 * (j - k) + k1 * k) / j; 5649 + private void processActorMovementVariables(Actor actor) { 5650 + if (actor.moveCycleStart == pulseCycle 5651 + || actor.emoteAnimation == -1 5652 + || actor.animationDelay != 0 5653 + || actor.animationSequence + 1 > AnimationSequence.animations[actor.emoteAnimation] 5654 + .getFrameLength(actor.displayedEmoteFrames)) { 5655 + int walkDt = actor.moveCycleStart - actor.moveCycleEnd; 5656 + int dt = pulseCycle - actor.moveCycleEnd; 5657 + int startX = actor.movementStartX * 128 + actor.boundaryDimension * 64; 5658 + int startY = actor.movementStartY * 128 + actor.boundaryDimension * 64; 5659 + int endX = actor.movementEndX * 128 + actor.boundaryDimension * 64; 5660 + int endY = actor.movementEndY * 128 + actor.boundaryDimension * 64; 5661 + actor.worldX = (startX * (walkDt - dt) + endX * dt) / walkDt; 5662 + actor.worldY = (startY * (walkDt - dt) + endY * dt) / walkDt; 5678 5663 } 5679 - class50_sub1_sub4_sub3.anInt1623 = 0; 5680 - if (class50_sub1_sub4_sub3.anInt1608 == 0) 5681 - class50_sub1_sub4_sub3.nextStepOrientation = 1024; 5682 - if (class50_sub1_sub4_sub3.anInt1608 == 1) 5683 - class50_sub1_sub4_sub3.nextStepOrientation = 1536; 5684 - if (class50_sub1_sub4_sub3.anInt1608 == 2) 5685 - class50_sub1_sub4_sub3.nextStepOrientation = 0; 5686 - if (class50_sub1_sub4_sub3.anInt1608 == 3) 5687 - class50_sub1_sub4_sub3.nextStepOrientation = 512; 5688 - class50_sub1_sub4_sub3.currentRotation = class50_sub1_sub4_sub3.nextStepOrientation; 5689 - if (i == -31135) 5690 - ; 5664 + actor.resyncWalkCycle = 0; 5665 + if (actor.moveDirection == 0) 5666 + actor.nextStepOrientation = 1024; 5667 + if (actor.moveDirection == 1) 5668 + actor.nextStepOrientation = 1536; 5669 + if (actor.moveDirection == 2) 5670 + actor.nextStepOrientation = 0; 5671 + if (actor.moveDirection == 3) 5672 + actor.nextStepOrientation = 512; 5673 + actor.currentRotation = actor.nextStepOrientation; 5691 5674 } 5692 5675 5693 - private void method71(Actor actor, int i) { 5676 + private void processActorMovement(Actor actor, int i) { 5694 5677 actor.movementAnimation = actor.idleAnimation; 5695 5678 if (actor.pathLength == 0) { 5696 - actor.anInt1623 = 0; 5679 + actor.resyncWalkCycle = 0; 5697 5680 return; 5698 5681 } 5699 5682 if (actor.emoteAnimation != -1 && actor.animationDelay == 0) { 5700 - AnimationSequence class14 = AnimationSequence.animations[actor.emoteAnimation]; 5701 - if (actor.anInt1613 > 0 && class14.anInt305 == 0) { 5702 - actor.anInt1623++; 5683 + AnimationSequence animationSequence = AnimationSequence.animations[actor.emoteAnimation]; 5684 + if (actor.stillPathPosition > 0 && animationSequence.speedFlag == 0) { 5685 + actor.resyncWalkCycle++; 5703 5686 return; 5704 5687 } 5705 - if (actor.anInt1613 <= 0 && class14.priority == 0) { 5706 - actor.anInt1623++; 5688 + if (actor.stillPathPosition <= 0 && animationSequence.priority == 0) { 5689 + actor.resyncWalkCycle++; 5707 5690 return; 5708 5691 } 5709 5692 } 5710 - int j = actor.worldX; 5711 - int k = actor.worldY; 5712 - int l = actor.pathX[actor.pathLength - 1] * 128 5693 + int sceneX = actor.worldX; 5694 + int sceneY = actor.worldY; 5695 + int destX = actor.pathX[actor.pathLength - 1] * 128 5713 5696 + actor.boundaryDimension * 64; 5714 - int i1 = actor.pathY[actor.pathLength - 1] * 128 5697 + int destY = actor.pathY[actor.pathLength - 1] * 128 5715 5698 + actor.boundaryDimension * 64; 5716 - if (l - j > 256 || l - j < -256 || i1 - k > 256 || i1 - k < -256) { 5717 - actor.worldX = l; 5718 - actor.worldY = i1; 5699 + if (destX - sceneX > 256 || destX - sceneX < -256 || destY - sceneY > 256 || destY - sceneY < -256) { 5700 + actor.worldX = destX; 5701 + actor.worldY = destY; 5719 5702 return; 5720 5703 } 5721 - if (j < l) { 5722 - if (k < i1) 5704 + if (sceneX < destX) { 5705 + if (sceneY < destY) 5723 5706 actor.nextStepOrientation = 1280; 5724 - else if (k > i1) 5707 + else if (sceneY > destY) 5725 5708 actor.nextStepOrientation = 1792; 5726 5709 else 5727 5710 actor.nextStepOrientation = 1536; 5728 - } else if (j > l) { 5729 - if (k < i1) 5711 + } else if (sceneX > destX) { 5712 + if (sceneY < destY) 5730 5713 actor.nextStepOrientation = 768; 5731 - else if (k > i1) 5714 + else if (sceneY > destY) 5732 5715 actor.nextStepOrientation = 256; 5733 5716 else 5734 5717 actor.nextStepOrientation = 512; 5735 - } else if (k < i1) 5718 + } else if (sceneY < destY) 5736 5719 actor.nextStepOrientation = 1024; 5737 5720 else 5738 5721 actor.nextStepOrientation = 0; 5739 - int j1 = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5740 - if (j1 > 1024) 5741 - j1 -= 2048; 5742 - int k1 = actor.turnAroundAnimationId; 5722 + int angleDifference = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5723 + if (angleDifference > 1024) 5724 + angleDifference -= 2048; 5725 + int index = actor.turnAroundAnimationId; 5743 5726 if (i != 0) 5744 5727 outBuffer.putByte(34); 5745 - if (j1 >= -256 && j1 <= 256) 5746 - k1 = actor.walkAnimationId; 5747 - else if (j1 >= 256 && j1 < 768) 5748 - k1 = actor.turnLeftAnimationId; 5749 - else if (j1 >= -768 && j1 <= -256) 5750 - k1 = actor.turnRightAnimationId; 5751 - if (k1 == -1) 5752 - k1 = actor.walkAnimationId; 5753 - actor.movementAnimation = k1; 5754 - int l1 = 4; 5728 + if (angleDifference >= -256 && angleDifference <= 256) 5729 + index = actor.walkAnimationId; 5730 + else if (angleDifference >= 256 && angleDifference < 768) 5731 + index = actor.turnLeftAnimationId; 5732 + else if (angleDifference >= -768 && angleDifference <= -256) 5733 + index = actor.turnRightAnimationId; 5734 + if (index == -1) 5735 + index = actor.walkAnimationId; 5736 + actor.movementAnimation = index; 5737 + int speed = 4; 5755 5738 if (actor.currentRotation != actor.nextStepOrientation 5756 - && actor.faceActor == -1 && actor.anInt1600 != 0) 5757 - l1 = 2; 5739 + && actor.faceActor == -1 && actor.turnSpeed != 0) 5740 + speed = 2; 5758 5741 if (actor.pathLength > 2) 5759 - l1 = 6; 5742 + speed = 6; 5760 5743 if (actor.pathLength > 3) 5761 - l1 = 8; 5762 - if (actor.anInt1623 > 0 && actor.pathLength > 1) { 5763 - l1 = 8; 5764 - actor.anInt1623--; 5744 + speed = 8; 5745 + if (actor.resyncWalkCycle > 0 && actor.pathLength > 1) { 5746 + speed = 8; 5747 + actor.resyncWalkCycle--; 5765 5748 } 5766 5749 if (actor.runningQueue[actor.pathLength - 1]) 5767 - l1 <<= 1; 5768 - if (l1 >= 8 && actor.movementAnimation == actor.walkAnimationId 5750 + speed <<= 1; 5751 + if (speed >= 8 && actor.movementAnimation == actor.walkAnimationId 5769 5752 && actor.runAnimationId != -1) 5770 5753 actor.movementAnimation = actor.runAnimationId; 5771 - if (j < l) { 5772 - actor.worldX += l1; 5773 - if (actor.worldX > l) 5774 - actor.worldX = l; 5775 - } else if (j > l) { 5776 - actor.worldX -= l1; 5777 - if (actor.worldX < l) 5778 - actor.worldX = l; 5754 + if (sceneX < destX) { 5755 + actor.worldX += speed; 5756 + if (actor.worldX > destX) 5757 + actor.worldX = destX; 5758 + } else if (sceneX > destX) { 5759 + actor.worldX -= speed; 5760 + if (actor.worldX < destX) 5761 + actor.worldX = destX; 5779 5762 } 5780 - if (k < i1) { 5781 - actor.worldY += l1; 5782 - if (actor.worldY > i1) 5783 - actor.worldY = i1; 5784 - } else if (k > i1) { 5785 - actor.worldY -= l1; 5786 - if (actor.worldY < i1) 5787 - actor.worldY = i1; 5763 + if (sceneY < destY) { 5764 + actor.worldY += speed; 5765 + if (actor.worldY > destY) 5766 + actor.worldY = destY; 5767 + } else if (sceneY > destY) { 5768 + actor.worldY -= speed; 5769 + if (actor.worldY < destY) 5770 + actor.worldY = destY; 5788 5771 } 5789 - if (actor.worldX == l && actor.worldY == i1) { 5772 + if (actor.worldX == destX && actor.worldY == destY) { 5790 5773 actor.pathLength--; 5791 - if (actor.anInt1613 > 0) 5792 - actor.anInt1613--; 5774 + if (actor.stillPathPosition > 0) 5775 + actor.stillPathPosition--; 5793 5776 } 5794 5777 } 5795 5778 5796 - private void method72(Actor actor) { 5797 - if (actor.anInt1600 == 0) 5779 + private void processActorRotation(Actor actor) { 5780 + if (actor.turnSpeed == 0) 5798 5781 return; 5799 5782 if (actor.faceActor != -1 && actor.faceActor < 32768) { 5800 5783 Npc npc = npcs[actor.faceActor]; 5801 5784 if (npc != null) { 5802 - int l = actor.worldX - npc.worldX; 5803 - int j1 = actor.worldY - npc.worldY; 5804 - if (l != 0 || j1 != 0) 5805 - actor.nextStepOrientation = (int) (Math.atan2(l, j1) * 325.94900000000001D) & 0x7ff; 5785 + int dx = actor.worldX - npc.worldX; 5786 + int dy = actor.worldY - npc.worldY; 5787 + if (dx != 0 || dy != 0) 5788 + actor.nextStepOrientation = (int) (Math.atan2(dx, dy) * 325.94900000000001D) & 0x7ff; 5806 5789 } 5807 5790 } 5808 5791 if (actor.faceActor >= 32768) { 5809 - int i = actor.faceActor - 32768; 5810 - if (i == thisPlayerServerId) 5811 - i = thisPlayerId; 5812 - Player player = players[i]; 5792 + int playerIndex = actor.faceActor - 32768; 5793 + if (playerIndex == thisPlayerServerId) 5794 + playerIndex = thisPlayerId; 5795 + Player player = players[playerIndex]; 5813 5796 if (player != null) { 5814 - int k1 = actor.worldX - player.worldX; 5815 - int l1 = actor.worldY - player.worldY; 5816 - if (k1 != 0 || l1 != 0) 5817 - actor.nextStepOrientation = (int) (Math.atan2(k1, l1) * 325.94900000000001D) & 0x7ff; 5797 + int dx = actor.worldX - player.worldX; 5798 + int dy = actor.worldY - player.worldY; 5799 + if (dx != 0 || dy != 0) 5800 + actor.nextStepOrientation = (int) (Math.atan2(dx, dy) * 325.94900000000001D) & 0x7ff; 5818 5801 } 5819 5802 } 5820 - if ((actor.anInt1598 != 0 || actor.anInt1599 != 0) 5821 - && (actor.pathLength == 0 || actor.anInt1623 > 0)) { 5822 - int j = actor.worldX - (actor.anInt1598 - nextTopLeftTileX - nextTopLeftTileX) * 64; 5823 - int i1 = actor.worldY - (actor.anInt1599 - nextTopRightTileY - nextTopRightTileY) * 64; 5824 - if (j != 0 || i1 != 0) 5825 - actor.nextStepOrientation = (int) (Math.atan2(j, i1) * 325.94900000000001D) & 0x7ff; 5826 - actor.anInt1598 = 0; 5827 - actor.anInt1599 = 0; 5803 + if ((actor.faceX != 0 || actor.faceY != 0) 5804 + && (actor.pathLength == 0 || actor.resyncWalkCycle > 0)) { 5805 + int dx = actor.worldX - (actor.faceX - nextTopLeftTileX - nextTopLeftTileX) * 64; 5806 + int dy = actor.worldY - (actor.faceY - nextTopRightTileY - nextTopRightTileY) * 64; 5807 + if (dx != 0 || dy != 0) 5808 + actor.nextStepOrientation = (int) (Math.atan2(dx, dy) * 325.94900000000001D) & 0x7ff; 5809 + actor.faceX = 0; 5810 + actor.faceY = 0; 5828 5811 } 5829 - int k = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5830 - if (k != 0) { 5831 - if (k < actor.anInt1600 || k > 2048 - actor.anInt1600) 5812 + int da = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5813 + if (da != 0) { 5814 + if (da < actor.turnSpeed || da > 2048 - actor.turnSpeed) 5832 5815 actor.currentRotation = actor.nextStepOrientation; 5833 - else if (k > 1024) 5834 - actor.currentRotation -= actor.anInt1600; 5816 + else if (da > 1024) 5817 + actor.currentRotation -= actor.turnSpeed; 5835 5818 else 5836 - actor.currentRotation += actor.anInt1600; 5819 + actor.currentRotation += actor.turnSpeed; 5837 5820 actor.currentRotation &= 0x7ff; 5838 5821 if (actor.movementAnimation == actor.idleAnimation 5839 5822 && actor.currentRotation != actor.nextStepOrientation) { ··· 5846 5829 } 5847 5830 } 5848 5831 5849 - private void method73(Actor actor) { 5832 + private void processActorSequence(Actor actor) { 5850 5833 actor.dynamic = false; 5851 5834 if (actor.movementAnimation != -1) { 5852 - AnimationSequence class14 = AnimationSequence.animations[actor.movementAnimation]; 5853 - actor.anInt1590++; 5854 - if (actor.displayedMovementFrames < class14.frameCount 5855 - && actor.anInt1590 > class14.getFrameLength(actor.displayedMovementFrames)) { 5856 - actor.anInt1590 = 1; 5835 + AnimationSequence animation = AnimationSequence.animations[actor.movementAnimation]; 5836 + actor.movementCycle++; 5837 + if (actor.displayedMovementFrames < animation.frameCount 5838 + && actor.movementCycle > animation.getFrameLength(actor.displayedMovementFrames)) { 5839 + actor.movementCycle = 1; 5857 5840 actor.displayedMovementFrames++; 5858 5841 } 5859 - if (actor.displayedMovementFrames >= class14.frameCount) { 5860 - actor.anInt1590 = 1; 5842 + if (actor.displayedMovementFrames >= animation.frameCount) { 5843 + actor.movementCycle = 1; 5861 5844 actor.displayedMovementFrames = 0; 5862 5845 } 5863 5846 } 5864 5847 if (actor.graphic != -1 && pulseCycle >= actor.spotGraphicDelay) { 5865 5848 if (actor.currentAnimation < 0) 5866 5849 actor.currentAnimation = 0; 5867 - AnimationSequence class14_1 = SpotAnimation.cache[actor.graphic].sequences; 5868 - actor.anInt1616++; 5869 - if (actor.currentAnimation < class14_1.frameCount 5870 - && actor.anInt1616 > class14_1.getFrameLength(actor.currentAnimation)) { 5871 - actor.anInt1616 = 1; 5850 + AnimationSequence animationSequence = SpotAnimation.cache[actor.graphic].sequences; 5851 + actor.animationCycle++; 5852 + if (actor.currentAnimation < animationSequence.frameCount 5853 + && actor.animationCycle > animationSequence.getFrameLength(actor.currentAnimation)) { 5854 + actor.animationCycle = 1; 5872 5855 actor.currentAnimation++; 5873 5856 } 5874 - if (actor.currentAnimation >= class14_1.frameCount 5875 - && (actor.currentAnimation < 0 || actor.currentAnimation >= class14_1.frameCount)) 5857 + if (actor.currentAnimation >= animationSequence.frameCount 5858 + && (actor.currentAnimation < 0 || actor.currentAnimation >= animationSequence.frameCount)) 5876 5859 actor.graphic = -1; 5877 5860 } 5878 5861 if (actor.emoteAnimation != -1 && actor.animationDelay <= 1) { 5879 - AnimationSequence class14_2 = AnimationSequence.animations[actor.emoteAnimation]; 5880 - if (class14_2.anInt305 == 1 && actor.anInt1613 > 0 5881 - && actor.anInt1606 <= pulseCycle && actor.anInt1607 < pulseCycle) { 5862 + AnimationSequence animation = AnimationSequence.animations[actor.emoteAnimation]; 5863 + if (animation.speedFlag == 1 && actor.stillPathPosition > 0 5864 + && actor.moveCycleEnd <= pulseCycle && actor.moveCycleStart < pulseCycle) { 5882 5865 actor.animationDelay = 1; 5883 5866 return; 5884 5867 } 5885 5868 } 5886 5869 if (actor.emoteAnimation != -1 && actor.animationDelay == 0) { 5887 - AnimationSequence class14_3 = AnimationSequence.animations[actor.emoteAnimation]; 5888 - actor.anInt1626++; 5889 - if (actor.displayedEmoteFrames < class14_3.frameCount 5890 - && actor.anInt1626 > class14_3.getFrameLength(actor.displayedEmoteFrames)) { 5891 - actor.anInt1626 = 1; 5870 + AnimationSequence animation = AnimationSequence.animations[actor.emoteAnimation]; 5871 + actor.animationSequence++; 5872 + if (actor.displayedEmoteFrames < animation.frameCount 5873 + && actor.animationSequence > animation.getFrameLength(actor.displayedEmoteFrames)) { 5874 + actor.animationSequence = 1; 5892 5875 actor.displayedEmoteFrames++; 5893 5876 } 5894 - if (actor.displayedEmoteFrames >= class14_3.frameCount) { 5895 - actor.displayedEmoteFrames -= class14_3.frameStep; 5896 - actor.anInt1628++; 5897 - if (actor.anInt1628 >= class14_3.anInt304) 5877 + if (actor.displayedEmoteFrames >= animation.frameCount) { 5878 + actor.displayedEmoteFrames -= animation.frameStep; 5879 + actor.animationResetCycle++; 5880 + if (actor.animationResetCycle >= animation.resetCycle) 5898 5881 actor.emoteAnimation = -1; 5899 - if (actor.displayedEmoteFrames < 0 || actor.displayedEmoteFrames >= class14_3.frameCount) 5882 + if (actor.displayedEmoteFrames < 0 || actor.displayedEmoteFrames >= animation.frameCount) 5900 5883 actor.emoteAnimation = -1; 5901 5884 } 5902 - actor.dynamic = class14_3.aBoolean300; 5885 + actor.dynamic = animation.dynamic; 5903 5886 } 5904 5887 if (actor.animationDelay > 0) 5905 5888 actor.animationDelay--; ··· 6048 6031 if (tabAreaOverlayWidgetId == -1) { 6049 6032 if (tabWidgetIds[currentTabId] != -1) { 6050 6033 if (currentTabId == 0) 6051 - aClass50_Sub1_Sub1_Sub3_880.drawImage(22, 10); 6034 + imageRedstone1.drawImage(22, 10); 6052 6035 if (currentTabId == 1) 6053 - aClass50_Sub1_Sub1_Sub3_881.drawImage(54, 8); 6036 + imageRedstone2.drawImage(54, 8); 6054 6037 if (currentTabId == 2) 6055 - aClass50_Sub1_Sub1_Sub3_881.drawImage(82, 8); 6038 + imageRedstone2.drawImage(82, 8); 6056 6039 if (currentTabId == 3) 6057 - aClass50_Sub1_Sub1_Sub3_882.drawImage(110, 8); 6040 + imageRedstone3.drawImage(110, 8); 6058 6041 if (currentTabId == 4) 6059 - aClass50_Sub1_Sub1_Sub3_884.drawImage(153, 8); 6042 + imageFlippedRedstone2.drawImage(153, 8); 6060 6043 if (currentTabId == 5) 6061 - aClass50_Sub1_Sub1_Sub3_884.drawImage(181, 8); 6044 + imageFlippedRedstone2.drawImage(181, 8); 6062 6045 if (currentTabId == 6) 6063 - aClass50_Sub1_Sub1_Sub3_883.drawImage(209, 9); 6046 + imageFlippedRedstone1.drawImage(209, 9); 6064 6047 } 6065 6048 if (tabWidgetIds[0] != -1 && (flashingTabId != 0 || pulseCycle % 20 < 10)) 6066 6049 tabIcon[0].drawImage(29, 13); ··· 6958 6941 fontBold.drawStringLeft(inputInputMessage + "*", 239, 60, 128); 6959 6942 } else if (inputType == 3) { 6960 6943 if (!inputInputMessage.equals(aString861)) { 6961 - method14(inputInputMessage, 2); 6944 + method14(inputInputMessage); 6962 6945 aString861 = inputInputMessage; 6963 6946 } 6964 6947 ··· 7347 7330 } 7348 7331 7349 7332 if (headIconDrawType == 2) { 7350 - int hintX = ((anInt844 - nextTopLeftTileX) * 4 + 2) - localPlayer.worldX / 32; 7351 - int hintY = ((anInt845 - nextTopRightTileY) * 4 + 2) - localPlayer.worldY / 32; 7333 + int hintX = ((hintIconX - nextTopLeftTileX) * 4 + 2) - localPlayer.worldX / 32; 7334 + int hintY = ((hintIconY - nextTopRightTileY) * 4 + 2) - localPlayer.worldY / 32; 7352 7335 7353 7336 drawMinimap(aClass50_Sub1_Sub1_Sub1_1037, hintX, hintY); 7354 7337 } ··· 7470 7453 anInt1129 = anInt1315; 7471 7454 return; 7472 7455 } 7473 - method111(anInt1178); 7456 + method111(); 7474 7457 anInt915 = 0; 7475 7458 anInt1315 = 0; 7476 7459 if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338) ··· 7933 7916 flameRightBackground.drawGraphics(637, 0, super.gameGraphics); 7934 7917 } 7935 7918 7936 - private void method100(int i) { 7937 - for (int j = -1; j < localPlayerCount; j++) { 7938 - int k; 7939 - if (j == -1) 7940 - k = thisPlayerId; 7941 - else 7942 - k = playerList[j]; 7943 - Player class50_sub1_sub4_sub3_sub2 = players[k]; 7944 - if (class50_sub1_sub4_sub3_sub2 != null) 7945 - method68(1, (byte) -97, class50_sub1_sub4_sub3_sub2); 7919 + private void processPlayers() { 7920 + for (int i = -1; i < localPlayerCount; i++) { 7921 + int index; 7922 + if (i == -1) { 7923 + index = thisPlayerId; 7924 + } else { 7925 + index = playerList[i]; 7926 + } 7927 + Player p = players[index]; 7928 + if (p != null) { 7929 + processActor(p); 7930 + } 7946 7931 } 7947 7932 7948 - if (i < anInt1222 || i > anInt1222) { 7949 - for (int l = 1; l > 0; l++) ; 7950 - } 7951 7933 } 7952 7934 7953 7935 private void updateWidget(Widget widget) { ··· 8518 8500 // return super.getAppletContext(); 8519 8501 // } 8520 8502 8521 - private void method111(int i) { 8522 - i = 21 / i; 8503 + private void method111() { 8523 8504 if (anInt1223 == 0) 8524 8505 return; 8525 8506 int j = 0; ··· 9779 9760 redrawTabArea = true; 9780 9761 } 9781 9762 9782 - private void method121(boolean flag) { 9763 + private void drawScene2d(boolean flag) { 9783 9764 anInt939 = 0; 9784 9765 for (int i = -1; i < localPlayerCount + npcCount; i++) { 9785 9766 Object obj; ··· 9802 9783 int k = 30; 9803 9784 Player class50_sub1_sub4_sub3_sub2 = (Player) obj; 9804 9785 if (class50_sub1_sub4_sub3_sub2.isSkulled != -1 || class50_sub1_sub4_sub3_sub2.headIcon != -1) { 9805 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9806 - if (anInt932 > -1) { 9786 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight + 15); 9787 + if (drawX > -1) { 9807 9788 if (class50_sub1_sub4_sub3_sub2.isSkulled != -1) { 9808 - aClass50_Sub1_Sub1_Sub1Array1288[class50_sub1_sub4_sub3_sub2.isSkulled].drawImage(anInt932 - 12, anInt933 9789 + aClass50_Sub1_Sub1_Sub1Array1288[class50_sub1_sub4_sub3_sub2.isSkulled].drawImage(drawX - 12, drawY 9809 9790 - k); 9810 9791 k += 25; 9811 9792 } 9812 9793 if (class50_sub1_sub4_sub3_sub2.headIcon != -1) { 9813 - aClass50_Sub1_Sub1_Sub1Array1079[class50_sub1_sub4_sub3_sub2.headIcon].drawImage(anInt932 - 12, anInt933 9794 + aClass50_Sub1_Sub1_Sub1Array1079[class50_sub1_sub4_sub3_sub2.headIcon].drawImage(drawX - 12, drawY 9814 9795 - k); 9815 9796 k += 25; 9816 9797 } 9817 9798 } 9818 9799 } 9819 9800 if (i >= 0 && headIconDrawType == 10 && otherPlayerId == playerList[i]) { 9820 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9821 - if (anInt932 > -1) 9822 - aClass50_Sub1_Sub1_Sub1Array954[1].drawImage(anInt932 - 12, anInt933 - k); 9801 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight + 15); 9802 + if (drawX > -1) 9803 + imageHeadIcons[1].drawImage(drawX - 12, drawY - k); 9823 9804 } 9824 9805 } else { 9825 9806 ActorDefinition class37_1 = ((Npc) obj).npcDefinition; 9826 9807 if (class37_1.headIcon >= 0 && class37_1.headIcon < aClass50_Sub1_Sub1_Sub1Array1079.length) { 9827 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9828 - if (anInt932 > -1) 9829 - aClass50_Sub1_Sub1_Sub1Array1079[class37_1.headIcon].drawImage(anInt932 - 12, anInt933 - 30 9808 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight + 15); 9809 + if (drawX > -1) 9810 + aClass50_Sub1_Sub1_Sub1Array1079[class37_1.headIcon].drawImage(drawX - 12, drawY - 30 9830 9811 ); 9831 9812 } 9832 9813 if (headIconDrawType == 1 && anInt1226 == npcIds[i - localPlayerCount] && pulseCycle % 20 < 10) { 9833 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9834 - if (anInt932 > -1) 9835 - aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt932 - 12, anInt933 - 28); 9814 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight + 15); 9815 + if (drawX > -1) 9816 + imageHeadIcons[0].drawImage(drawX - 12, drawY - 28); 9836 9817 } 9837 9818 } 9838 9819 if (((Actor) (obj)).forcedChat != null 9839 9820 && (i >= localPlayerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 9840 9821 && hasFriend(((Player) obj).playerName))) { 9841 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight); 9842 - if (anInt932 > -1 && anInt939 < anInt940) { 9822 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight); 9823 + if (drawX > -1 && anInt939 < anInt940) { 9843 9824 anIntArray944[anInt939] = fontBold.getDisplayedWidth(((Actor) (obj)).forcedChat 9844 9825 ) / 2; 9845 9826 anIntArray943[anInt939] = fontBold.characterDefaultHeight; 9846 - anIntArray941[anInt939] = anInt932; 9847 - anIntArray942[anInt939] = anInt933; 9827 + anIntArray941[anInt939] = drawX; 9828 + anIntArray942[anInt939] = drawY; 9848 9829 anIntArray945[anInt939] = ((Actor) (obj)).textColour; 9849 9830 anIntArray946[anInt939] = ((Actor) (obj)).textEffect; 9850 9831 anIntArray947[anInt939] = ((Actor) (obj)).textCycle; ··· 9860 9841 } 9861 9842 } 9862 9843 if (((Actor) (obj)).endCycle > pulseCycle) { 9863 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight + 15); 9864 - if (anInt932 > -1) { 9844 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight + 15); 9845 + if (drawX > -1) { 9865 9846 int l = (((Actor) (obj)).anInt1596 * 30) / ((Actor) (obj)).anInt1597; 9866 9847 if (l > 30) 9867 9848 l = 30; 9868 - Rasterizer.drawFilledRectangle(anInt932 - 15, anInt933 - 3, l, 5, 65280); 9869 - Rasterizer.drawFilledRectangle((anInt932 - 15) + l, anInt933 - 3, 30 - l, 5, 0xff0000); 9849 + Rasterizer.drawFilledRectangle(drawX - 15, drawY - 3, l, 5, 65280); 9850 + Rasterizer.drawFilledRectangle((drawX - 15) + l, drawY - 3, 30 - l, 5, 0xff0000); 9870 9851 } 9871 9852 } 9872 9853 for (int i1 = 0; i1 < 4; i1++) 9873 9854 if (((Actor) (obj)).hitCycles[i1] > pulseCycle) { 9874 - method136(((Actor) (obj)), false, ((Actor) (obj)).modelHeight / 2); 9875 - if (anInt932 > -1) { 9855 + setDrawXY(((Actor) (obj)), ((Actor) (obj)).modelHeight / 2); 9856 + if (drawX > -1) { 9876 9857 if (i1 == 1) 9877 - anInt933 -= 20; 9858 + drawY -= 20; 9878 9859 if (i1 == 2) { 9879 - anInt932 -= 15; 9880 - anInt933 -= 10; 9860 + drawX -= 15; 9861 + drawY -= 10; 9881 9862 } 9882 9863 if (i1 == 3) { 9883 - anInt932 += 15; 9884 - anInt933 -= 10; 9864 + drawX += 15; 9865 + drawY -= 10; 9885 9866 } 9886 9867 aClass50_Sub1_Sub1_Sub1Array1182[((Actor) (obj)).hitTypes[i1]].drawImage( 9887 - anInt932 - 12, anInt933 - 12); 9868 + drawX - 12, drawY - 12); 9888 9869 fontSmall.drawStringLeft(String 9889 - .valueOf(((Actor) (obj)).hitDamages[i1]), anInt932, anInt933 + 4, 0); 9870 + .valueOf(((Actor) (obj)).hitDamages[i1]), drawX, drawY + 4, 0); 9890 9871 fontSmall.drawStringLeft(String 9891 - .valueOf(((Actor) (obj)).hitDamages[i1]), anInt932 - 1, anInt933 + 3, 0xffffff); 9872 + .valueOf(((Actor) (obj)).hitDamages[i1]), drawX - 1, drawY + 3, 0xffffff); 9892 9873 } 9893 9874 } 9894 9875 ··· 9912 9893 } 9913 9894 9914 9895 } 9915 - anInt932 = anIntArray941[j]; 9916 - anInt933 = anIntArray942[j] = k1; 9896 + drawX = anIntArray941[j]; 9897 + drawY = anIntArray942[j] = k1; 9917 9898 String s = aStringArray948[j]; 9918 9899 if (anInt998 == 0) { 9919 9900 int k2 = 0xffff00; ··· 9953 9934 k2 = 0xffffff - 0x50000 * (j3 - 100); 9954 9935 } 9955 9936 if (anIntArray946[j] == 0) { 9956 - fontBold.drawStringLeft(s, anInt932, anInt933 + 1, 0); 9957 - fontBold.drawStringLeft(s, anInt932, anInt933, k2); 9937 + fontBold.drawStringLeft(s, drawX, drawY + 1, 0); 9938 + fontBold.drawStringLeft(s, drawX, drawY, k2); 9958 9939 } 9959 9940 if (anIntArray946[j] == 1) { 9960 - fontBold.drawCenteredStringWaveY(s, anInt932, anInt933 + 1, renderCount, 0); 9961 - fontBold.drawCenteredStringWaveY(s, anInt932, anInt933, renderCount, k2); 9941 + fontBold.drawCenteredStringWaveY(s, drawX, drawY + 1, renderCount, 0); 9942 + fontBold.drawCenteredStringWaveY(s, drawX, drawY, renderCount, k2); 9962 9943 } 9963 9944 if (anIntArray946[j] == 2) { 9964 - fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933 + 1, renderCount, 0); 9965 - fontBold.drawCeneteredStringWaveXY(s, anInt932, anInt933, renderCount, k2); 9945 + fontBold.drawCeneteredStringWaveXY(s, drawX, drawY + 1, renderCount, 0); 9946 + fontBold.drawCeneteredStringWaveXY(s, drawX, drawY, renderCount, k2); 9966 9947 } 9967 9948 if (anIntArray946[j] == 3) { 9968 - fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933 + 1, renderCount, 150 - anIntArray947[j], 0 9949 + fontBold.drawCenteredStringWaveXYMove(s, drawX, drawY + 1, renderCount, 150 - anIntArray947[j], 0 9969 9950 ); 9970 - fontBold.drawCenteredStringWaveXYMove(s, anInt932, anInt933, renderCount, 150 - anIntArray947[j], k2 9951 + fontBold.drawCenteredStringWaveXYMove(s, drawX, drawY, renderCount, 150 - anIntArray947[j], k2 9971 9952 ); 9972 9953 } 9973 9954 if (anIntArray946[j] == 4) { 9974 9955 int k3 = fontBold.getDisplayedWidth(s); 9975 9956 int i4 = ((150 - anIntArray947[j]) * (k3 + 100)) / 150; 9976 - Rasterizer.setCoordinates(0, anInt932 - 50, 334, anInt932 + 50); 9977 - fontBold.drawString(s, (anInt932 + 50) - i4, anInt933 + 1, 0); 9978 - fontBold.drawString(s, (anInt932 + 50) - i4, anInt933, k2); 9957 + Rasterizer.setCoordinates(0, drawX - 50, 334, drawX + 50); 9958 + fontBold.drawString(s, (drawX + 50) - i4, drawY + 1, 0); 9959 + fontBold.drawString(s, (drawX + 50) - i4, drawY, k2); 9979 9960 Rasterizer.resetCoordinates(); 9980 9961 } 9981 9962 if (anIntArray946[j] == 5) { ··· 9985 9966 j4 = l3 - 25; 9986 9967 else if (l3 > 125) 9987 9968 j4 = l3 - 125; 9988 - Rasterizer.setCoordinates(anInt933 - fontBold.characterDefaultHeight - 1, 0, anInt933 + 5, 9969 + Rasterizer.setCoordinates(drawY - fontBold.characterDefaultHeight - 1, 0, drawY + 5, 9989 9970 512); 9990 - fontBold.drawStringLeft(s, anInt932, anInt933 + 1 + j4, 0); 9991 - fontBold.drawStringLeft(s, anInt932, anInt933 + j4, k2); 9971 + fontBold.drawStringLeft(s, drawX, drawY + 1 + j4, 0); 9972 + fontBold.drawStringLeft(s, drawX, drawY + j4, k2); 9992 9973 Rasterizer.resetCoordinates(); 9993 9974 } 9994 9975 } else { 9995 - fontBold.drawStringLeft(s, anInt932, anInt933 + 1, 0); 9996 - fontBold.drawStringLeft(s, anInt932, anInt933, 0xffff00); 9976 + fontBold.drawStringLeft(s, drawX, drawY + 1, 0); 9977 + fontBold.drawStringLeft(s, drawX, drawY, 0xffff00); 9997 9978 } 9998 9979 } 9999 9980 ··· 10165 10146 return j == 762; 10166 10147 } 10167 10148 10168 - private void method127() { 10149 + private void drawMarker() { 10169 10150 if (headIconDrawType != 2) 10170 10151 return; 10171 - method137((anInt844 - nextTopLeftTileX << 7) + anInt847, anInt846 * 2, (anInt845 - nextTopRightTileY << 7) + anInt848, -214); 10172 - if (anInt932 > -1 && pulseCycle % 20 < 10) 10173 - aClass50_Sub1_Sub1_Sub1Array954[0].drawImage(anInt932 - 12, anInt933 - 28); 10152 + setDrawXY((hintIconX - nextTopLeftTileX << 7) + markerOffsetX, (hintIconY - nextTopRightTileY << 7) + markerOffsetY, hintIconOffset * 2); 10153 + if (drawX > -1 && pulseCycle % 20 < 10) 10154 + imageHeadIcons[0].drawImage(drawX - 12, drawY - 28); 10174 10155 } 10175 10156 10176 10157 public void repaintGame() { ··· 10457 10438 int j1 = buffer.getBits(1); 10458 10439 npc.npcDefinition = ActorDefinition.getDefinition(buffer.getBits(13)); 10459 10440 npc.boundaryDimension = npc.npcDefinition.boundaryDimension; 10460 - npc.anInt1600 = npc.npcDefinition.degreesToTurn; 10441 + npc.turnSpeed = npc.npcDefinition.degreesToTurn; 10461 10442 npc.walkAnimationId = npc.npcDefinition.walkAnimationId; 10462 10443 npc.turnAroundAnimationId = npc.npcDefinition.turnAroundAnimationId; 10463 10444 npc.turnRightAnimationId = npc.npcDefinition.turnRightAnimationId; ··· 10560 10541 } 10561 10542 } 10562 10543 } 10563 - if (opcode == SET_PLAYER_GROUND_ITEM) { 10544 + if (SET_PLAYER_GROUND_ITEM.equals(opcode)) { 10564 10545 int offset = buf.getUnsignedPostNegativeOffsetByte(); 10565 10546 int x = placementX + (offset >> 4 & 7); 10566 10547 int y = placementY + (offset & 7); ··· 10630 10611 } 10631 10612 return; 10632 10613 } 10633 - if (opcode == SET_GROUND_ITEM) { 10614 + if (SET_GROUND_ITEM.equals(opcode)) { 10634 10615 int itemId = buf.getUnsignedShortBE(); 10635 10616 int offset = buf.getUnsignedInvertedByte(); 10636 10617 int x = placementX + (offset >> 4 & 7); ··· 10647 10628 } 10648 10629 return; 10649 10630 } 10650 - if (opcode == UPDATE_GROUND_ITEM_AMOUNT) { 10631 + if (UPDATE_GROUND_ITEM_AMOUNT.equals(opcode)) { 10651 10632 int offset = buf.getUnsignedByte(); 10652 10633 int x = placementX + (offset >> 4 & 7); 10653 10634 int y = placementY + (offset & 7); ··· 10669 10650 } 10670 10651 return; 10671 10652 } 10672 - if (opcode == SHOW_PROJECTILE) { 10653 + if (SHOW_PROJECTILE.equals(opcode)) { 10673 10654 int offset = buf.getUnsignedByte(); 10674 10655 int startX = placementX + (offset >> 4 & 7); 10675 10656 int startY = placementY + (offset & 7); ··· 10697 10678 } 10698 10679 return; 10699 10680 } 10700 - if (opcode == PLAY_POSITION_SOUND) { 10681 + if (PLAY_POSITION_SOUND.equals(opcode)) { 10701 10682 int offset = buf.getUnsignedByte(); 10702 10683 int x = placementX + (offset >> 4 & 7); 10703 10684 int y = placementY + (offset & 7); ··· 10716 10697 currentSound++; 10717 10698 } 10718 10699 } 10719 - if (opcode == SHOW_STILL_GRAPHICS) { 10700 + if (SHOW_STILL_GRAPHICS.equals(opcode)) { 10720 10701 int offset = buf.getUnsignedByte(); 10721 10702 int x = placementX + (offset >> 4 & 7); 10722 10703 int y = placementY + (offset & 7); ··· 10731 10712 } 10732 10713 return; 10733 10714 } 10734 - if (opcode == SET_LANDSCAPE_OBJECT) { 10715 + if (SET_LANDSCAPE_OBJECT.equals(opcode)) { 10735 10716 int landscapeObjectData = buf.getUnsignedInvertedByte(); 10736 10717 int typeIndex = landscapeObjectData >> 2; 10737 10718 int rotation = landscapeObjectData & 3; ··· 10744 10725 createObjectSpawnRequest(plane, x, rotation, -1, typeIndex, landscapeObjectId, 0, type, y); 10745 10726 return; 10746 10727 } 10747 - if (opcode == REMOVE_GROUND_ITEM) { 10728 + if (REMOVE_GROUND_ITEM.equals(opcode)) { 10748 10729 int itemId = buf.getUnsignedNegativeOffsetShortBE(); 10749 10730 int offset = buf.getUnsignedPostNegativeOffsetByte(); 10750 10731 int x = placementX + (offset >> 4 & 7); ··· 10766 10747 } 10767 10748 return; 10768 10749 } 10769 - if (opcode == REMOVE_LANDSCAPE_OBJECT) { 10750 + if (REMOVE_LANDSCAPE_OBJECT.equals(opcode)) { 10770 10751 int offset = buf.getUnsignedPreNegativeOffsetByte(); 10771 10752 int x = placementX + (offset >> 4 & 7); 10772 10753 int y = placementY + (offset & 7); ··· 10795 10776 } 10796 10777 10797 10778 10798 - private void method136(Actor class50_sub1_sub4_sub3, boolean flag, int i) { 10799 - method137(class50_sub1_sub4_sub3.worldX, i, class50_sub1_sub4_sub3.worldY, -214); 10800 - if (!flag) 10801 - ; 10779 + private void setDrawXY(Actor actor, int offsetZ) { 10780 + setDrawXY(actor.worldX, actor.worldY, offsetZ); 10802 10781 } 10803 10782 10804 - private void method137(int i, int j, int k, int l) { 10805 - if (i < 128 || k < 128 || i > 13056 || k > 13056) { 10806 - anInt932 = -1; 10807 - anInt933 = -1; 10783 + private void setDrawXY(int x, int y, int offsetZ) { 10784 + if (x < 128 || y < 128 || x > 13056 || y > 13056) { 10785 + drawX = -1; 10786 + drawY = -1; 10808 10787 return; 10809 10788 } 10810 - int i1 = getFloorDrawHeight(plane, i, k) - j; 10811 - i -= cameraX; 10812 - i1 -= cameraZ; 10813 - k -= cameraY; 10814 - int j1 = Model.SINE[cameraVerticalRotation]; 10815 - int k1 = Model.COSINE[cameraVerticalRotation]; 10816 - int l1 = Model.SINE[cameraHorizontalRotation]; 10817 - int i2 = Model.COSINE[cameraHorizontalRotation]; 10818 - int j2 = k * l1 + i * i2 >> 16; 10819 - k = k * i2 - i * l1 >> 16; 10820 - i = j2; 10821 - j2 = i1 * k1 - k * j1 >> 16; 10822 - k = i1 * j1 + k * k1 >> 16; 10823 - while (l >= 0) 10824 - opcode = -1; 10825 - i1 = j2; 10826 - if (k >= 50) { 10827 - anInt932 = Rasterizer3D.centerX + (i << 9) / k; 10828 - anInt933 = Rasterizer3D.centerY + (i1 << 9) / k; 10789 + int z = getFloorDrawHeight(plane, x, y) - offsetZ; 10790 + x -= cameraX; 10791 + z -= cameraZ; 10792 + y -= cameraY; 10793 + int pitchSine = Model.SINE[cameraVerticalRotation]; 10794 + int pitchCosine = Model.COSINE[cameraVerticalRotation]; 10795 + int yawSine = Model.SINE[cameraHorizontalRotation]; 10796 + int yawCosine = Model.COSINE[cameraHorizontalRotation]; 10797 + int i = y * yawSine + x * yawCosine >> 16; 10798 + y = y * yawCosine - x * yawSine >> 16; 10799 + x = i; 10800 + i = z * pitchCosine - y * pitchSine >> 16; 10801 + y = z * pitchSine + y * pitchCosine >> 16; 10802 + z = i; 10803 + if (y >= 50) { 10804 + drawX = Rasterizer3D.centerX + (x << 9) / y; 10805 + drawY = Rasterizer3D.centerY + (z << 9) / y; 10829 10806 } else { 10830 - anInt932 = -1; 10831 - anInt933 = -1; 10807 + drawX = -1; 10808 + drawY = -1; 10832 10809 } 10833 10810 } 10834 10811 ··· 11775 11752 } 11776 11753 11777 11754 int textureId = Rasterizer3D.textureGetCount; 11778 - Model.aBoolean1705 = true; 11755 + Model.gameScreenClickable = true; 11779 11756 Model.resourceCount = 0; 11780 11757 Model.cursorX = super.mouseX - 4; 11781 11758 Model.cursorY = super.mouseY - 4; 11782 11759 Rasterizer.resetPixels(); 11783 11760 currentScene.render(cameraX, cameraPlane, 0, cameraZ, cameraY, cameraHorizontalRotation, cameraVerticalRotation); 11784 11761 currentScene.clearInteractiveObjectCache(); 11785 - method121(false); 11786 - method127(); 11762 + drawScene2d(false); 11763 + drawMarker(); 11787 11764 animateTexture(textureId); 11788 11765 draw3dScreen(); 11789 11766 gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics);
+9 -9
src/main/java/com/jagex/runescape/cache/media/AnimationSequence.java
··· 14 14 public int frameLenghts[]; 15 15 public int frameStep = -1; 16 16 public int flowControl[]; 17 - public boolean aBoolean300 = false; 17 + public boolean dynamic = false; 18 18 public int anInt301 = 5; 19 19 public int getPlayerShieldDelta = -1; 20 20 public int getPlayerWeaponDelta = -1; 21 - public int anInt304 = 99; 22 - public int anInt305 = -1; 21 + public int resetCycle = 99; 22 + public int speedFlag = -1; 23 23 public int priority = -1; 24 24 public int anInt307 = 2; 25 25 ··· 79 79 flowControl[flowCount] = 0x98967f; 80 80 break; 81 81 case 4: 82 - aBoolean300 = true; 82 + dynamic = true; 83 83 break; 84 84 case 5: 85 85 anInt301 = buf.getUnsignedByte(); ··· 91 91 getPlayerWeaponDelta = buf.getUnsignedShortBE(); 92 92 break; 93 93 case 8: 94 - anInt304 = buf.getUnsignedByte(); 94 + resetCycle = buf.getUnsignedByte(); 95 95 break; 96 96 case 9: 97 - anInt305 = buf.getUnsignedByte(); 97 + speedFlag = buf.getUnsignedByte(); 98 98 break; 99 99 case 10: 100 100 priority = buf.getUnsignedByte(); ··· 119 119 frameLenghts = new int[1]; 120 120 frameLenghts[0] = -1; 121 121 } 122 - if (anInt305 == -1) 122 + if (speedFlag == -1) 123 123 if (flowControl != null) 124 - anInt305 = 2; 124 + speedFlag = 2; 125 125 else 126 - anInt305 = 0; 126 + speedFlag = 0; 127 127 if (priority == -1) { 128 128 if (flowControl != null) { 129 129 priority = 2;
+96
src/main/java/com/jagex/runescape/config/IncomingPacket.java
··· 1 + package com.jagex.runescape.config; 2 + 3 + public enum IncomingPacket { 4 + REMOVE_LANDSCAPE_OBJECT(88), 5 + SET_LANDSCAPE_OBJECT(152), 6 + REMOVE_GROUND_ITEM(208), 7 + UPDATE_GROUND_ITEM_AMOUNT(121), 8 + SET_GROUND_ITEM(107), 9 + SET_PLAYER_GROUND_ITEM(106), 10 + UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS(183), 11 + CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS(40), 12 + 13 + SHOW_STILL_GRAPHICS(59), 14 + SHOW_PROJECTILE(181), 15 + SHOW_HINT_ICON(199), 16 + 17 + PLAY_SOUND(26), 18 + PLAY_POSITION_SOUND(41), 19 + PLAY_SONG(220), 20 + PLAY_TEMP_SONG(249), 21 + 22 + SYSTEM_UPDATE(190), 23 + CHATBOX_MESSAGE(63), 24 + 25 + CONSTRUCT_MAP_REGION(53), 26 + UPDATE_ACTIVE_MAP_REGION(222), 27 + 28 + SET_WIDGET_ANIMATION(2), 29 + SET_WIDGET_ITEM_MODEL(21), 30 + SET_WIDGET_PLAYER_HEAD(255), 31 + SET_CHAT_INPUT_TYPE_2(6), 32 + SET_WIDGET_MODEL_1(216), 33 + SET_WIDGET_MODEL_2(162), 34 + RESET_WIDGET_SETTINGS(113), 35 + FLASH_TAB_ICON(238), 36 + SET_TAB_WIDGET(10), 37 + SET_ACTIVE_TAB(252), 38 + CLEAR_WIDGET_ITEMS(219), 39 + UPDATE_ALL_WIDGET_ITEMS(206), 40 + UPDATE_WIDGET_ITEMS_BY_SLOT(134), 41 + UPDATE_WIDGET_SETTING_LARGE(115), 42 + UPDATE_WIDGET_SETTING_SMALL(182), 43 + UPDATE_CHAT_SETTINGS(201), 44 + UPDATE_WIDGET_COLOR(218), 45 + UPDATE_WIDGET_STRING(232), 46 + UPDATE_WIDGET_SCROLL_POSITION(200), 47 + UPDATE_WIDGET_MODEL_DISPLAY(186), 48 + HIDE_WIDGET(82), 49 + UPDATE_WIDGET_POSITION(166), 50 + SHOW_SIDEBAR_OVERLAY_WIDGET(246), 51 + SHOW_GAME_WIDGET(159), 52 + SHOW_SIDEBAR_AND_GAME_WIDGET(128), 53 + SHOW_WALKABLE_WIDGET(50), 54 + UPDATE_WELCOME_SCREEN(76), 55 + SHOW_DIALOG(158), 56 + SHOW_CHATBOX_WIDGET(109), 57 + SHOW_FULLSCREEN_WIDGET(253), 58 + CLOSE_ALL_WIDGETS(29), 59 + SET_MINIMAP_STATE(156), 60 + 61 + PLAYER_UPDATING(90), 62 + NPC_UPDATING(71), 63 + RESET_MOB_ANIMATIONS(13), 64 + 65 + UPDATE_FRIEND_LIST_STATUS(251), 66 + UPDATE_IGNORE_LIST(226), 67 + PRIVATE_MESSAGE_RECEIVED(135), 68 + UPDATE_FRIEND(78), 69 + UPDATE_PLAYER_CONTEXT_OPTION(157), 70 + 71 + SEND_REFERENCE_POSITION(75), 72 + 73 + UPDATE_MEMBERSHIP_AND_WORLD_INDEX(126), 74 + UPDATE_RUN_ENERGY(125), 75 + UPDATE_SKILL(49), 76 + UPDATE_CARRY_WEIGHT(174), 77 + SEND_LOGOUT(5), 78 + 79 + RESET_CUTSCENE_CAMERA(148), 80 + MOVE_CUTSCENE_CAMERA(167), 81 + CAMERA_SHAKE(67); 82 + 83 + private int packetId; 84 + 85 + IncomingPacket(int packetId){ 86 + this.packetId = packetId; 87 + } 88 + 89 + public int getId() { 90 + return packetId; 91 + } 92 + 93 + public boolean equals(int opcode) { 94 + return opcode == this.packetId; 95 + } 96 + }
-85
src/main/java/com/jagex/runescape/config/IncomingPacketIds.java
··· 1 - package com.jagex.runescape.config; 2 - 3 - public final class IncomingPacketIds { 4 - 5 - public static final int 6 - REMOVE_LANDSCAPE_OBJECT = 88, 7 - SET_LANDSCAPE_OBJECT = 152, 8 - REMOVE_GROUND_ITEM = 208, 9 - UPDATE_GROUND_ITEM_AMOUNT = 121, 10 - SET_GROUND_ITEM = 107, 11 - SET_PLAYER_GROUND_ITEM = 106, 12 - UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS = 183, 13 - CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS = 40, 14 - 15 - SHOW_STILL_GRAPHICS = 59, 16 - SHOW_PROJECTILE = 181, 17 - SHOW_HINT_ICON = 199, 18 - 19 - PLAY_SOUND = 26, 20 - PLAY_POSITION_SOUND = 41, 21 - PLAY_SONG = 220, 22 - PLAY_TEMP_SONG = 249, 23 - 24 - SYSTEM_UPDATE = 190, 25 - CHATBOX_MESSAGE = 63, 26 - 27 - CONSTRUCT_MAP_REGION = 53, 28 - UPDATE_ACTIVE_MAP_REGION = 222, 29 - 30 - SET_WIDGET_ANIMATION = 2, 31 - SET_WIDGET_ITEM_MODEL = 21, 32 - SET_WIDGET_PLAYER_HEAD = 255, 33 - SET_CHAT_INPUT_TYPE_2 = 6, 34 - SET_WIDGET_MODEL_1 = 216, 35 - SET_WIDGET_MODEL_2 = 162, 36 - RESET_WIDGET_SETTINGS = 113, 37 - FLASH_TAB_ICON = 238, 38 - SET_TAB_WIDGET = 10, 39 - SET_ACTIVE_TAB = 252, 40 - CLEAR_WIDGET_ITEMS = 219, 41 - UPDATE_ALL_WIDGET_ITEMS = 206, 42 - UPDATE_WIDGET_ITEMS_BY_SLOT = 134, 43 - UPDATE_WIDGET_SETTING_LARGE = 115, 44 - UPDATE_WIDGET_SETTING_SMALL = 182, 45 - UPDATE_CHAT_SETTINGS = 201, 46 - UPDATE_WIDGET_COLOR = 218, 47 - UPDATE_WIDGET_STRING = 232, 48 - UPDATE_WIDGET_SCROLL_POSITION = 200, 49 - UPDATE_WIDGET_MODEL_DISPLAY = 186, 50 - HIDE_WIDGET = 82, 51 - UPDATE_WIDGET_POSITION = 166, 52 - SHOW_SIDEBAR_OVERLAY_WIDGET = 246, 53 - SHOW_GAME_WIDGET = 159, 54 - SHOW_SIDEBAR_AND_GAME_WIDGET = 128, 55 - SHOW_WALKABLE_WIDGET = 50, 56 - UPDATE_WELCOME_SCREEN = 76, 57 - SHOW_DIALOG = 158, 58 - SHOW_CHATBOX_WIDGET = 109, 59 - SHOW_FULLSCREEN_WIDGET = 253, 60 - CLOSE_ALL_WIDGETS = 29, 61 - SET_MINIMAP_STATE = 156, 62 - 63 - PLAYER_UPDATING = 90, 64 - NPC_UPDATING = 71, 65 - RESET_MOB_ANIMATIONS = 13, 66 - 67 - UPDATE_FRIEND_LIST_STATUS = 251, 68 - UPDATE_IGNORE_LIST = 226, 69 - PRIVATE_MESSAGE_RECEIVED = 135, 70 - UPDATE_FRIEND = 78, 71 - UPDATE_PLAYER_CONTEXT_OPTION = 157, 72 - 73 - SEND_REFERENCE_POSITION = 75, 74 - 75 - UPDATE_MEMBERSHIP_AND_WORLD_INDEX = 126, 76 - UPDATE_RUN_ENERGY = 125, 77 - UPDATE_SKILL = 49, 78 - UPDATE_CARRY_WEIGHT = 174, 79 - SEND_LOGOUT = 5, 80 - 81 - RESET_CUTSCENE_CAMERA = 148, 82 - MOVE_CUTSCENE_CAMERA = 167, 83 - CAMERA_SHAKE = 67; 84 - 85 - }
+2 -2
src/main/java/com/jagex/runescape/media/renderable/Model.java
··· 69 69 private static int vertexXModifier; 70 70 private static int vertexYModifier; 71 71 private static int vertexZModifier; 72 - public static boolean aBoolean1705; 72 + public static boolean gameScreenClickable; 73 73 public static int cursorX; 74 74 public static int cursorY; 75 75 public static int resourceCount; ··· 1464 1464 flag = true; 1465 1465 } 1466 1466 boolean flag1 = false; 1467 - if (i2 > 0 && aBoolean1705) { 1467 + if (i2 > 0 && gameScreenClickable) { 1468 1468 int k5 = k2 - l2; 1469 1469 if (k5 <= 50) { 1470 1470 k5 = 50;
+19 -19
src/main/java/com/jagex/runescape/media/renderable/actor/Actor.java
··· 13 13 public int[] pathY = new int[10]; 14 14 public int movementAnimation = -1; 15 15 public int displayedMovementFrames; 16 - public int anInt1590; 16 + public int movementCycle; 17 17 public boolean[] runningQueue = new boolean[10]; 18 18 public boolean dynamic = false; 19 19 public int textEffect; ··· 21 21 public int endCycle = -1000; 22 22 public int anInt1596; 23 23 public int anInt1597; 24 - public int anInt1598; 25 - public int anInt1599; 26 - public int anInt1600 = 32; 24 + public int faceX; 25 + public int faceY; 26 + public int turnSpeed = 32; 27 27 public int boundaryDimension = 1; 28 - public int anInt1602; 29 - public int anInt1603; 30 - public int anInt1604; 31 - public int anInt1605; 32 - public int anInt1606; 33 - public int anInt1607; 34 - public int anInt1608; 28 + public int movementStartX; 29 + public int movementEndX; 30 + public int movementStartY; 31 + public int movementEndY; 32 + public int moveCycleEnd; 33 + public int moveCycleStart; 34 + public int moveDirection; 35 35 public int faceActor = -1; 36 36 public int worldX; 37 37 public int worldY; 38 38 public int currentRotation; 39 - public int anInt1613; 39 + public int stillPathPosition; 40 40 public int graphic = -1; 41 41 public int currentAnimation; 42 - public int anInt1616; 42 + public int animationCycle; 43 43 public int spotGraphicDelay; 44 44 public int spotGraphicHeight; 45 45 public int walkAnimationId = -1; 46 46 public int turnAroundAnimationId = -1; 47 47 public int turnRightAnimationId = -1; 48 48 public int turnLeftAnimationId = -1; 49 - public int anInt1623; 49 + public int resyncWalkCycle; 50 50 public int emoteAnimation = -1; 51 51 public int displayedEmoteFrames; 52 - public int anInt1626; 52 + public int animationSequence; 53 53 public int animationDelay; 54 - public int anInt1628; 54 + public int animationResetCycle; 55 55 public int runAnimationId = -1; 56 56 public int[] hitDamages = new int[4]; 57 57 public int[] hitTypes = new int[4]; ··· 62 62 63 63 public void resetPath() { 64 64 pathLength = 0; 65 - anInt1613 = 0; 65 + stillPathPosition = 0; 66 66 } 67 67 68 68 public boolean isVisible() { ··· 144 144 } 145 145 } 146 146 pathLength = 0; 147 - anInt1613 = 0; 148 - anInt1623 = 0; 147 + stillPathPosition = 0; 148 + resyncWalkCycle = 0; 149 149 pathX[0] = x; 150 150 pathY[0] = y; 151 151 worldX = pathX[0] * 128 + boundaryDimension * 64;