BattlePyramidChooseMonHeldItems bugfix and improved diffs

Scyrous 2024-10-13 16:03:13 +02:00
parent e366fb2d59
commit 23bef3390d
1 changed files with 57 additions and 29 deletions

@ -1,4 +1,4 @@
**Credits:** Zeturic, Deokishisu
**Credits:** Zeturic, Deokishisu, Scyrous
Adds a MOVE option to the ITEM menu which allows you to move held items directly between Pokémon in your party, instead of having to use the bag as a middle man. Originally posted by Zeturic in [this](https://www.pokecommunity.com/threads/simple-modifications-directory.416647/page-3#post-10120157) pokecommunity post. This guide also includes the mail fix by Deokishisu in [this post](https://www.pokecommunity.com/threads/simple-modifications-directory.416647/post-10517557) and the pokeemerald code is much more recent.
@ -10,6 +10,8 @@ Lastly, some changes have been made compared to the code in the pokecommunity po
- After selecting MOVE in the ITEM menu, the text in the bottom-left corner will now read ''Move {STR_VAR_2} to where?'' instead of ''Move item to where?'', with STR_VAR_2 being the item you're attempting to move. This makes it much easier to identify what item the Pokémon is currently holding.
- **BUGFIX:** when `BattlePyramidChooseMonHeldItems` is called, the party menu window displays the options TAKE/TOSS/CANCEL. Since we're adding a new MOVE option and adjusting the window size, we need to ensure this specific Battle Pyramid window retains its original dimensions, otherwise there will be a blank entry at the bottom.
***
## 1. In `include/strings.h`, end of the file:
```diff
@ -57,6 +59,40 @@ enum {
MENU_TAKE_MAIL,
MENU_READ,
```
Also in `DisplaySelectionWindow`:
```diff
case SELECTWINDOW_ITEM:
window = sItemGiveTakeWindowTemplate;
break;
+ case SELECTWINDOW_PYRAMID:
+ window = sItemPyramidTakeTossWindowTemplate;
+ break;
case SELECTWINDOW_MAIL:
window = sMailReadTakeWindowTemplate;
break;
```
In `CreateSelectionWindow`:
```diff
item = GetMonData(mon, MON_DATA_HELD_ITEM);
if (item != ITEM_NONE)
{
SetPartyMonSelectionActions(gPlayerParty, gPartyMenu.slotId, GetPartyMenuActionsType(mon));
- DisplaySelectionWindow(SELECTWINDOW_ITEM);
+ DisplaySelectionWindow(SELECTWINDOW_PYRAMID);
CopyItemName(item, gStringVar2);
DisplayPartyMenuStdMessage(PARTY_MSG_ALREADY_HOLDING_ONE);
}
```
And in `CursorCb_Cancel2`:
```diff
else
{
- DisplaySelectionWindow(SELECTWINDOW_ITEM);
+ DisplaySelectionWindow(SELECTWINDOW_PYRAMID);
CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar2);
DisplayPartyMenuStdMessage(PARTY_MSG_ALREADY_HOLDING_ONE);
}
```
At the end of the file, add the following two functions:
```
void CursorCb_MoveItemCallback(u8 taskId)
@ -191,6 +227,14 @@ void CursorCb_MoveItem(u8 taskId)
+#define PARTY_MSG_MOVE_ITEM_WHERE 27
#define PARTY_MSG_NONE 127
```
Also:
```diff
#define SELECTWINDOW_ACTIONS 0
#define SELECTWINDOW_ITEM 1
#define SELECTWINDOW_MAIL 2
#define SELECTWINDOW_MOVES 3
+#define SELECTWINDOW_PYRAMID 4
```
## 5. In `src/data/party_menu.h`:
```diff
struct
@ -209,39 +253,12 @@ struct
[MENU_MAIL] = {gText_Mail, CursorCb_Mail},
[MENU_TAKE_MAIL] = {gText_Take2, CursorCb_TakeMail},
```
Also:
In `const sActionStringTable[]`:
```diff
static const u8 *const sActionStringTable[] =
{
[PARTY_MSG_CHOOSE_MON] = gText_ChoosePokemon,
[PARTY_MSG_CHOOSE_MON_OR_CANCEL] = gText_ChoosePokemonCancel,
[PARTY_MSG_CHOOSE_MON_AND_CONFIRM] = gText_ChoosePokemonConfirm,
[PARTY_MSG_MOVE_TO_WHERE] = gText_MoveToWhere,
[PARTY_MSG_TEACH_WHICH_MON] = gText_TeachWhichPokemon,
[PARTY_MSG_USE_ON_WHICH_MON] = gText_UseOnWhichPokemon,
[PARTY_MSG_GIVE_TO_WHICH_MON] = gText_GiveToWhichPokemon,
[PARTY_MSG_NOTHING_TO_CUT] = gText_NothingToCut,
[PARTY_MSG_CANT_SURF_HERE] = gText_CantSurfHere,
[PARTY_MSG_ALREADY_SURFING] = gText_AlreadySurfing,
[PARTY_MSG_CURRENT_TOO_FAST] = gText_CurrentIsTooFast,
[PARTY_MSG_ENJOY_CYCLING] = gText_EnjoyCycling,
[PARTY_MSG_ALREADY_IN_USE] = gText_InUseAlready_PM,
[PARTY_MSG_CANT_USE_HERE] = gText_CantUseHere,
[PARTY_MSG_NO_MON_FOR_BATTLE] = gText_NoPokemonForBattle,
[PARTY_MSG_CHOOSE_MON_2] = gText_ChoosePokemon2,
[PARTY_MSG_NOT_ENOUGH_HP] = gText_NotEnoughHp,
[PARTY_MSG_X_MONS_ARE_NEEDED] = gText_PokemonAreNeeded,
[PARTY_MSG_MONS_CANT_BE_SAME] = gText_PokemonCantBeSame,
[PARTY_MSG_NO_SAME_HOLD_ITEMS] = gText_NoIdenticalHoldItems,
[PARTY_MSG_UNUSED] = gText_EmptyString2,
[PARTY_MSG_DO_WHAT_WITH_MON] = gText_DoWhatWithPokemon,
[PARTY_MSG_RESTORE_WHICH_MOVE] = gText_RestoreWhichMove,
[PARTY_MSG_BOOST_PP_WHICH_MOVE] = gText_BoostPp,
[PARTY_MSG_DO_WHAT_WITH_ITEM] = gText_DoWhatWithItem,
[PARTY_MSG_DO_WHAT_WITH_MAIL] = gText_DoWhatWithMail,
[PARTY_MSG_ALREADY_HOLDING_ONE] = gText_AlreadyHoldingOne,
+ [PARTY_MSG_MOVE_ITEM_WHERE] = gText_MoveItemWhere,
};
```
And also:
```diff
@ -266,5 +283,16 @@ static const struct WindowTemplate sItemGiveTakeWindowTemplate =
.paletteNum = 14,
.baseBlock = 0x39D,
};
+static const struct WindowTemplate sItemPyramidTakeTossWindowTemplate =
+{
+ .bg = 2,
+ .tilemapLeft = 23,
+ .tilemapTop = 13,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 14,
+ .baseBlock = 0x39D,
+};
```
That is all!