From 6c9273cd71db0183bd73d771dca6fb19020ade9c Mon Sep 17 00:00:00 2001 From: Ken Bynell Date: Thu, 9 Jan 2025 01:59:15 -0600 Subject: [PATCH 01/44] prompt progress --- include/config/debug.h | 2 +- include/config/pokemon.h | 1 + src/pokemon_summary_screen.c | 44 ++++++++++++++++++++++++++++++------ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/include/config/debug.h b/include/config/debug.h index 2446b9360c0b..e2f35426f90f 100644 --- a/include/config/debug.h +++ b/include/config/debug.h @@ -5,7 +5,7 @@ #define DEBUG_OVERWORLD_MENU TRUE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. #define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. #define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS. -#define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). +#define DEBUG_OVERWORLD_IN_MENU TRUE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). // Battle Debug Menu #define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 0b5d3828adb8..7eed6b957c51 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -63,6 +63,7 @@ #define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. #define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. +#define P_SUMMARY_SCREEN_IV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f0c65dc2a753..ddd065b81e4d 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -62,7 +62,7 @@ #define PSS_LABEL_WINDOW_PROMPT_CANCEL 4 // Also handles the "rename" prompt if P_SUMMARY_SCREEN_RENAME is true #define PSS_LABEL_WINDOW_PROMPT_INFO 5 #define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 -#define PSS_LABEL_WINDOW_UNUSED1 7 +#define PSS_LABEL_WINDOW_PROMPT_IV_INFO 7 // Info screen #define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 8 @@ -318,6 +318,7 @@ static void SummaryScreen_DestroyAnimDelayTask(void); static bool32 ShouldShowMoveRelearner(void); static bool32 ShouldShowRename(void); static void ShowCancelOrRenamePrompt(void); +static void ShowMonIvPrompt(void); static void CB2_ReturnToSummaryScreenFromNamingScreen(void); static void CB2_PssChangePokemonNickname(void); @@ -454,14 +455,14 @@ static const struct WindowTemplate sSummaryTemplate[] = .paletteNum = 7, .baseBlock = 121, }, - [PSS_LABEL_WINDOW_UNUSED1] = { + [PSS_LABEL_WINDOW_PROMPT_IV_INFO] = { .bg = 0, - .tilemapLeft = 11, - .tilemapTop = 4, - .width = 0, + .tilemapLeft = 22, + .tilemapTop = 0, + .width = 8, .height = 2, - .paletteNum = 6, - .baseBlock = 137, + .paletteNum = 7, + .baseBlock = 105, }, [PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL] = { .bg = 0, @@ -1795,6 +1796,13 @@ static void Task_ChangeSummaryMon(u8 taskId) else ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + if (P_SUMMARY_SCREEN_IV_INFO) + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); + else + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); + } } break; case 5: @@ -1832,6 +1840,12 @@ static void Task_ChangeSummaryMon(u8 taskId) ShowCancelOrRenamePrompt(); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); } + if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_IV_INFO, PIXEL_FILL(0)); + ShowMonIvPrompt(); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); + } break; case 12: gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 0; @@ -3009,6 +3023,7 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); ShowCancelOrRenamePrompt(); + ShowMonIvPrompt(); stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; @@ -3071,6 +3086,8 @@ static void PutPageWindowTilemaps(u8 page) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); + if (P_SUMMARY_SCREEN_IV_INFO) + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); break; case PSS_PAGE_BATTLE_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); @@ -4417,6 +4434,19 @@ static void ShowCancelOrRenamePrompt(void) PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, promptText, stringXPos, 1, 0, 0); } +static void ShowMonIvPrompt(void) +{ + const u8* promptText = COMPOUND_STRING("{R_BUTTON} IVs"); + + int stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, promptText, 62); + int iconXPos = stringXPos - 16; + if (iconXPos < 0) + iconXPos = 0; + + // PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_IV_INFO, FALSE, iconXPos); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_IV_INFO, promptText, stringXPos, 1, 0, 0); +} + static void CB2_ReturnToSummaryScreenFromNamingScreen(void) { SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2); From c0c1df7cbe25d7750fb1f6d100cbb5e4654072cb Mon Sep 17 00:00:00 2001 From: Ken Bynell Date: Thu, 9 Jan 2025 02:11:41 -0600 Subject: [PATCH 02/44] re-ordered function call --- src/pokemon_summary_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ddd065b81e4d..f9b8b82e0443 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3023,7 +3023,6 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); ShowCancelOrRenamePrompt(); - ShowMonIvPrompt(); stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; @@ -3061,6 +3060,7 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Appeal, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Jam, 0, 17, 0, 1); PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); + ShowMonIvPrompt(); } static void PutPageWindowTilemaps(u8 page) From cae5630685bf83bf8c9070308231175d3e841d66 Mon Sep 17 00:00:00 2001 From: khbsd Date: Fri, 10 Jan 2025 01:24:21 -0600 Subject: [PATCH 03/44] almost working! --- graphics/summary_screen/iv_ev_tiles.png | Bin 0 -> 2311 bytes src/graphics.c | 4 + src/pokemon_summary_screen.c | 221 +++++++++++++++++++++--- 3 files changed, 202 insertions(+), 23 deletions(-) create mode 100644 graphics/summary_screen/iv_ev_tiles.png diff --git a/graphics/summary_screen/iv_ev_tiles.png b/graphics/summary_screen/iv_ev_tiles.png new file mode 100644 index 0000000000000000000000000000000000000000..66774f143855008074e06394bb0e3b9733209af4 GIT binary patch literal 2311 zcmZvdeK^zm8^=H2eQjn8NAgr56hfttN=$ipfoJxIJosyG=pDgq+Q&LB4^NS%5-{1OmUH)gXh_bP?oG8)$W1Gcp8)|#rm;+vFwM* zY-KZJXZ^MNYBcg6`(o0tej!uJ;fN!7d}mQVAA8DF3f<)=fs`p`X`jnvQmr$S$?PW* zF_i5u#Q+z@_&hW=lB>Zigfa{j%h=z^|H~_tBB78uJBC(Z00^}e!vg9K>;ph|UTA=S z)Pd}wGCJ*pw}Ir%<28ek&j)!YSfRhkkh=4`-5Urt;Pf7$zU-^-zq_4R1I~%oFXe!rLOx5^#8gl#Ww#vPmrH6v3CEKs}Z_ z-oHNCXLXUYqK=TUY6RNmz#dU;#Y^lrh2*gi-FCy8cHqM#SlrBh1mY5qgv^VCba=|# zvxWq1`*2WkXBYe{>3kAUd)5pJpscc-(np}-jH$zvPnMHS@%_@cm=QH~ex^|$bv(Nu zYmcDJ@h#n+lBss6)>Us9wgABm*k8Tg&J+Ql`ez{%QMLj~tqMKl0!~N5#;q3KHXw?rvU%R|+BRvtIJ? ztSsGwlOLX$nZSwlSv{06m5LVf4(dlC3IG8(1b`+d@H4SwGbz~sD!xwcn(4f;sH>_u z_e+5nW0J0N^{=yrZTTlRY)OA~dB_i+GqfhRk^Kcf?+s>1Y)>(=PXy`<&f6g?K4 z$)WBBJd(cle_A}~r;}#bSG#2(0lW1?CW+TC7KGUWsSf#E0=V)4Tq=riM}l%H>O4U! z33(4a%XgBrW`hP6*zF0Lir>-ThYufCZfpI-HWj!=gPpCq3QZku3U3#sb_~%`WTfic zlrJMwYsW~yXfNz#Js4SNv{p~eq^BMEaEDwDBVS{TKc|x@;&@0Te1%J8-3nvIS+Y6mM_`AY&0yj~UFkM{+td5gL5PvAk~CNsTB;4$i#=0-du(KK92^fW+$ ztDq2$r!(1h!au)lcH4?iFTU5Cs((a~7XNFJ!H~U?u8mN~>8^k7w2SH~(_OrnXOvgW0cW4k*VOc=DQxzn?M4LGMY#hEC!0Wd^&*5AO-ezbtC**fDZAhINO~t%4*L@VQZ07k>|!d~3k? zjON}rN@>S~(yXV4-G^%}k>D?l=<>?k86Zr8+Pq+2(9udY9|F|wwsXs=J&~~6O5+0p zo+zJuQHNv0A+5nt%?We&@IE#ttOT!)(Av87sdtmz&dLZE#@h{$6h+I=nJg%|o*sx$ z;fh06OaA&@zQXc%9rB6}g3j_~h9NzjneQMd z)K~imZe`g}!Xfz7mNU?S^F=p0DG%%;f17)Xk89t65^7>!njXUmYNA)+$wAvAvUfM9 zWe*yZSWYYrjxKhq1s0G&AksFrdWjec!JgStb8(l9;&Sj78&_z?p3fZfUAoWK%E-15 z_VTPcZ4Wc9?eVF!oaq92QA5WMSNtpIh4+pNE^%Jnrj`HJzbMMIYAnxbnqp5l&=9N6 z)6EIMB*l!_ikJ2V2d=-ZAM0VU8&E$qR7|@n@|mxFUB{^;A$D-WFfdbQ#$Wy=ldracZ z1-1c2j{C<%Bd4Mc6_$VdIon5H@a@Yq9q>2l$IVgDte@p9+La5p|6{7WxtGH`u6m>& zRM~xZRDBN~s0Xrj5ddyr;A=gwljt`mK)@9W0l`qFHPQBh}2dWaxL)?^V z=Yrj90V6NUEJ{gI)D2g2$4wPo3$6H!k-ayf+HH{c*`H%;&4J+0&6TO?cZ?d3spuft z$9qdcCTDRQGP2pjrxodPwcovqt zXZr8UV}Yh;J-?t}Ebl+z#>?UxWc6V&pI#0=$m9tuu7bB!wzT-1wEL4m0hj!zYpExO zLvEs%L?xe3&{T8CSw@B9_0y@MhPjImf0bZ{$u?&BxTebjx%vBYQSaQNGbjkZo&hlm zT|DA&M0%yIcfiZ)7D5fxyB&UIHbvai9iT6iGE**T zbsV^6XU^R3B=KwLf1Lkn*t}NzZ5r;|9=bmw0xZ#LqBg%rJMHZE78spdef = GetMonData(mon, MON_DATA_SPDEF); sum->speed = GetMonData(mon, MON_DATA_SPEED); } - else + else // { sum->nature = GetNature(mon); sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); @@ -1641,8 +1649,46 @@ static void CloseSummaryScreen(u8 taskId) } } +#define STATS_CORD_X 44 +#define STATS_CORD_Y 102 + +#define STATS_STATS_BLOCK 169 +#define EVS_STATS_BLOCK 218 +#define IVS_STATS_BLOCK (EVS_STATS_BLOCK + 3) +#define STATS_BLANK_BLOCK 1241 + +// Update skills page tilemap +static void ChangeSummaryState(s16 mode) +{ + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 4, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 5, STATS_CORD_Y, 1, 1, 2); + switch (mode) + { + case SKILL_PAGE_IVS: + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + break; + case SKILL_PAGE_EVS: + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + break; + case SKILL_PAGE_STATS: + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); + break; + } + CopyBgTilemapBufferToVram(1); +} + static void Task_HandleInput(u8 taskId) { + s16 *taskData = gTasks[taskId].data; + if (MenuHelpers_ShouldWaitForLinkRecv() != TRUE && !gPaletteFade.active) { if (JOY_NEW(DPAD_UP)) @@ -1683,6 +1729,15 @@ static void Task_HandleInput(u8 taskId) SwitchToMoveSelection(taskId); } } + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + if (P_SUMMARY_SCREEN_IV_INFO) + { + taskData[0]++; + ShowMonSkillsInfo(taskId, taskData[0]); + // PlaySE(SE_M_GIGA_DRAIN); + } + } } else if (JOY_NEW(B_BUTTON)) { @@ -1711,6 +1766,80 @@ static void Task_HandleInput(u8 taskId) } } +static void ShowMonSkillsInfo(u8 taskId, s16 mode) +{ + struct PokeSummary *sum = &sMonSummaryScreen->summary; + struct Pokemon *mon = &sMonSummaryScreen->currentMon; + + DynamicPlaceholderTextUtil_Reset(); + FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_LEFT], 0); + FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_RIGHT], 0); + + ChangeSummaryState(mode); + + if (mode == SKILL_PAGE_STATS) + { + if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) + { + sum->nature = GetNature(mon); + sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); + sum->currentHP = GetMonData(mon, MON_DATA_HP); + sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); + sum->atk = GetMonData(mon, MON_DATA_ATK); + sum->def = GetMonData(mon, MON_DATA_DEF); + sum->spatk = GetMonData(mon, MON_DATA_SPATK); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF); + sum->speed = GetMonData(mon, MON_DATA_SPEED); + + } + else // + { + sum->nature = GetNature(mon); + sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); + sum->currentHP = GetMonData(mon, MON_DATA_HP); + sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); + sum->atk = GetMonData(mon, MON_DATA_ATK2); + sum->def = GetMonData(mon, MON_DATA_DEF2); + sum->spatk = GetMonData(mon, MON_DATA_SPATK2); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF2); + sum->speed = GetMonData(mon, MON_DATA_SPEED2); + } + BufferLeftColumnStats(); + } + else if (mode == SKILL_PAGE_IVS) + { + sum->currentHP = GetMonData(mon, MON_DATA_HP_IV); + sum->maxHP = 0; + sum->atk = GetMonData(mon, MON_DATA_ATK_IV); + sum->def = GetMonData(mon, MON_DATA_DEF_IV); + sum->spatk = GetMonData(mon, MON_DATA_SPATK_IV); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF_IV); + sum->speed = GetMonData(mon, MON_DATA_SPEED_IV); + + BufferLeftColumnIvEvStats(); + + } + else if (mode == SKILL_PAGE_EVS) + { + sum->currentHP = GetMonData(mon, MON_DATA_HP_EV); + sum->maxHP = 0; + sum->atk = GetMonData(mon, MON_DATA_ATK_EV); + sum->def = GetMonData(mon, MON_DATA_DEF_EV); + sum->spatk = GetMonData(mon, MON_DATA_SPATK_EV); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF_EV); + sum->speed = GetMonData(mon, MON_DATA_SPEED_EV); + + BufferLeftColumnIvEvStats(); + + gTasks[taskId].data[0] = -1; // we increment this in Task_HandleInput + } + + PrintLeftColumnStats(); + BufferRightColumnStats(); + PrintRightColumnStats(); + gTasks[taskId].func = Task_HandleInput; +} + static void ChangeSummaryPokemon(u8 taskId, s8 delta) { s8 monId; @@ -1753,6 +1882,7 @@ static void ChangeSummaryPokemon(u8 taskId, s8 delta) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ScheduleBgCopyTilemapToVram(0); HandleStatusTilemap(0, 2); + ChangeSummaryState(SKILL_PAGE_STATS); } sMonSummaryScreen->curMonIndex = monId; gTasks[taskId].data[0] = 0; @@ -1796,13 +1926,6 @@ static void Task_ChangeSummaryMon(u8 taskId) else ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) - { - if (P_SUMMARY_SCREEN_IV_INFO) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); - else - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); - } } break; case 5: @@ -1824,6 +1947,7 @@ static void Task_ChangeSummaryMon(u8 taskId) gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 1; TryDrawExperienceProgressBar(); data[1] = 0; + ChangeSummaryState(SKILL_PAGE_STATS); break; case 9: SetTypeIcons(); @@ -1837,14 +1961,14 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - ShowCancelOrRenamePrompt(); + ShowCancelOrUtilityPrompt(); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); } if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_IV_INFO, PIXEL_FILL(0)); - ShowMonIvPrompt(); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); + ShowCancelOrUtilityPrompt(); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); } break; case 12: @@ -1948,6 +2072,8 @@ static void ChangePage(u8 taskId, s8 delta) SetTaskFuncWithFollowupFunc(taskId, PssScrollLeft, gTasks[taskId].func); CreateTextPrinterTask(sMonSummaryScreen->currPageIndex); HidePageSpecificSprites(); + ShowCancelOrUtilityPrompt(); + ChangeSummaryState(SKILL_PAGE_STATS); } static void PssScrollRight(u8 taskId) // Scroll right @@ -3022,7 +3148,7 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); - ShowCancelOrRenamePrompt(); + ShowCancelOrUtilityPrompt(); stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; @@ -3060,7 +3186,6 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Appeal, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Jam, 0, 17, 0, 1); PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); - ShowMonIvPrompt(); } static void PutPageWindowTilemaps(u8 page) @@ -3087,7 +3212,7 @@ static void PutPageWindowTilemaps(u8 page) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); if (P_SUMMARY_SCREEN_IV_INFO) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_IV_INFO); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); break; case PSS_PAGE_BATTLE_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); @@ -3141,6 +3266,7 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); + ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_CANCEL); break; case PSS_PAGE_BATTLE_MOVES: if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) @@ -3622,6 +3748,23 @@ static void BufferLeftColumnStats(void) Free(defenseString); } +static void BufferLeftColumnIvEvStats(void) +{ + u8 *hpIvEvString = Alloc(20); + u8 *attackIvEvString = Alloc(20); + u8 *defenseIvEvString = Alloc(20); + + DynamicPlaceholderTextUtil_Reset(); + BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); + BufferStat(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); + BufferStat(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftIVEVColumnLayout); + + Free(hpIvEvString); + Free(attackIvEvString); + Free(defenseIvEvString); +} + static void PrintLeftColumnStats(void) { PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_STATS_LEFT), gStringVar4, 4, 1, 0, 0); @@ -4421,9 +4564,41 @@ static inline bool32 ShouldShowRename(void) && GetPlayerIDAsU32() == sMonSummaryScreen->summary.OTID); } -static void ShowCancelOrRenamePrompt(void) +static void ShowCancelOrUtilityPrompt(void) { - const u8 *promptText = ShouldShowRename() ? gText_Rename : gText_Cancel2; + + const u8* promptText; + const u8* gText_ShowIv = COMPOUND_STRING("IVs"); + + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) + { + if (ShouldShowRename()) + { + promptText = gText_Rename; + // PlaySE(SE_M_REVERSAL); + } + else + { + promptText = gText_Cancel2; + } + } + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + if (P_SUMMARY_SCREEN_IV_INFO) + { + promptText = gText_ShowIv; + // PlaySE(SE_M_GIGA_DRAIN); + } + else + return; + } + else if (sMonSummaryScreen->currPageIndex > PSS_PAGE_SKILLS) + promptText = gText_Info; + else + return; + + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); int stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, promptText, 62); int iconXPos = stringXPos - 16; @@ -4434,9 +4609,9 @@ static void ShowCancelOrRenamePrompt(void) PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, promptText, stringXPos, 1, 0, 0); } -static void ShowMonIvPrompt(void) +/*static void ShowCancelOrIvPrompt(void) { - const u8* promptText = COMPOUND_STRING("{R_BUTTON} IVs"); + const u8* promptText = P_SUMMARY_SCREEN_IV_INFO ? COMPOUND_STRING("{R_BUTTON} IVs") : gText_Cancel2; int stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, promptText, 62); int iconXPos = stringXPos - 16; @@ -4444,8 +4619,8 @@ static void ShowMonIvPrompt(void) iconXPos = 0; // PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_IV_INFO, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_IV_INFO, promptText, stringXPos, 1, 0, 0); -} + +}*/ static void CB2_ReturnToSummaryScreenFromNamingScreen(void) { From f3c7e22945dcdd2423b0a31f909b2689e7941a1a Mon Sep 17 00:00:00 2001 From: khbsd Date: Fri, 10 Jan 2025 23:37:12 -0600 Subject: [PATCH 04/44] working, but really needs a refactor of what writes to the cancel prompt --- graphics/summary_screen/page_skills.bin | Bin 2048 -> 2048 bytes src/pokemon_summary_screen.c | 302 ++++++++++++------------ 2 files changed, 154 insertions(+), 148 deletions(-) diff --git a/graphics/summary_screen/page_skills.bin b/graphics/summary_screen/page_skills.bin index 19cb94637637b7caa47361d545d7279335126731..daa1ddbced36f948bd8ba4bb290510e91a416753 100644 GIT binary patch delta 22 YcmZn=Xb{*igOPKc0u*ju$QaKC09ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES); break; case 2: - if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) - { - sum->nature = GetNature(mon); - sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); - sum->currentHP = GetMonData(mon, MON_DATA_HP); - sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); - sum->atk = GetMonData(mon, MON_DATA_ATK); - sum->def = GetMonData(mon, MON_DATA_DEF); - sum->spatk = GetMonData(mon, MON_DATA_SPATK); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF); - sum->speed = GetMonData(mon, MON_DATA_SPEED); - } - else // - { - sum->nature = GetNature(mon); - sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); - sum->currentHP = GetMonData(mon, MON_DATA_HP); - sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); - sum->atk = GetMonData(mon, MON_DATA_ATK2); - sum->def = GetMonData(mon, MON_DATA_DEF2); - sum->spatk = GetMonData(mon, MON_DATA_SPATK2); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF2); - sum->speed = GetMonData(mon, MON_DATA_SPEED2); - } + ExtractMonSkillStatsData(mon, sum); break; case 3: GetMonData(mon, MON_DATA_OT_NAME, sum->OTName); @@ -1649,42 +1628,51 @@ static void CloseSummaryScreen(u8 taskId) } } -#define STATS_CORD_X 44 -#define STATS_CORD_Y 102 - -#define STATS_STATS_BLOCK 169 -#define EVS_STATS_BLOCK 218 -#define IVS_STATS_BLOCK (EVS_STATS_BLOCK + 3) -#define STATS_BLANK_BLOCK 1241 - // Update skills page tilemap -static void ChangeSummaryState(s16 mode) +static void ChangeStatLabel(s16 mode) { - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 4, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 5, STATS_CORD_Y, 1, 1, 2); + u32 STATS_CORD_X = 44; + u32 STATS_CORD_Y = 102; + + u32 STATS_STATS_BLOCK = 169; + u32 EVS_STATS_BLOCK = 218; + u32 IVS_STATS_BLOCK = (EVS_STATS_BLOCK + 3); + + ClearStatLabel(); + switch (mode) { - case SKILL_PAGE_IVS: - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); - break; - case SKILL_PAGE_EVS: - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); - break; - case SKILL_PAGE_STATS: - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); - break; + case SKILL_PAGE_STATS: + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); + break; + case SKILL_PAGE_IVS: + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + break; + case SKILL_PAGE_EVS: + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + break; } CopyBgTilemapBufferToVram(1); } +static void ClearStatLabel(void) +{ + u32 STATS_CORD_X = 44; + u32 STATS_CORD_Y = 102; + u32 STATS_BLANK_BLOCK = 1241; + + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 4, STATS_CORD_Y, 1, 1, 2); + FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 5, STATS_CORD_Y, 1, 1, 2); +} + static void Task_HandleInput(u8 taskId) { s16 *taskData = gTasks[taskId].data; @@ -1775,64 +1763,30 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_LEFT], 0); FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_RIGHT], 0); - ChangeSummaryState(mode); + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + ChangeStatLabel(mode); + ShowCancelOrUtilityPrompt(mode); + } + if (mode == SKILL_PAGE_STATS) { - if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) - { - sum->nature = GetNature(mon); - sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); - sum->currentHP = GetMonData(mon, MON_DATA_HP); - sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); - sum->atk = GetMonData(mon, MON_DATA_ATK); - sum->def = GetMonData(mon, MON_DATA_DEF); - sum->spatk = GetMonData(mon, MON_DATA_SPATK); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF); - sum->speed = GetMonData(mon, MON_DATA_SPEED); - - } - else // - { - sum->nature = GetNature(mon); - sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); - sum->currentHP = GetMonData(mon, MON_DATA_HP); - sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); - sum->atk = GetMonData(mon, MON_DATA_ATK2); - sum->def = GetMonData(mon, MON_DATA_DEF2); - sum->spatk = GetMonData(mon, MON_DATA_SPATK2); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF2); - sum->speed = GetMonData(mon, MON_DATA_SPEED2); - } + ExtractMonSkillStatsData(mon, sum); BufferLeftColumnStats(); } else if (mode == SKILL_PAGE_IVS) { - sum->currentHP = GetMonData(mon, MON_DATA_HP_IV); - sum->maxHP = 0; - sum->atk = GetMonData(mon, MON_DATA_ATK_IV); - sum->def = GetMonData(mon, MON_DATA_DEF_IV); - sum->spatk = GetMonData(mon, MON_DATA_SPATK_IV); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF_IV); - sum->speed = GetMonData(mon, MON_DATA_SPEED_IV); - + ExtractMonSkillIvData(mon, sum); BufferLeftColumnIvEvStats(); - } else if (mode == SKILL_PAGE_EVS) { - sum->currentHP = GetMonData(mon, MON_DATA_HP_EV); - sum->maxHP = 0; - sum->atk = GetMonData(mon, MON_DATA_ATK_EV); - sum->def = GetMonData(mon, MON_DATA_DEF_EV); - sum->spatk = GetMonData(mon, MON_DATA_SPATK_EV); - sum->spdef = GetMonData(mon, MON_DATA_SPDEF_EV); - sum->speed = GetMonData(mon, MON_DATA_SPEED_EV); - + ExtractMonSkillEvData(mon, sum); BufferLeftColumnIvEvStats(); - gTasks[taskId].data[0] = -1; // we increment this in Task_HandleInput } + PrintLeftColumnStats(); BufferRightColumnStats(); @@ -1840,6 +1794,57 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) gTasks[taskId].func = Task_HandleInput; } +void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum) +{ + if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) + { + sum->nature = GetNature(mon); + sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); + sum->currentHP = GetMonData(mon, MON_DATA_HP); + sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); + sum->atk = GetMonData(mon, MON_DATA_ATK); + sum->def = GetMonData(mon, MON_DATA_DEF); + sum->spatk = GetMonData(mon, MON_DATA_SPATK); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF); + sum->speed = GetMonData(mon, MON_DATA_SPEED); + } + else // + { + sum->nature = GetNature(mon); + sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); + sum->currentHP = GetMonData(mon, MON_DATA_HP); + sum->maxHP = GetMonData(mon, MON_DATA_MAX_HP); + sum->atk = GetMonData(mon, MON_DATA_ATK2); + sum->def = GetMonData(mon, MON_DATA_DEF2); + sum->spatk = GetMonData(mon, MON_DATA_SPATK2); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF2); + sum->speed = GetMonData(mon, MON_DATA_SPEED2); + } +} + +void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum) +{ + sum->currentHP = GetMonData(mon, MON_DATA_HP_IV); + sum->maxHP = 0; + sum->atk = GetMonData(mon, MON_DATA_ATK_IV); + sum->def = GetMonData(mon, MON_DATA_DEF_IV); + sum->spatk = GetMonData(mon, MON_DATA_SPATK_IV); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF_IV); + sum->speed = GetMonData(mon, MON_DATA_SPEED_IV); +} + +void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum) +{ + if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) + sum->currentHP = GetMonData(mon, MON_DATA_HP_EV); + sum->maxHP = 0; + sum->atk = GetMonData(mon, MON_DATA_ATK_EV); + sum->def = GetMonData(mon, MON_DATA_DEF_EV); + sum->spatk = GetMonData(mon, MON_DATA_SPATK_EV); + sum->spdef = GetMonData(mon, MON_DATA_SPDEF_EV); + sum->speed = GetMonData(mon, MON_DATA_SPEED_EV); +} + static void ChangeSummaryPokemon(u8 taskId, s8 delta) { s8 monId; @@ -1882,7 +1887,7 @@ static void ChangeSummaryPokemon(u8 taskId, s8 delta) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ScheduleBgCopyTilemapToVram(0); HandleStatusTilemap(0, 2); - ChangeSummaryState(SKILL_PAGE_STATS); + // ChangeStatLabel(SKILL_PAGE_STATS); } sMonSummaryScreen->curMonIndex = monId; gTasks[taskId].data[0] = 0; @@ -1947,7 +1952,6 @@ static void Task_ChangeSummaryMon(u8 taskId) gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 1; TryDrawExperienceProgressBar(); data[1] = 0; - ChangeSummaryState(SKILL_PAGE_STATS); break; case 9: SetTypeIcons(); @@ -1961,13 +1965,13 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - ShowCancelOrUtilityPrompt(); + ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); } if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - ShowCancelOrUtilityPrompt(); + ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); } break; @@ -2072,8 +2076,17 @@ static void ChangePage(u8 taskId, s8 delta) SetTaskFuncWithFollowupFunc(taskId, PssScrollLeft, gTasks[taskId].func); CreateTextPrinterTask(sMonSummaryScreen->currPageIndex); HidePageSpecificSprites(); - ShowCancelOrUtilityPrompt(); - ChangeSummaryState(SKILL_PAGE_STATS); + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + struct Pokemon *mon = &sMonSummaryScreen->currentMon; + + ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); + ExtractMonSkillStatsData(mon, summary); + BufferLeftColumnStats(); + BufferRightColumnStats(); + } + else + ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); } static void PssScrollRight(u8 taskId) // Scroll right @@ -3023,12 +3036,12 @@ static void ResetWindows(void) sMonSummaryScreen->windowIds[i] = WINDOW_NONE; } -static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) +void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) { AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); } -static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) { PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, FONT_NORMAL); } @@ -3148,14 +3161,14 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); - ShowCancelOrUtilityPrompt(); + ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_INFO, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 1, 0, 0); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 0, 0, 0); stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Switch, 62); iconXPos = stringXPos - 16; @@ -3305,7 +3318,7 @@ static void ClearPageWindowTilemaps(u8 page) ScheduleBgCopyTilemapToVram(0); } -static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) +u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) { u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId]; if (*windowIdPtr == WINDOW_NONE) @@ -3620,6 +3633,7 @@ static void PrintSkillsPageText(void) { PrintHeldItemName(); PrintRibbonCount(); + ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); BufferLeftColumnStats(); PrintLeftColumnStats(); BufferRightColumnStats(); @@ -3640,21 +3654,24 @@ static void Task_PrintSkillsPage(u8 taskId) PrintRibbonCount(); break; case 3: - BufferLeftColumnStats(); + ChangeStatLabel(SKILL_PAGE_STATS); break; case 4: - PrintLeftColumnStats(); + BufferLeftColumnStats(); break; case 5: - BufferRightColumnStats(); + PrintLeftColumnStats(); break; case 6: - PrintRightColumnStats(); + BufferRightColumnStats(); break; case 7: - PrintExpPointsNextLevel(); + PrintRightColumnStats(); break; case 8: + PrintExpPointsNextLevel(); + break; + case 9: DestroyTask(taskId); return; } @@ -4564,31 +4581,33 @@ static inline bool32 ShouldShowRename(void) && GetPlayerIDAsU32() == sMonSummaryScreen->summary.OTID); } -static void ShowCancelOrUtilityPrompt(void) +static void ShowCancelOrUtilityPrompt(s16 mode) { - const u8* promptText; - const u8* gText_ShowIv = COMPOUND_STRING("IVs"); + const u8* gText_SkillPageIvs = COMPOUND_STRING("IVs"); + const u8* gText_SkillPageEvs = COMPOUND_STRING("EVs"); + const u8* gText_SkillPageStats = COMPOUND_STRING("STATS"); if (sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { if (ShouldShowRename()) { promptText = gText_Rename; - // PlaySE(SE_M_REVERSAL); + PlaySE(SE_M_REVERSAL); } else { promptText = gText_Cancel2; } } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) - { - if (P_SUMMARY_SCREEN_IV_INFO) - { - promptText = gText_ShowIv; - // PlaySE(SE_M_GIGA_DRAIN); - } + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_INFO) + { + if (mode == SKILL_PAGE_STATS) + promptText = gText_SkillPageIvs; + else if (mode == SKILL_PAGE_IVS) + promptText = gText_SkillPageEvs; + else if (mode == SKILL_PAGE_EVS) + promptText = gText_SkillPageStats; else return; } @@ -4606,22 +4625,9 @@ static void ShowCancelOrUtilityPrompt(void) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_CANCEL, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, promptText, stringXPos, 1, 0, 0); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, promptText, stringXPos, 0, 0, 0); } -/*static void ShowCancelOrIvPrompt(void) -{ - const u8* promptText = P_SUMMARY_SCREEN_IV_INFO ? COMPOUND_STRING("{R_BUTTON} IVs") : gText_Cancel2; - - int stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, promptText, 62); - int iconXPos = stringXPos - 16; - if (iconXPos < 0) - iconXPos = 0; - - // PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_IV_INFO, FALSE, iconXPos); - -}*/ - static void CB2_ReturnToSummaryScreenFromNamingScreen(void) { SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2); From a0859bf2c92818a7ed766b626bae4cb39e818da7 Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 11 Jan 2025 00:25:59 -0600 Subject: [PATCH 05/44] small refactor, may need more cleanup --- include/pokemon_summary_screen.h | 3 + src/pokemon_summary_screen.c | 118 ++++++++++++++++++------------- 2 files changed, 72 insertions(+), 49 deletions(-) diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 1f286698a56d..0ef76ba10071 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -29,6 +29,9 @@ enum PokemonSummaryScreenMode SUMMARY_MODE_SELECT_MOVE, SUMMARY_MODE_RELEARNER_BATTLE, // returning from move relearner initiated from battle moves page SUMMARY_MODE_RELEARNER_CONTEST, // returning from move relearner initiated from contest moves page + SUMMARY_MODE_SKILLS_STATS, + SUMMARY_MODE_SKILLS_IVS, + SUMMARY_MODE_SKILLS_EVS, }; enum PokemonSummaryScreenPage diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 584516cad78d..55ec1b4a68d3 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -59,7 +59,7 @@ #define PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE 3 // Button control text (upper right) -#define PSS_LABEL_WINDOW_PROMPT_CANCEL 4 // Also handles the "rename" prompt if P_SUMMARY_SCREEN_RENAME is true +#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "rename" prompt if P_SUMMARY_SCREEN_RENAME is true #define PSS_LABEL_WINDOW_PROMPT_INFO 5 #define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 #define PSS_DATA_WINDOW_UNUSED 7 @@ -202,6 +202,7 @@ EWRAM_DATA MainCallback gInitialSummaryScreenCallback = NULL; // stores callback void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); +static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(void); static bool8 LoadGraphics(void); static void CB2_InitSummaryScreen(void); @@ -439,7 +440,7 @@ static const struct WindowTemplate sSummaryTemplate[] = .paletteNum = 6, .baseBlock = 67, }, - [PSS_LABEL_WINDOW_PROMPT_CANCEL] = { + [PSS_LABEL_WINDOW_PROMPT_UTILITY] = { .bg = 0, .tilemapLeft = 22, .tilemapTop = 0, @@ -1144,13 +1145,6 @@ static const struct SpriteTemplate sSpriteTemplate_StatusCondition = }; static const u16 sMarkings_Pal[] = INCBIN_U16("graphics/summary_screen/markings.gbapal"); -enum { - SKILL_PAGE_STATS, - SKILL_PAGE_IVS, - SKILL_PAGE_EVS, - PSS_OTHER_PAGES, -}; - // code static u8 ShowCategoryIcon(u32 category) { @@ -1642,18 +1636,21 @@ static void ChangeStatLabel(s16 mode) switch (mode) { - case SKILL_PAGE_STATS: + case SUMMARY_MODE_SKILLS_STATS: + ClearStatLabel(); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); break; - case SKILL_PAGE_IVS: + case SUMMARY_MODE_SKILLS_IVS: + ClearStatLabel(); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); break; - case SKILL_PAGE_EVS: + case SUMMARY_MODE_SKILLS_EVS: + ClearStatLabel(); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); @@ -1675,8 +1672,6 @@ static void ClearStatLabel(void) static void Task_HandleInput(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - if (MenuHelpers_ShouldWaitForLinkRecv() != TRUE && !gPaletteFade.active) { if (JOY_NEW(DPAD_UP)) @@ -1721,8 +1716,7 @@ static void Task_HandleInput(u8 taskId) { if (P_SUMMARY_SCREEN_IV_INFO) { - taskData[0]++; - ShowMonSkillsInfo(taskId, taskData[0]); + ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->mode)); // PlaySE(SE_M_GIGA_DRAIN); } } @@ -1754,6 +1748,24 @@ static void Task_HandleInput(u8 taskId) } } +static u8 IncrementSkillsStatsMode(u8 mode) +{ + switch (mode) + { + case SUMMARY_MODE_SKILLS_STATS: + sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_IVS; + return SUMMARY_MODE_SKILLS_IVS; + case SUMMARY_MODE_SKILLS_IVS: + sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_EVS; + return SUMMARY_MODE_SKILLS_EVS; + case SUMMARY_MODE_SKILLS_EVS: + default: + sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; + return SUMMARY_MODE_SKILLS_STATS; + } + +} + static void ShowMonSkillsInfo(u8 taskId, s16 mode) { struct PokeSummary *sum = &sMonSummaryScreen->summary; @@ -1770,17 +1782,17 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) } - if (mode == SKILL_PAGE_STATS) + if (mode == SUMMARY_MODE_SKILLS_STATS) { ExtractMonSkillStatsData(mon, sum); BufferLeftColumnStats(); } - else if (mode == SKILL_PAGE_IVS) + else if (mode == SUMMARY_MODE_SKILLS_IVS) { ExtractMonSkillIvData(mon, sum); BufferLeftColumnIvEvStats(); } - else if (mode == SKILL_PAGE_EVS) + else if (mode == SUMMARY_MODE_SKILLS_EVS) { ExtractMonSkillEvData(mon, sum); BufferLeftColumnIvEvStats(); @@ -1887,7 +1899,7 @@ static void ChangeSummaryPokemon(u8 taskId, s8 delta) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ScheduleBgCopyTilemapToVram(0); HandleStatusTilemap(0, 2); - // ChangeStatLabel(SKILL_PAGE_STATS); + // ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); } sMonSummaryScreen->curMonIndex = monId; gTasks[taskId].data[0] = 0; @@ -1964,15 +1976,16 @@ static void Task_ChangeSummaryMon(u8 taskId) LimitEggSummaryPageDisplay(); if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_SKILLS_STATS); + ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } break; case 12: @@ -2080,13 +2093,15 @@ static void ChangePage(u8 taskId, s8 delta) { struct Pokemon *mon = &sMonSummaryScreen->currentMon; - ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); + if (sMonSummaryScreen->mode != SUMMARY_MODE_SKILLS_STATS) + sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; + ShowCancelOrUtilityPrompt(sMonSummaryScreen->mode); ExtractMonSkillStatsData(mon, summary); BufferLeftColumnStats(); BufferRightColumnStats(); } else - ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); } static void PssScrollRight(u8 taskId) // Scroll right @@ -2332,7 +2347,9 @@ static void CloseMoveSelectMode(u8 taskId) { DestroyMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_SWITCH); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); if (ShouldShowMoveRelearner()) PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); PrintMoveDetails(0); @@ -3161,21 +3178,21 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); - ShowCancelOrUtilityPrompt(PSS_OTHER_PAGES); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); - stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); + /*stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_INFO, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 0, 0, 0); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 0, 0, 0);*/ stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Switch, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_SWITCH, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_SWITCH, gText_Switch, stringXPos, 1, 0, 0); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_SWITCH, gText_Switch, stringXPos, 0, 0, 0); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL, gText_RentalPkmn, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE, gText_TypeSlash, 0, 1, 0, 0); @@ -3214,7 +3231,7 @@ static void PutPageWindowTilemaps(u8 page) { case PSS_PAGE_INFO: PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (InBattleFactory() == TRUE || InSlateportBattleTent() == TRUE) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE); @@ -3225,7 +3242,7 @@ static void PutPageWindowTilemaps(u8 page) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); if (P_SUMMARY_SCREEN_IV_INFO) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); @@ -3236,7 +3253,7 @@ static void PutPageWindowTilemaps(u8 page) } else { - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (ShouldShowMoveRelearner()) PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } @@ -3250,7 +3267,7 @@ static void PutPageWindowTilemaps(u8 page) } else { - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (ShouldShowMoveRelearner()) PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } @@ -3270,7 +3287,7 @@ static void ClearPageWindowTilemaps(u8 page) switch (page) { case PSS_PAGE_INFO: - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (InBattleFactory() == TRUE || InSlateportBattleTent() == TRUE) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE); @@ -3279,7 +3296,7 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); - ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_CANCEL); + ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) @@ -3633,7 +3650,7 @@ static void PrintSkillsPageText(void) { PrintHeldItemName(); PrintRibbonCount(); - ShowCancelOrUtilityPrompt(SKILL_PAGE_STATS); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_SKILLS_STATS); BufferLeftColumnStats(); PrintLeftColumnStats(); BufferRightColumnStats(); @@ -3654,7 +3671,7 @@ static void Task_PrintSkillsPage(u8 taskId) PrintRibbonCount(); break; case 3: - ChangeStatLabel(SKILL_PAGE_STATS); + ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); break; case 4: BufferLeftColumnStats(); @@ -3842,6 +3859,8 @@ static void PrintBattleMoves(void) PrintMoveDetails(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]); } } + + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); } static void Task_PrintBattleMoves(u8 taskId) @@ -3971,6 +3990,8 @@ static void PrintContestMoves(void) PrintNewMoveDetailsOrCancelText(); PrintContestMoveDescription(sMonSummaryScreen->firstMoveIndex); } + + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); } static void Task_PrintContestMoves(u8 taskId) @@ -4593,7 +4614,6 @@ static void ShowCancelOrUtilityPrompt(s16 mode) if (ShouldShowRename()) { promptText = gText_Rename; - PlaySE(SE_M_REVERSAL); } else { @@ -4602,11 +4622,11 @@ static void ShowCancelOrUtilityPrompt(s16 mode) } else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_INFO) { - if (mode == SKILL_PAGE_STATS) + if (mode == SUMMARY_MODE_SKILLS_STATS) promptText = gText_SkillPageIvs; - else if (mode == SKILL_PAGE_IVS) + else if (mode == SUMMARY_MODE_SKILLS_IVS) promptText = gText_SkillPageEvs; - else if (mode == SKILL_PAGE_EVS) + else if (mode == SUMMARY_MODE_SKILLS_EVS) promptText = gText_SkillPageStats; else return; @@ -4616,16 +4636,16 @@ static void ShowCancelOrUtilityPrompt(s16 mode) else return; - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_CANCEL, PIXEL_FILL(0)); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_CANCEL); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); int stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, promptText, 62); int iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; - PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_CANCEL, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, promptText, stringXPos, 0, 0, 0); + PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_UTILITY, FALSE, iconXPos); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_UTILITY, promptText, stringXPos, 0, 0, 0); } static void CB2_ReturnToSummaryScreenFromNamingScreen(void) From 76072b7abd7670e54f4f9583a7b7ebcd333f8f81 Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 11 Jan 2025 00:40:36 -0600 Subject: [PATCH 06/44] may need more but added select sfx --- src/pokemon_summary_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 55ec1b4a68d3..1cbe4f75740d 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1717,7 +1717,7 @@ static void Task_HandleInput(u8 taskId) if (P_SUMMARY_SCREEN_IV_INFO) { ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->mode)); - // PlaySE(SE_M_GIGA_DRAIN); + PlaySE(SE_SELECT); } } } @@ -2089,7 +2089,7 @@ static void ChangePage(u8 taskId, s8 delta) SetTaskFuncWithFollowupFunc(taskId, PssScrollLeft, gTasks[taskId].func); CreateTextPrinterTask(sMonSummaryScreen->currPageIndex); HidePageSpecificSprites(); - if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS || (sMonSummaryScreen->currPageIndex + delta) == PSS_PAGE_SKILLS) { struct Pokemon *mon = &sMonSummaryScreen->currentMon; From b5dec45ef5bd3cfeb3809972078c13f2ce42a437 Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 11 Jan 2025 00:44:12 -0600 Subject: [PATCH 07/44] oops redundant! --- src/pokemon_summary_screen.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 1cbe4f75740d..29483ce8eadf 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1637,20 +1637,17 @@ static void ChangeStatLabel(s16 mode) switch (mode) { case SUMMARY_MODE_SKILLS_STATS: - ClearStatLabel(); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); break; case SUMMARY_MODE_SKILLS_IVS: - ClearStatLabel(); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); break; case SUMMARY_MODE_SKILLS_EVS: - ClearStatLabel(); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); From 1dcae1b6afcbe081f169a9f015ce97b29263d298 Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 11 Jan 2025 18:08:01 -0600 Subject: [PATCH 08/44] refactors --- src/pokemon_summary_screen.c | 180 +++++++++++++++++------------------ 1 file changed, 89 insertions(+), 91 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 29483ce8eadf..a6a552e5b95f 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -60,7 +60,7 @@ // Button control text (upper right) #define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "rename" prompt if P_SUMMARY_SCREEN_RENAME is true -#define PSS_LABEL_WINDOW_PROMPT_INFO 5 +// #define PSS_LABEL_WINDOW_PROMPT_INFO 5 #define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 #define PSS_DATA_WINDOW_UNUSED 7 @@ -202,6 +202,8 @@ EWRAM_DATA MainCallback gInitialSummaryScreenCallback = NULL; // stores callback void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); +static void ClearRelearnPrompt(void); +static void ShowRelearnPrompt(void); static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(void); static bool8 LoadGraphics(void); @@ -326,6 +328,7 @@ static void SummaryScreen_DestroyAnimDelayTask(void); static bool32 ShouldShowMoveRelearner(void); static bool32 ShouldShowRename(void); static void ShowCancelOrUtilityPrompt(s16 mode); +static inline void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); @@ -449,15 +452,6 @@ static const struct WindowTemplate sSummaryTemplate[] = .paletteNum = 7, .baseBlock = 89, }, - [PSS_LABEL_WINDOW_PROMPT_INFO] = { - .bg = 0, - .tilemapLeft = 22, - .tilemapTop = 0, - .width = 8, - .height = 2, - .paletteNum = 7, - .baseBlock = 105, - }, [PSS_LABEL_WINDOW_PROMPT_SWITCH] = { .bg = 0, .tilemapLeft = 22, @@ -1703,7 +1697,8 @@ static void Task_HandleInput(u8 taskId) PlaySE(SE_SELECT); BeginCloseSummaryScreen(taskId); } - else // Contest or Battle Moves + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES + || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES) { PlaySE(SE_SELECT); SwitchToMoveSelection(taskId); @@ -1777,7 +1772,6 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) ChangeStatLabel(mode); ShowCancelOrUtilityPrompt(mode); } - if (mode == SUMMARY_MODE_SKILLS_STATS) { @@ -1795,7 +1789,6 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) BufferLeftColumnIvEvStats(); gTasks[taskId].data[0] = -1; // we increment this in Task_HandleInput } - PrintLeftColumnStats(); BufferRightColumnStats(); @@ -1927,20 +1920,7 @@ static void Task_ChangeSummaryMon(u8 taskId) break; case 4: if (ExtractMonDataToSummaryStruct(&sMonSummaryScreen->currentMon) == FALSE) - { return; - } - else - { - if (P_SUMMARY_SCREEN_MOVE_RELEARNER - && (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES)) - { - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - else - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - } - } break; case 5: RemoveAndCreateMonMarkingsSprite(&sMonSummaryScreen->currentMon); @@ -2078,6 +2058,7 @@ static void ChangePage(u8 taskId, s8 delta) PlaySE(SE_SELECT); ClearPageWindowTilemaps(sMonSummaryScreen->currPageIndex); + ClearRelearnPrompt(); sMonSummaryScreen->currPageIndex += delta; data[0] = 0; if (delta == 1) @@ -2086,12 +2067,15 @@ static void ChangePage(u8 taskId, s8 delta) SetTaskFuncWithFollowupFunc(taskId, PssScrollLeft, gTasks[taskId].func); CreateTextPrinterTask(sMonSummaryScreen->currPageIndex); HidePageSpecificSprites(); - if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS || (sMonSummaryScreen->currPageIndex + delta) == PSS_PAGE_SKILLS) + + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS + || (sMonSummaryScreen->currPageIndex + delta) == PSS_PAGE_SKILLS) { struct Pokemon *mon = &sMonSummaryScreen->currentMon; if (sMonSummaryScreen->mode != SUMMARY_MODE_SKILLS_STATS) sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; + ShowCancelOrUtilityPrompt(sMonSummaryScreen->mode); ExtractMonSkillStatsData(mon, summary); BufferLeftColumnStats(); @@ -2099,6 +2083,7 @@ static void ChangePage(u8 taskId, s8 delta) } else ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + } static void PssScrollRight(u8 taskId) // Scroll right @@ -2203,20 +2188,21 @@ static void SwitchToMoveSelection(u8 taskId) { u16 move; + if (!sMonSummaryScreen->lockMovesFlag || sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES) + { + sMonSummaryScreen->lockMovesFlag = TRUE; + sMonSummaryScreen->mode = SUMMARY_MODE_LOCK_MOVES; + } + sMonSummaryScreen->firstMoveIndex = 0; move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]; + ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); if (!gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]].invisible) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); HandlePowerAccTilemap(9, -3); HandleAppealJamTilemap(9, -3, move); - if (!sMonSummaryScreen->lockMovesFlag) - { - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); - if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_SWITCH); - } + TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, FALSE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE); PrintMoveDetails(move); @@ -2226,6 +2212,8 @@ static void SwitchToMoveSelection(u8 taskId) ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(2); CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); + ClearRelearnPrompt(); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); gTasks[taskId].func = Task_HandleInput_MoveSelect; } @@ -2247,15 +2235,16 @@ static void Task_HandleInput_MoveSelect(u8 taskId) } else if (JOY_NEW(A_BUTTON)) { - if (sMonSummaryScreen->lockMovesFlag == TRUE - || (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES)) + if (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES) { PlaySE(SE_SELECT); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); CloseMoveSelectMode(taskId); } else if (HasMoreThanOneMove() == TRUE) { PlaySE(SE_SELECT); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); SwitchToMovePositionSwitchMode(taskId); } else @@ -2343,12 +2332,17 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr) static void CloseMoveSelectMode(u8 taskId) { DestroyMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_SWITCH); - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_SWITCH); + // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + if (sMonSummaryScreen->lockMovesFlag || sMonSummaryScreen->mode != SUMMARY_MODE_NORMAL) + { + sMonSummaryScreen->mode = SUMMARY_MODE_NORMAL; + sMonSummaryScreen->lockMovesFlag = FALSE; + } + ShowRelearnPrompt(); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); PrintMoveDetails(0); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, TRUE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, TRUE); @@ -3166,8 +3160,8 @@ static void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) static void PrintPageNamesAndStats(void) { - int stringXPos; - int iconXPos; + // int stringXPos; + // int iconXPos; int statsXPos; PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 1, 0, 1); @@ -3177,20 +3171,6 @@ static void PrintPageNamesAndStats(void) ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); - /*stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); - iconXPos = stringXPos - 16; - if (iconXPos < 0) - iconXPos = 0; - PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_INFO, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 0, 0, 0);*/ - - stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Switch, 62); - iconXPos = stringXPos - 16; - if (iconXPos < 0) - iconXPos = 0; - PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_SWITCH, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_SWITCH, gText_Switch, stringXPos, 0, 0, 0); - PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL, gText_RentalPkmn, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE, gText_TypeSlash, 0, 1, 0, 0); statsXPos = 6 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_HP4, 42); @@ -3212,7 +3192,6 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_POWER_ACC, gText_Accuracy2, 0, 17, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Appeal, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Jam, 0, 17, 0, 1); - PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); } static void PutPageWindowTilemaps(u8 page) @@ -3223,6 +3202,7 @@ static void PutPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE); ClearWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); ClearWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); + // ShowClearRelearnPrompt(); switch (page) { @@ -3243,31 +3223,25 @@ static void PutPageWindowTilemaps(u8 page) break; case PSS_PAGE_BATTLE_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); } else - { - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - } + ShowRelearnPrompt(); break; case PSS_PAGE_CONTEST_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); } else - { - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - } + ShowRelearnPrompt(); break; } @@ -3296,32 +3270,23 @@ static void ClearPageWindowTilemaps(u8 page) ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: - if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) + if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE || sMonSummaryScreen->lockMovesFlag) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) { ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); gSprites[sMonSummaryScreen->categoryIconSpriteId].invisible = TRUE; } - } - else - { - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); - if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; case PSS_PAGE_CONTEST_MOVES: - if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) + if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE || sMonSummaryScreen->lockMovesFlag) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); - } - else - { - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_INFO); - if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; } @@ -3842,10 +3807,10 @@ static void PrintBattleMoves(void) PrintMoveNameAndPP(1); PrintMoveNameAndPP(2); PrintMoveNameAndPP(3); - if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); + // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); if (sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES) { if (sMonSummaryScreen->newMove != MOVE_NONE) @@ -3857,7 +3822,8 @@ static void PrintBattleMoves(void) } } - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + // if (ShouldShowMoveRelearner()) + // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } static void Task_PrintBattleMoves(u8 taskId) @@ -3985,10 +3951,12 @@ static void PrintContestMoves(void) if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); + // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); PrintContestMoveDescription(sMonSummaryScreen->firstMoveIndex); } - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + // if (ShouldShowMoveRelearner()) + // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } static void Task_PrintContestMoves(u8 taskId) @@ -4599,7 +4567,32 @@ static inline bool32 ShouldShowRename(void) && GetPlayerIDAsU32() == sMonSummaryScreen->summary.OTID); } -static void ShowCancelOrUtilityPrompt(s16 mode) +static inline void ShowRelearnPrompt(void) +{ + if (ShouldShowMoveRelearner() + && sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES + && (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES + || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES)) + { + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); + } +} + +static inline void ClearRelearnPrompt(void) +{ + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_RELEARN, PIXEL_FILL(0)); +} + +static inline void ClearUtilityPrompt(void) +{ + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); +} + + +static inline void ShowCancelOrUtilityPrompt(s16 mode) { const u8* promptText; const u8* gText_SkillPageIvs = COMPOUND_STRING("IVs"); @@ -4609,13 +4602,9 @@ static void ShowCancelOrUtilityPrompt(s16 mode) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { if (ShouldShowRename()) - { promptText = gText_Rename; - } else - { promptText = gText_Cancel2; - } } else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_INFO) { @@ -4626,12 +4615,21 @@ static void ShowCancelOrUtilityPrompt(s16 mode) else if (mode == SUMMARY_MODE_SKILLS_EVS) promptText = gText_SkillPageStats; else + { + ClearUtilityPrompt(); return; + } } else if (sMonSummaryScreen->currPageIndex > PSS_PAGE_SKILLS) - promptText = gText_Info; + if (sMonSummaryScreen->mode == SUMMARY_MODE_LOCK_MOVES) + promptText = gText_Switch; + else + promptText = gText_Info; else + { + ClearUtilityPrompt(); return; + } FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); From 36cd26910fea5250bc0f5457e4ea0747cdaa164d Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 11 Jan 2025 19:22:11 -0600 Subject: [PATCH 09/44] aligned some text as well --- src/pokemon_summary_screen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index a6a552e5b95f..595c8ed73cdd 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3164,10 +3164,10 @@ static void PrintPageNamesAndStats(void) // int iconXPos; int statsXPos; - PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 1, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE, gText_PkmnSkills, 2, 1, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 0, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE, gText_PkmnSkills, 2, 0, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 0, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 0, 0, 1); ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); From be49a624aa3f3b1e9f7b223a084bd411a3d2b0da Mon Sep 17 00:00:00 2001 From: khbsd Date: Sun, 12 Jan 2025 01:46:27 -0600 Subject: [PATCH 10/44] added mode reset to changing mons --- src/pokemon_summary_screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 595c8ed73cdd..64f2a5b19022 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1960,6 +1960,7 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); + sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; ShowCancelOrUtilityPrompt(SUMMARY_MODE_SKILLS_STATS); ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); From fe3b08c3dcf655a4d86eecc7bc34db5b4a66c7a7 Mon Sep 17 00:00:00 2001 From: khbsd Date: Sun, 12 Jan 2025 02:39:35 -0600 Subject: [PATCH 11/44] fix lag when switching from moves to skills --- src/pokemon_summary_screen.c | 38 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 64f2a5b19022..5afe5b9cc38f 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -202,6 +202,7 @@ EWRAM_DATA MainCallback gInitialSummaryScreenCallback = NULL; // stores callback void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); +static void WriteToStatsTilemapBuffer(u32 length, u32 block); static void ClearRelearnPrompt(void); static void ShowRelearnPrompt(void); static u8 IncrementSkillsStatsMode(u8 mode); @@ -1619,37 +1620,41 @@ static void CloseSummaryScreen(u8 taskId) // Update skills page tilemap static void ChangeStatLabel(s16 mode) { - u32 STATS_CORD_X = 44; - u32 STATS_CORD_Y = 102; + u32 STATS_BLOCK = 169; + u32 EVS_BLOCK = 218; + u32 IVS_BLOCK = 221; - u32 STATS_STATS_BLOCK = 169; - u32 EVS_STATS_BLOCK = 218; - u32 IVS_STATS_BLOCK = (EVS_STATS_BLOCK + 3); + u32 statsLength = 3; + u32 ivEvLength = 2; ClearStatLabel(); switch (mode) { case SUMMARY_MODE_SKILLS_STATS: - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_STATS_BLOCK + 3, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); + WriteToStatsTilemapBuffer(statsLength, STATS_BLOCK); break; case SUMMARY_MODE_SKILLS_IVS: - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, IVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + WriteToStatsTilemapBuffer(ivEvLength, IVS_BLOCK); break; case SUMMARY_MODE_SKILLS_EVS: - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK, STATS_CORD_X, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 1, STATS_CORD_X + 1, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, EVS_STATS_BLOCK + 2, STATS_CORD_X + 2, STATS_CORD_Y, 1, 1, 2); + WriteToStatsTilemapBuffer(ivEvLength, EVS_BLOCK); break; } CopyBgTilemapBufferToVram(1); } +static void WriteToStatsTilemapBuffer(u32 length, u32 block) +{ + u32 STATS_COORD_X = 44; + u32 STATS_COORD_Y = 102; + u32 i; + + for (i = 0; i <= length; i++) + FillBgTilemapBufferRect(1, block + i, STATS_COORD_X + i, STATS_COORD_Y, 1, 1, 2); + +} + static void ClearStatLabel(void) { u32 STATS_CORD_X = 44; @@ -2133,6 +2138,9 @@ static void PssScrollRightEnd(u8 taskId) // display right static void PssScrollLeft(u8 taskId) // Scroll left { s16 *data = gTasks[taskId].data; + // to fix a specific lag in writing to that spot + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); if (data[0] == 0) { if (sMonSummaryScreen->bgDisplayOrder == 0) From eb38bdee6097c11e26c2b818536d20544e2b3939 Mon Sep 17 00:00:00 2001 From: khbsd Date: Mon, 13 Jan 2025 19:50:45 -0600 Subject: [PATCH 12/44] revert page_skills.bin changes --- graphics/summary_screen/page_skills.bin | Bin 2048 -> 2048 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/graphics/summary_screen/page_skills.bin b/graphics/summary_screen/page_skills.bin index daa1ddbced36f948bd8ba4bb290510e91a416753..19cb94637637b7caa47361d545d7279335126731 100644 GIT binary patch delta 22 ecmZn=Xb{*igOPKk!YYN;3TqVBZeGY3&jtWn!3YEZ delta 22 YcmZn=Xb{*igOPKc0u*ju$QaKC09 Date: Mon, 13 Jan 2025 20:09:05 -0600 Subject: [PATCH 13/44] reorganize and clean up some personal changes not needed for the pr --- src/pokemon_summary_screen.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5afe5b9cc38f..cc18f5a6e3d4 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -199,12 +199,6 @@ ALIGNED(4) static EWRAM_DATA u8 sAnimDelayTaskId = 0; EWRAM_DATA MainCallback gInitialSummaryScreenCallback = NULL; // stores callback from the first time the screen is opened from the party or PC menu // forward declarations -void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); -void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); -u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); -static void WriteToStatsTilemapBuffer(u32 length, u32 block); -static void ClearRelearnPrompt(void); -static void ShowRelearnPrompt(void); static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(void); static bool8 LoadGraphics(void); @@ -328,15 +322,21 @@ static void KeepMoveSelectorVisible(u8); static void SummaryScreen_DestroyAnimDelayTask(void); static bool32 ShouldShowMoveRelearner(void); static bool32 ShouldShowRename(void); +static void BufferLeftColumnIvEvStats(void); +static void CB2_ReturnToSummaryScreenFromNamingScreen(void); +static void CB2_PssChangePokemonNickname(void); static void ShowCancelOrUtilityPrompt(s16 mode); -static inline void ClearUtilityPrompt(void); +static void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); +static void WriteToStatsTilemapBuffer(u32 length, u32 block); +static void ClearRelearnPrompt(void); +static void ShowRelearnPrompt(void); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); -static void BufferLeftColumnIvEvStats(void); -static void CB2_ReturnToSummaryScreenFromNamingScreen(void); -static void CB2_PssChangePokemonNickname(void); +void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); +void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); +u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); static const struct BgTemplate sBgTemplates[] = { @@ -2138,7 +2138,7 @@ static void PssScrollRightEnd(u8 taskId) // display right static void PssScrollLeft(u8 taskId) // Scroll left { s16 *data = gTasks[taskId].data; - // to fix a specific lag in writing to that spot + // to fix a specific lag in writing to the stat label if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); if (data[0] == 0) @@ -2341,9 +2341,6 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr) static void CloseMoveSelectMode(u8 taskId) { DestroyMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); - // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_SWITCH); - // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); if (sMonSummaryScreen->lockMovesFlag || sMonSummaryScreen->mode != SUMMARY_MODE_NORMAL) { sMonSummaryScreen->mode = SUMMARY_MODE_NORMAL; @@ -3173,10 +3170,10 @@ static void PrintPageNamesAndStats(void) // int iconXPos; int statsXPos; - PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 0, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE, gText_PkmnSkills, 2, 0, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 0, 0, 1); - PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 0, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 1, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE, gText_PkmnSkills, 2, 1, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); + PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); @@ -4649,7 +4646,7 @@ static inline void ShowCancelOrUtilityPrompt(s16 mode) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_UTILITY, FALSE, iconXPos); - PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_UTILITY, promptText, stringXPos, 0, 0, 0); + PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_UTILITY, promptText, stringXPos, 1, 0, 0); } static void CB2_ReturnToSummaryScreenFromNamingScreen(void) From 2a2b1d8931c133f9cb4df91ca2c419148d7201dd Mon Sep 17 00:00:00 2001 From: khbsd Date: Mon, 13 Jan 2025 20:42:51 -0600 Subject: [PATCH 14/44] more cleanup and small changes to args for statlabel funcs --- src/pokemon_summary_screen.c | 92 +++++++++++++++--------------------- 1 file changed, 38 insertions(+), 54 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index cc18f5a6e3d4..e8480078feaa 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -59,33 +59,30 @@ #define PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE 3 // Button control text (upper right) -#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "rename" prompt if P_SUMMARY_SCREEN_RENAME is true -// #define PSS_LABEL_WINDOW_PROMPT_INFO 5 -#define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 -#define PSS_DATA_WINDOW_UNUSED 7 +#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "Rename" and "IVs"/"EVs" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_INFO are true, respectively +#define PSS_LABEL_WINDOW_PROMPT_SWITCH 5 +#define PSS_DATA_WINDOW_UNUSED 6 // Info screen -#define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 8 -#define PSS_LABEL_WINDOW_POKEMON_INFO_TYPE 9 +#define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 7 +#define PSS_LABEL_WINDOW_POKEMON_INFO_TYPE 8 // Skills screen -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT 10 // HP, Attack, Defense -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT 11 // Sp. Attack, Sp. Defense, Speed -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP 12 // EXP, Next Level -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS 13 +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT 9 // HP, Attack, Defense +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT 10 // Sp. Attack, Sp. Defense, Speed +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP 11 // EXP, Next Level +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS 12 // Moves screen -#define PSS_LABEL_WINDOW_MOVES_POWER_ACC 14 // Also contains the power and accuracy values -#define PSS_LABEL_WINDOW_MOVES_APPEAL_JAM 15 -#define PSS_LABEL_WINDOW_PROMPT_RELEARN 16 +#define PSS_LABEL_WINDOW_MOVES_POWER_ACC 13 // Also contains the power and accuracy values +#define PSS_LABEL_WINDOW_MOVES_APPEAL_JAM 14 +#define PSS_LABEL_WINDOW_PROMPT_RELEARN 15 // Above/below the pokemon's portrait (left) -#define PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER 17 -#define PSS_LABEL_WINDOW_PORTRAIT_NICKNAME 18 // The upper name -#define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 19 // The lower name -#define PSS_LABEL_WINDOW_END 20 - -// dynamic stat type labels for the skills screen +#define PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER 16 +#define PSS_LABEL_WINDOW_PORTRAIT_NICKNAME 17 // The upper name +#define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 18 // The lower name +#define PSS_LABEL_WINDOW_END 19 // Dynamic fields for the Pokémon Info page #define PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER 0 @@ -99,7 +96,6 @@ #define PSS_DATA_WINDOW_SKILLS_STATS_LEFT 2 // HP, Attack, Defense #define PSS_DATA_WINDOW_SKILLS_STATS_RIGHT 3 // Sp. Attack, Sp. Defense, Speed #define PSS_DATA_WINDOW_EXP 4 // Exp, next level -// #define PSS_LABEL_WINDOW_SKILLS_STATS_TYPE 5 // Dynamic fields for the Battle Moves and Contest Moves pages. #define PSS_DATA_WINDOW_MOVE_NAMES 0 @@ -199,8 +195,6 @@ ALIGNED(4) static EWRAM_DATA u8 sAnimDelayTaskId = 0; EWRAM_DATA MainCallback gInitialSummaryScreenCallback = NULL; // stores callback from the first time the screen is opened from the party or PC menu // forward declarations -static u8 IncrementSkillsStatsMode(u8 mode); -static void ClearStatLabel(void); static bool8 LoadGraphics(void); static void CB2_InitSummaryScreen(void); static void InitBGs(void); @@ -328,7 +322,7 @@ static void CB2_PssChangePokemonNickname(void); static void ShowCancelOrUtilityPrompt(s16 mode); static void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); -static void WriteToStatsTilemapBuffer(u32 length, u32 block); +static void WriteToStatsTilemapBuffer(u32 length, u32 block, u32 statsCoordX, u32 statsCoordY); static void ClearRelearnPrompt(void); static void ShowRelearnPrompt(void); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); @@ -337,6 +331,8 @@ void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); +static u8 IncrementSkillsStatsMode(u8 mode); +static void ClearStatLabel(u32 length, u32 statsCoordX, u32 statsCoordY); static const struct BgTemplate sBgTemplates[] = { @@ -1620,50 +1616,50 @@ static void CloseSummaryScreen(u8 taskId) // Update skills page tilemap static void ChangeStatLabel(s16 mode) { - u32 STATS_BLOCK = 169; - u32 EVS_BLOCK = 218; - u32 IVS_BLOCK = 221; + u32 statsBlock = 169; + u32 ivsBlock = 221; + u32 evsBlock = 218; + + u32 statsCoordX = 44; + u32 statsCoordY = 102; u32 statsLength = 3; u32 ivEvLength = 2; - ClearStatLabel(); + ClearStatLabel(statsLength, statsCoordX, statsCoordY); switch (mode) { case SUMMARY_MODE_SKILLS_STATS: - WriteToStatsTilemapBuffer(statsLength, STATS_BLOCK); + WriteToStatsTilemapBuffer(statsLength, statsBlock, statsCoordX, statsCoordY); break; case SUMMARY_MODE_SKILLS_IVS: - WriteToStatsTilemapBuffer(ivEvLength, IVS_BLOCK); + WriteToStatsTilemapBuffer(ivEvLength, ivsBlock, statsCoordX, statsCoordY); break; case SUMMARY_MODE_SKILLS_EVS: - WriteToStatsTilemapBuffer(ivEvLength, EVS_BLOCK); + WriteToStatsTilemapBuffer(ivEvLength, evsBlock, statsCoordX, statsCoordY); break; } CopyBgTilemapBufferToVram(1); } -static void WriteToStatsTilemapBuffer(u32 length, u32 block) +static void WriteToStatsTilemapBuffer(u32 length, u32 block, u32 statsCoordX, u32 statsCoordY) { - u32 STATS_COORD_X = 44; - u32 STATS_COORD_Y = 102; u32 i; for (i = 0; i <= length; i++) - FillBgTilemapBufferRect(1, block + i, STATS_COORD_X + i, STATS_COORD_Y, 1, 1, 2); - + FillBgTilemapBufferRect(1, block + i, statsCoordX + i, statsCoordY, 1, 1, 2); } -static void ClearStatLabel(void) +static void ClearStatLabel(u32 length, u32 statsCoordX, u32 statsCoordY) { - u32 STATS_CORD_X = 44; - u32 STATS_CORD_Y = 102; - u32 STATS_BLANK_BLOCK = 1241; + u32 blankStatsBlock = 1241; - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 3, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 4, STATS_CORD_Y, 1, 1, 2); - FillBgTilemapBufferRect(1, STATS_BLANK_BLOCK, STATS_CORD_X + 5, STATS_CORD_Y, 1, 1, 2); + u32 i; + u32 blankOffset = 3; + + for (i = 0; i <= length; i++) + FillBgTilemapBufferRect(1, blankStatsBlock, statsCoordX + blankOffset + i, statsCoordY, 1, 1, 2); } static void Task_HandleInput(u8 taskId) @@ -1894,7 +1890,6 @@ static void ChangeSummaryPokemon(u8 taskId, s8 delta) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ScheduleBgCopyTilemapToVram(0); HandleStatusTilemap(0, 2); - // ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); } sMonSummaryScreen->curMonIndex = monId; gTasks[taskId].data[0] = 0; @@ -3166,8 +3161,6 @@ static void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) static void PrintPageNamesAndStats(void) { - // int stringXPos; - // int iconXPos; int statsXPos; PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TITLE, gText_PkmnInfo, 2, 1, 0, 1); @@ -3208,7 +3201,6 @@ static void PutPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE); ClearWindowTilemap(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE); ClearWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); - // ShowClearRelearnPrompt(); switch (page) { @@ -3816,7 +3808,6 @@ static void PrintBattleMoves(void) if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); - // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); if (sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES) { if (sMonSummaryScreen->newMove != MOVE_NONE) @@ -3827,9 +3818,6 @@ static void PrintBattleMoves(void) PrintMoveDetails(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]); } } - - // if (ShouldShowMoveRelearner()) - // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } static void Task_PrintBattleMoves(u8 taskId) @@ -3957,12 +3945,8 @@ static void PrintContestMoves(void) if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); - // ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); PrintContestMoveDescription(sMonSummaryScreen->firstMoveIndex); } - - // if (ShouldShowMoveRelearner()) - // PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } static void Task_PrintContestMoves(u8 taskId) From de6a0b5804d6c0f67beb76b1e79b4b88b9a0ea53 Mon Sep 17 00:00:00 2001 From: khbsd Date: Mon, 13 Jan 2025 23:07:38 -0600 Subject: [PATCH 15/44] rename P_SUMMARY_SCREEN_IV_INFO to P_SUMMARY_SCREEN_IV_EV_INFO and update comment accordingly --- include/config/pokemon.h | 2 +- src/graphics.c | 4 ++-- src/pokemon_summary_screen.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 7eed6b957c51..75567d915387 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -63,7 +63,7 @@ #define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. #define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. +#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. diff --git a/src/graphics.c b/src/graphics.c index 18d5a2e36f6b..c04daaa71a59 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1683,11 +1683,11 @@ const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz"); const u32 gSummaryMoveSelect_Gfx[] = INCBIN_U32("graphics/summary_screen/move_select.4bpp.lz"); const u32 gSummaryMoveSelect_Pal[] = INCBIN_U32("graphics/summary_screen/move_select.gbapal.lz"); -#if P_SUMMARY_SCREEN_IV_INFO == TRUE +#if P_SUMMARY_SCREEN_IV_EV_INFO == TRUE const u32 gSummaryScreen_Gfx[] = INCBIN_U32("graphics/summary_screen/iv_ev_tiles.4bpp.lz"); #else const u32 gSummaryScreen_Gfx[] = INCBIN_U32("graphics/summary_screen/tiles.4bpp.lz"); -#endif // P_SUMMARY_SCREEN_IV_INFO +#endif // P_SUMMARY_SCREEN_IV_EV_INFO const u32 gSummaryScreen_Pal[] = INCBIN_U32("graphics/summary_screen/tiles.gbapal.lz"); const u32 gSummaryPage_Info_Tilemap[] = INCBIN_U32("graphics/summary_screen/page_info.bin.lz"); const u32 gSummaryPage_Skills_Tilemap[] = INCBIN_U32("graphics/summary_screen/page_skills.bin.lz"); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e8480078feaa..036dc3e2e329 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -59,7 +59,7 @@ #define PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE 3 // Button control text (upper right) -#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "Rename" and "IVs"/"EVs" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_INFO are true, respectively +#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "Rename" and "IVs"/"EVs" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_EV_INFO are true, respectively #define PSS_LABEL_WINDOW_PROMPT_SWITCH 5 #define PSS_DATA_WINDOW_UNUSED 6 @@ -1707,7 +1707,7 @@ static void Task_HandleInput(u8 taskId) } if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - if (P_SUMMARY_SCREEN_IV_INFO) + if (P_SUMMARY_SCREEN_IV_EV_INFO) { ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->mode)); PlaySE(SE_SELECT); @@ -1957,7 +1957,7 @@ static void Task_ChangeSummaryMon(u8 taskId) ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } - if (P_SUMMARY_SCREEN_IV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + if (P_SUMMARY_SCREEN_IV_EV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; @@ -3216,7 +3216,7 @@ static void PutPageWindowTilemaps(u8 page) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); - if (P_SUMMARY_SCREEN_IV_INFO) + if (P_SUMMARY_SCREEN_IV_EV_INFO) PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: @@ -4596,7 +4596,7 @@ static inline void ShowCancelOrUtilityPrompt(s16 mode) else promptText = gText_Cancel2; } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_INFO) + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_EV_INFO) { if (mode == SUMMARY_MODE_SKILLS_STATS) promptText = gText_SkillPageIvs; From 523bf2e36c1dbfbf300c27aad6c8973241532d01 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 01:07:43 -0600 Subject: [PATCH 16/44] wip bugfix for relearner in box --- include/pokemon_summary_screen.h | 10 ++-- src/pokemon_summary_screen.c | 81 ++++++++++++++++++++------------ 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 0ef76ba10071..7d928ac09eb5 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -29,9 +29,6 @@ enum PokemonSummaryScreenMode SUMMARY_MODE_SELECT_MOVE, SUMMARY_MODE_RELEARNER_BATTLE, // returning from move relearner initiated from battle moves page SUMMARY_MODE_RELEARNER_CONTEST, // returning from move relearner initiated from contest moves page - SUMMARY_MODE_SKILLS_STATS, - SUMMARY_MODE_SKILLS_IVS, - SUMMARY_MODE_SKILLS_EVS, }; enum PokemonSummaryScreenPage @@ -43,4 +40,11 @@ enum PokemonSummaryScreenPage PSS_PAGE_COUNT, }; +enum PokemonSummarySkillsMode +{ + SUMMARY_SKILLS_MODE_STATS, + SUMMARY_SKILLS_MODE_IVS, + SUMMARY_SKILLS_MODE_EVS, +}; + #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 036dc3e2e329..9ff3ef661303 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -168,6 +168,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData } summary; u16 bgTilemapBuffers[PSS_PAGE_COUNT][2][0x400]; u8 mode; + u8 skillsPageMode; bool8 isBoxMon; u8 curMonIndex; u8 maxMonIndex; @@ -1630,13 +1631,13 @@ static void ChangeStatLabel(s16 mode) switch (mode) { - case SUMMARY_MODE_SKILLS_STATS: + case SUMMARY_SKILLS_MODE_STATS: WriteToStatsTilemapBuffer(statsLength, statsBlock, statsCoordX, statsCoordY); break; - case SUMMARY_MODE_SKILLS_IVS: + case SUMMARY_SKILLS_MODE_IVS: WriteToStatsTilemapBuffer(ivEvLength, ivsBlock, statsCoordX, statsCoordY); break; - case SUMMARY_MODE_SKILLS_EVS: + case SUMMARY_SKILLS_MODE_EVS: WriteToStatsTilemapBuffer(ivEvLength, evsBlock, statsCoordX, statsCoordY); break; } @@ -1709,7 +1710,7 @@ static void Task_HandleInput(u8 taskId) { if (P_SUMMARY_SCREEN_IV_EV_INFO) { - ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->mode)); + ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->skillsPageMode)); PlaySE(SE_SELECT); } } @@ -1745,16 +1746,16 @@ static u8 IncrementSkillsStatsMode(u8 mode) { switch (mode) { - case SUMMARY_MODE_SKILLS_STATS: - sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_IVS; - return SUMMARY_MODE_SKILLS_IVS; - case SUMMARY_MODE_SKILLS_IVS: - sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_EVS; - return SUMMARY_MODE_SKILLS_EVS; - case SUMMARY_MODE_SKILLS_EVS: + case SUMMARY_SKILLS_MODE_STATS: + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_IVS; + return SUMMARY_SKILLS_MODE_IVS; + case SUMMARY_SKILLS_MODE_IVS: + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; + return SUMMARY_SKILLS_MODE_EVS; + case SUMMARY_SKILLS_MODE_EVS: default: - sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; - return SUMMARY_MODE_SKILLS_STATS; + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; + return SUMMARY_SKILLS_MODE_STATS; } } @@ -1774,17 +1775,17 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) ShowCancelOrUtilityPrompt(mode); } - if (mode == SUMMARY_MODE_SKILLS_STATS) + if (mode == SUMMARY_SKILLS_MODE_STATS) { ExtractMonSkillStatsData(mon, sum); BufferLeftColumnStats(); } - else if (mode == SUMMARY_MODE_SKILLS_IVS) + else if (mode == SUMMARY_SKILLS_MODE_IVS) { ExtractMonSkillIvData(mon, sum); BufferLeftColumnIvEvStats(); } - else if (mode == SUMMARY_MODE_SKILLS_EVS) + else if (mode == SUMMARY_SKILLS_MODE_EVS) { ExtractMonSkillEvData(mon, sum); BufferLeftColumnIvEvStats(); @@ -1960,9 +1961,9 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_IV_EV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); - sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; - ShowCancelOrUtilityPrompt(SUMMARY_MODE_SKILLS_STATS); - ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; + ShowCancelOrUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); + ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } break; @@ -2074,10 +2075,10 @@ static void ChangePage(u8 taskId, s8 delta) { struct Pokemon *mon = &sMonSummaryScreen->currentMon; - if (sMonSummaryScreen->mode != SUMMARY_MODE_SKILLS_STATS) - sMonSummaryScreen->mode = SUMMARY_MODE_SKILLS_STATS; + if (sMonSummaryScreen->skillsPageMode != SUMMARY_SKILLS_MODE_STATS) + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; - ShowCancelOrUtilityPrompt(sMonSummaryScreen->mode); + ShowCancelOrUtilityPrompt(sMonSummaryScreen->skillsPageMode); ExtractMonSkillStatsData(mon, summary); BufferLeftColumnStats(); BufferRightColumnStats(); @@ -2135,7 +2136,7 @@ static void PssScrollLeft(u8 taskId) // Scroll left s16 *data = gTasks[taskId].data; // to fix a specific lag in writing to the stat label if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) - ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); + ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); if (data[0] == 0) { if (sMonSummaryScreen->bgDisplayOrder == 0) @@ -2341,7 +2342,10 @@ static void CloseMoveSelectMode(u8 taskId) sMonSummaryScreen->mode = SUMMARY_MODE_NORMAL; sMonSummaryScreen->lockMovesFlag = FALSE; } - ShowRelearnPrompt(); + if (ShouldShowMoveRelearner()) + ShowRelearnPrompt(); + else + ClearRelearnPrompt(); ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); PrintMoveDetails(0); @@ -3227,8 +3231,15 @@ static void PutPageWindowTilemaps(u8 page) if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); } - else + + if (ShouldShowMoveRelearner()) + { + PlaySE(SE_M_REVERSAL); ShowRelearnPrompt(); + } + + else + ClearRelearnPrompt(); break; case PSS_PAGE_CONTEST_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); @@ -3238,8 +3249,16 @@ static void PutPageWindowTilemaps(u8 page) if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); } - else + + if (ShouldShowMoveRelearner()) + { + PlaySE(SE_M_REVERSAL); ShowRelearnPrompt(); + } + + + else + ClearRelearnPrompt(); break; } @@ -3610,7 +3629,7 @@ static void PrintSkillsPageText(void) { PrintHeldItemName(); PrintRibbonCount(); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_SKILLS_STATS); + ShowCancelOrUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); BufferLeftColumnStats(); PrintLeftColumnStats(); BufferRightColumnStats(); @@ -3631,7 +3650,7 @@ static void Task_PrintSkillsPage(u8 taskId) PrintRibbonCount(); break; case 3: - ChangeStatLabel(SUMMARY_MODE_SKILLS_STATS); + ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); break; case 4: BufferLeftColumnStats(); @@ -4598,11 +4617,11 @@ static inline void ShowCancelOrUtilityPrompt(s16 mode) } else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_EV_INFO) { - if (mode == SUMMARY_MODE_SKILLS_STATS) + if (mode == SUMMARY_SKILLS_MODE_STATS) promptText = gText_SkillPageIvs; - else if (mode == SUMMARY_MODE_SKILLS_IVS) + else if (mode == SUMMARY_SKILLS_MODE_IVS) promptText = gText_SkillPageEvs; - else if (mode == SUMMARY_MODE_SKILLS_EVS) + else if (mode == SUMMARY_SKILLS_MODE_EVS) promptText = gText_SkillPageStats; else { From c53c8d205947f5efe23d4310e741f6231a0c69a9 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 01:34:38 -0600 Subject: [PATCH 17/44] potentially fixed, will bugfix more tomorrow --- src/pokemon_summary_screen.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 9ff3ef661303..f81e40613dd8 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1922,6 +1922,13 @@ static void Task_ChangeSummaryMon(u8 taskId) case 4: if (ExtractMonDataToSummaryStruct(&sMonSummaryScreen->currentMon) == FALSE) return; + else + { + if (ShouldShowMoveRelearner()) + ShowRelearnPrompt(); + else + ClearRelearnPrompt(); + } break; case 5: RemoveAndCreateMonMarkingsSprite(&sMonSummaryScreen->currentMon); @@ -2208,6 +2215,11 @@ static void SwitchToMoveSelection(u8 taskId) HandlePowerAccTilemap(9, -3); HandleAppealJamTilemap(9, -3, move); + if (ShouldShowMoveRelearner()) + ShowRelearnPrompt(); + else + ClearRelearnPrompt(); + TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, FALSE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE); PrintMoveDetails(move); @@ -3233,11 +3245,7 @@ static void PutPageWindowTilemaps(u8 page) } if (ShouldShowMoveRelearner()) - { - PlaySE(SE_M_REVERSAL); ShowRelearnPrompt(); - } - else ClearRelearnPrompt(); break; @@ -3251,12 +3259,7 @@ static void PutPageWindowTilemaps(u8 page) } if (ShouldShowMoveRelearner()) - { - PlaySE(SE_M_REVERSAL); ShowRelearnPrompt(); - } - - else ClearRelearnPrompt(); break; @@ -4557,6 +4560,7 @@ static inline bool32 ShouldShowMoveRelearner(void) { return (P_SUMMARY_SCREEN_MOVE_RELEARNER && !sMonSummaryScreen->lockMovesFlag + && !sMonSummaryScreen->isBoxMon && sMonSummaryScreen->mode != SUMMARY_MODE_BOX && sMonSummaryScreen->mode != SUMMARY_MODE_BOX_CURSOR && sMonSummaryScreen->relearnableMovesNum > 0 @@ -4569,6 +4573,7 @@ static inline bool32 ShouldShowRename(void) return (P_SUMMARY_SCREEN_RENAME && !sMonSummaryScreen->lockMovesFlag && !sMonSummaryScreen->summary.isEgg + && !sMonSummaryScreen->isBoxMon && sMonSummaryScreen->mode != SUMMARY_MODE_BOX && sMonSummaryScreen->mode != SUMMARY_MODE_BOX_CURSOR && !InBattleFactory() @@ -4578,8 +4583,7 @@ static inline bool32 ShouldShowRename(void) static inline void ShowRelearnPrompt(void) { - if (ShouldShowMoveRelearner() - && sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES + if (sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES && (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES)) { From bc91e9150d94e71256a13baf41871f5246194ebb Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 19:05:05 -0600 Subject: [PATCH 18/44] restored unused window (PSS_LABEL_WINDOW_UNUSED1) --- src/pokemon_summary_screen.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f81e40613dd8..bfcb67c97c7a 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -61,7 +61,7 @@ // Button control text (upper right) #define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "Rename" and "IVs"/"EVs" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_EV_INFO are true, respectively #define PSS_LABEL_WINDOW_PROMPT_SWITCH 5 -#define PSS_DATA_WINDOW_UNUSED 6 +#define PSS_LABEL_WINDOW_UNUSED1 6 // Info screen #define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 7 @@ -459,6 +459,15 @@ static const struct WindowTemplate sSummaryTemplate[] = .paletteNum = 7, .baseBlock = 121, }, + [PSS_LABEL_WINDOW_UNUSED1] = { + .bg = 0, + .tilemapLeft = 11, + .tilemapTop = 4, + .width = 0, + .height = 2, + .paletteNum = 6, + .baseBlock = 137, + }, [PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL] = { .bg = 0, .tilemapLeft = 11, From 5ea48f1e7b56b65dc6dca6034ab8d5bd6669a0d6 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 19:12:45 -0600 Subject: [PATCH 19/44] restored PSS_LABEL_WINDOW_PROMPT_INFO --- src/pokemon_summary_screen.c | 42 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index bfcb67c97c7a..c92804c820b8 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -59,30 +59,31 @@ #define PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE 3 // Button control text (upper right) -#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Also handles the "Rename" and "IVs"/"EVs" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_EV_INFO are true, respectively -#define PSS_LABEL_WINDOW_PROMPT_SWITCH 5 -#define PSS_LABEL_WINDOW_UNUSED1 6 +#define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Handles "Switch", "Info", and "Cancel" prompts. Also handles the "Rename" and "IVs"/"EVs"/"STATS" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_EV_INFO are true, respectively +#define PSS_LABEL_WINDOW_PROMPT_INFO 5 +#define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 +#define PSS_LABEL_WINDOW_UNUSED1 7 // Info screen -#define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 7 -#define PSS_LABEL_WINDOW_POKEMON_INFO_TYPE 8 +#define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 8 +#define PSS_LABEL_WINDOW_POKEMON_INFO_TYPE 9 // Skills screen -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT 9 // HP, Attack, Defense -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT 10 // Sp. Attack, Sp. Defense, Speed -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP 11 // EXP, Next Level -#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS 12 +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT 10 // HP, Attack, Defense +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT 11 // Sp. Attack, Sp. Defense, Speed +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP 12 // EXP, Next Level +#define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS 13 // Moves screen -#define PSS_LABEL_WINDOW_MOVES_POWER_ACC 13 // Also contains the power and accuracy values -#define PSS_LABEL_WINDOW_MOVES_APPEAL_JAM 14 -#define PSS_LABEL_WINDOW_PROMPT_RELEARN 15 +#define PSS_LABEL_WINDOW_MOVES_POWER_ACC 14 // Also contains the power and accuracy values +#define PSS_LABEL_WINDOW_MOVES_APPEAL_JAM 15 +#define PSS_LABEL_WINDOW_PROMPT_RELEARN 16 // Above/below the pokemon's portrait (left) -#define PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER 16 -#define PSS_LABEL_WINDOW_PORTRAIT_NICKNAME 17 // The upper name -#define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 18 // The lower name -#define PSS_LABEL_WINDOW_END 19 +#define PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER 17 +#define PSS_LABEL_WINDOW_PORTRAIT_NICKNAME 18 // The upper name +#define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 19 // The lower name +#define PSS_LABEL_WINDOW_END 20 // Dynamic fields for the Pokémon Info page #define PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER 0 @@ -450,6 +451,15 @@ static const struct WindowTemplate sSummaryTemplate[] = .paletteNum = 7, .baseBlock = 89, }, + [PSS_LABEL_WINDOW_PROMPT_INFO] = { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 0, + .width = 8, + .height = 2, + .paletteNum = 7, + .baseBlock = 105, + }, [PSS_LABEL_WINDOW_PROMPT_SWITCH] = { .bg = 0, .tilemapLeft = 22, From 2802fd220ca3c7e67bac0d5319c0744467d3cafa Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 19:14:16 -0600 Subject: [PATCH 20/44] clarifying comments on unused windows --- src/pokemon_summary_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index c92804c820b8..e003e5bf35ce 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -60,8 +60,8 @@ // Button control text (upper right) #define PSS_LABEL_WINDOW_PROMPT_UTILITY 4 // Handles "Switch", "Info", and "Cancel" prompts. Also handles the "Rename" and "IVs"/"EVs"/"STATS" prompts if P_SUMMARY_SCREEN_RENAME and P_SUMMARY_SCREEN_IV_EV_INFO are true, respectively -#define PSS_LABEL_WINDOW_PROMPT_INFO 5 -#define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 +#define PSS_LABEL_WINDOW_PROMPT_INFO 5 // unused +#define PSS_LABEL_WINDOW_PROMPT_SWITCH 6 // unused #define PSS_LABEL_WINDOW_UNUSED1 7 // Info screen From a7e0c499a8b8fb757d1e2d8e9b348d33c8eee87b Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 19:23:19 -0600 Subject: [PATCH 21/44] remove redundant call to DynamicPlaceholderTextUtil_Reset() --- src/pokemon_summary_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e003e5bf35ce..94c9cc9c4c19 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1784,7 +1784,6 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) struct PokeSummary *sum = &sMonSummaryScreen->summary; struct Pokemon *mon = &sMonSummaryScreen->currentMon; - DynamicPlaceholderTextUtil_Reset(); FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_LEFT], 0); FillWindowPixelBuffer(sMonSummaryScreen->windowIds[PSS_DATA_WINDOW_SKILLS_STATS_RIGHT], 0); From 9bf53ba5b1076c81022b696e63f47367217c0c7f Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 20:02:55 -0600 Subject: [PATCH 22/44] remove some unnecessary checks/logic --- src/pokemon_summary_screen.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 94c9cc9c4c19..df7c9c085683 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -332,7 +332,7 @@ void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); -u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); +static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(u32 length, u32 statsCoordX, u32 statsCoordY); @@ -2218,12 +2218,6 @@ static void SwitchToMoveSelection(u8 taskId) { u16 move; - if (!sMonSummaryScreen->lockMovesFlag || sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES) - { - sMonSummaryScreen->lockMovesFlag = TRUE; - sMonSummaryScreen->mode = SUMMARY_MODE_LOCK_MOVES; - } - sMonSummaryScreen->firstMoveIndex = 0; move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]; @@ -2367,11 +2361,6 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr) static void CloseMoveSelectMode(u8 taskId) { DestroyMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); - if (sMonSummaryScreen->lockMovesFlag || sMonSummaryScreen->mode != SUMMARY_MODE_NORMAL) - { - sMonSummaryScreen->mode = SUMMARY_MODE_NORMAL; - sMonSummaryScreen->lockMovesFlag = FALSE; - } if (ShouldShowMoveRelearner()) ShowRelearnPrompt(); else @@ -3308,23 +3297,25 @@ static void ClearPageWindowTilemaps(u8 page) ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: - if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE || sMonSummaryScreen->lockMovesFlag) + if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) { ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); gSprites[sMonSummaryScreen->categoryIconSpriteId].invisible = TRUE; } - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + if (ShouldShowMoveRelearner()) + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; case PSS_PAGE_CONTEST_MOVES: - if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE || sMonSummaryScreen->lockMovesFlag) + if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + if (ShouldShowMoveRelearner()) + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; } @@ -3335,7 +3326,7 @@ static void ClearPageWindowTilemaps(u8 page) ScheduleBgCopyTilemapToVram(0); } -u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) +static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) { u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId]; if (*windowIdPtr == WINDOW_NONE) @@ -4652,7 +4643,7 @@ static inline void ShowCancelOrUtilityPrompt(s16 mode) } } else if (sMonSummaryScreen->currPageIndex > PSS_PAGE_SKILLS) - if (sMonSummaryScreen->mode == SUMMARY_MODE_LOCK_MOVES) + if (mode == SUMMARY_MODE_SELECT_MOVE || !sMonSummaryScreen->lockMovesFlag) promptText = gText_Switch; else promptText = gText_Info; From 0ddaba460a11581635d86b3b3fe5c90b22370a03 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 20:21:16 -0600 Subject: [PATCH 23/44] fixed logic for showing info and switch prompts --- src/pokemon_summary_screen.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index df7c9c085683..1f247ad46405 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2242,7 +2242,10 @@ static void SwitchToMoveSelection(u8 taskId) ScheduleBgCopyTilemapToVram(2); CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); ClearRelearnPrompt(); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + if (!sMonSummaryScreen->lockMovesFlag) + ShowCancelOrUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); + else + ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); gTasks[taskId].func = Task_HandleInput_MoveSelect; } @@ -2273,7 +2276,7 @@ static void Task_HandleInput_MoveSelect(u8 taskId) else if (HasMoreThanOneMove() == TRUE) { PlaySE(SE_SELECT); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowCancelOrUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); SwitchToMovePositionSwitchMode(taskId); } else @@ -4642,8 +4645,9 @@ static inline void ShowCancelOrUtilityPrompt(s16 mode) return; } } - else if (sMonSummaryScreen->currPageIndex > PSS_PAGE_SKILLS) - if (mode == SUMMARY_MODE_SELECT_MOVE || !sMonSummaryScreen->lockMovesFlag) + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES + || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES) + if (mode == SUMMARY_MODE_SELECT_MOVE && !sMonSummaryScreen->lockMovesFlag) promptText = gText_Switch; else promptText = gText_Info; From 9f4cfae3753e05aa37868259b936cb918202f72d Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 20:34:44 -0600 Subject: [PATCH 24/44] ShowCancelOrUtilityPrompt -> ShowUtilityPrompt, cleaned up prev unneeded changes --- src/pokemon_summary_screen.c | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 1f247ad46405..c901d7d4a411 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -321,7 +321,7 @@ static bool32 ShouldShowRename(void); static void BufferLeftColumnIvEvStats(void); static void CB2_ReturnToSummaryScreenFromNamingScreen(void); static void CB2_PssChangePokemonNickname(void); -static void ShowCancelOrUtilityPrompt(s16 mode); +static void ShowUtilityPrompt(s16 mode); static void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); static void WriteToStatsTilemapBuffer(u32 length, u32 block, u32 statsCoordX, u32 statsCoordY); @@ -330,8 +330,8 @@ static void ShowRelearnPrompt(void); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); -void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); -void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); +static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); +static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(u32 length, u32 statsCoordX, u32 statsCoordY); @@ -1790,7 +1790,7 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { ChangeStatLabel(mode); - ShowCancelOrUtilityPrompt(mode); + ShowUtilityPrompt(mode); } if (mode == SUMMARY_SKILLS_MODE_STATS) @@ -1830,7 +1830,7 @@ void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum) sum->spdef = GetMonData(mon, MON_DATA_SPDEF); sum->speed = GetMonData(mon, MON_DATA_SPEED); } - else // + else { sum->nature = GetNature(mon); sum->mintNature = GetMonData(mon, MON_DATA_HIDDEN_NATURE); @@ -1980,14 +1980,14 @@ static void Task_ChangeSummaryMon(u8 taskId) if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } if (P_SUMMARY_SCREEN_IV_EV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; - ShowCancelOrUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); + ShowUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } @@ -2103,13 +2103,13 @@ static void ChangePage(u8 taskId, s8 delta) if (sMonSummaryScreen->skillsPageMode != SUMMARY_SKILLS_MODE_STATS) sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; - ShowCancelOrUtilityPrompt(sMonSummaryScreen->skillsPageMode); + ShowUtilityPrompt(sMonSummaryScreen->skillsPageMode); ExtractMonSkillStatsData(mon, summary); BufferLeftColumnStats(); BufferRightColumnStats(); } else - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); } @@ -2220,7 +2220,6 @@ static void SwitchToMoveSelection(u8 taskId) sMonSummaryScreen->firstMoveIndex = 0; move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]; - ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); if (!gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]].invisible) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); @@ -2243,9 +2242,9 @@ static void SwitchToMoveSelection(u8 taskId) CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); ClearRelearnPrompt(); if (!sMonSummaryScreen->lockMovesFlag) - ShowCancelOrUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); + ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); else - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); gTasks[taskId].func = Task_HandleInput_MoveSelect; } @@ -2270,13 +2269,13 @@ static void Task_HandleInput_MoveSelect(u8 taskId) if (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES) { PlaySE(SE_SELECT); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); CloseMoveSelectMode(taskId); } else if (HasMoreThanOneMove() == TRUE) { PlaySE(SE_SELECT); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); + ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); SwitchToMovePositionSwitchMode(taskId); } else @@ -2369,7 +2368,7 @@ static void CloseMoveSelectMode(u8 taskId) else ClearRelearnPrompt(); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); PrintMoveDetails(0); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, TRUE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, TRUE); @@ -3071,12 +3070,12 @@ static void ResetWindows(void) sMonSummaryScreen->windowIds[i] = WINDOW_NONE; } -void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) +static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) { AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); } -void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) { PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, FONT_NORMAL); } @@ -3194,7 +3193,7 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); - ShowCancelOrUtilityPrompt(SUMMARY_MODE_NORMAL); + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL, gText_RentalPkmn, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE, gText_TypeSlash, 0, 1, 0, 0); @@ -3644,7 +3643,7 @@ static void PrintSkillsPageText(void) { PrintHeldItemName(); PrintRibbonCount(); - ShowCancelOrUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); + ShowUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); BufferLeftColumnStats(); PrintLeftColumnStats(); BufferRightColumnStats(); @@ -4617,7 +4616,7 @@ static inline void ClearUtilityPrompt(void) } -static inline void ShowCancelOrUtilityPrompt(s16 mode) +static inline void ShowUtilityPrompt(s16 mode) { const u8* promptText; const u8* gText_SkillPageIvs = COMPOUND_STRING("IVs"); From 0cb3c4b3f3b7386635deedc5601b553c5a09f109 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 20:57:15 -0600 Subject: [PATCH 25/44] more cleanup of redundant code --- src/pokemon_summary_screen.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index c901d7d4a411..d37b2a7b9171 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1978,18 +1978,11 @@ static void Task_ChangeSummaryMon(u8 taskId) PrintPageSpecificText(sMonSummaryScreen->currPageIndex); LimitEggSummaryPageDisplay(); if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) - { - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); ShowUtilityPrompt(SUMMARY_MODE_NORMAL); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - } if (P_SUMMARY_SCREEN_IV_EV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; - ShowUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); } break; case 12: @@ -3296,7 +3289,8 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); - ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); + if (P_SUMMARY_SCREEN_IV_EV_INFO) + ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: if (sMonSummaryScreen->mode == SUMMARY_MODE_SELECT_MOVE) @@ -3307,7 +3301,7 @@ static void ClearPageWindowTilemaps(u8 page) gSprites[sMonSummaryScreen->categoryIconSpriteId].invisible = TRUE; } if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + ClearRelearnPrompt(); } break; case PSS_PAGE_CONTEST_MOVES: @@ -3317,7 +3311,7 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + ClearRelearnPrompt(); } break; } From 4bb08dd6f99aa2b06eb5c9e5edc3b9cd3f0d39db Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 21:09:42 -0600 Subject: [PATCH 26/44] final cleanup before submitting PR --- include/config/pokemon.h | 6 +++--- src/pokemon_summary_screen.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 75567d915387..23adc6f629d7 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -60,10 +60,10 @@ #define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny. #define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny #define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla. -#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. +#define P_SUMMARY_SCREEN_MOVE_RELEARNER FALSE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. -#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. +#define P_SUMMARY_SCREEN_RENAME FALSE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. +#define P_SUMMARY_SCREEN_IV_EV_INFO FALSE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index d37b2a7b9171..9d0c65b5d582 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2259,7 +2259,8 @@ static void Task_HandleInput_MoveSelect(u8 taskId) } else if (JOY_NEW(A_BUTTON)) { - if (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES) + if (sMonSummaryScreen->lockMovesFlag == TRUE + || (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES)) { PlaySE(SE_SELECT); ShowUtilityPrompt(SUMMARY_MODE_NORMAL); From 00f69c3fd9d2ced742c3f281d7ec215a98662b58 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 21:10:41 -0600 Subject: [PATCH 27/44] oops thought settings were false by default --- include/config/pokemon.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 23adc6f629d7..f81104eb734d 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -60,10 +60,10 @@ #define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny. #define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny #define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla. -#define P_SUMMARY_SCREEN_MOVE_RELEARNER FALSE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. +#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. -#define P_SUMMARY_SCREEN_RENAME FALSE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO FALSE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. +#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. +#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. From e10ec690f07dc3c9f765914d36d64d601dfae690 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 21:51:19 -0600 Subject: [PATCH 28/44] revert out-of-scope relearner prompt changes --- src/pokemon_summary_screen.c | 56 +++++++++++------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 9d0c65b5d582..ed710b425f94 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -325,8 +325,6 @@ static void ShowUtilityPrompt(s16 mode); static void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); static void WriteToStatsTilemapBuffer(u32 length, u32 block, u32 statsCoordX, u32 statsCoordY); -static void ClearRelearnPrompt(void); -static void ShowRelearnPrompt(void); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); @@ -1942,10 +1940,14 @@ static void Task_ChangeSummaryMon(u8 taskId) return; else { - if (ShouldShowMoveRelearner()) - ShowRelearnPrompt(); - else - ClearRelearnPrompt(); + if (P_SUMMARY_SCREEN_MOVE_RELEARNER + && (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES)) + { + if (ShouldShowMoveRelearner()) + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + else + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + } } break; case 5: @@ -2078,7 +2080,6 @@ static void ChangePage(u8 taskId, s8 delta) PlaySE(SE_SELECT); ClearPageWindowTilemaps(sMonSummaryScreen->currPageIndex); - ClearRelearnPrompt(); sMonSummaryScreen->currPageIndex += delta; data[0] = 0; if (delta == 1) @@ -2220,9 +2221,7 @@ static void SwitchToMoveSelection(u8 taskId) HandleAppealJamTilemap(9, -3, move); if (ShouldShowMoveRelearner()) - ShowRelearnPrompt(); - else - ClearRelearnPrompt(); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, FALSE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE); @@ -2233,7 +2232,6 @@ static void SwitchToMoveSelection(u8 taskId) ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(2); CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); - ClearRelearnPrompt(); if (!sMonSummaryScreen->lockMovesFlag) ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); else @@ -2358,9 +2356,7 @@ static void CloseMoveSelectMode(u8 taskId) { DestroyMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); if (ShouldShowMoveRelearner()) - ShowRelearnPrompt(); - else - ClearRelearnPrompt(); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); ShowUtilityPrompt(SUMMARY_MODE_NORMAL); PrintMoveDetails(0); @@ -3210,6 +3206,7 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_POWER_ACC, gText_Accuracy2, 0, 17, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Appeal, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM, gText_Jam, 0, 17, 0, 1); + PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); } static void PutPageWindowTilemaps(u8 page) @@ -3248,9 +3245,8 @@ static void PutPageWindowTilemaps(u8 page) } if (ShouldShowMoveRelearner()) - ShowRelearnPrompt(); - else - ClearRelearnPrompt(); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + break; case PSS_PAGE_CONTEST_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); @@ -3262,10 +3258,7 @@ static void PutPageWindowTilemaps(u8 page) } if (ShouldShowMoveRelearner()) - ShowRelearnPrompt(); - else - ClearRelearnPrompt(); - break; + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) @@ -3302,7 +3295,7 @@ static void ClearPageWindowTilemaps(u8 page) gSprites[sMonSummaryScreen->categoryIconSpriteId].invisible = TRUE; } if (ShouldShowMoveRelearner()) - ClearRelearnPrompt(); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; case PSS_PAGE_CONTEST_MOVES: @@ -3312,7 +3305,7 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); if (ShouldShowMoveRelearner()) - ClearRelearnPrompt(); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; } @@ -4587,23 +4580,6 @@ static inline bool32 ShouldShowRename(void) && GetPlayerIDAsU32() == sMonSummaryScreen->summary.OTID); } -static inline void ShowRelearnPrompt(void) -{ - if (sMonSummaryScreen->mode != SUMMARY_MODE_LOCK_MOVES - && (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES - || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES)) - { - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - PrintTextOnWindowWithFont(PSS_LABEL_WINDOW_PROMPT_RELEARN, gText_Relearn, 0, 4, 0, 0, FONT_SMALL); - } -} - -static inline void ClearRelearnPrompt(void) -{ - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_RELEARN, PIXEL_FILL(0)); -} - static inline void ClearUtilityPrompt(void) { ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); From 7be25bf626a2c33429722433e617498656b59b45 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 21:56:03 -0600 Subject: [PATCH 29/44] missed some elses --- src/pokemon_summary_screen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ed710b425f94..ea218f594eda 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3294,6 +3294,9 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); gSprites[sMonSummaryScreen->categoryIconSpriteId].invisible = TRUE; } + } + else + { if (ShouldShowMoveRelearner()) ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } @@ -3303,7 +3306,9 @@ static void ClearPageWindowTilemaps(u8 page) { if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); - + } + else + { if (ShouldShowMoveRelearner()) ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } From 45d2f917139f2f3f55392d1386339fcdce1bfe4b Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 21:59:32 -0600 Subject: [PATCH 30/44] two more elses --- src/pokemon_summary_screen.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ea218f594eda..b447d22f2bb9 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3243,10 +3243,11 @@ static void PutPageWindowTilemaps(u8 page) if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); } - - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); - + else + { + if (ShouldShowMoveRelearner()) + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + } break; case PSS_PAGE_CONTEST_MOVES: PutWindowTilemap(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE); @@ -3256,9 +3257,12 @@ static void PutPageWindowTilemaps(u8 page) if (sMonSummaryScreen->newMove != MOVE_NONE || sMonSummaryScreen->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); } - - if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + else + { + if (ShouldShowMoveRelearner()) + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + } + break; } for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) From 0f0d4587a0f16cae6ee4877799f0a4f23e395061 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 22:05:52 -0600 Subject: [PATCH 31/44] couple more things --- src/pokemon_summary_screen.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b447d22f2bb9..ed458d52c05e 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2220,8 +2220,15 @@ static void SwitchToMoveSelection(u8 taskId) HandlePowerAccTilemap(9, -3); HandleAppealJamTilemap(9, -3, move); - if (ShouldShowMoveRelearner()) - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + if (!sMonSummaryScreen->lockMovesFlag) + { + if (ShouldShowMoveRelearner()) + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + + ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); + } + else + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, FALSE); TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE); @@ -2232,10 +2239,6 @@ static void SwitchToMoveSelection(u8 taskId) ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(2); CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); - if (!sMonSummaryScreen->lockMovesFlag) - ShowUtilityPrompt(SUMMARY_MODE_SELECT_MOVE); - else - ShowUtilityPrompt(SUMMARY_MODE_NORMAL); gTasks[taskId].func = Task_HandleInput_MoveSelect; } @@ -3246,7 +3249,7 @@ static void PutPageWindowTilemaps(u8 page) else { if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; case PSS_PAGE_CONTEST_MOVES: @@ -3260,7 +3263,7 @@ static void PutPageWindowTilemaps(u8 page) else { if (ShouldShowMoveRelearner()) - PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); + PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_RELEARN); } break; } From f4654720c004e451e26d897e547bee6f46718579 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 22:44:12 -0600 Subject: [PATCH 32/44] forgot debug woops --- include/config/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/debug.h b/include/config/debug.h index e2f35426f90f..2446b9360c0b 100644 --- a/include/config/debug.h +++ b/include/config/debug.h @@ -5,7 +5,7 @@ #define DEBUG_OVERWORLD_MENU TRUE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. #define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. #define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS. -#define DEBUG_OVERWORLD_IN_MENU TRUE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). +#define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). // Battle Debug Menu #define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. From 1015f6cdf043d48f45fbc9e3a6991a674f9b7442 Mon Sep 17 00:00:00 2001 From: khbsd Date: Tue, 14 Jan 2025 22:46:13 -0600 Subject: [PATCH 33/44] update comment next to pokemon.h setting --- include/config/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index f81104eb734d..61a548c5564f 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -63,7 +63,7 @@ #define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. #define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to view the IVs in the skills section of the pokemon summary screen by pressing 'R'. +#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. From 81c24b6f673849f37480f6fd20d87a4ccaa3b88f Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 00:08:28 -0600 Subject: [PATCH 34/44] fix indentation @1770 --- src/pokemon_summary_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ed458d52c05e..151039d80f4c 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1767,7 +1767,7 @@ static u8 IncrementSkillsStatsMode(u8 mode) sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_IVS; return SUMMARY_SKILLS_MODE_IVS; case SUMMARY_SKILLS_MODE_IVS: - sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; return SUMMARY_SKILLS_MODE_EVS; case SUMMARY_SKILLS_MODE_EVS: default: From 06ef1f6b7ad7e14e873d0af0fa6d966f3ba9de8c Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 00:37:18 -0600 Subject: [PATCH 35/44] remove unnecessary writes to sum->maxHP --- src/pokemon_summary_screen.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 151039d80f4c..e9b2e831c715 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1845,7 +1845,6 @@ void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum) void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum) { sum->currentHP = GetMonData(mon, MON_DATA_HP_IV); - sum->maxHP = 0; sum->atk = GetMonData(mon, MON_DATA_ATK_IV); sum->def = GetMonData(mon, MON_DATA_DEF_IV); sum->spatk = GetMonData(mon, MON_DATA_SPATK_IV); @@ -1857,7 +1856,6 @@ void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum) { if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) sum->currentHP = GetMonData(mon, MON_DATA_HP_EV); - sum->maxHP = 0; sum->atk = GetMonData(mon, MON_DATA_ATK_EV); sum->def = GetMonData(mon, MON_DATA_DEF_EV); sum->spatk = GetMonData(mon, MON_DATA_SPATK_EV); From 5c1a633213ed2310a660c16f4d663bfdb22640d6 Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 00:38:08 -0600 Subject: [PATCH 36/44] remove leftover condition in ExtractMonSkillEvData() --- src/pokemon_summary_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e9b2e831c715..d67c286dd0b7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1854,7 +1854,6 @@ void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum) void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum) { - if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->handleDeoxys == TRUE) sum->currentHP = GetMonData(mon, MON_DATA_HP_EV); sum->atk = GetMonData(mon, MON_DATA_ATK_EV); sum->def = GetMonData(mon, MON_DATA_DEF_EV); From 01262290ce082dcfe3b6964ecad0590cdf259ed0 Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 13:50:08 -0600 Subject: [PATCH 37/44] added configs and flag for tileset loading and box only --- include/config/pokemon.h | 14 ++++++--- src/graphics.c | 4 +-- src/pokemon_summary_screen.c | 59 ++++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 61a548c5564f..606939f2469e 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -60,10 +60,15 @@ #define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny. #define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny #define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla. -#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. -#define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. -#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. + +// Summary screen settings +#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. +#define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. +#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. +#define P_SUMMARY_SCREEN_IV_EV_INFO P_FLAG_IV_EV_INFO // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. +#define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. +#define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. +#define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. @@ -73,6 +78,7 @@ // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. #define P_FLAG_FORCE_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into being Shiny. #define P_FLAG_FORCE_NO_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into NOT being Shiny. +#define P_FLAG_IV_EV_INFO 1 // If this flag is set, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. // Go here if you want to disable specific families of Pokémon. #include "config/species_enabled.h" diff --git a/src/graphics.c b/src/graphics.c index c04daaa71a59..bc510d9d96c7 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1683,11 +1683,11 @@ const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz"); const u32 gSummaryMoveSelect_Gfx[] = INCBIN_U32("graphics/summary_screen/move_select.4bpp.lz"); const u32 gSummaryMoveSelect_Pal[] = INCBIN_U32("graphics/summary_screen/move_select.gbapal.lz"); -#if P_SUMMARY_SCREEN_IV_EV_INFO == TRUE +#if P_SUMMARY_SCREEN_IV_EV_TILESET const u32 gSummaryScreen_Gfx[] = INCBIN_U32("graphics/summary_screen/iv_ev_tiles.4bpp.lz"); #else const u32 gSummaryScreen_Gfx[] = INCBIN_U32("graphics/summary_screen/tiles.4bpp.lz"); -#endif // P_SUMMARY_SCREEN_IV_EV_INFO +#endif // P_SUMMARY_SCREEN_IV_EV_TILESET const u32 gSummaryScreen_Pal[] = INCBIN_U32("graphics/summary_screen/tiles.gbapal.lz"); const u32 gSummaryPage_Info_Tilemap[] = INCBIN_U32("graphics/summary_screen/page_info.bin.lz"); const u32 gSummaryPage_Skills_Tilemap[] = INCBIN_U32("graphics/summary_screen/page_skills.bin.lz"); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index d67c286dd0b7..a1dd22a62c01 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -318,6 +318,7 @@ static void KeepMoveSelectorVisible(u8); static void SummaryScreen_DestroyAnimDelayTask(void); static bool32 ShouldShowMoveRelearner(void); static bool32 ShouldShowRename(void); +static bool32 ShouldShowIvEvPrompt(void); static void BufferLeftColumnIvEvStats(void); static void CB2_ReturnToSummaryScreenFromNamingScreen(void); static void CB2_PssChangePokemonNickname(void); @@ -1634,6 +1635,9 @@ static void CloseSummaryScreen(u8 taskId) // Update skills page tilemap static void ChangeStatLabel(s16 mode) { + if (!P_SUMMARY_SCREEN_IV_EV_TILESET) + return; + u32 statsBlock = 169; u32 ivsBlock = 221; u32 evsBlock = 218; @@ -1725,7 +1729,7 @@ static void Task_HandleInput(u8 taskId) } if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - if (P_SUMMARY_SCREEN_IV_EV_INFO) + if (ShouldShowIvEvPrompt()) { ShowMonSkillsInfo(taskId, IncrementSkillsStatsMode(sMonSummaryScreen->skillsPageMode)); PlaySE(SE_SELECT); @@ -1978,7 +1982,7 @@ static void Task_ChangeSummaryMon(u8 taskId) LimitEggSummaryPageDisplay(); if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) ShowUtilityPrompt(SUMMARY_MODE_NORMAL); - if (P_SUMMARY_SCREEN_IV_EV_INFO && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + if (ShouldShowIvEvPrompt() && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); @@ -3232,7 +3236,7 @@ static void PutPageWindowTilemaps(u8 page) PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); - if (P_SUMMARY_SCREEN_IV_EV_INFO) + if (ShouldShowIvEvPrompt()) PutWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: @@ -3287,7 +3291,7 @@ static void ClearPageWindowTilemaps(u8 page) ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP); - if (P_SUMMARY_SCREEN_IV_EV_INFO) + if (ShouldShowIvEvPrompt()) ClearPageWindowTilemaps(PSS_LABEL_WINDOW_PROMPT_UTILITY); break; case PSS_PAGE_BATTLE_MOVES: @@ -3640,7 +3644,8 @@ static void PrintSkillsPageText(void) { PrintHeldItemName(); PrintRibbonCount(); - ShowUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); + if(ShouldShowIvEvPrompt()) + ShowUtilityPrompt(SUMMARY_SKILLS_MODE_STATS); BufferLeftColumnStats(); PrintLeftColumnStats(); BufferRightColumnStats(); @@ -4589,6 +4594,21 @@ static inline bool32 ShouldShowRename(void) && GetPlayerIDAsU32() == sMonSummaryScreen->summary.OTID); } +static inline bool32 ShouldShowIvEvPrompt(void) +{ + if (P_SUMMARY_SCREEN_IV_EV_BOX_ONLY == TRUE) + { + return ((P_SUMMARY_SCREEN_IV_EV_INFO == TRUE || FlagGet(P_FLAG_IV_EV_INFO)) + && (sMonSummaryScreen->mode == SUMMARY_MODE_BOX + || sMonSummaryScreen->mode == SUMMARY_MODE_BOX_CURSOR)); + } + else if (P_SUMMARY_SCREEN_IV_EV_BOX_ONLY == FALSE) { + return (P_SUMMARY_SCREEN_IV_EV_INFO == TRUE || FlagGet(P_FLAG_IV_EV_INFO)); + } + else + return FALSE; +} + static inline void ClearUtilityPrompt(void) { ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); @@ -4598,7 +4618,7 @@ static inline void ClearUtilityPrompt(void) static inline void ShowUtilityPrompt(s16 mode) { - const u8* promptText; + const u8* promptText = NULL; const u8* gText_SkillPageIvs = COMPOUND_STRING("IVs"); const u8* gText_SkillPageEvs = COMPOUND_STRING("EVs"); const u8* gText_SkillPageStats = COMPOUND_STRING("STATS"); @@ -4607,30 +4627,31 @@ static inline void ShowUtilityPrompt(s16 mode) { if (ShouldShowRename()) promptText = gText_Rename; - else + else promptText = gText_Cancel2; } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS && P_SUMMARY_SCREEN_IV_EV_INFO) + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) { - if (mode == SUMMARY_SKILLS_MODE_STATS) - promptText = gText_SkillPageIvs; - else if (mode == SUMMARY_SKILLS_MODE_IVS) - promptText = gText_SkillPageEvs; - else if (mode == SUMMARY_SKILLS_MODE_EVS) - promptText = gText_SkillPageStats; - else + if (ShouldShowIvEvPrompt()) { - ClearUtilityPrompt(); - return; + if (mode == SUMMARY_SKILLS_MODE_STATS) + promptText = gText_SkillPageIvs; + else if (mode == SUMMARY_SKILLS_MODE_IVS) + promptText = gText_SkillPageEvs; + else if (mode == SUMMARY_SKILLS_MODE_EVS) + promptText = gText_SkillPageStats; } } - else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES + else if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES || sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES) + { if (mode == SUMMARY_MODE_SELECT_MOVE && !sMonSummaryScreen->lockMovesFlag) promptText = gText_Switch; else promptText = gText_Info; - else + } + + if (promptText == NULL) { ClearUtilityPrompt(); return; From 03568a3dd35eb65339321c7de4e215c73cc6d3eb Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 16:29:48 -0600 Subject: [PATCH 38/44] add letter grading functionality --- src/pokemon_summary_screen.c | 98 ++++++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 9 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index a1dd22a62c01..963428655eb8 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3757,6 +3757,48 @@ static void BufferStat(u8 *dst, u8 statIndex, u32 stat, u32 strId, u32 n) DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); } +static const u8 *GetLetterGrade(u32 stat) +{ + static const u8 gText_GradeF[] = _("F"); + static const u8 gText_GradeD[] = _("D"); + static const u8 gText_GradeC[] = _("C"); + static const u8 gText_GradeB[] = _("B"); + static const u8 gText_GradeA[] = _("A"); + static const u8 gText_GradeS[] = _("S"); + + if (stat > 0 && stat <= 15) + return gText_GradeD; + else if (stat > 15 && stat <= 25) + return gText_GradeC; + else if (stat > 26 && stat <= 29) + return gText_GradeB; + else if (stat == 30) + return gText_GradeA; + else if (stat == 31) + return gText_GradeS; + else + return gText_GradeF; +} + +static void BufferLetterGrade(u8 *dst, u8 statIndex, u32 stat, u32 strId, u32 n) +{ + static const u8 sTextNatureDown[] = _("{COLOR}{08}"); + static const u8 sTextNatureUp[] = _("{COLOR}{05}"); + static const u8 sTextNatureNeutral[] = _("{COLOR}{01}"); + + if (statIndex == 0 || !SUMMARY_SCREEN_NATURE_COLORS || gNaturesInfo[sMonSummaryScreen->summary.mintNature].statUp == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statDown) + StringCopy(dst, sTextNatureNeutral); + else if (statIndex == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statUp) + StringCopy(dst, sTextNatureUp); + else if (statIndex == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statDown) + StringCopy(dst, sTextNatureDown); + else + StringCopy(dst, sTextNatureNeutral); + + StringAppend(dst, GetLetterGrade(stat)); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); +} + static void BufferLeftColumnStats(void) { u8 *currentHPString = Alloc(20); @@ -3765,10 +3807,12 @@ static void BufferLeftColumnStats(void) u8 *defenseString = Alloc(20); DynamicPlaceholderTextUtil_Reset(); + BufferStat(currentHPString, 0, sMonSummaryScreen->summary.currentHP, 0, 3); BufferStat(maxHPString, 0, sMonSummaryScreen->summary.maxHP, 1, 3); BufferStat(attackString, STAT_ATK, sMonSummaryScreen->summary.atk, 2, 7); BufferStat(defenseString, STAT_DEF, sMonSummaryScreen->summary.def, 3, 7); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftColumnLayout); Free(currentHPString); @@ -3782,11 +3826,22 @@ static void BufferLeftColumnIvEvStats(void) u8 *hpIvEvString = Alloc(20); u8 *attackIvEvString = Alloc(20); u8 *defenseIvEvString = Alloc(20); - + DynamicPlaceholderTextUtil_Reset(); - BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); - BufferStat(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); - BufferStat(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); + + if (P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) + { + BufferLetterGrade(hpIvEvString, 0, sMonSummaryScreen->summary.currentHP, 0, 3); + BufferLetterGrade(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); + BufferLetterGrade(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); + } + else + { + BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); + BufferStat(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); + BufferStat(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); + } + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftIVEVColumnLayout); Free(hpIvEvString); @@ -3796,21 +3851,46 @@ static void BufferLeftColumnIvEvStats(void) static void PrintLeftColumnStats(void) { - PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_STATS_LEFT), gStringVar4, 4, 1, 0, 0); + int x; + + if (sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS && P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE) + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 46); + else + x = 4; + + PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_STATS_LEFT), gStringVar4, x, 1, 0, 0); } static void BufferRightColumnStats(void) { DynamicPlaceholderTextUtil_Reset(); - BufferStat(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); - BufferStat(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); - BufferStat(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); + + if (P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) + { + BufferLetterGrade(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); + BufferLetterGrade(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); + BufferLetterGrade(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); + } + else + { + BufferStat(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); + BufferStat(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); + BufferStat(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); + } + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsRightColumnLayout); } static void PrintRightColumnStats(void) { - PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_STATS_RIGHT), gStringVar4, 2, 1, 0, 0); + int x; + + if (sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS && P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE) + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 20); + else + x = 2; + + PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_STATS_RIGHT), gStringVar4, x, 1, 0, 0); } static void PrintExpPointsNextLevel(void) From 3b0484742ac874f0a7eeaaea0b9ec3d8710da086 Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 15 Jan 2025 17:12:41 -0600 Subject: [PATCH 39/44] clarify flag use --- include/config/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 606939f2469e..7c6042fae8a8 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -78,7 +78,7 @@ // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. #define P_FLAG_FORCE_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into being Shiny. #define P_FLAG_FORCE_NO_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into NOT being Shiny. -#define P_FLAG_IV_EV_INFO 1 // If this flag is set, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. +#define P_FLAG_IV_EV_INFO 1 // If this flag is set, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. Note: if P_SUMMARY_SCREEN_IV_EV_INFO is TRUE, this flag does nothing. // Go here if you want to disable specific families of Pokémon. #include "config/species_enabled.h" From 6a96449c649239dec452d8d16601c0d1d565cf61 Mon Sep 17 00:00:00 2001 From: khbsd Date: Thu, 16 Jan 2025 15:42:38 -0600 Subject: [PATCH 40/44] moved some logic around in Task_ChangeSummaryMon to ensure reset on changing mons, and added options for only showing IVs or only showing EVs --- include/config/pokemon.h | 4 +- src/pokemon_summary_screen.c | 117 +++++++++++++++++------------------ 2 files changed, 59 insertions(+), 62 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 7c6042fae8a8..c986b91ff4df 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -68,7 +68,9 @@ #define P_SUMMARY_SCREEN_IV_EV_INFO P_FLAG_IV_EV_INFO // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. #define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. #define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. -#define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. +#define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. +#define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. +#define P_SUMMARY_SCREEN_EV_ONLY FALSE // If TRUE, will only show EV info in the summary screen. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 963428655eb8..b0e3756d0014 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -331,6 +331,7 @@ void ExtractMonSkillIvData(struct Pokemon *mon, struct PokeSummary *sum); void ExtractMonSkillEvData(struct Pokemon *mon, struct PokeSummary *sum); static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId); static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId); +static const u8 *GetLetterGrade(u32 stat); static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId); static u8 IncrementSkillsStatsMode(u8 mode); static void ClearStatLabel(u32 length, u32 statsCoordX, u32 statsCoordY); @@ -1768,11 +1769,28 @@ static u8 IncrementSkillsStatsMode(u8 mode) switch (mode) { case SUMMARY_SKILLS_MODE_STATS: - sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_IVS; - return SUMMARY_SKILLS_MODE_IVS; + if (P_SUMMARY_SCREEN_EV_ONLY == TRUE) + { + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; + return SUMMARY_SKILLS_MODE_EVS; + } + else + { + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_IVS; + return SUMMARY_SKILLS_MODE_IVS; + } + case SUMMARY_SKILLS_MODE_IVS: - sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; - return SUMMARY_SKILLS_MODE_EVS; + if (P_SUMMARY_SCREEN_IV_ONLY == TRUE) + { + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; + return SUMMARY_SKILLS_MODE_STATS; + } + else + { + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_EVS; + return SUMMARY_SKILLS_MODE_EVS; + } case SUMMARY_SKILLS_MODE_EVS: default: sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; @@ -1809,7 +1827,6 @@ static void ShowMonSkillsInfo(u8 taskId, s16 mode) { ExtractMonSkillEvData(mon, sum); BufferLeftColumnIvEvStats(); - gTasks[taskId].data[0] = -1; // we increment this in Task_HandleInput } PrintLeftColumnStats(); @@ -1937,6 +1954,13 @@ static void Task_ChangeSummaryMon(u8 taskId) sMonSummaryScreen->switchCounter = 0; break; case 4: + if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) + ShowUtilityPrompt(SUMMARY_MODE_NORMAL); + if (ShouldShowIvEvPrompt() && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) + { + sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; + ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); + } if (ExtractMonDataToSummaryStruct(&sMonSummaryScreen->currentMon) == FALSE) return; else @@ -1980,13 +2004,6 @@ static void Task_ChangeSummaryMon(u8 taskId) case 11: PrintPageSpecificText(sMonSummaryScreen->currPageIndex); LimitEggSummaryPageDisplay(); - if (P_SUMMARY_SCREEN_RENAME && sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) - ShowUtilityPrompt(SUMMARY_MODE_NORMAL); - if (ShouldShowIvEvPrompt() && sMonSummaryScreen->currPageIndex == PSS_PAGE_SKILLS) - { - sMonSummaryScreen->skillsPageMode = SUMMARY_SKILLS_MODE_STATS; - ChangeStatLabel(SUMMARY_SKILLS_MODE_STATS); - } break; case 12: gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 0; @@ -3753,7 +3770,12 @@ static void BufferStat(u8 *dst, u8 statIndex, u32 stat, u32 strId, u32 n) else txtPtr = StringCopy(dst, sTextNatureNeutral); - ConvertIntToDecimalStringN(txtPtr, stat, STR_CONV_MODE_RIGHT_ALIGN, n); + if (P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE + && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) + StringAppend(dst, GetLetterGrade(stat)); + else + ConvertIntToDecimalStringN(txtPtr, stat, STR_CONV_MODE_RIGHT_ALIGN, n); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); } @@ -3780,25 +3802,6 @@ static const u8 *GetLetterGrade(u32 stat) return gText_GradeF; } -static void BufferLetterGrade(u8 *dst, u8 statIndex, u32 stat, u32 strId, u32 n) -{ - static const u8 sTextNatureDown[] = _("{COLOR}{08}"); - static const u8 sTextNatureUp[] = _("{COLOR}{05}"); - static const u8 sTextNatureNeutral[] = _("{COLOR}{01}"); - - if (statIndex == 0 || !SUMMARY_SCREEN_NATURE_COLORS || gNaturesInfo[sMonSummaryScreen->summary.mintNature].statUp == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statDown) - StringCopy(dst, sTextNatureNeutral); - else if (statIndex == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statUp) - StringCopy(dst, sTextNatureUp); - else if (statIndex == gNaturesInfo[sMonSummaryScreen->summary.mintNature].statDown) - StringCopy(dst, sTextNatureDown); - else - StringCopy(dst, sTextNatureNeutral); - - StringAppend(dst, GetLetterGrade(stat)); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); -} - static void BufferLeftColumnStats(void) { u8 *currentHPString = Alloc(20); @@ -3808,8 +3811,8 @@ static void BufferLeftColumnStats(void) DynamicPlaceholderTextUtil_Reset(); - BufferStat(currentHPString, 0, sMonSummaryScreen->summary.currentHP, 0, 3); - BufferStat(maxHPString, 0, sMonSummaryScreen->summary.maxHP, 1, 3); + BufferStat(currentHPString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 3); + BufferStat(maxHPString, STAT_HP, sMonSummaryScreen->summary.maxHP, 1, 3); BufferStat(attackString, STAT_ATK, sMonSummaryScreen->summary.atk, 2, 7); BufferStat(defenseString, STAT_DEF, sMonSummaryScreen->summary.def, 3, 7); @@ -3829,18 +3832,9 @@ static void BufferLeftColumnIvEvStats(void) DynamicPlaceholderTextUtil_Reset(); - if (P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) - { - BufferLetterGrade(hpIvEvString, 0, sMonSummaryScreen->summary.currentHP, 0, 3); - BufferLetterGrade(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); - BufferLetterGrade(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); - } - else - { - BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); - BufferStat(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); - BufferStat(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); - } + BufferStat(hpIvEvString, STAT_HP, sMonSummaryScreen->summary.currentHP, 0, 7); + BufferStat(attackIvEvString, STAT_ATK, sMonSummaryScreen->summary.atk, 1, 7); + BufferStat(defenseIvEvString, STAT_DEF, sMonSummaryScreen->summary.def, 2, 7); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftIVEVColumnLayout); @@ -3865,19 +3859,10 @@ static void BufferRightColumnStats(void) { DynamicPlaceholderTextUtil_Reset(); - if (P_SUMMARY_SCREEN_IV_EV_VALUES == FALSE && sMonSummaryScreen->skillsPageMode == SUMMARY_SKILLS_MODE_IVS) - { - BufferLetterGrade(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); - BufferLetterGrade(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); - BufferLetterGrade(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); - } - else - { - BufferStat(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); - BufferStat(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); - BufferStat(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); - } - + BufferStat(gStringVar1, STAT_SPATK, sMonSummaryScreen->summary.spatk, 0, 3); + BufferStat(gStringVar2, STAT_SPDEF, sMonSummaryScreen->summary.spdef, 1, 3); + BufferStat(gStringVar3, STAT_SPEED, sMonSummaryScreen->summary.speed, 2, 3); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsRightColumnLayout); } @@ -4715,9 +4700,19 @@ static inline void ShowUtilityPrompt(s16 mode) if (ShouldShowIvEvPrompt()) { if (mode == SUMMARY_SKILLS_MODE_STATS) - promptText = gText_SkillPageIvs; + { + if (P_SUMMARY_SCREEN_EV_ONLY == TRUE) + promptText = gText_SkillPageEvs; + else + promptText = gText_SkillPageIvs; + } else if (mode == SUMMARY_SKILLS_MODE_IVS) - promptText = gText_SkillPageEvs; + { + if (P_SUMMARY_SCREEN_IV_ONLY == TRUE) + promptText = gText_SkillPageStats; + else + promptText = gText_SkillPageEvs; + } else if (mode == SUMMARY_SKILLS_MODE_EVS) promptText = gText_SkillPageStats; } From 7030824dee05467b1ae233d6030cdfeb85687b78 Mon Sep 17 00:00:00 2001 From: khbsd Date: Thu, 16 Jan 2025 15:47:49 -0600 Subject: [PATCH 41/44] formattin --- include/config/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index c986b91ff4df..3ed5b178d7a3 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -69,7 +69,7 @@ #define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. #define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. #define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. -#define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. +#define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. #define P_SUMMARY_SCREEN_EV_ONLY FALSE // If TRUE, will only show EV info in the summary screen. // Learnset helper toggles From 2cdc871e91822a0c7fb8e58543394b824c6b9ed5 Mon Sep 17 00:00:00 2001 From: khbsd Date: Fri, 17 Jan 2025 13:58:36 -0600 Subject: [PATCH 42/44] saner defaults and a letter grade guide that links to the stats judge bulbapedia page. --- include/config/pokemon.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 3ed5b178d7a3..0fb71594b0b2 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -65,22 +65,34 @@ #define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. #define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO P_FLAG_IV_EV_INFO // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. +#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. #define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. #define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. #define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. +/* +LETTER GRADE GUIDE: + + F = 0 + D = 1 - 15 + C = 16 - 25 + B = 26 - 29 + A = 30 + S = 31 + +Info taken from https://bulbapedia.bulbagarden.net/wiki/Stats_judge. +*/ #define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. #define P_SUMMARY_SCREEN_EV_ONLY FALSE // If TRUE, will only show EV info in the summary screen. // Learnset helper toggles -#define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. +#define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. #define P_FLAG_FORCE_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into being Shiny. #define P_FLAG_FORCE_NO_SHINY 0 // If this flag is set, all wild and gift Pokémon will forced into NOT being Shiny. -#define P_FLAG_IV_EV_INFO 1 // If this flag is set, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. Note: if P_SUMMARY_SCREEN_IV_EV_INFO is TRUE, this flag does nothing. +#define P_FLAG_IV_EV_INFO 0 // If this flag is set, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. Note: if P_SUMMARY_SCREEN_IV_EV_INFO is TRUE, this flag does nothing. // Go here if you want to disable specific families of Pokémon. #include "config/species_enabled.h" From 250578521dbdeea1e2d7dc1281227ccefbaa5e71 Mon Sep 17 00:00:00 2001 From: khbsd Date: Fri, 17 Jan 2025 14:16:44 -0600 Subject: [PATCH 43/44] off by default --- include/config/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 0fb71594b0b2..c5e6c1120e36 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -65,7 +65,7 @@ #define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. #define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. #define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO TRUE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. +#define P_SUMMARY_SCREEN_IV_EV_INFO FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. #define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. #define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. #define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. From 7090765a8691b6c49de98ccd925c308d0a019d1d Mon Sep 17 00:00:00 2001 From: khbsd Date: Sat, 18 Jan 2025 21:03:25 -0600 Subject: [PATCH 44/44] address a couple comments --- include/config/pokemon.h | 20 ++++++++++---------- src/pokemon_summary_screen.c | 18 +++++------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index c5e6c1120e36..d9fbe22d91f9 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -62,13 +62,13 @@ #define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla. // Summary screen settings -#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. -#define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. -#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. -#define P_SUMMARY_SCREEN_IV_EV_INFO FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. -#define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. -#define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. -#define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. +#define P_SUMMARY_SCREEN_MOVE_RELEARNER TRUE // If TRUE, shows an option for Pokémon to relearn moves on the summary screen moves page. +#define P_SUMMARY_MOVE_RELEARNER_FULL_PP TRUE // If TRUE, the move relearner in the summary screen restores relearned moves' PP to full. +#define P_SUMMARY_SCREEN_RENAME TRUE // If TRUE, an option to change Pokémon nicknames replaces the cancel prompt on the summary screen info page. +#define P_SUMMARY_SCREEN_IV_EV_INFO FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page. +#define P_SUMMARY_SCREEN_IV_EV_BOX_ONLY FALSE // If TRUE, will allow player to cycle through the Stats, IVs, and EVs in the summary screen skills page, but only in the PC storage box. +#define P_SUMMARY_SCREEN_IV_EV_TILESET FALSE // If TRUE, loads an alternate tileset to allow changing the "STATS" label in the summary screen skills page. Note: if it's still loading the alternate tileset after changing this and recompiling, you may need a `make clean` before compilation. +#define P_SUMMARY_SCREEN_IV_EV_VALUES FALSE // If TRUE, will show the actual IV value instead of the letter grade. /* LETTER GRADE GUIDE: @@ -81,11 +81,11 @@ LETTER GRADE GUIDE: Info taken from https://bulbapedia.bulbagarden.net/wiki/Stats_judge. */ -#define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. -#define P_SUMMARY_SCREEN_EV_ONLY FALSE // If TRUE, will only show EV info in the summary screen. +#define P_SUMMARY_SCREEN_IV_ONLY FALSE // If TRUE, will only show IV info in the summary screen. +#define P_SUMMARY_SCREEN_EV_ONLY FALSE // If TRUE, will only show EV info in the summary screen. // Learnset helper toggles -#define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. +#define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b0e3756d0014..7a8297d82395 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -323,7 +323,6 @@ static void BufferLeftColumnIvEvStats(void); static void CB2_ReturnToSummaryScreenFromNamingScreen(void); static void CB2_PssChangePokemonNickname(void); static void ShowUtilityPrompt(s16 mode); -static void ClearUtilityPrompt(void); static void ShowMonSkillsInfo(u8 taskId, s16 mode); static void WriteToStatsTilemapBuffer(u32 length, u32 block, u32 statsCoordX, u32 statsCoordY); void ExtractMonSkillStatsData(struct Pokemon *mon, struct PokeSummary *sum); @@ -4663,24 +4662,16 @@ static inline bool32 ShouldShowIvEvPrompt(void) { if (P_SUMMARY_SCREEN_IV_EV_BOX_ONLY == TRUE) { - return ((P_SUMMARY_SCREEN_IV_EV_INFO == TRUE || FlagGet(P_FLAG_IV_EV_INFO)) + return (P_SUMMARY_SCREEN_IV_EV_INFO == TRUE || FlagGet(P_FLAG_IV_EV_INFO)) && (sMonSummaryScreen->mode == SUMMARY_MODE_BOX - || sMonSummaryScreen->mode == SUMMARY_MODE_BOX_CURSOR)); + || sMonSummaryScreen->mode == SUMMARY_MODE_BOX_CURSOR); } - else if (P_SUMMARY_SCREEN_IV_EV_BOX_ONLY == FALSE) { + else if (P_SUMMARY_SCREEN_IV_EV_BOX_ONLY == FALSE) return (P_SUMMARY_SCREEN_IV_EV_INFO == TRUE || FlagGet(P_FLAG_IV_EV_INFO)); - } else return FALSE; } -static inline void ClearUtilityPrompt(void) -{ - ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); - FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); -} - - static inline void ShowUtilityPrompt(s16 mode) { const u8* promptText = NULL; @@ -4728,7 +4719,8 @@ static inline void ShowUtilityPrompt(s16 mode) if (promptText == NULL) { - ClearUtilityPrompt(); + ClearWindowTilemap(PSS_LABEL_WINDOW_PROMPT_UTILITY); + FillWindowPixelBuffer(PSS_LABEL_WINDOW_PROMPT_UTILITY, PIXEL_FILL(0)); return; }