mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Updated MetaTypes init data, Fixed XmlMeta not importing some things
This commit is contained in:
parent
6da590530b
commit
da24d38812
@ -139,6 +139,7 @@ namespace CodeWalker.GameFiles
|
||||
InitDlc();
|
||||
|
||||
|
||||
//TestMetas();
|
||||
//TestYcds();
|
||||
//TestYmaps();
|
||||
//TestPlacements();
|
||||
@ -2106,6 +2107,56 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
|
||||
|
||||
public void TestMetas()
|
||||
{
|
||||
//find all RSC meta files and generate the MetaTypes init code
|
||||
|
||||
MetaTypes.Clear();
|
||||
foreach (RpfFile file in AllRpfs)
|
||||
{
|
||||
foreach (RpfEntry entry in file.AllEntries)
|
||||
{
|
||||
try
|
||||
{
|
||||
var n = entry.NameLower;
|
||||
if (n.EndsWith(".ymap"))
|
||||
{
|
||||
UpdateStatus(string.Format(entry.Path));
|
||||
YmapFile ymapfile = RpfMan.GetFile<YmapFile>(entry);
|
||||
if ((ymapfile != null) && (ymapfile.Meta != null))
|
||||
{
|
||||
MetaTypes.EnsureMetaTypes(ymapfile.Meta);
|
||||
}
|
||||
}
|
||||
else if (n.EndsWith(".ytyp"))
|
||||
{
|
||||
UpdateStatus(string.Format(entry.Path));
|
||||
YtypFile ytypfile = RpfMan.GetFile<YtypFile>(entry);
|
||||
if ((ytypfile != null) && (ytypfile.Meta != null))
|
||||
{
|
||||
MetaTypes.EnsureMetaTypes(ytypfile.Meta);
|
||||
}
|
||||
}
|
||||
else if (n.EndsWith(".ymt"))
|
||||
{
|
||||
UpdateStatus(string.Format(entry.Path));
|
||||
YmtFile ymtfile = RpfMan.GetFile<YmtFile>(entry);
|
||||
if ((ymtfile != null) && (ymtfile.Meta != null))
|
||||
{
|
||||
MetaTypes.EnsureMetaTypes(ymtfile.Meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UpdateStatus("Error! " + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string str = MetaTypes.GetTypesInitString();
|
||||
|
||||
}
|
||||
public void TestYcds()
|
||||
{
|
||||
foreach (RpfFile file in AllRpfs)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -549,9 +549,10 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(split[i]))
|
||||
var ts = split[i]?.Trim();
|
||||
if (!string.IsNullOrEmpty(ts))
|
||||
{
|
||||
var val = Convert.ToSingle(split[i]);
|
||||
var val = FloatUtil.Parse(ts);// Convert.ToSingle(split[i]);
|
||||
data.Add(val);
|
||||
}
|
||||
}
|
||||
@ -564,22 +565,43 @@ namespace CodeWalker.GameFiles
|
||||
{
|
||||
var items = new List<Vector4>();
|
||||
|
||||
foreach (XmlNode cnode in node.ChildNodes)
|
||||
|
||||
var split = node.InnerText.Split('\n');// Regex.Split(node.InnerText, @"[\s\r\n\t]");
|
||||
|
||||
|
||||
float x = 0f;
|
||||
float y = 0f;
|
||||
float z = 0f;
|
||||
float w = 0f;
|
||||
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
|
||||
var split = Regex.Split(node.InnerText, @",\s");
|
||||
|
||||
float x = FloatUtil.Parse(split[0]);
|
||||
float y = FloatUtil.Parse(split[1]);
|
||||
float z = FloatUtil.Parse(split[2]);
|
||||
float w = 0f;
|
||||
|
||||
var val = new Vector4(x, y, z, w);
|
||||
|
||||
items.Add(val);
|
||||
break;
|
||||
var s = split[i]?.Trim();
|
||||
if (string.IsNullOrEmpty(s)) continue;
|
||||
var split2 = Regex.Split(s, @"[\s\t]");
|
||||
int c = 0;
|
||||
x = 0f; y = 0f; z = 0f;
|
||||
for (int n = 0; n < split2.Length; n++)
|
||||
{
|
||||
var ts = split2[n]?.Trim();
|
||||
if (string.IsNullOrEmpty(ts)) continue;
|
||||
var f = FloatUtil.Parse(ts);
|
||||
switch (c)
|
||||
{
|
||||
case 0: x = f; break;
|
||||
case 1: y = f; break;
|
||||
case 2: z = f; break;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
if (c >= 3)
|
||||
{
|
||||
var val = new Vector4(x, y, z, w);
|
||||
items.Add(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return mb.AddPaddedVector3ArrayPtr(items.ToArray());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user