Skip to content

Commit ebdafef

Browse files
committed
remove all non relevant members gameshell
1 parent 0d596f5 commit ebdafef

File tree

7 files changed

+141
-150
lines changed

7 files changed

+141
-150
lines changed

src/main/java/org/runejs/client/GameShell.java

Lines changed: 1 addition & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
package org.runejs.client;
22

33
import org.runejs.client.cache.def.IdentityKit;
4-
import org.runejs.client.cache.media.gameInterface.GameInterface;
5-
import org.runejs.client.cache.media.gameInterface.GameInterfaceType;
64
import org.runejs.client.frame.ScreenController;
75
import org.runejs.client.frame.ScreenMode;
86
import org.runejs.client.input.MouseHandler;
9-
import org.runejs.client.media.Rasterizer3D;
107
import org.runejs.client.media.renderable.actor.Actor;
11-
import org.runejs.client.media.renderable.actor.Player;
128
import org.runejs.client.media.renderable.actor.PlayerAppearance;
13-
import org.runejs.client.message.outbound.chat.ModifySocialListOutboundMessage;
14-
import org.runejs.client.net.OutgoingPackets;
159
import org.runejs.client.net.PacketBuffer;
1610
import org.runejs.client.scene.SceneCluster;
1711
import org.runejs.client.scene.tile.GenericTile;
18-
import org.runejs.client.scene.tile.Wall;
1912
import org.runejs.client.util.Signlink;
2013
import org.runejs.client.util.Timer;
2114

22-
import org.runejs.client.cache.media.AnimationSequence;
23-
import org.runejs.client.cache.media.IndexedImage;
2415
import org.runejs.Configuration;
2516

2617
import java.awt.*;
@@ -31,130 +22,15 @@
3122
import java.net.URL;
3223

3324
public abstract class GameShell extends Canvas implements Runnable, FocusListener, WindowListener {
34-
/**
35-
* The image used for the highlighted (selected) tab button,
36-
* for one of the tabs on the left-hand side of the top,
37-
* but not the furthest-left (see `tabHighlightImageTopLeftEdge` for that).
38-
*/
39-
public static IndexedImage tabHighlightImageTopLeft;
4025
public static long[] tickSamples = new long[32];
41-
public static int anInt31;
4226

4327
public static long exitTimeInMillis = 0L;
4428
public static Frame clientFrame;
4529
public static GameShell currentGameShell = null;
46-
public static int millisPerTick = 20;
30+
private final int millisPerTick = 20;
4731
public boolean gameShellError = false;
4832

4933

50-
public static void runClientScriptsForInterface(int minY, int arg1, int scrollWidth, int arg3, int minX, int parentId, GameInterface[] interfaceCollection, int arg8, int scrollHeight) {
51-
for (int i = 0; i < interfaceCollection.length; i++) {
52-
GameInterface gameInterface = interfaceCollection[i];
53-
if (gameInterface != null && (gameInterface.type == GameInterfaceType.LAYER || gameInterface.hasListeners) && parentId == gameInterface.parentId && (!gameInterface.isHidden || PacketBuffer.hiddenButtonTest)) {
54-
int absoluteX = minX + gameInterface.currentX;
55-
int absoluteY = minY + gameInterface.currentY;
56-
if (!gameInterface.lockScroll)
57-
absoluteY -= scrollHeight;
58-
int bottomLeftY = absoluteY + gameInterface.originalHeight;
59-
int i_4_ = Math.max(minY, absoluteY);
60-
if (!gameInterface.lockScroll)
61-
absoluteX -= scrollWidth;
62-
int topRightX = absoluteX + gameInterface.originalWidth;
63-
int i_6_ = Math.max(minX, absoluteX);
64-
int i_7_ = Math.min(arg1, bottomLeftY);
65-
int i_8_ = Math.min(topRightX, arg8);
66-
if (gameInterface.type == GameInterfaceType.LAYER) {
67-
runClientScriptsForInterface(i_4_, i_7_, gameInterface.scrollWidth, arg3, i_6_, i, interfaceCollection, i_8_, gameInterface.scrollPosition);
68-
if (gameInterface.children != null)
69-
runClientScriptsForInterface(i_4_, i_7_, gameInterface.scrollWidth, arg3, i_6_, gameInterface.id, gameInterface.children, i_8_, gameInterface.scrollPosition);
70-
}
71-
if (gameInterface.hasListeners) {
72-
boolean bool;
73-
bool = Class13.mouseX >= i_6_ && i_4_ <= Landscape.mouseY && i_8_ > Class13.mouseX && i_7_ > Landscape.mouseY;
74-
boolean bool_9_ = false;
75-
if (MouseHandler.currentMouseButtonPressed == 1 && bool)
76-
bool_9_ = true;
77-
boolean bool_10_ = false;
78-
if (gameInterface.anInt2738 != -1 && bool_9_ && Wall.aGameInterface_353 == null) {
79-
MovedStatics.anInt1996 = Class13.mouseX;
80-
Wall.aGameInterface_353 = gameInterface;
81-
MovedStatics.anInt2621 = Landscape.mouseY;
82-
}
83-
if (MouseHandler.clickType == 1 && i_6_ <= Class57.clickX && RSString.clickY >= i_4_ && Class57.clickX < i_8_ && RSString.clickY < i_7_)
84-
bool_10_ = true;
85-
if (Wall.aGameInterface_353 != null) {
86-
bool_9_ = false;
87-
bool = false;
88-
bool_10_ = false;
89-
}
90-
if (!gameInterface.aBoolean2730 && bool_10_ && (0x1 & arg3) != 0) {
91-
gameInterface.aBoolean2730 = true;
92-
if (gameInterface.anObjectArray2681 != null)
93-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2681, 0, RSString.clickY + -absoluteY, gameInterface, Class57.clickX - absoluteX);
94-
}
95-
if (gameInterface.aBoolean2730 && bool_9_ && (arg3 & 0x4) != 0 && gameInterface.anObjectArray2747 != null)
96-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2747, 0, -absoluteY + Landscape.mouseY, gameInterface, -absoluteX + Class13.mouseX);
97-
if (gameInterface.aBoolean2730 && !bool_9_ && (0x2 & arg3) != 0) {
98-
gameInterface.aBoolean2730 = false;
99-
if (gameInterface.anObjectArray2707 != null)
100-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2707, 0, Landscape.mouseY - absoluteY, gameInterface, Class13.mouseX - absoluteX);
101-
}
102-
if (bool_9_ && (arg3 & 0x8) != 0 && gameInterface.anObjectArray2644 != null)
103-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2644, 0, -absoluteY + Landscape.mouseY, gameInterface, -absoluteX + Class13.mouseX);
104-
if (!gameInterface.aBoolean2682 && bool && (0x10 & arg3) != 0) {
105-
gameInterface.aBoolean2682 = true;
106-
if (gameInterface.anObjectArray2658 != null)
107-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2658, 0, Landscape.mouseY - absoluteY, gameInterface, Class13.mouseX - absoluteX);
108-
}
109-
if (gameInterface.aBoolean2682 && bool && (0x40 & arg3) != 0 && gameInterface.anObjectArray2680 != null)
110-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2680, 0, -absoluteY + Landscape.mouseY, gameInterface, -absoluteX + Class13.mouseX);
111-
if (gameInterface.aBoolean2682 && !bool && (arg3 & 0x20) != 0) {
112-
gameInterface.aBoolean2682 = false;
113-
if (gameInterface.anObjectArray2672 != null)
114-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2672, 0, -absoluteY + Landscape.mouseY, gameInterface, -absoluteX + Class13.mouseX);
115-
}
116-
if (gameInterface.anObjectArray2712 != null && (arg3 & 0x80) != 0)
117-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2712, 0, 0, gameInterface, 0);
118-
if (AnimationSequence.anInt2480 == MovedStatics.pulseCycle && gameInterface.anObjectArray2650 != null && (arg3 & 0x100) != 0)
119-
ClientScriptRunner.runClientScripts(gameInterface.anObjectArray2650, 0, 0, gameInterface, 0);
120-
}
121-
}
122-
}
123-
124-
}
125-
126-
public static void providesignlink(Signlink signlink) {
127-
Actor.signlink = Main.signlink = signlink;
128-
}
129-
130-
public static void method28(long arg0) {
131-
if (arg0 != 0) {
132-
int i = 0;
133-
for (/**/; Player.friendsCount > i; i++) {
134-
if (Class59.friends[i] == arg0) {
135-
Player.friendsCount--;
136-
GameInterface.redrawTabArea = true;
137-
for (int i_13_ = i; i_13_ < Player.friendsCount; i_13_++) {
138-
Player.friendUsernames[i_13_] = Player.friendUsernames[1 + i_13_];
139-
Player.friendWorlds[i_13_] = Player.friendWorlds[i_13_ + 1];
140-
Class59.friends[i_13_] = Class59.friends[1 + i_13_];
141-
}
142-
143-
OutgoingPackets.sendMessage(
144-
new ModifySocialListOutboundMessage(arg0, ModifySocialListOutboundMessage.SocialList.FRIEND, ModifySocialListOutboundMessage.SocialListAction.REMOVE));
145-
break;
146-
}
147-
}
148-
}
149-
}
150-
151-
public static int interpolate(int arg0, int arg1, int arg2, boolean arg3, int arg4) {
152-
if (!arg3)
153-
return -109;
154-
int i = 65536 + -Rasterizer3D.cosinetable[1024 * arg4 / arg1] >> 1;
155-
return ((65536 + -i) * arg0 >> 16) + (arg2 * i >> 16);
156-
}
157-
15834
public void run() {
15935
if (Signlink.javaVendor != null) {
16036
String string = Signlink.javaVendor.toLowerCase();

src/main/java/org/runejs/client/MovedStatics.java

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ public class MovedStatics {
182182
public static IndexedImage[] moderatorIcon;
183183
public static int[] anIntArray2764 = new int[128];
184184
public static ImageRGB minimapImage;
185+
public static int imageMaxHeight;
186+
185187
public static void method440() {
186188
if (ISAAC.aBoolean512) {
187189
Class51.anIntArray1198 = null;
@@ -411,8 +413,8 @@ public static boolean method459(int arg0, int arg1) {
411413

412414
public static IndexedImage method538() {
413415
IndexedImage class40_sub5_sub14_sub2 = new IndexedImage();
414-
class40_sub5_sub14_sub2.maxWidth = ItemDefinition.anInt2846;
415-
class40_sub5_sub14_sub2.maxHeight = GameShell.anInt31;
416+
class40_sub5_sub14_sub2.maxWidth = ItemDefinition.imageMaxWidth;
417+
class40_sub5_sub14_sub2.maxHeight = imageMaxHeight;
416418
class40_sub5_sub14_sub2.xDrawOffset = Class57.anIntArray1347[0];
417419
class40_sub5_sub14_sub2.yDrawOffset = Actor.anIntArray3111[0];
418420
class40_sub5_sub14_sub2.imgWidth = Class17.anIntArray456[0];
@@ -476,9 +478,9 @@ public static int perlinNoise(int x, int y, int scale) {
476478
int b = CollisionMap.randomNoiseWeightedSum(1 + scaledX, scaledY);
477479
int c = CollisionMap.randomNoiseWeightedSum(scaledX, 1 + scaledY);
478480
int d = CollisionMap.randomNoiseWeightedSum(1 + scaledX, 1 + scaledY);
479-
int i1 = GameShell.interpolate(a, scale, b, true, muX);
480-
int i2 = GameShell.interpolate(c, scale, d, true, muX);
481-
return GameShell.interpolate(i1, scale, i2, true, muY);
481+
int i1 = interpolateForPerlin(a, scale, b, true, muX);
482+
int i2 = interpolateForPerlin(c, scale, d, true, muX);
483+
return interpolateForPerlin(i1, scale, i2, true, muY);
482484
}
483485

484486
public static int calculateCrc8(int offset, int size, byte[] data) {
@@ -562,8 +564,8 @@ public static void method184(byte[] data, int arg1) {
562564
Class57.anIntArray1347 = new int[anInt2581];
563565

564566
buffer.currentPosition = data.length + -7 + -(anInt2581 * 8);
565-
ItemDefinition.anInt2846 = buffer.getUnsignedShortBE();
566-
GameShell.anInt31 = buffer.getUnsignedShortBE();
567+
ItemDefinition.imageMaxWidth = buffer.getUnsignedShortBE();
568+
imageMaxHeight = buffer.getUnsignedShortBE();
567569
int i = 1 + (buffer.getUnsignedByte() & 0xff);
568570
for (int i_34_ = 0; i_34_ < anInt2581; i_34_++)
569571
Class57.anIntArray1347[i_34_] = buffer.getUnsignedShortBE();
@@ -689,9 +691,9 @@ public static void method527(int currentTabId, int[] tabWidgetIds, boolean arg3,
689691
if (currentTabId == 0)
690692
tabHighlightImageTopLeftEdge.drawImage(22, 10);
691693
if (currentTabId == 1)
692-
GameShell.tabHighlightImageTopLeft.drawImage(54, 8);
694+
GameInterface.tabHighlightImageTopLeft.drawImage(54, 8);
693695
if (currentTabId == 2)
694-
GameShell.tabHighlightImageTopLeft.drawImage(82, 8);
696+
GameInterface.tabHighlightImageTopLeft.drawImage(82, 8);
695697
if (currentTabId == 3)
696698
Class35.tabHighlightImageTopMiddle.drawImage(110, 8);
697699
if (currentTabId == 4)
@@ -1549,7 +1551,7 @@ public static void manageTextInputs() {
15491551
}
15501552
if(Class37.anInt876 == 2 && Player.friendsCount > 0) {
15511553
long l = RSString.nameToLong(ChatBox.chatMessage);
1552-
GameShell.method28(l);
1554+
GameInterface.removeFriend(l);
15531555
}
15541556
if(Class37.anInt876 == 3 && ChatBox.chatMessage.length() > 0) {
15551557
// private messages
@@ -1913,8 +1915,8 @@ public static IndexedImage[] method315() {
19131915
IndexedImage[] class40_sub5_sub14_sub2s = new IndexedImage[anInt2581];
19141916
for(int i = 0; anInt2581 > i; i++) {
19151917
IndexedImage class40_sub5_sub14_sub2 = class40_sub5_sub14_sub2s[i] = new IndexedImage();
1916-
class40_sub5_sub14_sub2.maxWidth = ItemDefinition.anInt2846;
1917-
class40_sub5_sub14_sub2.maxHeight = GameShell.anInt31;
1918+
class40_sub5_sub14_sub2.maxWidth = ItemDefinition.imageMaxWidth;
1919+
class40_sub5_sub14_sub2.maxHeight = imageMaxHeight;
19181920
class40_sub5_sub14_sub2.xDrawOffset = Class57.anIntArray1347[i];
19191921
class40_sub5_sub14_sub2.yDrawOffset = Actor.anIntArray3111[i];
19201922
class40_sub5_sub14_sub2.imgWidth = Class17.anIntArray456[i];
@@ -1930,8 +1932,8 @@ public static ImageRGB[] method319() {
19301932
ImageRGB[] class40_sub5_sub14_sub4s = new ImageRGB[anInt2581];
19311933
for(int i = 0; i < anInt2581; i++) {
19321934
ImageRGB class40_sub5_sub14_sub4 = class40_sub5_sub14_sub4s[i] = new ImageRGB();
1933-
class40_sub5_sub14_sub4.maxWidth = ItemDefinition.anInt2846;
1934-
class40_sub5_sub14_sub4.maxHeight = GameShell.anInt31;
1935+
class40_sub5_sub14_sub4.maxWidth = ItemDefinition.imageMaxWidth;
1936+
class40_sub5_sub14_sub4.maxHeight = imageMaxHeight;
19351937
class40_sub5_sub14_sub4.offsetX = Class57.anIntArray1347[i];
19361938
class40_sub5_sub14_sub4.offsetY = Actor.anIntArray3111[i];
19371939
class40_sub5_sub14_sub4.imageWidth = Class17.anIntArray456[i];
@@ -2041,4 +2043,11 @@ public static void method313() {
20412043
}
20422044
public static int[] anIntArray1847 = new int[2000];
20432045
public static long aLong1841;
2046+
2047+
public static int interpolateForPerlin(int arg0, int arg1, int arg2, boolean arg3, int arg4) {
2048+
if (!arg3)
2049+
return -109;
2050+
int i = 65536 + -Rasterizer3D.cosinetable[1024 * arg4 / arg1] >> 1;
2051+
return ((65536 + -i) * arg0 >> 16) + (arg2 * i >> 16);
2052+
}
20442053
}

src/main/java/org/runejs/client/Projectile.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.runejs.client.cache.media.ImageRGB;
88
import org.runejs.client.cache.media.IndexedImage;
99
import org.runejs.client.cache.def.SpotAnimDefinition;
10+
import org.runejs.client.cache.media.gameInterface.GameInterface;
1011
import org.runejs.client.frame.ScreenController;
1112
import org.runejs.client.frame.ScreenMode;
1213
import org.runejs.client.io.Buffer;
@@ -204,22 +205,22 @@ public static void method763(Component arg0, CacheArchive arg2) {
204205
Class17.chatboxTop = MovedStatics.createGraphicsBuffer(image.imageWidth, image.imageHeight, arg0);
205206
image.drawInverse(0, 0);
206207
MovedStatics.tabHighlightImageTopLeftEdge = Main.method359(Native.redstone1, Native.aClass1_305, arg2);
207-
GameShell.tabHighlightImageTopLeft = Main.method359(Native.redstone2, Native.aClass1_305, arg2);
208+
GameInterface.tabHighlightImageTopLeft = Main.method359(Native.redstone2, Native.aClass1_305, arg2);
208209
Class35.tabHighlightImageTopMiddle = Main.method359(Native.redstone3, Native.aClass1_305, arg2);
209210
MovedStatics.tabHighlightImageTopRightEdge = MovedStatics.tabHighlightImageTopLeftEdge.cloneImage();
210211
MovedStatics.tabHighlightImageTopRightEdge.flipHorizontal();
211-
WallDecoration.tabHighlightImageTopRight = GameShell.tabHighlightImageTopLeft.cloneImage();
212+
WallDecoration.tabHighlightImageTopRight = GameInterface.tabHighlightImageTopLeft.cloneImage();
212213
WallDecoration.tabHighlightImageTopRight.flipHorizontal();
213214
Renderable.tabHighlightImageBottomLeftEdge = MovedStatics.tabHighlightImageTopLeftEdge.cloneImage();
214215
Renderable.tabHighlightImageBottomLeftEdge.flipVertical();
215-
MovedStatics.tabHighlightImageBottomLeft = GameShell.tabHighlightImageTopLeft.cloneImage();
216+
MovedStatics.tabHighlightImageBottomLeft = GameInterface.tabHighlightImageTopLeft.cloneImage();
216217
MovedStatics.tabHighlightImageBottomLeft.flipVertical();
217218
MovedStatics.tabHighlightImageBottomMiddle = Class35.tabHighlightImageTopMiddle.cloneImage();
218219
MovedStatics.tabHighlightImageBottomMiddle.flipVertical();
219220
ISAAC.tabHighlightImageBottomRightEdge = MovedStatics.tabHighlightImageTopLeftEdge.cloneImage();
220221
ISAAC.tabHighlightImageBottomRightEdge.flipHorizontal();
221222
ISAAC.tabHighlightImageBottomRightEdge.flipVertical();
222-
Class13.tabHighlightImageBottomRight = GameShell.tabHighlightImageTopLeft.cloneImage();
223+
Class13.tabHighlightImageBottomRight = GameInterface.tabHighlightImageTopLeft.cloneImage();
223224
Class13.tabHighlightImageBottomRight.flipHorizontal();
224225
Class13.tabHighlightImageBottomRight.flipVertical();
225226
Class40_Sub5_Sub15.tabIcons = IndexedImage.getMultipleIndexedImages(arg2, Native.sideIcons, Native.aClass1_305);

src/main/java/org/runejs/client/cache/def/ActorDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public static int method576() {
107107

108108
public static ImageRGB method578() {
109109
ImageRGB class40_sub5_sub14_sub4 = new ImageRGB();
110-
class40_sub5_sub14_sub4.maxWidth = ItemDefinition.anInt2846;
111-
class40_sub5_sub14_sub4.maxHeight = GameShell.anInt31;
110+
class40_sub5_sub14_sub4.maxWidth = ItemDefinition.imageMaxWidth;
111+
class40_sub5_sub14_sub4.maxHeight = MovedStatics.imageMaxHeight;
112112
class40_sub5_sub14_sub4.offsetX = Class57.anIntArray1347[0];
113113
class40_sub5_sub14_sub4.offsetY = Actor.anIntArray3111[0];
114114
class40_sub5_sub14_sub4.imageWidth = Class17.anIntArray456[0];

src/main/java/org/runejs/client/cache/def/ItemDefinition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class ItemDefinition extends CachedNode implements EntityDefinition {
2626
public static int anInt2798 = 0;
2727
public static int selectedMask;
28-
public static int anInt2846;
28+
public static int imageMaxWidth;
2929
public static int anInt2850 = -1;
3030
public static int anInt2854;
3131
public static int count;

0 commit comments

Comments
 (0)