Merge pull request #91 from pnwparksfan/menyoo-import-updates

Updated Menyoo spooner XML import
This commit is contained in:
dexyfex 2021-04-14 15:27:53 +10:00 committed by GitHub
commit 3bbddbcc6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 7 deletions

View File

@ -87,7 +87,8 @@ namespace CodeWalker.Project
public bool FrozenPos { get; set; }
public string HashName { get; set; }
public int InitialHandle { get; set; }
public List<MenyooXmlObjectProperty> ObjectProperties { get; set; }
public List<MenyooXmlProperty> ObjectProperties { get; set; }
public List<MenyooXmlProperty> VehicleProperties { get; set; }
public int OpacityLevel { get; set; }
public float LodDistance { get; set; }
public bool IsVisible { get; set; }
@ -135,18 +136,31 @@ namespace CodeWalker.Project
if (enode != null)
{
var objprops = Xml.GetChild(enode, "ObjectProperties");
ObjectProperties = new List<MenyooXmlObjectProperty>();
ObjectProperties = new List<MenyooXmlProperty>();
if (objprops != null)
{
foreach (XmlNode objpropn in objprops.ChildNodes)
{
MenyooXmlObjectProperty pr = new MenyooXmlObjectProperty();
MenyooXmlProperty pr = new MenyooXmlProperty();
pr.Name = objpropn.Name;
pr.Value = objpropn.InnerText;
ObjectProperties.Add(pr);
}
}
var vehprops = Xml.GetChild(enode, "VehicleProperties");
VehicleProperties = new List<MenyooXmlProperty>();
if (vehprops != null)
{
foreach (XmlNode vehpropn in vehprops.ChildNodes)
{
MenyooXmlProperty pr = new MenyooXmlProperty();
pr.Name = vehpropn.Name;
pr.Value = vehpropn.InnerText;
VehicleProperties.Add(pr);
}
}
var posrot = Xml.GetChild(enode, "PositionRotation");
var px = Xml.GetChildFloatInnerText(posrot, "X");
var py = Xml.GetChildFloatInnerText(posrot, "Y");
@ -173,8 +187,6 @@ namespace CodeWalker.Project
IsMeleeProof = Xml.GetChildBoolInnerText(node, "IsMeleeProof");
IsOnlyDamagedByPlayer = Xml.GetChildBoolInnerText(node, "IsOnlyDamagedByPlayer");
Attachment_isAttached = Xml.GetChildBoolAttribute(node, "Attachment", "isAttached");
}
@ -186,7 +198,7 @@ namespace CodeWalker.Project
}
public class MenyooXmlObjectProperty
public class MenyooXmlProperty
{
public string Name { get; set; }
public string Value { get; set; }

View File

@ -2335,6 +2335,15 @@ namespace CodeWalker.Project
ccg.perpendicularLength = 2.6f;
ccg.position = placement.Position;
ccg.carModel = placement.ModelHash;
ccg.bodyColorRemap1 = -1;
ccg.bodyColorRemap2 = -1;
ccg.bodyColorRemap3 = -1;
ccg.bodyColorRemap4 = -1;
if (sbyte.TryParse(placement.VehicleProperties.FirstOrDefault(p => p.Name == "Livery")?.Value, out sbyte livery))
{
ccg.livery = livery;
}
YmapCarGen cg = new YmapCarGen(CurrentYmapFile, ccg);
@ -2362,11 +2371,15 @@ namespace CodeWalker.Project
cent.scaleZ = 1.0f;
cent.flags = placement.Dynamic ? 0 : 32u;// 1572872; //32 = static
cent.parentIndex = -1;
cent.lodDist = placement.LodDistance;
cent.lodDist = (placement.LodDistance < 10000) ? placement.LodDistance : -1;
cent.lodLevel = rage__eLodType.LODTYPES_DEPTH_ORPHANHD;
cent.priorityLevel = rage__ePriorityLevel.PRI_REQUIRED;
cent.ambientOcclusionMultiplier = 255;
cent.artificialAmbientOcclusion = 255;
if(uint.TryParse(placement.ObjectProperties.FirstOrDefault(p => p.Name == "TextureVariation")?.Value, out uint tint))
{
cent.tintValue = tint;
}
YmapEntityDef ent = new YmapEntityDef(CurrentYmapFile, 0, ref cent);