Skip to content

Commit

Permalink
refactor: Renaming some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazaz committed Jul 17, 2024
1 parent 87e4fd9 commit d778e1c
Show file tree
Hide file tree
Showing 32 changed files with 1,078 additions and 1,071 deletions.
360 changes: 180 additions & 180 deletions client/src/main/java/client.java

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions mapview/src/main/java/WorldmapFont.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jagex2.client.GameShell;
import jagex2.graphics.Draw2D;
import jagex2.graphics.Pix2D;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalClass;
import org.openrs2.deob.annotation.OriginalMember;
Expand All @@ -9,7 +9,7 @@
import java.awt.image.PixelGrabber;

@OriginalClass("mapview!g")
public final class WorldmapFont extends Draw2D {
public final class WorldmapFont extends Pix2D {

private static final String CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";

Expand Down Expand Up @@ -215,7 +215,7 @@ private void drawString(@OriginalArg(0) String str, @OriginalArg(1) int x, @Orig
public void drawStringCenter(@OriginalArg(0) String str, @OriginalArg(1) int x, @OriginalArg(2) int y, @OriginalArg(3) int rgb, @OriginalArg(4) boolean shadowed) {
@Pc(5) int xOffset = this.stringWidth(str) / 2;
@Pc(8) int yOffset = this.getYOffset();
if (x - xOffset <= Draw2D.right && (x + xOffset >= Draw2D.left && (y - yOffset <= Draw2D.bottom && y >= 0))) {
if (x - xOffset <= Pix2D.boundRight && (x + xOffset >= Pix2D.boundLeft && (y - yOffset <= Pix2D.boundBottom && y >= 0))) {
this.drawString(str, x - xOffset, y, rgb, shadowed);
}
}
Expand Down Expand Up @@ -266,31 +266,31 @@ private void drawChar(@OriginalArg(0) int c, @OriginalArg(1) int x, @OriginalArg
@Pc(21) int local21 = info[c + 3];
@Pc(27) int local27 = info[c + 4];
@Pc(47) int local47 = info[c] * 16384 + info[c + 1] * 128 + info[c + 2];
@Pc(53) int local53 = local7 + local15 * Draw2D.width2d;
@Pc(57) int local57 = Draw2D.width2d - local21;
@Pc(53) int local53 = local7 + local15 * Pix2D.width2d;
@Pc(57) int local57 = Pix2D.width2d - local21;
@Pc(59) int local59 = 0;
@Pc(66) int local66;
if (local15 < Draw2D.top) {
local66 = Draw2D.top - local15;
if (local15 < Pix2D.boundTop) {
local66 = Pix2D.boundTop - local15;
local27 -= local66;
local15 = Draw2D.top;
local15 = Pix2D.boundTop;
local47 += local66 * local21;
local53 += local66 * Draw2D.width2d;
local53 += local66 * Pix2D.width2d;
}
if (local15 + local27 >= Draw2D.bottom) {
local27 -= local15 + local27 - Draw2D.bottom + 1;
if (local15 + local27 >= Pix2D.boundBottom) {
local27 -= local15 + local27 - Pix2D.boundBottom + 1;
}
if (local7 < Draw2D.left) {
local66 = Draw2D.left - local7;
if (local7 < Pix2D.boundLeft) {
local66 = Pix2D.boundLeft - local7;
local21 -= local66;
local7 = Draw2D.left;
local7 = Pix2D.boundLeft;
local47 += local66;
local53 += local66;
local59 += local66;
local57 += local66;
}
if (local7 + local21 >= Draw2D.right) {
local66 = local7 + local21 - Draw2D.right + 1;
if (local7 + local21 >= Pix2D.boundRight) {
local66 = local7 + local21 - Pix2D.boundRight + 1;
local21 -= local66;
local59 += local66;
local57 += local66;
Expand All @@ -299,9 +299,9 @@ private void drawChar(@OriginalArg(0) int c, @OriginalArg(1) int x, @OriginalArg
return;
}
if (flagged) {
this.plotLetter2(Draw2D.data, info, rgb, local47, local53, local21, local27, local57, local59);
this.plotLetter2(Pix2D.data, info, rgb, local47, local53, local21, local27, local57, local59);
} else {
this.plotLetter(Draw2D.data, info, rgb, local47, local53, local21, local27, local57, local59);
this.plotLetter(Pix2D.data, info, rgb, local47, local53, local21, local27, local57, local59);
}
}

Expand Down
104 changes: 52 additions & 52 deletions mapview/src/main/java/mapview.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jagex2.client.GameShell;
import jagex2.graphics.Draw2D;
import jagex2.graphics.Pix24;
import jagex2.graphics.Pix2D;
import jagex2.graphics.Pix32;
import jagex2.graphics.Pix8;
import jagex2.graphics.PixFont;
import jagex2.io.Jagfile;
Expand Down Expand Up @@ -116,7 +116,7 @@ public final class mapview extends GameShell {
private int flashTimer;

@OriginalMember(owner = "mapview!mapview", name = "Db", descriptor = "Lmapview!h;")
private Pix24 imageOverview;
private Pix32 imageOverview;

@OriginalMember(owner = "mapview!mapview", name = "Eb", descriptor = "I")
private int lastMouseClickX;
Expand Down Expand Up @@ -158,12 +158,12 @@ public final class mapview extends GameShell {
private Pix8[] imageMapscene = new Pix8[50];

@OriginalMember(owner = "mapview!mapview", name = "W", descriptor = "[Lmapview!h;")
private Pix24[] imageMapfunction = new Pix24[50];
private Pix32[] imageMapfunction = new Pix32[50];

private Pix24 imageMapdot0;
private Pix24 imageMapdot1;
private Pix24 imageMapdot2;
private Pix24 imageMapdot3;
private Pix32 imageMapdot0;
private Pix32 imageMapdot1;
private Pix32 imageMapdot2;
private Pix32 imageMapdot3;

@OriginalMember(owner = "mapview!mapview", name = "gb", descriptor = "[I")
private int[] visibleMapFunctionsX = new int[2000];
Expand Down Expand Up @@ -321,15 +321,15 @@ protected void load() {

try {
for (int i = 0; i < 50; i++) {
this.imageMapfunction[i] = new Pix24(worldmap, "mapfunction", i);
this.imageMapfunction[i] = new Pix32(worldmap, "mapfunction", i);
}
} catch (@Pc(204) Exception ignore) {
}

this.imageMapdot0 = new Pix24(worldmap, "mapdots", 0);
this.imageMapdot1 = new Pix24(worldmap, "mapdots", 1);
this.imageMapdot2 = new Pix24(worldmap, "mapdots", 2);
this.imageMapdot3 = new Pix24(worldmap, "mapdots", 3);
this.imageMapdot0 = new Pix32(worldmap, "mapdots", 0);
this.imageMapdot1 = new Pix32(worldmap, "mapdots", 1);
this.imageMapdot2 = new Pix32(worldmap, "mapdots", 2);
this.imageMapdot3 = new Pix32(worldmap, "mapdots", 3);

this.b12 = new PixFont(worldmap, "b12");
this.f11 = new WorldmapFont(11, true, this);
Expand All @@ -344,11 +344,11 @@ protected void load() {
this.floormapColors = new int[this.sizeX][this.sizeZ];
this.averageUnderlayColors(underlayTiles, this.floormapColors);

this.imageOverview = new Pix24(this.imageOverviewWidth, this.imageOverviewHeight);
this.imageOverview = new Pix32(this.imageOverviewWidth, this.imageOverviewHeight);
this.imageOverview.bind();
this.drawMap(0, 0, this.sizeX, this.sizeZ, 0, 0, this.imageOverviewWidth, this.imageOverviewHeight);
Draw2D.drawRect(0, 0, 0, this.imageOverviewWidth, this.imageOverviewHeight);
Draw2D.drawRect(1, 1, this.colorInactiveBorderTL, this.imageOverviewWidth - 2, this.imageOverviewHeight - 2);
Pix2D.drawRect(0, 0, 0, this.imageOverviewWidth, this.imageOverviewHeight);
Pix2D.drawRect(1, 1, this.colorInactiveBorderTL, this.imageOverviewWidth - 2, this.imageOverviewHeight - 2);

super.drawArea.bind();
}
Expand Down Expand Up @@ -684,7 +684,7 @@ protected void update() {
// 2005 mapview applet feature
System.out.println("Starting export...");

@Pc(169) Pix24 map = new Pix24(this.sizeX * 2, this.sizeZ * 2);
@Pc(169) Pix32 map = new Pix32(this.sizeX * 2, this.sizeZ * 2);
map.bind();
this.drawMap(0, 0, this.sizeX, this.sizeZ, 0, 0, this.sizeX * 2, this.sizeZ * 2);
super.drawArea.bind();
Expand Down Expand Up @@ -861,7 +861,7 @@ protected void draw() {
this.redraw = false;
this.redrawTimer = 0;

Draw2D.clear();
Pix2D.clear();

@Pc(20) int left = this.offsetX - (int) (635.0D / this.zoom);
@Pc(29) int top = this.offsetZ - (int) (503.0D / this.zoom);
Expand All @@ -872,15 +872,15 @@ protected void draw() {
if (this.showOverview) {
this.imageOverview.blitOpaque(this.overviewX, this.overviewY);

Draw2D.fillRectAlpha(this.overviewX + this.imageOverviewWidth * left / this.sizeX, this.overviewY + this.imageOverviewHeight * top / this.sizeZ, (right - left) * this.imageOverviewWidth / this.sizeX, (bottom - top) * this.imageOverviewHeight / this.sizeZ, 0xff0000, 0x80);
Draw2D.drawRect(this.overviewX + this.imageOverviewWidth * left / this.sizeX, this.overviewY + this.imageOverviewHeight * top / this.sizeZ, 0xff0000, (right - left) * this.imageOverviewWidth / this.sizeX, (bottom - top) * this.imageOverviewHeight / this.sizeZ);
Pix2D.fillRectTrans(this.overviewX + this.imageOverviewWidth * left / this.sizeX, this.overviewY + this.imageOverviewHeight * top / this.sizeZ, (right - left) * this.imageOverviewWidth / this.sizeX, (bottom - top) * this.imageOverviewHeight / this.sizeZ, 0xff0000, 0x80);
Pix2D.drawRect(this.overviewX + this.imageOverviewWidth * left / this.sizeX, this.overviewY + this.imageOverviewHeight * top / this.sizeZ, 0xff0000, (right - left) * this.imageOverviewWidth / this.sizeX, (bottom - top) * this.imageOverviewHeight / this.sizeZ);

if (this.flashTimer > 0 && this.flashTimer % 10 < 5) {
for (int i = 0; i < this.activeMapFunctionCount; i++) {
if (this.activeMapFunctions[i] == this.currentKey) {
int x = this.overviewX + this.imageOverviewWidth * this.activeMapFunctionX[i] / this.sizeX;
int y = this.overviewY + this.imageOverviewHeight * this.activeMapFunctionZ[i] / this.sizeZ;
Draw2D.fillCircle(x, y, 2, 0xffff00, 256);
Pix2D.fillCircleTrans(x, y, 2, 0xffff00, 256);
}
}
}
Expand Down Expand Up @@ -959,18 +959,18 @@ protected void refresh() {

@OriginalMember(owner = "mapview!mapview", name = "a", descriptor = "(IIIIIIILjava/lang/String;)V")
private void drawString(@OriginalArg(0) int x, @OriginalArg(1) int y, @OriginalArg(2) int width, @OriginalArg(3) int height, @OriginalArg(4) int colorBorderTL, @OriginalArg(5) int fillColor, @OriginalArg(6) int colorBorderBR, @OriginalArg(7) String str) {
Draw2D.drawRect(x, y, 0, width, height);
Pix2D.drawRect(x, y, 0, width, height);

@Pc(6) int xPad = x + 1;
@Pc(7) int yPad = y + 1;
@Pc(8) int widthPad = width - 2;
@Pc(9) int heightPad = height - 2;

Draw2D.fillRect(xPad, yPad, fillColor, widthPad, heightPad);
Draw2D.drawHorizontalLine(xPad, yPad, colorBorderTL, widthPad);
Draw2D.drawVerticalLine(xPad, yPad, colorBorderTL, heightPad);
Draw2D.drawHorizontalLine(xPad, yPad + heightPad - 1, colorBorderBR, widthPad);
Draw2D.drawVerticalLine(xPad + widthPad - 1, yPad, colorBorderBR, heightPad);
Pix2D.fillRect(xPad, yPad, fillColor, widthPad, heightPad);
Pix2D.hline(xPad, yPad, colorBorderTL, widthPad);
Pix2D.vline(xPad, yPad, colorBorderTL, heightPad);
Pix2D.hline(xPad, yPad + heightPad - 1, colorBorderBR, widthPad);
Pix2D.vline(xPad + widthPad - 1, yPad, colorBorderBR, heightPad);

this.b12.drawStringCenter(xPad + widthPad / 2 + 1, yPad + heightPad / 2 + 1 + 4, str, 0);
this.b12.drawStringCenter(xPad + widthPad / 2, yPad + heightPad / 2 + 4, str, 0xffffff);
Expand Down Expand Up @@ -1011,14 +1011,14 @@ private void drawMap(@OriginalArg(0) int left, @OriginalArg(1) int top, @Origina

int overlay = overlays[y + top];
if (overlay == 0) {
Draw2D.fillRect(startX, startY, colors[y + top], endX - startX, endY - startY);
Pix2D.fillRect(startX, startY, colors[y + top], endX - startX, endY - startY);
} else {
@Pc(140) byte info = shapes[y + top];
int shape = info & 0xFC;
if (shape == 0 || lengthX <= 1 || lengthY <= 1) {
Draw2D.fillRect(startX, startY, overlay, lengthX, lengthY);
Pix2D.fillRect(startX, startY, overlay, lengthX, lengthY);
} else {
this.drawSmoothEdges(Draw2D.data, startY * Draw2D.width2d + startX, colors[y + top], overlay, lengthX, lengthY, shape >> 2, info & 0x3);
this.drawSmoothEdges(Pix2D.data, startY * Pix2D.width2d + startX, colors[y + top], overlay, lengthX, lengthY, shape >> 2, info & 0x3);
}
}
}
Expand Down Expand Up @@ -1076,40 +1076,40 @@ private void drawMap(@OriginalArg(0) int left, @OriginalArg(1) int top, @Origina
}

if (wall == 1) {
Draw2D.drawVerticalLine(startX, startY, rgb, lengthY);
Pix2D.vline(startX, startY, rgb, lengthY);
} else if (wall == 2) {
Draw2D.drawHorizontalLine(startX, startY, rgb, lengthX);
Pix2D.hline(startX, startY, rgb, lengthX);
} else if (wall == 3) {
Draw2D.drawVerticalLine(edgeX, startY, rgb, lengthY);
Pix2D.vline(edgeX, startY, rgb, lengthY);
} else if (wall == 4) {
Draw2D.drawHorizontalLine(startX, edgeY, rgb, lengthX);
Pix2D.hline(startX, edgeY, rgb, lengthX);
} else if (wall == 9) {
Draw2D.drawVerticalLine(startX, startY, 0xffffff, lengthY);
Draw2D.drawHorizontalLine(startX, startY, rgb, lengthX);
Pix2D.vline(startX, startY, 0xffffff, lengthY);
Pix2D.hline(startX, startY, rgb, lengthX);
} else if (wall == 10) {
Draw2D.drawVerticalLine(edgeX, startY, 0xffffff, lengthY);
Draw2D.drawHorizontalLine(startX, startY, rgb, lengthX);
Pix2D.vline(edgeX, startY, 0xffffff, lengthY);
Pix2D.hline(startX, startY, rgb, lengthX);
} else if (wall == 11) {
Draw2D.drawVerticalLine(edgeX, startY, 0xffffff, lengthY);
Draw2D.drawHorizontalLine(startX, edgeY, rgb, lengthX);
Pix2D.vline(edgeX, startY, 0xffffff, lengthY);
Pix2D.hline(startX, edgeY, rgb, lengthX);
} else if (wall == 12) {
Draw2D.drawVerticalLine(startX, startY, 0xffffff, lengthY);
Draw2D.drawHorizontalLine(startX, edgeY, rgb, lengthX);
Pix2D.vline(startX, startY, 0xffffff, lengthY);
Pix2D.hline(startX, edgeY, rgb, lengthX);
} else if (wall == 17) {
Draw2D.drawHorizontalLine(startX, startY, rgb, 1);
Pix2D.hline(startX, startY, rgb, 1);
} else if (wall == 18) {
Draw2D.drawHorizontalLine(edgeX, startY, rgb, 1);
Pix2D.hline(edgeX, startY, rgb, 1);
} else if (wall == 19) {
Draw2D.drawHorizontalLine(edgeX, edgeY, rgb, 1);
Pix2D.hline(edgeX, edgeY, rgb, 1);
} else if (wall == 20) {
Draw2D.drawHorizontalLine(startX, edgeY, rgb, 1);
Pix2D.hline(startX, edgeY, rgb, 1);
} else if (wall == 25) {
for (int i = 0; i < lengthY; i++) {
Draw2D.drawHorizontalLine(startX + i, edgeY - i, rgb, 1);
Pix2D.hline(startX + i, edgeY - i, rgb, 1);
}
} else if (wall == 26) {
for (int i = 0; i < lengthY; i++) {
Draw2D.drawHorizontalLine(startX + i, startY + i, rgb, 1);
Pix2D.hline(startX + i, startY + i, rgb, 1);
}
}
}
Expand Down Expand Up @@ -1197,8 +1197,8 @@ private void drawMap(@OriginalArg(0) int left, @OriginalArg(1) int top, @Origina
this.imageMapfunction[this.visibleMapFunctions[i]].draw(this.visibleMapFunctionsX[i] - 7, this.visibleMapFunctionsY[i] - 7);

if (this.flashTimer % 10 < 5) {
Draw2D.fillCircle(this.visibleMapFunctionsX[i], this.visibleMapFunctionsY[i], 15, 0xffff00, 128);
Draw2D.fillCircle(this.visibleMapFunctionsX[i], this.visibleMapFunctionsY[i], 7, 0xffffff, 256);
Pix2D.fillCircleTrans(this.visibleMapFunctionsX[i], this.visibleMapFunctionsY[i], 15, 0xffff00, 128);
Pix2D.fillCircleTrans(this.visibleMapFunctionsX[i], this.visibleMapFunctionsY[i], 7, 0xffffff, 256);
}
}
}
Expand Down Expand Up @@ -1293,7 +1293,7 @@ private void drawMap(@OriginalArg(0) int left, @OriginalArg(1) int top, @Origina
int drawRight = widthOffset + (width - widthOffset) * (x + 64 - left) / (right - left);
int drawBottom = heightOffset + (height - heightOffset) * (z - top) / (bottom - top);

Draw2D.drawRect(drawLeft, drawTop, 0xffffff, drawRight - drawLeft, drawBottom - drawTop);
Pix2D.drawRect(drawLeft, drawTop, 0xffffff, drawRight - drawLeft, drawBottom - drawTop);
this.b12.drawStringRight(drawRight - 5, drawBottom - 5, mx + "_" + mz, 0xffffff, false);

if (mx == 33 && mz >= 71 && mz <= 73) {
Expand All @@ -1308,7 +1308,7 @@ private void drawMap(@OriginalArg(0) int left, @OriginalArg(1) int top, @Origina

@OriginalMember(owner = "mapview!mapview", name = "a", descriptor = "([IIIIIIII)V")
private void drawSmoothEdges(@OriginalArg(0) int[] data, @OriginalArg(1) int off, @OriginalArg(2) int color, @OriginalArg(3) int overlay, @OriginalArg(4) int width, @OriginalArg(5) int height, @OriginalArg(6) int shape, @OriginalArg(7) int rotation) {
@Pc(5) int step = Draw2D.width2d - width;
@Pc(5) int step = Pix2D.width2d - width;
if (shape == 9) {
shape = 1;
rotation = rotation + 1 & 0x3;
Expand Down
4 changes: 2 additions & 2 deletions runetek3/src/main/java/jagex2/client/GameShell.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package jagex2.client;

import jagex2.graphics.Pix24;
import jagex2.graphics.Pix32;
import jagex2.graphics.PixMap;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalClass;
Expand Down Expand Up @@ -43,7 +43,7 @@ public class GameShell extends Applet implements Runnable, MouseListener, MouseM
protected PixMap drawArea;

@OriginalMember(owner = "client!a", name = "p", descriptor = "[Lclient!hb;")
private final Pix24[] temp = new Pix24[6];
private final Pix32[] temp = new Pix32[6];

@OriginalMember(owner = "client!a", name = "q", descriptor = "Lclient!b;")
protected ViewBox frame;
Expand Down
16 changes: 8 additions & 8 deletions runetek3/src/main/java/jagex2/config/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import jagex2.datastruct.JString;
import jagex2.datastruct.LruCache;
import jagex2.graphics.Model;
import jagex2.graphics.Pix24;
import jagex2.graphics.Pix32;
import jagex2.graphics.PixFont;
import jagex2.io.Jagfile;
import jagex2.io.Packet;
Expand Down Expand Up @@ -188,7 +188,7 @@ public class Component {
public int marginY;

@OriginalMember(owner = "client!hc", name = "H", descriptor = "[Lclient!hb;")
public Pix24[] invSlotSprite;
public Pix32[] invSlotSprite;

@OriginalMember(owner = "client!hc", name = "I", descriptor = "[I")
public int[] invSlotOffsetX;
Expand Down Expand Up @@ -227,10 +227,10 @@ public class Component {
public int overColour;

@OriginalMember(owner = "client!hc", name = "U", descriptor = "Lclient!hb;")
public Pix24 graphic;
public Pix32 graphic;

@OriginalMember(owner = "client!hc", name = "V", descriptor = "Lclient!hb;")
public Pix24 activeGraphic;
public Pix32 activeGraphic;

@OriginalMember(owner = "client!hc", name = "W", descriptor = "Lclient!eb;")
public Model model;
Expand Down Expand Up @@ -362,7 +362,7 @@ public static void unpack(@OriginalArg(3) Jagfile jag, @OriginalArg(0) Jagfile m

com.invSlotOffsetX = new int[20];
com.invSlotOffsetY = new int[20];
com.invSlotSprite = new Pix24[20];
com.invSlotSprite = new Pix32[20];

for (int i = 0; i < 20; i++) {
if (dat.g1() == 1) {
Expand Down Expand Up @@ -511,16 +511,16 @@ public static void unpack(@OriginalArg(3) Jagfile jag, @OriginalArg(0) Jagfile m
}

@OriginalMember(owner = "client!hc", name = "a", descriptor = "(Lclient!ub;ILjava/lang/String;I)Lclient!hb;")
private static Pix24 getImage(@OriginalArg(0) Jagfile media, @OriginalArg(2) String sprite, @OriginalArg(1) int spriteId) {
private static Pix32 getImage(@OriginalArg(0) Jagfile media, @OriginalArg(2) String sprite, @OriginalArg(1) int spriteId) {
@Pc(8) long uid = (JString.hashCode(sprite) << 8) + (long) spriteId;
@Pc(13) Pix24 image = (Pix24) imageCache.get(uid);
@Pc(13) Pix32 image = (Pix32) imageCache.get(uid);

if (image != null) {
return image;
}

try {
image = new Pix24(media, sprite, spriteId);
image = new Pix32(media, sprite, spriteId);
imageCache.put(uid, image);
} catch (@Pc(38) Exception ignored) {
return null;
Expand Down
Loading

0 comments on commit d778e1c

Please sign in to comment.