public DataSet(PakFile Pak, PakFile.PakTag Item) { var reader = Pak.Reader; var count = reader.ReadInt32(); if (count == 0) { return; } for (int i = 0; i < count; i++) { unkS0.Add(new struct0(Pak, Item)); } unk0 = reader.ReadInt32(); //total faces MinBound = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); unkf0 = reader.ReadSingle(); DataLength = reader.ReadInt32(); reader.ReadBytes(DataLength); //unmapped }
public struct0(PakFile Pak, PakFile.PakTag Item) { unk0 = new int[12]; //not sure if signed or not //appears to be compressed floats, might be //coordinates relative to the bounds values for (int i = 0; i < 12; i++) { unk0[i] = Pak.Reader.ReadInt16(); } }
public struct0(PakFile Pak, PakFile.PakTag Item) { var reader = Pak.Reader; NodeID = reader.ReadInt16(); //ID for bsp node NodeFaces = reader.ReadInt32(); //face count for bsp node unk1 = reader.ReadInt32(); //??? //usually always large negative //may not actually be a float //(though always valid as one) unkf0 = reader.ReadSingle(); }
public SceneCDT(PakFile Pak, PakFile.PakTag Item) { var reader = Pak.Reader; reader.Format = EndianFormat.Little; reader.SeekTo(Item.Offset); reader.ReadInt16(); //F000 reader.ReadInt32(); //07000000 reader.ReadByte(); //12 unmapped0 = reader.ReadBytes(16); //??? var count = reader.ReadInt32(); //03000000 [data set count] for (int i = 0; i < count; i++) { sets.Add(new DataSet(Pak, Item)); } }
public SceneData(PakFile Pak, PakFile.PakTag Item) { var reader = Pak.Reader; reader.Format = EndianFormat.Little; reader.SeekTo(Item.Offset); unmapped0 = reader.ReadBytes(16); x0700 = reader.ReadInt16(); //0700 xADDE = reader.ReadInt16(); //ADDE var min = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); var max = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); unkBounds = new BoundingBox() { XBounds = new Range <float>(min.X, max.X), YBounds = new Range <float>(min.Y, max.Y), ZBounds = new Range <float>(min.Z, max.Z), }; var count = reader.ReadInt32(); //always bsp object count + 1 indices = new List <int>(); for (int i = 0; i < count; i++) { indices.Add(reader.ReadInt32()); //last value is always struct0 count } count = reader.ReadInt32(); unkS0 = new List <struct0>(); for (int i = 0; i < count; i++) { unkS0.Add(new struct0(Pak, Item)); } unmapped1 = reader.ReadBytes(13); //always the same }
public Texture(PakFile Pak, PakFile.PakTag Item) { var reader = Pak.Reader; reader.Format = EndianFormat.Little; reader.SeekTo(Item.Offset + 6); isLittleEndian = reader.ReadInt32() == 1346978644; //PICT if (!isLittleEndian) { reader.Format = IO.EndianFormat.Big; } reader.SeekTo(Item.Offset + (isLittleEndian ? 16 : 12)); Width = reader.ReadInt32(); Height = reader.ReadInt32(); reader.SeekTo(Item.Offset + (isLittleEndian ? 38 : 32)); Format = BitmapFormat.Dxt5; var intFormat = reader.ReadInt32(); switch (intFormat) { case 0: Format = BitmapFormat.A8R8G8B8; break; case 10: Format = BitmapFormat.A8Y8; break; case 12: Format = BitmapFormat.Dxt1; break; case 13: Format = BitmapFormat.Dxt1; break; case 15: Format = BitmapFormat.Dxt3; break; case 17: Format = BitmapFormat.Dxt5; break; case 22: Format = BitmapFormat.X8R8G8B8; break; case 36: Format = BitmapFormat.Dxn; break; case 37: Format = BitmapFormat.Dxt5a; break; default: throw new Exception("CHECK THIS"); } reader.SeekTo(Item.Offset + (isLittleEndian ? 28 : 24)); int mapCount = reader.ReadInt32(); if (mapCount == 6) { Type = BitmapType.CubeMap; } else { Type = BitmapType.Texture2D; } if (mapCount > 1 && mapCount != 6) { throw new Exception("CHECK THIS"); } DataAddress = Item.Offset + (isLittleEndian ? 58 : 4096); reader.Format = IO.EndianFormat.Little; //in case it was PICT }
public Scene(PakFile Pak, PakFile.PakTag Item, bool loadMesh) { var reader = Pak.Reader; reader.Format = EndianFormat.Little; reader.Origin = Item.Offset; reader.SeekTo(0); Name = Item.Name; //contains 16bytes, maybe all uint16 _C003 = new unkBlock_XXXX(reader, 0xC003); #region Block 5501 reader.ReadInt16(); //5501 reader.ReadInt32(); //address int count = reader.ReadInt32(); Materials = new List <MatRefBlock_5601>(); for (int i = 0; i < count; i++) { Materials.Add(new MatRefBlock_5601(Pak.Reader)); } #endregion reader.ReadInt16(); //0100 reader.ReadInt32(); //address #region Block 1F02 reader.ReadInt16(); //1F02 reader.ReadInt32(); //EOB offset _2002 = new Block_2002(reader); _2102 = new Block_2102(reader); _2202 = new Block_2202(reader, _2102.unk0); #endregion reader.ReadInt16(); //0100 reader.ReadInt32(); //address #region Block 8204 reader.ReadInt16(); //8204 reader.ReadInt32(); //address count = reader.ReadInt32(); Scripts = new List <StringBlock_BA01>(); for (int i = 0; i < count; i++) { Scripts.Add(new StringBlock_BA01(Pak.Reader)); } #endregion _8404 = new unkBlock_XXXX(reader, 0x8404); #region Block F000 xF000 = reader.ReadInt16(); reader.ReadInt32(); x2C01 = reader.ReadInt16(); reader.ReadInt32(); //address to first object count = reader.ReadInt32(); Objects = new List <Node>(); for (int i = 0; i < count; i++) { Objects.Add(new Node(Pak.Reader, loadMesh)); } #endregion reader.ReadInt16(); //0100 reader.ReadInt32(); //address //additional geometry, mainly sky objects _EA01 = new unkBlock_XXXX(reader, 0xEA01); reader.ReadInt16(); //0100 reader.ReadInt32(); //address //additional objects, no geometry, lighting related _B801 = new unkBlock_XXXX(reader, 0xB801); reader.ReadInt16(); //0100 reader.ReadInt32(); //address //additional objects, no geometry, lighting related _8002 = new unkBlock_XXXX(reader, 0x8002); reader.ReadInt16(); //0100 reader.ReadInt32(); //address //6x int32 _2504 = new unkBlock_XXXX(reader, 0x2504); reader.ReadInt16(); //0100 reader.ReadInt32(); //address //empty? _1D02 = new unkBlock_XXXX(reader, 0x1D02); foreach (var obj in Objects) { if (obj.isInheritor) { Objects[obj._2901.InheritID].isInherited = true; } } reader.Origin = 0; }
public Template(PakFile Pak, PakFile.PakTag Item, bool loadMesh) { var reader = Pak.Reader; reader.Format = EndianFormat.Little; reader.Origin = Item.Offset; reader.SeekTo(0); reader.ReadInt16(); //E402 reader.ReadInt32(); //filesize (EOB offset?) #region Block E502 reader.ReadInt16(); //E502 reader.ReadInt32(); //EOB offset reader.ReadInt32(); //LPTA (probs part of the string) Name = reader.ReadNullTerminatedString(); reader.ReadByte(); //00 #endregion #region Block 1603 reader.ReadInt16(); //1603 reader.ReadInt32(); //EOB offset reader.ReadBytes(3); //02 01 01 #endregion #region Block 5501 reader.ReadInt16(); //5501 reader.ReadInt32(); //address int count = reader.ReadInt32(); Materials = new List<MatRefBlock_5601>(); for (int i = 0; i < count; i++) Materials.Add(new MatRefBlock_5601(reader)); #endregion reader.ReadInt16(); //0100 reader.ReadInt32(); //address #region Block F000 xF000 = reader.ReadInt16(); reader.ReadInt32(); //EOB offset x2C01 = reader.ReadInt16(); reader.ReadInt32(); //EOB offset count = reader.ReadInt32(); Objects = new List<Node>(); for (int i = 0; i < count; i++) Objects.Add(new Node(reader, loadMesh)); foreach (var obj in Objects) if (obj.isInheritor) Objects[obj._2901.InheritID].isInherited = true; #endregion reader.ReadInt16(); //0100 reader.ReadInt32(); //address #region Block E802 reader.ReadInt16(); //E802 reader.ReadInt32(); //address count = reader.ReadInt32(); for (int i = 0; i < count; i++) Bones.Add(new BoneBlock_E902(reader)); #endregion //havent mapped this block, assumed anim/sound related _E602 = new unkBlock_XXXX(reader, 0xE602); reader.ReadInt16(); //0100 reader.ReadInt32(); //address if (reader.PeekUInt16() == 0xBA01) unkStrBlk = new StringBlock_BA01(reader); //contains data count, havent seen used _1D02 = new unkBlock_XXXX(reader, 0x1D02); //int16 count, [int16, int16] * count if (reader.PeekUInt16() == 0x1103) _1103 = new unkBlock_XXXX(reader, 0x1103); //contains null term string, used on IGA models _0403 = new unkBlock_XXXX(reader, 0x0403); if (reader.PeekUInt16() == 0x0503) _0503 = new Block_0503(reader); #region Block 0803 reader.ReadInt16(); //0803 reader.ReadInt32(); //address to end of bounds values reader.ReadInt32(); //bounds count? var min = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); var max = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); RenderBounds = new BoundingBox(); RenderBounds.XBounds = new Range<float>(min.X, max.X); RenderBounds.YBounds = new Range<float>(min.Y, max.Y); RenderBounds.ZBounds = new Range<float>(min.Z, max.Z); #endregion _0E03 = new Block_0E03(reader); //contains length prefixed string if (reader.PeekUInt16() == 0x1203) _1203 = new unkBlock_XXXX(reader, 0x1203); reader.ReadInt16(); //0100 reader.ReadInt32(); //address to EOF reader.Origin = 0; }