diff --git a/YAMS-LIB/Program.cs b/YAMS-LIB/Program.cs index 25d912d..c9a04db 100644 --- a/YAMS-LIB/Program.cs +++ b/YAMS-LIB/Program.cs @@ -1428,6 +1428,11 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) global.curropt = 0 """); + // Add Long Beam as an item + characterVarsCode.PrependGMLInCode("global.hasLongBeam = 0;"); + gmData.Code.ByName("gml_Object_oBeam_Create_0").AppendGMLInCode("existingTimer = 12;"); + gmData.Code.ByName("gml_Object_oBeam_Step_0").PrependGMLInCode("if (existingTimer > 0) existingTimer--; if (existingTimer <= 0 && !global.hasLongBeam) instance_destroy()"); + // Add WJ as item - TODO: set this to 0 when we have sprites!!! characterVarsCode.PrependGMLInCode("global.hasWJ = 1;"); gmData.Code.ByName("gml_Script_characterStepEvent").ReplaceGMLInCode( @@ -1615,6 +1620,7 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) ds_list_add(list, global.collectedItems) ds_list_add(list, global.hasWJ) ds_list_add(list, global.hasIBJ) + ds_list_add(list, global.hasLongBeam) str_list = ds_list_write(list) ds_list_clear(list) return str_list; @@ -1679,6 +1685,9 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) global.hasIBJ = readline() if (global.hasIBJ == undefined) global.hasIBJ = 1 + global.hasLongBeam = readline() + if (global.hasLongBeam == undefined) + global.hasLongBeam = 1 ds_list_clear(list) """); gmData.Code.Add(loadGlobalsCode); @@ -1891,6 +1900,8 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) case ItemEnum.InfiniteBombJump: characterVarsCode.ReplaceGMLInCode("global.hasIBJ = 0", $"global.hasIBJ = {quantity}"); break; + case ItemEnum.LongBeam: + characterVarsCode.ReplaceGMLInCode("global.hasLongBeam = 0", $"global.hasLongBeam = {quantity}"); case ItemEnum.Nothing: break; default: @@ -2121,6 +2132,7 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) gmData.Scripts.AddScript("get_speed_booster_upgrade", "global.speedBoosterFramesReduction += argument0;"); gmData.Scripts.AddScript("get_walljump_upgrade", "global.hasWJ = 1;"); gmData.Scripts.AddScript("get_IBJ_upgrade", "global.hasIBJ = 1;"); + gmData.Scripts.AddScript("get_long_beam", "global.hasLongBeam = 1;"); // Modify every location item, to give the wished item, spawn the wished text and the wished sprite foreach ((string pickupName, PickupObject pickup) in seedObject.PickupObjects) @@ -2205,6 +2217,7 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath) ItemEnum.SpeedBoosterUpgrade => $"event_inherited(); if (active) {{ get_speed_booster_upgrade({pickup.Quantity}); }}", ItemEnum.Walljump => "event_inherited(); if (active) { get_walljump_upgrade(); }", ItemEnum.InfiniteBombJump => "event_inherited(); if (active) { get_IBJ_upgrade(); }", + ItemEnum.LongBeam => "event_inherited(); if (active) { get_long_beam(); }", ItemEnum.Nothing => "event_inherited();", _ => throw new NotSupportedException("Unsupported item! " + pickup.ItemEffect) }; diff --git a/YAMS-LIB/SeedObject.cs b/YAMS-LIB/SeedObject.cs index 8eb8900..2049625 100644 --- a/YAMS-LIB/SeedObject.cs +++ b/YAMS-LIB/SeedObject.cs @@ -532,6 +532,8 @@ public enum ItemEnum Walljump, [EnumMember(Value = "Infinite Bomb Jump")] InfiniteBombJump, + [EnumMember(Value = "Long Beam")] + LongBeam, } public class PickupObject diff --git a/YAMS-LIB/patches/Multiworld.cs b/YAMS-LIB/patches/Multiworld.cs index f31b626..a251634 100644 --- a/YAMS-LIB/patches/Multiworld.cs +++ b/YAMS-LIB/patches/Multiworld.cs @@ -462,6 +462,9 @@ public static void Apply(UndertaleData gmData, GlobalDecompileContext decompileC case "{{ItemEnum.InfiniteBombJump.GetEnumMemberValue()}}": get_IBJ_upgrade() break + case "{{ItemEnum.InfiniteBombJump.GetEnumMemberValue()}}": + get_long_beam() + break default: if (string_count("Metroid DNA", itemName) > 0) { diff --git a/YAMS-LIB/patches/Sprites.cs b/YAMS-LIB/patches/Sprites.cs index 5c683a9..e71e292 100644 --- a/YAMS-LIB/patches/Sprites.cs +++ b/YAMS-LIB/patches/Sprites.cs @@ -225,6 +225,8 @@ void CreateAndAddItemSprite(string name) Textures = GetTexturePageItemsForSpriteName("sItemSpeedBoosterUpgrade_") }); + CreateAndAddItemSprite("sItemLongBeam"); + gmData.Sprites.Add(new UndertaleSprite { // TODO: sprite is offset by a bit? Double check whether thats still the case diff --git a/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_1.png b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_1.png new file mode 100644 index 0000000..a98408a Binary files /dev/null and b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_1.png differ diff --git a/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_2.png b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_2.png new file mode 100644 index 0000000..af1603b Binary files /dev/null and b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_2.png differ diff --git a/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_3.png b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_3.png new file mode 100644 index 0000000..a98408a Binary files /dev/null and b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_3.png differ diff --git a/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_4.png b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_4.png new file mode 100644 index 0000000..6774a83 Binary files /dev/null and b/YAMS-LIB/sprites/items/longBeam/sItemLongBeam_4.png differ