diff --git a/Assets/Resources/Music/mus_superb01.ogg b/Assets/Resources/Music/mus_superb01.ogg index 8d53d2c88..1b0a8fdaf 100644 Binary files a/Assets/Resources/Music/mus_superb01.ogg and b/Assets/Resources/Music/mus_superb01.ogg differ diff --git a/Assets/Resources/Sprites/Games/KarateMan/karateman_cellshader.mat b/Assets/Resources/Sprites/Games/KarateMan/karateman_cellshader.mat index 86e3c4e92..803b55d33 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/karateman_cellshader.mat +++ b/Assets/Resources/Sprites/Games/KarateMan/karateman_cellshader.mat @@ -86,6 +86,6 @@ Material: - _Color: {r: 1, g: 1, b: 1, a: 1} - _ColorAlpha: {r: 1, g: 1, b: 1, a: 1} - _ColorBravo: {r: 1, g: 0, b: 0, a: 1} - - _ColorDelta: {r: 0.7647867, g: 0.7568468, b: 0.8092505, a: 1} + - _ColorDelta: {r: 0.82210875, g: 0.6714016, b: 0.7016807, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index ed61f464b..0114053b8 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -444,32 +444,27 @@ namespace HeavenStudio return result; } - public float GetLoopPositionFromBeat(float beatOffset, float length) + public float GetLoopPositionFromBeat(float beatOffset, float length, bool beatClamp = true) { - return Mathf.Repeat((songPositionInBeats / length) + beatOffset, 1); + float beat = songPositionInBeats; + if (beatClamp) + { + beat = Mathf.Max(beat, 0); + } + return Mathf.Repeat((beat / length) + beatOffset, 1); } - public float GetPositionFromBeat(double startBeat, double length) + public float GetPositionFromBeat(double startBeat, double length, bool beatClamp = true) { - float a = Mathp.Normalize(songPositionInBeats, (float)startBeat, (float)(startBeat + length)); + float beat = songPositionInBeats; + if (beatClamp) + { + beat = Mathf.Max(beat, 0); + } + float a = Mathp.Normalize(beat, (float)startBeat, (float)(startBeat + length)); return a; } - public float GetBeatFromPosition(float position, float startBeat, float length) - { - return Mathp.DeNormalize(position, (float)startBeat, (float)(startBeat + length)); - } - - public float GetPositionFromMargin(float targetBeat, float margin) - { - return GetPositionFromBeat(targetBeat - margin, margin); - } - - public float GetBeatFromPositionAndMargin(float position, float targetBeat, float margin) - { - return GetBeatFromPosition(position, targetBeat - margin, margin); - } - private List GetSortedTempoChanges() { GameManager.instance.SortEventsList(); diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 45349fb2e..fdafa7fc9 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -481,10 +481,11 @@ namespace HeavenStudio if (!Conductor.instance.isPlaying) return; Conductor cond = Conductor.instance; + double beat = Math.Max(cond.songPositionInBeatsAsDouble, 0); if (currentTempoEvent < Beatmap.TempoChanges.Count && currentTempoEvent >= 0) { - if (cond.songPositionInBeatsAsDouble >= tempoBeats[currentTempoEvent]) + if (beat >= tempoBeats[currentTempoEvent]) { cond.SetBpm(Beatmap.TempoChanges[currentTempoEvent]["tempo"]); currentTempoEvent++; @@ -493,7 +494,7 @@ namespace HeavenStudio if (currentVolumeEvent < Beatmap.VolumeChanges.Count && currentVolumeEvent >= 0) { - if (cond.songPositionInBeatsAsDouble >= volumeBeats[currentVolumeEvent]) + if (beat >= volumeBeats[currentVolumeEvent]) { cond.SetVolume(Beatmap.VolumeChanges[currentVolumeEvent]["volume"]); currentVolumeEvent++; @@ -502,7 +503,7 @@ namespace HeavenStudio if (currentSectionEvent < Beatmap.SectionMarkers.Count && currentSectionEvent >= 0) { - if (cond.songPositionInBeatsAsDouble >= sectionBeats[currentSectionEvent]) + if (beat >= sectionBeats[currentSectionEvent]) { Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started"); lastSection = currentSection; @@ -519,7 +520,7 @@ namespace HeavenStudio } } - if (cond.songPositionInBeatsAsDouble >= Math.Ceiling(_playStartBeat) + _pulseTally) + if (beat >= Math.Ceiling(_playStartBeat) + _pulseTally) { if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally); onBeatPulse?.Invoke(Math.Ceiling(_playStartBeat) + _pulseTally); @@ -528,12 +529,12 @@ namespace HeavenStudio float seekTime = 8f; //seek ahead to preload games that have assetbundles - SeekAheadAndPreload(cond.songPositionInBeatsAsDouble, seekTime); - SeekAheadAndDoPreEvent(cond.songPositionInBeatsAsDouble); + SeekAheadAndPreload(beat, seekTime); + SeekAheadAndDoPreEvent(beat); if (currentEvent < Beatmap.Entities.Count && currentEvent >= 0) { - if (cond.songPositionInBeatsAsDouble >= eventBeats[currentEvent]) + if (beat >= eventBeats[currentEvent]) { List entitiesAtSameBeat = ListPool.Get(); List fxEntities = ListPool.Get(); @@ -975,7 +976,7 @@ namespace HeavenStudio if (miniGame != null) miniGame.OnGameSwitch(beat); - while (beat + 0.25 > Conductor.instance.songPositionInBeats) + while (beat + 0.25 > Math.Max(Conductor.instance.songPositionInBeatsAsDouble, 0)) { if (!Conductor.instance.isPlaying) { diff --git a/Assets/Scripts/Games/Global/Filter.cs b/Assets/Scripts/Games/Global/Filter.cs index 96bb56daf..ef13aa217 100644 --- a/Assets/Scripts/Games/Global/Filter.cs +++ b/Assets/Scripts/Games/Global/Filter.cs @@ -113,7 +113,7 @@ namespace HeavenStudio.Games.Global private void Update() { - var songPosBeat = Conductor.instance.songPositionInBeatsAsDouble; + var songPosBeat = Math.Max(Conductor.instance.songPositionInBeatsAsDouble, 0); foreach (var e in allFilterEvents) { diff --git a/Assets/Scripts/Games/Global/Flash.cs b/Assets/Scripts/Games/Global/Flash.cs index 33c15fc1a..0e514e5d3 100644 --- a/Assets/Scripts/Games/Global/Flash.cs +++ b/Assets/Scripts/Games/Global/Flash.cs @@ -100,9 +100,8 @@ namespace HeavenStudio.Games.Global private void Update() { - FindFadeFromBeat(Conductor.instance.songPositionInBeatsAsDouble); + FindFadeFromBeat(Math.Max(Conductor.instance.songPositionInBeatsAsDouble, 0)); float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, length); - // normalizedBeat = Mathf.Clamp01(normalizedBeat); currentCol = new Color(func(startColor.r, endColor.r, normalizedBeat), func(startColor.g, endColor.g, normalizedBeat), func(startColor.b, endColor.b, normalizedBeat), func(startColor.a, endColor.a, normalizedBeat)); spriteRenderer.color = currentCol; diff --git a/Assets/Scripts/UI/Overlays/GoForAPerfect.cs b/Assets/Scripts/UI/Overlays/GoForAPerfect.cs index 8dd1bc214..d82dda310 100644 --- a/Assets/Scripts/UI/Overlays/GoForAPerfect.cs +++ b/Assets/Scripts/UI/Overlays/GoForAPerfect.cs @@ -61,9 +61,9 @@ namespace HeavenStudio.Common currentBlink++; } } - else if (cond.songPositionInBeats < lastReportedBeat) + else if (cond.songPositionInBeatsAsDouble < lastReportedBeat) { - lastReportedBeat = Mathf.Round(cond.songPositionInBeats); + lastReportedBeat = System.Math.Round(cond.songPositionInBeatsAsDouble); } } diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index 964d04897..7bfbcb981 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -57,6 +57,7 @@ namespace HeavenStudio.Common isPaused = true; canPick = false; optionSelected = 0; + ChooseOption((Options)optionSelected, false); } void UnPause(bool instant = false)