public void Init(YtypFile ytyp, ref CMloArchetypeDef arch) { Ytyp = ytyp; InitVars(ref arch._BaseArchetypeDef); _MloArchetypeDef = arch; _MloArchetypeDefData = arch.MloArchetypeDef; }
//TEMP public static void GenerateMLO(string ytyppath, string ymappath) { Console.WriteLine("Insert the name for the MLO:"); string mloname = Console.ReadLine(); Ytyp theytyp = new Ytyp(XDocument.Load(ytyppath), mloname); Ymap theymap = new Ymap(XDocument.Load(ymappath), mloname); if (theytyp != null && theymap != null) { CMloInstanceDef mloent = new CMloInstanceDef(mloname); CMloArchetypeDef mloarc = new CMloArchetypeDef(mloname); //COPY VALUES mloarc.entities = theymap.CMapData.entities; mloarc.lodDist = theytyp.CMapTypes.archetypes.Max(arc => arc.lodDist); mloarc.hdTextureDist = theytyp.CMapTypes.archetypes.Max(arc => arc.hdTextureDist); mloent.lodDist = theymap.CMapData.entities.Max(ent => ent.lodDist); //GET CENTROID OF ENTITIES AND USE IT AS MLO POSITION foreach (CEntityDef ent in theymap.CMapData.entities) { mloent.position += ent.position; } mloent.position = mloent.position / theymap.CMapData.entities.Count; //CHANGE COORDSYSTEM TO PARENT'S ONE foreach (CEntityDef ent in mloarc.entities) { ent.position = ent.position - mloent.position; } //WEIRD WAY OF SAVING BECAUSE I'M ACTUALLY TOO BORED TO FIX ALL THE CODE TO SUPPORT MLO :DDDDDDDDDDD theytyp.CMapTypes.name = mloname; XDocument doc = theytyp.WriteXML(); doc.Element("CMapTypes").Element("archetypes").Add(mloarc.WriteXML()); doc.Save(mloname + ".ytyp.xml"); Console.WriteLine(mloname + ".ytyp.xml"); theymap.CMapData.name = mloname; theymap.CMapData.entities = new List <CEntityDef>(); doc = theymap.WriteXML(); doc.Element("CMapData").Element("entities").Add(mloent.WriteXML()); doc.Save(mloname + ".ymap.xml"); Console.WriteLine(mloname + ".ymap.xml"); } }
public void Init(YtypFile ytyp, CMloArchetypeDef arch) { Hash = arch.CBaseArchetypeDef.assetName; if (Hash.Hash == 0) { Hash = arch.CBaseArchetypeDef.name; } Ytyp = ytyp; MloArchetype = arch; DrawableDict = arch.CBaseArchetypeDef.drawableDictionary; TextureDict = arch.CBaseArchetypeDef.textureDictionary; ClipDict = arch.CBaseArchetypeDef.clipDictionary; BBMin = arch.CBaseArchetypeDef.bbMin; BBMax = arch.CBaseArchetypeDef.bbMax; BSCenter = arch.CBaseArchetypeDef.bsCentre; BSRadius = arch.CBaseArchetypeDef.bsRadius; IsTimeArchetype = false; IsMloArchetype = true; LodDist = arch.CBaseArchetypeDef.lodDist; }