diff --git a/Assemblies/0Harmony.dll b/Assemblies/0Harmony.dll index fec1d88..f6120e2 100644 Binary files a/Assemblies/0Harmony.dll and b/Assemblies/0Harmony.dll differ diff --git a/Assemblies/CameraPlus.dll b/Assemblies/CameraPlus.dll index dc7bc49..3dc8f9c 100644 Binary files a/Assemblies/CameraPlus.dll and b/Assemblies/CameraPlus.dll differ diff --git a/Harmony/0Harmony.dll b/Harmony/0Harmony.dll index fec1d88..f6120e2 100644 Binary files a/Harmony/0Harmony.dll and b/Harmony/0Harmony.dll differ diff --git a/Source/Main.cs b/Source/Main.cs index f999cb7..f25f720 100755 --- a/Source/Main.cs +++ b/Source/Main.cs @@ -31,65 +31,49 @@ static GameFont GetAdaptedGameFont() return GameFont.Tiny; } - class AdaptedGameFontReplacer : CodeProcessor + // we replace the first "GameFont.Tiny" with our "GetAdaptedGameFont()" + // + [HarmonyTranspiler] + static IEnumerable AdaptedGameFontReplacerPatch(IEnumerable instructions) { bool firstInstruction = true; - - // we replace the first "GameFont.Tiny" with our "GetAdaptedGameFont()" - // - public override List Process(CodeInstruction instruction) + foreach (var instruction in instructions) { - var result = new List(); if (firstInstruction && instruction.opcode == OpCodes.Ldc_I4_0) { var method = AccessTools.Method(typeof(GenMapUI_DrawThingLabel_Patch), "GetAdaptedGameFont"); - var call = new CodeInstruction(OpCodes.Call, method); - result.Add(call); + yield return new CodeInstruction(OpCodes.Call, method); } else - result.Add(instruction); + yield return instruction; firstInstruction = false; - return result; } } - - [HarmonyProcessorFactory] - static HarmonyProcessor AdaptedGameFontReplacerPatch(MethodBase original) - { - var processor = new HarmonyProcessor(); - processor.Add(new AdaptedGameFontReplacer()); - return processor; - } } [HarmonyPatch(typeof(CameraDriver))] [HarmonyPatch("get_CurrentZoom")] static class CameraDriver_get_CurrentZoom_Patch { - class ZoomLerper : CodeProcessor + // Normal values: 12, 13.8, 42, 57 + // + [HarmonyTranspiler] + static IEnumerable LerpCurrentZoom(IEnumerable instructions) { - // Normal values: 12, 13.8, 42, 57 - // - public override List Process(CodeInstruction instruction) + foreach (var instruction in instructions) { if (instruction.opcode == OpCodes.Ldc_R4) { var f = (float)instruction.operand; f = GenMath.LerpDouble(12, 57, 30, 60, f); instruction.operand = f; + yield return instruction; } - return new List() { instruction }; + else + yield return instruction; } } - - [HarmonyProcessorFactory] - static HarmonyProcessor LerpCurrentZoom(MethodBase original) - { - var processor = new HarmonyProcessor(); - processor.Add(new ZoomLerper()); - return processor; - } } [HarmonyPatch(typeof(CameraDriver))] diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index ce28110..cd2cb42 100755 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")]