From 921d29823e945bb23498ac2985f74d34c4265cad Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 15:05:59 -0600 Subject: [PATCH 1/6] feat: add gen 7 config for B_HPBAR_COLOR_THRESHOLD --- src/battle_interface.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 7584f23f46..a833d27d01 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2117,10 +2117,15 @@ static void MoveBattleBarGraphically(enum BattlerId battler, u8 whichBar) break; default: case HP_BAR_RED: - if (maxValue > 1) // handling for wonder guard + if (maxValue > 1 || B_HPBAR_COLOR_THRESHOLD < GEN_9) // handling for wonder guard + { barElementId = HEALTHBOX_GFX_HP_BAR_RED; + } else - barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; + { + if (B_HPBAR_COLOR_THRESHOLD >= GEN_9) + barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; + } break; } From 893a9a72210cfb7d544ffabdb21e74760d7d6e5d Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 15:13:51 -0600 Subject: [PATCH 2/6] cleanup: make logic easier to read --- src/battle_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index a833d27d01..19f7b8fd65 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2117,14 +2117,16 @@ static void MoveBattleBarGraphically(enum BattlerId battler, u8 whichBar) break; default: case HP_BAR_RED: - if (maxValue > 1 || B_HPBAR_COLOR_THRESHOLD < GEN_9) // handling for wonder guard + if (maxValue > 1) { barElementId = HEALTHBOX_GFX_HP_BAR_RED; } - else + else // handling for wonder guard { if (B_HPBAR_COLOR_THRESHOLD >= GEN_9) barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; + else + barElementId = HEALTHBOX_GFX_HP_BAR_RED; } break; } From 184177b125ba3f0c22c5e6f682e2974b39f36b8a Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 15:22:20 -0600 Subject: [PATCH 3/6] update(docs): add extra info for gen config --- include/config/battle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/battle.h b/include/config/battle.h index dfa48b8420..98b2086fcd 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -322,7 +322,7 @@ #define B_ANIMATE_MON_AFTER_KO TRUE // If set to TRUE, if a Pokémon on the opposite site faints, the non-fainted Pokemon will display a victory animation. #define B_ANIMATE_MON_AFTER_FAILED_POKEBALL TRUE // If set to TRUE, if a Pokémon on the opposite side breaks out of a thrown Poké Ball, the wild Pokémon will display its animation. #define B_SHOW_DYNAMAX_MESSAGE FALSE // If set to TRUE, an additional battle message is shown after completing Dynamaxing/Gigantamaxing. -#define B_HPBAR_COLOR_THRESHOLD GEN_LATEST // In Gen 5+, HP bar color thresholds were changed to be based on the actual HP values instead of the pixel length of the HP bar, leading to more accurate HP bar colors. +#define B_HPBAR_COLOR_THRESHOLD GEN_LATEST // In Gen 5+, HP bar color thresholds were changed to be based on the actual HP values instead of the pixel length of the HP bar, leading to more accurate HP bar colors. If Gens earlier than 9 are picked, the HP bars of Pokémon with 1 Max HP (ie Shedinja) will turn red before depleting. If Gens 9 or later are picked, they will stay green while depleting. // Catching settings #define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) From db349bfb505be692b7364ae5a3ac9d3d4897c0ae Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 15:23:50 -0600 Subject: [PATCH 4/6] update(comment): clarify code comment --- src/battle_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 19f7b8fd65..b5e9814a65 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2121,7 +2121,7 @@ static void MoveBattleBarGraphically(enum BattlerId battler, u8 whichBar) { barElementId = HEALTHBOX_GFX_HP_BAR_RED; } - else // handling for wonder guard + else // handling for mons with 1 max HP, ie Shedinja { if (B_HPBAR_COLOR_THRESHOLD >= GEN_9) barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; From 71686784d74cf1d0fa1ef24d7957bc84d52d253c Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 16:06:02 -0600 Subject: [PATCH 5/6] fix: correct gen config --- include/config/battle.h | 2 +- src/battle_interface.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/config/battle.h b/include/config/battle.h index 98b2086fcd..a8b4e19757 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -322,7 +322,7 @@ #define B_ANIMATE_MON_AFTER_KO TRUE // If set to TRUE, if a Pokémon on the opposite site faints, the non-fainted Pokemon will display a victory animation. #define B_ANIMATE_MON_AFTER_FAILED_POKEBALL TRUE // If set to TRUE, if a Pokémon on the opposite side breaks out of a thrown Poké Ball, the wild Pokémon will display its animation. #define B_SHOW_DYNAMAX_MESSAGE FALSE // If set to TRUE, an additional battle message is shown after completing Dynamaxing/Gigantamaxing. -#define B_HPBAR_COLOR_THRESHOLD GEN_LATEST // In Gen 5+, HP bar color thresholds were changed to be based on the actual HP values instead of the pixel length of the HP bar, leading to more accurate HP bar colors. If Gens earlier than 9 are picked, the HP bars of Pokémon with 1 Max HP (ie Shedinja) will turn red before depleting. If Gens 9 or later are picked, they will stay green while depleting. +#define B_HPBAR_COLOR_THRESHOLD GEN_LATEST // In Gen 5+, HP bar color thresholds were changed to be based on the actual HP values instead of the pixel length of the HP bar, leading to more accurate HP bar colors. If Gens earlier than 8 are picked, the HP bars of Pokémon with 1 Max HP (ie Shedinja) will turn red before depleting. If Gens 8 or later are picked, they will stay green while depleting. // Catching settings #define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) diff --git a/src/battle_interface.c b/src/battle_interface.c index b5e9814a65..9f49e9f6b3 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2123,7 +2123,7 @@ static void MoveBattleBarGraphically(enum BattlerId battler, u8 whichBar) } else // handling for mons with 1 max HP, ie Shedinja { - if (B_HPBAR_COLOR_THRESHOLD >= GEN_9) + if (B_HPBAR_COLOR_THRESHOLD >= GEN_8) barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; else barElementId = HEALTHBOX_GFX_HP_BAR_RED; From 2d5360560a91a4dc9c4ac54f2f255509aa75bdc1 Mon Sep 17 00:00:00 2001 From: khbsd Date: Wed, 4 Feb 2026 16:22:56 -0600 Subject: [PATCH 6/6] update: make logic easier to read (ty alex!) --- src/battle_interface.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 9f49e9f6b3..63da163a38 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2118,16 +2118,11 @@ static void MoveBattleBarGraphically(enum BattlerId battler, u8 whichBar) default: case HP_BAR_RED: if (maxValue > 1) - { barElementId = HEALTHBOX_GFX_HP_BAR_RED; - } - else // handling for mons with 1 max HP, ie Shedinja - { - if (B_HPBAR_COLOR_THRESHOLD >= GEN_8) - barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; - else - barElementId = HEALTHBOX_GFX_HP_BAR_RED; - } + else if (B_HPBAR_COLOR_THRESHOLD >= GEN_8) // handling for mons with 1 max HP, ie Shedinja + barElementId = HEALTHBOX_GFX_HP_BAR_GREEN; + else + barElementId = HEALTHBOX_GFX_HP_BAR_RED; break; }