Skip to content

Commit d90342a

Browse files
authored
Merge pull request #181 from runejs/more-renaming-jkm
refactor: move and rename a load more statics appropriately
2 parents 5fc7ed1 + a52fc91 commit d90342a

22 files changed

+591
-621
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import org.runejs.client.media.renderable.actor.Actor;
99
import org.runejs.client.node.CachedNode;
1010

11+
/**
12+
* anim skeleton?
13+
*/
1114
public class Class40_Sub5_Sub15 extends CachedNode {
1215
public FrameDefinition[] aFrameDefinitionArray2794;
1316

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package org.runejs.client;
22

3-
import org.runejs.client.io.Buffer;
43
import org.runejs.client.node.Class40_Sub6;
5-
import org.runejs.client.scene.util.CollisionMap;
64

75
public class Class44 implements Runnable {
86
public void run() {
@@ -14,13 +12,13 @@ public void run() {
1412
}
1513
if(class40_sub6 == null) {
1614
MovedStatics.threadSleep(100L);
17-
synchronized(CollisionMap.anObject162) {
18-
if(Buffer.anInt1987 <= 1) {
19-
Buffer.anInt1987 = 0;
20-
CollisionMap.anObject162.notifyAll();
15+
synchronized(MovedStatics.anObject162) {
16+
if(MovedStatics.anInt1987 <= 1) {
17+
MovedStatics.anInt1987 = 0;
18+
MovedStatics.anObject162.notifyAll();
2119
break;
2220
}
23-
Buffer.anInt1987--;
21+
MovedStatics.anInt1987--;
2422
}
2523
} else {
2624
if(class40_sub6.anInt2112 == 0) {
@@ -34,13 +32,13 @@ public void run() {
3432
MovedStatics.aLinkedList_2604.addLast(class40_sub6);
3533
}
3634
}
37-
synchronized(CollisionMap.anObject162) {
38-
if(Buffer.anInt1987 <= 1) {
39-
Buffer.anInt1987 = 0;
40-
CollisionMap.anObject162.notifyAll();
35+
synchronized(MovedStatics.anObject162) {
36+
if(MovedStatics.anInt1987 <= 1) {
37+
MovedStatics.anInt1987 = 0;
38+
MovedStatics.anObject162.notifyAll();
4139
break;
4240
}
43-
Buffer.anInt1987 = 600;
41+
MovedStatics.anInt1987 = 600;
4442
}
4543
}
4644
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.runejs.client.util.BitUtils;
1616
import org.runejs.client.util.Signlink;
1717
import org.runejs.client.util.SignlinkNode;
18-
import org.runejs.client.cache.def.ActorDefinition;
1918
import org.runejs.client.cache.def.ItemDefinition;
2019
import org.runejs.client.cache.def.VarPlayerDefinition;
2120
import org.runejs.client.cache.def.VarbitDefinition;
@@ -921,7 +920,7 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
921920
break;
922921
}
923922
intValueIndex -= 2;
924-
ActorDefinition.playAnimation(scriptIntValues[intValueIndex], scriptIntValues[intValueIndex + 1], Player.localPlayer);
923+
Player.playAnimation(scriptIntValues[intValueIndex], scriptIntValues[intValueIndex + 1], Player.localPlayer);
925924
}
926925
}
927926
} else {

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.runejs.client.scene.camera.CameraRotation;
3030
import org.runejs.client.scene.camera.CutsceneCamera;
3131
import org.runejs.client.scene.camera.SphericalCamera;
32-
import org.runejs.client.scene.util.CollisionMap;
3332
import org.runejs.client.sound.MusicSystem;
3433
import org.runejs.client.sound.SoundSystem;
3534
import org.runejs.client.util.Signlink;
@@ -79,7 +78,7 @@ public class Game {
7978
public static int loginStatus = 0;
8079
public static int modewhat = 0;
8180
public static int modewhere = 0;
82-
public static long aLong1203 = 0L;
81+
public static long lastClickTime = 0L;
8382
public static int mouseInvInterfaceIndex = 0;
8483
public static int anInt509 = 0;
8584
public static boolean aBoolean519 = true;
@@ -103,6 +102,10 @@ public class Game {
103102
public static long aLong1841;
104103
public static int clientVersion;
105104
public static int playerRights = 0;
105+
/**
106+
* Backup port if the first one fails?
107+
*/
108+
private static int someOtherPort;
106109
private static int gameServerPort;
107110
private static int duplicateClickCount = 0;
108111
private static int lastClickY = 0;
@@ -267,7 +270,7 @@ public static boolean drawInterface(int areaId, int minX, int minY, int maxX, in
267270
i_12_ = 0;
268271
if (i_14_ < 5 && i_14_ > -5)
269272
i_14_ = 0;
270-
if (Buffer.lastItemDragTime < 5) {
273+
if (GameInterface.lastItemDragTime < 5) {
271274
i_14_ = 0;
272275
i_12_ = 0;
273276
}
@@ -615,7 +618,7 @@ else if (gameInterface.xTextAlignment == 1)
615618

616619

617620
public static void setConfigToDefaults() {
618-
aLong1203 = 0L;
621+
lastClickTime = 0L;
619622
mouseCapturer.coord = 0;
620623
duplicateClickCount = 0;
621624
aBoolean1735 = true;
@@ -633,12 +636,12 @@ public static void setConfigToDefaults() {
633636
IncomingPackets.thirdLastOpcode = -1;
634637
IncomingPackets.incomingPacketBuffer.currentPosition = 0;
635638
MovedStatics.menuActionRow = 0;
636-
MouseHandler.method650(0);
639+
MouseHandler.setFramesSinceMouseInput(0);
637640
for (int i = 0; i < 100; i++)
638641
ChatBox.chatMessages[i] = null;
639642
GameInterface.itemCurrentlySelected = 0;
640643
MovedStatics.destinationX = 0;
641-
Buffer.anInt1985 = -1;
644+
MovedStatics.anInt1985 = -1;
642645
Player.npcCount = 0;
643646
SoundSystem.reset();
644647
widgetSelected = 0;
@@ -1324,10 +1327,10 @@ else if(x > 764)
13241327
}
13251328
}
13261329
if(MouseHandler.clickType != 0) {
1327-
long l = (MouseHandler.aLong2561 - aLong1203) / 50L;
1330+
long delta = (MouseHandler.clickTime - lastClickTime) / 50L;
13281331
int i = MouseHandler.clickX;
13291332
int i_10_ = MouseHandler.clickY;
1330-
aLong1203 = MouseHandler.aLong2561;
1333+
lastClickTime = MouseHandler.clickTime;
13311334
if(i >= 0) {
13321335
if(i > 764)
13331336
i = 764;
@@ -1341,9 +1344,9 @@ else if(x > 764)
13411344
int i_11_ = 0;
13421345
if(MouseHandler.clickType == 2)
13431346
i_11_ = 1;
1344-
if(l > 4095)
1345-
l = 4095L;
1346-
int i_12_ = (int) l;
1347+
if(delta > 4095)
1348+
delta = 4095L;
1349+
int i_12_ = (int) delta;
13471350
OutgoingPackets.buffer.putPacket(234);
13481351
int i_13_ = i_10_ * 765 + i;
13491352
OutgoingPackets.buffer.putIntLE((i_11_ << 19) + (i_12_ << 20) + i_13_);
@@ -1398,7 +1401,7 @@ else if(x > 764)
13981401
}
13991402
MovedStatics.anInt199++;
14001403
if(GameInterface.activeInterfaceType != 0) {
1401-
Buffer.lastItemDragTime++;
1404+
GameInterface.lastItemDragTime++;
14021405
if(MouseHandler.mouseX > Renderable.anInt2869 + 5 || Renderable.anInt2869 + -5 > MouseHandler.mouseX || MovedStatics.anInt2798 + 5 < MouseHandler.mouseY || MovedStatics.anInt2798 - 5 > MouseHandler.mouseY)
14031406
MovedStatics.lastItemDragged = true;
14041407
if(MouseHandler.currentMouseButtonPressed == 0) {
@@ -1407,7 +1410,7 @@ else if(x > 764)
14071410
if(GameInterface.activeInterfaceType == 2)
14081411
GameInterface.redrawTabArea = true;
14091412
GameInterface.activeInterfaceType = 0;
1410-
if(MovedStatics.lastItemDragged && Buffer.lastItemDragTime >= 5) {
1413+
if(MovedStatics.lastItemDragged && GameInterface.lastItemDragTime >= 5) {
14111414
GameInterface.lastActiveInvInterface = -1;
14121415
MovedStatics.processRightClick();
14131416
if(GameInterface.lastActiveInvInterface == GameInterface.modifiedWidgetId && mouseInvInterfaceIndex != GameInterface.selectedInventorySlot) {
@@ -1486,7 +1489,7 @@ else if(MovedStatics.menuActionRow > 0)
14861489
}
14871490

14881491
if(MouseHandler.currentMouseButtonPressed == 1 || MouseHandler.clickType == 1)
1489-
Npc.anInt3294++;
1492+
MovedStatics.anInt3294++;
14901493

14911494
int i = 34;
14921495
if(GameInterface.gameScreenInterfaceId != -1)
@@ -1540,7 +1543,7 @@ else if(ChatBox.dialogueId != -1)
15401543
int i_21_ = KeyFocusListener.resetFramesSinceKeyboardInput();
15411544
if(i_20_ > 4500 && i_21_ > 4500) {
15421545
SceneCluster.idleLogout = 250;
1543-
MouseHandler.method650(4000);
1546+
MouseHandler.setFramesSinceMouseInput(4000);
15441547
OutgoingPackets.buffer.putPacket(216);
15451548
}
15461549

@@ -1764,7 +1767,7 @@ public static void handleLoginScreenActions() {
17641767
if (MovedStatics.anInt2321 < 1) {
17651768
MovedStatics.anInt2321++;
17661769
if (gameServerPort == currentPort) {
1767-
currentPort = CollisionMap.someOtherPort;
1770+
currentPort = someOtherPort;
17681771
} else {
17691772
currentPort = gameServerPort;
17701773
}
@@ -1778,7 +1781,7 @@ public static void handleLoginScreenActions() {
17781781
} catch (IOException ioexception) {
17791782
if (MovedStatics.anInt2321 < 1) {
17801783
if (currentPort == gameServerPort) {
1781-
currentPort = CollisionMap.someOtherPort;
1784+
currentPort = someOtherPort;
17821785
} else {
17831786
currentPort = gameServerPort;
17841787
}
@@ -1791,11 +1794,11 @@ public static void handleLoginScreenActions() {
17911794
}
17921795

17931796
private static void method947(int arg0) {
1794-
synchronized(CollisionMap.anObject162) {
1795-
if((Buffer.anInt1987 ^ 0xffffffff) != arg0) {
1796-
Buffer.anInt1987 = 1;
1797+
synchronized(MovedStatics.anObject162) {
1798+
if((MovedStatics.anInt1987 ^ 0xffffffff) != arg0) {
1799+
MovedStatics.anInt1987 = 1;
17971800
try {
1798-
CollisionMap.anObject162.wait();
1801+
MovedStatics.anObject162.wait();
17991802
} catch(InterruptedException interruptedexception) {
18001803
/* empty */
18011804
}
@@ -1914,8 +1917,8 @@ public static void method910() {
19141917
if(true) {
19151918
if (VertexNormal.lowMemory && MovedStatics.onBuildTimePlane != Player.worldLevel)
19161919
Landscape.method789(Player.localPlayer.pathY[0], MovedStatics.regionY, MovedStatics.regionX, Player.localPlayer.pathX[0], Player.worldLevel);
1917-
else if (Buffer.anInt1985 != Player.worldLevel) {
1918-
Buffer.anInt1985 = Player.worldLevel;
1920+
else if (MovedStatics.anInt1985 != Player.worldLevel) {
1921+
MovedStatics.anInt1985 = Player.worldLevel;
19191922
Minimap.method299(Player.worldLevel);
19201923
}
19211924
}
@@ -2119,7 +2122,7 @@ public void method35(int arg1) {
21192122
if (currentPort != gameServerPort)
21202123
currentPort = gameServerPort;
21212124
else
2122-
currentPort = CollisionMap.someOtherPort;
2125+
currentPort = someOtherPort;
21232126
updateServerSocket = null;
21242127
updateServerSignlinkNode = null;
21252128
anInt292++;
@@ -2155,10 +2158,10 @@ public void processGameLoop() {
21552158
MouseHandler.method1015();
21562159

21572160
if (gameStatusCode == 0) {
2158-
InteractiveObjectTemporary.startup();
2161+
MovedStatics.startup();
21592162
method992();
21602163
} else if (gameStatusCode == 5) {
2161-
InteractiveObjectTemporary.startup();
2164+
MovedStatics.startup();
21622165
method992();
21632166
} else if (gameStatusCode == 10) {
21642167
Class60.updateLogin();
@@ -2226,7 +2229,7 @@ else if (gameStatusCode == 5) {
22262229
method164();
22272230
} else if (gameStatusCode == 40)
22282231
MovedStatics.method940(English.connectionLost, false, English.pleaseWaitAttemptingToReestablish);
2229-
Npc.anInt3294 = 0;
2232+
MovedStatics.anInt3294 = 0;
22302233
}
22312234

22322235
public void connectUpdateServer() {
@@ -2352,7 +2355,7 @@ public void close() {
23522355

23532356
public void startup() {
23542357
// Define ports
2355-
CollisionMap.someOtherPort = modewhere == 0 ? 443 : 50000 + Player.worldId;
2358+
someOtherPort = modewhere == 0 ? 443 : 50000 + Player.worldId;
23562359
gameServerPort = modewhere != 0 ? Player.worldId + 40000 : Configuration.GAME_PORT;
23572360
currentPort = gameServerPort;
23582361

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ public static void method789(int chunkLocalX, int chunkY, int chunkX, int chunkL
14231423
if(obj.x < 0 || obj.y < 0 || obj.x >= 104 || obj.y >= 104)
14241424
obj.unlink();
14251425
}
1426-
Buffer.anInt1985 = -1;
1426+
MovedStatics.anInt1985 = -1;
14271427
if(MovedStatics.destinationX != 0) {
14281428
MovedStatics.destinationX -= i_34_;
14291429
Game.destinationY -= i_35_;

0 commit comments

Comments
 (0)