Battle related music bugs fix

This commit is contained in:
JappaWakka 2022-04-19 18:13:18 +02:00
parent a017bb653d
commit 797cd45085
3 changed files with 20 additions and 15 deletions

View File

@ -1224,7 +1224,7 @@ nextIndex:
If hasLevelUp = False Then If hasLevelUp = False Then
MusicManager._afterBattleIntroSong = Nothing MusicManager._afterBattleIntroSong = Nothing
MusicManager._introContinueSong = SavedOverworld.Level.MusicLoop MusicManager.Play(SavedOverworld.Level.MusicLoop)
Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 254), False, AddressOf ChangeSavedScreen)) Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 254), False, AddressOf ChangeSavedScreen))
Else Else
Dim EvolvePokeList As New List(Of Integer) Dim EvolvePokeList As New List(Of Integer)
@ -1242,7 +1242,7 @@ nextIndex:
If EvolvePokeList.Count = 0 Then If EvolvePokeList.Count = 0 Then
MusicManager._afterBattleIntroSong = Nothing MusicManager._afterBattleIntroSong = Nothing
MusicManager._introContinueSong = SavedOverworld.Level.MusicLoop MusicManager.Play(SavedOverworld.Level.MusicLoop)
Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 254), False, AddressOf ChangeSavedScreen)) Core.SetScreen(New TransitionScreen(Me, SavedOverworld.OverworldScreen, New Color(255, 255, 254), False, AddressOf ChangeSavedScreen))
Else Else
Core.SetScreen(New TransitionScreen(Me, New EvolutionScreen(Core.CurrentScreen, EvolvePokeList, "", EvolutionCondition.EvolutionTrigger.LevelUp, True), Color.Black, False)) Core.SetScreen(New TransitionScreen(Me, New EvolutionScreen(Core.CurrentScreen, EvolvePokeList, "", EvolutionCondition.EvolutionTrigger.LevelUp, True), Color.Black, False))

View File

@ -60,17 +60,22 @@ Public Class LoopStream
_sourceStream.Position = 0 _sourceStream.Position = 0
MusicManager._introContinueSong = MusicManager._afterBattleIntroSong.Name MusicManager._introContinueSong = MusicManager._afterBattleIntroSong.Name
MusicManager._isIntroStarted = True MusicManager._isIntroStarted = True
MusicManager._afterBattleIntroSong = Nothing
Logger.Debug($"Play song [{IntroSong.Name}]")
Else Else
If MusicManager._afterBattleIntroSong.AudioType = ".ogg" Then Dim ContinueSong As SongContainer = MusicManager.GetSong(MusicManager._afterBattleIntroSong.Name)
_sourceStream = New VorbisWaveReader(MusicManager._afterBattleIntroSong.Song) If ContinueSong.AudioType = ".ogg" Then
ElseIf MusicManager._afterBattleIntroSong.AudioType = ".mp3" Then _sourceStream = New VorbisWaveReader(ContinueSong.Song)
_sourceStream = New Mp3FileReader(MusicManager._afterBattleIntroSong.Song) ElseIf ContinueSong.AudioType = ".mp3" Then
ElseIf MusicManager._afterBattleIntroSong.AudioType = ".wma" Then _sourceStream = New Mp3FileReader(ContinueSong.Song)
_sourceStream = New MediaFoundationReader(MusicManager._afterBattleIntroSong.Song) ElseIf ContinueSong.AudioType = ".wma" Then
_sourceStream = New MediaFoundationReader(ContinueSong.Song)
End If End If
_enableLooping = True _enableLooping = True
_sourceStream.Position = 0 _sourceStream.Position = 0
MusicManager._isIntroStarted = False MusicManager._isIntroStarted = False
MusicManager._afterBattleIntroSong = Nothing
Logger.Debug($"Play song [{ContinueSong.Name}]")
End If End If
Else Else
If MusicManager._isIntroStarted = True Then If MusicManager._isIntroStarted = True Then
@ -113,7 +118,7 @@ Public Class LoopStream
End Class End Class
Public Class MusicManager Public Class MusicManager
Private Const DEFAULT_FADE_SPEED As Single = 0.03F Private Const DEFAULT_FADE_SPEED As Single = 0.5F
Private Const NO_MUSIC As String = "silence" Private Const NO_MUSIC As String = "silence"
Private Shared _songs As Dictionary(Of String, SongContainer) = New Dictionary(Of String, SongContainer)() Private Shared _songs As Dictionary(Of String, SongContainer) = New Dictionary(Of String, SongContainer)()
@ -397,7 +402,7 @@ Public Class MusicManager
End Sub End Sub
Public Shared Function Play(song As String) As SongContainer Public Shared Function Play(song As String) As SongContainer
Return Play(song, False, DEFAULT_FADE_SPEED) Return Play(song, True, DEFAULT_FADE_SPEED)
End Function End Function
Public Shared Function Play(song As String, playIntro As Boolean, Optional loopSong As Boolean = True) As SongContainer Public Shared Function Play(song As String, playIntro As Boolean, Optional loopSong As Boolean = True) As SongContainer

View File

@ -43,18 +43,18 @@
Public Sub New(ByVal OldScreen As Screen, ByVal NewScreen As Screen, ByVal IntroType As Integer, ByVal MusicLoop As String) Public Sub New(ByVal OldScreen As Screen, ByVal NewScreen As Screen, ByVal IntroType As Integer, ByVal MusicLoop As String)
If MusicLoop = "" Then If MusicLoop = "" Then
MusicLoop = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_intro" MusicLoop = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_intro"
If MusicManager.SongExists(MusicLoop) = False Then If MusicManager.SongExists(MusicLoop) = True Then
If BattleSystem.BattleScreen.RoamingBattle = True Then If BattleSystem.BattleScreen.RoamingBattle = True Then
If BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" Then If BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" Then
MusicLoop = BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop & "_intro" MusicLoop = BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop & "_intro"
End If End If
End If End If
End If
If MusicManager.SongExists(MusicLoop) = False Then If MusicManager.SongExists(MusicLoop) = False Then
MusicLoop = "johto_wild_intro" MusicLoop = "johto_wild_intro"
End If End If
End If End If
End If
Me.Constructor(OldScreen, NewScreen, Nothing, MusicLoop, IntroType) Me.Constructor(OldScreen, NewScreen, Nothing, MusicLoop, IntroType)
End Sub End Sub