Skip to content

Commit a47cc70

Browse files
committed
refactor: remove statics from PlayerAppearance
1 parent 54c5c42 commit a47cc70

File tree

3 files changed

+46
-48
lines changed

3 files changed

+46
-48
lines changed

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

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,14 +2584,14 @@ else if(i < Player.localPlayerCount)
25842584
Point2d screenPos = getProjectedScreenPosition(actor.anInt3117, actor.worldY, actor.worldX);
25852585

25862586
if(screenPos != null && 50 > SceneCluster.anInt770) {
2587-
PlayerAppearance.anIntArray680[SceneCluster.anInt770] = TypeFace.fontBold.getStringWidth(actor.forcedChatMessage) / 2;
2588-
PlayerAppearance.anIntArray688[SceneCluster.anInt770] = TypeFace.fontBold.characterDefaultHeight;
2589-
PlayerAppearance.anIntArray715[SceneCluster.anInt770] = screenPos.x;
2590-
PlayerAppearance.anIntArray685[SceneCluster.anInt770] = screenPos.y;
2591-
PlayerAppearance.overheadChatColor[SceneCluster.anInt770] = actor.chatcolor;
2592-
PlayerAppearance.overheadChatShape[SceneCluster.anInt770] = actor.chatEffects;
2593-
PlayerAppearance.anIntArray684[SceneCluster.anInt770] = actor.chatTimer;
2594-
PlayerAppearance.overheadChatMessage[SceneCluster.anInt770] = actor.forcedChatMessage;
2587+
Actor.overheadChatHalfWidth[SceneCluster.anInt770] = TypeFace.fontBold.getStringWidth(actor.forcedChatMessage) / 2;
2588+
Actor.overheadChatLetterHeight[SceneCluster.anInt770] = TypeFace.fontBold.characterDefaultHeight;
2589+
Actor.overheadChatX[SceneCluster.anInt770] = screenPos.x;
2590+
Actor.overheadChatY[SceneCluster.anInt770] = screenPos.y;
2591+
Actor.overheadChatColor[SceneCluster.anInt770] = actor.chatcolor;
2592+
Actor.overheadChatShape[SceneCluster.anInt770] = actor.chatEffects;
2593+
Actor.overheadChatTimer[SceneCluster.anInt770] = actor.chatTimer;
2594+
Actor.overheadChatMessage[SceneCluster.anInt770] = actor.forcedChatMessage;
25952595
SceneCluster.anInt770++;
25962596
}
25972597
}
@@ -2628,38 +2628,38 @@ else if(i < Player.localPlayerCount)
26282628
}
26292629
}
26302630
for(int i = 0; SceneCluster.anInt770 > i; i++) {
2631-
int i_3_ = PlayerAppearance.anIntArray715[i];
2632-
int i_4_ = PlayerAppearance.anIntArray685[i];
2633-
int i_5_ = PlayerAppearance.anIntArray680[i];
2634-
int i_6_ = PlayerAppearance.anIntArray688[i];
2631+
int i_3_ = Actor.overheadChatX[i];
2632+
int i_4_ = Actor.overheadChatY[i];
2633+
int i_5_ = Actor.overheadChatHalfWidth[i];
2634+
int i_6_ = Actor.overheadChatLetterHeight[i];
26352635
boolean bool = true;
26362636
while(bool) {
26372637
bool = false;
26382638
for(int i_7_ = 0; i > i_7_; i_7_++) {
2639-
if(-PlayerAppearance.anIntArray688[i_7_] + PlayerAppearance.anIntArray685[i_7_] < i_4_ + 2 && -i_6_ + i_4_ < 2 + PlayerAppearance.anIntArray685[i_7_] && PlayerAppearance.anIntArray715[i_7_] + PlayerAppearance.anIntArray680[i_7_] > -i_5_ + i_3_ && i_5_ + i_3_ > -PlayerAppearance.anIntArray680[i_7_] + PlayerAppearance.anIntArray715[i_7_] && -PlayerAppearance.anIntArray688[i_7_] + PlayerAppearance.anIntArray685[i_7_] < i_4_) {
2639+
if(-Actor.overheadChatLetterHeight[i_7_] + Actor.overheadChatY[i_7_] < i_4_ + 2 && -i_6_ + i_4_ < 2 + Actor.overheadChatY[i_7_] && Actor.overheadChatX[i_7_] + Actor.overheadChatHalfWidth[i_7_] > -i_5_ + i_3_ && i_5_ + i_3_ > -Actor.overheadChatHalfWidth[i_7_] + Actor.overheadChatX[i_7_] && -Actor.overheadChatLetterHeight[i_7_] + Actor.overheadChatY[i_7_] < i_4_) {
26402640
bool = true;
2641-
i_4_ = -PlayerAppearance.anIntArray688[i_7_] + PlayerAppearance.anIntArray685[i_7_];
2641+
i_4_ = -Actor.overheadChatLetterHeight[i_7_] + Actor.overheadChatY[i_7_];
26422642
}
26432643
}
26442644
}
2645-
PlayerAppearance.anIntArray685[i] = i_4_;
2645+
Actor.overheadChatY[i] = i_4_;
26462646

2647-
Point2d screenPos = new Point2d(PlayerAppearance.anIntArray715[i], PlayerAppearance.anIntArray685[i]);
2648-
String message = PlayerAppearance.overheadChatMessage[i];
2647+
Point2d screenPos = new Point2d(Actor.overheadChatX[i], Actor.overheadChatY[i]);
2648+
String message = Actor.overheadChatMessage[i];
26492649
if(chatEffectsDisabled == 0) {
26502650
int textColor = OVERHEAD_CHAT_COLORS[0];
26512651
// standard 6 colors (yellow, red, green, cyan, purple, white)
26522652
// TODO (James) tie this into the ChatColorEffect enum
2653-
if(PlayerAppearance.overheadChatColor[i] < 6)
2654-
textColor = OVERHEAD_CHAT_COLORS[PlayerAppearance.overheadChatColor[i]];
2655-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.FLASH1.getNetworkCode())
2653+
if(Actor.overheadChatColor[i] < 6)
2654+
textColor = OVERHEAD_CHAT_COLORS[Actor.overheadChatColor[i]];
2655+
if(Actor.overheadChatColor[i] == ChatColorEffect.FLASH1.getNetworkCode())
26562656
textColor = anInt2628 % 20 >= 10 ? OVERHEAD_CHAT_COLORS[0] : OVERHEAD_CHAT_COLORS[1];
2657-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.FLASH2.getNetworkCode())
2657+
if(Actor.overheadChatColor[i] == ChatColorEffect.FLASH2.getNetworkCode())
26582658
textColor = anInt2628 % 20 < 10 ? 255 : OVERHEAD_CHAT_COLORS[3];
2659-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.FLASH3.getNetworkCode())
2659+
if(Actor.overheadChatColor[i] == ChatColorEffect.FLASH3.getNetworkCode())
26602660
textColor = anInt2628 % 20 >= 10 ? 8454016 : 45056;
2661-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.GLOW1.getNetworkCode()) {
2662-
int i_9_ = 150 - PlayerAppearance.anIntArray684[i];
2661+
if(Actor.overheadChatColor[i] == ChatColorEffect.GLOW1.getNetworkCode()) {
2662+
int i_9_ = 150 - Actor.overheadChatTimer[i];
26632663
if(i_9_ >= 50) {
26642664
if(i_9_ < 100)
26652665
textColor = -((-50 + i_9_) * 327680) + OVERHEAD_CHAT_COLORS[0];
@@ -2668,8 +2668,8 @@ else if(i_9_ < 150)
26682668
} else
26692669
textColor = OVERHEAD_CHAT_COLORS[1] + 1280 * i_9_;
26702670
}
2671-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.GLOW2.getNetworkCode()) {
2672-
int i_10_ = 150 + -PlayerAppearance.anIntArray684[i];
2671+
if(Actor.overheadChatColor[i] == ChatColorEffect.GLOW2.getNetworkCode()) {
2672+
int i_10_ = 150 + -Actor.overheadChatTimer[i];
26732673
if(i_10_ >= 50) {
26742674
if(i_10_ >= 100) {
26752675
if(i_10_ < 150)
@@ -2679,8 +2679,8 @@ else if(i_9_ < 150)
26792679
} else
26802680
textColor = 5 * i_10_ + OVERHEAD_CHAT_COLORS[1];
26812681
}
2682-
if(PlayerAppearance.overheadChatColor[i] == ChatColorEffect.GLOW3.getNetworkCode()) {
2683-
int i_11_ = -PlayerAppearance.anIntArray684[i] + 150;
2682+
if(Actor.overheadChatColor[i] == ChatColorEffect.GLOW3.getNetworkCode()) {
2683+
int i_11_ = -Actor.overheadChatTimer[i] + 150;
26842684
if(i_11_ >= 50) {
26852685
if(i_11_ < 100)
26862686
textColor = 327685 * (i_11_ - 50) + OVERHEAD_CHAT_COLORS[2];
@@ -2689,33 +2689,33 @@ else if(i_11_ < 150)
26892689
} else
26902690
textColor = -(327685 * i_11_) + OVERHEAD_CHAT_COLORS[5];
26912691
}
2692-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.NONE.getNetworkCode()) {
2692+
if(Actor.overheadChatShape[i] == ChatShapeEffect.NONE.getNetworkCode()) {
26932693
TypeFace.fontBold.drawStringLeft(message, screenPos.x, screenPos.y + 1, 0);
26942694
TypeFace.fontBold.drawStringLeft(message, screenPos.x, screenPos.y, textColor);
26952695
}
2696-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.WAVE.getNetworkCode()) {
2696+
if(Actor.overheadChatShape[i] == ChatShapeEffect.WAVE.getNetworkCode()) {
26972697
TypeFace.fontBold.drawCenteredStringWaveY(message, screenPos.x, screenPos.y + 1, anInt2628, 0);
26982698
TypeFace.fontBold.drawCenteredStringWaveY(message, screenPos.x, screenPos.y, anInt2628, textColor);
26992699
}
2700-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.WAVE2.getNetworkCode()) {
2700+
if(Actor.overheadChatShape[i] == ChatShapeEffect.WAVE2.getNetworkCode()) {
27012701
TypeFace.fontBold.drawCenteredStringWaveXY(message, screenPos.x, 1 + screenPos.y, anInt2628, 0);
27022702
TypeFace.fontBold.drawCenteredStringWaveXY(message, screenPos.x, screenPos.y, anInt2628, textColor);
27032703
}
2704-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.SHAKE.getNetworkCode()) {
2705-
TypeFace.fontBold.drawCenteredStringWaveXYMove(message, screenPos.x, screenPos.y + 1, anInt2628, -PlayerAppearance.anIntArray684[i] + 150, 0);
2706-
TypeFace.fontBold.drawCenteredStringWaveXYMove(message, screenPos.x, screenPos.y, anInt2628, -PlayerAppearance.anIntArray684[i] + 150, textColor);
2704+
if(Actor.overheadChatShape[i] == ChatShapeEffect.SHAKE.getNetworkCode()) {
2705+
TypeFace.fontBold.drawCenteredStringWaveXYMove(message, screenPos.x, screenPos.y + 1, anInt2628, -Actor.overheadChatTimer[i] + 150, 0);
2706+
TypeFace.fontBold.drawCenteredStringWaveXYMove(message, screenPos.x, screenPos.y, anInt2628, -Actor.overheadChatTimer[i] + 150, textColor);
27072707
}
2708-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.SCROLL.getNetworkCode()) {
2708+
if(Actor.overheadChatShape[i] == ChatShapeEffect.SCROLL.getNetworkCode()) {
27092709
int i_12_ = TypeFace.fontBold.getStringWidth(message);
2710-
int i_13_ = (i_12_ + 100) * (150 + -PlayerAppearance.anIntArray684[i]) / 150;
2710+
int i_13_ = (i_12_ + 100) * (150 + -Actor.overheadChatTimer[i]) / 150;
27112711
Rasterizer.setBounds(screenPos.x + -50, 0, 50 + screenPos.x, 334);
27122712
TypeFace.fontBold.drawString(message, -i_13_ + screenPos.x + 50, screenPos.y + 1, 0);
27132713
TypeFace.fontBold.drawString(message, 50 + screenPos.x + -i_13_, screenPos.y, textColor);
27142714
Rasterizer.resetBounds();
27152715
}
2716-
if(PlayerAppearance.overheadChatShape[i] == ChatShapeEffect.SLIDE.getNetworkCode()) {
2716+
if(Actor.overheadChatShape[i] == ChatShapeEffect.SLIDE.getNetworkCode()) {
27172717
int i_14_ = 0;
2718-
int i_15_ = 150 + -PlayerAppearance.anIntArray684[i];
2718+
int i_15_ = 150 + -Actor.overheadChatTimer[i];
27192719
Rasterizer.setBounds(0, -1 + -TypeFace.fontBold.characterDefaultHeight + screenPos.y, 512, 5 + screenPos.y);
27202720
if(i_15_ >= 25) {
27212721
if(i_15_ > 125)

src/main/java/org/runejs/client/media/renderable/actor/Actor.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
public abstract class Actor extends Renderable {
88
public static int actorUpdatingIndex = 0;
9+
public static int[] overheadChatHalfWidth = new int[50];
10+
public static int[] overheadChatTimer = new int[50];
11+
public static int[] overheadChatY = new int[50];
12+
public static int[] overheadChatLetterHeight = new int[50];
13+
public static int[] overheadChatShape = new int[50];
14+
public static String[] overheadChatMessage = new String[50];
15+
public static int[] overheadChatColor = new int[50];
16+
public static int[] overheadChatX = new int[50];
917

1018
public boolean[] aBooleanArray3072;
1119
public int forceMoveFaceDirection;

src/main/java/org/runejs/client/media/renderable/actor/PlayerAppearance.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
import org.runejs.client.node.NodeCache;
1010

1111
public class PlayerAppearance {
12-
13-
public static int[] anIntArray680 = new int[50];
14-
public static int[] anIntArray684 = new int[50];
15-
public static int[] anIntArray685 = new int[50];
16-
public static int[] anIntArray688 = new int[50];
17-
public static int[] overheadChatShape = new int[50];
18-
public static String[] overheadChatMessage = new String[50];
19-
public static int[] overheadChatColor = new int[50];
20-
public static int[] anIntArray715 = new int[50];
21-
2212
public static int[][] playerColours = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}};
2313
public static int[] playerSkinColors = new int[]{9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
2414

0 commit comments

Comments
 (0)