diff --git a/P3D/Content/Sounds/jump_ledge.wav b/P3D/Content/Sounds/jump_ledge.wav index 180ff7702..82a9d4431 100644 Binary files a/P3D/Content/Sounds/jump_ledge.wav and b/P3D/Content/Sounds/jump_ledge.wav differ diff --git a/P3D/Core/Core.vb b/P3D/Core/Core.vb index c478621bd..67f9bd540 100644 --- a/P3D/Core/Core.vb +++ b/P3D/Core/Core.vb @@ -174,6 +174,7 @@ MainGameFunctions.FunctionKeys() MusicManager.Update() + SoundManager.Update() GameMessage.Update() diff --git a/P3D/Entites/Enviroment/StepBlock.vb b/P3D/Entites/Enviroment/StepBlock.vb index ee92a4c4b..99905c3b1 100644 --- a/P3D/Entites/Enviroment/StepBlock.vb +++ b/P3D/Entites/Enviroment/StepBlock.vb @@ -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 diff --git a/P3D/Resources/Sound/SoundManager.vb b/P3D/Resources/Sound/SoundManager.vb index 43de65f24..0d09d2181 100644 --- a/P3D/Resources/Sound/SoundManager.vb +++ b/P3D/Resources/Sound/SoundManager.vb @@ -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)