Skip to content

Commit

Permalink
refactor: LocEntity (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeruth authored Jul 13, 2024
1 parent 41a7719 commit 87e4fd9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
28 changes: 14 additions & 14 deletions client/src/main/java/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -9566,9 +9566,9 @@ private void buildScene() {
// NO_TIMEOUT
this.out.p1isaac(108);
for (@Pc(301) LocEntity loc = (LocEntity) this.locList.head(); loc != null; loc = (LocEntity) this.locList.next()) {
if ((this.levelTileFlags[1][loc.heightmapNE][loc.heightmapNW] & 0x2) == 2) {
loc.heightmapSW--;
if (loc.heightmapSW < 0) {
if ((this.levelTileFlags[1][loc.x][loc.z] & 0x2) == 2) {
loc.level--;
if (loc.level < 0) {
loc.unlink();
}
}
Expand Down Expand Up @@ -9891,24 +9891,24 @@ private void pushLocs() {
}

if (append) {
@Pc(96) int level = loc.heightmapSW;
@Pc(99) int x = loc.heightmapNE;
@Pc(102) int z = loc.heightmapNW;
@Pc(96) int level = loc.level;
@Pc(99) int x = loc.x;
@Pc(102) int z = loc.z;

@Pc(104) int bitset = 0;
if (loc.heightmapSE == 0) {
if (loc.type == 0) {
bitset = this.scene.getWallBitset(level, x, z);
}

if (loc.heightmapSE == 1) {
if (loc.type == 1) {
bitset = this.scene.getWallDecorationBitset(level, z, x);
}

if (loc.heightmapSE == 2) {
if (loc.type == 2) {
bitset = this.scene.getLocBitset(level, x, z);
}

if (loc.heightmapSE == 3) {
if (loc.type == 3) {
bitset = this.scene.getGroundDecorationBitset(level, x, z);
}

Expand All @@ -9924,7 +9924,7 @@ private void pushLocs() {
seqId = loc.seq.frames[loc.seqFrame];
}

if (loc.heightmapSE == 2) {
if (loc.type == 2) {
int info = this.scene.getInfo(level, x, z, bitset);
int shape = info & 0x1F;
int rotation = info >> 6;
Expand All @@ -9935,10 +9935,10 @@ private void pushLocs() {

Model model = type.getModel(shape, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, seqId);
this.scene.setLocModel(level, x, z, model);
} else if (loc.heightmapSE == 1) {
} else if (loc.type == 1) {
@Pc(282) Model model = type.getModel(LocType.WALLDECOR_STRAIGHT_NOOFFSET, 0, heightmapSW, heightmapSE, heightmapNE, heightmapNW, seqId);
this.scene.setWallDecorationModel(level, x, z, model);
} else if (loc.heightmapSE == 0) {
} else if (loc.type == 0) {
int info = this.scene.getInfo(level, x, z, bitset);
int shape = info & 0x1F;
int rotation = info >> 6;
Expand All @@ -9952,7 +9952,7 @@ private void pushLocs() {
Model model = type.getModel(shape, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, seqId);
this.scene.setWallModel(level, x, z, model);
}
} else if (loc.heightmapSE == 3) {
} else if (loc.type == 3) {
int info = this.scene.getInfo(level, x, z, bitset);
int rotation = info >> 6;
@Pc(400) Model model = type.getModel(LocType.GROUNDDECOR, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, seqId);
Expand Down
18 changes: 9 additions & 9 deletions runetek3/src/main/java/jagex2/dash3d/entity/LocEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
public class LocEntity extends Linkable {

@OriginalMember(owner = "client!nb", name = "e", descriptor = "I")
public int heightmapSW;
public int level;

@OriginalMember(owner = "client!nb", name = "f", descriptor = "I")
public final int heightmapSE;
public final int type;

@OriginalMember(owner = "client!nb", name = "g", descriptor = "I")
public final int heightmapNE;
public final int x;

@OriginalMember(owner = "client!nb", name = "h", descriptor = "I")
public final int heightmapNW;
public final int z;

@OriginalMember(owner = "client!nb", name = "i", descriptor = "I")
public final int index;
Expand All @@ -34,11 +34,11 @@ public class LocEntity extends Linkable {
public int seqCycle;

@OriginalMember(owner = "client!nb", name = "<init>", descriptor = "(ZIIIILclient!jc;II)V")
public LocEntity(@OriginalArg(1) int index, @OriginalArg(2) int heightmapSW, @OriginalArg(4) int heightmapSE, @OriginalArg(7) int heightmapNE, @OriginalArg(6) int heightmapNW, @OriginalArg(5) SeqType seq, @OriginalArg(0) boolean randomFrame) {
this.heightmapSW = heightmapSW;
this.heightmapSE = heightmapSE;
this.heightmapNE = heightmapNE;
this.heightmapNW = heightmapNW;
public LocEntity(@OriginalArg(1) int index, @OriginalArg(2) int level, @OriginalArg(4) int type, @OriginalArg(7) int x, @OriginalArg(6) int z, @OriginalArg(5) SeqType seq, @OriginalArg(0) boolean randomFrame) {
this.level = level;
this.type = type;
this.x = x;
this.z = z;
this.index = index;
this.seq = seq;

Expand Down

0 comments on commit 87e4fd9

Please sign in to comment.