Skip to content

Commit

Permalink
Merge pull request #912 from Miepee/models
Browse files Browse the repository at this point in the history
Comment more models
  • Loading branch information
Grossley authored May 15, 2022
2 parents 6362878 + 8c65255 commit a1694a6
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 41 deletions.
8 changes: 6 additions & 2 deletions UndertaleModLib/Models/UndertaleEmbeddedTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ public class UndertaleEmbeddedTexture : UndertaleNamedResource
public uint Scaled { get; set; }

/// <summary>
/// The amount of generated mipmap levels.
/// The amount of generated mipmap levels. <br/>
/// GameMaker Studio: 2 only.
/// </summary>
public uint GeneratedMips { get; set; }


/// <summary>
/// TODO: something. <br/>
/// GameMaker: Studio 2 only.
/// </summary>
public uint TextureBlockSize { get; set; }

/// <summary>
Expand Down
10 changes: 8 additions & 2 deletions UndertaleModLib/Models/UndertaleExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@ public enum UndertaleExtensionKind : uint
/// <summary>
/// A DLL extension.
/// </summary>
DLL = 1,
Dll = 1,
/// <summary>
/// A GML extension.
/// </summary>
GML = 2,
/// <summary>
/// TODO: unknown
/// </summary>
ActionLib = 3,
/// <summary>
/// TODO: unknown
/// </summary>
Generic = 4,
/// <summary>
/// A JavaScript extension.
/// </summary>
JS = 5
Js = 5
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion UndertaleModLib/Models/UndertaleFilterEffect.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace UndertaleModLib.Models;

/// <summary>
/// A filter effect as it's used in a GameMaker data file.
/// A filter effect as it's used in a GameMaker data file. These are GameMaker: Studio 2.3.6+ only.
/// </summary>
[PropertyChanged.AddINotifyPropertyChangedInterface]
public class UndertaleFilterEffect : UndertaleNamedResource
Expand All @@ -10,6 +10,10 @@ public class UndertaleFilterEffect : UndertaleNamedResource
/// The name of the <see cref="UndertaleFilterEffect"/>.
/// </summary>
public UndertaleString Name { get; set; }

/// <summary>
/// TODO: fill this out please
/// </summary>
public UndertaleString Value { get; set; }

/// <inheritdoc />
Expand Down
25 changes: 22 additions & 3 deletions UndertaleModLib/Models/UndertaleFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class UndertaleFont : UndertaleNamedResource
public ushort RangeStart { get; set; }

/// <summary>
/// TODO: Currently unknown value.
/// TODO: Currently unknown value. Possibly related to ranges? (aka normal, ascii, digits, letters)
/// </summary>
public byte Charset { get; set; }

Expand Down Expand Up @@ -75,7 +75,7 @@ public class UndertaleFont : UndertaleNamedResource
public float ScaleY { get; set; }

/// <summary>
/// TODO: currently unknown, needs investigation.
/// TODO: currently unknown, needs investigation. GMS2022.2 specific?
/// </summary>
public uint Ascender { get; set; }

Expand Down Expand Up @@ -122,10 +122,19 @@ public class Glyph : UndertaleObject
public ushort SourceHeight { get; set; }


//TODO: From here on out is some kerning related stuff I don't know.
/// <summary>
/// TODO: something kerning related
/// </summary>
public short Shift { get; set; }

/// <summary>
/// TODO: something kerning related.
/// </summary>
public short Offset { get; set; }

/// <summary>
/// The kerning for each glyph.
/// </summary>
public UndertaleSimpleListShort<GlyphKerning> Kerning { get; set; } = new UndertaleSimpleListShort<GlyphKerning>();

/// <inheritdoc />
Expand Down Expand Up @@ -154,9 +163,19 @@ public void Unserialize(UndertaleReader reader)
Kerning = reader.ReadUndertaleObject<UndertaleSimpleListShort<GlyphKerning>>();
}

/// <summary>
/// A class representing kerning for a glyph.
/// </summary>
public class GlyphKerning : UndertaleObject
{
/// <summary>
/// TODO: unknown?
/// </summary>
public short Other;

/// <summary>
/// TODO: unknown?
/// </summary>
public short Amount;

/// <inheritdoc />
Expand Down
14 changes: 14 additions & 0 deletions UndertaleModLib/Models/UndertaleFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@

namespace UndertaleModLib.Models;

/// <summary>
/// A function entry as it's used in a GameMaker data file.
/// </summary>
[PropertyChanged.AddINotifyPropertyChangedInterface]
public class UndertaleFunction : UndertaleNamedResource, UndertaleInstruction.ReferencedObject
{
public FunctionClassification Classification { get; set; }

/// <summary>
/// The name of the <see cref="UndertaleFunction"/>.
/// </summary>
public UndertaleString Name { get; set; }

/// <summary>
/// The index of <see cref="Name"/> in <see cref="UndertaleData.Strings"/>.
/// </summary>
public int NameStringID { get; set; }

/// <summary>
/// How often this <see cref="UndertaleFunction"/> is referenced in code.
/// </summary>
public uint Occurrences { get; set; }
public UndertaleInstruction FirstAddress { get; set; }

Expand Down
23 changes: 13 additions & 10 deletions UndertaleModLib/Models/UndertaleGameObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
/// <summary>
/// Whether the game object is solid.
/// </summary>
public bool Solid { get; set; } = false;
public bool Solid { get; set; }

/// <summary>
/// The depth level of the game object.
/// </summary>
public int Depth { get; set; } = 0;
public int Depth { get; set; }

/// <summary>
/// Whether the game object is persistent.
/// </summary>
public bool Persistent { get; set; } = false;
public bool Persistent { get; set; }

/// <summary>
/// The parent game object this is inheriting from.
Expand All @@ -78,12 +78,12 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
/// <summary>
/// Whether this object uses Game Maker physics.
/// </summary>
public bool UsesPhysics { get; set; } = false;
public bool UsesPhysics { get; set; }

/// <summary>
/// Whether this game object should act as a sensor fixture.
/// </summary>
public bool IsSensor { get; set; } = false;
public bool IsSensor { get; set; }

/// <summary>
/// The collision shape the game object should use.
Expand All @@ -103,7 +103,7 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
/// <summary>
/// The physics collision group this game object belongs to.
/// </summary>
public uint Group { get; set; } = 0;
public uint Group { get; set; }

/// <summary>
/// The physics linear damping this game object uses.
Expand All @@ -123,12 +123,12 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
/// <summary>
/// Whether this game object should start awake in the physics simulation.
/// </summary>
public bool Awake { get; set; } = false;
public bool Awake { get; set; }

/// <summary>
/// Whether this game object is kinematic.
/// </summary>
public bool Kinematic { get; set; } = false;
public bool Kinematic { get; set; }

/// <summary>
/// The vertices used for a <see cref="CollisionShape"/> of type <see cref="CollisionShapeFlags.Custom"/>.
Expand All @@ -145,6 +145,9 @@ public class UndertaleGameObject : UndertaleNamedResource, INotifyPropertyChange
/// <inheritdoc />
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Initialized an instance of <see cref="UndertaleGameObject"/>.
/// </summary>
public UndertaleGameObject()
{
for (int i = 0; i < Enum.GetValues(typeof(EventType)).Length; i++)
Expand All @@ -163,7 +166,7 @@ public void Serialize(UndertaleWriter writer)
// This apparently has a different notation than everything else...
if (_ParentId.Resource == null)
{
writer.Write((int)-100);
writer.Write(-100);
}
else
{
Expand Down Expand Up @@ -372,7 +375,7 @@ public class Event : UndertaleObject
/// <remarks>This seems to always have 1 entry, it would need testing if maybe the games using drag-and-drop code are different</remarks>
public UndertalePointerList<EventAction> Actions { get; private set; } = new UndertalePointerList<EventAction>();

//TODO: not used, condense.
//TODO: not used, condense. Also UMT specific.
public EventSubtypeKey EventSubtypeKey
{
get => (EventSubtypeKey)EventSubtype;
Expand Down
Loading

0 comments on commit a1694a6

Please sign in to comment.