JappaWakka fae7349356
Fix audio engine & contentpacks (#35)
* Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb)
Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues.
The game now directly loads .ogg files instead of the .wma/.xnb combination from before.
ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks).
To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen.

* Delete GameController.vb

* Add gamecontroller.vb back

* Fix sfx missing

* Battleintro doodle now doesn't loop anymore (for no trainer)
Changed the shutter sound (aka Large Door sound) to something more large door-y
Made the enter sound slightly louder
The enter sound now plays when going through any warp to or from an indoor map (including falling through holes)
The flying sound effect is played earlier in the animation after selecting a location
Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy"
The bump noise now also plays when bumping into something in first person
Fixed small gap between the end of the intro song and the start of the main song
Replaced some songs with better songs

* Fixed some more intro issues

* Forgot to change a thing

* Fixed an error where the main music would play, ignoring the muted musicmanager.

* fix indenting in musicmanager

* The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music.

* Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not.

* Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb.

* Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter.

* Added more music commands, added quite some menu select noises, will add more later

* More select sound effects!

* Fix music not resuming after soundeffect

* Trainer using item now plays the single_heal soundeffect

* Pokémon cries now sound louder

* Possibly fixing crash when playing Pokémon cry at volume higher than 0.71

* Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720.

* Sound effects now sound louder

* Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720."

This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea.

* Fixed the cause of why the title screen music plays even when the game is muted

* Tabs to spaces

* Revert

Co-authored-by: darkfire006 <blazer257@live.com>
Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com>
Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com>
Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 20:59:42 +03:00

109 lines
4.8 KiB
VB.net

Public Class WarpBlock
Inherits Entity
Public Overrides Sub Render()
Me.Draw(Me.Model, Textures, False)
End Sub
Public Overrides Function WalkAgainstFunction() As Boolean
Return Warp(False)
End Function
Public Function Warp(ByVal MapViewMode As Boolean) As Boolean
If IsValidLink(Me.AdditionalValue) = True And ScriptBlock.TriggeredScriptBlock = False Then
Dim destination As String = Me.AdditionalValue.GetSplit(0)
Dim link As String = Me.AdditionalValue
Dim c As Integer = 0
For e = 0 To link.Length - 1
If link(e) = CChar(",") Then
c += 1
End If
Next
If c >= 5 Then
Dim validRotations As New List(Of Integer)
Dim rotationData() As String = link.GetSplit(5, ",").Split(CChar("|"))
For Each Element As String In rotationData
validRotations.Add(CInt(Element))
Next
If validRotations.Contains(Screen.Camera.GetPlayerFacingDirection()) = False Then
Return True
End If
End If
If System.IO.File.Exists(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.MapPath & destination) = True Or System.IO.File.Exists(GameController.GamePath & "\Content\Data\maps\" & destination) = True Then
If MapViewMode = False Then
Screen.Level.WarpData.WarpDestination = Me.AdditionalValue.GetSplit(0)
Screen.Level.WarpData.WarpPosition = New Vector3(CSng(Me.AdditionalValue.GetSplit(1)), CSng(Me.AdditionalValue.GetSplit(2).Replace(".", GameController.DecSeparator)), CSng(Me.AdditionalValue.GetSplit(3)))
Screen.Level.WarpData.WarpRotations = CInt(Me.AdditionalValue.GetSplit(4))
Screen.Level.WarpData.DoWarpInNextTick = True
Screen.Level.WarpData.CorrectCameraYaw = Screen.Camera.Yaw
Screen.Level.WarpData.IsWarpBlock = True
Logger.Debug("Lock Camera")
CType(Screen.Camera, OverworldCamera).YawLocked = True
Else
Screen.Level = New Level()
Screen.Level.Load(Me.AdditionalValue.GetSplit(0))
Screen.Level.World.Initialize(Screen.Level.EnvironmentType, Screen.Level.WeatherType)
Screen.Camera.Position = New Vector3(CSng(Me.AdditionalValue.GetSplit(1)), CSng(Me.AdditionalValue.GetSplit(2).Replace(".", GameController.DecSeparator)), CSng(Me.AdditionalValue.GetSplit(3)))
End If
Else
CallError("Map file """ & GameModeManager.ActiveGameMode.MapPath & destination & """ does not exist.")
End If
End If
Return False
End Function
Public Shared Function IsValidLink(ByVal link As String) As Boolean
If link <> "" Then
If link.Contains(",") = True Then
Dim c As Integer = 0
For e = 0 To link.Length - 1
If link(e) = CChar(",") Then
c += 1
End If
Next
If c >= 4 Then
Dim destination As String = link.GetSplit(0)
If destination.EndsWith(".dat") = True Then
Dim x As String = link.GetSplit(1)
Dim y As String = link.GetSplit(2).Replace(".", GameController.DecSeparator)
Dim z As String = link.GetSplit(3)
Dim l As String = link.GetSplit(4)
If StringHelper.IsNumeric(x) = True And
StringHelper.IsNumeric(y) = True And
StringHelper.IsNumeric(z) = True And
StringHelper.IsNumeric(l) = True Then
Return True
Else
CallError("Position values are not numeric.")
Return False
End If
Else
CallError("Destination file is not a valid map file.")
Return False
End If
Else
CallError("Not enough or too much arguments to resolve the link.")
Return False
End If
Else
CallError("Link does not contain seperators or has wrong seperators.")
Return False
End If
Else
CallError("Link is empty.")
Return False
End If
End Function
Private Shared Sub CallError(ByVal ex As String)
Logger.Log(Logger.LogTypes.ErrorMessage, "WarpBlock.vb: Invalid warp! More information:" & ex)
End Sub
End Class