Skip to content

Commit 54c5c42

Browse files
committed
refactor: remove statics from Renderable
1 parent aad46bf commit 54c5c42

File tree

4 files changed

+76
-78
lines changed

4 files changed

+76
-78
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.runejs.client.media.Rasterizer3D;
1616
import org.runejs.client.media.VertexNormal;
1717
import org.runejs.client.media.renderable.Model;
18-
import org.runejs.client.media.renderable.Renderable;
1918
import org.runejs.client.media.renderable.actor.*;
2019
import org.runejs.client.message.handler.MessageHandlerRegistry;
2120
import org.runejs.client.message.handler.rs435.RS435HandlerRegistry;
@@ -265,7 +264,7 @@ public static boolean drawInterface(int areaId, int minX, int minY, int maxX, in
265264
else {
266265
if (GameInterface.activeInterfaceType != 0 && GameInterface.selectedInventorySlot == i_7_ && gameInterface.id == GameInterface.modifiedWidgetId) {
267266
i_14_ = MouseHandler.mouseY + -MovedStatics.anInt2798;
268-
i_12_ = MouseHandler.mouseX + -Renderable.anInt2869;
267+
i_12_ = MouseHandler.mouseX + -MovedStatics.anInt2869;
269268
if (i_12_ < 5 && i_12_ > -5)
270269
i_12_ = 0;
271270
if (i_14_ < 5 && i_14_ > -5)
@@ -868,7 +867,7 @@ public static void drawGameScreen() {
868867
GameInterface.redrawTabArea = true;
869868
}
870869
if(GameInterface.tabAreaInterfaceId != -1) {
871-
boolean bool = Renderable.handleSequences(GameInterface.tabAreaInterfaceId);
870+
boolean bool = GameInterface.handleSequences(GameInterface.tabAreaInterfaceId);
872871
if(bool) {
873872
GameInterface.redrawTabArea = true;
874873
}
@@ -884,13 +883,13 @@ public static void drawGameScreen() {
884883
MovedStatics.drawTabArea();
885884

886885
if(GameInterface.chatboxInterfaceId != -1) {
887-
boolean bool = Renderable.handleSequences(GameInterface.chatboxInterfaceId);
886+
boolean bool = GameInterface.handleSequences(GameInterface.chatboxInterfaceId);
888887
if(bool) {
889888
ChatBox.redrawChatbox = true;
890889
}
891890
}
892891
if(ChatBox.dialogueId != -1) {
893-
boolean bool = Renderable.handleSequences(ChatBox.dialogueId);
892+
boolean bool = GameInterface.handleSequences(ChatBox.dialogueId);
894893
if(bool) {
895894
ChatBox.redrawChatbox = true;
896895
}
@@ -941,15 +940,15 @@ public static void drawGameScreen() {
941940

942941

943942
if(GameInterface.tabAreaInterfaceId != -1) {
944-
Renderable.handleSequences(GameInterface.tabAreaInterfaceId);
943+
GameInterface.handleSequences(GameInterface.tabAreaInterfaceId);
945944
}
946945

947946
if(GameInterface.chatboxInterfaceId != -1) {
948-
Renderable.handleSequences(GameInterface.chatboxInterfaceId);
947+
GameInterface.handleSequences(GameInterface.chatboxInterfaceId);
949948
}
950949

951950
if(ChatBox.dialogueId != -1) {
952-
Renderable.handleSequences(ChatBox.dialogueId);
951+
GameInterface.handleSequences(ChatBox.dialogueId);
953952
}
954953
method353();
955954
ChatBox.renderChatbox();
@@ -1041,9 +1040,9 @@ public static void displayMessageForResponseCode(int responseCode) {
10411040
}
10421041

10431042
public static void method164() {
1044-
Renderable.handleSequences(GameInterface.fullscreenInterfaceId);
1043+
GameInterface.handleSequences(GameInterface.fullscreenInterfaceId);
10451044
if(GameInterface.fullscreenSiblingInterfaceId != -1)
1046-
Renderable.handleSequences(GameInterface.fullscreenSiblingInterfaceId);
1045+
GameInterface.handleSequences(GameInterface.fullscreenSiblingInterfaceId);
10471046
MovedStatics.anInt199 = 0;
10481047
MovedStatics.aProducingGraphicsBuffer_2213.prepareRasterizer();
10491048
Player.viewportOffsets = Rasterizer3D.setLineOffsets(Player.viewportOffsets);
@@ -1330,7 +1329,7 @@ else if(x > 764)
13301329
MovedStatics.anInt199++;
13311330
if(GameInterface.activeInterfaceType != 0) {
13321331
GameInterface.lastItemDragTime++;
1333-
if(MouseHandler.mouseX > Renderable.anInt2869 + 5 || Renderable.anInt2869 + -5 > MouseHandler.mouseX || MovedStatics.anInt2798 + 5 < MouseHandler.mouseY || MovedStatics.anInt2798 - 5 > MouseHandler.mouseY)
1332+
if(MouseHandler.mouseX > MovedStatics.anInt2869 + 5 || MovedStatics.anInt2869 + -5 > MouseHandler.mouseX || MovedStatics.anInt2798 + 5 < MouseHandler.mouseY || MovedStatics.anInt2798 - 5 > MouseHandler.mouseY)
13341333
MovedStatics.lastItemDragged = true;
13351334
if(MouseHandler.currentMouseButtonPressed == 0) {
13361335
if(GameInterface.activeInterfaceType == 3)
@@ -1563,16 +1562,16 @@ public static void handleLoginScreenActions() {
15631562
}
15641563
if (IncomingPackets.incomingPacketBuffer.currentPosition == 8) {
15651564
IncomingPackets.incomingPacketBuffer.currentPosition = 0;
1566-
Renderable.aLong2858 = IncomingPackets.incomingPacketBuffer.getLongBE();
1565+
MovedStatics.aLong2858 = IncomingPackets.incomingPacketBuffer.getLongBE();
15671566
loginStatus = 5;
15681567
}
15691568
}
15701569
if (loginStatus == 5) {
15711570
int[] seeds = new int[4];
15721571
seeds[0] = (int) (Math.random() * 9.9999999E7);
15731572
seeds[1] = (int) (Math.random() * 9.9999999E7);
1574-
seeds[2] = (int) (Renderable.aLong2858 >> 32);
1575-
seeds[3] = (int) Renderable.aLong2858;
1573+
seeds[2] = (int) (MovedStatics.aLong2858 >> 32);
1574+
seeds[3] = (int) MovedStatics.aLong2858;
15761575
OutgoingPackets.buffer.currentPosition = 0;
15771576
OutgoingPackets.buffer.putByte(10);
15781577
OutgoingPackets.buffer.putIntBE(seeds[0]);

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.runejs.client.language.Native;
3030
import org.runejs.client.media.Rasterizer3D;
3131
import org.runejs.client.media.VertexNormal;
32-
import org.runejs.client.media.renderable.Renderable;
3332
import org.runejs.client.scene.*;
3433
import org.runejs.client.scene.camera.CameraRotation;
3534
import org.runejs.client.scene.util.CollisionMap;
@@ -351,6 +350,19 @@ public class MovedStatics {
351350
* Some kind of mouse information
352351
*/
353352
public static int anInt3294 = 0;
353+
/**
354+
* ISAAC key?
355+
*/
356+
public static long aLong2858 = 0L;
357+
/**
358+
* The image used for the highlighted (selected) tab button,
359+
* for the furthest-left tab on the bottom.
360+
*/
361+
public static IndexedImage tabHighlightImageBottomLeftEdge;
362+
/**
363+
* Something to do with item drag tracking
364+
*/
365+
public static int anInt2869 = 0;
354366

355367
public static void method440() {
356368
if (aBoolean512) {
@@ -642,7 +654,7 @@ public static void method527(int currentTabId, int[] tabWidgetIds, boolean arg3,
642654
if (arg3) {
643655
if (tabWidgetIds[currentTabId] != -1) {
644656
if (currentTabId == 7)
645-
Renderable.tabHighlightImageBottomLeftEdge.drawImage(42, 0);
657+
tabHighlightImageBottomLeftEdge.drawImage(42, 0);
646658
if (currentTabId == 8)
647659
tabHighlightImageBottomLeft.drawImage(74, 0);
648660
if (currentTabId == 9)
@@ -1448,7 +1460,7 @@ private static void method344(int arg0) {
14481460
tabPieceUpperRight = null;
14491461
tabHighlightImageTopMiddle = null;
14501462
tabHighlightImageBottomLeft = null;
1451-
Renderable.tabHighlightImageBottomLeftEdge = null;
1463+
tabHighlightImageBottomLeftEdge = null;
14521464
fullScreenTextureArray = null;
14531465
tabPieveLowerRight = null;
14541466
framePieceTop = null;
@@ -1582,7 +1594,7 @@ public static void draw3dScreen() {
15821594
if (GameInterface.gameScreenInterfaceId != -1 || GameInterface.walkableWidgetId != -1) {
15831595
int areaId = GameInterface.gameScreenInterfaceId != -1 ? 0 : 4;
15841596
int id = GameInterface.gameScreenInterfaceId != -1 ? GameInterface.gameScreenInterfaceId : GameInterface.walkableWidgetId;
1585-
Renderable.handleSequences(id);
1597+
GameInterface.handleSequences(id);
15861598
int yOffset = (ScreenController.drawHeight /2) - (334/2) - (184/2);
15871599
int xOffset = (ScreenController.drawWidth /2) - (512/2) - (234/3);
15881600
if(ScreenController.frameMode == ScreenMode.FIXED) {
@@ -1974,8 +1986,8 @@ public static void method763(Component arg0, CacheArchive arg2) {
19741986
tabHighlightImageTopRightEdge.flipHorizontal();
19751987
tabHighlightImageTopRight = GameInterface.tabHighlightImageTopLeft.cloneImage();
19761988
tabHighlightImageTopRight.flipHorizontal();
1977-
Renderable.tabHighlightImageBottomLeftEdge = tabHighlightImageTopLeftEdge.cloneImage();
1978-
Renderable.tabHighlightImageBottomLeftEdge.flipVertical();
1989+
tabHighlightImageBottomLeftEdge = tabHighlightImageTopLeftEdge.cloneImage();
1990+
tabHighlightImageBottomLeftEdge.flipVertical();
19791991
tabHighlightImageBottomLeft = GameInterface.tabHighlightImageTopLeft.cloneImage();
19801992
tabHighlightImageBottomLeft.flipVertical();
19811993
tabHighlightImageBottomMiddle = tabHighlightImageTopMiddle.cloneImage();
@@ -3272,7 +3284,7 @@ public static void processMenuClick() {
32723284
int id = secondMenuOperand[-1 + menuActionRow];
32733285
GameInterface gameInterface = GameInterface.getInterface(id);
32743286
if(gameInterface.itemSwapable || gameInterface.itemDeletesDraged) {
3275-
Renderable.anInt2869 = MouseHandler.clickX;
3287+
anInt2869 = MouseHandler.clickX;
32763288
lastItemDragged = false;
32773289
GameInterface.activeInterfaceType = 2;
32783290
GameInterface.modifiedWidgetId = id;

src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,50 @@ public static void clearInterfaceCaches() {
22932293
interfaceTypefaceCache.clear();
22942294
}
22952295

2296+
public static boolean handleSequences(int arg1) {
2297+
if(!decodeGameInterface(arg1))
2298+
return false;
2299+
GameInterface[] gameInterfaces = cachedInterfaces[arg1];
2300+
boolean bool = false;
2301+
for(int i = 0; gameInterfaces.length > i; i++) {
2302+
GameInterface gameInterface = gameInterfaces[i];
2303+
if(gameInterface != null && gameInterface.type == GameInterfaceType.MODEL) {
2304+
if(gameInterface.animation != -1 || gameInterface.alternateAnimation != -1) {
2305+
boolean bool_0_ = checkForAlternateAction(gameInterface);
2306+
int i_1_;
2307+
if(bool_0_)
2308+
i_1_ = gameInterface.alternateAnimation;
2309+
else
2310+
i_1_ = gameInterface.animation;
2311+
if(i_1_ != -1) {
2312+
AnimationSequence animationSequence = AnimationSequence.getAnimationSequence(i_1_);
2313+
gameInterface.remainingAnimationTime += MovedStatics.anInt199;
2314+
while(animationSequence.frameLengths[gameInterface.animationFrame] < gameInterface.remainingAnimationTime) {
2315+
bool = true;
2316+
gameInterface.remainingAnimationTime -= animationSequence.frameLengths[gameInterface.animationFrame];
2317+
gameInterface.animationFrame++;
2318+
if(gameInterface.animationFrame >= animationSequence.frameIds.length) {
2319+
gameInterface.animationFrame -= animationSequence.frameStep;
2320+
if(gameInterface.animationFrame < 0 || animationSequence.frameIds.length <= gameInterface.animationFrame)
2321+
gameInterface.animationFrame = 0;
2322+
}
2323+
}
2324+
}
2325+
}
2326+
if(gameInterface.rotationSpeed != 0) {
2327+
bool = true;
2328+
int i_2_ = gameInterface.rotationSpeed >> 16;
2329+
int i_3_ = gameInterface.rotationSpeed << 16 >> 16;
2330+
i_2_ *= MovedStatics.anInt199;
2331+
gameInterface.rotationX = 0x7ff & i_2_ + gameInterface.rotationX;
2332+
i_3_ *= MovedStatics.anInt199;
2333+
gameInterface.rotationZ = 0x7ff & gameInterface.rotationZ + i_3_;
2334+
}
2335+
}
2336+
}
2337+
return bool;
2338+
}
2339+
22962340
public void swapItems(int arg0, boolean arg1, int arg2) {
22972341
int i = items[arg2];
22982342
items[arg2] = items[arg0];

src/main/java/org/runejs/client/media/renderable/Renderable.java

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,10 @@
11
package org.runejs.client.media.renderable;
22

3-
import org.runejs.client.MovedStatics;
4-
import org.runejs.client.cache.media.AnimationSequence;
5-
import org.runejs.client.cache.media.IndexedImage;
6-
import org.runejs.client.cache.media.gameInterface.GameInterface;
7-
import org.runejs.client.cache.media.gameInterface.GameInterfaceType;
83
import org.runejs.client.node.CachedNode;
94

105
public abstract class Renderable extends CachedNode {
11-
public static long aLong2858 = 0L;
12-
/**
13-
* The image used for the highlighted (selected) tab button,
14-
* for the furthest-left tab on the bottom.
15-
*/
16-
public static IndexedImage tabHighlightImageBottomLeftEdge;
17-
public static int anInt2869 = 0;
18-
196
public int modelHeight = 1000;
207

21-
public static boolean handleSequences(int arg1) {
22-
if(!GameInterface.decodeGameInterface(arg1))
23-
return false;
24-
GameInterface[] gameInterfaces = GameInterface.cachedInterfaces[arg1];
25-
boolean bool = false;
26-
for(int i = 0; gameInterfaces.length > i; i++) {
27-
GameInterface gameInterface = gameInterfaces[i];
28-
if(gameInterface != null && gameInterface.type == GameInterfaceType.MODEL) {
29-
if(gameInterface.animation != -1 || gameInterface.alternateAnimation != -1) {
30-
boolean bool_0_ = GameInterface.checkForAlternateAction(gameInterface);
31-
int i_1_;
32-
if(bool_0_)
33-
i_1_ = gameInterface.alternateAnimation;
34-
else
35-
i_1_ = gameInterface.animation;
36-
if(i_1_ != -1) {
37-
AnimationSequence animationSequence = AnimationSequence.getAnimationSequence(i_1_);
38-
gameInterface.remainingAnimationTime += MovedStatics.anInt199;
39-
while(animationSequence.frameLengths[gameInterface.animationFrame] < gameInterface.remainingAnimationTime) {
40-
bool = true;
41-
gameInterface.remainingAnimationTime -= animationSequence.frameLengths[gameInterface.animationFrame];
42-
gameInterface.animationFrame++;
43-
if(gameInterface.animationFrame >= animationSequence.frameIds.length) {
44-
gameInterface.animationFrame -= animationSequence.frameStep;
45-
if(gameInterface.animationFrame < 0 || animationSequence.frameIds.length <= gameInterface.animationFrame)
46-
gameInterface.animationFrame = 0;
47-
}
48-
}
49-
}
50-
}
51-
if(gameInterface.rotationSpeed != 0) {
52-
bool = true;
53-
int i_2_ = gameInterface.rotationSpeed >> 16;
54-
int i_3_ = gameInterface.rotationSpeed << 16 >> 16;
55-
i_2_ *= MovedStatics.anInt199;
56-
gameInterface.rotationX = 0x7ff & i_2_ + gameInterface.rotationX;
57-
i_3_ *= MovedStatics.anInt199;
58-
gameInterface.rotationZ = 0x7ff & gameInterface.rotationZ + i_3_;
59-
}
60-
}
61-
}
62-
return bool;
63-
}
64-
658
public void renderAtPoint(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) {
669
Model class40_sub5_sub17_sub5 = getRotatedModel();
6710
if(class40_sub5_sub17_sub5 != null) {

0 commit comments

Comments
 (0)