summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/config.h3
-rw-r--r--src/pokemon_2.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index 251cbc6c2..22f5647c3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -12,4 +12,7 @@
// European editions of Ruby/Sapphire and all editions of Emerald have this fix.
// #define BUGFIX_TRAINERAPPROACH
+// Fixed in Emerald.
+// #define BUGFIX_SETMONIVS
+
#endif // GUARD_CONFIG_H
diff --git a/src/pokemon_2.c b/src/pokemon_2.c
index aeffb29a0..e747629d1 100644
--- a/src/pokemon_2.c
+++ b/src/pokemon_2.c
@@ -1016,7 +1016,11 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const u8 *data)
break;
case MON_DATA_IVS:
{
+#ifdef BUGFIX_SETMONIVS
+ u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[1] << 24);
+#else
u32 ivs = *data; // Bug: Only the HP IV and the lower 3 bits of the Attack IV are read. The rest become 0.
+#endif
substruct3->hpIV = ivs & 0x1F;
substruct3->attackIV = (ivs >> 5) & 0x1F;
substruct3->defenseIV = (ivs >> 10) & 0x1F;