Skip to content

Commit

Permalink
Merge pull request #137 from OliBomby/dev
Browse files Browse the repository at this point in the history
Dev update 1.8.0.2
  • Loading branch information
OliBomby authored Dec 13, 2020
2 parents 3de940b + 34313c6 commit 154a644
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 232 deletions.
2 changes: 2 additions & 0 deletions Mapping Tools/Classes/HitsoundStuff/SampleGeneratingArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel;
using Mapping_Tools.Classes.MathUtil;
using Mapping_Tools.Classes.SystemTools;
using Newtonsoft.Json;

namespace Mapping_Tools.Classes.HitsoundStuff {
/// <summary>
Expand Down Expand Up @@ -105,6 +106,7 @@ public double Length {
set => Set(ref length, value);
}

[JsonIgnore]
public int Velocity {
get => (int) Math.Round(Volume * 127);
set => Volume = value / 127d;
Expand Down
187 changes: 0 additions & 187 deletions Mapping Tools/Classes/SpectrumUtil/Waveform.cs

This file was deleted.

8 changes: 5 additions & 3 deletions Mapping Tools/Classes/Tools/MapCleanerStuff/MapCleaner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public static MapCleanerResult CleanMap(BeatmapEditor editor, MapCleanerArgs arg
int objectsResnapped = 0;
int samplesRemoved = 0;

// Collect timeline objects before resnapping, so the timingpoints
// are still valid and the tlo's get the correct hitsounds and offsets.
// Resnapping of the hit objects will move the tlo's aswell
Timeline timeline = beatmap.GetTimeline();

// Collect Kiai toggles and SliderVelocity changes for mania/taiko
List<TimingPoint> kiaiToggles = new List<TimingPoint>();
List<TimingPoint> svChanges = new List<TimingPoint>();
Expand Down Expand Up @@ -93,9 +98,6 @@ public static MapCleanerResult CleanMap(BeatmapEditor editor, MapCleanerArgs arg
UpdateProgressBar(worker, 45);
}

// Collect timeline objects after resnapping
Timeline timeline = beatmap.GetTimeline();

// Make new timingpoints
List<TimingPointsChange> timingPointsChanges = new List<TimingPointsChange>();

Expand Down
68 changes: 36 additions & 32 deletions Mapping Tools/Classes/Tools/PatternGallery/OsuPatternPlacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
double patternTickRate = patternBeatmap.Difficulty["SliderTickRate"].DoubleValue;

// Don't include SV changes if it is based on nothing
bool includeSliderVelocity = patternTiming.Count > 0;
bool includePatternSliderVelocity = patternTiming.Count > 0;

// Avoid including hitsounds if there are no timingpoints to get hitsounds from
bool includeTimingPointHitsounds = IncludeHitsounds && patternTiming.Count > 0;
Expand All @@ -240,22 +240,27 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
// This multiplier is not meant to change SV so this is subtracted from the greenline SV later
double bpmMultiplier = FixTickRate ? patternTickRate / originalTickRate : 1;

// Give new combo to all hit objects which were actually new combo in the pattern
// This code can be put anywhere really
foreach (var ho in patternBeatmap.HitObjects) {
ho.NewCombo = ho.ActualNewCombo && !ho.IsSpinner;
}
// Dont give new combo to all hit objects which were actually new combo in the pattern,
// because it leads to unexpected NC's at the start of patterns.

// Collect Kiai toggles and SliderVelocity changes for mania/taiko
List<TimingPoint> patternKiaiToggles = new List<TimingPoint>();
List<TimingPoint> svChanges = new List<TimingPoint>();
// Collect Kiai toggles
List<TimingPoint> kiaiToggles = new List<TimingPoint>();
bool lastKiai = false;
double lastSV = -100;
foreach (TimingPoint tp in patternTiming.TimingPoints) {
if (tp.Kiai != lastKiai || patternKiaiToggles.Count == 0) {
patternKiaiToggles.Add(tp.Copy());
// If not including the kiai of the pattern, add the kiai of the original map.
// This has to be done because this part of the original map might get deleted.
foreach (TimingPoint tp in IncludeKiai ? patternTiming.TimingPoints : originalTiming.TimingPoints) {
if (tp.Kiai != lastKiai || kiaiToggles.Count == 0) {
kiaiToggles.Add(tp.Copy());
lastKiai = tp.Kiai;
}
}

// Collect SliderVelocity changes for mania/taiko
List<TimingPoint> svChanges = new List<TimingPoint>();
double lastSV = -100;
// If not including the SV of the pattern, add the SV of the original map.
// This has to be done because this part of the original map might get deleted.
foreach (TimingPoint tp in includePatternSliderVelocity ? patternTiming.TimingPoints : originalTiming.TimingPoints) {
if (tp.Uninherited) {
lastSV = -100;
} else {
Expand All @@ -266,6 +271,14 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
}
}

// If not including the SV of the pattern, set the SV of sliders to that of the original beatmap,
// so the pattern will take over the SV of the original beatmap.
if (!includePatternSliderVelocity) {
foreach (var ho in patternBeatmap.HitObjects.Where(ho => ho.IsSlider)) {
ho.SliderVelocity = originalTiming.GetSvAtTime(ho.Time);
}
}

// Get the timeline before moving all objects so it has the correct hitsounds
// Make sure that moving the objects in the pattern moves the timeline objects aswell
// This method is NOT safe to use in beat time
Expand All @@ -288,7 +301,7 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
}
}

foreach (var tp in patternKiaiToggles.Concat(svChanges)) {
foreach (var tp in kiaiToggles.Concat(svChanges)) {
tp.Offset = patternTiming.GetBeatLength(patternStartTime, tp.Offset);
}

Expand Down Expand Up @@ -358,7 +371,8 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
switch (timingOverwriteMode) {
case TimingOverwriteMode.PatternTimingOnly:
// Subtract one from the end time to omit BPM changes right on the end of the part.
inPartRedlines = transformPatternTiming.GetRedlinesInRange(startTime, endTime - 2 * Precision.DOUBLE_EPSILON).ToArray();
inPartRedlines = transformPatternTiming.GetRedlinesInRange(startTime,
Math.Max(startTime, endTime - 2 * Precision.DOUBLE_EPSILON)).ToArray();
startPartRedline = transformPatternTiming.GetRedlineAtTime(startTime);
break;
case TimingOverwriteMode.InPatternAbsoluteTiming:
Expand Down Expand Up @@ -399,7 +413,8 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
break;
default: // Original timing only
// Subtract one from the end time to omit BPM changes right on the end of the part.
inPartRedlines = transformOriginalTiming.GetRedlinesInRange(startTime, endTime - 2 * Precision.DOUBLE_EPSILON).ToArray();
inPartRedlines = transformOriginalTiming.GetRedlinesInRange(startTime,
Math.Max(startTime, endTime - 2 * Precision.DOUBLE_EPSILON)).ToArray();
startPartRedline = transformOriginalTiming.GetRedlineAtTime(startTime);
break;
}
Expand Down Expand Up @@ -520,7 +535,7 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
ho.UpdateTimelineObjectTimes();
}

foreach (var tp in patternKiaiToggles.Concat(svChanges)) {
foreach (var tp in kiaiToggles.Concat(svChanges)) {
tp.Offset = Math.Floor(newTiming.GetMilliseconds(tp.Offset, patternStartTime));
}
}
Expand Down Expand Up @@ -583,7 +598,7 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
ho.ResnapPosition(targetMode, patternCircleSize); // Resnap to column X positions for mania only
}
// Resnap Kiai toggles
foreach (TimingPoint tp in patternKiaiToggles) {
foreach (TimingPoint tp in kiaiToggles) {
tp.ResnapSelf(transformNewTiming, BeatDivisors);
}

Expand Down Expand Up @@ -611,27 +626,16 @@ private void PreparePattern(Beatmap patternBeatmap, Beatmap beatmap, out List<Pa
new TimingPointsChange(tp, mpb: true, meter: true, unInherited: true, omitFirstBarLine: true, fuzzyness:Precision.DOUBLE_EPSILON)).ToList();

// Add SliderVelocity changes for taiko and mania
if (includeSliderVelocity && (targetMode == GameMode.Taiko || targetMode == GameMode.Mania)) {
if (includePatternSliderVelocity && (targetMode == GameMode.Taiko || targetMode == GameMode.Mania)) {
timingPointsChanges.AddRange(svChanges.Select(tp => new TimingPointsChange(tp, mpb: true)));
}

// Add Kiai toggles
if (IncludeKiai) {
timingPointsChanges.AddRange(patternKiaiToggles.Select(tp => new TimingPointsChange(tp, kiai: true)));
}
else {
lastKiai = false;
foreach (TimingPoint tp in originalTiming.TimingPoints) {
if (tp.Kiai != lastKiai) {
timingPointsChanges.Add(new TimingPointsChange(tp.Copy(), kiai: true));
lastKiai = tp.Kiai;
}
}
}
timingPointsChanges.AddRange(kiaiToggles.Select(tp => new TimingPointsChange(tp, kiai: true)));

// Add Hitobject stuff
foreach (HitObject ho in patternBeatmap.HitObjects) {
if (ho.IsSlider && includeSliderVelocity) // SliderVelocity changes
if (ho.IsSlider) // SliderVelocity changes
{
TimingPoint tp = ho.TimingPoint.Copy();
tp.Offset = ho.Time;
Expand Down
2 changes: 2 additions & 0 deletions Mapping Tools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ private void OpenInfo(object sender, RoutedEventArgs e) {
builder.AppendLine("Mercury");
builder.AppendLine("Spoppyboi");
builder.AppendLine("Pon -");
builder.AppendLine("Ryuusei Aika");
builder.AppendLine("Joshua Saku");
builder.AppendLine();
builder.AppendLine("Contributors:");
builder.AppendLine("Potoofu");
Expand Down
1 change: 0 additions & 1 deletion Mapping Tools/Mapping_Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@
<Compile Include="Classes\Tools\SnappingTools\Serialization\SnappingToolsSaveSlot.cs" />
<Compile Include="Classes\Tools\SnappingTools\Serialization\SnappingToolsPreferences.cs" />
<Compile Include="Classes\Tools\SnappingTools\Serialization\SnappingToolsProject.cs" />
<Compile Include="Classes\SpectrumUtil\Waveform.cs" />
<Compile Include="Classes\SystemTools\ActionHotkey.cs" />
<Compile Include="Classes\SystemTools\BackupManager.cs" />
<Compile Include="Classes\SystemTools\BindableBase.cs" />
Expand Down
4 changes: 2 additions & 2 deletions Mapping Tools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// 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.8.0.1")]
[assembly: AssemblyFileVersion("1.8.0.1")]
[assembly: AssemblyVersion("1.8.0.2")]
[assembly: AssemblyFileVersion("1.8.0.2")]
[assembly: NeutralResourcesLanguage("en")]

Loading

0 comments on commit 154a644

Please sign in to comment.