Skip to content

Commit

Permalink
MPL3Entry: Fix color parsing and set some defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Luzifix committed Sep 9, 2024
1 parent 2cd42ba commit cd9cacc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Warcraft.NET/Files/WDT/Entries/SL/MPL3Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class MPL3Entry
/// <summary>
/// Color
/// </summary>
public uint Color { get; set; }
public RGBA Color { get; set; }

/// <summary>
/// Position
Expand All @@ -44,7 +44,7 @@ public class MPL3Entry
/// <summary>
/// Unknown/unused vector3, likely rotation from another struct but unused for point lights.
/// </summary>
public Vector3 Unused0 { get; set; }
public Vector3 Unused0 { get; set; } = new Vector3(0.0f, 0.0f, 0.0f);

/// <summary>
/// Map Tile X
Expand All @@ -71,7 +71,7 @@ public class MPL3Entry
/// <summary>
/// Flags
/// </summary>
public MPL3Flags Flags { get; set; }
public MPL3Flags Flags { get; set; } = 0;

/// <summary>
/// Unknown value, wiki mentions it is "a packed value". 14336 appears to be the most common value.
Expand All @@ -91,7 +91,7 @@ public MPL3Entry(byte[] data)
using (var br = new BinaryReader(ms))
{
Id = br.ReadUInt32();
Color = br.ReadUInt32();
Color = br.ReadBGRA();
Position = br.ReadVector3(AxisConfiguration.Native);
AttenuationStart = br.ReadSingle();
AttenuationEnd = br.ReadSingle();
Expand Down Expand Up @@ -126,7 +126,7 @@ public byte[] Serialize(long offset = 0)
using (var bw = new BinaryWriter(ms))
{
bw.Write(Id);
bw.Write(Color);
bw.WriteBGRA(Color);
bw.WriteVector3(Position, AxisConfiguration.Native);
bw.Write(AttenuationStart);
bw.Write(AttenuationEnd);
Expand Down

0 comments on commit cd9cacc

Please sign in to comment.