Improved D2.Entry

Renamed b1 to speed and changed to unsigned byte as short
Renamed b2 to unk1 and changed to unsigned byte as short
Added assertion that zero is really 0
This commit is contained in:
Collin Smith
2019-12-04 02:06:57 -08:00
parent 158de75523
commit a4068ba975

View File

@ -98,7 +98,8 @@ public class D2 {
public String cof;
public int framesPerDir;
public byte b1, b2;
public short speed;
public short unk1;
public short zero;
public byte data[];
@ -106,10 +107,11 @@ public class D2 {
ByteBuffer buffer = ByteBuffer.wrap(IOUtils.readFully(in, SIZE)).order(ByteOrder.LITTLE_ENDIAN);
cof = BufferUtils.readString2(buffer, 8);
framesPerDir = buffer.getInt();
b1 = buffer.get();
b2 = buffer.get();
speed = (short) (buffer.get() & 0xFF);
unk1 = (short) (buffer.get() & 0xFF);
zero = buffer.getShort();
data = BufferUtils.readBytes(buffer, 144);
assert zero == 0;
assert !buffer.hasRemaining();
}
@ -118,8 +120,8 @@ public class D2 {
return new ToStringBuilder(this)
.append("cof", cof)
.append("framesPerDir", framesPerDir)
.append("b1", b1 & 0xFF)
.append("b2", b2 & 0xFF)
.append("speed", speed)
.append("unk1", unk1)
.append("zero", zero)
//.append("data", data)
.build();