Exemple #1
0
        public static UnknownEntry4 Deserialize(FZReader reader)
        {
            var obj = new UnknownEntry4();

            obj.address  = (int)reader.BaseStream.Position;
            obj.unknown1 = reader.ReadInt32();

            return(obj);
        }
Exemple #2
0
        public static UnknownTable2 Deserialize(FZReader reader)
        {
            var table = new UnknownTable2();

            table.numEntries     = reader.ReadInt32();
            table.offset         = reader.ReadInt32();
            table.unknownEntries = reader.ReadArrayAtOffset(table.offset, table.numEntries, UnknownEntry2.Deserialize);

            return(table);
        }
Exemple #3
0
        public static MeshCollisionTable Deserialize(FZReader reader)
        {
            var table = new MeshCollisionTable();

            table.numEntries           = reader.ReadInt32();
            table.offset               = reader.ReadInt32();
            table.meshCollisionEntries = reader.ReadArrayAtOffset(table.offset, table.numEntries, MeshCollisionEntry.Deserialize);

            return(table);
        }
Exemple #4
0
        public static CheckpointTable Deserialize(FZReader reader)
        {
            var table = new CheckpointTable();

            table.numEntries        = reader.ReadInt32();
            table.offset            = reader.ReadInt32();
            table.checkpointEntries = reader.ReadArrayAtOffset(table.offset, table.numEntries, CheckpointEntry.Deserialize);

            return(table);
        }
Exemple #5
0
        public static MeshCollisionEntry Deserialize(FZReader reader)
        {
            var entry = new MeshCollisionEntry();

            entry.unknown1 = reader.ReadBytes(12);
            entry.offset   = reader.ReadInt32();
            if (entry.offset != 0)
            {
                entry.meshCollision = reader.ReadAtOffset(entry.offset, MeshCollisionData.Deserialize);
            }

            return(entry);
        }
        public static Triangle Deserialize(FZReader reader)
        {
            var obj = new Triangle();

            obj.address  = (int)reader.BaseStream.Position;
            obj.unknown1 = reader.ReadInt32();
            obj.normal   = reader.ReadVector3();
            obj.vertex1  = reader.ReadVector3();
            obj.vertex2  = reader.ReadVector3();
            obj.vertex3  = reader.ReadVector3();
            obj.unknown2 = reader.ReadBytes(36);

            return(obj);
        }
Exemple #7
0
        public static MeshCollisionData Deserialize(FZReader reader)
        {
            var obj = new MeshCollisionData();

            obj.address         = (int)reader.BaseStream.Position;
            obj.unknown1        = reader.ReadBytes(20);
            obj.numTriangles    = reader.ReadInt32();
            obj.numQuads        = reader.ReadInt32();
            obj.trianglesOffset = reader.ReadInt32();
            obj.quadsOffset     = reader.ReadInt32();
            obj.triangles       = reader.ReadArrayAtOffset(obj.trianglesOffset, obj.numTriangles, Triangle.Deserialize);
            obj.quads           = reader.ReadArrayAtOffset(obj.quadsOffset, obj.numQuads, Quad.Deserialize);

            return(obj);
        }
Exemple #8
0
        public static ObjectCollisionData Deserialize(FZReader reader)
        {
            var table = new ObjectCollisionData();

            table.address             = (int)reader.BaseStream.Position;
            table.unknown1            = reader.ReadBytes(36);
            table.startTriangleOffset = reader.ReadInt32();
            table.nextTriangleOffset  = reader.ReadInt32();

            var numTriangles = (table.nextTriangleOffset - table.startTriangleOffset - triangleExtraDataSize) / triangleSize;

            table.triangles = new Triangle[numTriangles];
            reader.BaseStream.Seek(table.startTriangleOffset, SeekOrigin.Begin);
            for (var i = 0; i < numTriangles; i++)
            {
                table.triangles[i] = Triangle.Deserialize(reader);
            }

            table.triangleExtraData = TriangleExtraData.Deserialize(reader);

            var quadOffset = 36 + 60 + 24;                                        // 36 null bytes, 60 offset bytes for triangle mesh section, and 24 bytes of unknown data to get to the offset for the first quad mesh

            reader.BaseStream.Seek(table.address + quadOffset, SeekOrigin.Begin); // Go to start of extra mesh table
            table.startQuadOffset = reader.ReadInt32();
            table.nextQuadOffset  = reader.ReadInt32();

            var numQuads = (table.nextQuadOffset - table.startQuadOffset - 24) / quadSize;

            table.quads = new Quad[numQuads];
            reader.BaseStream.Seek(table.startQuadOffset, SeekOrigin.Begin);
            for (var i = 0; i < numQuads; i++)
            {
                table.quads[i] = Quad.Deserialize(reader);
            }

            table.quadExtraData = QuadExtraData.Deserialize(reader);

            return(table);
        }
        public static CheckpointData Deserialize(FZReader reader)
        {
            var obj = new CheckpointData();

            obj.address        = (int)reader.BaseStream.Position;
            obj.trackOffset1   = reader.ReadSingle();
            obj.trackOffset2   = reader.ReadSingle();
            obj.unknown3       = reader.ReadSingle();
            obj.startTangent   = reader.ReadVector3();
            obj.start          = reader.ReadVector3();
            obj.unknown4       = reader.ReadSingle();
            obj.endTangent     = reader.ReadVector3();
            obj.end            = reader.ReadVector3();
            obj.unknown5       = reader.ReadSingle();
            obj.unknown6       = reader.ReadSingle();
            obj.width          = reader.ReadSingle();
            obj.startConnected = reader.ReadByte();
            obj.endConnected   = reader.ReadByte();
            obj.flag3          = reader.ReadByte();
            obj.flag4          = reader.ReadByte();

            return(obj);
        }
Exemple #10
0
        public static FZObjectData Deserialize(FZReader reader)
        {
            var obj = new FZObjectData();

            obj.address           = (int)reader.BaseStream.Position;
            obj.unknown1          = reader.ReadInt32();
            obj.unknown2          = reader.ReadInt32();
            obj.unknown3          = reader.ReadInt32();
            obj.position          = reader.ReadVector3();
            obj.unknown4          = reader.ReadInt32();
            obj.unknown5          = reader.ReadInt32();
            obj.scale             = reader.ReadVector3();
            obj.unknown6          = reader.ReadInt32();
            obj.unknownOffset1    = reader.ReadInt32();
            obj.unknownOffset2    = reader.ReadInt32();
            obj.unknown7          = reader.ReadInt32();
            obj.orientationOffset = reader.ReadInt32();
            if (obj.orientationOffset != 0)
            {
                obj.orientation = reader.ReadAtOffset(obj.orientationOffset, FZOrientation.Deserialize);
            }

            return(obj);
        }