From ba884e9c503dc1ac83148157d7ef9284c29b9bc1 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 16 Feb 2022 09:24:10 -0300 Subject: May as well take the chance and add a very important note for item_expansion users, since it's relevant to the choice given at the end --- Infinite-TM-usage.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Infinite-TM-usage.md b/Infinite-TM-usage.md index f58ffb3..aa5b267 100644 --- a/Infinite-TM-usage.md +++ b/Infinite-TM-usage.md @@ -236,3 +236,36 @@ And that's it! TMs are now reusable just like in Gen 5! ![](https://i.imgur.com/zA0lj2E.png) Alternatively, see [this commit](https://github.com/LOuroboros/pokeemerald/commit/6f69765770a52c1a7d6608a117112b78a2afcc22) for an implementation by Karathan that turns TMs and HMs into a bitfield, freeing up some saveblock space. This saves space, but is slightly more complex. + +**[Item_expansion](https://github.com/rh-hideout/pokeemerald-expansion/tree/item_expansion)** users, please keep in mind that if you decide to use the above refactorization of TMs and HMs, you will need to modify the `CanMonLearnTMTutor` function located in `src/party_menu.c` like this: + +```diff +static u8 CanMonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor) +{ + u16 move; + + if (GetMonData(mon, MON_DATA_IS_EGG)) + return CANNOT_LEARN_MOVE_IS_EGG; + + if (item >= ITEM_TM01) + { +- if (!CanMonLearnTMHM(mon, item - ITEM_TM01 - ((item > ITEM_TM100) ? 50 : 0))) ++ if (!CanMonLearnTMHM(mon, item - ITEM_TM01)) + return CANNOT_LEARN_MOVE; + else + move = ItemIdToBattleMoveId(item); + } + else + { + if (!CanLearnTutorMove(GetMonData(mon, MON_DATA_SPECIES), tutor)) + return CANNOT_LEARN_MOVE; + else + move = GetTutorMove(tutor); + } + + if (MonKnowsMove(mon, move) == TRUE) + return ALREADY_KNOWS_MOVE; + else + return CAN_LEARN_MOVE; +} +``` \ No newline at end of file -- cgit v1.2.3