Skip to content

Commit 8fe3734

Browse files
committed
Battle menu bug fix
When clearing the held item for an enemy, the held/equipped badges are now cleared.
1 parent bb35349 commit 8fe3734

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

ttyd-tools/rel/source/menu.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,14 +2144,32 @@ void menuCheckButton()
21442144
}
21452145

21462146
#ifdef TTYD_US
2147-
uint32_t offset = 0x308;
2147+
uint32_t HeldItemOffset = 0x308;
2148+
uint32_t BadgeFlagOffsetStart = 0x2E0;
21482149
#elif defined TTYD_JP
2149-
uint32_t offset = 0x304;
2150+
uint32_t HeldItemOffset = 0x304;
2151+
uint32_t BadgeFlagOffsetStart = 0x2DC;
21502152
#elif defined TTYD_EU
2151-
uint32_t offset = 0x30C;
2153+
uint32_t HeldItemOffset = 0x30C;
2154+
uint32_t BadgeFlagOffsetStart = 0x2E4;
21522155
#endif
21532156

2154-
*reinterpret_cast<uint32_t *>(ActorAddress + offset) = 0;
2157+
// Clear the held item
2158+
*reinterpret_cast<int32_t *>(ActorAddress + HeldItemOffset) = 0;
2159+
2160+
// Do not clear the equipped badges for Mario or the partners
2161+
uint32_t CurrentActorId = *reinterpret_cast<uint32_t *>(ActorAddress + 0x8);
2162+
const uint32_t MarioId = 222;
2163+
const uint32_t MowzId = 230;
2164+
2165+
if ((CurrentActorId >= MarioId) &&
2166+
(CurrentActorId <= MowzId))
2167+
{
2168+
break;
2169+
}
2170+
2171+
// Clear all of the currently equipped badges
2172+
clearMemory(reinterpret_cast<void *>(ActorAddress + BadgeFlagOffsetStart), 0x28);
21552173
break;
21562174
}
21572175
case CHANGE_ACTOR_STATUSES:

0 commit comments

Comments
 (0)