The dirty fixes: Part 2

This commit is contained in:
Aragas 2016-10-06 18:25:33 +03:00
parent 8922030727
commit 3ef08819a9
5 changed files with 47 additions and 10 deletions

View File

@ -225,6 +225,7 @@
Return 1
End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0)
@ -271,8 +272,9 @@
If r <> lastRectangle Then
lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1)
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If
End If
End Sub
@ -747,4 +749,9 @@
#End Region
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class

View File

@ -84,7 +84,7 @@
If Not OnlineSprite Is Nothing Then
Me.Texture = OnlineSprite
Else
If net.Pokemon3D.Game.TextureManager.TextureExist(texturePath) = True Then
If TextureManager.TextureExist(texturePath) = True Then
Logger.Debug("Change network texture to [" & texturePath & "]")
If texturePath.StartsWith("Pokemon\") = True Then
@ -93,10 +93,10 @@
Me.HasPokemonTexture = False
End If
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture(texturePath)
Me.Texture = TextureManager.GetTexture(texturePath)
Else
Logger.Debug("Texture fallback!")
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture("Textures\NPC\" & FallBack(Me.NetworkID))
Me.Texture = TextureManager.GetTexture("Textures\NPC\" & FallBack(Me.NetworkID))
End If
End If
End Sub
@ -124,6 +124,7 @@
Return texturePath & TextureID
End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0)
@ -156,8 +157,9 @@
If r <> lastRectangle Then
lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1)
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If
End If
End Sub
@ -370,4 +372,10 @@
Return Nothing
End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class

View File

@ -16,7 +16,7 @@
Dim AnimationDelay As Single = AnimationDelayLenght
Public Sub New(ByVal pos As Vector3, ByVal PokemonTexture As String, ByVal visible As Boolean)
MyBase.New(pos.X, pos.Y, pos.Z, "NetworkPokemon", {net.Pokemon3D.Game.TextureManager.DefaultTexture}, {0, 0}, False, 0, New Vector3(0.9F), BaseModel.BillModel, 0, "", New Vector3(1))
MyBase.New(pos.X, pos.Y, pos.Z, "NetworkPokemon", {TextureManager.DefaultTexture}, {0, 0}, False, 0, New Vector3(0.9F), BaseModel.BillModel, 0, "", New Vector3(1))
Me.Visible = visible
@ -97,10 +97,11 @@
Return True
End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture()
If Me.Texture Is Nothing Then
Dim path As String = Me.PokemonTexture.Replace("[POKEMON|N]", "Pokemon\Overworld\Normal\").Replace("[POKEMON|S]", "Pokemon\Overworld\Shiny\")
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture(path)
Me.Texture = TextureManager.GetTexture(path)
End If
Dim r As New Rectangle(0, 0, 0, 0)
@ -133,8 +134,9 @@
If r <> lastRectangle Then
lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1)
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If
End Sub
@ -173,4 +175,10 @@
Catch : End Try
End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class

View File

@ -34,6 +34,7 @@ Public Class OverworldPokemon
Me.DropUpdateUnlessDrawn = False
End Sub
Dim dispTex As Boolean = false
Private Sub ChangeTexture()
If Me.Texture Is Nothing Then
Me.Texture = PokemonReference.GetOverworldTexture()
@ -62,8 +63,9 @@ Public Class OverworldPokemon
If r <> lastRectangle Then
lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1)
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
End If
End Sub
@ -269,4 +271,9 @@ Public Class OverworldPokemon
Me.ChangeTexture()
End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class

View File

@ -113,6 +113,7 @@
End If
End Sub
Dim dispTex As Boolean = false
Public Sub ChangeTexture()
If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0)
@ -146,8 +147,9 @@
Core.Player.Skin = SkinName
Try
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1)
Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t
dispTex = true
Catch
Logger.Log(Logger.LogTypes.Warning, "OwnPlayer.vb: Error assigning a new texture to the player.")
End Try
@ -205,4 +207,9 @@
Return OwnPlayer.AnimationDelayLenght
End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class