YLD/XML conversion

This commit is contained in:
dexy
2020-01-24 02:55:48 +11:00
Unverified
parent 7bc7d9612a
commit bd18610dca
8 changed files with 1771 additions and 797 deletions
File diff suppressed because it is too large Load Diff
+33 -2
View File
@@ -428,7 +428,23 @@ namespace CodeWalker.GameFiles
}
if ((Cloths?.data_items?.Length ?? 0) > 0)
{
YftXml.WriteItemArray(sb, Cloths.data_items, indent, "Cloths");
YftXml.OpenTag(sb, indent, "Cloths");
var cind = indent + 1;
var cind2 = indent + 2;
for (int i = 0; i < Cloths.data_items.Length; i++)
{
if (Cloths.data_items[i] != null)
{
YftXml.OpenTag(sb, cind, "Item");
Cloths.data_items[i].WriteXml(sb, cind2, ddsfolder);
YftXml.CloseTag(sb, cind, "Item");
}
else
{
YftXml.SelfClosingTag(sb, cind, "Item");
}
}
YftXml.CloseTag(sb, indent, "Cloths");
}
}
public void ReadXml(XmlNode node, string ddsfolder)
@@ -498,7 +514,22 @@ namespace CodeWalker.GameFiles
LightAttributes = new ResourceSimpleList64_s<LightAttributes_s>();
LightAttributes.data_items = XmlMeta.ReadItemArray<LightAttributes_s>(node, "Lights");
Cloths = new ResourcePointerList64<EnvironmentCloth>();
Cloths.data_items = XmlMeta.ReadItemArray<EnvironmentCloth>(node, "Cloths");
var cnode = node.SelectSingleNode("Cloths");
if (cnode != null)
{
var inodes = cnode.SelectNodes("Item");
if (inodes?.Count > 0)
{
var vlist = new List<EnvironmentCloth>();
foreach (XmlNode inode in inodes)
{
var v = new EnvironmentCloth();
v.ReadXml(inode, ddsfolder);
vlist.Add(v);
}
Cloths.data_items = vlist.ToArray();
}
}
AssignChildrenSkeletonsAndBounds();
AssignChildrenShaders();
@@ -1102,7 +1102,7 @@ namespace CodeWalker.GameFiles
public ushort EntriesCapacity { get; private set; }
// reference data
public ushort[] data_items { get; private set; }
public ushort[] data_items { get; set; }
private ResourceSystemStructBlock<ushort> data_block;//used for saving.
@@ -1336,7 +1336,7 @@ namespace CodeWalker.GameFiles
public ushort EntriesCapacity { get; private set; }
// reference data
public float[] data_items { get; private set; }
public float[] data_items { get; set; }
private ResourceSystemStructBlock<float> data_block;//used for saving.