Added option to disable hispeed change visuals during playback

This commit is contained in:
Goatgarien
2023-04-28 14:23:08 -07:00
parent 8ee60bee2a
commit aea6e7ff30
5 changed files with 88 additions and 65 deletions
+52 -49
View File
@@ -18,6 +18,7 @@ namespace BAKKA_Editor
public float Radius { get; private set; }
public float CurrentMeasure { get; set; }
public float Hispeed { get; set; } = 1.5f;
public bool showHispeed { get; set; } = true;
// Pens and Brushes
public Pen BasePen { get; set; }
@@ -77,71 +78,73 @@ namespace BAKKA_Editor
{
//Convert hispeed to frames
float displayFrames = 73.0f - ((Hispeed - 1.5f) * 10.0f);
//Account for hispeed gimmick
List<Gimmick> HispeedChanges = new List<Gimmick>();
Gimmick InitialSpeed = chart.Gimmicks.Where(x => x.GimmickType == GimmickType.HiSpeedChange && CurrentMeasure > x.Measure).LastOrDefault();
//Add initial hispeed to list
if (InitialSpeed == null)
{
InitialSpeed = new Gimmick();
InitialSpeed.HiSpeed = 1.0;
}
HispeedChanges.Add(InitialSpeed);
//Random todos that im too lazy to put in applicable locations
//TODO: Add option to disable hispeed gimmick in visual
//TODO: add "time" to notes so we can compare against it every time instead of always calculating what time a note is at
//TODO: add function to reevaluate the time of every note when bpm or TS is added/removed.
//add all hispeed changes to list that happen within the current total time to show notes
float tempTotalTime = ((displayFrames / 60.0f) * 1000.0f);
float currentTime = chart.GetTime(new BeatInfo(CurrentMeasure));
float tempEndTime = currentTime + tempTotalTime;
HispeedChanges.AddRange(chart.Gimmicks.Where(
x => x.Measure >= CurrentMeasure
&& chart.GetTime(new BeatInfo(x.Measure)) < tempEndTime
&& x.GimmickType == GimmickType.HiSpeedChange).ToList());
if (HispeedChanges.Count > 1)
if (showHispeed)
{
for (int i = 0; i < HispeedChanges.Count; i++)
//Account for hispeed gimmick
List<Gimmick> HispeedChanges = new List<Gimmick>();
Gimmick InitialSpeed = chart.Gimmicks.Where(x => x.GimmickType == GimmickType.HiSpeedChange && CurrentMeasure > x.Measure).LastOrDefault();
//Add initial hispeed to list
if (InitialSpeed == null)
{
float timeDiff;
float itemTime = chart.GetTime(HispeedChanges[i].BeatInfo);
float modifiedTime;
if (itemTime <= (tempTotalTime + currentTime))
InitialSpeed = new Gimmick();
InitialSpeed.HiSpeed = 1.0;
}
HispeedChanges.Add(InitialSpeed);
//Random todos that im too lazy to put in applicable locations
//TODO: add "time" to notes so we can compare against it every time instead of always calculating what time a note is at
//TODO: add function to reevaluate the time of every note when bpm or TS is added/removed.
//add all hispeed changes to list that happen within the current total time to show notes
HispeedChanges.AddRange(chart.Gimmicks.Where(
x => x.Measure >= CurrentMeasure
&& chart.GetTime(new BeatInfo(x.Measure)) < tempEndTime
&& x.GimmickType == GimmickType.HiSpeedChange).ToList());
if (HispeedChanges.Count > 1)
{
for (int i = 0; i < HispeedChanges.Count; i++)
{
if (i == 0)
itemTime = currentTime;
if (i != HispeedChanges.Count - 1)
float timeDiff;
float itemTime = chart.GetTime(HispeedChanges[i].BeatInfo);
float modifiedTime;
if (itemTime <= (tempTotalTime + currentTime))
{
float tempTestITimeDiff = (currentTime + tempTotalTime) - itemTime;
float tempTestIModifiedTime = (tempTestITimeDiff) / (float)(HispeedChanges[i].HiSpeed);
if ((currentTime + tempTotalTime - tempTestITimeDiff + tempTestIModifiedTime) < chart.GetTime(HispeedChanges[i + 1].BeatInfo))
if (i == 0)
itemTime = currentTime;
if (i != HispeedChanges.Count - 1)
{
float tempTestITimeDiff = (currentTime + tempTotalTime) - itemTime;
float tempTestIModifiedTime = (tempTestITimeDiff) / (float)(HispeedChanges[i].HiSpeed);
if ((currentTime + tempTotalTime - tempTestITimeDiff + tempTestIModifiedTime) < chart.GetTime(HispeedChanges[i + 1].BeatInfo))
{
timeDiff = (currentTime + tempTotalTime) - itemTime;
modifiedTime = timeDiff / (float)HispeedChanges[i].HiSpeed;
}
else
{
timeDiff = chart.GetTime(HispeedChanges[i + 1].BeatInfo) - itemTime;
modifiedTime = timeDiff / (float)HispeedChanges[i].HiSpeed;
}
}
else
{
timeDiff = (currentTime + tempTotalTime) - itemTime;
modifiedTime = timeDiff / (float)HispeedChanges[i].HiSpeed;
}
else
{
timeDiff = chart.GetTime(HispeedChanges[i + 1].BeatInfo) - itemTime;
modifiedTime = timeDiff / (float)HispeedChanges[i].HiSpeed;
}
tempTotalTime = tempTotalTime - timeDiff + modifiedTime;
}
else
{
timeDiff = (currentTime + tempTotalTime) - itemTime;
modifiedTime = timeDiff / (float)HispeedChanges[i].HiSpeed;
}
tempTotalTime = tempTotalTime - timeDiff + modifiedTime;
}
}
}
else
{
tempTotalTime /= (float)HispeedChanges[0].HiSpeed;
else
{
tempTotalTime /= (float)HispeedChanges[0].HiSpeed;
}
tempEndTime = currentTime + tempTotalTime;
}
//convert total time to total measure
tempEndTime = currentTime + tempTotalTime;
BeatInfo EndMeasure = chart.GetBeat(tempEndTime);
return EndMeasure.MeasureDecimal - CurrentMeasure;
}
+2 -2
View File
@@ -52,8 +52,8 @@ namespace BAKKA_Editor
internal enum MaskType
{
Clockwise = 1,
CounterClockwise = 0,
CounterClockwise = 0,
Clockwise = 1,
Center = 2
}
+17 -6
View File
@@ -101,6 +101,7 @@
this.highlightViewedNoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.selectLastInsertedNoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showGimmicksInCircleViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showGimmicksDuringPlaybackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.initialChartSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -945,7 +946,8 @@
this.showCursorDuringPlaybackToolStripMenuItem,
this.highlightViewedNoteToolStripMenuItem,
this.selectLastInsertedNoteToolStripMenuItem,
this.showGimmicksInCircleViewToolStripMenuItem});
this.showGimmicksInCircleViewToolStripMenuItem,
this.showGimmicksDuringPlaybackToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
@@ -956,14 +958,14 @@
this.showCursorToolStripMenuItem.CheckOnClick = true;
this.showCursorToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showCursorToolStripMenuItem.Name = "showCursorToolStripMenuItem";
this.showCursorToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.showCursorToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.showCursorToolStripMenuItem.Text = "Show Cursor";
this.showCursorToolStripMenuItem.Click += new System.EventHandler(this.showCursorToolStripMenuItem_Click);
//
// showCursorDuringPlaybackToolStripMenuItem
//
this.showCursorDuringPlaybackToolStripMenuItem.Name = "showCursorDuringPlaybackToolStripMenuItem";
this.showCursorDuringPlaybackToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.showCursorDuringPlaybackToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.showCursorDuringPlaybackToolStripMenuItem.Text = "Show Cursor During Playback";
//
// highlightViewedNoteToolStripMenuItem
@@ -972,7 +974,7 @@
this.highlightViewedNoteToolStripMenuItem.CheckOnClick = true;
this.highlightViewedNoteToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.highlightViewedNoteToolStripMenuItem.Name = "highlightViewedNoteToolStripMenuItem";
this.highlightViewedNoteToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.highlightViewedNoteToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.highlightViewedNoteToolStripMenuItem.Text = "Highlight Viewed Note";
//
// selectLastInsertedNoteToolStripMenuItem
@@ -981,7 +983,7 @@
this.selectLastInsertedNoteToolStripMenuItem.CheckOnClick = true;
this.selectLastInsertedNoteToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.selectLastInsertedNoteToolStripMenuItem.Name = "selectLastInsertedNoteToolStripMenuItem";
this.selectLastInsertedNoteToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.selectLastInsertedNoteToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.selectLastInsertedNoteToolStripMenuItem.Text = "Select Last Inserted Note";
//
// showGimmicksInCircleViewToolStripMenuItem
@@ -990,10 +992,18 @@
this.showGimmicksInCircleViewToolStripMenuItem.CheckOnClick = true;
this.showGimmicksInCircleViewToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showGimmicksInCircleViewToolStripMenuItem.Name = "showGimmicksInCircleViewToolStripMenuItem";
this.showGimmicksInCircleViewToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.showGimmicksInCircleViewToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.showGimmicksInCircleViewToolStripMenuItem.Text = "Show Gimmicks In Circle View";
this.showGimmicksInCircleViewToolStripMenuItem.Click += new System.EventHandler(this.showGimmicksInCircleViewToolStripMenuItem_Click);
//
// showGimmicksDuringPlaybackToolStripMenuItem
//
this.showGimmicksDuringPlaybackToolStripMenuItem.CheckOnClick = true;
this.showGimmicksDuringPlaybackToolStripMenuItem.Name = "showGimmicksDuringPlaybackToolStripMenuItem";
this.showGimmicksDuringPlaybackToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.showGimmicksDuringPlaybackToolStripMenuItem.Text = "Show Gimmicks During Playback";
this.showGimmicksDuringPlaybackToolStripMenuItem.Click += new System.EventHandler(this.showGimmicksDuringPlaybackToolStripMenuItem_Click);
//
// chartToolStripMenuItem
//
this.chartToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1577,5 +1587,6 @@
private TrackBar trackBarSpeed;
private Button gimmickJumpToCurrTimeButton;
private ToolStripMenuItem showGimmicksInCircleViewToolStripMenuItem;
private ToolStripMenuItem showGimmicksDuringPlaybackToolStripMenuItem;
}
}
+16 -8
View File
@@ -128,6 +128,7 @@ namespace BAKKA_Editor
showCursorDuringPlaybackToolStripMenuItem.Checked = userSettings.ViewSettings.ShowCursorDuringPlayback;
highlightViewedNoteToolStripMenuItem.Checked = userSettings.ViewSettings.HighlightViewedNote;
showGimmicksInCircleViewToolStripMenuItem.Checked = userSettings.ViewSettings.ShowGimmicks;
showGimmicksDuringPlaybackToolStripMenuItem.Checked = userSettings.ViewSettings.ShowGimmicksDuringPlayback;
selectLastInsertedNoteToolStripMenuItem.Checked = userSettings.ViewSettings.SelectLastInsertedNote;
visualHispeedNumeric.Value = (decimal)userSettings.ViewSettings.HispeedSetting;
trackBarVolume.Value = userSettings.ViewSettings.Volume;
@@ -349,14 +350,15 @@ namespace BAKKA_Editor
if (tempFilePath != "")
File.Delete(tempFilePath);
// Apply settings
userSettings.ViewSettings.ShowCursor = showCursorToolStripMenuItem.Checked;
userSettings.ViewSettings.ShowCursorDuringPlayback = showCursorDuringPlaybackToolStripMenuItem.Checked;
userSettings.ViewSettings.HighlightViewedNote = highlightViewedNoteToolStripMenuItem.Checked;
userSettings.ViewSettings.ShowGimmicks = showGimmicksInCircleViewToolStripMenuItem.Checked;
userSettings.ViewSettings.SelectLastInsertedNote = selectLastInsertedNoteToolStripMenuItem.Checked;
userSettings.ViewSettings.HispeedSetting = circleView.Hispeed;
userSettings.ViewSettings.Volume = trackBarVolume.Value;
userSettings.SaveSettings.AutoSaveInterval = autoSaveTimer.Interval / 60000;
userSettings.ViewSettings.ShowCursor = showCursorToolStripMenuItem.Checked;
userSettings.ViewSettings.ShowCursorDuringPlayback = showCursorDuringPlaybackToolStripMenuItem.Checked;
userSettings.ViewSettings.HighlightViewedNote = highlightViewedNoteToolStripMenuItem.Checked;
userSettings.ViewSettings.ShowGimmicks = showGimmicksInCircleViewToolStripMenuItem.Checked;
userSettings.ViewSettings.ShowGimmicksDuringPlayback = showGimmicksDuringPlaybackToolStripMenuItem.Checked;
userSettings.ViewSettings.SelectLastInsertedNote = selectLastInsertedNoteToolStripMenuItem.Checked;
userSettings.ViewSettings.HispeedSetting = circleView.Hispeed;
userSettings.ViewSettings.Volume = trackBarVolume.Value;
userSettings.SaveSettings.AutoSaveInterval = autoSaveTimer.Interval / 60000;
//Update user settings.toml
if (File.Exists("settings.toml"))
File.WriteAllText("settings.toml", Toml.FromModel(userSettings));
@@ -2193,5 +2195,11 @@ namespace BAKKA_Editor
currentSong.PlaybackSpeed = (trackBarSpeed.Value / (float)trackBarSpeed.Maximum);
labelSpeed.Text = $"Speed (x{currentSong.PlaybackSpeed:0.00})";
}
private void showGimmicksDuringPlaybackToolStripMenuItem_Click(object sender, EventArgs e)
{
circleView.showHispeed = showGimmicksDuringPlaybackToolStripMenuItem.Checked;
circlePanel.Invalidate();
}
}
}
+1
View File
@@ -22,6 +22,7 @@ namespace BAKKA_Editor
public bool HighlightViewedNote { get; set; } = true;
public bool SelectLastInsertedNote { get; set; } = true;
public bool ShowGimmicks { get; set; } = true;
public bool ShowGimmicksDuringPlayback { get; set; } = true;
public float HispeedSetting { get; set; } = 1.5f;
public int Volume { get; set; } = 100;
}