Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public override void Read(BinaryReader file, uint size)
 {
     positionX.Read(file, 0);
     positionY.Read(file, 0);
     positionZ.Read(file, 0);
     positionW.Read(file, 0);
     umbratile.Read(file, 0);
 }
Exemplo n.º 3
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            ParentGroup.ChunkHandle = true;
            ParentGroup.Read(file, 4);

            //base.AddVariable(ParentGroup);
        }
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            inputnodes.Read(file, 0);
            unk1.Read(file, 0);
            unk2.Read(file, 0);
            outputnode.Read(file, 0);
        }
 public override void Read(BinaryReader file, uint size)
 {
     diffuseTexture.Read(file, size);
     normalTexture.Read(file, size);
     specularColor.Read(file, size);
     specularScale.Read(file, size);
     specularBase.Read(file, size);
     specularity.Read(file, size);
     additiveNormals.Read(file, size);
     diffuseRandomColor0.Read(file, size);
     diffuseRandomColor1.Read(file, size);
     subUVType.Read(file, size);
 }
Exemplo n.º 6
0
 public override void Read(BinaryReader file, uint size)
 {
     diffuseTexture.Read(file, size);
     normalTexture.Read(file, size);
     specularColor.Read(file, size); //BUG: fx\monsters\endriaga\spawn_ground\endriaga_spawn_ground.w2p
     //file.BaseStream.Seek(4, SeekOrigin.Current);
     specularScale.Read(file, size);
     specularBase.Read(file, size);
     specularity.Read(file, size);
     additiveNormals.Read(file, size);
     diffuseRandomColor0.Read(file, size);
     diffuseRandomColor1.Read(file, size);
     subUVType.Read(file, size);
 }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            Toplevelnode.Read(file, 0);

            unk2.Read(file, 0);
            variables1.Read(file, 0);

            unk3.Read(file, 0);
            descriptions.Read(file, 0);

            unk4.Read(file, 0);
            vectorvariables1.Read(file, 0);

            unk5.Read(file, 0);
            variables2.Read(file, 0);

            unk6.Read(file, 0);
            vectorvariables2.Read(file, 0);
        }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        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;
            }
        }
Exemplo n.º 11
0
        public override void Read(BinaryReader file, uint size)
        {
            var startPos = file.BaseStream.Position;

            base.Read(file, size);

            // check if created from template
            isCreatedFromTemplate = variables.FirstOrDefault(_ => _.Name == "template") != null;

            // Read Component Array (should only be present if NOT created from template)
            #region Componentsarray
            var endPos    = file.BaseStream.Position;
            var bytesleft = size - (endPos - startPos);
            if (!isCreatedFromTemplate)
            {
                if (bytesleft > 0)
                {
                    var elementcount = file.ReadBit6();
                    for (var i = 0; i < elementcount; i++)
                    {
                        var handle = new CHandle(cr2w);
                        handle.Read(file, 0);
                        components.AddVariable(handle);
                    }
                }
                else
                {
                    throw new EndOfStreamException("unknown CEntity Fileformat.");
                }
            }
            #endregion


            // Read Buffer 1 (always)
            #region Buffer 1
            endPos    = file.BaseStream.Position;
            bytesleft = size - (endPos - startPos);
            if (bytesleft > 0)
            {
                bool canRead;
                do
                {
                    var t_buffer = new CEntityBufferType1(cr2w)
                    {
                        Name = "",
                    };
                    canRead = t_buffer.CanRead(file);
                    if (canRead)
                    {
                        t_buffer.Read(file, 0);
                    }

                    buffer_v1.AddVariable(t_buffer);
                } while (canRead);
            }
            else
            {
                throw new EndOfStreamException("unknown CEntity Fileformat.");
            }
            #endregion

            // Read Buffer 2 (should only be present if created from template)
            #region Buffer 2
            endPos    = file.BaseStream.Position;
            bytesleft = size - (endPos - startPos);
            if (isCreatedFromTemplate)
            {
                if (bytesleft > 0)
                {
                    buffer_v2.Read(file, 0);
                }
                else
                {
                    throw new EndOfStreamException("unknown CEntity Fileformat.");
                }
            }
            #endregion
        }
Exemplo n.º 12
0
 public override void Read(BinaryReader file, uint size)
 {
     guid.Read(file, 16);
     handle.Read(file, 4);
 }
Exemplo n.º 13
0
 public override void Read(BinaryReader file, uint size)
 {
     id.Read(file, 2);
     handle.Read(file, 2);
 }
Exemplo n.º 14
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            firstlayer.Read(file, 0);
        }