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
P3D
Battle/BattleSystemV2
Resources/Sound
Screens

@ -1224,7 +1224,7 @@ nextIndex:
If hasLevelUp = False Then
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))
Else
Dim EvolvePokeList As New List(Of Integer)
@ -1242,7 +1242,7 @@ nextIndex:
If EvolvePokeList.Count = 0 Then
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))
Else
Core.SetScreen(New TransitionScreen(Me, New EvolutionScreen(Core.CurrentScreen, EvolvePokeList, "", EvolutionCondition.EvolutionTrigger.LevelUp, True), Color.Black, False))

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

@ -43,18 +43,18 @@
Public Sub New(ByVal OldScreen As Screen, ByVal NewScreen As Screen, ByVal IntroType As Integer, ByVal MusicLoop As String)
If MusicLoop = "" Then
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.RoamingPokemonStorage.MusicLoop <> "" Then
MusicLoop = BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop & "_intro"
End If
End If
If MusicManager.SongExists(MusicLoop) = False Then
MusicLoop = "johto_wild_intro"
End If
End If
If MusicManager.SongExists(MusicLoop) = False Then
MusicLoop = "johto_wild_intro"
End If
End If
Me.Constructor(OldScreen, NewScreen, Nothing, MusicLoop, IntroType)
End Sub