mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-26 23:34:58 +02:00
Water animation improvements
* Added the ability for contentpacks to change the animation speed of water * Water backdrops are synced to the current map's water animation speed
This commit is contained in:
parent
249a93bc3f
commit
ea0ab80ba6
Binary file not shown.
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -8,10 +8,12 @@
|
|||||||
Dim WaterAnimation As Animation
|
Dim WaterAnimation As Animation
|
||||||
Dim currentRectangle As New Rectangle(0, 0, 0, 0)
|
Dim currentRectangle As New Rectangle(0, 0, 0, 0)
|
||||||
|
|
||||||
|
Public Shared Property WaterSpeed As Integer = 8
|
||||||
|
|
||||||
Public Overrides Sub Initialize()
|
Public Overrides Sub Initialize()
|
||||||
MyBase.Initialize()
|
MyBase.Initialize()
|
||||||
|
|
||||||
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, 9, 15, 0)
|
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, WaterSpeed, 15, 0)
|
||||||
|
|
||||||
CreateWaterTextureTemp()
|
CreateWaterTextureTemp()
|
||||||
End Sub
|
End Sub
|
||||||
@ -161,7 +163,7 @@
|
|||||||
|
|
||||||
Public Overrides Sub UpdateEntity()
|
Public Overrides Sub UpdateEntity()
|
||||||
If Not WaterAnimation Is Nothing Then
|
If Not WaterAnimation Is Nothing Then
|
||||||
WaterAnimation.Update(0.01)
|
WaterAnimation.Update(0.005)
|
||||||
If currentRectangle <> WaterAnimation.TextureRectangle Then
|
If currentRectangle <> WaterAnimation.TextureRectangle Then
|
||||||
ChangeTexture()
|
ChangeTexture()
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
Dim tempRasterizer = GraphicsDevice.RasterizerState
|
Dim tempRasterizer = GraphicsDevice.RasterizerState
|
||||||
|
|
||||||
GraphicsDevice.RasterizerState = RasterizerState.CullNone
|
GraphicsDevice.RasterizerState = RasterizerState.CullNone
|
||||||
GraphicsDevice.SamplerStates(0) = New SamplerState() With {.AddressU = TextureAddressMode.Wrap, .AddressV = TextureAddressMode.Wrap}
|
GraphicsDevice.SamplerStates(0) = New SamplerState() With {.Filter = TextureFilter.Point, .AddressU = TextureAddressMode.Wrap, .AddressV = TextureAddressMode.Wrap}
|
||||||
|
|
||||||
For Each b As Backdrop In Me._backdrops
|
For Each b As Backdrop In Me._backdrops
|
||||||
b.Draw({0, 1, 3, 2, 3, 0})
|
b.Draw({0, 1, 3, 2, 3, 0})
|
||||||
@ -75,11 +75,12 @@
|
|||||||
Private _position As Vector3
|
Private _position As Vector3
|
||||||
Private _rotation As Vector3
|
Private _rotation As Vector3
|
||||||
Private _shader As Effect
|
Private _shader As Effect
|
||||||
|
|
||||||
Private _width As Integer = 0
|
Private _width As Integer = 0
|
||||||
Private _height As Integer = 0
|
Private _height As Integer = 0
|
||||||
|
|
||||||
Private _waterAnimationDelay As Single = 1.0F
|
Dim WaterAnimation As Animation
|
||||||
|
|
||||||
|
Private _waterAnimationDelay As Single = CSng(1 / Water.WaterSpeed)
|
||||||
Private _waterAnimationIndex As Integer = 0
|
Private _waterAnimationIndex As Integer = 0
|
||||||
|
|
||||||
Private _setTexture As Boolean = False
|
Private _setTexture As Boolean = False
|
||||||
@ -106,7 +107,8 @@
|
|||||||
Select Case BackdropType.ToLower()
|
Select Case BackdropType.ToLower()
|
||||||
Case "water"
|
Case "water"
|
||||||
Me._backdropType = BackdropTypes.Water
|
Me._backdropType = BackdropTypes.Water
|
||||||
_backdropTexture = TextureManager.GetTexture("Backdrops\Water", New Rectangle(0, 0, 64, 64))
|
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Backdrops\Water"), 1, 3, 64, 64, Water.WaterSpeed, 0, 0)
|
||||||
|
_backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "")
|
||||||
Case "grass"
|
Case "grass"
|
||||||
Me._backdropType = BackdropTypes.Grass
|
Me._backdropType = BackdropTypes.Grass
|
||||||
Case "texture"
|
Case "texture"
|
||||||
@ -121,16 +123,11 @@
|
|||||||
|
|
||||||
Select Case Me._backdropType
|
Select Case Me._backdropType
|
||||||
Case BackdropTypes.Water
|
Case BackdropTypes.Water
|
||||||
_waterAnimationDelay -= 0.1F
|
If Core.GameOptions.GraphicStyle = 1 Then
|
||||||
If _waterAnimationDelay <= 0.0F Then
|
If Not WaterAnimation Is Nothing Then
|
||||||
_waterAnimationDelay = 1.0F
|
WaterAnimation.Update(0.005)
|
||||||
|
_backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "")
|
||||||
_waterAnimationIndex += 1
|
|
||||||
If _waterAnimationIndex = 3 Then
|
|
||||||
_waterAnimationIndex = 0
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_backdropTexture = TextureManager.GetTexture("Backdrops\Water", New Rectangle(64 * _waterAnimationIndex, 0, 64, 64))
|
|
||||||
End If
|
End If
|
||||||
Case BackdropTypes.Grass
|
Case BackdropTypes.Grass
|
||||||
If Me._setTexture = False Then
|
If Me._setTexture = False Then
|
||||||
|
@ -9,27 +9,31 @@
|
|||||||
If System.IO.File.Exists(ContentPackFile) = True Then
|
If System.IO.File.Exists(ContentPackFile) = True Then
|
||||||
Dim Lines() As String = System.IO.File.ReadAllLines(ContentPackFile)
|
Dim Lines() As String = System.IO.File.ReadAllLines(ContentPackFile)
|
||||||
For Each Line As String In Lines
|
For Each Line As String In Lines
|
||||||
Select Case Line.CountSplits("|")
|
If Line.GetSplit(0, "|").ToLower = "waterspeed" Then
|
||||||
Case 2 'ResolutionChange
|
Water.WaterSpeed = CInt(Line.GetSplit(1, "|"))
|
||||||
Dim TextureName As String = Line.GetSplit(0, "|")
|
Else
|
||||||
Dim Resolution As Single = CSng(Line.GetSplit(1, "|").Replace(".", GameController.DecSeparator))
|
Select Case Line.CountSplits("|")
|
||||||
|
Case 2 'ResolutionChange
|
||||||
|
Dim TextureName As String = Line.GetSplit(0, "|")
|
||||||
|
Dim Resolution As Single = CSng(Line.GetSplit(1, "|").Replace(".", GameController.DecSeparator))
|
||||||
|
|
||||||
If TextureResolutions.ContainsKey(TextureName) = False Then
|
If TextureResolutions.ContainsKey(TextureName) = False Then
|
||||||
TextureResolutions.Add(TextureName, Resolution)
|
TextureResolutions.Add(TextureName, Resolution)
|
||||||
End If
|
End If
|
||||||
Case 4 'TextureReplacement
|
Case 4 'TextureReplacement
|
||||||
Dim oldTextureName As String = Line.GetSplit(0, "|")
|
Dim oldTextureName As String = Line.GetSplit(0, "|")
|
||||||
Dim newTextureName As String = Line.GetSplit(2, "|")
|
Dim newTextureName As String = Line.GetSplit(2, "|")
|
||||||
Dim oRS As String = Line.GetSplit(1, "|") 'oRS = oldRectangleSource
|
Dim oRS As String = Line.GetSplit(1, "|") 'oRS = oldRectangleSource
|
||||||
Dim nRS As String = Line.GetSplit(3, "|") 'nRS = newRectangleSource
|
Dim nRS As String = Line.GetSplit(3, "|") 'nRS = newRectangleSource
|
||||||
|
|
||||||
Dim oldTextureSource As New TextureSource(oldTextureName, New Rectangle(CInt(oRS.GetSplit(0)), CInt(oRS.GetSplit(1)), CInt(oRS.GetSplit(2)), CInt(oRS.GetSplit(3))))
|
Dim oldTextureSource As New TextureSource(oldTextureName, New Rectangle(CInt(oRS.GetSplit(0)), CInt(oRS.GetSplit(1)), CInt(oRS.GetSplit(2)), CInt(oRS.GetSplit(3))))
|
||||||
Dim newTextureSource As New TextureSource(newTextureName, New Rectangle(CInt(nRS.GetSplit(0)), CInt(nRS.GetSplit(1)), CInt(nRS.GetSplit(2)), CInt(nRS.GetSplit(3))))
|
Dim newTextureSource As New TextureSource(newTextureName, New Rectangle(CInt(nRS.GetSplit(0)), CInt(nRS.GetSplit(1)), CInt(nRS.GetSplit(2)), CInt(nRS.GetSplit(3))))
|
||||||
|
|
||||||
If TextureReplacements.ContainsKey(oldTextureSource) = False Then
|
If TextureReplacements.ContainsKey(oldTextureSource) = False Then
|
||||||
TextureReplacements.Add(oldTextureSource, newTextureSource)
|
TextureReplacements.Add(oldTextureSource, newTextureSource)
|
||||||
End If
|
End If
|
||||||
End Select
|
End Select
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
@ -504,6 +504,7 @@
|
|||||||
Core.GameOptions.SaveOptions()
|
Core.GameOptions.SaveOptions()
|
||||||
MusicManager.PlayNoMusic()
|
MusicManager.PlayNoMusic()
|
||||||
ContentPackManager.Clear()
|
ContentPackManager.Clear()
|
||||||
|
Water.WaterSpeed = 8
|
||||||
For Each s As String In Core.GameOptions.ContentPackNames
|
For Each s As String In Core.GameOptions.ContentPackNames
|
||||||
ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat")
|
ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat")
|
||||||
Next
|
Next
|
||||||
|
Loading…
x
Reference in New Issue
Block a user