Skip to content

Commit

Permalink
Fixed DisplayCaughtMonDexPage graphical issue + cry (#4279)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo authored Mar 14, 2024
1 parent cd650ae commit dbd7e2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/pokedex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3996,7 +3996,8 @@ u8 DisplayCaughtMonDexPage(u16 species, u32 otId, u32 personality)
static void Task_DisplayCaughtMonDexPage(u8 taskId)
{
u8 spriteId;
u16 dexNum = SpeciesToNationalPokedexNum(gTasks[taskId].tSpecies);
u16 species = gTasks[taskId].tSpecies;
u16 dexNum = SpeciesToNationalPokedexNum(species);

switch (gTasks[taskId].tState)
{
Expand All @@ -4022,7 +4023,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
PutWindowTilemap(WIN_INFO);
PutWindowTilemap(WIN_FOOTPRINT);
DrawFootprint(WIN_FOOTPRINT, dexNum);
DrawFootprint(WIN_FOOTPRINT, species);
CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX);
ResetPaletteFade();
LoadPokedexBgPalette(FALSE);
Expand All @@ -4039,7 +4040,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
gTasks[taskId].tState++;
break;
case 4:
spriteId = CreateMonPicSprite(NationalPokedexNumToSpecies(dexNum), 0, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE);
spriteId = CreateMonPicSprite(species, FALSE, ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo, TRUE, MON_PAGE_X, MON_PAGE_Y, 0, TAG_NONE);
gSprites[spriteId].oam.priority = 0;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
SetVBlankCallback(gPokedexVBlankCB);
Expand All @@ -4058,7 +4059,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
case 6:
if (!gPaletteFade.active)
{
PlayCry_Normal(NationalPokedexNumToSpecies(dexNum), 0);
PlayCry_Normal(species, 0);
gTasks[taskId].tPalTimer = 0;
gTasks[taskId].func = Task_HandleCaughtMonPageInput;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pokedex_plus_hgss.c
Original file line number Diff line number Diff line change
Expand Up @@ -4206,7 +4206,7 @@ void Task_DisplayCaughtMonDexPageHGSS(u8 taskId)
case 6:
if (!gPaletteFade.active)
{
PlayCry_Normal(NationalPokedexNumToSpeciesHGSS(dexNum), 0);
PlayCry_Normal(species, 0);
gTasks[taskId].tPalTimer = 0;
gTasks[taskId].func = Task_HandleCaughtMonPageInput;
}
Expand Down
1 change: 1 addition & 0 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -4217,6 +4217,7 @@ u16 NationalToHoennOrder(u16 nationalNum)

u16 SpeciesToNationalPokedexNum(u16 species)
{
species = SanitizeSpeciesId(species);
if (!species)
return NATIONAL_DEX_NONE;

Expand Down

0 comments on commit dbd7e2a

Please sign in to comment.