Пример #1
0
        public override void Build(MetaBuilder mb, bool isRoot = false)
        {
            this.MetaStructure.name = mb.AddStringPtr(this.Name);

            this.MetaStructure.bbMin = this.BbMin;
            this.MetaStructure.bbMax = this.BbMax;

            this.MetaStructure.blend                  = this.Blend;
            this.MetaStructure.timecycleName          = this.TimecycleName;
            this.MetaStructure.secondaryTimecycleName = this.SecondaryTimecycleName;
            this.MetaStructure.flags                  = this.Flags;
            this.MetaStructure.portalCount            = this.PortalCount;
            this.MetaStructure.floorId                = this.FloorId;
            this.MetaStructure.exteriorVisibiltyDepth = this.ExteriorVisibiltyDepth;
            this.MetaStructure.attachedObjects        = mb.AddUintArrayPtr(this.AttachedObjects.ToArray());

            MCMloRoomDef.AddEnumAndStructureInfo(mb);

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

                this.Meta = mb.GetMeta();
            }
        }
Пример #2
0
        public override void Build(MetaBuilder mb, bool isRoot = false)
        {
            this.MetaStructure.lodDist            = this.LodDist;
            this.MetaStructure.flags              = this.Flags;
            this.MetaStructure.specialAttribute   = this.SpecialAttribute;
            this.MetaStructure.bbMin              = this.BbMin;
            this.MetaStructure.bbMax              = this.BbMax;
            this.MetaStructure.bsCentre           = this.BsCentre;
            this.MetaStructure.bsRadius           = this.BsRadius;
            this.MetaStructure.hdTextureDist      = this.HdTextureDist;
            this.MetaStructure.name               = this.Name;
            this.MetaStructure.textureDictionary  = this.TextureDictionary;
            this.MetaStructure.clipDictionary     = this.ClipDictionary;
            this.MetaStructure.drawableDictionary = this.DrawableDictionary;
            this.MetaStructure.physicsDictionary  = this.PhysicsDictionary;
            this.MetaStructure.assetType          = this.AssetType;
            this.MetaStructure.assetName          = this.AssetName;

            // CEntityDef + ?
            var entPtrs = new List <MetaPOINTER>();

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

            if (this.Rooms != null)
            {
                this.MetaStructure.rooms = mb.AddItemArrayPtr(MetaName.CMloRoomDef, this.Rooms.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray());
            }
            MCMloRoomDef.AddEnumAndStructureInfo(mb);

            if (this.Portals != null)
            {
                this.MetaStructure.portals = mb.AddItemArrayPtr(MetaName.CMloPortalDef, this.Portals.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray());
            }
            MCMloPortalDef.AddEnumAndStructureInfo(mb);

            if (this.EntitySets != null)
            {
                this.MetaStructure.entitySets = mb.AddItemArrayPtr(MetaName.CMloEntitySet, this.EntitySets.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray());
            }
            MCMloEntitySet.AddEnumAndStructureInfo(mb);

            if (this.TimeCycleModifiers != null)
            {
                this.MetaStructure.timeCycleModifiers = mb.AddItemArrayPtr(MetaName.CMloTimeCycleModifier, this.TimeCycleModifiers.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray());
            }
            MCMloTimeCycleModifier.AddEnumAndStructureInfo(mb);

            this.MetaStructure.mloFlags = this.MloFlags;

            // Extensions
            var extPtrs = new List <MetaPOINTER>();

            if (this.ExtensionDefAudioCollisionSettings != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefAudioCollisionSettings, this.ExtensionDefAudioCollisionSettings.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefAudioEmitters != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefAudioEmitter, this.ExtensionDefAudioEmitters.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefBuoyancies != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefBuoyancy, this.ExtensionDefBuoyancies.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefExplosionEffects != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefExplosionEffect, this.ExtensionDefExplosionEffects.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefExpressions != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefExpression, this.ExtensionDefExpressions.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefLadders != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefLadder, this.ExtensionDefLadders.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefLightShafts != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefLightShaft, this.ExtensionDefLightShafts.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefParticleEffects != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefParticleEffect, this.ExtensionDefParticleEffects.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefProcObjects != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefProcObject, this.ExtensionDefProcObjects.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefSpawnPoints != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefSpawnPoint, this.ExtensionDefSpawnPoints.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            if (this.ExtensionDefWindDisturbances != null)
            {
                this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefWindDisturbance, this.ExtensionDefWindDisturbances.Select(e => { e.Build(mb); return(e.MetaStructure); }));
            }

            this.MetaStructure.extensions = mb.AddPointerArray(extPtrs.ToArray());

            MCMloArchetypeDef.AddEnumAndStructureInfo(mb);

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

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