Skip to content

Commit 39e28b9

Browse files
authored
Merge pull request #172 from runejs/move-statics-to-movedstatics-2
refactor: moving more statics around
2 parents 869eee4 + 6137882 commit 39e28b9

23 files changed

+211
-240
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.runejs.client.scene.SceneCluster;
1616

1717
public class Class33 {
18-
public static int[] selectedMenuActions = new int[500];
1918

2019

2120
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static void startup() {
159159
Game.method357(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
160160
MovedStatics.initializeItemDefinitionCache(CacheArchive.gameDefinitionsCacheArchive, MovedStatics.membersWorld, CacheArchive.modelCacheArchive);
161161
MovedStatics.initializeAnimationCaches(CacheArchive.skinDefinitionCacheArchive, CacheArchive.gameDefinitionsCacheArchive, CacheArchive.skeletonCacheArchive);
162-
Class55.method966(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
162+
SpotAnimDefinition.initializeSpotAnimCache(CacheArchive.modelCacheArchive, CacheArchive.gameDefinitionsCacheArchive);
163163
VarbitDefinition.initializeVarbitDefinitionCache(CacheArchive.gameDefinitionsCacheArchive);
164164
VarPlayerDefinition.initializeVarPlayerDefinitionCache(CacheArchive.gameDefinitionsCacheArchive);
165165
GameInterface.createInterfaceMemoryBuffers();

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

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
import org.runejs.client.language.English;
1111
import org.runejs.client.language.Native;
1212
import org.runejs.client.media.Rasterizer;
13-
import org.runejs.client.media.VertexNormal;
14-
import org.runejs.client.media.renderable.Item;
1513
import org.runejs.client.media.renderable.actor.Player;
16-
import org.runejs.client.scene.InteractiveObject;
17-
import org.runejs.client.scene.util.CollisionMap;
1814

1915
public class Class43 {
2016
public static LinkedList projectileQueue = new LinkedList();
@@ -52,19 +48,19 @@ else if(ScreenController.frameMode == ScreenMode.FIXED)
5248
}
5349

5450
if(ScreenController.frameMode == ScreenMode.FIXED) {
55-
Class55.drawTabGraphics();
51+
MovedStatics.drawTabGraphics();
5652
}
5753
}
5854

5955

6056
public static void processRightClick() {
6157
if(MovedStatics.activeInterfaceType == 0) {
62-
Landscape.menuActionTexts[0] = English.cancel;
58+
MovedStatics.menuActionTexts[0] = English.cancel;
6359
MovedStatics.menuActionTypes[0] = ActionRowType.CANCEL.getId();
6460
MovedStatics.menuActionRow = 1;
6561
if(GameInterface.fullscreenInterfaceId == -1) {
6662
MovedStatics.method445();
67-
Item.anInt3065 = -1;
63+
MovedStatics.anInt3065 = -1;
6864
MovedStatics.hoveredWidgetChildId = -1;
6965
boolean bool = false;
7066
// Right game screen
@@ -82,88 +78,88 @@ public static void processRightClick() {
8278
}
8379
}
8480

85-
MovedStatics.anInt573 = Item.anInt3065;
81+
MovedStatics.anInt573 = MovedStatics.anInt3065;
8682
MovedStatics.anInt2850 = MovedStatics.hoveredWidgetChildId;
87-
Item.anInt3065 = -1;
83+
MovedStatics.anInt3065 = -1;
8884
MovedStatics.hoveredWidgetChildId = -1;
8985
// Right click tab
9086
if(ScreenController.isCoordinatesInTabArea(MouseHandler.mouseX, MouseHandler.mouseY)) {
9187
ScreenController.handleTabClick(MouseHandler.mouseX, MouseHandler.mouseY);
9288
}
93-
if(MovedStatics.hoveredWidgetChildId != CollisionMap.currentHoveredWidgetChildId) {
89+
if(MovedStatics.hoveredWidgetChildId != MovedStatics.currentHoveredWidgetChildId) {
9490
GameInterface.redrawTabArea = true;
95-
CollisionMap.currentHoveredWidgetChildId = MovedStatics.hoveredWidgetChildId;
91+
MovedStatics.currentHoveredWidgetChildId = MovedStatics.hoveredWidgetChildId;
9692
}
9793
MovedStatics.hoveredWidgetChildId = -1;
98-
if(Item.anInt3065 != MovedStatics.anInt614) {
99-
MovedStatics.anInt614 = Item.anInt3065;
94+
if(MovedStatics.anInt3065 != MovedStatics.anInt614) {
95+
MovedStatics.anInt614 = MovedStatics.anInt3065;
10096
GameInterface.redrawTabArea = true;
10197
}
102-
Item.anInt3065 = -1;
98+
MovedStatics.anInt3065 = -1;
10399
// right click chatbox
104100
if(ScreenController.isCoordinatesInChatArea(MouseHandler.mouseX , MouseHandler.mouseY)) {
105101
ScreenController.handleChatBoxMouse(MouseHandler.mouseX , MouseHandler.mouseY);
106102
}
107103

108104
// Set hovering for chat widgets
109-
if((GameInterface.chatboxInterfaceId != -1 || ChatBox.dialogueId != -1) && Class55.currentHoveredChatboxWidgetChildId != MovedStatics.hoveredWidgetChildId) {
105+
if((GameInterface.chatboxInterfaceId != -1 || ChatBox.dialogueId != -1) && MovedStatics.currentHoveredChatboxWidgetChildId != MovedStatics.hoveredWidgetChildId) {
110106
ChatBox.redrawChatbox = true;
111-
Class55.currentHoveredChatboxWidgetChildId = MovedStatics.hoveredWidgetChildId;
107+
MovedStatics.currentHoveredChatboxWidgetChildId = MovedStatics.hoveredWidgetChildId;
112108
}
113109

114-
if((GameInterface.chatboxInterfaceId != -1 || ChatBox.dialogueId != -1) && Item.anInt3065 != MovedStatics.anInt1586) {
110+
if((GameInterface.chatboxInterfaceId != -1 || ChatBox.dialogueId != -1) && MovedStatics.anInt3065 != MovedStatics.anInt1586) {
115111
ChatBox.redrawChatbox = true;
116-
MovedStatics.anInt1586 = Item.anInt3065;
112+
MovedStatics.anInt1586 = MovedStatics.anInt3065;
117113
}
118114
while(!bool) {
119115
bool = true;
120116
for(int i = 0; -1 + MovedStatics.menuActionRow > i; i++) {
121117
if(MovedStatics.menuActionTypes[i] < 1000 && MovedStatics.menuActionTypes[1 + i] > 1000) {
122118
bool = false;
123-
String class1 = Landscape.menuActionTexts[i];
124-
Landscape.menuActionTexts[i] = Landscape.menuActionTexts[i + 1];
125-
Landscape.menuActionTexts[i + 1] = class1;
119+
String class1 = MovedStatics.menuActionTexts[i];
120+
MovedStatics.menuActionTexts[i] = MovedStatics.menuActionTexts[i + 1];
121+
MovedStatics.menuActionTexts[i + 1] = class1;
126122
int i_90_ = MovedStatics.menuActionTypes[i];
127123
MovedStatics.menuActionTypes[i] = MovedStatics.menuActionTypes[i + 1];
128124
MovedStatics.menuActionTypes[i + 1] = i_90_;
129-
i_90_ = InteractiveObject.firstMenuOperand[i];
130-
InteractiveObject.firstMenuOperand[i] = InteractiveObject.firstMenuOperand[1 + i];
131-
InteractiveObject.firstMenuOperand[1 + i] = i_90_;
132-
i_90_ = Class59.secondMenuOperand[i];
133-
Class59.secondMenuOperand[i] = Class59.secondMenuOperand[1 + i];
134-
Class59.secondMenuOperand[i + 1] = i_90_;
135-
i_90_ = Class33.selectedMenuActions[i];
136-
Class33.selectedMenuActions[i] = Class33.selectedMenuActions[i + 1];
137-
Class33.selectedMenuActions[1 + i] = i_90_;
125+
i_90_ = MovedStatics.firstMenuOperand[i];
126+
MovedStatics.firstMenuOperand[i] = MovedStatics.firstMenuOperand[1 + i];
127+
MovedStatics.firstMenuOperand[1 + i] = i_90_;
128+
i_90_ = MovedStatics.secondMenuOperand[i];
129+
MovedStatics.secondMenuOperand[i] = MovedStatics.secondMenuOperand[1 + i];
130+
MovedStatics.secondMenuOperand[i + 1] = i_90_;
131+
i_90_ = MovedStatics.selectedMenuActions[i];
132+
MovedStatics.selectedMenuActions[i] = MovedStatics.selectedMenuActions[i + 1];
133+
MovedStatics.selectedMenuActions[1 + i] = i_90_;
138134
}
139135
}
140136
}
141137
} else {
142-
Item.anInt3065 = -1;
138+
MovedStatics.anInt3065 = -1;
143139
MovedStatics.hoveredWidgetChildId = -1;
144140
Class13.handleInterfaceActions(GameInterfaceArea.GAME_AREA, MouseHandler.mouseX, MouseHandler.mouseY, 0, 0, 765, 503, GameInterface.fullscreenInterfaceId);
145141
MovedStatics.anInt2850 = MovedStatics.hoveredWidgetChildId;
146-
MovedStatics.anInt573 = Item.anInt3065;
142+
MovedStatics.anInt573 = MovedStatics.anInt3065;
147143
}
148144
}
149145
}
150146

151147
public static void method398() {
152148
String class1 = null;
153149
for(int i = 0; MovedStatics.menuActionRow > i; i++) {
154-
if(Landscape.menuActionTexts[i].contains(Native.lightRed)) {
155-
class1 = Landscape.menuActionTexts[i].substring(Landscape.menuActionTexts[i].indexOf(Native.lightRed));
150+
if(MovedStatics.menuActionTexts[i].contains(Native.lightRed)) {
151+
class1 = MovedStatics.menuActionTexts[i].substring(MovedStatics.menuActionTexts[i].indexOf(Native.lightRed));
156152
break;
157153
}
158154
}
159155
if(class1 == null)
160156
MovedStatics.drawMenu(0,0);
161157
else {
162-
int i = VertexNormal.menuWidth;
163-
int i_0_ = InteractiveObject.menuOffsetX;
158+
int i = MovedStatics.menuWidth;
159+
int i_0_ = MovedStatics.menuOffsetX;
164160
if(i > 190)
165161
i = 190;
166-
int i_1_ = CollisionMap.menuHeight;
162+
int i_1_ = MovedStatics.menuHeight;
167163
int i_2_ = Game.menuOffsetY;
168164
if(i_0_ < 0)
169165
i_0_ = 0;
@@ -188,7 +184,7 @@ public static void method398() {
188184
}
189185
for(int i_6_ = 0; i_6_ < MovedStatics.menuActionRow; i_6_++) {
190186
int i_7_ = 31 + i_2_ + (MovedStatics.menuActionRow + -1 + -i_6_) * 15;
191-
String class1_8_ = Landscape.menuActionTexts[i_6_];
187+
String class1_8_ = MovedStatics.menuActionTexts[i_6_];
192188
int i_9_ = 16777215;
193189
if(class1_8_.endsWith(class1)) {
194190
class1_8_ = class1_8_.substring(0, class1_8_.length() - class1.length());

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

Lines changed: 0 additions & 88 deletions
This file was deleted.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ public class Class59 {
1212
public static int anInt1388;
1313
public static int anInt1389 = 0;
1414
public static KeyFocusListener keyFocusListener;
15-
public static int[] secondMenuOperand;
1615
public static long[] friends;
1716

1817
static {
19-
secondMenuOperand = new int[500];
18+
MovedStatics.secondMenuOperand = new int[500];
2019
friends = new long[200];
2120
keyFocusListener = new KeyFocusListener();
2221
}

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
import org.runejs.client.media.renderable.actor.Player;
1919
import org.runejs.client.net.ISAAC;
2020
import org.runejs.client.net.UpdateServer;
21-
import org.runejs.client.scene.InteractiveObject;
2221
import org.runejs.client.scene.SceneCluster;
23-
import org.runejs.client.scene.util.CollisionMap;
2422
import org.runejs.client.sound.MusicSystem;
2523
import org.runejs.Configuration;
2624
import org.runejs.whitelabel.Images;
@@ -55,7 +53,7 @@ public static int method988(CacheArchive arg0, CacheArchive arg1) {
5553
public static void determineMenuSize() {
5654
int width = TypeFace.fontBold.getStringWidth(English.chooseOption);
5755
for(int i = 0; i < MovedStatics.menuActionRow; i++) {
58-
int rowWidth = TypeFace.fontBold.getTextDisplayedWidth(Landscape.menuActionTexts[i]);
56+
int rowWidth = TypeFace.fontBold.getTextDisplayedWidth(MovedStatics.menuActionTexts[i]);
5957
if(width < rowWidth)
6058
width = rowWidth;
6159
}
@@ -64,15 +62,15 @@ public static void determineMenuSize() {
6462
if(ScreenController.frameMode == ScreenMode.FIXED){
6563
if(MouseHandler.clickX > 4 && MouseHandler.clickY > 4 && MouseHandler.clickX < 516 && MouseHandler.clickY < 338) {
6664
MovedStatics.menuScreenArea = 0;
67-
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
65+
MovedStatics.menuHeight = MovedStatics.menuActionRow * 15 + 22;
6866
MovedStatics.menuOpen = true;
6967
int x = -(width / 2) + -4 + MouseHandler.clickX;
70-
VertexNormal.menuWidth = width;
68+
MovedStatics.menuWidth = width;
7169
if(width + x > 512)
7270
x = 512 - width;
7371
if(x < 0)
7472
x = 0;
75-
InteractiveObject.menuOffsetX = x;
73+
MovedStatics.menuOffsetX = x;
7674
int y = MouseHandler.clickY + -4;
7775
if(y + height > 334)
7876
y = 334 - height;
@@ -81,7 +79,7 @@ public static void determineMenuSize() {
8179
Game.menuOffsetY = y;
8280
}
8381
if(MouseHandler.clickX > 553 && MouseHandler.clickY > 205 && MouseHandler.clickX < 743 && MouseHandler.clickY < 466) {
84-
CollisionMap.menuHeight = 22 + 15 * MovedStatics.menuActionRow;
82+
MovedStatics.menuHeight = 22 + 15 * MovedStatics.menuActionRow;
8583
MovedStatics.menuScreenArea = 1;
8684
int y = -205 + MouseHandler.clickY;
8785
int x = -(width / 2) + -553 + MouseHandler.clickX;
@@ -90,19 +88,19 @@ public static void determineMenuSize() {
9088
else if(width + x > 190)
9189
x = 190 - width;
9290
MovedStatics.menuOpen = true;
93-
InteractiveObject.menuOffsetX = x;
91+
MovedStatics.menuOffsetX = x;
9492
if(y >= 0) {
9593
if(height + y > 261)
9694
y = -height + 261;
9795
} else
9896
y = 0;
99-
VertexNormal.menuWidth = width;
97+
MovedStatics.menuWidth = width;
10098
Game.menuOffsetY = y;
10199
}
102100
if(MouseHandler.clickX > 17 && MouseHandler.clickY > 357 && MouseHandler.clickX < 496 && MouseHandler.clickY < 453) {
103-
VertexNormal.menuWidth = width;
101+
MovedStatics.menuWidth = width;
104102
MovedStatics.menuScreenArea = 2;
105-
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
103+
MovedStatics.menuHeight = MovedStatics.menuActionRow * 15 + 22;
106104
int y = MouseHandler.clickY + -357;
107105
if(y >= 0) {
108106
if(height + y > 96)
@@ -116,7 +114,7 @@ else if(width + x > 190)
116114
x = 0;
117115
else if(x + width > 479)
118116
x = -width + 479;
119-
InteractiveObject.menuOffsetX = x;
117+
MovedStatics.menuOffsetX = x;
120118
}
121119

122120
} else if(MouseHandler.clickX > 0 && MouseHandler.clickY > 0 && MouseHandler.clickX < GameShell.clientFrame.getWidth() && MouseHandler.clickY < GameShell.clientFrame.getHeight()) {
@@ -136,10 +134,10 @@ else if(x + width > 479)
136134
if(width + x > ScreenController.drawWidth)
137135
x = ScreenController.drawWidth - width;
138136
MovedStatics.menuOpen = true;
139-
InteractiveObject.menuOffsetX = x;
137+
MovedStatics.menuOffsetX = x;
140138
Game.menuOffsetY = y;
141-
VertexNormal.menuWidth = width;
142-
CollisionMap.menuHeight = MovedStatics.menuActionRow * 15 + 22;
139+
MovedStatics.menuWidth = width;
140+
MovedStatics.menuHeight = MovedStatics.menuActionRow * 15 + 22;
143141
}
144142
// if(Class57.clickX > 553 && RSString.clickY > 205 && Class57.clickX < 743 && RSString.clickY < 466) {
145143
// CollisionMap.menuHeight = 22 + 15 * ActorDefinition.menuActionRow;

0 commit comments

Comments
 (0)