Jump Ledge sound plays later depending on speed

This commit is contained in:
JappaWakka 2025-02-01 18:05:38 +01:00
parent 1cdb83545e
commit 540186d2ea
4 changed files with 46 additions and 1 deletions

Binary file not shown.

View File

@ -174,6 +174,7 @@
MainGameFunctions.FunctionKeys()
MusicManager.Update()
SoundManager.Update()
GameMessage.Update()

View File

@ -19,7 +19,16 @@
Screen.Level.OverworldPokemon.Visible = False
Screen.Level.OverworldPokemon.warped = True
SoundManager.PlaySound("jump_ledge", False)
Dim delay As Date = Date.Now
If Screen.Level.Riding = True Then
delay = Date.Now.AddMilliseconds(401)
ElseIf Core.Player.IsRunning() = True Then
delay = Date.Now.AddMilliseconds(540)
Else
delay = Date.Now.AddMilliseconds(867)
End If
SoundManager.PlaySound("jump_ledge", False, delay)
Return False
End If

View File

@ -7,11 +7,28 @@
Public Shared Volume As Single = 1.0F
Public Shared Muted As Boolean = False
Public Shared DelayedDate As Date = Nothing
Public Shared DelayedSound As String = ""
Public Shared DelayedStopMusic As Boolean = False
Private Declare Function GetAudioOutputDevices Lib "winmm.dll" Alias "waveOutGetNumDevs" () As Integer
Private Shared Function HasOutputDeviceAvailable() As Boolean
Return GetAudioOutputDevices() > 0
End Function
Public Shared Sub Update()
If DelayedDate <> Nothing AndAlso DelayedSound <> "" Then
If Date.Now >= DelayedDate Then
PlaySound(DelayedSound, 0.0F, 0.0F, Volume, DelayedStopMusic)
DelayedDate = Nothing
DelayedSound = ""
DelayedStopMusic = False
End If
End If
End Sub
Private Shared Function AddSound(ByVal Name As String, ByVal forceReplace As Boolean) As Boolean
Try
Dim cContent As ContentManager = ContentPackManager.GetContentManager("Sounds\" & Name, ".xnb,.wav")
@ -64,10 +81,28 @@
Public Shared Sub PlaySound(soundFile As String)
PlaySound(soundFile, 0.0F, 0.0F, Volume, False)
End Sub
Public Shared Sub PlaySound(soundFile As String, Optional delay As Date = Nothing)
If delay = Nothing OrElse delay = Date.Now Then
PlaySound(soundFile, 0.0F, 0.0F, Volume, False)
Else
DelayedDate = delay
DelayedSound = soundFile
DelayedStopMusic = False
End If
End Sub
Public Shared Sub PlaySound(soundFile As String, stopMusic As Boolean)
PlaySound(soundFile, 0.0F, 0.0F, Volume, stopMusic)
End Sub
Public Shared Sub PlaySound(soundFile As String, stopMusic As Boolean, Optional delay As Date = Nothing)
If delay = Nothing OrElse delay = Date.Now Then
PlaySound(soundFile, 0.0F, 0.0F, Volume, stopMusic)
Else
DelayedDate = delay
DelayedSound = soundFile
DelayedStopMusic = stopMusic
End If
End Sub
Public Shared Sub PlaySound(soundFile As String, pitch As Single, pan As Single, volume As Single, stopMusic As Boolean)