Fix Pokedex switch entry

This commit is contained in:
JappaWakka 2023-07-19 17:29:10 +02:00
parent 3f6f42bd8c
commit 3176c6b9cb

View File

@ -349,7 +349,7 @@ Public Class PokedexScreen
Public Shared TempPokemonStorage As New Dictionary(Of Integer, Pokemon) Public Shared TempPokemonStorage As New Dictionary(Of Integer, Pokemon)
Shared TempPokemonDexType As New Dictionary(Of Integer, Integer) Shared TempPokemonDexType As New Dictionary(Of Integer, Integer)
Dim PokemonList As New List(Of Pokemon) Public PokemonList As New List(Of Pokemon)
Dim menu As SelectMenu Dim menu As SelectMenu
Public Sub New(ByVal currentScreen As Screen, ByVal Profile As PokedexSelectScreen.PokedexProfile, ByVal Habitat As Habitat) Public Sub New(ByVal currentScreen As Screen, ByVal Profile As PokedexSelectScreen.PokedexProfile, ByVal Habitat As Habitat)
@ -811,7 +811,7 @@ Public Class PokedexScreen
If TempPokemonDexType(dexIndex) > 0 Then If TempPokemonDexType(dexIndex) > 0 Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
Core.SetScreen(New PokedexViewScreen(Me, TempPokemonStorage(dexIndex), False, dexIndex)) Core.SetScreen(New PokedexViewScreen(Me, TempPokemonStorage(dexIndex), False, dexIndex - 1))
End If End If
Else Else
Cursor.X = x Cursor.X = x
@ -827,7 +827,7 @@ Public Class PokedexScreen
Dim dexIndex As Integer = CInt((Cursor.Y + Scroll) * 6 + Cursor.X + 1) Dim dexIndex As Integer = CInt((Cursor.Y + Scroll) * 6 + Cursor.X + 1)
If TempPokemonDexType(dexIndex) > 0 Then If TempPokemonDexType(dexIndex) > 0 Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
Core.SetScreen(New PokedexViewScreen(Me, TempPokemonStorage(dexIndex), False, dexIndex)) Core.SetScreen(New PokedexViewScreen(Me, TempPokemonStorage(dexIndex), False, dexIndex - 1))
End If End If
End If End If
@ -1367,20 +1367,26 @@ Public Class PokedexViewScreen
Private Sub LoadPokemonData(ByVal newDexIndex As Integer, Optional ByVal newPokemon As Pokemon = Nothing, Optional playCry As Boolean = False) Private Sub LoadPokemonData(ByVal newDexIndex As Integer, Optional ByVal newPokemon As Pokemon = Nothing, Optional playCry As Boolean = False)
Dim oldCry As String = "" Dim oldCry As String = ""
Dim oldNumber As Integer = -1
If Me.Pokemon IsNot Nothing Then If Me.Pokemon IsNot Nothing Then
PokemonForms.GetCrySuffix(Me.Pokemon) oldNumber = Me.Pokemon.Number
oldCry = PokemonForms.GetCrySuffix(Me.Pokemon)
End If End If
If newPokemon IsNot Nothing Then If newPokemon IsNot Nothing Then
EvolutionLineConnections.Clear() EvolutionLineConnections.Clear()
Me.Pokemon = newPokemon Me.Pokemon = newPokemon
End If End If
If newDexIndex <> -1 AndAlso newDexIndex <> Me.DexIndex Then If Me.PreScreen.Identification = Identifications.PokedexScreen Then
Me.Pokemon = PokedexScreen.TempPokemonStorage(newDexIndex) Dim PDexScreen As PokedexScreen = CType(Me.PreScreen, PokedexScreen)
Me.DexIndex = newDexIndex If newDexIndex <> -1 AndAlso newDexIndex <> Me.DexIndex Then
Me.Forms.Clear() Me.Pokemon = PDexScreen.PokemonList(newDexIndex)
Me.EvolutionLineConnections.Clear() Me.DexIndex = newDexIndex
Me.Forms.Add(Me.Pokemon.Number.ToString) Me.Forms.Clear()
Me.FormIndex = 0 Me.EvolutionLineConnections.Clear()
Me.Forms.Add(Me.Pokemon.Number.ToString)
Me.FormIndex = 0
End If
End If End If
@ -1399,7 +1405,7 @@ Public Class PokedexViewScreen
Me.FillHabitats() Me.FillHabitats()
Me.FillEvolutionGrid() Me.FillEvolutionGrid()
If playCry = True AndAlso oldCry <> PokemonForms.GetCrySuffix(Me.Pokemon) Then If playCry = True AndAlso oldNumber <> Me.Pokemon.Number OrElse oldCry <> PokemonForms.GetCrySuffix(Me.Pokemon) Then
Dim crySuffix As String = PokemonForms.GetCrySuffix(Me.Pokemon) Dim crySuffix As String = PokemonForms.GetCrySuffix(Me.Pokemon)
SoundManager.PlayPokemonCry(Pokemon.Number, crySuffix) SoundManager.PlayPokemonCry(Pokemon.Number, crySuffix)
End If End If
@ -1846,22 +1852,46 @@ Public Class PokedexViewScreen
End If End If
End If End If
If DexIndex > -1 Then If DexIndex > -1 AndAlso Me.PreScreen.Identification = Identifications.PokedexScreen Then
If Me.DexIndex > PokedexScreen.TempPokemonStorage.Keys(0) Then If Controls.Up(True, True, False, True, True, True) = True Then
If Controls.Up(True, True, False, True, True, True) = True Then Dim PDexScreen As PokedexScreen = CType(Me.PreScreen, PokedexScreen)
vLineLength = 1 If Me.DexIndex > 0 Then
mLineLength = 1 Dim index As Integer = Me.DexIndex - 1
fadeMainImage = 0 While Pokedex.GetEntryType(Core.Player.PokedexData, PokemonForms.GetPokemonDataFileName(PDexScreen.PokemonList(index).Number, PDexScreen.PokemonList(index).AdditionalData, True)) = 0
LoadPokemonData(Me.DexIndex - 1, Nothing, True) If index > 0 Then
index -= 1
Else
Exit While
End If
End While
If Pokedex.GetEntryType(Core.Player.PokedexData, PokemonForms.GetPokemonDataFileName(PDexScreen.PokemonList(index).Number, PDexScreen.PokemonList(index).AdditionalData, True)) > 0 Then
vLineLength = 1
mLineLength = 1
fadeMainImage = 0
LoadPokemonData(index, Nothing, True)
End If
End If
End If End If
End If
If Me.DexIndex < PokedexScreen.TempPokemonStorage.Keys(PokedexScreen.TempPokemonStorage.Count - 1) Then If Controls.Down(True, True, False, True, True, True) = True Then
If Controls.Down(True, True, False, True, True, True) = True Then Dim PDexScreen As PokedexScreen = CType(Me.PreScreen, PokedexScreen)
vLineLength = 1 If Me.DexIndex < PDexScreen.PokemonList.count - 1 Then
mLineLength = 1 Dim index As Integer = Me.DexIndex + 1
fadeMainImage = 0
LoadPokemonData(Me.DexIndex + 1, Nothing, True) While Pokedex.GetEntryType(Core.Player.PokedexData, PokemonForms.GetPokemonDataFileName(PDexScreen.PokemonList(index).Number, PDexScreen.PokemonList(index).AdditionalData, True)) = 0
If index < PDexScreen.PokemonList.Count - 1 Then
index += 1
Else
Exit While
End If
End While
If Pokedex.GetEntryType(Core.Player.PokedexData, PokemonForms.GetPokemonDataFileName(PDexScreen.PokemonList(index).Number, PDexScreen.PokemonList(index).AdditionalData, True)) > 0 Then
vLineLength = 1
mLineLength = 1
fadeMainImage = 0
LoadPokemonData(index, Nothing, True)
End If
End If End If
End If End If
End If End If