Tweak(particle): update previously Unknown values and correct bytes

This commit is contained in:
ook3d 2023-12-17 04:15:00 -05:00
parent 3a04afa9e3
commit 3be4ee9c0f

View File

@ -1,4 +1,5 @@
using System; using SharpDX;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -2060,39 +2061,51 @@ namespace CodeWalker.GameFiles
public ulong EventEmittersPointer { get; set; } public ulong EventEmittersPointer { get; set; }
public ushort EventEmittersCount { get; set; } public ushort EventEmittersCount { get; set; }
public ushort EventEmittersCapacity { get; set; } = 32; //always 32 public ushort EventEmittersCapacity { get; set; } = 32; //always 32
public uint Unknown_44h; // 0x00000000 public uint Unknown_44h; // 0x00000000
public ulong UnknownData1Pointer { get; set; } public ulong UnknownData1Pointer { get; set; }
public uint Unknown_50h { get; set; } // 0, 0xffffffff public uint Unknown_50h { get; set; } // 0, 0xffffffff
public uint Unknown_54h { get; set; } // eg. 0x01010200 public uint Unknown_54h { get; set; } // eg. 0x01010200
public ulong Unknown_58h; // 0x0000000000000000 public int NumLoops { get; set; }
public ulong Unknown_60h; // 0x0000000000000000 public byte SortEventsByDistance { get; set; }
public uint Unknown_68h; // 0x00000000 public byte DrawListId { get; set; }
public uint Unknown_6Ch { get; set; } = 0x7f800001; // 0x7f800001 public byte IsShortLived { get; set; }
public float Unknown_70h { get; set; } public byte HasNoShadows { get; set; }
public float Unknown_74h { get; set; } // 0, 0.1f, 0.25f, 1.0f public Vector3 VRandOffsetPos { get; set; }
public float PlaybackDelay { get; set; } public uint Unknown_6Ch { get; set; } = 0x7f800001; // 4 Bytes
public float PlaybackDelayModifier { get; set; } public float PreUpdateTime { get; set; } // float m_preUpdateTime
public float PlaybackSpeedScale { get; set; } public float PreUpdateTimeInterval { get; set; } // float m_preUpdateTimeInterval
public float PlaybackSpeedScaleModifier { get; set; } public float DurationMin { get; set; } // float m_durationMin
public uint Unknown_88h { get; set; } // eg. 0x01010105 public float DurationMax { get; set; } // float m_durationMax
public uint Unknown_8Ch { get; set; } // eg. 0x01010002 public float PlaybackRateScalarMin { get; set; } // float m_playbackRateScalarMin
public float CullRadius { get; set; } public float PlaybackRateScalarMax { get; set; } // float m_playbackRateScalarMax
public float CullDistance { get; set; } public byte ViewportCullingMode { get; set; } // unsigned __int8 m_viewportCullingMode;
public float Unknown_98h { get; set; } public byte RenderWhenViewportCulled { get; set; } // bool m_renderWhenViewportCulled;
public uint Unknown_9Ch { get; set; } = 0x7f800001;// 0x7f800001 public byte UpdateWhenViewportCulled { get; set; } // bool m_updateWhenViewportCulled
public float Unknown_A0h { get; set; } public byte EmitWhenViewportCulled { get; set; } // bool m_emitWhenViewportCulled;
public float Unknown_A4h { get; set; } public byte DistanceCullingMode { get; set; } // unsigned __int8 m_distanceCullingMode;
public float Unknown_A8h { get; set; } public byte RenderWhenDistanceCulled { get; set; } // bool m_renderWhenDistanceCulled;
public float Unknown_ACh { get; set; } public byte UpdateWhenDistanceCulled { get; set; } // bool m_updateWhenDistanceCulled;
public float Unknown_B0h { get; set; } public byte EmitWhenDistanceCulled { get; set; } // bool m_emitWhenDistanceCulled;
public float Unknown_B4h { get; set; } public Vector3 ViewportCullingSphereOffset { get; set; } // Vec3V m_viewportCullingSphereOffset
public float Unknown_B8h { get; set; } public uint Unknown_9Ch { get; set; } = 0x7f800001; // Unused / Extra ?
public uint Unknown_BCh { get; set; } // eg. 0x00010103 public float ViewportCullingSphereRadius { get; set; } // float m_viewportCullingSphereRadius;
public ParticleKeyframeProp KeyframeProp0 { get; set; } public float DistanceCullingFadeDist { get; set; } // float m_distanceCullingFadeDist;
public ParticleKeyframeProp KeyframeProp1 { get; set; } public float DistanceCullingCullDist { get; set; } // float m_distanceCullingCullDist;
public ParticleKeyframeProp KeyframeProp2 { get; set; } public float LodEvoDistMin { get; set; } // float m_lodEvoDistMin;
public ParticleKeyframeProp KeyframeProp3 { get; set; } public float LodEvoDistMax { get; set; } // float m_lodEvoDistMax;
public ParticleKeyframeProp KeyframeProp4 { get; set; } public float ColnRange { get; set; } // float float m_colnRange;
public float ColnProbeDist { get; set; } // float m_colnProbeDist;
public byte ColnType { get; set; } // unsigned __int8 m_colnType;
public byte ShareEntityColn { get; set; } // bool m_shareEntityColn;
public byte OnlyUseBVHColn { get; set; } // bool m_onlyUseBVHColn;
public byte GameFlags { get; set; } // unsigned __int8 m_gameFlags;
public ParticleKeyframeProp ColourTintMinKFP { get; set; } // ptxKeyframeProp m_colourTintMinKFP;
public ParticleKeyframeProp ColourTintMaxKFP { get; set; } // ptxKeyframeProp m_colourTintMaxKFP;
public ParticleKeyframeProp ZoomScalarKFP { get; set; } // ptxKeyframeProp m_zoomScalarKFP;
public ParticleKeyframeProp DataSphereKFP { get; set; } // ptxKeyframeProp m_dataSphereKFP;
public ParticleKeyframeProp DataCapsuleKFP { get; set; } // ptxKeyframeProp m_dataCapsuleKFP;
public ulong KeyframePropsPointer { get; set; } //pointer to a list, which is pointing back to above items public ulong KeyframePropsPointer { get; set; } //pointer to a list, which is pointing back to above items
public ushort KeyframePropsCount { get; set; } = 5; //always 5 public ushort KeyframePropsCount { get; set; } = 5; //always 5
public ushort KeyframePropsCapacity { get; set; } = 16; //always 16 public ushort KeyframePropsCapacity { get; set; } = 16; //always 16
@ -2125,7 +2138,7 @@ namespace CodeWalker.GameFiles
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
this.NamePointer = reader.ReadUInt64(); this.NamePointer = reader.ReadUInt64();
this.Unknown_28h = reader.ReadUInt64(); this.Unknown_28h = reader.ReadUInt64();
this.VFT2 = reader.ReadUInt32(); this.VFT2 = reader.ReadUInt32();
this.Unknown_34h = reader.ReadUInt32(); this.Unknown_34h = reader.ReadUInt32();
this.EventEmittersPointer = reader.ReadUInt64(); this.EventEmittersPointer = reader.ReadUInt64();
this.EventEmittersCount = reader.ReadUInt16(); this.EventEmittersCount = reader.ReadUInt16();
@ -2134,35 +2147,46 @@ namespace CodeWalker.GameFiles
this.UnknownData1Pointer = reader.ReadUInt64(); this.UnknownData1Pointer = reader.ReadUInt64();
this.Unknown_50h = reader.ReadUInt32(); this.Unknown_50h = reader.ReadUInt32();
this.Unknown_54h = reader.ReadUInt32(); this.Unknown_54h = reader.ReadUInt32();
this.Unknown_58h = reader.ReadUInt64(); this.NumLoops = reader.ReadInt32();
this.Unknown_60h = reader.ReadUInt64(); this.SortEventsByDistance = reader.ReadByte();
this.Unknown_68h = reader.ReadUInt32(); this.DrawListId = reader.ReadByte();
this.IsShortLived = reader.ReadByte();
this.HasNoShadows = reader.ReadByte();
this.VRandOffsetPos = reader.ReadVector3();
this.Unknown_6Ch = reader.ReadUInt32(); this.Unknown_6Ch = reader.ReadUInt32();
this.Unknown_70h = reader.ReadSingle(); this.PreUpdateTime = reader.ReadSingle();
this.Unknown_74h = reader.ReadSingle(); this.PreUpdateTimeInterval = reader.ReadSingle();
this.PlaybackDelay = reader.ReadSingle(); this.DurationMin = reader.ReadSingle();
this.PlaybackDelayModifier = reader.ReadSingle(); this.DurationMax = reader.ReadSingle();
this.PlaybackSpeedScale = reader.ReadSingle(); this.PlaybackRateScalarMin = reader.ReadSingle();
this.PlaybackSpeedScaleModifier = reader.ReadSingle(); this.PlaybackRateScalarMax = reader.ReadSingle();
this.Unknown_88h = reader.ReadUInt32(); this.ViewportCullingMode = reader.ReadByte();
this.Unknown_8Ch = reader.ReadUInt32(); this.RenderWhenViewportCulled = reader.ReadByte();
this.CullRadius = reader.ReadSingle(); this.UpdateWhenViewportCulled = reader.ReadByte();
this.CullDistance = reader.ReadSingle(); this.EmitWhenViewportCulled = reader.ReadByte();
this.Unknown_98h = reader.ReadSingle(); this.DistanceCullingMode = reader.ReadByte();
this.RenderWhenDistanceCulled = reader.ReadByte();
this.UpdateWhenDistanceCulled = reader.ReadByte();
this.EmitWhenDistanceCulled = reader.ReadByte();
this.ViewportCullingSphereOffset = reader.ReadVector3();
this.Unknown_9Ch = reader.ReadUInt32(); this.Unknown_9Ch = reader.ReadUInt32();
this.Unknown_A0h = reader.ReadSingle(); this.ViewportCullingSphereRadius = reader.ReadSingle();
this.Unknown_A4h = reader.ReadSingle(); this.DistanceCullingFadeDist = reader.ReadSingle();
this.Unknown_A8h = reader.ReadSingle(); this.DistanceCullingCullDist = reader.ReadSingle();
this.Unknown_ACh = reader.ReadSingle(); this.LodEvoDistMin = reader.ReadSingle();
this.Unknown_B0h = reader.ReadSingle(); this.LodEvoDistMax = reader.ReadSingle();
this.Unknown_B4h = reader.ReadSingle(); this.ColnRange = reader.ReadSingle();
this.Unknown_B8h = reader.ReadSingle(); this.ColnProbeDist = reader.ReadSingle();
this.Unknown_BCh = reader.ReadUInt32(); this.ColnType = reader.ReadByte();
this.KeyframeProp0 = reader.ReadBlock<ParticleKeyframeProp>(); this.ShareEntityColn = reader.ReadByte();
this.KeyframeProp1 = reader.ReadBlock<ParticleKeyframeProp>(); this.OnlyUseBVHColn = reader.ReadByte();
this.KeyframeProp2 = reader.ReadBlock<ParticleKeyframeProp>(); this.GameFlags = reader.ReadByte();
this.KeyframeProp3 = reader.ReadBlock<ParticleKeyframeProp>();
this.KeyframeProp4 = reader.ReadBlock<ParticleKeyframeProp>(); this.ColourTintMinKFP = reader.ReadBlock<ParticleKeyframeProp>();
this.ColourTintMaxKFP = reader.ReadBlock<ParticleKeyframeProp>();
this.ZoomScalarKFP = reader.ReadBlock<ParticleKeyframeProp>();
this.DataSphereKFP = reader.ReadBlock<ParticleKeyframeProp>();
this.DataCapsuleKFP = reader.ReadBlock<ParticleKeyframeProp>();
this.KeyframePropsPointer = reader.ReadUInt64(); this.KeyframePropsPointer = reader.ReadUInt64();
this.KeyframePropsCount = reader.ReadUInt16(); this.KeyframePropsCount = reader.ReadUInt16();
this.KeyframePropsCapacity = reader.ReadUInt16(); this.KeyframePropsCapacity = reader.ReadUInt16();
@ -2524,35 +2548,45 @@ namespace CodeWalker.GameFiles
writer.Write(this.UnknownData1Pointer); writer.Write(this.UnknownData1Pointer);
writer.Write(this.Unknown_50h); writer.Write(this.Unknown_50h);
writer.Write(this.Unknown_54h); writer.Write(this.Unknown_54h);
writer.Write(this.Unknown_58h); writer.Write(this.NumLoops);
writer.Write(this.Unknown_60h); writer.Write(this.SortEventsByDistance);
writer.Write(this.Unknown_68h); writer.Write(this.DrawListId);
writer.Write(this.IsShortLived);
writer.Write(this.HasNoShadows);
writer.Write(this.VRandOffsetPos);
writer.Write(this.Unknown_6Ch); writer.Write(this.Unknown_6Ch);
writer.Write(this.Unknown_70h); writer.Write(this.PreUpdateTime);
writer.Write(this.Unknown_74h); writer.Write(this.PreUpdateTimeInterval);
writer.Write(this.PlaybackDelay); writer.Write(this.DurationMin);
writer.Write(this.PlaybackDelayModifier); writer.Write(this.DurationMax);
writer.Write(this.PlaybackSpeedScale); writer.Write(this.PlaybackRateScalarMin);
writer.Write(this.PlaybackSpeedScaleModifier); writer.Write(this.PlaybackRateScalarMax);
writer.Write(this.Unknown_88h); writer.Write(this.ViewportCullingMode);
writer.Write(this.Unknown_8Ch); writer.Write(this.RenderWhenViewportCulled);
writer.Write(this.CullRadius); writer.Write(this.UpdateWhenViewportCulled);
writer.Write(this.CullDistance); writer.Write(this.EmitWhenViewportCulled);
writer.Write(this.Unknown_98h); writer.Write(this.DistanceCullingMode);
writer.Write(this.RenderWhenDistanceCulled);
writer.Write(this.UpdateWhenDistanceCulled);
writer.Write(this.EmitWhenDistanceCulled);
writer.Write(this.ViewportCullingSphereOffset);
writer.Write(this.Unknown_9Ch); writer.Write(this.Unknown_9Ch);
writer.Write(this.Unknown_A0h); writer.Write(this.ViewportCullingSphereRadius);
writer.Write(this.Unknown_A4h); writer.Write(this.DistanceCullingFadeDist);
writer.Write(this.Unknown_A8h); writer.Write(this.DistanceCullingCullDist);
writer.Write(this.Unknown_ACh); writer.Write(this.LodEvoDistMin);
writer.Write(this.Unknown_B0h); writer.Write(this.LodEvoDistMax);
writer.Write(this.Unknown_B4h); writer.Write(this.ColnRange);
writer.Write(this.Unknown_B8h); writer.Write(this.ColnProbeDist);
writer.Write(this.Unknown_BCh); writer.Write(this.ColnType);
writer.WriteBlock(this.KeyframeProp0); writer.Write(this.ShareEntityColn);
writer.WriteBlock(this.KeyframeProp1); writer.Write(this.OnlyUseBVHColn);
writer.WriteBlock(this.KeyframeProp2); writer.Write(this.GameFlags);
writer.WriteBlock(this.KeyframeProp3); writer.WriteBlock(this.ColourTintMinKFP);
writer.WriteBlock(this.KeyframeProp4); writer.WriteBlock(this.ColourTintMaxKFP);
writer.WriteBlock(this.ZoomScalarKFP);
writer.WriteBlock(this.DataSphereKFP);
writer.WriteBlock(this.DataCapsuleKFP);
writer.Write(this.KeyframePropsPointer); writer.Write(this.KeyframePropsPointer);
writer.Write(this.KeyframePropsCount); writer.Write(this.KeyframePropsCount);
writer.Write(this.KeyframePropsCapacity); writer.Write(this.KeyframePropsCapacity);
@ -2569,25 +2603,37 @@ namespace CodeWalker.GameFiles
YptXml.StringTag(sb, indent, "Name", YptXml.XmlEscape(Name?.Value ?? "")); YptXml.StringTag(sb, indent, "Name", YptXml.XmlEscape(Name?.Value ?? ""));
YptXml.ValueTag(sb, indent, "Unknown50", YptXml.UintString(Unknown_50h)); YptXml.ValueTag(sb, indent, "Unknown50", YptXml.UintString(Unknown_50h));
YptXml.ValueTag(sb, indent, "Unknown54", YptXml.UintString(Unknown_54h)); YptXml.ValueTag(sb, indent, "Unknown54", YptXml.UintString(Unknown_54h));
YptXml.ValueTag(sb, indent, "Unknown70", FloatUtil.ToString(Unknown_70h)); YptXml.ValueTag(sb, indent, "NumLoops", FloatUtil.ToString(NumLoops));
YptXml.ValueTag(sb, indent, "Unknown74", FloatUtil.ToString(Unknown_74h)); YptXml.ValueTag(sb, indent, "SortEventsByDistance", FloatUtil.ToString(SortEventsByDistance));
YptXml.ValueTag(sb, indent, "PlaybackDelay", FloatUtil.ToString(PlaybackDelay)); YptXml.ValueTag(sb, indent, "DrawListId", FloatUtil.ToString(DrawListId));
YptXml.ValueTag(sb, indent, "PlaybackDelayModifier", FloatUtil.ToString(PlaybackDelayModifier)); YptXml.ValueTag(sb, indent, "IsShortLived", FloatUtil.ToString(IsShortLived));
YptXml.ValueTag(sb, indent, "PlaybackSpeedScale", FloatUtil.ToString(PlaybackSpeedScale)); YptXml.ValueTag(sb, indent, "HasNoShadows", FloatUtil.ToString(HasNoShadows));
YptXml.ValueTag(sb, indent, "PlaybackSpeedScaleModifier", FloatUtil.ToString(PlaybackSpeedScaleModifier)); YftXml.SelfClosingTag(sb, indent, "VRandOffsetPos " + FloatUtil.GetVector3XmlString(VRandOffsetPos));
YptXml.ValueTag(sb, indent, "Unknown88", YptXml.UintString(Unknown_88h)); YptXml.ValueTag(sb, indent, "PreUpdateTime", FloatUtil.ToString(PreUpdateTime));
YptXml.ValueTag(sb, indent, "Unknown8C", YptXml.UintString(Unknown_8Ch)); YptXml.ValueTag(sb, indent, "PreUpdateTimeInterval", FloatUtil.ToString(PreUpdateTimeInterval));
YptXml.ValueTag(sb, indent, "CullRadius", FloatUtil.ToString(CullRadius)); YptXml.ValueTag(sb, indent, "DurationMin", FloatUtil.ToString(DurationMin));
YptXml.ValueTag(sb, indent, "CullDistance", FloatUtil.ToString(CullDistance)); YptXml.ValueTag(sb, indent, "DurationMax", FloatUtil.ToString(DurationMax));
YptXml.ValueTag(sb, indent, "Unknown98", FloatUtil.ToString(Unknown_98h)); YptXml.ValueTag(sb, indent, "PlaybackRateScalarMin", FloatUtil.ToString(PlaybackRateScalarMin));
YptXml.ValueTag(sb, indent, "UnknownA0", FloatUtil.ToString(Unknown_A0h)); YptXml.ValueTag(sb, indent, "PlaybackRateScalarMax", FloatUtil.ToString(PlaybackRateScalarMax));
YptXml.ValueTag(sb, indent, "UnknownA4", FloatUtil.ToString(Unknown_A4h)); YptXml.ValueTag(sb, indent, "ViewportCullingMode", FloatUtil.ToString(ViewportCullingMode));
YptXml.ValueTag(sb, indent, "UnknownA8", FloatUtil.ToString(Unknown_A8h)); YptXml.ValueTag(sb, indent, "RenderWhenViewportCulled", FloatUtil.ToString(RenderWhenViewportCulled));
YptXml.ValueTag(sb, indent, "UnknownAC", FloatUtil.ToString(Unknown_ACh)); YptXml.ValueTag(sb, indent, "UpdateWhenViewportCulled", FloatUtil.ToString(UpdateWhenViewportCulled));
YptXml.ValueTag(sb, indent, "UnknownB0", FloatUtil.ToString(Unknown_B0h)); YptXml.ValueTag(sb, indent, "EmitWhenViewportCulled", FloatUtil.ToString(EmitWhenViewportCulled));
YptXml.ValueTag(sb, indent, "UnknownB4", FloatUtil.ToString(Unknown_B4h)); YptXml.ValueTag(sb, indent, "DistanceCullingMode", FloatUtil.ToString(DistanceCullingMode));
YptXml.ValueTag(sb, indent, "UnknownB8", FloatUtil.ToString(Unknown_B8h)); YptXml.ValueTag(sb, indent, "RenderWhenDistanceCulled", FloatUtil.ToString(RenderWhenDistanceCulled));
YptXml.ValueTag(sb, indent, "UnknownBC", YptXml.UintString(Unknown_BCh)); YptXml.ValueTag(sb, indent, "UpdateWhenDistanceCulled", FloatUtil.ToString(UpdateWhenDistanceCulled));
YptXml.ValueTag(sb, indent, "EmitWhenDistanceCulled", FloatUtil.ToString(EmitWhenDistanceCulled));
YftXml.SelfClosingTag(sb, indent, "ViewportCullingSphereOffset " + FloatUtil.GetVector3XmlString(ViewportCullingSphereOffset));
YptXml.ValueTag(sb, indent, "DistanceCullingFadeDist", FloatUtil.ToString(DistanceCullingFadeDist));
YptXml.ValueTag(sb, indent, "DistanceCullingCullDist", FloatUtil.ToString(DistanceCullingCullDist));
YptXml.ValueTag(sb, indent, "LodEvoDistMin", FloatUtil.ToString(LodEvoDistMin));
YptXml.ValueTag(sb, indent, "LodEvoDistMax", FloatUtil.ToString(LodEvoDistMax));
YptXml.ValueTag(sb, indent, "ColnRange", FloatUtil.ToString(ColnRange));
YptXml.ValueTag(sb, indent, "ColnProbeDist", FloatUtil.ToString(ColnProbeDist));
YptXml.ValueTag(sb, indent, "ColnType", FloatUtil.ToString(ColnType));
YptXml.ValueTag(sb, indent, "ShareEntityColn", FloatUtil.ToString(ShareEntityColn));
YptXml.ValueTag(sb, indent, "OnlyUseBVHColn", FloatUtil.ToString(OnlyUseBVHColn));
YptXml.ValueTag(sb, indent, "GameFlags", FloatUtil.ToString(GameFlags));
YptXml.ValueTag(sb, indent, "Unknown3A0", YptXml.UintString(Unknown_3A0h)); YptXml.ValueTag(sb, indent, "Unknown3A0", YptXml.UintString(Unknown_3A0h));
if (EventEmitters?.data_items != null) if (EventEmitters?.data_items != null)
{ {
@ -2614,25 +2660,38 @@ namespace CodeWalker.GameFiles
NameHash = JenkHash.GenHash(Name?.Value ?? ""); NameHash = JenkHash.GenHash(Name?.Value ?? "");
Unknown_50h = Xml.GetChildUIntAttribute(node, "Unknown50"); Unknown_50h = Xml.GetChildUIntAttribute(node, "Unknown50");
Unknown_54h = Xml.GetChildUIntAttribute(node, "Unknown54"); Unknown_54h = Xml.GetChildUIntAttribute(node, "Unknown54");
Unknown_70h = Xml.GetChildFloatAttribute(node, "Unknown70"); NumLoops = (int)Xml.GetChildUIntAttribute(node, "NumLoops");
Unknown_74h = Xml.GetChildFloatAttribute(node, "Unknown74"); SortEventsByDistance = (byte)Xml.GetChildFloatAttribute(node, "SortEventsByDistance");
PlaybackDelay = Xml.GetChildFloatAttribute(node, "PlaybackDelay"); DrawListId = (byte)Xml.GetChildFloatAttribute(node, "DrawListId");
PlaybackDelayModifier = Xml.GetChildFloatAttribute(node, "PlaybackDelayModifier"); IsShortLived = (byte)Xml.GetChildFloatAttribute(node, "IsShortLived");
PlaybackSpeedScale = Xml.GetChildFloatAttribute(node, "PlaybackSpeedScale"); HasNoShadows = (byte)Xml.GetChildFloatAttribute(node, "HasNoShadows");
PlaybackSpeedScaleModifier = Xml.GetChildFloatAttribute(node, "PlaybackSpeedScaleModifier"); VRandOffsetPos = Xml.GetChildVector3Attributes(node, "VRandOffsetPos");
Unknown_88h = Xml.GetChildUIntAttribute(node, "Unknown88"); PreUpdateTime = Xml.GetChildFloatAttribute(node, "PreUpdateTime");
Unknown_8Ch = Xml.GetChildUIntAttribute(node, "Unknown8C"); PreUpdateTimeInterval = Xml.GetChildFloatAttribute(node, "PreUpdateTimeInterval");
CullRadius = Xml.GetChildFloatAttribute(node, "CullRadius"); DurationMin = Xml.GetChildFloatAttribute(node, "DurationMin");
CullDistance = Xml.GetChildFloatAttribute(node, "CullDistance"); DurationMax = Xml.GetChildFloatAttribute(node, "DurationMax");
Unknown_98h = Xml.GetChildFloatAttribute(node, "Unknown98"); PlaybackRateScalarMin = Xml.GetChildFloatAttribute(node, "PlaybackRateScalarMin");
Unknown_A0h = Xml.GetChildFloatAttribute(node, "UnknownA0"); PlaybackRateScalarMax = Xml.GetChildFloatAttribute(node, "PlaybackRateScalarMax");
Unknown_A4h = Xml.GetChildFloatAttribute(node, "UnknownA4"); ViewportCullingMode = (byte)Xml.GetChildFloatAttribute(node, "ViewportCullingMode");
Unknown_A8h = Xml.GetChildFloatAttribute(node, "UnknownA8"); RenderWhenViewportCulled = (byte)Xml.GetChildFloatAttribute(node, "RenderWhenViewportCulled");
Unknown_ACh = Xml.GetChildFloatAttribute(node, "UnknownAC"); UpdateWhenViewportCulled = (byte)Xml.GetChildFloatAttribute(node, "UpdateWhenViewportCulled");
Unknown_B0h = Xml.GetChildFloatAttribute(node, "UnknownB0"); EmitWhenViewportCulled = (byte)Xml.GetChildFloatAttribute(node, "EmitWhenViewportCulled");
Unknown_B4h = Xml.GetChildFloatAttribute(node, "UnknownB4"); DistanceCullingMode = (byte)Xml.GetChildFloatAttribute(node, "DistanceCullingMode");
Unknown_B8h = Xml.GetChildFloatAttribute(node, "UnknownB8"); RenderWhenDistanceCulled = (byte)Xml.GetChildFloatAttribute(node, "RenderWhenDistanceCulled");
Unknown_BCh = Xml.GetChildUIntAttribute(node, "UnknownBC"); UpdateWhenDistanceCulled = (byte)Xml.GetChildFloatAttribute(node, "UpdateWhenDistanceCulled");
EmitWhenDistanceCulled = (byte)Xml.GetChildFloatAttribute(node, "EmitWhenDistanceCulled");
ViewportCullingSphereOffset = Xml.GetChildVector3Attributes(node, "ViewportCullingSphereOffset");
ViewportCullingSphereRadius = Xml.GetChildFloatAttribute(node, "ViewportCullingSphereRadius");
DistanceCullingFadeDist = Xml.GetChildFloatAttribute(node, "DistanceCullingFadeDist");
DistanceCullingCullDist = Xml.GetChildFloatAttribute(node, "DistanceCullingCullDist");
LodEvoDistMin = Xml.GetChildFloatAttribute(node, "LodEvoDistMin");
LodEvoDistMax = Xml.GetChildFloatAttribute(node, "LodEvoDistMax");
ColnRange = Xml.GetChildFloatAttribute(node, "ColnRange");
ColnProbeDist = Xml.GetChildFloatAttribute(node, "ColnProbeDist");
ColnType = (byte)Xml.GetChildFloatAttribute(node, "ColnType");
ShareEntityColn = (byte)Xml.GetChildFloatAttribute(node, "ShareEntityColn");
OnlyUseBVHColn = (byte)Xml.GetChildFloatAttribute(node, "OnlyUseBVHColn");
GameFlags = (byte)Xml.GetChildFloatAttribute(node, "GameFlags");
Unknown_3A0h = Xml.GetChildUIntAttribute(node, "Unknown3A0"); Unknown_3A0h = Xml.GetChildUIntAttribute(node, "Unknown3A0");
var emlist = XmlMeta.ReadItemArray<ParticleEventEmitter>(node, "EventEmitters")?.ToList() ?? new List<ParticleEventEmitter>(); var emlist = XmlMeta.ReadItemArray<ParticleEventEmitter>(node, "EventEmitters")?.ToList() ?? new List<ParticleEventEmitter>();
@ -2650,11 +2709,11 @@ namespace CodeWalker.GameFiles
var kflist = XmlMeta.ReadItemArray<ParticleKeyframeProp>(node, "KeyframeProperties")?.ToList() ?? new List<ParticleKeyframeProp>(); var kflist = XmlMeta.ReadItemArray<ParticleKeyframeProp>(node, "KeyframeProperties")?.ToList() ?? new List<ParticleKeyframeProp>();
KeyframeProp0 = (kflist.Count > 0) ? kflist[0] : new ParticleKeyframeProp(); ColourTintMinKFP = (kflist.Count > 0) ? kflist[0] : new ParticleKeyframeProp();
KeyframeProp1 = (kflist.Count > 1) ? kflist[1] : new ParticleKeyframeProp(); ColourTintMaxKFP = (kflist.Count > 1) ? kflist[1] : new ParticleKeyframeProp();
KeyframeProp2 = (kflist.Count > 2) ? kflist[2] : new ParticleKeyframeProp(); ZoomScalarKFP = (kflist.Count > 2) ? kflist[2] : new ParticleKeyframeProp();
KeyframeProp3 = (kflist.Count > 3) ? kflist[3] : new ParticleKeyframeProp(); DataSphereKFP = (kflist.Count > 3) ? kflist[3] : new ParticleKeyframeProp();
KeyframeProp4 = (kflist.Count > 4) ? kflist[4] : new ParticleKeyframeProp(); DataCapsuleKFP = (kflist.Count > 4) ? kflist[4] : new ParticleKeyframeProp();
for (int i = kflist.Count; i < 16; i++) kflist.Add(null); for (int i = kflist.Count; i < 16; i++) kflist.Add(null);
KeyframeProps = new ResourcePointerArray64<ParticleKeyframeProp>(); KeyframeProps = new ResourcePointerArray64<ParticleKeyframeProp>();
KeyframeProps.data_items = kflist.ToArray(); KeyframeProps.data_items = kflist.ToArray();
@ -2688,11 +2747,11 @@ namespace CodeWalker.GameFiles
public override Tuple<long, IResourceBlock>[] GetParts() public override Tuple<long, IResourceBlock>[] GetParts()
{ {
return new Tuple<long, IResourceBlock>[] { return new Tuple<long, IResourceBlock>[] {
new Tuple<long, IResourceBlock>(192, KeyframeProp0), new Tuple<long, IResourceBlock>(192, ColourTintMinKFP),
new Tuple<long, IResourceBlock>(336, KeyframeProp1), new Tuple<long, IResourceBlock>(336, ColourTintMaxKFP),
new Tuple<long, IResourceBlock>(480, KeyframeProp2), new Tuple<long, IResourceBlock>(480, ZoomScalarKFP),
new Tuple<long, IResourceBlock>(624, KeyframeProp3), new Tuple<long, IResourceBlock>(624, DataSphereKFP),
new Tuple<long, IResourceBlock>(768, KeyframeProp4) new Tuple<long, IResourceBlock>(768, DataCapsuleKFP)
}; };
} }
@ -2723,12 +2782,12 @@ namespace CodeWalker.GameFiles
public ulong ParticleRuleNamePointer { get; set; } public ulong ParticleRuleNamePointer { get; set; }
public ulong EmitterRulePointer { get; set; } public ulong EmitterRulePointer { get; set; }
public ulong ParticleRulePointer { get; set; } public ulong ParticleRulePointer { get; set; }
public float MoveSpeedScale { get; set; } public float PlaybackRateScalarMin { get; set; }
public float MoveSpeedScaleModifier { get; set; } public float PlaybackRateScalarMax { get; set; }
public float ParticleScale { get; set; } public float ZoomScalarMin { get; set; }
public float ParticleScaleModifier { get; set; } public float ZoomScalarMax { get; set; }
public uint Colour1 { get; set; } // eg. 0xfffafafa - colour? public uint ColourTintMin { get; set; } // eg. 0xfffafafa - colour?
public uint Colour2 { get; set; } // eg. 0x5affffff - colour? public uint ColourTintMax { get; set; } // eg. 0x5affffff - colour?
public ulong Unknown_68h; // 0x0000000000000000 public ulong Unknown_68h; // 0x0000000000000000
// reference data // reference data
@ -2755,12 +2814,12 @@ namespace CodeWalker.GameFiles
this.ParticleRuleNamePointer = reader.ReadUInt64(); this.ParticleRuleNamePointer = reader.ReadUInt64();
this.EmitterRulePointer = reader.ReadUInt64(); this.EmitterRulePointer = reader.ReadUInt64();
this.ParticleRulePointer = reader.ReadUInt64(); this.ParticleRulePointer = reader.ReadUInt64();
this.MoveSpeedScale = reader.ReadSingle(); this.PlaybackRateScalarMin = reader.ReadSingle();
this.MoveSpeedScaleModifier = reader.ReadSingle(); this.PlaybackRateScalarMax = reader.ReadSingle();
this.ParticleScale = reader.ReadSingle(); this.ZoomScalarMin = reader.ReadSingle();
this.ParticleScaleModifier = reader.ReadSingle(); this.ZoomScalarMax = reader.ReadSingle();
this.Colour1 = reader.ReadUInt32(); this.ColourTintMin = reader.ReadUInt32();
this.Colour2 = reader.ReadUInt32(); this.ColourTintMax = reader.ReadUInt32();
this.Unknown_68h = reader.ReadUInt64(); this.Unknown_68h = reader.ReadUInt64();
// read reference data // read reference data
@ -2828,7 +2887,7 @@ namespace CodeWalker.GameFiles
//{ }//no hit //{ }//no hit
//if (Unknown_28h != 0) //if (Unknown_28h != 0)
//{ }//no hit //{ }//no hit
switch (MoveSpeedScale) switch (PlaybackRateScalarMin)
{ {
case 1.0f: case 1.0f:
case 2.0f: case 2.0f:
@ -2838,7 +2897,7 @@ namespace CodeWalker.GameFiles
default: default:
break;//more break;//more
} }
switch (MoveSpeedScaleModifier) switch (PlaybackRateScalarMax)
{ {
case 1.0f: case 1.0f:
case 2.0f: case 2.0f:
@ -2848,7 +2907,7 @@ namespace CodeWalker.GameFiles
default: default:
break;//and more break;//and more
} }
switch (ParticleScale) switch (ZoomScalarMin)
{ {
case 1.0f: case 1.0f:
case 0.5f: case 0.5f:
@ -2859,7 +2918,7 @@ namespace CodeWalker.GameFiles
default: default:
break;//more break;//more
} }
switch (ParticleScaleModifier) switch (ZoomScalarMax)
{ {
case 1.0f: case 1.0f:
case 1.2f: case 1.2f:
@ -2869,7 +2928,7 @@ namespace CodeWalker.GameFiles
default: default:
break;//more break;//more
} }
switch (Colour1) switch (ColourTintMin)
{ {
case 0xffffffff: case 0xffffffff:
case 0xfffafafa: case 0xfffafafa:
@ -2883,7 +2942,7 @@ namespace CodeWalker.GameFiles
default: default:
break;//more break;//more
} }
switch (Colour2) switch (ColourTintMax)
{ {
case 0xffffffff: case 0xffffffff:
case 0xffffefc2: case 0xffffefc2:
@ -2928,26 +2987,24 @@ namespace CodeWalker.GameFiles
writer.Write(this.ParticleRuleNamePointer); writer.Write(this.ParticleRuleNamePointer);
writer.Write(this.EmitterRulePointer); writer.Write(this.EmitterRulePointer);
writer.Write(this.ParticleRulePointer); writer.Write(this.ParticleRulePointer);
writer.Write(this.MoveSpeedScale); writer.Write(this.PlaybackRateScalarMin);
writer.Write(this.MoveSpeedScaleModifier); writer.Write(this.PlaybackRateScalarMax);
writer.Write(this.ParticleScale); writer.Write(this.ZoomScalarMin);
writer.Write(this.ParticleScaleModifier); writer.Write(this.ZoomScalarMax);
writer.Write(this.Colour1); writer.Write(this.ColourTintMin);
writer.Write(this.Colour2); writer.Write(this.ColourTintMax);
writer.Write(this.Unknown_68h); writer.Write(this.Unknown_68h);
} }
public void WriteXml(StringBuilder sb, int indent) public void WriteXml(StringBuilder sb, int indent)
{ {
YptXml.StringTag(sb, indent, "EmitterRule", YptXml.XmlEscape(EmitterRuleName?.Value ?? "")); YptXml.StringTag(sb, indent, "EmitterRule", YptXml.XmlEscape(EmitterRuleName?.Value ?? ""));
YptXml.StringTag(sb, indent, "ParticleRule", YptXml.XmlEscape(ParticleRuleName?.Value ?? "")); YptXml.StringTag(sb, indent, "ParticleRule", YptXml.XmlEscape(ParticleRuleName?.Value ?? ""));
YptXml.ValueTag(sb, indent, "Unknown10", FloatUtil.ToString(Unknown_10h)); YptXml.ValueTag(sb, indent, "PlaybackRateScalarMin", FloatUtil.ToString(PlaybackRateScalarMin));
YptXml.ValueTag(sb, indent, "Unknown14", FloatUtil.ToString(Unknown_14h)); YptXml.ValueTag(sb, indent, "PlaybackRateScalarMax", FloatUtil.ToString(PlaybackRateScalarMax));
YptXml.ValueTag(sb, indent, "MoveSpeedScale", FloatUtil.ToString(MoveSpeedScale)); YptXml.ValueTag(sb, indent, "ZoomScalarMin", FloatUtil.ToString(ZoomScalarMin));
YptXml.ValueTag(sb, indent, "MoveSpeedScaleModifier", FloatUtil.ToString(MoveSpeedScaleModifier)); YptXml.ValueTag(sb, indent, "ZoomScalarMax", FloatUtil.ToString(ZoomScalarMax));
YptXml.ValueTag(sb, indent, "ParticleScale", FloatUtil.ToString(ParticleScale)); YptXml.ValueTag(sb, indent, "ColourTintMin", YptXml.UintString(ColourTintMin));
YptXml.ValueTag(sb, indent, "ParticleScaleModifier", FloatUtil.ToString(ParticleScaleModifier)); YptXml.ValueTag(sb, indent, "ColourTintMax", YptXml.UintString(ColourTintMax));
YptXml.ValueTag(sb, indent, "Colour1", YptXml.UintString(Colour1));
YptXml.ValueTag(sb, indent, "Colour2", YptXml.UintString(Colour2));
if (UnknownData != null) if (UnknownData != null)
{ {
YptXml.OpenTag(sb, indent, "UnknownData"); YptXml.OpenTag(sb, indent, "UnknownData");
@ -2959,14 +3016,12 @@ namespace CodeWalker.GameFiles
{ {
EmitterRuleName = (string_r)Xml.GetChildInnerText(node, "EmitterRule"); if (EmitterRuleName.Value == null) EmitterRuleName = null; EmitterRuleName = (string_r)Xml.GetChildInnerText(node, "EmitterRule"); if (EmitterRuleName.Value == null) EmitterRuleName = null;
ParticleRuleName = (string_r)Xml.GetChildInnerText(node, "ParticleRule"); if (ParticleRuleName.Value == null) ParticleRuleName = null; ParticleRuleName = (string_r)Xml.GetChildInnerText(node, "ParticleRule"); if (ParticleRuleName.Value == null) ParticleRuleName = null;
Unknown_10h = Xml.GetChildFloatAttribute(node, "Unknown10"); PlaybackRateScalarMin = Xml.GetChildFloatAttribute(node, "PlaybackRateScalarMin");
Unknown_14h = Xml.GetChildFloatAttribute(node, "Unknown14"); PlaybackRateScalarMax = Xml.GetChildFloatAttribute(node, "PlaybackRateScalarMax");
MoveSpeedScale = Xml.GetChildFloatAttribute(node, "MoveSpeedScale"); ZoomScalarMin = Xml.GetChildFloatAttribute(node, "ZoomScalarMin");
MoveSpeedScaleModifier = Xml.GetChildFloatAttribute(node, "MoveSpeedScaleModifier"); ZoomScalarMax = Xml.GetChildFloatAttribute(node, "ZoomScalarMax");
ParticleScale = Xml.GetChildFloatAttribute(node, "ParticleScale"); ColourTintMin = Xml.GetChildUIntAttribute(node, "ColourTintMin");
ParticleScaleModifier = Xml.GetChildFloatAttribute(node, "ParticleScaleModifier"); ColourTintMax = Xml.GetChildUIntAttribute(node, "ColourTintMax");
Colour1 = Xml.GetChildUIntAttribute(node, "Colour1");
Colour2 = Xml.GetChildUIntAttribute(node, "Colour2");
var udnode = node.SelectSingleNode("UnknownData"); var udnode = node.SelectSingleNode("UnknownData");
if (udnode != null) if (udnode != null)
{ {
@ -3451,7 +3506,7 @@ namespace CodeWalker.GameFiles
public ushort KeyframePropsCount1 = 10; // 10 public ushort KeyframePropsCount1 = 10; // 10
public ushort KeyframePropsCount2 = 10; // 10 public ushort KeyframePropsCount2 = 10; // 10
public uint Unknown_624h; // 0x00000000 public uint Unknown_624h; // 0x00000000
public uint Unknown_628h { get; set; } // 0, 1 public uint IsOneShot { get; set; } // 0, 1
public uint Unknown_62Ch; // 0x00000000 public uint Unknown_62Ch; // 0x00000000
// reference data // reference data
@ -3491,7 +3546,7 @@ namespace CodeWalker.GameFiles
this.KeyframePropsCount1 = reader.ReadUInt16(); this.KeyframePropsCount1 = reader.ReadUInt16();
this.KeyframePropsCount2 = reader.ReadUInt16(); this.KeyframePropsCount2 = reader.ReadUInt16();
this.Unknown_624h = reader.ReadUInt32(); this.Unknown_624h = reader.ReadUInt32();
this.Unknown_628h = reader.ReadUInt32(); this.IsOneShot = reader.ReadUInt32();
this.Unknown_62Ch = reader.ReadUInt32(); this.Unknown_62Ch = reader.ReadUInt32();
// read reference data // read reference data
@ -3622,14 +3677,14 @@ namespace CodeWalker.GameFiles
writer.Write(this.KeyframePropsCount1); writer.Write(this.KeyframePropsCount1);
writer.Write(this.KeyframePropsCount2); writer.Write(this.KeyframePropsCount2);
writer.Write(this.Unknown_624h); writer.Write(this.Unknown_624h);
writer.Write(this.Unknown_628h); writer.Write(this.IsOneShot);
writer.Write(this.Unknown_62Ch); writer.Write(this.Unknown_62Ch);
} }
public void WriteXml(StringBuilder sb, int indent) public void WriteXml(StringBuilder sb, int indent)
{ {
YptXml.StringTag(sb, indent, "Name", YptXml.XmlEscape(Name?.Value ?? "")); YptXml.StringTag(sb, indent, "Name", YptXml.XmlEscape(Name?.Value ?? ""));
YptXml.ValueTag(sb, indent, "Unknown10", Unknown_10h.ToString()); YptXml.ValueTag(sb, indent, "Unknown10", Unknown_10h.ToString());
YptXml.ValueTag(sb, indent, "Unknown628", Unknown_628h.ToString()); YptXml.ValueTag(sb, indent, "IsOneShot", IsOneShot.ToString());
ParticleDomain.WriteXmlNode(Domain1, sb, indent, "Domain1"); ParticleDomain.WriteXmlNode(Domain1, sb, indent, "Domain1");
ParticleDomain.WriteXmlNode(Domain2, sb, indent, "Domain2"); ParticleDomain.WriteXmlNode(Domain2, sb, indent, "Domain2");
ParticleDomain.WriteXmlNode(Domain3, sb, indent, "Domain3"); ParticleDomain.WriteXmlNode(Domain3, sb, indent, "Domain3");
@ -3643,7 +3698,7 @@ namespace CodeWalker.GameFiles
Name = (string_r)Xml.GetChildInnerText(node, "Name"); if (Name.Value == null) Name = null; Name = (string_r)Xml.GetChildInnerText(node, "Name"); if (Name.Value == null) Name = null;
NameHash = JenkHash.GenHash(Name?.Value ?? ""); NameHash = JenkHash.GenHash(Name?.Value ?? "");
Unknown_10h = Xml.GetChildUIntAttribute(node, "Unknown10"); Unknown_10h = Xml.GetChildUIntAttribute(node, "Unknown10");
Unknown_628h = Xml.GetChildUIntAttribute(node, "Unknown628"); IsOneShot = Xml.GetChildUIntAttribute(node, "IsOneShot");
Domain1 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain1")); if (Domain1 != null) Domain1.Index = 0; Domain1 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain1")); if (Domain1 != null) Domain1.Index = 0;
Domain2 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain2")); if (Domain2 != null) Domain2.Index = 1; Domain2 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain2")); if (Domain2 != null) Domain2.Index = 1;
Domain3 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain3")); if (Domain3 != null) Domain3.Index = 2; Domain3 = ParticleDomain.ReadXmlNode(node.SelectSingleNode("Domain3")); if (Domain3 != null) Domain3.Index = 2;