Fix for BoundVertex going out of range on XML import

This commit is contained in:
dexy 2024-07-25 18:09:37 +10:00
parent 05bd42f3a6
commit 4b65af9d74

View File

@ -4465,15 +4465,20 @@ namespace CodeWalker.GameFiles
public BoundVertex_s(Vector3 v) public BoundVertex_s(Vector3 v)
{ {
X = (short)v.X; X = (short)Math.Min(Math.Max(v.X, -32767f), 32767f);
Y = (short)v.Y; Y = (short)Math.Min(Math.Max(v.Y, -32767f), 32767f);
Z = (short)v.Z; Z = (short)Math.Min(Math.Max(v.Z, -32767f), 32767f);
} }
public Vector3 Vector public Vector3 Vector
{ {
get { return new Vector3(X, Y, Z); } get { return new Vector3(X, Y, Z); }
set { X = (short)value.X; Y = (short)value.Y; Z = (short)value.Z; } set
{
X = (short)Math.Min(Math.Max(value.X, -32767f), 32767f);
Y = (short)Math.Min(Math.Max(value.Y, -32767f), 32767f);
Z = (short)Math.Min(Math.Max(value.Z, -32767f), 32767f);
}
} }
} }