mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 13:09:56 +00:00
sub_806D010 and GetEntInfo
This commit is contained in:
parent
5bb84ee604
commit
c9e15ca7e8
@ -5,647 +5,6 @@
|
||||
|
||||
.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}
|
||||
|
@ -413,4 +413,9 @@ enum VisualFlag
|
||||
VISUAL_FLAG_RUN_AWAY = 2
|
||||
};
|
||||
|
||||
static inline EntityInfo *GetEntInfo(Entity *ent)
|
||||
{
|
||||
return ent->info;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,10 +1,11 @@
|
||||
#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 "dungeon_util.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "pokemon.h"
|
||||
@ -12,6 +13,12 @@
|
||||
#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 "code_804267C.h"
|
||||
#include "move_effects_target.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
|
||||
const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00 };
|
||||
|
||||
@ -228,3 +235,198 @@ u32 sub_806CF98(Entity *entity)
|
||||
entityInfo->unk204 = shadowSize;
|
||||
return shadowSize;
|
||||
}
|
||||
|
||||
struct UnkStruct_sub_806D010
|
||||
{
|
||||
s32 unk0;
|
||||
s32 unk4;
|
||||
s32 unk8;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
};
|
||||
|
||||
bool8 sub_806D528(Entity *, Entity *, struct UnkStruct_sub_806D010 *r8, bool32, s32, s32, s32);
|
||||
|
||||
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 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 u8 *const gUnknown_80FCFA4;
|
||||
|
||||
void sub_806D010(Entity *r6, Entity *r5, struct UnkStruct_sub_806D010 *r8, bool32 r3, s32 arg0, s16 arg4, bool32 arg8, s32 argC)
|
||||
{
|
||||
bool32 r9;
|
||||
// Some compiler weirdness, because it won't match without creating arg4 again
|
||||
s32 r10 = arg4;
|
||||
s32 r7 = 0;
|
||||
|
||||
if (sub_806D528(r6, r5, r8, r3, arg0, r10, argC))
|
||||
return;
|
||||
if (r8->unkF)
|
||||
return;
|
||||
if (!EntityExists(r6) || !EntityExists(r5))
|
||||
return;
|
||||
if (GetEntityType(r6) != ENTITY_MONSTER || GetEntityType(r5) != ENTITY_MONSTER)
|
||||
return;
|
||||
|
||||
r9 = arg8;
|
||||
if (CheckVariousStatuses(r5) || r5->info->charging.chargingStatus != 0)
|
||||
r9 = FALSE;
|
||||
if (r9
|
||||
&& abs(r6->pos.x - r5->pos.x) <= 1 && abs(r6->pos.y - r5->pos.y) <= 1
|
||||
&& r6 != r5
|
||||
&& sub_8092354(r8->unkC)
|
||||
&& r5->info->protection.protectionStatus == STATUS_VITAL_THROW)
|
||||
{
|
||||
sub_8042730(r5, r6);
|
||||
sub_807F43C(r5, r6);
|
||||
}
|
||||
|
||||
if (r5->info->charging.chargingStatus == STATUS_ENRAGED) {
|
||||
RaiseAttackStageTarget(r6, r5, gUnknown_8106A4C, 1);
|
||||
}
|
||||
|
||||
if (!EntityExists(r6) || !EntityExists(r5))
|
||||
return;
|
||||
|
||||
if (r9
|
||||
&& r6 != r5
|
||||
&& abs(r6->pos.x - r5->pos.x) <= 1 && abs(r6->pos.y - r5->pos.y) <= 1)
|
||||
{
|
||||
u8 r4 = sub_8092354(r8->unkC); // Possibly move category/split
|
||||
if (r5->info->protection.protectionStatus == STATUS_COUNTER && r4 != 0) {
|
||||
sub_8041B18(r5);
|
||||
r7 += 4;
|
||||
}
|
||||
if (r5->info->protection.protectionStatus == STATUS_MINI_COUNTER && r4 != 0) {
|
||||
sub_8041B18(r5);
|
||||
r7 += 1;
|
||||
}
|
||||
if (r5->info->protection.protectionStatus == STATUS_MIRROR_COAT && r4 == 0) {
|
||||
sub_8041B90(r5);
|
||||
r7 += 4;
|
||||
}
|
||||
|
||||
if (HasAbility(r5, ABILITY_ROUGH_SKIN))
|
||||
r7 += 2;
|
||||
|
||||
if (r7) {
|
||||
struct UnkStruct_sub_806D010 sp;
|
||||
|
||||
sub_80522F4(r6, r5, gUnknown_80FCFA4);
|
||||
sp.unk0 = (r8->unk0 * r7) / 4;
|
||||
sp.unkC = r8->unkC;
|
||||
sp.unk4 = 6;
|
||||
sp.unk8 = 2;
|
||||
sp.unkD = 0;
|
||||
sp.unkE = 0;
|
||||
sp.unkF = 0;
|
||||
sub_806D528(r5, r6, &sp, FALSE, arg0, r10, argC);
|
||||
}
|
||||
}
|
||||
if (!EntityExists(r6) || !EntityExists(r5))
|
||||
return;
|
||||
|
||||
// Check trapping / contact abilities
|
||||
if (r9
|
||||
&& r6 != r5
|
||||
&& abs(r6->pos.x - r5->pos.x) <= 1 && abs(r6->pos.y - r5->pos.y) <= 1)
|
||||
{
|
||||
bool8 unkBool = sub_8092354(r8->unkC);
|
||||
EntityInfo *monInfo = r6->info;
|
||||
|
||||
if (HasAbility(r5, ABILITY_ARENA_TRAP)
|
||||
&& !MonsterIsType(r6, TYPE_FLYING)
|
||||
&& !HasAbility(r6, ABILITY_LEVITATE)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E10)
|
||||
{
|
||||
monInfo->unk178 |= 1;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_SHADOW_TAG)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E12)
|
||||
{
|
||||
monInfo->unk178 |= 2;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_MAGNET_PULL)
|
||||
&& MonsterIsType(r6, TYPE_STEEL)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E14)
|
||||
{
|
||||
monInfo->unk178 |= 4;
|
||||
}
|
||||
|
||||
if (HasAbility(r5, ABILITY_STATIC)
|
||||
&& unkBool
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E16)
|
||||
{
|
||||
monInfo->unk178 |= 8;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_POISON_POINT)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E18)
|
||||
{
|
||||
monInfo->unk178 |= 0x20;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_EFFECT_SPORE)
|
||||
&& unkBool
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1A)
|
||||
{
|
||||
s32 rnd = DungeonRandInt(3);
|
||||
if (rnd < 1)
|
||||
monInfo->unk178 |= 0x40;
|
||||
else if (rnd < 2)
|
||||
monInfo->unk178 |= 0x10;
|
||||
else
|
||||
monInfo->unk178 |= 0x80;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_FLAME_BODY)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1C)
|
||||
{
|
||||
monInfo->unk178 |= 0x100;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_CUTE_CHARM)
|
||||
&& unkBool
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E1E)
|
||||
{
|
||||
monInfo->unk178 |= 0x200;
|
||||
}
|
||||
if (HasAbility(r5, ABILITY_STENCH)
|
||||
&& DungeonRandInt(100) < gUnknown_80F4E20)
|
||||
{
|
||||
monInfo->unk178 |= 0x400;
|
||||
}
|
||||
}
|
||||
if (!EntityExists(r6) || !EntityExists(r5))
|
||||
return;
|
||||
|
||||
// Destiny Bond
|
||||
if (r9) {
|
||||
EntityInfo *monInfo = GetEntInfo(r5);
|
||||
if (monInfo->linked.linkedStatus == STATUS_DESTINY_BOND) {
|
||||
Entity *destBondTarget = gDungeon->allPokemon[monInfo->linked.unkD8];
|
||||
if (destBondTarget == NULL) {
|
||||
monInfo->linked.linkedStatus = 0;
|
||||
}
|
||||
else if (destBondTarget->info->unk98 != monInfo->linked.unkD4) {
|
||||
monInfo->linked.linkedStatus = 0;
|
||||
}
|
||||
else {
|
||||
sub_8041D00(destBondTarget, r5);
|
||||
DealDamageToEntity(destBondTarget, r8->unk0, 0xC, 0x1F9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user