Skip to content

Commit a81e995

Browse files
committed
refactor: rename static type arrays
ty @thedaneeffect for these
1 parent eba13bb commit a81e995

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.runejs.client.net.OutgoingPackets;
1919
import org.runejs.client.scene.InteractiveObjectTemporary;
2020
import org.runejs.client.scene.Scene;
21-
import org.runejs.client.scene.SceneCluster;
2221
import org.runejs.client.scene.util.CollisionMap;
2322
import org.runejs.client.sound.SoundSystem;
2423
import org.runejs.client.util.BitUtils;
@@ -1057,7 +1056,7 @@ public static void addObject(int objectId, int localX, int localY, int plane, in
10571056
renderable = gameObjectDefinition.createTerrainObjectModel(vertexHeightTopRight, vertexHeightTop, face, vertexHeight, 0, vertexHeightRight);
10581057
else
10591058
renderable = new GameObject(objectId, 0, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
1060-
scene.addWall(localX, localY, plane, vertexMix, SceneCluster.anIntArray761[face], 0, hash, renderable, null, objectConfig);
1059+
scene.addWall(localX, localY, plane, vertexMix, Scene.ROTATION_WALL_TYPE[face], 0, hash, renderable, null, objectConfig);
10611060
if(face == 0) {
10621061
if(gameObjectDefinition.castsShadow) {
10631062
tileShadowIntensity[plane][localX][localY] = (byte) 50;
@@ -1097,7 +1096,7 @@ public static void addObject(int objectId, int localX, int localY, int plane, in
10971096
renderable = gameObjectDefinition.createTerrainObjectModel(vertexHeightTopRight, vertexHeightTop, face, vertexHeight, 1, vertexHeightRight);
10981097
else
10991098
renderable = new GameObject(objectId, 1, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
1100-
scene.addWall(localX, localY, plane, vertexMix, MovedStatics.anIntArray2788[face], 0, hash, renderable, null, objectConfig);
1099+
scene.addWall(localX, localY, plane, vertexMix, Scene.ROTATION_WALL_CORNER_TYPE[face], 0, hash, renderable, null, objectConfig);
11011100
if(gameObjectDefinition.castsShadow) {
11021101
if(face == 0)
11031102
tileShadowIntensity[plane][localX][localY + 1] = (byte) 50;
@@ -1121,7 +1120,7 @@ else if(face == 3)
11211120
renderable = new GameObject(objectId, 2, 4 + face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
11221121
renderable_47_ = new GameObject(objectId, 2, i_46_, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
11231122
}
1124-
scene.addWall(localX, localY, plane, vertexMix, SceneCluster.anIntArray761[face], SceneCluster.anIntArray761[i_46_], hash, renderable, renderable_47_, objectConfig);
1123+
scene.addWall(localX, localY, plane, vertexMix, Scene.ROTATION_WALL_TYPE[face], Scene.ROTATION_WALL_TYPE[i_46_], hash, renderable, renderable_47_, objectConfig);
11251124
if(gameObjectDefinition.wall) {
11261125
if(face == 0) {
11271126
tileCullingBitsets[plane][localX][localY] = BitUtils.bitWiseOR(tileCullingBitsets[plane][localX][localY], 585);
@@ -1147,7 +1146,7 @@ else if(face == 3)
11471146
renderable = new GameObject(objectId, 3, face, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
11481147
else
11491148
renderable = gameObjectDefinition.createTerrainObjectModel(vertexHeightTopRight, vertexHeightTop, face, vertexHeight, 3, vertexHeightRight);
1150-
scene.addWall(localX, localY, plane, vertexMix, MovedStatics.anIntArray2788[face], 0, hash, renderable, null, objectConfig);
1149+
scene.addWall(localX, localY, plane, vertexMix, Scene.ROTATION_WALL_CORNER_TYPE[face], 0, hash, renderable, null, objectConfig);
11511150
if(gameObjectDefinition.castsShadow) {
11521151
if(face != 0) {
11531152
if(face == 1)
@@ -1199,7 +1198,7 @@ else if(face == 3)
11991198
renderable = gameObjectDefinition.createTerrainObjectModel(vertexHeightTopRight, vertexHeightTop, 0, vertexHeight, 4, vertexHeightRight);
12001199
else
12011200
renderable = new GameObject(objectId, 4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
1202-
scene.addWallDecoration(localX, localY, plane, vertexMix, 0, 0, 512 * face, hash, renderable, objectConfig, SceneCluster.anIntArray761[face]);
1201+
scene.addWallDecoration(localX, localY, plane, vertexMix, 0, 0, 512 * face, hash, renderable, objectConfig, Scene.ROTATION_WALL_TYPE[face]);
12031202
} else if(type == 5) {
12041203
int i_51_ = scene.getWallHash(plane, localX, localY);
12051204
int i_52_ = 16;
@@ -1210,7 +1209,7 @@ else if(face == 3)
12101209
renderable = gameObjectDefinition.createTerrainObjectModel(vertexHeightTopRight, vertexHeightTop, 0, vertexHeight, 4, vertexHeightRight);
12111210
else
12121211
renderable = new GameObject(objectId, 4, 0, vertexHeight, vertexHeightRight, vertexHeightTopRight, vertexHeightTop, gameObjectDefinition.animationId, true);
1213-
scene.addWallDecoration(localX, localY, plane, vertexMix, i_52_ * MovedStatics.anIntArray666[face], MovedStatics.anIntArray2207[face] * i_52_, face * 512, hash, renderable, objectConfig, SceneCluster.anIntArray761[face]);
1212+
scene.addWallDecoration(localX, localY, plane, vertexMix, i_52_ * MovedStatics.anIntArray666[face], MovedStatics.anIntArray2207[face] * i_52_, face * 512, hash, renderable, objectConfig, Scene.ROTATION_WALL_TYPE[face]);
12141213
} else if(type == 6) {
12151214
Renderable renderable;
12161215
if(gameObjectDefinition.animationId == -1 && gameObjectDefinition.childIds == null)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public class MovedStatics {
260260
public static boolean showIconsRedrawnText = false;
261261
public static IndexedImage[] tabIcons;
262262
public static boolean lastItemDragged = false;
263-
public static int[] anIntArray2788 = new int[]{16, 32, 64, 128};
264263
public static int randomiserHue = -8 + (int) (17.0 * Math.random());
265264
public static ProducingGraphicsBuffer mapBackRight;
266265
public static IndexedImage chatboxBackgroundImage;

src/main/java/org/runejs/client/scene/Scene.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ public class Scene {
4949
public static int[] faceOffsetY2 = new int[]{-53, -53, 53, 53};
5050
public static SceneCluster[][] cullingClusters = new SceneCluster[anInt90][500];
5151
public static boolean clicked = false;
52-
public static int[] anIntArray117 = new int[]{160, 192, 80, 96, 0, 144, 80, 48, 160};
53-
public static int[] anIntArray119 = new int[]{0, 0, 2, 0, 0, 2, 1, 1, 0};
54-
public static int[] anIntArray120 = new int[]{19, 55, 38, 155, 255, 110, 137, 205, 76};
52+
public static int[] DIRECTION_ALLOW_WALL_CORNER_TYPE = new int[]{160, 192, 80, 96, 0, 144, 80, 48, 160};
53+
public static int[] WALL_CORNER_TYPE_16_BLOCK_OBJ_SPANS = new int[]{0, 0, 2, 0, 0, 2, 1, 1, 0};
54+
public static int[] FRONT_WALL_TYPES = new int[]{19, 55, 38, 155, 255, 110, 137, 205, 76};
5555
public static int drawWidthMidpoint;
56-
public static int[] anIntArray125 = new int[]{2, 0, 0, 2, 0, 0, 0, 4, 4};
56+
public static int[] WALL_CORNER_TYPE_32_BLOCK_OBJ_SPANS = new int[]{2, 0, 0, 2, 0, 0, 0, 4, 4};
5757
public static int drawHeight;
58-
public static int[] anIntArray130 = new int[]{76, 8, 137, 4, 0, 1, 38, 2, 19};
59-
public static int[] anIntArray131 = new int[]{1, 1, 0, 0, 0, 8, 0, 0, 8};
60-
public static int[] anIntArray132 = new int[]{0, 4, 4, 8, 0, 0, 8, 0, 0};
58+
public static int[] BACK_WALL_TYPES = new int[]{76, 8, 137, 4, 0, 1, 38, 2, 19};
59+
public static int[] WALL_CORNER_TYPE_128_BLOCK_OBJ_SPANS = new int[]{1, 1, 0, 0, 0, 8, 0, 0, 8};
60+
public static int[] WALL_CORNER_TYPE_64_BLOCK_OBJ_SPANS = new int[]{0, 4, 4, 8, 0, 0, 8, 0, 0};
6161
private static final int TILE_DRAW_DISTANCE = 75;
6262
public static boolean[][] TILE_VISIBILITY_MAP;
6363
public static boolean[][][][] TILE_VISIBILITY_MAPS = new boolean[8][32][(TILE_DRAW_DISTANCE * 2) + 1][(TILE_DRAW_DISTANCE * 2) + 1];
@@ -68,6 +68,8 @@ public class Scene {
6868
public static int[] screenX = new int[6];
6969
public static int[] viewspaceX = new int[6];
7070
public static int[] viewspaceY = new int[6];
71+
public static int[] ROTATION_WALL_CORNER_TYPE = new int[]{16, 32, 64, 128};
72+
public static int[] ROTATION_WALL_TYPE = {1, 2, 4, 8};
7173

7274
public SceneTile[][][] tileArray;
7375
public int[][][] anIntArrayArrayArray83;
@@ -942,26 +944,26 @@ public void renderTile(SceneTile _tile, boolean arg1) {
942944
} else if (cameraPositionTileY > y) {
943945
i_86_ += 6;
944946
}
945-
i_87_ = anIntArray120[i_86_];
946-
groundTile.anInt2064 = anIntArray130[i_86_];
947+
i_87_ = FRONT_WALL_TYPES[i_86_];
948+
groundTile.anInt2064 = BACK_WALL_TYPES[i_86_];
947949
}
948950
if (wall != null) {
949-
if ((wall.orientationA & anIntArray117[i_86_]) != 0) {
951+
if ((wall.orientationA & DIRECTION_ALLOW_WALL_CORNER_TYPE[i_86_]) != 0) {
950952
if (wall.orientationA == 16) {
951953
groundTile.wallCullDirection = 3;
952-
groundTile.wallUncullDirection = anIntArray119[i_86_];
954+
groundTile.wallUncullDirection = WALL_CORNER_TYPE_16_BLOCK_OBJ_SPANS[i_86_];
953955
groundTile.wallCullOppositeDirection = 3 - groundTile.wallUncullDirection;
954956
} else if (wall.orientationA == 32) {
955957
groundTile.wallCullDirection = 6;
956-
groundTile.wallUncullDirection = anIntArray125[i_86_];
958+
groundTile.wallUncullDirection = WALL_CORNER_TYPE_32_BLOCK_OBJ_SPANS[i_86_];
957959
groundTile.wallCullOppositeDirection = 6 - groundTile.wallUncullDirection;
958960
} else if (wall.orientationA == 64) {
959961
groundTile.wallCullDirection = 12;
960-
groundTile.wallUncullDirection = anIntArray132[i_86_];
962+
groundTile.wallUncullDirection = WALL_CORNER_TYPE_64_BLOCK_OBJ_SPANS[i_86_];
961963
groundTile.wallCullOppositeDirection = 12 - groundTile.wallUncullDirection;
962964
} else {
963965
groundTile.wallCullDirection = 9;
964-
groundTile.wallUncullDirection = anIntArray131[i_86_];
966+
groundTile.wallUncullDirection = WALL_CORNER_TYPE_128_BLOCK_OBJ_SPANS[i_86_];
965967
groundTile.wallCullOppositeDirection = 9 - groundTile.wallUncullDirection;
966968
}
967969
} else {

src/main/java/org/runejs/client/scene/SceneCluster.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.runejs.client.util.Timer;
44

55
public class SceneCluster {
6-
public static int[] anIntArray761 = {1, 2, 4, 8};
76
public static Timer gameTimer;
87
public static int anInt770 = 0;
98
public static int idleLogout = 0;

src/main/java/org/runejs/client/scene/util/CollisionMap.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.runejs.client.media.renderable.GameObject;
66
import org.runejs.client.media.renderable.Renderable;
77
import org.runejs.client.scene.Scene;
8-
import org.runejs.client.scene.SceneCluster;
98
import org.runejs.client.util.BitUtils;
109

1110
public class CollisionMap {
@@ -101,7 +100,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
101100
renderable = new GameObject(arg1, 0, arg7, i, i_0_, i_2_, i_1_, gameObjectDefinition.animationId, true);
102101
else
103102
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, arg7, i, 0, i_0_);
104-
arg5.addWall(arg9, arg8, arg3, i_3_, SceneCluster.anIntArray761[arg7], 0, i_5_, renderable, null, i_4_);
103+
arg5.addWall(arg9, arg8, arg3, i_3_, Scene.ROTATION_WALL_TYPE[arg7], 0, i_5_, renderable, null, i_4_);
105104
if (gameObjectDefinition.solid)
106105
arg0.unmarkWall(arg9, arg8, arg4, arg7, gameObjectDefinition.walkable);
107106
} else if (arg4 == 1) {
@@ -110,7 +109,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
110109
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, arg7, i, 1, i_0_);
111110
else
112111
renderable = new GameObject(arg1, 1, arg7, i, i_0_, i_2_, i_1_, gameObjectDefinition.animationId, true);
113-
arg5.addWall(arg9, arg8, arg3, i_3_, MovedStatics.anIntArray2788[arg7], 0, i_5_, renderable, null, i_4_);
112+
arg5.addWall(arg9, arg8, arg3, i_3_, Scene.ROTATION_WALL_CORNER_TYPE[arg7], 0, i_5_, renderable, null, i_4_);
114113
if (gameObjectDefinition.solid)
115114
arg0.unmarkWall(arg9, arg8, arg4, arg7, gameObjectDefinition.walkable);
116115
} else if (arg4 == 2) {
@@ -124,7 +123,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
124123
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, arg7 + 4, i, 2, i_0_);
125124
renderable_10_ = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, i_9_, i, 2, i_0_);
126125
}
127-
arg5.addWall(arg9, arg8, arg3, i_3_, SceneCluster.anIntArray761[arg7], SceneCluster.anIntArray761[i_9_], i_5_, renderable, renderable_10_, i_4_);
126+
arg5.addWall(arg9, arg8, arg3, i_3_, Scene.ROTATION_WALL_TYPE[arg7], Scene.ROTATION_WALL_TYPE[i_9_], i_5_, renderable, renderable_10_, i_4_);
128127
if (gameObjectDefinition.solid)
129128
arg0.unmarkWall(arg9, arg8, arg4, arg7, gameObjectDefinition.walkable);
130129
} else if (arg4 == 3) {
@@ -133,7 +132,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
133132
renderable = new GameObject(arg1, 3, arg7, i, i_0_, i_2_, i_1_, gameObjectDefinition.animationId, true);
134133
else
135134
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, arg7, i, 3, i_0_);
136-
arg5.addWall(arg9, arg8, arg3, i_3_, MovedStatics.anIntArray2788[arg7], 0, i_5_, renderable, null, i_4_);
135+
arg5.addWall(arg9, arg8, arg3, i_3_, Scene.ROTATION_WALL_CORNER_TYPE[arg7], 0, i_5_, renderable, null, i_4_);
137136
if (gameObjectDefinition.solid)
138137
arg0.unmarkWall(arg9, arg8, arg4, arg7, gameObjectDefinition.walkable);
139138
} else if (arg4 == 9) {
@@ -174,7 +173,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
174173
renderable = new GameObject(arg1, 4, 0, i, i_0_, i_2_, i_1_, gameObjectDefinition.animationId, true);
175174
else
176175
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, 0, i, 4, i_0_);
177-
arg5.addWallDecoration(arg9, arg8, arg3, i_3_, 0, 0, 512 * arg7, i_5_, renderable, i_4_, SceneCluster.anIntArray761[arg7]);
176+
arg5.addWallDecoration(arg9, arg8, arg3, i_3_, 0, 0, 512 * arg7, i_5_, renderable, i_4_, Scene.ROTATION_WALL_TYPE[arg7]);
178177
} else if (arg4 == 5) {
179178
int i_14_ = 16;
180179
int i_15_ = arg5.getWallHash(arg3, arg9, arg8);
@@ -185,7 +184,7 @@ public static void addObject(CollisionMap arg0, int arg1, int arg2, int arg3, in
185184
renderable = gameObjectDefinition.createTerrainObjectModel(i_2_, i_1_, 0, i, 4, i_0_);
186185
else
187186
renderable = new GameObject(arg1, 4, 0, i, i_0_, i_2_, i_1_, gameObjectDefinition.animationId, true);
188-
arg5.addWallDecoration(arg9, arg8, arg3, i_3_, MovedStatics.anIntArray666[arg7] * i_14_, MovedStatics.anIntArray2207[arg7] * i_14_, 512 * arg7, i_5_, renderable, i_4_, SceneCluster.anIntArray761[arg7]);
187+
arg5.addWallDecoration(arg9, arg8, arg3, i_3_, MovedStatics.anIntArray666[arg7] * i_14_, MovedStatics.anIntArray2207[arg7] * i_14_, 512 * arg7, i_5_, renderable, i_4_, Scene.ROTATION_WALL_TYPE[arg7]);
189188
} else if (arg4 == 6) {
190189
Renderable renderable;
191190
if (gameObjectDefinition.animationId != -1 || gameObjectDefinition.childIds != null)

0 commit comments

Comments
 (0)