Skip to content

Commit

Permalink
Move 2.3.1 check to object counting stage
Browse files Browse the repository at this point in the history
  • Loading branch information
colinator27 committed Jul 10, 2024
1 parent 4e93fbc commit 31da3be
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions UndertaleModLib/Models/UndertaleAnimationCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ public void Unserialize(UndertaleReader reader)
Function = (FunctionType)reader.ReadUInt32();
Iterations = reader.ReadUInt32();

Points = reader.ReadUndertaleObject<UndertaleSimpleList<Point>>();
}

/// <inheritdoc cref="UndertaleObject.UnserializeChildObjectCount(UndertaleReader)"/>
public static uint UnserializeChildObjectCount(UndertaleReader reader)
{
reader.Position += 12;

// This check is partly duplicated from UndertaleChunks.cs, but it's necessary to handle embedded curves
// (For example, those in SEQN in the TS!Underswap v1.0 demo; see issue #1414)
if (!reader.undertaleData.IsVersionAtLeast(2, 3, 1))
Expand All @@ -158,14 +166,6 @@ public void Unserialize(UndertaleReader reader)
reader.AbsPosition = returnPosition;
}

Points = reader.ReadUndertaleObject<UndertaleSimpleList<Point>>();
}

/// <inheritdoc cref="UndertaleObject.UnserializeChildObjectCount(UndertaleReader)"/>
public static uint UnserializeChildObjectCount(UndertaleReader reader)
{
reader.Position += 12;

// "Points"
uint count = reader.ReadUInt32();
if (reader.undertaleData.IsVersionAtLeast(2, 3, 1))
Expand Down

0 comments on commit 31da3be

Please sign in to comment.