diff --git a/CustomJSONData/HarmonyPatches/CustomBeatmapData/ConvertersCustomify.cs b/CustomJSONData/HarmonyPatches/CustomBeatmapData/ConvertersCustomify.cs index c79c05c..5e17bce 100644 --- a/CustomJSONData/HarmonyPatches/CustomBeatmapData/ConvertersCustomify.cs +++ b/CustomJSONData/HarmonyPatches/CustomBeatmapData/ConvertersCustomify.cs @@ -105,13 +105,43 @@ private static IEnumerable BombNoteConvertV3(IEnumerable ObstacleConvertV3(IEnumerable instructions) { return instructions.ReplaceCtor(_version3, _obstacleDataCtor, _customObstacleDataCtor); + }*/ + + [HarmonyPrefix] + [HarmonyPatch( + typeof(BeatmapDataLoaderVersion3.BeatmapDataLoader.ObstacleConverter), + nameof(BeatmapDataLoaderVersion3.BeatmapDataLoader.ObstacleConverter.Convert))] + private static bool ObstacleConvertV3( + BeatmapDataLoaderVersion3.BeatmapDataLoader.ObstacleConverter __instance, + BeatmapSaveDataVersion3.ObstacleData obstacleSaveData, + ref BeatmapObjectData? __result) + { + float time = __instance.BeatToTime(obstacleSaveData.beat); + float endBeat = obstacleSaveData.beat + obstacleSaveData.duration; + float duration = __instance.BeatToTime(endBeat) - time; + + __result = new CustomObstacleData( + time, +#if !PRE_V1_39_1 + obstacleSaveData.beat, + endBeat, + __instance.BeatToRotation(obstacleSaveData.beat), +#endif + obstacleSaveData.line, + BeatmapDataLoaderVersion3.BeatmapDataLoader.ObstacleConverter.GetNoteLineLayer(obstacleSaveData.layer), + duration, + obstacleSaveData.width, + obstacleSaveData.height, + obstacleSaveData.GetData(), + BeatmapSaveDataHelpers.version3); + return false; } [HarmonyTranspiler]