From f8a515194258722bbb38cb630eb37f792fe78b60 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 27 May 2019 11:47:39 +0200 Subject: [PATCH 1/3] Colored stats depending on nature --- src/pokemon_summary_screen.c | 48 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 79aac4b5e6f8..17e69a5814df 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3345,23 +3345,37 @@ static void PrintRibbonCount(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT), text, offset, 1, 0, 0); } -static void BufferLeftColumnStats(void) +static void BufferStat(u8 *dst, s8 natureMod, u32 stat, u32 strId, u32 n) { - u8 *currentHPString = Alloc(8); - u8 *maxHPString = Alloc(8); - u8 *attackString = Alloc(8); - u8 *defenseString = Alloc(8); + static const u8 sTextNatureDown[] = _("{COLOR}{09}"); + static const u8 sTextNatureUp[] = _("{COLOR}{05}"); + static const u8 sTextNatureNeutral[] = _("{COLOR}{01}"); + u8 *txtPtr; + + if (natureMod == 0) + txtPtr = StringCopy(dst, sTextNatureNeutral); + else if (natureMod > 0) + txtPtr = StringCopy(dst, sTextNatureUp); + else + txtPtr = StringCopy(dst, sTextNatureDown); + + ConvertIntToDecimalStringN(txtPtr, stat, STR_CONV_MODE_RIGHT_ALIGN, n); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(strId, dst); +} - ConvertIntToDecimalStringN(currentHPString, sMonSummaryScreen->summary.currentHP, 1, 3); - ConvertIntToDecimalStringN(maxHPString, sMonSummaryScreen->summary.maxHP, 1, 3); - ConvertIntToDecimalStringN(attackString, sMonSummaryScreen->summary.atk, 1, 7); - ConvertIntToDecimalStringN(defenseString, sMonSummaryScreen->summary.def, 1, 7); +static void BufferLeftColumnStats(void) +{ + u8 *currentHPString = Alloc(20); + u8 *maxHPString = Alloc(20); + u8 *attackString = Alloc(20); + u8 *defenseString = Alloc(20); + const s8 *natureMod = gNatureStatTable[sMonSummaryScreen->summary.nature]; DynamicPlaceholderTextUtil_Reset(); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, currentHPString); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, maxHPString); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, attackString); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, defenseString); + BufferStat(currentHPString, 0, sMonSummaryScreen->summary.currentHP, 0, 3); + BufferStat(maxHPString, 0, sMonSummaryScreen->summary.maxHP, 1, 3); + BufferStat(attackString, natureMod[STAT_ATK - 1], sMonSummaryScreen->summary.atk, 2, 7); + BufferStat(defenseString, natureMod[STAT_DEF - 1], sMonSummaryScreen->summary.def, 3, 7); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftColumnLayout); Free(currentHPString); @@ -3377,9 +3391,11 @@ static void PrintLeftColumnStats(void) static void BufferRightColumnStats(void) { - ConvertIntToDecimalStringN(gStringVar1, sMonSummaryScreen->summary.spatk, 1, 3); - ConvertIntToDecimalStringN(gStringVar2, sMonSummaryScreen->summary.spdef, 1, 3); - ConvertIntToDecimalStringN(gStringVar3, sMonSummaryScreen->summary.speed, 1, 3); + const s8 *natureMod = gNatureStatTable[sMonSummaryScreen->summary.nature]; + + BufferStat(gStringVar1, natureMod[STAT_SPATK - 1], sMonSummaryScreen->summary.spatk, 0, 3); + BufferStat(gStringVar2, natureMod[STAT_SPDEF - 1], sMonSummaryScreen->summary.spdef, 1, 3); + BufferStat(gStringVar3, natureMod[STAT_SPEED - 1], sMonSummaryScreen->summary.speed, 2, 3); DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); From d6d0669882d7dbf287ec61ec003bcbaaf220f45d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 27 May 2019 11:58:17 +0200 Subject: [PATCH 2/3] Fix bug --- src/pokemon_summary_screen.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 17e69a5814df..930e6fbb83fd 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3393,14 +3393,10 @@ static void BufferRightColumnStats(void) { const s8 *natureMod = gNatureStatTable[sMonSummaryScreen->summary.nature]; + DynamicPlaceholderTextUtil_Reset(); BufferStat(gStringVar1, natureMod[STAT_SPATK - 1], sMonSummaryScreen->summary.spatk, 0, 3); BufferStat(gStringVar2, natureMod[STAT_SPDEF - 1], sMonSummaryScreen->summary.spdef, 1, 3); BufferStat(gStringVar3, natureMod[STAT_SPEED - 1], sMonSummaryScreen->summary.speed, 2, 3); - - DynamicPlaceholderTextUtil_Reset(); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gStringVar3); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsRightColumnLayout); } From 59a7d2cb92a89395c11181ee38f3895ad2b47908 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 19 Nov 2023 18:30:18 +0100 Subject: [PATCH 3/3] Update colors and add config --- include/config.h | 5 +++-- src/pokemon_summary_screen.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/config.h b/include/config.h index 17082b0fdc72..49559e78e8a5 100644 --- a/include/config.h +++ b/include/config.h @@ -74,7 +74,8 @@ #define GEN_LATEST GEN_9 // General settings -#define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen. -#define POKEDEX_PLUS_HGSS FALSE // If TRUE, enables the custom HGSS style Pokedex. +#define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen. +#define POKEDEX_PLUS_HGSS FALSE // If TRUE, enables the custom HGSS style Pokedex. +#define SUMMARY_SCREEN_NATURE_COLORS TRUE // If TRUE, nature-based stat boosts and reductions will be red and blue in the summary screen. #endif // GUARD_CONFIG_H diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ffc02ebb730e..b6efb82473e4 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3473,12 +3473,12 @@ static void PrintRibbonCount(void) static void BufferStat(u8 *dst, s8 natureMod, u32 stat, u32 strId, u32 n) { - static const u8 sTextNatureDown[] = _("{COLOR}{09}"); + static const u8 sTextNatureDown[] = _("{COLOR}{08}"); static const u8 sTextNatureUp[] = _("{COLOR}{05}"); static const u8 sTextNatureNeutral[] = _("{COLOR}{01}"); u8 *txtPtr; - if (natureMod == 0) + if (natureMod == 0 || !SUMMARY_SCREEN_NATURE_COLORS) txtPtr = StringCopy(dst, sTextNatureNeutral); else if (natureMod > 0) txtPtr = StringCopy(dst, sTextNatureUp);