Fix for texture bugs

Rival rename texture bug, potential Trainer texture bugs and Player rename texture bugs fixed
This commit is contained in:
JappaWakka 2022-06-11 14:46:21 +02:00
parent 3d25b132bb
commit c6c7ef236d
7 changed files with 119 additions and 19 deletions

View File

@ -788,8 +788,16 @@
Next
If Not t Is Nothing And Not tempPlayer Is Nothing Then
Dim FrameSize As Vector2
If t.Width = t.Height / 2 Then
FrameSize = New Vector2(CInt(t.Width / 2), CInt(t.Height / 4))
ElseIf t.Width = t.Height Then
FrameSize = New Vector2(CInt(t.Width / 4), CInt(t.Height / 4))
Else
FrameSize = New Vector2(CInt(t.Width / 3), CInt(t.Height / 4))
End If
Core.SpriteBatch.DrawString(FontManager.MainFont, tempPlayer.Name, New Vector2(Core.windowSize.Width - 260, 215), Color.Black, 0.0F, Vector2.Zero, 1.5F, SpriteEffects.None, 0.0F)
Core.SpriteBatch.Draw(t, New Rectangle(CInt(Core.windowSize.Width - 340), 200, 64, 64), New Rectangle(0, 64, 32, 32), Color.White)
Core.SpriteBatch.Draw(t, New Rectangle(CInt(Core.windowSize.Width - 340), 200, 64, 64), New Rectangle(0, CInt(FrameSize.Y * 2), CInt(FrameSize.X), CInt(FrameSize.Y)), Color.White)
End If
Canvas.DrawRectangle(New Rectangle(CInt(Core.windowSize.Width - 400), 264, 400, 32), New Color(6, 77, 139))

View File

@ -171,18 +171,34 @@
Private Sub DrawTrainerIntro()
Dim barPosition As Vector2 = New Vector2(Trainer.BarImagePosition.X * 128, Trainer.BarImagePosition.Y * 128)
Dim VSPosition As Vector2 = New Vector2(Trainer.VSImagePosition.X * 128, Trainer.VSImagePosition.Y * 128 + 64)
Dim TrainerFrameSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName).Width / 3), CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName).Height / 4))
Dim TrainerTexture1 As Texture2D = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName)
Dim TrainerTexture2 As Texture2D = Nothing
Dim Trainer1FrameSize As Size = Nothing
Dim Trainer2FrameSize As Size = Nothing
If Trainer.VSImageOrigin <> "VSIntro" Then
VSPosition.Y -= 64
End If
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 2), CInt(TrainerTexture1.Height / 4))
ElseIf TrainerTexture1.Width = TrainerTexture1.Height Then
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 4), CInt(TrainerTexture1.Height / 4))
Else
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 3), CInt(TrainerTexture1.Height / 4))
End If
Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "")
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\" & Trainer.VSImageOrigin, New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), Trainer.VSImageSize.Width, Trainer.VSImageSize.Height), "")
Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, TrainerFrameSize.Height * 2, TrainerFrameSize.Width, TrainerFrameSize.Height))
Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, Trainer1FrameSize.Height * 2, Trainer1FrameSize.Width, Trainer1FrameSize.Height))
Dim t4 As Texture2D = Nothing
If Trainer.DoubleTrainer = True Then
Dim Trainer2FrameSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2).Width / 3), CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2).Height / 4))
TrainerTexture2 = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2)
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 2), CInt(TrainerTexture2.Height / 4))
ElseIf TrainerTexture1.Width = TrainerTexture1.Height Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 4), CInt(TrainerTexture2.Height / 4))
Else
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 3), CInt(TrainerTexture2.Height / 4))
End If
t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, Trainer2FrameSize.Height * 2, Trainer2FrameSize.Width, Trainer2FrameSize.Height))
End If
@ -239,14 +255,32 @@
Private Sub DrawFaceshotIntro()
Dim barPosition As Vector2 = New Vector2(Trainer.BarImagePosition.X * 128, Trainer.BarImagePosition.Y * 128)
Dim VSPosition As Vector2 = New Vector2(Trainer.VSImagePosition.X * 128, Trainer.VSImagePosition.Y * 128 + 64)
Dim TrainerFrameSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName).Width / 3), CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName).Height / 4))
Dim TrainerTexture1 As Texture2D = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName)
Dim TrainerTexture2 As Texture2D = Nothing
Dim Trainer1FrameSize As Size = Nothing
Dim Trainer2FrameSize As Size = Nothing
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 2), CInt(TrainerTexture1.Height / 4))
ElseIf TrainerTexture1.Width = TrainerTexture1.Height Then
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 4), CInt(TrainerTexture1.Height / 4))
Else
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 3), CInt(TrainerTexture1.Height / 4))
End If
Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "")
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), 61, 54), "")
Dim t3 As Texture2D = TextureManager.GetTexture("NPC\" & Trainer.SpriteName, New Rectangle(0, TrainerFrameSize.Height * 2, TrainerFrameSize.Width, TrainerFrameSize.Height))
Dim t3 As Texture2D = TextureManager.GetTexture(TrainerTexture1, New Rectangle(0, Trainer1FrameSize.Height * 2, Trainer1FrameSize.Width, Trainer1FrameSize.Height))
Dim t4 As Texture2D = Nothing
If Trainer.DoubleTrainer = True Then
Dim Trainer2FrameSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2).Width / 3), CInt(TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2).Height / 4))
TrainerTexture2 = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2)
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 2), CInt(TrainerTexture2.Height / 4))
ElseIf TrainerTexture1.Width = TrainerTexture1.Height Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 4), CInt(TrainerTexture2.Height / 4))
Else
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 3), CInt(TrainerTexture2.Height / 4))
End If
t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, Trainer2FrameSize.Height * 2, Trainer2FrameSize.Width, Trainer2FrameSize.Height))
End If
@ -254,7 +288,14 @@
If GameJolt.Emblem.HasDownloadedSprite(Trainer.GameJoltID) = True Then
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then
Dim spriteSize As New Vector2(CInt(t.Width / 3), CInt(t.Height / 4))
Dim spriteSize As Vector2
If t.Width = t.Height / 2 Then
spriteSize = New Vector2(CInt(t.Width / 2), CInt(t.Height / 4))
ElseIf t.Width = t.Height Then
spriteSize = New Vector2(CInt(t.Width / 4), CInt(t.Height / 4))
Else
spriteSize = New Vector2(CInt(t.Width / 3), CInt(t.Height / 4))
End If
t3 = TextureManager.GetTexture(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
End If
End If
@ -270,7 +311,7 @@
Next
Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, blackPosition), Color.Black)
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - trainerPosition, CInt(Core.windowSize.Height / 2) - 96, 256, 224), New Rectangle(0, 0, 32, 28), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(CInt(Core.windowSize.Width - trainerPosition), CInt(Core.windowSize.Height / 2 - 96), 256, 224), New Rectangle(0, 0, t3.Width, CInt(t3.Height * 0.875)), Color.White)
Core.SpriteBatch.Draw(t2, New Rectangle(trainerPosition - 61 * 4, CInt(Core.windowSize.Height / 2) - 96, 61 * 4, 54 * 4), Color.White)
Canvas.DrawRectangle(New Rectangle(0, Core.windowSize.Height - blackPosition, Core.windowSize.Width, blackPosition), Color.Black)

View File

@ -313,7 +313,14 @@
For i = 0 To _sprites.Count - 1
Dim sprite As Texture2D = _sprites(i)
Dim frameSize As New Size(CInt(sprite.Width / 3), CInt(sprite.Height / 4))
Dim frameSize As Size
If sprite.Width = sprite.Height / 2 Then
frameSize = New Size(CInt(sprite.Width / 2), CInt(sprite.Height / 4))
ElseIf sprite.Width = sprite.Height Then
frameSize = New Size(CInt(sprite.Width / 4), CInt(sprite.Height / 4))
Else
frameSize = New Size(CInt(sprite.Width / 3), CInt(sprite.Height / 4))
End If
Dim outSize As Integer = 256 - Math.Abs(_index - i) * 30

View File

@ -1334,7 +1334,15 @@ Public Class NewMainMenuScreen
Else
If _loaded Then
Dim frameSize As Size = New Size(CInt(_sprite.Width / 3), CInt(_sprite.Height / 4))
Dim frameSize As Size
If _sprite.Width = _sprite.Height / 2 Then
frameSize = New Size(CInt(_sprite.Width / 2), CInt(_sprite.Height / 4))
ElseIf _sprite.Width = _sprite.Height Then
frameSize = New Size(CInt(_sprite.Width / 4), CInt(_sprite.Height / 4))
Else
frameSize = New Size(CInt(_sprite.Width / 3), CInt(_sprite.Height / 4))
End If
If isSelected Then
_spriteDelay -= 0.1F
If _spriteDelay <= 0F Then

View File

@ -79,7 +79,15 @@
Me.Index = 0
TextBox.reDelay = 0
Dim skinTexture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex))
Dim skinRectangle As New Rectangle(0, CInt(skinTexture2D.Height / 4 * 2), CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4))
Dim skinFrameSize As Size
If skinTexture2D.Width = skinTexture2D.Height / 2 Then
skinFrameSize = New Size(CInt(skinTexture2D.Width / 2), CInt(skinTexture2D.Height / 4))
ElseIf skinTexture2D.Width = skinTexture2D.Height Then
skinFrameSize = New Size(CInt(skinTexture2D.Width / 4), CInt(skinTexture2D.Height / 4))
Else
skinFrameSize = New Size(CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4))
End If
Dim skinRectangle As New Rectangle(0, CInt(skinFrameSize.Height * 2), CInt(skinFrameSize.Width), CInt(skinFrameSize.Height))
skinTexture = TextureManager.GetTexture(skinTexture2D, skinRectangle)
MusicManager.Play("nomusic")
@ -312,8 +320,18 @@
End Sub
Private Sub UpdateTextbox()
Dim skinTexture2D As Texture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex))
Core.SetScreen(New InputScreen(Core.CurrentScreen, skinNames(SkinIndex), InputScreen.InputModes.Name, skinNames(SkinIndex), 14, New List(Of Texture2D)({skinTexture2D}), AddressOf Me.ConfirmInput))
Dim skinTexture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex))
Dim skinFrameSize As Size
If skinTexture2D.Width = skinTexture2D.Height / 2 Then
skinFrameSize = New Size(CInt(skinTexture2D.Width / 2), CInt(skinTexture2D.Height / 4))
ElseIf skinTexture2D.Width = skinTexture2D.Height Then
skinFrameSize = New Size(CInt(skinTexture2D.Width / 4), CInt(skinTexture2D.Height / 4))
Else
skinFrameSize = New Size(CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4))
End If
Dim skinRectangle As New Rectangle(0, CInt(skinFrameSize.Height * 2), CInt(skinFrameSize.Width), CInt(skinFrameSize.Height))
skinTexture = TextureManager.GetTexture(skinTexture2D, skinRectangle)
Core.SetScreen(New InputScreen(Core.CurrentScreen, skinNames(SkinIndex), InputScreen.InputModes.Name, skinNames(SkinIndex), 14, New List(Of Texture2D)({skinTexture}), AddressOf Me.ConfirmInput))
End Sub
Private Sub ConfirmInput(ByVal input As String)

View File

@ -53,8 +53,14 @@
_charTexture = Screen.Level.OwnPlayer.Texture
End If
End If
Dim frameSize As Size = New Size(CInt(_charTexture.Width / 3), CInt(_charTexture.Height / 4))
Dim frameSize As Size
If _charTexture.Width = _charTexture.Height / 2 Then
frameSize = New Size(CInt(_charTexture.Width / 2), CInt(_charTexture.Height / 4))
ElseIf _charTexture.Width = _charTexture.Height Then
frameSize = New Size(CInt(_charTexture.Width / 4), CInt(_charTexture.Height / 4))
Else
frameSize = New Size(CInt(_charTexture.Width / 3), CInt(_charTexture.Height / 4))
End If
_charTexture = TextureManager.GetTexture(_charTexture, New Rectangle(0, frameSize.Height * 2, frameSize.Width, frameSize.Height))
_spriteBatch = New SpriteBatch(GraphicsDevice)

View File

@ -25,9 +25,21 @@
Core.Player.HasPokegear = True
IsReady = True
Case "renamerival"
Dim RivalTexture As String = GameModeManager.ActiveGameMode.ContentPath & "Textures\" & Core.Player.RivalSkin
Dim RivalTexture2D As Texture2D = TextureManager.GetTexture(GameModeManager.ActiveGameMode.ContentPath & "Textures\NPC\" & Core.Player.RivalSkin)
Dim RivalFrameSize As Size
If RivalTexture2D.Width = RivalTexture2D.Height / 2 Then
RivalFrameSize = New Size(CInt(RivalTexture2D.Width / 2), CInt(RivalTexture2D.Height / 4))
ElseIf RivalTexture2D.Width = RivalTexture2D.Height Then
RivalFrameSize = New Size(CInt(RivalTexture2D.Width / 4), CInt(RivalTexture2D.Height / 4))
Else
RivalFrameSize = New Size(CInt(RivalTexture2D.Width / 3), CInt(RivalTexture2D.Height / 4))
End If
Dim RivalRectangle As New Rectangle(0, CInt(RivalFrameSize.Height * 2), CInt(RivalFrameSize.Width), CInt(RivalFrameSize.Height))
Dim RivalRenameSprite As Texture2D = TextureManager.GetTexture(RivalTexture2D, RivalRectangle)
Dim RivalName As String = Core.Player.RivalName
Core.SetScreen(New NameObjectScreen(Core.CurrentScreen, TextureManager.GetTexture(RivalTexture, New Rectangle(0, 64, 32, 32)), False, False, RivalName, "???", AddressOf Script.NameRival))
Core.SetScreen(New NameObjectScreen(Core.CurrentScreen, RivalRenameSprite, False, False, RivalName, "???", AddressOf Script.NameRival))
IsReady = True
CanContinue = False
Case "setrivalskin"