Skip to content

Commit

Permalink
MPL3: Change unknown1 ushort to HalfFloat and rename to Scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Luzifix committed Sep 17, 2024
1 parent a9a5ecf commit ac6ad61
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Warcraft.NET/Files/WDT/Entries/SL/MPL3Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Warcraft.NET.Extensions;
using Warcraft.NET.Files.Structures;
using Warcraft.NET.Files.WDT.Flags;
using Warcraft.NET.Types;

namespace Warcraft.NET.Files.WDT.Entries.SL
{
Expand Down Expand Up @@ -74,9 +75,10 @@ public class MPL3Entry
public MPL3Flags Flags { get; set; } = 0;

/// <summary>
/// Unknown value, wiki mentions it is "a packed value". 14336 appears to be the most common value.
/// Scale as half float value
/// Default value is 0.5f
/// </summary>
public ushort Unknown1 { get; set; } = 14336;
public HalfFloat Scale { get; set; } = 0.5f;

public MPL3Entry() { }

Expand All @@ -102,7 +104,7 @@ public MPL3Entry(byte[] data)
MLTAIndex = br.ReadInt16();
MTEXIndex = br.ReadInt16();
Flags = (MPL3Flags)br.ReadUInt16();
Unknown1 = br.ReadUInt16();
Scale = br.ReadHalfFloat();
}
}
}
Expand Down Expand Up @@ -137,7 +139,7 @@ public byte[] Serialize(long offset = 0)
bw.Write(MLTAIndex);
bw.Write(MTEXIndex);
bw.Write((ushort)Flags);
bw.Write(Unknown1);
bw.WriteHalfFloat(Scale);

return ms.ToArray();
}
Expand Down

0 comments on commit ac6ad61

Please sign in to comment.