YVR/XML and YWR/XML conversions

This commit is contained in:
dexy
2022-02-01 02:46:36 +11:00
Unverified
parent 4e8f789cf8
commit d367dbebe5
9 changed files with 443 additions and 48 deletions
+32 -2
View File
@@ -276,8 +276,8 @@ namespace CodeWalker
InitFileType(".gfx", "Scaleform Flash", 7);
InitFileType(".ynd", "Path Nodes", 8, FileTypeAction.ViewYnd, true);
InitFileType(".ynv", "Nav Mesh", 9, FileTypeAction.ViewModel, true);
InitFileType(".yvr", "Vehicle Record", 9, FileTypeAction.ViewYvr);
InitFileType(".ywr", "Waypoint Record", 9, FileTypeAction.ViewYwr);
InitFileType(".yvr", "Vehicle Record", 9, FileTypeAction.ViewYvr, true);
InitFileType(".ywr", "Waypoint Record", 9, FileTypeAction.ViewYwr, true);
InitFileType(".fxc", "Compiled Shaders", 9, FileTypeAction.ViewFxc);
InitFileType(".yed", "Expression Dictionary", 9, FileTypeAction.ViewYed, true);
InitFileType(".yld", "Cloth Dictionary", 9, FileTypeAction.ViewYld, true);
@@ -2745,6 +2745,14 @@ namespace CodeWalker
{
mformat = MetaFormat.Yed;
}
if (fnamel.EndsWith(".ywr.xml"))
{
mformat = MetaFormat.Ywr;
}
if (fnamel.EndsWith(".yvr.xml"))
{
mformat = MetaFormat.Yvr;
}
if (fnamel.EndsWith(".awc.xml"))
{
mformat = MetaFormat.Awc;
@@ -2939,6 +2947,28 @@ namespace CodeWalker
data = yed.Save();
break;
}
case MetaFormat.Ywr:
{
var ywr = XmlYwr.GetYwr(doc, fpathin);
if (ywr.Waypoints == null)
{
MessageBox.Show(fname + ": Schema not supported.", "Cannot import YWR XML");
continue;
}
data = ywr.Save();
break;
}
case MetaFormat.Yvr:
{
var yvr = XmlYvr.GetYvr(doc, fpathin);
if (yvr.Records == null)
{
MessageBox.Show(fname + ": Schema not supported.", "Cannot import YVR XML");
continue;
}
data = yvr.Save();
break;
}
case MetaFormat.Awc:
{
var awc = XmlAwc.GetAwc(doc, fpathin);
+6 -6
View File
@@ -69,11 +69,11 @@ namespace CodeWalker.Forms
sb.AppendLine("PositionX, PositionY, PositionZ, Time, VelocityX, VelocityY, VelocityZ, RightX, RightY, RightZ, TopX, TopY, TopZ, SteeringAngle, GasPedalPower, BrakePedalPower, HandbrakeUsed");
foreach (var entry in yvr.Records.Entries.data_items)
{
sb.Append(FloatUtil.ToString(entry.PositionX));
sb.Append(FloatUtil.ToString(entry.Position.X));
sb.Append(", ");
sb.Append(FloatUtil.ToString(entry.PositionY));
sb.Append(FloatUtil.ToString(entry.Position.Y));
sb.Append(", ");
sb.Append(FloatUtil.ToString(entry.PositionZ));
sb.Append(FloatUtil.ToString(entry.Position.Z));
sb.Append(", ");
sb.Append(entry.Time.ToString());
sb.Append(", ");
@@ -114,9 +114,9 @@ namespace CodeWalker.Forms
{
string[] row =
{
FloatUtil.ToString(entry.PositionX),
FloatUtil.ToString(entry.PositionY),
FloatUtil.ToString(entry.PositionZ),
FloatUtil.ToString(entry.Position.X),
FloatUtil.ToString(entry.Position.Y),
FloatUtil.ToString(entry.Position.Z),
entry.Time.ToString(),
entry.VelocityX.ToString(),
entry.VelocityY.ToString(),
+6 -6
View File
@@ -72,11 +72,11 @@ namespace CodeWalker.Forms
sb.AppendLine("PositionX, PositionY, PositionZ, Unk0, Unk1, Unk2, Unk3");
foreach (var entry in ywr.Waypoints.Entries)
{
sb.Append(FloatUtil.ToString(entry.PositionX));
sb.Append(FloatUtil.ToString(entry.Position.X));
sb.Append(", ");
sb.Append(FloatUtil.ToString(entry.PositionY));
sb.Append(FloatUtil.ToString(entry.Position.Y));
sb.Append(", ");
sb.Append(FloatUtil.ToString(entry.PositionZ));
sb.Append(FloatUtil.ToString(entry.Position.Z));
sb.Append(", ");
sb.Append(entry.Unk0.ToString());
sb.Append(", ");
@@ -97,9 +97,9 @@ namespace CodeWalker.Forms
{
string[] row =
{
FloatUtil.ToString(entry.PositionX),
FloatUtil.ToString(entry.PositionY),
FloatUtil.ToString(entry.PositionZ),
FloatUtil.ToString(entry.Position.X),
FloatUtil.ToString(entry.Position.Y),
FloatUtil.ToString(entry.Position.Z),
entry.Unk0.ToString(),
entry.Unk1.ToString(),
entry.Unk2.ToString(),