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.

scrolling interfaces, sidebars, chatbox and zoom

+720 -645
+57 -56
src/com/jagex/runescape/Game.java
··· 70 70 private int anInt848; 71 71 private String friendUsernames[] = new String[200]; 72 72 private int anInt850; 73 - private int anInt851; 73 + public int chatboxScroll; 74 + public static int cameraZoom = 1200; 74 75 private int cameraAmplitude[] = new int[5]; 75 76 private int anInt853; 76 77 private int anInt854 = 2; ··· 158 159 private int anIntArray947[] = new int[anInt940]; 159 160 private String aStringArray948[] = new String[anInt940]; 160 161 private String inputInputMessage = ""; 161 - private boolean aBoolean950 = false; 162 + private boolean drawTabIcons = false; 162 163 private int tickDelta; 163 164 private static int SKILL_EXPERIENCE[]; 164 165 private boolean aBoolean953 = false; ··· 195 196 private IndexedImage aClass50_Sub1_Sub1_Sub3_985; 196 197 private IndexedImage aClass50_Sub1_Sub1_Sub3_986; 197 198 private IndexedImage aClass50_Sub1_Sub1_Sub3_987; 198 - private int backDialogueId = -1; 199 + public int backDialogueId = -1; 199 200 private int placementX; 200 201 private int placementY; 201 202 private int cameraFrequency[] = new int[5]; ··· 283 284 private int minimapHintY[] = new int[1000]; 284 285 private ImageRGB aClass50_Sub1_Sub1_Sub1Array1079[] = new ImageRGB[32]; 285 286 private int anInt1080 = 0x4d4233; 286 - private int tabInterfaceIDs[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 287 + public int tabInterfaceIDs[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 287 288 private static int anInt1082; 288 289 private int anInt1083; 289 290 private int anIntArray1084[]; ··· 308 309 private String chatboxInput = ""; 309 310 private int cameraJitter[] = new int[5]; 310 311 private int anInt1106; 311 - private int anInt1107 = 78; 312 + private int chatboxScrollMax = 78; 312 313 private ProducingGraphicsBuffer aClass18_1108; 313 314 private ProducingGraphicsBuffer aClass18_1109; 314 315 private ProducingGraphicsBuffer aClass18_1110; ··· 367 368 private int anIntArray1166[] = new int[256]; 368 369 public static Player localPlayer; 369 370 private static int anInt1168; 370 - private int openInterfaceId = -1; 371 + public int openInterfaceId = -1; 371 372 private int anInt1170; 372 373 private int widgetSelected; 373 374 private int anInt1172; ··· 379 380 private int anInt1178 = 300; 380 381 private int anInt1257; 381 382 private int anIntArray1180[] = new int[33]; 382 - private boolean redrawTabArea = false; 383 + public boolean redrawTabArea = false; 383 384 private ImageRGB aClass50_Sub1_Sub1_Sub1Array1182[] = new ImageRGB[20]; 384 385 private int menuActionRow; 385 386 private String menuActionTexts[] = new String[500]; ··· 436 437 private static int anInt1237; 437 438 private int anInt1238; 438 439 private boolean aBoolean1239 = false; 439 - private boolean redrawChatbox = false; 440 + public boolean redrawChatbox = false; 440 441 private int lastAddress; 441 442 private static boolean aBoolean1242 = true; 442 443 private volatile boolean aBoolean1243 = false; ··· 445 446 private boolean inTutorialIsland; 446 447 private ImageRGB minimapEdge; 447 448 private MouseCapturer mouseCapturer; 448 - private Widget aClass13_1249 = new Widget(); 449 + public Widget chatboxInterface = new Widget(); 449 450 private long aLong1172; 450 451 private int cameraVertical = 128; 451 452 private int cameraHorizontal; ··· 479 480 private LinkedList aClass6_1282 = new LinkedList(); 480 481 private boolean aBoolean1283 = false; 481 482 private int anInt1284; 482 - private int currentTabId = 3; 483 + public int currentTabId = 3; 483 484 private int anIntArray1286[] = new int[33]; 484 485 private int anInt1287 = 0x332d25; 485 486 private ImageRGB aClass50_Sub1_Sub1_Sub1Array1288[] = new ImageRGB[32]; ··· 764 765 openInvOverLayId = -1; 765 766 redrawTabArea = true; 766 767 aBoolean1239 = false; 767 - aBoolean950 = true; 768 + drawTabIcons = true; 768 769 } 769 770 if (backDialogueId != -1) { 770 771 method44(backDialogueId); ··· 1033 1034 && tabInterfaceIDs[0] != -1) { 1034 1035 redrawTabArea = true; 1035 1036 currentTabId = 0; 1036 - aBoolean950 = true; 1037 + drawTabIcons = true; 1037 1038 } 1038 1039 if (super.clickX >= 569 && super.clickX <= 599 && super.clickY >= 168 && super.clickY < 205 1039 1040 && tabInterfaceIDs[1] != -1) { 1040 1041 redrawTabArea = true; 1041 1042 currentTabId = 1; 1042 - aBoolean950 = true; 1043 + drawTabIcons = true; 1043 1044 } 1044 1045 if (super.clickX >= 597 && super.clickX <= 627 && super.clickY >= 168 && super.clickY < 205 1045 1046 && tabInterfaceIDs[2] != -1) { 1046 1047 redrawTabArea = true; 1047 1048 currentTabId = 2; 1048 - aBoolean950 = true; 1049 + drawTabIcons = true; 1049 1050 } 1050 1051 if (super.clickX >= 625 && super.clickX <= 669 && super.clickY >= 168 && super.clickY < 203 1051 1052 && tabInterfaceIDs[3] != -1) { 1052 1053 redrawTabArea = true; 1053 1054 currentTabId = 3; 1054 - aBoolean950 = true; 1055 + drawTabIcons = true; 1055 1056 } 1056 1057 if (super.clickX >= 666 && super.clickX <= 696 && super.clickY >= 168 && super.clickY < 205 1057 1058 && tabInterfaceIDs[4] != -1) { 1058 1059 redrawTabArea = true; 1059 1060 currentTabId = 4; 1060 - aBoolean950 = true; 1061 + drawTabIcons = true; 1061 1062 } 1062 1063 if (super.clickX >= 694 && super.clickX <= 724 && super.clickY >= 168 && super.clickY < 205 1063 1064 && tabInterfaceIDs[5] != -1) { 1064 1065 redrawTabArea = true; 1065 1066 currentTabId = 5; 1066 - aBoolean950 = true; 1067 + drawTabIcons = true; 1067 1068 } 1068 1069 if (super.clickX >= 722 && super.clickX <= 756 && super.clickY >= 169 && super.clickY < 205 1069 1070 && tabInterfaceIDs[6] != -1) { 1070 1071 redrawTabArea = true; 1071 1072 currentTabId = 6; 1072 - aBoolean950 = true; 1073 + drawTabIcons = true; 1073 1074 } 1074 1075 if (super.clickX >= 540 && super.clickX <= 574 && super.clickY >= 466 && super.clickY < 502 1075 1076 && tabInterfaceIDs[7] != -1) { 1076 1077 redrawTabArea = true; 1077 1078 currentTabId = 7; 1078 - aBoolean950 = true; 1079 + drawTabIcons = true; 1079 1080 } 1080 1081 if (super.clickX >= 572 && super.clickX <= 602 && super.clickY >= 466 && super.clickY < 503 1081 1082 && tabInterfaceIDs[8] != -1) { 1082 1083 redrawTabArea = true; 1083 1084 currentTabId = 8; 1084 - aBoolean950 = true; 1085 + drawTabIcons = true; 1085 1086 } 1086 1087 if (super.clickX >= 599 && super.clickX <= 629 && super.clickY >= 466 && super.clickY < 503 1087 1088 && tabInterfaceIDs[9] != -1) { 1088 1089 redrawTabArea = true; 1089 1090 currentTabId = 9; 1090 - aBoolean950 = true; 1091 + drawTabIcons = true; 1091 1092 } 1092 1093 if (super.clickX >= 627 && super.clickX <= 671 && super.clickY >= 467 && super.clickY < 502 1093 1094 && tabInterfaceIDs[10] != -1) { 1094 1095 redrawTabArea = true; 1095 1096 currentTabId = 10; 1096 - aBoolean950 = true; 1097 + drawTabIcons = true; 1097 1098 } 1098 1099 if (super.clickX >= 669 && super.clickX <= 699 && super.clickY >= 466 && super.clickY < 503 1099 1100 && tabInterfaceIDs[11] != -1) { 1100 1101 redrawTabArea = true; 1101 1102 currentTabId = 11; 1102 - aBoolean950 = true; 1103 + drawTabIcons = true; 1103 1104 } 1104 1105 if (super.clickX >= 696 && super.clickX <= 726 && super.clickY >= 466 && super.clickY < 503 1105 1106 && tabInterfaceIDs[12] != -1) { 1106 1107 redrawTabArea = true; 1107 1108 currentTabId = 12; 1108 - aBoolean950 = true; 1109 + drawTabIcons = true; 1109 1110 } 1110 1111 if (super.clickX >= 724 && super.clickX <= 758 && super.clickY >= 466 && super.clickY < 502 1111 1112 && tabInterfaceIDs[13] != -1) { 1112 1113 redrawTabArea = true; 1113 1114 currentTabId = 13; 1114 - aBoolean950 = true; 1115 + drawTabIcons = true; 1115 1116 } 1116 1117 } 1117 1118 } ··· 2090 2091 method44(openInvOverLayId); 2091 2092 openInvOverLayId = -1; 2092 2093 redrawTabArea = true; 2093 - aBoolean950 = true; 2094 + drawTabIcons = true; 2094 2095 } 2095 2096 if (anInt1053 != -1) { 2096 2097 method44(anInt1053); ··· 2273 2274 method44(openInvOverLayId); 2274 2275 openInvOverLayId = -1; 2275 2276 redrawTabArea = true; 2276 - aBoolean950 = true; 2277 + drawTabIcons = true; 2277 2278 } 2278 2279 if (backDialogueId != -1) { 2279 2280 method44(backDialogueId); ··· 2431 2432 redrawChatbox = true; 2432 2433 } 2433 2434 redrawTabArea = true; 2434 - aBoolean950 = true; 2435 + drawTabIcons = true; 2435 2436 aBoolean1239 = false; 2436 2437 opcode = -1; 2437 2438 return true; ··· 2527 2528 if (opcode == 252) { 2528 2529 currentTabId = buffer.getByteNegated(); 2529 2530 redrawTabArea = true; 2530 - aBoolean950 = true; 2531 + drawTabIcons = true; 2531 2532 opcode = -1; 2532 2533 return true; 2533 2534 } ··· 2624 2625 method44(openInvOverLayId); 2625 2626 openInvOverLayId = -1; 2626 2627 redrawTabArea = true; 2627 - aBoolean950 = true; 2628 + drawTabIcons = true; 2628 2629 } 2629 2630 if (backDialogueId != -1) { 2630 2631 method44(backDialogueId); ··· 2682 2683 redrawChatbox = true; 2683 2684 } 2684 2685 redrawTabArea = true; 2685 - aBoolean950 = true; 2686 + drawTabIcons = true; 2686 2687 aBoolean1239 = false; 2687 2688 opcode = -1; 2688 2689 return true; ··· 3014 3015 tabInterfaceIDs[sidebarIcon] = interfaceId; 3015 3016 } 3016 3017 redrawTabArea = true; 3017 - aBoolean950 = true; 3018 + drawTabIcons = true; 3018 3019 opcode = -1; 3019 3020 return true; 3020 3021 } ··· 3628 3629 } 3629 3630 } 3630 3631 3631 - private void method42(int i, int j, Widget class13, byte byte0, int k, int l, int i1, int j1, int k1) { 3632 + private void scrollInterface(int i, int j, Widget class13, byte byte0, int k, int l, int i1, int j1, int k1) { 3632 3633 if (aBoolean1127) 3633 3634 anInt1303 = 32; 3634 3635 else ··· 5393 5394 if (child.type == 0) { 5394 5395 method66(k2, child, j, child.scrollPosition, j2, i1, 23658, k1); 5395 5396 if (child.scrollLimit > child.height) 5396 - method42(child.scrollLimit, k2, child, (byte) 102, k1, j, i1, child.height, j2 5397 + scrollInterface(child.scrollLimit, k2, child, (byte) 102, k1, j, i1, child.height, j2 5397 5398 + child.width); 5398 5399 } else { 5399 5400 if (child.actionType == 1 && i1 >= j2 && k1 >= k2 && i1 < j2 + child.width ··· 5939 5940 aClass18_914.drawGraphics(0, 338, super.gameGraphics); 5940 5941 redrawTabArea = true; 5941 5942 redrawChatbox = true; 5942 - aBoolean950 = true; 5943 + drawTabIcons = true; 5943 5944 redrawChatMode = true; 5944 5945 if (loadingStage != 2) { 5945 5946 gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics); ··· 5969 5970 redrawTabArea = false; 5970 5971 } 5971 5972 if (backDialogueId == -1 && inputType == 0) { 5972 - aClass13_1249.scrollPosition = anInt1107 - anInt851 - 77; 5973 + chatboxInterface.scrollPosition = chatboxScrollMax - chatboxScroll - 77; 5973 5974 if (super.mouseX > 448 && super.mouseX < 560 && super.mouseY > 332) 5974 - method42(anInt1107, 0, aClass13_1249, (byte) 102, super.mouseY - 357, -1, super.mouseX - 17, 77, 463); 5975 - int j = anInt1107 - 77 - aClass13_1249.scrollPosition; 5975 + scrollInterface(chatboxScrollMax, 0, chatboxInterface, (byte) 102, super.mouseY - 357, -1, super.mouseX - 17, 77, 463); 5976 + int j = chatboxScrollMax - 77 - chatboxInterface.scrollPosition; 5976 5977 if (j < 0) 5977 5978 j = 0; 5978 - if (j > anInt1107 - 77) 5979 - j = anInt1107 - 77; 5980 - if (anInt851 != j) { 5981 - anInt851 = j; 5979 + if (j > chatboxScrollMax - 77) 5980 + j = chatboxScrollMax - 77; 5981 + if (chatboxScroll != j) { 5982 + chatboxScroll = j; 5982 5983 redrawChatbox = true; 5983 5984 } 5984 5985 } 5985 5986 if (backDialogueId == -1 && inputType == 3) { 5986 5987 int k = anInt862 * 14 + 7; 5987 - aClass13_1249.scrollPosition = anInt865; 5988 + chatboxInterface.scrollPosition = anInt865; 5988 5989 if (super.mouseX > 448 && super.mouseX < 560 && super.mouseY > 332) 5989 - method42(k, 0, aClass13_1249, (byte) 102, super.mouseY - 357, -1, super.mouseX - 17, 77, 463); 5990 - int i1 = aClass13_1249.scrollPosition; 5990 + scrollInterface(k, 0, chatboxInterface, (byte) 102, super.mouseY - 357, -1, super.mouseX - 17, 77, 463); 5991 + int i1 = chatboxInterface.scrollPosition; 5991 5992 if (i1 < 0) 5992 5993 i1 = 0; 5993 5994 if (i1 > k - 77) ··· 6019 6020 aClass18_1157.drawGraphics(550, 4, super.gameGraphics); 6020 6021 } 6021 6022 if (anInt1213 != -1) 6022 - aBoolean950 = true; 6023 - if (aBoolean950) { 6023 + drawTabIcons = true; 6024 + if (drawTabIcons) { 6024 6025 if (anInt1213 != -1 && anInt1213 == currentTabId) { 6025 6026 anInt1213 = -1; 6026 6027 outBuffer.putOpcode(119); 6027 6028 outBuffer.putByte(currentTabId); 6028 6029 } 6029 - aBoolean950 = false; 6030 + drawTabIcons = false; 6030 6031 aClass18_1110.createRasterizer(); 6031 6032 anIndexedImage1054.drawImage(0, 0); 6032 6033 if (openInvOverLayId == -1) { ··· 6979 6980 if (chatMessages[i] != null) { 6980 6981 String name = chatPlayerNames[i]; 6981 6982 int type = chatTypes[i]; 6982 - int y = (70 - line * 14) + anInt851; 6983 + int y = (70 - line * 14) + chatboxScroll; 6983 6984 byte privilege = 0; 6984 6985 6985 6986 if (name != null && name.startsWith("@cr1@")) { ··· 7086 7087 7087 7088 Rasterizer.resetCoordinates(); 7088 7089 7089 - anInt1107 = line * 14 + 7; 7090 + chatboxScrollMax = line * 14 + 7; 7090 7091 7091 - if (anInt1107 < 78) 7092 - anInt1107 = 78; 7092 + if (chatboxScrollMax < 78) 7093 + chatboxScrollMax = 78; 7093 7094 7094 - method56(true, anInt1107 - anInt851 - 77, 463, 77, anInt1107, 0); 7095 + method56(true, chatboxScrollMax - chatboxScroll - 77, 463, 77, chatboxScrollMax, 0); 7095 7096 7096 7097 String name; 7097 7098 ··· 7715 7716 int yawDifference = 2048 - yaw & 0x7ff; 7716 7717 int xOffset = 0; 7717 7718 int zOffset = 0; 7718 - int yOffset = 600 + pitch * 3; 7719 + int yOffset = cameraZoom + pitch * 3; 7719 7720 7720 7721 if (pitchDifference != 0) { 7721 7722 int sine = Model.SINE[pitchDifference]; ··· 8571 8572 if (chatMessages[i1] == null) 8572 8573 continue; 8573 8574 int j1 = chatTypes[i1]; 8574 - int k1 = (70 - l * 14) + anInt851 + 4; 8575 + int k1 = (70 - l * 14) + chatboxScroll + 4; 8575 8576 if (k1 < -20) 8576 8577 break; 8577 8578 String s = chatPlayerNames[i1]; ··· 9408 9409 if (anInt1173 == 16) { 9409 9410 redrawTabArea = true; 9410 9411 currentTabId = 3; 9411 - aBoolean950 = true; 9412 + drawTabIcons = true; 9412 9413 } 9413 9414 return; 9414 9415 }
+508 -413
src/com/jagex/runescape/GameShell.java
··· 1 1 package com.jagex.runescape; 2 2 3 3 import com.jagex.runescape.cache.media.ImageRGB; 4 + import com.jagex.runescape.cache.media.Widget; 4 5 import com.jagex.runescape.media.ProducingGraphicsBuffer; 5 6 6 7 import java.applet.Applet; ··· 13 14 14 15 @SuppressWarnings("serial") 15 16 public class GameShell extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, 16 - FocusListener, WindowListener { 17 + MouseWheelListener, FocusListener, WindowListener { 17 18 18 - private int gameState; 19 - private int deltime = 20; 20 - public int mindel = 1; 21 - private long optims[] = new long[10]; 22 - public int fps; 23 - public boolean dumpRequested = false; 24 - public int width; 25 - public int height; 26 - public Graphics gameGraphics; 27 - public ProducingGraphicsBuffer imageProducer; 28 - public ImageRGB aClass50_Sub1_Sub1_Sub1Array16[] = new ImageRGB[6]; 29 - public GameFrame gameFrame; 30 - public boolean clearScreen = true; 31 - public boolean awtFocus = true; 32 - public int idleTime; 33 - public int mouseButtonPressed; 34 - public int mouseX; 35 - public int mouseY; 36 - public int eventMouseButtonPressed; 37 - public int eventClickX; 38 - public int eventClickY; 39 - public long lastClick; 40 - public int clickType; 41 - public int clickX; 42 - public int clickY; 43 - public long clickTime; 44 - public int keyStatus[] = new int[128]; 45 - private int inputBuffer[] = new int[128]; 46 - private int readIndex; 47 - private int writeIndex; 48 - public boolean mouseWheelDown; 49 - public int mouseWheelX; 50 - public int mouseWheelY; 19 + private int gameState; 20 + private int deltime = 20; 21 + public int mindel = 1; 22 + private long optims[] = new long[10]; 23 + public int fps; 24 + public boolean dumpRequested = false; 25 + public int width; 26 + public int height; 27 + public Graphics gameGraphics; 28 + public ProducingGraphicsBuffer imageProducer; 29 + public ImageRGB aClass50_Sub1_Sub1_Sub1Array16[] = new ImageRGB[6]; 30 + public GameFrame gameFrame; 31 + public boolean clearScreen = true; 32 + public boolean awtFocus = true; 33 + public int idleTime; 34 + public int mouseButtonPressed; 35 + public int mouseX; 36 + public int mouseY; 37 + public int eventMouseButtonPressed; 38 + public int eventClickX; 39 + public int eventClickY; 40 + public long lastClick; 41 + public int clickType; 42 + public int clickX; 43 + public int clickY; 44 + public long clickTime; 45 + public int keyStatus[] = new int[128]; 46 + private int inputBuffer[] = new int[128]; 47 + private int readIndex; 48 + private int writeIndex; 49 + public boolean mouseWheelDown; 50 + public int mouseWheelX; 51 + public int mouseWheelY; 52 + private Game client; 53 + 54 + 55 + public final void initializeApplication(int _width, int _height) { 56 + width = _width; 57 + height = _height; 58 + gameFrame = new GameFrame(this, width, height); 59 + gameGraphics = getParentComponent().getGraphics(); 60 + imageProducer = new ProducingGraphicsBuffer(width, height, getParentComponent()); 61 + startRunnable(this, 1); 62 + } 63 + 64 + public final void initializeApplet(int width, int height) { 65 + this.width = width; 66 + this.height = height; 67 + gameGraphics = getParentComponent().getGraphics(); 68 + imageProducer = new ProducingGraphicsBuffer(this.width, this.height, getParentComponent()); 69 + startRunnable(this, 1); 70 + } 71 + 72 + public void run() { 73 + final Component parentComponent = getParentComponent(); 74 + parentComponent.addMouseListener(this); 75 + parentComponent.addMouseMotionListener(this); 76 + parentComponent.addMouseWheelListener(this); 77 + parentComponent.addKeyListener(this); 78 + parentComponent.addFocusListener(this); 79 + if (gameFrame != null) { 80 + // Handle SIGTERM and exit 81 + gameFrame.addWindowListener(new WindowAdapter() { 82 + @Override 83 + public void windowClosing(WindowEvent event) { 84 + System.out.println("Closing Client..."); 85 + System.exit(0); 86 + } 87 + }); 88 + } 89 + 90 + drawLoadingText(0, "Loading..."); 91 + startup(); 92 + int opos = 0; 93 + int ratio = 256; 94 + int del = 1; 95 + int count = 0; 96 + int intex = 0; 97 + for (int optim = 0; optim < 10; optim++) 98 + optims[optim] = System.currentTimeMillis(); 99 + 100 + while (gameState >= 0) { 101 + if (gameState > 0) { 102 + gameState--; 103 + if (gameState == 0) { 104 + exit(); 105 + return; 106 + } 107 + } 108 + ratio = 300; 109 + del = 1; 110 + long currentTime = System.currentTimeMillis(); 111 + if (currentTime > optims[opos]) 112 + ratio = (int) ((2560 * deltime) / (currentTime - optims[opos])); 113 + if (ratio < 25) 114 + ratio = 25; 115 + if (ratio > 256) { 116 + ratio = 256; 117 + del = (int) (deltime - (currentTime - optims[opos]) / 10L); 118 + } 119 + if (del > deltime) 120 + del = deltime; 121 + optims[opos] = currentTime; 122 + opos = (opos + 1) % 10; 123 + if (del > 1) { 124 + for (int optim = 0; optim < 10; optim++) 125 + if (optims[optim] != 0L) 126 + optims[optim] += del; 127 + 128 + } 129 + if (del < mindel) 130 + del = mindel; 131 + try { 132 + Thread.sleep(del); 133 + } catch (InterruptedException _ex) { 134 + intex++; 135 + } 136 + for (; count < 256; count += ratio) { 137 + clickType = eventMouseButtonPressed; 138 + clickX = eventClickX; 139 + clickY = eventClickY; 140 + clickTime = lastClick; 141 + eventMouseButtonPressed = 0; 142 + doLogic(); 143 + readIndex = writeIndex; 144 + } 51 145 146 + count &= 0xff; 147 + if (deltime > 0) 148 + fps = (1000 * ratio) / (deltime * 256); 149 + repaintGame(); 150 + if (dumpRequested) { 151 + System.out.println("ntime:" + currentTime); 152 + for (int i = 0; i < 10; i++) { 153 + int optim = ((opos - i - 1) + 20) % 10; 154 + System.out.println("otim" + optim + ":" + optims[optim]); 155 + } 52 156 53 - public final void initializeApplication(int _width, int _height) { 54 - width = _width; 55 - height = _height; 56 - gameFrame = new GameFrame(this, width, height); 57 - gameGraphics = getParentComponent().getGraphics(); 58 - imageProducer = new ProducingGraphicsBuffer(width, height, getParentComponent()); 59 - startRunnable(this, 1); 60 - } 157 + System.out.println("fps:" + fps + " ratio:" + ratio + " count:" + count); 158 + System.out.println("del:" + del + " deltime:" + deltime + " mindel:" + mindel); 159 + System.out.println("intex:" + intex + " opos:" + opos); 160 + dumpRequested = false; 161 + intex = 0; 162 + } 163 + } 164 + if (gameState == -1) 165 + exit(); 166 + } 61 167 62 - public final void initializeApplet(int width, int height) { 63 - this.width = width; 64 - this.height = height; 65 - gameGraphics = getParentComponent().getGraphics(); 66 - imageProducer = new ProducingGraphicsBuffer(this.width, this.height, getParentComponent()); 67 - startRunnable(this, 1); 68 - } 168 + public void exit() { 169 + gameState = -2; 170 + shutdown(); 171 + if (gameFrame != null) { 172 + try { 173 + Thread.sleep(1000L); 174 + } catch (Exception _ex) { 175 + } 176 + System.exit(0); 177 + } 178 + } 69 179 70 - public void run() { 71 - final Component parentComponent = getParentComponent(); 72 - parentComponent.addMouseListener(this); 73 - parentComponent.addMouseMotionListener(this); 74 - parentComponent.addKeyListener(this); 75 - parentComponent.addFocusListener(this); 76 - if (gameFrame != null) { 77 - // Handle SIGTERM and exit 78 - gameFrame.addWindowListener(new WindowAdapter() { 79 - @Override 80 - public void windowClosing(WindowEvent event) { 81 - System.out.println("Closing Client..."); 82 - System.exit(0); 83 - } 84 - }); 85 - } 180 + public void setFrameRate(int i) { 181 + deltime = 1000 / i; 182 + } 86 183 87 - drawLoadingText(0, "Loading..."); 88 - startup(); 89 - int opos = 0; 90 - int ratio = 256; 91 - int del = 1; 92 - int count = 0; 93 - int intex = 0; 94 - for (int optim = 0; optim < 10; optim++) 95 - optims[optim] = System.currentTimeMillis(); 184 + @Override 185 + public void start() { 186 + if (gameState >= 0) 187 + gameState = 0; 188 + } 96 189 97 - while (gameState >= 0) { 98 - if (gameState > 0) { 99 - gameState--; 100 - if (gameState == 0) { 101 - exit(); 102 - return; 103 - } 104 - } 105 - ratio = 300; 106 - del = 1; 107 - long currentTime = System.currentTimeMillis(); 108 - if (currentTime > optims[opos]) 109 - ratio = (int) ((2560 * deltime) / (currentTime - optims[opos])); 110 - if (ratio < 25) 111 - ratio = 25; 112 - if (ratio > 256) { 113 - ratio = 256; 114 - del = (int) (deltime - (currentTime - optims[opos]) / 10L); 115 - } 116 - if (del > deltime) 117 - del = deltime; 118 - optims[opos] = currentTime; 119 - opos = (opos + 1) % 10; 120 - if (del > 1) { 121 - for (int optim = 0; optim < 10; optim++) 122 - if (optims[optim] != 0L) 123 - optims[optim] += del; 190 + @Override 191 + public void stop() { 192 + if (gameState >= 0) 193 + gameState = 4000 / deltime; 194 + } 124 195 125 - } 126 - if (del < mindel) 127 - del = mindel; 128 - try { 129 - Thread.sleep(del); 130 - } catch (InterruptedException _ex) { 131 - intex++; 132 - } 133 - for (; count < 256; count += ratio) { 134 - clickType = eventMouseButtonPressed; 135 - clickX = eventClickX; 136 - clickY = eventClickY; 137 - clickTime = lastClick; 138 - eventMouseButtonPressed = 0; 139 - doLogic(); 140 - readIndex = writeIndex; 141 - } 196 + @Override 197 + public void destroy() { 198 + gameState = -1; 199 + try { 200 + Thread.sleep(10000L); 201 + } catch (Exception _ex) { 202 + } 203 + if (gameState == -1) 204 + exit(); 205 + } 142 206 143 - count &= 0xff; 144 - if (deltime > 0) 145 - fps = (1000 * ratio) / (deltime * 256); 146 - repaintGame(); 147 - if (dumpRequested) { 148 - System.out.println("ntime:" + currentTime); 149 - for (int i = 0; i < 10; i++) { 150 - int optim = ((opos - i - 1) + 20) % 10; 151 - System.out.println("otim" + optim + ":" + optims[optim]); 152 - } 207 + @Override 208 + public void update(Graphics graphics) { 209 + if (gameGraphics == null) 210 + gameGraphics = graphics; 211 + clearScreen = true; 212 + redraw(); 213 + } 153 214 154 - System.out.println("fps:" + fps + " ratio:" + ratio + " count:" + count); 155 - System.out.println("del:" + del + " deltime:" + deltime + " mindel:" + mindel); 156 - System.out.println("intex:" + intex + " opos:" + opos); 157 - dumpRequested = false; 158 - intex = 0; 159 - } 160 - } 161 - if (gameState == -1) 162 - exit(); 163 - } 215 + @Override 216 + public void paint(Graphics graphics) { 217 + if (gameGraphics == null) 218 + gameGraphics = graphics; 219 + clearScreen = true; 220 + redraw(); 221 + } 164 222 165 - public void exit() { 166 - gameState = -2; 167 - shutdown(); 168 - if (gameFrame != null) { 169 - try { 170 - Thread.sleep(1000L); 171 - } catch (Exception _ex) { 172 - } 173 - System.exit(0); 174 - } 175 - } 223 + public void mousePressed(MouseEvent mouseevent) { 224 + int mouseX = mouseevent.getX(); 225 + int mouseY = mouseevent.getY(); 226 + if (gameFrame != null) { 227 + mouseX -= 4; 228 + mouseY -= 22; 229 + } 230 + idleTime = 0; 231 + eventClickX = mouseX; 232 + eventClickY = mouseY; 233 + lastClick = System.currentTimeMillis(); 234 + if (mouseevent.getButton() == MouseEvent.BUTTON2) { 235 + mouseWheelDown = true; 236 + mouseWheelX = mouseX; 237 + mouseWheelY = mouseY; 238 + return; 239 + } 240 + if (mouseevent.isMetaDown() || mouseevent.getButton() == MouseEvent.BUTTON3) { 241 + eventMouseButtonPressed = 2; 242 + mouseButtonPressed = 2; 243 + } else { 244 + eventMouseButtonPressed = 1; 245 + mouseButtonPressed = 1; 246 + } 247 + } 176 248 177 - public void setFrameRate(int i) { 178 - deltime = 1000 / i; 179 - } 249 + public void mouseReleased(MouseEvent mouseevent) { 250 + idleTime = 0; 251 + mouseButtonPressed = 0; 252 + mouseWheelDown = false; 253 + } 180 254 181 - @Override 182 - public void start() { 183 - if (gameState >= 0) 184 - gameState = 0; 185 - } 255 + public void mouseClicked(MouseEvent mouseevent) { 256 + } 186 257 187 - @Override 188 - public void stop() { 189 - if (gameState >= 0) 190 - gameState = 4000 / deltime; 191 - } 258 + public void mouseEntered(MouseEvent mouseevent) { 259 + } 192 260 193 - @Override 194 - public void destroy() { 195 - gameState = -1; 196 - try { 197 - Thread.sleep(10000L); 198 - } catch (Exception _ex) { 199 - } 200 - if (gameState == -1) 201 - exit(); 202 - } 261 + public void mouseExited(MouseEvent mouseevent) { 262 + idleTime = 0; 263 + mouseX = -1; 264 + mouseY = -1; 265 + } 203 266 204 - @Override 205 - public void update(Graphics graphics) { 206 - if (gameGraphics == null) 207 - gameGraphics = graphics; 208 - clearScreen = true; 209 - redraw(); 210 - } 267 + public void mouseDragged(MouseEvent mouseevent) { 268 + int mouseX = mouseevent.getX(); 269 + int mouseY = mouseevent.getY(); 270 + if (gameFrame != null) { 271 + mouseX -= 4; 272 + mouseY -= 22; 273 + } 274 + if (mouseWheelDown) { 275 + mouseY = mouseWheelX - mouseevent.getX(); 276 + int k = mouseWheelY - mouseevent.getY(); 277 + mouseWheelDragged(mouseY, -k); 278 + mouseWheelX = mouseevent.getX(); 279 + mouseWheelY = mouseevent.getY(); 280 + return; 281 + } 282 + idleTime = 0; 283 + this.mouseX = mouseX; 284 + this.mouseY = mouseY; 285 + } 211 286 212 - @Override 213 - public void paint(Graphics graphics) { 214 - if (gameGraphics == null) 215 - gameGraphics = graphics; 216 - clearScreen = true; 217 - redraw(); 218 - } 287 + void mouseWheelDragged(int param1, int param2) { 219 288 220 - public void mousePressed(MouseEvent mouseevent) { 221 - int mouseX = mouseevent.getX(); 222 - int mouseY = mouseevent.getY(); 223 - if (gameFrame != null) { 224 - mouseX -= 4; 225 - mouseY -= 22; 226 - } 227 - idleTime = 0; 228 - eventClickX = mouseX; 229 - eventClickY = mouseY; 230 - lastClick = System.currentTimeMillis(); 231 - if (mouseevent.getButton() == MouseEvent.BUTTON2) { 232 - mouseWheelDown = true; 233 - mouseWheelX = mouseX; 234 - mouseWheelY = mouseY; 235 - return; 236 - } 237 - if (mouseevent.isMetaDown() || mouseevent.getButton() == MouseEvent.BUTTON3) { 238 - eventMouseButtonPressed = 2; 239 - mouseButtonPressed = 2; 240 - } else { 241 - eventMouseButtonPressed = 1; 242 - mouseButtonPressed = 1; 243 - } 244 - } 289 + } 245 290 246 - public void mouseReleased(MouseEvent mouseevent) { 247 - idleTime = 0; 248 - mouseButtonPressed = 0; 249 - mouseWheelDown = false; 250 - } 291 + public void mouseMoved(MouseEvent mouseevent) { 292 + int mouseX = mouseevent.getX(); 293 + int mouseY = mouseevent.getY(); 294 + if (gameFrame != null) { 295 + mouseX -= 4; 296 + mouseY -= 22; 297 + } 298 + idleTime = 0; 299 + this.mouseX = mouseX; 300 + this.mouseY = mouseY; 301 + } 251 302 252 - public void mouseClicked(MouseEvent mouseevent) { 253 - } 303 + public void keyPressed(KeyEvent keyevent) { 304 + idleTime = 0; 305 + int keyCode = keyevent.getKeyCode(); 306 + int keyChar = keyevent.getKeyChar(); 307 + if (keyChar < 30) 308 + keyChar = 0; 309 + if (keyCode == 37) 310 + keyChar = 1; 311 + if (keyCode == 39) 312 + keyChar = 2; 313 + if (keyCode == 38) 314 + keyChar = 3; 315 + if (keyCode == 40) 316 + keyChar = 4; 317 + if (keyCode == 17) 318 + keyChar = 5; 319 + if (keyCode == 8) 320 + keyChar = 8; 321 + if (keyCode == 127) 322 + keyChar = 8; 323 + if (keyCode == 9) 324 + keyChar = 9; 325 + if (keyCode == 10) 326 + keyChar = 10; 327 + if (keyCode >= 112 && keyCode <= 123) 328 + keyChar = (1008 + keyCode) - 112; 329 + if (keyCode == 36) 330 + keyChar = 1000; 331 + if (keyCode == 35) 332 + keyChar = 1001; 333 + if (keyCode == 33) 334 + keyChar = 1002; 335 + if (keyCode == 34) 336 + keyChar = 1003; 337 + if (keyChar > 0 && keyChar < 128) 338 + keyStatus[keyChar] = 1; 339 + if (keyChar > 4) { 340 + inputBuffer[writeIndex] = keyChar; 341 + writeIndex = writeIndex + 1 & 0x7f; 342 + } 343 + } 254 344 255 - public void mouseEntered(MouseEvent mouseevent) { 256 - } 345 + public void keyReleased(KeyEvent keyevent) { 346 + idleTime = 0; 347 + int keyCode = keyevent.getKeyCode(); 348 + char keyChar = keyevent.getKeyChar(); 349 + if (keyChar < '\036') 350 + keyChar = '\0'; 351 + if (keyCode == 37) 352 + keyChar = '\001'; 353 + if (keyCode == 39) 354 + keyChar = '\002'; 355 + if (keyCode == 38) 356 + keyChar = '\003'; 357 + if (keyCode == 40) 358 + keyChar = '\004'; 359 + if (keyCode == 17) 360 + keyChar = '\005'; 361 + if (keyCode == 8) 362 + keyChar = '\b'; 363 + if (keyCode == 127) 364 + keyChar = '\b'; 365 + if (keyCode == 9) 366 + keyChar = '\t'; 367 + if (keyCode == 10) 368 + keyChar = '\n'; 369 + if (keyChar > 0 && keyChar < '\200') 370 + keyStatus[keyChar] = 0; 371 + } 257 372 258 - public void mouseExited(MouseEvent mouseevent) { 259 - idleTime = 0; 260 - mouseX = -1; 261 - mouseY = -1; 262 - } 373 + public void keyTyped(KeyEvent keyevent) { 374 + } 263 375 264 - public void mouseDragged(MouseEvent mouseevent) { 265 - int mouseX = mouseevent.getX(); 266 - int mouseY = mouseevent.getY(); 267 - if (gameFrame != null) { 268 - mouseX -= 4; 269 - mouseY -= 22; 270 - } 271 - if (mouseWheelDown) { 272 - mouseY = mouseWheelX - mouseevent.getX(); 273 - int k = mouseWheelY - mouseevent.getY(); 274 - mouseWheelDragged(mouseY, -k); 275 - mouseWheelX = mouseevent.getX(); 276 - mouseWheelY = mouseevent.getY(); 277 - return; 278 - } 279 - idleTime = 0; 280 - this.mouseX = mouseX; 281 - this.mouseY = mouseY; 282 - } 283 - void mouseWheelDragged(int param1, int param2) { 376 + public int readCharacter() { 377 + int character = -1; 378 + if (writeIndex != readIndex) { 379 + character = inputBuffer[readIndex]; 380 + readIndex = readIndex + 1 & 0x7f; 381 + } 382 + return character; 383 + } 284 384 285 - } 286 - public void mouseMoved(MouseEvent mouseevent) { 287 - int mouseX = mouseevent.getX(); 288 - int mouseY = mouseevent.getY(); 289 - if (gameFrame != null) { 290 - mouseX -= 4; 291 - mouseY -= 22; 292 - } 293 - idleTime = 0; 294 - this.mouseX = mouseX; 295 - this.mouseY = mouseY; 296 - } 385 + public void focusGained(FocusEvent focusevent) { 386 + awtFocus = true; 387 + clearScreen = true; 388 + redraw(); 389 + } 297 390 298 - public void keyPressed(KeyEvent keyevent) { 299 - idleTime = 0; 300 - int keyCode = keyevent.getKeyCode(); 301 - int keyChar = keyevent.getKeyChar(); 302 - if (keyChar < 30) 303 - keyChar = 0; 304 - if (keyCode == 37) 305 - keyChar = 1; 306 - if (keyCode == 39) 307 - keyChar = 2; 308 - if (keyCode == 38) 309 - keyChar = 3; 310 - if (keyCode == 40) 311 - keyChar = 4; 312 - if (keyCode == 17) 313 - keyChar = 5; 314 - if (keyCode == 8) 315 - keyChar = 8; 316 - if (keyCode == 127) 317 - keyChar = 8; 318 - if (keyCode == 9) 319 - keyChar = 9; 320 - if (keyCode == 10) 321 - keyChar = 10; 322 - if (keyCode >= 112 && keyCode <= 123) 323 - keyChar = (1008 + keyCode) - 112; 324 - if (keyCode == 36) 325 - keyChar = 1000; 326 - if (keyCode == 35) 327 - keyChar = 1001; 328 - if (keyCode == 33) 329 - keyChar = 1002; 330 - if (keyCode == 34) 331 - keyChar = 1003; 332 - if (keyChar > 0 && keyChar < 128) 333 - keyStatus[keyChar] = 1; 334 - if (keyChar > 4) { 335 - inputBuffer[writeIndex] = keyChar; 336 - writeIndex = writeIndex + 1 & 0x7f; 337 - } 338 - } 391 + public void focusLost(FocusEvent focusevent) { 392 + awtFocus = false; 393 + for (int key = 0; key < 128; key++) 394 + keyStatus[key] = 0; 339 395 340 - public void keyReleased(KeyEvent keyevent) { 341 - idleTime = 0; 342 - int keyCode = keyevent.getKeyCode(); 343 - char keyChar = keyevent.getKeyChar(); 344 - if (keyChar < '\036') 345 - keyChar = '\0'; 346 - if (keyCode == 37) 347 - keyChar = '\001'; 348 - if (keyCode == 39) 349 - keyChar = '\002'; 350 - if (keyCode == 38) 351 - keyChar = '\003'; 352 - if (keyCode == 40) 353 - keyChar = '\004'; 354 - if (keyCode == 17) 355 - keyChar = '\005'; 356 - if (keyCode == 8) 357 - keyChar = '\b'; 358 - if (keyCode == 127) 359 - keyChar = '\b'; 360 - if (keyCode == 9) 361 - keyChar = '\t'; 362 - if (keyCode == 10) 363 - keyChar = '\n'; 364 - if (keyChar > 0 && keyChar < '\200') 365 - keyStatus[keyChar] = 0; 366 - } 396 + } 367 397 368 - public void keyTyped(KeyEvent keyevent) { 369 - } 398 + public void windowActivated(WindowEvent windowevent) { 399 + } 370 400 371 - public int readCharacter() { 372 - int character = -1; 373 - if (writeIndex != readIndex) { 374 - character = inputBuffer[readIndex]; 375 - readIndex = readIndex + 1 & 0x7f; 376 - } 377 - return character; 378 - } 401 + public void windowClosed(WindowEvent windowevent) { 402 + } 379 403 380 - public void focusGained(FocusEvent focusevent) { 381 - awtFocus = true; 382 - clearScreen = true; 383 - redraw(); 384 - } 404 + public void windowClosing(WindowEvent windowevent) { 405 + destroy(); 406 + } 385 407 386 - public void focusLost(FocusEvent focusevent) { 387 - awtFocus = false; 388 - for (int key = 0; key < 128; key++) 389 - keyStatus[key] = 0; 408 + public void windowDeactivated(WindowEvent windowevent) { 409 + } 390 410 391 - } 411 + public void windowDeiconified(WindowEvent windowevent) { 412 + } 392 413 393 - public void windowActivated(WindowEvent windowevent) { 394 - } 414 + public void windowIconified(WindowEvent windowevent) { 415 + } 395 416 396 - public void windowClosed(WindowEvent windowevent) { 397 - } 417 + public void windowOpened(WindowEvent windowevent) { 418 + } 398 419 399 - public void windowClosing(WindowEvent windowevent) { 400 - destroy(); 401 - } 420 + public void startup() { 421 + } 402 422 403 - public void windowDeactivated(WindowEvent windowevent) { 404 - } 423 + public void doLogic() { 424 + } 405 425 406 - public void windowDeiconified(WindowEvent windowevent) { 407 - } 426 + public void shutdown() { 427 + } 408 428 409 - public void windowIconified(WindowEvent windowevent) { 410 - } 429 + public void repaintGame() { 430 + } 411 431 412 - public void windowOpened(WindowEvent windowevent) { 413 - } 432 + public void redraw() { 433 + } 414 434 415 - public void startup() { 416 - } 435 + public Component getParentComponent() { 436 + if (gameFrame != null) 437 + return gameFrame; 438 + else 439 + return this; 440 + } 417 441 418 - public void doLogic() { 419 - } 442 + public void startRunnable(Runnable runnable, int priority) { 443 + Thread thread = new Thread(runnable); 444 + thread.start(); 445 + thread.setPriority(priority); 446 + } 420 447 421 - public void shutdown() { 422 - } 448 + public void mouseWheelMoved(MouseWheelEvent event) { 449 + int rotation = event.getWheelRotation(); 450 + if (this instanceof Game) { 451 + if(!handleInterfaceScrolling(event, (Game) this)) { 452 + if ((client.cameraZoom <= 300 && rotation <= 0) 453 + || (client.cameraZoom >= 1200 && rotation >= 0)) { 454 + return; 455 + } 456 + int diff = rotation * 8; 457 + client.cameraZoom = client.cameraZoom + diff; 458 + } 459 + } 460 + } 423 461 424 - public void repaintGame() { 425 - } 462 + public boolean handleInterfaceScrolling(MouseWheelEvent event, Game client) { 463 + int rotation = event.getWheelRotation(); 464 + if (mouseX > 0 && mouseY > 346 && mouseX < 516 && mouseY < 505 && client.backDialogueId == -1) { 465 + if (rotation < 0) { 466 + if (client.chatboxInterface.scrollPosition >= 1) { 467 + client.chatboxScroll = client.chatboxScroll + 30; 468 + client.redrawChatbox = true; 469 + } 470 + } else { 471 + if (client.chatboxScroll < 1) { 472 + client.chatboxScroll = 0; 473 + client.redrawChatbox = true; 474 + } else { 475 + client.chatboxScroll = client.chatboxScroll - 30; 476 + client.redrawChatbox = true; 477 + } 478 + } 479 + return true; 480 + } else { 481 + int positionX = 0; 482 + int positionY = 0; 483 + int width = 0; 484 + int height = 0; 485 + int offsetX = 0; 486 + int offsetY = 0; 487 + int childID = 0; 488 + /* Tab interface scrolling */ 489 + int tabInterfaceID = client.tabInterfaceIDs[client.currentTabId]; 490 + if (tabInterfaceID != -1) { 491 + Widget tab = Widget.interfaces[tabInterfaceID]; 492 + offsetX = 765 - 218; 493 + offsetY = 503 - 298; 494 + for (int index = 0; index < tab.children.length; index++) { 495 + if (Widget.interfaces[tab.children[index]].scrollLimit > 0) { 496 + childID = index; 497 + positionX = tab.childrenX[index]; 498 + positionY = tab.childrenY[index]; 499 + width = Widget.interfaces[tab.children[index]].width; 500 + height = Widget.interfaces[tab.children[index]].height; 501 + break; 502 + } 503 + } 504 + if (mouseX > offsetX + positionX && mouseY > offsetY + positionY && mouseX < offsetX + positionX + width && mouseY < offsetY + positionY + height) { 505 + Widget.interfaces[tab.children[childID]].scrollPosition += rotation * 30; 506 + // client.tabAreaAltered = true; 507 + client.redrawTabArea = true; 508 + return true; 509 + } 510 + } 511 + /* Main interface scrolling */ 512 + if (client.openInterfaceId != -1) { 513 + Widget widget = Widget.interfaces[client.openInterfaceId]; 514 + offsetX = 4; 515 + offsetY = 4; 516 + for (int index = 0; index < widget.children.length; index++) { 517 + if (Widget.interfaces[widget.children[index]].scrollLimit > 0) { 518 + childID = index; 519 + positionX = widget.childrenX[index]; 520 + positionY = widget.childrenY[index]; 521 + width = Widget.interfaces[widget.children[index]].width; 522 + height = Widget.interfaces[widget.children[index]].height; 523 + break; 524 + } 525 + } 526 + if (mouseX > offsetX + positionX && mouseY > offsetY + positionY && mouseX < offsetX + positionX + width && mouseY < offsetY + positionY + height) { 527 + Widget.interfaces[widget.children[childID]].scrollPosition += rotation * 30; 528 + return true; 529 + } 426 530 427 - public void redraw() { 428 - } 531 + } 532 + } 533 + return false; 429 534 430 - public Component getParentComponent() { 431 - if (gameFrame != null) 432 - return gameFrame; 433 - else 434 - return this; 435 - } 436 535 437 - public void startRunnable(Runnable runnable, int priority) { 438 - Thread thread = new Thread(runnable); 439 - thread.start(); 440 - thread.setPriority(priority); 441 - } 536 + } 442 537 443 - public void drawLoadingText(int percent, String desc) { 444 - while (gameGraphics == null) { 445 - gameGraphics = getParentComponent().getGraphics(); 446 - try { 447 - getParentComponent().repaint(); 448 - } catch (Exception _ex) { 449 - } 450 - try { 451 - Thread.sleep(1000L); 452 - } catch (Exception _ex) { 453 - } 454 - } 455 - Font helveticaBold = new Font("Helvetica", 1, 13); 456 - FontMetrics fontmetrics = getParentComponent().getFontMetrics(helveticaBold); 457 - Font helvetica = new Font("Helvetica", 0, 13); 458 - getParentComponent().getFontMetrics(helvetica); 459 - if (clearScreen) { 460 - gameGraphics.setColor(Color.black); 461 - gameGraphics.fillRect(0, 0, width, height); 462 - clearScreen = false; 463 - } 464 - Color color = new Color(140, 17, 17); 465 - int centerHeight = height / 2 - 18; 466 - gameGraphics.setColor(color); 467 - gameGraphics.drawRect(width / 2 - 152, centerHeight, 304, 34); 468 - gameGraphics.fillRect(width / 2 - 150, centerHeight + 2, percent * 3, 30); 469 - gameGraphics.setColor(Color.black); 470 - gameGraphics.fillRect((width / 2 - 150) + percent * 3, centerHeight + 2, 300 - percent * 3, 30); 471 - gameGraphics.setFont(helveticaBold); 472 - gameGraphics.setColor(Color.white); 473 - gameGraphics.drawString(desc, (width - fontmetrics.stringWidth(desc)) / 2, centerHeight + 22); 474 - } 538 + public void drawLoadingText(int percent, String desc) { 539 + while (gameGraphics == null) { 540 + gameGraphics = getParentComponent().getGraphics(); 541 + try { 542 + getParentComponent().repaint(); 543 + } catch (Exception _ex) { 544 + } 545 + try { 546 + Thread.sleep(1000L); 547 + } catch (Exception _ex) { 548 + } 549 + } 550 + Font helveticaBold = new Font("Helvetica", 1, 13); 551 + FontMetrics fontmetrics = getParentComponent().getFontMetrics(helveticaBold); 552 + Font helvetica = new Font("Helvetica", 0, 13); 553 + getParentComponent().getFontMetrics(helvetica); 554 + if (clearScreen) { 555 + gameGraphics.setColor(Color.black); 556 + gameGraphics.fillRect(0, 0, width, height); 557 + clearScreen = false; 558 + } 559 + Color color = new Color(140, 17, 17); 560 + int centerHeight = height / 2 - 18; 561 + gameGraphics.setColor(color); 562 + gameGraphics.drawRect(width / 2 - 152, centerHeight, 304, 34); 563 + gameGraphics.fillRect(width / 2 - 150, centerHeight + 2, percent * 3, 30); 564 + gameGraphics.setColor(Color.black); 565 + gameGraphics.fillRect((width / 2 - 150) + percent * 3, centerHeight + 2, 300 - percent * 3, 30); 566 + gameGraphics.setFont(helveticaBold); 567 + gameGraphics.setColor(Color.white); 568 + gameGraphics.drawString(desc, (width - fontmetrics.stringWidth(desc)) / 2, centerHeight + 22); 569 + } 475 570 476 571 477 572 }
+1 -1
src/com/jagex/runescape/cache/def/ActorDefinition.java
··· 276 276 childModel.triangleSkin = null; 277 277 childModel.vectorSkin = null; 278 278 if (boundaryDimension == 1) 279 - childModel.oneSquareModel = true; 279 + childModel.singleTile = true; 280 280 return childModel; 281 281 } 282 282
+1 -1
src/com/jagex/runescape/cache/def/ItemDefinition.java
··· 418 418 419 419 } 420 420 model.applyLighting(64 + ambience, 768 + diffusion, -50, -10, -50, true); 421 - model.oneSquareModel = true; 421 + model.singleTile = true; 422 422 modelCache.put(model, id); 423 423 return model; 424 424 }
+150 -171
src/com/jagex/runescape/media/renderable/Model.java
··· 7 7 public class Model extends Renderable { 8 8 9 9 10 - public boolean singleTile = false; 11 10 public static Model EMPTY_MODEL = new Model(); 12 - public static int anIntArray1644[] = new int[2000]; 13 - public static int anIntArray1645[] = new int[2000]; 14 - public static int anIntArray1646[] = new int[2000]; 15 - public static int anIntArray1647[] = new int[2000]; 11 + private static int[] anIntArray1644 = new int[2000]; 12 + private static int[] anIntArray1645 = new int[2000]; 13 + private static int[] anIntArray1646 = new int[2000]; 14 + private static int[] anIntArray1647 = new int[2000]; 16 15 public int vertexCount; 17 - public int verticesX[]; 18 - public int verticesY[]; 19 - public int verticesZ[]; 16 + public int[] verticesX; 17 + public int[] verticesY; 18 + public int[] verticesZ; 20 19 public int triangleCount; 21 - public int trianglePointsX[]; 22 - public int trianglePointsY[]; 23 - public int trianglePointsZ[]; 24 - public int triangleHSLA[]; 25 - public int triangleHSLB[]; 26 - public int triangleHSLC[]; 27 - public int triangleDrawType[]; 28 - public int trianglePriorities[]; 29 - public int triangleAlphaValues[]; 30 - public int triangleColorValues[]; 31 - public int trianglePriority; 32 - public int texturedTriangleCount; 33 - public int texturedTrianglePointsX[]; 34 - public int texturedTrianglePointsY[]; 35 - public int texturedTrianglePointsZ[]; 36 - public int anInt1668; 20 + public int[] trianglePointsX; 21 + public int[] trianglePointsY; 22 + public int[] trianglePointsZ; 23 + private int[] triangleHSLA; 24 + private int[] triangleHSLB; 25 + private int[] triangleHSLC; 26 + public int[] triangleDrawType; 27 + private int[] trianglePriorities; 28 + private int[] triangleAlphaValues; 29 + public int[] triangleColorValues; 30 + private int trianglePriority; 31 + private int texturedTriangleCount; 32 + private int[] texturedTrianglePointsX; 33 + private int[] texturedTrianglePointsY; 34 + private int[] texturedTrianglePointsZ; 35 + private int anInt1668; 37 36 public int worldX; 38 37 public int worldZ; 39 38 public int diagonal2DAboveOrigin; 40 39 public int maxY; 41 - public int diagonal3D; 42 - public int diagonal3DAboveOrigin; 40 + private int diagonal3D; 41 + private int diagonal3DAboveOrigin; 43 42 public int anInt1675; 44 - public int vertexSkins[]; 45 - public int triangleSkinValues[]; 46 - public int vectorSkin[][]; 47 - public int triangleSkin[][]; 48 - public boolean oneSquareModel = false; 49 - public VertexNormal vertexNormalOffset[]; 50 - public static ModelHeader modelHeaders[]; 43 + private int[] vertexSkins; 44 + private int[] triangleSkinValues; 45 + public int[][] vectorSkin; 46 + public int[][] triangleSkin; 47 + public boolean singleTile = false; 48 + public VertexNormal[] vertexNormalOffset; 49 + private static ModelHeader[] modelHeaders; 51 50 public static Requester requester; 52 - public static boolean restrictEdges[] = new boolean[4096]; 53 - public static boolean aBooleanArray1685[] = new boolean[4096]; 54 - public static int vertexScreenX[] = new int[4096]; 55 - public static int vertexScreenY[] = new int[4096]; 56 - public static int vertexScreenZ[] = new int[4096]; 57 - public static int vertexMovedX[] = new int[4096]; 58 - public static int vertexMovedY[] = new int[4096]; 59 - public static int vertexMovedZ[] = new int[4096]; 60 - public static int anIntArray1692[] = new int[1500]; 61 - public static int anIntArrayArray1693[][] = new int[1500][512]; 62 - public static int anIntArray1694[] = new int[12]; 63 - public static int anIntArrayArray1695[][] = new int[12][2000]; 64 - public static int anIntArray1696[] = new int[2000]; 65 - public static int anIntArray1697[] = new int[2000]; 66 - public static int anIntArray1698[] = new int[12]; 67 - public static int anIntArray1699[] = new int[10]; 68 - public static int anIntArray1700[] = new int[10]; 69 - public static int anIntArray1701[] = new int[10]; 70 - public static int vertexXModifier; 71 - public static int vertexYModifier; 72 - public static int vertexZModifier; 51 + private static boolean[] restrictEdges = new boolean[4096]; 52 + private static boolean[] aBooleanArray1685 = new boolean[4096]; 53 + private static int[] vertexScreenX = new int[4096]; 54 + private static int[] vertexScreenY = new int[4096]; 55 + private static int[] vertexScreenZ = new int[4096]; 56 + private static int[] vertexMovedX = new int[4096]; 57 + private static int[] vertexMovedY = new int[4096]; 58 + private static int[] vertexMovedZ = new int[4096]; 59 + private static int[] anIntArray1692 = new int[1500]; 60 + private static int[][] anIntArrayArray1693 = new int[1500][512]; 61 + private static int[] anIntArray1694 = new int[12]; 62 + private static int[][] anIntArrayArray1695 = new int[12][2000]; 63 + private static int[] anIntArray1696 = new int[2000]; 64 + private static int[] anIntArray1697 = new int[2000]; 65 + private static int[] anIntArray1698 = new int[12]; 66 + private static int[] anIntArray1699 = new int[10]; 67 + private static int[] anIntArray1700 = new int[10]; 68 + private static int[] anIntArray1701 = new int[10]; 69 + private static int vertexXModifier; 70 + private static int vertexYModifier; 71 + private static int vertexZModifier; 73 72 public static boolean aBoolean1705; 74 73 public static int cursorX; 75 74 public static int cursorY; 76 75 public static int resourceCount; 77 - public static int anIntArray1709[] = new int[1000]; 78 - public static int SINE[]; 79 - public static int COSINE[]; 80 - public static int HSLtoRGB[]; 81 - public static int anIntArray1713[]; 76 + public static int[] anIntArray1709 = new int[1000]; 77 + public static int[] SINE; 78 + public static int[] COSINE; 79 + private static int[] HSLtoRGB; 80 + private static int[] anIntArray1713; 82 81 83 82 public Model() { 84 83 } ··· 218 217 219 218 220 219 public Model(int modelId) { 221 - singleTile = false; 222 220 ModelHeader modelHeader = modelHeaders[modelId]; 223 221 vertexCount = modelHeader.vertexCount; 224 222 triangleCount = modelHeader.triangleCount; ··· 365 363 366 364 } 367 365 368 - public Model(int modelCount, Model subModels[]) { 369 - singleTile = false; 366 + public Model(int modelCount, Model[] subModels) { 370 367 boolean setDrawType = false; 371 368 boolean setPriority = false; 372 369 boolean setAlpha = false; ··· 484 481 485 482 public Model(Model[] models) { 486 483 final int modelCount = 2;// was parameter 487 - singleTile = false; 488 484 boolean flag1 = false; 489 485 boolean flag2 = false; 490 486 boolean flag3 = false; ··· 608 604 609 605 public Model(boolean flag2, 610 606 Model model, boolean flag3) { 611 - singleTile = false; 612 607 vertexCount = model.vertexCount; 613 608 triangleCount = model.triangleCount; 614 609 texturedTriangleCount = model.texturedTriangleCount; ··· 658 653 } 659 654 660 655 public Model(boolean flag, boolean flag1, Model model) { 661 - singleTile = false; 662 656 vertexCount = model.vertexCount; 663 657 triangleCount = model.triangleCount; 664 658 texturedTriangleCount = model.texturedTriangleCount; ··· 782 776 texturedTrianglePointsZ = model.texturedTrianglePointsZ; 783 777 } 784 778 785 - public int getFirstIdenticalVertexIndex(Model model, int vertex) { 779 + private int getFirstIdenticalVertexIndex(Model model, int vertex) { 786 780 int identicalVertexIndex = -1; 787 781 int vertexX = model.verticesX[vertex]; 788 782 int vertexY = model.verticesY[vertex]; ··· 849 843 diagonal3D = diagonal3DAboveOrigin + (int) (Math.sqrt(diagonal2DAboveOrigin * diagonal2DAboveOrigin + maxY * maxY) + 0.98999999999999999D); 850 844 } 851 845 852 - public void calculateDiagonalsAndBounds() { 846 + private void calculateDiagonalsAndBounds() { 853 847 super.modelHeight = 0; 854 848 diagonal2DAboveOrigin = 0; 855 849 maxY = 0; 856 - int minX; 857 - int maxX; 858 - int maxZ; 859 - int minZ; 860 - minX = 32767; 861 - maxX = -32767; 862 - maxZ = -32767; 863 - minZ = 32767; 850 + int minX = 32767; 851 + int maxX = -32767; 852 + int maxZ = -32767; 853 + int minZ = 32767; 864 854 for (int vertex = 0; vertex < vertexCount; vertex++) { 865 855 int x = verticesX[vertex]; 866 856 int y = verticesY[vertex]; ··· 898 888 899 889 public void createBones() { 900 890 if (vertexSkins != null) { 901 - int ai[] = new int[256]; 891 + int[] ai = new int[256]; 902 892 int j = 0; 903 893 for (int l = 0; l < vertexCount; l++) { 904 894 int j1 = vertexSkins[l]; ··· 922 912 vertexSkins = null; 923 913 } 924 914 if (triangleSkinValues != null) { 925 - int ai1[] = new int[256]; 915 + int[] ai1 = new int[256]; 926 916 int k = 0; 927 917 for (int i1 = 0; i1 < triangleCount; i1++) { 928 918 int l1 = triangleSkinValues[i1]; ··· 970 960 971 961 } 972 962 973 - public void mixAnimationFrames(int i, int j, int k, int ai[]) { 963 + public void mixAnimationFrames(int i, int j, int k, int[] ai) { 974 964 if (k == -1) { 975 965 return; 976 966 } ··· 1022 1012 1023 1013 } 1024 1014 1025 - public void transformStep(int i, int ai[], int j, int k, int l) { 1015 + private void transformStep(int i, int[] ai, int j, int k, int l) { 1026 1016 int i1 = ai.length; 1027 1017 if (i == 0) { 1028 1018 int j1 = 0; ··· 1032 1022 for (int k2 = 0; k2 < i1; k2++) { 1033 1023 int l3 = ai[k2]; 1034 1024 if (l3 < vectorSkin.length) { 1035 - int ai5[] = vectorSkin[l3]; 1025 + int[] ai5 = vectorSkin[l3]; 1036 1026 for (int i5 = 0; i5 < ai5.length; i5++) { 1037 1027 int j6 = ai5[i5]; 1038 1028 vertexXModifier += verticesX[j6]; ··· 1060 1050 for (int k1 = 0; k1 < i1; k1++) { 1061 1051 int l2 = ai[k1]; 1062 1052 if (l2 < vectorSkin.length) { 1063 - int ai1[] = vectorSkin[l2]; 1053 + int[] ai1 = vectorSkin[l2]; 1064 1054 for (int i4 = 0; i4 < ai1.length; i4++) { 1065 1055 int j5 = ai1[i4]; 1066 1056 verticesX[j5] += j; ··· 1077 1067 for (int l1 = 0; l1 < i1; l1++) { 1078 1068 int i3 = ai[l1]; 1079 1069 if (i3 < vectorSkin.length) { 1080 - int ai2[] = vectorSkin[i3]; 1070 + int[] ai2 = vectorSkin[i3]; 1081 1071 for (int j4 = 0; j4 < ai2.length; j4++) { 1082 1072 int k5 = ai2[j4]; 1083 1073 verticesX[k5] -= vertexXModifier; ··· 1121 1111 for (int i2 = 0; i2 < i1; i2++) { 1122 1112 int j3 = ai[i2]; 1123 1113 if (j3 < vectorSkin.length) { 1124 - int ai3[] = vectorSkin[j3]; 1114 + int[] ai3 = vectorSkin[j3]; 1125 1115 for (int k4 = 0; k4 < ai3.length; k4++) { 1126 1116 int l5 = ai3[k4]; 1127 1117 verticesX[l5] -= vertexXModifier; ··· 1144 1134 for (int j2 = 0; j2 < i1; j2++) { 1145 1135 int k3 = ai[j2]; 1146 1136 if (k3 < triangleSkin.length) { 1147 - int ai4[] = triangleSkin[k3]; 1137 + int[] ai4 = triangleSkin[k3]; 1148 1138 for (int l4 = 0; l4 < ai4.length; l4++) { 1149 1139 int i6 = ai4[l4]; 1150 1140 triangleAlphaValues[i6] += j * 8; ··· 1171 1161 1172 1162 } 1173 1163 1174 - public void rotateX(int i) { 1164 + void rotateX(int i) { 1175 1165 int k = SINE[i]; 1176 1166 int l = COSINE[i]; 1177 1167 for (int i1 = 0; i1 < vertexCount; i1++) { ··· 1227 1217 1228 1218 } 1229 1219 1230 - public void applyLighting(int i, int j, int k, int l, int i1, boolean flag) { 1231 - int j1 = (int) Math.sqrt(k * k + l * l + i1 * i1); 1232 - int k1 = j * j1 >> 8; 1220 + public void applyLighting(int lightMod, int magnitudeMultiplier, int lightX, int lightY, int lightZ, boolean flatShading) { 1221 + int lightMagnitude = (int) Math.sqrt(lightX * lightX + lightY * lightY + lightZ * lightZ); 1222 + int magnitude = magnitudeMultiplier * lightMagnitude >> 8; 1233 1223 if (triangleHSLA == null) { 1234 1224 triangleHSLA = new int[triangleCount]; 1235 1225 triangleHSLB = new int[triangleCount]; ··· 1237 1227 } 1238 1228 if (super.verticesNormal == null) { 1239 1229 super.verticesNormal = new VertexNormal[vertexCount]; 1240 - for (int l1 = 0; l1 < vertexCount; l1++) { 1241 - super.verticesNormal[l1] = new VertexNormal(); 1230 + for (int vertex = 0; vertex < vertexCount; vertex++) { 1231 + super.verticesNormal[vertex] = new VertexNormal(); 1242 1232 } 1243 1233 1244 1234 } 1245 - for (int i2 = 0; i2 < triangleCount; i2++) { 1246 - int j2 = trianglePointsX[i2]; 1247 - int l2 = trianglePointsY[i2]; 1248 - int i3 = trianglePointsZ[i2]; 1249 - int j3 = verticesX[l2] - verticesX[j2]; 1250 - int k3 = verticesY[l2] - verticesY[j2]; 1251 - int l3 = verticesZ[l2] - verticesZ[j2]; 1252 - int i4 = verticesX[i3] - verticesX[j2]; 1253 - int j4 = verticesY[i3] - verticesY[j2]; 1254 - int k4 = verticesZ[i3] - verticesZ[j2]; 1255 - int l4 = k3 * k4 - j4 * l3; 1256 - int i5 = l3 * i4 - k4 * j3; 1257 - int j5; 1258 - for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 || l4 < -8192 || i5 < -8192 || j5 < -8192; j5 >>= 1) { 1259 - l4 >>= 1; 1260 - i5 >>= 1; 1235 + for (int triangle = 0; triangle < triangleCount; triangle++) { 1236 + int _triangleX = trianglePointsX[triangle]; 1237 + int _triangleY = trianglePointsY[triangle]; 1238 + int _triangleZ = trianglePointsZ[triangle]; 1239 + int distanceXXY = verticesX[_triangleY] - verticesX[_triangleX]; 1240 + int distanceYXY = verticesY[_triangleY] - verticesY[_triangleX]; 1241 + int distanceZXY = verticesZ[_triangleY] - verticesZ[_triangleX]; 1242 + int distanceXZX = verticesX[_triangleZ] - verticesX[_triangleX]; 1243 + int distanceYZX = verticesY[_triangleZ] - verticesY[_triangleX]; 1244 + int distanceZZX = verticesZ[_triangleZ] - verticesZ[_triangleX]; 1245 + int normalX = distanceYXY * distanceZZX - distanceYZX * distanceZXY; 1246 + int normalY = distanceZXY * distanceXZX - distanceZZX * distanceXXY; 1247 + int normalZ; 1248 + for (normalZ = distanceXXY * distanceYZX - distanceXZX * distanceYXY; normalX > 8192 || normalY > 8192 || normalZ > 8192 || normalX < -8192 || normalY < -8192 || normalZ < -8192; normalZ >>= 1) { 1249 + normalX >>= 1; 1250 + normalY >>= 1; 1261 1251 } 1262 1252 1263 - int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5); 1264 - if (k5 <= 0) { 1265 - k5 = 1; 1253 + int normalLength = (int) Math.sqrt(normalX * normalX + normalY * normalY + normalZ * normalZ); 1254 + if (normalLength <= 0) { 1255 + normalLength = 1; 1266 1256 } 1267 - l4 = (l4 * 256) / k5; 1268 - i5 = (i5 * 256) / k5; 1269 - j5 = (j5 * 256) / k5; 1270 - if (triangleDrawType == null || (triangleDrawType[i2] & 1) == 0) { 1271 - VertexNormal class40_2 = super.verticesNormal[j2]; 1272 - class40_2.x += l4; 1273 - class40_2.y += i5; 1274 - class40_2.z += j5; 1275 - class40_2.magnitude++; 1276 - class40_2 = super.verticesNormal[l2]; 1277 - class40_2.x += l4; 1278 - class40_2.y += i5; 1279 - class40_2.z += j5; 1280 - class40_2.magnitude++; 1281 - class40_2 = super.verticesNormal[i3]; 1282 - class40_2.x += l4; 1283 - class40_2.y += i5; 1284 - class40_2.z += j5; 1285 - class40_2.magnitude++; 1257 + normalX = (normalX * 256) / normalLength; 1258 + normalY = (normalY * 256) / normalLength; 1259 + normalZ = (normalZ * 256) / normalLength; 1260 + if (triangleDrawType == null || (triangleDrawType[triangle] & 1) == 0) { 1261 + VertexNormal vertexNormal = super.verticesNormal[_triangleX]; 1262 + vertexNormal.x += normalX; 1263 + vertexNormal.y += normalY; 1264 + vertexNormal.z += normalZ; 1265 + vertexNormal.magnitude++; 1266 + vertexNormal = super.verticesNormal[_triangleY]; 1267 + vertexNormal.x += normalX; 1268 + vertexNormal.y += normalY; 1269 + vertexNormal.z += normalZ; 1270 + vertexNormal.magnitude++; 1271 + vertexNormal = super.verticesNormal[_triangleZ]; 1272 + vertexNormal.x += normalX; 1273 + vertexNormal.y += normalY; 1274 + vertexNormal.z += normalZ; 1275 + vertexNormal.magnitude++; 1286 1276 } else { 1287 - int l5 = i + (k * l4 + l * i5 + i1 * j5) / (k1 + k1 / 2); 1288 - triangleHSLA[i2] = method597(triangleColorValues[i2], l5, triangleDrawType[i2]); 1277 + int lightness = lightMod + (lightX * normalX + lightY * normalY + lightZ * normalZ) / (magnitude + magnitude / 2); 1278 + triangleHSLA[triangle] = mixLightness(triangleColorValues[triangle], lightness, triangleDrawType[triangle]); 1289 1279 } 1290 1280 } 1291 1281 1292 - if (flag) { 1293 - method596(i, k1, k, l, i1); 1282 + if (flatShading) { 1283 + handleShading(lightMod, magnitude, lightX, lightY, lightZ); 1294 1284 } else { 1295 1285 vertexNormalOffset = new VertexNormal[vertexCount]; 1296 - for (int k2 = 0; k2 < vertexCount; k2++) { 1297 - VertexNormal class40 = super.verticesNormal[k2]; 1298 - VertexNormal class40_1 = vertexNormalOffset[k2] = new VertexNormal(); 1299 - class40_1.x = class40.x; 1300 - class40_1.y = class40.y; 1301 - class40_1.z = class40.z; 1302 - class40_1.magnitude = class40.magnitude; 1286 + for (int vertex = 0; vertex < vertexCount; vertex++) { 1287 + VertexNormal vertexNormal = super.verticesNormal[vertex]; 1288 + VertexNormal shadowVertexNormal = vertexNormalOffset[vertex] = new VertexNormal(); 1289 + shadowVertexNormal.x = vertexNormal.x; 1290 + shadowVertexNormal.y = vertexNormal.y; 1291 + shadowVertexNormal.z = vertexNormal.z; 1292 + shadowVertexNormal.magnitude = vertexNormal.magnitude; 1303 1293 } 1304 1294 1305 - anInt1668 = (i << 16) + (k1 & 0xffff); 1295 + anInt1668 = (lightMod << 16) + (magnitude & 0xffff); 1306 1296 } 1307 - if (flag) { 1297 + if (flatShading) { 1308 1298 calculateDiagonals(); 1309 - return; 1310 1299 } else { 1311 1300 calculateDiagonalsAndBounds(); 1312 - return; 1313 1301 } 1314 1302 } 1315 1303 1316 1304 public void handleShading(int i, int j, int k, int l) { 1317 1305 int i1 = anInt1668 >> 16; 1318 1306 int j1 = (anInt1668 << 16) >> 16; 1319 - if (k != 0) { 1320 - for (int k1 = 1; k1 > 0; k1++) { 1321 - ; 1322 - } 1323 - } 1324 - method596(i1, j1, l, i, j); 1307 + handleShading(i1, j1, l, i, j); 1325 1308 } 1326 1309 1327 - public void method596(int i, int j, int k, int l, int i1) { 1310 + private void handleShading(int i, int j, int k, int l, int i1) { 1328 1311 for (int j1 = 0; j1 < triangleCount; j1++) { 1329 1312 int k1 = trianglePointsX[j1]; 1330 1313 int i2 = trianglePointsY[j1]; ··· 1334 1317 VertexNormal class40 = super.verticesNormal[k1]; 1335 1318 int k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) 1336 1319 / (j * class40.magnitude); 1337 - triangleHSLA[j1] = method597(i3, k2, 0); 1320 + triangleHSLA[j1] = mixLightness(i3, k2, 0); 1338 1321 class40 = super.verticesNormal[i2]; 1339 1322 k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) / (j * class40.magnitude); 1340 - triangleHSLB[j1] = method597(i3, k2, 0); 1323 + triangleHSLB[j1] = mixLightness(i3, k2, 0); 1341 1324 class40 = super.verticesNormal[j2]; 1342 1325 k2 = i + (k * class40.x + l * class40.y + i1 * class40.z) / (j * class40.magnitude); 1343 - triangleHSLC[j1] = method597(i3, k2, 0); 1326 + triangleHSLC[j1] = mixLightness(i3, k2, 0); 1344 1327 } else if ((triangleDrawType[j1] & 1) == 0) { 1345 1328 int j3 = triangleColorValues[j1]; 1346 1329 int k3 = triangleDrawType[j1]; 1347 1330 VertexNormal class40_1 = super.verticesNormal[k1]; 1348 1331 int l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1349 1332 / (j * class40_1.magnitude); 1350 - triangleHSLA[j1] = method597(j3, l2, k3); 1333 + triangleHSLA[j1] = mixLightness(j3, l2, k3); 1351 1334 class40_1 = super.verticesNormal[i2]; 1352 1335 l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1353 1336 / (j * class40_1.magnitude); 1354 - triangleHSLB[j1] = method597(j3, l2, k3); 1337 + triangleHSLB[j1] = mixLightness(j3, l2, k3); 1355 1338 class40_1 = super.verticesNormal[j2]; 1356 1339 l2 = i + (k * class40_1.x + l * class40_1.y + i1 * class40_1.z) 1357 1340 / (j * class40_1.magnitude); 1358 - triangleHSLC[j1] = method597(j3, l2, k3); 1341 + triangleHSLC[j1] = mixLightness(j3, l2, k3); 1359 1342 } 1360 1343 } 1361 1344 ··· 1374 1357 triangleColorValues = null; 1375 1358 } 1376 1359 1377 - public static int method597(int i, int j, int k) { 1360 + private static int mixLightness(int i, int j, int k) { 1378 1361 if ((k & 2) == 2) { 1379 1362 if (j < 0) { 1380 1363 j = 0; ··· 1442 1425 1443 1426 try { 1444 1427 method599(false, false, 0); 1445 - return; 1446 1428 } catch (Exception _ex) { 1447 - return; 1448 1429 } 1449 1430 } 1450 1431 ··· 1505 1486 int i6 = cursorX - Rasterizer3D.centerX; 1506 1487 int k6 = cursorY - Rasterizer3D.centerY; 1507 1488 if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) { 1508 - if (oneSquareModel) { 1489 + if (singleTile) { 1509 1490 anIntArray1709[resourceCount++] = i2; 1510 1491 } else { 1511 1492 flag1 = true; ··· 1555 1536 1556 1537 try { 1557 1538 method599(flag, flag1, i2); 1558 - return; 1559 1539 } catch (Exception _ex) { 1560 - return; 1561 1540 } 1562 1541 } 1563 1542 1564 - public void method599(boolean flag, boolean flag1, int i) { 1543 + private void method599(boolean flag, boolean flag1, int i) { 1565 1544 for (int j = 0; j < diagonal3D; j++) { 1566 1545 anIntArray1692[j] = 0; 1567 1546 } ··· 1605 1584 for (int i1 = diagonal3D - 1; i1 >= 0; i1--) { 1606 1585 int l1 = anIntArray1692[i1]; 1607 1586 if (l1 > 0) { 1608 - int ai[] = anIntArrayArray1693[i1]; 1587 + int[] ai = anIntArrayArray1693[i1]; 1609 1588 for (int j3 = 0; j3 < l1; j3++) { 1610 1589 method600(ai[j3]); 1611 1590 } ··· 1623 1602 for (int i2 = diagonal3D - 1; i2 >= 0; i2--) { 1624 1603 int k2 = anIntArray1692[i2]; 1625 1604 if (k2 > 0) { 1626 - int ai1[] = anIntArrayArray1693[i2]; 1605 + int[] ai1 = anIntArrayArray1693[i2]; 1627 1606 for (int i4 = 0; i4 < k2; i4++) { 1628 1607 int l4 = ai1[i4]; 1629 1608 int l5 = trianglePriorities[l4]; ··· 1655 1634 } 1656 1635 int i6 = 0; 1657 1636 int k6 = anIntArray1694[10]; 1658 - int ai2[] = anIntArrayArray1695[10]; 1659 - int ai3[] = anIntArray1696; 1637 + int[] ai2 = anIntArrayArray1695[10]; 1638 + int[] ai3 = anIntArray1696; 1660 1639 if (i6 == k6) { 1661 1640 i6 = 0; 1662 1641 k6 = anIntArray1694[11]; ··· 1713 1692 } 1714 1693 } 1715 1694 int i7 = anIntArray1694[l6]; 1716 - int ai4[] = anIntArrayArray1695[l6]; 1695 + int[] ai4 = anIntArrayArray1695[l6]; 1717 1696 for (int j7 = 0; j7 < i7; j7++) { 1718 1697 method600(ai4[j7]); 1719 1698 } ··· 1736 1715 } 1737 1716 } 1738 1717 1739 - public void method600(int i) { 1718 + private void method600(int i) { 1740 1719 if (aBooleanArray1685[i]) { 1741 1720 method601(i); 1742 1721 return; ··· 1790 1769 triangleColorValues[i]); 1791 1770 } 1792 1771 1793 - public void method601(int i) { 1772 + private void method601(int i) { 1794 1773 int j = Rasterizer3D.centerX; 1795 1774 int k = Rasterizer3D.centerY; 1796 1775 int l = 0; ··· 1965 1944 } 1966 1945 } 1967 1946 1968 - public boolean method602(int i, int j, int k, int l, int i1, int j1, int k1, int l1) { 1947 + private boolean method602(int i, int j, int k, int l, int i1, int j1, int k1, int l1) { 1969 1948 if (j < k && j < l && j < i1) { 1970 1949 return false; 1971 1950 }
+1 -1
src/com/jagex/runescape/media/renderable/actor/Npc.java
··· 51 51 } 52 52 } 53 53 if (npcDefinition.boundaryDimension == 1) 54 - model.oneSquareModel = true; 54 + model.singleTile = true; 55 55 return model; 56 56 } 57 57
+2 -2
src/com/jagex/runescape/media/renderable/actor/Player.java
··· 203 203 if (appearanceModel == null) 204 204 return null; 205 205 modelHeight = appearanceModel.modelHeight; 206 - appearanceModel.oneSquareModel = true; 206 + appearanceModel.singleTile = true; 207 207 if (preventRotation) 208 208 return appearanceModel; 209 209 if (super.graphic != -1 && super.currentAnimation != -1) { ··· 256 256 drawHeight2 - drawHeight); 257 257 } 258 258 } 259 - appearanceModel.oneSquareModel = true; 259 + appearanceModel.singleTile = true; 260 260 return appearanceModel; 261 261 } 262 262