Skip to content

Commit

Permalink
HPD: Automatically generate offset when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Greavesy1899 committed Jan 29, 2024
1 parent 90f9360 commit bdaeded
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Mafia2Libs/ResourceTypes/FileTypes/Navigation/HPD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void WriteToFile(BinaryWriter writer)
writer.Write(AiMeshManagement);
writer.Write(NumPODEntries);

uint CurrentOffset = 0;
for (int i = 0; i < HPDEntries.Length; i++)
{
var data = HPDEntries[i];
Expand All @@ -174,9 +175,11 @@ public void WriteToFile(BinaryWriter writer)
writer.Write(data.BBoxMax.Z);
writer.Write(data.Level);
writer.Write(data.FileSize);
writer.Write(data.FileOffset);
writer.Write(CurrentOffset);
writer.Write(data.Tag1);
writer.Write(data.Tag2);

CurrentOffset += data.FileSize;
}

StringHelpers.WriteString(writer, Unk2);
Expand Down

0 comments on commit bdaeded

Please sign in to comment.