Skip to content

Commit c557c36

Browse files
authored
Merge pull request #183 from runejs/more-renaming-jkm
refactor: move almost all remaining statics
2 parents d90342a + 50659cb commit c557c36

File tree

14 files changed

+180
-168
lines changed

14 files changed

+180
-168
lines changed

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.runejs.client.media.Rasterizer3D;
1616
import org.runejs.client.media.VertexNormal;
1717
import org.runejs.client.media.renderable.Model;
18-
import org.runejs.client.media.renderable.Renderable;
1918
import org.runejs.client.media.renderable.actor.*;
2019
import org.runejs.client.message.handler.MessageHandlerRegistry;
2120
import org.runejs.client.message.handler.rs435.RS435HandlerRegistry;
@@ -42,6 +41,7 @@
4241
import org.runejs.client.cache.media.gameInterface.InterfaceModelType;
4342
import org.runejs.Configuration;
4443
import org.runejs.client.util.SignlinkNode;
44+
import org.runejs.client.util.Timer;
4545

4646
import java.awt.*;
4747
import java.io.IOException;
@@ -102,6 +102,8 @@ public class Game {
102102
public static long aLong1841;
103103
public static int clientVersion;
104104
public static int playerRights = 0;
105+
public static Timer gameTimer;
106+
public static int idleLogout = 0;
105107
/**
106108
* Backup port if the first one fails?
107109
*/
@@ -265,7 +267,7 @@ public static boolean drawInterface(int areaId, int minX, int minY, int maxX, in
265267
else {
266268
if (GameInterface.activeInterfaceType != 0 && GameInterface.selectedInventorySlot == i_7_ && gameInterface.id == GameInterface.modifiedWidgetId) {
267269
i_14_ = MouseHandler.mouseY + -MovedStatics.anInt2798;
268-
i_12_ = MouseHandler.mouseX + -Renderable.anInt2869;
270+
i_12_ = MouseHandler.mouseX + -MovedStatics.anInt2869;
269271
if (i_12_ < 5 && i_12_ > -5)
270272
i_12_ = 0;
271273
if (i_14_ < 5 && i_14_ > -5)
@@ -632,7 +634,7 @@ public static void setConfigToDefaults() {
632634
IncomingPackets.cyclesSinceLastPacket = 0;
633635
Player.headIconDrawType = 0;
634636
OutgoingPackets.buffer.currentPosition = 0;
635-
SceneCluster.idleLogout = 0;
637+
idleLogout = 0;
636638
IncomingPackets.thirdLastOpcode = -1;
637639
IncomingPackets.incomingPacketBuffer.currentPosition = 0;
638640
MovedStatics.menuActionRow = 0;
@@ -940,7 +942,7 @@ public static void drawGameScreen() {
940942
GameInterface.redrawTabArea = true;
941943
}
942944
if(GameInterface.tabAreaInterfaceId != -1) {
943-
boolean bool = Renderable.handleSequences(GameInterface.tabAreaInterfaceId);
945+
boolean bool = GameInterface.handleSequences(GameInterface.tabAreaInterfaceId);
944946
if(bool) {
945947
GameInterface.redrawTabArea = true;
946948
}
@@ -956,13 +958,13 @@ public static void drawGameScreen() {
956958
MovedStatics.drawTabArea();
957959

958960
if(GameInterface.chatboxInterfaceId != -1) {
959-
boolean bool = Renderable.handleSequences(GameInterface.chatboxInterfaceId);
961+
boolean bool = GameInterface.handleSequences(GameInterface.chatboxInterfaceId);
960962
if(bool) {
961963
ChatBox.redrawChatbox = true;
962964
}
963965
}
964966
if(ChatBox.dialogueId != -1) {
965-
boolean bool = Renderable.handleSequences(ChatBox.dialogueId);
967+
boolean bool = GameInterface.handleSequences(ChatBox.dialogueId);
966968
if(bool) {
967969
ChatBox.redrawChatbox = true;
968970
}
@@ -1013,15 +1015,15 @@ public static void drawGameScreen() {
10131015

10141016

10151017
if(GameInterface.tabAreaInterfaceId != -1) {
1016-
Renderable.handleSequences(GameInterface.tabAreaInterfaceId);
1018+
GameInterface.handleSequences(GameInterface.tabAreaInterfaceId);
10171019
}
10181020

10191021
if(GameInterface.chatboxInterfaceId != -1) {
1020-
Renderable.handleSequences(GameInterface.chatboxInterfaceId);
1022+
GameInterface.handleSequences(GameInterface.chatboxInterfaceId);
10211023
}
10221024

10231025
if(ChatBox.dialogueId != -1) {
1024-
Renderable.handleSequences(ChatBox.dialogueId);
1026+
GameInterface.handleSequences(ChatBox.dialogueId);
10251027
}
10261028
method353();
10271029
ChatBox.renderChatbox();
@@ -1113,9 +1115,9 @@ public static void displayMessageForResponseCode(int responseCode) {
11131115
}
11141116

11151117
public static void method164() {
1116-
Renderable.handleSequences(GameInterface.fullscreenInterfaceId);
1118+
GameInterface.handleSequences(GameInterface.fullscreenInterfaceId);
11171119
if(GameInterface.fullscreenSiblingInterfaceId != -1)
1118-
Renderable.handleSequences(GameInterface.fullscreenSiblingInterfaceId);
1120+
GameInterface.handleSequences(GameInterface.fullscreenSiblingInterfaceId);
11191121
MovedStatics.anInt199 = 0;
11201122
MovedStatics.aProducingGraphicsBuffer_2213.prepareRasterizer();
11211123
Player.viewportOffsets = Rasterizer3D.setLineOffsets(Player.viewportOffsets);
@@ -1241,8 +1243,8 @@ public static void moveTowardsTarget() {
12411243
public static void updateGame() {
12421244
if(MovedStatics.systemUpdateTime > 1)
12431245
MovedStatics.systemUpdateTime--;
1244-
if(SceneCluster.idleLogout > 0)
1245-
SceneCluster.idleLogout--;
1246+
if(idleLogout > 0)
1247+
idleLogout--;
12461248
if(aBoolean871) {
12471249
aBoolean871 = false;
12481250
dropClient();
@@ -1402,7 +1404,7 @@ else if(x > 764)
14021404
MovedStatics.anInt199++;
14031405
if(GameInterface.activeInterfaceType != 0) {
14041406
GameInterface.lastItemDragTime++;
1405-
if(MouseHandler.mouseX > Renderable.anInt2869 + 5 || Renderable.anInt2869 + -5 > MouseHandler.mouseX || MovedStatics.anInt2798 + 5 < MouseHandler.mouseY || MovedStatics.anInt2798 - 5 > MouseHandler.mouseY)
1407+
if(MouseHandler.mouseX > MovedStatics.anInt2869 + 5 || MovedStatics.anInt2869 + -5 > MouseHandler.mouseX || MovedStatics.anInt2798 + 5 < MouseHandler.mouseY || MovedStatics.anInt2798 - 5 > MouseHandler.mouseY)
14061408
MovedStatics.lastItemDragged = true;
14071409
if(MouseHandler.currentMouseButtonPressed == 0) {
14081410
if(GameInterface.activeInterfaceType == 3)
@@ -1542,7 +1544,7 @@ else if(ChatBox.dialogueId != -1)
15421544
int i_20_ = MouseHandler.resetFramesSinceMouseInput();
15431545
int i_21_ = KeyFocusListener.resetFramesSinceKeyboardInput();
15441546
if(i_20_ > 4500 && i_21_ > 4500) {
1545-
SceneCluster.idleLogout = 250;
1547+
idleLogout = 250;
15461548
MouseHandler.setFramesSinceMouseInput(4000);
15471549
OutgoingPackets.buffer.putPacket(216);
15481550
}
@@ -1635,16 +1637,16 @@ public static void handleLoginScreenActions() {
16351637
}
16361638
if (IncomingPackets.incomingPacketBuffer.currentPosition == 8) {
16371639
IncomingPackets.incomingPacketBuffer.currentPosition = 0;
1638-
Renderable.aLong2858 = IncomingPackets.incomingPacketBuffer.getLongBE();
1640+
MovedStatics.aLong2858 = IncomingPackets.incomingPacketBuffer.getLongBE();
16391641
loginStatus = 5;
16401642
}
16411643
}
16421644
if (loginStatus == 5) {
16431645
int[] seeds = new int[4];
16441646
seeds[0] = (int) (Math.random() * 9.9999999E7);
16451647
seeds[1] = (int) (Math.random() * 9.9999999E7);
1646-
seeds[2] = (int) (Renderable.aLong2858 >> 32);
1647-
seeds[3] = (int) Renderable.aLong2858;
1648+
seeds[2] = (int) (MovedStatics.aLong2858 >> 32);
1649+
seeds[3] = (int) MovedStatics.aLong2858;
16481650
OutgoingPackets.buffer.currentPosition = 0;
16491651
OutgoingPackets.buffer.putByte(10);
16501652
OutgoingPackets.buffer.putIntBE(seeds[0]);
@@ -1951,7 +1953,7 @@ public static void method249() {
19511953
}
19521954

19531955
public static void dropClient() {
1954-
if(SceneCluster.idleLogout > 0) {
1956+
if(idleLogout > 0) {
19551957
// Instant logout
19561958
logout();
19571959
} else {
@@ -1968,7 +1970,7 @@ public static void setLowMemory() {
19681970
}
19691971

19701972
public static void method992() {
1971-
SceneCluster.gameTimer.start();
1973+
gameTimer.start();
19721974
for(int i = 0; i < 32; i++)
19731975
GameShell.tickSamples[i] = 0L;
19741976
for(int i = 0; i < 32; i++)

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.runejs.client.frame.ScreenMode;
55
import org.runejs.client.language.Native;
66
import org.runejs.client.media.renderable.actor.Player;
7-
import org.runejs.client.scene.SceneCluster;
87
import org.runejs.client.util.Signlink;
98
import org.runejs.client.util.Timer;
109

@@ -69,7 +68,7 @@ public void run() {
6968
}
7069
}
7170
if (Game.signlink.gameShell != null) {
72-
Method method = Signlink.aMethod724;
71+
Method method = Signlink.setFocusCycleRoot;
7372
if (method != null) {
7473
try {
7574
method.invoke(Game.signlink.gameShell, Boolean.TRUE);
@@ -80,12 +79,12 @@ public void run() {
8079
setCanvas();
8180
MovedStatics.aProducingGraphicsBuffer_2213 = MovedStatics.createGraphicsBuffer(MovedStatics.width, MovedStatics.height, Game.gameCanvas);
8281
this.game.startup();
83-
SceneCluster.gameTimer = Timer.create();
84-
SceneCluster.gameTimer.start();
82+
Game.gameTimer = Timer.create();
83+
Game.gameTimer.start();
8584

8685
// Initialize client loop
8786
while (exitTimeInMillis == 0L || System.currentTimeMillis() < exitTimeInMillis) {
88-
MovedStatics.ticksPerLoop = SceneCluster.gameTimer.getTicks(millisPerTick, anInt2024);
87+
MovedStatics.ticksPerLoop = Game.gameTimer.getTicks(millisPerTick, anInt2024);
8988
for (int currentTick = 0; currentTick < MovedStatics.ticksPerLoop; currentTick++) {
9089
long currentTimeMillis = System.currentTimeMillis();
9190

0 commit comments

Comments
 (0)