mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Export/import missing nav poly flags
This commit is contained in:
parent
c45ea83733
commit
6546eec82f
@ -768,6 +768,7 @@ namespace CodeWalker.GameFiles
|
|||||||
public byte Flags2 { get { return _RawData.Flags2; } set { _RawData.Flags2 = value; } }
|
public byte Flags2 { get { return _RawData.Flags2; } set { _RawData.Flags2 = value; } }
|
||||||
public byte Flags3 { get { return _RawData.Flags3; } set { _RawData.Flags3 = value; } }
|
public byte Flags3 { get { return _RawData.Flags3; } set { _RawData.Flags3 = value; } }
|
||||||
public byte Flags4 { get { return _RawData.Flags4; } set { _RawData.Flags4 = value; } }
|
public byte Flags4 { get { return _RawData.Flags4; } set { _RawData.Flags4 = value; } }
|
||||||
|
public byte Flags5 { get { return _RawData.Flags5; } set { _RawData.Flags5 = value; } }
|
||||||
public bool B00_AvoidUnk { get { return (_RawData.PolyFlags0 & 1) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 0, value); } }
|
public bool B00_AvoidUnk { get { return (_RawData.PolyFlags0 & 1) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 0, value); } }
|
||||||
public bool B01_AvoidUnk { get { return (_RawData.PolyFlags0 & 2) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 1, value); } }
|
public bool B01_AvoidUnk { get { return (_RawData.PolyFlags0 & 2) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 1, value); } }
|
||||||
public bool B02_IsFootpath { get { return (_RawData.PolyFlags0 & 4) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 2, value); } }
|
public bool B02_IsFootpath { get { return (_RawData.PolyFlags0 & 4) > 0; } set { _RawData.PolyFlags0 = (ushort)BitUtil.UpdateBit(_RawData.PolyFlags0, 2, value); } }
|
||||||
@ -997,7 +998,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
public void WriteXml(StringBuilder sb, int indent)
|
public void WriteXml(StringBuilder sb, int indent)
|
||||||
{
|
{
|
||||||
byte[] flags = { Flags1, Flags2, Flags3, Flags4, UnkX, UnkY };
|
byte[] flags = { Flags1, Flags2, Flags3, Flags4, UnkX, UnkY, Flags5 };
|
||||||
YnvXml.WriteRawArray(sb, flags, indent, "Flags", "");
|
YnvXml.WriteRawArray(sb, flags, indent, "Flags", "");
|
||||||
YnvXml.WriteRawArray(sb, Vertices, indent, "Vertices", "", YnvXml.FormatVector3, 1);
|
YnvXml.WriteRawArray(sb, Vertices, indent, "Vertices", "", YnvXml.FormatVector3, 1);
|
||||||
var cind = indent + 1;
|
var cind = indent + 1;
|
||||||
@ -1009,6 +1010,14 @@ namespace CodeWalker.GameFiles
|
|||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
}
|
}
|
||||||
YnvXml.CloseTag(sb, indent, "Edges");
|
YnvXml.CloseTag(sb, indent, "Edges");
|
||||||
|
YnvXml.OpenTag(sb, indent, "EdgesFlags");
|
||||||
|
foreach (var e in Edges)
|
||||||
|
{
|
||||||
|
YnvXml.Indent(sb, cind);
|
||||||
|
sb.AppendFormat("{0}:{1}, {2}:{3}", e.Poly1Unk2, e.Poly1Unk3, e.Poly2Unk2, e.Poly2Unk3);
|
||||||
|
sb.AppendLine();
|
||||||
|
}
|
||||||
|
YnvXml.CloseTag(sb, indent, "EdgesFlags");
|
||||||
if ((PortalLinks != null) && (PortalLinks.Length > 0))
|
if ((PortalLinks != null) && (PortalLinks.Length > 0))
|
||||||
{
|
{
|
||||||
YnvXml.WriteRawArray(sb, PortalLinks, indent, "Portals", "");
|
YnvXml.WriteRawArray(sb, PortalLinks, indent, "Portals", "");
|
||||||
@ -1025,6 +1034,7 @@ namespace CodeWalker.GameFiles
|
|||||||
Flags4 = (flags.Length > 3) ? flags[3] : (byte)0;
|
Flags4 = (flags.Length > 3) ? flags[3] : (byte)0;
|
||||||
UnkX = (flags.Length > 4) ? flags[4] : (byte)0;
|
UnkX = (flags.Length > 4) ? flags[4] : (byte)0;
|
||||||
UnkY = (flags.Length > 5) ? flags[5] : (byte)0;
|
UnkY = (flags.Length > 5) ? flags[5] : (byte)0;
|
||||||
|
Flags5 = (flags.Length > 6) ? flags[6] : (byte)0;
|
||||||
}
|
}
|
||||||
Vertices = Xml.GetChildRawVector3Array(node, "Vertices");
|
Vertices = Xml.GetChildRawVector3Array(node, "Vertices");
|
||||||
Indices = new ushort[Vertices?.Length ?? 0];//needs to be present for later
|
Indices = new ushort[Vertices?.Length ?? 0];//needs to be present for later
|
||||||
@ -1060,6 +1070,34 @@ namespace CodeWalker.GameFiles
|
|||||||
{
|
{
|
||||||
Edges = edges.ToArray();
|
Edges = edges.ToArray();
|
||||||
}
|
}
|
||||||
|
var edgesflagsstr = Xml.GetChildInnerText(node, "EdgesFlags");
|
||||||
|
var edgesflagsstrarr = edgesflagsstr.Trim().Split('\n');
|
||||||
|
int edgeflagidx = -1;
|
||||||
|
foreach (var edgeflagsstr in edgesflagsstrarr)
|
||||||
|
{
|
||||||
|
edgeflagidx++;
|
||||||
|
var estrparts = edgeflagsstr.Trim().Split(',');
|
||||||
|
if (estrparts.Length != 2)
|
||||||
|
{ continue; }
|
||||||
|
var estrp0 = estrparts[0].Trim().Split(':');
|
||||||
|
var estrp1 = estrparts[1].Trim().Split(':');
|
||||||
|
if (estrp0.Length != 2)
|
||||||
|
{ continue; }
|
||||||
|
if (estrp1.Length != 2)
|
||||||
|
{ continue; }
|
||||||
|
|
||||||
|
uint p1u2, p1u3, p2u2, p2u3;
|
||||||
|
uint.TryParse(estrp0[0].Trim(), out p1u2);
|
||||||
|
uint.TryParse(estrp0[1].Trim(), out p1u3);
|
||||||
|
uint.TryParse(estrp1[0].Trim(), out p2u2);
|
||||||
|
uint.TryParse(estrp1[1].Trim(), out p2u3);
|
||||||
|
|
||||||
|
var e = Edges[edgeflagidx];
|
||||||
|
e.Poly1Unk2 = p1u2;
|
||||||
|
e.Poly1Unk3 = p1u3;
|
||||||
|
e.Poly2Unk2 = p2u2;
|
||||||
|
e.Poly2Unk3 = p2u3;
|
||||||
|
}
|
||||||
|
|
||||||
PortalLinks = Xml.GetChildRawUshortArrayNullable(node, "Portals");
|
PortalLinks = Xml.GetChildRawUshortArrayNullable(node, "Portals");
|
||||||
}
|
}
|
||||||
@ -1242,6 +1280,10 @@ namespace CodeWalker.GameFiles
|
|||||||
public uint AreaID2 { get; set; }
|
public uint AreaID2 { get; set; }
|
||||||
public uint PolyID1 { get { return _RawData._Poly1.PolyID; } set { _RawData._Poly1.PolyID = value; } }
|
public uint PolyID1 { get { return _RawData._Poly1.PolyID; } set { _RawData._Poly1.PolyID = value; } }
|
||||||
public uint PolyID2 { get { return _RawData._Poly2.PolyID; } set { _RawData._Poly2.PolyID = value; } }
|
public uint PolyID2 { get { return _RawData._Poly2.PolyID; } set { _RawData._Poly2.PolyID = value; } }
|
||||||
|
public uint Poly1Unk2 { get { return _RawData._Poly1.Unk2; } set { _RawData._Poly1.Unk2 = value; } }
|
||||||
|
public uint Poly2Unk2 { get { return _RawData._Poly2.Unk2; } set { _RawData._Poly2.Unk2 = value; } }
|
||||||
|
public uint Poly1Unk3 { get { return _RawData._Poly1.Unk3; } set { _RawData._Poly1.Unk3 = value; } }
|
||||||
|
public uint Poly2Unk3 { get { return _RawData._Poly2.Unk3; } set { _RawData._Poly2.Unk3 = value; } }
|
||||||
public YnvPoly Poly1 { get; set; }
|
public YnvPoly Poly1 { get; set; }
|
||||||
public YnvPoly Poly2 { get; set; }
|
public YnvPoly Poly2 { get; set; }
|
||||||
|
|
||||||
|
@ -845,6 +845,7 @@ namespace CodeWalker.GameFiles
|
|||||||
public byte Flags2 { get { return (byte)((PolyFlags1 >> 0) & 0xFF); } set { PolyFlags1 = ((PolyFlags1 & 0xFFFFFF00u) | ((value & 0xFFu) << 0)); } }
|
public byte Flags2 { get { return (byte)((PolyFlags1 >> 0) & 0xFF); } set { PolyFlags1 = ((PolyFlags1 & 0xFFFFFF00u) | ((value & 0xFFu) << 0)); } }
|
||||||
public byte Flags3 { get { return (byte)((PolyFlags1 >> 9) & 0xFF); } set { PolyFlags1 = ((PolyFlags1 & 0xFFFE01FFu) | ((value & 0xFFu) << 9)); } }
|
public byte Flags3 { get { return (byte)((PolyFlags1 >> 9) & 0xFF); } set { PolyFlags1 = ((PolyFlags1 & 0xFFFE01FFu) | ((value & 0xFFu) << 9)); } }
|
||||||
public byte Flags4 { get { return (byte)((PolyFlags2 >> 16) & 0xFF); } set { PolyFlags2 = ((PolyFlags2 & 0xFF00FFFFu) | ((value & 0xFFu) << 16)); } }
|
public byte Flags4 { get { return (byte)((PolyFlags2 >> 16) & 0xFF); } set { PolyFlags2 = ((PolyFlags2 & 0xFF00FFFFu) | ((value & 0xFFu) << 16)); } }
|
||||||
|
public byte Flags5 { get { return (byte)((PolyFlags1 >> 8) & 0x1); } set { PolyFlags1 = ((PolyFlags1 & 0xFFFFFEFFu) | ((value & 0x1u) << 8)); } }
|
||||||
|
|
||||||
//public uint UnkFlags0 { get { return (uint)((PolyFlags0 >> 8) & 0xFF); } } //always 0
|
//public uint UnkFlags0 { get { return (uint)((PolyFlags0 >> 8) & 0xFF); } } //always 0
|
||||||
//public uint UnkFlags1 { get { return (uint)((PolyFlags1 >> 17) & 0xFFFF); } } //always 0
|
//public uint UnkFlags1 { get { return (uint)((PolyFlags1 >> 17) & 0xFFFF); } } //always 0
|
||||||
|
Loading…
Reference in New Issue
Block a user