mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 13:09:56 +00:00
UseAttack
This commit is contained in:
parent
b50c8b2803
commit
6ff0810726
@ -6,775 +6,5 @@
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start sub_8075050
|
||||
sub_8075050:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x8
|
||||
mov r9, r0
|
||||
adds r6, r1, 0
|
||||
ldr r0, _08075070
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08075078
|
||||
ldr r1, _08075074
|
||||
movs r0, 0x2
|
||||
b _0807507C
|
||||
.align 2, 0
|
||||
_08075070: .4byte gGameOptionsRef
|
||||
_08075074: .4byte gUnknown_202F378
|
||||
_08075078:
|
||||
ldr r1, _080750D0
|
||||
movs r0, 0x1
|
||||
_0807507C:
|
||||
str r0, [r1]
|
||||
movs r1, 0xFA
|
||||
lsls r1, 1
|
||||
add r1, r9
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1]
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
cmp r0, 0x2
|
||||
bne _080750D4
|
||||
ldr r0, _080750D0
|
||||
ldr r1, [r0]
|
||||
lsls r1, 1
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
movs r1, 0xCE
|
||||
lsls r1, 1
|
||||
add r1, r9
|
||||
strh r0, [r1]
|
||||
movs r2, 0xCA
|
||||
lsls r2, 1
|
||||
add r2, r9
|
||||
ldr r1, [r2]
|
||||
lsls r1, 1
|
||||
str r1, [r2]
|
||||
movs r2, 0xCC
|
||||
lsls r2, 1
|
||||
add r2, r9
|
||||
ldr r1, [r2]
|
||||
lsls r1, 1
|
||||
str r1, [r2]
|
||||
strh r0, [r6, 0x18]
|
||||
ldr r0, [r6, 0x10]
|
||||
lsls r0, 1
|
||||
str r0, [r6, 0x10]
|
||||
ldr r0, [r6, 0x14]
|
||||
lsls r0, 1
|
||||
str r0, [r6, 0x14]
|
||||
b _080751F8
|
||||
.align 2, 0
|
||||
_080750D0: .4byte gUnknown_202F378
|
||||
_080750D4:
|
||||
cmp r0, 0x3
|
||||
bne _08075160
|
||||
ldr r1, [r6, 0x10]
|
||||
str r1, [sp]
|
||||
ldr r0, [r6, 0x14]
|
||||
str r0, [sp, 0x4]
|
||||
movs r4, 0xCE
|
||||
lsls r4, 1
|
||||
add r4, r9
|
||||
movs r5, 0
|
||||
movs r7, 0x1
|
||||
_080750EA:
|
||||
ldr r1, _0807515C
|
||||
ldr r0, [r1]
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
strh r0, [r4]
|
||||
movs r3, 0xCA
|
||||
lsls r3, 1
|
||||
add r3, r9
|
||||
adds r3, r5
|
||||
ldr r1, [r3]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
str r0, [r3]
|
||||
movs r2, 0xCC
|
||||
lsls r2, 1
|
||||
add r2, r9
|
||||
adds r2, r5
|
||||
ldr r1, [r2]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
str r0, [r2]
|
||||
ldr r0, [r3]
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
str r0, [r3]
|
||||
ldr r0, [r2]
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
str r0, [r2]
|
||||
adds r4, 0x1C
|
||||
adds r5, 0x1C
|
||||
subs r7, 0x1
|
||||
cmp r7, 0
|
||||
bge _080750EA
|
||||
ldr r1, _0807515C
|
||||
ldr r0, [r1]
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
strh r0, [r6, 0x18]
|
||||
ldr r1, [sp]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
str r0, [r6, 0x10]
|
||||
ldr r1, [sp, 0x4]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
str r0, [r6, 0x14]
|
||||
b _080751F8
|
||||
.align 2, 0
|
||||
_0807515C: .4byte gUnknown_202F378
|
||||
_08075160:
|
||||
cmp r0, 0x4
|
||||
bne _080751EC
|
||||
ldr r0, [r6, 0x10]
|
||||
str r0, [sp]
|
||||
ldr r1, [r6, 0x14]
|
||||
str r1, [sp, 0x4]
|
||||
movs r7, 0xCE
|
||||
lsls r7, 1
|
||||
add r7, r9
|
||||
movs r0, 0
|
||||
mov r8, r0
|
||||
movs r1, 0x2
|
||||
mov r10, r1
|
||||
_0807517A:
|
||||
ldr r0, _080751E8
|
||||
ldr r1, [r0]
|
||||
lsls r1, 2
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
strh r0, [r7]
|
||||
movs r4, 0xCA
|
||||
lsls r4, 1
|
||||
add r4, r9
|
||||
add r4, r8
|
||||
ldr r0, [r4]
|
||||
lsls r0, 2
|
||||
str r0, [r4]
|
||||
movs r5, 0xCC
|
||||
lsls r5, 1
|
||||
add r5, r9
|
||||
add r5, r8
|
||||
ldr r0, [r5]
|
||||
lsls r0, 2
|
||||
str r0, [r5]
|
||||
ldr r0, [r4]
|
||||
movs r1, 0x3
|
||||
bl __divsi3
|
||||
str r0, [r4]
|
||||
ldr r0, [r5]
|
||||
movs r1, 0x3
|
||||
bl __divsi3
|
||||
str r0, [r5]
|
||||
adds r7, 0x1C
|
||||
movs r1, 0x1C
|
||||
add r8, r1
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
add r10, r0
|
||||
mov r1, r10
|
||||
cmp r1, 0
|
||||
bge _0807517A
|
||||
ldr r0, _080751E8
|
||||
ldr r1, [r0]
|
||||
lsls r1, 2
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
strh r0, [r6, 0x18]
|
||||
ldr r1, [sp]
|
||||
lsls r0, r1, 2
|
||||
str r0, [r6, 0x10]
|
||||
ldr r1, [sp, 0x4]
|
||||
lsls r0, r1, 2
|
||||
str r0, [r6, 0x14]
|
||||
b _080751F8
|
||||
.align 2, 0
|
||||
_080751E8: .4byte gUnknown_202F378
|
||||
_080751EC:
|
||||
ldr r0, _08075208
|
||||
ldr r1, [r0]
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
strh r0, [r6, 0x18]
|
||||
_080751F8:
|
||||
add sp, 0x8
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08075208: .4byte gUnknown_202F378
|
||||
thumb_func_end sub_8075050
|
||||
|
||||
thumb_func_start UseAttack
|
||||
UseAttack:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x18
|
||||
mov r10, r0
|
||||
movs r7, 0
|
||||
movs r0, 0
|
||||
mov r9, r0
|
||||
ldr r0, _08075238
|
||||
mov r1, r9
|
||||
strb r1, [r0]
|
||||
ldr r0, _0807523C
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08075244
|
||||
ldr r1, _08075240
|
||||
movs r0, 0x2
|
||||
b _08075248
|
||||
.align 2, 0
|
||||
_08075238: .4byte gUnknown_202F32D
|
||||
_0807523C: .4byte gGameOptionsRef
|
||||
_08075240: .4byte gUnknown_202F378
|
||||
_08075244:
|
||||
ldr r1, _080752D0
|
||||
movs r0, 0x1
|
||||
_08075248:
|
||||
str r0, [r1]
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
_0807524E:
|
||||
ldr r0, _080752D4
|
||||
ldr r0, [r0]
|
||||
mov r3, r8
|
||||
lsls r1, r3, 2
|
||||
ldr r4, _080752D8
|
||||
adds r0, r4
|
||||
adds r0, r1
|
||||
ldr r5, [r0]
|
||||
adds r0, r5, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807534C
|
||||
ldr r4, [r5, 0x70]
|
||||
movs r1, 0xFA
|
||||
lsls r1, 1
|
||||
adds r0, r4, r1
|
||||
movs r3, 0
|
||||
ldrsh r2, [r0, r3]
|
||||
cmp r2, 0
|
||||
bne _080752E0
|
||||
ldr r0, _080752DC
|
||||
adds r1, r4, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _0807534C
|
||||
strb r2, [r1]
|
||||
movs r1, 0xB6
|
||||
lsls r1, 1
|
||||
adds r6, r4, r1
|
||||
ldr r1, [r6]
|
||||
cmp r1, 0
|
||||
beq _0807534C
|
||||
ldr r0, [r5, 0x4]
|
||||
cmp r1, r0
|
||||
beq _0807534C
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1
|
||||
bl CheckVariousStatuses2
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080752B2
|
||||
adds r0, r5, 0
|
||||
bl CheckVariousStatuses
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807534C
|
||||
_080752B2:
|
||||
adds r0, r5, 0x4
|
||||
adds r1, r6, 0
|
||||
bl GetDirectionTowardsPosition
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x46
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _0807534C
|
||||
adds r0, r5, 0
|
||||
bl sub_806CE68
|
||||
b _0807534C
|
||||
.align 2, 0
|
||||
_080752D0: .4byte gUnknown_202F378
|
||||
_080752D4: .4byte gDungeon
|
||||
_080752D8: .4byte 0x000135cc
|
||||
_080752DC: .4byte 0x00000147
|
||||
_080752E0:
|
||||
ldrh r1, [r4]
|
||||
movs r2, 0x80
|
||||
lsls r2, 6
|
||||
adds r0, r2, 0
|
||||
orrs r0, r1
|
||||
strh r0, [r4]
|
||||
movs r3, 0xC4
|
||||
lsls r3, 1
|
||||
adds r0, r4, r3
|
||||
ldr r1, [r0]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r1, 0xC0
|
||||
lsls r1, 4
|
||||
adds r0, r1
|
||||
str r0, [sp]
|
||||
movs r2, 0xC6
|
||||
lsls r2, 1
|
||||
adds r0, r4, r2
|
||||
ldr r1, [r0]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r3, 0x80
|
||||
lsls r3, 5
|
||||
adds r0, r3
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r5, 0
|
||||
mov r1, sp
|
||||
bl sub_804535C
|
||||
movs r1, 0xC8
|
||||
lsls r1, 1
|
||||
adds r0, r4, r1
|
||||
ldr r2, [r0]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0
|
||||
bl sub_806CDFC
|
||||
movs r2, 0xFB
|
||||
lsls r2, 1
|
||||
adds r0, r4, r2
|
||||
movs r3, 0
|
||||
strh r3, [r0]
|
||||
movs r7, 0x1
|
||||
adds r0, r5, 0
|
||||
bl sub_8045888
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807534C
|
||||
movs r4, 0x1
|
||||
mov r9, r4
|
||||
_0807534C:
|
||||
movs r0, 0x1
|
||||
add r8, r0
|
||||
mov r1, r8
|
||||
cmp r1, 0x13
|
||||
bgt _08075358
|
||||
b _0807524E
|
||||
_08075358:
|
||||
cmp r7, 0
|
||||
bne _08075360
|
||||
movs r0, 0
|
||||
b _0807566C
|
||||
_08075360:
|
||||
ldr r0, _08075390
|
||||
ldr r0, [r0]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0xB8
|
||||
ldr r2, [r1]
|
||||
str r2, [sp, 0x10]
|
||||
mov r3, r10
|
||||
str r3, [r1]
|
||||
ldr r4, _08075394
|
||||
adds r0, r4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807537C
|
||||
b _080754AE
|
||||
_0807537C:
|
||||
mov r0, r9
|
||||
cmp r0, 0
|
||||
bne _08075384
|
||||
b _080754AE
|
||||
_08075384:
|
||||
movs r0, 0x35
|
||||
bl sub_80526D0
|
||||
movs r5, 0
|
||||
b _0807549E
|
||||
.align 2, 0
|
||||
_08075390: .4byte gDungeon
|
||||
_08075394: .4byte 0x0000066c
|
||||
_08075398:
|
||||
movs r0, 0x7
|
||||
bl sub_803E46C
|
||||
movs r1, 0
|
||||
mov r8, r1
|
||||
adds r5, 0x1
|
||||
mov r9, r5
|
||||
_080753A6:
|
||||
ldr r0, _08075420
|
||||
ldr r0, [r0]
|
||||
mov r2, r8
|
||||
lsls r1, r2, 2
|
||||
ldr r3, _08075424
|
||||
adds r0, r3
|
||||
adds r0, r1
|
||||
ldr r3, [r0]
|
||||
adds r0, r3, 0
|
||||
str r3, [sp, 0x14]
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
ldr r3, [sp, 0x14]
|
||||
cmp r0, 0
|
||||
beq _08075492
|
||||
ldr r0, [r3, 0x70]
|
||||
adds r7, r0, 0
|
||||
movs r4, 0xFB
|
||||
lsls r4, 1
|
||||
adds r5, r7, r4
|
||||
movs r1, 0
|
||||
ldrsh r0, [r5, r1]
|
||||
lsls r1, r0, 3
|
||||
subs r1, r0
|
||||
lsls r1, 2
|
||||
movs r2, 0xC2
|
||||
lsls r2, 1
|
||||
adds r1, r2
|
||||
adds r4, r7, r1
|
||||
movs r0, 0xFA
|
||||
lsls r0, 1
|
||||
adds r6, r7, r0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r6, r1]
|
||||
cmp r0, 0
|
||||
beq _08075492
|
||||
ldr r1, [r4, 0x10]
|
||||
ldr r2, [r4, 0x14]
|
||||
adds r0, r3, 0
|
||||
bl IncreaseEntityPixelPos
|
||||
ldrh r0, [r4, 0x18]
|
||||
subs r0, 0x1
|
||||
strh r0, [r4, 0x18]
|
||||
lsls r0, 16
|
||||
asrs r2, r0, 16
|
||||
ldr r3, [sp, 0x14]
|
||||
cmp r2, 0
|
||||
bne _08075492
|
||||
ldrh r0, [r5]
|
||||
adds r0, 0x1
|
||||
strh r0, [r5]
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
movs r4, 0
|
||||
ldrsh r1, [r6, r4]
|
||||
cmp r0, r1
|
||||
bne _08075428
|
||||
strh r2, [r6]
|
||||
b _08075492
|
||||
.align 2, 0
|
||||
_08075420: .4byte gDungeon
|
||||
_08075424: .4byte 0x000135cc
|
||||
_08075428:
|
||||
movs r0, 0
|
||||
ldrsh r1, [r5, r0]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
movs r2, 0xC4
|
||||
lsls r2, 1
|
||||
adds r1, r7, r2
|
||||
adds r1, r0
|
||||
ldr r1, [r1]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r4, 0xC0
|
||||
lsls r4, 4
|
||||
adds r0, r4
|
||||
str r0, [sp, 0x8]
|
||||
movs r0, 0
|
||||
ldrsh r1, [r5, r0]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r2, 0x4
|
||||
adds r1, r7, r2
|
||||
adds r1, r0
|
||||
ldr r1, [r1]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r4, 0x80
|
||||
lsls r4, 5
|
||||
adds r0, r4
|
||||
add r1, sp, 0x8
|
||||
str r0, [r1, 0x4]
|
||||
adds r0, r3, 0
|
||||
str r3, [sp, 0x14]
|
||||
bl sub_804535C
|
||||
movs r0, 0
|
||||
ldrsh r1, [r5, r0]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
movs r2, 0xC8
|
||||
lsls r2, 1
|
||||
adds r1, r7, r2
|
||||
adds r1, r0
|
||||
ldr r2, [r1]
|
||||
ldr r3, [sp, 0x14]
|
||||
adds r0, r3, 0
|
||||
movs r1, 0
|
||||
bl sub_806CDFC
|
||||
_08075492:
|
||||
movs r3, 0x1
|
||||
add r8, r3
|
||||
mov r4, r8
|
||||
cmp r4, 0x13
|
||||
ble _080753A6
|
||||
mov r5, r9
|
||||
_0807549E:
|
||||
ldr r0, _08075510
|
||||
ldr r1, [r0]
|
||||
movs r0, 0x18
|
||||
bl __divsi3
|
||||
cmp r5, r0
|
||||
bge _080754AE
|
||||
b _08075398
|
||||
_080754AE:
|
||||
movs r0, 0
|
||||
mov r8, r0
|
||||
_080754B2:
|
||||
ldr r0, _08075514
|
||||
ldr r0, [r0]
|
||||
mov r2, r8
|
||||
lsls r1, r2, 2
|
||||
ldr r3, _08075518
|
||||
adds r0, r3
|
||||
adds r0, r1
|
||||
ldr r5, [r0]
|
||||
adds r0, r5, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080754F6
|
||||
ldr r4, [r5, 0x70]
|
||||
movs r0, 0xFA
|
||||
lsls r0, 1
|
||||
adds r1, r4, r0
|
||||
movs r0, 0
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl nullsub_97
|
||||
ldrh r0, [r4]
|
||||
movs r2, 0x80
|
||||
lsls r2, 6
|
||||
adds r1, r2, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080754F6
|
||||
adds r0, r5, 0
|
||||
movs r1, 0
|
||||
bl sub_804535C
|
||||
_080754F6:
|
||||
movs r3, 0x1
|
||||
add r8, r3
|
||||
mov r4, r8
|
||||
cmp r4, 0x13
|
||||
ble _080754B2
|
||||
bl sub_807AA30
|
||||
movs r7, 0
|
||||
_08075506:
|
||||
movs r5, 0
|
||||
adds r0, r7, 0x1
|
||||
mov r8, r0
|
||||
b _08075600
|
||||
.align 2, 0
|
||||
_08075510: .4byte gUnknown_202F378
|
||||
_08075514: .4byte gDungeon
|
||||
_08075518: .4byte 0x000135cc
|
||||
_0807551C:
|
||||
ldr r2, [r4, 0x70]
|
||||
cmp r7, 0
|
||||
bne _0807552A
|
||||
ldrb r0, [r2, 0x7]
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
b _08075530
|
||||
_0807552A:
|
||||
ldrb r0, [r2, 0x7]
|
||||
cmp r0, 0
|
||||
bne _080755FE
|
||||
_08075530:
|
||||
ldr r6, [r4, 0x4]
|
||||
ldrh r1, [r2]
|
||||
movs r3, 0x80
|
||||
lsls r3, 6
|
||||
adds r0, r3, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080755BC
|
||||
ldr r3, _08075560
|
||||
adds r0, r3, 0
|
||||
ands r0, r1
|
||||
strh r0, [r2]
|
||||
ldrb r0, [r2, 0x7]
|
||||
cmp r0, 0
|
||||
beq _08075564
|
||||
adds r0, r4, 0x4
|
||||
bl sub_804AC20
|
||||
movs r0, 0
|
||||
bl sub_807EC28
|
||||
bl sub_805EE30
|
||||
b _0807556A
|
||||
.align 2, 0
|
||||
_08075560: .4byte 0x0000dfff
|
||||
_08075564:
|
||||
adds r0, r4, 0
|
||||
bl sub_8075708
|
||||
_0807556A:
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807562A
|
||||
movs r0, 0
|
||||
bl sub_8043ED0
|
||||
adds r0, r4, 0
|
||||
bl sub_8074094
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807562A
|
||||
adds r0, r4, 0
|
||||
bl sub_8071DA4
|
||||
bl sub_8046D20
|
||||
ldr r0, _08075650
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08075654
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
adds r0, r4, 0
|
||||
bl sub_8075900
|
||||
_080755BC:
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807562A
|
||||
ldr r0, [r4, 0x4]
|
||||
cmp r6, r0
|
||||
beq _080755DE
|
||||
ldr r1, _08075658
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
_080755DE:
|
||||
adds r0, r4, 0
|
||||
bl sub_806A5B8
|
||||
adds r1, r4, 0x4
|
||||
adds r0, r4, 0
|
||||
bl sub_80706A4
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
adds r0, r4, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl sub_807D148
|
||||
_080755FE:
|
||||
adds r5, 0x1
|
||||
_08075600:
|
||||
cmp r5, 0x13
|
||||
bgt _0807562A
|
||||
ldr r0, _08075650
|
||||
ldr r0, [r0]
|
||||
lsls r1, r5, 2
|
||||
ldr r2, _0807565C
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080755FE
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807562A
|
||||
b _0807551C
|
||||
_0807562A:
|
||||
mov r7, r8
|
||||
cmp r7, 0x1
|
||||
bgt _08075632
|
||||
b _08075506
|
||||
_08075632:
|
||||
bl sub_8086AC0
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08075660
|
||||
bl sub_8085140
|
||||
ldr r0, _08075650
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xB8
|
||||
ldr r3, [sp, 0x10]
|
||||
str r3, [r0]
|
||||
b _0807566A
|
||||
.align 2, 0
|
||||
_08075650: .4byte gDungeon
|
||||
_08075654: .4byte 0x00003a08
|
||||
_08075658: .4byte gUnknown_202F32D
|
||||
_0807565C: .4byte 0x000135cc
|
||||
_08075660:
|
||||
ldr r0, _0807567C
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xB8
|
||||
ldr r4, [sp, 0x10]
|
||||
str r4, [r0]
|
||||
_0807566A:
|
||||
movs r0, 0x1
|
||||
_0807566C:
|
||||
add sp, 0x18
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0807567C: .4byte gDungeon
|
||||
thumb_func_end UseAttack
|
||||
|
||||
.align 2,0
|
||||
|
@ -164,8 +164,7 @@ typedef struct Unk_Entity_x184
|
||||
/* 0x190 - 0xC */ s32 lastMoveDirection; // The last direction that the Pokémon moved in.
|
||||
// Number of tiles that the Pokémon moved last, multiplied by 0x100.
|
||||
/* 0x194 - 0x10*/ Position32 lastMoveIncrement;
|
||||
/* 0x19C - 0x18 */ u8 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops.
|
||||
/* 0x19D - 0x19 */ u8 fill19d;
|
||||
/* 0x19C - 0x18 */ s16 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops.
|
||||
/* 0x19e - 0x1a */ u8 unk1A;
|
||||
} Unk_Entity_x184 ;
|
||||
|
||||
@ -319,7 +318,7 @@ typedef struct EntityInfo
|
||||
// Previous value of targetPosition for movement, 1 and 2 moves ago.
|
||||
/* 0x184 */ Unk_Entity_x184 unk184[4];
|
||||
/* 0x1F4 */ s16 numMoveTiles; // Number of tiles to move in a turn. Can be greater than 1 if the user's movement speed is boosted.
|
||||
/* 0x1F6 */ bool8 notMoving;
|
||||
/* 0x1F6 */ s16 notMoving;
|
||||
/* 0x1F8 */ s16 unk1F8;
|
||||
/* 0x1FA */ s16 mobileTurnTimer; // When a Pokémon can pass through walls in a hallway, this counts up to 200 before the Pokémon turns in a random direction.
|
||||
/* 0x1FC */ u32 expGainedInTurn; // Used to accumulate experience when multiple enemies are defeated in one turn.
|
||||
|
@ -9,7 +9,11 @@
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/map.h"
|
||||
#include "structs/str_moves.h"
|
||||
#include "position_util.h"
|
||||
#include "dungeon_music.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "code_803E46C.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "game_options.h"
|
||||
#include "dungeon_items.h"
|
||||
@ -30,6 +34,8 @@
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
|
||||
extern bool8 sub_8044B28(void);
|
||||
extern void sub_8075708(Entity *entity);
|
||||
extern void sub_80526D0(u8 r0);
|
||||
extern void sub_806F324(Entity *, s32, u32, u32);
|
||||
extern void sub_8067110(Entity *);
|
||||
extern void sub_80671A0(Entity *);
|
||||
@ -40,7 +46,6 @@ extern bool8 sub_80461C8(Position *, u32);
|
||||
extern void sub_805229C(void);
|
||||
extern void sub_807E8F0(Entity *);
|
||||
extern void sub_80444F4(Entity *pokemon);
|
||||
extern u8 UseAttack(u32);
|
||||
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);
|
||||
extern void sub_800A34C(struct unkStruct_80943A8 *, struct unkStruct_80943A8 *, const u8 *);
|
||||
extern void sub_80420B8(Entity *pokemon);
|
||||
@ -48,26 +53,24 @@ extern void sub_8041C4C(Entity *pokemon, u32 r1);
|
||||
extern void sub_805E804(void);
|
||||
extern void sub_80838EC(u8 *a);
|
||||
extern bool8 sub_8055FA0(struct Entity *, u32, u32, u32, u32, struct Move *);
|
||||
extern bool8 sub_8045888(Entity *);
|
||||
extern void nullsub_97(Entity *entity);
|
||||
extern void sub_805EE30(void);
|
||||
extern void sub_8086AC0(void);
|
||||
extern void sub_8085140(void);
|
||||
extern void sub_8075708(Entity *entity);
|
||||
extern void sub_8043ED0(u32);
|
||||
extern void sub_8071DA4(Entity *);
|
||||
extern void sub_8075900(Entity *pokemon, u8 r1);
|
||||
extern void sub_806A5B8(Entity *);
|
||||
extern void sub_807EC28(bool8);
|
||||
|
||||
extern s32 gUnknown_202F378;
|
||||
extern u8 gUnknown_202F32D;
|
||||
extern u8 gUnknown_202DE58[];
|
||||
extern u8 gUnknown_202DFE8[];
|
||||
extern u8 gAvailablePokemonNames[];
|
||||
|
||||
void HandleEatAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_8067110(pokemon);
|
||||
}
|
||||
|
||||
void HandleThrowItemAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_80671A0(pokemon);
|
||||
}
|
||||
|
||||
void HandlePickUpAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_8073D14(pokemon);
|
||||
}
|
||||
|
||||
extern const u8 *gUnknown_80F8F88;
|
||||
extern const u8 *gUnknown_80F9054;
|
||||
extern const u8 *gUnknown_80F9018;
|
||||
@ -85,6 +88,51 @@ extern const u8 *gPtrProtectSavedItMessage;
|
||||
extern const u8 *gPtrStenchWavedOffMessage;
|
||||
extern const u8 *gUnknown_80FA124[];
|
||||
|
||||
extern const s16 gWarpScarfActivationChances[];
|
||||
extern const s16 gUnknown_80F4FC8[];
|
||||
extern const s16 gUnknown_80F4F8E;
|
||||
extern const s16 gUnknown_80F4E0C;
|
||||
extern const s16 gUnknown_80F4F32;
|
||||
extern const s16 gUnknown_80F4F34;
|
||||
extern const s16 gUnknown_80F4F70;
|
||||
extern const s16 gUnknown_80F4F72;
|
||||
extern const s16 gUnknown_80F4F30;
|
||||
extern const s16 gUnknown_80F4F38;
|
||||
extern const s16 gUnknown_80F4FC4;
|
||||
extern const s16 gUnknown_80F4FC0;
|
||||
extern const s16 gUnknown_80F4F3A;
|
||||
extern const s16 gUnknown_80F4F3C;
|
||||
extern const s16 gUnknown_80F4FB2;
|
||||
extern const s16 gUnknown_80F4F3E;
|
||||
extern const s16 gUnknown_80F4FB4;
|
||||
extern const s16 gUnknown_80F4F40;
|
||||
extern const s16 gUnknown_80F4F74;
|
||||
extern const s16 gUnknown_80F4FC2;
|
||||
extern const s16 gUnknown_80F4F76;
|
||||
extern const s16 gUnknown_80F4F36;
|
||||
extern const u8 gUnknown_80F54F4[][8];
|
||||
extern const s32 gUnknown_80F60DC[];
|
||||
|
||||
extern const Position gUnknown_80F4D44[];
|
||||
|
||||
bool8 UseAttack(Entity *a0);
|
||||
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr);
|
||||
|
||||
void HandleEatAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_8067110(pokemon);
|
||||
}
|
||||
|
||||
void HandleThrowItemAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_80671A0(pokemon);
|
||||
}
|
||||
|
||||
void HandlePickUpAIAction(Entity *pokemon)
|
||||
{
|
||||
sub_8073D14(pokemon);
|
||||
}
|
||||
|
||||
void sub_8073D14(Entity *entity)
|
||||
{
|
||||
Item *groundItem;
|
||||
@ -234,31 +282,6 @@ void sub_8073D14(Entity *entity)
|
||||
}
|
||||
}
|
||||
|
||||
extern const s16 gWarpScarfActivationChances[];
|
||||
extern const s16 gUnknown_80F4FC8[];
|
||||
extern const s16 gUnknown_80F4F8E;
|
||||
extern const s16 gUnknown_80F4E0C;
|
||||
extern const s16 gUnknown_80F4F32;
|
||||
extern const s16 gUnknown_80F4F34;
|
||||
extern const s16 gUnknown_80F4F70;
|
||||
extern const s16 gUnknown_80F4F72;
|
||||
extern const s16 gUnknown_80F4F30;
|
||||
extern const s16 gUnknown_80F4F38;
|
||||
extern const s16 gUnknown_80F4FC4;
|
||||
extern const s16 gUnknown_80F4FC0;
|
||||
extern const s16 gUnknown_80F4F3A;
|
||||
extern const s16 gUnknown_80F4F3C;
|
||||
extern const s16 gUnknown_80F4FB2;
|
||||
extern const s16 gUnknown_80F4F3E;
|
||||
extern const s16 gUnknown_80F4FB4;
|
||||
extern const s16 gUnknown_80F4F40;
|
||||
extern const s16 gUnknown_80F4F74;
|
||||
extern const s16 gUnknown_80F4FC2;
|
||||
extern const s16 gUnknown_80F4F76;
|
||||
extern const s16 gUnknown_80F4F36;
|
||||
extern const u8 gUnknown_80F54F4[][8];
|
||||
extern const s32 gUnknown_80F60DC[];
|
||||
|
||||
void sub_8074094(Entity *entity)
|
||||
{
|
||||
s32 rand;
|
||||
@ -279,7 +302,7 @@ void sub_8074094(Entity *entity)
|
||||
if (DungeonRandInt(100) < gWarpScarfActivationChances[entityInfo->turnsSinceWarpScarfActivation]) {
|
||||
entityInfo->turnsSinceWarpScarfActivation = 0;
|
||||
sub_80444F4(entity);
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
sub_807D148(entity, entity, 0, NULL);
|
||||
@ -340,7 +363,7 @@ void sub_8074094(Entity *entity)
|
||||
if (FixedPointToInt(entityInfo->belly) == 0) {
|
||||
sub_805E804();
|
||||
sub_80444F4(entity);
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
if (gDungeon->unk679 < 10)
|
||||
@ -390,7 +413,7 @@ void sub_8074094(Entity *entity)
|
||||
// Abilities check
|
||||
rand = DungeonRandInt(100);
|
||||
if (HasAbility(entity, ABILITY_SHED_SKIN) && rand < gUnknown_80F4E0C && HasNegativeStatus(entity)) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
sub_8079F20(entity, entity, 1, 0);
|
||||
@ -405,7 +428,7 @@ void sub_8074094(Entity *entity)
|
||||
|
||||
// Statuses
|
||||
if (entityInfo->sleep.sleep == STATUS_YAWNING) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
sub_80420B8(entity);
|
||||
@ -413,7 +436,7 @@ void sub_8074094(Entity *entity)
|
||||
|
||||
if (entityInfo->nonVolatile.nonVolatileStatus == STATUS_BURN) {
|
||||
if (entityInfo->nonVolatile.nonVolatileStatusDamageCountdown == 0 || --entityInfo->nonVolatile.nonVolatileStatusDamageCountdown == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
entityInfo->nonVolatile.nonVolatileStatusDamageCountdown = gUnknown_80F4F32;
|
||||
@ -426,7 +449,7 @@ void sub_8074094(Entity *entity)
|
||||
|
||||
if (entityInfo->nonVolatile.nonVolatileStatus == STATUS_POISONED) {
|
||||
if (entityInfo->nonVolatile.nonVolatileStatusDamageCountdown == 0 || --entityInfo->nonVolatile.nonVolatileStatusDamageCountdown == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
entityInfo->nonVolatile.nonVolatileStatusDamageCountdown = gUnknown_80F4F34;
|
||||
@ -445,7 +468,7 @@ void sub_8074094(Entity *entity)
|
||||
if (turns >= 29)
|
||||
turns = 29;
|
||||
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
|
||||
@ -458,7 +481,7 @@ void sub_8074094(Entity *entity)
|
||||
|
||||
if (entityInfo->immobilize.immobilizeStatus == STATUS_CONSTRICTION) {
|
||||
if (entityInfo->immobilize.immobilizeStatusDamageCountdown == 0 || --entityInfo->immobilize.immobilizeStatusDamageCountdown == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
entityInfo->immobilize.immobilizeStatusDamageCountdown = gUnknown_80F4F38;
|
||||
@ -471,7 +494,7 @@ void sub_8074094(Entity *entity)
|
||||
}
|
||||
else if (entityInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
|
||||
if (entityInfo->immobilize.immobilizeStatusDamageCountdown == 0 || --entityInfo->immobilize.immobilizeStatusDamageCountdown == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
entityInfo->immobilize.immobilizeStatusDamageCountdown = gUnknown_80F4F3A;
|
||||
@ -483,7 +506,7 @@ void sub_8074094(Entity *entity)
|
||||
}
|
||||
else if (entityInfo->immobilize.immobilizeStatus == STATUS_INGRAIN) {
|
||||
if (entityInfo->immobilize.immobilizeStatusDamageCountdown == 0 || --entityInfo->immobilize.immobilizeStatusDamageCountdown == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
entityInfo->immobilize.immobilizeStatusDamageCountdown = gUnknown_80F4F3C;
|
||||
@ -497,7 +520,7 @@ void sub_8074094(Entity *entity)
|
||||
if (dmg == 0)
|
||||
dmg = 1;
|
||||
entityInfo->waitingStruct.curseDamageCountdown = gUnknown_80F4F3E;
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
|
||||
@ -525,7 +548,7 @@ void sub_8074094(Entity *entity)
|
||||
else {
|
||||
bool8 dmgUser = HasAbility(entity, ABILITY_LIQUID_OOZE);
|
||||
sub_80444F4(entity);
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || !EntityExists(target) || sub_8044B28())
|
||||
return;
|
||||
|
||||
@ -550,7 +573,7 @@ void sub_8074094(Entity *entity)
|
||||
if (entityInfo->perishSongTurns != 0) {
|
||||
sub_80838EC(&entityInfo->perishSongTurns);
|
||||
if (entityInfo->perishSongTurns == 0) {
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
if (!EntityExists(entity) || sub_8044B28())
|
||||
return;
|
||||
SetMessageArgument(gUnknown_202DFE8, entity, 0);
|
||||
@ -574,7 +597,7 @@ void sub_8074094(Entity *entity)
|
||||
if (!CheckVariousStatuses2(entity, FALSE) && !CannotAttack(entity, FALSE) && !CheckVariousStatuses(entity)) {
|
||||
Move bideMove;
|
||||
|
||||
UseAttack(0);
|
||||
UseAttack(NULL);
|
||||
InitPokemonMove(&bideMove, MOVE_BIDE_2);
|
||||
bideMove.moveFlags |= MOVE_FLAG_LAST_USED;
|
||||
sub_8055FA0(entity, 0, 0, 0, 0, &bideMove);
|
||||
@ -779,19 +802,9 @@ void TickStatusHeal(Entity *entity)
|
||||
}
|
||||
}
|
||||
|
||||
extern s32 gUnknown_202F378;
|
||||
extern const Position gUnknown_80F4D44[];
|
||||
|
||||
void sub_8075050(EntityInfo *info);
|
||||
|
||||
void sub_8074FB0(Entity *entity, s32 a1, Position *pos)
|
||||
{
|
||||
#ifdef NONMATCHING
|
||||
Unk_Entity_x184 *strPtr;
|
||||
#else
|
||||
register Unk_Entity_x184 *strPtr asm("r1");
|
||||
#endif // NONMATCHING
|
||||
|
||||
EntityInfo *entityInfo = entity->info;
|
||||
|
||||
if (entityInfo->numMoveTiles > 3) {
|
||||
@ -813,7 +826,235 @@ void sub_8074FB0(Entity *entity, s32 a1, Position *pos)
|
||||
strPtr->previousTargetMovePosition2.y = pos->y;
|
||||
strPtr->lastMoveIncrement.x = gUnknown_80F4D44[a1].x * gUnknown_202F378;
|
||||
strPtr->lastMoveIncrement.y = gUnknown_80F4D44[a1].y * gUnknown_202F378;
|
||||
sub_8075050(entityInfo);
|
||||
sub_8075050(entityInfo, strPtr);
|
||||
}
|
||||
|
||||
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr)
|
||||
{
|
||||
s32 savedX, savedY;
|
||||
|
||||
if (gGameOptionsRef->dungeonSpeed != 0)
|
||||
gUnknown_202F378 = 2;
|
||||
else
|
||||
gUnknown_202F378 = 1;
|
||||
|
||||
info->numMoveTiles++;
|
||||
if (info->numMoveTiles == 2) {
|
||||
info->unk184[0].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
|
||||
info->unk184[0].lastMoveIncrement.x *= 2;
|
||||
info->unk184[0].lastMoveIncrement.y *= 2;
|
||||
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
|
||||
strPtr->lastMoveIncrement.x *= 2;
|
||||
strPtr->lastMoveIncrement.y *= 2;
|
||||
}
|
||||
else if (info->numMoveTiles == 3) {
|
||||
s32 i;
|
||||
|
||||
savedX = strPtr->lastMoveIncrement.x;
|
||||
savedY = strPtr->lastMoveIncrement.y;
|
||||
for (i = 0; i < 2; i++) {
|
||||
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
|
||||
info->unk184[i].lastMoveIncrement.x *= 3;
|
||||
info->unk184[i].lastMoveIncrement.y *= 3;
|
||||
info->unk184[i].lastMoveIncrement.x /= 2;
|
||||
info->unk184[i].lastMoveIncrement.y /= 2;
|
||||
}
|
||||
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
|
||||
strPtr->lastMoveIncrement.x = savedX * 3;
|
||||
strPtr->lastMoveIncrement.y = savedY * 3;
|
||||
}
|
||||
else if (info->numMoveTiles == 4) {
|
||||
s32 i;
|
||||
|
||||
savedX = strPtr->lastMoveIncrement.x;
|
||||
savedY = strPtr->lastMoveIncrement.y;
|
||||
for (i = 0; i < 3; i++) {
|
||||
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
|
||||
info->unk184[i].lastMoveIncrement.x *= 4;
|
||||
info->unk184[i].lastMoveIncrement.y *= 4;
|
||||
info->unk184[i].lastMoveIncrement.x /= 3;
|
||||
info->unk184[i].lastMoveIncrement.y /= 3;
|
||||
}
|
||||
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
|
||||
strPtr->lastMoveIncrement.x = savedX * 4;
|
||||
strPtr->lastMoveIncrement.y = savedY * 4;
|
||||
}
|
||||
else {
|
||||
strPtr->walkAnimFramesLeft = 24 / gUnknown_202F378;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 UseAttack(Entity *a0)
|
||||
{
|
||||
s32 i, j, loop;
|
||||
Entity *savedEntityPtr;
|
||||
bool32 r7 = FALSE;
|
||||
bool32 r9 = FALSE;
|
||||
|
||||
gUnknown_202F32D = 0;
|
||||
if (gGameOptionsRef->dungeonSpeed != 0)
|
||||
gUnknown_202F378 = 2;
|
||||
else
|
||||
gUnknown_202F378 = 1;
|
||||
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
Entity *mon = gDungeon->allPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
EntityInfo *monInfo = mon->info;
|
||||
if (monInfo->numMoveTiles == 0) {
|
||||
if (monInfo->waiting) {
|
||||
monInfo->waiting = FALSE;
|
||||
if ((monInfo->targetPos.x != 0 || monInfo->targetPos.y != 0)
|
||||
&& (monInfo->targetPos.x != mon->pos.x || monInfo->targetPos.y != mon->pos.y)
|
||||
&& (!CheckVariousStatuses2(mon, TRUE) || !CheckVariousStatuses(mon)))
|
||||
{
|
||||
s32 direction = GetDirectionTowardsPosition(&mon->pos, &monInfo->targetPos);
|
||||
if (direction != monInfo->action.direction)
|
||||
sub_806CE68(mon, direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Position32 pos;
|
||||
|
||||
monInfo->flags |= 0x2000;
|
||||
pos.x = (monInfo->unk184[0].previousTargetMovePosition2.x * 0x1800) + 0xC00;
|
||||
pos.y = (monInfo->unk184[0].previousTargetMovePosition2.y * 0x1800) + 0x1000;
|
||||
sub_804535C(mon, &pos);
|
||||
sub_806CDFC(mon, 0, monInfo->unk184[0].lastMoveDirection);
|
||||
monInfo->notMoving = 0;
|
||||
r7 = TRUE;
|
||||
if (sub_8045888(mon))
|
||||
r9 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!r7)
|
||||
return FALSE;
|
||||
|
||||
savedEntityPtr = gDungeon->unkB8;
|
||||
gDungeon->unkB8 = a0;
|
||||
if (gDungeon->unk66C == 0 && r9) {
|
||||
sub_80526D0(0x35);
|
||||
for (loop = 0; loop < 24 / gUnknown_202F378; loop++) {
|
||||
sub_803E46C(7);
|
||||
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_;
|
||||
Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving];
|
||||
|
||||
#ifndef NONMATCHING
|
||||
// Dummy needed to match, feel free to remove if you do not care about matching.
|
||||
i++;i--;
|
||||
#endif // NONMATCHING
|
||||
if (monInfo->numMoveTiles != 0) {
|
||||
IncreaseEntityPixelPos(mon, strPtr->lastMoveIncrement.x, strPtr->lastMoveIncrement.y);
|
||||
if (--strPtr->walkAnimFramesLeft == 0) {
|
||||
if (++monInfo->notMoving == monInfo->numMoveTiles) {
|
||||
monInfo->numMoveTiles = 0;
|
||||
}
|
||||
else {
|
||||
Position32 pos;
|
||||
|
||||
pos.x = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x * 0x1800) + 0xC00;
|
||||
pos.y = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y * 0x1800) + 0x1000;
|
||||
sub_804535C(mon, &pos);
|
||||
sub_806CDFC(mon, 0, monInfo->unk184[monInfo->notMoving].lastMoveDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
Entity *mon = gDungeon->allPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
EntityInfo *monInfo = mon->info;
|
||||
monInfo->numMoveTiles = 0;
|
||||
nullsub_97(mon);
|
||||
if (monInfo->flags & 0x2000) {
|
||||
sub_804535C(mon, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub_807AA30();
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) {
|
||||
Position monPosBefore;
|
||||
EntityInfo *monInfo;
|
||||
Entity *mon = gDungeon->allPokemon[loop];
|
||||
|
||||
if (!EntityExists(mon))
|
||||
continue;
|
||||
if (sub_8044B28())
|
||||
break;
|
||||
|
||||
monInfo = mon->info;
|
||||
if ((j == 0 && !monInfo->isTeamLeader) || (j != 0 && monInfo->isTeamLeader))
|
||||
continue;
|
||||
|
||||
monPosBefore = mon->pos;
|
||||
|
||||
// Statement with no effect needed to match.
|
||||
mon->info->isTeamLeader = mon->info->isTeamLeader;
|
||||
|
||||
if (monInfo->flags & 0x2000) {
|
||||
monInfo->flags &= ~(0x2000);
|
||||
if (monInfo->isTeamLeader) {
|
||||
sub_804AC20(&mon->pos);
|
||||
sub_807EC28(FALSE);
|
||||
sub_805EE30();
|
||||
}
|
||||
else {
|
||||
sub_8075708(mon);
|
||||
}
|
||||
if (!EntityExists(mon))
|
||||
continue;
|
||||
if (sub_8044B28())
|
||||
break;
|
||||
|
||||
sub_8043ED0(0);
|
||||
sub_8074094(mon);
|
||||
if (!EntityExists(mon))
|
||||
continue;
|
||||
if (sub_8044B28())
|
||||
break;
|
||||
|
||||
sub_8071DA4(mon);
|
||||
sub_8046D20();
|
||||
sub_8075900(mon, gDungeon->unk3A08);
|
||||
}
|
||||
if (!EntityExists(mon))
|
||||
continue;
|
||||
if (sub_8044B28())
|
||||
break;
|
||||
|
||||
if (monPosBefore.x != mon->pos.x || monPosBefore.y != mon->pos.y)
|
||||
gUnknown_202F32D = 1;
|
||||
|
||||
sub_806A5B8(mon);
|
||||
if (sub_80706A4(mon, &mon->pos)) {
|
||||
sub_807D148(mon, mon, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub_8086AC0();
|
||||
if (!sub_8044B28()) {
|
||||
sub_8085140();
|
||||
gDungeon->unkB8 = savedEntityPtr;
|
||||
}
|
||||
else {
|
||||
gDungeon->unkB8 = savedEntityPtr;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
//
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user