Exemple #1
0
            internal void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.WriteUInt32((uint)Shape.Type);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(Unk2);
                bw.ReserveInt64("BaseDataOffset1");
                bw.ReserveInt64("BaseDataOffset2");
                bw.WriteInt32(-1);
                bw.WriteUInt32(MapStudioLayer);

                bw.ReserveInt64("ShapeDataOffset");
                bw.ReserveInt64("BaseDataOffset3");
                bw.ReserveInt64("TypeDataOffset");

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(ReambiguateName(Name), true);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset1", bw.Position - start);
                bw.WriteInt16((short)UnkA.Count);
                bw.WriteInt16s(UnkA);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset2", bw.Position - start);
                bw.WriteInt16((short)UnkB.Count);
                bw.WriteInt16s(UnkB);
                bw.Pad(8);

                Shape.Write(bw, start);

                bw.FillInt64("BaseDataOffset3", bw.Position - start);
                bw.WriteInt32(ActivationPartIndex);
                bw.WriteInt32(EventEntityID);

                if (HasTypeData)
                {
                    WriteSpecific(bw, start);
                }
                else
                {
                    bw.FillInt64("TypeDataOffset", 0);
                }

                bw.Pad(8);
            }
            internal void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteInt32(0);
                bw.WriteInt32(id);
                bw.WriteUInt32((uint)Shape.Type);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(Unk2);

                bw.ReserveInt64("BaseDataOffset1");
                bw.ReserveInt64("BaseDataOffset2");


                bw.ReserveInt64("ShapeDataOffset");
                bw.ReserveInt64("BaseDataOffset3");

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(ReambiguateName(Name), true);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset1", bw.Position - start);
                bw.WriteInt16((short)UnkA.Count);
                bw.WriteInt16s(UnkA);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset2", bw.Position - start);
                bw.WriteInt16((short)UnkB.Count);
                bw.WriteInt16s(UnkB);
                bw.Pad(8);

                if (Shape.HasShapeData)
                {
                    bw.FillInt64("ShapeDataOffset", (int)(bw.Position - start));
                    Shape.WriteShapeData(bw);
                }
                else
                {
                    bw.FillInt64("ShapeDataOffset", 0);
                }

                bw.FillInt64("BaseDataOffset3", bw.Position - start);
                bw.WriteInt32(EntityID);

                bw.Pad(8);
            }
Exemple #3
0
            internal void WriteFaceIndices(BinaryWriterEx bw, ref short index, ref int faceIndexIndex)
            {
                short thisIndex = index;

                if (FaceIndices == null)
                {
                    bw.FillInt16($"FaceIndexCount{thisIndex}", 0);
                    bw.FillInt16($"FaceIndexIndex{thisIndex}", 0);
                }
                else
                {
                    bw.FillInt16($"FaceIndexCount{thisIndex}", (short)FaceIndices.Count);
                    bw.FillInt16($"FaceIndexIndex{thisIndex}", (short)faceIndexIndex);
                    bw.WriteInt16s(FaceIndices);
                    faceIndexIndex += FaceIndices.Count;
                }

                if (Left != null)
                {
                    index++;
                    Left.WriteFaceIndices(bw, ref index, ref faceIndexIndex);
                }

                if (Right != null)
                {
                    index++;
                    Right.WriteFaceIndices(bw, ref index, ref faceIndexIndex);
                }
            }
Exemple #4
0
 internal void WriteSubIDs(BinaryWriterEx bw, int version, int index)
 {
     if (version >= 2)
     {
         bw.FillInt32($"SubIDsOffset{index}", (int)bw.Position);
         bw.WriteInt16s(SubIDs);
     }
 }
Exemple #5
0
 internal override void WriteSpecific(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt16s(walkPointIndices);
 }
Exemple #6
0
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt16s(WalkPointIndices);
 }
Exemple #7
0
            internal void Write(BinaryWriterEx bw, BTPBVersion version)
            {
                bw.WriteInt16s(Coefficients);
                bw.WriteInt16(LightMask);
                bw.WriteInt16(Unk1A);

                if (version >= BTPBVersion.Bloodborne)
                {
                    bw.WriteVector3(Position);
                    bw.WritePattern(0x20, 0x00);
                }
            }
Exemple #8
0
 internal void Write(BinaryWriterEx bw, Dictionary <string, int> stringOffsets, Queue <int> shapOffsets, Queue <int> ctrlOffsets, Queue <int> dlgoOffsets)
 {
     Write(bw, stringOffsets, shapOffsets, ctrlOffsets);
     bw.WriteInt32(Dlgos.Count);
     bw.WriteInt32(dlgoOffsets.Dequeue());
     bw.WriteInt16(LeftEdge);
     bw.WriteInt16(TopEdge);
     bw.WriteInt16(RightEdge);
     bw.WriteInt16(BottomEdge);
     bw.WriteInt16s(Unk30);
     bw.WriteInt16(Unk3A);
     bw.WriteInt32(Unk3C);
 }
Exemple #9
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt16s(WalkRegionIndices);
     for (int i = 0; i < 5; i++)
     {
         WREntries[i].Write(bw);
     }
     bw.WriteNull(0x14, false);
 }
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteByte(HitFilterID);
     bw.WriteByte(SoundSpaceType);
     bw.WriteInt16(EnvLightMapSpotIndex);
     bw.WriteSingle(ReflectPlaneHeight);
     bw.WriteUInt32s(NvmGroups);
     bw.WriteInt16s(RefTexIDs);
     bw.WriteInt16(UnkT38);
     bw.WriteInt16(MapNameID);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
 }
Exemple #11
0
 internal override void Write(BinaryWriterEx bw, int id)
 {
     base.Write(bw, id);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(ThinkParamID);
     bw.WriteInt32(NPCParamID);
     bw.WriteInt32(TalkID);
     bw.WriteSingle(UnkT14);
     bw.WriteInt32(CharaInitID);
     bw.WriteInt32(CollisionIndex);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt16s(MovePointIndices);
     bw.WriteInt32(UnkT38);
     bw.WriteInt32(UnkT3C);
 }
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32(UnkT04);
     bw.WriteSingle(UnkT08);
     bw.WriteInt32(NPCParamID);
     bw.WriteInt32(TalkID);
     bw.WriteByte(PointMoveType);
     bw.WriteByte(0);
     bw.WriteUInt16(PlatoonID);
     bw.WriteInt32(CharaInitID);
     bw.WriteInt32(CollisionIndex);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt16s(MovePointIndices);
     bw.WriteInt32(InitAnimID);
     bw.WriteInt32(DamageAnimID);
 }
 internal override void Write(BinaryWriterEx bw, int id)
 {
     bw.WriteSingle(Unk00);
     bw.WriteSingle(Unk04);
     bw.WriteSingle(Unk08);
     bw.WriteInt32(Unk0C);
     bw.WriteSingle(Unk10);
     bw.WriteSingle(Unk14);
     bw.WriteSingle(Unk18);
     bw.WriteInt32(Unk1C);
     bw.WriteSingle(Unk20);
     bw.WriteSingle(Unk24);
     bw.WriteSingle(Unk28);
     bw.WriteInt32(Unk2C);
     bw.WriteSingle(Unk30);
     bw.WriteInt32(UnkShorts.Count);
     bw.WriteInt16s(UnkShorts);
     bw.Pad(0x10);
 }
Exemple #14
0
            internal void Write(BinaryWriterEx bw, int version, int index)
            {
                bw.WriteVector3(Position);
                bw.WriteInt16(Section0Index);
                bw.WriteInt16(MainID);

                if (version < 2)
                {
                    if (SubIDs.Count != 16)
                    {
                        throw new InvalidDataException("Sub ID count must be 16 in DS3/BB.");
                    }
                    bw.WriteInt16s(SubIDs);
                }
                else
                {
                    bw.WriteInt32(SubIDs.Count);
                    bw.WriteInt32(Unk14);
                    bw.ReserveInt32($"SubIDsOffset{index}");
                    bw.WriteInt32(0);
                }
            }
Exemple #15
0
            internal override void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.WriteUInt32((uint)Shape.Type);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(Unk2C);
                bw.ReserveInt64("BaseDataOffset1");
                bw.ReserveInt64("BaseDataOffset2");
                bw.WriteInt32(-1);
                bw.WriteInt32(MapStudioLayer);
                bw.ReserveInt64("ShapeDataOffset");
                bw.ReserveInt64("BaseDataOffset3");
                bw.ReserveInt64("TypeDataOffset");

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(Name, true);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset1", bw.Position - start);
                bw.WriteInt16((short)UnkA.Count);
                bw.WriteInt16s(UnkA);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset2", bw.Position - start);
                bw.WriteInt16((short)UnkB.Count);
                bw.WriteInt16s(UnkB);
                bw.Pad(8);

                if (Shape.HasShapeData)
                {
                    bw.FillInt64("ShapeDataOffset", bw.Position - start);
                    Shape.WriteShapeData(bw);
                }
                else
                {
                    bw.FillInt64("ShapeDataOffset", 0);
                }

                bw.FillInt64("BaseDataOffset3", bw.Position - start);
                bw.WriteInt32(UnkC00);
                bw.WriteInt32(UnkC04);

                if (HasTypeData)
                {
                    if (Type == RegionType.Region23 || Type == RegionType.PartsGroup || Type == RegionType.AutoDrawGroup)
                    {
                        bw.Pad(8);
                    }

                    bw.FillInt64("TypeDataOffset", bw.Position - start);
                    WriteTypeData(bw);
                }
                else
                {
                    bw.FillInt64("TypeDataOffset", 0);
                }
                bw.Pad(8);
            }
Exemple #16
0
        protected override void Write(BinaryWriterEx bw)
        {
            bw.BigEndian  = BigEndian;
            bw.VarintLong = Version == NGPVersion.Scholar;

            bw.WriteASCII("NVG2");
            bw.WriteUInt16((ushort)Version);
            bw.WriteInt16(0);
            bw.WriteInt32(Meshes.Count);
            bw.WriteInt32(StructAs.Count);
            bw.WriteInt32(StructBs.Count);
            bw.WriteInt32(StructCs.Count);
            bw.WriteInt32(StructDs.Count);
            bw.WriteInt32(Unk1C);
            bw.ReserveVarint("OffsetA");
            bw.ReserveVarint("OffsetB");
            bw.ReserveVarint("OffsetC");
            bw.ReserveVarint("OffsetD");
            for (int i = 0; i < Meshes.Count; i++)
            {
                bw.ReserveVarint($"MeshOffset{i}");
            }

            void writeMeshes()
            {
                for (int i = 0; i < Meshes.Count; i++)
                {
                    bw.Pad(bw.VarintSize);
                    bw.FillVarint($"MeshOffset{i}", bw.Position);
                    Meshes[i].Write(bw, Version);
                }
            }

            if (Version == NGPVersion.Vanilla)
            {
                writeMeshes();
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetA", bw.Position);
            foreach (StructA structA in StructAs)
            {
                structA.Write(bw);
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetB", bw.Position);
            foreach (StructB structB in StructBs)
            {
                structB.Write(bw);
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetC", bw.Position);
            bw.WriteInt32s(StructCs);

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetD", bw.Position);
            bw.WriteInt16s(StructDs);

            if (Version == NGPVersion.Scholar)
            {
                writeMeshes();
            }
        }
Exemple #17
0
 internal void WriteIndices(BinaryWriterEx bw, int index)
 {
     bw.FillInt32($"IndicesOffset{index}", (int)bw.Position);
     bw.WriteInt16s(Indices);
 }
 internal void Write(BinaryWriterEx bw)
 {
     bw.WriteInt16s(Unk00);
     bw.WriteInt32(Index);
     bw.WriteInt32(0);
 }