Skip to content

Commit 672272d

Browse files
committed
refactor: move statics from some Definition files
1 parent 989b8a6 commit 672272d

22 files changed

+210
-235
lines changed

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

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

3-
import org.runejs.client.cache.def.ActorDefinition;
43
import org.runejs.client.cache.media.ImageRGB;
54
import org.runejs.client.frame.Minimap;
65
import org.runejs.client.media.renderable.actor.Player;
@@ -19,7 +18,7 @@ public class Class37 {
1918
public static void method434() {
2019
MovedStatics.menuOpen = false;
2120
IncomingPackets.opcode = -1;
22-
ActorDefinition.menuActionRow = 0;
21+
MovedStatics.menuActionRow = 0;
2322
IncomingPackets.incomingPacketSize = 0;
2423
SceneCluster.packetBuffer.currentPosition = 0;
2524
IncomingPackets.lastOpcode = -1;

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

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

33
import org.runejs.client.cache.def.ItemDefinition;
4-
import org.runejs.client.cache.def.ActorDefinition;
54
import org.runejs.client.cache.def.OverlayDefinition;
65
import org.runejs.client.cache.media.TypeFace;
76
import org.runejs.client.cache.media.gameInterface.GameInterface;
@@ -66,7 +65,7 @@ public static void processRightClick() {
6665
if(SceneTile.activeInterfaceType == 0) {
6766
Landscape.menuActionTexts[0] = English.cancel;
6867
MovedStatics.menuActionTypes[0] = ActionRowType.CANCEL.getId();
69-
ActorDefinition.menuActionRow = 1;
68+
MovedStatics.menuActionRow = 1;
7069
if(GameInterface.fullscreenInterfaceId == -1) {
7170
MovedStatics.method445();
7271
Item.anInt3065 = -1;
@@ -122,7 +121,7 @@ public static void processRightClick() {
122121
}
123122
while(!bool) {
124123
bool = true;
125-
for(int i = 0; -1 + ActorDefinition.menuActionRow > i; i++) {
124+
for(int i = 0; -1 + MovedStatics.menuActionRow > i; i++) {
126125
if(MovedStatics.menuActionTypes[i] < 1000 && MovedStatics.menuActionTypes[1 + i] > 1000) {
127126
bool = false;
128127
String class1 = Landscape.menuActionTexts[i];
@@ -155,7 +154,7 @@ public static void processRightClick() {
155154

156155
public static void method398() {
157156
String class1 = null;
158-
for(int i = 0; ActorDefinition.menuActionRow > i; i++) {
157+
for(int i = 0; MovedStatics.menuActionRow > i; i++) {
159158
if(Landscape.menuActionTexts[i].contains(Native.lightRed)) {
160159
class1 = Landscape.menuActionTexts[i].substring(Landscape.menuActionTexts[i].indexOf(Native.lightRed));
161160
break;
@@ -191,8 +190,8 @@ public static void method398() {
191190
i_5_ -= 357;
192191
i_4_ -= 17;
193192
}
194-
for(int i_6_ = 0; i_6_ < ActorDefinition.menuActionRow; i_6_++) {
195-
int i_7_ = 31 + i_2_ + (ActorDefinition.menuActionRow + -1 + -i_6_) * 15;
193+
for(int i_6_ = 0; i_6_ < MovedStatics.menuActionRow; i_6_++) {
194+
int i_7_ = 31 + i_2_ + (MovedStatics.menuActionRow + -1 + -i_6_) * 15;
196195
String class1_8_ = Landscape.menuActionTexts[i_6_];
197196
int i_9_ = 16777215;
198197
if(class1_8_.endsWith(class1)) {

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

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ public static int method988(CacheArchive arg0, CacheArchive arg1) {
5656

5757
public static void determineMenuSize() {
5858
int width = TypeFace.fontBold.getStringWidth(English.chooseOption);
59-
for(int i = 0; i < ActorDefinition.menuActionRow; i++) {
59+
for(int i = 0; i < MovedStatics.menuActionRow; i++) {
6060
int rowWidth = TypeFace.fontBold.getTextDisplayedWidth(Landscape.menuActionTexts[i]);
6161
if(width < rowWidth)
6262
width = rowWidth;
6363
}
6464
width += 8;
65-
int height = ActorDefinition.menuActionRow * 15 + 21;
65+
int height = MovedStatics.menuActionRow * 15 + 21;
6666
if(ScreenController.frameMode == ScreenMode.FIXED){
6767
if(MouseHandler.clickX > 4 && MouseHandler.clickY > 4 && MouseHandler.clickX < 516 && MouseHandler.clickY < 338) {
6868
Projectile.menuScreenArea = 0;
69-
CollisionMap.menuHeight = ActorDefinition.menuActionRow * 15 + 22;
69+
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
7070
MovedStatics.menuOpen = true;
7171
int x = -(width / 2) + -4 + MouseHandler.clickX;
7272
VertexNormal.menuWidth = width;
@@ -83,7 +83,7 @@ public static void determineMenuSize() {
8383
Main.menuOffsetY = y;
8484
}
8585
if(MouseHandler.clickX > 553 && MouseHandler.clickY > 205 && MouseHandler.clickX < 743 && MouseHandler.clickY < 466) {
86-
CollisionMap.menuHeight = 22 + 15 * ActorDefinition.menuActionRow;
86+
CollisionMap.menuHeight = 22 + 15 * MovedStatics.menuActionRow;
8787
Projectile.menuScreenArea = 1;
8888
int y = -205 + MouseHandler.clickY;
8989
int x = -(width / 2) + -553 + MouseHandler.clickX;
@@ -104,7 +104,7 @@ else if(width + x > 190)
104104
if(MouseHandler.clickX > 17 && MouseHandler.clickY > 357 && MouseHandler.clickX < 496 && MouseHandler.clickY < 453) {
105105
VertexNormal.menuWidth = width;
106106
Projectile.menuScreenArea = 2;
107-
CollisionMap.menuHeight = ActorDefinition.menuActionRow * 15 + 22;
107+
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
108108
int y = MouseHandler.clickY + -357;
109109
if(y >= 0) {
110110
if(height + y > 96)
@@ -141,7 +141,7 @@ else if(x + width > 479)
141141
InteractiveObject.menuOffsetX = x;
142142
Main.menuOffsetY = y;
143143
VertexNormal.menuWidth = width;
144-
CollisionMap.menuHeight = ActorDefinition.menuActionRow * 15 + 22;
144+
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
145145
}
146146
// if(Class57.clickX > 553 && RSString.clickY > 205 && Class57.clickX < 743 && RSString.clickY < 466) {
147147
// CollisionMap.menuHeight = 22 + 15 * ActorDefinition.menuActionRow;
@@ -455,7 +455,7 @@ public static void drawLoadingScreen(TypeFace fontBold, TypeFace fontSmall) {
455455
Class51.aProducingGraphicsBuffer_1206.drawGraphics(offsetX + 202, offsetY + 371, graphics);
456456
Class17.aProducingGraphicsBuffer_463.drawGraphics(offsetX, offsetY + 265, graphics);
457457
KeyFocusListener.aProducingGraphicsBuffer_1285.drawGraphics(offsetX + 562, offsetY + 265, graphics);
458-
GameObjectDefinition.aProducingGraphicsBuffer_2524.drawGraphics(offsetX + 128, offsetY + 171, graphics);
458+
MovedStatics.aProducingGraphicsBuffer_2524.drawGraphics(offsetX + 128, offsetY + 171, graphics);
459459
ProducingGraphicsBuffer.aProducingGraphicsBuffer_1631.drawGraphics(offsetX + 562, offsetY + 171, graphics);
460460
ProducingGraphicsBuffer.muteButton.drawGraphics(ScreenController.drawWidth-42, ScreenController.drawHeight-42, graphics);
461461
} catch (Exception exception) {
@@ -495,7 +495,7 @@ private static void method836(int arg0) {
495495
if (RSRuntimeException.anInt1641 > Landscape.anIntArray1168.length) {
496496
RSRuntimeException.anInt1641 -= Landscape.anIntArray1168.length;
497497
int i_9_ = (int) (12.0 * Math.random());
498-
FramemapDefinition.method879(MovedStatics.aClass40_Sub5_Sub14_Sub2Array535[i_9_]);
498+
method879(MovedStatics.aClass40_Sub5_Sub14_Sub2Array535[i_9_]);
499499
}
500500
for (int i_10_ = 1; i_10_ < -1 + i; i_10_++) {
501501
for (int i_11_ = 1; i_11_ < 127; i_11_++) {
@@ -538,7 +538,7 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
538538
Rasterizer.resetPixels();
539539
KeyFocusListener.aProducingGraphicsBuffer_1285 = MovedStatics.createGraphicsBuffer(203, 238, arg0);
540540
Rasterizer.resetPixels();
541-
GameObjectDefinition.aProducingGraphicsBuffer_2524 = MovedStatics.createGraphicsBuffer(74, 94, arg0);
541+
MovedStatics.aProducingGraphicsBuffer_2524 = MovedStatics.createGraphicsBuffer(74, 94, arg0);
542542
Rasterizer.resetPixels();
543543
ProducingGraphicsBuffer.aProducingGraphicsBuffer_1631 = MovedStatics.createGraphicsBuffer(75, 94, arg0);
544544
Rasterizer.resetPixels();
@@ -560,7 +560,7 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
560560
titleImg.drawInverse(0, -265);
561561
KeyFocusListener.aProducingGraphicsBuffer_1285.prepareRasterizer();
562562
titleImg.drawInverse(-562, -265);
563-
GameObjectDefinition.aProducingGraphicsBuffer_2524.prepareRasterizer();
563+
MovedStatics.aProducingGraphicsBuffer_2524.prepareRasterizer();
564564
titleImg.drawInverse(-128, -171);
565565
ProducingGraphicsBuffer.aProducingGraphicsBuffer_1631.prepareRasterizer();
566566
titleImg.drawInverse(-562, -171);
@@ -585,7 +585,7 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
585585
titleImg.drawInverse(382, -265);
586586
KeyFocusListener.aProducingGraphicsBuffer_1285.prepareRasterizer();
587587
titleImg.drawInverse(-180, -265);
588-
GameObjectDefinition.aProducingGraphicsBuffer_2524.prepareRasterizer();
588+
MovedStatics.aProducingGraphicsBuffer_2524.prepareRasterizer();
589589
titleImg.drawInverse(254, -171);
590590
ProducingGraphicsBuffer.aProducingGraphicsBuffer_1631.prepareRasterizer();
591591
titleImg.drawInverse(-180, -171);
@@ -643,7 +643,7 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
643643
MovedStatics.anIntArray1013 = new int[256];
644644
MovedStatics.anIntArray1445 = new int[32768];
645645
Landscape.anIntArray1168 = new int[32768];
646-
FramemapDefinition.method879(null);
646+
method879(null);
647647
SpotAnim.anIntArray3255 = new int[32768];
648648
Native.username = Configuration.getUsername();
649649
Native.password = Configuration.getPassword();
@@ -658,4 +658,39 @@ public static void renderLoginScreen(Component arg0, CacheArchive huffmanCacheAr
658658
ISAAC.aBoolean512 = true;
659659
}
660660
}
661+
662+
public static void method879(IndexedImage arg1) {
663+
int i = 0;
664+
for(/**/; i < Landscape.anIntArray1168.length; i++)
665+
Landscape.anIntArray1168[i] = 0;
666+
int i_19_ = 256;
667+
for(int i_20_ = 0; i_20_ < 5000; i_20_++) {
668+
int i_21_ = (int) ((double) i_19_ * (128.0 * Math.random()));
669+
Landscape.anIntArray1168[i_21_] = (int) (256.0 * Math.random());
670+
}
671+
for(int i_22_ = 0; i_22_ < 20; i_22_++) {
672+
for(int i_23_ = 1; -1 + i_19_ > i_23_; i_23_++) {
673+
for(int i_24_ = 1; i_24_ < 127; i_24_++) {
674+
int i_25_ = (i_23_ << 7) + i_24_;
675+
MovedStatics.anIntArray1445[i_25_] = (Landscape.anIntArray1168[i_25_ - 128] + Landscape.anIntArray1168[i_25_ + -1] + Landscape.anIntArray1168[i_25_ + 1] + Landscape.anIntArray1168[128 + i_25_]) / 4;
676+
}
677+
}
678+
int[] is = Landscape.anIntArray1168;
679+
Landscape.anIntArray1168 = MovedStatics.anIntArray1445;
680+
MovedStatics.anIntArray1445 = is;
681+
}
682+
if(arg1 != null) {
683+
int i_26_ = 0;
684+
for(int i_27_ = 0; arg1.imgHeight > i_27_; i_27_++) {
685+
for(int i_28_ = 0; i_28_ < arg1.imgWidth; i_28_++) {
686+
if(arg1.imgPixels[i_26_++] != 0) {
687+
int i_29_ = arg1.yDrawOffset + i_27_ + 16;
688+
int i_30_ = arg1.xDrawOffset + i_28_ + 16;
689+
int i_31_ = i_30_ + (i_29_ << 7);
690+
Landscape.anIntArray1168[i_31_] = 0;
691+
}
692+
}
693+
}
694+
}
695+
}
661696
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static void loadRegion() {
216216
Npc.currentScene.setHeightLevel(MovedStatics.lowestPlane);
217217
for(int x = 0; x < 104; x++) {
218218
for(int y = 0; y < 104; y++)
219-
FramemapDefinition.spawnGroundItem(y, x);
219+
MovedStatics.spawnGroundItem(y, x);
220220
}
221221
method285((byte) 118);
222222
GameObjectDefinition.objectModelCache.clear();

0 commit comments

Comments
 (0)