Renamed: Buffer#readU*
Refactored: Censor (mostly)
This commit is contained in:
1 parent
9bac90c50a
commit
6f9ff70b14
28 files changed
+1027
-975
No files matched your search
@@ -16,33 +16,33 @@ public class BitmapFont {
|
||||
public BitmapFont(FileArchive archive, String name, boolean quill) throws IOException {
|
||||
Buffer dat = new Buffer(archive.read(name + ".dat"));
|
||||
Buffer idx = new Buffer(archive.read("index.dat"));
|
||||
idx.position = dat.read16U() + 4;
|
||||
idx.position = dat.readU16() + 4;
|
||||
|
||||
int k = idx.read8U();
|
||||
int k = idx.readU8();
|
||||
|
||||
if (k > 0) {
|
||||
idx.position += 3 * (k - 1);
|
||||
}
|
||||
|
||||
for (int c = 0; c < 256; c++) {
|
||||
charOffsetX[c] = idx.read8U();
|
||||
charOffsetY[c] = idx.read8U();
|
||||
charOffsetX[c] = idx.readU8();
|
||||
charOffsetY[c] = idx.readU8();
|
||||
|
||||
int w = charMaskWidth[c] = idx.read16U();
|
||||
int h = charMaskHeight[c] = idx.read16U();
|
||||
int storeOrder = idx.read8U();
|
||||
int w = charMaskWidth[c] = idx.readU16();
|
||||
int h = charMaskHeight[c] = idx.readU16();
|
||||
int storeOrder = idx.readU8();
|
||||
|
||||
int len = w * h;
|
||||
charMask[c] = new byte[len];
|
||||
|
||||
if (storeOrder == 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
charMask[c][i] = dat.read();
|
||||
charMask[c][i] = dat.read8();
|
||||
}
|
||||
} else if (storeOrder == 1) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
for (int y = 0; y < h; y++) {
|
||||
charMask[c][x + (y * w)] = dat.read();
|
||||
charMask[c][x + (y * w)] = dat.read8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -6,7 +6,7 @@ import java.nio.charset.StandardCharsets;
|
||||
/**
|
||||
* A {@link Buffer} encapsulates a finite amount of data and provides methods for reading and writing to that data.
|
||||
* The <code>write()</code> and <code>read()</code> methods describe the type of data they use by attributes in their
|
||||
* suffix. The naming convention is <code>(read|write)[type][U:unsigned][endianness][modifier]</code>.
|
||||
* suffix. The naming convention is <code>(read[U:unsigned]|write)[type][endianness][modifier]</code>.
|
||||
* <p>
|
||||
* <b>Types:</b><br/>
|
||||
* # — the number of bytes<br/>
|
||||
@@ -135,7 +135,7 @@ public class Buffer extends DoublyLinkedList.Node {
|
||||
}
|
||||
}
|
||||
|
||||
public byte read() {
|
||||
public byte read8() {
|
||||
return data[position++];
|
||||
}
|
||||
|
||||
@@ -147,19 +147,19 @@ public class Buffer extends DoublyLinkedList.Node {
|
||||
return (byte) (128 - data[position++]);
|
||||
}
|
||||
|
||||
public int read8U() {
|
||||
public int readU8() {
|
||||
return data[position++] & 0xff;
|
||||
}
|
||||
|
||||
public int read8UA() {
|
||||
public int readU8A() {
|
||||
return (data[position++] - 128) & 0xff;
|
||||
}
|
||||
|
||||
public int read8UC() {
|
||||
public int readU8C() {
|
||||
return -data[position++] & 0xff;
|
||||
}
|
||||
|
||||
public int read8US() {
|
||||
public int readU8S() {
|
||||
return (128 - data[position++]) & 0xff;
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ public class Buffer extends DoublyLinkedList.Node {
|
||||
*/
|
||||
public int readSmart() {
|
||||
if ((data[position] & 0xff) < 128) {
|
||||
return read8U() - 64;
|
||||
return readU8() - 64;
|
||||
} else {
|
||||
return read16U() - 49152;
|
||||
return readU16() - 49152;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,30 +181,30 @@ public class Buffer extends DoublyLinkedList.Node {
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
public int readSmartU() {
|
||||
public int readUSmart() {
|
||||
if ((data[position] & 0xff) < 128) {
|
||||
return read8U();
|
||||
return readU8();
|
||||
} else {
|
||||
return read16U() - 32768;
|
||||
return readU16() - 32768;
|
||||
}
|
||||
}
|
||||
|
||||
public int read16U() {
|
||||
public int readU16() {
|
||||
position += 2;
|
||||
return ((data[position - 2] & 0xff) << 8) + (data[position - 1] & 0xff);
|
||||
}
|
||||
|
||||
public int read16UA() {
|
||||
public int readU16A() {
|
||||
position += 2;
|
||||
return ((data[position - 2] & 0xff) << 8) + ((data[position - 1] - 128) & 0xff);
|
||||
}
|
||||
|
||||
public int read16ULE() {
|
||||
public int readU16LE() {
|
||||
position += 2;
|
||||
return ((data[position - 1] & 0xff) << 8) + (data[position - 2] & 0xff);
|
||||
}
|
||||
|
||||
public int read16ULEA() {
|
||||
public int readU16LEA() {
|
||||
position += 2;
|
||||
return ((data[position - 1] & 0xff) << 8) + ((data[position - 2] - 128) & 0xff);
|
||||
}
|
||||
|
||||
+484
-432
File diff suppressed because it is too large.
Load diff
@@ -19,7 +19,7 @@ public final class ChatCompression {
|
||||
int carry = -1;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
int value = in.read8U();
|
||||
int value = in.readU8();
|
||||
int nibble = (value >> 4) & 0b1111;
|
||||
|
||||
if (carry == -1) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FileArchive {
|
||||
unpacked = false;
|
||||
}
|
||||
|
||||
fileCount = buffer.read16U();
|
||||
fileCount = buffer.readU16();
|
||||
fileHash = new int[fileCount];
|
||||
fileSizeInflated = new int[fileCount];
|
||||
fileSizeDeflated = new int[fileCount];
|
||||
|
||||
@@ -11,7 +11,7 @@ public class FloType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("flo.dat"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
if (instances == null) {
|
||||
instances = new FloType[count];
|
||||
}
|
||||
@@ -38,14 +38,14 @@ public class FloType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
rgb = in.read24();
|
||||
setColor(rgb);
|
||||
} else if (code == 2) {
|
||||
textureID = in.read8U();
|
||||
textureID = in.readU8();
|
||||
} else if (code == 3) {
|
||||
} else if (code == 5) {
|
||||
occludes = false;
|
||||
|
||||
+198
-198
@@ -1080,7 +1080,7 @@ public class Game extends GameShell {
|
||||
areaViewportOffsets = Draw3D.lineOffset;
|
||||
|
||||
Scene.init(512, 334);
|
||||
Censor.method487(archiveWordenc);
|
||||
Censor.unpack(archiveWordenc);
|
||||
|
||||
mouseRecorder = new MouseRecorder(this);
|
||||
startThread(mouseRecorder = new MouseRecorder(this), 10);
|
||||
@@ -3311,10 +3311,10 @@ public class Game extends GameShell {
|
||||
for (int i = 0; i < entityUpdateCount; i++) {
|
||||
int playerID = entityUpdateIDs[i];
|
||||
PlayerEntity player = players[playerID];
|
||||
int updates = in.read8U();
|
||||
int updates = in.readU8();
|
||||
|
||||
if ((updates & 0x40) != 0) {
|
||||
updates += in.read8U() << 8;
|
||||
updates += in.readU8() << 8;
|
||||
}
|
||||
|
||||
if ((updates & 0x400) != 0) {
|
||||
@@ -3360,20 +3360,20 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readPlayerForceMovement(PlayerEntity player) {
|
||||
player.forceMoveStartSceneTileX = in.read8US();
|
||||
player.forceMoveStartSceneTileZ = in.read8US();
|
||||
player.forceMoveEndSceneTileX = in.read8US();
|
||||
player.forceMoveEndSceneTileZ = in.read8US();
|
||||
player.forceMoveEndCycle = in.read16ULEA() + loopCycle;
|
||||
player.forceMoveStartCycle = in.read16UA() + loopCycle;
|
||||
player.forceMoveFaceDirection = in.read8US();
|
||||
player.forceMoveStartSceneTileX = in.readU8S();
|
||||
player.forceMoveStartSceneTileZ = in.readU8S();
|
||||
player.forceMoveEndSceneTileX = in.readU8S();
|
||||
player.forceMoveEndSceneTileZ = in.readU8S();
|
||||
player.forceMoveEndCycle = in.readU16LEA() + loopCycle;
|
||||
player.forceMoveStartCycle = in.readU16A() + loopCycle;
|
||||
player.forceMoveFaceDirection = in.readU8S();
|
||||
player.resetPath();
|
||||
}
|
||||
|
||||
private void readPlayerGraphic(PlayerEntity player) {
|
||||
player.spotanimID = in.read16ULE();
|
||||
player.spotanimOffset = in.read16U();
|
||||
player.spotanimLastCycle = loopCycle + in.read16U();
|
||||
player.spotanimID = in.readU16LE();
|
||||
player.spotanimOffset = in.readU16();
|
||||
player.spotanimLastCycle = loopCycle + in.readU16();
|
||||
player.spotanimFrame = 0;
|
||||
player.spotanimCycle = 0;
|
||||
|
||||
@@ -3387,13 +3387,13 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readPlayerAnimation(PlayerEntity player) {
|
||||
int seqID = in.read16ULE();
|
||||
int seqID = in.readU16LE();
|
||||
|
||||
if (seqID == 65535) {
|
||||
seqID = -1;
|
||||
}
|
||||
|
||||
int delay = in.read8UC();
|
||||
int delay = in.readU8C();
|
||||
|
||||
if ((seqID == player.primarySeqID) && (seqID != -1)) {
|
||||
int style = SeqType.instances[seqID].replayStyle;
|
||||
@@ -3434,9 +3434,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readPlayerChat(PlayerEntity player) {
|
||||
int colorStyle = in.read16ULE();
|
||||
int role = in.read8U();
|
||||
int length = in.read8UC();
|
||||
int colorStyle = in.readU16LE();
|
||||
int role = in.readU8();
|
||||
int length = in.readU8C();
|
||||
int start = in.position;
|
||||
|
||||
if ((player.name != null) && player.visible) {
|
||||
@@ -3460,7 +3460,7 @@ public class Game extends GameShell {
|
||||
chatBuffer.position = 0;
|
||||
|
||||
String chat = ChatCompression.unpack(length, chatBuffer);
|
||||
chat = Censor.apply(chat);
|
||||
chat = Censor.filter(chat);
|
||||
|
||||
player.chat = chat;
|
||||
player.chatColor = colorStyle >> 8;
|
||||
@@ -3484,7 +3484,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readPlayerTargetEntity(PlayerEntity player) {
|
||||
player.targetID = in.read16ULE();
|
||||
player.targetID = in.readU16LE();
|
||||
|
||||
if (player.targetID == 65535) {
|
||||
player.targetID = -1;
|
||||
@@ -3492,33 +3492,33 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readPlayerAppearance(int playerID, PlayerEntity player) {
|
||||
Buffer buffer = new Buffer(new byte[in.read8UC()]);
|
||||
Buffer buffer = new Buffer(new byte[in.readU8C()]);
|
||||
in.read(buffer.data);
|
||||
playerAppearanceBuffer[playerID] = buffer;
|
||||
player.read(buffer);
|
||||
}
|
||||
|
||||
private void readPlayerTargetTile(PlayerEntity player) {
|
||||
player.targetTileX = in.read16ULEA();
|
||||
player.targetTileZ = in.read16ULE();
|
||||
player.targetTileX = in.readU16LEA();
|
||||
player.targetTileZ = in.readU16LE();
|
||||
}
|
||||
|
||||
private void readPlayerDamage0(PlayerEntity player) {
|
||||
int damage = in.read8U();
|
||||
int type = in.read8UA();
|
||||
int damage = in.readU8();
|
||||
int type = in.readU8A();
|
||||
player.hit(type, damage);
|
||||
player.combatCycle = loopCycle + 300;
|
||||
player.health = in.read8UC();
|
||||
player.totalHealth = in.read8U();
|
||||
player.health = in.readU8C();
|
||||
player.totalHealth = in.readU8();
|
||||
}
|
||||
|
||||
private void readPlayerDamage1(PlayerEntity player) {
|
||||
int damage = in.read8U();
|
||||
int type = in.read8US();
|
||||
int damage = in.readU8();
|
||||
int type = in.readU8S();
|
||||
player.hit(type, damage);
|
||||
player.combatCycle = loopCycle + 300;
|
||||
player.health = in.read8U();
|
||||
player.totalHealth = in.read8UC();
|
||||
player.health = in.readU8();
|
||||
player.totalHealth = in.readU8C();
|
||||
}
|
||||
|
||||
public void drawMinimapLoc(int tileZ, int wallRGB, int tileX, int doorRGB, int level) {
|
||||
@@ -6095,7 +6095,7 @@ public class Game extends GameShell {
|
||||
out.writeA(chatBuffer.data, 0, chatBuffer.position);
|
||||
out.writeSize(out.position - startPosition);
|
||||
chatTyped = ChatCompression.format(chatTyped);
|
||||
chatTyped = Censor.apply(chatTyped);
|
||||
chatTyped = Censor.filter(chatTyped);
|
||||
localPlayer.chat = chatTyped;
|
||||
localPlayer.chatColor = color;
|
||||
localPlayer.chatStyle = style;
|
||||
@@ -6198,7 +6198,7 @@ public class Game extends GameShell {
|
||||
ChatCompression.pack(socialInput, out);
|
||||
out.writeSize(out.position - start);
|
||||
socialInput = ChatCompression.format(socialInput);
|
||||
socialInput = Censor.apply(socialInput);
|
||||
socialInput = Censor.filter(socialInput);
|
||||
addMessage(6, StringUtil.formatName(StringUtil.fromBase37(inputFriendName37)), socialInput);
|
||||
if (privateChatSetting == 2) {
|
||||
privateChatSetting = 1;
|
||||
@@ -7483,7 +7483,7 @@ public class Game extends GameShell {
|
||||
|
||||
for (int i = 0; i < entityUpdateCount; i++) {
|
||||
NPCEntity npc = npcs[entityUpdateIDs[i]];
|
||||
int updates = in.read8U();
|
||||
int updates = in.readU8();
|
||||
|
||||
if ((updates & 0x10) != 0) {
|
||||
readNPCAnimation(npc);
|
||||
@@ -7520,9 +7520,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readNPCGraphic(NPCEntity npc) {
|
||||
npc.spotanimID = in.read16U();
|
||||
npc.spotanimOffset = in.read16U();
|
||||
npc.spotanimLastCycle = loopCycle + in.read16U();
|
||||
npc.spotanimID = in.readU16();
|
||||
npc.spotanimOffset = in.readU16();
|
||||
npc.spotanimLastCycle = loopCycle + in.readU16();
|
||||
npc.spotanimFrame = 0;
|
||||
npc.spotanimCycle = 0;
|
||||
if (npc.spotanimLastCycle > loopCycle) {
|
||||
@@ -7534,15 +7534,15 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readNPCTargetEntity(NPCEntity npc) {
|
||||
npc.targetID = in.read16U();
|
||||
npc.targetID = in.readU16();
|
||||
if (npc.targetID == 65535) {
|
||||
npc.targetID = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void readNPCTargetTile(NPCEntity npc) {
|
||||
npc.targetTileX = in.read16ULE();
|
||||
npc.targetTileZ = in.read16ULE();
|
||||
npc.targetTileX = in.readU16LE();
|
||||
npc.targetTileZ = in.readU16LE();
|
||||
}
|
||||
|
||||
private void readNPCChat(NPCEntity npc) {
|
||||
@@ -7551,16 +7551,16 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readNPCDamage1(NPCEntity npc) {
|
||||
int damage = in.read8UC();
|
||||
int type = in.read8US();
|
||||
int damage = in.readU8C();
|
||||
int type = in.readU8S();
|
||||
npc.hit(type, damage);
|
||||
npc.combatCycle = loopCycle + 300;
|
||||
npc.health = in.read8US();
|
||||
npc.totalHealth = in.read8UC();
|
||||
npc.health = in.readU8S();
|
||||
npc.totalHealth = in.readU8C();
|
||||
}
|
||||
|
||||
private void readNPCTransform(NPCEntity npc) {
|
||||
npc.type = NPCType.get(in.read16ULEA());
|
||||
npc.type = NPCType.get(in.readU16LEA());
|
||||
npc.size = npc.type.size;
|
||||
npc.turnSpeed = npc.type.turnSpeed;
|
||||
npc.seqWalkID = npc.type.seqWalkID;
|
||||
@@ -7571,13 +7571,13 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readNPCAnimation(NPCEntity npc) {
|
||||
int seqID = in.read16ULE();
|
||||
int seqID = in.readU16LE();
|
||||
|
||||
if (seqID == 65535) {
|
||||
seqID = -1;
|
||||
}
|
||||
|
||||
int delay = in.read8U();
|
||||
int delay = in.readU8();
|
||||
if ((seqID == npc.primarySeqID) && (seqID != -1)) {
|
||||
int style = SeqType.instances[seqID].replayStyle;
|
||||
|
||||
@@ -7602,12 +7602,12 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readNPCDamage0(NPCEntity npc) {
|
||||
int damage = in.read8UA();
|
||||
int type = in.read8UC();
|
||||
int damage = in.readU8A();
|
||||
int type = in.readU8C();
|
||||
npc.hit(type, damage);
|
||||
npc.combatCycle = loopCycle + 300;
|
||||
npc.health = in.read8UA();
|
||||
npc.totalHealth = in.read8U();
|
||||
npc.health = in.readU8A();
|
||||
npc.totalHealth = in.readU8();
|
||||
}
|
||||
|
||||
public void addNPCOptions(NPCType type, int npcID, int tileZ, int tileX) {
|
||||
@@ -10502,9 +10502,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readObjAdd() {
|
||||
int objID = in.read16ULEA();
|
||||
int objCount = in.read16U();
|
||||
int pos = in.read8U();
|
||||
int objID = in.readU16LEA();
|
||||
int objCount = in.readU16();
|
||||
int pos = in.readU8();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104)) {
|
||||
@@ -10520,12 +10520,12 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readObjReveal() {
|
||||
int objID = in.read16UA();
|
||||
int pos = in.read8US();
|
||||
int objID = in.readU16A();
|
||||
int pos = in.readU8S();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int ownerPID = in.read16UA();
|
||||
int objCount = in.read16U();
|
||||
int ownerPID = in.readU16A();
|
||||
int objCount = in.readU16();
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104) && (ownerPID != localPID)) {
|
||||
ObjEntity obj = new ObjEntity();
|
||||
obj.id = objID;
|
||||
@@ -10539,12 +10539,12 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readObjCount() {
|
||||
int pos = in.read8U();
|
||||
int pos = in.readU8();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int objID = in.read16U();
|
||||
int oldCount = in.read16U();
|
||||
int newCount = in.read16U();
|
||||
int objID = in.readU16();
|
||||
int oldCount = in.readU16();
|
||||
int newCount = in.readU16();
|
||||
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104)) {
|
||||
DoublyLinkedList stacks = levelObjStacks[currentLevel][x][z];
|
||||
@@ -10562,10 +10562,10 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readObjDelete() {
|
||||
int pos = in.read8UA();
|
||||
int pos = in.readU8A();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int objID = in.read16U();
|
||||
int objID = in.readU16();
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104)) {
|
||||
DoublyLinkedList list = levelObjStacks[currentLevel][x][z];
|
||||
if (list != null) {
|
||||
@@ -10585,11 +10585,11 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readLocAdd() {
|
||||
int pos = in.read8UA();
|
||||
int pos = in.readU8A();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int id = in.read16ULE();
|
||||
int info = in.read8US();
|
||||
int id = in.readU16LE();
|
||||
int info = in.readU8S();
|
||||
int kind = info >> 2;
|
||||
int rotation = info & 3;
|
||||
int classID = LOC_KIND_TO_CLASS_ID[kind];
|
||||
@@ -10599,14 +10599,14 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readLocChange() {
|
||||
int pos = in.read8US();
|
||||
int pos = in.readU8S();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int info = in.read8US();
|
||||
int info = in.readU8S();
|
||||
int kind = info >> 2;
|
||||
int rotation = info & 3;
|
||||
int classID = LOC_KIND_TO_CLASS_ID[kind];
|
||||
int seqID = in.read16UA();
|
||||
int seqID = in.readU16A();
|
||||
|
||||
if ((x < 0) || (z < 0) || (x >= 103) || (z >= 103)) {
|
||||
return;
|
||||
@@ -10662,11 +10662,11 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readLocDelete() {
|
||||
int info = in.read8UC();
|
||||
int info = in.readU8C();
|
||||
int kind = info >> 2;
|
||||
int rotation = info & 3;
|
||||
int classID = LOC_KIND_TO_CLASS_ID[kind];
|
||||
int pos = in.read8U();
|
||||
int pos = in.readU8();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104)) {
|
||||
@@ -10675,20 +10675,20 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readLocPlayer() {
|
||||
int pos = in.read8US();
|
||||
int pos = in.readU8S();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int pid = in.read16U();
|
||||
int pid = in.readU16();
|
||||
byte maxX = in.read8S();
|
||||
int delay = in.read16ULE();
|
||||
int delay = in.readU16LE();
|
||||
byte maxZ = in.read8C();
|
||||
int duration = in.read16U();
|
||||
int info = in.read8US();
|
||||
int duration = in.readU16();
|
||||
int info = in.readU8S();
|
||||
int kind = info >> 2;
|
||||
int rotation = info & 3;
|
||||
int classID = LOC_KIND_TO_CLASS_ID[kind];
|
||||
byte minX = in.read();
|
||||
int locID = in.read16U();
|
||||
byte minX = in.read8();
|
||||
int locID = in.readU16();
|
||||
byte minZ = in.read8C();
|
||||
PlayerEntity player;
|
||||
|
||||
@@ -10746,12 +10746,12 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readMapAnim() {
|
||||
int pos = in.read8U();
|
||||
int pos = in.readU8();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int id = in.read16U();
|
||||
int y = in.read8U();
|
||||
int delay = in.read16U();
|
||||
int id = in.readU16();
|
||||
int y = in.readU8();
|
||||
int delay = in.readU16();
|
||||
|
||||
if ((x >= 0) && (z >= 0) && (x < 104) && (z < 104)) {
|
||||
x = (x * 128) + 64;
|
||||
@@ -10762,11 +10762,11 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readMapSound() {
|
||||
int pos = in.read8U();
|
||||
int pos = in.readU8();
|
||||
int x = baseX + ((pos >> 4) & 7);
|
||||
int z = baseZ + (pos & 7);
|
||||
int waveID = in.read16U();
|
||||
int info = in.read8U();
|
||||
int waveID = in.readU16();
|
||||
int info = in.readU8();
|
||||
int maxDist = (info >> 4) & 0xf;
|
||||
int loopCount = info & 0b111;
|
||||
if ((localPlayer.pathTileX[0] >= (x - maxDist)) && (localPlayer.pathTileX[0] <= (x + maxDist)) && (localPlayer.pathTileZ[0] >= (z - maxDist)) && (localPlayer.pathTileZ[0] <= (z + maxDist)) && waveEnabled && !lowmem && (waveCount < 50)) {
|
||||
@@ -10778,19 +10778,19 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readMapProjectile() {
|
||||
int pos = in.read8U();
|
||||
int pos = in.readU8();
|
||||
int srcX = baseX + ((pos >> 4) & 7);
|
||||
int srcZ = baseZ + (pos & 7);
|
||||
int dstX = srcX + in.read();
|
||||
int dstZ = srcZ + in.read();
|
||||
int dstX = srcX + in.read8();
|
||||
int dstZ = srcZ + in.read8();
|
||||
int targetID = in.read16();
|
||||
int spotanimID = in.read16U();
|
||||
int srcY = in.read8U() * 4;
|
||||
int dstY = in.read8U() * 4;
|
||||
int delay = in.read16U();
|
||||
int duration = in.read16U();
|
||||
int peakPitch = in.read8U();
|
||||
int arcSize = in.read8U();
|
||||
int spotanimID = in.readU16();
|
||||
int srcY = in.readU8() * 4;
|
||||
int dstY = in.readU8() * 4;
|
||||
int delay = in.readU16();
|
||||
int duration = in.readU16();
|
||||
int peakPitch = in.readU8();
|
||||
int arcSize = in.readU8();
|
||||
if ((srcX >= 0) && (srcZ >= 0) && (srcX < 104) && (srcZ < 104) && (dstX >= 0) && (dstZ >= 0) && (dstX < 104) && (dstZ < 104) && (spotanimID != 65535)) {
|
||||
srcX = (srcX * 128) + 64;
|
||||
srcZ = (srcZ * 128) + 64;
|
||||
@@ -11167,7 +11167,7 @@ public class Game extends GameShell {
|
||||
if (available > 1) {
|
||||
connection.read(in.data, 0, 2);
|
||||
in.position = 0;
|
||||
packetSize = in.read16U();
|
||||
packetSize = in.readU16();
|
||||
bytesIn += 2;
|
||||
available -= 2;
|
||||
} else {
|
||||
@@ -11259,7 +11259,7 @@ public class Game extends GameShell {
|
||||
break;
|
||||
|
||||
case PacketIn.MINIMAP_TOGGLE:
|
||||
minimapState = in.read8U();
|
||||
minimapState = in.readU8();
|
||||
break;
|
||||
|
||||
case PacketIn.IF_SETNPCHEAD:
|
||||
@@ -11267,7 +11267,7 @@ public class Game extends GameShell {
|
||||
break;
|
||||
|
||||
case PacketIn.UPDATE_REBOOT_TIMER:
|
||||
systemUpdateTimer = in.read16ULE() * 30;
|
||||
systemUpdateTimer = in.readU16LE() * 30;
|
||||
break;
|
||||
|
||||
case PacketIn.ZONE_UPDATE:
|
||||
@@ -11327,8 +11327,8 @@ public class Game extends GameShell {
|
||||
break;
|
||||
|
||||
case PacketIn.ZONE_BASE:
|
||||
baseZ = in.read8UC();
|
||||
baseX = in.read8UC();
|
||||
baseZ = in.readU8C();
|
||||
baseX = in.readU8C();
|
||||
break;
|
||||
|
||||
case PacketIn.TAB_HINT:
|
||||
@@ -11376,13 +11376,13 @@ public class Game extends GameShell {
|
||||
break;
|
||||
|
||||
case PacketIn.FRIENDLIST_LOADED:
|
||||
friendlistStatus = in.read8U();
|
||||
friendlistStatus = in.readU8();
|
||||
redrawSidebar = true;
|
||||
break;
|
||||
|
||||
case PacketIn.LOCAL_PLAYER:
|
||||
isMember = in.read8UA();
|
||||
localPID = in.read16ULEA();
|
||||
isMember = in.readU8A();
|
||||
localPID = in.readU16LEA();
|
||||
break;
|
||||
|
||||
case PacketIn.SYNC_NPCS:
|
||||
@@ -11415,7 +11415,7 @@ public class Game extends GameShell {
|
||||
break;
|
||||
|
||||
case PacketIn.MULTIZONE:
|
||||
multizone = in.read8U();
|
||||
multizone = in.readU8();
|
||||
break;
|
||||
|
||||
case PacketIn.IF_SETANIM:
|
||||
@@ -11475,11 +11475,11 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readLastLoginInfo() {
|
||||
daysSinceRecoveriesChanged = in.read8UC();
|
||||
unreadMessages = in.read16UA();
|
||||
warnMembersInNonMembers = in.read8U();
|
||||
daysSinceRecoveriesChanged = in.readU8C();
|
||||
unreadMessages = in.readU16A();
|
||||
warnMembersInNonMembers = in.readU8();
|
||||
lastAddress = in.read32ME();
|
||||
daysSinceLastLogin = in.read16U();
|
||||
daysSinceLastLogin = in.readU16();
|
||||
|
||||
if ((lastAddress != 0) && (viewportInterfaceID == -1)) {
|
||||
Signlink.dnslookup(StringUtil.formatIPv4(lastAddress));
|
||||
@@ -11505,8 +11505,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readZoneClear() {
|
||||
baseX = in.read8UC();
|
||||
baseZ = in.read8US();
|
||||
baseX = in.readU8C();
|
||||
baseZ = in.readU8S();
|
||||
for (int x = baseX; x < (baseX + 8); x++) {
|
||||
for (int z = baseZ; z < (baseZ + 8); z++) {
|
||||
if (levelObjStacks[currentLevel][x][z] != null) {
|
||||
@@ -11523,7 +11523,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetPlayerHead() {
|
||||
int interfaceID = in.read16ULEA();
|
||||
int interfaceID = in.readU16LEA();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.modelType = IfType.MODEL_TYPE_PLAYER;
|
||||
|
||||
@@ -11542,7 +11542,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readInventoryClear() {
|
||||
int interfaceID = in.read16ULE();
|
||||
int interfaceID = in.readU16LE();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
for (int slot = 0; slot < iface.inventorySlotObjID.length; slot++) {
|
||||
iface.inventorySlotObjID[slot] = -1;
|
||||
@@ -11559,11 +11559,11 @@ public class Game extends GameShell {
|
||||
|
||||
private void readCameraSetPos() {
|
||||
cutscene = true;
|
||||
cutsceneSrcLocalTileX = in.read8U();
|
||||
cutsceneSrcLocalTileZ = in.read8U();
|
||||
cutsceneSrcHeight = in.read16U();
|
||||
cutsceneMoveSpeed = in.read8U();
|
||||
cutsceneMoveAcceleration = in.read8U();
|
||||
cutsceneSrcLocalTileX = in.readU8();
|
||||
cutsceneSrcLocalTileZ = in.readU8();
|
||||
cutsceneSrcHeight = in.readU16();
|
||||
cutsceneMoveSpeed = in.readU8();
|
||||
cutsceneMoveAcceleration = in.readU8();
|
||||
|
||||
if (cutsceneMoveAcceleration >= 100) {
|
||||
cameraX = (cutsceneSrcLocalTileX * 128) + 64;
|
||||
@@ -11574,11 +11574,11 @@ public class Game extends GameShell {
|
||||
|
||||
private void readCameraLookAt() {
|
||||
cutscene = true;
|
||||
cutsceneDstLocalTileX = in.read8U();
|
||||
cutsceneDstLocalTileZ = in.read8U();
|
||||
cutsceneDstHeight = in.read16U();
|
||||
cutsceneRotateSpeed = in.read8U();
|
||||
cutsceneRotateAcceleration = in.read8U();
|
||||
cutsceneDstLocalTileX = in.readU8();
|
||||
cutsceneDstLocalTileZ = in.readU8();
|
||||
cutsceneDstHeight = in.readU16();
|
||||
cutsceneRotateSpeed = in.readU8();
|
||||
cutsceneRotateAcceleration = in.readU8();
|
||||
|
||||
if (cutsceneRotateAcceleration >= 100) {
|
||||
int sceneX = (cutsceneDstLocalTileX * 128) + 64;
|
||||
@@ -11601,9 +11601,9 @@ public class Game extends GameShell {
|
||||
|
||||
private void readUpdateStat() {
|
||||
redrawSidebar = true;
|
||||
int skill = in.read8U();
|
||||
int skill = in.readU8();
|
||||
int experience = in.read32RME();
|
||||
int level = in.read8U();
|
||||
int level = in.readU8();
|
||||
skillExperience[skill] = experience;
|
||||
skillLevel[skill] = level;
|
||||
skillBaseLevel[skill] = 1;
|
||||
@@ -11615,8 +11615,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfTab() {
|
||||
int interfaceID = in.read16U();
|
||||
int tab = in.read8UA();
|
||||
int interfaceID = in.readU16();
|
||||
int tab = in.readU8A();
|
||||
if (interfaceID == 65535) {
|
||||
interfaceID = -1;
|
||||
}
|
||||
@@ -11626,7 +11626,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readMidiSong() {
|
||||
int next = in.read16ULE();
|
||||
int next = in.readU16LE();
|
||||
if (next == 65535) {
|
||||
next = -1;
|
||||
}
|
||||
@@ -11639,8 +11639,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readMidiJingle() {
|
||||
int next = in.read16ULEA();
|
||||
int delay = in.read16UA();
|
||||
int next = in.readU16LEA();
|
||||
int delay = in.readU16A();
|
||||
if (midiEnabled && !lowmem) {
|
||||
song = next;
|
||||
songFading = false;
|
||||
@@ -11652,7 +11652,7 @@ public class Game extends GameShell {
|
||||
private void readIfSetPosition() {
|
||||
int x = in.read16();
|
||||
int y = in.read16LE();
|
||||
int interfaceID = in.read16ULE();
|
||||
int interfaceID = in.readU16LE();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.x = x;
|
||||
iface.y = y;
|
||||
@@ -11663,13 +11663,13 @@ public class Game extends GameShell {
|
||||
int zoneZ = sceneCenterZoneZ;
|
||||
|
||||
if (packetType == PacketIn.REBUILD_REGION) {
|
||||
zoneX = in.read16UA();
|
||||
zoneZ = in.read16U();
|
||||
zoneX = in.readU16A();
|
||||
zoneZ = in.readU16();
|
||||
sceneInstanced = false;
|
||||
}
|
||||
|
||||
if (packetType == PacketIn.REBUILD_REGION_INSTANCE) {
|
||||
zoneZ = in.read16UA();
|
||||
zoneZ = in.readU16A();
|
||||
in.accessBits();
|
||||
|
||||
for (int level = 0; level < 4; level++) {
|
||||
@@ -11685,7 +11685,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
in.accessBytes();
|
||||
zoneX = in.read16U();
|
||||
zoneX = in.readU16();
|
||||
sceneInstanced = true;
|
||||
}
|
||||
|
||||
@@ -11914,25 +11914,25 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetNPCHead() {
|
||||
int npcID = in.read16ULEA();
|
||||
int interfaceID = in.read16ULEA();
|
||||
int npcID = in.readU16LEA();
|
||||
int interfaceID = in.readU16LEA();
|
||||
IfType.instances[interfaceID].modelType = IfType.MODEL_TYPE_NPC;
|
||||
IfType.instances[interfaceID].modelID = npcID;
|
||||
}
|
||||
|
||||
private void readZoneUpdate() {
|
||||
baseZ = in.read8U();
|
||||
baseX = in.read8UC();
|
||||
baseZ = in.readU8();
|
||||
baseX = in.readU8C();
|
||||
while (in.position < packetSize) {
|
||||
readZonePacket(in.read8U());
|
||||
readZonePacket(in.readU8());
|
||||
}
|
||||
}
|
||||
|
||||
private void readCameraShake() {
|
||||
int type = in.read8U();
|
||||
int jitterScale = in.read8U();
|
||||
int wobbleScale = in.read8U();
|
||||
int wobbleSpeed = in.read8U();
|
||||
int type = in.readU8();
|
||||
int jitterScale = in.readU8();
|
||||
int wobbleScale = in.readU8();
|
||||
int wobbleSpeed = in.readU8();
|
||||
cameraModifierEnabled[type] = true;
|
||||
cameraModifierJitter[type] = jitterScale;
|
||||
cameraModifierWobbleScale[type] = wobbleScale;
|
||||
@@ -11941,9 +11941,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readSynthSound() {
|
||||
int waveID = in.read16U();
|
||||
int loopCount = in.read8U();
|
||||
int delay = in.read16U();
|
||||
int waveID = in.readU16();
|
||||
int loopCount = in.readU8();
|
||||
int delay = in.readU16();
|
||||
if (waveEnabled && !lowmem && (waveCount < 50)) {
|
||||
waveIDs[waveCount] = waveID;
|
||||
waveLoops[waveCount] = loopCount;
|
||||
@@ -11953,8 +11953,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readSetPlayerOp() {
|
||||
int option = in.read8UC();
|
||||
int priority = in.read8UA();
|
||||
int option = in.readU8C();
|
||||
int priority = in.readU8A();
|
||||
String text = in.readString();
|
||||
if ((option >= 1) && (option <= 5)) {
|
||||
if (text.equalsIgnoreCase("null")) {
|
||||
@@ -12035,7 +12035,7 @@ public class Game extends GameShell {
|
||||
|
||||
private void readFriendStatus() {
|
||||
long name37 = in.read64();
|
||||
int world = in.read8U();
|
||||
int world = in.readU8();
|
||||
String name = StringUtil.formatName(StringUtil.fromBase37(name37));
|
||||
|
||||
for (int i = 0; i < friendCount; i++) {
|
||||
@@ -12090,14 +12090,14 @@ public class Game extends GameShell {
|
||||
if (selectedTab == 12) {
|
||||
redrawSidebar = true;
|
||||
}
|
||||
energy = in.read8U();
|
||||
energy = in.readU8();
|
||||
}
|
||||
|
||||
private void readHintArrow() {
|
||||
hintType = in.read8U();
|
||||
hintType = in.readU8();
|
||||
|
||||
if (hintType == 1) {
|
||||
hintNPC = in.read16U();
|
||||
hintNPC = in.readU16();
|
||||
}
|
||||
|
||||
if ((hintType >= 2) && (hintType <= 6)) {
|
||||
@@ -12122,19 +12122,19 @@ public class Game extends GameShell {
|
||||
hintOffsetZ = 128;
|
||||
}
|
||||
hintType = 2;
|
||||
hintTileX = in.read16U();
|
||||
hintTileZ = in.read16U();
|
||||
hintHeight = in.read8U();
|
||||
hintTileX = in.readU16();
|
||||
hintTileZ = in.readU16();
|
||||
hintHeight = in.readU8();
|
||||
}
|
||||
|
||||
if (hintType == 10) {
|
||||
hintPlayer = in.read16U();
|
||||
hintPlayer = in.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
private void readIfViewportAndSidebar() {
|
||||
int viewportInterfaceID = in.read16UA();
|
||||
int sidebarInterfaceID = in.read16U();
|
||||
int viewportInterfaceID = in.readU16A();
|
||||
int sidebarInterfaceID = in.readU16();
|
||||
|
||||
if (chatInterfaceID != -1) {
|
||||
chatInterfaceID = -1;
|
||||
@@ -12154,8 +12154,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetScrollPos() {
|
||||
int interfaceID = in.read16ULE();
|
||||
int scrollPos = in.read16UA();
|
||||
int interfaceID = in.readU16LE();
|
||||
int scrollPos = in.readU16A();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
if ((iface != null) && (iface.type == IfType.TYPE_PARENT)) {
|
||||
if (scrollPos < 0) {
|
||||
@@ -12181,7 +12181,7 @@ public class Game extends GameShell {
|
||||
private void readMessagePublic() {
|
||||
long name37 = in.read64();
|
||||
int messageID = in.read32();
|
||||
int role = in.read8U();
|
||||
int role = in.readU8();
|
||||
boolean ignore = false;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
if (messageIDs[i] == messageID) {
|
||||
@@ -12206,7 +12206,7 @@ public class Game extends GameShell {
|
||||
String message = ChatCompression.unpack(packetSize - 13, in);
|
||||
|
||||
if (role != 3) {
|
||||
message = Censor.apply(message);
|
||||
message = Censor.filter(message);
|
||||
}
|
||||
|
||||
if ((role == 2) || (role == 3)) {
|
||||
@@ -12223,7 +12223,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readTabHint() {
|
||||
flashingTab = in.read8US();
|
||||
flashingTab = in.readU8S();
|
||||
if (flashingTab == selectedTab) {
|
||||
if (flashingTab == 3) {
|
||||
selectedTab = 1;
|
||||
@@ -12235,9 +12235,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetObject() {
|
||||
int interfaceID = in.read16ULE();
|
||||
int zoom = in.read16U();
|
||||
int objID = in.read16U();
|
||||
int interfaceID = in.readU16LE();
|
||||
int zoom = in.readU16();
|
||||
int objID = in.readU16();
|
||||
|
||||
if (objID != 65535) {
|
||||
ObjType type = ObjType.get(objID);
|
||||
@@ -12253,13 +12253,13 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetHide() {
|
||||
boolean hide = in.read8U() == 1;
|
||||
int interfaceID = in.read16U();
|
||||
boolean hide = in.readU8() == 1;
|
||||
int interfaceID = in.readU16();
|
||||
IfType.instances[interfaceID].hide = hide;
|
||||
}
|
||||
|
||||
private void readIfStopAnim() {
|
||||
int interfaceID = in.read16ULE();
|
||||
int interfaceID = in.readU16LE();
|
||||
resetInterfaceAnimation(interfaceID);
|
||||
if (chatInterfaceID != -1) {
|
||||
chatInterfaceID = -1;
|
||||
@@ -12278,7 +12278,7 @@ public class Game extends GameShell {
|
||||
|
||||
private void readIfSetText() {
|
||||
String text = in.readString();
|
||||
int interfaceID = in.read16UA();
|
||||
int interfaceID = in.readU16A();
|
||||
if ((interfaceID >= 0) && (interfaceID < IfType.instances.length)) {
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
if (iface != null) {
|
||||
@@ -12291,9 +12291,9 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readChatFilterSettings() {
|
||||
publicChatSetting = in.read8U();
|
||||
privateChatSetting = in.read8U();
|
||||
tradeChatSetting = in.read8U();
|
||||
publicChatSetting = in.readU8();
|
||||
privateChatSetting = in.readU8();
|
||||
tradeChatSetting = in.readU8();
|
||||
redrawPrivacySettings = true;
|
||||
redrawChatback = true;
|
||||
}
|
||||
@@ -12306,15 +12306,15 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetModel() {
|
||||
int interfaceID = in.read16ULEA();
|
||||
int modelID = in.read16U();
|
||||
int interfaceID = in.readU16LEA();
|
||||
int modelID = in.readU16();
|
||||
IfType.instances[interfaceID].modelType = IfType.MODEL_TYPE_NORMAL;
|
||||
IfType.instances[interfaceID].modelID = modelID;
|
||||
}
|
||||
|
||||
private void readIfSetColor() {
|
||||
int interfaceID = in.read16ULEA();
|
||||
int rgb555 = in.read16ULEA();
|
||||
int interfaceID = in.readU16LEA();
|
||||
int rgb555 = in.readU16LEA();
|
||||
int r = (rgb555 >> 10) & 0x1f;
|
||||
int g = (rgb555 >> 5) & 0x1f;
|
||||
int b = rgb555 & 0x1f;
|
||||
@@ -12323,21 +12323,21 @@ public class Game extends GameShell {
|
||||
|
||||
private void readUpdateInvFull() {
|
||||
redrawSidebar = true;
|
||||
int interfaceID = in.read16U();
|
||||
int interfaceID = in.readU16();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
int lastSlot = in.read16U();
|
||||
int lastSlot = in.readU16();
|
||||
|
||||
for (int slot = 0; slot < lastSlot; slot++) {
|
||||
int objCount = in.read8U();
|
||||
int objCount = in.readU8();
|
||||
|
||||
if (objCount == 255) {
|
||||
objCount = in.read32ME();
|
||||
}
|
||||
|
||||
if (slot >= iface.inventorySlotObjID.length) {
|
||||
in.read16ULEA();
|
||||
in.readU16LEA();
|
||||
} else {
|
||||
iface.inventorySlotObjID[slot] = in.read16ULEA();
|
||||
iface.inventorySlotObjID[slot] = in.readU16LEA();
|
||||
iface.inventorySlotObjCount[slot] = objCount;
|
||||
}
|
||||
}
|
||||
@@ -12350,10 +12350,10 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetAngle() {
|
||||
int zoom = in.read16UA();
|
||||
int interfaceID = in.read16U();
|
||||
int pitch = in.read16U();
|
||||
int yaw = in.read16ULEA();
|
||||
int zoom = in.readU16A();
|
||||
int interfaceID = in.readU16();
|
||||
int pitch = in.readU16();
|
||||
int yaw = in.readU16LEA();
|
||||
IfType.instances[interfaceID].modelPitch = pitch;
|
||||
IfType.instances[interfaceID].modelYaw = yaw;
|
||||
IfType.instances[interfaceID].modelZoom = zoom;
|
||||
@@ -12385,13 +12385,13 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readViewportInterface() {
|
||||
int interfaceID = in.read16U();
|
||||
int interfaceID = in.readU16();
|
||||
resetInterfaceAnimation(interfaceID);
|
||||
openViewportInterface(interfaceID);
|
||||
}
|
||||
|
||||
private void readVarpLarge() {
|
||||
int varpID = in.read16ULE();
|
||||
int varpID = in.readU16LE();
|
||||
int value = in.read32RME();
|
||||
varCache[varpID] = value;
|
||||
|
||||
@@ -12406,8 +12406,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readVarpSmall() {
|
||||
int varpID = in.read16ULE();
|
||||
byte value = in.read();
|
||||
int varpID = in.readU16LE();
|
||||
byte value = in.read8();
|
||||
varCache[varpID] = value;
|
||||
|
||||
if (varps[varpID] != value) {
|
||||
@@ -12421,7 +12421,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readIfSetAnim() {
|
||||
int interfaceID = in.read16U();
|
||||
int interfaceID = in.readU16();
|
||||
int seqID = in.read16();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.seqID = seqID;
|
||||
@@ -12433,13 +12433,13 @@ public class Game extends GameShell {
|
||||
|
||||
private void readUpdateInvPartial() {
|
||||
redrawSidebar = true;
|
||||
int interfaceID = in.read16U();
|
||||
int interfaceID = in.readU16();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
|
||||
while (in.position < packetSize) {
|
||||
int slot = in.readSmartU();
|
||||
int objID = in.read16U();
|
||||
int objCount = in.read8U();
|
||||
int slot = in.readUSmart();
|
||||
int objID = in.readU16();
|
||||
int objCount = in.readU8();
|
||||
if (objCount == 255) {
|
||||
objCount = in.read32();
|
||||
}
|
||||
@@ -12451,13 +12451,13 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
private void readTabSelected() {
|
||||
selectedTab = in.read8UC();
|
||||
selectedTab = in.readU8C();
|
||||
redrawSidebar = true;
|
||||
redrawSideicons = true;
|
||||
}
|
||||
|
||||
private void readIfChat() {
|
||||
int interfaceID = in.read16ULE();
|
||||
int interfaceID = in.readU16LE();
|
||||
resetInterfaceAnimation(interfaceID);
|
||||
if (sidebarInterfaceID != -1) {
|
||||
sidebarInterfaceID = -1;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class IdkType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("idk.dat"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
if (instances == null) {
|
||||
instances = new IdkType[count];
|
||||
}
|
||||
@@ -35,25 +35,25 @@ public class IdkType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
type = in.read8U();
|
||||
type = in.readU8();
|
||||
} else if (code == 2) {
|
||||
int j = in.read8U();
|
||||
int j = in.readU8();
|
||||
modelIDs = new int[j];
|
||||
for (int k = 0; k < j; k++) {
|
||||
modelIDs[k] = in.read16U();
|
||||
modelIDs[k] = in.readU16();
|
||||
}
|
||||
} else if (code == 3) {
|
||||
selectable = true;
|
||||
} else if ((code >= 40) && (code < 50)) {
|
||||
colorSrc[code - 40] = in.read16U();
|
||||
colorSrc[code - 40] = in.readU16();
|
||||
} else if ((code >= 50) && (code < 60)) {
|
||||
colorDst[code - 50] = in.read16U();
|
||||
colorDst[code - 50] = in.readU16();
|
||||
} else if ((code >= 60) && (code < 70)) {
|
||||
headModelIDs[code - 60] = in.read16U();
|
||||
headModelIDs[code - 60] = in.readU16();
|
||||
} else {
|
||||
System.out.println("Error unrecognised identikit config code: " + code);
|
||||
}
|
||||
|
||||
+51
-51
@@ -38,91 +38,91 @@ public class IfType {
|
||||
Buffer in = new Buffer(config.read("data"));
|
||||
|
||||
int parentID = -1;
|
||||
int count = in.read16U();
|
||||
int count = in.readU16();
|
||||
|
||||
instances = new IfType[count];
|
||||
|
||||
while (in.position < in.data.length) {
|
||||
int id = in.read16U();
|
||||
int id = in.readU16();
|
||||
|
||||
if (id == 65535) {
|
||||
parentID = in.read16U();
|
||||
id = in.read16U();
|
||||
parentID = in.readU16();
|
||||
id = in.readU16();
|
||||
}
|
||||
|
||||
IfType iface = instances[id] = new IfType();
|
||||
iface.id = id;
|
||||
iface.parentID = parentID;
|
||||
iface.type = in.read8U();
|
||||
iface.optionType = in.read8U();
|
||||
iface.contentType = in.read16U();
|
||||
iface.width = in.read16U();
|
||||
iface.height = in.read16U();
|
||||
iface.transparency = (byte) in.read8U();
|
||||
iface.delegateHover = in.read8U();
|
||||
iface.type = in.readU8();
|
||||
iface.optionType = in.readU8();
|
||||
iface.contentType = in.readU16();
|
||||
iface.width = in.readU16();
|
||||
iface.height = in.readU16();
|
||||
iface.transparency = (byte) in.readU8();
|
||||
iface.delegateHover = in.readU8();
|
||||
|
||||
if (iface.delegateHover != 0) {
|
||||
iface.delegateHover = ((iface.delegateHover - 1) << 8) + in.read8U();
|
||||
iface.delegateHover = ((iface.delegateHover - 1) << 8) + in.readU8();
|
||||
} else {
|
||||
iface.delegateHover = -1;
|
||||
}
|
||||
|
||||
int comparatorCount = in.read8U();
|
||||
int comparatorCount = in.readU8();
|
||||
if (comparatorCount > 0) {
|
||||
iface.scriptComparator = new int[comparatorCount];
|
||||
iface.scriptOperand = new int[comparatorCount];
|
||||
for (int i = 0; i < comparatorCount; i++) {
|
||||
iface.scriptComparator[i] = in.read8U();
|
||||
iface.scriptOperand[i] = in.read16U();
|
||||
iface.scriptComparator[i] = in.readU8();
|
||||
iface.scriptOperand[i] = in.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
int scriptCount = in.read8U();
|
||||
int scriptCount = in.readU8();
|
||||
if (scriptCount > 0) {
|
||||
iface.scripts = new int[scriptCount][];
|
||||
for (int scriptID = 0; scriptID < scriptCount; scriptID++) {
|
||||
int length = in.read16U();
|
||||
int length = in.readU16();
|
||||
iface.scripts[scriptID] = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
iface.scripts[scriptID][i] = in.read16U();
|
||||
iface.scripts[scriptID][i] = in.readU16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_PARENT) {
|
||||
iface.scrollableHeight = in.read16U();
|
||||
iface.hide = in.read8U() == 1;
|
||||
int childCount = in.read16U();
|
||||
iface.scrollableHeight = in.readU16();
|
||||
iface.hide = in.readU8() == 1;
|
||||
int childCount = in.readU16();
|
||||
iface.childID = new int[childCount];
|
||||
iface.childX = new int[childCount];
|
||||
iface.childY = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
iface.childID[i] = in.read16U();
|
||||
iface.childID[i] = in.readU16();
|
||||
iface.childX[i] = in.read16();
|
||||
iface.childY[i] = in.read16();
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_UNUSED) {
|
||||
in.read16U();
|
||||
in.read8U();
|
||||
in.readU16();
|
||||
in.readU8();
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_INVENTORY) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.inventoryDraggable = in.read8U() == 1;
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryUsable = in.read8U() == 1;
|
||||
iface.inventoryMoveReplaces = in.read8U() == 1;
|
||||
iface.inventoryMarginX = in.read8U();
|
||||
iface.inventoryMarginY = in.read8U();
|
||||
iface.inventoryDraggable = in.readU8() == 1;
|
||||
iface.inventoryInteractable = in.readU8() == 1;
|
||||
iface.inventoryUsable = in.readU8() == 1;
|
||||
iface.inventoryMoveReplaces = in.readU8() == 1;
|
||||
iface.inventoryMarginX = in.readU8();
|
||||
iface.inventoryMarginY = in.readU8();
|
||||
iface.inventorySlotOffsetX = new int[20];
|
||||
iface.inventorySlotOffsetY = new int[20];
|
||||
iface.inventorySlotImage = new Image24[20];
|
||||
|
||||
for (int slot = 0; slot < 20; slot++) {
|
||||
if (in.read8U() == 1) {
|
||||
if (in.readU8() == 1) {
|
||||
iface.inventorySlotOffsetX[slot] = in.read16();
|
||||
iface.inventorySlotOffsetY[slot] = in.read16();
|
||||
String imageName = in.readString();
|
||||
@@ -145,16 +145,16 @@ public class IfType {
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_RECT) {
|
||||
iface.fill = in.read8U() == 1;
|
||||
iface.fill = in.readU8() == 1;
|
||||
}
|
||||
|
||||
if ((iface.type == TYPE_TEXT) || (iface.type == TYPE_UNUSED)) {
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
iface.center = in.readU8() == 1;
|
||||
int fontID = in.readU8();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
iface.shadow = in.readU8() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_TEXT) {
|
||||
@@ -186,50 +186,50 @@ public class IfType {
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_MODEL) {
|
||||
int tmp = in.read8U();
|
||||
int tmp = in.readU8();
|
||||
if (tmp != 0) {
|
||||
iface.modelType = MODEL_TYPE_NORMAL;
|
||||
iface.modelID = ((tmp - 1) << 8) + in.read8U();
|
||||
iface.modelID = ((tmp - 1) << 8) + in.readU8();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
tmp = in.readU8();
|
||||
if (tmp != 0) {
|
||||
iface.activeModelType = MODEL_TYPE_NORMAL;
|
||||
iface.activeModelID = ((tmp - 1) << 8) + in.read8U();
|
||||
iface.activeModelID = ((tmp - 1) << 8) + in.readU8();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
tmp = in.readU8();
|
||||
if (tmp != 0) {
|
||||
iface.seqID = ((tmp - 1) << 8) + in.read8U();
|
||||
iface.seqID = ((tmp - 1) << 8) + in.readU8();
|
||||
} else {
|
||||
iface.seqID = -1;
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
tmp = in.readU8();
|
||||
if (tmp != 0) {
|
||||
iface.activeSeqID = ((tmp - 1) << 8) + in.read8U();
|
||||
iface.activeSeqID = ((tmp - 1) << 8) + in.readU8();
|
||||
} else {
|
||||
iface.activeSeqID = -1;
|
||||
}
|
||||
|
||||
iface.modelZoom = in.read16U();
|
||||
iface.modelPitch = in.read16U();
|
||||
iface.modelYaw = in.read16U();
|
||||
iface.modelZoom = in.readU16();
|
||||
iface.modelPitch = in.readU16();
|
||||
iface.modelYaw = in.readU16();
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_INVENTORY_TEXT) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
iface.center = in.readU8() == 1;
|
||||
int fontID = in.readU8();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
iface.shadow = in.readU8() == 1;
|
||||
iface.color = in.read32();
|
||||
iface.inventoryMarginX = in.read16();
|
||||
iface.inventoryMarginY = in.read16();
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryInteractable = in.readU8() == 1;
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int option = 0; option < 5; option++) {
|
||||
iface.inventoryOptions[option] = in.readString();
|
||||
@@ -246,7 +246,7 @@ public class IfType {
|
||||
if ((iface.optionType == OPTION_TYPE_SPELL) || (iface.type == TYPE_INVENTORY)) {
|
||||
iface.spellAction = in.readString();
|
||||
iface.spellName = in.readString();
|
||||
iface.spellFlags = in.read16U();
|
||||
iface.spellFlags = in.readU16();
|
||||
}
|
||||
|
||||
if ((iface.optionType == OPTION_TYPE_STANDARD) || (iface.optionType == OPTION_TYPE_TOGGLE) || (iface.optionType == OPTION_TYPE_SELECT) || (iface.optionType == OPTION_TYPE_CONTINUE)) {
|
||||
|
||||
+12
-12
@@ -42,10 +42,10 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
public Image24(FileArchive archive, String file, int index) throws IOException {
|
||||
Buffer dat = new Buffer(archive.read(file + ".dat"));
|
||||
Buffer idx = new Buffer(archive.read("index.dat"));
|
||||
idx.position = dat.read16U();
|
||||
cropW = idx.read16U();
|
||||
cropH = idx.read16U();
|
||||
int paletteSize = idx.read8U();
|
||||
idx.position = dat.readU16();
|
||||
cropW = idx.readU16();
|
||||
cropH = idx.readU16();
|
||||
int paletteSize = idx.readU8();
|
||||
int[] palette = new int[paletteSize];
|
||||
for (int k = 0; k < (paletteSize - 1); k++) {
|
||||
palette[k + 1] = idx.read24();
|
||||
@@ -55,26 +55,26 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
}
|
||||
for (int i = 0; i < index; i++) {
|
||||
idx.position += 2;
|
||||
dat.position += idx.read16U() * idx.read16U();
|
||||
dat.position += idx.readU16() * idx.readU16();
|
||||
idx.position++;
|
||||
}
|
||||
cropX = idx.read8U();
|
||||
cropY = idx.read8U();
|
||||
width = idx.read16U();
|
||||
height = idx.read16U();
|
||||
int layout = idx.read8U();
|
||||
cropX = idx.readU8();
|
||||
cropY = idx.readU8();
|
||||
width = idx.readU16();
|
||||
height = idx.readU16();
|
||||
int layout = idx.readU8();
|
||||
int pixelLen = width * height;
|
||||
pixels = new int[pixelLen];
|
||||
if (layout == 0) {
|
||||
for (int i = 0; i < pixelLen; i++) {
|
||||
pixels[i] = palette[dat.read8U()];
|
||||
pixels[i] = palette[dat.readU8()];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (layout == 1) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
pixels[x + (y * width)] = palette[dat.read8U()];
|
||||
pixels[x + (y * width)] = palette[dat.readU8()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -14,30 +14,30 @@ public class Image8 {
|
||||
public Image8(FileArchive archive, String name, int index) throws IOException {
|
||||
Buffer dat = new Buffer(archive.read(name + ".dat"));
|
||||
Buffer idx = new Buffer(archive.read("index.dat"));
|
||||
idx.position = dat.read16U();
|
||||
cropW = idx.read16U();
|
||||
cropH = idx.read16U();
|
||||
int paletteSize = idx.read8U();
|
||||
idx.position = dat.readU16();
|
||||
cropW = idx.readU16();
|
||||
cropH = idx.readU16();
|
||||
int paletteSize = idx.readU8();
|
||||
palette = new int[paletteSize];
|
||||
for (int i = 0; i < (paletteSize - 1); i++) {
|
||||
palette[i + 1] = idx.read24();
|
||||
}
|
||||
for (int i = 0; i < index; i++) {
|
||||
idx.position += 2;
|
||||
dat.position += idx.read16U() * idx.read16U();
|
||||
dat.position += idx.readU16() * idx.readU16();
|
||||
idx.position++;
|
||||
}
|
||||
cropX = idx.read8U();
|
||||
cropY = idx.read8U();
|
||||
width = idx.read16U();
|
||||
height = idx.read16U();
|
||||
int pixelOrder = idx.read8U();
|
||||
cropX = idx.readU8();
|
||||
cropY = idx.readU8();
|
||||
width = idx.readU16();
|
||||
height = idx.readU16();
|
||||
int pixelOrder = idx.readU8();
|
||||
int pixelCount = width * height;
|
||||
pixels = new byte[pixelCount];
|
||||
|
||||
if (pixelOrder == 0) {
|
||||
for (int i = 0; i < pixelCount; i++) {
|
||||
pixels[i] = dat.read();
|
||||
pixels[i] = dat.read8();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class Image8 {
|
||||
if (pixelOrder == 1) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
pixels[x + (y * width)] = dat.read();
|
||||
pixels[x + (y * width)] = dat.read8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-29
@@ -78,12 +78,12 @@ public class LocType {
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
dat = new Buffer(archive.read("loc.dat"));
|
||||
Buffer buffer = new Buffer(archive.read("loc.idx"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
offsets = new int[count];
|
||||
int offset = 2;
|
||||
for (int j = 0; j < count; j++) {
|
||||
offsets[j] = offset;
|
||||
offset += buffer.read16U();
|
||||
offset += buffer.readU16();
|
||||
}
|
||||
cache = new LocType[20];
|
||||
for (int i = 0; i < 20; i++) {
|
||||
@@ -409,19 +409,19 @@ public class LocType {
|
||||
do {
|
||||
int j;
|
||||
do {
|
||||
j = buffer.read8U();
|
||||
j = buffer.readU8();
|
||||
if (j == 0) {
|
||||
break label0;
|
||||
}
|
||||
if (j == 1) {
|
||||
int k = buffer.read8U();
|
||||
int k = buffer.readU8();
|
||||
if (k > 0) {
|
||||
if ((modelIDs == null) || lowmem) {
|
||||
modelKinds = new int[k];
|
||||
modelIDs = new int[k];
|
||||
for (int k1 = 0; k1 < k; k1++) {
|
||||
modelIDs[k1] = buffer.read16U();
|
||||
modelKinds[k1] = buffer.read8U();
|
||||
modelIDs[k1] = buffer.readU16();
|
||||
modelKinds[k1] = buffer.readU8();
|
||||
}
|
||||
} else {
|
||||
buffer.position += k * 3;
|
||||
@@ -432,28 +432,28 @@ public class LocType {
|
||||
} else if (j == 3) {
|
||||
examine = buffer.readString();
|
||||
} else if (j == 5) {
|
||||
int l = buffer.read8U();
|
||||
int l = buffer.readU8();
|
||||
if (l > 0) {
|
||||
if ((modelIDs == null) || lowmem) {
|
||||
modelKinds = null;
|
||||
modelIDs = new int[l];
|
||||
for (int l1 = 0; l1 < l; l1++) {
|
||||
modelIDs[l1] = buffer.read16U();
|
||||
modelIDs[l1] = buffer.readU16();
|
||||
}
|
||||
} else {
|
||||
buffer.position += l * 2;
|
||||
}
|
||||
}
|
||||
} else if (j == 14) {
|
||||
sizeX = buffer.read8U();
|
||||
sizeX = buffer.readU8();
|
||||
} else if (j == 15) {
|
||||
sizeZ = buffer.read8U();
|
||||
sizeZ = buffer.readU8();
|
||||
} else if (j == 17) {
|
||||
solid = false;
|
||||
} else if (j == 18) {
|
||||
blocksProjectiles = false;
|
||||
} else if (j == 19) {
|
||||
i = buffer.read8U();
|
||||
i = buffer.readU8();
|
||||
if (i == 1) {
|
||||
interactable = true;
|
||||
}
|
||||
@@ -464,16 +464,16 @@ public class LocType {
|
||||
} else if (j == 23) {
|
||||
occludes = true;
|
||||
} else if (j == 24) {
|
||||
seqID = buffer.read16U();
|
||||
seqID = buffer.readU16();
|
||||
if (seqID == 65535) {
|
||||
seqID = -1;
|
||||
}
|
||||
} else if (j == 28) {
|
||||
decorOffset = buffer.read8U();
|
||||
decorOffset = buffer.readU8();
|
||||
} else if (j == 29) {
|
||||
lightAmbient = buffer.read();
|
||||
lightAmbient = buffer.read8();
|
||||
} else if (j == 39) {
|
||||
lightAttenuation = buffer.read();
|
||||
lightAttenuation = buffer.read8();
|
||||
} else if ((j >= 30) && (j < 39)) {
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
@@ -483,29 +483,29 @@ public class LocType {
|
||||
options[j - 30] = null;
|
||||
}
|
||||
} else if (j == 40) {
|
||||
int i1 = buffer.read8U();
|
||||
int i1 = buffer.readU8();
|
||||
srcColor = new int[i1];
|
||||
dstColor = new int[i1];
|
||||
for (int i2 = 0; i2 < i1; i2++) {
|
||||
srcColor[i2] = buffer.read16U();
|
||||
dstColor[i2] = buffer.read16U();
|
||||
srcColor[i2] = buffer.readU16();
|
||||
dstColor[i2] = buffer.readU16();
|
||||
}
|
||||
} else if (j == 60) {
|
||||
mapfunctionIcon = buffer.read16U();
|
||||
mapfunctionIcon = buffer.readU16();
|
||||
} else if (j == 62) {
|
||||
invert = true;
|
||||
} else if (j == 64) {
|
||||
castShadow = false;
|
||||
} else if (j == 65) {
|
||||
scaleX = buffer.read16U();
|
||||
scaleX = buffer.readU16();
|
||||
} else if (j == 66) {
|
||||
scaleZ = buffer.read16U();
|
||||
scaleZ = buffer.readU16();
|
||||
} else if (j == 67) {
|
||||
scaleY = buffer.read16U();
|
||||
scaleY = buffer.readU16();
|
||||
} else if (j == 68) {
|
||||
mapsceneIcon = buffer.read16U();
|
||||
mapsceneIcon = buffer.readU16();
|
||||
} else if (j == 69) {
|
||||
interactionSideFlags = buffer.read8U();
|
||||
interactionSideFlags = buffer.readU8();
|
||||
} else if (j == 70) {
|
||||
translateX = buffer.read16();
|
||||
} else if (j == 71) {
|
||||
@@ -520,22 +520,22 @@ public class LocType {
|
||||
if (j != 75) {
|
||||
continue;
|
||||
}
|
||||
supportsObj = buffer.read8U();
|
||||
supportsObj = buffer.readU8();
|
||||
}
|
||||
continue label0;
|
||||
} while (j != 77);
|
||||
varbit = buffer.read16U();
|
||||
varbit = buffer.readU16();
|
||||
if (varbit == 65535) {
|
||||
varbit = -1;
|
||||
}
|
||||
varp = buffer.read16U();
|
||||
varp = buffer.readU16();
|
||||
if (varp == 65535) {
|
||||
varp = -1;
|
||||
}
|
||||
int j1 = buffer.read8U();
|
||||
int j1 = buffer.readU8();
|
||||
overrideTypeIDs = new int[j1 + 1];
|
||||
for (int j2 = 0; j2 <= j1; j2++) {
|
||||
overrideTypeIDs[j2] = buffer.read16U();
|
||||
overrideTypeIDs[j2] = buffer.readU16();
|
||||
if (overrideTypeIDs[j2] == 65535) {
|
||||
overrideTypeIDs[j2] = -1;
|
||||
}
|
||||
|
||||
+23
-23
@@ -108,20 +108,20 @@ public class Model extends Entity {
|
||||
buffer.position = src.length - 18;
|
||||
Header header = headers[id] = new Header();
|
||||
header.data = src;
|
||||
header.vertexCount = buffer.read16U();
|
||||
header.faceCount = buffer.read16U();
|
||||
header.texturedFaceCount = buffer.read8U();
|
||||
header.vertexCount = buffer.readU16();
|
||||
header.faceCount = buffer.readU16();
|
||||
header.texturedFaceCount = buffer.readU8();
|
||||
|
||||
int hasInfo = buffer.read8U();
|
||||
int priority = buffer.read8U();
|
||||
int hasAlpha = buffer.read8U();
|
||||
int hasFaceLabels = buffer.read8U();
|
||||
int hasVertexLabels = buffer.read8U();
|
||||
int hasInfo = buffer.readU8();
|
||||
int priority = buffer.readU8();
|
||||
int hasAlpha = buffer.readU8();
|
||||
int hasFaceLabels = buffer.readU8();
|
||||
int hasVertexLabels = buffer.readU8();
|
||||
|
||||
int dataLengthX = buffer.read16U();
|
||||
int dataLengthY = buffer.read16U();
|
||||
int dataLengthZ = buffer.read16U();
|
||||
int dataLengthFaceOrientations = buffer.read16U();
|
||||
int dataLengthX = buffer.readU16();
|
||||
int dataLengthY = buffer.readU16();
|
||||
int dataLengthZ = buffer.readU16();
|
||||
int dataLengthFaceOrientations = buffer.readU16();
|
||||
|
||||
int offset = 0;
|
||||
header.vertexFlagsOffset = offset;
|
||||
@@ -398,7 +398,7 @@ public class Model extends Entity {
|
||||
int z = 0;
|
||||
|
||||
for (int v = 0; v < vertexCount; v++) {
|
||||
int flags = buf0.read8U();
|
||||
int flags = buf0.readU8();
|
||||
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
@@ -425,7 +425,7 @@ public class Model extends Entity {
|
||||
z = vertexZ[v];
|
||||
|
||||
if (vertexLabel != null) {
|
||||
vertexLabel[v] = buf4.read8U();
|
||||
vertexLabel[v] = buf4.readU8();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,22 +436,22 @@ public class Model extends Entity {
|
||||
buf4.position = header.faceLabelsOffset;
|
||||
|
||||
for (int face = 0; face < faceCount; face++) {
|
||||
faceColor[face] = buf0.read16U();
|
||||
faceColor[face] = buf0.readU16();
|
||||
|
||||
if (faceInfo != null) {
|
||||
faceInfo[face] = buf1.read8U();
|
||||
faceInfo[face] = buf1.readU8();
|
||||
}
|
||||
|
||||
if (facePriority != null) {
|
||||
facePriority[face] = buf2.read8U();
|
||||
facePriority[face] = buf2.readU8();
|
||||
}
|
||||
|
||||
if (faceAlpha != null) {
|
||||
faceAlpha[face] = buf3.read8U();
|
||||
faceAlpha[face] = buf3.readU8();
|
||||
}
|
||||
|
||||
if (faceLabel != null) {
|
||||
faceLabel[face] = buf4.read8U();
|
||||
faceLabel[face] = buf4.readU8();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ public class Model extends Entity {
|
||||
int last = 0;
|
||||
|
||||
for (int face = 0; face < faceCount; face++) {
|
||||
int orientation = buf1.read8U();
|
||||
int orientation = buf1.readU8();
|
||||
|
||||
// fancy shmansy compression type stuff.
|
||||
// vertex indices stored as deltas, with some faces
|
||||
@@ -519,9 +519,9 @@ public class Model extends Entity {
|
||||
buf0.position = header.faceTextureAxisOffset;
|
||||
|
||||
for (int face = 0; face < texturedFaceCount; face++) {
|
||||
texturedVertexA[face] = buf0.read16U();
|
||||
texturedVertexB[face] = buf0.read16U();
|
||||
texturedVertexC[face] = buf0.read16U();
|
||||
texturedVertexA[face] = buf0.readU16();
|
||||
texturedVertexB[face] = buf0.readU16();
|
||||
texturedVertexC[face] = buf0.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+29
-29
@@ -33,13 +33,13 @@ public class NPCType {
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
dat = new Buffer(archive.read("npc.dat"));
|
||||
Buffer buffer = new Buffer(archive.read("npc.idx"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
offsets = new int[count];
|
||||
|
||||
int offset = 2;
|
||||
for (int i = 0; i < count; i++) {
|
||||
offsets[i] = offset;
|
||||
offset += buffer.read16U();
|
||||
offset += buffer.readU16();
|
||||
}
|
||||
|
||||
cache = new NPCType[20];
|
||||
@@ -233,31 +233,31 @@ public class NPCType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
int modelCount = in.read8U();
|
||||
int modelCount = in.readU8();
|
||||
modelIDs = new int[modelCount];
|
||||
for (int i = 0; i < modelCount; i++) {
|
||||
modelIDs[i] = in.read16U();
|
||||
modelIDs[i] = in.readU16();
|
||||
}
|
||||
} else if (code == 2) {
|
||||
name = in.readString();
|
||||
} else if (code == 3) {
|
||||
examine = in.readString();
|
||||
} else if (code == 12) {
|
||||
size = in.read();
|
||||
size = in.read8();
|
||||
} else if (code == 13) {
|
||||
seqStandID = in.read16U();
|
||||
seqStandID = in.readU16();
|
||||
} else if (code == 14) {
|
||||
seqWalkID = in.read16U();
|
||||
seqWalkID = in.readU16();
|
||||
} else if (code == 17) {
|
||||
seqWalkID = in.read16U();
|
||||
seqTurnAroundID = in.read16U();
|
||||
seqTurnLeftID = in.read16U();
|
||||
seqTurnRightID = in.read16U();
|
||||
seqWalkID = in.readU16();
|
||||
seqTurnAroundID = in.readU16();
|
||||
seqTurnLeftID = in.readU16();
|
||||
seqTurnRightID = in.readU16();
|
||||
} else if ((code >= 30) && (code < 40)) {
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
@@ -269,58 +269,58 @@ public class NPCType {
|
||||
options[code - 30] = null;
|
||||
}
|
||||
} else if (code == 40) {
|
||||
int count = in.read8U();
|
||||
int count = in.readU8();
|
||||
colorSrc = new int[count];
|
||||
colorDst = new int[count];
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
colorSrc[i] = in.read16U();
|
||||
colorDst[i] = in.read16U();
|
||||
colorSrc[i] = in.readU16();
|
||||
colorDst[i] = in.readU16();
|
||||
}
|
||||
} else if (code == 60) {
|
||||
int count = in.read8U();
|
||||
int count = in.readU8();
|
||||
headModelIDs = new int[count];
|
||||
for (int l1 = 0; l1 < count; l1++) {
|
||||
headModelIDs[l1] = in.read16U();
|
||||
headModelIDs[l1] = in.readU16();
|
||||
}
|
||||
} else if ((code == 90) || (code == 91) || (code == 92)) {
|
||||
in.read16U();
|
||||
in.readU16();
|
||||
} else if (code == 93) {
|
||||
showOnMinimap = false;
|
||||
} else if (code == 95) {
|
||||
level = in.read16U();
|
||||
level = in.readU16();
|
||||
} else if (code == 97) {
|
||||
scaleXY = in.read16U();
|
||||
scaleXY = in.readU16();
|
||||
} else if (code == 98) {
|
||||
scaleZ = in.read16U();
|
||||
scaleZ = in.readU16();
|
||||
} else if (code == 99) {
|
||||
important = true;
|
||||
} else if (code == 100) {
|
||||
lightAmbient = in.read();
|
||||
lightAmbient = in.read8();
|
||||
} else if (code == 101) {
|
||||
lightAttenuation = in.read() * 5;
|
||||
lightAttenuation = in.read8() * 5;
|
||||
} else if (code == 102) {
|
||||
headicon = in.read16U();
|
||||
headicon = in.readU16();
|
||||
} else if (code == 103) {
|
||||
turnSpeed = in.read16U();
|
||||
turnSpeed = in.readU16();
|
||||
} else if (code == 106) {
|
||||
varbitID = in.read16U();
|
||||
varbitID = in.readU16();
|
||||
|
||||
if (varbitID == 65535) {
|
||||
varbitID = -1;
|
||||
}
|
||||
|
||||
varpID = in.read16U();
|
||||
varpID = in.readU16();
|
||||
|
||||
if (varpID == 65535) {
|
||||
varpID = -1;
|
||||
}
|
||||
|
||||
int overrideCount = in.read8U();
|
||||
int overrideCount = in.readU8();
|
||||
overrides = new int[overrideCount + 1];
|
||||
|
||||
for (int i = 0; i <= overrideCount; i++) {
|
||||
overrides[i] = in.read16U();
|
||||
overrides[i] = in.readU16();
|
||||
|
||||
if (overrides[i] == 65535) {
|
||||
overrides[i] = -1;
|
||||
|
||||
+36
-36
@@ -27,12 +27,12 @@ public class ObjType {
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
dat = new Buffer(archive.read("obj.dat"));
|
||||
Buffer idx = new Buffer(archive.read("obj.idx"));
|
||||
count = idx.read16U();
|
||||
count = idx.readU16();
|
||||
typeOffset = new int[count];
|
||||
int offset = 2;
|
||||
for (int j = 0; j < count; j++) {
|
||||
typeOffset[j] = offset;
|
||||
offset += idx.read16U();
|
||||
offset += idx.readU16();
|
||||
}
|
||||
recent = new ObjType[10];
|
||||
for (int k = 0; k < 10; k++) {
|
||||
@@ -556,34 +556,34 @@ public class ObjType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
modelID = in.read16U();
|
||||
modelID = in.readU16();
|
||||
} else if (code == 2) {
|
||||
name = in.readString();
|
||||
} else if (code == 3) {
|
||||
examine = in.readString();
|
||||
} else if (code == 4) {
|
||||
iconZoom = in.read16U();
|
||||
iconZoom = in.readU16();
|
||||
} else if (code == 5) {
|
||||
iconPitch = in.read16U();
|
||||
iconPitch = in.readU16();
|
||||
} else if (code == 6) {
|
||||
iconYaw = in.read16U();
|
||||
iconYaw = in.readU16();
|
||||
} else if (code == 7) {
|
||||
iconOffsetX = in.read16U();
|
||||
iconOffsetX = in.readU16();
|
||||
if (iconOffsetX > 32767) {
|
||||
iconOffsetX -= 0x10000;
|
||||
}
|
||||
} else if (code == 8) {
|
||||
iconOffsetY = in.read16U();
|
||||
iconOffsetY = in.readU16();
|
||||
if (iconOffsetY > 32767) {
|
||||
iconOffsetY -= 0x10000;
|
||||
}
|
||||
} else if (code == 10) {
|
||||
in.read16U();
|
||||
in.readU16();
|
||||
} else if (code == 11) {
|
||||
stackable = true;
|
||||
} else if (code == 12) {
|
||||
@@ -591,15 +591,15 @@ public class ObjType {
|
||||
} else if (code == 16) {
|
||||
members = true;
|
||||
} else if (code == 23) {
|
||||
maleModelID0 = in.read16U();
|
||||
maleOffsetY = in.read();
|
||||
maleModelID0 = in.readU16();
|
||||
maleOffsetY = in.read8();
|
||||
} else if (code == 24) {
|
||||
maleModelID1 = in.read16U();
|
||||
maleModelID1 = in.readU16();
|
||||
} else if (code == 25) {
|
||||
femaleModelID0 = in.read16U();
|
||||
femaleOffsetY = in.read();
|
||||
femaleModelID0 = in.readU16();
|
||||
femaleOffsetY = in.read8();
|
||||
} else if (code == 26) {
|
||||
femaleModelID1 = in.read16U();
|
||||
femaleModelID1 = in.readU16();
|
||||
} else if ((code >= 30) && (code < 35)) {
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
@@ -614,50 +614,50 @@ public class ObjType {
|
||||
}
|
||||
inventoryOptions[code - 35] = in.readString();
|
||||
} else if (code == 40) {
|
||||
int recolorCount = in.read8U();
|
||||
int recolorCount = in.readU8();
|
||||
srcColor = new int[recolorCount];
|
||||
dstColor = new int[recolorCount];
|
||||
for (int i = 0; i < recolorCount; i++) {
|
||||
srcColor[i] = in.read16U();
|
||||
dstColor[i] = in.read16U();
|
||||
srcColor[i] = in.readU16();
|
||||
dstColor[i] = in.readU16();
|
||||
}
|
||||
} else if (code == 78) {
|
||||
maleModelID2 = in.read16U();
|
||||
maleModelID2 = in.readU16();
|
||||
} else if (code == 79) {
|
||||
femaleModelID2 = in.read16U();
|
||||
femaleModelID2 = in.readU16();
|
||||
} else if (code == 90) {
|
||||
maleHeadModelID0 = in.read16U();
|
||||
maleHeadModelID0 = in.readU16();
|
||||
} else if (code == 91) {
|
||||
femaleHeadModelID0 = in.read16U();
|
||||
femaleHeadModelID0 = in.readU16();
|
||||
} else if (code == 92) {
|
||||
maleHeadModelID1 = in.read16U();
|
||||
maleHeadModelID1 = in.readU16();
|
||||
} else if (code == 93) {
|
||||
femaleHeadModelID1 = in.read16U();
|
||||
femaleHeadModelID1 = in.readU16();
|
||||
} else if (code == 95) {
|
||||
iconRoll = in.read16U();
|
||||
iconRoll = in.readU16();
|
||||
} else if (code == 97) {
|
||||
linkedID = in.read16U();
|
||||
linkedID = in.readU16();
|
||||
} else if (code == 98) {
|
||||
certificateID = in.read16U();
|
||||
certificateID = in.readU16();
|
||||
} else if ((code >= 100) && (code < 110)) {
|
||||
if (stackID == null) {
|
||||
stackID = new int[10];
|
||||
stackCount = new int[10];
|
||||
}
|
||||
stackID[code - 100] = in.read16U();
|
||||
stackCount[code - 100] = in.read16U();
|
||||
stackID[code - 100] = in.readU16();
|
||||
stackCount[code - 100] = in.readU16();
|
||||
} else if (code == 110) {
|
||||
scaleX = in.read16U();
|
||||
scaleX = in.readU16();
|
||||
} else if (code == 111) {
|
||||
scaleZ = in.read16U();
|
||||
scaleZ = in.readU16();
|
||||
} else if (code == 112) {
|
||||
scaleY = in.read16U();
|
||||
scaleY = in.readU16();
|
||||
} else if (code == 113) {
|
||||
lightAmbient = in.read();
|
||||
lightAmbient = in.read8();
|
||||
} else if (code == 114) {
|
||||
lightAttenuation = in.read() * 5;
|
||||
lightAttenuation = in.read8() * 5;
|
||||
} else if (code == 115) {
|
||||
team = in.read8U();
|
||||
team = in.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class OnDemand implements Runnable {
|
||||
storeFilePriorities[i] = new byte[count];
|
||||
|
||||
for (int l = 0; l < count; l++) {
|
||||
storeFileVersions[i][l] = buffer.read16U();
|
||||
storeFileVersions[i][l] = buffer.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,10 +229,10 @@ public class OnDemand implements Runnable {
|
||||
mapPrefetched = new int[count];
|
||||
|
||||
for (int i2 = 0; i2 < count; i2++) {
|
||||
mapIndex[i2] = buffer.read16U();
|
||||
mapLandFile[i2] = buffer.read16U();
|
||||
mapLocFile[i2] = buffer.read16U();
|
||||
mapPrefetched[i2] = buffer.read8U();
|
||||
mapIndex[i2] = buffer.readU16();
|
||||
mapLandFile[i2] = buffer.readU16();
|
||||
mapLocFile[i2] = buffer.readU16();
|
||||
mapPrefetched[i2] = buffer.readU8();
|
||||
}
|
||||
|
||||
data = versionlist.read("anim_index");
|
||||
@@ -241,7 +241,7 @@ public class OnDemand implements Runnable {
|
||||
animIndex = new int[count];
|
||||
|
||||
for (int j2 = 0; j2 < count; j2++) {
|
||||
animIndex[j2] = buffer.read16U();
|
||||
animIndex[j2] = buffer.readU16();
|
||||
}
|
||||
|
||||
data = versionlist.read("midi_index");
|
||||
@@ -250,7 +250,7 @@ public class OnDemand implements Runnable {
|
||||
midiIndex = new int[count];
|
||||
|
||||
for (int k2 = 0; k2 < count; k2++) {
|
||||
midiIndex[k2] = buffer.read8U();
|
||||
midiIndex[k2] = buffer.readU8();
|
||||
}
|
||||
|
||||
this.game = game;
|
||||
|
||||
@@ -116,24 +116,24 @@ public class PlayerEntity extends PathingEntity {
|
||||
|
||||
public void read(Buffer in) {
|
||||
in.position = 0;
|
||||
gender = in.read8U();
|
||||
headicons = in.read8U();
|
||||
gender = in.readU8();
|
||||
headicons = in.readU8();
|
||||
transmogrify = null;
|
||||
team = 0;
|
||||
|
||||
for (int part = 0; part < 12; part++) {
|
||||
int msb = in.read8U();
|
||||
int msb = in.readU8();
|
||||
|
||||
if (msb == 0) {
|
||||
appearances[part] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
int lsb = in.read8U();
|
||||
int lsb = in.readU8();
|
||||
appearances[part] = (msb << 8) + lsb;
|
||||
|
||||
if ((part == 0) && (appearances[0] == 65535)) {
|
||||
transmogrify = NPCType.get(in.read16U());
|
||||
transmogrify = NPCType.get(in.readU16());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
}
|
||||
|
||||
for (int part = 0; part < 5; part++) {
|
||||
int color = in.read8U();
|
||||
int color = in.readU8();
|
||||
|
||||
if ((color < 0) || (color >= Game.designPartColor[part].length)) {
|
||||
color = 0;
|
||||
@@ -156,37 +156,37 @@ public class PlayerEntity extends PathingEntity {
|
||||
colors[part] = color;
|
||||
}
|
||||
|
||||
super.seqStandID = in.read16U();
|
||||
super.seqStandID = in.readU16();
|
||||
if (super.seqStandID == 65535) {
|
||||
super.seqStandID = -1;
|
||||
}
|
||||
super.seqTurnID = in.read16U();
|
||||
super.seqTurnID = in.readU16();
|
||||
if (super.seqTurnID == 65535) {
|
||||
super.seqTurnID = -1;
|
||||
}
|
||||
super.seqWalkID = in.read16U();
|
||||
super.seqWalkID = in.readU16();
|
||||
if (super.seqWalkID == 65535) {
|
||||
super.seqWalkID = -1;
|
||||
}
|
||||
super.seqTurnAroundID = in.read16U();
|
||||
super.seqTurnAroundID = in.readU16();
|
||||
if (super.seqTurnAroundID == 65535) {
|
||||
super.seqTurnAroundID = -1;
|
||||
}
|
||||
super.seqTurnLeftID = in.read16U();
|
||||
super.seqTurnLeftID = in.readU16();
|
||||
if (super.seqTurnLeftID == 65535) {
|
||||
super.seqTurnLeftID = -1;
|
||||
}
|
||||
super.seqTurnRightID = in.read16U();
|
||||
super.seqTurnRightID = in.readU16();
|
||||
if (super.seqTurnRightID == 65535) {
|
||||
super.seqTurnRightID = -1;
|
||||
}
|
||||
super.seqRunID = in.read16U();
|
||||
super.seqRunID = in.readU16();
|
||||
if (super.seqRunID == 65535) {
|
||||
super.seqRunID = -1;
|
||||
}
|
||||
name = StringUtil.formatName(StringUtil.fromBase37(in.read64()));
|
||||
combatLevel = in.read8U();
|
||||
skillLevel = in.read16U();
|
||||
combatLevel = in.readU8();
|
||||
skillLevel = in.readU16();
|
||||
visible = true;
|
||||
|
||||
appearanceHashcode = 0L;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class SceneBuilder {
|
||||
int locID = -1;
|
||||
|
||||
for (; ; ) {
|
||||
int deltaID = buffer.readSmartU();
|
||||
int deltaID = buffer.readUSmart();
|
||||
|
||||
if (deltaID == 0) {
|
||||
break;
|
||||
@@ -45,8 +45,8 @@ public class SceneBuilder {
|
||||
LocType type = LocType.get(locID);
|
||||
type.prefetch(onDemand);
|
||||
|
||||
while (buffer.readSmartU() != 0) {
|
||||
buffer.read8U();
|
||||
while (buffer.readUSmart() != 0) {
|
||||
buffer.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,7 +350,7 @@ public class SceneBuilder {
|
||||
int locID = -1;
|
||||
|
||||
for (; ; ) {
|
||||
int deltaID = buffer.readSmartU();
|
||||
int deltaID = buffer.readUSmart();
|
||||
if (deltaID == 0) {
|
||||
break;
|
||||
}
|
||||
@@ -363,12 +363,12 @@ public class SceneBuilder {
|
||||
// this loop is for the same Loc ID.
|
||||
for (; ; ) {
|
||||
if (skip) {
|
||||
if (buffer.readSmartU() == 0) {
|
||||
if (buffer.readUSmart() == 0) {
|
||||
break;
|
||||
}
|
||||
buffer.read8U();
|
||||
buffer.readU8();
|
||||
} else {
|
||||
int deltaPos = buffer.readSmartU();
|
||||
int deltaPos = buffer.readUSmart();
|
||||
|
||||
if (deltaPos == 0) {
|
||||
break;
|
||||
@@ -379,7 +379,7 @@ public class SceneBuilder {
|
||||
int z = pos & 0x3f;
|
||||
int x = (pos >> 6) & 0x3f;
|
||||
|
||||
int kind = buffer.read8U() >> 2;
|
||||
int kind = buffer.readU8() >> 2;
|
||||
int localX = x + originX;
|
||||
int localZ = z + originZ;
|
||||
|
||||
@@ -1332,7 +1332,7 @@ public class SceneBuilder {
|
||||
levelTileFlags[level][x][z] = (byte) 0;
|
||||
|
||||
for (; ; ) {
|
||||
int type = in.read8U();
|
||||
int type = in.readU8();
|
||||
|
||||
if (type == 0) {
|
||||
if (level == 0) {
|
||||
@@ -1345,7 +1345,7 @@ public class SceneBuilder {
|
||||
}
|
||||
|
||||
if (type == 1) {
|
||||
int height = in.read8U();
|
||||
int height = in.readU8();
|
||||
|
||||
if (height == 1) {
|
||||
height = 0;
|
||||
@@ -1361,7 +1361,7 @@ public class SceneBuilder {
|
||||
}
|
||||
|
||||
if (type <= 49) {
|
||||
levelTileOverlayIDs[level][x][z] = in.read();
|
||||
levelTileOverlayIDs[level][x][z] = in.read8();
|
||||
levelTileOverlayShape[level][x][z] = (byte) ((type - 2) / 4);
|
||||
levelTileOverlayRotation[level][x][z] = (byte) (((type - 2) + mapRotation) & 0x3);
|
||||
} else if (type <= 81) {
|
||||
@@ -1372,16 +1372,16 @@ public class SceneBuilder {
|
||||
}
|
||||
} else {
|
||||
for (; ; ) {
|
||||
int type = in.read8U();
|
||||
int type = in.readU8();
|
||||
if (type == 0) {
|
||||
break;
|
||||
}
|
||||
if (type == 1) {
|
||||
in.read8U();
|
||||
in.readU8();
|
||||
break;
|
||||
}
|
||||
if (type <= 49) {
|
||||
in.read8U();
|
||||
in.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1402,7 +1402,7 @@ public class SceneBuilder {
|
||||
int locID = -1;
|
||||
|
||||
while (true) {
|
||||
int deltaID = in.readSmartU();
|
||||
int deltaID = in.readUSmart();
|
||||
|
||||
if (deltaID == 0) {
|
||||
break;
|
||||
@@ -1413,7 +1413,7 @@ public class SceneBuilder {
|
||||
int locData = 0;
|
||||
|
||||
while (true) {
|
||||
int deltaData = in.readSmartU();
|
||||
int deltaData = in.readUSmart();
|
||||
|
||||
if (deltaData == 0) {
|
||||
break;
|
||||
@@ -1424,7 +1424,7 @@ public class SceneBuilder {
|
||||
int locZ = locData & 0x3f;
|
||||
int locX = (locData >> 6) & 0x3f;
|
||||
int locLevel = locData >> 12;
|
||||
int locInfo = in.read8U();
|
||||
int locInfo = in.readU8();
|
||||
int locKind = locInfo >> 2;
|
||||
int locRotation = locInfo & 0x3;
|
||||
|
||||
@@ -1487,7 +1487,7 @@ public class SceneBuilder {
|
||||
Buffer in = new Buffer(data);
|
||||
int locID = -1;
|
||||
for (; ; ) {
|
||||
int deltaID = in.readSmartU();
|
||||
int deltaID = in.readUSmart();
|
||||
|
||||
if (deltaID == 0) {
|
||||
break;
|
||||
@@ -1497,7 +1497,7 @@ public class SceneBuilder {
|
||||
int locData = 0;
|
||||
|
||||
for (; ; ) {
|
||||
int deltaData = in.readSmartU();
|
||||
int deltaData = in.readUSmart();
|
||||
|
||||
if (deltaData == 0) {
|
||||
break;
|
||||
@@ -1507,7 +1507,7 @@ public class SceneBuilder {
|
||||
int locZ = locData & 0x3f;
|
||||
int locX = (locData >> 6) & 0x3f;
|
||||
int locLevel = locData >> 12;
|
||||
int locInfo = in.read8U();
|
||||
int locInfo = in.readU8();
|
||||
int locKind = locInfo >> 2;
|
||||
int locRotation = locInfo & 0x3;
|
||||
int x = locX + originX;
|
||||
|
||||
@@ -37,17 +37,17 @@ public class SeqSkeleton {
|
||||
* @param in the input
|
||||
*/
|
||||
public SeqSkeleton(Buffer in) {
|
||||
final int length = in.read8U();
|
||||
final int length = in.readU8();
|
||||
baseTypes = new int[length];
|
||||
baseLabels = new int[length][];
|
||||
for (int group = 0; group < length; group++) {
|
||||
baseTypes[group] = in.read8U();
|
||||
baseTypes[group] = in.readU8();
|
||||
}
|
||||
for (int group = 0; group < length; group++) {
|
||||
int count = in.read8U();
|
||||
int count = in.readU8();
|
||||
baseLabels[group] = new int[count];
|
||||
for (int child = 0; child < count; child++) {
|
||||
baseLabels[group][child] = in.read8U();
|
||||
baseLabels[group][child] = in.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,38 +67,38 @@ public class SeqTransform {
|
||||
|
||||
int offset = 0;
|
||||
header.position = offset;
|
||||
offset += offsets.read16U() + 2;
|
||||
offset += offsets.readU16() + 2;
|
||||
|
||||
tran1.position = offset;
|
||||
offset += offsets.read16U();
|
||||
offset += offsets.readU16();
|
||||
|
||||
tran2.position = offset;
|
||||
offset += offsets.read16U();
|
||||
offset += offsets.readU16();
|
||||
|
||||
del.position = offset;
|
||||
offset += offsets.read16U();
|
||||
offset += offsets.readU16();
|
||||
|
||||
skel.position = offset;
|
||||
|
||||
SeqSkeleton skeleton = new SeqSkeleton(skel);
|
||||
|
||||
int frameCount = header.read16U();
|
||||
int frameCount = header.readU16();
|
||||
int[] bases = new int[500];
|
||||
int[] x = new int[500];
|
||||
int[] y = new int[500];
|
||||
int[] z = new int[500];
|
||||
|
||||
for (int i = 0; i < frameCount; i++) {
|
||||
SeqTransform transform = instances[header.read16U()] = new SeqTransform();
|
||||
transform.delay = del.read8U();
|
||||
SeqTransform transform = instances[header.readU16()] = new SeqTransform();
|
||||
transform.delay = del.readU8();
|
||||
transform.skeleton = skeleton;
|
||||
|
||||
int baseCount = header.read8U();
|
||||
int baseCount = header.readU8();
|
||||
int lastBase = -1;
|
||||
int length = 0;
|
||||
|
||||
for (int base = 0; base < baseCount; base++) {
|
||||
int flags = tran1.read8U();
|
||||
int flags = tran1.readU8();
|
||||
|
||||
if (flags <= 0) {
|
||||
continue;
|
||||
|
||||
+16
-16
@@ -11,7 +11,7 @@ public class SeqType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("seq.dat"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
if (instances == null) {
|
||||
instances = new SeqType[count];
|
||||
}
|
||||
@@ -137,48 +137,48 @@ public class SeqType {
|
||||
|
||||
public void load(Buffer buffer) {
|
||||
while (true) {
|
||||
int code = buffer.read8U();
|
||||
int code = buffer.readU8();
|
||||
|
||||
if (code == 0) {
|
||||
break;
|
||||
} else if (code == 1) {
|
||||
frameCount = buffer.read8U();
|
||||
frameCount = buffer.readU8();
|
||||
transformIDs = new int[frameCount];
|
||||
auxiliaryTransformIDs = new int[frameCount];
|
||||
frameDuration = new int[frameCount];
|
||||
for (int f = 0; f < frameCount; f++) {
|
||||
transformIDs[f] = buffer.read16U();
|
||||
auxiliaryTransformIDs[f] = buffer.read16U();
|
||||
transformIDs[f] = buffer.readU16();
|
||||
auxiliaryTransformIDs[f] = buffer.readU16();
|
||||
if (auxiliaryTransformIDs[f] == 65535) {
|
||||
auxiliaryTransformIDs[f] = -1;
|
||||
}
|
||||
frameDuration[f] = buffer.read16U();
|
||||
frameDuration[f] = buffer.readU16();
|
||||
}
|
||||
} else if (code == 2) {
|
||||
loopFrameCount = buffer.read16U();
|
||||
loopFrameCount = buffer.readU16();
|
||||
} else if (code == 3) {
|
||||
int count = buffer.read8U();
|
||||
int count = buffer.readU8();
|
||||
mask = new int[count + 1];
|
||||
for (int l = 0; l < count; l++) {
|
||||
mask[l] = buffer.read8U();
|
||||
mask[l] = buffer.readU8();
|
||||
}
|
||||
mask[count] = 9999999;
|
||||
} else if (code == 4) {
|
||||
forwardRenderPadding = true;
|
||||
} else if (code == 5) {
|
||||
priority = buffer.read8U();
|
||||
priority = buffer.readU8();
|
||||
} else if (code == 6) {
|
||||
rightHandOverride = buffer.read16U();
|
||||
rightHandOverride = buffer.readU16();
|
||||
} else if (code == 7) {
|
||||
leftHandOverride = buffer.read16U();
|
||||
leftHandOverride = buffer.readU16();
|
||||
} else if (code == 8) {
|
||||
loopCount = buffer.read8U();
|
||||
loopCount = buffer.readU8();
|
||||
} else if (code == 9) {
|
||||
moveStyle = buffer.read8U();
|
||||
moveStyle = buffer.readU8();
|
||||
} else if (code == 10) {
|
||||
idleStyle = buffer.read8U();
|
||||
idleStyle = buffer.readU8();
|
||||
} else if (code == 11) {
|
||||
replayStyle = buffer.read8U();
|
||||
replayStyle = buffer.readU8();
|
||||
} else if (code == 12) {
|
||||
buffer.read32();
|
||||
} else {
|
||||
|
||||
@@ -22,19 +22,19 @@ public class SoundEnvelope {
|
||||
}
|
||||
|
||||
public void read(Buffer in) {
|
||||
form = in.read8U();
|
||||
form = in.readU8();
|
||||
start = in.read32();
|
||||
end = in.read32();
|
||||
readShape(in);
|
||||
}
|
||||
|
||||
public void readShape(Buffer buffer) {
|
||||
length = buffer.read8U();
|
||||
length = buffer.readU8();
|
||||
shapeDelta = new int[length];
|
||||
shapePeak = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
shapeDelta[i] = buffer.read16U();
|
||||
shapePeak[i] = buffer.read16U();
|
||||
shapeDelta[i] = buffer.readU16();
|
||||
shapePeak[i] = buffer.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,28 +80,28 @@ public class SoundFilter {
|
||||
}
|
||||
|
||||
public void read(Buffer in, SoundEnvelope envelope) {
|
||||
int count = in.read8U();
|
||||
int count = in.readU8();
|
||||
pairs[0] = count >> 4;
|
||||
pairs[1] = count & 0xf;
|
||||
|
||||
if (count != 0) {
|
||||
unities[0] = in.read16U();
|
||||
unities[1] = in.read16U();
|
||||
unities[0] = in.readU16();
|
||||
unities[1] = in.readU16();
|
||||
|
||||
int migration = in.read8U();
|
||||
int migration = in.readU8();
|
||||
|
||||
for (int direction = 0; direction < 2; direction++) {
|
||||
for (int pair = 0; pair < pairs[direction]; pair++) {
|
||||
frequencies[direction][0][pair] = in.read16U();
|
||||
ranges[direction][0][pair] = in.read16U();
|
||||
frequencies[direction][0][pair] = in.readU16();
|
||||
ranges[direction][0][pair] = in.readU16();
|
||||
}
|
||||
}
|
||||
|
||||
for (int direction = 0; direction < 2; direction++) {
|
||||
for (int pair = 0; pair < pairs[direction]; pair++) {
|
||||
if ((migration & (1 << (direction * 4) << pair)) != 0) {
|
||||
frequencies[direction][1][pair] = in.read16U();
|
||||
ranges[direction][1][pair] = in.read16U();
|
||||
frequencies[direction][1][pair] = in.readU16();
|
||||
ranges[direction][1][pair] = in.readU16();
|
||||
} else {
|
||||
frequencies[direction][1][pair] = frequencies[direction][0][pair];
|
||||
ranges[direction][1][pair] = ranges[direction][0][pair];
|
||||
|
||||
@@ -277,7 +277,7 @@ public class SoundTone {
|
||||
amplitudeBase = new SoundEnvelope();
|
||||
amplitudeBase.read(in);
|
||||
|
||||
if (in.read8U() != 0) {
|
||||
if (in.readU8() != 0) {
|
||||
in.position--;
|
||||
frequencyModRate = new SoundEnvelope();
|
||||
frequencyModRate.read(in);
|
||||
@@ -285,7 +285,7 @@ public class SoundTone {
|
||||
frequencyModRange.read(in);
|
||||
}
|
||||
|
||||
if (in.read8U() != 0) {
|
||||
if (in.readU8() != 0) {
|
||||
in.position--;
|
||||
amplitudeModRate = new SoundEnvelope();
|
||||
amplitudeModRate.read(in);
|
||||
@@ -293,7 +293,7 @@ public class SoundTone {
|
||||
amplitudeModRange.read(in);
|
||||
}
|
||||
|
||||
if (in.read8U() != 0) {
|
||||
if (in.readU8() != 0) {
|
||||
in.position--;
|
||||
release = new SoundEnvelope();
|
||||
release.read(in);
|
||||
@@ -302,7 +302,7 @@ public class SoundTone {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int volume = in.readSmartU();
|
||||
int volume = in.readUSmart();
|
||||
|
||||
if (volume == 0) {
|
||||
break;
|
||||
@@ -310,14 +310,14 @@ public class SoundTone {
|
||||
|
||||
harmonicVolume[i] = volume;
|
||||
harmonicSemitone[i] = in.readSmart();
|
||||
harmonicDelay[i] = in.readSmartU();
|
||||
harmonicDelay[i] = in.readUSmart();
|
||||
}
|
||||
|
||||
reverbDelay = in.readSmartU();
|
||||
reverbVolume = in.readSmartU();
|
||||
reverbDelay = in.readUSmart();
|
||||
reverbVolume = in.readUSmart();
|
||||
|
||||
length = in.read16U();
|
||||
start = in.read16U();
|
||||
length = in.readU16();
|
||||
start = in.readU16();
|
||||
|
||||
filter = new SoundFilter();
|
||||
filterRange = new SoundEnvelope();
|
||||
|
||||
@@ -9,7 +9,7 @@ public class SoundTrack {
|
||||
SoundTone.init();
|
||||
|
||||
do {
|
||||
int id = in.read16U();
|
||||
int id = in.readU16();
|
||||
|
||||
if (id == 65535) {
|
||||
return;
|
||||
@@ -39,14 +39,14 @@ public class SoundTrack {
|
||||
|
||||
public void read(Buffer in) {
|
||||
for (int tone = 0; tone < 10; tone++) {
|
||||
if (in.read8U() != 0) {
|
||||
if (in.readU8() != 0) {
|
||||
in.position--;
|
||||
tones[tone] = new SoundTone();
|
||||
tones[tone].read(in);
|
||||
}
|
||||
}
|
||||
loopBegin = in.read16U();
|
||||
loopEnd = in.read16U();
|
||||
loopBegin = in.readU16();
|
||||
loopEnd = in.readU16();
|
||||
}
|
||||
|
||||
public int trim() {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SpotAnimType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("spotanim.dat"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
|
||||
if (instances == null) {
|
||||
instances = new SpotAnimType[count];
|
||||
@@ -46,30 +46,30 @@ public class SpotAnimType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
modelID = in.read16U();
|
||||
modelID = in.readU16();
|
||||
} else if (code == 2) {
|
||||
seqID = in.read16U();
|
||||
seqID = in.readU16();
|
||||
if (SeqType.instances != null) {
|
||||
seq = SeqType.instances[seqID];
|
||||
}
|
||||
} else if (code == 4) {
|
||||
scaleXY = in.read16U();
|
||||
scaleXY = in.readU16();
|
||||
} else if (code == 5) {
|
||||
scaleZ = in.read16U();
|
||||
scaleZ = in.readU16();
|
||||
} else if (code == 6) {
|
||||
rotation = in.read16U();
|
||||
rotation = in.readU16();
|
||||
} else if (code == 7) {
|
||||
lightAmbient = in.read8U();
|
||||
lightAmbient = in.readU8();
|
||||
} else if (code == 8) {
|
||||
lightAttenuation = in.read8U();
|
||||
lightAttenuation = in.readU8();
|
||||
} else if ((code >= 40) && (code < 50)) {
|
||||
colorSrc[code - 40] = in.read16U();
|
||||
colorSrc[code - 40] = in.readU16();
|
||||
} else if ((code >= 50) && (code < 60)) {
|
||||
colorDst[code - 50] = in.read16U();
|
||||
colorDst[code - 50] = in.readU16();
|
||||
} else {
|
||||
System.out.println("Error unrecognised spotanim config code: " + code);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class VarbitType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("varbit.dat"));
|
||||
int count = buffer.read16U();
|
||||
int count = buffer.readU16();
|
||||
|
||||
if (instances == null) {
|
||||
instances = new VarbitType[count];
|
||||
@@ -42,13 +42,13 @@ public class VarbitType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
do {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1) {
|
||||
varp = in.read16U();
|
||||
lsb = in.read8U();
|
||||
msb = in.read8U();
|
||||
varp = in.readU16();
|
||||
lsb = in.readU8();
|
||||
msb = in.readU8();
|
||||
} else if (code == 10) {
|
||||
in.readString();
|
||||
} else if (code == 3 || code == 4) {
|
||||
|
||||
@@ -11,7 +11,7 @@ public class VarpType {
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("varp.dat"));
|
||||
count = buffer.read16U();
|
||||
count = buffer.readU16();
|
||||
if (instances == null) {
|
||||
instances = new VarpType[count];
|
||||
}
|
||||
@@ -33,13 +33,13 @@ public class VarpType {
|
||||
|
||||
public void read(Buffer in) {
|
||||
while (true) {
|
||||
int code = in.read8U();
|
||||
int code = in.readU8();
|
||||
if (code == 0) {
|
||||
return;
|
||||
} else if (code == 1 || code == 2) {
|
||||
in.read8U();
|
||||
in.readU8();
|
||||
} else if (code == 5) {
|
||||
type = in.read16U();
|
||||
type = in.readU16();
|
||||
} else if (code == 7 || code == 12) {
|
||||
in.read32();
|
||||
} else if (code == 10) {
|
||||
|
||||
Reference in new issue
Block a user