diff --git a/UndertaleModLib/Models/UndertaleAnimationCurve.cs b/UndertaleModLib/Models/UndertaleAnimationCurve.cs
index 35ee81f81..2d46db1cb 100644
--- a/UndertaleModLib/Models/UndertaleAnimationCurve.cs
+++ b/UndertaleModLib/Models/UndertaleAnimationCurve.cs
@@ -3,14 +3,23 @@
namespace UndertaleModLib.Models;
///
-/// An animation curve entry in a data file.
+/// An animation curve entry in a data file. These were introduced in GameMaker 2.3.0
///
[PropertyChanged.AddINotifyPropertyChangedInterface]
public class UndertaleAnimationCurve : UndertaleNamedResource, IDisposable
{
+ ///
+ /// TODO: unknown
+ ///
public enum GraphTypeEnum : uint
{
+ ///
+ /// Unknown
+ ///
Unknown0 = 0,
+ ///
+ /// Unknown
+ ///
Unknown1 = 1
}
@@ -23,8 +32,10 @@ public enum GraphTypeEnum : uint
/// The graph type of this animation curve.
///
public GraphTypeEnum GraphType { get; set; }
-
-
+
+ ///
+ /// The channels this animation curve has.
+ ///
public UndertaleSimpleList Channels { get; set; }
///
@@ -99,30 +110,56 @@ public void Dispose()
{
foreach (Channel channel in Channels)
channel?.Dispose();
- }
+ }
Name = null;
Channels = null;
}
-
+
+ ///
+ /// A channel in an animation curve.
+ ///
[PropertyChanged.AddINotifyPropertyChangedInterface]
- public class Channel : UndertaleObject, IDisposable
+ public class Channel : UndertaleNamedResource, IDisposable
{
- public enum FunctionType : uint
+ ///
+ /// The curve type determines how points flow to each other in a channel.
+ ///
+ public enum CurveType : uint
{
+ ///
+ /// Creates a linear progression between points.
+ ///
Linear = 0,
+ ///
+ /// Creates a smooth progression between points using catmull-rom interpolation.
+ ///
Smooth = 1
+ // TODO: What about bezier?
}
+ ///
public UndertaleString Name { get; set; }
- public FunctionType Function { get; set; }
+
+ ///
+ /// The curve type this channel uses.
+ ///
+ public CurveType Curve { get; set; }
+
+ ///
+ /// TODO: document this
+ ///
public uint Iterations { get; set; }
+
+ ///
+ /// The points
+ ///
public UndertaleSimpleList Points { get; set; }
///
public void Serialize(UndertaleWriter writer)
{
writer.WriteUndertaleString(Name);
- writer.Write((uint)Function);
+ writer.Write((uint)Curve);
writer.Write(Iterations);
Points.Serialize(writer);
}
@@ -131,7 +168,7 @@ public void Serialize(UndertaleWriter writer)
public void Unserialize(UndertaleReader reader)
{
Name = reader.ReadUndertaleString();
- Function = (FunctionType)reader.ReadUInt32();
+ Curve = (CurveType)reader.ReadUInt32();
Iterations = reader.ReadUInt32();
Points = reader.ReadUndertaleObject>();
}
@@ -160,14 +197,39 @@ public void Dispose()
Points = null;
}
+ ///
+ /// A point which can exist on a .
+ ///
public class Point : UndertaleObject
{
+ ///
+ /// The X coordinate of this point. GameMaker abbreviates this to "h".
+ ///
public float X;
+
+ ///
+ /// The Y coordinate of this point. GameMaker abbreviates this to "v".
+ ///
public float Value;
- public float BezierX0; // Bezier only
+ ///
+ /// The Y position for the first bezier handle. Only used if the Channel is set to Bezier.
+ ///
+ public float BezierX0;
+
+ ///
+ /// The Y position for the first bezier handle. Only used if the Channel is set to Bezier.
+ ///
public float BezierY0;
+
+ ///
+ /// The X position for the second bezier handle. Only used if the Channel is set to Bezier.
+ ///
public float BezierX1;
+
+ ///
+ /// The Y position for the second bezier handle. Only used if the Channel is set to Bezier.
+ ///
public float BezierY1;
///
diff --git a/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs b/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs
index bb893c27e..2f32ca83c 100644
--- a/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs
+++ b/UndertaleModLib/Models/UndertaleEmbeddedTexture.cs
@@ -353,6 +353,10 @@ public int Height
///
public event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// Invoked whenever the effective value of any dependency property has been updated.
+ ///
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
diff --git a/UndertaleModLib/Models/UndertaleExtension.cs b/UndertaleModLib/Models/UndertaleExtension.cs
index c944d4ed8..aa85bb50d 100644
--- a/UndertaleModLib/Models/UndertaleExtension.cs
+++ b/UndertaleModLib/Models/UndertaleExtension.cs
@@ -108,12 +108,20 @@ public class UndertaleExtensionFunction : UndertaleObject, IDisposable
/// An identification number of the function.
///
public uint ID { get; set; }
+
+ ///
+ /// TODO: is this kind the same as extension kind?
+ ///
public uint Kind { get; set; }
///
/// The return type of the function.
///
public UndertaleExtensionVarType RetType { get; set; }
+
+ ///
+ /// TODO: The extension of the filename this function belongs to?
+ ///
public UndertaleString ExtName { get; set; }
///
@@ -168,13 +176,35 @@ public void Dispose()
}
}
+///
+/// A file that's used in an .
+///
[PropertyChanged.AddINotifyPropertyChangedInterface]
public class UndertaleExtensionFile : UndertaleObject, IDisposable
{
+ ///
+ /// The filename of this extension file.
+ ///
public UndertaleString Filename { get; set; }
+
+ ///
+ /// The script name that gets called when the game ends.
+ ///
public UndertaleString CleanupScript { get; set; }
+
+ ///
+ /// The script name that gets called when the game starts.
+ ///
public UndertaleString InitScript { get; set; }
+
+ ///
+ /// The type of extension this belongs to.
+ ///
public UndertaleExtensionKind Kind { get; set; }
+
+ ///
+ /// The functions this file has defined.
+ ///
public UndertalePointerList Functions { get; set; } = new UndertalePointerList();
///
@@ -231,7 +261,7 @@ public void Dispose()
{
foreach (UndertaleExtensionFunction func in Functions)
func?.Dispose();
- }
+ }
Filename = null;
CleanupScript = null;
InitScript = null;
@@ -239,22 +269,45 @@ public void Dispose()
}
}
-
+///
+/// An option that's used in an .
+///
[PropertyChanged.AddINotifyPropertyChangedInterface]
-public class UndertaleExtensionOption : UndertaleObject, IStaticChildObjectsSize, IDisposable
+public class UndertaleExtensionOption : UndertaleNamedResource, IStaticChildObjectsSize, IDisposable
{
///
public static readonly uint ChildObjectsSize = 12;
+ ///
+ /// The type of what the option value is.
+ ///
public enum OptionKind : uint
{
+ ///
+ /// The option value is a boolean-
+ ///
Boolean = 0,
+ ///
+ /// The option value is a number.
+ ///
Number = 1,
+ ///
+ /// The option value is a string.
+ ///
String = 2
}
+ ///
public UndertaleString Name { get; set; }
+
+ ///
+ /// The value of this option.
+ ///
public UndertaleString Value { get; set; }
+
+ ///
+ /// The type of this option.
+ ///
public OptionKind Kind { get; set; } = OptionKind.String;
///
@@ -306,10 +359,25 @@ public class UndertaleExtension : UndertaleNamedResource, IDisposable
/// The name of the extension.
///
public UndertaleString Name { get; set; }
+
+ ///
+ /// TODO: unknown?
+ ///
public UndertaleString ClassName { get; set; }
+
+ ///
+ /// The version of the extension.
+ ///
public UndertaleString Version { get; set; }
+ ///
+ /// The files that this extension contains.
+ ///
public UndertalePointerList Files { get; set; } = new UndertalePointerList();
+
+ ///
+ /// The options that this extension contains.
+ ///
public UndertalePointerList Options { get; set; } = new UndertalePointerList();
///
diff --git a/UndertaleModLib/Models/UndertaleFeatureFlags.cs b/UndertaleModLib/Models/UndertaleFeatureFlags.cs
index 533eb87aa..4e7e6d0ae 100644
--- a/UndertaleModLib/Models/UndertaleFeatureFlags.cs
+++ b/UndertaleModLib/Models/UndertaleFeatureFlags.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections;
-using System.Collections.Generic;
namespace UndertaleModLib.Models;
@@ -10,6 +8,9 @@ namespace UndertaleModLib.Models;
[PropertyChanged.AddINotifyPropertyChangedInterface]
public class UndertaleFeatureFlags : UndertaleObject, IDisposable
{
+ ///
+ /// The list of feature flags.
+ ///
public UndertaleSimpleListString List { get; set; }
diff --git a/UndertaleModLib/Models/UndertaleGameObject.cs b/UndertaleModLib/Models/UndertaleGameObject.cs
index 65ee498fa..2e93cfa2a 100644
--- a/UndertaleModLib/Models/UndertaleGameObject.cs
+++ b/UndertaleModLib/Models/UndertaleGameObject.cs
@@ -150,6 +150,10 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
///
public event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// Invoked whenever the effective value of any dependency property has been updated.
+ ///
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
@@ -537,6 +541,7 @@ public class EventAction : UndertaleObject, INotifyPropertyChanged, IDisposable,
public bool IsNot { get; set; } // always 0
public uint UnknownAlwaysZero { get; set; } // always 0
+ ///
public event PropertyChangedEventHandler PropertyChanged;
///
diff --git a/UndertaleModLib/Models/UndertaleGeneralInfo.cs b/UndertaleModLib/Models/UndertaleGeneralInfo.cs
index f20302958..21b94bc6b 100644
--- a/UndertaleModLib/Models/UndertaleGeneralInfo.cs
+++ b/UndertaleModLib/Models/UndertaleGeneralInfo.cs
@@ -711,44 +711,58 @@ public enum OptionsFlags : ulong
public OptionsFlags Info { get; set; } = OptionsFlags.InterpolatePixels | OptionsFlags.UseNewAudio | OptionsFlags.ShowCursor | OptionsFlags.ScreenKey | OptionsFlags.QuitKey | OptionsFlags.SaveKey | OptionsFlags.ScreenShotKey | OptionsFlags.CloseSec | OptionsFlags.ScaleProgress | OptionsFlags.DisplayErrors | OptionsFlags.VariableErrors | OptionsFlags.CreationEventOrder;
///
- /// The window scale.
+ /// The window scale. // TODO: is this a legacy gm thing, or still used today?
///
public int Scale { get; set; } = -1;
///
- /// The window color. TODO: unused? Legacy GM remnant?
+ /// The window color. TODO: unused? Legacy GM remnant? Is this the "Color outside the room region" thing?
///
public uint WindowColor { get; set; } = 0;
///
- /// The Color depth. TODO: unused? Legacy GM remnant?
+ /// The Color depth the game uses. Used only in Game Maker 8 and earlier.
///
public uint ColorDepth { get; set; } = 0;
///
- /// The game's resolution. TODO: unused? Legacy GM remnant?
+ /// The game's resolution. Used only in Game Maker 8 and earlier.
///
public uint Resolution { get; set; } = 0;
///
- /// The game's refresh rate. TODO: unused? Legacy GM remnant?
+ /// The game's refresh rate. Used only in Game Maker 8 and earlier.
///
public uint Frequency { get; set; } = 0;
///
- /// Whether the game uses V-Sync. TODO: unused? Legacy GM remnant?
+ /// Whether the game uses V-Sync. Used only in Game Maker 8 and earlier.
///
public uint VertexSync { get; set; } = 0;
///
- /// TODO: unused? Legacy GM remnant?
+ /// The priority of the game process. The higher the number, the more priority will be given to the game. Used only in Game Maker 8 and earlier.
///
public uint Priority { get; set; } = 0;
-
- // Apparently these exist, but I can't find any examples of it. They're also only used in "old format".
+
+ ///
+ /// The background of the loading bar when loading GameMaker 8 games.
+ ///
public UndertaleSprite.TextureEntry BackImage { get; set; } = new UndertaleSprite.TextureEntry();
+
+ ///
+ /// The image of the loading bar when loading GameMaker 8 games.
+ ///
public UndertaleSprite.TextureEntry FrontImage { get; set; } = new UndertaleSprite.TextureEntry();
+
+ ///
+ /// The image that gets shown when loading GameMaker 8 games.
+ ///
public UndertaleSprite.TextureEntry LoadImage { get; set; } = new UndertaleSprite.TextureEntry();
+
+ ///
+ /// The transparency value of . 255 indicates fully opaque, 0 means fully transparent.
+ ///
public uint LoadAlpha { get; set; } = 255;
///
@@ -952,7 +966,7 @@ public void Dispose()
{
foreach (Constant constant in Constants)
constant?.Dispose();
- }
+ }
BackImage = new();
FrontImage = new();
LoadImage = new();
diff --git a/UndertaleModLib/Models/UndertaleRoom.cs b/UndertaleModLib/Models/UndertaleRoom.cs
index a1cacfd8d..8bd414477 100644
--- a/UndertaleModLib/Models/UndertaleRoom.cs
+++ b/UndertaleModLib/Models/UndertaleRoom.cs
@@ -71,12 +71,12 @@ public enum RoomEntryFlags : uint
///
/// Whether this room is persistant.
///
- public bool Persistent { get; set; } = false;
+ public bool Persistent { get; set; }
///
/// The background color of this room.
///
- public uint BackgroundColor { get; set; } = 0;
+ public uint BackgroundColor { get; set; }
///
/// Whether the display buffer should be cleared with Window Color.
@@ -172,7 +172,7 @@ public enum RoomEntryFlags : uint
/// Calls for in order to update the room background color.
/// Only used for GameMaker: Studio 2 rooms.
///
- public void UpdateBGColorLayer() => OnPropertyChanged("BGColorLayer");
+ public void UpdateBGColorLayer() => OnPropertyChanged(nameof(BGColorLayer));
///
/// Checks whether is ordered by .
@@ -222,7 +222,6 @@ public void RearrangeLayers(Tuple layerProperties = null)
for (int i = 0; i < orderedLayers.Length; i++)
{
- if (Layers[i] != orderedLayers[i])
Layers[i] = orderedLayers[i];
}
}
@@ -248,6 +247,10 @@ public Layer BGColorLayer
///
public event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// Invoked whenever the effective value of any dependency property has been updated.
+ ///
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
@@ -1649,7 +1652,7 @@ public uint TilesX
{
Array.Resize(ref _tileData[y], (int)value);
}
- OnPropertyChanged("TileData");
+ OnPropertyChanged(nameof(TileData));
}
}
}
diff --git a/UndertaleModLib/Models/UndertaleShader.cs b/UndertaleModLib/Models/UndertaleShader.cs
index 425c2c9d5..8c7ca0700 100644
--- a/UndertaleModLib/Models/UndertaleShader.cs
+++ b/UndertaleModLib/Models/UndertaleShader.cs
@@ -490,16 +490,8 @@ public class UndertaleRawShaderData : IDisposable
internal uint _PointerLocation;
internal uint _Length; // note: this is not always an accurate value, use Data.Length if necessary
public byte[] Data;
- public bool IsNull;
-
- public UndertaleRawShaderData()
- {
- _Position = 0;
- _PointerLocation = 0;
- _Length = 0;
- IsNull = true;
- }
-
+ public bool IsNull = true;
+
public void Serialize(UndertaleWriter writer, bool writeLength = true)
{
_PointerLocation = writer.Position;
diff --git a/UndertaleModLib/Models/UndertaleSound.cs b/UndertaleModLib/Models/UndertaleSound.cs
index d5cd2bf58..e45940b63 100644
--- a/UndertaleModLib/Models/UndertaleSound.cs
+++ b/UndertaleModLib/Models/UndertaleSound.cs
@@ -75,7 +75,7 @@ public enum AudioEntryFlags : uint
///
/// The pitch change of the audio entry.
///
- public float Pitch { get; set; } = 0;
+ public float Pitch { get; set; }
private UndertaleResourceById _audioGroup = new();
private UndertaleResourceById _audioFile = new();
@@ -102,6 +102,10 @@ public enum AudioEntryFlags : uint
///
public event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// Invoked whenever the effective value of any dependency property has been updated.
+ ///
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
diff --git a/UndertaleModLib/Models/UndertaleSprite.cs b/UndertaleModLib/Models/UndertaleSprite.cs
index 682f46c96..0cf7ad974 100644
--- a/UndertaleModLib/Models/UndertaleSprite.cs
+++ b/UndertaleModLib/Models/UndertaleSprite.cs
@@ -81,7 +81,7 @@ public void Dispose()
///
/// Sprite entry in the data file.
///
-public class UndertaleSprite : UndertaleNamedResource, PrePaddedObject, INotifyPropertyChanged
+public class UndertaleSprite : UndertaleNamedResource, PrePaddedObject, INotifyPropertyChanged, IDisposable
{
///
/// The name of the sprite.
@@ -155,7 +155,7 @@ public class UndertaleSprite : UndertaleNamedResource, PrePaddedObject, INotifyP
public int OriginY { get; set; }
///
- /// A wrapper that also sets accordingly.
+ /// A wrapper that also sets accordingly.
///
///
/// This attribute is used only in UndertaleModTool and doesn't exist in GameMaker.
@@ -173,7 +173,7 @@ public int OriginXWrapper
}
///
- /// A wrapper that also sets accordingly.
+ /// A wrapper that also sets accordingly.
///
///
/// This attribute is used only in UndertaleModTool and doesn't exist in GameMaker.
diff --git a/UndertaleModLib/UndertaleData.cs b/UndertaleModLib/UndertaleData.cs
index f81f8008f..b1013f55e 100644
--- a/UndertaleModLib/UndertaleData.cs
+++ b/UndertaleModLib/UndertaleData.cs
@@ -341,7 +341,7 @@ public IList this[Type resourceType]
//TODO: Why are the functions that deal with the cache in a completely different place than the cache parameters? These have *no* place of being here.
///
- /// A of cached decompiled code,
+ /// A of cached decompiled code,
/// with the code name as the Key and the decompiled code text as the value.
///
public ConcurrentDictionary GMLCache { get; set; }
diff --git a/UndertaleModLib/Util/QoiConverter.cs b/UndertaleModLib/Util/QoiConverter.cs
index ea05a5ac3..1391c24fc 100644
--- a/UndertaleModLib/Util/QoiConverter.cs
+++ b/UndertaleModLib/Util/QoiConverter.cs
@@ -63,20 +63,15 @@ public static Bitmap GetImageFromStream(Stream s)
}
///
- /// Creates a from a .
+ /// Creates a from a of s.
///
- /// The to create the PNG image from.
+ /// The of s to create the PNG image from.
/// The QOI image as a PNG.
/// If there is an invalid QOIF magic header or there was an error with stride width.
public static Bitmap GetImageFromSpan(ReadOnlySpan bytes) => GetImageFromSpan(bytes, out _);
- ///
- /// Creates a from a .
- ///
- /// The to create the PNG image from.
- /// The total amount of data read from the .
- /// The QOI image as a PNG.
- /// If there is an invalid QOIF magic header or there was an error with stride width.
+ ///
+ /// The total amount of data read from the .
public unsafe static Bitmap GetImageFromSpan(ReadOnlySpan bytes, out int length)
{
ReadOnlySpan header = bytes[..12];
@@ -195,13 +190,13 @@ public unsafe static Bitmap GetImageFromSpan(ReadOnlySpan bytes, out int l
public static byte[] GetArrayFromImage(Bitmap bmp, int padding = 4) => GetSpanFromImage(bmp, padding).ToArray();
///
- /// Creates a QOI image as a from a .
+ /// Creates a QOI image as a from a .
///
/// The to create the QOI image from.
/// The amount of bytes of padding that should be used.
/// A QOI Image as a byte array.
/// If there was an error with stride width.
- public unsafe static Span GetSpanFromImage(Bitmap bmp, int padding = 4)
+ public static unsafe Span GetSpanFromImage(Bitmap bmp, int padding = 4)
{
if (!isBufferEmpty)
Array.Clear(sharedBuffer);