cache: update object definition

This commit is contained in:
Adam
2019-10-11 08:55:54 -04:00
parent 0bcefb0be0
commit 562ff3232e
4 changed files with 43 additions and 43 deletions

View File

@@ -532,7 +532,7 @@ public class MapImageDumper
{ {
// this is a wall // this is a wall
int hash = (localY << 7) + localX + (location.getId() << 14) + 0x4000_0000; int hash = (localY << 7) + localX + (location.getId() << 14) + 0x4000_0000;
if (object.getAnInt2088() == 0) if (object.getWallOrDoor() == 0)
{ {
hash -= Integer.MIN_VALUE; hash -= Integer.MIN_VALUE;
} }
@@ -645,7 +645,7 @@ public class MapImageDumper
} }
int hash = (localY << 7) + localX + (location.getId() << 14) + 0x4000_0000; int hash = (localY << 7) + localX + (location.getId() << 14) + 0x4000_0000;
if (object.getAnInt2088() == 0) if (object.getWallOrDoor() == 0)
{ {
hash -= Integer.MIN_VALUE; hash -= Integer.MIN_VALUE;
} }

View File

@@ -33,8 +33,8 @@ public class ObjectDefinition
{ {
private int id; private int id;
private short[] retextureToFind; private short[] retextureToFind;
private int anInt2069 = 16; private int decorDisplacement = 16;
private boolean isSolid = false; private boolean isHollow = false;
private String name = "null"; private String name = "null";
private int[] objectModels; private int[] objectModels;
private int[] objectTypes; private int[] objectTypes;
@@ -46,8 +46,8 @@ public class ObjectDefinition
private int anInt2083 = 0; private int anInt2083 = 0;
private int[] anIntArray2084; private int[] anIntArray2084;
private int offsetX = 0; private int offsetX = 0;
private boolean nonFlatShading = false; private boolean mergeNormals = false;
private int anInt2088 = -1; private int wallOrDoor = -1;
private int animationID = -1; private int animationID = -1;
private int varbitID = -1; private int varbitID = -1;
private int ambient = 0; private int ambient = 0;
@@ -56,20 +56,20 @@ public class ObjectDefinition
private int interactType = 2; private int interactType = 2;
private int mapSceneID = -1; private int mapSceneID = -1;
private short[] recolorToReplace; private short[] recolorToReplace;
private boolean aBool2097 = true; private boolean shadow = true;
private int modelSizeX = 128; private int modelSizeX = 128;
private int modelSizeHeight = 128; private int modelSizeHeight = 128;
private int modelSizeY = 128; private int modelSizeY = 128;
private int objectID; private int objectID;
private int offsetHeight = 0; private int offsetHeight = 0;
private int offsetY = 0; private int offsetY = 0;
private boolean aBool2104 = false; private boolean obstructsGround = false;
private int anInt2105 = -1; private int contouredGround = -1;
private int anInt2106 = -1; private int supportsItems = -1;
private int[] configChangeDest; private int[] configChangeDest;
private boolean isRotated = false; private boolean isRotated = false;
private int varpID = -1; private int varpID = -1;
private int anInt2110 = -1; private int ambientSoundId = -1;
private boolean aBool2111 = false; private boolean aBool2111 = false;
private int anInt2112 = 0; private int anInt2112 = 0;
private int anInt2113 = 0; private int anInt2113 = 0;

View File

@@ -117,15 +117,15 @@ public class ObjectLoader
} }
else if (opcode == 19) else if (opcode == 19)
{ {
def.setAnInt2088(is.readUnsignedByte()); def.setWallOrDoor(is.readUnsignedByte());
} }
else if (opcode == 21) else if (opcode == 21)
{ {
def.setAnInt2105(0); def.setContouredGround(0);
} }
else if (opcode == 22) else if (opcode == 22)
{ {
def.setNonFlatShading(false); def.setMergeNormals(true);
} }
else if (opcode == 23) else if (opcode == 23)
{ {
@@ -145,7 +145,7 @@ public class ObjectLoader
} }
else if (opcode == 28) else if (opcode == 28)
{ {
def.setAnInt2069(is.readUnsignedByte()); def.setDecorDisplacement(is.readUnsignedByte());
} }
else if (opcode == 29) else if (opcode == 29)
{ {
@@ -153,7 +153,7 @@ public class ObjectLoader
} }
else if (opcode == 39) else if (opcode == 39)
{ {
def.setContrast(is.readByte()); def.setContrast(is.readByte() * 25);
} }
else if (opcode >= 30 && opcode < 35) else if (opcode >= 30 && opcode < 35)
{ {
@@ -200,7 +200,7 @@ public class ObjectLoader
} }
else if (opcode == 64) else if (opcode == 64)
{ {
def.setABool2097(false); def.setShadow(false);
} }
else if (opcode == 65) else if (opcode == 65)
{ {
@@ -236,15 +236,15 @@ public class ObjectLoader
} }
else if (opcode == 73) else if (opcode == 73)
{ {
def.setABool2104(true); def.setObstructsGround(true);
} }
else if (opcode == 74) else if (opcode == 74)
{ {
def.setSolid(true); def.setHollow(true);
} }
else if (opcode == 75) else if (opcode == 75)
{ {
def.setAnInt2106(is.readUnsignedByte()); def.setSupportsItems(is.readUnsignedByte());
} }
else if (opcode == 77) else if (opcode == 77)
{ {
@@ -280,7 +280,7 @@ public class ObjectLoader
} }
else if (opcode == 78) else if (opcode == 78)
{ {
def.setAnInt2110(is.readUnsignedShort()); def.setAmbientSoundId(is.readUnsignedShort());
def.setAnInt2083(is.readUnsignedByte()); def.setAnInt2083(is.readUnsignedByte());
} }
else if (opcode == 79) else if (opcode == 79)
@@ -300,7 +300,7 @@ public class ObjectLoader
} }
else if (opcode == 81) else if (opcode == 81)
{ {
def.setAnInt2105(is.readUnsignedByte() * 256); def.setContouredGround(is.readUnsignedByte() * 256);
} }
else if (opcode == 82) else if (opcode == 82)
{ {
@@ -380,26 +380,26 @@ public class ObjectLoader
private void post(ObjectDefinition def) private void post(ObjectDefinition def)
{ {
if (def.getAnInt2088() == -1) if (def.getWallOrDoor() == -1)
{ {
def.setAnInt2088(0); def.setWallOrDoor(0);
if (def.getObjectModels() != null && (def.getObjectTypes() == null || def.getObjectTypes()[0] == 10)) if (def.getObjectModels() != null && (def.getObjectTypes() == null || def.getObjectTypes()[0] == 10))
{ {
def.setAnInt2088(1); def.setWallOrDoor(1);
} }
for (int var1 = 0; var1 < 5; ++var1) for (int var1 = 0; var1 < 5; ++var1)
{ {
if (def.getActions()[var1] != null) if (def.getActions()[var1] != null)
{ {
def.setAnInt2088(1); def.setWallOrDoor(1);
} }
} }
} }
if (def.getAnInt2106() == -1) if (def.getSupportsItems() == -1)
{ {
def.setAnInt2106(def.getInteractType() != 0 ? 1 : 0); def.setSupportsItems(def.getInteractType() != 0 ? 1 : 0);
} }
} }
} }

View File

@@ -69,16 +69,16 @@ public class ObjectSaver
{ {
out.writeByte(18); out.writeByte(18);
} }
if (obj.getAnInt2088() != -1) if (obj.getWallOrDoor() != -1)
{ {
out.writeByte(19); out.writeByte(19);
out.writeByte(obj.getAnInt2088()); out.writeByte(obj.getWallOrDoor());
} }
if (obj.getAnInt2105() == 0) if (obj.getContouredGround() == 0)
{ {
out.writeByte(21); out.writeByte(21);
} }
if (!obj.isNonFlatShading()) if (!obj.isMergeNormals())
{ {
out.writeByte(22); out.writeByte(22);
} }
@@ -96,11 +96,11 @@ public class ObjectSaver
out.writeByte(27); out.writeByte(27);
} }
out.writeByte(28); out.writeByte(28);
out.writeByte(obj.getAnInt2069()); out.writeByte(obj.getDecorDisplacement());
out.writeByte(29); out.writeByte(29);
out.writeByte(obj.getAmbient()); out.writeByte(obj.getAmbient());
out.writeByte(39); out.writeByte(39);
out.writeByte(obj.getContrast()); out.writeByte(obj.getContrast() / 25);
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i)
{ {
out.writeByte(30 + i); out.writeByte(30 + i);
@@ -131,7 +131,7 @@ public class ObjectSaver
{ {
out.writeByte(62); out.writeByte(62);
} }
if (!obj.isABool2097()) if (!obj.isShadow())
{ {
out.writeByte(64); out.writeByte(64);
} }
@@ -152,23 +152,23 @@ public class ObjectSaver
out.writeShort(obj.getOffsetHeight()); out.writeShort(obj.getOffsetHeight());
out.writeByte(72); out.writeByte(72);
out.writeShort(obj.getOffsetY()); out.writeShort(obj.getOffsetY());
if (obj.isABool2104()) if (obj.isObstructsGround())
{ {
out.writeByte(73); out.writeByte(73);
} }
if (obj.isSolid()) if (obj.isHollow())
{ {
out.writeByte(74); out.writeByte(74);
} }
if (obj.getAnInt2106() != -1) if (obj.getSupportsItems() != -1)
{ {
out.writeByte(75); out.writeByte(75);
out.writeByte(obj.getAnInt2106()); out.writeByte(obj.getSupportsItems());
} }
if (obj.getAnInt2110() != -1) if (obj.getAmbientSoundId() != -1)
{ {
out.writeByte(78); out.writeByte(78);
out.writeShort(obj.getAnInt2110()); out.writeShort(obj.getAmbientSoundId());
out.writeByte(obj.getAnInt2083()); out.writeByte(obj.getAnInt2083());
} }
if (obj.getAnIntArray2084() != null) if (obj.getAnIntArray2084() != null)
@@ -183,10 +183,10 @@ public class ObjectSaver
out.writeShort(i); out.writeShort(i);
} }
} }
if (obj.getAnInt2105() != -1) if (obj.getContouredGround() != -1)
{ {
out.writeByte(81); out.writeByte(81);
out.writeByte(obj.getAnInt2105() / 256); out.writeByte(obj.getContouredGround() / 256);
} }
if (obj.getMapAreaId() != -1) if (obj.getMapAreaId() != -1)
{ {