mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-25 14:54:48 +02:00
Fixed the music gap between BattleIntroScreen and BattleScreen
Also replaced the johto_wild music with a well-looped one
This commit is contained in:
parent
a85849a52c
commit
4132bbe1c0
@ -189,20 +189,6 @@
|
|||||||
|
|
||||||
PlayerStatistics.Track("Wild battles", 1)
|
PlayerStatistics.Track("Wild battles", 1)
|
||||||
|
|
||||||
If CustomBattleMusic = "" OrElse MusicManager.SongExists(CustomBattleMusic) = False Then
|
|
||||||
If RoamingBattle = True AndAlso RoamingPokemonStorage.MusicLoop <> "" AndAlso MusicManager.SongExists(RoamingPokemonStorage.MusicLoop) = True Then
|
|
||||||
MusicManager.Play(RoamingPokemonStorage.MusicLoop, True, 0.0F)
|
|
||||||
Else
|
|
||||||
If MusicManager.SongExists(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
|
|
||||||
MusicManager.Play(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild", True, 0.0F)
|
|
||||||
Else
|
|
||||||
MusicManager.Play("johto_wild", True, 0.0F)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
MusicManager.Play(CustomBattleMusic, True, 0.0F)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Me.defaultMapType = defaultMapType
|
Me.defaultMapType = defaultMapType
|
||||||
|
|
||||||
Me.OppPokemon = WildPokemon
|
Me.OppPokemon = WildPokemon
|
||||||
@ -331,12 +317,6 @@
|
|||||||
PlayerStatistics.Track("Trainer battles", 1)
|
PlayerStatistics.Track("Trainer battles", 1)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If IsPVPBattle = True Then
|
|
||||||
MusicManager.Play("pvp", True, 0.0F)
|
|
||||||
Else
|
|
||||||
MusicManager.Play(Trainer.GetBattleMusicName(), True, 0.0F)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Me.defaultMapType = defaultMapType
|
Me.defaultMapType = defaultMapType
|
||||||
|
|
||||||
Me.OppPokemon = Trainer.Pokemons(0)
|
Me.OppPokemon = Trainer.Pokemons(0)
|
||||||
@ -479,12 +459,6 @@
|
|||||||
|
|
||||||
PlayerStatistics.Track("Safari battles", 1)
|
PlayerStatistics.Track("Safari battles", 1)
|
||||||
|
|
||||||
If MusicManager.SongExists(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
|
|
||||||
MusicManager.Play(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild", True, 0.0F)
|
|
||||||
Else
|
|
||||||
MusicManager.Play("johto_wild", True, 0.0F)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Me.defaultMapType = defaultMapType
|
Me.defaultMapType = defaultMapType
|
||||||
|
|
||||||
Me.OppPokemon = WildPokemon
|
Me.OppPokemon = WildPokemon
|
||||||
@ -596,12 +570,6 @@
|
|||||||
|
|
||||||
PlayerStatistics.Track("Bug-Catching contest battles", 1)
|
PlayerStatistics.Track("Bug-Catching contest battles", 1)
|
||||||
|
|
||||||
If MusicManager.SongExists(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
|
|
||||||
MusicManager.Play(SavedOverworld.Level.CurrentRegion.Split(CChar(","))(0) & "_wild", True, 0.0F)
|
|
||||||
Else
|
|
||||||
MusicManager.Play("johto_wild", True, 0.0F)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Me.defaultMapType = defaultMapType
|
Me.defaultMapType = defaultMapType
|
||||||
|
|
||||||
Me.OppPokemon = WildPokemon
|
Me.OppPokemon = WildPokemon
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -45,33 +45,63 @@ Public Class LoopStream
|
|||||||
_sourceStream.Position = 0
|
_sourceStream.Position = 0
|
||||||
Else
|
Else
|
||||||
If Not _sourceStream.Position = 0 Then
|
If Not _sourceStream.Position = 0 Then
|
||||||
If MusicManager._isIntroStarted = True Then
|
If MusicManager._afterBattleIntroSong IsNot Nothing Then
|
||||||
Dim IntroContinueSong As SongContainer = MusicManager.GetSong(MusicManager._introContinueSong)
|
Dim IntroSongName As String = "intro\" & MusicManager._afterBattleIntroSong.Name
|
||||||
If IntroContinueSong IsNot Nothing Then
|
Dim IntroSong As SongContainer = MusicManager.GetSong(IntroSongName)
|
||||||
Logger.Debug($"Play song [{IntroContinueSong.Name}]")
|
If IntroSong IsNot Nothing Then
|
||||||
If IntroContinueSong.AudioType = ".ogg" Then
|
If IntroSong.AudioType = ".ogg" Then
|
||||||
_sourceStream = New VorbisWaveReader(IntroContinueSong.Song)
|
_sourceStream = New VorbisWaveReader(IntroSong.Song)
|
||||||
ElseIf IntroContinueSong.AudioType = ".mp3" Then
|
ElseIf IntroSong.AudioType = ".mp3" Then
|
||||||
_sourceStream = New Mp3FileReader(IntroContinueSong.Song)
|
_sourceStream = New Mp3FileReader(IntroSong.Song)
|
||||||
ElseIf IntroContinueSong.AudioType = ".wma" Then
|
ElseIf IntroSong.AudioType = ".wma" Then
|
||||||
_sourceStream = New MediaFoundationReader(IntroContinueSong.Song)
|
_sourceStream = New MediaFoundationReader(IntroSong.Song)
|
||||||
End If
|
End If
|
||||||
_enableLooping = True
|
_enableLooping = False
|
||||||
_sourceStream.Position = 0
|
_sourceStream.Position = 0
|
||||||
|
MusicManager._introContinueSong = MusicManager._afterBattleIntroSong.Name
|
||||||
|
MusicManager._isIntroStarted = True
|
||||||
Else
|
Else
|
||||||
If MusicManager.GetSong("silence").AudioType = ".ogg" Then
|
If MusicManager._afterBattleIntroSong.AudioType = ".ogg" Then
|
||||||
_sourceStream = New VorbisWaveReader(MusicManager.GetSong("silence").Song)
|
_sourceStream = New VorbisWaveReader(MusicManager._afterBattleIntroSong.Song)
|
||||||
ElseIf MusicManager.GetSong("silence").AudioType = ".mp3" Then
|
ElseIf IntroSong.AudioType = ".mp3" Then
|
||||||
_sourceStream = New Mp3FileReader(MusicManager.GetSong("silence").Song)
|
_sourceStream = New Mp3FileReader(MusicManager._afterBattleIntroSong.Song)
|
||||||
ElseIf MusicManager.GetSong("silence").AudioType = ".wma" Then
|
ElseIf IntroSong.AudioType = ".wma" Then
|
||||||
_sourceStream = New MediaFoundationReader(MusicManager.GetSong("silence").Song)
|
_sourceStream = New MediaFoundationReader(MusicManager._afterBattleIntroSong.Song)
|
||||||
End If
|
End If
|
||||||
_enableLooping = True
|
_enableLooping = True
|
||||||
_sourceStream.Position = 0
|
_sourceStream.Position = 0
|
||||||
|
MusicManager._isIntroStarted = False
|
||||||
End If
|
End If
|
||||||
MusicManager._fadeIntoIntro = False
|
MusicManager._afterBattleIntroSong = Nothing
|
||||||
Else
|
Else
|
||||||
Exit While
|
If MusicManager._isIntroStarted = True Then
|
||||||
|
Dim IntroContinueSong As SongContainer = MusicManager.GetSong(MusicManager._introContinueSong)
|
||||||
|
If IntroContinueSong IsNot Nothing Then
|
||||||
|
Logger.Debug($"Play song [{IntroContinueSong.Name}]")
|
||||||
|
If IntroContinueSong.AudioType = ".ogg" Then
|
||||||
|
_sourceStream = New VorbisWaveReader(IntroContinueSong.Song)
|
||||||
|
ElseIf IntroContinueSong.AudioType = ".mp3" Then
|
||||||
|
_sourceStream = New Mp3FileReader(IntroContinueSong.Song)
|
||||||
|
ElseIf IntroContinueSong.AudioType = ".wma" Then
|
||||||
|
_sourceStream = New MediaFoundationReader(IntroContinueSong.Song)
|
||||||
|
End If
|
||||||
|
_enableLooping = True
|
||||||
|
_sourceStream.Position = 0
|
||||||
|
Else
|
||||||
|
If MusicManager.GetSong("silence").AudioType = ".ogg" Then
|
||||||
|
_sourceStream = New VorbisWaveReader(MusicManager.GetSong("silence").Song)
|
||||||
|
ElseIf MusicManager.GetSong("silence").AudioType = ".mp3" Then
|
||||||
|
_sourceStream = New Mp3FileReader(MusicManager.GetSong("silence").Song)
|
||||||
|
ElseIf MusicManager.GetSong("silence").AudioType = ".wma" Then
|
||||||
|
_sourceStream = New MediaFoundationReader(MusicManager.GetSong("silence").Song)
|
||||||
|
End If
|
||||||
|
_enableLooping = True
|
||||||
|
_sourceStream.Position = 0
|
||||||
|
End If
|
||||||
|
MusicManager._fadeIntoIntro = False
|
||||||
|
Else
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@ -99,6 +129,7 @@ Public Class MusicManager
|
|||||||
' if the song in _currentSong is an actual existing song
|
' if the song in _currentSong is an actual existing song
|
||||||
Private Shared _currentSongExists As Boolean = False
|
Private Shared _currentSongExists As Boolean = False
|
||||||
Private Shared _currentSong As SongContainer = Nothing
|
Private Shared _currentSong As SongContainer = Nothing
|
||||||
|
Public Shared _afterBattleIntroSong As SongContainer = Nothing
|
||||||
|
|
||||||
' time until music playback is paused for sound effect
|
' time until music playback is paused for sound effect
|
||||||
Private Shared _pausedUntil As Date
|
Private Shared _pausedUntil As Date
|
||||||
@ -202,6 +233,7 @@ Public Class MusicManager
|
|||||||
_currentSongExists = False
|
_currentSongExists = False
|
||||||
_currentSong = Nothing
|
_currentSong = Nothing
|
||||||
_currentSongName = NO_MUSIC
|
_currentSongName = NO_MUSIC
|
||||||
|
_afterBattleIntroSong = Nothing
|
||||||
_isIntroStarted = False
|
_isIntroStarted = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -304,7 +336,6 @@ Public Class MusicManager
|
|||||||
Public Shared Sub [Stop]()
|
Public Shared Sub [Stop]()
|
||||||
If Not outputDevice Is Nothing Then
|
If Not outputDevice Is Nothing Then
|
||||||
outputDevice.Stop()
|
outputDevice.Stop()
|
||||||
outputDevice.Dispose()
|
|
||||||
End If
|
End If
|
||||||
_isIntroStarted = False
|
_isIntroStarted = False
|
||||||
End Sub
|
End Sub
|
||||||
@ -325,7 +356,7 @@ Public Class MusicManager
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub Play(song As SongContainer, Optional ByVal introSong As SongContainer = Nothing)
|
Private Shared Sub Play(song As SongContainer)
|
||||||
If Not song Is Nothing Then
|
If Not song Is Nothing Then
|
||||||
Logger.Debug($"Play song [{song.Name}]")
|
Logger.Debug($"Play song [{song.Name}]")
|
||||||
If Not outputDevice Is Nothing Then
|
If Not outputDevice Is Nothing Then
|
||||||
@ -376,17 +407,28 @@ Public Class MusicManager
|
|||||||
Return Play(song, playIntro, DEFAULT_FADE_SPEED, loopSong)
|
Return Play(song, playIntro, DEFAULT_FADE_SPEED, loopSong)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function Play(song As String, playIntro As Boolean, fadeSpeed As Single, Optional loopSong As Boolean = True) As SongContainer
|
Public Shared Function Play(song As String, playIntro As Boolean, fadeSpeed As Single, Optional loopSong As Boolean = True, Optional AfterBattleIntroSong As String = "") As SongContainer
|
||||||
|
|
||||||
Dim playedSong As SongContainer = Nothing
|
Dim playedSong As SongContainer = Nothing
|
||||||
|
|
||||||
' get the current song, only play if it's different
|
' get the current song, only play if it's different
|
||||||
Dim currentSong = GetCurrentSong().ToLowerInvariant()
|
Dim currentSong = GetCurrentSong().ToLowerInvariant()
|
||||||
Dim songName = GetSongName(song)
|
Dim songName = GetSongName(song)
|
||||||
|
Dim AfterBattleIntroSongName As String = GetSongName(AfterBattleIntroSong)
|
||||||
|
|
||||||
If currentSong = NO_MUSIC OrElse currentSong <> songName Then
|
If currentSong = NO_MUSIC OrElse currentSong <> songName Then
|
||||||
|
If AfterBattleIntroSongName <> "" Then
|
||||||
|
_isLooping = False
|
||||||
|
|
||||||
If playIntro = True Then
|
Dim battleIntroSong = GetSong(songName)
|
||||||
|
|
||||||
|
If battleIntroSong IsNot Nothing Then
|
||||||
|
Play(battleIntroSong)
|
||||||
|
_afterBattleIntroSong = GetSong(AfterBattleIntroSongName)
|
||||||
|
End If
|
||||||
|
playedSong = battleIntroSong
|
||||||
|
|
||||||
|
ElseIf playIntro = True Then
|
||||||
_isLooping = False
|
_isLooping = False
|
||||||
Dim introSong = GetSong("intro\" + songName)
|
Dim introSong = GetSong("intro\" + songName)
|
||||||
If Not introSong Is Nothing Then
|
If Not introSong Is Nothing Then
|
||||||
@ -421,7 +463,7 @@ Public Class MusicManager
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' intro was not requested or does not exist
|
' intro was not requested or does not exist
|
||||||
If Not _isIntroStarted AndAlso Not _fadeIntoIntro Then
|
If Not _isIntroStarted AndAlso Not _fadeIntoIntro AndAlso AfterBattleIntroSongName = "" Then
|
||||||
If loopSong = True Then
|
If loopSong = True Then
|
||||||
_isLooping = True
|
_isLooping = True
|
||||||
Else
|
Else
|
||||||
|
@ -504,10 +504,37 @@
|
|||||||
Player.Temp.BeforeBattlePosition = Screen.Camera.Position
|
Player.Temp.BeforeBattlePosition = Screen.Camera.Position
|
||||||
Player.Temp.BeforeBattleLevelFile = Screen.Level.LevelFile
|
Player.Temp.BeforeBattleLevelFile = Screen.Level.LevelFile
|
||||||
Player.Temp.BeforeBattleFacing = Screen.Camera.GetPlayerFacingDirection()
|
Player.Temp.BeforeBattleFacing = Screen.Camera.GetPlayerFacingDirection()
|
||||||
MusicManager.Play(MusicLoop, False, 0F, False)
|
Dim b As BattleSystem.BattleScreen = CType(Me.NewScreen, BattleSystem.BattleScreen)
|
||||||
|
|
||||||
If Not MusicManager.CurrentSong Is Nothing Then
|
If b.IsPVPBattle = True Then
|
||||||
Me.duration = MusicManager.CurrentSong.Duration
|
MusicManager.Play(MusicLoop, False, 0.0F, False, "pvp")
|
||||||
|
Else
|
||||||
|
If b.IsTrainerBattle = True Then
|
||||||
|
MusicManager.Play(MusicLoop, False, 0.0F, False, Trainer.GetBattleMusicName())
|
||||||
|
ElseIf Screen.Level.IsSafariZone = True Or Screen.Level.IsBugCatchingContest = True Then
|
||||||
|
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
|
||||||
|
MusicManager.Play(MusicLoop, False, 0.0F, False, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
|
||||||
|
Else
|
||||||
|
MusicManager.Play(MusicLoop, False, 0.0F, False, "johto_wild")
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If BattleSystem.BattleScreen.CustomBattleMusic = "" OrElse MusicManager.SongExists(BattleSystem.BattleScreen.CustomBattleMusic) = False Then
|
||||||
|
If BattleSystem.BattleScreen.RoamingBattle = True AndAlso BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" AndAlso MusicManager.SongExists(BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop) = True Then
|
||||||
|
MusicManager.Play(MusicLoop, True, 0.0F, False, BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop)
|
||||||
|
Else
|
||||||
|
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
|
||||||
|
MusicManager.Play(MusicLoop, False, 0.0F, False, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
|
||||||
|
Else
|
||||||
|
MusicManager.Play(MusicLoop, False, 0.0F, False, "johto_wild")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
MusicManager.Play(MusicLoop, True, 0.0F, False, BattleSystem.BattleScreen.CustomBattleMusic)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If Not MusicLoop Is Nothing Then
|
||||||
|
Me.duration = MusicManager.GetSong(MusicLoop).Duration
|
||||||
Else
|
Else
|
||||||
Me.duration = New TimeSpan(0)
|
Me.duration = New TimeSpan(0)
|
||||||
End If
|
End If
|
||||||
|
Loading…
x
Reference in New Issue
Block a user