Implement fade into the next song in command

This commit is contained in:
JappaWakka 2023-11-28 09:53:20 +01:00
parent a8b022c613
commit 864fa7f508
3 changed files with 25 additions and 5 deletions

View File

@ -520,14 +520,22 @@ Public Class MusicManager
If _isFadingIn Then If _isFadingIn Then
Return Playlist(0).Name Return Playlist(0).Name
Else Else
If Playlist(1) IsNot Nothing Then
Return Playlist(1).Name Return Playlist(1).Name
Else
Return Playlist(0).Name
End If
End If End If
Else Else
If _isIntroStarted Then If _isIntroStarted Then
If Playlist(1) IsNot Nothing Then
Return Playlist(1).Name Return Playlist(1).Name
Else Else
Return Playlist(0).Name Return Playlist(0).Name
End If End If
Else
Return Playlist(0).Name
End If
End If End If
ElseIf Playlist.Count = 1 Then ElseIf Playlist.Count = 1 Then
Return Playlist(0).Name Return Playlist(0).Name

View File

@ -13,10 +13,22 @@
Select Case command.ToLower() Select Case command.ToLower()
Case "play" Case "play"
Dim LoopSong As Boolean = True Dim LoopSong As Boolean = True
Dim FadeIntoSong As Boolean = False
If argument.Split(",").Length > 1 Then If argument.Split(",").Length > 1 Then
If argument.GetSplit(1, ",") <> "" Then
LoopSong = CBool(argument.GetSplit(1, ",")) LoopSong = CBool(argument.GetSplit(1, ","))
End If End If
End If
If argument.Split(",").Length > 2 Then
FadeIntoSong = CBool(argument.GetSplit(2, ","))
End If
If FadeIntoSong = False Then
MusicManager.Play(argument.GetSplit(0, ","), True, LoopSong) MusicManager.Play(argument.GetSplit(0, ","), True, LoopSong)
Else
MusicManager.Play(argument.GetSplit(0, ","), True, 0.01F, LoopSong)
End If
If LoopSong = True Then If LoopSong = True Then
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then

View File

@ -171,7 +171,7 @@ Namespace ScriptVersion2
Private Shared Sub DoMusic() Private Shared Sub DoMusic()
' Commands: ' Commands:
r(New ScriptCommand("music", "play", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str), r(New ScriptCommand("music", "play", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str),
New ScriptArgument("loopSong", ScriptArgument.ArgumentTypes.Bool, True, "true")}.ToList(), "Changes the currently playing music to a new one.")) New ScriptArgument("loopSong", ScriptArgument.ArgumentTypes.Bool, True, "true"), New ScriptArgument("fadeIntoSong", ScriptArgument.ArgumentTypes.Bool, True, "false")}.ToList(), "Changes the currently playing music to a new one."))
r(New ScriptCommand("music", "forceplay", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the currently playing music to a new one and prevents the music from being changed by warps or surfing/riding and such.")) r(New ScriptCommand("music", "forceplay", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the currently playing music to a new one and prevents the music from being changed by warps or surfing/riding and such."))
r(New ScriptCommand("music", "unforce", "Allows warps and surfing/riding etc. to change the music again.")) r(New ScriptCommand("music", "unforce", "Allows warps and surfing/riding etc. to change the music again."))
r(New ScriptCommand("music", "setmusicloop", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the map musicloop to a new musicfile.")) r(New ScriptCommand("music", "setmusicloop", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the map musicloop to a new musicfile."))