diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ca402fe6..d8211eb66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,7 @@ Contributions are very welcome and greatly appreciated! Make sure to join the [C - [Adding Content](#adding-content) - [Patching](#patching) - [`patch_` classes](#patch_-classes) + - [`Ext` classes](#ext-classes) - [MonoModRules](#monomodrules) - [Miscellaneous](#miscellaneous) - [Warnings](#warnings) @@ -90,6 +91,19 @@ There are a few attributes that can be applied to members of the class with diff - `[MonoModConstructor]` treat this method as a constructor - [why this is needed](https://github.com/MonoMod/MonoMod/issues/51#issuecomment-496115932). - `[MonoModReplace]` replace this method entirely, do not generate an `orig_` method. +### `Ext` classes +Code mods were previously created with Everest as a git submodule, which meant that any additions from Everest in `patch_` classes were not available to those mods at build time. + +The recommended practice has since been updated to build against a patched version of Celeste, making `Ext` classes relatively obsolete. + +In most cases, **new `patch_` members should not be added to their associated `Ext` class, and new `Ext` classes should not be created.** + +Exceptions are made when the `Ext` class contains significant additions that are not within the scope of the original class (ex: `TextMenuExt`). + +Existing `Ext` classes will also be kept in the following cases: +- An associated `patch_` class member was not made public (ex: `patch_Audio.CheckFmod`) +- Useful extension methods are defined (ex: `AreaDataExt.ToKey`) + ### MonoModRules :information_source: **The recommended practices for MonoModRules have recently been changed as described in [this PR](https://github.com/EverestAPI/Everest/pull/351).** diff --git a/Celeste.Mod.mm/Mod/Core/CoreMapDataProcessor.cs b/Celeste.Mod.mm/Mod/Core/CoreMapDataProcessor.cs index fd2143225..423bb3ceb 100644 --- a/Celeste.Mod.mm/Mod/Core/CoreMapDataProcessor.cs +++ b/Celeste.Mod.mm/Mod/Core/CoreMapDataProcessor.cs @@ -183,14 +183,14 @@ public override void Reset() { if (entity.Name == "checkpoint") { if (CheckpointsAuto != null) { MapMeta modeMeta = AreaData.GetModeMeta(AreaKey.Mode); - CheckpointData c = new CheckpointData( + patch_CheckpointData c = new patch_CheckpointData( LevelName, - (AreaData.GetSID() + "_" + LevelName).DialogKeyify(), + (AreaData.SID + "_" + LevelName).DialogKeyify(), MapMeta.GetInventory(entity.Attr("inventory")), entity.Attr("dreaming") == "" ? modeMeta.Dreaming ?? AreaData.Dreaming : entity.AttrBool("dreaming"), null ); - c.SetArea(AreaKey); + c.Area = AreaKey; if (entity.Attr("coreMode") == "") { c.CoreMode = modeMeta.CoreMode ?? AreaData.CoreMode; } else { @@ -221,8 +221,8 @@ public override void Reset() { if (ParentAreaData.CassetteCheckpointIndex < 0) ParentAreaData.CassetteCheckpointIndex = Checkpoint + (ParentMode.Checkpoints?.Length ?? 0); - MapData.SetDetectedCassette(); - ParentMapData.SetDetectedCassette(); + MapData.DetectedCassette = true; + ParentMapData.DetectedCassette = true; } }, { "entity:strawberry", entity => { @@ -281,9 +281,9 @@ public override void End() { ParentMode.Checkpoints = ParentMode.Checkpoints.Concat(CheckpointsAuto.Where(c => c != null)).ToArray(); } - MapData.SetDetectedStrawberriesIncludingUntracked(TotalStrawberriesIncludingUntracked); + MapData.DetectedStrawberriesIncludingUntracked = TotalStrawberriesIncludingUntracked; if (MapData != ParentMapData) - ParentMapData.SetDetectedStrawberriesIncludingUntracked(ParentMapData.GetDetectedStrawberriesIncludingUntracked() + TotalStrawberriesIncludingUntracked); + ParentMapData.DetectedStrawberriesIncludingUntracked = ParentMapData.DetectedStrawberriesIncludingUntracked + TotalStrawberriesIncludingUntracked; } } } diff --git a/Celeste.Mod.mm/Mod/Core/CoreModule.cs b/Celeste.Mod.mm/Mod/Core/CoreModule.cs index e75260b8c..5be7f36ac 100644 --- a/Celeste.Mod.mm/Mod/Core/CoreModule.cs +++ b/Celeste.Mod.mm/Mod/Core/CoreModule.cs @@ -121,7 +121,7 @@ public override void LoadContent(bool firstLoad) { // Check if the current input GUI override is still valid. If so, apply it. if (!string.IsNullOrEmpty(Settings.InputGui)) { string inputGuiPath = $"controls/{Settings.InputGui}/"; - if (GFX.Gui.GetTextures().Any(kvp => kvp.Key.StartsWith(inputGuiPath))) { + if (((patch_Atlas) GFX.Gui).Textures.Any(kvp => kvp.Key.StartsWith(inputGuiPath))) { Input.OverrideInputPrefix = Settings.InputGui; } else { Settings.InputGui = ""; @@ -160,10 +160,10 @@ public void CreateMainMenuButtons(OuiMainMenu menu, List buttons) { // Find the options button and place our button below it. index = buttons.FindIndex(_ => { - MainMenuSmallButton other = (_ as MainMenuSmallButton); + patch_MainMenuSmallButton other = (_ as patch_MainMenuSmallButton); if (other == null) return false; - return other.GetLabelName() == "menu_options" && other.GetIconName() == "menu/options"; + return other.LabelName == "menu_options" && other.IconName == "menu/options"; }); if (index != -1) index++; @@ -178,11 +178,11 @@ public void CreateMainMenuButtons(OuiMainMenu menu, List buttons) { })); } - public void CreatePauseMenuButtons(Level level, TextMenu menu, bool minimal) { + public void CreatePauseMenuButtons(Level level, patch_TextMenu menu, bool minimal) { if (!Settings.ShowModOptionsInGame) return; - List items = menu.GetItems(); + List items = menu.Items; int index; // Find the options button and place our button below it. @@ -215,8 +215,8 @@ public void CreatePauseMenuButtons(Level level, TextMenu menu, bool minimal) { level.Pause(returnIndex, minimal, false); // adjust the Mod Options menu position, in case it moved (pause menu entries added/removed after changing mod options). - TextMenu textMenu = level.Entities.GetToAdd().FirstOrDefault((Entity e) => e is TextMenu) as TextMenu; - TextMenu.Button modOptionsButton = textMenu?.GetItems().OfType() + patch_TextMenu textMenu = ((patch_EntityList) (object) level.Entities).ToAdd.FirstOrDefault((Entity e) => e is TextMenu) as patch_TextMenu; + TextMenu.Button modOptionsButton = textMenu?.Items.OfType() .FirstOrDefault(button => button.Label == Dialog.Clean("menu_pause_modoptions")); if (modOptionsButton != null) { textMenu.Selection = textMenu.IndexOf(modOptionsButton); @@ -236,14 +236,14 @@ public void CreatePauseMenuButtons(Level level, TextMenu menu, bool minimal) { })); } - public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { + public override void CreateModMenuSection(patch_TextMenu menu, bool inGame, EventInstance snapshot) { // Optional - reload mod settings when entering the mod options. // LoadSettings(); base.CreateModMenuSection(menu, inGame, snapshot); if (!inGame) { - List items = menu.GetItems(); + List items = menu.Items; // insert extra options before the "key config" options menu.Insert(items.Count - 2, new TextMenu.Button(Dialog.Clean("modoptions_coremodule_oobe")).Pressed(() => { diff --git a/Celeste.Mod.mm/Mod/Core/CoreModuleSettings.cs b/Celeste.Mod.mm/Mod/Core/CoreModuleSettings.cs index 2c7e9e802..60fa8bbfc 100644 --- a/Celeste.Mod.mm/Mod/Core/CoreModuleSettings.cs +++ b/Celeste.Mod.mm/Mod/Core/CoreModuleSettings.cs @@ -370,7 +370,7 @@ public void CreateInputGuiEntry(TextMenu menu, bool inGame) { List inputGuiPrefixes = new List { "" // Auto }; - foreach (KeyValuePair kvp in GFX.Gui.GetTextures()) { + foreach (KeyValuePair kvp in ((patch_Atlas) GFX.Gui).Textures) { string path = kvp.Key; if (!path.StartsWith("controls/")) continue; diff --git a/Celeste.Mod.mm/Mod/Entities/CustomTextVignette.cs b/Celeste.Mod.mm/Mod/Entities/CustomTextVignette.cs index 3d5843975..5ea6417bf 100644 --- a/Celeste.Mod.mm/Mod/Entities/CustomTextVignette.cs +++ b/Celeste.Mod.mm/Mod/Entities/CustomTextVignette.cs @@ -47,7 +47,7 @@ public CustomTextVignette(Session session, MapMetaTextVignette meta, HiresSnow s snow.Direction = meta.SnowDirection; Add(renderer = new HudRenderer()); Add(this.snow = snow); - RendererList.UpdateLists(); + ((patch_RendererList) (object) RendererList).UpdateLists(); initialDelay = meta.InitialDelay; finalDelay = meta.FinalDelay; @@ -164,7 +164,7 @@ private void ReturnToMap() { } }).OnUpdate = (f) => textAlpha = Math.Min(textAlpha, 1f - f); - RendererList.UpdateLists(); + ((patch_RendererList) (object) RendererList).UpdateLists(); RendererList.MoveToFront(snow); } diff --git a/Celeste.Mod.mm/Mod/Everest/Emoji.cs b/Celeste.Mod.mm/Mod/Everest/Emoji.cs index f5f723e49..a1c34c4ce 100644 --- a/Celeste.Mod.mm/Mod/Everest/Emoji.cs +++ b/Celeste.Mod.mm/Mod/Everest/Emoji.cs @@ -44,7 +44,7 @@ internal static void Auto() { return; Initialized = true; - foreach (KeyValuePair kvp in GFX.Gui.GetTextures()) + foreach (KeyValuePair kvp in ((patch_Atlas) GFX.Gui).Textures) if (kvp.Key.StartsWith("emoji/")) Register(kvp.Key.Substring(6), kvp.Value); diff --git a/Celeste.Mod.mm/Mod/Everest/Everest.Content.cs b/Celeste.Mod.mm/Mod/Everest/Everest.Content.cs index 2e834897e..d3f46127f 100644 --- a/Celeste.Mod.mm/Mod/Everest/Everest.Content.cs +++ b/Celeste.Mod.mm/Mod/Everest/Everest.Content.cs @@ -837,7 +837,7 @@ private static void RecrawlMod(ModContent mod) { public static void Update(ModAsset prev, ModAsset next) { if (prev != null) { foreach (object target in prev.Targets) { - if (target is MTexture mtex) { + if (target is patch_MTexture mtex) { AssetReloadHelper.Do($"{Dialog.Clean("ASSETRELOADHELPER_UNLOADINGTEXTURE")} {Path.GetFileName(prev.PathVirtual)}", () => { mtex.UndoOverride(prev); }); @@ -1013,11 +1013,11 @@ public static void ProcessUpdate(object asset, ModAsset mapping, bool load) { if (asset == null || mapping == null) return; - if (asset is Atlas atlas) { + if (asset is patch_Atlas atlas) { string reloadingText = Dialog.Language == null ? "" : Dialog.Clean(mapping.Children.Count == 0 ? "ASSETRELOADHELPER_RELOADINGTEXTURE" : "ASSETRELOADHELPER_RELOADINGTEXTURES"); AssetReloadHelper.Do(load, $"{reloadingText} {Path.GetFileName(mapping.PathVirtual)}", () => { atlas.ResetCaches(); - (atlas as patch_Atlas).Ingest(mapping); + atlas.Ingest(mapping); }); // if the atlas is (or contains) an emoji, register it. @@ -1153,7 +1153,7 @@ public static void Dump(string assetNameFull, object asset) { } /**/ - } else if (asset is Atlas atlas) { + } else if (asset is patch_Atlas atlas) { /* for (int i = 0; i < atlas.Sources.Count; i++) { @@ -1171,7 +1171,7 @@ public static void Dump(string assetNameFull, object asset) { } */ - Dictionary textures = atlas.GetTextures(); + Dictionary textures = atlas.Textures; foreach (KeyValuePair kvp in textures) { string name = kvp.Key; MTexture source = kvp.Value; diff --git a/Celeste.Mod.mm/Mod/Everest/Everest.DebugRC.cs b/Celeste.Mod.mm/Mod/Everest/Everest.DebugRC.cs index cdab678a4..4f9b94795 100644 --- a/Celeste.Mod.mm/Mod/Everest/Everest.DebugRC.cs +++ b/Celeste.Mod.mm/Mod/Everest/Everest.DebugRC.cs @@ -383,7 +383,7 @@ public static void Write(HttpListenerContext c, string str) { return; } - AreaData area = AreaDataExt.Get(sid); + AreaData area = patch_AreaData.Get(sid); if (area == null) { c.Response.StatusCode = (int) HttpStatusCode.BadRequest; Write(c, $"ERROR: Chapter not found: {sid}"); @@ -484,7 +484,7 @@ public static void Write(HttpListenerContext c, string str) { return; } - AreaData area = AreaDataExt.Get(sid); + patch_AreaData area = patch_AreaData.Get(sid); if (area == null) { c.Response.StatusCode = (int) HttpStatusCode.BadRequest; Write(c, $"ERROR: Chapter not found: {sid}"); diff --git a/Celeste.Mod.mm/Mod/Everest/Everest.DiscordSDK.cs b/Celeste.Mod.mm/Mod/Everest/Everest.DiscordSDK.cs index f276f7034..06bf4d7eb 100644 --- a/Celeste.Mod.mm/Mod/Everest/Everest.DiscordSDK.cs +++ b/Celeste.Mod.mm/Mod/Everest/Everest.DiscordSDK.cs @@ -172,7 +172,7 @@ internal void UpdatePresence(Session session = null) { } } else { Language english = Dialog.Languages["english"]; - AreaData area = AreaData.Get(session); + patch_AreaData area = patch_AreaData.Get(session); // the displayed info if "show map" was disabled: just "Playing a map" string mapName = "a map"; @@ -197,7 +197,7 @@ internal void UpdatePresence(Session session = null) { } if (!IsOnlyMapInLevelSet(area)) { - fullName = FilterEmojiFrom(area.GetLevelSet().DialogCleanOrNull(english) ?? area.GetLevelSet()) + fullName = FilterEmojiFrom(area.LevelSet.DialogCleanOrNull(english) ?? area.LevelSet) + " | " + (session.Area.ChapterIndex >= 0 ? "Chapter " + session.Area.ChapterIndex + " - " : "") + mapName; } else { fullName = mapName; @@ -241,9 +241,9 @@ private string FilterEmojiFrom(string s) { return Regex.Replace(Emoji.Apply(s), "[" + Emoji.Start + "-" + Emoji.End + "]", "").Trim(); } - private bool IsOnlyMapInLevelSet(AreaData area) { - foreach (AreaData otherArea in AreaData.Areas) { - if (area.GetLevelSet() == otherArea.GetLevelSet() && area.GetSID() != otherArea.GetSID()) { + private bool IsOnlyMapInLevelSet(patch_AreaData area) { + foreach (patch_AreaData otherArea in AreaData.Areas) { + if (area.LevelSet == otherArea.LevelSet && area.SID != otherArea.SID) { return false; } } diff --git a/Celeste.Mod.mm/Mod/Everest/Everest.Events.cs b/Celeste.Mod.mm/Mod/Everest/Everest.Events.cs index 7bdb55b2b..9657146fc 100644 --- a/Celeste.Mod.mm/Mod/Everest/Everest.Events.cs +++ b/Celeste.Mod.mm/Mod/Everest/Everest.Events.cs @@ -98,12 +98,12 @@ internal static void Pause(_Level level, int startIndex, bool minimal, bool quic public static event UnpauseHandler OnUnpause; internal static void Unpause(_Level level) => OnUnpause?.Invoke(level); - public delegate void CreatePauseMenuButtonsHandler(_Level level, TextMenu menu, bool minimal); + public delegate void CreatePauseMenuButtonsHandler(_Level level, patch_TextMenu menu, bool minimal); /// /// Called when the Level's pause menu is created. /// public static event CreatePauseMenuButtonsHandler OnCreatePauseMenuButtons; - internal static void CreatePauseMenuButtons(_Level level, TextMenu menu, bool minimal) + internal static void CreatePauseMenuButtons(_Level level, patch_TextMenu menu, bool minimal) => OnCreatePauseMenuButtons?.Invoke(level, menu, minimal); public delegate void TransitionToHandler(_Level level, LevelData next, Vector2 direction); diff --git a/Celeste.Mod.mm/Mod/Everest/Extensions.cs b/Celeste.Mod.mm/Mod/Everest/Extensions.cs index 7fea8fe87..421605294 100644 --- a/Celeste.Mod.mm/Mod/Everest/Extensions.cs +++ b/Celeste.Mod.mm/Mod/Everest/Extensions.cs @@ -197,7 +197,7 @@ public static Vector2 ToVector2(this Point p) { /// The menu containing the TextMenu.Item option. /// This method does nothing if this is set to false. /// The passed option. - public static TextMenu.Item NeedsRelaunch(this TextMenu.Item option, TextMenu containingMenu, bool needsRelaunch = true) { + public static TextMenu.Item NeedsRelaunch(this TextMenu.Item option, patch_TextMenu containingMenu, bool needsRelaunch = true) { if (!needsRelaunch) return option; @@ -207,7 +207,7 @@ public static TextMenu.Item NeedsRelaunch(this TextMenu.Item option, TextMenu co HeightExtra = 0f }; - List items = containingMenu.GetItems(); + List items = containingMenu.Items; if (items.Contains(option)) { // insert the text after the option that needs relaunch. containingMenu.Insert(items.IndexOf(option) + 1, needsRelaunchText); @@ -232,14 +232,14 @@ public static TextMenu.Item NeedsRelaunch(this TextMenu.Item option, TextMenu co /// The menu containing the TextMenu.Item option. /// /// The passed option. - public static TextMenu.Item AddDescription(this TextMenu.Item option, TextMenu containingMenu, string description) { + public static TextMenu.Item AddDescription(this TextMenu.Item option, patch_TextMenu containingMenu, string description) { // build the description menu entry TextMenuExt.EaseInSubHeaderExt descriptionText = new TextMenuExt.EaseInSubHeaderExt(description, false, containingMenu) { TextColor = Color.Gray, HeightExtra = 0f }; - List items = containingMenu.GetItems(); + List items = containingMenu.Items; if (items.Contains(option)) { // insert the description after the option. containingMenu.Insert(items.IndexOf(option) + 1, descriptionText); diff --git a/Celeste.Mod.mm/Mod/Helpers/AssetReloadHelper.cs b/Celeste.Mod.mm/Mod/Helpers/AssetReloadHelper.cs index d1185c562..b07a0d044 100644 --- a/Celeste.Mod.mm/Mod/Helpers/AssetReloadHelper.cs +++ b/Celeste.Mod.mm/Mod/Helpers/AssetReloadHelper.cs @@ -181,7 +181,7 @@ public static void ReloadAllMaps() { SaveData saveData = SaveData.Instance; // ChapterSelect only updates the ID. - string lastAreaSID = saveData == null ? null : (AreaData.Get(saveData.LastArea.ID)?.ToKey().GetSID() ?? AreaKey.Default.GetSID()); + string lastAreaSID = saveData == null ? null : (patch_AreaData.Get(saveData.LastArea.ID)?.ToKey().GetSID() ?? AreaKey.Default.GetSID()); // Note: SaveData.Instance.LastArea is reset by AreaData.Interlude_Safe -> SaveData.LevelSetStats realizing that AreaOffset == -1 // Store the "resolved" last selected area in a local variable, then re-set it after reloading. @@ -192,7 +192,7 @@ public static void ReloadAllMaps() { // Fake a save data reload to resync the save data to the new area list. if (saveData != null) { - AreaData lastArea = AreaDataExt.Get(lastAreaSID); + patch_AreaData lastArea = patch_AreaData.Get(lastAreaSID); saveData.LastArea = lastArea?.ToKey() ?? AreaKey.Default; saveData.BeforeSave(); saveData.AfterInitialize(); diff --git a/Celeste.Mod.mm/Mod/Helpers/MapDataFixup.cs b/Celeste.Mod.mm/Mod/Helpers/MapDataFixup.cs index 94db92b72..0f45c371d 100644 --- a/Celeste.Mod.mm/Mod/Helpers/MapDataFixup.cs +++ b/Celeste.Mod.mm/Mod/Helpers/MapDataFixup.cs @@ -5,23 +5,23 @@ namespace Celeste.Mod { public class MapDataFixup { public List Processors = new List(); - public readonly MapData MapData; + public readonly patch_MapData MapData; public readonly AreaKey AreaKey; - public readonly AreaData AreaData; + public readonly patch_AreaData AreaData; public readonly AreaData ParentAreaData; public readonly ModeProperties Mode; public readonly ModeProperties ParentMode; - public readonly MapData ParentMapData; + public readonly patch_MapData ParentMapData; public BinaryPacker.Element Root; - public MapDataFixup(MapData map) { + public MapDataFixup(patch_MapData map) { MapData = map; AreaKey = map.Area; - AreaData = AreaData.Get(AreaKey); - ParentAreaData = AreaDataExt.Get(AreaData.GetMeta()?.Parent) ?? AreaData; + AreaData = patch_AreaData.Get(AreaKey); + ParentAreaData = patch_AreaData.Get(AreaData.Meta?.Parent) ?? AreaData; Mode = AreaData.Mode[(int) AreaKey.Mode]; ParentMode = ParentAreaData.Mode.ElementAtOrDefault((int) AreaKey.Mode) ?? Mode; - ParentMapData = ParentMode?.MapData ?? map; + ParentMapData = ((patch_ModeProperties) ParentMode)?.MapData ?? map; foreach (EverestModule module in Everest._Modules) { module.PrepareMapDataProcessors(this); diff --git a/Celeste.Mod.mm/Mod/Meta/MapMeta.cs b/Celeste.Mod.mm/Mod/Meta/MapMeta.cs index 62c737fc3..2f2839dfa 100644 --- a/Celeste.Mod.mm/Mod/Meta/MapMeta.cs +++ b/Celeste.Mod.mm/Mod/Meta/MapMeta.cs @@ -134,7 +134,7 @@ public void Parse(BinaryPacker.Element meta) { } } - public void ApplyTo(AreaData area) { + public void ApplyTo(patch_AreaData area) { if (!string.IsNullOrEmpty(Icon) && GFX.Gui.Has(Icon)) area.Icon = Icon; @@ -192,16 +192,16 @@ public void ApplyTo(AreaData area) { area.MountainCursor = Mountain?.Cursor?.ToVector3() ?? area.MountainCursor; area.MountainState = Mountain?.State ?? area.MountainState; - ModeProperties[] modes = area.Mode; + patch_ModeProperties[] modes = area.Mode; area.Mode = Convert(Modes) ?? modes; if (modes != null) for (int i = 0; i < area.Mode.Length && i < modes.Length; i++) if (area.Mode[i] == null) area.Mode[i] = modes[i]; - MapMeta meta = area.GetMeta(); + MapMeta meta = area.Meta; if (meta == null) { - area.SetMeta(this); + area.Meta = this; } else { if (!string.IsNullOrEmpty(Parent)) meta.Parent = Parent; @@ -270,10 +270,10 @@ public void ApplyToForOverride(AreaData area) { area.CoreMode = CoreMode.Value; } - public static ModeProperties[] Convert(MapMetaModeProperties[] meta) { + public static patch_ModeProperties[] Convert(MapMetaModeProperties[] meta) { if (meta == null || meta.Length == 0) return null; - ModeProperties[] data = new ModeProperties[meta.Length]; + patch_ModeProperties[] data = new patch_ModeProperties[meta.Length]; for (int i = 0; i < meta.Length; i++) data[i] = meta[i]?.Convert(); return data; @@ -332,8 +332,8 @@ public MapMetaModeProperties(BinaryPacker.Element meta) { public bool? SeekerSlowdown { get; set; } public bool? TheoInBubble { get; set; } - public ModeProperties Convert() - => new ModeProperties() { + public patch_ModeProperties Convert() + => new patch_ModeProperties() { AudioState = AudioState?.Convert() ?? new AudioState(SFX.music_city, SFX.env_amb_01_main), Checkpoints = MapMeta.Convert(Checkpoints), // Can be null. IgnoreLevelAudioLayerData = IgnoreLevelAudioLayerData ?? false, @@ -367,9 +367,9 @@ public void Parse(BinaryPacker.Element meta) { } } - public void ApplyTo(AreaData area, AreaMode mode) { - area.GetMeta().Modes[(int) mode] = this; - ModeProperties props = area.Mode[(int) mode]; + public void ApplyTo(patch_AreaData area, AreaMode mode) { + area.Meta.Modes[(int) mode] = this; + patch_ModeProperties props = area.Mode[(int) mode]; if (props != null) { props.AudioState = AudioState?.Convert() ?? props.AudioState; props.Checkpoints = MapMeta.Convert(Checkpoints) ?? props.Checkpoints; diff --git a/Celeste.Mod.mm/Mod/Module/EverestMapDataProcessor.cs b/Celeste.Mod.mm/Mod/Module/EverestMapDataProcessor.cs index a10a25599..18ddd72bd 100644 --- a/Celeste.Mod.mm/Mod/Module/EverestMapDataProcessor.cs +++ b/Celeste.Mod.mm/Mod/Module/EverestMapDataProcessor.cs @@ -6,12 +6,12 @@ public abstract class EverestMapDataProcessor { public MapDataFixup Context { get; private set; } public AreaKey AreaKey => Context.AreaKey; - public AreaData AreaData => Context.AreaData; + public patch_AreaData AreaData => Context.AreaData; public AreaData ParentAreaData => Context.ParentAreaData; public ModeProperties Mode => Context.Mode; public ModeProperties ParentMode => Context.ParentMode; - public MapData MapData => Context.MapData; - public MapData ParentMapData => Context.ParentMapData; + public patch_MapData MapData => Context.MapData; + public patch_MapData ParentMapData => Context.ParentMapData; public Dictionary> Steps { get; protected set; } public abstract void Reset(); diff --git a/Celeste.Mod.mm/Mod/Module/EverestModule.cs b/Celeste.Mod.mm/Mod/Module/EverestModule.cs index cfa080018..fcb02467f 100644 --- a/Celeste.Mod.mm/Mod/Module/EverestModule.cs +++ b/Celeste.Mod.mm/Mod/Module/EverestModule.cs @@ -634,7 +634,7 @@ private Entity CreateButtonConfigUI(TextMenu menu) { /// Menu to add the section to. /// Whether we're in-game (paused) or in the main menu. /// The Level.PauseSnapshot - public virtual void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { + public virtual void CreateModMenuSection(patch_TextMenu menu, bool inGame, EventInstance snapshot) { Type type = SettingsType; EverestModuleSettings settings = _Settings; if (type == null || settings == null) diff --git a/Celeste.Mod.mm/Mod/Module/LuaModule.cs b/Celeste.Mod.mm/Mod/Module/LuaModule.cs index 85497bf66..33f743e3c 100644 --- a/Celeste.Mod.mm/Mod/Module/LuaModule.cs +++ b/Celeste.Mod.mm/Mod/Module/LuaModule.cs @@ -20,7 +20,7 @@ public override void Load() { public override void Unload() { } - public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { + public override void CreateModMenuSection(patch_TextMenu menu, bool inGame, EventInstance snapshot) { } } diff --git a/Celeste.Mod.mm/Mod/Module/NullModule.cs b/Celeste.Mod.mm/Mod/Module/NullModule.cs index ec3d156b0..48529f881 100644 --- a/Celeste.Mod.mm/Mod/Module/NullModule.cs +++ b/Celeste.Mod.mm/Mod/Module/NullModule.cs @@ -17,7 +17,7 @@ public override void Load() { public override void Unload() { } - public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { + public override void CreateModMenuSection(patch_TextMenu menu, bool inGame, EventInstance snapshot) { } } diff --git a/Celeste.Mod.mm/Mod/UI/AutoModUpdater.cs b/Celeste.Mod.mm/Mod/UI/AutoModUpdater.cs index 7380e83da..f630915f6 100755 --- a/Celeste.Mod.mm/Mod/UI/AutoModUpdater.cs +++ b/Celeste.Mod.mm/Mod/UI/AutoModUpdater.cs @@ -44,7 +44,7 @@ public override void Begin() { // add on-screen elements like GameLoader/OverworldLoader Add(new HudRenderer()); Add(snow); - RendererList.UpdateLists(); + ((patch_RendererList) (object) RendererList).UpdateLists(); // register the routine Entity entity = new Entity(); diff --git a/Celeste.Mod.mm/Mod/UI/MainMenuModOptionsButton.cs b/Celeste.Mod.mm/Mod/UI/MainMenuModOptionsButton.cs index e06bdd416..29d1ee784 100755 --- a/Celeste.Mod.mm/Mod/UI/MainMenuModOptionsButton.cs +++ b/Celeste.Mod.mm/Mod/UI/MainMenuModOptionsButton.cs @@ -5,7 +5,7 @@ using System; namespace Celeste.Mod.UI { - class MainMenuModOptionsButton : MainMenuSmallButton { + class MainMenuModOptionsButton : patch_MainMenuSmallButton { private string subText; public bool SmallSubTextSpacing = false; @@ -50,7 +50,7 @@ public override void Render() { base.Render(); if (subText != null) { - Vector2 offset = new Vector2(Ease.CubeInOut(this.GetEase()) * 32f, this.GetWiggler().Value * 8f); + Vector2 offset = new Vector2(Monocle.Ease.CubeInOut(this.Ease) * 32f, this.Wiggler.Value * 8f); ActiveFont.DrawOutline(subText, Position + offset + new Vector2(84f, SmallSubTextSpacing ? 70f : 84f), new Vector2(0f, 0.5f), Vector2.One * 0.6f, Color.OrangeRed, 2f, Color.Black); } diff --git a/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotLevelSetPicker.cs b/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotLevelSetPicker.cs index aff7c2ffd..cbede5aa3 100755 --- a/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotLevelSetPicker.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotLevelSetPicker.cs @@ -15,18 +15,18 @@ public OuiFileSelectSlotLevelSetPicker(OuiFileSelectSlot selectSlot) { this.selectSlot = selectSlot; // if the default starting level set still exists, set it by default. - if (AreaData.Areas.Any(area => area.GetLevelSet() == CoreModule.Settings.DefaultStartingLevelSet)) { + if (patch_AreaData.Areas.Any(area => area.LevelSet == CoreModule.Settings.DefaultStartingLevelSet)) { NewGameLevelSet = CoreModule.Settings.DefaultStartingLevelSet; } - Label = DialogExt.CleanLevelSet(NewGameLevelSet ?? "Celeste"); + Label = patch_Dialog.CleanLevelSet(NewGameLevelSet ?? "Celeste"); Scale = 0.5f; Action = () => changeStartingLevelSet(1); // find out what is the width of the biggest level set out there. float levelSetNameWidth = 0; - foreach (AreaData areaData in AreaData.Areas) { - levelSetNameWidth = Math.Max(levelSetNameWidth, ActiveFont.Measure(DialogExt.CleanLevelSet(areaData.GetLevelSet())).X); + foreach (patch_AreaData areaData in AreaData.Areas) { + levelSetNameWidth = Math.Max(levelSetNameWidth, ActiveFont.Measure(patch_Dialog.CleanLevelSet(areaData.LevelSet)).X); } arrowOffset = new Vector2(20f + levelSetNameWidth / 2 * Scale, 0f); } @@ -63,9 +63,9 @@ private void changeStartingLevelSet(int direction) { int id; if (direction > 0) { - id = AreaData.Areas.FindLastIndex(area => area.GetLevelSet() == NewGameLevelSet) + direction; + id = patch_AreaData.Areas.FindLastIndex(area => area.LevelSet == NewGameLevelSet) + direction; } else { - id = AreaData.Areas.FindIndex(area => area.GetLevelSet() == NewGameLevelSet) + direction; + id = patch_AreaData.Areas.FindIndex(area => area.LevelSet == NewGameLevelSet) + direction; } if (id >= AreaData.Areas.Count) @@ -73,9 +73,9 @@ private void changeStartingLevelSet(int direction) { if (id < 0) id = AreaData.Areas.Count - 1; - NewGameLevelSet = AreaData.Areas[id].GetLevelSet(); + NewGameLevelSet = patch_AreaData.Areas[id].LevelSet; - Label = DialogExt.CleanLevelSet(NewGameLevelSet ?? "Celeste"); + Label = patch_Dialog.CleanLevelSet(NewGameLevelSet ?? "Celeste"); ((patch_OuiFileSelectSlot) selectSlot).WiggleMenu(); } } diff --git a/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotSubmenu.cs b/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotSubmenu.cs index 40fd6ab48..7f2bedc0e 100755 --- a/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotSubmenu.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiFileSelectSlotSubmenu.cs @@ -13,7 +13,7 @@ public static void Goto(OuiFileSelectSlot slot, EverestModuleSaveData modSave protected abstract void addOptionsToMenu(TextMenu menu, OuiFileSelectSlot slot, EverestModuleSaveData modSaveData, bool fileExists); - protected override void addOptionsToMenu(TextMenu menu) { + protected override void addOptionsToMenu(patch_TextMenu menu) { addOptionsToMenu(menu, parameters[0] as OuiFileSelectSlot, parameters[1] as EverestModuleSaveData, (bool) parameters[2]); } } diff --git a/Celeste.Mod.mm/Mod/UI/OuiGenericMenu.cs b/Celeste.Mod.mm/Mod/UI/OuiGenericMenu.cs index eb2cb6417..be1aaa4d4 100755 --- a/Celeste.Mod.mm/Mod/UI/OuiGenericMenu.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiGenericMenu.cs @@ -15,7 +15,7 @@ public abstract class OuiGenericMenu : Oui { /// /// The text menu this screen contains. /// - protected TextMenu menu; + protected patch_TextMenu menu; /// /// The title for the menu. @@ -42,11 +42,11 @@ public abstract class OuiGenericMenu : Oui { /// /// Adds all the submenu options to the TextMenu given in parameter. /// - protected abstract void addOptionsToMenu(TextMenu menu); + protected abstract void addOptionsToMenu(patch_TextMenu menu); public override IEnumerator Enter(Oui from) { // build the menu - menu = new TextMenu(); + menu = new patch_TextMenu(); menu.Add(new TextMenu.Header(MenuName)); addOptionsToMenu(menu); diff --git a/Celeste.Mod.mm/Mod/UI/OuiHelper_ChapterSelect_LevelSet.cs b/Celeste.Mod.mm/Mod/UI/OuiHelper_ChapterSelect_LevelSet.cs index 5e4696721..fc1c71cb1 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiHelper_ChapterSelect_LevelSet.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiHelper_ChapterSelect_LevelSet.cs @@ -19,11 +19,11 @@ public override IEnumerator Enter(Oui from) { yield return 0.25f; int startID = SaveData.Instance.LastArea.ID; - string startLevelSet = SaveData.Instance.GetLevelSet(); + string startLevelSet = patch_SaveData.Instance.LevelSet; int count = AreaData.Areas.Count; for (int i = (count + startID + Direction) % count; i != startID; i = (count + i + Direction) % count) { - AreaData area = AreaData.Get(i); - if (area == null || area.GetLevelSet() != startLevelSet) { + patch_AreaData area = patch_AreaData.Get(i); + if (area == null || area.LevelSet != startLevelSet) { SaveData.Instance.LastArea = area.ToKey(); goto Done; } diff --git a/Celeste.Mod.mm/Mod/UI/OuiMapList.cs b/Celeste.Mod.mm/Mod/UI/OuiMapList.cs index 29f8ef730..5f392d97d 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiMapList.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiMapList.cs @@ -12,9 +12,9 @@ public class OuiMapList : Oui { private MountainCamera cameraStart; private MountainCamera cameraEnd; - public List OuiIcons; + public List OuiIcons; - private TextMenu menu; + private patch_TextMenu menu; private const float onScreenX = 960f; private const float offScreenX = 2880f; @@ -28,9 +28,9 @@ public class OuiMapList : Oui { private List sets = new List(); - private TextMenu CreateMenu(bool inGame, EventInstance snapshot) { - menu = new TextMenu(); - ((patch_TextMenu) menu).CompactWidthMode = true; + private patch_TextMenu CreateMenu(bool inGame, EventInstance snapshot) { + menu = new patch_TextMenu(); + menu.CompactWidthMode = true; items.Clear(); menu.Add(new TextMenu.Header(Dialog.Clean("maplist_title"))); @@ -38,8 +38,8 @@ private TextMenu CreateMenu(bool inGame, EventInstance snapshot) { menu.Add(new patch_TextMenu.patch_SubHeader(Dialog.Clean("maplist_filters"))); sets.Clear(); - foreach (AreaData area in AreaData.Areas) { - string levelSet = area.GetLevelSet(); + foreach (patch_AreaData area in AreaData.Areas) { + string levelSet = area.LevelSet; if (string.IsNullOrEmpty(levelSet)) continue; if (levelSet == "Celeste") @@ -56,7 +56,7 @@ private TextMenu CreateMenu(bool inGame, EventInstance snapshot) { return Dialog.Clean("maplist_type_everything"); if (value == 2) return Dialog.Clean("maplist_type_allmods"); - return DialogExt.CleanLevelSet(sets[value - 3]); + return patch_Dialog.CleanLevelSet(sets[value - 3]); }, 0, 2 + sets.Count, type).Change(value => { type = value; ReloadItems(); @@ -102,15 +102,15 @@ private void ReloadItems() { SaveData save = SaveData.Instance; List areaStatsAll = save.Areas; for (int i = 0; i < AreaData.Areas.Count; i++) { - AreaData area = AreaData.Get(i); + patch_AreaData area = patch_AreaData.Get(i); if (area == null || !area.HasMode((AreaMode) side)) continue; // TODO: Make subchapters hidden by default in the map list, even in debug mode. - if (!save.DebugMode && !string.IsNullOrEmpty(area.GetMeta()?.Parent)) + if (!save.DebugMode && !string.IsNullOrEmpty(area.Meta?.Parent)) continue; - string levelSet = area.GetLevelSet(); + string levelSet = area.LevelSet; if (type != 1 && ((filterSet == null && levelSet == "Celeste") || (filterSet != null && filterSet != levelSet))) continue; @@ -120,11 +120,11 @@ private void ReloadItems() { if (lastLevelSet != levelSet) { lastLevelSet = levelSet; - levelSetStats = SaveData.Instance.GetLevelSetStatsFor(levelSet); + levelSetStats = patch_SaveData.Instance.GetLevelSetStatsFor(levelSet); levelSetAreaOffset = levelSetStats.AreaOffset; levelSetUnlockedAreas = levelSetStats.UnlockedAreas; levelSetUnlockedModes = levelSetStats.UnlockedModes; - string setname = DialogExt.CleanLevelSet(levelSet); + string setname = patch_Dialog.CleanLevelSet(levelSet); TextMenuExt.SubHeaderExt levelSetHeader = new TextMenuExt.SubHeaderExt(setname); levelSetHeader.Alpha = 0f; menu.Add(levelSetHeader); @@ -271,7 +271,7 @@ public override void Render() { base.Render(); } - protected void Inspect(AreaData area, AreaMode mode = AreaMode.Normal) { + protected void Inspect(patch_AreaData area, AreaMode mode = AreaMode.Normal) { Focused = false; Audio.Play(SFX.ui_world_icon_select); SaveData.Instance.LastArea = area.ToKey(mode); @@ -281,19 +281,19 @@ protected void Inspect(AreaData area, AreaMode mode = AreaMode.Normal) { Overworld.Goto(); } - private void Start(AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { + private void Start(patch_AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { Focused = false; Audio.Play(SFX.ui_world_chapter_checkpoint_start); Add(new Coroutine(StartRoutine(area, mode, checkpoint))); } - private IEnumerator StartRoutine(AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { + private IEnumerator StartRoutine(patch_AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { Overworld.Maddy.Hide(false); area.Wipe(Overworld, false, null); Audio.SetMusic(null, true, true); Audio.SetAmbience(null, true); if ((area.ID == 0 || area.ID == 9) && checkpoint == null && mode == AreaMode.Normal) { - Overworld.RendererList.UpdateLists(); + ((patch_RendererList) (object) Overworld.RendererList).UpdateLists(); Overworld.RendererList.MoveToFront(Overworld.Snow); } yield return 0.5f; diff --git a/Celeste.Mod.mm/Mod/UI/OuiMapSearch.cs b/Celeste.Mod.mm/Mod/UI/OuiMapSearch.cs index 08f278828..6901dd442 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiMapSearch.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiMapSearch.cs @@ -13,7 +13,7 @@ public class OuiMapSearch : Oui { private MountainCamera cameraStart; private MountainCamera cameraEnd; - public List OuiIcons; + public List OuiIcons; private SearchMenu menu; @@ -58,8 +58,8 @@ public bool leftFocused { } } - public TextMenu leftMenu; - public TextMenu rightMenu; + public patch_TextMenu leftMenu; + public patch_TextMenu rightMenu; private float leftOffset; private float rightOffset; @@ -86,7 +86,7 @@ public bool Focused { } } - public SearchMenu(TextMenu leftMenu, TextMenu rightMenu) { + public SearchMenu(patch_TextMenu leftMenu, patch_TextMenu rightMenu) { Position = Vector2.Zero; this.leftMenu = leftMenu; this.rightMenu = rightMenu; @@ -152,7 +152,7 @@ public void OnTextInput(char c) { } } - int index = menu.rightMenu.GetItems().FindIndex(item => item is TextMenuExt.ButtonExt button && button.Selectable && items.Contains(button)); + int index = menu.rightMenu.Items.FindIndex(item => item is TextMenuExt.ButtonExt button && button.Selectable && items.Contains(button)); if (index > 0) { menu.rightMenu.Selection = index; Audio.Play(SFX.ui_main_button_select); @@ -212,7 +212,7 @@ public void OnTextInput(char c) { } private SearchMenu CreateMenu(bool inGame, EventInstance snapshot) { - menu = new SearchMenu(new TextMenu(), new TextMenu()); + menu = new SearchMenu(new patch_TextMenu(), new patch_TextMenu()); items.Clear(); menu.leftMenu.Add(searchTitle = new TextMenu.Header(Dialog.Clean("maplist_search"))); @@ -256,15 +256,15 @@ private void ReloadItems() { SaveData save = SaveData.Instance; List areaStatsAll = save.Areas; for (int i = 0; i < AreaData.Areas.Count; i++) { - AreaData area = AreaData.Get(i); + patch_AreaData area = patch_AreaData.Get(i); if (area == null || !area.HasMode(AreaMode.Normal)) continue; // TODO: Make subchapters hidden by default in the map list, even in debug mode. - if (!save.DebugMode && !string.IsNullOrEmpty(area.GetMeta()?.Parent)) + if (!save.DebugMode && !string.IsNullOrEmpty(area.Meta?.Parent)) continue; - string levelSet = area.GetLevelSet(); + string levelSet = area.LevelSet; string id = area.Name; name = id.DialogCleanOrNull() ?? id.SpacedPascalCase(); @@ -276,7 +276,7 @@ private void ReloadItems() { id, name, levelSet, - DialogExt.CleanLevelSet(levelSet) + patch_Dialog.CleanLevelSet(levelSet) }.Select(text => text.ToLower()).ToList(); List unmatchedHunks = searchHunks.ToList(); @@ -317,11 +317,11 @@ private void ReloadItems() { if (matchCount > 1) { lastLevelSet = levelSet; - levelSetStats = SaveData.Instance.GetLevelSetStatsFor(levelSet); + levelSetStats = patch_SaveData.Instance.GetLevelSetStatsFor(levelSet); levelSetAreaOffset = levelSetStats.AreaOffset; levelSetUnlockedAreas = levelSetStats.UnlockedAreas; levelSetUnlockedModes = levelSetStats.UnlockedModes; - string setname = DialogExt.CleanLevelSet(levelSet); + string setname = patch_Dialog.CleanLevelSet(levelSet); TextMenuExt.SubHeaderExt levelSetHeader = new TextMenuExt.SubHeaderExt(setname); levelSetHeader.Alpha = 0f; menu.rightMenu.Insert(1, levelSetHeader); @@ -331,11 +331,11 @@ private void ReloadItems() { if (lastLevelSet != levelSet) { lastLevelSet = levelSet; - levelSetStats = SaveData.Instance.GetLevelSetStatsFor(levelSet); + levelSetStats = patch_SaveData.Instance.GetLevelSetStatsFor(levelSet); levelSetAreaOffset = levelSetStats.AreaOffset; levelSetUnlockedAreas = levelSetStats.UnlockedAreas; levelSetUnlockedModes = levelSetStats.UnlockedModes; - string setname = DialogExt.CleanLevelSet(levelSet); + string setname = patch_Dialog.CleanLevelSet(levelSet); TextMenuExt.SubHeaderExt levelSetHeader = new TextMenuExt.SubHeaderExt(setname); levelSetHeader.Alpha = 0f; menu.rightMenu.Add(levelSetHeader); @@ -555,7 +555,7 @@ public override void Update() { // Don't allow pressing any buttons while searching if (menu != null) - foreach (TextMenu.Item item in menu.rightMenu.GetItems()) + foreach (TextMenu.Item item in menu.rightMenu.Items) item.Disabled = Searching; } @@ -580,7 +580,7 @@ public override void SceneEnd(Scene scene) { MInput.Disabled = false; } - protected void Inspect(AreaData area, AreaMode mode = AreaMode.Normal) { + protected void Inspect(patch_AreaData area, AreaMode mode = AreaMode.Normal) { Focused = false; Audio.Play(SFX.ui_world_icon_select); SaveData.Instance.LastArea = area.ToKey(mode); @@ -590,19 +590,19 @@ protected void Inspect(AreaData area, AreaMode mode = AreaMode.Normal) { Overworld.Goto(); } - private void Start(AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { + private void Start(patch_AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { Focused = false; Audio.Play(SFX.ui_world_chapter_checkpoint_start); Add(new Coroutine(StartRoutine(area, mode, checkpoint))); } - private IEnumerator StartRoutine(AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { + private IEnumerator StartRoutine(patch_AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null) { Overworld.Maddy.Hide(false); area.Wipe(Overworld, false, null); Audio.SetMusic(null, true, true); Audio.SetAmbience(null, true); if ((area.ID == 0 || area.ID == 9) && checkpoint == null && mode == AreaMode.Normal) { - Overworld.RendererList.UpdateLists(); + ((patch_RendererList) (object) Overworld.RendererList).UpdateLists(); Overworld.RendererList.MoveToFront(Overworld.Snow); } yield return 0.5f; diff --git a/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs b/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs index 6cf2e9d27..11d3d298b 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiModOptions.cs @@ -32,9 +32,9 @@ public OuiModOptions() { } public static TextMenu CreateMenu(bool inGame, EventInstance snapshot) { - TextMenu menu = new TextMenu(); - ((patch_TextMenu) menu).CompactWidthMode = true; - ((patch_TextMenu) menu).BatchMode = true; + patch_TextMenu menu = new patch_TextMenu(); + menu.CompactWidthMode = true; + menu.BatchMode = true; menu.Add(new TextMenuExt.HeaderImage("menu/everest") { ImageColor = Color.White, @@ -142,7 +142,7 @@ public static TextMenu CreateMenu(bool inGame, EventInstance snapshot) { /// /// true if an element matching 'criteria' was found, false otherwise. private static bool createModMenuSectionAndDelete(List modules, Predicate criteria, - TextMenu menu, bool inGame, EventInstance snapshot) { + patch_TextMenu menu, bool inGame, EventInstance snapshot) { bool foundMatch = false; diff --git a/Celeste.Mod.mm/Mod/UI/OuiModToggler.cs b/Celeste.Mod.mm/Mod/UI/OuiModToggler.cs index 0730ed498..cb579c68a 100755 --- a/Celeste.Mod.mm/Mod/UI/OuiModToggler.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiModToggler.cs @@ -169,7 +169,7 @@ public OuiModToggler() { backToParentMenu = onBackPressed; } - protected override void addOptionsToMenu(TextMenu menu) { + protected override void addOptionsToMenu(patch_TextMenu menu) { // for now, display a "loading" message. TextMenu.Button loading = new TextMenu.Button(Dialog.Clean("MODOPTIONS_MODTOGGLE_LOADING")) { Disabled = true }; menu.Add(loading); diff --git a/Celeste.Mod.mm/Mod/UI/OuiModUpdateList.cs b/Celeste.Mod.mm/Mod/UI/OuiModUpdateList.cs index 03262c4a7..7191ccdbe 100755 --- a/Celeste.Mod.mm/Mod/UI/OuiModUpdateList.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiModUpdateList.cs @@ -11,7 +11,7 @@ namespace Celeste.Mod.UI { class OuiModUpdateList : Oui, OuiModOptions.ISubmenu { - private TextMenu menu; + private patch_TextMenu menu; private TextMenuExt.SubHeaderExt subHeader; private TextMenuExt.SubHeaderExt subRestartHeader; private TextMenu.Button fetchingButton; @@ -41,7 +41,7 @@ class OuiModUpdateList : Oui, OuiModOptions.ISubmenu { public override IEnumerator Enter(Oui from) { Everest.Loader.AutoLoadNewMods = false; - menu = new TextMenu(); + menu = new patch_TextMenu(); // display the title and a dummy "Fetching" button menu.Add(new TextMenu.Header(Dialog.Clean("MODUPDATECHECKER_MENU_TITLE"))); @@ -467,7 +467,7 @@ private void downloadAllMods() { } private void focusOn(TextMenu.Button button) { - int index = menu.GetItems().IndexOf(button); + int index = menu.Items.IndexOf(button); if (index != -1) { menu.Selection = index; } diff --git a/Celeste.Mod.mm/Mod/UI/OuiOOBE.cs b/Celeste.Mod.mm/Mod/UI/OuiOOBE.cs index e0c8b7ec7..dee17f04a 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiOOBE.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiOOBE.cs @@ -135,7 +135,7 @@ public TextMenu CreateMenu(int step) { // Modders / Mappers case 3: { Item fmod; - TextMenu menu = new TextMenu() { + patch_TextMenu menu = new patch_TextMenu() { new patch_TextMenu.patch_SubHeader(Dialog.Clean("OOBE_SETTINGS_CREATE")), new patch_TextMenu.patch_SubHeader(""), diff --git a/Celeste.Mod.mm/Mod/UI/OuiSoundTest.cs b/Celeste.Mod.mm/Mod/UI/OuiSoundTest.cs index 2b8ea57e4..f9bf3aa3d 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiSoundTest.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiSoundTest.cs @@ -36,7 +36,7 @@ public class OuiSoundTest : Oui, OuiModOptions.ISubmenu { private Color selectColorA = Calc.HexToColor("84FF54"); private Color selectColorB = Calc.HexToColor("FCFF59"); - private TextMenu musicParamMenu; + private patch_TextMenu musicParamMenu; private float musicParamMenuEase = 0f; private Dictionary musicParams = new Dictionary(); @@ -58,7 +58,7 @@ public override IEnumerator Enter(Oui from) { Visible = true; - musicParamMenu = new TextMenu(); + musicParamMenu = new patch_TextMenu(); musicParamMenu.Focused = false; musicParamMenu.MinWidth = 500f; @@ -133,7 +133,7 @@ public override void Update() { musicParamMenu.Update(); } - if (Focused && musicParamMenu != null && Input.MenuJournal.Pressed && musicParamMenu.GetItems().Count != 0) { + if (Focused && musicParamMenu != null && Input.MenuJournal.Pressed && musicParamMenu.Items.Count != 0) { musicParamMenu.Selection = musicParamMenu.FirstPossibleSelection; musicParamMenu.Focused = !musicParamMenu.Focused; } @@ -272,7 +272,7 @@ private void UpdateSelectedPath() { continue; } - if (musicParamMenu.GetItems().Count == 0) { + if (musicParamMenu.Items.Count == 0) { musicParamMenu.Add(new patch_TextMenu.patch_SubHeader(Dialog.Clean("SOUNDTEST_AUDIOPARAMS"))); } @@ -336,7 +336,7 @@ public override void Render() { pos = posInput + new Vector2(0f, spacingY * -0.8f + wigglerBankPath.Value * 2f); ActiveFont.DrawOutline(selectedBankPath ?? "", pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.LightSlateGray * ease, 2f, Color.Black * ease * ease * ease); - if (musicParamMenu.GetItems().Count > 0) { + if (musicParamMenu.Items.Count > 0) { // Press... pos = posInput + new Vector2(0f, spacingY * 2f + wigglerBankPath.Value * 2f); ActiveFont.DrawOutline(Dialog.Clean("SOUNDTEST_AUDIOPARAMS_OPEN_1"), pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.White * ease, 2f, Color.Black * ease * ease * ease); diff --git a/Celeste.Mod.mm/Mod/UI/OuiVersionList.cs b/Celeste.Mod.mm/Mod/UI/OuiVersionList.cs index 1d0400060..dc76dffc7 100644 --- a/Celeste.Mod.mm/Mod/UI/OuiVersionList.cs +++ b/Celeste.Mod.mm/Mod/UI/OuiVersionList.cs @@ -9,7 +9,7 @@ namespace Celeste.Mod.UI { public class OuiVersionList : Oui, OuiModOptions.ISubmenu { - private TextMenu menu; + private patch_TextMenu menu; private TextMenu.SubHeader currentBranchName; @@ -152,7 +152,7 @@ private void ReloadMenu() { Scene.Remove(menu); } - menu = CreateMenu(false, null); + menu = (patch_TextMenu) CreateMenu(false, null); if (selected >= 0) { menu.Selection = selected; diff --git a/Celeste.Mod.mm/Patches/AreaComplete.cs b/Celeste.Mod.mm/Patches/AreaComplete.cs index 4c1de3f74..ba6256f04 100644 --- a/Celeste.Mod.mm/Patches/AreaComplete.cs +++ b/Celeste.Mod.mm/Patches/AreaComplete.cs @@ -162,7 +162,7 @@ public static void DisposeAreaCompleteInfoForEverest() { } private string GetCustomCompleteScreenTitle() { - MapMetaCompleteScreenTitle completeScreenTitle = AreaData.Get(Session.Area)?.GetMeta()?.CompleteScreen?.Title; + MapMetaCompleteScreenTitle completeScreenTitle = patch_AreaData.Get(Session.Area)?.Meta?.CompleteScreen?.Title; if (completeScreenTitle == null) { return null; } diff --git a/Celeste.Mod.mm/Patches/AreaData.cs b/Celeste.Mod.mm/Patches/AreaData.cs index c60cdce54..0c8416ff7 100644 --- a/Celeste.Mod.mm/Patches/AreaData.cs +++ b/Celeste.Mod.mm/Patches/AreaData.cs @@ -12,7 +12,15 @@ using System.Text.RegularExpressions; namespace Celeste { - class patch_AreaData : AreaData { + public class patch_AreaData : AreaData { + +#pragma warning disable CS0108 // Hides inherited member + + // Required to reference this class in other files + public static List Areas; + public patch_ModeProperties[] Mode; + +# pragma warning restore CS0108 private static Regex ParseNameRegex = new Regex(@"^(?:(?\d+)(?[ABCHX]?)\-)?(?.+?)(?:\-(?[ABCHX]?))?$", RegexOptions.Compiled); private static Dictionary ParseNameCache = new Dictionary(); @@ -103,7 +111,7 @@ public bool Interlude_Safe { get { return Interlude_Unsafe || - (SaveData.Instance != null && SaveData.Instance.GetLevelSet() != LevelSet); + (SaveData.Instance != null && patch_SaveData.Instance.LevelSet != LevelSet); } set { Interlude_Unsafe = value; @@ -121,7 +129,7 @@ public bool IsFinal_Safe { get { return IsFinal_Unsafe && - (SaveData.Instance != null && SaveData.Instance.GetLevelSet() == LevelSet); + (SaveData.Instance != null && patch_SaveData.Instance.LevelSet == LevelSet); } set { IsFinal_Unsafe = value; @@ -129,8 +137,8 @@ public bool IsFinal_Safe { } [MonoModReplace] - public static new AreaData Get(Scene scene) { - AreaData result; + public static new patch_AreaData Get(Scene scene) { + patch_AreaData result; if (scene != null && scene is Level) { result = Get(((Level) scene).Session.Area); } else { @@ -140,8 +148,8 @@ public bool IsFinal_Safe { } [MonoModReplace] - public static new AreaData Get(Session session) { - AreaData result; + public static new patch_AreaData Get(Session session) { + patch_AreaData result; if (session != null) { result = Get(session.Area); } else { @@ -151,14 +159,14 @@ public bool IsFinal_Safe { } [MonoModReplace] - public static new AreaData Get(AreaKey area) { + public static new patch_AreaData Get(AreaKey area) { if (area.GetSID() == null) return Get(area.ID); return Get(area.GetSID()); } [MonoModReplace] - public static new AreaData Get(int id) { + public static new patch_AreaData Get(int id) { if (id < 0) return null; @@ -167,15 +175,15 @@ public bool IsFinal_Safe { } } - public static AreaData Get(AreaStats stats) { - if (stats.GetSID() == null) + public static patch_AreaData Get(patch_AreaStats stats) { + if (stats.SID == null) return Get(stats.ID); - return Get(stats.GetSID()); + return Get(stats.SID); } - public static AreaData Get(string sid) { + public static patch_AreaData Get(string sid) { lock (AssetReloadHelper.AreaReloadLock) { - return string.IsNullOrEmpty(sid) ? null : Areas.Find(area => area.GetSID() == sid); + return string.IsNullOrEmpty(sid) ? null : Areas.Find(area => area.SID == sid); } } @@ -184,32 +192,32 @@ public static AreaData Get(string sid) { orig_Load(); // assign SIDs and CheckpointData.Area for vanilla maps. - foreach (AreaData area in Areas) { - area.SetSID("Celeste/" + area.Mode[0].Path); + foreach (patch_AreaData area in Areas) { + area.SID = "Celeste/" + area.Mode[0].Path; for (int modeId = 0; modeId < area.Mode.Length; modeId++) { ModeProperties mode = area.Mode[modeId]; if (mode?.Checkpoints == null) continue; - foreach (CheckpointData checkpoint in mode.Checkpoints) { - checkpoint.SetArea(area.ToKey((AreaMode) modeId)); + foreach (patch_CheckpointData checkpoint in mode.Checkpoints) { + checkpoint.Area = area.ToKey((AreaMode) modeId); } } } // Separate array as we sort it afterwards. - List modAreas = new List(); + List modAreas = new List(); lock (Everest.Content.Map) { foreach (ModAsset asset in Everest.Content.Map.Values.Where(asset => asset.Type == typeof(AssetTypeMap))) { string path = asset.PathVirtual.Substring(5); - AreaData area = new AreaData(); + patch_AreaData area = new patch_AreaData(); // Default values. - area.SetSID(path); + area.SID = path; area.Name = path; area.Icon = "areas/" + path.ToLowerInvariant(); if (!GFX.Gui.Has(area.Icon)) @@ -227,8 +235,8 @@ public static AreaData Get(string sid) { area.Dreaming = false; area.ColorGrade = null; - area.Mode = new ModeProperties[] { - new ModeProperties { + area.Mode = new patch_ModeProperties[] { + new patch_ModeProperties { Inventory = PlayerInventory.Default, AudioState = new AudioState(SFX.music_city, SFX.env_amb_00_main) } @@ -251,7 +259,7 @@ public static AreaData Get(string sid) { meta.ApplyTo(area); MapMeta metaLoaded = asset.GetMeta(); if (metaLoaded != null) { - area.SetMeta(null); + area.Meta = null; metaLoaded.ApplyTo(area); meta = metaLoaded; } @@ -269,22 +277,22 @@ public static AreaData Get(string sid) { meta.Modes = larger; } if (area.Mode.Length < 3) { - ModeProperties[] larger = new ModeProperties[3]; + patch_ModeProperties[] larger = new patch_ModeProperties[3]; for (int i = 0; i < area.Mode.Length; i++) larger[i] = area.Mode[i]; area.Mode = larger; } // Celeste levelset always appears first. - if (area.GetLevelSet() == "Celeste") + if (area.LevelSet == "Celeste") Areas.Add(area); else modAreas.Add(area); // Some special handling. area.OnLevelBegin = (level) => { - MapMeta levelMeta = AreaData.Get(level.Session).GetMeta(); - MapMetaModeProperties levelMetaMode = level.Session.MapData.GetMeta(); + MapMeta levelMeta = patch_AreaData.Get(level.Session).Meta; + MapMetaModeProperties levelMetaMode = ((patch_MapData) level.Session.MapData).Meta; if (levelMetaMode?.SeekerSlowdown ?? false) level.Add(new SeekerEffectsController()); @@ -298,8 +306,8 @@ public static AreaData Get(string sid) { // Find duplicates and remove any earlier copies. for (int i = 0; i < Areas.Count; i++) { - AreaData area = Areas[i]; - int otherIndex = Areas.FindIndex(other => other.GetSID() == area.GetSID()); + patch_AreaData area = Areas[i]; + int otherIndex = Areas.FindIndex(other => other.SID == area.SID); if (otherIndex < i) { Areas[otherIndex] = area; Areas.RemoveAt(i); @@ -313,7 +321,7 @@ public static AreaData Get(string sid) { // Remove AreaDatas which are now a mode of another AreaData. // This can happen late as the map data (.bin) can contain additional metadata. for (int i = 0; i < Areas.Count; i++) { - AreaData area = Areas[i]; + patch_AreaData area = Areas[i]; string path = area.Mode[0].Path; int otherIndex = Areas.FindIndex(other => other.Mode.Any(otherMode => otherMode?.Path == path)); if (otherIndex != -1 && otherIndex != i) { @@ -326,13 +334,13 @@ public static AreaData Get(string sid) { // Also check for .bins possibly belonging to A side .bins by their path and lack of existing modes. for (int ii = 0; ii < Areas.Count; ii++) { - AreaData other = Areas[ii]; + patch_AreaData other = Areas[ii]; ParseName(other.Mode[0].Path, out int? otherOrder, out AreaMode otherSide, out string otherName); - if (area.GetLevelSet() == other.GetLevelSet() && order == otherOrder && name == otherName && side != otherSide && + if (area.LevelSet == other.LevelSet && order == otherOrder && name == otherName && side != otherSide && !other.HasMode(side)) { if (other.Mode[(int) side] == null) - other.Mode[(int) side] = new ModeProperties { + other.Mode[(int) side] = new patch_ModeProperties { Inventory = PlayerInventory.Default, AudioState = new AudioState(SFX.music_city, SFX.env_amb_00_main) }; @@ -345,7 +353,7 @@ public static AreaData Get(string sid) { } for (int i = 0; i < Areas.Count; i++) { - AreaData area = Areas[i]; + patch_AreaData area = Areas[i]; area.ID = i; // Clean up non-existing modes. @@ -357,7 +365,7 @@ public static AreaData Get(string sid) { } Array.Resize(ref area.Mode, modei); - Logger.Log(LogLevel.Verbose, "AreaData", $"{i}: {area.GetSID()} - {area.Mode.Length} sides"); + Logger.Log(LogLevel.Verbose, "AreaData", $"{i}: {area.SID} - {area.Mode.Length} sides"); // Update old MapData areas and load any new areas. @@ -365,18 +373,18 @@ public static AreaData Get(string sid) { if (area.Mode[0].MapData != null) area.Mode[0].MapData.Area = area.ToKey(); else - area.Mode[0].MapData = new MapData(area.ToKey()); + area.Mode[0].MapData = new patch_MapData(area.ToKey()); if (area.IsInterludeUnsafe()) continue; // A and (some) B sides have PoemIDs. Can be overridden via empty PoemID. if (area.Mode[0].PoemID == null) - area.Mode[0].PoemID = area.GetSID().DialogKeyify() + "_A"; + area.Mode[0].PoemID = area.SID.DialogKeyify() + "_A"; if (area.Mode.Length > 1 && area.Mode[1] != null && area.Mode[1].PoemID == null) { - area.Mode[1].PoemID = area.GetSID().DialogKeyify() + "_B"; + area.Mode[1].PoemID = area.SID.DialogKeyify() + "_B"; } // Update all other existing mode's area keys. @@ -386,7 +394,7 @@ public static AreaData Get(string sid) { if (area.Mode[mode].MapData != null) area.Mode[mode].MapData.Area = area.ToKey((AreaMode) mode); else - area.Mode[mode].MapData = new MapData(area.ToKey((AreaMode) mode)); + area.Mode[mode].MapData = new patch_MapData(area.ToKey((AreaMode) mode)); } } @@ -396,13 +404,13 @@ public static AreaData Get(string sid) { MTNExt.LoadModData(); } - private static int AreaComparison(AreaData a, AreaData b) { - string aSet = a.GetLevelSet(); - string aSID = a.GetSID(); - MapMeta aMeta = a.GetMeta(); - string bSet = b.GetLevelSet(); - string bSID = b.GetSID(); - MapMeta bMeta = b.GetMeta(); + private static int AreaComparison(patch_AreaData a, patch_AreaData b) { + string aSet = a.LevelSet; + string aSID = a.SID; + MapMeta aMeta = a.Meta; + string bSet = b.LevelSet; + string bSID = b.SID; + MapMeta bMeta = b.Meta; // Celeste appears before everything else. if (aSet == "Celeste" && bSet != "Celeste") @@ -453,7 +461,7 @@ private static int AreaComparison(AreaData a, AreaData b) { public static string GetStartName(AreaKey area) { string start_key = $"{area.GetSID()}/{(char) ('A' + (int) area.Mode)}/start"; - if (AreaData.Get(area).GetLevelSet() == "Celeste" || !Dialog.Has(start_key)) + if (patch_AreaData.Get(area).LevelSet == "Celeste" || !Dialog.Has(start_key)) return Dialog.Clean("overworld_start"); return Dialog.Clean(start_key); } @@ -469,85 +477,93 @@ public static string GetStartName(AreaKey area) { } } - public static class AreaDataExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. + [Obsolete("Use AreaData members instead.")] + public static class AreaDataExt { - public static AreaData Get(AreaStats stats) + [Obsolete("Use AreaData.Get(AreaStats) instead.")] + public static AreaData Get(patch_AreaStats stats) => patch_AreaData.Get(stats); + [Obsolete("Use AreaData.Get(string) instead.")] public static AreaData Get(string sid) => patch_AreaData.Get(sid); /// /// Check if the AreaData is an interlude (like Prologue and Epilogue). /// - public static bool IsInterludeUnsafe(this AreaData self) - => ((patch_AreaData) self).Interlude_Unsafe; + public static bool IsInterludeUnsafe(this patch_AreaData self) + => self.Interlude_Unsafe; /// /// Get an AreaKey for this area. /// - public static AreaKey ToKey(this AreaData self, AreaMode mode = AreaMode.Normal) - => new AreaKey(self.ID, mode).SetSID(self.GetSID()); + public static AreaKey ToKey(this patch_AreaData self, AreaMode mode = AreaMode.Normal) + => new AreaKey(self.ID, mode).SetSID(self.SID); /// /// Get the name of the level set this area belongs to. /// - public static string GetLevelSet(this AreaData self) - => ((patch_AreaData) self).LevelSet; + [Obsolete("Use AreaData.LevelSet instead.")] + public static string GetLevelSet(this patch_AreaData self) + => self.LevelSet; /// /// Check if the area is official. /// - public static bool IsOfficialLevelSet(this AreaData self) - => ((patch_AreaData) self).LevelSet == "Celeste"; + public static bool IsOfficialLevelSet(this patch_AreaData self) + => self.LevelSet == "Celeste"; /// /// Get the SID (string ID) of the area. /// - public static string GetSID(this AreaData self) - => ((patch_AreaData) self).SID; + [Obsolete("Use AreaData.SID instead.")] + public static string GetSID(this patch_AreaData self) + => self.SID; /// /// Set the SID (string ID) of the area. /// - public static AreaData SetSID(this AreaData self, string value) { - ((patch_AreaData) self).SID = value; + [Obsolete("Use AreaData.SID instead.")] + public static AreaData SetSID(this patch_AreaData self, string value) { + self.SID = value; return self; } /// /// Get the custom metadata if it has been loaded from the .meta or set otherwise. /// - public static MapMeta GetMeta(this AreaData self) - => ((patch_AreaData) self).Meta; + [Obsolete("Use AreaData.Meta instead.")] + public static MapMeta GetMeta(this patch_AreaData self) + => self.Meta; /// /// Set the custom metadata. /// - public static AreaData SetMeta(this AreaData self, MapMeta value) { - ((patch_AreaData) self).Meta = value; + [Obsolete("Use AreaData.Meta instead.")] + public static AreaData SetMeta(this patch_AreaData self, MapMeta value) { + self.Meta = value; return self; } /// /// Get the A-Side's area data backup. /// - public static AreaData GetASideAreaDataBackup(this AreaData self) - => ((patch_AreaData) self).ASideAreaDataBackup; + [Obsolete("Use AreaData.ASideAreaDataBackup instead.")] + public static AreaData GetASideAreaDataBackup(this patch_AreaData self) + => self.ASideAreaDataBackup; /// /// Set the A-Side's area data backup. /// - public static AreaData SetASideAreaDataBackup(this AreaData self, AreaData value) { - ((patch_AreaData) self).ASideAreaDataBackup = value; + [Obsolete("Use AreaData.ASideAreaDataBackup instead.")] + public static AreaData SetASideAreaDataBackup(this patch_AreaData self, AreaData value) { + self.ASideAreaDataBackup = value; return self; } /// /// Restore A-Side's area data from backup. /// - public static void RestoreASideAreaData(this AreaData self) { - AreaData backup = self.GetASideAreaDataBackup(); + public static void RestoreASideAreaData(this patch_AreaData self) { + AreaData backup = self.ASideAreaDataBackup; if (backup == null) return; @@ -563,22 +579,20 @@ public static void RestoreASideAreaData(this AreaData self) { /// /// Get the custom metadata of the mode if OverrideASideMeta is enabled. /// - public static MapMeta GetModeMeta(this AreaData self, AreaMode value) { + public static MapMeta GetModeMeta(this patch_AreaData self, AreaMode value) { if (self.Mode[(int) value]?.GetMapMeta() is MapMeta mapMeta) { if (value != AreaMode.Normal && (mapMeta.OverrideASideMeta ?? false)) return mapMeta; } - return self.GetMeta(); + return self.Meta; } /// /// Apply the metadata of the mode to the area if OverrideASideMeta is enabled. /// - public static void OverrideASideMeta(this AreaData self, AreaMode value) { - patch_AreaData areaData = (patch_AreaData) self; - - if (areaData.LevelSet == "Celeste") + public static void OverrideASideMeta(this patch_AreaData self, AreaMode value) { + if (self.LevelSet == "Celeste") return; if (value == AreaMode.Normal) @@ -590,7 +604,7 @@ public static void OverrideASideMeta(this AreaData self, AreaMode value) { if (!(mapMeta.OverrideASideMeta ?? false)) return; - mapMeta.ApplyToForOverride(areaData); + mapMeta.ApplyToForOverride(self); } } } diff --git a/Celeste.Mod.mm/Patches/AreaKey.cs b/Celeste.Mod.mm/Patches/AreaKey.cs index 4b9df0932..3a1f2545e 100644 --- a/Celeste.Mod.mm/Patches/AreaKey.cs +++ b/Celeste.Mod.mm/Patches/AreaKey.cs @@ -29,13 +29,13 @@ public string SID { get { string value = _SID; if ((SIDID != ID || string.IsNullOrEmpty(value)) && 0 <= ID && ID < AreaData.Areas.Count) - value = AreaData.Areas[ID].GetSID(); + value = patch_AreaData.Areas[ID].SID; return value; } set { _SID = value; // We want to force any legacy code to use the SID's ID. - ID = AreaDataExt.Get(value)?.ID ?? ID; + ID = patch_AreaData.Get(value)?.ID ?? ID; SIDID = ID; // Last ID when the SID was set. SID is always set last. } } @@ -52,7 +52,7 @@ public patch_AreaKey(int id, AreaMode mode = AreaMode.Normal) { // Only set SID if this AreaKey isn't AreaKey.Default or AreaKey.None if (id != -1 && AreaData.Areas != null && AreaData.Areas.Count > 0) { // We don't actually check if we're in bounds as we want an exception. - string sid = AreaData.Areas[id].GetSID(); + string sid = patch_AreaData.Areas[id].SID; // Only set sid after load. During load, sid is still null. if (sid != null) SID = sid; @@ -80,7 +80,7 @@ public int ChapterIndex { string levelSet = LevelSet; int index = 0; for (int i = 0; i <= ID; i++) { - if (AreaData.Areas[i].GetLevelSet() != levelSet) + if (patch_AreaData.Areas[i].LevelSet != levelSet) continue; if (AreaData.Areas[i].Interlude) continue; @@ -98,7 +98,7 @@ public int RelativeIndex { string levelSet = LevelSet; int index = 0; for (int i = 0; i <= ID; i++) { - if (AreaData.Areas[i].GetLevelSet() != levelSet) + if (patch_AreaData.Areas[i].LevelSet != levelSet) continue; index++; } @@ -120,9 +120,6 @@ public override string ToString() { } public static class AreaKeyExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Get the name of the level set this area belongs to. /// diff --git a/Celeste.Mod.mm/Patches/AreaStats.cs b/Celeste.Mod.mm/Patches/AreaStats.cs index a791479b7..c0087de39 100644 --- a/Celeste.Mod.mm/Patches/AreaStats.cs +++ b/Celeste.Mod.mm/Patches/AreaStats.cs @@ -7,7 +7,7 @@ using System.Xml.Serialization; namespace Celeste { - class patch_AreaStats : AreaStats { + public class patch_AreaStats : AreaStats { [XmlAttribute] [MonoModLinkFrom("System.Int32 Celeste.AreaStats::ID_Unsafe")] @@ -21,13 +21,13 @@ class patch_AreaStats : AreaStats { public int ID_Safe { get { if (!string.IsNullOrEmpty(SID)) - return AreaDataExt.Get(SID)?.ID ?? ID_Unsafe; + return patch_AreaData.Get(SID)?.ID ?? ID_Unsafe; return ID_Unsafe; } set { ID_Unsafe = value; if (ID_Unsafe != -1) - SID = AreaData.Areas[ID_Unsafe].GetSID(); + SID = patch_AreaData.Areas[ID_Unsafe].SID; else SID = null; } @@ -84,31 +84,33 @@ public patch_AreaStats(int id) } } - public static class AreaStatsExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. + [Obsolete("Use AreaStats members instead.")] + public static class AreaStatsExt { /// /// Get an AreaKey for this area. /// - public static AreaKey ToKey(this AreaStats self, AreaMode mode) - => new AreaKey(self.ID, mode).SetSID(self.GetSID()); + public static AreaKey ToKey(this patch_AreaStats self, AreaMode mode) + => new AreaKey(self.ID, mode).SetSID(self.SID); /// /// Get the name of the level set this area belongs to. /// + [Obsolete("Use AreaStats.LevelSet instead.")] public static string GetLevelSet(this AreaStats self) => ((patch_AreaStats) self).LevelSet; /// /// Get the SID (string ID) of the area. /// - public static string GetSID(this AreaStats self) + [Obsolete("Use AreaStats.SID instead.")] + public static string VerySpecificString(this AreaStats self) => ((patch_AreaStats) self).SID; /// /// Set the SID (string ID) of the area. /// + [Obsolete("Use AreaStats.SID instead.")] public static AreaStats SetSID(this AreaStats self, string value) { ((patch_AreaStats) self).SID = value; return self; diff --git a/Celeste.Mod.mm/Patches/Audio.cs b/Celeste.Mod.mm/Patches/Audio.cs index 401d63484..6e2a3f15b 100644 --- a/Celeste.Mod.mm/Patches/Audio.cs +++ b/Celeste.Mod.mm/Patches/Audio.cs @@ -358,9 +358,6 @@ public static Bank Load(string name, bool loadStrings) { } public static class AudioExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - public static Dictionary Banks => patch_Audio.patch_Banks.Banks; /// diff --git a/Celeste.Mod.mm/Patches/CassetteBlockManager.cs b/Celeste.Mod.mm/Patches/CassetteBlockManager.cs index 82be438fb..120fc44a2 100644 --- a/Celeste.Mod.mm/Patches/CassetteBlockManager.cs +++ b/Celeste.Mod.mm/Patches/CassetteBlockManager.cs @@ -32,7 +32,7 @@ public patch_CassetteBlockManager() public extern void orig_Awake(Scene scene); public override void Awake(Scene scene) { - AreaData area = AreaData.Get(scene); + patch_AreaData area = patch_AreaData.Get(scene); if (area.CassetteSong == "-" || string.IsNullOrWhiteSpace(area.CassetteSong)) area.CassetteSong = null; @@ -42,7 +42,7 @@ public override void Awake(Scene scene) { ticksPerSwap = 2; beatIndexMax = 256; - MapMetaCassetteModifier meta = area.GetMeta()?.CassetteModifier; + MapMetaCassetteModifier meta = area.Meta?.CassetteModifier; if (meta != null) { if (meta.OldBehavior) { tempoMult = meta.TempoMult; @@ -130,7 +130,7 @@ public override void Update() { [MonoModReplace] public new void OnLevelStart() { Level level = Scene as Level; - MapMetaCassetteModifier meta = AreaData.Get(level.Session).GetMeta()?.CassetteModifier; + MapMetaCassetteModifier meta = patch_AreaData.Get(level.Session).Meta?.CassetteModifier; if (meta != null && meta.OldBehavior) { currentIndex = maxBeat - 1 - ((beatIndex / beatsPerTick) % maxBeat); diff --git a/Celeste.Mod.mm/Patches/Checkpoint.cs b/Celeste.Mod.mm/Patches/Checkpoint.cs index ababe6e60..6fc379607 100644 --- a/Celeste.Mod.mm/Patches/Checkpoint.cs +++ b/Celeste.Mod.mm/Patches/Checkpoint.cs @@ -43,12 +43,12 @@ public override void Awake(Scene scene) { // misplaced, as the checkpoint entity wasn't visible in-game. // Decals were used instead, so let's just move the entity. - foreach (Decal decal in level.Entities.FindAll()) { + foreach (patch_Decal decal in level.Entities.FindAll()) { if (decal.Name.IndexOf("checkpoint", StringComparison.InvariantCultureIgnoreCase) == -1) continue; Depth = decal.Depth - 1; - Vector2 scale = sprite.Scale = flash.Scale = decal.GetScale(); + Vector2 scale = sprite.Scale = flash.Scale = decal.Scale; Position = decal.Position + ( decal.Name == "decals/1-forsakencity/checkpoint" ? new Vector2(0f, 13f) : new Vector2(0f, 12f) diff --git a/Celeste.Mod.mm/Patches/CheckpointData.cs b/Celeste.Mod.mm/Patches/CheckpointData.cs index 7e913ee45..5913bd87f 100644 --- a/Celeste.Mod.mm/Patches/CheckpointData.cs +++ b/Celeste.Mod.mm/Patches/CheckpointData.cs @@ -1,4 +1,6 @@ -namespace Celeste { +using System; + +namespace Celeste { class patch_CheckpointData : CheckpointData { public AreaKey Area; @@ -10,11 +12,10 @@ public patch_CheckpointData(string level, string name, PlayerInventory? inventor } public static class CheckpointDataExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - + [Obsolete("Use CheckpointData.Area instead.")] public static AreaKey GetArea(this CheckpointData self) => ((patch_CheckpointData) self).Area; + [Obsolete("Use CheckpointData.Area instead.")] public static void SetArea(this CheckpointData self, AreaKey value) => ((patch_CheckpointData) self).Area = value; diff --git a/Celeste.Mod.mm/Patches/Commands.cs b/Celeste.Mod.mm/Patches/Commands.cs index 392d8c085..0464b43c9 100644 --- a/Celeste.Mod.mm/Patches/Commands.cs +++ b/Celeste.Mod.mm/Patches/Commands.cs @@ -40,7 +40,7 @@ private static void CmdPrintCounts() { return; } - LevelSetStats stats = SaveData.Instance.GetLevelSetStats(); + LevelSetStats stats = patch_SaveData.Instance.LevelSetStats; Engine.Commands.Log($"** Level Set Stats: {stats.Name} **"); Engine.Commands.Log($"Max strawberry count = {stats.MaxStrawberries}"); Engine.Commands.Log($"Max golden strawberry count = {stats.MaxGoldenStrawberries}"); @@ -262,12 +262,12 @@ private static void ReturnToMap() { [MonoModReplace] [Command("hearts", "sets the amount of obtained hearts for the specified level set to a given number (default all hearts and current level set)")] private static void CmdHearts(int amount = int.MaxValue, string levelSet = null) { - patch_SaveData saveData = SaveData.Instance as patch_SaveData; + patch_SaveData saveData = patch_SaveData.Instance; if (saveData == null) return; if (string.IsNullOrEmpty(levelSet)) - levelSet = saveData.GetLevelSet(); + levelSet = saveData.LevelSet; int num = 0; foreach (patch_AreaStats areaStats in saveData.Areas_Safe.Cast().Where(stats => stats.LevelSet == levelSet)) { diff --git a/Celeste.Mod.mm/Patches/CompleteRenderer.cs b/Celeste.Mod.mm/Patches/CompleteRenderer.cs index 4ba07a510..8f3a64173 100644 --- a/Celeste.Mod.mm/Patches/CompleteRenderer.cs +++ b/Celeste.Mod.mm/Patches/CompleteRenderer.cs @@ -67,7 +67,7 @@ public void ctor(XmlElement xml, Atlas atlas, float delay, Action onDoneSlide = continue; } - Layers.Add(new ImageLayerNoXML(Offset, atlas, layer)); + Layers.Add(new ImageLayerNoXML(Offset, (patch_Atlas) atlas, layer)); } } } @@ -147,7 +147,7 @@ public int ImageIndex { public class ImageLayerNoXML : patch_ImageLayer { - public ImageLayerNoXML(Vector2 offset, Atlas atlas, MapMetaCompleteScreenLayer meta) + public ImageLayerNoXML(Vector2 offset, patch_Atlas atlas, MapMetaCompleteScreenLayer meta) : base(offset, atlas, FakeXML) { Position = meta.Position + offset; ScrollFactor = meta.Scroll; @@ -157,7 +157,7 @@ public ImageLayerNoXML(Vector2 offset, Atlas atlas, MapMetaCompleteScreenLayer m if (atlas.Has(img)) { Images.Add(atlas[img]); } else { - Logger.Log(LogLevel.Warn, "Atlas", $"Requested CompleteScreen texture that does not exist: {atlas.GetDataPath().Substring(17)}/{img}"); + Logger.Log(LogLevel.Warn, "Atlas", $"Requested CompleteScreen texture that does not exist: {atlas.DataPath.Substring(17)}/{img}"); Images.Add(null); } } diff --git a/Celeste.Mod.mm/Patches/Decal.cs b/Celeste.Mod.mm/Patches/Decal.cs index b2c19a4a6..f66190bf6 100644 --- a/Celeste.Mod.mm/Patches/Decal.cs +++ b/Celeste.Mod.mm/Patches/Decal.cs @@ -334,8 +334,10 @@ private void CreateOverlay() { public static class DecalExt { + [Obsolete("Use Decal.Scale instead.")] public static Vector2 GetScale(this Decal self) => ((patch_Decal) self).Scale; + [Obsolete("Use Decal.Scale instead.")] public static void SetScale(this Decal self, Vector2 value) => ((patch_Decal) self).Scale = value; diff --git a/Celeste.Mod.mm/Patches/Dialog.cs b/Celeste.Mod.mm/Patches/Dialog.cs index 3283f82ab..40af4edb6 100644 --- a/Celeste.Mod.mm/Patches/Dialog.cs +++ b/Celeste.Mod.mm/Patches/Dialog.cs @@ -236,10 +236,8 @@ public static string CleanLevelSet(string name) { } public static class DialogExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// + [Obsolete("Use Dialog.CleanLevelSet instead.")] public static string CleanLevelSet(string name) => patch_Dialog.CleanLevelSet(name); diff --git a/Celeste.Mod.mm/Patches/GameplayRenderer.cs b/Celeste.Mod.mm/Patches/GameplayRenderer.cs index 34df4f1d8..194099645 100644 --- a/Celeste.Mod.mm/Patches/GameplayRenderer.cs +++ b/Celeste.Mod.mm/Patches/GameplayRenderer.cs @@ -1,5 +1,6 @@ using Monocle; using MonoMod; +using System; namespace Celeste { class patch_GameplayRenderer : GameplayRenderer { @@ -19,9 +20,7 @@ public override void Render(Scene scene) { } public static class GameplayRendererExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - + [Obsolete("Use GameplayRenderer.RenderDebug instead.")] public static bool RenderDebug { get { return patch_GameplayRenderer.RenderDebug; diff --git a/Celeste.Mod.mm/Patches/HeartGem.cs b/Celeste.Mod.mm/Patches/HeartGem.cs index 9743b80ea..5481267e0 100644 --- a/Celeste.Mod.mm/Patches/HeartGem.cs +++ b/Celeste.Mod.mm/Patches/HeartGem.cs @@ -40,7 +40,7 @@ private IEnumerator CollectRoutine(Player player) { Level level = Scene as Level; bool heartIsEnd = false; - MapMetaModeProperties mapMetaModeProperties = (level != null) ? level.Session.MapData.GetMeta() : null; + MapMetaModeProperties mapMetaModeProperties = (level != null) ? ((patch_MapData) level.Session.MapData).Meta : null; if (mapMetaModeProperties != null && mapMetaModeProperties.HeartIsEnd != null) { heartIsEnd = mapMetaModeProperties.HeartIsEnd.Value; } @@ -65,7 +65,7 @@ private IEnumerator CollectRoutine(Player player) { } private bool IsCompleteArea(bool value) { - MapMetaModeProperties meta = (Scene as Level)?.Session.MapData.GetMeta(); + MapMetaModeProperties meta = ((patch_MapData) (Scene as Level)?.Session.MapData).Meta; if (meta?.HeartIsEnd != null) return meta.HeartIsEnd.Value && !IsFake; diff --git a/Celeste.Mod.mm/Patches/HiresSnow.cs b/Celeste.Mod.mm/Patches/HiresSnow.cs index 06bfca608..04d166b79 100644 --- a/Celeste.Mod.mm/Patches/HiresSnow.cs +++ b/Celeste.Mod.mm/Patches/HiresSnow.cs @@ -18,7 +18,7 @@ public patch_HiresSnow(float overlayAlpha = 0.45f) public void ctor(float overlayAlpha = 0.45f) { // THe vanilla overlay texture has got a 4x4 transparent blob formed by transparent pixels at each corner. MTexture overlay = OVR.Atlas["overlay"]; - if (overlay.Texture.GetMetadata() == null) { + if (((patch_VirtualTexture) (object) overlay.Texture).Metadata == null) { Texture2D texture = overlay.Texture.Texture; if (overlay.ClipRect.X == 0 && overlay.ClipRect.Y == 0 && overlay.ClipRect.Width == texture.Width && overlay.ClipRect.Height == texture.Height) { diff --git a/Celeste.Mod.mm/Patches/Level.cs b/Celeste.Mod.mm/Patches/Level.cs index 01cb1c33d..fc295cd8b 100644 --- a/Celeste.Mod.mm/Patches/Level.cs +++ b/Celeste.Mod.mm/Patches/Level.cs @@ -4,23 +4,23 @@ using Celeste.Mod; using Celeste.Mod.Core; using Celeste.Mod.Entities; +using Celeste.Mod.Helpers; using Celeste.Mod.Meta; using Celeste.Mod.UI; using FMOD.Studio; using Microsoft.Xna.Framework; +using Mono.Cecil; +using Mono.Cecil.Cil; using Monocle; using MonoMod; +using MonoMod.Cil; +using MonoMod.InlineRT; using MonoMod.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using Mono.Cecil; -using Mono.Cecil.Cil; -using MonoMod.Cil; -using MonoMod.InlineRT; -using Celeste.Mod.Helpers; namespace Celeste { class patch_Level : Level { @@ -127,7 +127,7 @@ public ScreenWipe CompleteArea(bool spotlightWipe = true, bool skipScreenWipe = public new void Pause(int startIndex = 0, bool minimal = false, bool quickReset = false) { orig_Pause(startIndex, minimal, quickReset); - if (Entities.GetToAdd().FirstOrDefault(e => e is TextMenu) is TextMenu menu) { + if (((patch_EntityList) (object) Entities).ToAdd.FirstOrDefault(e => e is TextMenu) is patch_TextMenu menu) { void Unpause() { Everest.Events.Level.Unpause(this); } @@ -203,7 +203,7 @@ private IEnumerator TransitionRoutine(LevelData next, Vector2 direction) { if (Session.FirstLevel && Session.StartedFromBeginning && Session.JustStarted && (!(Engine.Scene is LevelLoader loader) || !loader.PlayerIntroTypeOverride.HasValue) && Session.Area.Mode == AreaMode.CSide - && AreaData.GetMode(Session.Area)?.GetMapMeta() is MapMeta mapMeta && (mapMeta.OverrideASideMeta ?? false) + && (AreaData.GetMode(Session.Area) as patch_ModeProperties)?.MapMeta is MapMeta mapMeta && (mapMeta.OverrideASideMeta ?? false) && mapMeta.IntroType is Player.IntroTypes introType) playerIntro = introType; @@ -238,7 +238,7 @@ private AreaMode _PatchHeartGemBehavior(AreaMode levelMode) { return levelMode; } - MapMetaModeProperties properties = Session.MapData.GetMeta(); + MapMetaModeProperties properties = ((patch_MapData) Session.MapData).Meta; if (properties != null && (properties.HeartIsEnd ?? false)) { // heart ends the level: this is like B-Sides. // the heart will appear even if it was collected, to avoid a softlock if we save & quit after collecting it. @@ -514,13 +514,12 @@ private bool CheckForErrors() { public static class LevelExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - internal static EventInstance PauseSnapshot => patch_Level._PauseSnapshot; + [Obsolete("Use Level.SubHudRenderer instead.")] public static SubHudRenderer GetSubHudRenderer(this Level self) => ((patch_Level) self).SubHudRenderer; + [Obsolete("Use Level.SubHudRenderer instead.")] public static void SetSubHudRenderer(this Level self, SubHudRenderer value) => ((patch_Level) self).SubHudRenderer = value; diff --git a/Celeste.Mod.mm/Patches/LevelEnter.cs b/Celeste.Mod.mm/Patches/LevelEnter.cs index 191c04c7c..2722227d2 100644 --- a/Celeste.Mod.mm/Patches/LevelEnter.cs +++ b/Celeste.Mod.mm/Patches/LevelEnter.cs @@ -56,14 +56,14 @@ public static patch_LevelEnter ForceCreate(Session session, bool fromSaveData) { public static bool PlayCustomVignette(Session session, bool fromSaveData) { bool playVignette = !fromSaveData && session.StartedFromBeginning; - AreaData area = AreaData.Get(session); + patch_AreaData area = patch_AreaData.Get(session); MapMetaCompleteScreen screen; MapMetaTextVignette text; - if (playVignette && (screen = area.GetMeta()?.LoadingVignetteScreen) != null && screen.Atlas != null) { + if (playVignette && (screen = area.Meta?.LoadingVignetteScreen) != null && screen.Atlas != null) { Engine.Scene = new CustomScreenVignette(session, meta: screen); return true; - } else if (playVignette && (text = area.GetMeta()?.LoadingVignetteText) != null && text.Dialog != null) { + } else if (playVignette && (text = area.Meta?.LoadingVignetteText) != null && text.Dialog != null) { if (Engine.Scene is not Overworld {Snow: HiresSnow snow}) { snow = null; } @@ -90,9 +90,9 @@ private IEnumerator Routine() { .Replace("((sid))", session.Area.GetSID())); } - AreaData areaData = AreaData.Get(session); - MapMeta areaMeta = areaData.GetMeta(); - if (areaMeta != null && areaData.GetLevelSet() != "Celeste" && + patch_AreaData areaData = patch_AreaData.Get(session); + MapMeta areaMeta = areaData.Meta; + if (areaMeta != null && areaData.LevelSet != "Celeste" && Dialog.Has(areaData.Name + "_postcard") && session.StartedFromBeginning && !fromSaveData && session.Area.Mode == AreaMode.Normal && @@ -171,10 +171,8 @@ public void ctor(Session session) { } public static class LevelEnterExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// + [Obsolete("Use LevelEnter.ErrorMessage instead.")] public static string ErrorMessage { get { return patch_LevelEnter.ErrorMessage; diff --git a/Celeste.Mod.mm/Patches/LevelExit.cs b/Celeste.Mod.mm/Patches/LevelExit.cs index 9d819217f..afa94c78f 100644 --- a/Celeste.Mod.mm/Patches/LevelExit.cs +++ b/Celeste.Mod.mm/Patches/LevelExit.cs @@ -35,7 +35,7 @@ public patch_LevelExit(Mode mode, Session session, HiresSnow snow = null) [MonoModConstructor] public void ctor(Mode mode, Session session, HiresSnow snow = null) { // Restore to metadata of A-Side. - AreaData.Get(session).RestoreASideAreaData(); + patch_AreaData.Get(session).RestoreASideAreaData(); orig_ctor(mode, session, snow); Everest.Events.Level.Exit(Engine.Scene as Level, this, mode, session, snow); @@ -43,9 +43,9 @@ public void ctor(Mode mode, Session session, HiresSnow snow = null) { [MonoModReplace] private void LoadCompleteThread() { - AreaData area = AreaData.Get(session); + patch_AreaData area = patch_AreaData.Get(session); - if ((completeMeta = area.GetMeta()?.CompleteScreen) != null && completeMeta.Atlas != null) { + if ((completeMeta = area.Meta?.CompleteScreen) != null && completeMeta.Atlas != null) { completeAtlas = Atlas.FromAtlas(Path.Combine("Graphics", "Atlases", completeMeta.Atlas), Atlas.AtlasDataFormat.PackerNoAtlas); } else if ((completeXml = area.CompleteScreenXml) != null && completeXml.HasAttr("atlas")) { @@ -65,7 +65,7 @@ private void LoadCompleteThread() { // returns true if there is custom music, false otherwise. private bool playCustomCompleteScreenMusic() { - string[] completeScreenMusic = AreaData.Get(session.Area)?.GetMeta()?.CompleteScreen?.MusicBySide; + string[] completeScreenMusic = patch_AreaData.Get(session.Area)?.Meta?.CompleteScreen?.MusicBySide; if (completeScreenMusic != null && completeScreenMusic.Length > (int) session.Area.Mode) { Audio.SetMusic(completeScreenMusic[(int) session.Area.Mode]); return true; diff --git a/Celeste.Mod.mm/Patches/LevelLoader.cs b/Celeste.Mod.mm/Patches/LevelLoader.cs index 819840242..40c0d0abf 100644 --- a/Celeste.Mod.mm/Patches/LevelLoader.cs +++ b/Celeste.Mod.mm/Patches/LevelLoader.cs @@ -47,7 +47,7 @@ public void ctor(Session session, Vector2? startPosition = default) { } if (CoreModule.Settings.LazyLoading) { - MainThreadHelper.Do(() => VirtualContentExt.UnloadOverworld()); + MainThreadHelper.Do(() => patch_VirtualContent.UnloadOverworld()); } // Vanilla TileToIndex mappings. @@ -84,8 +84,8 @@ public void ctor(Session session, Vector2? startPosition = default) { string path = ""; try { - AreaData area = AreaData.Get(session); - MapMeta meta = area.GetMeta(); + patch_AreaData area = patch_AreaData.Get(session); + MapMeta meta = area.Meta; path = meta?.BackgroundTiles; if (string.IsNullOrEmpty(path)) @@ -124,8 +124,8 @@ public void ctor(Session session, Vector2? startPosition = default) { SpriteData valueMod = kvpBank.Value; if (bankOrig.SpriteData.TryGetValue(key, out SpriteData valueOrig)) { - IDictionary animsOrig = valueOrig.Sprite.GetAnimations(); - IDictionary animsMod = valueMod.Sprite.GetAnimations(); + IDictionary animsOrig = ((patch_Sprite) valueOrig.Sprite).Animations; + IDictionary animsMod = ((patch_Sprite) valueMod.Sprite).Animations; foreach (DictionaryEntry kvpAnim in animsMod) { animsOrig[kvpAnim.Key] = kvpAnim.Value; } diff --git a/Celeste.Mod.mm/Patches/MTN.cs b/Celeste.Mod.mm/Patches/MTN.cs index dfab4a941..7ccb257a7 100644 --- a/Celeste.Mod.mm/Patches/MTN.cs +++ b/Celeste.Mod.mm/Patches/MTN.cs @@ -173,7 +173,7 @@ private static ObjModel loadModelFile(ModAsset asset, string path) { if (ObjModelCache.TryGetValue(path, out ObjModel cached)) { return cached; } - ObjModel loaded = ObjModelExt.CreateFromStream(asset.Stream, path); + ObjModel loaded = patch_ObjModel.CreateFromStream(asset.Stream, path); ObjModelCache[path] = loaded; return loaded; } diff --git a/Celeste.Mod.mm/Patches/Maddy3D.cs b/Celeste.Mod.mm/Patches/Maddy3D.cs index bd81a3880..8ee95a579 100644 --- a/Celeste.Mod.mm/Patches/Maddy3D.cs +++ b/Celeste.Mod.mm/Patches/Maddy3D.cs @@ -12,7 +12,7 @@ public patch_Maddy3D(MountainRenderer renderer) : base(renderer) { } private extern void orig_SetRunAnim(); private void SetRunAnim() { - if (Renderer.Area < 0 || AreaData.Get(Renderer.Area).IsOfficialLevelSet()) { + if (Renderer.Area < 0 || patch_AreaData.Get(Renderer.Area).IsOfficialLevelSet()) { orig_SetRunAnim(); } else if (AreaData.Get(Renderer.Area).Mode[0].Inventory.Dashes > 1) { frames = MTN.Mountain.GetAtlasSubtextures("marker/runNoBackpack"); diff --git a/Celeste.Mod.mm/Patches/MainMenuSmallButton.cs b/Celeste.Mod.mm/Patches/MainMenuSmallButton.cs index 6d13711b0..7ed12969f 100644 --- a/Celeste.Mod.mm/Patches/MainMenuSmallButton.cs +++ b/Celeste.Mod.mm/Patches/MainMenuSmallButton.cs @@ -50,18 +50,22 @@ public static class MainMenuSmallButtonExt { /// /// Get the original label name dialog key. Useful when inserting your own button between others. /// + [Obsolete("Use MainMenuSmallButton.LabelName instead.")] public static string GetLabelName(this MainMenuSmallButton self) => ((patch_MainMenuSmallButton) self).LabelName; /// /// Get the original GUI atlas icon path. Useful when inserting your own button between others. /// + [Obsolete("Use MainMenuSmallButton.IconName instead.")] public static string GetIconName(this MainMenuSmallButton self) => ((patch_MainMenuSmallButton) self).IconName; + [Obsolete("Use MainMenuSmallButton.Ease instead.")] public static float GetEase(this MainMenuSmallButton self) { return ((patch_MainMenuSmallButton) self).Ease; } + [Obsolete("Use MainMenuSmallButton.Wiggler instead.")] public static Wiggler GetWiggler(this MainMenuSmallButton self) { return ((patch_MainMenuSmallButton) self).Wiggler; } diff --git a/Celeste.Mod.mm/Patches/MapData.cs b/Celeste.Mod.mm/Patches/MapData.cs index c6181b96a..fffaecbc9 100644 --- a/Celeste.Mod.mm/Patches/MapData.cs +++ b/Celeste.Mod.mm/Patches/MapData.cs @@ -13,7 +13,7 @@ using MonoMod.Cil; namespace Celeste { - class patch_MapData : MapData { + public class patch_MapData : MapData { public bool DetectedCassette; public int DetectedStrawberriesIncludingUntracked; @@ -26,7 +26,7 @@ class patch_MapData : MapData { public MapMetaModeProperties Meta { get { - MapMeta metaAll = AreaData.Get(Area).GetMeta(); + MapMeta metaAll = patch_AreaData.Get(Area).Meta; return (metaAll?.Modes?.Length ?? 0) > (int) Area.Mode ? metaAll.Modes[(int) Area.Mode] : @@ -65,8 +65,8 @@ private void Load() { } } - AreaData area = AreaData.Get(Area); - AreaData parentArea = AreaDataExt.Get(area.GetMeta()?.Parent); + patch_AreaData area = patch_AreaData.Get(Area); + AreaData parentArea = patch_AreaData.Get(area.Meta?.Parent); ModeProperties parentMode = parentArea?.Mode?.ElementAtOrDefault((int) Area.Mode); if (parentMode != null) { MapData parentMapData = parentMode.MapData; @@ -172,7 +172,7 @@ private BinaryPacker.Element Process(BinaryPacker.Element root) { } private void ProcessMeta(BinaryPacker.Element meta) { - AreaData area = AreaData.Get(Area); + patch_AreaData area = patch_AreaData.Get(Area); AreaMode mode = Area.Mode; if (mode == AreaMode.Normal) { @@ -180,7 +180,7 @@ private void ProcessMeta(BinaryPacker.Element meta) { Area = area.ToKey(); // Backup A-Side's Metadata. Only back up useful data. - area.SetASideAreaDataBackup(new AreaData { + area.ASideAreaDataBackup = new AreaData { IntroType = area.IntroType, ColorGrade = area.ColorGrade, DarknessAlpha = area.DarknessAlpha, @@ -188,7 +188,7 @@ private void ProcessMeta(BinaryPacker.Element meta) { BloomStrength = area.BloomStrength, CoreMode = area.CoreMode, Dreaming = area.Dreaming - }); + }; } BinaryPacker.Element modeMeta = meta.Children?.FirstOrDefault(el => el.Name == "mode"); @@ -200,9 +200,9 @@ private void ProcessMeta(BinaryPacker.Element meta) { // Metadata for B-Side and C-Side are parsed and stored. if (mode != AreaMode.Normal) { MapMeta mapMeta = new MapMeta(meta) { - Modes = area.GetMeta().Modes + Modes = area.Meta.Modes }; - area.Mode[(int) mode].SetMapMeta(mapMeta); + area.Mode[(int) mode].MapMeta = mapMeta; } } @@ -265,18 +265,21 @@ public static class MapDataExt { /// /// Get the mod mode metadata of the map. /// + [Obsolete("Use MapData.Meta instead.")] public static MapMetaModeProperties GetMeta(this MapData self) => ((patch_MapData) self).Meta; /// /// Returns whether the map contains a cassette or not. /// + [Obsolete("Use MapData.DetectedCassette instead.")] public static bool GetDetectedCassette(this MapData self) => ((patch_MapData) self).DetectedCassette; /// /// To be called by the CoreMapDataProcessor when a cassette is detected in a map. /// + [Obsolete("Use MapData.DetectedCassette instead.")] internal static void SetDetectedCassette(this MapData self) { ((patch_MapData) self).DetectedCassette = true; } @@ -284,12 +287,14 @@ internal static void SetDetectedCassette(this MapData self) { /// /// Returns the number of strawberries in the map, including untracked ones (goldens, moons). /// + [Obsolete("Use MapData.DetectedStrawberriesIncludingUntracked instead.")] public static int GetDetectedStrawberriesIncludingUntracked(this MapData self) => ((patch_MapData) self).DetectedStrawberriesIncludingUntracked; /// /// To be called by the CoreMapDataProcessor when processing a map is over, to register the detected berry count. /// + [Obsolete("Use MapData.DetectedStrawberriesIncludingUntracked instead.")] internal static void SetDetectedStrawberriesIncludingUntracked(this MapData self, int count) { ((patch_MapData) self).DetectedStrawberriesIncludingUntracked = count; } @@ -297,6 +302,7 @@ internal static void SetDetectedStrawberriesIncludingUntracked(this MapData self /// /// Returns the list of dashless goldens in the map. /// + [Obsolete("Use MapData.DashlessGoldenBerries instead.")] public static List GetDashlessGoldenberries(this MapData self) => ((patch_MapData) self).DashlessGoldenberries; } diff --git a/Celeste.Mod.mm/Patches/ModeProperties.cs b/Celeste.Mod.mm/Patches/ModeProperties.cs index a81e10ccf..47c0c9ec7 100644 --- a/Celeste.Mod.mm/Patches/ModeProperties.cs +++ b/Celeste.Mod.mm/Patches/ModeProperties.cs @@ -1,18 +1,19 @@ using Celeste.Mod.Meta; +using System; namespace Celeste { public class patch_ModeProperties : ModeProperties { // Store the metadata in the corresponding mode public MapMeta MapMeta; + public new patch_MapData MapData; } public static class ModePropertiesExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - + [Obsolete("Use ModeProperties.MapMeta instead.")] public static MapMeta GetMapMeta(this ModeProperties self) => ((patch_ModeProperties) self).MapMeta; + [Obsolete("Use ModeProperties.MapMeta instead.")] public static void SetMapMeta(this ModeProperties self, MapMeta value) => ((patch_ModeProperties) self).MapMeta = value; } diff --git a/Celeste.Mod.mm/Patches/Monocle/Atlas.cs b/Celeste.Mod.mm/Patches/Monocle/Atlas.cs index 3d5298b45..270330a56 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Atlas.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Atlas.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod; +using System; using System.Collections.Generic; using System.IO; using System.Xml; @@ -40,7 +41,7 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for XmlDocument xmlDoc; VirtualTexture texV; - MTexture texM; + patch_MTexture texM; switch (format) { case AtlasDataFormat.TexturePacker_Sparrow: @@ -50,8 +51,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for break; texV = VirtualContent.CreateTexture(Path.Combine(Path.GetDirectoryName(path), xmlTextureAtlas.Attr("imagePath", ""))); - texM = new MTexture(texV); - texM.SetAtlas(atlas); + texM = new patch_MTexture(texV); + texM.Atlas = atlas; atlas.Sources.Add(texV); XmlNodeList xmlSubs = xmlTextureAtlas.GetElementsByTagName("SubTexture"); @@ -79,8 +80,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for foreach (XmlElement xmlAtlasSource in xmlAtlas) { texV = VirtualContent.CreateTexture(Path.Combine(Path.GetDirectoryName(path), xmlAtlasSource.Attr("n", "") + ".png")); - texM = new MTexture(texV); - texM.SetAtlas(atlas); + texM = new patch_MTexture(texV); + texM.Atlas = atlas; atlas.Sources.Add(texV); foreach (XmlElement xmlSub in xmlAtlasSource) { string name = xmlSub.Attr("n"); @@ -107,8 +108,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for short sources = reader.ReadInt16(); for (int i = 0; i < sources; i++) { texV = VirtualContent.CreateTexture(Path.Combine(Path.GetDirectoryName(path), reader.ReadNullTerminatedString() + ".png")); - texM = new MTexture(texV); - texM.SetAtlas(atlas); + texM = new patch_MTexture(texV); + texM.Atlas = atlas; atlas.Sources.Add(texV); short subs = reader.ReadInt16(); for (int j = 0; j < subs; j++) { @@ -160,8 +161,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for short width = reader.ReadInt16(); short height = reader.ReadInt16(); texV = VirtualContent.CreateTexture(Path.Combine(sourcePath, name + ".png")); - texM = atlas.textures[name] = new MTexture(texV, new Vector2(-offsX, -offsY), width, height); - texM.SetAtlas(atlas); + atlas.textures[name] = texM = new patch_MTexture(texV, new Vector2(-offsX, -offsY), width, height); + texM.Atlas = atlas; atlas.Sources.Add(texV); } } @@ -180,8 +181,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for short sources = reader.ReadInt16(); for (int i = 0; i < sources; i++) { texV = VirtualContent.CreateTexture(Path.Combine(Path.GetDirectoryName(path), reader.ReadString() + ".data")); - texM = new MTexture(texV); - texM.SetAtlas(atlas); + texM = new patch_MTexture(texV); + texM.Atlas = atlas; atlas.Sources.Add(texV); short subs = reader.ReadInt16(); for (int j = 0; j < subs; j++) { @@ -236,8 +237,8 @@ private static void ReadAtlasData(Atlas _atlas, string path, AtlasDataFormat for short width = reader.ReadInt16(); short height = reader.ReadInt16(); texV = VirtualContent.CreateTexture(Path.Combine(sourcePath, name + ".data")); - texM = atlas.textures[name] = new MTexture(texV, new Vector2(-offsX, -offsY), width, height); - texM.SetAtlas(atlas); + atlas.textures[name] = texM = new patch_MTexture(texV, new Vector2(-offsX, -offsY), width, height); + texM.Atlas = atlas; texM.AtlasPath = name; atlas.Sources.Add(texV); } @@ -375,14 +376,14 @@ public void Ingest(ModAsset asset) { if (textures.TryGetValue(path, out MTexture mtex)) { Logger.Log(LogLevel.Verbose, "Atlas.Ingest", $"{Path.GetFileName(DataPath)} + ({asset.Source?.Name ?? "???"}) {path}"); - mtex.SetOverride(asset); + ((patch_MTexture) mtex).SetOverride(asset); this[path] = mtex; return; } VirtualTexture vtex; try { - vtex = VirtualContentExt.CreateTexture(asset); + vtex = patch_VirtualContent.CreateTexture(asset); } catch { // The game is going to crash from this. Log the offending texture to make debugging easier. Logger.Log(LogLevel.Error, "Atlas.Ingest", $"Error while loading texture {path} ({asset.Source?.Name ?? "???"}) into atlas {Path.GetFileName(DataPath)}"); @@ -401,8 +402,8 @@ public void Ingest(ModAsset asset) { mtex = new MTexture(vtex); } mtex.AtlasPath = path; - mtex.SetAtlas(this); - mtex.SetOverride(asset); + ((patch_MTexture) mtex).Atlas = this; + ((patch_MTexture) mtex).SetOverride(asset); this[path] = mtex; Sources.Add(vtex); } @@ -478,45 +479,49 @@ public bool HasAtlasSubtexturesAt(string key, int index) { } public static class AtlasExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Get the internal string-MTexture dictionary. /// + [Obsolete("Use Atlas.Textures instead.")] public static Dictionary GetTextures(this Atlas self) => ((patch_Atlas) self).Textures; /// /// Get the method with which this atlas was loaded. /// + [Obsolete("Use Atlas.DataMethod instead.")] public static string GetDataMethod(this Atlas self) => ((patch_Atlas) self).DataMethod; /// /// Get the path from which this atlas was loaded. /// + [Obsolete("Use Atlas.DataPath instead.")] public static string GetDataPath(this Atlas self) => ((patch_Atlas) self).DataPath; /// /// If the atlas was loaded with FromMultiAtlas, get the paths from which this atlas was loaded. /// + [Obsolete("Use Atlas.DataPaths instead.")] public static string[] GetDataPaths(this Atlas self) => ((patch_Atlas) self).DataPaths; /// /// Get the atlas data format, or none in case of directory atlases. /// + [Obsolete("Use Atlas.DataFormat instead.")] public static Atlas.AtlasDataFormat? GetDataFormat(this Atlas self) => ((patch_Atlas) self).DataFormat; + [Obsolete("Use Atlas.ResetCaches instead.")] public static void ResetCaches(this Atlas self) => ((patch_Atlas) self).ResetCaches(); /// /// Feed the given ModAsset into the atlas. /// + [Obsolete("Use Atlas.Ingest instead.")] public static void Ingest(this Atlas self, ModAsset asset) => ((patch_Atlas) self).Ingest(asset); diff --git a/Celeste.Mod.mm/Patches/Monocle/Commands.cs b/Celeste.Mod.mm/Patches/Monocle/Commands.cs index 6dc1dca5f..6cedc0710 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Commands.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Commands.cs @@ -246,7 +246,7 @@ private void HandleKey(Keys key) { // SID matching tabPrefix = currentText.Substring(0, 5); string startOfSid = currentText.Substring(5); - tabResults = AreaData.Areas.Select(area => area.GetSID()).Where(sid => sid.StartsWith(startOfSid, StringComparison.InvariantCultureIgnoreCase)).ToArray(); + tabResults = patch_AreaData.Areas.Select(area => area.SID).Where(sid => sid.StartsWith(startOfSid, StringComparison.InvariantCultureIgnoreCase)).ToArray(); } else { // command matching tabPrefix = ""; diff --git a/Celeste.Mod.mm/Patches/Monocle/Coroutine.cs b/Celeste.Mod.mm/Patches/Monocle/Coroutine.cs index 3db5ca060..1a5dcd1d8 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Coroutine.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Coroutine.cs @@ -58,10 +58,8 @@ public override void Update() { } public static class CoroutineExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// + [Obsolete("Use Coroutine.Jump instead.")] public static void Jump(this Coroutine self) => ((patch_Coroutine) self).Jump(); diff --git a/Celeste.Mod.mm/Patches/Monocle/Engine.cs b/Celeste.Mod.mm/Patches/Monocle/Engine.cs index 4f2bb2a9f..75eed3e83 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Engine.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Engine.cs @@ -73,9 +73,6 @@ private static float GetTimeRateComponentMultiplier(Scene scene) { } public static class EngineExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - public static int ViewWidth { get { return Engine.ViewWidth; diff --git a/Celeste.Mod.mm/Patches/Monocle/EntityList.cs b/Celeste.Mod.mm/Patches/Monocle/EntityList.cs index 8e6bab233..028541c43 100644 --- a/Celeste.Mod.mm/Patches/Monocle/EntityList.cs +++ b/Celeste.Mod.mm/Patches/Monocle/EntityList.cs @@ -1,13 +1,13 @@ #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value -using System; -using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod; using MonoMod.Cil; using MonoMod.InlineRT; using MonoMod.Utils; +using System; +using System.Collections.Generic; namespace Monocle { // No public constructors. @@ -36,12 +36,10 @@ internal void ClearEntities() { } public static class EntityListExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Get the list of entities which are about to get added. /// + [Obsolete("Use EntityList.ToAdd instead.")] public static List GetToAdd(this EntityList self) => ((patch_EntityList) (object) self).ToAdd; diff --git a/Celeste.Mod.mm/Patches/Monocle/MTexture.cs b/Celeste.Mod.mm/Patches/Monocle/MTexture.cs index 302ef90bb..9dd0ad484 100644 --- a/Celeste.Mod.mm/Patches/Monocle/MTexture.cs +++ b/Celeste.Mod.mm/Patches/Monocle/MTexture.cs @@ -44,6 +44,14 @@ public Atlas Atlas { private List _ModAssets; + [MonoModIgnore] + public patch_MTexture(VirtualTexture vtex) + : base(vtex) { } + + [MonoModIgnore] + public patch_MTexture(VirtualTexture vtex, Vector2 offset, int width, int height) + : base(vtex, offset, width, height) { } + // Patching constructors is ugly. public extern void orig_ctor(patch_MTexture parent, int x, int y, int width, int height); [MonoModConstructor] @@ -92,7 +100,7 @@ public void SetOverride(VirtualTexture texture, Vector2 drawOffset, int frameWid /// Override the given MTexture with the given mod asset. /// public void SetOverride(ModAsset asset) { - if (!_HasOrig && Texture.GetMetadata() == asset) { + if (!_HasOrig && ((patch_VirtualTexture) (object) Texture).Metadata == asset) { Metadata = asset; asset.Targets.Add(this); return; @@ -107,7 +115,7 @@ public void SetOverride(ModAsset asset) { asset.Targets.Add(this); } - VirtualTexture vtex = VirtualContentExt.CreateTexture(asset); + VirtualTexture vtex = patch_VirtualContent.CreateTexture(asset); MTextureMeta meta = asset.GetMeta(); if (meta != null) { @@ -158,8 +166,8 @@ public void UndoOverride() { /// public void UndoOverride(ModAsset asset) { if (asset == Metadata) { - Atlas atlas = Atlas; - if (atlas != null && atlas.GetTextures().ContainsValue(this)) { + patch_Atlas atlas = (patch_Atlas) Atlas; + if (atlas != null && atlas.Textures.ContainsValue(this)) { // TODO: Delayed removal - allow other textures to overwrite THIS ALREADY REFERENCED OBJECT before loosening it. /* atlas.ResetCaches(); @@ -809,37 +817,45 @@ public float ScaleFix { } public static class MTextureExt { + [Obsolete("Use MTexture.Atlas instead.")] public static void SetAtlas(this MTexture self, Atlas atlas) => ((patch_MTexture) self).Atlas = atlas; + [Obsolete("Use MTexture.Atlas instead.")] public static Atlas GetAtlas(this MTexture self) => ((patch_MTexture) self).Atlas; /// + [Obsolete("Use MTexture.SetOverride instead.")] public static void SetOverride(this MTexture self, VirtualTexture texture, Vector2 drawOffset, int frameWidth, int frameHeight) => ((patch_MTexture) self).SetOverride(texture, drawOffset, frameWidth, frameHeight); /// + [Obsolete("Use MTexture.SetOverride instead.")] public static void SetOverride(this MTexture self, ModAsset asset) => ((patch_MTexture) self).SetOverride(asset); /// + [Obsolete("Use MTexture.UndoOverride instead.")] public static void UndoOverride(this MTexture self) => ((patch_MTexture) self).UndoOverride(); /// + [Obsolete("Use MTexture.UndoOverride instead.")] public static void UndoOverride(this MTexture self, ModAsset asset) => ((patch_MTexture) self).UndoOverride(asset); /// /// Gets the parent texture of the given MTexture. /// + [Obsolete("Use MTexture.Parent instead.")] public static MTexture GetParent(this MTexture self) => ((patch_MTexture) self).Parent; /// /// Sets the parent texture of the given MTexture. /// + [Obsolete("Use MTexture.Parent instead.")] public static void SetParent(this MTexture self, MTexture parent) => ((patch_MTexture) self).Parent = (patch_MTexture) parent; diff --git a/Celeste.Mod.mm/Patches/Monocle/RendererList.cs b/Celeste.Mod.mm/Patches/Monocle/RendererList.cs index 3f95fe430..4f04a5799 100644 --- a/Celeste.Mod.mm/Patches/Monocle/RendererList.cs +++ b/Celeste.Mod.mm/Patches/Monocle/RendererList.cs @@ -1,4 +1,5 @@ using MonoMod; +using System; namespace Monocle { class patch_RendererList { @@ -6,21 +7,19 @@ class patch_RendererList { // We're effectively in RendererList, but still need to "expose" private fields to our mod. [MonoModIgnore] - internal extern void UpdateLists(); - public void _UpdateLists() - => UpdateLists(); + [MonoModPublic] + [MonoModLinkFrom("System.Void Monocle.RendererList::_UpdateLists()")] + public extern void UpdateLists(); } public static class RendererListExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Update the renderer lists - apply any pending additions or removals. /// + [Obsolete("Use RendererList.UpdateLists instead.")] public static void UpdateLists(this RendererList self) - => ((patch_RendererList) (object) self)._UpdateLists(); + => ((patch_RendererList) (object) self).UpdateLists(); } } diff --git a/Celeste.Mod.mm/Patches/Monocle/Sprite.cs b/Celeste.Mod.mm/Patches/Monocle/Sprite.cs index 2122e5d75..4c51101d0 100644 --- a/Celeste.Mod.mm/Patches/Monocle/Sprite.cs +++ b/Celeste.Mod.mm/Patches/Monocle/Sprite.cs @@ -1,6 +1,7 @@ #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value using MonoMod; +using System; using System.Collections.Generic; namespace Monocle { @@ -27,6 +28,7 @@ public class Animation { } public static class SpriteExt { + [Obsolete("Use Sprite.Animations instead.")] public static Dictionary GetAnimations(this Sprite self) => ((patch_Sprite) self).Animations; diff --git a/Celeste.Mod.mm/Patches/Monocle/SpriteBank.cs b/Celeste.Mod.mm/Patches/Monocle/SpriteBank.cs index 3e568076f..3103f7b4e 100644 --- a/Celeste.Mod.mm/Patches/Monocle/SpriteBank.cs +++ b/Celeste.Mod.mm/Patches/Monocle/SpriteBank.cs @@ -2,6 +2,7 @@ using Celeste.Mod; using MonoMod; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -197,12 +198,10 @@ private static List getChildElements(XmlNode node) { } public static class SpriteBankExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Get the path to the file from which the SpriteBank was loaded. /// + [Obsolete("Use SpriteBank.XMLPath instead.")] public static string GetXMLPath(this SpriteBank self) => ((patch_SpriteBank) self).XMLPath; diff --git a/Celeste.Mod.mm/Patches/Monocle/VirtualAsset.cs b/Celeste.Mod.mm/Patches/Monocle/VirtualAsset.cs index 843b7a1fd..8c4dc7f62 100644 --- a/Celeste.Mod.mm/Patches/Monocle/VirtualAsset.cs +++ b/Celeste.Mod.mm/Patches/Monocle/VirtualAsset.cs @@ -1,14 +1,17 @@ using MonoMod; +using System; namespace Monocle { // This is only required as VirtualAsset's members are internal or even private, not protected. // Noel or Matt, if you see this, please change the visibility to protected. Thanks! [MonoModIgnore] - abstract class patch_VirtualAsset { + abstract class patch_VirtualAsset : VirtualAsset { +#pragma warning disable CS0108 public string Name { get; internal set; } public int Width { get; internal set; } public int Height { get; internal set; } +# pragma warning restore CS0108 internal virtual void Unload() { } @@ -19,13 +22,11 @@ internal virtual void Reload() { } public static class VirtualAssetExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// Unloads a virtual asset without removing it from the virtual asset list. /// /// The asset to unload. + [Obsolete("Use VirtualAsset.Unload instead.")] public static void Unload(this VirtualAsset self) => ((patch_VirtualAsset) (object) self).Unload(); @@ -33,6 +34,7 @@ public static void Unload(this VirtualAsset self) /// Reloads a single virtual asset. /// /// The asset to reload. + [Obsolete("Use VirtualAsset.Reload instead.")] public static void Reload(this VirtualAsset self) => ((patch_VirtualAsset) (object) self).Reload(); diff --git a/Celeste.Mod.mm/Patches/Monocle/VirtualContent.cs b/Celeste.Mod.mm/Patches/Monocle/VirtualContent.cs index b47ccc1e5..4fe524887 100644 --- a/Celeste.Mod.mm/Patches/Monocle/VirtualContent.cs +++ b/Celeste.Mod.mm/Patches/Monocle/VirtualContent.cs @@ -4,6 +4,7 @@ using Celeste.Mod; using Microsoft.Xna.Framework.Graphics; using MonoMod; +using System; using System.Collections.Generic; using System.IO; @@ -52,14 +53,14 @@ public static VirtualTexture CreateTexture(ModAsset metadata) { } [MonoModIgnore] - internal static extern void Reload(); - public static void _Reload() - => Reload(); + [MonoModPublic] + [MonoModLinkFrom("System.Void Monocle.VirtualContent::_Reload()")] + public static extern void Reload(); [MonoModIgnore] - internal static extern void Unload(); - public static void _Unload() - => Unload(); + [MonoModPublic] + [MonoModLinkFrom("System.Void Monocle.VirtualContent::_Unload()")] + public static extern void Unload(); /// /// Forcibly unload and reload all content. @@ -73,9 +74,9 @@ public static void ForceReload() { /// Unload all overworld-related content. /// public static void UnloadOverworld() { - foreach (VirtualAsset asset in assets) { + foreach (patch_VirtualAsset asset in assets) { string path = asset.Name.Replace('\\', '/'); - if (asset is VirtualTexture && path.StartsWith("Graphics/Atlases/")) { + if (asset is patch_VirtualTexture && path.StartsWith("Graphics/Atlases/")) { path = path.Substring(17); if (path.StartsWith("Opening") || path.StartsWith("Overworld") || path.StartsWith("Mountain") || path.StartsWith("Journal")) { asset.Unload(); @@ -87,33 +88,36 @@ public static void UnloadOverworld() { } public static class VirtualContentExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// + [Obsolete("Use VirtualContent.Assets instead.")] public static List Assets => patch_VirtualContent.Assets; /// + [Obsolete("Use VirtualContent.CreateTexture instead.")] public static VirtualTexture CreateTexture(ModAsset metadata) => patch_VirtualContent.CreateTexture(metadata); /// /// Reload all content. /// + [Obsolete("Use VirtualContent.Reload instead.")] public static void Reload() - => patch_VirtualContent._Reload(); + => patch_VirtualContent.Reload(); /// /// Unload all content. /// + [Obsolete("Use VirtualContent.Unload instead.")] public static void Unload() - => patch_VirtualContent._Unload(); + => patch_VirtualContent.Unload(); /// + [Obsolete("Use VirtualContent.ForceReload instead.")] public static void ForceReload() => patch_VirtualContent.ForceReload(); /// + [Obsolete("Use VirtualContent.UnloadOverworld instead.")] public static void UnloadOverworld() => patch_VirtualContent.UnloadOverworld(); diff --git a/Celeste.Mod.mm/Patches/Monocle/VirtualTexture.cs b/Celeste.Mod.mm/Patches/Monocle/VirtualTexture.cs index cd2a3a893..d861d4acb 100644 --- a/Celeste.Mod.mm/Patches/Monocle/VirtualTexture.cs +++ b/Celeste.Mod.mm/Patches/Monocle/VirtualTexture.cs @@ -883,18 +883,17 @@ private static int SwapEndian(int data) { } public static class VirtualTextureExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// /// If the VirtualTexture originates from a mod, get the mod asset metadata. /// + [Obsolete("Use VirtualTexture.Metadata instead.")] public static ModAsset GetMetadata(this VirtualTexture self) => ((patch_VirtualTexture) (object) self).Metadata; /// /// Set a fallback texture in case the texture becomes unavailable on reload. /// + [Obsolete("Use VirtualTexture.Fallback instead.")] public static void SetFallback(this VirtualTexture self, VirtualTexture fallback) => ((patch_VirtualTexture) (object) self).Fallback = fallback; diff --git a/Celeste.Mod.mm/Patches/MountainRenderer.cs b/Celeste.Mod.mm/Patches/MountainRenderer.cs index ba088388b..402731bf0 100644 --- a/Celeste.Mod.mm/Patches/MountainRenderer.cs +++ b/Celeste.Mod.mm/Patches/MountainRenderer.cs @@ -27,8 +27,8 @@ public float EaseCamera(int area, MountainCamera transform, float? duration = nu [PatchMountainRendererUpdate] public extern void orig_Update(Scene scene); public override void Update(Scene scene) { - AreaData area = -1 < Area && Area < (AreaData.Areas?.Count ?? 0) ? AreaData.Get(Area) : null; - MapMeta meta = area?.GetMeta(); + patch_AreaData area = -1 < Area && Area < (AreaData.Areas?.Count ?? 0) ? patch_AreaData.Get(Area) : null; + MapMeta meta = area?.Meta; bool wasFreeCam = inFreeCameraDebugMode; diff --git a/Celeste.Mod.mm/Patches/ObjModel.cs b/Celeste.Mod.mm/Patches/ObjModel.cs index 92dd7aa72..399593ceb 100644 --- a/Celeste.Mod.mm/Patches/ObjModel.cs +++ b/Celeste.Mod.mm/Patches/ObjModel.cs @@ -169,10 +169,8 @@ private bool ResetVertexBuffer() { public static class ObjModelExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - /// + [Obsolete("Use ObjModel.CreateFromStream instead.")] public static ObjModel CreateFromStream(Stream stream, string fname) { return patch_ObjModel.CreateFromStream(stream, fname); } diff --git a/Celeste.Mod.mm/Patches/OuiChapterPanel.cs b/Celeste.Mod.mm/Patches/OuiChapterPanel.cs index 76a91c618..ad63e73d7 100644 --- a/Celeste.Mod.mm/Patches/OuiChapterPanel.cs +++ b/Celeste.Mod.mm/Patches/OuiChapterPanel.cs @@ -3,18 +3,17 @@ using Celeste.Mod.UI; using Microsoft.Xna.Framework; +using Mono.Cecil; +using Mono.Cecil.Cil; using Monocle; using MonoMod; +using MonoMod.Cil; +using MonoMod.InlineRT; +using MonoMod.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using Mono.Cecil; -using Mono.Cecil.Cil; -using MonoMod.Cil; -using MonoMod.InlineRT; -using MonoMod.Utils; -using Celeste.Mod; namespace Celeste { class patch_OuiChapterPanel : OuiChapterPanel { @@ -56,7 +55,7 @@ private Option AddRemixButton() { internal static string _GetCheckpointPreviewName(AreaKey area, string level) { int split = level?.IndexOf('|') ?? -1; if (split >= 0) { - area = AreaDataExt.Get(level.Substring(0, split))?.ToKey(area.Mode) ?? area; + area = patch_AreaData.Get(level.Substring(0, split))?.ToKey(area.Mode) ?? area; level = level.Substring(split + 1); } @@ -81,8 +80,8 @@ public override bool IsStart(Overworld overworld, Overworld.StartMode start) { } if (start == Overworld.StartMode.AreaComplete || start == Overworld.StartMode.AreaQuit) { - AreaData area = AreaData.Get(SaveData.Instance.LastArea.ID); - area = AreaDataExt.Get(area?.GetMeta()?.Parent) ?? area; + patch_AreaData area = patch_AreaData.Get(SaveData.Instance.LastArea.ID); + area = patch_AreaData.Get(area?.Meta?.Parent) ?? area; if (area != null) SaveData.Instance.LastArea.ID = area.ID; } @@ -151,14 +150,14 @@ private static HashSet _GetCheckpoints(SaveData save, AreaKey area) { HashSet set; - AreaData areaData = AreaData.Areas[area.ID]; + patch_AreaData areaData = patch_AreaData.Areas[area.ID]; ModeProperties mode = areaData.Mode[(int) area.Mode]; if (save.DebugMode || save.CheatMode) { set = new HashSet(); if (mode.Checkpoints != null) - foreach (CheckpointData cp in mode.Checkpoints) - set.Add($"{(AreaData.Get(cp.GetArea()) ?? areaData).GetSID()}|{cp.Level}"); + foreach (patch_CheckpointData cp in mode.Checkpoints) + set.Add($"{(patch_AreaData.Get(cp.Area) ?? areaData).SID}|{cp.Level}"); return set; } @@ -173,15 +172,15 @@ private static HashSet _GetCheckpoints(SaveData save, AreaKey area) { } set.RemoveWhere((string a) => !mode.Checkpoints.Any((CheckpointData b) => b.Level == a)); - AreaData[] subs = AreaData.Areas.Where(other => - other.GetMeta()?.Parent == areaData.GetSID() && + AreaData[] subs = patch_AreaData.Areas.Where(other => + other.Meta?.Parent == areaData.SID && other.HasMode(area.Mode) ).ToArray(); return new HashSet(set.Select(s => { - foreach (AreaData sub in subs) { + foreach (patch_AreaData sub in subs) { foreach (CheckpointData cp in sub.Mode[(int) area.Mode].Checkpoints) { if (cp.Level == s) { - return $"{sub.GetSID()}|{s}"; + return $"{sub.SID}|{s}"; } } } @@ -193,7 +192,7 @@ private static HashSet _GetCheckpoints(SaveData save, AreaKey area) { private IEnumerator StartRoutine(string checkpoint = null) { int checkpointAreaSplit = checkpoint?.IndexOf('|') ?? -1; if (checkpointAreaSplit >= 0) { - Area = AreaDataExt.Get(checkpoint.Substring(0, checkpointAreaSplit))?.ToKey(Area.Mode) ?? Area; + Area = patch_AreaData.Get(checkpoint.Substring(0, checkpointAreaSplit))?.ToKey(Area.Mode) ?? Area; checkpoint = checkpoint.Substring(checkpointAreaSplit + 1); } @@ -209,7 +208,7 @@ private IEnumerator StartRoutine(string checkpoint = null) { Audio.SetAmbience(null); // TODO: Determine if the area should keep the overworld snow. if ((Area.ID == 0 || Area.ID == 9) && checkpoint == null && Area.Mode == AreaMode.Normal) { - Overworld.RendererList.UpdateLists(); + ((patch_RendererList) (object) Overworld.RendererList).UpdateLists(); Overworld.RendererList.MoveToFront(Overworld.Snow); } yield return 0.5f; @@ -236,7 +235,7 @@ private void DrawCheckpoint(Vector2 center, Option option, int checkpointIndex) CheckpointData cp = mode.Checkpoints[i]; if (option.CheckpointLevelName == cp.Level - || option.CheckpointLevelName == $"{(AreaData.Get(cp.GetArea()) ?? areaData).GetSID()}|{cp.Level}") { + || option.CheckpointLevelName == $"{((patch_AreaData) (AreaData.Get(((patch_CheckpointData) cp).Area) ?? areaData)).SID}|{cp.Level}") { checkpointIndex = i + 1; break; @@ -253,7 +252,7 @@ private static List getAllCheckpoints(AreaKey area) { List filteredList = new List(); if (mode.Checkpoints != null) foreach (CheckpointData cp in mode.Checkpoints) - filteredList.Add($"{(AreaData.Get(cp.GetArea()) ?? areaData).GetSID()}|{cp.Level}"); + filteredList.Add($"{((patch_AreaData) (AreaData.Get(((patch_CheckpointData) cp).Area) ?? areaData)).SID}|{cp.Level}"); return filteredList; } @@ -267,7 +266,7 @@ private string _ModAreaselectTexture(string textureName) { } // If none are found, fall back to levelset textures. - string levelSet = SaveData.Instance?.GetLevelSet() ?? "Celeste"; + string levelSet = patch_SaveData.Instance?.LevelSet ?? "Celeste"; string levelSetTextureName = textureName.Replace("areaselect/", $"areaselect/{levelSet}/"); if (GFX.Gui.Has(levelSetTextureName)) { textureName = levelSetTextureName; @@ -288,7 +287,7 @@ private string _ModMenuTexture(string textureName) { } // If none are found, fall back to levelset textures. - string levelSet = SaveData.Instance?.GetLevelSet() ?? "Celeste"; + string levelSet = ((patch_SaveData) SaveData.Instance)?.LevelSet ?? "Celeste"; string levelSetTextureName = textureName.Replace("menu/", $"menu/{levelSet}/"); if (GFX.Gui.Has(levelSetTextureName)) { textureName = levelSetTextureName; diff --git a/Celeste.Mod.mm/Patches/OuiChapterSelect.cs b/Celeste.Mod.mm/Patches/OuiChapterSelect.cs index b8d253c87..bd605e65c 100644 --- a/Celeste.Mod.mm/Patches/OuiChapterSelect.cs +++ b/Celeste.Mod.mm/Patches/OuiChapterSelect.cs @@ -18,7 +18,7 @@ class patch_OuiChapterSelect : OuiChapterSelect { // We're effectively in OuiTitleScreen, but still need to "expose" private fields to our mod. [MonoModIgnore] // This property defines its own getter and setter - don't accidentally replace them. private int area { get; set; } - private List icons; + private List icons; private int indexToSnap; private const int scarfSegmentSize = 2; // We can't change consts. private MTexture scarf; @@ -45,9 +45,9 @@ public override void Added(Scene scene) { SaveData save = SaveData.Instance; for (int i = icons.Count - 1; i > -1; --i) { OuiChapterSelectIcon icon = icons[i]; - AreaData area = AreaData.Get(icon.Area); + patch_AreaData area = patch_AreaData.Get(icon.Area); - if (!string.IsNullOrEmpty(area?.GetMeta()?.Parent)) { + if (!string.IsNullOrEmpty(area?.Meta?.Parent)) { icons[i].Area = -1; icons[i].Hide(); continue; @@ -56,7 +56,7 @@ public override void Added(Scene scene) { } private void GetMinMaxArea(out int areaOffs, out int areaMax) { - int areaOffsRaw = SaveData.Instance.GetLevelSetStats().AreaOffset; + int areaOffsRaw = patch_SaveData.Instance.LevelSetStats.AreaOffset; int areaMaxRaw = Math.Max(areaOffsRaw, SaveData.Instance.UnlockedAreas); do { @@ -74,16 +74,16 @@ private void GetMinMaxArea(out int areaOffs, out int areaMax) { [MonoModReplace] private void EaseCamera() { - AreaData areaData = AreaData.Areas[area]; - Overworld.Mountain.EaseCamera(area, areaData.MountainIdle, null, true, areaData.GetMeta()?.Mountain?.Rotate ?? areaData.GetLevelSet() == "Celeste" && area == 10); + patch_AreaData areaData = patch_AreaData.Areas[area]; + Overworld.Mountain.EaseCamera(area, areaData.MountainIdle, null, true, areaData.Meta?.Mountain?.Rotate ?? areaData.LevelSet == "Celeste" && area == 10); Overworld.Mountain.Model.EaseState(areaData.MountainState); } public extern bool orig_IsStart(Overworld overworld, Overworld.StartMode start); public override bool IsStart(Overworld overworld, Overworld.StartMode start) { if (start == Overworld.StartMode.AreaComplete || start == Overworld.StartMode.AreaQuit) { - AreaData area = AreaData.Get(SaveData.Instance.LastArea.ID); - area = AreaDataExt.Get(area?.GetMeta()?.Parent) ?? area; + patch_AreaData area = patch_AreaData.Get(SaveData.Instance.LastArea.ID); + area = patch_AreaData.Get(area?.Meta?.Parent) ?? area; if (area != null) SaveData.Instance.LastArea.ID = area.ID; } @@ -102,7 +102,7 @@ public override IEnumerator Enter(Oui from) { EaseCamera(); display = true; - currentLevelSet = SaveData.Instance?.GetLevelSet() ?? "Celeste"; + currentLevelSet = patch_SaveData.Instance?.LevelSet ?? "Celeste"; journalEnabled = string.IsNullOrEmpty(currentLevelSet) || Celeste.PlayMode == Celeste.PlayModes.Debug || (SaveData.Instance?.CheatMode ?? false); for (int i = 0; i <= SaveData.Instance.UnlockedAreas && !journalEnabled; i++) @@ -121,8 +121,8 @@ public override IEnumerator Enter(Oui from) { bool isVanilla = currentLevelSet == "Celeste"; foreach (OuiChapterSelectIcon icon in icons) { - AreaData area = AreaData.Get(icon.Area); - if (area == null || area.GetLevelSet() != currentLevelSet) + patch_AreaData area = patch_AreaData.Get(icon.Area); + if (area == null || area.LevelSet != currentLevelSet) continue; int index = area.ToKey().ID; @@ -154,8 +154,8 @@ private IEnumerator EaseOut(Oui next) { bool isVanilla = currentLevelSet == "Celeste"; foreach (OuiChapterSelectIcon icon in icons) { - AreaData area = AreaData.Get(icon.Area); - if (area == null || area.GetLevelSet() != currentLevelSet) + patch_AreaData area = patch_AreaData.Get(icon.Area); + if (area == null || area.LevelSet != currentLevelSet) continue; if (selected != icon) @@ -219,16 +219,16 @@ public override void Update() { if (area > areaMax) { area = areaMax; } - while (area > 0 && icons[area].GetIsHidden()) { + while (area > 0 && icons[area].IsHidden) { area--; } } - if (Input.MenuLeft.Pressed && (area - 1 < 0 || icons[area - 1].GetIsHidden())) { + if (Input.MenuLeft.Pressed && (area - 1 < 0 || icons[area - 1].IsHidden)) { return; } - if (Input.MenuRight.Pressed && (area + 1 >= icons.Count || icons[area + 1].GetIsHidden())) { + if (Input.MenuRight.Pressed && (area + 1 >= icons.Count || icons[area + 1].IsHidden)) { return; } } @@ -280,7 +280,7 @@ public override void Render() { if (levelsetEase > 0f) { Vector2 pos = new Vector2(1920f - 64f * Ease.CubeOut(maplistEase), 1080f - 128f); - string line = DialogExt.CleanLevelSet(currentLevelSet); + string line = patch_Dialog.CleanLevelSet(currentLevelSet); ActiveFont.DrawOutline(line, pos, new Vector2(1f, 0.5f), Vector2.One * 0.7f, Color.White * Ease.CubeOut(maplistEase), 2f, Color.Black * Ease.CubeOut(maplistEase)); Vector2 lineSize = ActiveFont.Measure(line) * 0.7f; Input.GuiDirection(new Vector2(0f, -1f)).DrawCentered(pos + new Vector2(-lineSize.X * 0.5f, -lineSize.Y * 0.5f - 16f), Color.White * Ease.CubeOut(maplistEase), 0.5f); diff --git a/Celeste.Mod.mm/Patches/OuiChapterSelectIcon.cs b/Celeste.Mod.mm/Patches/OuiChapterSelectIcon.cs index ff680ddd8..85b9d3a51 100644 --- a/Celeste.Mod.mm/Patches/OuiChapterSelectIcon.cs +++ b/Celeste.Mod.mm/Patches/OuiChapterSelectIcon.cs @@ -1,9 +1,10 @@ #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value using Monocle; +using System; namespace Celeste { - class patch_OuiChapterSelectIcon : OuiChapterSelectIcon { + public class patch_OuiChapterSelectIcon : OuiChapterSelectIcon { // We're effectively in OuiChapterSelectIcon, but still need to "expose" private fields to our mod. private bool hidden; @@ -20,12 +21,11 @@ public patch_OuiChapterSelectIcon(int area, MTexture front, MTexture back) } public static class OuiChapterSelectIconExt { - // Mods can't access patch_ classes directly. - // We thus expose any new members through extensions. - + [Obsolete("Use OuiChapterSelectIcon.IsHidden instead.")] public static bool GetIsHidden(this OuiChapterSelectIcon self) => ((patch_OuiChapterSelectIcon) self).IsHidden; + [Obsolete("Use OuiChapterSelectIcon.IsHidden instead.")] public static bool GetIsSelected(this OuiChapterSelectIcon self) => ((patch_OuiChapterSelectIcon) self).IsSelected; diff --git a/Celeste.Mod.mm/Patches/OuiFileSelectSlot.cs b/Celeste.Mod.mm/Patches/OuiFileSelectSlot.cs index 5276ae78b..803beed12 100644 --- a/Celeste.Mod.mm/Patches/OuiFileSelectSlot.cs +++ b/Celeste.Mod.mm/Patches/OuiFileSelectSlot.cs @@ -7,17 +7,17 @@ using Celeste.Mod.UI; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; +using Mono.Cecil; +using Mono.Cecil.Cil; using Monocle; using MonoMod; +using MonoMod.Cil; +using MonoMod.InlineRT; +using MonoMod.Utils; using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using Mono.Cecil; -using Mono.Cecil.Cil; -using MonoMod.Cil; -using MonoMod.InlineRT; -using MonoMod.Utils; namespace Celeste { public class patch_OuiFileSelectSlot : OuiFileSelectSlot { @@ -28,6 +28,7 @@ public class patch_OuiFileSelectSlot : OuiFileSelectSlot { public interface ISubmenu { } // We're effectively in OuiFileSelectSlot, but still need to "expose" private fields to our mod. + public new patch_SaveData SaveData; private OuiFileSelect fileSelect; private List