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,11 +520,19 @@ Public Class MusicManager
If _isFadingIn Then
Return Playlist(0).Name
Else
Return Playlist(1).Name
If Playlist(1) IsNot Nothing Then
Return Playlist(1).Name
Else
Return Playlist(0).Name
End If
End If
Else
If _isIntroStarted Then
Return Playlist(1).Name
If Playlist(1) IsNot Nothing Then
Return Playlist(1).Name
Else
Return Playlist(0).Name
End If
Else
Return Playlist(0).Name
End If

View File

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

View File

@ -171,7 +171,7 @@ Namespace ScriptVersion2
Private Shared Sub DoMusic()
' Commands:
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", "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."))