From c06c944440f8adb8a80e036fe29fbcf685f3dab3 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Sun, 22 Mar 2026 21:59:14 +0100 Subject: [PATCH] summary screen improvements --- include/strings.h | 7 --- src/pokemon_summary_screen.c | 101 ++++++++++++++++++++--------------- src/strings.c | 5 -- 3 files changed, 58 insertions(+), 55 deletions(-) diff --git a/include/strings.h b/include/strings.h index c905fed2a..12daefe06 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1423,13 +1423,6 @@ extern const u8 gText_PokeSum_EggHatch_LongTime[]; extern const u8 gText_PokeSum_EggHatch_SomeTime[]; extern const u8 gText_PokeSum_EggHatch_Soon[]; extern const u8 gText_PokeSum_EggHatch_AlmostReady[]; -extern const u8 gText_PokeSum_EggOrigin_DayCare[]; -extern const u8 gText_PokeSum_EggOrigin_Trade[]; -extern const u8 gText_PokeSum_EggOrigin_TravelingMan[]; -extern const u8 gText_PokeSum_EggOrigin_Trade[]; -extern const u8 gText_PokeSum_EggOrigin_NicePlace[]; -extern const u8 gText_PokeSum_EggOrigin_Spa[]; -extern const u8 gText_PokeSum_EggOrigin_Trade[]; extern const u8 gText_BasePointsResetToZero[]; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 77a10f143..8d0eba351 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -223,8 +223,8 @@ struct PokemonSummaryScreenData u8 ALIGNED(4) unk3248; /* 0x3248 */ s16 ALIGNED(4) flipPagesBgHofs; /* 0x324C */ - u16 moveTypes[5]; /* 0x3250 */ - u16 moveIds[5]; /* 0x325A */ + u16 moveTypes[MAX_MON_MOVES + 1]; /* 0x3250 */ + u16 moveIds[MAX_MON_MOVES + 1]; /* 0x325A */ u8 ALIGNED(4) numMoves; /* 0x3264 */ u8 ALIGNED(4) isSwappingMoves; /* 0x3268 */ @@ -636,11 +636,20 @@ static const u32 sStarObjTiles[] = INCBIN_U32( "graphics/summary_screen/shiny_st static const u32 sBgTilemap_MovesInfoPage[] = INCBIN_U32( "graphics/summary_screen/moves_info_page.bin.smolTM"); static const u32 sBgTilemap_MovesPage[] = INCBIN_U32( "graphics/summary_screen/moves_page.bin.smolTM"); -static const u8 *const sEggHatchTimeTexts[] = { - gText_PokeSum_EggHatch_LongTime, - gText_PokeSum_EggHatch_SomeTime, - gText_PokeSum_EggHatch_Soon, - gText_PokeSum_EggHatch_AlmostReady +enum EggHatchTime +{ + EGG_HATCH_TIME_LONG, + EGG_HATCH_TIME_SOME, + EGG_HATCH_TIME_SOON, + EGG_HATCH_TIME_ALMOST_READY, +}; + +static const u8 *const sEggHatchTimeTexts[] = +{ + [EGG_HATCH_TIME_LONG] = gText_PokeSum_EggHatch_LongTime, + [EGG_HATCH_TIME_SOME] = gText_PokeSum_EggHatch_SomeTime, + [EGG_HATCH_TIME_SOON] = gText_PokeSum_EggHatch_Soon, + [EGG_HATCH_TIME_ALMOST_READY] = gText_PokeSum_EggHatch_AlmostReady }; enum EggOrigin @@ -652,12 +661,13 @@ enum EggOrigin EGG_ORIGIN_SPA, }; -static const u8 *const sEggOriginTexts[] = { - [EGG_ORIGIN_DAYCARE] = gText_PokeSum_EggOrigin_DayCare, - [EGG_ORIGIN_TRADE] = gText_PokeSum_EggOrigin_Trade, - [EGG_ORIGIN_TRAVELING_MAN] = gText_PokeSum_EggOrigin_TravelingMan, - [EGG_ORIGIN_NICE_PLACE] = gText_PokeSum_EggOrigin_NicePlace, - [EGG_ORIGIN_SPA] = gText_PokeSum_EggOrigin_Spa, +static const u8 *const sEggOriginTexts[] = +{ + [EGG_ORIGIN_DAYCARE] = COMPOUND_STRING("An odd POKéMON EGG found by the\nDAY-CARE couple."), + [EGG_ORIGIN_TRADE] = COMPOUND_STRING("A peculiar POKéMON EGG obtained\nin a trade."), + [EGG_ORIGIN_TRAVELING_MAN] = COMPOUND_STRING("An odd POKéMON EGG obtained from\nthe traveling man."), + [EGG_ORIGIN_NICE_PLACE] = COMPOUND_STRING("A wondrously peculiar POKéMON EGG\nobtained at a nice place."), + [EGG_ORIGIN_SPA] = COMPOUND_STRING("An odd POKéMON EGG obtained from\nan old woman at the SPA."), }; static const u8 sPrintMoveTextColors[][3] = { @@ -2637,18 +2647,18 @@ static void BufferMonMoves(void) { u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) BufferMonMoveI(i); if (sMonSummaryScreen->mode == PSS_MODE_SELECT_MOVE) - BufferMonMoveI(4); + BufferMonMoveI(MAX_MON_MOVES); } #define GetRightAlignXpos_NDigits(a, b) ((6 * (a)) - StringLength((b)) * 6) static void BufferMonMoveI(u8 i) { - if (i < 4) + if (i < MAX_MON_MOVES) sMonSummaryScreen->moveIds[i] = GetMonMoveBySlotId(&sMonSummaryScreen->currentMon, i); if (sMonSummaryScreen->moveIds[i] == 0) @@ -2873,43 +2883,48 @@ u32 GetInfoPageFontIdForString(u8 *str, u32 x) return GetFontIdToFit(str, FONT_NORMAL, letterSpacing, maxTextWidth); } +static enum EggHatchTime GetEggHatchTime(void) +{ + u8 eggCycles; + + if (sMonSummaryScreen->isBadEgg) + return EGG_HATCH_TIME_LONG; + + eggCycles = GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_FRIENDSHIP); + + if (eggCycles <= 5) + return EGG_HATCH_TIME_ALMOST_READY; + if (eggCycles <= 10) + return EGG_HATCH_TIME_SOON; + if (eggCycles <= 40) + return EGG_HATCH_TIME_SOME; + + return EGG_HATCH_TIME_LONG; +} + static void PrintInfoPage(void) { - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 47, 19, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.speciesNameStrBuf); + const u8 *colors = sLevelNickTextColors[0]; + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 47, 19, colors, TEXT_SKIP_DRAW, sMonSummaryScreen->summary.speciesNameStrBuf); if (!sMonSummaryScreen->isEgg) { u32 fontId; fontId = GetInfoPageFontIdForString(sMonSummaryScreen->summary.dexNumStrBuf, 47 + sMonSkillsPrinterXpos->unk00); - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47 + sMonSkillsPrinterXpos->unk00, 5, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.dexNumStrBuf); + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47 + sMonSkillsPrinterXpos->unk00, 5, colors, TEXT_SKIP_DRAW, sMonSummaryScreen->summary.dexNumStrBuf); fontId = GetInfoPageFontIdForString(sMonSummaryScreen->summary.otNameStrBuf, 47); - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 49, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.otNameStrBuf); + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 49, colors, TEXT_SKIP_DRAW, sMonSummaryScreen->summary.otNameStrBuf); fontId = GetInfoPageFontIdForString(sMonSummaryScreen->summary.unk306C, 47); - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 64, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.unk306C); + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 64, colors, TEXT_SKIP_DRAW, sMonSummaryScreen->summary.unk306C); fontId = GetInfoPageFontIdForString(sMonSummaryScreen->summary.itemNameStrBuf, 47); - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 79, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.itemNameStrBuf); + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], fontId, 47, 79, colors, TEXT_SKIP_DRAW, sMonSummaryScreen->summary.itemNameStrBuf); } else { - u8 eggCycles; - u8 hatchMsgIndex; + enum EggHatchTime hatchMsgIndex = GetEggHatchTime(); - eggCycles = GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_FRIENDSHIP); - - if (eggCycles <= 5) - hatchMsgIndex = 3; - else if (eggCycles <= 10) - hatchMsgIndex = 2; - else if (eggCycles <= 40) - hatchMsgIndex = 1; - else - hatchMsgIndex = 0; - - if (sMonSummaryScreen->isBadEgg) - hatchMsgIndex = 0; - - AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 7, 45, sLevelNickTextColors[0], TEXT_SKIP_DRAW, sEggHatchTimeTexts[hatchMsgIndex]); + AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 7, 45, colors, TEXT_SKIP_DRAW, sEggHatchTimeTexts[hatchMsgIndex]); } } @@ -2946,13 +2961,13 @@ static void PrintMovesPage(void) { u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) PokeSum_PrintMoveName(i); if (sMonSummaryScreen->curPageIndex == PSS_PAGE_MOVES_INFO) { if (sMonSummaryScreen->mode == PSS_MODE_SELECT_MOVE) - PokeSum_PrintMoveName(4); + PokeSum_PrintMoveName(MAX_MON_MOVES); else AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 3, GetMoveNamePrinterYpos(4), @@ -2968,7 +2983,7 @@ static void PokeSum_PrintMoveName(u8 i) u8 ppBonuses = GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_PP_BONUSES); u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i); - if (i == 4) + if (i == MAX_MON_MOVES) curPP = maxPP; AddTextPrinterParameterized3(sMonSummaryScreen->windowIds[POKESUM_WIN_RIGHT_PANE], FONT_NORMAL, 0, GetMoveNamePrinterYpos(i), sPrintMoveTextColors[0], TEXT_SKIP_DRAW, sMonSummaryScreen->summary.moveNameStrBufs[i]); @@ -3369,7 +3384,7 @@ static void PokeSum_DrawMoveTypeIcons(void) FillWindowPixelBuffer(sMonSummaryScreen->windowIds[5], 0); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { if (sMonSummaryScreen->moveIds[i] == MOVE_NONE) continue; @@ -3378,7 +3393,7 @@ static void PokeSum_DrawMoveTypeIcons(void) } if (sMonSummaryScreen->mode == PSS_MODE_SELECT_MOVE) - BlitMenuInfoIcon(sMonSummaryScreen->windowIds[5], sMonSummaryScreen->moveTypes[4] + 1, 3, GetMoveNamePrinterYpos(4)); + BlitMenuInfoIcon(sMonSummaryScreen->windowIds[5], sMonSummaryScreen->moveTypes[MAX_MON_MOVES] + 1, 3, GetMoveNamePrinterYpos(MAX_MON_MOVES)); } static void PokeSum_PrintPageHeaderText(u8 curPageIndex) diff --git a/src/strings.c b/src/strings.c index 8dc43b397..bc5dc6500 100644 --- a/src/strings.c +++ b/src/strings.c @@ -704,11 +704,6 @@ const u8 gText_PokeSum_FatefulEncounterHatched[] = _("{DYNAMIC 0x00} nature. Met const u8 gText_PokeSum_FatefulEncounterHatched_BoldGentleGrammar[] = _("{DYNAMIC 0x00} nature. Met in a fateful\nencounter (hatched: {DYNAMIC 0x02}\nat {LV_2} {DYNAMIC 0x01})."); const u8 gText_PokeSum_ApparentlyFatefulEncounterHatched[] = _("{DYNAMIC 0x00} nature. Apparently met in\na fateful encounter (hatched:\n{DYNAMIC 0x02} at {LV_2} {DYNAMIC 0x01})."); const u8 gText_PokeSum_ApparentlyFatefulEncounterHatched_BoldGentleGrammar[] = _("{DYNAMIC 0x00} nature. Apparently met in\na fateful encounter (hatched:\n{DYNAMIC 0x02} at {LV_2} {DYNAMIC 0x01})."); -const u8 gText_PokeSum_EggOrigin_DayCare[] = _("An odd POKéMON EGG found by the\nDAY-CARE couple."); -const u8 gText_PokeSum_EggOrigin_TravelingMan[] = _("An odd POKéMON EGG obtained from\nthe traveling man."); -const u8 gText_PokeSum_EggOrigin_NicePlace[] = _("A wondrously peculiar POKéMON EGG\nobtained at a nice place."); -const u8 gText_PokeSum_EggOrigin_Spa[] = _("An odd POKéMON EGG obtained from\nan old woman at the SPA."); -const u8 gText_PokeSum_EggOrigin_Trade[] = _("A peculiar POKéMON EGG obtained\nin a trade."); const u8 gText_PokeSum_EggHatch_LongTime[] = _("It looks like this\nEGG will take a\nlong time to hatch."); const u8 gText_PokeSum_EggHatch_SomeTime[] = _("What will hatch\nfrom this? It will\ntake some time."); const u8 gText_PokeSum_EggHatch_Soon[] = _("It occasionally\nmoves. It should\nhatch soon.");