Fixs some music bugs...

Fixed delay when unpausing the game while current level has no musicloop defined
Fixed silence (caused by undefined musicloop) overriding currently playing song when unpausing
This commit is contained in:
JappaWakka 2024-01-07 13:35:17 +01:00
parent 9129ae0675
commit 16a83441d9
3 changed files with 16 additions and 14 deletions

View File

@ -1379,8 +1379,7 @@ nextIndex:
Next
If hasLevelUp = False Then
MusicManager.Stop()
MusicManager.Play(SavedOverworld.Level.MusicLoop, True, 0.01F)
MusicManager.Play(SavedOverworld.Level.MusicLoop, True, 0.02F)
Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 255), False, AddressOf ChangeSavedScreen))
Else
Dim EvolvePokeList As New List(Of Integer)
@ -1397,8 +1396,7 @@ nextIndex:
Next
If EvolvePokeList.Count = 0 Then
MusicManager.Stop()
MusicManager.Play(SavedOverworld.Level.MusicLoop, True, 0.01F)
MusicManager.Play(SavedOverworld.Level.MusicLoop, True, 0.02F)
Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 255), False, AddressOf ChangeSavedScreen))
Else
Core.SetScreen(New TransitionScreen(Me, New EvolutionScreen(Core.CurrentScreen, EvolvePokeList, "", EvolutionCondition.EvolutionTrigger.LevelUp, True), Color.Black, False))

View File

@ -440,14 +440,14 @@ Public Class OverworldScreen
'Set to correct music:
If TrainerEncountered = False Then
Dim x = 0
While (x < 100 And String.IsNullOrEmpty(Level.MusicLoop))
Thread.Sleep(20)
x = x + 1
End While
If String.IsNullOrEmpty(Level.MusicLoop) Then
Return
End If
'Dim x = 0
'While (x < 100 And String.IsNullOrEmpty(Level.MusicLoop))
' Thread.Sleep(20)
' x = x + 1
'End While
'If String.IsNullOrEmpty(Level.MusicLoop) Then
' Return
'End If
Dim theme As String = Level.MusicLoop
If Screen.Level.Surfing = True Then
@ -464,7 +464,9 @@ Public Class OverworldScreen
Level.IsRadioOn = False
End If
MusicManager.Play(theme, True) 'remove when debugging music
If MusicManager._currentSongName Is "silence" Or MusicManager.CurrentSong Is Nothing Then
MusicManager.Play(theme, True) 'remove when debugging music
End If
End If
End Sub

View File

@ -1078,7 +1078,9 @@ Public Class Level
If MusicManager.GetSong(MusicLoop) IsNot Nothing Then
MusicManager.Play(MusicLoop, True, 0.01F)
Else
MusicManager.Play("silence")
If MusicManager._currentSongName Is "silence" Or MusicManager.CurrentSong Is Nothing Then
MusicManager.Play("silence")
End If
End If
End If
End If