Fixes to scale and positioning of Pokémon sprites

This commit is contained in:
JappaWakka 2022-09-15 21:11:13 +02:00
parent 315c1063df
commit 5209a6e768
6 changed files with 26 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -56,7 +56,7 @@
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(CInt(p.X), CInt(p.Y), 320, 320))
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(CInt(p.X + 48), CInt(p.Y + 48), 256, 256), Color.White)
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(CInt(p.X + 160 + 16 - MathHelper.Min(Me.Texture.Width * 3, 288) / 2), CInt(p.Y + 160 + 16 - MathHelper.Min(Me.Texture.Height * 3, 288) / 2), MathHelper.Min(Me.Texture.Width * 3, 288), MathHelper.Min(Me.Texture.Height * 3, 288)), Color.White)
If Me.Delay = 0.0F Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Overworld\TextBox"), New Rectangle(CInt(p.X) + 144 + 160, CInt(p.Y) + 144 + 160 + 32, 16, 16), New Rectangle(0, 48, 16, 16), Color.White)

View File

@ -26,7 +26,7 @@
Dim ballPosition As Vector2
Dim ballIndex As Vector2 = New Vector2(0, 0)
Dim ballAnimationDelay As Single = 0.2F
Dim ballVelocity As Single = -4.0F
Dim ballVelocity As Single = -7.0F
Dim pokePosition As Vector2
Dim pokeID As Integer = 0
@ -232,10 +232,10 @@
Case 1
Core.SpriteBatch.Draw(mainTexture, New Rectangle(CInt(ballPosition.X), CInt(ballPosition.Y), 22, 22), New Rectangle(62 + CInt(ballIndex.X * 22), 48 + CInt(ballIndex.Y * 22), 22, 22), Color.White)
Case 2
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(pokePosition.X) - 100, CInt(pokePosition.Y) - 218, 256, 256), Color.White)
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(pokePosition.X) - MathHelper.Min(CInt(pokeTexture.Width), 128), CInt(pokePosition.Y) - MathHelper.Min(CInt(pokeTexture.Height), 128), MathHelper.Min(CInt(pokeTexture.Width * 2), 256), MathHelper.Min(CInt(pokeTexture.Height * 2), 256)), Color.White)
Case 3
If Index < 6 Then
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 300, CInt(Core.windowSize.Height / 2) - 218, 256, 256), New Color(255, 255, 255, ProfAlpha))
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(pokePosition.X) - MathHelper.Min(CInt(pokeTexture.Width), 128), CInt(Core.windowSize.Height / 2) - MathHelper.Min(CInt(pokeTexture.Height), 128), MathHelper.Min(CInt(pokeTexture.Width * 2), 256), MathHelper.Min(CInt(pokeTexture.Height * 2), 256)), New Color(255, 255, 255, ProfAlpha))
End If
End Select
@ -245,11 +245,11 @@
Select Case pokeIndex
Case 0
ballPosition = New Vector2(CInt(Core.windowSize.Width / 2) - 40, CInt(Core.windowSize.Height / 2) - 110)
pokePosition = New Vector2(CInt(Core.windowSize.Width / 2) - 200, CInt(Core.windowSize.Height / 2) - 110)
pokePosition = New Vector2(CInt(Core.windowSize.Width / 2) - MathHelper.Min(CInt(pokeTexture.Width * 2), 256), CInt(Core.windowSize.Height / 2 - MathHelper.Min(CInt(pokeTexture.Height * 2), 256)))
pokeIndex = 1
AnimateBall()
Case 1
If ballPosition.X > CInt(Core.windowSize.Width / 2) - 200 Then
If ballPosition.X > CInt(Core.windowSize.Width / 2) - MathHelper.Min(CInt(pokeTexture.Width * 2), 256) Then
ballPosition.X -= 3
ballPosition.Y += ballVelocity
ballVelocity += 0.2F

View File

@ -1333,7 +1333,7 @@ Public Class StorageSystemScreen
Draw3DModel(p, "Models\Pokemon\" & modelName & "\" & shinyString)
Else
GetYOffset(p)
Core.SpriteBatch.Draw(p.GetTexture(True), New Rectangle(660, 200 - yOffset, 256, 256), Color.White)
Core.SpriteBatch.Draw(p.GetTexture(True), New Rectangle(792 - CInt(MathHelper.Min(p.GetTexture(True).Width * 3, 288) / 2), 192 - yOffset, MathHelper.Min(p.GetTexture(True).Width * 3, 288), MathHelper.Min(p.GetTexture(True).Height * 3, 288)), Color.White)
End If
Canvas.DrawRectangle(New Rectangle(660, 472, 320, 240), c)

View File

@ -645,10 +645,10 @@ Public Class PokedexScreen
End While
If entryType = 0 Then
Core.SpriteBatch.DrawString(FontManager.MainFont, "???" & Environment.NewLine & Environment.NewLine & "No. " & no, New Vector2(830, 200), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, "???" & Environment.NewLine & Environment.NewLine & "No. " & no, New Vector2(864, 200), Color.White)
Else
Core.SpriteBatch.DrawString(FontManager.MainFont, p.GetName() & Environment.NewLine & Environment.NewLine & "No. " & no, New Vector2(830, 200), Color.White)
Core.SpriteBatch.Draw(p.GetTexture(True), New Rectangle(670, 140, 128, 128), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, p.GetName() & Environment.NewLine & Environment.NewLine & "No. " & no, New Vector2(864, 200), Color.White)
Core.SpriteBatch.Draw(p.GetTexture(True), New Rectangle(CInt(680 - p.GetTexture(True).Width / 4), CInt(140 - p.GetTexture(True).Height / 4), MathHelper.Min(CInt(p.GetTexture(True).Width * 2), 256), MathHelper.Min(CInt(p.GetTexture(True).Height * 2), 256)), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, "SPECIES", New Vector2(680, 310), Color.Black)
Core.SpriteBatch.DrawString(FontManager.MainFont, "TYPE", New Vector2(680, 350), Color.Black)
@ -685,14 +685,14 @@ Public Class PokedexScreen
Core.SpriteBatch.DrawString(FontManager.MainFont, p.PokedexEntry.Text.CropStringToWidth(FontManager.MainFont, 448), New Vector2(688, 490), Color.Black)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokedexhabitat", New Rectangle(160, 160, 10, 10), ""), New Rectangle(928, 242, 20, 20), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokedexhabitat", New Rectangle(160, 160, 10, 10), ""), New Rectangle(992, 242, 20, 20), Color.White)
Else
Core.SpriteBatch.DrawString(FontManager.MainFont, "??? Pokémon", New Vector2(850, 310), Color.Black)
Core.SpriteBatch.DrawString(FontManager.MainFont, "???", New Vector2(850, 350), Color.Black)
Core.SpriteBatch.DrawString(FontManager.MainFont, "??? m", New Vector2(850, 390), Color.Black)
Core.SpriteBatch.DrawString(FontManager.MainFont, "??? kg", New Vector2(850, 430), Color.Black)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokedexhabitat", New Rectangle(160, 170, 10, 10), ""), New Rectangle(928, 242, 20, 20), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokedexhabitat", New Rectangle(160, 170, 10, 10), ""), New Rectangle(992, 242, 20, 20), Color.White)
End If
End If
End Sub
@ -1449,8 +1449,8 @@ Public Class PokedexViewScreen
Dim playedCry As Boolean = False
Private Sub DrawPage1()
Dim v As Vector2 = Core.GetMiddlePosition(New Size(512, 512))
Core.SpriteBatch.Draw(Pokemon.GetTexture(Me.FrontView), New Rectangle(CInt(v.X), CInt(v.Y) - yOffset * 2, 512, 512), New Color(255, 255, 255, fadeMainImage))
Dim v As Vector2 = Core.GetMiddlePosition(New Size(MathHelper.Min(Pokemon.GetTexture(True).Width * 4, 512), MathHelper.Min(Pokemon.GetTexture(True).Height * 4, 512)))
Core.SpriteBatch.Draw(Pokemon.GetTexture(Me.FrontView), New Rectangle(CInt(v.X), CInt(v.Y) - yOffset * 2 + 32, MathHelper.Min(Pokemon.GetTexture(True).Width * 4, 512), MathHelper.Min(Pokemon.GetTexture(True).Height * 4, 512)), New Color(255, 255, 255, fadeMainImage))
If fadeMainImage = 255 Then
Dim mV As Vector2 = Core.GetMiddlePosition(New Size(0, 0))

View File

@ -114,11 +114,11 @@
End Sub
Public Overrides Sub Render()
Dim PokemonTexture = GetPokemon().GetTexture(True)
_pixelFade = 1 'Remove when pixel fading effect is properly implemented.
Dim pixelSize As Integer = CInt(256 * _pixelFade).Clamp(16, 256)
If pixelSize = 256 Or Core.GraphicsManager.IsFullScreen = True Then
Dim pixelSize As Integer = CInt(MathHelper.Min(PokemonTexture.Width * 3, 288) * _pixelFade).Clamp(16, MathHelper.Min(PokemonTexture.Width * 3, 288))
If pixelSize = MathHelper.Min(PokemonTexture.Width * 3, 288) Or Core.GraphicsManager.IsFullScreen = True Then
pixeledPokemonTexture = GetPokemon().GetTexture(True)
Else
Dim pixeled As New RenderTarget2D(GraphicsDevice, pixelSize, pixelSize, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents)
@ -126,15 +126,15 @@
GraphicsDevice.Clear(Color.Transparent)
Dim s As New SpriteBatch(GraphicsDevice)
s.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise)
s.Draw(GetPokemon().GetTexture(True), New Rectangle(0, 0, pixelSize, pixelSize), Color.White)
s.Draw(PokemonTexture, New Rectangle(0, 0, pixelSize, pixelSize), Color.White)
s.End()
Dim dePixeled As New RenderTarget2D(GraphicsDevice, 256, 256, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents)
Dim dePixeled As New RenderTarget2D(GraphicsDevice, MathHelper.Min(PokemonTexture.Width * 3, 288), MathHelper.Min(PokemonTexture.Height * 3, 288), False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents)
GraphicsDevice.SetRenderTarget(dePixeled)
GraphicsDevice.Clear(Color.Transparent)
s = New SpriteBatch(GraphicsDevice)
s.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise)
s.Draw(pixeled, New Rectangle(0, 0, 256, 256), Color.White)
s.Draw(pixeled, New Rectangle(0, 0, MathHelper.Min(PokemonTexture.Width * 3, 288), MathHelper.Min(PokemonTexture.Height * 3, 288)), Color.White)
s.End()
pixeledPokemonTexture = dePixeled
@ -201,17 +201,15 @@
'Draw Pokémon preview:
If _enrollY >= 160 Then
Dim height As Integer = CInt(_enrollY - 160).Clamp(0, 256)
Dim pokemonTexture = GetPokemon().GetTexture(_isFront)
Dim textureHeight As Integer = CInt(pokemonTexture.Height * (height / 256))
Dim height As Integer = CInt(_enrollY - 160).Clamp(0, MathHelper.Min(pokemonTexture.Height * 3, 288))
Dim pokemonTextureOffset As Integer = 0 + 8
If GetPokemon().IsEgg() = True Then
pokemonTextureOffset = 32 + 8 + 8
End If
Dim textureHeight As Integer = CInt(pokemonTexture.Height * (height / MathHelper.Min(pokemonTexture.Height * 3, 288)))
SpriteBatch.Draw(pokemonTexture, New Rectangle(DeltaX + 20 + 10, DeltaY + 64 - _yOffset + pokemonTextureOffset + 10, 256, height), New Rectangle(0, 0, pokemonTexture.Width, textureHeight), New Color(0, 0, 0, 150))
SpriteBatch.Draw(pokemonTexture, New Rectangle(DeltaX + 20, DeltaY + 64 - _yOffset + pokemonTextureOffset, 256, height), New Rectangle(0, 0, pokemonTexture.Width, textureHeight), Color.White)
Dim pokemonTextureOffset As Integer = CInt(MathHelper.Min(pokemonTexture.Height * 3, 288) / 2)
SpriteBatch.Draw(pokemonTexture, New Rectangle(DeltaX + 144 - CInt(MathHelper.Min(pokemonTexture.Width * 3, 288) / 2) + 10, DeltaY + 208 - _yOffset - pokemonTextureOffset + 10, MathHelper.Min(pokemonTexture.Width * 3, 288), height), New Rectangle(0, 0, pokemonTexture.Width, textureHeight), New Color(0, 0, 0, 150))
SpriteBatch.Draw(pokemonTexture, New Rectangle(DeltaX + 144 - CInt(MathHelper.Min(pokemonTexture.Width * 3, 288) / 2), DeltaY + 208 - _yOffset - pokemonTextureOffset, MathHelper.Min(pokemonTexture.Width * 3, 288), height), New Rectangle(0, 0, pokemonTexture.Width, textureHeight), Color.White)
End If
'Draw main infos: