dungeon menu moves done

This commit is contained in:
DizzyEggg 2025-03-03 14:46:42 +01:00
parent 1f610267fe
commit e670716324
11 changed files with 285 additions and 350 deletions

View File

@ -7,89 +7,6 @@
thumb_func_start sub_8064310
sub_8064310:
push {r4,lr}
adds r4, r0, 0
ldr r1, _08064350
movs r0, 0
str r0, [r1]
movs r0, 0x22
movs r1, 0
bl sub_8044F5C
movs r0, 0x21
movs r1, 0
bl sub_8044F5C
ldr r0, _08064354
ldr r1, [r0]
adds r0, r4, 0
bl sub_8064358
lsls r0, 24
cmp r0, 0
bne _08064340
movs r0, 0x21
bl sub_8044FF0
_08064340:
movs r0, 0x1D
movs r1, 0
bl sub_8044F5C
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08064350: .4byte gDungeonSubMenuItemsCount
_08064354: .4byte gUnknown_202F2D8
thumb_func_end sub_8064310
thumb_func_start sub_8064358
sub_8064358:
push {r4-r6,lr}
adds r3, r0, 0
adds r2, r1, 0
movs r5, 0
adds r2, 0x1
movs r4, 0
cmp r2, 0x7
bgt _0806439C
lsls r0, r2, 3
adds r0, r3, r0
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0806439C
movs r5, 0x1
adds r2, 0x1
movs r6, 0x2
lsls r0, r2, 3
adds r3, r0, r3
_08064380:
adds r4, 0x1
cmp r4, 0x7
bgt _0806439C
cmp r2, 0x7
bgt _0806439C
ldrb r1, [r3]
adds r0, r6, 0
ands r0, r1
cmp r0, 0
beq _0806439C
movs r5, 0x1
adds r3, 0x8
adds r2, 0x1
b _08064380
_0806439C:
cmp r5, 0
bne _080643A4
movs r0, 0
b _080643A6
_080643A4:
movs r0, 0x1
_080643A6:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8064358
thumb_func_start sub_80643AC
sub_80643AC:
@ -361,10 +278,10 @@ sub_80645D4:
str r0, [r1]
movs r0, 0x25
movs r1, 0
bl sub_8044F5C
bl AddActionToDungeonSubMenu
movs r0, 0xC
movs r1, 0
bl sub_8044F5C
bl AddActionToDungeonSubMenu
bl sub_8045064
pop {r0}
bx r0
@ -894,10 +811,10 @@ sub_8064A18:
str r0, [r1]
movs r0, 0x26
movs r1, 0
bl sub_8044F5C
bl AddActionToDungeonSubMenu
movs r0, 0xC
movs r1, 0
bl sub_8044F5C
bl AddActionToDungeonSubMenu
bl sub_8045064
pop {r0}
bx r0

View File

@ -24,11 +24,12 @@ enum DungeonAction
ACTION_CHANGE_TACTICS = 0x1A,
ACTION_CHECK_SUMMARY = 0x1B,
ACTION_TALK_MENU = 0x1C, // Talking to another Pokémon via the menu.
ACTION_UNK1D = 0x1D,
ACTION_MOVE_INFO = 0x1D,
ACTION_SET_MOVE = 0x1E, // Registering a move.
ACTION_UNK1F = 0x1F,
ACTION_UNK20 = 0x20,
ACTION_UNK21 = 0x21,
ACTION_SWITCH_AI_MOVE = 0x1F,
ACTION_LINK_MOVES = 0x20,
ACTION_DELINK_MOVES = 0x21,
ACTION_UNK22 = 0x22,
ACTION_EAT_AI = 0x23,
ACTION_THROW_ITEM_AI = 0x24,
ACTION_STEPPED_ON_TRAP = 0x25,

View File

@ -6,6 +6,13 @@
#include "structs/subStruct_203B240.h"
void ShowMovesFromTeamMenu(ActionContainer *a0);
bool8 ShowDungeonMovesMenu(Entity * entity, bool8 addLinkOptions, bool8 addUseMove, s32 a3, s32 a4);
void ActionShowMoveInfo(ActionContainer *a0);
void ShowStatusDescriptionMenu(struct subStruct_203B240 *status, MenuInputStructSub *menuSub);
void ActionSetOrUnsetMove(ActionContainer *a0, bool8 flagToSet);
void ActionToggleMoveUsableForAi(ActionContainer *a0);
void ActionLinkMoves(ActionContainer *a0);
void ActionDelinkMoves(ActionContainer *a0, bool8 showMsg);
bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBPress);
#endif

View File

@ -185,44 +185,44 @@ bool8 CanSubMenuItemBeChosen(s32 itemId)
return gDungeonSubMenu[itemId].canBeChosen;
}
void sub_8044F5C(u16 param_1, u8 param_2)
void AddActionToDungeonSubMenu(u16 actionId, u8 param_2)
{
int index;
if (gDungeonSubMenuItemsCount < 10) {
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == param_1) {
if (gDungeonSubMenu[index].actionId == actionId) {
return;
}
}
gDungeonSubMenu[gDungeonSubMenuItemsCount].actionId = param_1;
gDungeonSubMenu[gDungeonSubMenuItemsCount].actionId = actionId;
gDungeonSubMenu[gDungeonSubMenuItemsCount].unk2 = param_2;
gDungeonSubMenu[gDungeonSubMenuItemsCount].canBeChosen = TRUE;
gDungeonSubMenuItemsCount++;
}
}
s32 sub_8044FB4(u16 param_1)
s32 ActionToDungeonSubMenuId(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == param_1) {
if (gDungeonSubMenu[index].actionId == actionId) {
return index;
}
}
return -1;
}
void sub_8044FF0(u16 param_1)
void SetActionUnusableInDungeonSubMenu(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == param_1) {
if (gDungeonSubMenu[index].actionId == actionId) {
gDungeonSubMenu[index].canBeChosen = FALSE;
return;
}

View File

@ -28,6 +28,7 @@
#include "structs/str_position.h"
#include "dungeon_config.h"
#include "dungeon_menu_team.h"
#include "dungeon_menu_moves.h"
extern s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS];
@ -69,12 +70,8 @@ extern void sub_8078B5C(Entity *, Entity *, u32, u32, u32);
extern u8 sub_806A538(s32);
extern void sub_8051E7C(Entity *pokemon);
extern void sub_8045BF8(u8 *, Item *);
extern void sub_8063B54(ActionContainer *);
extern void sub_80637E8(ActionContainer *);
extern void sub_8063BB4(ActionContainer *);
extern void sub_8063CF0(ActionContainer *, u32);
extern void sub_8063A70(ActionContainer *, u32);
extern u8 ShowDungeonMovesMenu(Entity *, u32, u32, u32, u32);
extern void ActionShowMoveInfo(ActionContainer *);
extern void ActionLinkMoves(ActionContainer *);
extern void sub_8044DF0(Entity *, u32, u32);
extern void sub_803EAF0(u32, u32);
extern void SetLeaderActionToNothing(bool8);
@ -932,27 +929,27 @@ bool8 sub_8048B9C(Entity *entity, Item *item)
originalAction = *entityActionPtr;
goto LOOP_MIDDLE; // Needed to match
while (1) {
if (entityActionPtr->action == ACTION_UNK1D) {
sub_80637E8(entityActionPtr);
if (entityActionPtr->action == ACTION_MOVE_INFO) {
ActionShowMoveInfo(entityActionPtr);
}
else if (entityActionPtr->action == ACTION_UNK20) {
else if (entityActionPtr->action == ACTION_LINK_MOVES) {
sub_803EAF0(0,0);
sub_8063BB4(entityActionPtr);
ActionLinkMoves(entityActionPtr);
SetLeaderActionToNothing(TRUE);
ret = TRUE;
}
else if (entityActionPtr->action == ACTION_UNK21) {
else if (entityActionPtr->action == ACTION_DELINK_MOVES) {
sub_803EAF0(0,0);
sub_8063CF0(entityActionPtr,0);
ActionDelinkMoves(entityActionPtr,0);
SetLeaderActionToNothing(TRUE);
}
else if ((entityActionPtr->action == ACTION_SET_MOVE) || (entityActionPtr->action == ACTION_UNSET_MOVE)) {
sub_803EAF0(0,0);
sub_8063A70(entityActionPtr,0);
ActionSetOrUnsetMove(entityActionPtr, FALSE);
}
else if (entityActionPtr->action == ACTION_UNK1F) {
else if (entityActionPtr->action == ACTION_SWITCH_AI_MOVE) {
sub_803EAF0(0,0);
sub_8063B54(entityActionPtr);
ActionToggleMoveUsableForAi(entityActionPtr);
}
LOOP_MIDDLE:

View File

@ -91,9 +91,9 @@ extern bool8 sub_8045888(Entity *);
extern Item *sub_8044D90(Entity *, s32, u32);
void sub_8045BF8(u8 *, Item *);
u8 sub_8048D50();
void sub_8044FF0(u16 param_1);
void SetActionUnusableInDungeonSubMenu(u16 param_1);
u8 * sub_80464AC();
void sub_8044F5C(u16 param_1, u8 param_2);
void AddActionToDungeonSubMenu(u16 param_1, u8 param_2);
void sub_8044DF0();
void sub_8042208(Entity *pokemon, u8 r1);
void sub_803E708();
@ -1125,20 +1125,20 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, PokemonStruct1 **a3)
r10 = gDungeonMenu.menuIndex;
arrId = gUnknown_202F30C + r10;
gDungeonSubMenuItemsCount = 0;
sub_8044F5C(0x29, 0);
sub_8044F5C(0x2A, 0);
sub_8044F5C(0x40, 0);
AddActionToDungeonSubMenu(0x29, 0);
AddActionToDungeonSubMenu(0x2A, 0);
AddActionToDungeonSubMenu(0x40, 0);
if (a3[arrId]->unk0 & 0x8000) {
sub_8044FF0(0x29);
SetActionUnusableInDungeonSubMenu(0x29);
}
else {
sub_8044FF0(0x2A);
SetActionUnusableInDungeonSubMenu(0x2A);
}
// This unnecessary variable is required to match.
locIdIsPartner = DUNGEON_JOIN_LOCATION_PARTNER;
if (a3[arrId]->isTeamLeader || (a3[arrId]->dungeonLocation.id == DUNGEON_JOIN_LOCATION_LEADER || a3[arrId]->dungeonLocation.id == locIdIsPartner)) {
sub_8044FF0(0x29);
SetActionUnusableInDungeonSubMenu(0x29);
}
sub_8045064();

View File

@ -90,17 +90,11 @@ bool8 sub_8044B28(void);
bool8 IsNotAttacking(Entity *param_1, bool8 param_2);
s32 GetTeamMemberEntityIndex(Entity *pokemon);
bool8 sub_8070F80(Entity * pokemon, s32 direction);
void sub_80637E8(ActionContainer *a0);
void sub_8063B54(ActionContainer *a0);
void sub_8063BB4(ActionContainer *a0);
void sub_806752C(ActionContainer *a0);
void sub_8063A70(ActionContainer *a0, bool8 a1);
void sub_8063CF0(ActionContainer *a0, bool8 a1);
void sub_8067768(ActionContainer *a0);
void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3);
extern bool8 sub_8071A8C(Entity *pokemon);
extern void sub_80643AC(Entity *pokemon);
extern bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4);
extern void GetWeatherName(u8 *dst, u8 weatherId);
extern bool8 sub_8070F14(Entity * pokemon, s32 direction);
extern Entity *sub_80696A8(Entity *a0);
@ -1368,7 +1362,6 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
}
}
while (1) {
SetLeaderActionToNothing(0);
LOOP_START_NO_CALL: // Actions 6 and 7 don't call SetLeaderActionToNothing
@ -1429,20 +1422,20 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
}
goto LOOP_START_NO_CALL;
}
else if (GetLeaderActionId() == ACTION_UNK1D) {
sub_80637E8(GetLeaderActionContainer());
else if (GetLeaderActionId() == ACTION_MOVE_INFO) {
ActionShowMoveInfo(GetLeaderActionContainer());
}
else if (GetLeaderActionId() == ACTION_SET_MOVE || GetLeaderActionId() == ACTION_UNSET_MOVE) {
sub_8063A70(GetLeaderActionContainer(), FALSE);
ActionSetOrUnsetMove(GetLeaderActionContainer(), FALSE);
}
else if (GetLeaderActionId() == ACTION_UNK1F) {
sub_8063B54(GetLeaderActionContainer());
else if (GetLeaderActionId() == ACTION_SWITCH_AI_MOVE) {
ActionToggleMoveUsableForAi(GetLeaderActionContainer());
}
else if (GetLeaderActionId() == ACTION_UNK20) {
sub_8063BB4(GetLeaderActionContainer());
else if (GetLeaderActionId() == ACTION_LINK_MOVES) {
ActionLinkMoves(GetLeaderActionContainer());
}
else if (GetLeaderActionId() == ACTION_UNK21) {
sub_8063CF0(GetLeaderActionContainer(), FALSE);
else if (GetLeaderActionId() == ACTION_DELINK_MOVES) {
ActionDelinkMoves(GetLeaderActionContainer(), FALSE);
}
else {
break;

View File

@ -54,8 +54,8 @@ extern s32 gDungeonSubMenuItemsCount;
extern const u8 gUnknown_8106B50[];
extern void DungeonShowWindows(WindowTemplates *a0, u8 a1);
extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3);
extern void sub_8044F5C(u16 param_1, u8 param_2);
extern void sub_8044FF0(u16 param_1);
extern void AddActionToDungeonSubMenu(u16 param_1, u8 param_2);
extern void SetActionUnusableInDungeonSubMenu(u16 param_1);
extern u16 sub_8044DC8(Item *param_1);
extern bool8 sub_8046F00(Item *item);
extern void sub_8045064(void);
@ -609,7 +609,7 @@ static void sub_8060900(Entity *a0)
gDungeonSubMenuItemsCount = 0;
if (sUnknownActionUnk4.actionUseIndex < 144) {
if (sUnknownActionUnk4.actionUseIndex == 128) {
sub_8044F5C(9, item->id);
AddActionToDungeonSubMenu(9, item->id);
if (GetItemCategory(item->id) != CATEGORY_POKE) {
bool32 r2 = 0;
if (gDungeon->unk644.unk17 != 0) {
@ -622,21 +622,21 @@ static void sub_8060900(Entity *a0)
}
if (r2) {
sub_8044FF0(9);
SetActionUnusableInDungeonSubMenu(9);
}
}
}
if (sUnknownActionUnk4.actionUseIndex == 128 && gDungeon->unk644.unk17 != 0) {
sub_8044F5C(10, item->id);
AddActionToDungeonSubMenu(10, item->id);
}
val_sub8044DC8 = sub_8044DC8(item);
if (val_sub8044DC8 != 0) {
sub_8044F5C(val_sub8044DC8, item->id);
AddActionToDungeonSubMenu(val_sub8044DC8, item->id);
if (item->flags & ITEM_FLAG_STICKY) {
sub_8044FF0(val_sub8044DC8);
SetActionUnusableInDungeonSubMenu(val_sub8044DC8);
}
if (!sub_8046F00(item)) {
sub_8044FF0(val_sub8044DC8);
SetActionUnusableInDungeonSubMenu(val_sub8044DC8);
}
}
@ -646,10 +646,10 @@ static void sub_8060900(Entity *a0)
s32 i;
if (ItemSet(item)) {
sub_8044F5C(0x3D, item->id);
AddActionToDungeonSubMenu(0x3D, item->id);
}
else {
sub_8044F5C(0x3C, item->id);
AddActionToDungeonSubMenu(0x3C, item->id);
}
for (i = 0; i < INVENTORY_SIZE; i++) {
@ -657,8 +657,8 @@ static void sub_8060900(Entity *a0)
&& ItemSet(&gTeamInventoryRef->teamItems[i])
&& ItemSticky(&gTeamInventoryRef->teamItems[i]))
{
sub_8044FF0(0x3C);
sub_8044FF0(0x3D);
SetActionUnusableInDungeonSubMenu(0x3C);
SetActionUnusableInDungeonSubMenu(0x3D);
break;
}
}
@ -669,7 +669,7 @@ static void sub_8060900(Entity *a0)
s32 i;
bool32 r8 = FALSE;
sub_8044F5C(0x36, item->id);
AddActionToDungeonSubMenu(0x36, item->id);
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
Entity *teamMon = gDungeon->teamPokemon[i];
if (EntityIsValid(teamMon)) {
@ -682,48 +682,48 @@ static void sub_8060900(Entity *a0)
}
}
if (!r8) {
sub_8044FF0(0x36);
SetActionUnusableInDungeonSubMenu(0x36);
}
}
}
else if (gDungeon->unk644.unk17) {
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS) {
sub_8044F5C(0x3E, item->id);
AddActionToDungeonSubMenu(0x3E, item->id);
}
else {
sub_8044F5C(0x37, item->id);
AddActionToDungeonSubMenu(0x37, item->id);
}
if (CheckVariousConditions(a0)) {
sub_8044FF0(0x37);
sub_8044FF0(0x3E);
SetActionUnusableInDungeonSubMenu(0x37);
SetActionUnusableInDungeonSubMenu(0x3E);
}
}
if (sUnknownActionUnk4.actionUseIndex <= 20) {
Entity *tileEntity = GetTile(a0->pos.x, a0->pos.y)->object;
if (tileEntity == NULL) {
sub_8044F5C(8, item->id);
AddActionToDungeonSubMenu(8, item->id);
}
else if (GetEntityType(tileEntity) == ENTITY_ITEM) {
sub_8044F5C(0x3A, item->id);
AddActionToDungeonSubMenu(0x3A, item->id);
}
}
if (GetItemCategory(item->id) == CATEGORY_THROWN_LINE) {
sub_8044F5C(0x27, item->id);
AddActionToDungeonSubMenu(0x27, item->id);
}
else if (GetItemCategory(item->id) == CATEGORY_THROWN_ARC) {
sub_8044F5C(0x41, item->id);
AddActionToDungeonSubMenu(0x41, item->id);
}
else {
sub_8044F5C(0xB, item->id);
AddActionToDungeonSubMenu(0xB, item->id);
}
if (!MonsterCanThrowItems(a0Info)) {
sub_8044FF0(0x27);
sub_8044FF0(0x41);
sub_8044FF0(0xB);
SetActionUnusableInDungeonSubMenu(0x27);
SetActionUnusableInDungeonSubMenu(0x41);
SetActionUnusableInDungeonSubMenu(0xB);
}
}
else {
@ -749,40 +749,40 @@ static void sub_8060900(Entity *a0)
if (gDungeon->unk644.unk17) {
if (r4) {
sub_8044F5C(0x3E, item->id);
AddActionToDungeonSubMenu(0x3E, item->id);
}
else {
sub_8044F5C(0x37, item->id);
AddActionToDungeonSubMenu(0x37, item->id);
}
if (r6) {
sub_8044FF0(0x37);
sub_8044FF0(0x3E);
SetActionUnusableInDungeonSubMenu(0x37);
SetActionUnusableInDungeonSubMenu(0x3E);
}
}
if (teamMonInfo->isTeamLeader) {
val_sub8044DC8 = sub_8044DC8(item);
if (val_sub8044DC8 != 0) {
sub_8044F5C(val_sub8044DC8, item->id);
AddActionToDungeonSubMenu(val_sub8044DC8, item->id);
if (item->flags & ITEM_FLAG_STICKY) {
sub_8044FF0(val_sub8044DC8);
SetActionUnusableInDungeonSubMenu(val_sub8044DC8);
}
if (!sub_8046F00(item)) {
sub_8044FF0(val_sub8044DC8);
SetActionUnusableInDungeonSubMenu(val_sub8044DC8);
}
}
}
else {
sub_8044F5C(0x38, item->id);
AddActionToDungeonSubMenu(0x38, item->id);
if (r5) {
sub_8044FF0(0x38);
SetActionUnusableInDungeonSubMenu(0x38);
}
}
}
}
sub_8044F5C(0xC, item->id);
AddActionToDungeonSubMenu(0xC, item->id);
sub_8045064();
}

View File

@ -38,39 +38,46 @@ extern bool8 CanSubMenuItemBeChosen(s32 param_1);
extern void sub_8045064(void);
extern void sub_803EAF0(u32, u8 *);
extern void sub_803E708(s32 a0, s32 a1);
extern void sub_8044F5C(u16 param_1, u8 param_2);
extern void sub_8044FF0(u16 param_1);
extern void AddActionToDungeonSubMenu(u16 param_1, u8 param_2);
extern void SetActionUnusableInDungeonSubMenu(u16 param_1);
extern void DungeonShowWindows(WindowTemplates *a0, u8 a1);
extern s32 GetTeamMemberEntityIndex(Entity *pokemon);
extern u32 sub_8062D88(void);
extern void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3);
extern void SetLeaderActionToNothing(u8 a0);
extern void sub_80637E8(ActionContainer *a0);
extern void sub_8063B54(ActionContainer *a0);
extern void sub_806752C(ActionContainer *a0);
extern void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 a1);
extern void sub_8063A70(ActionContainer *a0, bool8 a1);
extern void sub_8063CF0(ActionContainer *a0, bool8 a1);
extern void sub_8067768(ActionContainer *a0);
extern void sub_806A2BC(Entity *a0, u8 a1);
extern bool8 sub_8071A8C(Entity *pokemon);
extern void sub_8083D1C(void);
extern s32 gDungeonSubMenuItemsCount;
extern MenuInputStruct gDungeonMenu;
extern s32 gUnknown_202F2D8;
extern s32 sub_8044FB4(u16 param_1);
extern s32 ActionToDungeonSubMenuId(u16 param_1);
extern const u8 *const gUnknown_80FE978;
extern const u8 *const gUnknown_80FDFE8;
extern const u8 *const gUnknown_80F8B40;
extern const u8 *const gUnknown_80F8B64;
extern const u8 *const gUnknown_80F8BB4;
extern const u8 *const gUnknown_80F8B88;
extern const u8 *const gUnknown_80FDF70;
extern const u8 *const gUnknown_80FDF00;
void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7);
void sub_8063698(Entity *entity, u8 a1, u8 a2);
void sub_80637BC(ActionContainer *a0, s32 a1, s32 a2);
void sub_80637A4(ActionContainer *a0, s32 a1);
void sub_8063578(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5);
bool8 sub_8063C88(EntityInfo *entInfo, s32 a1);
bool8 sub_8063DD4(EntityInfo *entInfo, s32 a1);
void sub_8063834(Move *moves, s32 a1, s32 a2);
static void ShowMovesMenuWindows(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7);
static void AddSubMenuOptions(Entity *entity, bool8 addLinkOptions, bool8 addUseMove);
static void SetSubMenuOptionAction(ActionContainer *a0, s32 a1, s32 a2);
static void MenuChosenOptionToAction(ActionContainer *a0, s32 a1);
static void PrintMoveNamesOnWindow(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5);
static bool8 IsMoveLinkedAndNotCharging(EntityInfo *entInfo, s32 moveId_);
static bool8 IsMoveLinked(EntityInfo *entInfo, s32 id);
static void ShowMovesInfoWindow(Move *moves, s32 firstMoveId, s32 movesCount);
static void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header);
static void sub_8064310(Move *moves);
static bool8 sub_8064358(Move *moves, s32 id);
EWRAM_DATA static WindowTemplates sMovesMenuWindows = {0};
EWRAM_DATA static s32 sChosenMoveSlotId = 0;
// Needed to match some functions.
static inline u32 CheckPressed(u32 button)
@ -80,7 +87,8 @@ static inline u32 CheckPressed(u32 button)
return check;
}
u32 sub_8062D88(void)
// In Blue it's 0x401, so A_BUTTON + 0x400 whatever that is
static u32 GetConfirmationButtons(void)
{
return A_BUTTON;
}
@ -149,28 +157,28 @@ void ShowMovesFromTeamMenu(ActionContainer *a0)
}
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_UNK1D) {
sub_80637E8(GetLeaderActionContainer());
else if (GetLeaderActionId() == ACTION_MOVE_INFO) {
ActionShowMoveInfo(GetLeaderActionContainer());
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_SET_MOVE) {
sub_803EAF0(0, NULL);
sub_8063A70(GetLeaderActionContainer(), TRUE);
ActionSetOrUnsetMove(GetLeaderActionContainer(), TRUE);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_UNSET_MOVE) {
sub_803EAF0(0, NULL);
sub_8063A70(GetLeaderActionContainer(), FALSE);
ActionSetOrUnsetMove(GetLeaderActionContainer(), FALSE);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_UNK1F) {
else if (GetLeaderActionId() == ACTION_SWITCH_AI_MOVE) {
sub_803EAF0(0, NULL);
sub_8063B54(GetLeaderActionContainer());
ActionToggleMoveUsableForAi(GetLeaderActionContainer());
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_UNK21) {
else if (GetLeaderActionId() == ACTION_DELINK_MOVES) {
sub_803EAF0(0, NULL);
sub_8063CF0(GetLeaderActionContainer(), TRUE);
ActionDelinkMoves(GetLeaderActionContainer(), TRUE);
SetLeaderActionToNothing(TRUE);
}
@ -182,7 +190,7 @@ void ShowMovesFromTeamMenu(ActionContainer *a0)
ChangeDungeonCameraPos(&entityOrg->pos, 0, 1, 1);
}
bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
bool8 ShowDungeonMovesMenu(Entity * entity, bool8 addLinkOptions, bool8 addUseMove, s32 a3, s32 a4)
{
s32 i;
bool8 ret;
@ -211,13 +219,13 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
s32 r5;
bool8 bPress;
gUnknown_202F2D8 = 0;
sChosenMoveSlotId = 0;
for (i = 0; i < MAX_MON_MOVES; i++) {
Move *move = &entInfo->moves.moves[i];
if (MoveFlagExists(move) && move->moveFlags2 & 2) {
move->moveFlags2 &= ~(2);
gUnknown_202F2D8 = i;
sChosenMoveSlotId = i;
}
}
@ -225,7 +233,7 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
r5 = 0;
ret = FALSE;
r10 = FALSE;
sub_80633E4(entity, entInfo, a1, &windows, &header, unk, a3, a4);
ShowMovesMenuWindows(entity, entInfo, addLinkOptions, &windows, &header, unk, a3, a4);
while (1) {
AddMenuCursorSprite_(&gDungeonMenu, unk);
DungeonRunFrameActions(0x1E);
@ -234,8 +242,8 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
s32 id = gDungeonMenu.menuIndex;
if (rHeld) {
gUnknown_202F2D8 = unk_SetMoveToLastInLinkedSequence4(entInfo->moves.moves, id);
if (id != gUnknown_202F2D8) {
sChosenMoveSlotId = unk_SetMoveToLastInLinkedSequence4(entInfo->moves.moves, id);
if (id != sChosenMoveSlotId) {
PlayDungeonCursorSE(0);
}
else {
@ -256,8 +264,8 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
s32 id = gDungeonMenu.menuIndex;
if (rHeld) {
gUnknown_202F2D8 = unk_SetMoveToFirstInLinkedSequence4(entInfo->moves.moves, id);
if (id != gUnknown_202F2D8) {
sChosenMoveSlotId = unk_SetMoveToFirstInLinkedSequence4(entInfo->moves.moves, id);
if (id != sChosenMoveSlotId) {
PlayDungeonCursorSE(0);
}
else {
@ -283,8 +291,8 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
break;
}
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
if (a1) {
if ((gRealInputs.pressed & GetConfirmationButtons()) || gDungeonMenu.unk28.a_button) {
if (addLinkOptions) {
bool8 rHeld = (gRealInputs.held & R_BUTTON) != 0;
if (rHeld) {
r5 = 3;
@ -324,51 +332,51 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
if (ret)
break;
gUnknown_202F2D8 = gDungeonMenu.menuIndex;
sChosenMoveSlotId = gDungeonMenu.menuIndex;
if (r5 == 1) {
SetMonsterActionFields(&leaderInfo->action, 0x1D);
leaderInfo->action.actionParameters[0].actionUseIndex = entity->unk24;
leaderInfo->action.actionParameters[1].actionUseIndex = gUnknown_202F2D8;
leaderInfo->action.actionParameters[1].actionUseIndex = sChosenMoveSlotId;
sub_803EAF0(0, NULL);
sub_803E708(8, 0x1B);
ret = FALSE;
break;
}
sub_8063698(entity, a1, a2);
AddSubMenuOptions(entity, addLinkOptions, addUseMove);
if (r5 == 3) {
s32 r6 = sub_8044FB4(0x20);
if (!CanSubMenuItemBeChosen(r6)) {
r6 = sub_8044FB4(0x21);
if (CanSubMenuItemBeChosen(r6)) {
sub_80637BC(&leaderInfo->action, r6, GetTeamMemberEntityIndex(entity));
s32 subMenuId = ActionToDungeonSubMenuId(ACTION_LINK_MOVES);
if (!CanSubMenuItemBeChosen(subMenuId)) {
subMenuId = ActionToDungeonSubMenuId(ACTION_DELINK_MOVES);
if (CanSubMenuItemBeChosen(subMenuId)) {
SetSubMenuOptionAction(&leaderInfo->action, subMenuId, GetTeamMemberEntityIndex(entity));
break;
}
}
else {
sub_80637BC(&leaderInfo->action, r6, GetTeamMemberEntityIndex(entity));
SetSubMenuOptionAction(&leaderInfo->action, subMenuId, GetTeamMemberEntityIndex(entity));
break;
}
}
else if (r5 == 2) {
if (entInfo->isTeamLeader) {
s32 r6 = sub_8044FB4(0x1E);
if (!CanSubMenuItemBeChosen(r6)) {
r6 = sub_8044FB4(0x33);
if (CanSubMenuItemBeChosen(r6)) {
sub_80637BC(&leaderInfo->action, r6, GetTeamMemberEntityIndex(entity));
s32 subMenuId = ActionToDungeonSubMenuId(ACTION_SET_MOVE);
if (!CanSubMenuItemBeChosen(subMenuId)) {
subMenuId = ActionToDungeonSubMenuId(ACTION_UNSET_MOVE);
if (CanSubMenuItemBeChosen(subMenuId)) {
SetSubMenuOptionAction(&leaderInfo->action, subMenuId, GetTeamMemberEntityIndex(entity));
break;
}
}
else {
sub_80637BC(&leaderInfo->action, r6, GetTeamMemberEntityIndex(entity));
SetSubMenuOptionAction(&leaderInfo->action, subMenuId, GetTeamMemberEntityIndex(entity));
break;
}
}
else {
s32 r6 = sub_8044FB4(0x1F);
if (CanSubMenuItemBeChosen(r6)) {
sub_80637BC(&leaderInfo->action, r6, GetTeamMemberEntityIndex(entity));
s32 subMenuId = ActionToDungeonSubMenuId(ACTION_SWITCH_AI_MOVE);
if (CanSubMenuItemBeChosen(subMenuId)) {
SetSubMenuOptionAction(&leaderInfo->action, subMenuId, GetTeamMemberEntityIndex(entity));
break;
}
}
@ -388,9 +396,9 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
MoveMenuCursorUpWrapAround(&gDungeonMenu, TRUE);
}
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
if ((gRealInputs.pressed & GetConfirmationButtons()) || gDungeonMenu.unk28.a_button) {
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
sub_80637A4(&leaderInfo->action, GetTeamMemberEntityIndex(entity));
MenuChosenOptionToAction(&leaderInfo->action, GetTeamMemberEntityIndex(entity));
if (leaderInfo->action.action != 20 && leaderInfo->action.action != 21) {
PlayDungeonConfirmationSE();
}
@ -422,7 +430,7 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
return ret;
}
void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7)
static void ShowMovesMenuWindows(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7)
{
s32 i, movesCount;
WindowTemplate windowNew = {
@ -447,7 +455,7 @@ void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *wi
}
}
gDungeonMenu.menuIndex = gUnknown_202F2D8;
gDungeonMenu.menuIndex = sChosenMoveSlotId;
gDungeonMenu.unk1A = movesCount;
gDungeonMenu.unk1C = 4;
gDungeonMenu.unk1E = arg6;
@ -482,13 +490,13 @@ void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *wi
}
}
sub_8063578(4, entity, entInfo->moves.moves, 0, a2, arg6);
PrintMoveNamesOnWindow(4, entity, entInfo->moves.moves, 0, a2, arg6);
sub_80073B8(2);
PrintFormattedStringOnWindow(4, 0, gUnknown_80FDFE8, 2, '\0');
sub_80073E0(2);
}
void sub_8063578(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5)
static void PrintMoveNamesOnWindow(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5)
{
s32 i;
EntityInfo *entInfo = GetEntInfo(entity);
@ -528,85 +536,85 @@ void sub_8063578(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s3
sub_80073E0(windowId);
}
void sub_8063698(Entity *entity, u8 a1, u8 a2)
static void AddSubMenuOptions(Entity *entity, bool8 addLinkOptions, bool8 addUseMove)
{
EntityInfo *entInfo = GetEntInfo(entity);
Move *move = &entInfo->moves.moves[gUnknown_202F2D8];
Move *move = &entInfo->moves.moves[sChosenMoveSlotId];
gDungeonSubMenuItemsCount = 0;
if (entInfo->isTeamLeader) {
if (a2) {
sub_8044F5C(0x14, 0);
if (addUseMove) {
AddActionToDungeonSubMenu(ACTION_USE_MOVE_PLAYER, 0);
}
if (MoveFlagExists(move)) {
if (MoveFlagSet(move)) {
sub_8044F5C(0x33, 0);
AddActionToDungeonSubMenu(ACTION_UNSET_MOVE, 0);
}
else {
sub_8044F5C(0x1E, 0);
AddActionToDungeonSubMenu(ACTION_SET_MOVE, 0);
}
}
}
else {
sub_8044F5C(0x1F, 0);
AddActionToDungeonSubMenu(ACTION_SWITCH_AI_MOVE, 0);
}
if (a1) {
sub_8044F5C(0x20, 0);
sub_8044F5C(0x21, 0);
if (addLinkOptions) {
AddActionToDungeonSubMenu(ACTION_LINK_MOVES, 0);
AddActionToDungeonSubMenu(ACTION_DELINK_MOVES, 0);
}
sub_8044F5C(0x1D, 0);
if (!a1) {
sub_8044FF0(0x20);
AddActionToDungeonSubMenu(ACTION_MOVE_INFO, 0);
if (!addLinkOptions) {
SetActionUnusableInDungeonSubMenu(ACTION_LINK_MOVES);
}
else {
if (!sub_8063C88(entInfo, gUnknown_202F2D8)) {
sub_8044FF0(0x20);
if (!IsMoveLinkedAndNotCharging(entInfo, sChosenMoveSlotId)) {
SetActionUnusableInDungeonSubMenu(ACTION_LINK_MOVES);
}
if (!sub_8063DD4(entInfo, gUnknown_202F2D8)) {
sub_8044FF0(0x21);
if (!IsMoveLinked(entInfo, sChosenMoveSlotId)) {
SetActionUnusableInDungeonSubMenu(ACTION_DELINK_MOVES);
}
}
if (!sub_8063DD4(entInfo, gUnknown_202F2D8)) {
sub_8044FF0(0x21);
if (!IsMoveLinked(entInfo, sChosenMoveSlotId)) {
SetActionUnusableInDungeonSubMenu(ACTION_DELINK_MOVES);
}
if (a2) {
bool8 unkBool = FALSE;
if (gUnknown_202F2D8 < MAX_MON_MOVES) {
unkBool = CanAIUseMove(entity, gUnknown_202F2D8, TRUE) != FALSE;
if (addUseMove) {
bool8 moveUnusable = FALSE;
if (sChosenMoveSlotId < MAX_MON_MOVES) {
moveUnusable = CanAIUseMove(entity, sChosenMoveSlotId, TRUE) != FALSE;
}
if (!unkBool) {
sub_8044FF0(0x14);
if (!moveUnusable) {
SetActionUnusableInDungeonSubMenu(ACTION_USE_MOVE_PLAYER);
}
}
sub_8045064();
}
void sub_80637A4(ActionContainer *a0, s32 a1)
static void MenuChosenOptionToAction(ActionContainer *a0, s32 teamId)
{
sub_80637BC(a0, gDungeonMenu.menuIndex, a1);
SetSubMenuOptionAction(a0, gDungeonMenu.menuIndex, teamId);
}
void sub_80637BC(ActionContainer *a0, s32 a1, s32 a2)
static void SetSubMenuOptionAction(ActionContainer *a0, s32 subMenuOptionId, s32 teamId)
{
SetMonsterActionFields(a0, gDungeonSubMenu[a1].actionId);
a0->actionParameters[0].actionUseIndex = a2;
a0->actionParameters[1].actionUseIndex = gUnknown_202F2D8;
SetMonsterActionFields(a0, gDungeonSubMenu[subMenuOptionId].actionId);
a0->actionParameters[0].actionUseIndex = teamId;
a0->actionParameters[1].actionUseIndex = sChosenMoveSlotId;
}
void sub_80637E8(ActionContainer *a0)
void ActionShowMoveInfo(ActionContainer *a0)
{
Entity *mon = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
EntityInfo *monInfo = GetEntInfo(mon);
monInfo->moves.moves[a0->actionParameters[1].actionUseIndex].moveFlags2 |= 2;
sub_8063834(monInfo->moves.moves, a0->actionParameters[1].actionUseIndex, 4);
ShowMovesInfoWindow(monInfo->moves.moves, a0->actionParameters[1].actionUseIndex, MAX_MON_MOVES);
}
void sub_8063834(Move *moves, s32 a1, s32 a2)
static void ShowMovesInfoWindow(Move *moves, s32 firstMoveId, s32 movesCount)
{
WindowTemplates windows;
WindowHeader header;
@ -617,7 +625,7 @@ void sub_8063834(Move *moves, s32 a1, s32 a2)
windows.id[0].header = &header;
count = 1;
for (i = a1 + 1; i < a2; i++) {
for (i = firstMoveId + 1; i < movesCount; i++) {
if (!MoveFlagExists(&moves[i]))
break;
if (!MoveFlagLinkChain(&moves[i]))
@ -648,7 +656,7 @@ void sub_8063834(Move *moves, s32 a1, s32 a2)
gDungeonMenu.unk1A = 0;
gDungeonMenu.unk1C = 0;
DungeonShowWindows(&windows, TRUE);
statusesCount = unk_PrintMoveDescription(currId, &moves[a1 + currId], 0, statuses);
statusesCount = unk_PrintMoveDescription(currId, &moves[firstMoveId + currId], 0, statuses);
while (1) {
if (statusesCount != 0) {
ShowStatusDescriptionMenuArrow();
@ -657,7 +665,7 @@ void sub_8063834(Move *moves, s32 a1, s32 a2)
nullsub_34(&gDungeonMenu.unk28, 0);
DungeonRunFrameActions(0x1C);
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
if ((gRealInputs.pressed & GetConfirmationButtons()) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
inputAction = 1;
if (statusesCount != 0) {
@ -708,8 +716,6 @@ void sub_8063834(Move *moves, s32 a1, s32 a2)
sub_803EAF0(0, 0);
}
extern WindowTemplates gUnknown_202F278;
static const WindowHeader sStatusDescriptionHeader = {
.count = 1,
.width = 16,
@ -717,9 +723,9 @@ static const WindowHeader sStatusDescriptionHeader = {
void ShowStatusDescriptionMenu(struct subStruct_203B240 *status, MenuInputStructSub *menuSub)
{
sub_80140B4(&gUnknown_202F278);
gUnknown_202F278.id[0].header = &sStatusDescriptionHeader;
DungeonShowWindows(&gUnknown_202F278, TRUE);
sub_80140B4(&sMovesMenuWindows);
sMovesMenuWindows.id[0].header = &sStatusDescriptionHeader;
DungeonShowWindows(&sMovesMenuWindows, TRUE);
sub_80073B8(0);
strcpy(gFormatBuffer_Monsters[0], status->pokeName);
@ -740,12 +746,7 @@ void ShowStatusDescriptionMenu(struct subStruct_203B240 *status, MenuInputStruct
sub_801317C(menuSub);
}
extern const u8 *const gUnknown_80F8B40;
extern const u8 *const gUnknown_80F8B64;
extern const u8 *const gUnknown_80F8BB4;
extern const u8 *const gUnknown_80F8B88;
void sub_8063A70(ActionContainer *a0, bool8 flagToSet)
void ActionSetOrUnsetMove(ActionContainer *a0, bool8 flagToSet)
{
s32 i;
Entity *entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
@ -777,7 +778,7 @@ void sub_8063A70(ActionContainer *a0, bool8 flagToSet)
}
}
void sub_8063B54(ActionContainer *a0)
void ActionToggleMoveUsableForAi(ActionContainer *a0)
{
Entity *entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
EntityInfo *entInfo = GetEntInfo(entity);
@ -790,7 +791,7 @@ void sub_8063B54(ActionContainer *a0)
PlaySoundEffect(0x133);
}
void sub_8063BB4(ActionContainer *a0)
void ActionLinkMoves(ActionContainer *a0)
{
s32 linkedCount;
Entity *entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
@ -821,11 +822,11 @@ void sub_8063BB4(ActionContainer *a0)
PlaySoundEffect(0x133);
}
bool8 sub_8063C88(EntityInfo *entInfo, s32 a1)
static bool8 IsMoveLinkedAndNotCharging(EntityInfo *entInfo, s32 moveId_)
{
s32 i;
bool8 ret = FALSE;
s32 moveId = a1;
s32 moveId = moveId_;
if (DoesMoveCharge(entInfo->moves.moves[moveId].id))
return FALSE;
@ -850,7 +851,7 @@ bool8 sub_8063C88(EntityInfo *entInfo, s32 a1)
return ret;
}
void sub_8063CF0(ActionContainer *a0, bool8 a1)
void ActionDelinkMoves(ActionContainer *a0, bool8 showMsg)
{
s32 linkedCount;
Entity *entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
@ -875,7 +876,7 @@ void sub_8063CF0(ActionContainer *a0, bool8 a1)
unk_FixLinkedMovesSetEnabled4(entInfo->moves.moves);
PlaySoundEffect(0x133);
if (a1) {
if (showMsg) {
if (unlInked) {
LogMessageByIdWithPopupCheckUser(entity, gUnknown_80F8B88);
}
@ -886,7 +887,7 @@ void sub_8063CF0(ActionContainer *a0, bool8 a1)
}
}
bool8 sub_8063DD4(EntityInfo *entInfo, s32 id)
static bool8 IsMoveLinked(EntityInfo *entInfo, s32 id)
{
bool8 linkFound = FALSE;
s32 linkedCount;
@ -909,7 +910,7 @@ bool8 sub_8063DD4(EntityInfo *entInfo, s32 id)
return FALSE;
}
void sub_8063E30(Move *moves, s32 id)
static void sub_8063E30(Move *moves, s32 id)
{
s32 i;
@ -926,14 +927,6 @@ void sub_8063E30(Move *moves, s32 id)
unk_FixLinkedMovesSetEnabled8(moves);
}
extern void sub_8083D1C(void);
void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header);
void sub_8064310(Move *moves);
extern const u8 *const gUnknown_80FDF70;
extern const u8 *const gUnknown_80FDF00;
static inline void ResetMoveFlags(Move *move)
{
move->moveFlags = 0;
@ -961,7 +954,7 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
};
Move movesLocal[8];
gUnknown_202F2D8 = 0;
sChosenMoveSlotId = 0;
while (1) {
s32 inputAction;
s32 yesNoAnswer;
@ -986,8 +979,8 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
PlayDungeonCursorSE(FALSE);
}
}
ASM_MATCH_TRICK(gUnknown_202F2D8);
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
ASM_MATCH_TRICK(sChosenMoveSlotId);
if ((gRealInputs.pressed & GetConfirmationButtons()) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
inputAction = 0;
break;
@ -1007,16 +1000,16 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x1E);
if (inputAction == 1) {
gUnknown_202F2D8 = -1;
sChosenMoveSlotId = -1;
}
else {
gUnknown_202F2D8 = gDungeonMenu.menuIndex;
sChosenMoveSlotId = gDungeonMenu.menuIndex;
if (inputAction == 2) {
sub_803EAF0(0, 0);
sub_803E708(8, 0x1B);
ASM_MATCH_TRICK(gUnknown_202F2D8);
sub_8063834(moves, gUnknown_202F2D8, 4);
ASM_MATCH_TRICK(sChosenMoveSlotId);
ShowMovesInfoWindow(moves, sChosenMoveSlotId, MAX_MON_MOVES);
continue;
}
@ -1036,7 +1029,7 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
MoveMenuCursorUpWrapAround(&gDungeonMenu, TRUE);
}
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
if ((gRealInputs.pressed & GetConfirmationButtons()) || gDungeonMenu.unk28.a_button) {
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
if (gDungeonMenu.menuIndex == 2) {
PlayDungeonConfirmationSE();
@ -1062,22 +1055,22 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
if (inputAction == 1)
continue;
if (gDungeonMenu.menuIndex == 1) {
sub_8063E30(moves, gUnknown_202F2D8);
sub_8063E30(moves, sChosenMoveSlotId);
continue;
}
if (gDungeonMenu.menuIndex == 2) {
sub_8063834(moves, gUnknown_202F2D8, 8);
ShowMovesInfoWindow(moves, sChosenMoveSlotId, 8);
continue;
}
}
if (gUnknown_202F2D8 < 0)
if (sChosenMoveSlotId < 0)
break;
if (showYesNoBox) {
bool8 linked = FALSE;
Move *move = &moves[gUnknown_202F2D8];
s32 nextMoveId = gUnknown_202F2D8 + 1;
Move *move = &moves[sChosenMoveSlotId];
s32 nextMoveId = sChosenMoveSlotId + 1;
if (nextMoveId < 8 && MoveFlagExists(&moves[nextMoveId])) {
linked = MoveFlagLinkChain(&moves[nextMoveId]) != 0;
@ -1090,8 +1083,8 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
}
if (yesNoAnswer == 1) {
moves[gUnknown_202F2D8].moveFlags = 0;
for (i = gUnknown_202F2D8 + 1; i < 8; i++) {
moves[sChosenMoveSlotId].moveFlags = 0;
for (i = sChosenMoveSlotId + 1; i < 8; i++) {
Move *move = &moves[i];
if (!MoveFlagExists(move))
break;
@ -1121,13 +1114,13 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP
}
}
if (gUnknown_202F2D8 < 0)
if (sChosenMoveSlotId < 0)
return FALSE;
return TRUE;
}
void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header)
static void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header)
{
s32 i, count;
@ -1142,7 +1135,7 @@ void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHe
}
}
gDungeonMenu.menuIndex = gUnknown_202F2D8;
gDungeonMenu.menuIndex = sChosenMoveSlotId;
gDungeonMenu.unk1A = count;
gDungeonMenu.unk1C = count;
gDungeonMenu.unk1E = 0;
@ -1162,8 +1155,39 @@ void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHe
DungeonShowWindows(windows, TRUE);
sub_80137B0(&gDungeonMenu, 0);
SetMessageArgument_2(gFormatBuffer_Monsters[0], GetEntInfo(entity), 0);
sub_8063578(count, entity, moves, 0, 0, 0);
PrintMoveNamesOnWindow(count, entity, moves, 0, 0, 0);
}
static void sub_8064310(Move *moves)
{
gDungeonSubMenuItemsCount = 0;
AddActionToDungeonSubMenu(ACTION_UNK22, 0);
AddActionToDungeonSubMenu(ACTION_DELINK_MOVES, 0);
if (!sub_8064358(moves, sChosenMoveSlotId)) {
SetActionUnusableInDungeonSubMenu(ACTION_DELINK_MOVES);
}
AddActionToDungeonSubMenu(ACTION_MOVE_INFO, 0);
}
//
static bool8 sub_8064358(Move *moves, s32 id)
{
bool8 linkFound = FALSE;
s32 linkedCount;
id++;
for (linkedCount = 0; linkedCount < 8 && id < 8; linkedCount++) {
Move *move = &moves[id];
if (MoveFlagLinkChain(move)) {
linkFound = TRUE;
id++;
}
else {
break;
}
}
if (linkFound)
return TRUE;
return FALSE;
}

View File

@ -87,12 +87,12 @@ void PrintOnMainMenu(bool8 printAll);
bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1);
void sub_8060D24(UNUSED ActionContainer *a0);
bool8 ShowDungeonTeamMenu(Entity *a0);
void sub_80637E8(ActionContainer *a0);
void sub_8063B54(ActionContainer *a0);
void sub_8063BB4(ActionContainer *a0);
void ActionShowMoveInfo(ActionContainer *a0);
void ActionToggleMoveUsableForAi(ActionContainer *a0);
void ActionLinkMoves(ActionContainer *a0);
void sub_806752C(ActionContainer *a0);
void sub_8063A70(ActionContainer *a0, bool8 a1);
void sub_8063CF0(ActionContainer *a0, bool8 a1);
void ActionSetOrUnsetMove(ActionContainer *a0, bool8 a1);
void ActionDelinkMoves(ActionContainer *a0, bool8 a1);
void sub_8067768(ActionContainer *a0);
void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3);
extern void sub_80643AC(Entity *pokemon);
@ -113,8 +113,8 @@ extern s32 gDungeonSubMenuItemsCount;
extern const u8 gUnknown_8106B50[];
extern void DungeonShowWindows(WindowTemplates *a0, u8 a1);
extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3);
extern void sub_8044F5C(u16 param_1, u8 param_2);
extern void sub_8044FF0(u16 param_1);
extern void AddActionToDungeonSubMenu(u16 param_1, u8 param_2);
extern void SetActionUnusableInDungeonSubMenu(u16 param_1);
extern u16 sub_8044DC8(Item *param_1);
extern bool8 sub_8046F00(Item *item);
extern void sub_8045064(void);
@ -457,22 +457,22 @@ static void sub_806145C(struct UnkFieldTeamMenuStruct *a0)
gDungeonSubMenuItemsCount = 0;
teamMon = gDungeon->teamPokemon[a0->unk4[gDungeonMenu.menuIndex]];
monInfo = GetEntInfo(teamMon);
sub_8044F5C(0x1B, 0);
sub_8044F5C(0x19, 0);
AddActionToDungeonSubMenu(0x1B, 0);
AddActionToDungeonSubMenu(0x19, 0);
if (!monInfo->isTeamLeader) {
if (!gDungeon->unk644.unk19 && (monInfo->joinedAt.id != DUNGEON_JOIN_LOCATION_PARTNER || gDungeon->unk644.unk18)) {
sub_8044F5C(0x34, 0);
AddActionToDungeonSubMenu(0x34, 0);
}
sub_8044F5C(0x1C, 0);
AddActionToDungeonSubMenu(0x1C, 0);
}
sub_8044F5C(0x30, 0);
AddActionToDungeonSubMenu(0x30, 0);
if (!monInfo->isTeamLeader) {
sub_8044F5C(0x1A, 0);
AddActionToDungeonSubMenu(0x1A, 0);
}
if (!monInfo->isTeamLeader && gDungeon->unk644.unk18 && CanLeaderSwitch(gDungeon->unk644.dungeonLocation.id)) {
bool32 r5;
sub_8044F5C(0x3B, 0);
AddActionToDungeonSubMenu(0x3B, 0);
r5 = TRUE;
if (monInfo->teamIndex >= MAX_TEAM_MEMBERS) {
r5 = FALSE;
@ -488,16 +488,16 @@ static void sub_806145C(struct UnkFieldTeamMenuStruct *a0)
r5 = FALSE;
}
if (!r5) {
sub_8044FF0(0x3B);
SetActionUnusableInDungeonSubMenu(0x3B);
}
}
if (IsExperienceLocked(monInfo->joinedAt.id)) {
sub_8044FF0(0x19);
sub_8044FF0(0x3B);
sub_8044FF0(0x1A);
sub_8044FF0(0x30);
sub_8044FF0(0x34);
SetActionUnusableInDungeonSubMenu(0x19);
SetActionUnusableInDungeonSubMenu(0x3B);
SetActionUnusableInDungeonSubMenu(0x1A);
SetActionUnusableInDungeonSubMenu(0x30);
SetActionUnusableInDungeonSubMenu(0x34);
}
sub_8045064();
@ -622,10 +622,10 @@ void ShowDungeonTacticsMenu(ActionContainer *a0)
ResetDungeonMenu();
PlayDungeonConfirmationSE();
gDungeonSubMenuItemsCount = 0;
sub_8044F5C(0x2F, 0);
sub_8044F5C(0xC, 0);
AddActionToDungeonSubMenu(0x2F, 0);
AddActionToDungeonSubMenu(0xC, 0);
if (CheckVariousStatuses2(teamMon, TRUE)) {
sub_8044FF0(0x2F);
SetActionUnusableInDungeonSubMenu(0x2F);
}
CreateDungeonMenuSubWindow(&windows.id[0], 0x16);
while (1) {
@ -1081,7 +1081,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq)
ResetDungeonMenu();
gDungeonSubMenuItemsCount = 0;
PlayDungeonConfirmationSE();
sub_8044F5C(0xC, 0);
AddActionToDungeonSubMenu(0xC, 0);
CreateDungeonMenuSubWindow(&windows.id[0], 0x16);
while (1) {
AddMenuCursorSprite(&gDungeonMenu);
@ -1117,10 +1117,10 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq)
ResetDungeonMenu();
gDungeonSubMenuItemsCount = 0;
PlayDungeonConfirmationSE();
sub_8044F5C(0x28, 0);
sub_8044F5C(0xC, 0);
AddActionToDungeonSubMenu(0x28, 0);
AddActionToDungeonSubMenu(0xC, 0);
if (CheckVariousStatuses2(entity, TRUE)) {
sub_8044FF0(0x28);
SetActionUnusableInDungeonSubMenu(0x28);
}
CreateDungeonMenuSubWindow(&windows.id[0], 0x16);
while (1) {

View File

@ -154,12 +154,8 @@ gUnknown_202EE76: /* 202EE76 (sub_804513C - sub_8082A08) */
.space 0x4
.include "src/dungeon_menu_team.o"
.space 0x4
gUnknown_202F278: /* 202F278 (sub_80639E4) */
.space 0x60
gUnknown_202F2D8: /* 202F2D8 (sub_8062F90 - sub_8064310) */
.space 0x8
.include "src/dungeon_menu_moves.o"
.space 0x4
gUnknown_202F2E0: /* 202F2E0 (sub_8064BE0 - sub_8065250) */
.space 0x8