From 90736d6bb27d786d7dea5c0dda6ff0bcaa47e2bf Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 2 Mar 2025 19:36:03 +0100 Subject: [PATCH] sub_8063E30 --- asm/code_805D8C8.s | 204 --------------------------------------- src/dungeon_menu_moves.c | 78 +++++++++++++++ 2 files changed, 78 insertions(+), 204 deletions(-) diff --git a/asm/code_805D8C8.s b/asm/code_805D8C8.s index 16075ce8a..32157a0bc 100644 --- a/asm/code_805D8C8.s +++ b/asm/code_805D8C8.s @@ -6,210 +6,6 @@ .text - - - thumb_func_start sub_8063CF0 -sub_8063CF0: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r1, _08063D98 - ldr r2, [r1] - ldrb r1, [r0, 0x4] - lsls r1, 2 - ldr r3, _08063D9C - adds r2, r3 - adds r2, r1 - ldr r7, [r2] - ldr r6, [r7, 0x70] - ldrb r5, [r0, 0xC] - movs r0, 0 - mov r8, r0 - ldr r0, _08063DA0 - lsls r4, r5, 3 - movs r1, 0x8C - lsls r1, 1 - mov r9, r1 - adds r1, r4, r1 - adds r1, r6, r1 - movs r2, 0 - bl BufferMoveName - adds r4, r6, r4 - ldr r3, _08063DA4 - adds r2, r4, r3 - ldrb r1, [r2] - movs r0, 0x2 - orrs r0, r1 - strb r0, [r2] - adds r5, 0x1 - movs r3, 0 - cmp r5, 0x3 - bgt _08063D70 - movs r0, 0x2 - mov r12, r0 - lsls r0, r5, 3 - add r0, r9 - adds r2, r0, r6 - movs r4, 0xFD -_08063D4E: - ldrb r1, [r2] - mov r0, r12 - ands r0, r1 - cmp r0, 0 - beq _08063D70 - adds r0, r4, 0 - ands r0, r1 - strb r0, [r2] - movs r1, 0x1 - mov r8, r1 - adds r2, 0x8 - adds r5, 0x1 - adds r3, 0x1 - cmp r3, 0x3 - bgt _08063D70 - cmp r5, 0x3 - ble _08063D4E -_08063D70: - movs r2, 0x8C - lsls r2, 1 - adds r0, r6, r2 - bl unk_FixLinkedMovesSetEnabled4 - ldr r0, _08063DA8 - bl PlaySoundEffect - mov r3, r10 - cmp r3, 0 - beq _08063DC2 - mov r0, r8 - cmp r0, 0 - beq _08063DB0 - ldr r0, _08063DAC - ldr r1, [r0] - adds r0, r7, 0 - bl LogMessageByIdWithPopupCheckUser - b _08063DBA - .align 2, 0 -_08063D98: .4byte gDungeon -_08063D9C: .4byte 0x0001357c -_08063DA0: .4byte gFormatBuffer_Items -_08063DA4: .4byte 0x00000119 -_08063DA8: .4byte 0x00000133 -_08063DAC: .4byte gUnknown_80F8B88 -_08063DB0: - ldr r0, _08063DD0 - ldr r1, [r0] - adds r0, r7, 0 - bl LogMessageByIdWithPopupCheckUser -_08063DBA: - movs r0, 0x78 - movs r1, 0x1F - bl sub_803E708 -_08063DC2: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08063DD0: .4byte gUnknown_80F8BB4 - thumb_func_end sub_8063CF0 - - thumb_func_start sub_8063DD4 -sub_8063DD4: - push {r4-r7,lr} - adds r3, r0, 0 - adds r2, r1, 0 - movs r5, 0 - adds r2, 0x1 - movs r4, 0 - cmp r2, 0x3 - bgt _08063E20 - lsls r0, r2, 3 - movs r6, 0x8C - lsls r6, 1 - adds r0, r6 - adds r0, r3, r0 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08063E20 - movs r5, 0x1 - adds r2, 0x1 - movs r7, 0x2 - lsls r0, r2, 3 - adds r0, r6 - adds r3, r0, r3 -_08063E04: - adds r4, 0x1 - cmp r4, 0x3 - bgt _08063E20 - cmp r2, 0x3 - bgt _08063E20 - ldrb r1, [r3] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _08063E20 - movs r5, 0x1 - adds r3, 0x8 - adds r2, 0x1 - b _08063E04 -_08063E20: - cmp r5, 0 - bne _08063E28 - movs r0, 0 - b _08063E2A -_08063E28: - movs r0, 0x1 -_08063E2A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8063DD4 - - thumb_func_start sub_8063E30 -sub_8063E30: - push {r4-r7,lr} - adds r5, r0, 0 - adds r1, 0x1 - movs r4, 0 - cmp r1, 0x7 - bgt _08063E62 - movs r7, 0x2 - movs r6, 0xFD - lsls r0, r1, 3 - adds r3, r0, r5 -_08063E44: - ldrb r2, [r3] - adds r0, r7, 0 - ands r0, r2 - cmp r0, 0 - beq _08063E62 - adds r0, r6, 0 - ands r0, r2 - strb r0, [r3] - adds r3, 0x8 - adds r1, 0x1 - adds r4, 0x1 - cmp r4, 0x7 - bgt _08063E62 - cmp r1, 0x7 - ble _08063E44 -_08063E62: - adds r0, r5, 0 - bl unk_FixLinkedMovesSetEnabled8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8063E30 - thumb_func_start sub_8063E70 sub_8063E70: push {r4-r7,lr} diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index ca74151f0..5dd701f6b 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -733,6 +733,8 @@ void ShowStatusDescriptionMenu(struct subStruct_203B240 *status, MenuInputStruct 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) { @@ -839,4 +841,80 @@ bool8 sub_8063C88(EntityInfo *entInfo, s32 a1) return ret; } +void sub_8063CF0(ActionContainer *a0, bool8 a1) +{ + s32 linkedCount; + Entity *entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex]; + EntityInfo *entInfo = GetEntInfo(entity); + s32 id = a0->actionParameters[1].actionUseIndex; + bool8 unlInked = FALSE; + + BufferMoveName(gFormatBuffer_Items[0], &entInfo->moves.moves[id], NULL); + entInfo->moves.moves[id].moveFlags2 |= 2; + + id++; + for (linkedCount = 0; linkedCount < MAX_MON_MOVES && id < MAX_MON_MOVES; id++, linkedCount++) { + Move *move = &entInfo->moves.moves[id]; + if (MoveFlagLinkChain(move)) { + move->moveFlags &= ~(MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN); + unlInked = TRUE; + } + else { + break; + } + } + + unk_FixLinkedMovesSetEnabled4(entInfo->moves.moves); + PlaySoundEffect(0x133); + if (a1) { + if (unlInked) { + LogMessageByIdWithPopupCheckUser(entity, gUnknown_80F8B88); + } + else { + LogMessageByIdWithPopupCheckUser(entity, gUnknown_80F8BB4); + } + sub_803E708(0x78, 0x1F); + } +} + +bool8 sub_8063DD4(EntityInfo *entInfo, s32 id) +{ + bool8 linkFound = FALSE; + s32 linkedCount; + + id++; + for (linkedCount = 0; linkedCount < MAX_MON_MOVES && id < MAX_MON_MOVES; linkedCount++) { + Move *move = &entInfo->moves.moves[id]; + + if (MoveFlagLinkChain(move)) { + linkFound = TRUE; + id++; + } + else { + break; + } + } + + if (linkFound) + return TRUE; + return FALSE; +} + +void sub_8063E30(Move *moves, s32 id) +{ + s32 i; + + id++; + for (i = 0; i < 8 && id < 8; id++, i++) { + if (MoveFlagLinkChain(&moves[id])) { + moves[id].moveFlags &= ~(MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN); + } + else { + break; + } + } + + unk_FixLinkedMovesSetEnabled8(moves); +} + //