diff --git a/GameFiles/FileTypes/YmapFile.cs b/GameFiles/FileTypes/YmapFile.cs index c569eef..3f3239c 100644 --- a/GameFiles/FileTypes/YmapFile.cs +++ b/GameFiles/FileTypes/YmapFile.cs @@ -592,7 +592,24 @@ namespace CodeWalker.GameFiles } } - mapdata.entities = mb.AddItemPointerArrayPtr(MetaName.CEntityDef, CEntityDefs); + + MetaPOINTER[] ptrs = new MetaPOINTER[AllEntities.Length]; + + for (int i = 0; i < AllEntities.Length; i++) + { + if (AllEntities[i].MloInstance != null) + { + ptrs[i] = mb.AddItemPtr(MetaName.CMloInstanceDef, AllEntities[i].MloInstance.Instance); + } + else + { + ptrs[i] = mb.AddItemPtr(MetaName.CEntityDef, AllEntities[i].CEntityDef); + } + } + + mapdata.entities = mb.AddPointerArray(ptrs); + + //mapdata.entities = mb.AddItemPointerArrayPtr(MetaName.CEntityDef, CEntityDefs); mapdata.timeCycleModifiers = mb.AddItemArrayPtr(MetaName.CTimeCycleModifier, CTimeCycleModifiers); @@ -600,11 +617,6 @@ namespace CodeWalker.GameFiles mapdata.carGenerators = mb.AddItemArrayPtr(MetaName.CCarGen, CCarGens); - if (CMloInstanceDefs != null) - { - LogSaveWarning("CMloInstanceDefs were present, may not save properly. (TODO!)"); - } - //clear everything out for now - TODO: fix if (mapdata.containerLods.Count1 != 0) LogSaveWarning("containerLods were not saved. (TODO!)"); if (mapdata.occludeModels.Count1 != 0) LogSaveWarning("occludeModels were not saved. (TODO!)"); @@ -646,6 +658,7 @@ namespace CodeWalker.GameFiles mb.AddStructureInfo(MetaName.CBlockDesc); mb.AddStructureInfo(MetaName.CMapData); mb.AddStructureInfo(MetaName.CEntityDef); + mb.AddStructureInfo(MetaName.CMloInstanceDef); mb.AddStructureInfo(MetaName.CTimeCycleModifier); if ((CCarGens != null) && (CCarGens.Length > 0)) { diff --git a/GameFiles/MetaTypes/MetaNames.cs b/GameFiles/MetaTypes/MetaNames.cs index 2751b64..cb05183 100644 --- a/GameFiles/MetaTypes/MetaNames.cs +++ b/GameFiles/MetaTypes/MetaNames.cs @@ -845,6 +845,7 @@ namespace CodeWalker.GameFiles DecisionMakerName = 71722552, Default = 1012917042, DefaultBrawlingStyle = 665939989, + defaultEntitySets = 1407157833, DefaultGestureClipSet = 289586118, DefaultRemoveRangeMultiplier = 2267082285, DefaultSpawningPreference = 3497281775, @@ -1166,6 +1167,7 @@ namespace CodeWalker.GameFiles MKT_SPORT = 3608585597, MKT_STANDARD = 315733923, MKT_SUV = 2385734984, + MLOInstflags = 3761966250, mod_col_1 = 1338030889, mod_col_2 = 2758960267, mod_col_3 = 1785032818, @@ -1213,6 +1215,7 @@ namespace CodeWalker.GameFiles NormalMapName = 2845714814, NUM_ANCHORS = 665640573, numCoronas = 2225470999, + numExitPortals = 528711607, OBJ_COVER_TUNING_FILE = 628815953, offset = 2705095151, offsetPosition = 3633645315, diff --git a/GameFiles/MetaTypes/MetaTypes.cs b/GameFiles/MetaTypes/MetaTypes.cs index 097b335..6a173d8 100644 --- a/GameFiles/MetaTypes/MetaTypes.cs +++ b/GameFiles/MetaTypes/MetaTypes.cs @@ -350,6 +350,34 @@ namespace CodeWalker.GameFiles new MetaStructureEntryInfo_s(MetaName.artificialAmbientOcclusion, 116, MetaStructureEntryDataType.SignedInt, 0, 0, 0), new MetaStructureEntryInfo_s(MetaName.tintValue, 120, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0) ); + case MetaName.CMloInstanceDef + : + return new MetaStructureInfo(MetaName.CMloInstanceDef, 2151576752, 1024, 160, + new MetaStructureEntryInfo_s(MetaName.archetypeName, 8, MetaStructureEntryDataType.Hash, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.flags, 12, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.guid, 16, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.position, 32, MetaStructureEntryDataType.Float_XYZ, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.rotation, 48, MetaStructureEntryDataType.Float_XYZW, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.scaleXY, 64, MetaStructureEntryDataType.Float, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.scaleZ, 68, MetaStructureEntryDataType.Float, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.parentIndex, 72, MetaStructureEntryDataType.SignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.lodDist, 76, MetaStructureEntryDataType.Float, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.childLodDist, 80, MetaStructureEntryDataType.Float, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.lodLevel, 84, MetaStructureEntryDataType.IntEnum, 0, 0, (MetaName)1264241711), + new MetaStructureEntryInfo_s(MetaName.numChildren, 88, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.priorityLevel, 92, MetaStructureEntryDataType.IntEnum, 0, 0, (MetaName)648413703), + new MetaStructureEntryInfo_s(MetaName.ARRAYINFO, 0, MetaStructureEntryDataType.StructurePointer, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.extensions, 96, MetaStructureEntryDataType.Array, 0, 13, 0), + new MetaStructureEntryInfo_s(MetaName.ambientOcclusionMultiplier, 112, MetaStructureEntryDataType.SignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.artificialAmbientOcclusion, 116, MetaStructureEntryDataType.SignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.tintValue, 120, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.groupId, 128, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.floorId, 132, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.ARRAYINFO, 0, MetaStructureEntryDataType.Hash, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.defaultEntitySets, 136, MetaStructureEntryDataType.Array, 0, 20, 0), + new MetaStructureEntryInfo_s(MetaName.numExitPortals, 152, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0), + new MetaStructureEntryInfo_s(MetaName.MLOInstflags, 156, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0) + ); case MetaName.CTimeCycleModifier: return new MetaStructureInfo(MetaName.CTimeCycleModifier, 2683420777, 1024, 64, new MetaStructureEntryInfo_s(MetaName.name, 8, MetaStructureEntryDataType.Hash, 0, 0, 0),