2009scape branding

This commit is contained in:
ceikry 2023-05-05 16:50:47 -05:00
parent ed4cae15e7
commit 1262d7cbd4
5 changed files with 81 additions and 47 deletions

View file

@ -469,6 +469,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
focus = focusIn;
}
this.mainLoop();
setWindowTitle();
}
public static GraphicsDevice getCurrentDevice() {
@ -686,6 +687,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
frame.setVisible(true);
frame.setBackground(Color.black);
frame.toFront();
frame.setIconImage(new javax.swing.ImageIcon(getClass().getResource("/saradomin.png")).getImage());
@Pc(44) Insets insets = frame.getInsets();
frame.setSize(insets.left + frameWidth + insets.right, insets.top + frameHeight + insets.bottom);
GameShell.setFpsTarget(getCurrentDevice().getDisplayMode().getRefreshRate());
@ -700,6 +702,38 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
}
}
private void setWindowTitle() {
if (GlobalJsonConfig.instance != null) {
String modeString = "2009Scape [Local]";
switch (GlobalJsonConfig.instance.ip_management) {
case "play.2009scape.org":
modeString = "2009Scape [Live]";
break;
case "test.2009scape.org":
modeString = "2009Scape [Test]";
break;
default:
break;
}
if (PlayerList.self != null) {
JagString name = PlayerList.self.username;
if (name != null)
modeString += " - " + name.toString();
else modeString += " - At Login";
}
if (frame != null)
frame.setTitle(modeString);
}
}
private final void configureTargetFPS() {
int refreshRate = getCurrentDevice().getDisplayMode().getRefreshRate();
if (refreshRate == java.awt.DisplayMode.REFRESH_RATE_UNKNOWN) {
refreshRate = 60; //just assume 60hz and call it a day.
}
GameShell.setFpsTarget(refreshRate);
}
@OriginalMember(owner = "client!rc", name = "windowOpened", descriptor = "(Ljava/awt/event/WindowEvent;)V")
@Override
public final void windowOpened(@OriginalArg(0) WindowEvent event) {

View file

@ -25,26 +25,26 @@ public class NpcList {
@OriginalMember(owner = "client!vg", name = "a", descriptor = "(IILclient!fe;)V")
public static void method4514(@OriginalArg(0) int arg0, @OriginalArg(2) PathingEntity arg1) {
if (client.loop < arg1.anInt3395) {
method553(arg1);
} else if (arg1.anInt3386 >= client.loop) {
method4665(arg1);
if (client.loop < arg1.forceMoveCyclesToStart) {
lerpToForceMoveStart(arg1);
} else if (arg1.forceMoveCyclesToDest >= client.loop) {
lerpToForceMoveDest(arg1);
} else {
method2247(arg1);
}
if (arg1.xFine < 128 || arg1.zFine < 128 || arg1.xFine >= 13184 || arg1.zFine >= 13184) {
arg1.seqId = -1;
arg1.spotAnimId = -1;
arg1.anInt3395 = 0;
arg1.anInt3386 = 0;
arg1.forceMoveCyclesToStart = 0;
arg1.forceMoveCyclesToDest = 0;
arg1.xFine = arg1.movementQueueX[0] * 128 + arg1.getSize() * 64;
arg1.zFine = arg1.movementQueueZ[0] * 128 + arg1.getSize() * 64;
arg1.method2689();
}
if (arg1 == PlayerList.self && (arg1.xFine < 1536 || arg1.zFine < 1536 || arg1.xFine >= 11776 || arg1.zFine >= 11776)) {
arg1.spotAnimId = -1;
arg1.anInt3395 = 0;
arg1.anInt3386 = 0;
arg1.forceMoveCyclesToStart = 0;
arg1.forceMoveCyclesToDest = 0;
arg1.seqId = -1;
arg1.xFine = arg1.movementQueueX[0] * 128 + arg1.getSize() * 64;
arg1.zFine = arg1.movementQueueZ[0] * 128 + arg1.getSize() * 64;
@ -55,50 +55,50 @@ public class NpcList {
}
@OriginalMember(owner = "client!bh", name = "a", descriptor = "(Lclient!fe;Z)V")
public static void method553(@OriginalArg(0) PathingEntity arg0) {
@Pc(8) int local8 = arg0.anInt3395 - client.loop;
@Pc(20) int local20 = arg0.anInt3380 * 128 + arg0.getSize() * 64;
@Pc(36) int local36 = arg0.anInt3428 * 128 + arg0.getSize() * 64;
if (arg0.anInt3431 == 0) {
public static void lerpToForceMoveStart(@OriginalArg(0) PathingEntity arg0) {
@Pc(8) int toStartCyclesLeft = arg0.forceMoveCyclesToStart - client.loop;
@Pc(20) int startXFine = arg0.forceMoveStartX * 128 + arg0.getSize() * 64;
@Pc(36) int startYFine = arg0.forceMoveStartY * 128 + arg0.getSize() * 64;
if (arg0.forceMoveDirection == 0) {
arg0.anInt3400 = 1024;
}
arg0.xFine += (local20 - arg0.xFine) / local8;
arg0.zFine += (local36 - arg0.zFine) / local8;
if (arg0.anInt3431 == 1) {
arg0.xFine += (startXFine - arg0.xFine) / toStartCyclesLeft;
arg0.zFine += (startYFine - arg0.zFine) / toStartCyclesLeft;
if (arg0.forceMoveDirection == 1) {
arg0.anInt3400 = 1536;
}
arg0.anInt3417 = 0;
if (arg0.anInt3431 == 2) {
if (arg0.forceMoveDirection == 2) {
arg0.anInt3400 = 0;
}
if (arg0.anInt3431 == 3) {
if (arg0.forceMoveDirection == 3) {
arg0.anInt3400 = 512;
}
}
@OriginalMember(owner = "client!wl", name = "a", descriptor = "(Lclient!fe;B)V")
public static void method4665(@OriginalArg(0) PathingEntity arg0) {
if (client.loop == arg0.anInt3386 || arg0.seqId == -1 || arg0.anInt3420 != 0 || arg0.anInt3360 + 1 > SeqTypeList.get(arg0.seqId).frameDelay[arg0.anInt3425]) {
@Pc(35) int local35 = arg0.anInt3386 - arg0.anInt3395;
@Pc(41) int local41 = client.loop - arg0.anInt3395;
@Pc(52) int local52 = arg0.anInt3380 * 128 + arg0.getSize() * 64;
@Pc(64) int local64 = arg0.anInt3428 * 128 + arg0.getSize() * 64;
@Pc(75) int local75 = arg0.anInt3416 * 128 + arg0.getSize() * 64;
@Pc(86) int local86 = arg0.anInt3392 * 128 + arg0.getSize() * 64;
arg0.xFine = (local41 * local75 + local52 * (local35 - local41)) / local35;
arg0.zFine = (local86 * local41 + local64 * (local35 - local41)) / local35;
public static void lerpToForceMoveDest(@OriginalArg(0) PathingEntity arg0) {
if (client.loop == arg0.forceMoveCyclesToDest || arg0.seqId == -1 || arg0.anInt3420 != 0 || arg0.anInt3360 + 1 > SeqTypeList.get(arg0.seqId).frameDelay[arg0.anInt3425]) {
@Pc(35) int cyclesDiff = arg0.forceMoveCyclesToDest - arg0.forceMoveCyclesToStart;
@Pc(41) int lerpCyclesRemaining = client.loop - arg0.forceMoveCyclesToStart;
@Pc(52) int startXFine = arg0.forceMoveStartX * 128 + arg0.getSize() * 64;
@Pc(64) int startYFine = arg0.forceMoveStartY * 128 + arg0.getSize() * 64;
@Pc(75) int destXFine = arg0.forceMoveDestX * 128 + arg0.getSize() * 64;
@Pc(86) int destYFine = arg0.forceMoveDestY * 128 + arg0.getSize() * 64;
arg0.xFine = (lerpCyclesRemaining * destXFine + startXFine * (cyclesDiff - lerpCyclesRemaining)) / cyclesDiff;
arg0.zFine = (destYFine * lerpCyclesRemaining + startYFine * (cyclesDiff - lerpCyclesRemaining)) / cyclesDiff;
}
arg0.anInt3417 = 0;
if (arg0.anInt3431 == 0) {
if (arg0.forceMoveDirection == 0) {
arg0.anInt3400 = 1024;
}
if (arg0.anInt3431 == 1) {
if (arg0.forceMoveDirection == 1) {
arg0.anInt3400 = 1536;
}
if (arg0.anInt3431 == 2) {
if (arg0.forceMoveDirection == 2) {
arg0.anInt3400 = 0;
}
if (arg0.anInt3431 == 3) {
if (arg0.forceMoveDirection == 3) {
arg0.anInt3400 = 512;
}
arg0.anInt3381 = arg0.anInt3400;
@ -535,7 +535,7 @@ public class NpcList {
}
if (entity.seqId != -1 && entity.anInt3420 <= 1) {
local18 = SeqTypeList.get(entity.seqId);
if (local18.looptype == 1 && entity.anInt3405 > 0 && client.loop >= entity.anInt3395 && client.loop > entity.anInt3386) {
if (local18.looptype == 1 && entity.anInt3405 > 0 && client.loop >= entity.forceMoveCyclesToStart && client.loop > entity.forceMoveCyclesToDest) {
entity.anInt3420 = 1;
return;
}

View file

@ -33,7 +33,7 @@ public abstract class PathingEntity extends Entity {
public int attachmentXFine;
@OriginalMember(owner = "client!fe", name = "bb", descriptor = "I")
public int anInt3380;
public int forceMoveStartX;
@OriginalMember(owner = "client!fe", name = "cb", descriptor = "I")
public int anInt3381;
@ -42,19 +42,19 @@ public abstract class PathingEntity extends Entity {
public int atachmentX0;
@OriginalMember(owner = "client!fe", name = "hb", descriptor = "I")
public int anInt3386;
public int forceMoveCyclesToDest;
@OriginalMember(owner = "client!fe", name = "nb", descriptor = "Ljava/lang/Object;")
public Object attachment;
@OriginalMember(owner = "client!fe", name = "rb", descriptor = "I")
public int anInt3392;
public int forceMoveDestY;
@OriginalMember(owner = "client!fe", name = "tb", descriptor = "I")
public int spotAnimY;
@OriginalMember(owner = "client!fe", name = "ub", descriptor = "I")
public int anInt3395;
public int forceMoveCyclesToStart;
@OriginalMember(owner = "client!fe", name = "vb", descriptor = "Lclient!ga;")
protected ParticleSystem particleSystem;
@ -75,7 +75,7 @@ public abstract class PathingEntity extends Entity {
public int xFine;
@OriginalMember(owner = "client!fe", name = "Ub", descriptor = "I")
public int anInt3416;
public int forceMoveDestX;
@OriginalMember(owner = "client!fe", name = "ac", descriptor = "I")
public int zFine;
@ -87,10 +87,10 @@ public abstract class PathingEntity extends Entity {
public int attachmentZFine;
@OriginalMember(owner = "client!fe", name = "hc", descriptor = "I")
public int anInt3428;
public int forceMoveStartY;
@OriginalMember(owner = "client!fe", name = "mc", descriptor = "I")
public int anInt3431;
public int forceMoveDirection;
@OriginalMember(owner = "client!fe", name = "w", descriptor = "[I")
public final int[] movementQueueZ = new int[10];

View file

@ -623,13 +623,13 @@ public class Protocol {
}
}
if ((flags & 0x400) != 0) {
player.anInt3380 = inboundBuffer.g1neg();
player.anInt3428 = inboundBuffer.g1();
player.anInt3416 = inboundBuffer.g1add();
player.anInt3392 = inboundBuffer.g1();
player.anInt3395 = inboundBuffer.ig2() + client.loop;
player.anInt3386 = inboundBuffer.ig2() + client.loop;
player.anInt3431 = inboundBuffer.g1neg();
player.forceMoveStartX = inboundBuffer.g1neg();
player.forceMoveStartY = inboundBuffer.g1();
player.forceMoveDestX = inboundBuffer.g1add();
player.forceMoveDestY = inboundBuffer.g1();
player.forceMoveCyclesToStart = inboundBuffer.ig2() + client.loop;
player.forceMoveCyclesToDest = inboundBuffer.ig2() + client.loop;
player.forceMoveDirection = inboundBuffer.g1neg();
player.movementQueueSize = 1;
player.anInt3405 = 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB