public override void Read(BinaryReader file, uint size) { base.Read(file, size); CDynamicInt count = new CDynamicInt(cr2w); count.Read(file, 1); for (int j = 0; j < count.val; j++) { CArray currenttreebundle = new CArray(cr2w); CHandle treetype = new CHandle(cr2w); treetype.Read(file, 4); currenttreebundle.Name = treetype.Handle; CArray currentTrees = new CArray(cr2w); currentTrees.AddVariable(treetype); CDynamicInt treecount = new CDynamicInt(cr2w); treecount.Read(file, 1); for (int i = 0; i < treecount.val; i++) { CTree tree = new CTree(cr2w); tree.Read(file, 29); currentTrees.AddVariable(tree); } currenttreebundle.AddVariable(currentTrees); Trees.AddVariable(currenttreebundle); } file.BaseStream.Seek(1, SeekOrigin.Current); }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); var count = file.ReadSByte(); for (var i = 0; i < count; i++) { var item = new CMaterialGraphParameter(cr2w); item.Read(file, 0); pixelParameters.AddVariable(item); } var vertexCount = file.ReadSByte(); for (var i = 0; i < vertexCount; i++) { var item = new CMaterialGraphParameter(cr2w); item.Read(file, 0); vertexParameters.AddVariable(item); } var unk1 = file.ReadInt32(); if (unk1 != 0) { // this should be 0... } }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); unk1.Read(file, 0); unk2.Read(file, 0); var elementcount = file.ReadBit6(); for (var i = 0; i < elementcount; i++) { var handle = new CHandle(cr2w); handle.Read(file, 0); components.AddVariable(handle); } }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); //components array /* this fails for (some) CLayer Entities * that have no components but still data behind their class * one possible solution: check if entity has children (tiresome) */ unk1.Read(file, 0); unk2.Read(file, 0); var elementcount = file.ReadBit6(); for (var i = 0; i < elementcount; i++) { var handle = new CHandle(cr2w); handle.Read(file, 0); components.AddVariable(handle); } }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); var count = file.ReadVLQInt32(); //For each of the treetypes for (int j = 0; j < count; j++) { CArray CTreeCollection = new CArray(cr2w); //Read the handle of the trees we are currently reading CHandle treetype = new CHandle(cr2w); treetype.Read(file, size); treetype.Name = "Type"; CTreeCollection.AddVariable(treetype); //Read the number of trees in this treetype var treecount = file.ReadVLQInt32(); //For each of the trees in the treetype for (int i = 0; i < treecount; i++) { SFoliageInstance tree = new SFoliageInstance(cr2w) { Name = "Details" }; tree.Read(file, size); //Add the tree entry to its handle holder CTreeCollection.AddVariable(tree); tree.Name = i.ToString(); } //Add the handle and the tree subvars into the Trees CArray Trees.AddVariable(CTreeCollection); } //Read Grasses! count = file.ReadVLQInt32(); if (count > 0) { for (int j = 0; j < count; j++) { CArray GrassCollection = new CArray(cr2w); //Read the handle of the Grasses we are currently reading CHandle treetype = new CHandle(cr2w); treetype.Read(file, size); treetype.Name = "Type"; GrassCollection.AddVariable(treetype); //Read the number of Grasses in this treetype var treecount = file.ReadVLQInt32(); //For each of the Grasses in the treetype for (int i = 0; i < treecount; i++) { SFoliageInstance grass = new SFoliageInstance(cr2w) { Name = "Details" }; grass.Read(file, size); //Add the grass entry to its handle holder GrassCollection.AddVariable(grass); grass.Name = i.ToString(); } //Add the handle and the grass subvars into the grasses CArray Grasses.AddVariable(GrassCollection); } } else { return; } }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); var cnt = file.ReadVLQInt32(); for (int i = 0; i < cnt; i++) { //This is actually a byte-byte pair but no idea why or how anyone would edit this var mapping = new CUInt16(cr2w, Unicodemapping, ""); mapping.Read(file, size); Unicodemapping.AddVariable(mapping); } Linedist.Read(file, size); Maxglyphheight.Read(file, size); Kerning.Read(file, size); var num = file.ReadVLQInt32(); for (int i = 0; i < num; i++) { var glyph = new CArray <CFloat>(cr2w, Glyphs, "Glyph - " + i) { Elementtype = "Float" }; // UVs CFloat uv00 = new CFloat(cr2w, glyph, "UV[0][0]"); uv00.Read(file, size); glyph.AddVariable(uv00); CFloat uv01 = new CFloat(cr2w, glyph, "UV[0][1]"); uv01.Read(file, size); glyph.AddVariable(uv01); CFloat uv10 = new CFloat(cr2w, glyph, "UV[1][0]"); uv10.Read(file, size); glyph.AddVariable(uv10); CFloat uv11 = new CFloat(cr2w, glyph, "UV[1][1]"); uv11.Read(file, size); glyph.AddVariable(uv11); CInt32 textureindex = new CInt32(cr2w, glyph, "Texture index"); textureindex.Read(file, size); glyph.AddVariable(textureindex); CInt32 width = new CInt32(cr2w, glyph, "Width"); width.Read(file, size); glyph.AddVariable(width); CInt32 height = new CInt32(cr2w, glyph, "Height"); height.Read(file, size); glyph.AddVariable(height); CInt32 advance_x = new CInt32(cr2w, glyph, "Advance X"); advance_x.Read(file, size); glyph.AddVariable(advance_x); CInt32 bearing_x = new CInt32(cr2w, glyph, "Bearing X"); bearing_x.Read(file, size); glyph.AddVariable(bearing_x); CInt32 bearing_y = new CInt32(cr2w, glyph, "Bearing Y"); bearing_y.Read(file, size); glyph.AddVariable(bearing_y); Glyphs.AddVariable(glyph); } }