diff --git a/client/src/main/java/client.java b/client/src/main/java/client.java index 6a835d6e..bc80b771 100644 --- a/client/src/main/java/client.java +++ b/client/src/main/java/client.java @@ -7,6 +7,7 @@ import jagex2.dash3d.entity.*; import jagex2.dash3d.type.LocSpawned; import jagex2.dash3d.type.LocTemporary; +import jagex2.dash3d.type.Tile; import jagex2.datastruct.JString; import jagex2.datastruct.LinkList; import jagex2.graphics.*; @@ -35,6 +36,10 @@ public class client extends GameShell { public boolean showDebug = false; public boolean showPerformance = false; + // alt+shift click to add a tile overlay + public Tile[] userTileMarkers = new Tile[4]; + public int userTileMarkerIndex = 0; + @OriginalMember(owner = "client!client", name = "E", descriptor = "I") public static int opHeld1Counter; @@ -1257,7 +1262,7 @@ public static void main(@OriginalArg(0) String[] args) { signlink.sunjava = true; } - signlink.startpriv(InetAddress.getByName("w1.225.2004scape.org")); + signlink.startpriv(InetAddress.getByName("localhost")); @Pc(82) client c = new client(); c.initApplication(789, 532); @@ -1362,12 +1367,12 @@ private void draw2DEntityElements() { if (this.showDebug) { // true tile overlay if (entity.pathLength > 0 || entity.forceMoveEndCycle >= loopCycle || entity.forceMoveStartCycle > loopCycle) { - int halfUnit = 64 * entity.size; - this.drawTileOverlay(entity.pathTileX[0] * 128 + halfUnit, entity.pathTileZ[0] * 128 + halfUnit, this.currentLevel, entity.size, 0x666666, true); + int halfUnit = 64 * entity.size; + this.drawTileOverlay(entity.pathTileX[0] * 128 + halfUnit, entity.pathTileZ[0] * 128 + halfUnit, this.currentLevel, entity.size, 0x00FFFF, false); } // local tile overlay - this.drawTileOverlay(entity.x, entity.z, this.currentLevel, entity.size, 0x444444, false); + this.drawTileOverlay(entity.x, entity.z, this.currentLevel, entity.size, 0x666666, false); int offsetY = 0; this.projectFromGround(entity, entity.height + 30); @@ -1558,6 +1563,16 @@ private void draw2DEntityElements() { } } + if (this.showDebug) { + for (int i = 0; i < this.userTileMarkers.length; i++) { + if (this.userTileMarkers[i] == null || this.userTileMarkers[i].level != this.currentLevel || this.userTileMarkers[i].x < 0 || this.userTileMarkers[i].z < 0 || this.userTileMarkers[i].x >= 104 || this.userTileMarkers[i].z >= 104) { + continue; + } + + this.drawTileOverlay(this.userTileMarkers[i].x * 128 + 64, this.userTileMarkers[i].z * 128 + 64, this.userTileMarkers[i].level, 1, 0xFFFF00, false); + } + } + for (@Pc(483) int i = 0; i < this.chatCount; i++) { int x = this.chatX[i]; @Pc(495) int y = this.chatY[i]; @@ -6903,7 +6918,7 @@ private void drawTileOverlay(int x, int z, int level, int size, int color, boole int x2, y2; int x3, y3; - int halfUnit = 64 * size; + int halfUnit = 64 * size; this.project(x - halfUnit, height, z - halfUnit); x0 = this.projectX; y0 = this.projectY; @@ -8300,7 +8315,7 @@ public URL getCodeBase() { try { if (super.frame != null) { - return new URL("http://w1.225.2004scape.org:" + (portOffset + 80)); + return new URL("http://localhost:" + (portOffset + 80)); } } catch (@Pc(21) Exception ex) { } @@ -8497,6 +8512,21 @@ private boolean tryMove(@OriginalArg(0) int srcX, @OriginalArg(4) int srcZ, @Ori int startX = this.bfsStepX[length]; int startZ = this.bfsStepZ[length]; + if (this.showDebug && super.actionKey[6] == 1 && super.actionKey[7] == 1) { + // check if tile is already added, if so remove it + for (int i = 0; i < this.userTileMarkers.length; i++) { + if (this.userTileMarkers[i] != null && this.userTileMarkers[i].x == World3D.clickTileX && this.userTileMarkers[i].z == World3D.clickTileZ) { + this.userTileMarkers[i] = null; + return false; + } + } + + // add new + this.userTileMarkers[this.userTileMarkerIndex] = new Tile(this.currentLevel, World3D.clickTileX, World3D.clickTileZ); + this.userTileMarkerIndex = this.userTileMarkerIndex + 1 & (this.userTileMarkers.length - 1); + return false; + } + if (type == 0) { // MOVE_GAMECLICK this.out.p1isaac(181); @@ -10053,6 +10083,10 @@ private void readLocalPlayer(@OriginalArg(2) Packet buf, @OriginalArg(1) int siz } } else if (updateType == 3) { this.currentLevel = buf.gBit(2); + if (this.showDebug) { + this.userTileMarkers = new Tile[4]; + this.userTileMarkerIndex = 0; + } int localX = buf.gBit(7); int localZ = buf.gBit(7); int jump = buf.gBit(1); diff --git a/client/src/main/java/jagex2/client/GameShell.java b/client/src/main/java/jagex2/client/GameShell.java index 3543b9f3..eeadf5c9 100644 --- a/client/src/main/java/jagex2/client/GameShell.java +++ b/client/src/main/java/jagex2/client/GameShell.java @@ -396,22 +396,36 @@ public final void keyPressed(@OriginalArg(0) KeyEvent e) { } if (code == 37) { + // KEY_LEFT ch = 1; } else if (code == 39) { + // KEY_RIGHT ch = 2; } else if (code == 38) { + // KEY_UP ch = 3; } else if (code == 40) { + // KEY_DOWN ch = 4; } else if (code == 17) { + // CONTROL ch = 5; + } else if (code == 16) { + // SHIFT + ch = 6; // (custom) + } else if (code == 18) { + // ALT + ch = 7; // (custom) } else if (code == 8) { + // BACKSPACE ch = 8; } else if (code == 127) { + // DELETE ch = 8; } else if (code == 9) { ch = 9; } else if (code == 10) { + // ENTER ch = 10; } else if (code >= 112 && code <= 123) { ch = code + 1008 - 112; @@ -451,22 +465,36 @@ public final void keyReleased(@OriginalArg(0) KeyEvent e) { } if (code == 37) { + // KEY_LEFT ch = 1; } else if (code == 39) { + // KEY_RIGHT ch = 2; } else if (code == 38) { + // KEY_UP ch = 3; } else if (code == 40) { + // KEY_DOWN ch = 4; } else if (code == 17) { + // CONTROL ch = 5; + } else if (code == 16) { + // SHIFT + ch = 6; // (custom) + } else if (code == 18) { + // ALT + ch = 7; // (custom) } else if (code == 8) { + // BACKSPACE ch = 8; } else if (code == 127) { + // DELETE ch = 8; } else if (code == 9) { ch = 9; } else if (code == 10) { + // ENTER ch = 10; } else if (code >= 112 && code <= 123) { ch = code + 1008 - 112; diff --git a/client/src/main/java/jagex2/dash3d/World3D.java b/client/src/main/java/jagex2/dash3d/World3D.java index 80454fcb..a7925f77 100644 --- a/client/src/main/java/jagex2/dash3d/World3D.java +++ b/client/src/main/java/jagex2/dash3d/World3D.java @@ -1123,17 +1123,17 @@ public void drawMinimapTile(@OriginalArg(3) int level, @OriginalArg(4) int x, @O int shape = overlay.shape; @Pc(71) int angle = overlay.rotation; - @Pc(74) int bcakground = overlay.backgroundRgb; + @Pc(74) int background = overlay.backgroundRgb; @Pc(77) int foreground = overlay.foregroundRgb; @Pc(82) int[] mask = this.MINIMAP_TILE_MASK[shape]; @Pc(87) int[] rotation = this.MINIMAP_TILE_ROTATION_MAP[angle]; @Pc(89) int off = 0; - if (bcakground != 0) { + if (background != 0) { for (int i = 0; i < 4; i++) { - dst[offset] = mask[rotation[off++]] == 0 ? bcakground : foreground; - dst[offset + 1] = mask[rotation[off++]] == 0 ? bcakground : foreground; - dst[offset + 2] = mask[rotation[off++]] == 0 ? bcakground : foreground; - dst[offset + 3] = mask[rotation[off++]] == 0 ? bcakground : foreground; + dst[offset] = mask[rotation[off++]] == 0 ? background : foreground; + dst[offset + 1] = mask[rotation[off++]] == 0 ? background : foreground; + dst[offset + 2] = mask[rotation[off++]] == 0 ? background : foreground; + dst[offset + 3] = mask[rotation[off++]] == 0 ? background : foreground; offset += step; } return;