From d6628632dd2985cd8a95aac693992c913612bcbd Mon Sep 17 00:00:00 2001 From: Miepee Date: Fri, 20 Oct 2023 19:03:49 +0200 Subject: [PATCH] Add support for credits spoiler log --- YAMS-LIB/Program.cs | 8 +++++++- YAMS-LIB/SeedObject.cs | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/YAMS-LIB/Program.cs b/YAMS-LIB/Program.cs index f833af5..f6e3e3c 100644 --- a/YAMS-LIB/Program.cs +++ b/YAMS-LIB/Program.cs @@ -146,6 +146,9 @@ void AddAllSpritesFromDir(string dirPath) foreach (var filePath in Directory.GetFiles(dirPath)) { + string extension = new FileInfo(filePath).Extension; + if (String.IsNullOrWhiteSpace(extension) || extension == ".md" || extension == ".txt") + continue; var sprite = Image.Load(filePath); currentShelfHeight = Math.Max(currentShelfHeight, sprite.Height); if ((lastUsedX + sprite.Width) > pageDimension) @@ -770,7 +773,7 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te "d0str = get_text(\"Title-Additions\", \"GameSlot_NewGame_NormalGame\")", "d0str = \"Randovania\";"); // Add Credits - ReplaceGMLInCode(gmData.Code.ByName("gml_Object_oCreditsText_Create_0"), "/Japanese Community;;;;", "/Japanese Community;;;*AM2R Randovania Credits;;*Development;Miepee=JesRight;;*Logic Database;Miepee=JeffGainsNGames;/Esteban 'DruidVorse' Criado;;*Art;ShirtyScarab=AbyssalCreature;;/With contributions from many others;;"); + ReplaceGMLInCode(gmData.Code.ByName("gml_Object_oCreditsText_Create_0"), "/Japanese Community;;;;", "/Japanese Community;;;*AM2R Randovania Credits;;*Development;Miepee=JesRight;;*Logic Database;Miepee=JeffGainsNGames;/Esteban 'DruidVorse' Criado;;*Art;ShirtyScarab=AbyssalCreature;;/With contributions from many others;;;"); // Unlock fusion etc. by default var unlockStuffCode = gmData.Code.ByName("gml_Object_oControl_Other_2"); @@ -3527,6 +3530,9 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te // TODO: rewrite log rendering to have color + // Add spoiler log in credits when finished game normally + ReplaceGMLInCode(gmData.Code.ByName("gml_Object_oCreditsText_Create_0"), "TEXT_ROWS = ", $"if (!global.creditsmenuopt) text = \"{seedObject.CreditsSpoiler}\" + text;\n TEXT_ROWS = "); + // Multiworld stuff diff --git a/YAMS-LIB/SeedObject.cs b/YAMS-LIB/SeedObject.cs index 4a24afb..96db1f4 100644 --- a/YAMS-LIB/SeedObject.cs +++ b/YAMS-LIB/SeedObject.cs @@ -46,6 +46,10 @@ [JsonInclude] [JsonPropertyName("door_locks")] [JsonInclude] [JsonPropertyName("cosmetics")] public GameCosmetics Cosmetics; + + [JsonInclude] + [JsonPropertyName("credits_spoiler")] + public string CreditsSpoiler; } public class DoorLock