Skip to content

Commit c7665f1

Browse files
committed
refactor: rename Main -> Game
1 parent af1b284 commit c7665f1

26 files changed

+155
-175
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repositories {
1414
}
1515

1616
application {
17-
mainClassName 'org.runejs.client.Main'
17+
mainClassName 'org.runejs.client.Game'
1818
}
1919

2020
jar {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ public static synchronized byte[] method246(int arg1) {
8686
GroundItemTile.aByteArrayArray1377[anInt356] = null;
8787
return is;
8888
}
89-
if(arg1 == 5000 && Main.anInt1764 > 0) {
90-
byte[] is = Class44.aByteArrayArray1039[--Main.anInt1764];
91-
Class44.aByteArrayArray1039[Main.anInt1764] = null;
89+
if(arg1 == 5000 && Game.anInt1764 > 0) {
90+
byte[] is = Class44.aByteArrayArray1039[--Game.anInt1764];
91+
Class44.aByteArrayArray1039[Game.anInt1764] = null;
9292
return is;
9393
}
9494
if(arg1 == 30000 && MovedStatics.anInt2359 > 0) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Class37 {
1111
public static ImageRGB[] cursorCross;
1212

1313
static {
14-
Main.anInt874 = 0;
14+
Game.anInt874 = 0;
1515
}
1616

1717
public static void method434() {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static void startup() {
111111
}
112112
} else if (MovedStatics.loadingPercent == 45) {
113113
MusicSystem.initialiseMusic(0);
114-
SoundSystem.initialiseSound(Main.signlink);
114+
SoundSystem.initialiseSound(Game.signlink);
115115
MovedStatics.loadingPercent = 50;
116116
Native.currentLoadingText = English.preparedSoundEngine;
117117
MovedStatics.anInt1607 = 35;
@@ -156,7 +156,7 @@ public static void startup() {
156156
UnderlayDefinition.initializeUnderlayDefinitionCache(CacheArchive.gameDefinitionsCacheArchive);
157157
initializeIdentityKitDefinitionCache(CacheArchive.gameDefinitionsCacheArchive, CacheArchive.modelCacheArchive);
158158
initializeGameObjectDefinitionCache(CacheArchive.modelCacheArchive, VertexNormal.lowMemory, CacheArchive.gameDefinitionsCacheArchive);
159-
Main.method357(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
159+
Game.method357(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
160160
MovedStatics.initializeItemDefinitionCache(CacheArchive.gameDefinitionsCacheArchive, MovedStatics.membersWorld, CacheArchive.modelCacheArchive);
161161
MovedStatics.initializeAnimationCaches(CacheArchive.skinDefinitionCacheArchive, CacheArchive.gameDefinitionsCacheArchive, CacheArchive.skeletonCacheArchive);
162162
Class55.method966(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
@@ -268,8 +268,8 @@ public static void startup() {
268268
MovedStatics.anInt1607 = 90;
269269
}
270270
} else if (MovedStatics.loadingPercent == 110) {
271-
Main.mouseCapturer = new Class39();
272-
Main.signlink.createThreadNode(10, Main.mouseCapturer);
271+
Game.mouseCapturer = new Class39();
272+
Game.signlink.createThreadNode(10, Game.mouseCapturer);
273273
Native.currentLoadingText = English.loadedInputHandler;
274274
MovedStatics.loadingPercent = 120;
275275
MovedStatics.anInt1607 = 94;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static boolean method840(byte[] arg1, int arg2, int arg3) {
4444
bool_2_ = true;
4545
if(!gameObjectDefinition.method612()) {
4646
bool = false;
47-
Main.anInt2591++;
47+
Game.anInt2591++;
4848
}
4949
}
5050
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public static void drawTabArea() {
3636
MovedStatics.showSidePanelRedrawnText = true;
3737
MovedStatics.method996();
3838
if(GameInterface.tabAreaInterfaceId != -1) {
39-
boolean bool = Main.drawParentInterface(1, 0, 0, 190, 261, GameInterface.tabAreaInterfaceId);
39+
boolean bool = Game.drawParentInterface(1, 0, 0, 190, 261, GameInterface.tabAreaInterfaceId);
4040
if(!bool)
4141
GameInterface.redrawTabArea = true;
4242
} else if(Player.tabWidgetIds[Player.currentTabId] != -1) {
43-
boolean bool = Main.drawParentInterface(1, 0, 0, 190, 261, Player.tabWidgetIds[Player.currentTabId]);
43+
boolean bool = Game.drawParentInterface(1, 0, 0, 190, 261, Player.tabWidgetIds[Player.currentTabId]);
4444
if(!bool)
4545
GameInterface.redrawTabArea = true;
4646
}
@@ -164,7 +164,7 @@ public static void method398() {
164164
if(i > 190)
165165
i = 190;
166166
int i_1_ = CollisionMap.menuHeight;
167-
int i_2_ = Main.menuOffsetY;
167+
int i_2_ = Game.menuOffsetY;
168168
if(i_0_ < 0)
169169
i_0_ = 0;
170170
int i_3_ = 6116423;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void determineMenuSize() {
7878
y = 334 - height;
7979
if(y < 0)
8080
y = 0;
81-
Main.menuOffsetY = y;
81+
Game.menuOffsetY = y;
8282
}
8383
if(MouseHandler.clickX > 553 && MouseHandler.clickY > 205 && MouseHandler.clickX < 743 && MouseHandler.clickY < 466) {
8484
CollisionMap.menuHeight = 22 + 15 * MovedStatics.menuActionRow;
@@ -97,7 +97,7 @@ else if(width + x > 190)
9797
} else
9898
y = 0;
9999
VertexNormal.menuWidth = width;
100-
Main.menuOffsetY = y;
100+
Game.menuOffsetY = y;
101101
}
102102
if(MouseHandler.clickX > 17 && MouseHandler.clickY > 357 && MouseHandler.clickX < 496 && MouseHandler.clickY < 453) {
103103
VertexNormal.menuWidth = width;
@@ -111,7 +111,7 @@ else if(width + x > 190)
111111
y = 0;
112112
int x = -(width / 2) + -17 + MouseHandler.clickX;
113113
MovedStatics.menuOpen = true;
114-
Main.menuOffsetY = y;
114+
Game.menuOffsetY = y;
115115
if(x < 0)
116116
x = 0;
117117
else if(x + width > 479)
@@ -137,7 +137,7 @@ else if(x + width > 479)
137137
x = ScreenController.drawWidth - width;
138138
MovedStatics.menuOpen = true;
139139
InteractiveObject.menuOffsetX = x;
140-
Main.menuOffsetY = y;
140+
Game.menuOffsetY = y;
141141
VertexNormal.menuWidth = width;
142142
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
143143
}
@@ -158,7 +158,7 @@ else if(x + width > 479)
158158
// } else
159159
// y = 0;
160160
// VertexNormal.menuWidth = width;
161-
// Main.menuOffsetY = y;
161+
// Game.menuOffsetY = y;
162162
// }
163163
// if(Class57.clickX > 17 && RSString.clickY > 357 && Class57.clickX < 496 && RSString.clickY < 453) {
164164
// VertexNormal.menuWidth = width;
@@ -172,7 +172,7 @@ else if(x + width > 479)
172172
// y = 0;
173173
// int x = -(width / 2) + -17 + Class57.clickX;
174174
// Class4.menuOpen = true;
175-
// Main.menuOffsetY = y;
175+
// Game.menuOffsetY = y;
176176
// if(x < 0)
177177
// x = 0;
178178
// else if(x + width > 479)
@@ -423,7 +423,7 @@ public static void drawLoadingScreen(TypeFace fontBold, TypeFace fontSmall) {
423423
Rasterizer.drawDiagonalLine(0,0, 42,42, 0xFF0000);
424424
}
425425

426-
Main.renderFlames();
426+
Game.renderFlames();
427427

428428
try {
429429
int offsetX = 0;
@@ -601,8 +601,8 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
601601

602602
logo.drawImage(-128 + 382 + -(logo.imageWidth / 2), 18);
603603

604-
Class40_Sub5_Sub15.loginScreenBox = Main.method359(Native.titleBox, "", gameImageCacheArchive);
605-
Class59.imgLoginScreenButton = Main.method359(Native.titleButton, "", gameImageCacheArchive);
604+
Class40_Sub5_Sub15.loginScreenBox = Game.method359(Native.titleBox, "", gameImageCacheArchive);
605+
Class59.imgLoginScreenButton = Game.method359(Native.titleButton, "", gameImageCacheArchive);
606606
MovedStatics.aClass40_Sub5_Sub14_Sub2Array535 = IndexedImage.getMultipleIndexedImages(gameImageCacheArchive, Native.runes, "");
607607

608608
Class39.aClass40_Sub5_Sub14_Sub4_918 = new ImageRGB(128, 265);

src/main/java/org/runejs/client/Main.java renamed to src/main/java/org/runejs/client/Game.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import java.net.InetAddress;
5353
import java.net.Socket;
5454

55-
public class Main extends GameShell {
55+
public class Game extends GameShell {
5656

5757
/**
5858
* The codec currently in use to encode and decode packets.
@@ -726,8 +726,8 @@ else if (!params[2].equals("rc")) {
726726
printHelp();
727727
}
728728

729-
Main main = new Main();
730-
main.openClientApplet("client435", 13, 32 + modewhat, InetAddress.getByName(Configuration.SERVER_ADDRESS), 435);
729+
Game game = new Game();
730+
game.openClientApplet("client435", 13, 32 + modewhat, InetAddress.getByName(Configuration.SERVER_ADDRESS), 435);
731731

732732
} catch (Exception exception) {
733733
exception.printStackTrace();
@@ -764,7 +764,7 @@ public static void setConfigToDefaults() {
764764
SoundSystem.reset();
765765
widgetSelected = 0;
766766
// TODO is this necessary? or should it be removed alongside other randomisation
767-
Main.playerCamera.setYaw(0x7ff & -10 + (int) (20.0 * Math.random()));
767+
Game.playerCamera.setYaw(0x7ff & -10 + (int) (20.0 * Math.random()));
768768
Minimap.minimapState = 0;
769769
Player.localPlayerCount = 0;
770770
Class55.destinationY = 0;
@@ -825,7 +825,7 @@ public static void method353() {
825825
MovedStatics.renderProjectiles();
826826
MovedStatics.renderSpotAnims();
827827
if(!Player.cutsceneActive) {
828-
int pitch = Main.playerCamera.getPitch();
828+
int pitch = Game.playerCamera.getPitch();
829829
if(SceneCamera.cameraTerrainMinScaledPitch / 256 > pitch) {
830830
pitch = SceneCamera.cameraTerrainMinScaledPitch / 256;
831831
}
@@ -834,7 +834,7 @@ public static void method353() {
834834
pitch = 128 + SceneCamera.customCameraAmplitude[4];
835835
}
836836

837-
Main.playerCamera.setPitch(pitch);
837+
Game.playerCamera.setPitch(pitch);
838838
}
839839

840840
int i;
@@ -916,7 +916,7 @@ public static void method353() {
916916
* Get the currently active camera.
917917
*/
918918
public static Camera getActiveCamera() {
919-
return Player.cutsceneActive ? Main.cutsceneCamera : Main.playerCamera;
919+
return Player.cutsceneActive ? Game.cutsceneCamera : Game.playerCamera;
920920
}
921921

922922
public static void method357(CacheArchive arg0, CacheArchive arg2) {
@@ -1209,7 +1209,7 @@ public static void method164() {
12091209

12101210
public static void moveTowardsTarget() {
12111211
// TODO (James) this moves the cutscene camera towards its target, we should move this into the CutsceneCamera class
1212-
CutsceneCamera camera = Main.cutsceneCamera;
1212+
CutsceneCamera camera = Game.cutsceneCamera;
12131213

12141214
int i = camera.getMoveTo().y;
12151215
int i_3_ = camera.getMoveTo().x;
@@ -1428,8 +1428,8 @@ else if(x > 764)
14281428
InteractiveObject.anInt487 = 20;
14291429
MovedStatics.aBoolean565 = false;
14301430
SceneCluster.packetBuffer.putPacket(58);
1431-
SceneCluster.packetBuffer.putShortBE(Main.playerCamera.getYaw());
1432-
SceneCluster.packetBuffer.putShortBE(Main.playerCamera.getPitch());
1431+
SceneCluster.packetBuffer.putShortBE(Game.playerCamera.getYaw());
1432+
SceneCluster.packetBuffer.putShortBE(Game.playerCamera.getPitch());
14331433
}
14341434
if(MovedStatics.aBoolean571 && !aBoolean1735) {
14351435
aBoolean1735 = true;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ public void run() {
4848
Class40_Sub3.anInt2024 = 5;
4949
}
5050
}
51-
if (Main.signlink.gameShell != null) {
51+
if (Game.signlink.gameShell != null) {
5252
Method method = Signlink.aMethod724;
5353
if (method != null) {
5454
try {
55-
method.invoke(Main.signlink.gameShell, Boolean.TRUE);
55+
method.invoke(Game.signlink.gameShell, Boolean.TRUE);
5656
} catch (Throwable throwable) {
5757
}
5858
}
@@ -110,9 +110,9 @@ public synchronized void closeGameShell() {
110110
/* empty */
111111
}
112112
}
113-
if (Main.signlink != null) {
113+
if (Game.signlink != null) {
114114
try {
115-
Main.signlink.killSignlinkThread();
115+
Game.signlink.killSignlinkThread();
116116
} catch (Exception exception) {
117117
/* empty */
118118
}
@@ -211,14 +211,14 @@ public void displayClientFrame(int clientVersion, int width, int height, int fil
211211
Class39.anInt901 = clientVersion;
212212
MovedStatics.height = width;
213213
currentGameShell = this;
214-
if (Main.signlink == null) {
214+
if (Game.signlink == null) {
215215
try {
216-
Actor.signlink = Main.signlink = new Signlink(false, this, InetAddress.getByName(getCodeBase().getHost()), fileStoreId, null, 0);
216+
Actor.signlink = Game.signlink = new Signlink(false, this, InetAddress.getByName(getCodeBase().getHost()), fileStoreId, null, 0);
217217
} catch (IOException e) {
218218
e.printStackTrace();
219219
}
220220
}
221-
Main.signlink.createThreadNode(1, this);
221+
Game.signlink.createThreadNode(1, this);
222222
windowActivated(null);
223223
}
224224

@@ -286,8 +286,8 @@ public void openClientApplet(String cacheFolder, int cacheIndexes, int fileStore
286286
Insets insets = clientFrame.getInsets();
287287
clientFrame.setSize(insets.right + width + insets.left, insets.bottom + insets.top + height);
288288
// Class35.aFrame1732.setLocationRelativeTo(null);
289-
Actor.signlink = Main.signlink = new Signlink(true, null, inetAddress, fileStoreId, cacheFolder, cacheIndexes);
290-
Main.signlink.createThreadNode(1, this);
289+
Actor.signlink = Game.signlink = new Signlink(true, null, inetAddress, fileStoreId, cacheFolder, cacheIndexes);
290+
Game.signlink.createThreadNode(1, this);
291291
} catch (Exception exception) {
292292
MovedStatics.printException(null, exception);
293293
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,28 @@ public class Landscape {
5252
public static int[][][] constructMapTiles = new int[4][13][13];
5353

5454
public static void loadRegion() {
55-
Main.method364(false);
56-
Main.anInt874 = 0;
55+
Game.method364(false);
56+
Game.anInt874 = 0;
5757
boolean bool = true;
5858
for(int i = 0; i < RSString.terrainData.length; i++) {
5959
if(LinkedList.terrainDataIds[i] != -1 && RSString.terrainData[i] == null) {
6060
RSString.terrainData[i] = CacheArchive.gameWorldMapCacheArchive.getFile(LinkedList.terrainDataIds[i], 0);
6161
if(RSString.terrainData[i] == null) {
62-
Main.anInt874++;
62+
Game.anInt874++;
6363
bool = false;
6464
}
6565
}
6666
if(Class13.objectDataIds[i] != -1 && objectData[i] == null) {
6767
objectData[i] = CacheArchive.gameWorldMapCacheArchive.method176(Class13.objectDataIds[i], 0, Class44.xteaKeys[i]);
6868
if(objectData[i] == null) {
69-
Main.anInt874++;
69+
Game.anInt874++;
7070
bool = false;
7171
}
7272
}
7373
}
7474
if(bool) {
7575
bool = true;
76-
Main.anInt2591 = 0;
76+
Game.anInt2591 = 0;
7777
for(int i = 0; RSString.terrainData.length > i; i++) {
7878
byte[] is = objectData[i];
7979
if(is != null) {
@@ -103,7 +103,7 @@ public static void loadRegion() {
103103
method1020();
104104
int dataLength = RSString.terrainData.length;
105105
SoundSystem.clearObjectSounds();
106-
Main.method364(true);
106+
Game.method364(true);
107107
if(!GroundItemTile.loadGeneratedMap) {
108108
for(int pointer = 0; dataLength > pointer; pointer++) {
109109
int offsetY = -Class26.baseY + (0xff & mapCoordinates[pointer]) * 64;
@@ -123,7 +123,7 @@ public static void loadRegion() {
123123
if(data == null && Class17.regionY < 800)
124124
MovedStatics.initiateVertexHeights(offsetY, 64, 64, offsetX);
125125
}
126-
Main.method364(true);
126+
Game.method364(true);
127127
for(int region = 0; dataLength > region; region++) {
128128
// System.out.println("Requesting map: "+Class13.anIntArray421[i_12_]);
129129
// load maps in here
@@ -180,7 +180,7 @@ public static void loadRegion() {
180180
MovedStatics.initiateVertexHeights(y * 8, 8, 8, 8 * x);
181181
}
182182
}
183-
Main.method364(true);
183+
Game.method364(true);
184184
for(int z = 0; z < 4; z++) {
185185
for(int x = 0; x < 13; x++) {
186186
for(int y = 0; y < 13; y++) {
@@ -202,10 +202,10 @@ public static void loadRegion() {
202202
}
203203
}
204204
}
205-
Main.method364(true);
205+
Game.method364(true);
206206
RSCanvas.clearCaches();
207207
createRegion(Npc.currentScene, currentCollisionMap);
208-
Main.method364(true);
208+
Game.method364(true);
209209
int z = MovedStatics.lowestPlane;
210210
if(Player.worldLevel < z)
211211
z = Player.worldLevel;
@@ -703,7 +703,7 @@ else if(s > 255)
703703

704704
private static void method285(byte arg0) {
705705
if(arg0 != 118)
706-
Main.aBoolean519 = true;
706+
Game.aBoolean519 = true;
707707
for(Class40_Sub3 class40_sub3 = (Class40_Sub3) LinkedList.aLinkedList_1064.peekFirst(); class40_sub3 != null; class40_sub3 = (Class40_Sub3) LinkedList.aLinkedList_1064.pollFirst()) {
708708
if(class40_sub3.anInt2031 == -1) {
709709
class40_sub3.anInt2033 = 0;

0 commit comments

Comments
 (0)