Skip to content

Commit

Permalink
Fix: currentBpm not scaling with speed changing mods
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrekol committed Dec 1, 2021
1 parent aed031d commit 4b63df6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/OsuMemoryEventSource/MemoryDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 4b63df6

Please sign in to comment.