mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-24 06:15:05 +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 currentRectangle As New Rectangle(0, 0, 0, 0)
|
||||
|
||||
Public Shared Property WaterSpeed As Integer = 8
|
||||
|
||||
Public Overrides Sub 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()
|
||||
End Sub
|
||||
@ -161,7 +163,7 @@
|
||||
|
||||
Public Overrides Sub UpdateEntity()
|
||||
If Not WaterAnimation Is Nothing Then
|
||||
WaterAnimation.Update(0.01)
|
||||
WaterAnimation.Update(0.005)
|
||||
If currentRectangle <> WaterAnimation.TextureRectangle Then
|
||||
ChangeTexture()
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
Dim tempRasterizer = GraphicsDevice.RasterizerState
|
||||
|
||||
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
|
||||
b.Draw({0, 1, 3, 2, 3, 0})
|
||||
@ -75,11 +75,12 @@
|
||||
Private _position As Vector3
|
||||
Private _rotation As Vector3
|
||||
Private _shader As Effect
|
||||
|
||||
Private _width 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 _setTexture As Boolean = False
|
||||
@ -106,7 +107,8 @@
|
||||
Select Case BackdropType.ToLower()
|
||||
Case "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"
|
||||
Me._backdropType = BackdropTypes.Grass
|
||||
Case "texture"
|
||||
@ -121,16 +123,11 @@
|
||||
|
||||
Select Case Me._backdropType
|
||||
Case BackdropTypes.Water
|
||||
_waterAnimationDelay -= 0.1F
|
||||
If _waterAnimationDelay <= 0.0F Then
|
||||
_waterAnimationDelay = 1.0F
|
||||
|
||||
_waterAnimationIndex += 1
|
||||
If _waterAnimationIndex = 3 Then
|
||||
_waterAnimationIndex = 0
|
||||
If Core.GameOptions.GraphicStyle = 1 Then
|
||||
If Not WaterAnimation Is Nothing Then
|
||||
WaterAnimation.Update(0.005)
|
||||
_backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "")
|
||||
End If
|
||||
|
||||
_backdropTexture = TextureManager.GetTexture("Backdrops\Water", New Rectangle(64 * _waterAnimationIndex, 0, 64, 64))
|
||||
End If
|
||||
Case BackdropTypes.Grass
|
||||
If Me._setTexture = False Then
|
||||
|
@ -9,27 +9,31 @@
|
||||
If System.IO.File.Exists(ContentPackFile) = True Then
|
||||
Dim Lines() As String = System.IO.File.ReadAllLines(ContentPackFile)
|
||||
For Each Line As String In Lines
|
||||
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 Line.GetSplit(0, "|").ToLower = "waterspeed" Then
|
||||
Water.WaterSpeed = CInt(Line.GetSplit(1, "|"))
|
||||
Else
|
||||
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
|
||||
TextureResolutions.Add(TextureName, Resolution)
|
||||
End If
|
||||
Case 4 'TextureReplacement
|
||||
Dim oldTextureName As String = Line.GetSplit(0, "|")
|
||||
Dim newTextureName As String = Line.GetSplit(2, "|")
|
||||
Dim oRS As String = Line.GetSplit(1, "|") 'oRS = oldRectangleSource
|
||||
Dim nRS As String = Line.GetSplit(3, "|") 'nRS = newRectangleSource
|
||||
If TextureResolutions.ContainsKey(TextureName) = False Then
|
||||
TextureResolutions.Add(TextureName, Resolution)
|
||||
End If
|
||||
Case 4 'TextureReplacement
|
||||
Dim oldTextureName As String = Line.GetSplit(0, "|")
|
||||
Dim newTextureName As String = Line.GetSplit(2, "|")
|
||||
Dim oRS As String = Line.GetSplit(1, "|") 'oRS = oldRectangleSource
|
||||
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 newTextureSource As New TextureSource(newTextureName, New Rectangle(CInt(nRS.GetSplit(0)), CInt(nRS.GetSplit(1)), CInt(nRS.GetSplit(2)), CInt(nRS.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))))
|
||||
|
||||
If TextureReplacements.ContainsKey(oldTextureSource) = False Then
|
||||
TextureReplacements.Add(oldTextureSource, newTextureSource)
|
||||
End If
|
||||
End Select
|
||||
If TextureReplacements.ContainsKey(oldTextureSource) = False Then
|
||||
TextureReplacements.Add(oldTextureSource, newTextureSource)
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
@ -504,6 +504,7 @@
|
||||
Core.GameOptions.SaveOptions()
|
||||
MusicManager.PlayNoMusic()
|
||||
ContentPackManager.Clear()
|
||||
Water.WaterSpeed = 8
|
||||
For Each s As String In Core.GameOptions.ContentPackNames
|
||||
ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat")
|
||||
Next
|
||||
|
Loading…
x
Reference in New Issue
Block a user