Skip to content

Commit 05b100d

Browse files
committed
Reset the partner menu if manually changing Yoshi's color
1 parent b58151e commit 05b100d

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

ttyd-tools/rel/include/menufunctions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ void resetMenu();
1616
void resetMenuToRoot();
1717
void resetAndCloseSecondaryMenu();
1818
void resetImportantItemsPauseMenu();
19+
void resetPartnerPauseMenu();
1920
void recheckUpgradesBattles(int32_t item);
2021

2122
void raiseSystemLevel();

ttyd-tools/rel/source/menu.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <ttyd/evt_yuugijou.h>
1313
#include <ttyd/mario_pouch.h>
1414
#include <ttyd/mariost.h>
15-
#include <ttyd/win_party.h>
1615
#include <ttyd/win_main.h>
1716
#include <ttyd/party.h>
1817

@@ -1318,14 +1317,8 @@ void menuCheckButton()
13181317

13191318
*AddressToChange = !*AddressToChange;
13201319

1321-
// Reset the partner menu if the pause menu is open
1322-
uint32_t SystemLevel = ttyd::mariost::marioStGetSystemLevel();
1323-
if (SystemLevel == 15)
1324-
{
1325-
void *PauseMenuPointer = ttyd::win_main::winGetPtr();
1326-
ttyd::win_party::winPartyExit(PauseMenuPointer);
1327-
ttyd::win_party::winPartyInit(PauseMenuPointer);
1328-
}
1320+
// Reset the partner menu
1321+
resetPartnerPauseMenu();
13291322
break;
13301323
}
13311324
case TOGGLE + 1:

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <ttyd/win_main.h>
88
#include <ttyd/mariost.h>
99
#include <ttyd/win_item.h>
10+
#include <ttyd/win_party.h>
1011
#include <ttyd/seqdrv.h>
1112
#include <ttyd/item_data.h>
1213
#include <ttyd/msgdrv.h>
@@ -149,10 +150,10 @@ void resetImportantItemsPauseMenu()
149150
uint32_t ImportantItemsSubMenu = *reinterpret_cast<uint32_t *>(
150151
reinterpret_cast<uint32_t>(PauseMenuPointer) + 0x210);
151152

152-
// Reset the item menu
153+
// Clear the item menu
153154
ttyd::win_item::winItemExit(PauseMenuPointer);
154155

155-
// Re-init the menu
156+
// Re-init the item menu
156157
ttyd::win_item::winItemInit(PauseMenuPointer);
157158

158159
// Restore the submenu
@@ -161,6 +162,25 @@ void resetImportantItemsPauseMenu()
161162
0x210) = ImportantItemsSubMenu;
162163
}
163164

165+
void resetPartnerPauseMenu()
166+
{
167+
// Only run if the pause menu is currently open
168+
uint32_t SystemLevel = ttyd::mariost::marioStGetSystemLevel();
169+
if (SystemLevel != 15)
170+
{
171+
// The pause menu is not open, so do nothing
172+
return;
173+
}
174+
175+
void *PauseMenuPointer = ttyd::win_main::winGetPtr();
176+
177+
// Clear the party menu
178+
ttyd::win_party::winPartyExit(PauseMenuPointer);
179+
180+
// Re-init the party menu
181+
ttyd::win_party::winPartyInit(PauseMenuPointer);
182+
}
183+
164184
void recheckUpgradesBattles(int32_t item)
165185
{
166186
// Only run while in a battle
@@ -1750,6 +1770,9 @@ uint32_t partnerChangeYoshiColorButtonControls()
17501770
{
17511771
setNewYoshiColorId(MenuVar.SecondaryMenuOption);
17521772

1773+
// Reset the partner menu
1774+
resetPartnerPauseMenu();
1775+
17531776
MenuVar.MenuSelectedOption = 0;
17541777

17551778
MenuVar.FrameCounter = 1;

0 commit comments

Comments
 (0)