diff options
Diffstat (limited to 'AnodyneArchipelago')
-rw-r--r-- | AnodyneArchipelago/ArchipelagoTreasure.cs | 2 | ||||
-rw-r--r-- | AnodyneArchipelago/Patches/StatePatches.cs | 29 | ||||
-rw-r--r-- | AnodyneArchipelago/Plugin.cs | 2 |
3 files changed, 32 insertions, 1 deletions
diff --git a/AnodyneArchipelago/ArchipelagoTreasure.cs b/AnodyneArchipelago/ArchipelagoTreasure.cs index 90f979c..9074108 100644 --- a/AnodyneArchipelago/ArchipelagoTreasure.cs +++ b/AnodyneArchipelago/ArchipelagoTreasure.cs | |||
@@ -9,7 +9,7 @@ namespace AnodyneArchipelago | |||
9 | { | 9 | { |
10 | private string _location; | 10 | private string _location; |
11 | 11 | ||
12 | public ArchipelagoTreasure(string location, Vector2 pos) : base("item_jump_shoes", pos, 0, -1) | 12 | public ArchipelagoTreasure(string location, Vector2 pos) : base("archipelago", pos, 0, -1) |
13 | { | 13 | { |
14 | _location = location; | 14 | _location = location; |
15 | } | 15 | } |
diff --git a/AnodyneArchipelago/Patches/StatePatches.cs b/AnodyneArchipelago/Patches/StatePatches.cs index c1e03fe..6da5eb5 100644 --- a/AnodyneArchipelago/Patches/StatePatches.cs +++ b/AnodyneArchipelago/Patches/StatePatches.cs | |||
@@ -10,9 +10,24 @@ using static AnodyneSharp.AnodyneGame; | |||
10 | using AnodyneSharp.Drawing; | 10 | using AnodyneSharp.Drawing; |
11 | using System.IO; | 11 | using System.IO; |
12 | using System; | 12 | using System; |
13 | using AnodyneSharp.Resources; | ||
14 | using BepInEx; | ||
15 | using Microsoft.Xna.Framework.Graphics; | ||
16 | using Microsoft.Xna.Framework; | ||
17 | using System.Collections.Generic; | ||
13 | 18 | ||
14 | namespace AnodyneArchipelago.Patches | 19 | namespace AnodyneArchipelago.Patches |
15 | { | 20 | { |
21 | [HarmonyPatch(typeof(AnodyneGame), "LoadContent")] | ||
22 | class AnodyneLoadContentPatch | ||
23 | { | ||
24 | static void Prefix(AnodyneGame __instance) | ||
25 | { | ||
26 | FieldInfo gdmField = typeof(AnodyneGame).GetField("graphics", BindingFlags.NonPublic | BindingFlags.Instance); | ||
27 | Plugin.GraphicsDevice = ((GraphicsDeviceManager)gdmField.GetValue(__instance)).GraphicsDevice; | ||
28 | } | ||
29 | } | ||
30 | |||
16 | [HarmonyPatch(typeof(AnodyneGame), "Update")] | 31 | [HarmonyPatch(typeof(AnodyneGame), "Update")] |
17 | class GameUpdatePatch | 32 | class GameUpdatePatch |
18 | { | 33 | { |
@@ -127,4 +142,18 @@ namespace AnodyneArchipelago.Patches | |||
127 | Plugin.ArchipelagoManager.ActivateGoal(); | 142 | Plugin.ArchipelagoManager.ActivateGoal(); |
128 | } | 143 | } |
129 | } | 144 | } |
145 | |||
146 | [HarmonyPatch(typeof(ResourceManager), nameof(ResourceManager.LoadResources))] | ||
147 | static class LoadResourcesPatch | ||
148 | { | ||
149 | static void Postfix() | ||
150 | { | ||
151 | FileStream filestream = File.OpenRead($"{Paths.GameRootPath}\\Resources\\archipelago.png"); | ||
152 | Texture2D apSprite = Texture2D.FromStream(Plugin.GraphicsDevice, filestream); | ||
153 | |||
154 | FieldInfo texturesField = typeof(ResourceManager).GetField("_textures", BindingFlags.NonPublic | BindingFlags.Static); | ||
155 | Dictionary<string, Texture2D> textures = (Dictionary<string, Texture2D>)texturesField.GetValue(null); | ||
156 | textures["archipelago"] = apSprite; | ||
157 | } | ||
158 | } | ||
130 | } | 159 | } |
diff --git a/AnodyneArchipelago/Plugin.cs b/AnodyneArchipelago/Plugin.cs index 18f0d36..6c1333d 100644 --- a/AnodyneArchipelago/Plugin.cs +++ b/AnodyneArchipelago/Plugin.cs | |||
@@ -3,6 +3,7 @@ using BepInEx; | |||
3 | using BepInEx.NET.Common; | 3 | using BepInEx.NET.Common; |
4 | using HarmonyLib; | 4 | using HarmonyLib; |
5 | using HarmonyLib.Tools; | 5 | using HarmonyLib.Tools; |
6 | using Microsoft.Xna.Framework.Graphics; | ||
6 | using System; | 7 | using System; |
7 | using System.Reflection; | 8 | using System.Reflection; |
8 | 9 | ||
@@ -13,6 +14,7 @@ namespace AnodyneArchipelago | |||
13 | { | 14 | { |
14 | public static Plugin Instance = null; | 15 | public static Plugin Instance = null; |
15 | 16 | ||
17 | public static GraphicsDevice GraphicsDevice = null; | ||
16 | public static Player Player = null; | 18 | public static Player Player = null; |
17 | public static ArchipelagoManager ArchipelagoManager = null; | 19 | public static ArchipelagoManager ArchipelagoManager = null; |
18 | public static bool IsGamePaused = false; | 20 | public static bool IsGamePaused = false; |