Refactor area npc code

This commit is contained in:
downthecrop 2022-05-30 20:54:20 -07:00
parent 2bb188a6a5
commit e62bf033e3
5 changed files with 181 additions and 175 deletions

View file

@ -225,7 +225,7 @@ public abstract class PathingEntity extends Entity {
private int anInt3427 = 0; private int anInt3427 = 0;
@OriginalMember(owner = "client!fe", name = "Tb", descriptor = "I") @OriginalMember(owner = "client!fe", name = "Tb", descriptor = "I")
private int anInt3415 = 1; private int size = 1;
@OriginalMember(owner = "client!fe", name = "Kb", descriptor = "I") @OriginalMember(owner = "client!fe", name = "Kb", descriptor = "I")
public int anInt3407 = 0; public int anInt3407 = 0;
@ -410,12 +410,12 @@ public abstract class PathingEntity extends Entity {
} }
@OriginalMember(owner = "client!fe", name = "a", descriptor = "(IIII)V") @OriginalMember(owner = "client!fe", name = "a", descriptor = "(IIII)V")
public final void addHit(@OriginalArg(0) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) int arg2) { public final void addHit(@OriginalArg(0) int color, @OriginalArg(2) int arg1, @OriginalArg(3) int hitValue) {
for (@Pc(11) int local11 = 0; local11 < 4; local11++) { for (@Pc(11) int i = 0; i < 4; i++) {
if (arg1 >= this.anIntArray319[local11]) { if (arg1 >= this.anIntArray319[i]) {
this.anIntArray322[local11] = arg2; this.anIntArray322[i] = hitValue;
this.anIntArray321[local11] = arg0; this.anIntArray321[i] = color;
this.anIntArray319[local11] = arg1 + 70; this.anIntArray319[i] = arg1 + 70;
return; return;
} }
} }
@ -637,12 +637,12 @@ public abstract class PathingEntity extends Entity {
} }
@OriginalMember(owner = "client!fe", name = "a", descriptor = "(II)V") @OriginalMember(owner = "client!fe", name = "a", descriptor = "(II)V")
public final void method2692(@OriginalArg(0) int arg0) { public final void setSize(@OriginalArg(0) int size) {
this.anInt3415 = arg0; this.size = size;
} }
@OriginalMember(owner = "client!fe", name = "c", descriptor = "(B)I") @OriginalMember(owner = "client!fe", name = "c", descriptor = "(B)I")
public int getSize() { public int getSize() {
return this.anInt3415; return this.size;
} }
} }

View file

@ -214,7 +214,7 @@ public final class Player extends PathingEntity {
@Pc(37) boolean local37 = (local20 & 0x4) != 0; @Pc(37) boolean local37 = (local20 & 0x4) != 0;
@Pc(41) int local41 = super.getSize(); @Pc(41) int local41 = super.getSize();
@Pc(44) int[] local44 = new int[12]; @Pc(44) int[] local44 = new int[12];
this.method2692((local20 >> 3 & 0x7) + 1); this.setSize((local20 >> 3 & 0x7) + 1);
this.anInt1651 = local20 >> 6 & 0x3; this.anInt1651 = local20 >> 6 & 0x3;
this.xFine += (this.getSize() - local41) * 64; this.xFine += (this.getSize() - local41) * 64;
this.zFine += (this.getSize() - local41) * 64; this.zFine += (this.getSize() - local41) * 64;

View file

@ -374,10 +374,7 @@ public class Protocol {
LoginManager.locationsMapFileIds = new int[local20]; LoginManager.locationsMapFileIds = new int[local20];
LoginManager.underWaterLocationsMapFileIds = new int[local20]; LoginManager.underWaterLocationsMapFileIds = new int[local20];
local20 = 0; local20 = 0;
@Pc(100) boolean local100 = false; @Pc(100) boolean local100 = (local31 / 8 == 48 || local31 / 8 == 49) && local60 / 8 == 48;
if ((local31 / 8 == 48 || local31 / 8 == 49) && local60 / 8 == 48) {
local100 = true;
}
if (local31 / 8 == 48 && local60 / 8 == 148) { if (local31 / 8 == 48 && local60 / 8 == 148) {
local100 = true; local100 = true;
} }
@ -608,10 +605,7 @@ public class Protocol {
int1 = -1; int1 = -1;
} }
int2 = inboundBuffer.g4me(); int2 = inboundBuffer.g4me();
@Pc(573) boolean local573 = true; @Pc(573) boolean local573 = int1 == -1 || player.spotAnimId == -1 || SeqTypeList.get(SpotAnimTypeList.get(int1).seqId).forcedPriority >= SeqTypeList.get(SpotAnimTypeList.get(player.spotAnimId).seqId).forcedPriority;
if (int1 != -1 && player.spotAnimId != -1 && SeqTypeList.get(SpotAnimTypeList.get(int1).seqId).forcedPriority < SeqTypeList.get(SpotAnimTypeList.get(player.spotAnimId).seqId).forcedPriority) {
local573 = false;
}
if (local573) { if (local573) {
player.spotAnimStart = (int2 & 0xFFFF) + client.loop; player.spotAnimStart = (int2 & 0xFFFF) + client.loop;
player.anInt3361 = 0; player.anInt3361 = 0;
@ -1649,14 +1643,14 @@ public class Protocol {
int tracknum = inboundBuffer.g2sub(); int tracknum = inboundBuffer.g2sub();
int target = inboundBuffer.g4rme(); int target = inboundBuffer.g4rme();
setVerifyId(tracknum); setVerifyId(tracknum);
@Pc(3449) ComponentPointer src = (ComponentPointer) InterfaceList.openInterfaces.get((long) source); @Pc(3449) ComponentPointer src = (ComponentPointer) InterfaceList.openInterfaces.get(source);
ComponentPointer tgt = (ComponentPointer) InterfaceList.openInterfaces.get((long) target); ComponentPointer tgt = (ComponentPointer) InterfaceList.openInterfaces.get(target);
if (tgt != null) { if (tgt != null) {
Static132.closeInterface(src == null || tgt.anInt5878 != src.anInt5878, tgt); Static132.closeInterface(src == null || tgt.anInt5878 != src.anInt5878, tgt);
} }
if (src != null) { if (src != null) {
src.unlink(); src.unlink();
InterfaceList.openInterfaces.put(src, (long) target); InterfaceList.openInterfaces.put(src, target);
} }
@Pc(3490) Component component = InterfaceList.getComponent(source); @Pc(3490) Component component = InterfaceList.getComponent(source);
if (component != null) { if (component != null) {
@ -2132,10 +2126,7 @@ public class Protocol {
long name37 = inboundBuffer.g8(); long name37 = inboundBuffer.g8();
int worldId = inboundBuffer.g2(); int worldId = inboundBuffer.g2();
@Pc(5325) byte rights = inboundBuffer.g1s(); @Pc(5325) byte rights = inboundBuffer.g1s();
boolean ignored = false; boolean ignored = (Long.MIN_VALUE & name37) != 0L;
if ((Long.MIN_VALUE & name37) != 0L) {
ignored = true;
}
if (ignored) { if (ignored) {
if (ClanChat.size == 0) { if (ClanChat.size == 0) {
opcode = -1; opcode = -1;
@ -2940,107 +2931,122 @@ public class Protocol {
} }
@OriginalMember(owner = "client!ta", name = "a", descriptor = "(I)V") @OriginalMember(owner = "client!ta", name = "a", descriptor = "(I)V")
public static void method4014() { public static void npcCombat() {
for (@Pc(3) int local3 = 0; local3 < extendedCount; local3++) { for (@Pc(3) int i = 0; i < extendedCount; i++) {
@Pc(10) int local10 = extendedIds[local3]; @Pc(10) int extendedId = extendedIds[i];
@Pc(14) Npc local14 = NpcList.npcs[local10]; @Pc(14) Npc npc = NpcList.npcs[extendedId];
@Pc(18) int local18 = inboundBuffer.g1(); @Pc(18) int local18 = inboundBuffer.g1();
@Pc(43) int local43;
@Pc(47) int local47;
//idk
if ((local18 & 0x8) != 0) { if ((local18 & 0x8) != 0) {
local18 += inboundBuffer.g1() << 8; local18 += inboundBuffer.g1() << 8;
} }
@Pc(43) int local43;
@Pc(47) int local47; boolean hasHitsplat = (local18 & 0x40) != 0;
if ((local18 & 0x40) != 0) { if (hasHitsplat) {
local43 = inboundBuffer.g1(); local43 = inboundBuffer.g1(); // Hit value
local47 = inboundBuffer.g1neg(); local47 = inboundBuffer.g1neg(); // Color
local14.addHit(local47, client.loop, local43); npc.addHit(local47, client.loop, local43);
local14.hitpointsBarVisibleUntil = client.loop + 300; npc.hitpointsBarVisibleUntil = client.loop + 300;
local14.hitpointsBar = inboundBuffer.g1ssub(); npc.hitpointsBar = inboundBuffer.g1ssub();
} }
if ((local18 & 0x2) != 0) {
local43 = inboundBuffer.g1neg(); boolean hasSecondaryHitsplat = (local18 & 0x2) != 0;
local47 = inboundBuffer.g1ssub(); if (hasSecondaryHitsplat) {
local14.addHit(local47, client.loop, local43); local43 = inboundBuffer.g1neg(); // Hit value
local47 = inboundBuffer.g1ssub(); // Color
npc.addHit(local47, client.loop, local43);
} }
if ((local18 & 0x10) != 0) {
local43 = inboundBuffer.g2(); boolean hasAnimation = (local18 & 0x10) != 0;
local47 = inboundBuffer.g1(); if (hasAnimation) {
local43 = inboundBuffer.g2(); // Animation ID
local47 = inboundBuffer.g1(); // Sequence
if (local43 == 65535) { if (local43 == 65535) {
local43 = -1; local43 = -1;
} }
Static223.animateNpc(local47, local43, local14); Static223.animateNpc(local47, local43, npc);
} }
if ((local18 & 0x4) != 0) {
local14.faceEntity = inboundBuffer.g2sub(); boolean hasFaceEntity = (local18 & 0x4) != 0;
if (local14.faceEntity == 65535) { if (hasFaceEntity) {
local14.faceEntity = -1; npc.faceEntity = inboundBuffer.g2sub();
if (npc.faceEntity == 65535) {
npc.faceEntity = -1;
} }
} }
if ((local18 & 0x80) != 0) {
boolean isKillingBlow = (local18 & 0x80) != 0;
if (isKillingBlow) {
local43 = inboundBuffer.g2sub(); local43 = inboundBuffer.g2sub();
if (local43 == 65535) { if (local43 == 65535) {
local43 = -1; local43 = -1;
} }
local47 = inboundBuffer.g4le(); local47 = inboundBuffer.g4le();
@Pc(147) boolean local147 = true; @Pc(147) boolean local147 = local43 == -1 || npc.spotAnimId == -1 || SeqTypeList.get(SpotAnimTypeList.get(local43).seqId).forcedPriority >= SeqTypeList.get(SpotAnimTypeList.get(npc.spotAnimId).seqId).forcedPriority;
if (local43 != -1 && local14.spotAnimId != -1 && SeqTypeList.get(SpotAnimTypeList.get(local43).seqId).forcedPriority < SeqTypeList.get(SpotAnimTypeList.get(local14.spotAnimId).seqId).forcedPriority) {
local147 = false;
}
if (local147) { if (local147) {
local14.spotAnimId = local43; npc.spotAnimId = local43;
local14.spotAnimStart = (local47 & 0xFFFF) + client.loop; npc.spotAnimStart = (local47 & 0xFFFF) + client.loop;
local14.anInt3361 = 0; npc.anInt3361 = 0;
local14.anInt3399 = 0; npc.anInt3399 = 0;
local14.spotAnimY = local47 >> 16; npc.spotAnimY = local47 >> 16;
local14.anInt3418 = 1; npc.anInt3418 = 1;
if (local14.spotAnimStart > client.loop) { if (npc.spotAnimStart > client.loop) {
local14.anInt3399 = -1; npc.anInt3399 = -1;
} }
if (local14.spotAnimId != -1 && local14.spotAnimStart == client.loop) { if (npc.spotAnimId != -1 && npc.spotAnimStart == client.loop) {
@Pc(227) int local227 = SpotAnimTypeList.get(local14.spotAnimId).seqId; @Pc(227) int seqId = SpotAnimTypeList.get(npc.spotAnimId).seqId;
if (local227 != -1) { if (seqId != -1) {
@Pc(236) SeqType local236 = SeqTypeList.get(local227); @Pc(236) SeqType seqType = SeqTypeList.get(seqId);
if (local236 != null && local236.frames != null) { if (seqType.frames != null) {
SoundPlayer.playSeqSound(local14.zFine, local236, local14.xFine, false, 0); SoundPlayer.playSeqSound(npc.zFine, seqType, npc.xFine, false, 0);
} }
} }
} }
} }
} }
if ((local18 & 0x1) != 0) {
if (local14.type.hasAreaSound()) { boolean hasSound = (local18 & 0x1) != 0;
AreaSoundManager.remove(local14); if (hasSound) {
if (npc.type.hasAreaSound()) {
AreaSoundManager.remove(npc);
} }
local14.setNpcType(NpcTypeList.get(inboundBuffer.g2le())); npc.setNpcType(NpcTypeList.get(inboundBuffer.g2le()));
local14.method2692(local14.type.size); npc.setSize(npc.type.size);
local14.anInt3365 = local14.type.basId; npc.anInt3365 = npc.type.basId;
if (local14.type.hasAreaSound()) { if (npc.type.hasAreaSound()) {
AreaSoundManager.add(local14.movementQueueZ[0], null, 0, local14, local14.movementQueueX[0], Player.level, null); AreaSoundManager.add(npc.movementQueueZ[0], null, 0, npc, npc.movementQueueX[0], Player.level, null);
} }
} }
if ((local18 & 0x20) != 0) {
local14.chatMessage = inboundBuffer.gjstr(); boolean hasChatMessage = (local18 & 0x20) != 0;
local14.chatLoops = 100; if (hasChatMessage) {
npc.chatMessage = inboundBuffer.gjstr();
npc.chatLoops = 100;
} }
if ((local18 & 0x100) != 0) { if ((local18 & 0x100) != 0) {
local43 = inboundBuffer.g1neg(); local43 = inboundBuffer.g1neg();
@Pc(331) int[] local331 = new int[local43]; @Pc(331) int[] local331 = new int[local43];
@Pc(334) int[] local334 = new int[local43]; @Pc(334) int[] local334 = new int[local43];
@Pc(337) int[] local337 = new int[local43]; @Pc(337) int[] local337 = new int[local43];
for (@Pc(339) int local339 = 0; local339 < local43; local339++) { for (@Pc(339) int i1 = 0; i1 < local43; i1++) {
@Pc(350) int local350 = inboundBuffer.g2le(); @Pc(350) int local350 = inboundBuffer.g2le();
if (local350 == 65535) { if (local350 == 65535) {
local350 = -1; local350 = -1;
} }
local331[local339] = local350; local331[i1] = local350;
local334[local339] = inboundBuffer.g1ssub(); local334[i1] = inboundBuffer.g1ssub();
local337[local339] = inboundBuffer.g2(); local337[i1] = inboundBuffer.g2();
} }
Static159.method3037(local337, local14, local334, local331); Static159.method3037(local337, npc, local334, local331);
} }
if ((local18 & 0x200) != 0) {
local14.faceX = inboundBuffer.g2sub(); boolean hasFaceLocation = (local18 & 0x200) != 0;
local14.faceY = inboundBuffer.g2(); if (hasFaceLocation) {
npc.faceX = inboundBuffer.g2sub();
npc.faceY = inboundBuffer.g2();
} }
} }
} }
@ -3049,87 +3055,87 @@ public class Protocol {
public static void readNpcPacket() { public static void readNpcPacket() {
extendedCount = 0; extendedCount = 0;
removedCount = 0; removedCount = 0;
method1202(); clearAreaNPCs();
method4645(); loadAreaNPCs();
method4014(); npcCombat();
@Pc(19) int local19; @Pc(19) int i;
for (local19 = 0; local19 < removedCount; local19++) { for (i = 0; i < removedCount; i++) {
@Pc(30) int local30 = removedIds[local19]; @Pc(30) int removedId = removedIds[i];
if (NpcList.npcs[local30].lastSeenLoop != client.loop) { if (NpcList.npcs[removedId].lastSeenLoop != client.loop) {
if (NpcList.npcs[local30].type.hasAreaSound()) { if (NpcList.npcs[removedId].type.hasAreaSound()) {
AreaSoundManager.remove(NpcList.npcs[local30]); AreaSoundManager.remove(NpcList.npcs[removedId]);
} }
NpcList.npcs[local30].setNpcType(null); NpcList.npcs[removedId].setNpcType(null);
NpcList.npcs[local30] = null; NpcList.npcs[removedId] = null;
} }
} }
if (length != inboundBuffer.offset) { if (length != inboundBuffer.offset) {
throw new RuntimeException("gnp1 pos:" + inboundBuffer.offset + " psize:" + length); throw new RuntimeException("gnp1 pos:" + inboundBuffer.offset + " psize:" + length);
} }
for (local19 = 0; local19 < NpcList.size; local19++) { for (i = 0; i < NpcList.size; i++) {
if (NpcList.npcs[NpcList.ids[local19]] == null) { if (NpcList.npcs[NpcList.ids[i]] == null) {
throw new RuntimeException("gnp2 pos:" + local19 + " size:" + NpcList.size); throw new RuntimeException("gnp2 pos:" + i + " size:" + NpcList.size);
} }
} }
} }
@OriginalMember(owner = "client!dm", name = "a", descriptor = "(B)V") @OriginalMember(owner = "client!dm", name = "a", descriptor = "(B)V")
public static void method1202() { public static void clearAreaNPCs() {
inboundBuffer.accessBits(); inboundBuffer.accessBits();
@Pc(13) int local13 = inboundBuffer.gBits(8); @Pc(13) int npcsInArea = inboundBuffer.gBits(8);
@Pc(22) int local22; @Pc(22) int i;
if (NpcList.size > local13) { if (NpcList.size > npcsInArea) {
for (local22 = local13; local22 < NpcList.size; local22++) { for (i = npcsInArea; i < NpcList.size; i++) {
removedIds[removedCount++] = NpcList.ids[local22]; removedIds[removedCount++] = NpcList.ids[i];
} }
} }
if (NpcList.size < local13) { if (NpcList.size < npcsInArea) {
throw new RuntimeException("gnpov1"); throw new RuntimeException("gnpov1");
} }
NpcList.size = 0; NpcList.size = 0;
for (local22 = 0; local22 < local13; local22++) { for (i = 0; i < npcsInArea; i++) {
@Pc(61) int local61 = NpcList.ids[local22]; @Pc(61) int id = NpcList.ids[i];
@Pc(65) Npc local65 = NpcList.npcs[local61]; @Pc(65) Npc npc = NpcList.npcs[id];
@Pc(70) int local70 = inboundBuffer.gBits(1); @Pc(70) int local70 = inboundBuffer.gBits(1);
if (local70 == 0) { if (local70 == 0) {
NpcList.ids[NpcList.size++] = local61; NpcList.ids[NpcList.size++] = id;
local65.lastSeenLoop = client.loop; npc.lastSeenLoop = client.loop;
} else { } else {
@Pc(92) int local92 = inboundBuffer.gBits(2); @Pc(92) int local92 = inboundBuffer.gBits(2);
if (local92 == 0) { if (local92 == 0) {
NpcList.ids[NpcList.size++] = local61; NpcList.ids[NpcList.size++] = id;
local65.lastSeenLoop = client.loop; npc.lastSeenLoop = client.loop;
extendedIds[extendedCount++] = local61; extendedIds[extendedCount++] = id;
} else { } else {
@Pc(139) int local139; @Pc(139) int local139;
@Pc(149) int local149; @Pc(149) int local149;
if (local92 == 1) { if (local92 == 1) {
NpcList.ids[NpcList.size++] = local61; NpcList.ids[NpcList.size++] = id;
local65.lastSeenLoop = client.loop; npc.lastSeenLoop = client.loop;
local139 = inboundBuffer.gBits(3); local139 = inboundBuffer.gBits(3);
local65.move(1, local139); npc.move(1, local139);
local149 = inboundBuffer.gBits(1); local149 = inboundBuffer.gBits(1);
if (local149 == 1) { if (local149 == 1) {
extendedIds[extendedCount++] = local61; extendedIds[extendedCount++] = id;
} }
} else if (local92 == 2) { } else if (local92 == 2) {
NpcList.ids[NpcList.size++] = local61; NpcList.ids[NpcList.size++] = id;
local65.lastSeenLoop = client.loop; npc.lastSeenLoop = client.loop;
if (inboundBuffer.gBits(1) == 1) { if (inboundBuffer.gBits(1) == 1) {
local139 = inboundBuffer.gBits(3); local139 = inboundBuffer.gBits(3);
local65.move(2, local139); npc.move(2, local139);
local149 = inboundBuffer.gBits(3); local149 = inboundBuffer.gBits(3);
local65.move(2, local149); npc.move(2, local149);
} else { } else {
local139 = inboundBuffer.gBits(3); local139 = inboundBuffer.gBits(3);
local65.move(0, local139); npc.move(0, local139);
} }
local139 = inboundBuffer.gBits(1); local139 = inboundBuffer.gBits(1);
if (local139 == 1) { if (local139 == 1) {
extendedIds[extendedCount++] = local61; extendedIds[extendedCount++] = id;
} }
} else if (local92 == 3) { } else if (local92 == 3) {
removedIds[removedCount++] = local61; removedIds[removedCount++] = id;
} }
} }
} }
@ -3137,33 +3143,33 @@ public class Protocol {
} }
@OriginalMember(owner = "client!wj", name = "a", descriptor = "(I)V") @OriginalMember(owner = "client!wj", name = "a", descriptor = "(I)V")
public static void method4645() { public static void loadAreaNPCs() {
while (true) { while (true) {
if (inboundBuffer.method2241(length) >= 27) { if (inboundBuffer.method2241(length) >= 27) {
@Pc(14) int local14 = inboundBuffer.gBits(15); @Pc(14) int npcIndex = inboundBuffer.gBits(15);
if (local14 != 32767) { if (npcIndex != 32767) {
@Pc(19) boolean local19 = false; @Pc(19) boolean local19 = false;
if (NpcList.npcs[local14] == null) { if (NpcList.npcs[npcIndex] == null) {
local19 = true; local19 = true;
NpcList.npcs[local14] = new Npc(); NpcList.npcs[npcIndex] = new Npc();
} }
@Pc(37) Npc local37 = NpcList.npcs[local14]; @Pc(37) Npc npc = NpcList.npcs[npcIndex];
NpcList.ids[NpcList.size++] = local14; NpcList.ids[NpcList.size++] = npcIndex;
local37.lastSeenLoop = client.loop; npc.lastSeenLoop = client.loop;
if (local37.type != null && local37.type.hasAreaSound()) { if (npc.type != null && npc.type.hasAreaSound()) {
AreaSoundManager.remove(local37); AreaSoundManager.remove(npc);
} }
@Pc(66) int local66 = inboundBuffer.gBits(1); @Pc(66) int local66 = inboundBuffer.gBits(1);
@Pc(73) int local73 = PathingEntity.ANGLES[inboundBuffer.gBits(3)]; @Pc(73) int angle = PathingEntity.ANGLES[inboundBuffer.gBits(3)];
if (local19) { if (local19) {
local37.anInt3400 = local37.anInt3381 = local73; npc.anInt3400 = npc.anInt3381 = angle;
} }
@Pc(86) int local86 = inboundBuffer.gBits(1); @Pc(86) int local86 = inboundBuffer.gBits(1);
if (local86 == 1) { if (local86 == 1) {
extendedIds[extendedCount++] = local14; extendedIds[extendedCount++] = npcIndex;
} }
@Pc(105) int local105 = inboundBuffer.gBits(5); @Pc(105) int local105 = inboundBuffer.gBits(5);
local37.setNpcType(NpcTypeList.get(inboundBuffer.gBits(14))); npc.setNpcType(NpcTypeList.get(inboundBuffer.gBits(14)));
if (local105 > 15) { if (local105 > 15) {
local105 -= 32; local105 -= 32;
} }
@ -3171,15 +3177,15 @@ public class Protocol {
if (local124 > 15) { if (local124 > 15) {
local124 -= 32; local124 -= 32;
} }
local37.method2692(local37.type.size); npc.setSize(npc.type.size);
local37.anInt3365 = local37.type.basId; npc.anInt3365 = npc.type.basId;
local37.anInt3376 = local37.type.anInt3733; npc.anInt3376 = npc.type.anInt3733;
if (local37.anInt3376 == 0) { if (npc.anInt3376 == 0) {
local37.anInt3381 = 0; npc.anInt3381 = 0;
} }
local37.method2683(local37.getSize(), PlayerList.self.movementQueueX[0] + local124, local105 + PlayerList.self.movementQueueZ[0], local66 == 1); npc.method2683(npc.getSize(), PlayerList.self.movementQueueX[0] + local124, local105 + PlayerList.self.movementQueueZ[0], local66 == 1);
if (local37.type.hasAreaSound()) { if (npc.type.hasAreaSound()) {
AreaSoundManager.add(local37.movementQueueZ[0], null, 0, local37, local37.movementQueueX[0], Player.level, null); AreaSoundManager.add(npc.movementQueueZ[0], null, 0, npc, npc.movementQueueX[0], Player.level, null);
} }
continue; continue;
} }
@ -3203,14 +3209,14 @@ public class Protocol {
} }
@OriginalMember(owner = "client!wc", name = "a", descriptor = "(Lclient!wa;I)V") @OriginalMember(owner = "client!wc", name = "a", descriptor = "(Lclient!wa;I)V")
public static void writeRandom(@OriginalArg(0) Buffer arg0) { public static void writeRandom(@OriginalArg(0) Buffer buffer) {
if (client.uid != null) { if (client.uid != null) {
try { try {
client.uid.seek(0L); client.uid.seek(0L);
client.uid.write(arg0.data, arg0.offset, 24); client.uid.write(buffer.data, buffer.offset, 24);
} catch (@Pc(16) Exception local16) { } catch (@Pc(16) Exception local16) {
} }
} }
arg0.offset += 24; buffer.offset += 24;
} }
} }

View file

@ -43,7 +43,7 @@ public final class Static158 {
NpcList.ids[NpcList.size++] = local97; NpcList.ids[NpcList.size++] = local97;
local198.lastSeenLoop = client.loop; local198.lastSeenLoop = client.loop;
local198.setNpcType(local148); local198.setNpcType(local148);
local198.method2692(local198.type.size); local198.setSize(local198.type.size);
local198.anInt3400 = local198.anInt3381 = PathingEntity.ANGLES[local198.type.aByte11]; local198.anInt3400 = local198.anInt3381 = PathingEntity.ANGLES[local198.type.aByte11];
local198.anInt3376 = local198.type.anInt3733; local198.anInt3376 = local198.type.anInt3733;
if (local198.anInt3376 == 0) { if (local198.anInt3376 == 0) {

View file

@ -10,31 +10,31 @@ public final class Static223 {
public static final boolean[] aBooleanArray116 = new boolean[100]; public static final boolean[] aBooleanArray116 = new boolean[100];
@OriginalMember(owner = "client!sc", name = "a", descriptor = "(IIILclient!km;)V") @OriginalMember(owner = "client!sc", name = "a", descriptor = "(IIILclient!km;)V")
public static void animateNpc(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(3) Npc arg2) { public static void animateNpc(@OriginalArg(0) int arg0, @OriginalArg(1) int animationId, @OriginalArg(3) Npc npc) {
if (arg2.seqId == arg1 && arg1 != -1) { if (npc.seqId == animationId && animationId != -1) {
@Pc(10) SeqType local10 = SeqTypeList.get(arg1); @Pc(10) SeqType seqType = SeqTypeList.get(animationId);
@Pc(13) int local13 = local10.anInt5347; @Pc(13) int local13 = seqType.anInt5347;
if (local13 == 1) { if (local13 == 1) {
arg2.anInt3373 = 1; npc.anInt3373 = 1;
arg2.anInt3425 = 0; npc.anInt3425 = 0;
arg2.anInt3360 = 0; npc.anInt3360 = 0;
arg2.anInt3371 = 0; npc.anInt3371 = 0;
arg2.anInt3420 = arg0; npc.anInt3420 = arg0;
SoundPlayer.playSeqSound(arg2.zFine, local10, arg2.xFine, false, arg2.anInt3425); SoundPlayer.playSeqSound(npc.zFine, seqType, npc.xFine, false, npc.anInt3425);
} }
if (local13 == 2) { if (local13 == 2) {
arg2.anInt3371 = 0; npc.anInt3371 = 0;
} }
} else if (arg1 == -1 || arg2.seqId == -1 || SeqTypeList.get(arg1).forcedPriority >= SeqTypeList.get(arg2.seqId).forcedPriority) { } else if (animationId == -1 || npc.seqId == -1 || SeqTypeList.get(animationId).forcedPriority >= SeqTypeList.get(npc.seqId).forcedPriority) {
arg2.anInt3360 = 0; npc.anInt3360 = 0;
arg2.seqId = arg1; npc.seqId = animationId;
arg2.anInt3373 = 1; npc.anInt3373 = 1;
arg2.anInt3371 = 0; npc.anInt3371 = 0;
arg2.anInt3420 = arg0; npc.anInt3420 = arg0;
arg2.anInt3405 = arg2.movementQueueSize; npc.anInt3405 = npc.movementQueueSize;
arg2.anInt3425 = 0; npc.anInt3425 = 0;
if (arg2.seqId != -1) { if (npc.seqId != -1) {
SoundPlayer.playSeqSound(arg2.zFine, SeqTypeList.get(arg2.seqId), arg2.xFine, false, arg2.anInt3425); SoundPlayer.playSeqSound(npc.zFine, SeqTypeList.get(npc.seqId), npc.xFine, false, npc.anInt3425);
} }
} }
} }