Skip to content

Commit c34de29

Browse files
committed
refactor: move statics from Projectile
1 parent d8f5312 commit c34de29

File tree

16 files changed

+557
-585
lines changed

16 files changed

+557
-585
lines changed

src/main/java/org/runejs/OldEngine/MapDecompressor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import org.runejs.client.Class26;
8-
import org.runejs.client.Projectile;
98
import org.runejs.client.Landscape;
109
import org.runejs.client.MovedStatics;
1110
import org.runejs.client.media.renderable.actor.Npc;
@@ -134,7 +133,7 @@ public static void spawnObject(int objectId, int x, int y, int z, int rotation,
134133
class20 = groundData[plane];
135134
}
136135
if(localY > 0 && localX > 0 && localY < 103 && localX < 103) {
137-
Projectile.addObject(objectId, localX, localY, z, rotation, type, Npc.currentScene, class20);
136+
MovedStatics.addObject(objectId, localX, localY, z, rotation, type, Npc.currentScene, class20);
138137
}
139138
}
140139

src/main/java/org/runejs/OldEngine/ObjectDecompressor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import org.runejs.client.Class26;
8-
import org.runejs.client.Projectile;
98
import org.runejs.client.Landscape;
109
import org.runejs.client.MovedStatics;
1110
import org.runejs.client.io.Buffer;
@@ -137,7 +136,7 @@ public static void spawnObject(int objectId, int x, int y, int z, int rotation,
137136
class20 = groundData[plane];
138137
}
139138
if(localY > 0 && localX > 0 && localY < 103 && localX < 103) {
140-
Projectile.addObject(objectId, localX, localY, z, rotation, type, Npc.currentScene, class20);
139+
MovedStatics.addObject(objectId, localX, localY, z, rotation, type, Npc.currentScene, class20);
141140
}
142141
}
143142

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void drawTabArea() {
4646
if(!bool)
4747
GameInterface.redrawTabArea = true;
4848
}
49-
if(MovedStatics.menuOpen && Projectile.menuScreenArea == 1) {
49+
if(MovedStatics.menuOpen && MovedStatics.menuScreenArea == 1) {
5050
if(MovedStatics.anInt848 == 1)
5151
method398();
5252
else if(ScreenController.frameMode == ScreenMode.FIXED)
@@ -176,15 +176,15 @@ public static void method398() {
176176
TypeFace.fontBold.drawShadowedString(class1, 3 + i_0_, 14 + i_2_, false, i_3_);
177177
int i_4_ = MouseHandler.mouseX;
178178
int i_5_ = MouseHandler.mouseY;
179-
if(Projectile.menuScreenArea == 0) {
179+
if(MovedStatics.menuScreenArea == 0) {
180180
i_4_ -= 4;
181181
i_5_ -= 4;
182182
}
183-
if(Projectile.menuScreenArea == 1) {
183+
if(MovedStatics.menuScreenArea == 1) {
184184
i_4_ -= 553;
185185
i_5_ -= 205;
186186
}
187-
if(Projectile.menuScreenArea == 2) {
187+
if(MovedStatics.menuScreenArea == 2) {
188188
i_5_ -= 357;
189189
i_4_ -= 17;
190190
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static void determineMenuSize() {
6464
int height = MovedStatics.menuActionRow * 15 + 21;
6565
if(ScreenController.frameMode == ScreenMode.FIXED){
6666
if(MouseHandler.clickX > 4 && MouseHandler.clickY > 4 && MouseHandler.clickX < 516 && MouseHandler.clickY < 338) {
67-
Projectile.menuScreenArea = 0;
67+
MovedStatics.menuScreenArea = 0;
6868
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
6969
MovedStatics.menuOpen = true;
7070
int x = -(width / 2) + -4 + MouseHandler.clickX;
@@ -83,7 +83,7 @@ public static void determineMenuSize() {
8383
}
8484
if(MouseHandler.clickX > 553 && MouseHandler.clickY > 205 && MouseHandler.clickX < 743 && MouseHandler.clickY < 466) {
8585
CollisionMap.menuHeight = 22 + 15 * MovedStatics.menuActionRow;
86-
Projectile.menuScreenArea = 1;
86+
MovedStatics.menuScreenArea = 1;
8787
int y = -205 + MouseHandler.clickY;
8888
int x = -(width / 2) + -553 + MouseHandler.clickX;
8989
if(x < 0)
@@ -102,7 +102,7 @@ else if(width + x > 190)
102102
}
103103
if(MouseHandler.clickX > 17 && MouseHandler.clickY > 357 && MouseHandler.clickX < 496 && MouseHandler.clickY < 453) {
104104
VertexNormal.menuWidth = width;
105-
Projectile.menuScreenArea = 2;
105+
MovedStatics.menuScreenArea = 2;
106106
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
107107
int y = MouseHandler.clickY + -357;
108108
if(y >= 0) {
@@ -121,7 +121,7 @@ else if(x + width > 479)
121121
}
122122

123123
} else if(MouseHandler.clickX > 0 && MouseHandler.clickY > 0 && MouseHandler.clickX < GameShell.clientFrame.getWidth() && MouseHandler.clickY < GameShell.clientFrame.getHeight()) {
124-
Projectile.menuScreenArea = 0;
124+
MovedStatics.menuScreenArea = 0;
125125
int x = -(width / 2) + -4 + MouseHandler.clickX;
126126
if(width + x > GameShell.clientFrame.getWidth() - 4)
127127
x = GameShell.clientFrame.getWidth() - 4;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class ClientScriptRunner extends Node {
4242
public static int[] scriptIntValues = new int[1000];
4343
public static InvokedScript[] invokedScripts = new InvokedScript[50];
4444
public static int invokedScriptIndex = 0;
45+
private static String[] aClass1Array2964 = new String[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
4546

4647
public int[] opcodes;
4748
public int[] errorCodes;
@@ -889,7 +890,7 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
889890
int i_79_ = MovedStatics.aCalendar279.get(Calendar.DATE);
890891
int i_80_ = MovedStatics.aCalendar279.get(Calendar.MONTH);
891892
int i_81_ = MovedStatics.aCalendar279.get(Calendar.YEAR);
892-
scriptStringValues[stringValueIndex++] = i_79_ + "-" + Projectile.aClass1Array2964[i_80_] + "-" + i_81_;
893+
scriptStringValues[stringValueIndex++] = i_79_ + "-" + aClass1Array2964[i_80_] + "-" + i_81_;
893894
} else if(scriptOpcode == 4105) {
894895
stringValueIndex -= 2;
895896
String class1 = scriptStringValues[stringValueIndex];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public static void constructMapRegionObjects(int drawX, int drawY, int drawingPl
327327
collisionMapPlane--;
328328
if(collisionMapPlane >= 0)
329329
collisionMap = collisionMaps[collisionMapPlane];
330-
Projectile.addObject(i, tileX, tileY, plane, originalOrientation + orientation & 0x3, objectType, scene, collisionMap);
330+
MovedStatics.addObject(i, tileX, tileY, plane, originalOrientation + orientation & 0x3, objectType, scene, collisionMap);
331331
}
332332
}
333333
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public static boolean drawInterface(int areaId, int minX, int minY, int maxX, in
281281
gameInterface_16_.scrollPosition += i_18_;
282282
}
283283
}
284-
} else if (Projectile.atInventoryInterfaceType == 0 || GameInterface.anInt1233 != i_7_ || gameInterface.id != PlayerAppearance.anInt704)
284+
} else if (GameInterface.atInventoryInterfaceType == 0 || GameInterface.anInt1233 != i_7_ || gameInterface.id != PlayerAppearance.anInt704)
285285
imageRGB.drawImage(i_10_, i_11_);
286286
else
287287
imageRGB.drawImageWithOpacity(i_10_, i_11_, 128);
@@ -840,7 +840,7 @@ public static void method353() {
840840

841841
int i;
842842
if(!Player.cutsceneActive) {
843-
i = Projectile.method764();
843+
i = MovedStatics.method764();
844844
} else {
845845
i = MovedStatics.method546();
846846
}
@@ -967,7 +967,7 @@ public static void drawGameScreen() {
967967
MovedStatics.redrawChatbox = true;
968968
drawCount++;
969969
} else if(drawCount != 0) {
970-
Projectile.method763(MouseHandler.gameCanvas, CacheArchive.gameImageCacheArchive);
970+
MovedStatics.method763(MouseHandler.gameCanvas, CacheArchive.gameImageCacheArchive);
971971
}
972972
if(GameInterface.chatboxInterfaceId == -1) {
973973
chatboxInterface.scrollPosition = -77 + -ChatBox.chatboxScroll + ChatBox.chatboxScrollMax;
@@ -1006,7 +1006,7 @@ public static void drawGameScreen() {
10061006
}
10071007
if(ScreenController.frameMode == ScreenMode.FIXED) {
10081008

1009-
if(MovedStatics.menuOpen && Projectile.menuScreenArea == 1) {
1009+
if(MovedStatics.menuOpen && MovedStatics.menuScreenArea == 1) {
10101010
GameInterface.redrawTabArea = true;
10111011
}
10121012
if(GameInterface.tabAreaInterfaceId != -1) {
@@ -1017,7 +1017,7 @@ public static void drawGameScreen() {
10171017
}
10181018
method353();
10191019

1020-
if(Projectile.atInventoryInterfaceType == -3) {
1020+
if(GameInterface.atInventoryInterfaceType == -3) {
10211021
GameInterface.redrawTabArea = true;
10221022
}
10231023
if(SceneTile.activeInterfaceType == 2) {
@@ -1037,7 +1037,7 @@ public static void drawGameScreen() {
10371037
ChatBox.redrawChatbox = true;
10381038
}
10391039
}
1040-
if(Projectile.atInventoryInterfaceType == 3) {
1040+
if(GameInterface.atInventoryInterfaceType == 3) {
10411041
ChatBox.redrawChatbox = true;
10421042
}
10431043
if(SceneTile.activeInterfaceType == 3) {
@@ -1046,7 +1046,7 @@ public static void drawGameScreen() {
10461046
if(Native.clickToContinueString != null) {
10471047
ChatBox.redrawChatbox = true;
10481048
}
1049-
if(MovedStatics.menuOpen && Projectile.menuScreenArea == 2) {
1049+
if(MovedStatics.menuOpen && MovedStatics.menuScreenArea == 2) {
10501050
ChatBox.redrawChatbox = true;
10511051
}
10521052
if(ChatBox.redrawChatbox) {
@@ -1197,7 +1197,7 @@ public static void method164() {
11971197
Class43.processRightClick();
11981198
SceneTile.drawMenuTooltip(4);
11991199
} else
1200-
if(ScreenController.frameMode == ScreenMode.FIXED && Projectile.menuScreenArea == 0){
1200+
if(ScreenController.frameMode == ScreenMode.FIXED && MovedStatics.menuScreenArea == 0){
12011201
MovedStatics.drawMenu(4,4); // might be 0,0
12021202
}
12031203
try {
@@ -1459,14 +1459,14 @@ else if(x > 764)
14591459
if(MovedStatics.crossIndex >= 400)
14601460
LinkedList.crossType = 0;
14611461
}
1462-
if(Projectile.atInventoryInterfaceType != 0) {
1462+
if(GameInterface.atInventoryInterfaceType != 0) {
14631463
RSRuntimeException.anInt1651++;
14641464
if(RSRuntimeException.anInt1651 >= 15) {
1465-
if(Projectile.atInventoryInterfaceType == 2)
1465+
if(GameInterface.atInventoryInterfaceType == 2)
14661466
GameInterface.redrawTabArea = true;
1467-
if(Projectile.atInventoryInterfaceType == 3)
1467+
if(GameInterface.atInventoryInterfaceType == 3)
14681468
ChatBox.redrawChatbox = true;
1469-
Projectile.atInventoryInterfaceType = 0;
1469+
GameInterface.atInventoryInterfaceType = 0;
14701470
}
14711471
}
14721472
MovedStatics.anInt199++;

0 commit comments

Comments
 (0)