added type icons to the "caught mon screen"

This commit is contained in:
TheXaman 2021-11-04 17:53:12 +01:00
parent 475bb8a624
commit a2eff37b38

View file

@ -4247,6 +4247,9 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
} }
break; break;
case 1: case 1:
sPokedexView = AllocZeroed(sizeof(struct PokedexView)); //for type icons
ResetPokedexView(sPokedexView);
LoadTilesetTilemapHGSS(INFO_SCREEN); LoadTilesetTilemapHGSS(INFO_SCREEN);
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
PutWindowTilemap(WIN_INFO); PutWindowTilemap(WIN_INFO);
@ -4258,6 +4261,9 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
gTasks[taskId].tState++; gTasks[taskId].tState++;
break; break;
case 2: case 2:
sPokedexView->typeIconSpriteIds[0] = 0xFF;
sPokedexView->typeIconSpriteIds[1] = 0xFF;
CreateTypeIconSprites();
gTasks[taskId].tState++; gTasks[taskId].tState++;
break; break;
case 3: case 3:
@ -4300,6 +4306,8 @@ static void Task_HandleCaughtMonPageInput(u8 taskId)
if (JOY_NEW(A_BUTTON | B_BUTTON)) if (JOY_NEW(A_BUTTON | B_BUTTON))
{ {
BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK); BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK);
SetSpriteInvisibility(0, TRUE);
SetSpriteInvisibility(1, TRUE);
gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter;
gTasks[taskId].func = Task_ExitCaughtMonPage; gTasks[taskId].func = Task_ExitCaughtMonPage;
} }
@ -4421,13 +4429,17 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId)
sprite->pos1.y = y + 8; sprite->pos1.y = y + 8;
SetSpriteInvisibility(spriteArrayId, FALSE); SetSpriteInvisibility(spriteArrayId, FALSE);
} }
static void PrintCurrentSpeciesTypeInfo(void) static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species)
{ {
u16 species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum);
u32 i; u32 i;
u16 dexNum = SpeciesToNationalPokedexNum(species); u16 dexNum = SpeciesToNationalPokedexNum(species);
u8 type1, type2; u8 type1, type2;
if (!newEntry)
{
species = NationalPokedexNumToSpecies(sPokedexListItem->dexNum);
dexNum = SpeciesToNationalPokedexNum(species);
}
//type icon(s) //type icon(s)
#ifdef TX_DIFFICULTY_CHALLENGES_USED #ifdef TX_DIFFICULTY_CHALLENGES_USED
type1 = GetTypeBySpecies(species, 1); type1 = GetTypeBySpecies(species, 1);
@ -4472,7 +4484,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
{ {
u8 str[16]; u8 str[16];
u8 str2[32]; u8 str2[32];
u16 natNum; u16 species;
const u8 *name; const u8 *name;
const u8 *category; const u8 *category;
const u8 *description; const u8 *description;
@ -4485,9 +4497,9 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
value = num; value = num;
ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3); ConvertIntToDecimalStringN(StringCopy(str, gText_NumberClear01), value, STR_CONV_MODE_LEADING_ZEROS, 3);
PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui PrintInfoScreenTextWhite(str, 123, 17); //HGSS_Ui
natNum = NationalPokedexNumToSpecies(num); species = NationalPokedexNumToSpecies(num);
if (natNum) if (species)
name = gSpeciesNames[natNum]; name = gSpeciesNames[species];
else else
name = sText_TenDashes2; name = sText_TenDashes2;
PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui PrintInfoScreenTextWhite(name, 157, 17); //HGSS_Ui
@ -4522,11 +4534,8 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 93); //HGSS_Ui PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 93); //HGSS_Ui
//Type Icon(s) //HGSS_Ui //Type Icon(s) //HGSS_Ui
if (owned && !newEntry) if (owned)
{ PrintCurrentSpeciesTypeInfo(newEntry, species); //HGSS_Ui
description = gPokedexEntries[num].description;
PrintCurrentSpeciesTypeInfo(); //HGSS_Ui
}
} }
static void PrintMonHeight(u16 height, u8 left, u8 top) static void PrintMonHeight(u16 height, u8 left, u8 top)