Loc/Zone Packets (Partial)

This commit is contained in:
thedaneeffect committed 2022-06-26 10:19:17 -06:00
1 parent ac3938c306
commit e5438f79a4
14 files changed
+2851 -2648

No files matched your search

+79 -64
View File
@@ -5,98 +5,113 @@
public class LocEntity extends Entity {
public static Game game;
public final int[] anIntArray1600;
public final int anInt1601;
public final int anInt1602;
public final int anInt1603;
public final int anInt1604;
public final int anInt1605;
public final int anInt1606;
public final int anInt1610;
public final int anInt1611;
public final int anInt1612;
public int anInt1599;
public SeqType aType_1607;
public int anInt1608;
public final int[] overrideTypeIDs;
public final int varbit;
public final int varp;
public final int heightmapSW;
public final int heightmapSE;
public final int heightmapNE;
public final int heightmapNW;
public final int id;
public final int kind;
public final int rotation;
public int seqFrame;
public SeqType seq;
public int seqCycle;
public LocEntity(int i, int j, int k, int l, int i1, int j1, int k1, int l1, boolean flag) {
anInt1610 = i;
anInt1611 = k;
anInt1612 = j;
anInt1603 = j1;
anInt1604 = l;
anInt1605 = i1;
anInt1606 = k1;
if (l1 != -1) {
aType_1607 = SeqType.instances[l1];
anInt1599 = 0;
anInt1608 = Game.loopCycle;
if (flag && (aType_1607.anInt356 != -1)) {
anInt1599 = (int) (Math.random() * (double) aType_1607.frameCount);
anInt1608 -= (int) (Math.random() * (double) aType_1607.getFrameDelay(anInt1599));
public LocEntity(int id, int rotation, int kind, int heightmapSE, int heightmapNE, int heightmapSW, int heightmapNW, int seqID, boolean randomFrame) {
this.id = id;
this.kind = kind;
this.rotation = rotation;
this.heightmapSW = heightmapSW;
this.heightmapSE = heightmapSE;
this.heightmapNE = heightmapNE;
this.heightmapNW = heightmapNW;
if (seqID != -1) {
seq = SeqType.instances[seqID];
seqFrame = 0;
seqCycle = Game.loopCycle;
if (randomFrame && (seq.speed != -1)) {
seqFrame = (int) (Math.random() * (double) seq.frameCount);
seqCycle -= (int) (Math.random() * (double) seq.getFrameDelay(seqFrame));
}
}
LocType type = LocType.get(anInt1610);
anInt1601 = type.varbit;
anInt1602 = type.varp;
anIntArray1600 = type.overrideIds;
LocType type = LocType.get(this.id);
varbit = type.varbit;
varp = type.varp;
overrideTypeIDs = type.overrideTypeIDs;
}
@Override
public Model getModel() {
int j = -1;
if (aType_1607 != null) {
int k = Game.loopCycle - anInt1608;
if ((k > 100) && (aType_1607.anInt356 > 0)) {
k = 100;
int frame = -1;
if (seq != null) {
int delta = Game.loopCycle - seqCycle;
if ((delta > 100) && (seq.speed > 0)) {
delta = 100;
}
while (k > aType_1607.getFrameDelay(anInt1599)) {
k -= aType_1607.getFrameDelay(anInt1599);
anInt1599++;
if (anInt1599 < aType_1607.frameCount) {
while (delta > seq.getFrameDelay(seqFrame)) {
delta -= seq.getFrameDelay(seqFrame);
seqFrame++;
if (seqFrame < seq.frameCount) {
continue;
}
anInt1599 -= aType_1607.anInt356;
if ((anInt1599 >= 0) && (anInt1599 < aType_1607.frameCount)) {
seqFrame -= seq.speed;
if ((seqFrame >= 0) && (seqFrame < seq.frameCount)) {
continue;
}
aType_1607 = null;
seq = null;
break;
}
anInt1608 = Game.loopCycle - k;
if (aType_1607 != null) {
j = aType_1607.primaryFrames[anInt1599];
seqCycle = Game.loopCycle - delta;
if (seq != null) {
frame = seq.primaryFrames[seqFrame];
}
}
LocType type;
if (anIntArray1600 != null) {
type = method457();
if (overrideTypeIDs != null) {
type = getOverrideType();
} else {
type = LocType.get(anInt1610);
type = LocType.get(id);
}
if (type == null) {
return null;
} else {
return type.method578(anInt1611, anInt1612, anInt1603, anInt1604, anInt1605, anInt1606, j);
return type.getModel(kind, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, frame);
}
}
public LocType method457() {
int i = -1;
if (anInt1601 != -1) {
VarbitType varbit = VarbitType.instances[anInt1601];
int k = varbit.varp;
int l = varbit.lsb;
int i1 = varbit.msb;
int j1 = Game.BITMASK[i1 - l];
i = (game.variables[k] >> l) & j1;
} else if (anInt1602 != -1) {
i = game.variables[anInt1602];
public LocType getOverrideType() {
int value = -1;
if (varbit != -1) {
VarbitType varbit = VarbitType.instances[this.varbit];
int varp = varbit.varp;
int low = varbit.lsb;
int high = varbit.msb;
int mask = Game.BITMASK[high - low];
value = (game.variables[varp] >> low) & mask;
} else if (varp != -1) {
value = game.variables[varp];
}
if ((i < 0) || (i >= anIntArray1600.length) || (anIntArray1600[i] == -1)) {
if ((value < 0) || (value >= overrideTypeIDs.length) || (overrideTypeIDs[value] == -1)) {
return null;
} else {
return LocType.get(anIntArray1600[i]);
return LocType.get(overrideTypeIDs[value]);
}
}