diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index 2acfee95..9b1ca19d 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -6018,7 +6018,7 @@ _08055790: adds r1, r4, 0 mov r2, r8 mov r3, r10 - bl sub_806D010 + bl HandleDealingDamage b _08055826 .align 2, 0 _080557AC: .4byte gDungeon @@ -6139,7 +6139,7 @@ sub_8055864: adds r1, r7, 0 add r2, sp, 0x10 movs r3, 0 - bl sub_806D010 + bl HandleDealingDamage add r0, sp, 0x10 ldrb r0, [r0, 0xF] cmp r0, 0 @@ -8611,7 +8611,7 @@ _08056C5A: bl GetMoveType lsls r0, 24 lsrs r0, 24 - bl sub_8092354 + bl IsTypePhysical movs r1, 0 lsls r0, 24 cmp r0, 0 diff --git a/asm/code_806CD90.s b/asm/code_806CD90.s deleted file mode 100644 index fe8989ed..00000000 --- a/asm/code_806CD90.s +++ /dev/null @@ -1,2123 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_806D010 -sub_806D010: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - adds r6, r0, 0 - adds r5, r1, 0 - mov r8, r2 - ldr r0, [sp, 0x40] - lsls r0, 16 - asrs r0, 16 - mov r10, r0 - movs r7, 0 - ldr r0, [sp, 0x3C] - str r0, [sp] - mov r1, r10 - str r1, [sp, 0x4] - ldr r2, [sp, 0x48] - str r2, [sp, 0x8] - adds r0, r6, 0 - adds r1, r5, 0 - mov r2, r8 - bl sub_806D528 - lsls r0, 24 - cmp r0, 0 - beq _0806D04A - b _0806D514 -_0806D04A: - mov r3, r8 - ldrb r0, [r3, 0xF] - cmp r0, 0 - beq _0806D054 - b _0806D514 -_0806D054: - adds r0, r6, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D062 - b _0806D514 -_0806D062: - adds r0, r5, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D070 - b _0806D514 -_0806D070: - adds r0, r6, 0 - bl GetEntityType - cmp r0, 0x1 - beq _0806D07C - b _0806D514 -_0806D07C: - adds r0, r5, 0 - bl GetEntityType - cmp r0, 0x1 - beq _0806D088 - b _0806D514 -_0806D088: - ldr r0, [sp, 0x44] - mov r9, r0 - adds r0, r5, 0 - bl CheckVariousStatuses - lsls r0, 24 - cmp r0, 0 - bne _0806D0A2 - ldr r0, [r5, 0x70] - adds r0, 0xC0 - ldrb r0, [r0] - cmp r0, 0 - beq _0806D0A6 -_0806D0A2: - movs r1, 0 - mov r9, r1 -_0806D0A6: - mov r2, r9 - cmp r2, 0 - beq _0806D100 - movs r3, 0x4 - ldrsh r1, [r6, r3] - movs r2, 0x4 - ldrsh r0, [r5, r2] - subs r1, r0 - cmp r1, 0 - bge _0806D0BC - negs r1, r1 -_0806D0BC: - cmp r1, 0x1 - bgt _0806D100 - movs r3, 0x6 - ldrsh r1, [r6, r3] - movs r2, 0x6 - ldrsh r0, [r5, r2] - subs r1, r0 - cmp r1, 0 - bge _0806D0D0 - negs r1, r1 -_0806D0D0: - cmp r1, 0x1 - bgt _0806D100 - cmp r6, r5 - beq _0806D100 - mov r3, r8 - ldrb r0, [r3, 0xC] - bl sub_8092354 - lsls r0, 24 - cmp r0, 0 - beq _0806D100 - ldr r0, [r5, 0x70] - adds r0, 0xC4 - ldrb r0, [r0] - cmp r0, 0xD - bne _0806D100 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8042730 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_807F43C -_0806D100: - ldr r0, [r5, 0x70] - adds r0, 0xC0 - ldrb r0, [r0] - cmp r0, 0xC - bne _0806D118 - ldr r0, _0806D3BC - ldr r2, [r0] - adds r0, r6, 0 - adds r1, r5, 0 - movs r3, 0x1 - bl RaiseAttackStageTarget -_0806D118: - adds r0, r6, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D126 - b _0806D514 -_0806D126: - adds r0, r5, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D134 - b _0806D514 -_0806D134: - mov r0, r9 - cmp r0, 0 - beq _0806D216 - cmp r6, r5 - beq _0806D216 - movs r2, 0x4 - ldrsh r1, [r6, r2] - movs r3, 0x4 - ldrsh r0, [r5, r3] - subs r1, r0 - cmp r1, 0 - bge _0806D14E - negs r1, r1 -_0806D14E: - cmp r1, 0x1 - bgt _0806D216 - movs r0, 0x6 - ldrsh r1, [r6, r0] - movs r2, 0x6 - ldrsh r0, [r5, r2] - subs r1, r0 - cmp r1, 0 - bge _0806D162 - negs r1, r1 -_0806D162: - cmp r1, 0x1 - bgt _0806D216 - mov r3, r8 - ldrb r0, [r3, 0xC] - bl sub_8092354 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, [r5, 0x70] - adds r0, 0xC4 - ldrb r0, [r0] - cmp r0, 0x4 - bne _0806D188 - cmp r4, 0 - beq _0806D188 - adds r0, r5, 0 - bl sub_8041B18 - adds r7, 0x4 -_0806D188: - ldr r0, [r5, 0x70] - adds r0, 0xC4 - ldrb r0, [r0] - cmp r0, 0xA - bne _0806D19E - cmp r4, 0 - beq _0806D19E - adds r0, r5, 0 - bl sub_8041B18 - adds r7, 0x1 -_0806D19E: - ldr r0, [r5, 0x70] - adds r0, 0xC4 - ldrb r0, [r0] - cmp r0, 0x8 - bne _0806D1B4 - cmp r4, 0 - bne _0806D1B4 - adds r0, r5, 0 - bl sub_8041B90 - adds r7, 0x4 -_0806D1B4: - adds r0, r5, 0 - movs r1, 0x12 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D1C4 - adds r7, 0x2 -_0806D1C4: - cmp r7, 0 - beq _0806D216 - ldr r0, _0806D3C0 - ldr r2, [r0] - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80522F4 - mov r1, r8 - ldr r0, [r1] - muls r0, r7 - cmp r0, 0 - bge _0806D1E0 - adds r0, 0x3 -_0806D1E0: - asrs r0, 2 - str r0, [sp, 0xC] - add r2, sp, 0xC - mov r3, r8 - ldrb r0, [r3, 0xC] - movs r1, 0 - strb r0, [r2, 0xC] - movs r0, 0x6 - str r0, [sp, 0x10] - movs r0, 0x2 - str r0, [sp, 0x14] - adds r0, r2, 0 - strb r1, [r0, 0xD] - strb r1, [r0, 0xE] - strb r1, [r0, 0xF] - ldr r0, [sp, 0x3C] - str r0, [sp] - mov r1, r10 - str r1, [sp, 0x4] - ldr r2, [sp, 0x48] - str r2, [sp, 0x8] - adds r0, r5, 0 - adds r1, r6, 0 - add r2, sp, 0xC - movs r3, 0 - bl sub_806D528 -_0806D216: - adds r0, r6, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D224 - b _0806D514 -_0806D224: - adds r0, r5, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - bne _0806D232 - b _0806D514 -_0806D232: - mov r3, r9 - cmp r3, 0 - bne _0806D23A - b _0806D48A -_0806D23A: - cmp r6, r5 - bne _0806D240 - b _0806D48A -_0806D240: - movs r0, 0x4 - ldrsh r1, [r6, r0] - movs r2, 0x4 - ldrsh r0, [r5, r2] - subs r1, r0 - cmp r1, 0 - bge _0806D250 - negs r1, r1 -_0806D250: - cmp r1, 0x1 - ble _0806D256 - b _0806D48A -_0806D256: - movs r3, 0x6 - ldrsh r1, [r6, r3] - movs r2, 0x6 - ldrsh r0, [r5, r2] - subs r1, r0 - cmp r1, 0 - bge _0806D266 - negs r1, r1 -_0806D266: - cmp r1, 0x1 - ble _0806D26C - b _0806D48A -_0806D26C: - mov r3, r8 - ldrb r0, [r3, 0xC] - bl sub_8092354 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, [r6, 0x70] - adds r0, r5, 0 - movs r1, 0x5 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D2C2 - adds r0, r6, 0 - movs r1, 0xA - bl MonsterIsType - lsls r0, 24 - cmp r0, 0 - bne _0806D2C2 - adds r0, r6, 0 - movs r1, 0x37 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - bne _0806D2C2 - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3C4 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D2C2 - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x1 - orrs r0, r1 - strh r0, [r2] -_0806D2C2: - adds r0, r5, 0 - movs r1, 0xA - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D2EE - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3C8 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D2EE - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x2 - orrs r0, r1 - strh r0, [r2] -_0806D2EE: - adds r0, r5, 0 - movs r1, 0x17 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D328 - adds r0, r6, 0 - movs r1, 0x11 - bl MonsterIsType - lsls r0, 24 - cmp r0, 0 - beq _0806D328 - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3CC - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D328 - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x4 - orrs r0, r1 - strh r0, [r2] -_0806D328: - adds r0, r5, 0 - movs r1, 0x20 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D358 - cmp r7, 0 - beq _0806D358 - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3D0 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D358 - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x8 - orrs r0, r1 - strh r0, [r2] -_0806D358: - adds r0, r5, 0 - movs r1, 0x27 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D384 - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3D4 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D384 - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x20 - orrs r0, r1 - strh r0, [r2] -_0806D384: - adds r0, r5, 0 - movs r1, 0x3D - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D3FA - cmp r7, 0 - beq _0806D3FA - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D3D8 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D3FA - movs r0, 0x3 - bl DungeonRandInt - cmp r0, 0 - bgt _0806D3DC - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r0, 0x40 - b _0806D3F6 - .align 2, 0 -_0806D3BC: .4byte gUnknown_8106A4C -_0806D3C0: .4byte gUnknown_80FCFA4 -_0806D3C4: .4byte gUnknown_80F4E10 -_0806D3C8: .4byte gUnknown_80F4E12 -_0806D3CC: .4byte gUnknown_80F4E14 -_0806D3D0: .4byte gUnknown_80F4E16 -_0806D3D4: .4byte gUnknown_80F4E18 -_0806D3D8: .4byte gUnknown_80F4E1A -_0806D3DC: - cmp r0, 0x1 - bgt _0806D3EC - movs r0, 0xBC - lsls r0, 1 - adds r2, r4, r0 - ldrh r1, [r2] - movs r0, 0x10 - b _0806D3F6 -_0806D3EC: - movs r1, 0xBC - lsls r1, 1 - adds r2, r4, r1 - ldrh r1, [r2] - movs r0, 0x80 -_0806D3F6: - orrs r0, r1 - strh r0, [r2] -_0806D3FA: - adds r0, r5, 0 - movs r1, 0x3E - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D428 - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D4D4 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D428 - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - subs r3, 0x78 - adds r0, r3, 0 - orrs r0, r1 - strh r0, [r2] -_0806D428: - adds r0, r5, 0 - movs r1, 0x44 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D45A - cmp r7, 0 - beq _0806D45A - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D4D8 - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D45A - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - adds r3, 0x88 - adds r0, r3, 0 - orrs r0, r1 - strh r0, [r2] -_0806D45A: - adds r0, r5, 0 - movs r1, 0x1 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D48A - movs r0, 0x64 - bl DungeonRandInt - ldr r1, _0806D4DC - movs r2, 0 - ldrsh r1, [r1, r2] - cmp r0, r1 - bge _0806D48A - movs r3, 0xBC - lsls r3, 1 - adds r2, r4, r3 - ldrh r1, [r2] - movs r3, 0x80 - lsls r3, 3 - adds r0, r3, 0 - orrs r0, r1 - strh r0, [r2] -_0806D48A: - adds r0, r6, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806D514 - adds r0, r5, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806D514 - mov r0, r9 - cmp r0, 0 - beq _0806D514 - ldr r2, [r5, 0x70] - adds r6, r2, 0 - adds r3, r2, 0 - adds r3, 0xD0 - ldrb r0, [r3] - cmp r0, 0x2 - bne _0806D514 - ldr r0, _0806D4E0 - ldr r1, [r0] - adds r0, r2, 0 - adds r0, 0xD8 - ldrb r0, [r0] - lsls r0, 2 - ldr r2, _0806D4E4 - adds r1, r2 - adds r1, r0 - ldr r4, [r1] - cmp r4, 0 - bne _0806D4E8 - strb r4, [r3] - b _0806D514 - .align 2, 0 -_0806D4D4: .4byte gUnknown_80F4E1C -_0806D4D8: .4byte gUnknown_80F4E1E -_0806D4DC: .4byte gUnknown_80F4E20 -_0806D4E0: .4byte gDungeon -_0806D4E4: .4byte 0x000135cc -_0806D4E8: - ldr r0, [r4, 0x70] - adds r0, 0x98 - adds r1, r6, 0 - adds r1, 0xD4 - ldr r2, [r0] - ldr r0, [r1] - cmp r2, r0 - beq _0806D4FE - movs r0, 0 - strb r0, [r3] - b _0806D514 -_0806D4FE: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8041D00 - mov r3, r8 - ldr r1, [r3] - ldr r3, _0806D524 - adds r0, r4, 0 - movs r2, 0xC - bl DealDamageToEntity -_0806D514: - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0806D524: .4byte 0x000001f9 - thumb_func_end sub_806D010 - - thumb_func_start sub_806D528 -sub_806D528: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x58 - mov r9, r0 - adds r7, r1, 0 - adds r5, r2, 0 - str r3, [sp, 0x4C] - ldr r0, [sp, 0x7C] - lsls r0, 16 - asrs r0, 16 - str r0, [sp, 0x50] - movs r0, 0 - str r0, [sp, 0x54] - mov r10, r0 - mov r8, r0 - mov r1, r10 - strb r1, [r5, 0xF] - adds r0, r7, 0 - bl GetEntityType - cmp r0, 0x1 - beq _0806D55C - b _0806D754 -_0806D55C: - ldr r6, [r7, 0x70] - mov r0, r9 - adds r1, r7, 0 - bl TrySendImmobilizeSleepEndMsg - mov r0, r9 - adds r1, r7, 0 - bl SetShopkeeperAggression - mov r0, r9 - bl GetEntityType - cmp r0, 0x1 - bne _0806D592 - mov r2, r9 - ldr r0, [r2, 0x70] - adds r0, 0xDC - ldrb r0, [r0] - cmp r0, 0x3 - bne _0806D592 - ldrb r0, [r5, 0xE] - cmp r0, 0 - bne _0806D592 - ldr r0, _0806D5C8 - movs r3, 0 - ldrsh r0, [r0, r3] - str r0, [r5] -_0806D592: - ldr r0, _0806D5CC - ldr r1, [sp, 0x50] - cmp r1, r0 - beq _0806D5DC - adds r0, r7, 0 - movs r1, 0xD - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D5DC - ldr r1, [r5] - ldr r0, _0806D5D0 - cmp r1, r0 - bne _0806D5DC - ldr r0, _0806D5D4 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - ldr r0, _0806D5D8 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 - b _0806D71E - .align 2, 0 -_0806D5C8: .4byte gUnknown_80F4F8C -_0806D5CC: .4byte 0x0000020e -_0806D5D0: .4byte 0x0000270f -_0806D5D4: .4byte gUnknown_202DFE8 -_0806D5D8: .4byte gUnknown_80FCA90 -_0806D5DC: - adds r0, r6, 0 - adds r0, 0xB0 - ldrb r4, [r0] - mov r10, r0 - cmp r4, 0x1 - bne _0806D618 - ldr r0, _0806D610 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - ldr r0, _0806D614 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 - mov r0, r9 - adds r1, r7, 0 - bl sub_8042238 - strb r4, [r5, 0xF] -_0806D608: - movs r0, 0 - bl _0806E0F0 - .align 2, 0 -_0806D610: .4byte gUnknown_202DFE8 -_0806D614: .4byte gUnknown_80F9600 -_0806D618: - adds r0, r6, 0 - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0806D62A - cmp r0, 0x5 - beq _0806D62A - cmp r0, 0x3 - bne _0806D63A -_0806D62A: - adds r0, r6, 0 - adds r0, 0xA9 - ldrb r0, [r0] - cmp r0, 0x7F - bne _0806D63A - adds r0, r7, 0 - bl WakeUpPokemon -_0806D63A: - adds r0, r7, 0 - movs r1, 0x23 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D660 - ldrb r0, [r5, 0xC] - cmp r0, 0x5 - bne _0806D660 -_0806D64E: - ldr r2, [r5] - movs r0, 0 - str r0, [sp] - mov r0, r9 - adds r1, r7, 0 - movs r3, 0 - bl HealTargetHP - b _0806D754 -_0806D660: - adds r0, r7, 0 - movs r1, 0x24 - bl HasAbility - lsls r0, 24 - cmp r0, 0 - beq _0806D674 - ldrb r0, [r5, 0xC] - cmp r0, 0x3 - beq _0806D64E -_0806D674: - movs r2, 0xA9 - lsls r2, 1 - adds r0, r6, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D6D0 - ldrb r0, [r5, 0xD] - cmp r0, 0 - beq _0806D692 - ldr r0, _0806D6A4 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D692: - ldr r0, [r5, 0x8] - cmp r0, 0x1 - beq _0806D6B0 - cmp r0, 0x1 - bcc _0806D6A8 - cmp r0, 0x3 - beq _0806D6C4 - b _0806D6D0 - .align 2, 0 -_0806D6A4: .4byte gUnknown_80F9614 -_0806D6A8: - ldr r0, _0806D6AC - b _0806D6B2 - .align 2, 0 -_0806D6AC: .4byte gUnknown_80F9630 -_0806D6B0: - ldr r0, _0806D6C0 -_0806D6B2: - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 - b _0806D6D0 - .align 2, 0 -_0806D6C0: .4byte gUnknown_80F9654 -_0806D6C4: - ldr r0, _0806D728 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D6D0: - ldr r4, _0806D72C - adds r0, r4, 0 - mov r1, r9 - movs r2, 0 - bl SetMessageArgument - adds r4, 0x50 - adds r0, r4, 0 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - ldr r1, [r5] - cmp r1, 0 - bne _0806D760 - mov r0, r9 - bl sub_8045888 - lsls r0, 24 - cmp r0, 0 - beq _0806D734 - adds r0, r7, 0 - bl sub_8045888 - lsls r0, 24 - cmp r0, 0 - beq _0806D734 - movs r3, 0xA9 - lsls r3, 1 - adds r0, r6, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D71E - ldr r0, _0806D730 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D71E: - mov r0, r9 - adds r1, r7, 0 - bl sub_8042238 - b _0806D754 - .align 2, 0 -_0806D728: .4byte gUnknown_80F9670 -_0806D72C: .4byte gAvailablePokemonNames -_0806D730: .4byte gUnknown_80F9688 -_0806D734: - movs r1, 0xA9 - lsls r1, 1 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D74C - ldr r0, _0806D75C - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D74C: - movs r0, 0x1E - movs r1, 0x18 - bl sub_803E708 -_0806D754: - movs r0, 0x1 - strb r0, [r5, 0xF] - b _0806D608 - .align 2, 0 -_0806D75C: .4byte gUnknown_80F9688 -_0806D760: - ldr r0, _0806D7B8 - cmp r1, r0 - bne _0806D7C4 - ldr r0, [sp, 0x80] - cmp r0, 0 - beq _0806D796 - adds r0, r7, 0 - bl sub_8045888 - lsls r0, 24 - cmp r0, 0 - beq _0806D796 - adds r0, r7, 0 - bl GetTileAtEntitySafe - mov r8, r0 - movs r0, 0x14 - movs r1, 0x18 - bl sub_803E708 - mov r2, r8 - ldrh r1, [r2, 0x4] - movs r0, 0x4 - orrs r0, r1 - strh r0, [r2, 0x4] - bl sub_8049ED4 -_0806D796: - movs r3, 0xA9 - lsls r3, 1 - adds r0, r6, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D7AE - ldr r0, _0806D7BC - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D7AE: - adds r1, r6, 0 - adds r1, 0xA0 - ldr r0, _0806D7C0 - str r0, [r1] - b _0806D84A - .align 2, 0 -_0806D7B8: .4byte 0x0000270f -_0806D7BC: .4byte gUnknown_80F96A8 -_0806D7C0: .4byte 0x000003e7 -_0806D7C4: - ldr r0, _0806D824 - str r1, [r0] - ldr r1, _0806D828 - ldr r0, [r5, 0x4] - lsls r0, 2 - adds r0, r1 - ldr r4, [r0] - adds r2, r6, 0 - adds r2, 0xA0 - ldr r0, [r2] - ldr r1, [r5] - adds r0, r1 - str r0, [r2] - ldr r1, _0806D82C - cmp r0, r1 - ble _0806D7E6 - str r1, [r2] -_0806D7E6: - adds r0, r7, 0 - bl sub_8045888 - lsls r0, 24 - cmp r0, 0 - beq _0806D830 - ldr r0, [r5, 0x4] - cmp r0, 0xE - beq _0806D808 - ldr r0, [r5] - negs r0, r0 - movs r3, 0x1 - negs r3, r3 - adds r1, r7, 0 - movs r2, 0x1 - bl sub_803ED30 -_0806D808: - movs r1, 0xA9 - lsls r1, 1 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D84A - cmp r4, 0 - beq _0806D84A - mov r0, r9 - adds r1, r7, 0 - adds r2, r4, 0 - bl sub_80522F4 - b _0806D84A - .align 2, 0 -_0806D824: .4byte gFormatData_202DE30 -_0806D828: .4byte gUnknown_80F9764 -_0806D82C: .4byte 0x000003e7 -_0806D830: - movs r2, 0xA9 - lsls r2, 1 - adds r0, r6, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _0806D84A - cmp r4, 0 - beq _0806D84A - mov r0, r9 - adds r1, r7, 0 - adds r2, r4, 0 - bl sub_80522F4 -_0806D84A: - ldr r0, [r5, 0x4] - cmp r0, 0xE - bne _0806D858 - movs r3, 0xE - ldrsh r0, [r6, r3] - cmp r0, 0x1 - bgt _0806D900 -_0806D858: - mov r0, r8 - cmp r0, 0 - bne _0806D900 - adds r0, r7, 0 - bl sub_8045888 - lsls r0, 24 - cmp r0, 0 - beq _0806D900 - mov r2, r9 - ldr r1, [r2, 0x4] - ldr r0, [r7, 0x4] - cmp r1, r0 - beq _0806D8E6 - mov r0, r9 - bl GetEntityType - cmp r0, 0x1 - bne _0806D8E6 - movs r4, 0 - ldrb r0, [r6, 0x7] - cmp r0, 0 - beq _0806D8B4 - ldr r0, _0806D8B0 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - cmp r0, 0 - beq _0806D8B6 - adds r0, r7, 0 - bl sub_806A458 - lsls r0, 24 - cmp r0, 0 - bne _0806D8B6 - adds r0, r7, 0 - mov r1, r9 - bl CanSeeTarget - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r4, r1, 31 - b _0806D8B6 - .align 2, 0 -_0806D8B0: .4byte gGameOptionsRef -_0806D8B4: - movs r4, 0 -_0806D8B6: - adds r0, r6, 0 - adds r0, 0xE8 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0806D8C8 - movs r4, 0 -_0806D8C8: - cmp r4, 0 - beq _0806D8E0 - ldr r4, [r7, 0x70] - adds r0, r7, 0x4 - mov r1, r9 - adds r1, 0x4 - bl GetDirectionTowardsPosition - movs r1, 0x7 - ands r0, r1 - adds r4, 0x46 - strb r0, [r4] -_0806D8E0: - adds r0, r7, 0 - bl TargetTileInFront -_0806D8E6: - ldr r0, [r7, 0x70] - adds r0, 0x46 - ldrb r2, [r0] - adds r0, r7, 0 - movs r1, 0x6 - bl sub_806CDD4 - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80420E8 - movs r3, 0x1 - str r3, [sp, 0x54] -_0806D900: - movs r0, 0xE - ldrsh r4, [r6, r0] - ldr r1, [r5] - cmp r4, r1 - ble _0806D910 - ldrh r0, [r6, 0xE] - subs r0, r1 - b _0806D912 -_0806D910: - movs r0, 0 -_0806D912: - strh r0, [r6, 0xE] - adds r0, r6, 0 - adds r0, 0xC4 - ldrb r0, [r0] - cmp r0, 0x9 - bne _0806D93C - movs r1, 0xE - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0806D958 - movs r0, 0x1 - strh r0, [r6, 0xE] - ldr r0, _0806D938 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 - b _0806D958 - .align 2, 0 -_0806D938: .4byte gUnknown_8100548 -_0806D93C: - ldr r2, [sp, 0x4C] - cmp r2, 0x1 - bne _0806D958 - movs r3, 0xE - ldrsh r0, [r6, r3] - cmp r0, 0 - bne _0806D958 - strh r2, [r6, 0xE] - ldr r0, _0806D9C8 - ldr r2, [r0] - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 -_0806D958: - movs r1, 0xE - ldrsh r0, [r6, r1] - subs r4, r0 - cmp r4, 0 - bge _0806D964 - movs r4, 0 -_0806D964: - ldr r2, [sp, 0x54] - cmp r2, 0 - bne _0806D970 - mov r3, r8 - cmp r3, 0 - beq _0806D978 -_0806D970: - movs r0, 0xA - movs r1, 0x18 - bl sub_803E708 -_0806D978: - movs r1, 0xE - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0806D9D4 - ldr r2, [sp, 0x54] - cmp r2, 0 - beq _0806D98E - adds r0, r7, 0 - movs r1, 0x8 - bl sub_806CE68 -_0806D98E: - adds r0, r7, 0 - movs r1, 0x10 - bl HasHeldItem - lsls r0, 24 - cmp r0, 0 - beq _0806D9B2 - cmp r4, 0 - ble _0806D9B2 - ldr r1, [r5] - ldr r0, _0806D9CC - cmp r1, r0 - beq _0806D9B2 - mov r0, r9 - adds r1, r7, 0 - adds r2, r4, 0 - bl sub_8071D4C -_0806D9B2: - mov r3, r8 - cmp r3, 0 - bne _0806D9BA - b _0806D608 -_0806D9BA: - ldrh r1, [r3, 0x4] - ldr r0, _0806D9D0 - ands r0, r1 - strh r0, [r3, 0x4] - bl sub_8049ED4 - b _0806D608 - .align 2, 0 -_0806D9C8: .4byte gUnknown_810056C -_0806D9CC: .4byte 0x0000270f -_0806D9D0: .4byte 0x0000fffb -_0806D9D4: - adds r0, r6, 0 - adds r0, 0xE4 - ldrb r0, [r0] - cmp r0, 0x2 - bne _0806D9E6 - mov r0, r9 - adds r1, r7, 0 - bl SendTransformEndMessage -_0806D9E6: - mov r0, r8 - cmp r0, 0 - beq _0806DA18 - movs r0, 0x14 - movs r1, 0x18 - bl sub_803E708 - adds r1, r7, 0 - adds r1, 0x22 - movs r0, 0x2 - strb r0, [r1] - movs r0, 0xA - movs r1, 0x18 - bl sub_803E708 - mov r2, r8 - ldrh r1, [r2, 0x4] - ldr r0, _0806DA14 - ands r0, r1 - strh r0, [r2, 0x4] - bl sub_8049ED4 - b _0806DA2E - .align 2, 0 -_0806DA14: .4byte 0x0000fffb -_0806DA18: - ldr r3, [sp, 0x54] - cmp r3, 0 - beq _0806DA2E - adds r1, r7, 0 - adds r1, 0x22 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x1E - movs r1, 0x18 - bl sub_803E708 -_0806DA2E: - movs r0, 0x1 - mov r8, r0 - mov r0, r9 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806DA50 - mov r0, r9 - bl GetEntityType - cmp r0, 0x1 - bne _0806DA50 - cmp r9, r7 - beq _0806DA50 - movs r1, 0 - mov r8, r1 -_0806DA50: - movs r2, 0xA6 - lsls r2, 1 - adds r1, r6, r2 - movs r0, 0 - strb r0, [r1] - ldr r4, _0806DA88 - adds r0, r4, 0 - mov r1, r9 - movs r2, 0 - bl SetMessageArgument - adds r4, 0x50 - adds r0, r4, 0 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - ldr r0, [r5, 0x4] - subs r0, 0x13 - cmp r0, 0x1 - bhi _0806DA9C - ldrb r0, [r6, 0x6] - cmp r0, 0 - beq _0806DA90 - ldr r0, _0806DA8C - ldr r2, [r0] - b _0806DAC2 - .align 2, 0 -_0806DA88: .4byte gAvailablePokemonNames -_0806DA8C: .4byte gUnknown_80F9E44 -_0806DA90: - ldr r0, _0806DA98 - ldr r1, [r0] - b _0806DB86 - .align 2, 0 -_0806DA98: .4byte gUnknown_80F9E44 -_0806DA9C: - ldrb r0, [r6, 0x6] - cmp r0, 0 - beq _0806DAD0 - adds r0, r6, 0 - adds r0, 0xA4 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0806DAB8 - ldr r0, _0806DAB4 - mov r3, r8 - lsls r1, r3, 2 - b _0806DB82 - .align 2, 0 -_0806DAB4: .4byte gUnknown_80F9DF0 -_0806DAB8: - ldr r0, _0806DACC - mov r2, r8 - lsls r1, r2, 2 - adds r1, r0 - ldr r2, [r1] -_0806DAC2: - mov r0, r9 - adds r1, r7, 0 - bl sub_80522F4 - b _0806DBA4 - .align 2, 0 -_0806DACC: .4byte gUnknown_80F9CC0 -_0806DAD0: - ldr r2, _0806DB04 - ldrb r1, [r6, 0xA] - movs r0, 0x64 - muls r0, r1 - ldr r3, _0806DB08 - adds r0, r3 - ldr r1, [r2] - adds r3, r1, r0 - ldrb r0, [r6, 0x7] - cmp r0, 0 - bne _0806DB00 - adds r0, r6, 0 - adds r0, 0x40 - ldrb r1, [r0] - adds r2, r0, 0 - cmp r1, 0x41 - bne _0806DB18 - ldr r0, _0806DB0C - ldr r0, [r0] - ldr r1, _0806DB10 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0806DB18 -_0806DB00: - ldr r0, _0806DB14 - b _0806DB7E - .align 2, 0 -_0806DB04: .4byte gRecruitedPokemonRef -_0806DB08: .4byte 0x00008df8 -_0806DB0C: .4byte gDungeon -_0806DB10: .4byte 0x0000065c -_0806DB14: .4byte gUnknown_80F9CEC -_0806DB18: - ldrb r0, [r2] - cmp r0, 0x4A - beq _0806DB22 - cmp r0, 0x47 - bne _0806DB26 -_0806DB22: - movs r0, 0x1 - b _0806DB28 -_0806DB26: - movs r0, 0 -_0806DB28: - cmp r0, 0 - beq _0806DB38 - ldr r0, _0806DB34 - mov r3, r8 - lsls r1, r3, 2 - b _0806DB82 - .align 2, 0 -_0806DB34: .4byte gUnknown_80F9DAC -_0806DB38: - adds r0, r6, 0 - adds r0, 0xA4 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0806DB4C - ldr r0, _0806DB48 - b _0806DB7E - .align 2, 0 -_0806DB48: .4byte gUnknown_80F9DF0 -_0806DB4C: - movs r1, 0xA - ldrsh r0, [r3, r1] - bl sub_806A58C - lsls r0, 24 - cmp r0, 0 - beq _0806DB94 - ldr r0, _0806DB70 - ldr r0, [r0] - ldr r2, _0806DB74 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0806DB7C - ldr r0, _0806DB78 - mov r3, r8 - lsls r1, r3, 2 - b _0806DB82 - .align 2, 0 -_0806DB70: .4byte gDungeon -_0806DB74: .4byte 0x0000065d -_0806DB78: .4byte gUnknown_80F9D8C -_0806DB7C: - ldr r0, _0806DB90 -_0806DB7E: - mov r2, r8 - lsls r1, r2, 2 -_0806DB82: - adds r1, r0 - ldr r1, [r1] -_0806DB86: - mov r0, r9 - bl sub_805239C - b _0806DBA4 - .align 2, 0 -_0806DB90: .4byte gUnknown_80F9D84 -_0806DB94: - ldr r0, _0806DC4C - mov r3, r8 - lsls r1, r3, 2 - adds r1, r0 - ldr r1, [r1] - mov r0, r9 - bl sub_805239C -_0806DBA4: - mov r1, r10 - ldrb r0, [r1] - subs r0, 0x3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0806DBBC - adds r0, r6, 0 - adds r0, 0x9C - ldr r0, [r0] - bl sub_8076CB4 -_0806DBBC: - adds r1, r6, 0 - adds r1, 0x60 - ldrb r3, [r1] - movs r2, 0x1 - mov r8, r2 - mov r0, r8 - ands r0, r3 - adds r5, r1, 0 - cmp r0, 0 - beq _0806DC5C - movs r0, 0x8 - ands r0, r3 - cmp r0, 0 - bne _0806DC5C - movs r0, 0x2 - ands r0, r3 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0806DC5C - ldrb r0, [r5, 0x2] - cmp r0, 0xD2 - bne _0806DC5C - adds r0, r7, 0 - bl sub_8042148 - adds r0, r7, 0 - adds r0, 0x22 - strb r4, [r0] - ldrh r0, [r6, 0x10] - movs r2, 0 - strh r0, [r6, 0xE] - movs r3, 0xAC - lsls r3, 1 - adds r0, r6, r3 - strb r2, [r0] - movs r1, 0xA6 - lsls r1, 1 - adds r0, r6, r1 - mov r3, r8 - strb r3, [r0] - movs r0, 0x9E - lsls r0, 1 - adds r1, r6, r0 - movs r3, 0xA0 - lsls r3, 1 - adds r0, r6, r3 - ldr r0, [r0] - str r0, [r1] - ldrb r0, [r6, 0x7] - cmp r0, 0 - beq _0806DC36 - ldr r0, _0806DC50 - ldr r1, [r0] - ldr r3, _0806DC54 - adds r1, r3 - strb r2, [r1] - ldr r0, [r0] - ldr r1, _0806DC58 - adds r0, r1 - strb r2, [r0] -_0806DC36: - strb r2, [r5, 0x2] - strb r2, [r5, 0x1] - strb r2, [r5] - adds r0, r6, 0 - adds r0, 0xC8 - ldrb r0, [r0] - cmp r0, 0x3 - bne _0806DC48 - b _0806DEC8 -_0806DC48: - b _0806DEE4 - .align 2, 0 -_0806DC4C: .4byte gUnknown_80F9D28 -_0806DC50: .4byte gDungeon -_0806DC54: .4byte 0x00000679 -_0806DC58: .4byte 0x00000676 -_0806DC5C: - ldrb r0, [r6, 0x7] - cmp r0, 0 - bne _0806DC64 - b _0806DDFC -_0806DC64: - mov r10, r5 - ldrb r1, [r5] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0806DC72 - b _0806DDFC -_0806DC72: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0806DC7C - b _0806DDFC -_0806DC7C: - ldrb r0, [r5, 0x2] - cmp r0, 0xD8 - beq _0806DC84 - b _0806DDFC -_0806DC84: - movs r4, 0 -_0806DC86: - ldr r0, _0806DD80 - ldr r0, [r0] - lsls r1, r4, 2 - ldr r2, _0806DD84 - adds r0, r2 - adds r0, r1 - ldr r0, [r0] - mov r8, r0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806DCDE - cmp r8, r7 - beq _0806DCDE - adds r0, r7, 0 - mov r1, r8 - bl CanSeeTarget - lsls r0, 24 - cmp r0, 0 - beq _0806DCDE - mov r3, r8 - movs r0, 0x4 - ldrsh r1, [r3, r0] - movs r2, 0x4 - ldrsh r0, [r7, r2] - subs r1, r0 - cmp r1, 0 - bge _0806DCC4 - negs r1, r1 -_0806DCC4: - cmp r1, 0x1 - bgt _0806DCDE - mov r3, r8 - movs r0, 0x6 - ldrsh r1, [r3, r0] - movs r2, 0x6 - ldrsh r0, [r7, r2] - subs r1, r0 - cmp r1, 0 - bge _0806DCDA - negs r1, r1 -_0806DCDA: - cmp r1, 0x1 - ble _0806DCE4 -_0806DCDE: - adds r4, 0x1 - cmp r4, 0x3 - ble _0806DC86 -_0806DCE4: - cmp r4, 0x4 - bne _0806DCEA - b _0806DDFC -_0806DCEA: - adds r0, r7, 0 - bl sub_8042148 - mov r3, r8 - ldr r4, [r3, 0x4] - ldr r1, _0806DD88 - mov r0, r8 - adds r2, r7, 0 - bl sub_8068FE0 - lsls r1, r4, 16 - asrs r1, 16 - asrs r4, 16 - adds r0, r7, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_80694C0 - adds r0, r7, 0 - movs r1, 0 - bl sub_804535C - adds r1, r7, 0 - adds r1, 0x22 - movs r0, 0 - strb r0, [r1] - ldrh r0, [r6, 0x10] - movs r4, 0 - strh r0, [r6, 0xE] - adds r0, r7, 0 - bl sub_8042A24 - movs r1, 0xAC - lsls r1, 1 - adds r0, r6, r1 - strb r4, [r0] - movs r2, 0xA6 - lsls r2, 1 - adds r1, r6, r2 - movs r0, 0x1 - strb r0, [r1] - movs r3, 0x9E - lsls r3, 1 - adds r1, r6, r3 - subs r2, 0xC - adds r0, r6, r2 - ldr r0, [r0] - str r0, [r1] - ldrb r0, [r6, 0x7] - cmp r0, 0 - beq _0806DD62 - ldr r0, _0806DD80 - ldr r1, [r0] - ldr r3, _0806DD8C - adds r1, r3 - strb r4, [r1] - ldr r0, [r0] - ldr r1, _0806DD90 - adds r0, r1 - strb r4, [r0] -_0806DD62: - mov r2, r10 - strb r4, [r2, 0x2] - strb r4, [r2, 0x1] - strb r4, [r2] - adds r0, r6, 0 - adds r0, 0xC8 - ldrb r0, [r0] - cmp r0, 0x3 - bne _0806DD94 - mov r0, r9 - adds r1, r7, 0 - movs r2, 0x3 - bl SendWaitingEndMessage - b _0806DDA2 - .align 2, 0 -_0806DD80: .4byte gDungeon -_0806DD84: .4byte 0x0001357c -_0806DD88: .4byte 0x00000221 -_0806DD8C: .4byte 0x00000679 -_0806DD90: .4byte 0x00000676 -_0806DD94: - cmp r0, 0x2 - bne _0806DDA2 - mov r0, r9 - adds r1, r7, 0 - movs r2, 0x2 - bl SendWaitingEndMessage -_0806DDA2: - adds r0, r7, 0 - bl sub_8078084 - adds r0, r6, 0 - movs r1, 0 - bl sub_806BFC0 - bl sub_800DBBC - adds r0, r7, 0 - bl sub_806A390 - adds r0, r7, 0 - bl sub_806CEBC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r7, 0 - bl sub_806CCB4 - adds r0, r7, 0 - bl EntityUpdateStatusSprites - ldr r4, _0806DDF0 - adds r0, r4, 0 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - adds r4, 0x50 - adds r0, r4, 0 - mov r1, r8 - movs r2, 0 - bl SetMessageArgument - ldr r0, _0806DDF4 - b _0806DF2E - .align 2, 0 -_0806DDF0: .4byte gAvailablePokemonNames -_0806DDF4: .4byte gUnknown_80FD484 -_0806DDF8: - mov r4, r8 - b _0806DE64 -_0806DDFC: - adds r0, r7, 0 - movs r1, 0x16 - bl IQSkillIsEnabled - lsls r0, 24 - cmp r0, 0 - bne _0806DE0C - b _0806DF48 -_0806DE0C: - movs r4, 0 - ldrb r1, [r5] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0806DE28 - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0806DE28 - ldrb r0, [r5, 0x2] - cmp r0, 0x3A - bne _0806DE28 - adds r4, r5, 0 -_0806DE28: - cmp r4, 0 - bne _0806DE68 - ldrb r0, [r6, 0x6] - cmp r0, 0 - bne _0806DE64 - movs r3, 0 - ldr r0, _0806DED4 - ldr r2, [r0] - mov r12, r2 - movs r0, 0x1 - mov r10, r0 -_0806DE3E: - lsls r0, r3, 2 - add r0, r12 - mov r8, r0 - ldrb r1, [r2] - mov r0, r10 - ands r0, r1 - cmp r0, 0 - beq _0806DE5C - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0806DE5C - ldrb r0, [r2, 0x2] - cmp r0, 0x3A - beq _0806DDF8 -_0806DE5C: - adds r2, 0x4 - adds r3, 0x1 - cmp r3, 0x13 - ble _0806DE3E -_0806DE64: - cmp r4, 0 - beq _0806DF48 -_0806DE68: - adds r0, r7, 0 - bl sub_8042148 - adds r0, r4, 0 - movs r1, 0x46 - movs r2, 0x2 - bl sub_8045C28 - adds r1, r7, 0 - adds r1, 0x22 - movs r0, 0 - strb r0, [r1] - ldrh r0, [r6, 0x10] - movs r2, 0 - strh r0, [r6, 0xE] - movs r1, 0xAC - lsls r1, 1 - adds r0, r6, r1 - strb r2, [r0] - movs r3, 0xA6 - lsls r3, 1 - adds r1, r6, r3 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x9E - lsls r0, 1 - adds r1, r6, r0 - subs r3, 0xC - adds r0, r6, r3 - ldr r0, [r0] - str r0, [r1] - ldrb r0, [r6, 0x7] - cmp r0, 0 - beq _0806DEBE - ldr r0, _0806DED8 - ldr r1, [r0] - ldr r3, _0806DEDC - adds r1, r3 - strb r2, [r1] - ldr r0, [r0] - ldr r1, _0806DEE0 - adds r0, r1 - strb r2, [r0] -_0806DEBE: - adds r0, r6, 0 - adds r0, 0xC8 - ldrb r0, [r0] - cmp r0, 0x3 - bne _0806DEE4 -_0806DEC8: - mov r0, r9 - adds r1, r7, 0 - movs r2, 0x3 - bl SendWaitingEndMessage - b _0806DEF2 - .align 2, 0 -_0806DED4: .4byte gTeamInventoryRef -_0806DED8: .4byte gDungeon -_0806DEDC: .4byte 0x00000679 -_0806DEE0: .4byte 0x00000676 -_0806DEE4: - cmp r0, 0x2 - bne _0806DEF2 - mov r0, r9 - adds r1, r7, 0 - movs r2, 0x2 - bl SendWaitingEndMessage -_0806DEF2: - adds r0, r7, 0 - bl sub_8078084 - adds r0, r6, 0 - movs r1, 0 - bl sub_806BFC0 - bl sub_800DBBC - adds r0, r7, 0 - bl sub_806A390 - adds r0, r7, 0 - bl sub_806CEBC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r7, 0 - bl sub_806CCB4 - adds r0, r7, 0 - bl EntityUpdateStatusSprites - ldr r0, _0806DF40 - adds r1, r7, 0 - movs r2, 0 - bl SetMessageArgument - ldr r0, _0806DF44 -_0806DF2E: - ldr r1, [r0] - mov r0, r9 - bl sub_805239C - adds r0, r7, 0 - bl sub_806F63C - bl _0806D608 - .align 2, 0 -_0806DF40: .4byte gUnknown_202DFE8 -_0806DF44: .4byte gUnknown_80FD46C -_0806DF48: - ldrb r4, [r6, 0x7] - cmp r4, 0 - bne _0806DF68 - ldrb r1, [r5] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0806DF68 - adds r1, r7, 0x4 - adds r0, r7, 0 - adds r2, r5, 0 - bl sub_80464C8 - strb r4, [r5, 0x2] - strb r4, [r5, 0x1] - strb r4, [r5] -_0806DF68: - adds r0, r6, 0 - adds r0, 0xF7 - ldrb r0, [r0] - cmp r0, 0 - beq _0806DF7E - ldr r0, _0806E02C - ldr r0, [r0] - ldr r2, _0806E030 - adds r0, r2 - ldr r1, _0806E034 - strh r1, [r0] -_0806DF7E: - movs r3, 0 - mov r10, r3 - mov r0, r9 - bl GetEntityType - cmp r0, 0x1 - bne _0806E066 - mov r0, r9 - ldr r4, [r0, 0x70] - movs r1, 0x2 - ldrsh r0, [r6, r1] - ldrb r1, [r6, 0x9] - bl CalculateEXPGain - adds r5, r0, 0 - adds r0, r6, 0 - adds r0, 0xFB - ldrb r0, [r0] - cmp r0, 0 - beq _0806DFAE - cmp r0, 0x2 - bne _0806DFB4 - lsls r0, r5, 1 - adds r5, r0, r5 -_0806DFAE: - lsrs r0, r5, 31 - adds r0, r5, r0 - asrs r5, r0, 1 -_0806DFB4: - cmp r5, 0 - bne _0806DFBA - movs r5, 0x1 -_0806DFBA: - ldrb r0, [r4, 0x7] - cmp r0, 0 - beq _0806DFC8 - movs r2, 0x2 - ldrsh r0, [r6, r2] - bl sub_80980B4 -_0806DFC8: - adds r0, r6, 0 - adds r0, 0xF4 - ldrb r0, [r0] - cmp r0, 0 - beq _0806DFDA - ldr r3, _0806E038 - adds r1, r4, r3 - movs r0, 0x1 - strb r0, [r1] -_0806DFDA: - ldr r0, [sp, 0x78] - cmp r0, 0x1 - bne _0806E066 - ldrb r0, [r4, 0x6] - cmp r0, 0 - bne _0806E040 - ldrb r0, [r6, 0x6] - cmp r0, 0 - beq _0806E066 - mov r0, r9 - mov r1, r9 - adds r2, r5, 0 - bl sub_8071D4C - movs r6, 0 -_0806DFF8: - ldr r0, _0806E02C - ldr r0, [r0] - lsls r1, r6, 2 - ldr r2, _0806E03C - adds r0, r2 - adds r0, r1 - ldr r4, [r0] - adds r0, r4, 0 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806E020 - cmp r4, r9 - beq _0806E020 - mov r0, r9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_8071D4C -_0806E020: - adds r6, 0x1 - cmp r6, 0x3 - ble _0806DFF8 - movs r3, 0x1 - mov r10, r3 - b _0806E066 - .align 2, 0 -_0806E02C: .4byte gDungeon -_0806E030: .4byte 0x0000066a -_0806E034: .4byte 0x000003e7 -_0806E038: .4byte 0x0000014b -_0806E03C: .4byte 0x0001357c -_0806E040: - ldr r5, _0806E0BC - ldr r0, [r5] - ldr r1, _0806E0C0 - adds r0, r1 - ldrb r0, [r0] - bl DoEnemiesEvolveWhenKOed - lsls r0, 24 - cmp r0, 0 - beq _0806E066 - ldr r2, _0806E0C4 - adds r0, r4, r2 - add r3, sp, 0x78 - ldrb r3, [r3] - strb r3, [r0] - ldr r0, [r5] - add r1, sp, 0x78 - ldrb r1, [r1] - strb r1, [r0, 0xD] -_0806E066: - mov r0, r9 - bl EntityExists - lsls r0, 24 - cmp r0, 0 - beq _0806E08A - mov r0, r9 - bl GetEntityType - cmp r0, 0x1 - bne _0806E08A - mov r2, r9 - ldr r0, [r2, 0x70] - ldrb r0, [r0, 0x7] - cmp r0, 0 - bne _0806E08A - movs r3, 0 - mov r10, r3 -_0806E08A: - mov r0, r10 - cmp r0, 0 - beq _0806E0E4 - add r0, sp, 0x4 - adds r1, r7, 0 - bl sub_8069D4C - mov r0, r9 - adds r1, r7, 0 - bl sub_806F660 - lsls r0, 24 - cmp r0, 0 - beq _0806E0D8 - mov r0, r9 - adds r1, r7, 0 - add r2, sp, 0x4 - bl sub_806FA5C - lsls r0, 24 - cmp r0, 0 - bne _0806E0CC - ldr r1, _0806E0C8 - adds r0, r7, 0 - b _0806E0DC - .align 2, 0 -_0806E0BC: .4byte gDungeon -_0806E0C0: .4byte 0x00000644 -_0806E0C4: .4byte 0x00000149 -_0806E0C8: .4byte 0x000001f5 -_0806E0CC: - ldr r1, _0806E0D4 - movs r0, 0x1 - strb r0, [r1] - b _0806E0EE - .align 2, 0 -_0806E0D4: .4byte gUnknown_202F221 -_0806E0D8: - adds r0, r7, 0 - ldr r1, [sp, 0x50] -_0806E0DC: - mov r2, r9 - bl sub_8068FE0 - b _0806E0EE -_0806E0E4: - adds r0, r7, 0 - ldr r1, [sp, 0x50] - mov r2, r9 - bl sub_8068FE0 -_0806E0EE: - movs r0, 0x1 -_0806E0F0: - add sp, 0x58 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_806D528 - - .align 2, 0 diff --git a/asm/code_806E8B0.s b/asm/code_806E8B0.s index 7eb95141..bbe1391a 100644 --- a/asm/code_806E8B0.s +++ b/asm/code_806E8B0.s @@ -33,7 +33,7 @@ sub_806EAF4: ldr r1, [r1, 0x70] str r1, [sp, 0x7C] adds r0, r2, 0 - bl sub_8092354 + bl IsTypePhysical movs r2, 0 str r2, [sp, 0x80] lsls r0, 24 @@ -1030,7 +1030,7 @@ DealDamageToEntity: add r0, sp, 0x10 mov r1, r8 movs r3, 0 - bl sub_806D010 + bl HandleDealingDamage add sp, 0x94 pop {r3} mov r8, r3 @@ -1138,7 +1138,7 @@ _0806F414: adds r1, r7, 0 add r2, sp, 0x10 movs r3, 0 - bl sub_806D010 + bl HandleDealingDamage ldr r0, [sp, 0x4C] cmp r0, 0 beq _0806F440 diff --git a/data/data_810AC60.s b/data/data_810AC60.s index c1730f5c..b87dba06 100644 --- a/data/data_810AC60.s +++ b/data/data_810AC60.s @@ -41,8 +41,8 @@ gUnknown_810AC6A: @ 810AC6A .byte 0x10 .byte 0x05 - .global gUnknown_810AC7C -gUnknown_810AC7C: @ 810AC7C + .global gIsTypePhysicalTable +gIsTypePhysicalTable: @ 810AC7C .byte 0x01 .byte 0x01 .byte 0x00 diff --git a/include/code_8041AD0.h b/include/code_8041AD0.h new file mode 100644 index 00000000..8f085951 --- /dev/null +++ b/include/code_8041AD0.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CODE_8041AD0_H +#define GUARD_CODE_8041AD0_H + +#include "structs/str_damage.h" + +void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct); + +#endif diff --git a/include/code_8069D4C.h b/include/code_8069D4C.h new file mode 100644 index 00000000..bb653ea5 --- /dev/null +++ b/include/code_8069D4C.h @@ -0,0 +1,25 @@ +#ifndef GUARD_CODE_8069D4C_H +#define GUARD_CODE_8069D4C_H + +struct unkStruct_8069D4C +{ + s16 id; + Position pos; + s16 HP; + u8 atk; + u8 spAtk; + u8 def; + u8 spDef; + u16 level; + u32 exp; + FixedPoint belly; + FixedPoint maxBelly; + Item heldItem; + Move moves[MAX_MON_MOVES]; + u32 unk40; // strugglemoveFlags? + HiddenPower hiddenPower; +}; + +void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target); + +#endif diff --git a/include/constants/iq_skill.h b/include/constants/iq_skill.h index da6b3e3e..7a2bdd8f 100644 --- a/include/constants/iq_skill.h +++ b/include/constants/iq_skill.h @@ -30,4 +30,4 @@ enum IQSkillID NUM_IQ_SKILLS }; -#endif // GUARD_CONSTANTS_IQ_SKILL_H \ No newline at end of file +#endif // GUARD_CONSTANTS_IQ_SKILL_H diff --git a/include/constants/move.h b/include/constants/move.h index b5b09e6e..87215f2e 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -60,4 +60,4 @@ enum TargetingFlag TARGETING_FLAG_EXPOSE = 0x600, }; -#endif // GUARD_CONSTANTS_MOVE_H \ No newline at end of file +#endif // GUARD_CONSTANTS_MOVE_H diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 5f2941d9..91da6a21 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -225,7 +225,7 @@ typedef struct EntityInfo u8 fill95[0x98 - 0x95]; /* 0x98 */ u32 unk98; /* 0x9C */ u32 unk9C; - /* 0xA0 */ u32 unkA0; + /* 0xA0 */ s32 unkA0; /* 0xA4 */ u8 clientType; u8 fillA5[0xA8 - 0xA5]; // Statuses are split into groups based on which ones can't overlap. @@ -413,4 +413,9 @@ enum VisualFlag VISUAL_FLAG_RUN_AWAY = 2 }; +static inline EntityInfo *GetEntInfo(Entity *ent) +{ + return ent->info; +} + #endif diff --git a/include/structs/str_damage.h b/include/structs/str_damage.h new file mode 100644 index 00000000..438ebf86 --- /dev/null +++ b/include/structs/str_damage.h @@ -0,0 +1,15 @@ +#ifndef GUARD_STR_DAMAGE_H +#define GUARD_STR_DAMAGE_H + +struct DamageStruct +{ + s32 dmg; + s32 residualDmgType; + u32 typeEffectiveness; + u8 type; + bool8 isCrit; + u8 unkE; + u8 unkF; +}; + +#endif diff --git a/include/text_util.h b/include/text_util.h index 3ae9b765..a5ac62cd 100644 --- a/include/text_util.h +++ b/include/text_util.h @@ -7,7 +7,7 @@ void CopyStringtoBuffer(u8 *buffer, u8 *string); void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size); const char *GetUnformattedTypeString(u8 type); const char * GetFormattedTypeString(u8 type); -u8 sub_8092354(u8 index); +u8 IsTypePhysical(u8 index); u8 sub_8092364(u8 index); void CopyAbilityNametoBuffer(char *buffer, u8 index); u8 *GetAbilityDescription(u8 index); diff --git a/ld_script.txt b/ld_script.txt index c7a20c36..0c66956f 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -253,7 +253,6 @@ SECTIONS { src/code_8069E0C.o(.text); asm/code_8069E0C.o(.text); src/code_806CD90.o(.text); - asm/code_806CD90.o(.text); src/type_effectiveness.o(.text); src/code_806E8B0.o(.text); asm/code_806E8B0.o(.text); diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index b186e9dc..af66eb6f 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -3,6 +3,8 @@ #include "code_803E46C.h" #include "code_804267C.h" #include "code_806CD90.h" +#include "code_8041AD0.h" +#include "type_chart.h" #include "constants/direction.h" #include "constants/status.h" #include "constants/type.h" @@ -12,14 +14,6 @@ #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" -// size: 0xC -struct unkStruct_80420E8 -{ - u32 unk0; - u32 unk4; - u32 unk8; -}; - // size: 0x1C typedef struct unkStruct_80416E0 { @@ -823,26 +817,26 @@ void nullsub_92(Entity *pokemon) { } -void sub_80420E8(Entity *pokemon, struct unkStruct_80420E8 *r1) +void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct) { - u32 temp; + u32 typeEffectiveness; u32 arg; - temp = r1->unk8; + typeEffectiveness = dmgStruct->typeEffectiveness; if(gDungeon->unk16D != 0) - temp = sub_806F62C(r1->unk8); - switch(temp) + typeEffectiveness = sub_806F62C(dmgStruct->typeEffectiveness); + switch(typeEffectiveness) { default: - case 0: + case EFFECTIVENESS_IMMUNE: arg = 8; break; - case 1: + case EFFECTIVENESS_RESIST: arg = 9; break; - case 2: + case EFFECTIVENESS_NEUTRAL: arg = 10; break; - case 3: + case EFFECTIVENESS_SUPER: arg = 11; break; } diff --git a/src/code_8069D4C.c b/src/code_8069D4C.c index a132c064..5b45774d 100644 --- a/src/code_8069D4C.c +++ b/src/code_8069D4C.c @@ -1,25 +1,7 @@ #include "global.h" #include "pokemon_mid.h" #include "dungeon_util.h" - -struct unkStruct_8069D4C -{ - s16 id; - Position pos; - s16 HP; - u8 atk; - u8 spAtk; - u8 def; - u8 spDef; - u16 level; - u32 exp; - FixedPoint belly; - FixedPoint maxBelly; - Item heldItem; - Move moves[MAX_MON_MOVES]; - u32 unk40; // strugglemoveFlags? - HiddenPower hiddenPower; -}; +#include "code_8069D4C.h" u32 sub_8069D18(Position *pos,Entity *entity) { diff --git a/src/code_806CD90.c b/src/code_806CD90.c index 317d12ba..b0f6898e 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -1,17 +1,45 @@ #include "global.h" #include "code_806CD90.h" - #include "code_803E46C.h" #include "code_805D8C8.h" #include "constants/direction.h" #include "constants/status.h" +#include "constants/ability.h" +#include "constants/type.h" +#include "constants/dungeon.h" +#include "constants/iq_skill.h" #include "dungeon_util.h" +#include "code_803E668.h" +#include "exclusive_pokemon.h" +#include "code_8077274_1.h" +#include "code_8069D4C.h" +#include "code_8045A00.h" +#include "position_util.h" +#include "game_options.h" +#include "dungeon_items.h" +#include "status.h" #include "pokemon_mid.h" #include "pokemon.h" #include "random.h" +#include "targeting.h" #include "sprite.h" #include "structs/str_dungeon.h" #include "tile_types.h" +#include "dungeon_capabilities.h" +#include "dungeon_random.h" +#include "text_util.h" +#include "dungeon_visibility.h" +#include "code_804267C.h" +#include "move_effects_target.h" +#include "dungeon_pokemon_attributes.h" +#include "code_8041AD0.h" +#include "type_chart.h" + +extern u8 gUnknown_202F221; +extern u8 gUnknown_202DFE8[]; + +extern void sub_806BFC0(EntityInfo *, u32); +extern void sub_805239C(Entity *, const u8 *); const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00 }; @@ -228,3 +256,760 @@ u32 sub_806CF98(Entity *entity) entityInfo->unk204 = shadowSize; return shadowSize; } + +static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8); + +extern void sub_807F43C(Entity *, Entity *); +extern void sub_8041B18(Entity *pokemon); +extern void sub_8041B90(Entity *pokemon); +extern void sub_80522F4(Entity *, Entity *, const u8 *); +extern void sub_8041D00(Entity *pokemon, Entity *target); +extern void DealDamageToEntity(Entity *, s32, u32, u32); +extern void SetShopkeeperAggression(Entity *, Entity *); +extern void sub_8042238(Entity *pokemon, Entity *target); +extern void sub_803ED30(s32, Entity *r0, u8, s32); +extern bool8 sub_806A458(Entity *); +extern bool8 sub_806F660(Entity *, Entity *); +extern bool8 sub_806A58C(s16 a0); +extern void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp); +extern void sub_8042148(Entity *pokemon); +extern void sub_8068FE0(Entity *, u32, Entity *r2); +extern void sub_80694C0(Entity *, s32, s32, u32); +extern void sub_8042A24(Entity *r0); +extern void sub_806A390(Entity *r0); +extern void sub_806F63C(Entity *r0); +extern void sub_8078084(Entity * pokemon); +extern void sub_800DBBC(void); +extern void sub_8045C28(Item *Item, u8 itemID, u32 param_3); +extern void sub_80464C8(Entity *, Position *, Item *); +extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon); +extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *); +extern void EntityUpdateStatusSprites(Entity *); +extern bool8 sub_8045888(Entity *r0); +extern void sub_8049ED4(void); + +extern const s32 gUnknown_8106A4C; +extern const s16 gUnknown_80F4E10; +extern const s16 gUnknown_80F4E12; +extern const s16 gUnknown_80F4E14; +extern const s16 gUnknown_80F4E16; +extern const s16 gUnknown_80F4E18; +extern const s16 gUnknown_80F4E1A; +extern const s16 gUnknown_80F4E1C; +extern const s16 gUnknown_80F4E1E; +extern const s16 gUnknown_80F4E20; +extern const s16 gUnknown_80F4F8C; +extern const u8 *const gUnknown_80FCFA4; +extern const u8 *const gUnknown_80FCA90; +extern const u8 *const gUnknown_80F9600; +extern const u8 *const gUnknown_80F9614; +extern const u8 *const gUnknown_80F9630; +extern const u8 *const gUnknown_80F9654; +extern const u8 *const gUnknown_80F9670; +extern const u8 *const gUnknown_80F9614; +extern const u8 *const gUnknown_80F9688; +extern const u8 *const gUnknown_80FD484; +extern const u8 *const gUnknown_80F96A8; +extern const u8 *const gUnknown_8100548; +extern const u8 *const gUnknown_80FD46C; +extern const u8 *const gUnknown_810056C; +extern const u8 *const gUnknown_80F9E44; +extern const u8 *const gUnknown_80F9764[]; +extern const u8 *const gUnknown_80F9CC0[]; +extern const u8 *const gUnknown_80F9CEC[]; +extern const u8 *const gUnknown_80F9DAC[]; +extern const u8 *const gUnknown_80F9DF0[]; +extern const u8 *const gUnknown_80F9D8C[]; +extern const u8 *const gUnknown_80F9D84[]; +extern const u8 *const gUnknown_80F9D28[]; + +extern u8 gAvailablePokemonNames[]; +extern u32 gFormatData_202DE30; + +void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, s32 giveExp, s16 arg4, bool32 arg8, s32 argC) +{ + bool32 r9; + // Some compiler weirdness, because it won't match without creating arg4 again + s32 r10 = arg4; + s32 returnDmg = 0; + + if (HandleDealingDamageInternal(attacker, target, dmgStruct, isFalseSwipe, giveExp, r10, argC)) + return; + if (dmgStruct->unkF) + return; + if (!EntityExists(attacker) || !EntityExists(target)) + return; + if (GetEntityType(attacker) != ENTITY_MONSTER || GetEntityType(target) != ENTITY_MONSTER) + return; + + r9 = arg8; + if (CheckVariousStatuses(target) || target->info->charging.chargingStatus != 0) + r9 = FALSE; + if (r9 + && abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1 + && attacker != target + && IsTypePhysical(dmgStruct->type) + && target->info->protection.protectionStatus == STATUS_VITAL_THROW) + { + sub_8042730(target, attacker); + sub_807F43C(target, attacker); + } + + if (target->info->charging.chargingStatus == STATUS_ENRAGED) { + RaiseAttackStageTarget(attacker, target, gUnknown_8106A4C, 1); + } + + if (!EntityExists(attacker) || !EntityExists(target)) + return; + + if (r9 + && attacker != target + && abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1) + { + bool32 isPhysical = IsTypePhysical(dmgStruct->type); + if (target->info->protection.protectionStatus == STATUS_COUNTER && isPhysical) { + sub_8041B18(target); + returnDmg += 4; + } + if (target->info->protection.protectionStatus == STATUS_MINI_COUNTER && isPhysical) { + sub_8041B18(target); + returnDmg += 1; + } + if (target->info->protection.protectionStatus == STATUS_MIRROR_COAT && !isPhysical) { + sub_8041B90(target); + returnDmg += 4; + } + + if (HasAbility(target, ABILITY_ROUGH_SKIN)) + returnDmg += 2; + + if (returnDmg) { + struct DamageStruct sp; + + sub_80522F4(attacker, target, gUnknown_80FCFA4); + sp.dmg = (dmgStruct->dmg * returnDmg) / 4; + sp.type = dmgStruct->type; + sp.residualDmgType = 6; + sp.typeEffectiveness = 2; + sp.isCrit = FALSE; + sp.unkE = 0; + sp.unkF = 0; + HandleDealingDamageInternal(target, attacker, &sp, FALSE, giveExp, r10, argC); + } + } + if (!EntityExists(attacker) || !EntityExists(target)) + return; + + // Check trapping / contact abilities + if (r9 + && attacker != target + && abs(attacker->pos.x - target->pos.x) <= 1 && abs(attacker->pos.y - target->pos.y) <= 1) + { + bool32 isPhysical = IsTypePhysical(dmgStruct->type); + EntityInfo *attackerInfo = attacker->info; + + if (HasAbility(target, ABILITY_ARENA_TRAP) + && !MonsterIsType(attacker, TYPE_FLYING) + && !HasAbility(attacker, ABILITY_LEVITATE) + && DungeonRandInt(100) < gUnknown_80F4E10) + { + attackerInfo->unk178 |= 1; + } + if (HasAbility(target, ABILITY_SHADOW_TAG) + && DungeonRandInt(100) < gUnknown_80F4E12) + { + attackerInfo->unk178 |= 2; + } + if (HasAbility(target, ABILITY_MAGNET_PULL) + && MonsterIsType(attacker, TYPE_STEEL) + && DungeonRandInt(100) < gUnknown_80F4E14) + { + attackerInfo->unk178 |= 4; + } + + if (HasAbility(target, ABILITY_STATIC) + && isPhysical + && DungeonRandInt(100) < gUnknown_80F4E16) + { + attackerInfo->unk178 |= 8; + } + if (HasAbility(target, ABILITY_POISON_POINT) + && DungeonRandInt(100) < gUnknown_80F4E18) + { + attackerInfo->unk178 |= 0x20; + } + if (HasAbility(target, ABILITY_EFFECT_SPORE) + && isPhysical + && DungeonRandInt(100) < gUnknown_80F4E1A) + { + s32 rnd = DungeonRandInt(3); + if (rnd < 1) + attackerInfo->unk178 |= 0x40; + else if (rnd < 2) + attackerInfo->unk178 |= 0x10; + else + attackerInfo->unk178 |= 0x80; + } + if (HasAbility(target, ABILITY_FLAME_BODY) + && DungeonRandInt(100) < gUnknown_80F4E1C) + { + attackerInfo->unk178 |= 0x100; + } + if (HasAbility(target, ABILITY_CUTE_CHARM) + && isPhysical + && DungeonRandInt(100) < gUnknown_80F4E1E) + { + attackerInfo->unk178 |= 0x200; + } + if (HasAbility(target, ABILITY_STENCH) + && DungeonRandInt(100) < gUnknown_80F4E20) + { + attackerInfo->unk178 |= 0x400; + } + } + if (!EntityExists(attacker) || !EntityExists(target)) + return; + + // Destiny Bond + if (r9) { + EntityInfo *targetInfo = GetEntInfo(target); + if (targetInfo->linked.linkedStatus == STATUS_DESTINY_BOND) { + Entity *destBondTarget = gDungeon->allPokemon[targetInfo->linked.unkD8]; + if (destBondTarget == NULL) { + targetInfo->linked.linkedStatus = 0; + } + else if (destBondTarget->info->unk98 != targetInfo->linked.unkD4) { + targetInfo->linked.linkedStatus = 0; + } + else { + sub_8041D00(destBondTarget, target); + DealDamageToEntity(destBondTarget, dmgStruct->dmg, 0xC, 0x1F9); + } + } + } +} + +static inline void ZeroOutItem(Item *item) +{ + item->id = 0; + item->quantity = 0; + item->flags = 0; +} + +static inline bool8 ItemSticky(Item *item) +{ + return (item->flags & ITEM_FLAG_STICKY); +} + +static inline bool8 ItemExists(Item *item) +{ + return (item->flags & ITEM_FLAG_EXISTS); +} + +static inline bool8 ItemInShop(Item *item) +{ + return (item->flags & ITEM_FLAG_IN_SHOP); +} + +static inline u8 ItemId(Item *item) +{ + return item->id; +} + +static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8) +{ + s32 hpBefore, hpChange; + EntityInfo *targetData; + s32 arg4 = arg4_; + bool32 var_24 = FALSE; + bool32 r10 = FALSE; + s32 r8 = 0; + Tile *unkTile = NULL; + + dmgStruct->unkF = 0; + if (GetEntityType(target) != ENTITY_MONSTER) { + dmgStruct->unkF = 1; + return FALSE; + } + + targetData = GetEntInfo(target); + TrySendImmobilizeSleepEndMsg(attacker, target); + SetShopkeeperAggression(attacker, target); + if (GetEntityType(attacker) == ENTITY_MONSTER + && attacker->info->moveStatus.moveStatus == STATUS_SET_DAMAGE + && dmgStruct->unkE == 0) + { + dmgStruct->dmg = gUnknown_80F4F8C; + } + + if (arg4 != 0x20E && HasAbility(target, ABILITY_STURDY) && dmgStruct->dmg == 9999) { + SetMessageArgument(gUnknown_202DFE8, target, 0); + sub_80522F4(attacker, target, gUnknown_80FCA90); + sub_8042238(attacker, target); + dmgStruct->unkF = 1; + return FALSE; + } + if (targetData->immobilize.immobilizeStatus == STATUS_FROZEN) { + SetMessageArgument(gUnknown_202DFE8, target, 0); + sub_80522F4(attacker, target, gUnknown_80F9600); + sub_8042238(attacker, target); + dmgStruct->unkF = 1; + return FALSE; + } + + if ((targetData->sleep.sleep == STATUS_SLEEP || targetData->sleep.sleep == STATUS_NAPPING || targetData->sleep.sleep == STATUS_NIGHTMARE) + && targetData->sleep.sleepTurns == 0x7F) + { + WakeUpPokemon(target); + } + + if ((HasAbility(target, ABILITY_VOLT_ABSORB) && dmgStruct->type == TYPE_ELECTRIC)) { + HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0); + dmgStruct->unkF = 1; + return FALSE; + } + else if (HasAbility(target, ABILITY_WATER_ABSORB) && dmgStruct->type == TYPE_WATER) { + HealTargetHP(attacker, target, dmgStruct->dmg, 0, 0); + dmgStruct->unkF = 1; + return FALSE; + } + + if (targetData->unk152 == 0) { + if (dmgStruct->isCrit) { + sub_80522F4(attacker, target, gUnknown_80F9614); + } + switch (dmgStruct->typeEffectiveness) { + case EFFECTIVENESS_IMMUNE: + sub_80522F4(attacker, target, gUnknown_80F9630); + break; + case EFFECTIVENESS_RESIST: + sub_80522F4(attacker, target, gUnknown_80F9654); + break; + case EFFECTIVENESS_SUPER: + sub_80522F4(attacker, target, gUnknown_80F9670); + break; + } + } + + SetMessageArgument(gAvailablePokemonNames, attacker, 0); + SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0); + if (dmgStruct->dmg == 0) { + if (sub_8045888(attacker) && sub_8045888(target)) { + if (targetData->unk152 == 0) { + sub_80522F4(attacker, target, gUnknown_80F9688); + } + sub_8042238(attacker, target); + } + else { + if (targetData->unk152 == 0) { + sub_80522F4(attacker, target, gUnknown_80F9688); + } + sub_803E708(0x1E, 0x18); + } + dmgStruct->unkF = 1; + return FALSE; + } + else if (dmgStruct->dmg == 9999) { + if (arg8 != 0 && sub_8045888(target)) { + unkTile = GetTileAtEntitySafe(target); + sub_803E708(0x14, 0x18); + unkTile->unk4 |= 4; + sub_8049ED4(); + } + if (targetData->unk152 == 0) { + sub_80522F4(attacker, target, gUnknown_80F96A8); + } + targetData->unkA0 = 999; + } + else { + const u8 *str; + + gFormatData_202DE30 = dmgStruct->dmg; + str = gUnknown_80F9764[dmgStruct->residualDmgType]; + + // Needed to match - the line can be safely removed + dmgStruct++;dmgStruct--; + + targetData->unkA0 += dmgStruct->dmg; + if (targetData->unkA0 > 999) + targetData->unkA0 = 999; + + if (sub_8045888(target)) { + if (dmgStruct->residualDmgType != 14) { + sub_803ED30(-dmgStruct->dmg, target, 1, -1); + } + if (targetData->unk152 == 0 && str != NULL) { + sub_80522F4(attacker, target, str); + } + } + else { + if (targetData->unk152 == 0 && str != NULL) { + sub_80522F4(attacker, target, str); + } + } + } + + if ((dmgStruct->residualDmgType != 14 || targetData->HP <= 1) && unkTile == NULL && sub_8045888(target)) { + if ((attacker->pos.x != target->pos.x || attacker->pos.y != target->pos.y) && GetEntityType(attacker) == ENTITY_MONSTER) { + bool32 unkBool = FALSE; + if (targetData->isTeamLeader) { + if (gGameOptionsRef->damageTurn != 0 && !sub_806A458(target)) { + if (CanSeeTarget(target, attacker)) + unkBool = TRUE; + else + unkBool = FALSE; + } + } + else { + unkBool = FALSE; + } + if (targetData->eyesightStatus.eyesightStatus == STATUS_BLINKER || targetData->eyesightStatus.eyesightStatus == STATUS_CROSS_EYED) + unkBool = FALSE; + if (unkBool) { + EntityInfo *info = GetEntInfo(target); + info->action.direction = (GetDirectionTowardsPosition(&target->pos, &attacker->pos) & DIRECTION_MASK); + } + TargetTileInFront(target); + } + sub_806CDD4(target, 6, target->info->action.direction); + sub_80420E8(target, dmgStruct); + var_24 = TRUE; + } + + // HP goes down + hpBefore = targetData->HP; + if (targetData->HP > dmgStruct->dmg) + targetData->HP -= dmgStruct->dmg; + else + targetData->HP = 0; + + if (targetData->protection.protectionStatus == STATUS_ENDURING) { + if (targetData->HP == 0) { + targetData->HP = 1; + sub_80522F4(attacker, target, gUnknown_8100548); + } + } + else if (isFalseSwipe == TRUE && targetData->HP == 0) { + targetData->HP = 1; + sub_80522F4(attacker, target, gUnknown_810056C); + } + + hpChange = hpBefore - targetData->HP; + if (hpChange < 0) + hpChange = 0; + + if (var_24 || unkTile != NULL) + sub_803E708(0xA, 0x18); + + if (targetData->HP != 0) { + if (var_24) { + sub_806CE68(target, 8); + } + if (HasHeldItem(target, ITEM_JOY_RIBBON) && hpChange > 0 && dmgStruct->dmg != 9999) { + sub_8071D4C(attacker, target, hpChange); + } + + if (unkTile != NULL) + { + unkTile->unk4 &= ~(0x4); + sub_8049ED4(); + } + return FALSE; + } + + // 0 HP + if (targetData->transformStatus.transformStatus == STATUS_TRANSFORMED) { + SendTransformEndMessage(attacker, target); + } + + if (unkTile != NULL) { + sub_803E708(0x14, 0x18); + target->unk22 = 2; + sub_803E708(0xA, 0x18); + unkTile->unk4 &= ~(0x4); + sub_8049ED4(); + } + else if (var_24) { + target->unk22 = 1; + sub_803E708(0x1E, 0x18); + } + + r8 = 1; + if (EntityExists(attacker) && GetEntityType(attacker) == ENTITY_MONSTER && attacker != target) + r8 = 0; + + targetData->unk14C = 0; + SetMessageArgument(gAvailablePokemonNames, attacker, 0); + SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0); + if (dmgStruct->residualDmgType == 19 || dmgStruct->residualDmgType == 20) { + if (targetData->isNotTeamMember) { + sub_80522F4(attacker, target, gUnknown_80F9E44); + } + else { + sub_805239C(attacker, gUnknown_80F9E44); + } + } + else if (targetData->isNotTeamMember) + { + if (targetData->clientType == CLIENT_TYPE_CLIENT) { + sub_805239C(attacker, gUnknown_80F9DF0[r8]); + } + else { + sub_80522F4(attacker, target, gUnknown_80F9CC0[r8]); + } + } + else { + PokemonStruct2 *recruitedMon = &gRecruitedPokemonRef->pokemon2[targetData->teamIndex]; + if (targetData->isTeamLeader || (targetData->joinedAt.joinedAt == DUNGEON_JOIN_LOCATION_PARTNER && gDungeon->unk65C == 0)) { + sub_805239C(attacker, gUnknown_80F9CEC[r8]); + } + else if (IsClientOrTeamBase(targetData->joinedAt.joinedAt)) { + sub_805239C(attacker, gUnknown_80F9DAC[r8]); + } + else if (targetData->clientType == CLIENT_TYPE_CLIENT) { + sub_805239C(attacker, gUnknown_80F9DF0[r8]); + } + else if (sub_806A58C(recruitedMon->unkA)) { + if (gDungeon->unk65D != 0) { + sub_805239C(attacker, gUnknown_80F9D8C[r8]); + } + else { + sub_805239C(attacker, gUnknown_80F9D84[r8]); + } + } + else { + sub_805239C(attacker, gUnknown_80F9D28[r8]); + } + } + + if (targetData->immobilize.immobilizeStatus == STATUS_WRAP || targetData->immobilize.immobilizeStatus == STATUS_WRAPPED) { + sub_8076CB4(targetData->unk9C); + } + + // Try revive items + if (targetData->heldItem.flags & ITEM_FLAG_EXISTS) { + // This do/while 0 loop has no effect other than matching asm, and can be removed. + do + { + if (!(ItemSticky(&targetData->heldItem)) && !(ItemInShop(&targetData->heldItem)) && ItemId(&targetData->heldItem) == ITEM_REVIVER_ORB) { + sub_8042148(target); + target->unk22 = 0; + targetData->HP = targetData->maxHPStat; + targetData->unk158 = 0; + targetData->unk14C = 1; + targetData->belly = targetData->maxBelly; + if (targetData->isTeamLeader) { + gDungeon->unk679 = 0; + gDungeon->itemHoldersIdentified = 0; + } + ZeroOutItem(&targetData->heldItem); + if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) { + SendWaitingEndMessage(attacker, target, STATUS_SNATCH); + } + else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) { + SendWaitingEndMessage(attacker, target, STATUS_DECOY); + } + sub_8078084(target); + sub_806BFC0(targetData, 0); + sub_800DBBC(); + sub_806A390(target); + sub_806CCB4(target, sub_806CEBC(target)); + EntityUpdateStatusSprites(target); + SetMessageArgument(gUnknown_202DFE8, target, 0); + sub_805239C(attacker, gUnknown_80FD46C); + sub_806F63C(target); + return FALSE; + } + } while(0); + } + + if (targetData->isTeamLeader) + { + Item *heldItem = &targetData->heldItem; + if (ItemExists(heldItem) && !(ItemSticky(heldItem)) && ItemId(heldItem) == ITEM_POSSESS_ORB ) { + s32 i; + Entity *teamMember; + + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + teamMember = gDungeon->teamPokemon[i]; + if (EntityExists(teamMember) + && teamMember != target + && CanSeeTarget(target, teamMember) + && abs(teamMember->pos.x - target->pos.x) <= 1 && abs(teamMember->pos.y - target->pos.y) <= 1) + { + break; + } + } + if (i != MAX_TEAM_MEMBERS) { + Position monPos; // r4 + + sub_8042148(target); + + monPos = teamMember->pos; + sub_8068FE0(teamMember, 0x221, target); + sub_80694C0(target, monPos.x, monPos.y, 1); + sub_804535C(target, NULL); + target->unk22 = 0; + targetData->HP = targetData->maxHPStat; + sub_8042A24(target); + targetData->unk158 = 0; + targetData->unk14C = 1; + targetData->belly = targetData->maxBelly; + if (targetData->isTeamLeader) { + gDungeon->unk679 = 0; + gDungeon->itemHoldersIdentified = 0; + } + ZeroOutItem(heldItem); + if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) { + SendWaitingEndMessage(attacker, target, STATUS_SNATCH); + } + else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) { + SendWaitingEndMessage(attacker, target, STATUS_DECOY); + } + sub_8078084(target); + sub_806BFC0(targetData, 0); + sub_800DBBC(); + sub_806A390(target); + sub_806CCB4(target, sub_806CEBC(target)); + EntityUpdateStatusSprites(target); + SetMessageArgument(gAvailablePokemonNames, target, 0); + SetMessageArgument(gAvailablePokemonNames + 0x50, teamMember, 0); + sub_805239C(attacker, gUnknown_80FD484); + sub_806F63C(target); + return FALSE; + } + + } + + } + + if (IQSkillIsEnabled(target, IQ_ITEM_MASTER)) { + s32 i; // r3 + Item *reviverSeed = NULL; // r4 + if (ItemExists(&targetData->heldItem) && !ItemSticky(&targetData->heldItem) && ItemId(&targetData->heldItem) == ITEM_REVIVER_SEED) + reviverSeed = &targetData->heldItem; + if (reviverSeed == NULL && !targetData->isNotTeamMember) { + for (i = 0; i < INVENTORY_SIZE; i++) { + Item *bagItem = &gTeamInventoryRef->teamItems[i]; + if (!(bagItem->flags & ITEM_FLAG_EXISTS)) + continue; + if (bagItem->flags & ITEM_FLAG_STICKY) + continue; + if (bagItem->id == ITEM_REVIVER_SEED) { + reviverSeed = bagItem; + break; + } + } + } + + if (reviverSeed != NULL) { + sub_8042148(target); + sub_8045C28(reviverSeed, ITEM_PLAIN_SEED, 2); + target->unk22 = 0; + targetData->HP = targetData->maxHPStat; + targetData->unk158 = 0; + targetData->unk14C = 1; + targetData->belly = targetData->maxBelly; + if (targetData->isTeamLeader) { + gDungeon->unk679 = 0; + gDungeon->itemHoldersIdentified = 0; + } + if (targetData->waitingStruct.waitingStatus == STATUS_SNATCH) { + SendWaitingEndMessage(attacker, target, STATUS_SNATCH); + } + else if (targetData->waitingStruct.waitingStatus == STATUS_DECOY) { + SendWaitingEndMessage(attacker, target, STATUS_DECOY); + } + sub_8078084(target); + sub_806BFC0(targetData, 0); + sub_800DBBC(); + sub_806A390(target); + sub_806CCB4(target, sub_806CEBC(target)); + EntityUpdateStatusSprites(target); + SetMessageArgument(gUnknown_202DFE8, target, 0); + sub_805239C(attacker, gUnknown_80FD46C); + sub_806F63C(target); + return FALSE; + } + } + + if (!targetData->isTeamLeader && ItemExists(&targetData->heldItem)) { + sub_80464C8(target, &target->pos, &targetData->heldItem); + ZeroOutItem(&targetData->heldItem); + } + if (targetData->bossFlag) { + gDungeon->bossSongIndex = 999; + } + + // Give exp + r10 = FALSE; + if (GetEntityType(attacker) == ENTITY_MONSTER) { + EntityInfo *attackerData = GetEntInfo(attacker); + s32 exp = CalculateEXPGain(targetData->id, targetData->level); + switch (targetData->unkFB) { + case 2: + exp *= 3; + exp /= 2; + break; + case 0: + exp /= 2; + break; + } + if (exp == 0) + exp = 1; + if (attackerData->isTeamLeader) { + sub_80980B4(targetData->id); + } + if (targetData->grudge) { + attackerData->unk14B = 1; + } + + if (giveExp == TRUE) { + if (!attackerData->isNotTeamMember) { + if (targetData->isNotTeamMember) { + s32 i; + + sub_8071D4C(attacker, attacker, exp); + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + Entity *teamMember = gDungeon->teamPokemon[i]; + if (EntityExists(teamMember) && teamMember != attacker) { + sub_8071D4C(attacker, teamMember, exp); + } + } + r10 = TRUE; + } + } + else { + if (DoEnemiesEvolveWhenKOed(gDungeon->dungeonLocation.id)) { + attackerData->unk149 = 1; + gDungeon->unkD = 1; + } + } + } + } + + if (EntityExists(attacker) && GetEntityType(attacker) == ENTITY_MONSTER && !attacker->info->isTeamLeader) + r10 = FALSE; + + if (r10) { + struct unkStruct_8069D4C sp; + + sub_8069D4C(&sp, target); + if (sub_806F660(attacker, target)) { + if (!sub_806FA5C(attacker, target, &sp)) { + sub_8068FE0(target, 0x1F5, attacker); + } + else { + gUnknown_202F221 = 1; + } + } + else { + sub_8068FE0(target, arg4, attacker); + } + } + else { + sub_8068FE0(target, arg4, attacker); + } + + return TRUE; +} diff --git a/src/code_806E8B0.c b/src/code_806E8B0.c index 5dad07aa..5d54e698 100644 --- a/src/code_806E8B0.c +++ b/src/code_806E8B0.c @@ -35,7 +35,7 @@ void sub_806E8B0(Entity * pokemon, Entity * target, u8 param_3, s32 *param_4, s3 r8 = 1; sp_0x4 = 1; sp_0x8 = 1; - r10 = sub_8092354(param_3) == 0; + r10 = IsTypePhysical(param_3) == 0; if (HasAbility(pokemon, ABILITY_GUTS)) { diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index ed8af85c..73ff352b 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -900,7 +900,7 @@ bool8 UseAttack(Entity *a0) for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { Entity *mon = gDungeon->allPokemon[i]; if (EntityExists(mon)) { - EntityInfo *monInfo = mon->info; + EntityInfo *monInfo = GetEntInfo(mon); if (monInfo->numMoveTiles == 0) { if (monInfo->waiting) { monInfo->waiting = FALSE; @@ -942,9 +942,7 @@ bool8 UseAttack(Entity *a0) for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { Entity *mon = gDungeon->allPokemon[i]; if (EntityExists(mon)) { - // r6 / r7 reg swap - EntityInfo *monInfo_ = mon->info; - EntityInfo *monInfo = monInfo_; + EntityInfo *monInfo = GetEntInfo(mon); Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving]; #ifndef NONMATCHING @@ -975,7 +973,7 @@ bool8 UseAttack(Entity *a0) for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { Entity *mon = gDungeon->allPokemon[i]; if (EntityExists(mon)) { - EntityInfo *monInfo = mon->info; + EntityInfo *monInfo = GetEntInfo(mon); monInfo->numMoveTiles = 0; nullsub_97(mon); if (monInfo->flags & 0x2000) { @@ -996,7 +994,7 @@ bool8 UseAttack(Entity *a0) if (sub_8044B28()) break; - monInfo = mon->info; + monInfo = GetEntInfo(mon); if ((j == 0 && !monInfo->isTeamLeader) || (j != 0 && monInfo->isTeamLeader)) continue; diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index bd7ba939..04dbe8e7 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -1572,9 +1572,7 @@ void SendMuzzledEndMessage(Entity * pokemon, Entity * target) bool8 TrySendImmobilizeSleepEndMsg(Entity * pokemon, Entity * target) { - // entityInfoMatch needed to match - EntityInfo *entityInfoMatch = target->info; - EntityInfo *entityInfo = entityInfoMatch; + EntityInfo *entityInfo = GetEntInfo(target); bool32 msg = FALSE; if (entityInfo->immobilize.immobilizeStatus == STATUS_PETRIFIED) { diff --git a/src/text_util.c b/src/text_util.c index fb85c31c..8c979a2d 100644 --- a/src/text_util.c +++ b/src/text_util.c @@ -93,7 +93,7 @@ const char * const gFormattedTypeStrings[NUM_POKEMON_TYPES] = extern u8 *gAbilityNames[]; extern u8 *AbilityDescriptions[]; -extern u8 gUnknown_810AC7C[]; +extern u8 gIsTypePhysicalTable[]; extern u8 gUnknown_810AC6A[]; extern u32 gUnknown_810983C[26]; // TODO: verify size later @@ -169,9 +169,9 @@ const char * GetFormattedTypeString(u8 type) return gFormattedTypeStrings[type]; } -u8 sub_8092354(u8 index) +u8 IsTypePhysical(u8 index) { - return gUnknown_810AC7C[index]; + return gIsTypePhysicalTable[index]; } u8 sub_8092364(u8 index)