public CBehaviorGraphStateMachineNode(CR2WFile cr2w) :
     base(cr2w)
 {
     inputnodes = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_)
     {
         ChunkHandle = true,
     })
     {
         Name = "inputnodes"
     };
     unk1 = new CBufferVLQ <CName>(cr2w, _ => new CName(_))
     {
         Name = "unk1"
     };
     unk2 = new CBufferVLQ <CName>(cr2w, _ => new CName(_))
     {
         Name = "unk2"
     };
     unk3 = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_))
     {
         Name = "unk3"
     };
     unk4 = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_))
     {
         Name = "unk4"
     };
     handle1 = new CHandle(cr2w)
     {
         Name = "handle1", ChunkHandle = true
     };
     outputnode = new CHandle(cr2w)
     {
         Name = "outputnode", ChunkHandle = true
     };
 }
Example #2
0
 public CLayerInfo(CR2WFile cr2w) : base(cr2w)
 {
     ParentGroup = new CHandle(cr2w)
     {
         Name = "ParentGroup"
     };
 }
Example #3
0
 public CLayerInfo(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     ParentGroup = new CHandle <CLayerGroup>(cr2w, this, nameof(ParentGroup))
     {
         IsSerialized = true
     };
 }
Example #4
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);
        }
Example #5
0
 public override void Write(BinaryWriter file)
 {
     base.Write(file);
     // unknown bytes
     file.Write(World.val);
     file.Write(LayergroupParent.val);
     file.Write(NumGroups.ToByte());
     if (NumGroups.val > 0)
     {
         List <CVariable> list = ChildrenGroups.array;
         for (int i = 0; i < list.Count; i++)
         {
             CHandle curHandle = (CHandle)list[i];
             file.Write(curHandle.val);
         }
     }
     file.Write(NumInfos.ToByte());
     if (NumInfos.val > 0)
     {
         List <CVariable> list = ChildrenInfos.array;
         for (int i = 0; i < list.Count; i++)
         {
             CHandle curHandle = (CHandle)list[i];
             file.Write(curHandle.val);
         }
     }
 }
Example #6
0
 public CLayerGroup(CR2WFile cr2w) : base(cr2w)
 {
     worldhandle = new CHandle(cr2w)
     {
         Name = "worldhandle", ChunkHandle = true
     };
     layergrouphandle = new CHandle(cr2w)
     {
         Name = "layergrouphandle", ChunkHandle = true
     };
     childrenGroups = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_)
     {
         ChunkHandle = true
     })
     {
         Name = "ChildrenGroups"
     };
     childrenInfos = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_)
     {
         ChunkHandle = true
     })
     {
         Name = "ChildrenInfos"
     };
 }
Example #7
0
 public CGameWorld(CR2WFile cr2w) :
     base(cr2w)
 {
     firstlayer = new CHandle(cr2w)
     {
         Name = "firstlayer"
     };
 }
Example #8
0
 public IdHandle(CR2WFile cr2w) : base(cr2w)
 {
     id = new CUInt16(cr2w)
     {
         Name = "id"
     };
     handle = new CHandle(cr2w)
     {
         Name = "handle"
     };
 }
Example #9
0
 public IdHandle(CR2WFile cr2w) : base(cr2w)
 {
     handlename = new CName(cr2w)
     {
         Name = "handlename"
     };
     handle = new CHandle(cr2w)
     {
         Name = "handle"
     };
 }
Example #10
0
 public SWayPointsCollectionsSetData(CR2WFile cr2w) :
     base(cr2w)
 {
     guid = new CGUID(cr2w)
     {
         Name = "guid"
     };
     handle = new CHandle(cr2w)
     {
         Name = "handle"
     };
 }
Example #11
0
        public CBehaviorGraph(CR2WFile cr2w) :
            base(cr2w)
        {
            Toplevelnode = new CHandle(cr2w)
            {
                Name = "Toplevelnode"
            };
            unk2 = new CUInt32(cr2w)
            {
                Name = "unk2"
            };
            variables1 = new CBufferUInt32 <IdHandle>(cr2w, _ => new IdHandle(_))
            {
                Name = "variables1"
            };

            unk3 = new CUInt32(cr2w)
            {
                Name = "unk3"
            };
            descriptions = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_))
            {
                Name = "descriptions"
            };

            unk4 = new CUInt32(cr2w)
            {
                Name = "unk4"
            };
            vectorvariables1 = new CBufferUInt32 <IdHandle>(cr2w, _ => new IdHandle(_))
            {
                Name = "vectorvariables1"
            };

            unk5 = new CUInt32(cr2w)
            {
                Name = "unk5"
            };
            variables2 = new CBufferUInt32 <IdHandle>(cr2w, _ => new IdHandle(_))
            {
                Name = "variables2"
            };

            unk6 = new CUInt32(cr2w)
            {
                Name = "unk6"
            };
            vectorvariables2 = new CBufferUInt32 <IdHandle>(cr2w, _ => new IdHandle(_))
            {
                Name = "vectorvariables2"
            };
        }
Example #12
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            // unknown bytes
            // first 4 bytes are a handle to the w2w resource
            World.ChunkHandle = true;
            World.val         = file.ReadInt32();
            base.AddVariable(World);
            // next 4 bytes are a handle to the CLayerGroupParent (in the first case, this is 0)
            LayergroupParent.ChunkHandle = true;
            LayergroupParent.val         = file.ReadInt32();
            base.AddVariable(LayergroupParent);

            // next are two arrays, with one-byte (of Type CDynamicInt?) length
            // first is an array of handles to all children of type CLayerGroup
            NumGroups.Read(file, 1);
            if (NumGroups.val > 0)
            {
                for (int i = 0; i < NumGroups.val; i++)
                {
                    var curhandle = new CHandle(base.cr2w)
                    {
                        ChunkHandle = true,
                        val         = file.ReadInt32(),
                        Name        = "LayerGroup",
                    };
                    ChildrenGroups.AddVariable(curhandle);
                }
                base.AddVariable(ChildrenGroups);
            }
            // second is an array of handles to all children of type CLayerGroup
            NumInfos.Read(file, 1);
            if (NumInfos.val > 0)
            {
                for (int i = 0; i < NumInfos.val; i++)
                {
                    var curhandle = new CHandle(base.cr2w)
                    {
                        ChunkHandle = true,
                        val         = file.ReadInt32(),
                        Name        = "LayerInfo",
                    };
                    ChildrenInfos.AddVariable(curhandle);
                }
                base.AddVariable(ChildrenInfos);
            }
        }
Example #13
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);
            }
        }
Example #14
0
 public SDynamicDecalMaterialInfo(CR2WFile cr2w) : base(cr2w)
 {
     diffuseTexture = new CHandle(cr2w)
     {
         Name = "diffuseTexture", Type = "CHandle"
     };
     normalTexture = new CHandle(cr2w)
     {
         Name = "normalTexture", Type = "CHandle"
     };
     specularColor = new CColor(cr2w)
     {
         Name = "specularColor", Type = "Color"
     };
     specularScale = new CFloat(cr2w)
     {
         Name = "specularScale", Type = "Float"
     };
     specularBase = new CFloat(cr2w)
     {
         Name = "specularBase", Type = "Float"
     };
     specularity = new CFloat(cr2w)
     {
         Name = "specularity", Type = "Float"
     };
     additiveNormals = new CBool(cr2w)
     {
         Name = "additiveNormals", Type = "Bool"
     };
     diffuseRandomColor0 = new CColor(cr2w)
     {
         Name = "diffuseRandomColor0", Type = "Color"
     };
     diffuseRandomColor1 = new CColor(cr2w)
     {
         Name = "diffuseRandomColor1", Type = "Color"
     };
     subUVType = new CName(cr2w)
     {
         Name = "subUVType", Type = "CName"
     };
 }
Example #15
0
 public CLayerGroup(CR2WFile cr2w) : base(cr2w)
 {
     World = new CHandle(cr2w)
     {
         Name = "WorldParent"
     };
     LayergroupParent = new CHandle(cr2w)
     {
         Name = "LayergroupParent"
     };
     NumGroups      = new CDynamicInt(cr2w);
     ChildrenGroups = new CArray(cr2w)
     {
         Name = "ChildrenGroups"
     };
     NumInfos      = new CDynamicInt(cr2w);
     ChildrenInfos = new CArray(cr2w)
     {
         Name = "ChildrenInfos"
     };
 }
 public CBehaviorGraphContainerNode(CR2WFile cr2w) :
     base(cr2w)
 {
     inputnodes = new CBufferVLQ <CHandle>(cr2w, _ => new CHandle(_)
     {
         ChunkHandle = true,
     })
     {
         Name = "inputnodes"
     };
     unk1 = new CBufferVLQ <CName>(cr2w, _ => new CName(_))
     {
         Name = "unk1"
     };
     unk2 = new CBufferVLQ <CName>(cr2w, _ => new CName(_))
     {
         Name = "unk2"
     };
     outputnode = new CHandle(cr2w)
     {
         Name = "outputnode", ChunkHandle = true
     };
 }
Example #17
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);
            }
        }
Example #18
0
 public SUmbraSceneData(CR2WFile cr2w) :
     base(cr2w)
 {
     positionX = new CFloat(cr2w)
     {
         Name = nameof(positionX)
     };
     positionY = new CFloat(cr2w)
     {
         Name = nameof(positionY)
     };
     positionZ = new CFloat(cr2w)
     {
         Name = nameof(positionZ)
     };
     positionW = new CFloat(cr2w)
     {
         Name = nameof(positionW)
     };
     umbratile = new CHandle(cr2w)
     {
         Name = nameof(umbratile)
     };
 }
        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;
            }
        }
Example #20
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
        }
Example #21
0
 public IdHandle(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     handlename = new CName(cr2w, this, "handlename");
     handle     = new CHandle <CBehaviorVariable>(cr2w, this, "handle");
 }