From 4b63df6494005bd5a8092150cf9067828df5dbca Mon Sep 17 00:00:00 2001 From: Piotrekol <4990365+Piotrekol@users.noreply.github.com> Date: Wed, 1 Dec 2021 20:04:50 +0100 Subject: [PATCH] Fix: currentBpm not scaling with speed changing mods #335 --- plugins/OsuMemoryEventSource/MemoryDataProcessor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/OsuMemoryEventSource/MemoryDataProcessor.cs b/plugins/OsuMemoryEventSource/MemoryDataProcessor.cs index 4702b9bd..3cf67c42 100644 --- a/plugins/OsuMemoryEventSource/MemoryDataProcessor.cs +++ b/plugins/OsuMemoryEventSource/MemoryDataProcessor.cs @@ -43,6 +43,7 @@ public class MemoryDataProcessor : IDisposable private Mods _mods; private PlayMode _playMode = PlayMode.Osu; private int _hitObjectCount = 0; + private double _bpmMultiplier = 1; private IToken _strainsToken; private IToken _firstHitObjectTimeToken; @@ -420,7 +421,7 @@ private void InitLiveTokens() return InterpolatedValues[InterpolatedValueName.liveStarRating].Current; }); CreateLiveToken("isBreakTime", 0, TokenType.Live, "{0}", 0, OsuStatus.All, () => _rawData.PpCalculator?.IsBreakTime(_rawData.PlayTime) ?? false ? 1 : 0); - CreateLiveToken("currentBpm", 0d, TokenType.Live, "{0}", 0d, OsuStatus.All, () => _reversedMapTimingPoints?.FirstOrDefault(t => t.StartTime < _rawData.PlayTime)?.BPM ?? 0d); + CreateLiveToken("currentBpm", 0d, TokenType.Live, "{0}", 0d, OsuStatus.All, () => (_reversedMapTimingPoints?.FirstOrDefault(t => t.StartTime < _rawData.PlayTime)?.BPM ?? 0d) * _bpmMultiplier); JsonSerializerSettings createJsonSerializerSettings(string serializationErrorMessage) => new JsonSerializerSettings @@ -507,6 +508,11 @@ public async Task CreateTokensAsync(IMapSearchResult mapSearchResult, Cancellati _playMode = mapSearchResult.PlayMode ?? PlayMode.Osu; var map = mapSearchResult.BeatmapsFound[0]; _hitObjectCount = map.Circles + map.Sliders + map.Spinners; + _bpmMultiplier = (_mods & Mods.Dt) != 0 + ? 1.5 + : (_mods & Mods.Ht) != 0 + ? 0.75 + : 1; if (!IsMainProcessor) return;