Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 79fb9b2

Browse files
committed
feat: size > 1 support for true tile overlay
1 parent 3ea75bf commit 79fb9b2

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

client/src/main/java/client.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,11 +1362,12 @@ private void draw2DEntityElements() {
13621362
if (this.showDebug) {
13631363
// true tile overlay
13641364
if (entity.pathLength > 0 || entity.forceMoveEndCycle >= loopCycle || entity.forceMoveStartCycle > loopCycle) {
1365-
this.drawTileOverlay(entity.pathTileX[0] * 128 + 64, entity.pathTileZ[0] * 128 + 64, this.currentLevel, 0x666666, true);
1365+
int halfUnit = 64 * entity.size;
1366+
this.drawTileOverlay(entity.pathTileX[0] * 128 + halfUnit, entity.pathTileZ[0] * 128 + halfUnit, this.currentLevel, entity.size, 0x666666, true);
13661367
}
13671368

13681369
// local tile overlay
1369-
this.drawTileOverlay(entity.x, entity.z, this.currentLevel, 0x444444, false);
1370+
this.drawTileOverlay(entity.x, entity.z, this.currentLevel, entity.size, 0x444444, false);
13701371

13711372
int offsetY = 0;
13721373
this.projectFromGround(entity, entity.height + 30);
@@ -2875,8 +2876,8 @@ private void pushPlayers() {
28752876

28762877
@OriginalMember(owner = "client!client", name = "a", descriptor = "(IIBI)I")
28772878
private int getHeightmapY(@OriginalArg(0) int level, @OriginalArg(1) int sceneX, @OriginalArg(3) int sceneZ) {
2878-
@Pc(11) int tileX = sceneX >> 7;
2879-
@Pc(15) int tileZ = sceneZ >> 7;
2879+
@Pc(11) int tileX = Math.min(sceneX >> 7, 103);
2880+
@Pc(15) int tileZ = Math.min(sceneZ >> 7, 103);
28802881
@Pc(17) int realLevel = level;
28812882
if (level < 3 && (this.levelTileFlags[1][tileX][tileZ] & 0x2) == 2) {
28822883
realLevel = level + 1;
@@ -6895,24 +6896,24 @@ private void drawInfoOverlay() {
68956896
}
68966897
}
68976898

6898-
private void drawTileOverlay(int x, int z, int level, int color, boolean crossed) {
6899+
private void drawTileOverlay(int x, int z, int level, int size, int color, boolean crossed) {
68996900
int height = this.getHeightmapY(level, x, z);
69006901
int x0, y0;
69016902
int x1, y1;
69026903
int x2, y2;
69036904
int x3, y3;
69046905

6905-
// x/z should be the center of a tile which is 128 client-units large, so +/- 64 puts us at the edges
6906-
this.project(x - 64, height, z - 64);
6906+
int halfUnit = 64 * size;
6907+
this.project(x - halfUnit, height, z - halfUnit);
69076908
x0 = this.projectX;
69086909
y0 = this.projectY;
6909-
this.project(x + 64, height, z - 64);
6910+
this.project(x + halfUnit, height, z - halfUnit);
69106911
x1 = this.projectX;
69116912
y1 = this.projectY;
6912-
this.project(x - 64, height, z + 64);
6913+
this.project(x - halfUnit, height, z + halfUnit);
69136914
x2 = this.projectX;
69146915
y2 = this.projectY;
6915-
this.project(x + 64, height, z + 64);
6916+
this.project(x + halfUnit, height, z + halfUnit);
69166917
x3 = this.projectX;
69176918
y3 = this.projectY;
69186919

client/src/main/java/jagex2/client/ViewBox.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ViewBox extends Frame {
1313
@OriginalMember(owner = "client!b", name = "b", descriptor = "Lclient!a;")
1414
private final GameShell shell;
1515

16-
public final Insets insets;
16+
public Insets insets;
1717

1818
@OriginalMember(owner = "client!b", name = "<init>", descriptor = "(IILclient!a;I)V")
1919
public ViewBox(@OriginalArg(2) GameShell shell, @OriginalArg(3) int width, @OriginalArg(0) int height) {
@@ -30,7 +30,9 @@ public ViewBox(@OriginalArg(2) GameShell shell, @OriginalArg(3) int width, @Orig
3030
@Override
3131
public Graphics getGraphics() {
3232
@Pc(2) Graphics g = super.getGraphics();
33-
g.translate(this.insets.left, this.insets.top);
33+
if (this.insets != null) {
34+
g.translate(this.insets.left, this.insets.top);
35+
}
3436
return g;
3537
}
3638

0 commit comments

Comments
 (0)