Example #1
0
        public override void Build(MetaBuilder mb, bool isRoot = false)
        {
            if (this.Direction != null)
            {
                this.MetaStructure.direction = mb.AddItemArrayPtr(MetaName.VECTOR3, this.Direction.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray());
            }

            MVECTOR3.AddEnumAndStructureInfo(mb);

            this.MetaStructure.falloff           = mb.AddFloatArrayPtr(this.Falloff.ToArray());
            this.MetaStructure.falloffExponent   = mb.AddFloatArrayPtr(this.FalloffExponent.ToArray());
            this.MetaStructure.timeAndStateFlags = mb.AddUintArrayPtr(this.TimeAndStateFlags.ToArray());
            this.MetaStructure.hash                   = mb.AddUintArrayPtr(this.Hash.ToArray());
            this.MetaStructure.coneInnerAngle         = mb.AddByteArrayPtr(this.ConeInnerAngle.ToArray());
            this.MetaStructure.coneOuterAngleOrCapExt = mb.AddByteArrayPtr(this.ConeOuterAngleOrCapExt.ToArray());
            this.MetaStructure.coronaIntensity        = mb.AddByteArrayPtr(this.CoronaIntensity.ToArray());

            MCLODLight.AddEnumAndStructureInfo(mb);

            if (isRoot)
            {
                mb.AddItem(this.MetaName, this.MetaStructure);

                this.Meta = mb.GetMeta();
            }
        }
Example #2
0
        public override void Parse(MetaFile meta, CMapData CMapData)
        {
            this.Meta          = meta;
            this.MetaStructure = CMapData;

            this.Name                = (MetaName)CMapData.name;
            this.Parent              = (MetaName)CMapData.parent;
            this.Flags               = CMapData.flags;
            this.ContentFlags        = CMapData.contentFlags;
            this.StreamingExtentsMin = CMapData.streamingExtentsMin;
            this.StreamingExtentsMax = CMapData.streamingExtentsMax;
            this.EntitiesExtentsMin  = CMapData.entitiesExtentsMin;
            this.EntitiesExtentsMax  = CMapData.entitiesExtentsMax;

            this.Entities = MetaUtils.GetTypedDataArray <CEntityDef>(this.Meta, MetaName.CEntityDef)?.Select(e => { var obj = new MCEntityDef(this); obj.Parse(meta, e); return(obj); }).ToList() ?? new List <MCEntityDef>();

            this.MloInstances = MetaUtils.GetTypedDataArray <CMloInstanceDef>(this.Meta, MetaName.CMloInstanceDef)?.Select(e => { var obj = new MCMloInstanceDef(); obj.Parse(meta, e); return(obj); }).ToList() ?? new List <MCMloInstanceDef>();

            this.ContainerLods = new Array_Structure();
            var boxOccluders = MetaUtils.ConvertDataArray <Unk_975711773>(meta, CMapData.boxOccluders);

            this.BoxOccluders = boxOccluders?.Select(e => { var msw = new MUnk_975711773(); msw.Parse(meta, e); return(msw); }).ToList();

            var occludeModels = MetaUtils.ConvertDataArray <Unk_2741784237>(meta, CMapData.occludeModels);

            this.OccludeModels = occludeModels?.Select(e => { var msw = new MUnk_2741784237(); msw.Parse(meta, e); return(msw); }).ToList();

            this.PhysicsDictionaries = CMapData.physicsDictionaries;
            this.InstancedData       = new Mrage__fwInstancedMapData();
            this.InstancedData.Parse(meta, CMapData.instancedData);


            var timeCycleModifiers = MetaUtils.ConvertDataArray <CTimeCycleModifier>(meta, CMapData.timeCycleModifiers);

            this.TimeCycleModifiers = timeCycleModifiers?.Select(e => { var msw = new MCTimeCycleModifier(); msw.Parse(meta, e); return(msw); }).ToList();


            var carGenerators = MetaUtils.ConvertDataArray <CCarGen>(meta, CMapData.carGenerators);

            this.CarGenerators = carGenerators?.Select(e => { var msw = new MCCarGen(); msw.Parse(meta, e); return(msw); }).ToList();

            this.LODLightsSOA = new MCLODLight();
            this.LODLightsSOA.Parse(meta, CMapData.LODLightsSOA);
            this.DistantLODLightsSOA = new MCDistantLODLight();
            this.DistantLODLightsSOA.Parse(meta, CMapData.DistantLODLightsSOA);
            this.Block = new MCBlockDesc();
            this.Block.Parse(meta, CMapData.block);
        }
Example #3
0
        public override void Build(MetaBuilder mb, bool isRoot = false)
        {
            this.MetaStructure.name                = (uint)this.Name;
            this.MetaStructure.parent              = (uint)this.Parent;
            this.MetaStructure.flags               = this.Flags;
            this.MetaStructure.contentFlags        = this.ContentFlags;
            this.MetaStructure.streamingExtentsMin = this.StreamingExtentsMin;
            this.MetaStructure.streamingExtentsMax = this.StreamingExtentsMax;
            this.MetaStructure.entitiesExtentsMin  = this.EntitiesExtentsMin;
            this.MetaStructure.entitiesExtentsMax  = this.EntitiesExtentsMax;

            // CEntityDef + CMloInstanceDef
            var entityPtrs = new List <MetaPOINTER>();

            this.AddMetaPointers(mb, entityPtrs, MetaName.CEntityDef, Entities.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            this.AddMetaPointers(mb, entityPtrs, MetaName.CMloInstanceDef, MloInstances.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            this.MetaStructure.entities = mb.AddPointerArray(entityPtrs.ToArray());

            // this.MetaStructure.containerLods = this.ContainerLods;
            if (this.BoxOccluders != null)
            {
                this.MetaStructure.boxOccluders = mb.AddItemArrayPtr((MetaName)(975711773), this.BoxOccluders.Select(e => e.MetaStructure).ToArray());
            }
            MUnk_975711773.AddEnumAndStructureInfo(mb);

            if (this.OccludeModels != null)
            {
                this.MetaStructure.occludeModels = mb.AddItemArrayPtr((MetaName)(-1553183059), this.OccludeModels.Select(e => e.MetaStructure).ToArray());
            }
            MUnk_2741784237.AddEnumAndStructureInfo(mb);

            this.MetaStructure.physicsDictionaries = this.PhysicsDictionaries;

            if (this.InstancedData != null)
            {
                this.InstancedData.Build(mb);
                this.MetaStructure.instancedData = this.InstancedData.MetaStructure;
            }
            Mrage__fwInstancedMapData.AddEnumAndStructureInfo(mb);

            if (this.TimeCycleModifiers != null)
            {
                this.MetaStructure.timeCycleModifiers = mb.AddItemArrayPtr(MetaName.CTimeCycleModifier, this.TimeCycleModifiers.Select(e => e.MetaStructure).ToArray());
            }
            MCTimeCycleModifier.AddEnumAndStructureInfo(mb);

            if (this.CarGenerators != null)
            {
                this.MetaStructure.carGenerators = mb.AddItemArrayPtr(MetaName.CCarGen, this.CarGenerators.Select(e => e.MetaStructure).ToArray());
            }
            MCCarGen.AddEnumAndStructureInfo(mb);


            if (this.LODLightsSOA != null)
            {
                this.LODLightsSOA.Build(mb);
                this.MetaStructure.LODLightsSOA = this.LODLightsSOA.MetaStructure;
            }
            MCLODLight.AddEnumAndStructureInfo(mb);


            if (this.DistantLODLightsSOA != null)
            {
                this.DistantLODLightsSOA.Build(mb);
                this.MetaStructure.DistantLODLightsSOA = this.DistantLODLightsSOA.MetaStructure;
            }
            MCDistantLODLight.AddEnumAndStructureInfo(mb);

            this.Block.Build(mb);
            this.MetaStructure.block = this.Block.MetaStructure;
            MCBlockDesc.AddEnumAndStructureInfo(mb);

            MCMapData.AddEnumAndStructureInfo(mb);

            if (isRoot)
            {
                mb.AddItem(this.MetaName, this.MetaStructure);

                this.Meta = mb.GetMeta();
            }
        }