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

Configure Feed

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

Merge pull request #4 from dope-head/master

Mergin Changes from @dope-head

author
Promises
committer
GitHub
date (May 4, 2018, 2:27 AM +0200) commit 3e54f065 parent dde8e587
+712 -482
+712 -482
src/com/jagex/runescape/Game.java
··· 466 466 public volatile boolean aBoolean1243 = false; 467 467 public int inputType; 468 468 public byte aByteArray1245[] = new byte[16384]; 469 - public int anInt1246; 469 + public boolean inTutorialIsland; 470 470 public ImageRGB minimapEdge; 471 471 public MouseCapturer mouseCapturer; 472 472 public Widget aClass13_1249 = new Widget(); ··· 817 817 } 818 818 } 819 819 820 - public void addNewPlayers(int newPlayers, Buffer buf) { 821 - while (buf.bitPosition + 10 < newPlayers * 8) { 822 - int id = buf.getBits(11); 820 + private void addNewPlayers(int size, Buffer buffer) { 821 + while (buffer.bitPosition + 10 < size * 8) { 822 + int id = buffer.getBits(11); 823 + 823 824 if (id == 2047) 824 825 break; 826 + 825 827 if (players[id] == null) { 826 828 players[id] = new Player(); 829 + 827 830 if (cachedAppearances[id] != null) 828 831 players[id].updateAppearance(cachedAppearances[id]); 829 832 } 833 + 830 834 playerList[localPlayerCount++] = id; 831 - Player plr = players[id]; 832 - plr.pulseCycle = pulseCycle; 833 - int x = buf.getBits(5); 835 + Player player = players[id]; 836 + player.pulseCycle = pulseCycle; 837 + int x = buffer.getBits(5); 838 + 834 839 if (x > 15) 835 840 x -= 32; 836 - int updated = buf.getBits(1); 841 + 842 + int updated = buffer.getBits(1); 843 + 837 844 if (updated == 1) 838 845 updatedPlayers[updatedPlayerCount++] = id; 839 - int discardQueue = buf.getBits(1); 840 - int y = buf.getBits(5); 846 + 847 + int discardQueue = buffer.getBits(1); 848 + int y = buffer.getBits(5); 849 + 841 850 if (y > 15) 842 851 y -= 32; 843 - plr.setPosition(localPlayer.pathX[0] + x, localPlayer.pathY[0] + y, 844 - discardQueue == 1); 852 + 853 + player.setPosition(localPlayer.pathX[0] + x, localPlayer.pathY[0] + y, discardQueue == 1); 845 854 } 846 - buf.finishBitAccess(); 855 + 856 + buffer.finishBitAccess(); 847 857 } 848 858 849 859 private void processFlamesCycle() { ··· 857 867 while (aBoolean1243) { 858 868 anInt1101++; 859 869 860 - method81((byte) 1); 861 - method81((byte) 1); 862 - method98(47); 870 + calculateFlamePositions(); 871 + calculateFlamePositions(); 872 + renderFlames(); 863 873 864 874 if (++cycle > 10) { 865 875 long currentTime = System.currentTimeMillis(); ··· 1502 1512 outBuffer.putLEShortDup(selectedInventorySlot); 1503 1513 } 1504 1514 } else if ((anInt1300 == 1 || menuHasAddFriend(menuActionRow - 1, aByte1161)) && menuActionRow > 2) 1505 - determineMenuSize(811); 1515 + determineMenuSize(); 1506 1516 else if (menuActionRow > 0) 1507 1517 processMenuActions(menuActionRow - 1); 1508 1518 atInventoryLoopCycle = 10; ··· 2351 2361 break; 2352 2362 } 2353 2363 2354 - if (!flag1 && anInt1246 == 0) 2364 + if (!flag1 && !inTutorialIsland) 2355 2365 addChatMessage(s3, "wishes to trade with you.", 4); 2356 2366 } else if (message.endsWith(":duelreq:")) { 2357 2367 String s4 = message.substring(0, message.indexOf(":")); ··· 2364 2374 break; 2365 2375 } 2366 2376 2367 - if (!flag2 && anInt1246 == 0) 2377 + if (!flag2 && !inTutorialIsland) 2368 2378 addChatMessage(s4, "wishes to duel with you.", 8); 2369 2379 } else if (message.endsWith(":chalreq:")) { 2370 2380 String s5 = message.substring(0, message.indexOf(":")); ··· 2377 2387 break; 2378 2388 } 2379 2389 2380 - if (!flag3 && anInt1246 == 0) { 2390 + if (!flag3 && !inTutorialIsland) { 2381 2391 String s8 = message.substring(message.indexOf(":") + 1, message.length() - 9); 2382 2392 addChatMessage(s5, s8, 8); 2383 2393 } ··· 2607 2617 } 2608 2618 2609 2619 } 2610 - if (!flag4 && anInt1246 == 0) 2620 + if (!flag4 && !inTutorialIsland) 2611 2621 try { 2612 2622 anIntArray1258[anInt1152] = i19; 2613 2623 anInt1152 = (anInt1152 + 1) % 100; ··· 3128 3138 return true; 3129 3139 } 3130 3140 if (opcode == 90) { // player update 3131 - updatePlayers(packetSize, 69, buffer); 3141 + updatePlayers(packetSize, buffer); 3132 3142 aBoolean1209 = false; 3133 3143 opcode = -1; 3134 3144 return true; ··· 3186 3196 return true; 3187 3197 } 3188 3198 3189 - public void method34(byte byte0) { 3199 + private void drawMenuTooltip() { 3190 3200 if (menuActionRow < 2 && itemSelected == 0 && widgetSelected == 0) 3191 3201 return; 3192 - if (byte0 != -79) 3193 - return; 3194 - String s; 3202 + 3203 + String str; 3204 + 3195 3205 if (itemSelected == 1 && menuActionRow < 2) 3196 - s = "Use " + aString1150 + " with..."; 3206 + str = "Use " + aString1150 + " with..."; 3197 3207 else if (widgetSelected == 1 && menuActionRow < 2) 3198 - s = selectedWidgetName + "..."; 3208 + str = selectedWidgetName + "..."; 3199 3209 else 3200 - s = menuActionTexts[menuActionRow - 1]; 3210 + str = menuActionTexts[menuActionRow - 1]; 3211 + 3201 3212 if (menuActionRow > 2) 3202 - s = s + "@whi@ / " + (menuActionRow - 2) + " more options"; 3203 - fontBold.drawShadowedSeededAlphaString(s, 4, 15, 0xffffff, pulseCycle / 1000); 3213 + str = str + "@whi@ / " + (menuActionRow - 2) + " more options"; 3214 + 3215 + fontBold.drawShadowedSeededAlphaString(str, 4, 15, 0xffffff, pulseCycle / 1000); 3204 3216 } 3205 3217 3206 3218 public boolean walk(boolean flag, boolean flag1, int dstY, int srcY, int k, int l, int packetType, int j1, int dstX, int l1, ··· 3581 3593 } 3582 3594 } 3583 3595 3584 - public void parsePlayerBlocks(Buffer vec, int packetSize) { 3585 - for (int k = 0; k < updatedPlayerCount; k++) { 3586 - int id = updatedPlayers[k]; 3587 - Player plr = players[id]; 3588 - int mask = vec.getUnsignedByte(); 3596 + private void parsePlayerBlocks(Buffer buffer) { 3597 + for (int i = 0; i < updatedPlayerCount; i++) { 3598 + int id = updatedPlayers[i]; 3599 + Player player = players[id]; 3600 + int mask = buffer.getUnsignedByte(); 3601 + 3589 3602 if ((mask & 0x20) != 0) 3590 - mask += vec.getUnsignedByte() << 8; 3591 - parsePlayerBlock(id, plr, mask, vec); 3603 + mask += buffer.getUnsignedByte() << 8; 3604 + 3605 + parsePlayerBlock(id, player, mask, buffer); 3592 3606 } 3593 3607 } 3594 3608 3595 - public void updateThisPlayerMovement(int i, boolean flag, Buffer buffer) { 3609 + private void updateLocalPlayerMovement(Buffer buffer) { 3596 3610 buffer.initBitAccess(); 3611 + 3597 3612 int moved = buffer.getBits(1); 3613 + 3598 3614 if (moved == 0) 3599 3615 return; 3616 + 3600 3617 int moveType = buffer.getBits(2); 3601 - loggedIn &= flag; 3618 + 3602 3619 if (moveType == 0) { 3603 3620 updatedPlayers[updatedPlayerCount++] = thisPlayerId; 3604 3621 return; 3605 3622 } 3623 + 3606 3624 if (moveType == 1) { 3607 3625 int direction = buffer.getBits(3); 3626 + 3608 3627 localPlayer.move(direction, false); 3628 + 3609 3629 int blockUpdateRequired = buffer.getBits(1); 3630 + 3610 3631 if (blockUpdateRequired == 1) 3611 3632 updatedPlayers[updatedPlayerCount++] = thisPlayerId; 3612 3633 return; 3613 3634 } 3635 + 3614 3636 if (moveType == 2) { 3615 3637 int direction1 = buffer.getBits(3); 3638 + 3616 3639 localPlayer.move(direction1, true); 3640 + 3617 3641 int direction2 = buffer.getBits(3); 3642 + 3618 3643 localPlayer.move(direction2, true); 3644 + 3619 3645 int blockUpdateRequired = buffer.getBits(1); 3646 + 3620 3647 if (blockUpdateRequired == 1) 3621 3648 updatedPlayers[updatedPlayerCount++] = thisPlayerId; 3622 3649 return; 3623 3650 } 3651 + 3624 3652 if (moveType == 3) { 3625 3653 int discardWalkingQueue = buffer.getBits(1); 3626 3654 plane = buffer.getBits(2); 3627 3655 int localY = buffer.getBits(7); 3628 3656 int localX = buffer.getBits(7); 3629 3657 int blockUpdateRequired = buffer.getBits(1); 3658 + 3630 3659 if (blockUpdateRequired == 1) 3631 3660 updatedPlayers[updatedPlayerCount++] = thisPlayerId; 3661 + 3632 3662 localPlayer.setPosition(localX, localY, discardWalkingQueue == 1); 3633 3663 } 3634 3664 } ··· 4260 4290 if (meta == 1 && menuActionRow > 0) 4261 4291 processMenuActions(menuActionRow - 1); 4262 4292 if (meta == 2 && menuActionRow > 0) 4263 - determineMenuSize(811); 4293 + determineMenuSize(); 4264 4294 } 4265 4295 } 4266 4296 ··· 4696 4726 4697 4727 } 4698 4728 4699 - public void parsePlayerBlock(int id, Player plr, int mask, Buffer vec) { 4729 + private void parsePlayerBlock(int id, Player player, int mask, Buffer buffer) { 4700 4730 if ((mask & 8) != 0) { 4701 - int i1 = vec.getUnsignedLEShort(); 4702 - if (i1 == 65535) 4703 - i1 = -1; 4704 - int k2 = vec.getByteSubtracted(); 4705 - if (i1 == plr.emoteAnimation && i1 != -1) { 4706 - int k3 = AnimationSequence.animations[i1].anInt307; 4707 - if (k3 == 1) { 4708 - plr.displayedEmoteFrames = 0; 4709 - plr.anInt1626 = 0; 4710 - plr.animationDelay = k2; 4711 - plr.anInt1628 = 0; 4731 + int animation = buffer.getUnsignedLEShort(); 4732 + 4733 + if (animation == 65535) 4734 + animation = -1; 4735 + 4736 + int delay = buffer.getByteSubtracted(); 4737 + 4738 + if (animation == player.emoteAnimation && animation != -1) { 4739 + int mode = AnimationSequence.animations[animation].anInt307; 4740 + 4741 + if (mode == 1) { 4742 + player.displayedEmoteFrames = 0; 4743 + player.anInt1626 = 0; 4744 + player.animationDelay = delay; 4745 + player.anInt1628 = 0; 4712 4746 } 4713 - if (k3 == 2) 4714 - plr.anInt1628 = 0; 4715 - } else if (i1 == -1 4716 - || plr.emoteAnimation == -1 4717 - || AnimationSequence.animations[i1].anInt301 >= AnimationSequence.animations[plr.emoteAnimation].anInt301) { 4718 - plr.emoteAnimation = i1; 4719 - plr.displayedEmoteFrames = 0; 4720 - plr.anInt1626 = 0; 4721 - plr.animationDelay = k2; 4722 - plr.anInt1628 = 0; 4723 - plr.anInt1613 = plr.pathLength; 4747 + 4748 + if (mode == 2) 4749 + player.anInt1628 = 0; 4750 + } else if (animation == -1 || player.emoteAnimation == -1 4751 + || AnimationSequence.animations[animation].anInt301 >= AnimationSequence.animations[player.emoteAnimation].anInt301) { 4752 + player.emoteAnimation = animation; 4753 + player.displayedEmoteFrames = 0; 4754 + player.anInt1626 = 0; 4755 + player.animationDelay = delay; 4756 + player.anInt1628 = 0; 4757 + player.anInt1613 = player.pathLength; 4724 4758 } 4725 4759 } 4760 + 4726 4761 if ((mask & 0x10) != 0) { 4727 - plr.forcedChat = vec.getString(); 4728 - if (plr.forcedChat.charAt(0) == '~') { 4729 - plr.forcedChat = plr.forcedChat.substring(1); 4730 - addChatMessage(plr.playerName, plr.forcedChat, 2); 4731 - } else if (plr == localPlayer) 4732 - addChatMessage(plr.playerName, plr.forcedChat, 2); 4733 - plr.textColour = 0; 4734 - plr.textEffect = 0; 4735 - plr.textCycle = 150; 4762 + player.forcedChat = buffer.getString(); 4763 + 4764 + if (player.forcedChat.charAt(0) == '~') { 4765 + player.forcedChat = player.forcedChat.substring(1); 4766 + addChatMessage(player.playerName, player.forcedChat, 2); 4767 + } else if (player == localPlayer) { 4768 + addChatMessage(player.playerName, player.forcedChat, 2); 4769 + } 4770 + 4771 + player.textColour = 0; 4772 + player.textEffect = 0; 4773 + player.textCycle = 150; 4736 4774 } 4775 + 4737 4776 if ((mask & 0x100) != 0) { 4738 - plr.anInt1602 = vec.getByteAdded(); 4739 - plr.anInt1604 = vec.getByteNegated(); 4740 - plr.anInt1603 = vec.getByteSubtracted(); 4741 - plr.anInt1605 = vec.getUnsignedByte(); 4742 - plr.anInt1606 = vec.getUnsignedLEShort() + pulseCycle; 4743 - plr.anInt1607 = vec.method550() + pulseCycle; 4744 - plr.anInt1608 = vec.getUnsignedByte(); 4745 - plr.resetPath(); 4777 + player.anInt1602 = buffer.getByteAdded(); 4778 + player.anInt1604 = buffer.getByteNegated(); 4779 + player.anInt1603 = buffer.getByteSubtracted(); 4780 + player.anInt1605 = buffer.getUnsignedByte(); 4781 + player.anInt1606 = buffer.getUnsignedLEShort() + pulseCycle; 4782 + player.anInt1607 = buffer.method550() + pulseCycle; 4783 + player.anInt1608 = buffer.getUnsignedByte(); 4784 + 4785 + player.resetPath(); 4746 4786 } 4787 + 4747 4788 if ((mask & 1) != 0) { 4748 - plr.anInt1609 = vec.method550(); 4749 - if (plr.anInt1609 == 65535) 4750 - plr.anInt1609 = -1; 4789 + player.anInt1609 = buffer.method550(); 4790 + 4791 + if (player.anInt1609 == 65535) 4792 + player.anInt1609 = -1; 4751 4793 } 4794 + 4752 4795 if ((mask & 2) != 0) { 4753 - plr.anInt1598 = vec.getUnsignedLEShort(); 4754 - plr.anInt1599 = vec.getUnsignedLEShort(); 4796 + player.anInt1598 = buffer.getUnsignedLEShort(); 4797 + player.anInt1599 = buffer.getUnsignedLEShort(); 4755 4798 } 4799 + 4756 4800 if ((mask & 0x200) != 0) { 4757 - plr.graphic = vec.method550(); 4758 - int j1 = vec.method556(); 4759 - plr.spotAnimationDelay = j1 >> 16; 4760 - plr.anInt1617 = pulseCycle + (j1 & 0xffff); 4761 - plr.currentAnimation = 0; 4762 - plr.anInt1616 = 0; 4763 - if (plr.anInt1617 > pulseCycle) 4764 - plr.currentAnimation = -1; 4765 - if (plr.graphic == 65535) 4766 - plr.graphic = -1; 4801 + player.graphic = buffer.method550(); 4802 + int heightAndDelay = buffer.method556(); 4803 + player.spotAnimationDelay = heightAndDelay >> 16; 4804 + player.anInt1617 = pulseCycle + (heightAndDelay & 0xffff); 4805 + player.currentAnimation = 0; 4806 + player.anInt1616 = 0; 4807 + 4808 + if (player.anInt1617 > pulseCycle) 4809 + player.currentAnimation = -1; 4810 + 4811 + if (player.graphic == 65535) 4812 + player.graphic = -1; 4767 4813 } 4814 + 4768 4815 if ((mask & 4) != 0) { 4769 - int size = vec.getUnsignedByte(); 4816 + int size = buffer.getUnsignedByte(); 4770 4817 byte bytes[] = new byte[size]; 4771 4818 Buffer appearance = new Buffer(bytes); 4772 - vec.getBytesReverse(bytes, 0, size); 4819 + 4820 + buffer.getBytesReverse(bytes, 0, size); 4821 + 4773 4822 cachedAppearances[id] = appearance; 4774 - plr.updateAppearance(appearance); 4823 + 4824 + player.updateAppearance(appearance); 4775 4825 } 4826 + 4776 4827 if ((mask & 0x400) != 0) { 4777 - int l1 = vec.getByteAdded(); 4778 - int l2 = vec.getByteSubtracted(); 4779 - plr.updateHits(l2, l1, pulseCycle); 4780 - plr.endCycle = pulseCycle + 300; 4781 - plr.anInt1596 = vec.getByteNegated(); 4782 - plr.anInt1597 = vec.getUnsignedByte(); 4828 + int damage = buffer.getByteAdded(); 4829 + int type = buffer.getByteSubtracted(); 4830 + 4831 + player.updateHits(type, damage, pulseCycle); 4832 + 4833 + player.endCycle = pulseCycle + 300; 4834 + player.anInt1596 = buffer.getByteNegated(); 4835 + player.anInt1597 = buffer.getUnsignedByte(); 4783 4836 } 4837 + 4784 4838 if ((mask & 0x40) != 0) { 4785 - int i2 = vec.getUnsignedLEShort(); 4786 - int rights = vec.getByteNegated(); 4787 - int length = vec.getByteAdded(); 4788 - int i4 = vec.currentPosition; 4789 - if (plr.playerName != null && plr.visible) { 4790 - long l4 = TextUtils.nameToLong(plr.playerName); 4791 - boolean flag = false; 4839 + int effectsAndColour = buffer.getUnsignedLEShort(); 4840 + int rights = buffer.getByteNegated(); 4841 + int length = buffer.getByteAdded(); 4842 + int currentPosition = buffer.currentPosition; 4843 + 4844 + if (player.playerName != null && player.visible) { 4845 + long nameLong = TextUtils.nameToLong(player.playerName); 4846 + boolean ignored = false; 4847 + 4792 4848 if (rights <= 1) { 4793 - for (int j4 = 0; j4 < ignoresCount; j4++) { 4794 - if (ignores[j4] != l4) 4849 + for (int i = 0; i < ignoresCount; i++) { 4850 + if (ignores[i] != nameLong) 4795 4851 continue; 4796 - flag = true; 4852 + 4853 + ignored = true; 4797 4854 break; 4798 4855 } 4799 4856 4800 4857 } 4801 - if (!flag && anInt1246 == 0) 4802 - try { 4803 - chatBuffer.currentPosition = 0; 4804 - vec.getBytesAdded(chatBuffer.buffer, 0, length); 4805 - chatBuffer.currentPosition = 0; 4806 - String s = ChatEncoder.get(length, chatBuffer); 4807 - s = ChatCensor.censorString(s); 4808 - plr.forcedChat = s; 4809 - plr.textColour = i2 >> 8; 4810 - plr.textEffect = i2 & 0xff; 4811 - plr.textCycle = 150; 4812 - if (rights == 2 || rights == 3) 4813 - addChatMessage("@cr2@" + plr.playerName, s, 1); 4814 - else if (rights == 1) 4815 - addChatMessage("@cr1@" + plr.playerName, s, 1); 4816 - else 4817 - addChatMessage(plr.playerName, s, 2); 4818 - } catch (Exception exception) { 4819 - SignLink.reportError("cde2"); 4820 - } 4858 + 4859 + if (!ignored && !inTutorialIsland) { 4860 + try { 4861 + chatBuffer.currentPosition = 0; 4862 + 4863 + buffer.getBytesAdded(chatBuffer.buffer, 0, length); 4864 + 4865 + chatBuffer.currentPosition = 0; 4866 + String message = ChatCensor.censorString(ChatEncoder.get(length, chatBuffer)); 4867 + player.forcedChat = message; 4868 + player.textColour = effectsAndColour >> 8; 4869 + player.textEffect = effectsAndColour & 0xff; 4870 + player.textCycle = 150; 4871 + 4872 + if (rights == 2 || rights == 3) 4873 + addChatMessage("@cr2@" + player.playerName, message, 1); 4874 + else if (rights == 1) 4875 + addChatMessage("@cr1@" + player.playerName, message, 1); 4876 + else 4877 + addChatMessage(player.playerName, message, 2); 4878 + } catch (Exception exception) { 4879 + SignLink.reportError("cde2"); 4880 + } 4881 + } 4821 4882 } 4822 - vec.currentPosition = i4 + length; 4883 + 4884 + buffer.currentPosition = currentPosition + length; 4823 4885 } 4886 + 4824 4887 if ((mask & 0x80) != 0) { 4825 - int j2 = vec.getByteSubtracted(); 4826 - int j3 = vec.getByteNegated(); 4827 - plr.updateHits(j3, j2, pulseCycle); 4828 - plr.endCycle = pulseCycle + 300; 4829 - plr.anInt1596 = vec.getByteSubtracted(); 4830 - plr.anInt1597 = vec.getUnsignedByte(); 4888 + int damage = buffer.getByteSubtracted(); 4889 + int type = buffer.getByteNegated(); 4890 + 4891 + player.updateHits(type, damage, pulseCycle); 4892 + 4893 + player.endCycle = pulseCycle + 300; 4894 + player.anInt1596 = buffer.getByteSubtracted(); 4895 + player.anInt1597 = buffer.getUnsignedByte(); 4831 4896 } 4832 4897 } 4833 4898 4834 4899 public void resetTitleScreen() { 4835 4900 if (aClass18_1198 != null) 4836 4901 return; 4902 + 4837 4903 super.imageProducer = null; 4838 4904 chatboxProducingGraphicsBuffer = null; 4839 4905 aClass18_1157 = null; ··· 4844 4910 4845 4911 flameLeftBackground = new ProducingGraphicsBuffer(128, 265, getParentComponent()); 4846 4912 Rasterizer.resetPixels(); 4913 + 4847 4914 flameRightBackground = new ProducingGraphicsBuffer(128, 265, getParentComponent()); 4848 4915 Rasterizer.resetPixels(); 4916 + 4849 4917 aClass18_1198 = new ProducingGraphicsBuffer(509, 171, getParentComponent()); 4850 4918 Rasterizer.resetPixels(); 4919 + 4851 4920 aClass18_1199 = new ProducingGraphicsBuffer(360, 132, getParentComponent()); 4852 4921 Rasterizer.resetPixels(); 4922 + 4853 4923 aClass18_1200 = new ProducingGraphicsBuffer(360, 200, getParentComponent()); 4854 4924 Rasterizer.resetPixels(); 4925 + 4855 4926 aClass18_1203 = new ProducingGraphicsBuffer(202, 238, getParentComponent()); 4856 4927 Rasterizer.resetPixels(); 4928 + 4857 4929 aClass18_1204 = new ProducingGraphicsBuffer(203, 238, getParentComponent()); 4858 4930 Rasterizer.resetPixels(); 4931 + 4859 4932 aClass18_1205 = new ProducingGraphicsBuffer(74, 94, getParentComponent()); 4860 4933 Rasterizer.resetPixels(); 4934 + 4861 4935 aClass18_1206 = new ProducingGraphicsBuffer(75, 94, getParentComponent()); 4862 4936 Rasterizer.resetPixels(); 4937 + 4863 4938 if (titleArchive != null) { 4864 4939 prepareTitleBackground(); 4865 4940 prepareTitle(); 4866 4941 } 4942 + 4867 4943 aBoolean1046 = true; 4868 4944 } 4869 4945 4870 4946 public void startup() { 4871 4947 drawLoadingText(20, "Starting up"); 4948 + 4872 4949 if (SignLink.cacheData != null) { 4873 4950 for (int type = 0; type < 5; type++) 4874 4951 stores[type] = new Index(type + 1, 0x927c0, SignLink.cacheData, SignLink.cacheIndex[type]); 4875 4952 } 4953 + 4876 4954 try { 4877 - requestArchiveCrcs(); 4955 + if (Configuration.JAGGRAB_ENABLED) 4956 + requestArchiveCrcs(); 4957 + 4878 4958 titleArchive = requestArchive(1, "title", archiveHashes[1], 25, "title screen"); 4879 4959 fontSmall = new TypeFace(false, titleArchive, "p11_full"); 4880 4960 fontNormal = new TypeFace(false, titleArchive, "p12_full"); 4881 4961 fontBold = new TypeFace(false, titleArchive, "b12_full"); 4882 4962 fontFancy = new TypeFace(true, titleArchive, "q8_full"); 4963 + 4883 4964 prepareTitleBackground(); 4884 4965 prepareTitle(); 4966 + 4885 4967 Archive configArchive = requestArchive(2, "config", archiveHashes[2], 30, "config"); 4886 4968 Archive archiveInterface = requestArchive(3, "interface", archiveHashes[3], 35, "interface"); 4887 4969 Archive archiveMedia = requestArchive(4, "media", archiveHashes[4], 40, "2d gameGraphics"); ··· 4891 4973 currentSceneTileFlags = new byte[4][104][104]; 4892 4974 anIntArrayArrayArray891 = new int[4][105][105]; 4893 4975 currentScene = new Scene(anIntArrayArrayArray891, 104, 4, 104, (byte) 5); 4976 + 4894 4977 for (int j = 0; j < 4; j++) 4895 4978 currentCollisionMap[j] = new CollisionMap(104, 104); 4896 4979 4897 4980 minimapImage = new ImageRGB(512, 512); 4898 4981 Archive versionListArchive = requestArchive(5, "versionlist", archiveHashes[5], 60, "update list"); 4982 + 4899 4983 drawLoadingText(60, "Connecting to update server"); 4984 + 4900 4985 onDemandRequester = new OnDemandRequester(); 4901 4986 onDemandRequester.init(versionListArchive, this); 4987 + 4902 4988 Animation.method235(onDemandRequester.animCount()); 4903 4989 Model.init(onDemandRequester.fileCount(0), onDemandRequester); 4990 + 4904 4991 if (!lowMemory) { 4905 4992 nextSong = 0; 4906 - try 4907 - { 4993 + 4994 + try { 4908 4995 nextSong = Integer.parseInt(getParameter("music")); 4909 - } 4910 - catch(Exception _ex) { } 4911 - songChanging = true; 4996 + } catch(Exception ignored) {} 4997 + 4998 + songChanging = true; 4999 + 4912 5000 onDemandRequester.request(2, nextSong); 5001 + 4913 5002 while (onDemandRequester.method333() > 0) { 4914 5003 method77(false); 5004 + 4915 5005 try { 4916 5006 Thread.sleep(100L); 4917 - } catch (Exception _ex) { 4918 - } 5007 + } catch (Exception ignored) {} 5008 + 4919 5009 if (onDemandRequester.requestFails > 3) { 4920 5010 method19("ondemand"); 4921 5011 return; 4922 5012 } 4923 5013 } 4924 5014 } 5015 + 4925 5016 drawLoadingText(65, "Requesting animations"); 5017 + 4926 5018 int fileRequestCount = onDemandRequester.fileCount(1); 4927 - for (int l = 0; l < fileRequestCount; l++) 4928 - onDemandRequester.request(1, l); 5019 + 5020 + for (int i = 0; i < fileRequestCount; i++) 5021 + onDemandRequester.request(1, i); 4929 5022 4930 5023 while (onDemandRequester.method333() > 0) { 4931 - int i1 = fileRequestCount - onDemandRequester.method333(); 4932 - if (i1 > 0) 4933 - drawLoadingText(65, "Loading animations - " + (i1 * 100) / fileRequestCount + "%"); 5024 + int total = fileRequestCount - onDemandRequester.method333(); 5025 + 5026 + if (total > 0) 5027 + drawLoadingText(65, "Loading animations - " + (total * 100) / fileRequestCount + "%"); 5028 + 4934 5029 method77(false); 5030 + 4935 5031 try { 4936 5032 Thread.sleep(100L); 4937 - } catch (Exception _ex) { 4938 - } 5033 + } catch (Exception ignored) {} 5034 + 4939 5035 if (onDemandRequester.requestFails > 3) { 4940 5036 method19("ondemand"); 4941 5037 return; 4942 5038 } 4943 5039 } 5040 + 4944 5041 drawLoadingText(70, "Requesting models"); 5042 + 4945 5043 fileRequestCount = onDemandRequester.fileCount(0); 4946 - for (int j1 = 0; j1 < fileRequestCount; j1++) { 4947 - int k1 = onDemandRequester.modelId(j1); 4948 - if ((k1 & 1) != 0) 4949 - onDemandRequester.request(0, j1); 5044 + 5045 + for (int i = 0; i < fileRequestCount; i++) { 5046 + int id = onDemandRequester.modelId(i); 5047 + 5048 + if ((id & 1) != 0) 5049 + onDemandRequester.request(0, i); 4950 5050 } 4951 5051 4952 5052 fileRequestCount = onDemandRequester.method333(); 5053 + 4953 5054 while (onDemandRequester.method333() > 0) { 4954 - int l1 = fileRequestCount - onDemandRequester.method333(); 4955 - if (l1 > 0) 4956 - drawLoadingText(70, "Loading models - " + (l1 * 100) / fileRequestCount + "%"); 5055 + int total = fileRequestCount - onDemandRequester.method333(); 5056 + 5057 + if (total > 0) 5058 + drawLoadingText(70, "Loading models - " + (total * 100) / fileRequestCount + "%"); 5059 + 4957 5060 method77(false); 5061 + 4958 5062 try { 4959 5063 Thread.sleep(100L); 4960 - } catch (Exception _ex) { 4961 - } 5064 + } catch (Exception ignored) {} 4962 5065 } 5066 + 4963 5067 if (stores[0] != null) { 4964 5068 drawLoadingText(75, "Requesting maps"); 4965 5069 onDemandRequester.request(3, onDemandRequester.regId(0, 47, 48, 0)); // these are the maps around tutorial island ··· 4974 5078 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 47, 1)); 4975 5079 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 148, 0)); 4976 5080 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 148, 1)); 5081 + 4977 5082 fileRequestCount = onDemandRequester.method333(); 5083 + 4978 5084 while (onDemandRequester.method333() > 0) { 4979 - int i2 = fileRequestCount - onDemandRequester.method333(); 4980 - if (i2 > 0) 4981 - drawLoadingText(75, "Loading maps - " + (i2 * 100) / fileRequestCount + "%"); 5085 + int total = fileRequestCount - onDemandRequester.method333(); 5086 + 5087 + if (total > 0) 5088 + drawLoadingText(75, "Loading maps - " + (total * 100) / fileRequestCount + "%"); 5089 + 4982 5090 method77(false); 5091 + 4983 5092 try { 4984 5093 Thread.sleep(100L); 4985 - } catch (Exception _ex) { 4986 - } 5094 + } catch (Exception ignored) {} 4987 5095 } 4988 5096 } 5097 + 4989 5098 fileRequestCount = onDemandRequester.fileCount(0); 4990 - for (int j2 = 0; j2 < fileRequestCount; j2++) { 4991 - int k2 = onDemandRequester.modelId(j2); 4992 - byte byte0 = 0; 4993 - if ((k2 & 8) != 0) 4994 - byte0 = 10; 4995 - else if ((k2 & 0x20) != 0) 4996 - byte0 = 9; 4997 - else if ((k2 & 0x10) != 0) 4998 - byte0 = 8; 4999 - else if ((k2 & 0x40) != 0) 5000 - byte0 = 7; 5001 - else if ((k2 & 0x80) != 0) 5002 - byte0 = 6; 5003 - else if ((k2 & 2) != 0) 5004 - byte0 = 5; 5005 - else if ((k2 & 4) != 0) 5006 - byte0 = 4; 5007 - if ((k2 & 1) != 0) 5008 - byte0 = 3; 5009 - if (byte0 != 0) 5010 - onDemandRequester.setPriority(byte0, 0, j2); 5099 + 5100 + for (int i = 0; i < fileRequestCount; i++) { 5101 + int id = onDemandRequester.modelId(i); 5102 + byte priority = 0; 5103 + 5104 + if ((id & 8) != 0) 5105 + priority = 10; 5106 + else if ((id & 0x20) != 0) 5107 + priority = 9; 5108 + else if ((id & 0x10) != 0) 5109 + priority = 8; 5110 + else if ((id & 0x40) != 0) 5111 + priority = 7; 5112 + else if ((id & 0x80) != 0) 5113 + priority = 6; 5114 + else if ((id & 2) != 0) 5115 + priority = 5; 5116 + else if ((id & 4) != 0) 5117 + priority = 4; 5118 + if ((id & 1) != 0) 5119 + priority = 3; 5120 + 5121 + if (priority != 0) 5122 + onDemandRequester.setPriority(priority, 0, i); 5011 5123 } 5012 5124 5013 5125 onDemandRequester.preloadRegions(memberServer); 5126 + 5014 5127 if (!lowMemory) { 5015 5128 fileRequestCount = onDemandRequester.fileCount(2); 5016 - for (int id = 1; id < fileRequestCount; id++) 5017 - if (onDemandRequester.midiIdEqualsOne(id)) 5018 - onDemandRequester.setPriority((byte) 1, 2, id); 5019 5129 5130 + for (int i = 1; i < fileRequestCount; i++) { 5131 + if (onDemandRequester.midiIdEqualsOne(i)) 5132 + onDemandRequester.setPriority((byte) 1, 2, i); 5133 + } 5020 5134 } 5135 + 5021 5136 fileRequestCount = onDemandRequester.fileCount(0); 5022 - for (int i3 = 0; i3 < fileRequestCount; i3++) { 5023 - int j3 = onDemandRequester.modelId(i3); 5024 - if (j3 == 0 && onDemandRequester.anInt1350 < 200) 5025 - onDemandRequester.setPriority((byte) 1, 0, i3); 5137 + 5138 + for (int i = 0; i < fileRequestCount; i++) { 5139 + int id = onDemandRequester.modelId(i); 5140 + 5141 + if (id == 0 && onDemandRequester.anInt1350 < 200) 5142 + onDemandRequester.setPriority((byte) 1, 0, i); 5026 5143 } 5027 5144 5028 5145 drawLoadingText(80, "Unpacking media"); 5146 + 5029 5147 inventoryBackgroundImage = new IndexedImage(archiveMedia, "invback", 0); 5030 5148 chatboxBackgroundImage = new IndexedImage(archiveMedia, "chatback", 0); 5031 5149 minimapBackgroundImage = new IndexedImage(archiveMedia, "mapback", 0); 5032 5150 anIndexedImage1052 = new IndexedImage(archiveMedia, "backbase1", 0); 5033 5151 anIndexedImage1053 = new IndexedImage(archiveMedia, "backbase2", 0); 5034 5152 anIndexedImage1054 = new IndexedImage(archiveMedia, "backhmid1", 0); 5035 - for (int tab = 0; tab < 13; tab++) 5036 - tabIcon[tab] = new IndexedImage(archiveMedia, "sideicons", tab); 5153 + 5154 + for (int i = 0; i < 13; i++) 5155 + tabIcon[i] = new IndexedImage(archiveMedia, "sideicons", i); 5037 5156 5038 5157 minimapCompass = new ImageRGB(archiveMedia, "compass", 0); 5039 5158 minimapEdge = new ImageRGB(archiveMedia, "mapedge", 0); 5040 5159 minimapEdge.trim(); 5160 + 5041 5161 for (int i = 0; i < 72; i++) 5042 5162 aClass50_Sub1_Sub1_Sub3Array1153[i] = new IndexedImage(archiveMedia, "mapscene", i); 5043 5163 ··· 5059 5179 aClass50_Sub1_Sub1_Sub1_1086 = new ImageRGB(archiveMedia, "overlay_multiway", 0); 5060 5180 mapFlagMarker = new ImageRGB(archiveMedia, "mapmarker", 0); 5061 5181 aClass50_Sub1_Sub1_Sub1_1037 = new ImageRGB(archiveMedia, "mapmarker", 1); 5182 + 5062 5183 for (int i = 0; i < 8; i++) 5063 5184 cursorCross[i] = new ImageRGB(archiveMedia, "cross", i); 5064 5185 ··· 5074 5195 aClass50_Sub1_Sub1_Sub3_882 = new IndexedImage(archiveMedia, "redstone3", 0); 5075 5196 aClass50_Sub1_Sub1_Sub3_883 = new IndexedImage(archiveMedia, "redstone1", 0); 5076 5197 aClass50_Sub1_Sub1_Sub3_883.flipHorizontal(); 5198 + 5077 5199 aClass50_Sub1_Sub1_Sub3_884 = new IndexedImage(archiveMedia, "redstone2", 0); 5078 5200 aClass50_Sub1_Sub1_Sub3_884.flipHorizontal(); 5201 + 5079 5202 aClass50_Sub1_Sub1_Sub3_983 = new IndexedImage(archiveMedia, "redstone1", 0); 5080 5203 aClass50_Sub1_Sub1_Sub3_983.flipVertical(); 5204 + 5081 5205 aClass50_Sub1_Sub1_Sub3_984 = new IndexedImage(archiveMedia, "redstone2", 0); 5082 5206 aClass50_Sub1_Sub1_Sub3_984.flipVertical(); 5207 + 5083 5208 aClass50_Sub1_Sub1_Sub3_985 = new IndexedImage(archiveMedia, "redstone3", 0); 5084 5209 aClass50_Sub1_Sub1_Sub3_985.flipVertical(); 5210 + 5085 5211 aClass50_Sub1_Sub1_Sub3_986 = new IndexedImage(archiveMedia, "redstone1", 0); 5086 5212 aClass50_Sub1_Sub1_Sub3_986.flipHorizontal(); 5087 5213 aClass50_Sub1_Sub1_Sub3_986.flipVertical(); 5214 + 5088 5215 aClass50_Sub1_Sub1_Sub3_987 = new IndexedImage(archiveMedia, "redstone2", 0); 5089 5216 aClass50_Sub1_Sub1_Sub3_987.flipHorizontal(); 5090 5217 aClass50_Sub1_Sub1_Sub3_987.flipVertical(); 5218 + 5091 5219 for (int i = 0; i < 2; i++) 5092 5220 moderatorIcon[i] = new IndexedImage(archiveMedia, "mod_icons", i); 5093 5221 5094 5222 ImageRGB image = new ImageRGB(archiveMedia, "backleft1", 0); 5095 5223 aClass18_906 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5096 5224 image.drawInverse(0, 0); 5225 + 5097 5226 image = new ImageRGB(archiveMedia, "backleft2", 0); 5098 5227 aClass18_907 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5099 5228 image.drawInverse(0, 0); 5229 + 5100 5230 image = new ImageRGB(archiveMedia, "backright1", 0); 5101 5231 aClass18_908 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5102 5232 image.drawInverse(0, 0); 5233 + 5103 5234 image = new ImageRGB(archiveMedia, "backright2", 0); 5104 5235 aClass18_909 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5105 5236 image.drawInverse(0, 0); 5237 + 5106 5238 image = new ImageRGB(archiveMedia, "backtop1", 0); 5107 5239 aClass18_910 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5108 5240 image.drawInverse(0, 0); 5241 + 5109 5242 image = new ImageRGB(archiveMedia, "backvmid1", 0); 5110 5243 aClass18_911 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5111 5244 image.drawInverse(0, 0); 5245 + 5112 5246 image = new ImageRGB(archiveMedia, "backvmid2", 0); 5113 5247 aClass18_912 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5114 5248 image.drawInverse(0, 0); 5249 + 5115 5250 image = new ImageRGB(archiveMedia, "backvmid3", 0); 5116 5251 aClass18_913 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5117 5252 image.drawInverse(0, 0); 5253 + 5118 5254 image = new ImageRGB(archiveMedia, "backhmid2", 0); 5119 5255 aClass18_914 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5120 5256 image.drawInverse(0, 0); 5121 - int l5 = (int) (Math.random() * 21D) - 10; 5122 - int i6 = (int) (Math.random() * 21D) - 10; 5123 - int j6 = (int) (Math.random() * 21D) - 10; 5124 - int k6 = (int) (Math.random() * 41D) - 20; 5125 - for (int l6 = 0; l6 < 100; l6++) { 5126 - if (worldMapHintIcons[l6] != null) 5127 - worldMapHintIcons[l6].adjustRGB(l5 + k6, i6 + k6, j6 + k6); 5128 - if (aClass50_Sub1_Sub1_Sub3Array1153[l6] != null) 5129 - aClass50_Sub1_Sub1_Sub3Array1153[l6].mixPalette(l5 + k6, i6 + k6, j6 + k6); 5257 + 5258 + int offset = (int) (Math.random() * 41D) - 20; 5259 + int red = (int) ((Math.random() * 21D) - 10) + offset; 5260 + int green = (int) ((Math.random() * 21D) - 10) + offset; 5261 + int blue = (int) ((Math.random() * 21D) - 10) + offset; 5262 + 5263 + for (int i = 0; i < 100; i++) { 5264 + if (worldMapHintIcons[i] != null) 5265 + worldMapHintIcons[i].adjustRGB(red, green, blue); 5266 + 5267 + if (aClass50_Sub1_Sub1_Sub3Array1153[i] != null) 5268 + aClass50_Sub1_Sub1_Sub3Array1153[i].mixPalette(red, green, blue); 5130 5269 } 5131 5270 5132 5271 drawLoadingText(83, "Unpacking textures"); ··· 5143 5282 SpotAnimation.load(configArchive); 5144 5283 Varp.load(configArchive); 5145 5284 Varbit.load(configArchive); 5285 + 5146 5286 ItemDefinition.memberServer = memberServer; 5287 + 5147 5288 if (!lowMemory) { 5148 5289 drawLoadingText(90, "Unpacking sounds"); 5149 - byte bs[] = soundArchive.getFile("sounds.dat"); 5150 - Buffer buffer = new Buffer(bs); 5290 + 5291 + byte[] bytes = soundArchive.getFile("sounds.dat"); 5292 + Buffer buffer = new Buffer(bytes); 5293 + 5151 5294 SoundTrack.load(buffer); 5152 5295 } 5296 + 5153 5297 drawLoadingText(95, "Unpacking interfaces"); 5154 - TypeFace[] typefaces = {fontSmall, 5155 - fontNormal, fontBold, fontFancy}; 5298 + 5299 + TypeFace[] typefaces = {fontSmall, fontNormal, fontBold, fontFancy}; 5300 + 5156 5301 Widget.load(archiveInterface, typefaces, archiveMedia); 5157 5302 drawLoadingText(100, "Preparing game engine"); 5158 - for (int i7 = 0; i7 < 33; i7++) { 5159 - int j7 = 999; 5160 - int l7 = 0; 5161 - for (int j8 = 0; j8 < 34; j8++) { 5162 - if (minimapBackgroundImage.pixels[j8 + i7 * minimapBackgroundImage.width] == 0) { 5163 - if (j7 == 999) 5164 - j7 = j8; 5303 + 5304 + for (int y = 0; y < 33; y++) { 5305 + int minWidth = 999; 5306 + int maxWidth = 0; 5307 + 5308 + for (int x = 0; x < 34; x++) { 5309 + if (minimapBackgroundImage.pixels[x + y * minimapBackgroundImage.width] == 0) { 5310 + if (minWidth == 999) 5311 + minWidth = x; 5312 + 5165 5313 continue; 5166 5314 } 5167 - if (j7 == 999) 5315 + 5316 + if (minWidth == 999) 5168 5317 continue; 5169 - l7 = j8; 5318 + 5319 + maxWidth = x; 5170 5320 break; 5171 5321 } 5172 5322 5173 - anIntArray1180[i7] = j7; 5174 - anIntArray1286[i7] = l7 - j7; 5323 + anIntArray1180[y] = minWidth; 5324 + anIntArray1286[y] = maxWidth - minWidth; 5175 5325 } 5176 5326 5177 - for (int k7 = 5; k7 < 156; k7++) { 5178 - int i8 = 999; 5179 - int k8 = 0; 5180 - for (int i9 = 25; i9 < 172; i9++) { 5181 - if (minimapBackgroundImage.pixels[i9 + k7 * minimapBackgroundImage.width] == 0 5182 - && (i9 > 34 || k7 > 34)) { 5183 - if (i8 == 999) 5184 - i8 = i9; 5327 + for (int y = 5; y < 156; y++) { 5328 + int minWidth = 999; 5329 + int maxWidth = 0; 5330 + 5331 + for (int x = 25; x < 172; x++) { 5332 + if (minimapBackgroundImage.pixels[x + y * minimapBackgroundImage.width] == 0 5333 + && (x > 34 || y > 34)) { 5334 + if (minWidth == 999) 5335 + minWidth = x; 5336 + 5185 5337 continue; 5186 5338 } 5187 - if (i8 == 999) 5339 + 5340 + if (minWidth == 999) 5188 5341 continue; 5189 - k8 = i9; 5342 + 5343 + maxWidth = x; 5190 5344 break; 5191 5345 } 5192 5346 5193 - anIntArray1019[k7 - 5] = i8 - 25; 5194 - anIntArray920[k7 - 5] = k8 - i8; 5347 + anIntArray1019[y - 5] = minWidth - 25; 5348 + anIntArray920[y - 5] = maxWidth - minWidth; 5195 5349 } 5196 5350 5197 5351 Rasterizer3D.method494(765, 503); 5198 5352 anIntArray1003 = Rasterizer3D.lineOffsets; 5353 + 5199 5354 Rasterizer3D.method494(479, 96); 5200 5355 chatboxLineOffsets = Rasterizer3D.lineOffsets; 5356 + 5201 5357 Rasterizer3D.method494(190, 261); 5202 5358 anIntArray1001 = Rasterizer3D.lineOffsets; 5359 + 5203 5360 Rasterizer3D.method494(512, 334); 5204 5361 anIntArray1002 = Rasterizer3D.lineOffsets; 5362 + 5205 5363 int ai[] = new int[9]; 5206 - for (int l8 = 0; l8 < 9; l8++) { 5207 - int j9 = 128 + l8 * 32 + 15; 5364 + 5365 + for (int i = 0; i < 9; i++) { //TODO: Needs refactoring 5366 + int j9 = 128 + i * 32 + 15; 5208 5367 int k9 = 600 + j9 * 3; 5209 5368 int l9 = Rasterizer3D.SINE[j9]; 5210 - ai[l8] = k9 * l9 >> 16; 5369 + ai[i] = k9 * l9 >> 16; 5211 5370 } 5212 5371 5213 5372 Scene.method277(500, 800, 512, 334, ai); 5214 5373 ChatCensor.load(chatArchive); 5374 + 5215 5375 mouseCapturer = new MouseCapturer(this); 5376 + 5216 5377 startRunnable(mouseCapturer, 10); 5378 + 5217 5379 GameObject.client = this; 5218 5380 GameObjectDefinition.client = this; 5219 5381 ActorDefinition.client = this; ··· 5221 5383 } catch (Exception exception) { 5222 5384 SignLink.reportError("loaderror " + aString1027 + " " + anInt1322); 5223 5385 } 5386 + 5224 5387 aBoolean1283 = true; 5225 5388 } 5226 5389 ··· 5800 5963 } 5801 5964 if (!menuOpen) { 5802 5965 processRightClick(-521); 5803 - method34((byte) -79); 5966 + drawMenuTooltip(); 5804 5967 } else { 5805 5968 method128(false); 5806 5969 } ··· 6019 6182 } 6020 6183 } 6021 6184 6022 - public void method75(int i) { 6023 - packetSize += i; 6185 + private void renderSplitPrivateMessages() { 6024 6186 if (anInt1223 == 0) 6025 6187 return; 6026 - TypeFace class50_sub1_sub1_sub2 = fontNormal; 6027 - int j = 0; 6188 + 6189 + TypeFace typeFace = fontNormal; 6190 + int line = 0; 6191 + 6028 6192 if (systemUpdateTime != 0) 6029 - j = 1; 6030 - for (int k = 0; k < 100; k++) 6031 - if (chatMessages[k] != null) { 6032 - int l = chatTypes[k]; 6033 - String s = chatPlayerNames[k]; 6034 - byte byte0 = 0; 6035 - if (s != null && s.startsWith("@cr1@")) { 6036 - s = s.substring(5); 6037 - byte0 = 1; 6038 - } 6039 - if (s != null && s.startsWith("@cr2@")) { 6040 - s = s.substring(5); 6041 - byte0 = 2; 6042 - } 6043 - if ((l == 3 || l == 7) && (l == 7 || privateChatMode == 0 || privateChatMode == 1 && method148(13292, s))) { 6044 - int i1 = 329 - j * 13; 6045 - int l1 = 4; 6046 - class50_sub1_sub1_sub2.drawString("From", l1, i1, 0); 6047 - class50_sub1_sub1_sub2.drawString("From", l1, i1 - 1, 65535); 6048 - l1 += class50_sub1_sub1_sub2.getStringEffectWidth("From "); 6049 - if (byte0 == 1) { 6050 - moderatorIcon[0].drawImage(l1, i1 - 12); 6051 - l1 += 14; 6052 - } 6053 - if (byte0 == 2) { 6054 - moderatorIcon[1].drawImage(l1, i1 - 12); 6055 - l1 += 14; 6056 - } 6057 - class50_sub1_sub1_sub2.drawString(s + ": " + chatMessages[k], l1, i1, 0); 6058 - class50_sub1_sub1_sub2.drawString(s + ": " + chatMessages[k], l1, i1 - 1, 65535); 6059 - if (++j >= 5) 6060 - return; 6061 - } 6062 - if (l == 5 && privateChatMode < 2) { 6063 - int j1 = 329 - j * 13; 6064 - class50_sub1_sub1_sub2.drawString(chatMessages[k], 4, j1, 0); 6065 - class50_sub1_sub1_sub2.drawString(chatMessages[k], 4, j1 - 1, 65535); 6066 - if (++j >= 5) 6067 - return; 6068 - } 6069 - if (l == 6 && privateChatMode < 2) { 6070 - int k1 = 329 - j * 13; 6071 - class50_sub1_sub1_sub2.drawString("To " + s + ": " + chatMessages[k], 4, k1, 0); 6072 - class50_sub1_sub1_sub2.drawString("To " + s + ": " + chatMessages[k], 4, k1 - 1, 65535); 6073 - if (++j >= 5) 6074 - return; 6075 - } 6076 - } 6193 + line = 1; 6194 + 6195 + for (int i = 0; i < 100; i++) { 6196 + if (chatMessages[i] != null) { 6197 + int type = chatTypes[i]; 6198 + String name = chatPlayerNames[i]; 6199 + byte privilege = 0; 6200 + 6201 + if (name != null && name.startsWith("@cr1@")) { 6202 + name = name.substring(5); 6203 + privilege = 1; 6204 + } 6205 + 6206 + if (name != null && name.startsWith("@cr2@")) { 6207 + name = name.substring(5); 6208 + privilege = 2; 6209 + } 6210 + 6211 + if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && method148(13292, name))) { 6212 + int y = 329 - line * 13; 6213 + int x = 4; 6214 + 6215 + typeFace.drawString("From", x, y, 0); 6216 + typeFace.drawString("From", x, y - 1, 65535); 6217 + 6218 + x += typeFace.getStringEffectWidth("From "); 6219 + 6220 + if (privilege == 1) { 6221 + moderatorIcon[0].drawImage(x, y - 12); 6222 + x += 14; 6223 + } 6224 + 6225 + if (privilege == 2) { 6226 + moderatorIcon[1].drawImage(x, y - 12); 6227 + x += 14; 6228 + } 6229 + 6230 + typeFace.drawString(name + ": " + chatMessages[i], x, y, 0); 6231 + typeFace.drawString(name + ": " + chatMessages[i], x, y - 1, 65535); 6232 + 6233 + if (++line >= 5) 6234 + return; 6235 + } 6236 + 6237 + if (type == 5 && privateChatMode < 2) { 6238 + int y = 329 - line * 13; 6239 + 6240 + typeFace.drawString(chatMessages[i], 4, y, 0); 6241 + typeFace.drawString(chatMessages[i], 4, y - 1, 65535); 6242 + 6243 + if (++line >= 5) 6244 + return; 6245 + } 6246 + 6247 + if (type == 6 && privateChatMode < 2) { 6248 + int y = 329 - line * 13; 6249 + 6250 + typeFace.drawString("To " + name + ": " + chatMessages[i], 4, y, 0); 6251 + typeFace.drawString("To " + name + ": " + chatMessages[i], 4, y - 1, 65535); 6077 6252 6253 + if (++line >= 5) 6254 + return; 6255 + } 6256 + } 6257 + } 6078 6258 } 6079 6259 6080 6260 public void init() { ··· 6594 6774 return true; 6595 6775 } 6596 6776 6597 - public void method81(byte byte0) { 6598 - char c = '\u0100'; 6599 - for (int i = 10; i < 117; i++) { 6600 - int j = (int) (Math.random() * 100D); 6601 - if (j < 50) 6602 - anIntArray1084[i + (c - 2 << 7)] = 255; 6777 + private void calculateFlamePositions() { //TODO: Needs more refactoring 6778 + int c = 256; 6779 + 6780 + for (int x = 10; x < 117; x++) { 6781 + int rand = (int) (Math.random() * 100D); 6782 + 6783 + if (rand < 50) 6784 + anIntArray1084[x + (c - 2 << 7)] = 255; 6603 6785 } 6604 6786 6605 - for (int k = 0; k < 100; k++) { 6606 - int l = (int) (Math.random() * 124D) + 2; 6607 - int j1 = (int) (Math.random() * 128D) + 128; 6608 - int j2 = l + (j1 << 7); 6609 - anIntArray1084[j2] = 192; 6787 + for (int i = 0; i < 100; i++) { 6788 + int x = (int) (Math.random() * 124D) + 2; 6789 + int y = (int) (Math.random() * 128D) + 128; 6790 + int pixel = x + (y << 7); 6791 + anIntArray1084[pixel] = 192; 6610 6792 } 6611 6793 6612 - for (int i1 = 1; i1 < c - 1; i1++) { 6613 - for (int k1 = 1; k1 < 127; k1++) { 6614 - int k2 = k1 + (i1 << 7); 6615 - anIntArray1085[k2] = (anIntArray1084[k2 - 1] + anIntArray1084[k2 + 1] + anIntArray1084[k2 - 128] + anIntArray1084[k2 + 128]) / 4; 6794 + for (int y = 1; y < c - 1; y++) { 6795 + for (int x = 1; x < 127; x++) { 6796 + int pixel = x + (y << 7); 6797 + anIntArray1085[pixel] = (anIntArray1084[pixel - 1] + anIntArray1084[pixel + 1] + anIntArray1084[pixel - 128] + anIntArray1084[pixel + 128]) / 4; 6616 6798 } 6617 - 6618 6799 } 6619 6800 6620 6801 anInt1238 += 128; 6802 + 6621 6803 if (anInt1238 > anIntArray1176.length) { 6622 6804 anInt1238 -= anIntArray1176.length; 6623 - int l1 = (int) (Math.random() * 12D); 6624 - method83(titleFlameEmblem[l1], 0); 6805 + int rand = (int) (Math.random() * 12D); 6806 + 6807 + method83(titleFlameEmblem[rand], 0); 6625 6808 } 6626 - for (int i2 = 1; i2 < c - 1; i2++) { 6627 - for (int l2 = 1; l2 < 127; l2++) { 6628 - int k3 = l2 + (i2 << 7); 6629 - int i4 = anIntArray1085[k3 + 128] - anIntArray1176[k3 + anInt1238 & anIntArray1176.length - 1] / 5; 6809 + 6810 + for (int y = 1; y < c - 1; y++) { 6811 + for (int x = 1; x < 127; x++) { 6812 + int pixel = x + (y << 7); 6813 + int i4 = anIntArray1085[pixel + 128] - anIntArray1176[pixel + anInt1238 & anIntArray1176.length - 1] / 5; 6814 + 6630 6815 if (i4 < 0) 6631 6816 i4 = 0; 6632 - anIntArray1084[k3] = i4; 6633 - } 6634 6817 6818 + anIntArray1084[pixel] = i4; 6819 + } 6635 6820 } 6636 6821 6637 - if (byte0 == 1) { 6638 - byte0 = 0; 6639 - } else { 6640 - for (int i3 = 1; i3 > 0; i3++); 6641 - } 6642 - for (int j3 = 0; j3 < c - 1; j3++) 6643 - anIntArray1166[j3] = anIntArray1166[j3 + 1]; 6822 + for (int i = 0; i < c - 1; i++) 6823 + anIntArray1166[i] = anIntArray1166[i + 1]; 6644 6824 6645 6825 anIntArray1166[c - 1] = (int) (Math.sin((double) pulseCycle / 14D) * 16D + Math.sin((double) pulseCycle / 15D) 6646 6826 * 14D + Math.sin((double) pulseCycle / 16D) * 12D); 6827 + 6647 6828 if (anInt1047 > 0) 6648 6829 anInt1047 -= 4; 6649 6830 if (anInt1048 > 0) 6650 6831 anInt1048 -= 4; 6651 6832 if (anInt1047 == 0 && anInt1048 == 0) { 6652 - int l3 = (int) (Math.random() * 2000D); 6653 - if (l3 == 0) 6833 + int rand = (int) (Math.random() * 2000D); 6834 + 6835 + if (rand == 0) 6654 6836 anInt1047 = 1024; 6655 - if (l3 == 1) 6837 + if (rand == 1) 6656 6838 anInt1048 = 1024; 6657 6839 } 6658 6840 } ··· 7636 7818 return true; 7637 7819 } 7638 7820 7639 - public void updatePlayers(int packetSize, int j, Buffer vec) { 7821 + private void updatePlayers(int size, Buffer buffer) { 7640 7822 removePlayerCount = 0; 7641 7823 updatedPlayerCount = 0; 7642 - updateThisPlayerMovement(packetSize, aBoolean1274, vec); 7643 - updateOtherPlayerMovement(packetSize, vec); 7644 - j = 40 / j; 7645 - addNewPlayers(packetSize, vec); 7646 - parsePlayerBlocks(vec, packetSize); 7647 - for (int k = 0; k < removePlayerCount; k++) { 7648 - int l = removePlayers[k]; 7649 - if (players[l].pulseCycle != pulseCycle) 7650 - players[l] = null; 7824 + 7825 + updateLocalPlayerMovement(buffer); 7826 + updateOtherPlayerMovement(buffer); 7827 + addNewPlayers(size, buffer); 7828 + parsePlayerBlocks(buffer); 7829 + 7830 + for (int i = 0; i < removePlayerCount; i++) { 7831 + int index = removePlayers[i]; 7832 + 7833 + if (players[index].pulseCycle != pulseCycle) 7834 + players[index] = null; 7651 7835 } 7652 7836 7653 - if (vec.currentPosition != packetSize) { 7654 - SignLink 7655 - .reportError("Error packet size mismatch in getplayer coord:" + vec.currentPosition + " psize:" + packetSize); 7837 + if (buffer.currentPosition != size) { 7838 + SignLink.reportError("Error packet size mismatch in getplayer coord:" + buffer.currentPosition + " psize:" + size); 7656 7839 throw new RuntimeException("eek"); 7657 7840 } 7658 - for (int i1 = 0; i1 < localPlayerCount; i1++) 7659 - if (players[playerList[i1]] == null) { 7660 - SignLink.reportError(username + " null entry in pl list - coord:" + i1 + " size:" 7661 - + localPlayerCount); 7841 + 7842 + for (int i = 0; i < localPlayerCount; i++) { 7843 + if (players[playerList[i]] == null) { 7844 + SignLink.reportError(username + " null entry in pl list - coord:" + i + " size:" + localPlayerCount); 7662 7845 throw new RuntimeException("eek"); 7663 7846 } 7664 - 7847 + } 7665 7848 } 7666 7849 7667 7850 public void removeIgnore(int i, long l) { ··· 7696 7879 return super.getParameter(s); 7697 7880 } 7698 7881 7699 - public void method98(int i) { 7700 - char c = '\u0100'; 7882 + private void renderFlames() { //TODO: Needs more refactoring 7883 + int c = 256; 7884 + 7701 7885 if (anInt1047 > 0) { 7702 - for (int j = 0; j < 256; j++) 7886 + for (int j = 0; j < 256; j++) { 7703 7887 if (anInt1047 > 768) 7704 7888 anIntArray1310[j] = method106(anIntArray1311[j], anIntArray1312[j], 1024 - anInt1047, 8); 7705 7889 else if (anInt1047 > 256) 7706 7890 anIntArray1310[j] = anIntArray1312[j]; 7707 7891 else 7708 7892 anIntArray1310[j] = method106(anIntArray1312[j], anIntArray1311[j], 256 - anInt1047, 8); 7709 - 7893 + } 7710 7894 } else if (anInt1048 > 0) { 7711 - for (int k = 0; k < 256; k++) 7895 + for (int k = 0; k < 256; k++) { 7712 7896 if (anInt1048 > 768) 7713 7897 anIntArray1310[k] = method106(anIntArray1311[k], anIntArray1313[k], 1024 - anInt1048, 8); 7714 7898 else if (anInt1048 > 256) 7715 7899 anIntArray1310[k] = anIntArray1313[k]; 7716 7900 else 7717 7901 anIntArray1310[k] = method106(anIntArray1313[k], anIntArray1311[k], 256 - anInt1048, 8); 7718 - 7902 + } 7719 7903 } else { 7720 - for (int l = 0; l < 256; l++) 7721 - anIntArray1310[l] = anIntArray1311[l]; 7904 + System.arraycopy(anIntArray1311, 0, anIntArray1310, 0, 256); 7905 + } 7722 7906 7723 - } 7724 - for (int i1 = 0; i1 < 33920; i1++) 7725 - flameLeftBackground.pixels[i1] = anImageRGB1226.pixels[i1]; 7907 + System.arraycopy(anImageRGB1226.pixels, 0, flameLeftBackground.pixels, 0, 33920); 7726 7908 7727 7909 int j1 = 0; 7728 7910 int k1 = 1152; 7911 + 7729 7912 for (int l1 = 1; l1 < c - 1; l1++) { 7730 7913 int i2 = (anIntArray1166[l1] * (c - l1)) / c; 7731 7914 int k2 = 22 + i2; 7915 + 7732 7916 if (k2 < 0) 7733 7917 k2 = 0; 7918 + 7734 7919 j1 += k2; 7920 + 7735 7921 for (int i3 = k2; i3 < 128; i3++) { 7736 7922 int k3 = anIntArray1084[j1++]; 7923 + 7737 7924 if (k3 != 0) { 7738 7925 int i4 = k3; 7739 7926 int k4 = 256 - k3; ··· 7750 7937 } 7751 7938 7752 7939 flameLeftBackground.drawGraphics(0, 0, super.gameGraphics); 7753 - i = 66 / i; 7754 - for (int j2 = 0; j2 < 33920; j2++) 7755 - flameRightBackground.pixels[j2] = anImageRGB1227.pixels[j2]; 7940 + 7941 + System.arraycopy(anImageRGB1227.pixels, 0, flameRightBackground.pixels, 0, 33920); 7756 7942 7757 7943 j1 = 0; 7758 7944 k1 = 1176; 7945 + 7759 7946 for (int l2 = 1; l2 < c - 1; l2++) { 7760 7947 int j3 = (anIntArray1166[l2] * (c - l2)) / c; 7761 7948 int l3 = 103 - j3; 7762 7949 k1 += j3; 7950 + 7763 7951 for (int j4 = 0; j4 < l3; j4++) { 7764 7952 int l4 = anIntArray1084[j1++]; 7953 + 7765 7954 if (l4 != 0) { 7766 7955 int j5 = l4; 7767 7956 int k5 = 256 - l4; ··· 8004 8193 if (anInt1034 == 0) 8005 8194 class13.disabledText = "\\nYou have not yet set any recovery questions.\\nIt is @lre@strongly@yel@ recommended that you do so.\\n\\nIf you don't you will be @lre@unable to recover your\\n@lre@password@yel@ if you forget it, or it is stolen."; 8006 8195 else if (anInt1034 <= anInt1170) { 8007 - class13.disabledText = "\\n\\nRecovery Questions Last Set:\\n@gre@" + method104(anInt1034, (byte) 83); 8196 + class13.disabledText = "\\n\\nRecovery Questions Last Set:\\n@gre@" + getDate(anInt1034); 8008 8197 } else { 8009 8198 int l1 = (anInt1170 + 14) - anInt1034; 8010 8199 String s2; ··· 8016 8205 s2 = l1 + " days ago"; 8017 8206 class13.disabledText = s2 8018 8207 + " you requested@lre@ new recovery\\n@lre@questions.@yel@ The requested change will occur\\non: @lre@" 8019 - + method104(anInt1034, (byte) 83) 8208 + + getDate(anInt1034) 8020 8209 + "\\n\\nIf you do not remember making this request\\ncancel it immediately, and change your password."; 8021 8210 } 8022 8211 if (i == 662) { ··· 8033 8222 if (anInt1083 <= 0 || anInt1083 > anInt1170 + 10) 8034 8223 class13.disabledText = "Last password change:\\n@gre@Never changed"; 8035 8224 else 8036 - class13.disabledText = "Last password change:\\n@gre@" + method104(anInt1083, (byte) 83); 8225 + class13.disabledText = "Last password change:\\n@gre@" + getDate(anInt1083); 8037 8226 if (i == 665) 8038 8227 if (anInt992 > 2 && !memberServer) 8039 8228 class13.disabledText = "This is a non-members\\nworld. To enjoy your\\nmembers benefits we\\nrecommend you play on a\\nmembers world instead."; ··· 8061 8250 } 8062 8251 } 8063 8252 8064 - public String method104(int i, byte byte0) { 8065 - if (byte0 != 83) 8066 - opcode = buffer.getUnsignedByte(); 8067 - if (i > anInt1170 + 10) { 8253 + private String getDate(int time) { 8254 + if (time > anInt1170 + 10) { 8068 8255 return "Unknown"; 8069 8256 } else { 8070 - long l = ((long) i + 11745L) * 0x5265c00L; 8257 + long date = ((long) time + 11745L) * 0x5265c00L; 8071 8258 Calendar calendar = Calendar.getInstance(); 8072 - calendar.setTime(new Date(l)); 8073 - int j = calendar.get(5); 8074 - int k = calendar.get(2); 8075 - int i1 = calendar.get(1); 8076 - String as[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 8077 - return j + "-" + as[k] + "-" + i1; 8259 + 8260 + calendar.setTime(new Date(date)); 8261 + 8262 + int day = calendar.get(Calendar.DAY_OF_MONTH); 8263 + int month = calendar.get(Calendar.MONTH); 8264 + int year = calendar.get(Calendar.YEAR); 8265 + String[] monthNames = { "Jan", "Feb", "Mar", "Apr", "May", 8266 + "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 8267 + 8268 + return day + "-" + monthNames[month] + "-" + year; 8078 8269 } 8079 8270 } 8080 8271 ··· 8168 8359 + ((i & 0xff00) * i1 + (j & 0xff00) * k & 0xff0000) >> 8; 8169 8360 } 8170 8361 8171 - public void method107(int i) { 8172 - anInt1246 = 0; 8173 - int j = (localPlayer.worldX >> 7) + nextTopLeftTileX; 8174 - int k; 8175 - for (k = (localPlayer.worldY >> 7) + nextTopRightTileY; i >= 0;) 8176 - return; 8362 + private void setTutorialIslandFlag() { 8363 + int x = (localPlayer.worldX >> 7) + nextTopLeftTileX; 8364 + int y = (localPlayer.worldY >> 7) + nextTopRightTileY; 8365 + inTutorialIsland = false; 8177 8366 8178 - if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) 8179 - anInt1246 = 1; 8180 - if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) 8181 - anInt1246 = 1; 8182 - if (anInt1246 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) 8183 - anInt1246 = 0; 8367 + if (x >= 3053 && x <= 3156 && y >= 3056 && y <= 3136) 8368 + inTutorialIsland = true; 8369 + if (x >= 3072 && x <= 3118 && y >= 9492 && y <= 9535) 8370 + inTutorialIsland = true; 8371 + if (inTutorialIsland && x >= 3139 && x <= 3199 && y >= 3008 && y <= 3062) 8372 + inTutorialIsland = false; 8184 8373 } 8185 8374 8186 - public void determineMenuSize(int i) { 8187 - int j = fontBold.getStringEffectWidth("Choose Option"); 8188 - for (int k = 0; k < menuActionRow; k++) { 8189 - int l = fontBold.getStringEffectWidth(menuActionTexts[k]); 8190 - if (l > j) 8191 - j = l; 8375 + private void determineMenuSize() { 8376 + int width = fontBold.getStringEffectWidth("Choose Option"); 8377 + 8378 + for (int i = 0; i < menuActionRow; i++) { 8379 + int rowWidth = fontBold.getStringEffectWidth(menuActionTexts[i]); 8380 + 8381 + if (rowWidth > width) 8382 + width = rowWidth; 8192 8383 } 8193 8384 8194 - j += 8; 8195 - if (i <= 0) 8196 - aBoolean1190 = !aBoolean1190; 8197 - int i1 = 15 * menuActionRow + 21; 8385 + width += 8; 8386 + int height = 15 * menuActionRow + 21; 8387 + 8198 8388 if (super.clickX > 4 && super.clickY > 4 && super.clickX < 516 && super.clickY < 338) { 8199 - int j1 = super.clickX - 4 - j / 2; 8200 - if (j1 + j > 512) 8201 - j1 = 512 - j; 8202 - if (j1 < 0) 8203 - j1 = 0; 8204 - int i2 = super.clickY - 4; 8205 - if (i2 + i1 > 334) 8206 - i2 = 334 - i1; 8207 - if (i2 < 0) 8208 - i2 = 0; 8389 + int x = super.clickX - 4 - width / 2; 8390 + 8391 + if (x + width > 512) 8392 + x = 512 - width; 8393 + if (x < 0) 8394 + x = 0; 8395 + 8396 + int y = super.clickY - 4; 8397 + 8398 + if (y + height > 334) 8399 + y = 334 - height; 8400 + if (y < 0) 8401 + y = 0; 8402 + 8209 8403 menuOpen = true; 8210 8404 anInt1304 = 0; 8211 - menuClickX = j1; 8212 - menuClickY = i2; 8213 - anInt1307 = j; 8214 - anInt1308 = 15 * menuActionRow + 22; 8405 + menuClickX = x; 8406 + menuClickY = y; 8407 + anInt1307 = width; 8408 + anInt1308 = height + 1; 8215 8409 } 8410 + 8216 8411 if (super.clickX > 553 && super.clickY > 205 && super.clickX < 743 && super.clickY < 466) { 8217 - int k1 = super.clickX - 553 - j / 2; 8218 - if (k1 < 0) 8219 - k1 = 0; 8220 - else if (k1 + j > 190) 8221 - k1 = 190 - j; 8222 - int j2 = super.clickY - 205; 8223 - if (j2 < 0) 8224 - j2 = 0; 8225 - else if (j2 + i1 > 261) 8226 - j2 = 261 - i1; 8412 + int x = super.clickX - 553 - width / 2; 8413 + 8414 + if (x < 0) 8415 + x = 0; 8416 + else if (x + width > 190) 8417 + x = 190 - width; 8418 + 8419 + int y = super.clickY - 205; 8420 + 8421 + if (y < 0) 8422 + y = 0; 8423 + else if (y + height > 261) 8424 + y = 261 - height; 8425 + 8227 8426 menuOpen = true; 8228 8427 anInt1304 = 1; 8229 - menuClickX = k1; 8230 - menuClickY = j2; 8231 - anInt1307 = j; 8232 - anInt1308 = 15 * menuActionRow + 22; 8428 + menuClickX = x; 8429 + menuClickY = y; 8430 + anInt1307 = width; 8431 + anInt1308 = height + 1; 8233 8432 } 8433 + 8234 8434 if (super.clickX > 17 && super.clickY > 357 && super.clickX < 496 && super.clickY < 453) { 8235 - int l1 = super.clickX - 17 - j / 2; 8236 - if (l1 < 0) 8237 - l1 = 0; 8238 - else if (l1 + j > 479) 8239 - l1 = 479 - j; 8240 - int k2 = super.clickY - 357; 8241 - if (k2 < 0) 8242 - k2 = 0; 8243 - else if (k2 + i1 > 96) 8244 - k2 = 96 - i1; 8435 + int x = super.clickX - 17 - width / 2; 8436 + 8437 + if (x < 0) 8438 + x = 0; 8439 + else if (x + width > 479) 8440 + x = 479 - width; 8441 + 8442 + int y = super.clickY - 357; 8443 + 8444 + if (y < 0) 8445 + y = 0; 8446 + else if (y + height > 96) 8447 + y = 96 - height; 8448 + 8245 8449 menuOpen = true; 8246 8450 anInt1304 = 2; 8247 - menuClickX = l1; 8248 - menuClickY = k2; 8249 - anInt1307 = j; 8250 - anInt1308 = 15 * menuActionRow + 22; 8451 + menuClickX = x; 8452 + menuClickY = y; 8453 + anInt1307 = width; 8454 + anInt1308 = height + 1; 8251 8455 } 8252 8456 } 8253 8457 8254 - public void method109(int i) { 8255 - if (i != 30729) 8256 - anInt1056 = incomingRandom.nextInt(); 8257 - method75(0); 8458 + private void renderGameView() { 8459 + renderSplitPrivateMessages(); 8460 + 8258 8461 if (crossType == 1) 8259 8462 cursorCross[crossIndex / 100].drawImage(anInt1021 - 8 - 4, anInt1020 - 8 - 4); 8260 8463 if (crossType == 2) 8261 8464 cursorCross[4 + crossIndex / 100].drawImage(anInt1021 - 8 - 4, anInt1020 - 8 - 4); 8465 + 8262 8466 if (anInt1279 != -1) { 8263 8467 method88(tickDelta, anInt1279, (byte) 5); 8264 8468 method142(0, 0, Widget.forId(anInt1279), 0, 8); 8265 8469 } 8470 + 8266 8471 if (openInterfaceId != -1) { 8267 8472 method88(tickDelta, openInterfaceId, (byte) 5); 8268 8473 method142(0, 0, Widget.forId(openInterfaceId), 0, 8); 8269 8474 } 8270 - method107(-7); 8475 + 8476 + setTutorialIslandFlag(); 8477 + 8271 8478 if (!menuOpen) { 8272 8479 processRightClick(-521); 8273 - method34((byte) -79); 8274 - } else if (anInt1304 == 0) 8275 - method128(false); 8480 + drawMenuTooltip(); 8481 + } else if (anInt1304 == 0) { 8482 + method128(false); 8483 + } 8484 + 8276 8485 if (anInt1319 == 1) 8277 8486 aClass50_Sub1_Sub1_Sub1_1086.drawImage(296, 472); 8487 + 8278 8488 if (fps) { 8279 - char c = '\u01FB'; 8280 - int k = 20; 8281 - int i1 = 0xffff00; 8489 + int y = 20; 8490 + int colour = 0xffff00; 8491 + 8282 8492 if (super.fps < 30 && lowMemory) 8283 - i1 = 0xff0000; 8493 + colour = 0xff0000; 8284 8494 if (super.fps < 20 && !lowMemory) 8285 - i1 = 0xff0000; 8286 - fontNormal.drawStringRight("Fps:" + super.fps, c, k, i1); 8287 - k += 15; 8495 + colour = 0xff0000; 8496 + 8497 + fontNormal.drawStringRight("Fps:" + super.fps, 507, y, colour); 8498 + 8499 + y += 15; 8288 8500 Runtime runtime = Runtime.getRuntime(); 8289 - int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); 8290 - i1 = 0xffff00; 8291 - if (j1 > 0x2000000 && lowMemory) 8292 - i1 = 0xff0000; 8293 - if (j1 > 0x4000000 && !lowMemory) 8294 - i1 = 0xff0000; 8295 - fontNormal.drawStringRight("Mem:" + j1 + "k", c, k, 0xffff00); 8296 - k += 15; 8501 + int memoryUsed = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); 8502 + colour = 0xffff00; 8503 + 8504 + if (memoryUsed > 0x2000000 && lowMemory) 8505 + colour = 0xff0000; 8506 + if (memoryUsed > 0x4000000 && !lowMemory) 8507 + colour = 0xff0000; 8508 + 8509 + fontNormal.drawStringRight("Mem:" + memoryUsed + "k", 507, y, colour); 8297 8510 } 8511 + 8298 8512 if (systemUpdateTime != 0) { 8299 - int j = systemUpdateTime / 50; 8300 - int l = j / 60; 8301 - j %= 60; 8302 - if (j < 10) 8303 - fontNormal.drawString("System update in: " + l + ":0" + j, 4, 329, 0xffff00); 8513 + int seconds = systemUpdateTime / 50; 8514 + int minutes = seconds / 60; 8515 + seconds %= 60; 8516 + 8517 + if (seconds < 10) 8518 + fontNormal.drawString("System update in: " + minutes + ":0" + seconds, 4, 329, 0xffff00); 8304 8519 else 8305 - fontNormal.drawString("System update in: " + l + ":" + j, 4, 329, 0xffff00); 8520 + fontNormal.drawString("System update in: " + minutes + ":" + seconds, 4, 329, 0xffff00); 8521 + 8306 8522 anInt895++; 8523 + 8307 8524 if (anInt895 > 112) { 8308 8525 anInt895 = 0; 8309 8526 outBuffer.putOpcode(197); ··· 8480 8697 8481 8698 } 8482 8699 8483 - public void updateOtherPlayerMovement(int packetSize, Buffer buffer) { 8700 + private void updateOtherPlayerMovement(Buffer buffer) { 8484 8701 int playerCount = buffer.getBits(8); 8702 + 8485 8703 if (playerCount < localPlayerCount) { 8486 - for (int l = playerCount; l < localPlayerCount; l++) 8487 - removePlayers[removePlayerCount++] = playerList[l]; 8704 + for (int i = playerCount; i < localPlayerCount; i++) 8705 + removePlayers[removePlayerCount++] = playerList[i]; 8706 + } 8488 8707 8489 - } 8490 8708 if (playerCount > localPlayerCount) { 8491 8709 SignLink.reportError(username + " Too many players"); 8492 8710 throw new RuntimeException("eek"); 8493 8711 } 8712 + 8494 8713 localPlayerCount = 0; 8714 + 8495 8715 for (int i = 0; i < playerCount; i++) { 8496 8716 int id = playerList[i]; 8497 - Player plr = players[id]; 8717 + Player player = players[id]; 8498 8718 int updated = buffer.getBits(1); 8719 + 8499 8720 if (updated == 0) { 8500 8721 playerList[localPlayerCount++] = id; 8501 - plr.pulseCycle = pulseCycle; 8722 + player.pulseCycle = pulseCycle; 8502 8723 } else { 8503 8724 int moveType = buffer.getBits(2); 8725 + 8504 8726 if (moveType == 0) { 8505 8727 playerList[localPlayerCount++] = id; 8506 - plr.pulseCycle = pulseCycle; 8728 + player.pulseCycle = pulseCycle; 8507 8729 updatedPlayers[updatedPlayerCount++] = id; 8508 8730 } else if (moveType == 1) { 8509 8731 playerList[localPlayerCount++] = id; 8510 - plr.pulseCycle = pulseCycle; 8732 + player.pulseCycle = pulseCycle; 8511 8733 int direction = buffer.getBits(3); 8512 - plr.move(direction, false); 8734 + 8735 + player.move(direction, false); 8736 + 8513 8737 int blockUpdateRequired = buffer.getBits(1); 8738 + 8514 8739 if (blockUpdateRequired == 1) 8515 8740 updatedPlayers[updatedPlayerCount++] = id; 8516 8741 } else if (moveType == 2) { 8517 8742 playerList[localPlayerCount++] = id; 8518 - plr.pulseCycle = pulseCycle; 8743 + player.pulseCycle = pulseCycle; 8519 8744 int direction1 = buffer.getBits(3); 8520 - plr.move(direction1, true); 8745 + 8746 + player.move(direction1, true); 8747 + 8521 8748 int direction2 = buffer.getBits(3); 8522 - plr.move(direction2, true); 8749 + 8750 + player.move(direction2, true); 8751 + 8523 8752 int updateRequired = buffer.getBits(1); 8753 + 8524 8754 if (updateRequired == 1) 8525 8755 updatedPlayers[updatedPlayerCount++] = id; 8526 - } else if (moveType == 3) 8527 - removePlayers[removePlayerCount++] = id; 8756 + } else if (moveType == 3) { 8757 + removePlayers[removePlayerCount++] = id; 8758 + } 8528 8759 } 8529 8760 } 8530 - 8531 8761 } 8532 8762 8533 8763 public void renderViewport(int plane) { ··· 11621 11851 method121(false); 11622 11852 method127(true); 11623 11853 method65(l2); 11624 - method109(30729); 11854 + renderGameView(); 11625 11855 aClass18_1158.drawGraphics(4, 4, super.gameGraphics); 11626 11856 cameraX = i1; 11627 11857 cameraZ = j1;