Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Celeste.Mod.mm/Mod/Meta/MapMeta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public MapMeta(BinaryPacker.Element meta) {
public string CassetteSong { get; set; }

public string PostcardSoundID { get; set; }
public string PostcardTexture { get; set; }

public string ForegroundTiles { get; set; }
public string BackgroundTiles { get; set; }
Expand Down Expand Up @@ -244,6 +245,9 @@ public void ApplyTo(patch_AreaData area) {

if (CassetteModifier != null)
meta.CassetteModifier = CassetteModifier;

if (PostcardTexture != null)
meta.PostcardTexture = PostcardTexture;
}
}

Expand Down
11 changes: 9 additions & 2 deletions Celeste.Mod.mm/Patches/LevelEnter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,17 @@ private IEnumerator ErrorRoutine(string message) {
Engine.Scene = new OverworldLoader(Overworld.StartMode.AreaQuit);
}

private IEnumerator EnterWithPostcardRoutine(string message, string soundId) {
private IEnumerator EnterWithPostcardRoutine(string message, string soundId)
=> EnterWithPostcardRoutine(message, soundId, patch_AreaData.Get(session)?.Meta?.PostcardTexture);

private IEnumerator EnterWithPostcardRoutine(string message, string soundId, string postcardTexture) {
yield return 1f;

Add(postcard = new patch_Postcard(message, soundId));
patch_Postcard localPostcard = new patch_Postcard(message, soundId);
if (postcardTexture is not null)
localPostcard.Postcard = GFX.Gui[postcardTexture];

Add(postcard = localPostcard);
yield return postcard.DisplayRoutine();

IEnumerator inner = orig_Routine();
Expand Down
14 changes: 12 additions & 2 deletions Celeste.Mod.mm/Patches/Postcard.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
using MonoMod;
using Monocle;
using MonoMod;

namespace Celeste {
class patch_Postcard : Postcard {
// make the vanilla field accessible to our patch class
private MTexture postcard;

/// <summary>
/// The texture of the postcard.
/// </summary>
public MTexture Postcard {
get => postcard;
set => postcard = value;
}

public patch_Postcard(string msg, int area)
: base(msg, area) {
Expand Down Expand Up @@ -50,6 +61,5 @@ public void ctor(string msg, string soundId) {

ctor(msg, prefix + "_in", prefix + "_out");
}

}
}
Loading