public override void Build(MetaBuilder mb, bool isRoot = false) { this.MetaStructure.name = this.Name; this.MetaStructure.offsetPosition = this.OffsetPosition; if (this.Instances != null) { this.MetaStructure.instances = mb.AddItemArrayPtr(MetaName.CLightAttrDef, this.Instances.Select(e => { e.Build(mb); return(e.MetaStructure); }).ToArray()); } MCLightAttrDef.AddEnumAndStructureInfo(mb); MCExtensionDefLightEffect.AddEnumAndStructureInfo(mb); if (isRoot) { mb.AddItem(this.MetaName, this.MetaStructure); this.Meta = mb.GetMeta(); } }
public override void Parse(MetaFile meta, CEntityDef CEntityDef) { this.Meta = meta; this.MetaStructure = CEntityDef; this.ArchetypeName = CEntityDef.archetypeName; this.Flags = CEntityDef.flags; this.Guid = CEntityDef.guid; this.Position = CEntityDef.position; this.Rotation = CEntityDef.rotation; this.ScaleXY = CEntityDef.scaleXY; this.ScaleZ = CEntityDef.scaleZ; this.ParentIndex = CEntityDef.parentIndex; this.LodDist = CEntityDef.lodDist; this.ChildLodDist = CEntityDef.childLodDist; this.LodLevel = CEntityDef.lodLevel; this.NumChildren = CEntityDef.numChildren; this.PriorityLevel = CEntityDef.priorityLevel; // Extensions var extptrs = MetaUtils.GetPointerArray(meta, CEntityDef.extensions); if (extptrs != null) { for (int i = 0; i < extptrs.Length; i++) { var extptr = extptrs[i]; var block = meta.GetBlock(extptr.BlockID); switch (block.StructureNameHash) { case MetaName.CExtensionDefLightEffect: { var data = MetaUtils.GetData <CExtensionDefLightEffect>(meta, extptr); var obj = new MCExtensionDefLightEffect(); obj.Parse(meta, data); ExtensionDefLightEffect.Add(obj); break; } case MetaName.CExtensionDefSpawnPointOverride: { var data = MetaUtils.GetData <CExtensionDefSpawnPointOverride>(meta, extptr); var obj = new MCExtensionDefSpawnPointOverride(); obj.Parse(meta, data); ExtensionDefSpawnPointOverride.Add(obj); break; } case MetaName.CExtensionDefDoor: { var data = MetaUtils.GetData <CExtensionDefDoor>(meta, extptr); var obj = new MCExtensionDefDoor(); obj.Parse(meta, data); ExtensionDefDoor.Add(obj); break; } case MetaName.rage__phVerletClothCustomBounds: { var data = MetaUtils.GetData <rage__phVerletClothCustomBounds>(meta, extptr); var obj = new Mrage__phVerletClothCustomBounds(); obj.Parse(meta, data); rage__phVerletClothCustomBounds.Add(obj); break; } default: break; } } } this.AmbientOcclusionMultiplier = CEntityDef.ambientOcclusionMultiplier; this.ArtificialAmbientOcclusion = CEntityDef.artificialAmbientOcclusion; this.TintValue = CEntityDef.tintValue; }
public override void Parse(MetaFile meta, CBaseArchetypeDef CBaseArchetypeDef) { this.Meta = meta; this.MetaStructure = CBaseArchetypeDef; this.LodDist = CBaseArchetypeDef.lodDist; this.Flags = CBaseArchetypeDef.flags; this.SpecialAttribute = CBaseArchetypeDef.specialAttribute; this.BbMin = CBaseArchetypeDef.bbMin; this.BbMax = CBaseArchetypeDef.bbMax; this.BsCentre = CBaseArchetypeDef.bsCentre; this.BsRadius = CBaseArchetypeDef.bsRadius; this.HdTextureDist = CBaseArchetypeDef.hdTextureDist; this.Name = (MetaName)CBaseArchetypeDef.name; this.TextureDictionary = (MetaName)CBaseArchetypeDef.textureDictionary; this.ClipDictionary = (MetaName)CBaseArchetypeDef.clipDictionary; this.DrawableDictionary = (MetaName)CBaseArchetypeDef.drawableDictionary; this.PhysicsDictionary = (MetaName)CBaseArchetypeDef.physicsDictionary; this.AssetType = CBaseArchetypeDef.assetType; this.AssetName = (MetaName)CBaseArchetypeDef.assetName; // Extensions var extptrs = MetaUtils.GetPointerArray(meta, CBaseArchetypeDef.extensions); if (extptrs != null) { for (int i = 0; i < extptrs.Length; i++) { var extptr = extptrs[i]; var block = meta.GetBlock(extptr.BlockID); switch (block.StructureNameHash) { case MetaName.CExtensionDefLightEffect: { var data = MetaUtils.GetData <CExtensionDefLightEffect>(meta, extptr); var obj = new MCExtensionDefLightEffect(); obj.Parse(meta, data); ExtensionDefLightEffects.Add(obj); break; } case MetaName.CExtensionDefSpawnPointOverride: { var data = MetaUtils.GetData <CExtensionDefSpawnPointOverride>(meta, extptr); var obj = new MCExtensionDefSpawnPointOverride(); obj.Parse(meta, data); ExtensionDefSpawnPointOverrides.Add(obj); break; } case MetaName.CExtensionDefDoor: { var data = MetaUtils.GetData <CExtensionDefDoor>(meta, extptr); var obj = new MCExtensionDefDoor(); obj.Parse(meta, data); ExtensionDefDoors.Add(obj); break; } case MetaName.rage__phVerletClothCustomBounds: { var data = MetaUtils.GetData <rage__phVerletClothCustomBounds>(meta, extptr); var obj = new Mrage__phVerletClothCustomBounds(); obj.Parse(meta, data); rage__PhVerletClothCustomBounds.Add(obj); break; } default: break; } } } }