Fix water textures not rotating on fast graphics

This commit is contained in:
JappaWakka 2023-11-13 12:59:19 +01:00
parent fef6b689ea
commit d516a1e152
2 changed files with 111 additions and 109 deletions

View File

@ -15,6 +15,7 @@
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, GameModeManager.ActiveGameMode.WaterSpeed, 15, 0)
CreateWaterTextureTemp()
ChangeTexture()
End Sub
Public Shared Sub ClearAnimationResources()
@ -195,65 +196,64 @@
End Function
Public Overrides Sub UpdateEntity()
If Not WaterAnimation Is Nothing Then
WaterAnimation.Update(0.005)
If currentRectangle <> WaterAnimation.TextureRectangle Then
ChangeTexture()
If Core.GameOptions.GraphicStyle = 1 Then
If Not WaterAnimation Is Nothing Then
WaterAnimation.Update(0.005)
If currentRectangle <> WaterAnimation.TextureRectangle Then
ChangeTexture()
currentRectangle = WaterAnimation.TextureRectangle
currentRectangle = WaterAnimation.TextureRectangle
End If
End If
End If
MyBase.UpdateEntity()
End Sub
Private Sub ChangeTexture()
If Core.GameOptions.GraphicStyle = 1 Then
If WaterTexturesTemp.Count = 0 OrElse Water.WaterTexturesTemp.ContainsKey("_0") = False OrElse Water.WaterTexturesTemp.ContainsKey(AdditionalValue & "_0") = False Then
ClearAnimationResources()
AddDefaultWaterAnimationResources()
CreateWaterTextureTemp()
End If
Select Case Me.Rotation.Y
Case 0, MathHelper.TwoPi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_0")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_1")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_2")
End Select
Case MathHelper.Pi * 0.5F
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_3")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_4")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_5")
End Select
Case MathHelper.Pi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_6")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_7")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_8")
End Select
Case MathHelper.Pi * 1.5
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_9")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_10")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_11")
End Select
End Select
If WaterTexturesTemp.Count = 0 OrElse Water.WaterTexturesTemp.ContainsKey("_0") = False OrElse Water.WaterTexturesTemp.ContainsKey(AdditionalValue & "_0") = False Then
ClearAnimationResources()
AddDefaultWaterAnimationResources()
CreateWaterTextureTemp()
End If
Select Case Me.Rotation.Y
Case 0, MathHelper.TwoPi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_0")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_1")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_2")
End Select
Case MathHelper.Pi * 0.5F
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_3")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_4")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_5")
End Select
Case MathHelper.Pi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_6")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_7")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_8")
End Select
Case MathHelper.Pi * 1.5
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_9")
Case 1
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_10")
Case 2
Me.Textures(0) = Water.WaterTexturesTemp(waterTextureName & "_11")
End Select
End Select
End Sub
Public Overrides Sub ResultFunction(ByVal Result As Integer)

View File

@ -35,6 +35,7 @@
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, 9, 13, 0)
CreateWaterTextureTemp()
ChangeTexture()
End Sub
Private Sub CreateWaterTextureTemp()
@ -116,12 +117,15 @@
End Sub
Public Overrides Sub UpdateEntity()
If Not WaterAnimation Is Nothing Then
WaterAnimation.Update(0.01)
If currentRectangle <> WaterAnimation.TextureRectangle Then
ChangeTexture()
currentRectangle = WaterAnimation.TextureRectangle
If Core.GameOptions.GraphicStyle = 1 Then
If Not WaterAnimation Is Nothing Then
WaterAnimation.Update(0.01)
If currentRectangle <> WaterAnimation.TextureRectangle Then
ChangeTexture()
currentRectangle = WaterAnimation.TextureRectangle
End If
End If
End If
@ -129,60 +133,58 @@
End Sub
Private Sub ChangeTexture()
If Core.GameOptions.GraphicStyle = 1 Then
If WaterfallTexturesTemp.Count = 0 Or WaterTexturesTemp.Count = 0 OrElse Waterfall.WaterTexturesTemp.ContainsKey("_0") = False OrElse Waterfall.WaterTexturesTemp.ContainsKey(AdditionalValue & "_0") = False Then
ClearAnimationResources()
AddDefaultWaterAnimationResources()
CreateWaterTextureTemp()
End If
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_0")
Case 1
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_1")
Case 2
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_2")
End Select
Select Case Me.Rotation.Y
Case 0, MathHelper.TwoPi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_0")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_1")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_2")
End Select
Case MathHelper.Pi * 0.5F
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_3")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_4")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_5")
End Select
Case MathHelper.Pi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_6")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_7")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_8")
End Select
Case MathHelper.Pi * 1.5
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_9")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_10")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_11")
End Select
End Select
If WaterfallTexturesTemp.Count = 0 Or WaterTexturesTemp.Count = 0 OrElse Waterfall.WaterTexturesTemp.ContainsKey("_0") = False OrElse Waterfall.WaterTexturesTemp.ContainsKey(AdditionalValue & "_0") = False Then
ClearAnimationResources()
AddDefaultWaterAnimationResources()
CreateWaterTextureTemp()
End If
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_0")
Case 1
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_1")
Case 2
Me.Textures(0) = Waterfall.WaterfallTexturesTemp(waterFallTextureName & "_2")
End Select
Select Case Me.Rotation.Y
Case 0, MathHelper.TwoPi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_0")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_1")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_2")
End Select
Case MathHelper.Pi * 0.5F
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_3")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_4")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_5")
End Select
Case MathHelper.Pi
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_6")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_7")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_8")
End Select
Case MathHelper.Pi * 1.5
Select Case WaterAnimation.CurrentColumn
Case 0
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_9")
Case 1
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_10")
Case 2
Me.Textures(1) = Waterfall.WaterTexturesTemp(waterTextureName & "_11")
End Select
End Select
End Sub
Public Overrides Sub Render()