Skip to content

Commit

Permalink
Revise for audio, texture, globalinit (#1520)
Browse files Browse the repository at this point in the history
* Redo documentation for audio, texture, globalinit

* revert the one change

* SPAAAAAAAAAAAAAAAAAAAACE
  • Loading branch information
Miepee authored Jul 27, 2024
1 parent b47792f commit da9ec09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions UndertaleModLib/Models/UndertaleEmbeddedAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class UndertaleEmbeddedAudio : UndertaleNamedResource, PaddedObject, IDis
/// <summary>
/// The name of the embedded audio entry.
/// </summary>
/// <remarks>This is an UTMT only attribute. GameMaker does not store names for them.</remarks>
/// <remarks>This is a UTMT only attribute. GameMaker does not store names for them.</remarks>
public UndertaleString Name { get; set; }

/// <summary>
Expand Down Expand Up @@ -56,13 +56,13 @@ public override string ToString()
try
{
// TODO: Does only the GUI set this?
return Name.Content + " (" + GetType().Name + ")";
return $"{Name.Content} ({GetType().Name})";
}
catch
{
Name = new UndertaleString("EmbeddedSound Unknown Index");
}
return Name.Content + " (" + GetType().Name + ")";
return $"{Name.Content} ({GetType().Name})";
}

/// <inheritdoc/>
Expand Down
7 changes: 5 additions & 2 deletions UndertaleModLib/Models/UndertaleEmbeddedTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class UndertaleEmbeddedTexture : UndertaleNamedResource, IDisposable
/// <summary>
/// The name of the embedded texture entry.
/// </summary>
/// <remarks>
/// This is UTMT specific. The data file does not contain names for embedded textures.
/// </remarks>
public UndertaleString Name { get; set; }

/// <summary>
Expand Down Expand Up @@ -59,13 +62,13 @@ public TexData TextureData
/// <summary>
/// Helper variable for whether or not this texture is to be stored externally or not.
/// </summary>
public bool TextureExternal { get; set; } = false;
public bool TextureExternal { get; set; }


/// <summary>
/// Helper variable for whether or not a texture was loaded yet.
/// </summary>
public bool TextureLoaded { get; set; } = false;
public bool TextureLoaded { get; set; }

/// <summary>
/// Width of the texture. 2022.9+ only.
Expand Down
8 changes: 5 additions & 3 deletions UndertaleModLib/Models/UndertaleGlobalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ namespace UndertaleModLib.Models;
/// <summary>
/// A global initialization entry in a data file.
/// </summary>
/// <remarks>Never seen in GMS1.4 so uncertain if the structure was the same.</remarks>
/// <remarks></remarks>
// TODO: Never seen in GMS1.4 so uncertain if the structure was the same.
public class UndertaleGlobalInit : UndertaleObject, INotifyPropertyChanged, IDisposable
{
private UndertaleResourceById<UndertaleCode, UndertaleChunkCODE> _code = new();

/// <summary>
/// The <see cref="UndertaleCode"/> object which contains the code.
/// </summary>
/// <remarks>This code is executed at a global scope, before the first room of the game executes.</remarks>
public UndertaleCode Code { get => _code.Resource; set { _code.Resource = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Code))); } }

/// <inheritdoc />
Expand All @@ -29,7 +31,7 @@ public void Serialize(UndertaleWriter writer)
public void Unserialize(UndertaleReader reader)
{
_code = new UndertaleResourceById<UndertaleCode, UndertaleChunkCODE>();
_code.Unserialize(reader); // TODO: reader.ReadUndertaleObject if one object starts with another one
_code.Unserialize(reader); // Cannot use ReadUndertaleObject, as that messes things up.
}

/// <inheritdoc/>
Expand All @@ -39,4 +41,4 @@ public void Dispose()

_code.Dispose();
}
}
}

0 comments on commit da9ec09

Please sign in to comment.