Skip to content

Commit

Permalink
refactor: Updated some field names to match server discoveries
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazaz committed Apr 25, 2024
1 parent f28c835 commit 8b01c6f
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 154 deletions.
160 changes: 81 additions & 79 deletions client/src/main/java/client.java

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions client/src/main/java/jagex2/config/LocType.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class LocType {
public int anim;

@OriginalMember(owner = "client!ac", name = "y", descriptor = "I")
public int walloff;
public int wallwidth;

@OriginalMember(owner = "client!ac", name = "z", descriptor = "B")
private byte ambient;
Expand All @@ -113,7 +113,7 @@ public class LocType {
private byte contrast;

@OriginalMember(owner = "client!ac", name = "B", descriptor = "[Ljava/lang/String;")
public String[] ops;
public String[] op;

@OriginalMember(owner = "client!ac", name = "C", descriptor = "Z")
private boolean disposeAlpha;
Expand All @@ -140,13 +140,13 @@ public class LocType {
private int resizez;

@OriginalMember(owner = "client!ac", name = "K", descriptor = "I")
private int xoff;
private int offsetx;

@OriginalMember(owner = "client!ac", name = "L", descriptor = "I")
private int yoff;
private int offsety;

@OriginalMember(owner = "client!ac", name = "M", descriptor = "I")
private int zoff;
private int offsetz;

@OriginalMember(owner = "client!ac", name = "N", descriptor = "I")
public int forceapproach;
Expand Down Expand Up @@ -223,10 +223,10 @@ public void reset() {
this.sharelight = false;
this.occlude = false;
this.anim = -1;
this.walloff = 16;
this.wallwidth = 16;
this.ambient = 0;
this.contrast = 0;
this.ops = null;
this.op = null;
this.disposeAlpha = false;
this.mapfunction = -1;
this.mapscene = -1;
Expand All @@ -236,9 +236,9 @@ public void reset() {
this.resizey = 128;
this.resizez = 128;
this.forceapproach = 0;
this.xoff = 0;
this.yoff = 0;
this.zoff = 0;
this.offsetx = 0;
this.offsety = 0;
this.offsetz = 0;
this.forcedecor = false;
}

Expand Down Expand Up @@ -293,19 +293,19 @@ public void decode(@OriginalArg(1) Packet dat) {
} else if (code == 25) {
this.disposeAlpha = true;
} else if (code == 28) {
this.walloff = dat.g1();
this.wallwidth = dat.g1();
} else if (code == 29) {
this.ambient = dat.g1b();
} else if (code == 39) {
this.contrast = dat.g1b();
} else if (code >= 30 && code < 39) {
if (this.ops == null) {
this.ops = new String[5];
if (this.op == null) {
this.op = new String[5];
}

this.ops[code - 30] = dat.gjstr();
if (this.ops[code - 30].equalsIgnoreCase("hidden")) {
this.ops[code - 30] = null;
this.op[code - 30] = dat.gjstr();
if (this.op[code - 30].equalsIgnoreCase("hidden")) {
this.op[code - 30] = null;
}
} else if (code == 40) {
int count = dat.g1();
Expand Down Expand Up @@ -333,11 +333,11 @@ public void decode(@OriginalArg(1) Packet dat) {
} else if (code == 69) {
this.forceapproach = dat.g1();
} else if (code == 70) {
this.xoff = dat.g2b();
this.offsetx = dat.g2b();
} else if (code == 71) {
this.yoff = dat.g2b();
this.offsety = dat.g2b();
} else if (code == 72) {
this.zoff = dat.g2b();
this.offsetz = dat.g2b();
} else if (code == 73) {
this.forcedecor = true;
}
Expand All @@ -350,7 +350,7 @@ public void decode(@OriginalArg(1) Packet dat) {
if (active == -1) {
this.active = this.shapes.length > 0 && this.shapes[0] == 10;

if (this.ops != null) {
if (this.op != null) {
this.active = true;
}
}
Expand Down Expand Up @@ -429,7 +429,7 @@ public Model getModel(@OriginalArg(0) int shape, @OriginalArg(1) int rotation, @
}

@Pc(235) boolean scaled = this.resizex != 128 || this.resizey != 128 || this.resizez != 128;
@Pc(250) boolean translated = this.xoff != 0 || this.yoff != 0 || this.zoff != 0;
@Pc(250) boolean translated = this.offsetx != 0 || this.offsety != 0 || this.offsetz != 0;

@Pc(284) Model modified = new Model(model, this.recol_s == null, !this.disposeAlpha, rotation == 0 && transformId == -1 && !scaled && !translated);
if (transformId != -1) {
Expand All @@ -454,7 +454,7 @@ public Model getModel(@OriginalArg(0) int shape, @OriginalArg(1) int rotation, @
}

if (translated) {
modified.translate(this.yoff, this.xoff, this.zoff);
modified.translate(this.offsety, this.offsetx, this.offsetz);
}

modified.calculateNormals(this.ambient + 64, this.contrast * 5 + 768, -50, -10, -50, !this.sharelight);
Expand Down
31 changes: 17 additions & 14 deletions client/src/main/java/jagex2/config/NpcType.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ public class NpcType {
private int[] recol_d;

@OriginalMember(owner = "client!bc", name = "u", descriptor = "[Ljava/lang/String;")
public String[] ops;
public String[] op;

@OriginalMember(owner = "client!bc", name = "v", descriptor = "I")
private int code90 = -1;
private int resizex = -1;

@OriginalMember(owner = "client!bc", name = "w", descriptor = "I")
private int code91 = -1;
private int resizey = -1;

@OriginalMember(owner = "client!bc", name = "x", descriptor = "I")
private int code92 = -1;
private int resizez = -1;

@OriginalMember(owner = "client!bc", name = "y", descriptor = "Z")
public boolean visonmap = true;
public boolean minimap = true;

@OriginalMember(owner = "client!bc", name = "z", descriptor = "I")
public int vislevel = -1;
Expand Down Expand Up @@ -173,13 +173,13 @@ public void decode(@OriginalArg(1) Packet dat) {
this.walkanim_r = dat.g2();
this.walkanim_l = dat.g2();
} else if (code >= 30 && code < 40) {
if (this.ops == null) {
this.ops = new String[5];
if (this.op == null) {
this.op = new String[5];
}

this.ops[code - 30] = dat.gjstr();
if (this.ops[code - 30].equalsIgnoreCase("hidden")) {
this.ops[code - 30] = null;
this.op[code - 30] = dat.gjstr();
if (this.op[code - 30].equalsIgnoreCase("hidden")) {
this.op[code - 30] = null;
}
} else if (code == 40) {
int count = dat.g1();
Expand All @@ -198,13 +198,16 @@ public void decode(@OriginalArg(1) Packet dat) {
this.heads[i] = dat.g2();
}
} else if (code == 90) {
this.code90 = dat.g2();
// unused
this.resizex = dat.g2();
} else if (code == 91) {
this.code91 = dat.g2();
// unused
this.resizey = dat.g2();
} else if (code == 92) {
this.code92 = dat.g2();
// unused
this.resizez = dat.g2();
} else if (code == 93) {
this.visonmap = false;
this.minimap = false;
} else if (code == 95) {
this.vislevel = dat.g2();
} else if (code == 97) {
Expand Down
28 changes: 14 additions & 14 deletions client/src/main/java/jagex2/config/ObjType.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public class ObjType {
public boolean members;

@OriginalMember(owner = "client!cc", name = "B", descriptor = "[Ljava/lang/String;")
public String[] ops;
public String[] op;

@OriginalMember(owner = "client!cc", name = "C", descriptor = "[Ljava/lang/String;")
public String[] iops;
public String[] iop;

@OriginalMember(owner = "client!cc", name = "D", descriptor = "I")
private int manwear;
Expand Down Expand Up @@ -195,8 +195,8 @@ public static ObjType get(@OriginalArg(0) int id) {
if (!membersWorld && obj.members) {
obj.name = "Members Object";
obj.desc = "Login to a members' server to use this object.";
obj.ops = null;
obj.iops = null;
obj.op = null;
obj.iop = null;
}

return obj;
Expand Down Expand Up @@ -326,8 +326,8 @@ public void reset() {
this.stackable = false;
this.cost = 1;
this.members = false;
this.ops = null;
this.iops = null;
this.op = null;
this.iop = null;
this.manwear = -1;
this.manwear2 = -1;
this.manwearOffsetY = 0;
Expand Down Expand Up @@ -397,20 +397,20 @@ public void decode(@OriginalArg(1) Packet dat) {
} else if (code == 26) {
this.womanwear2 = dat.g2();
} else if (code >= 30 && code < 35) {
if (this.ops == null) {
this.ops = new String[5];
if (this.op == null) {
this.op = new String[5];
}

this.ops[code - 30] = dat.gjstr();
if (this.ops[code - 30].equalsIgnoreCase("hidden")) {
this.ops[code - 30] = null;
this.op[code - 30] = dat.gjstr();
if (this.op[code - 30].equalsIgnoreCase("hidden")) {
this.op[code - 30] = null;
}
} else if (code >= 35 && code < 40) {
if (this.iops == null) {
this.iops = new String[5];
if (this.iop == null) {
this.iop = new String[5];
}

this.iops[code - 35] = dat.gjstr();
this.iop[code - 35] = dat.gjstr();
} else if (code == 40) {
@Pc(260) int count = dat.g1();
this.recol_s = new int[count];
Expand Down
18 changes: 10 additions & 8 deletions client/src/main/java/jagex2/config/SeqType.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SeqType {
public int replayoff = -1;

@OriginalMember(owner = "client!jc", name = "j", descriptor = "[I")
public int[] labelGroups;
public int[] walkmerge;

@OriginalMember(owner = "client!jc", name = "k", descriptor = "Z")
public boolean stretches = false;
Expand All @@ -42,10 +42,10 @@ public class SeqType {
public int priority = 5;

@OriginalMember(owner = "client!jc", name = "m", descriptor = "I")
public int mainhand = -1;
public int righthand = -1;

@OriginalMember(owner = "client!jc", name = "n", descriptor = "I")
public int offhand = -1;
public int lefthand = -1;

@OriginalMember(owner = "client!jc", name = "o", descriptor = "I")
public int replaycount = 99;
Expand Down Expand Up @@ -103,21 +103,23 @@ public void decode(@OriginalArg(1) Packet dat) {
this.replayoff = dat.g2();
} else if (code == 3) {
int count = dat.g1();
this.labelGroups = new int[count + 1];
this.walkmerge = new int[count + 1];

for (@Pc(127) int i = 0; i < count; i++) {
this.labelGroups[i] = dat.g1();
this.walkmerge[i] = dat.g1();
}

this.labelGroups[count] = 9999999;
this.walkmerge[count] = 9999999;
} else if (code == 4) {
this.stretches = true;
} else if (code == 5) {
this.priority = dat.g1();
} else if (code == 6) {
this.mainhand = dat.g2();
// later RS (think RS3) this becomes mainhand
this.righthand = dat.g2();
} else if (code == 7) {
this.offhand = dat.g2();
// later RS (think RS3) this becomes offhand
this.lefthand = dat.g2();
} else if (code == 8) {
this.replaycount = dat.g1();
} else {
Expand Down
12 changes: 6 additions & 6 deletions client/src/main/java/jagex2/dash3d/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static void addLoc(@OriginalArg(7) int level, @OriginalArg(0) int x, @Ori
width = scene.getWallBitset(level, x, z);

if (width > 0) {
offset = LocType.get(width >> 14 & 0x7FFF).walloff;
offset = LocType.get(width >> 14 & 0x7FFF).wallwidth;
}

model2 = loc.getModel(LocType.WALLDECOR_STRAIGHT_NOOFFSET, 0, heightSW, heightSE, heightNW, heightNE, -1);
Expand Down Expand Up @@ -644,8 +644,8 @@ private void addLoc(@OriginalArg(2) int level, @OriginalArg(9) int x, @OriginalA
locs.addTail(new LocEntity(locId, level, 0, x, z, SeqType.instances[loc.anim], true));
}

if (loc.walloff != 16) {
scene.setWallDecorationOffset(level, x, z, loc.walloff);
if (loc.wallwidth != 16) {
scene.setWallDecorationOffset(level, x, z, loc.wallwidth);
}
} else if (shape == LocType.WALL_DIAGONALCORNER) {
model = loc.getModel(LocType.WALL_DIAGONALCORNER, rotation, heightSW, heightSE, heightNW, heightNE, -1);
Expand Down Expand Up @@ -700,8 +700,8 @@ private void addLoc(@OriginalArg(2) int level, @OriginalArg(9) int x, @OriginalA
locs.addTail(new LocEntity(locId, level, 0, x, z, SeqType.instances[loc.anim], true));
}

if (loc.walloff != 16) {
scene.setWallDecorationOffset(level, x, z, loc.walloff);
if (loc.wallwidth != 16) {
scene.setWallDecorationOffset(level, x, z, loc.wallwidth);
}
} else if (shape == LocType.WALL_SQUARECORNER) {
model = loc.getModel(LocType.WALL_SQUARECORNER, rotation, heightSW, heightSE, heightNW, heightNE, -1);
Expand Down Expand Up @@ -748,7 +748,7 @@ private void addLoc(@OriginalArg(2) int level, @OriginalArg(9) int x, @OriginalA
offset = 16;
width = scene.getWallBitset(level, x, z);
if (width > 0) {
offset = LocType.get(width >> 14 & 0x7FFF).walloff;
offset = LocType.get(width >> 14 & 0x7FFF).wallwidth;
}

model1 = loc.getModel(LocType.WALLDECOR_STRAIGHT_NOOFFSET, 0, heightSW, heightSE, heightNW, heightNE, -1);
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/java/jagex2/dash3d/entity/NpcEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private Model getSequencedModel() {
if (super.secondarySeqId >= 0 && super.secondarySeqId != super.seqStandId) {
secondaryTransformId = SeqType.instances[super.secondarySeqId].frames[super.secondarySeqFrame];
}
return this.type.getSequencedModel(primaryTransformId, secondaryTransformId, SeqType.instances[super.primarySeqId].labelGroups);
return this.type.getSequencedModel(primaryTransformId, secondaryTransformId, SeqType.instances[super.primarySeqId].walkmerge);
}

int transformId = -1;
Expand Down
10 changes: 5 additions & 5 deletions client/src/main/java/jagex2/dash3d/entity/PlayerEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ private Model getSequencedModel() {
secondaryTransformId = SeqType.instances[super.secondarySeqId].frames[super.secondarySeqFrame];
}

if (seq.mainhand >= 0) {
rightHandValue = seq.mainhand;
if (seq.righthand >= 0) {
rightHandValue = seq.righthand;
hashCode += (long) rightHandValue - this.appearances[5] << 8;
}

if (seq.offhand >= 0) {
leftHandValue = seq.offhand;
if (seq.lefthand >= 0) {
leftHandValue = seq.lefthand;
hashCode += (long) leftHandValue - this.appearances[3] << 16;
}
} else if (super.secondarySeqId >= 0) {
Expand Down Expand Up @@ -338,7 +338,7 @@ private Model getSequencedModel() {

@Pc(249) Model tmp = new Model(model, true);
if (primaryTransformId != -1 && secondaryTransformId != -1) {
tmp.applyTransforms(primaryTransformId, secondaryTransformId, SeqType.instances[super.primarySeqId].labelGroups);
tmp.applyTransforms(primaryTransformId, secondaryTransformId, SeqType.instances[super.primarySeqId].walkmerge);
} else if (primaryTransformId != -1) {
tmp.applyTransform(primaryTransformId);
}
Expand Down
Loading

0 comments on commit 8b01c6f

Please sign in to comment.