decompile peahat

This commit is contained in:
Behemoth
2020-08-28 03:45:50 +02:00
parent ccd02a96ec
commit 2751406a33
8 changed files with 542 additions and 1032 deletions
-928
View File
@@ -1,928 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Peahat
Peahat: @ 0x0801FF5C
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xa]
cmp r0, #0
bne _0801FF84
ldr r1, _0801FF80 @ =gUnk_080CA570
adds r0, r4, #0
bl EnemyFunctionHandler
movs r3, #0x10
rsbs r3, r3, #0
adds r0, r4, #0
movs r1, #0
movs r2, #1
bl SetChildOffset
b _0801FF94
.align 2, 0
_0801FF80: .4byte gUnk_080CA570
_0801FF84:
ldr r0, _0801FF98 @ =gUnk_080CA588
ldrb r1, [r4, #0xc]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
_0801FF94:
pop {r4, pc}
.align 2, 0
_0801FF98: .4byte gUnk_080CA588
thumb_func_start sub_0801FF9C
sub_0801FF9C: @ 0x0801FF9C
push {r4, lr}
adds r4, r0, #0
ldr r1, _0801FFD4 @ =gUnk_080CA590
ldrb r0, [r4, #0xc]
lsls r0, r0, #2
adds r0, r0, r1
ldr r1, [r0]
adds r0, r4, #0
bl _call_via_r1
adds r0, r4, #0
adds r0, #0x81
ldrb r0, [r0]
cmp r0, #0
beq _0801FFD2
ldr r2, _0801FFD8 @ =gUnk_080CA5B8
ldrb r1, [r4, #0xf]
adds r0, r1, #1
strb r0, [r4, #0xf]
movs r0, #0x30
ands r0, r1
lsrs r0, r0, #4
adds r0, r0, r2
ldrb r0, [r0]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
strh r0, [r4, #0x36]
_0801FFD2:
pop {r4, pc}
.align 2, 0
_0801FFD4: .4byte gUnk_080CA590
_0801FFD8: .4byte gUnk_080CA5B8
thumb_func_start sub_0801FFDC
sub_0801FFDC: @ 0x0801FFDC
push {r4, r5, r6, lr}
adds r4, r0, #0
adds r6, r4, #0
adds r6, #0x82
ldrb r0, [r6]
cmp r0, #0
beq _08020068
adds r0, r4, #0
adds r0, #0x41
ldrb r1, [r0]
cmp r1, #0x94
bne _08020018
movs r0, #3
movs r1, #1
bl CreateEnemy
adds r5, r0, #0
cmp r5, #0
beq _08020010
adds r0, r4, #0
adds r1, r5, #0
bl CopyPosition
ldrh r0, [r5, #0x36]
subs r0, #8
strh r0, [r5, #0x36]
_08020010:
movs r0, #0
strb r0, [r6]
movs r0, #2
b _0802001E
_08020018:
cmp r1, #0x9b
bne _08020042
movs r0, #1
_0802001E:
strb r0, [r4, #0x14]
movs r0, #5
strb r0, [r4, #0xc]
movs r1, #0
movs r0, #0x80
strh r0, [r4, #0x24]
adds r2, r4, #0
adds r2, #0x3d
movs r0, #0xe2
strb r0, [r2]
adds r0, r4, #0
adds r0, #0x81
strb r1, [r0]
ldrb r1, [r4, #0x14]
adds r0, r4, #0
bl InitializeAnimation
b _08020068
_08020042:
cmp r1, #0x80
bne _08020068
ldrb r0, [r4, #0x14]
cmp r0, #0
bne _08020068
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0x1e
strb r0, [r4, #0xe]
strh r1, [r4, #0x24]
movs r0, #0xff
strb r0, [r4, #0x15]
adds r1, r4, #0
adds r1, #0x83
movs r0, #0x78
strb r0, [r1]
adds r0, r4, #0
bl GetNextFrame
_08020068:
adds r0, r4, #0
adds r0, #0x43
ldrb r0, [r0]
cmp r0, #0
beq _0802007A
adds r0, r4, #0
movs r1, #0x1c
bl sub_0804A9FC
_0802007A:
ldr r1, _08020084 @ =gUnk_080CA570
adds r0, r4, #0
bl sub_0804AA30
pop {r4, r5, r6, pc}
.align 2, 0
_08020084: .4byte gUnk_080CA570
thumb_func_start sub_08020088
sub_08020088: @ 0x08020088
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xd]
cmp r0, #2
bhi _0802009C
adds r0, r4, #0
bl sub_0806F520
cmp r0, #0
beq _080200AC
_0802009C:
ldr r0, _080200B0 @ =gUnk_080CA5BC
ldrb r1, [r4, #0xd]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
_080200AC:
pop {r4, pc}
.align 2, 0
_080200B0: .4byte gUnk_080CA5BC
thumb_func_start sub_080200B4
sub_080200B4: @ 0x080200B4
push {lr}
adds r2, r0, #0
movs r1, #1
strb r1, [r2, #0xd]
movs r0, #0x3c
strb r0, [r2, #0x1d]
ldrb r3, [r2, #0x14]
cmp r3, #0
bne _080200E2
strb r1, [r2, #0x14]
movs r0, #5
strb r0, [r2, #0xc]
adds r1, r2, #0
adds r1, #0x3f
movs r0, #0x71
strb r0, [r1]
adds r0, r2, #0
adds r0, #0x81
strb r3, [r0]
ldrb r1, [r2, #0x14]
adds r0, r2, #0
bl InitializeAnimation
_080200E2:
pop {pc}
thumb_func_start sub_080200E4
sub_080200E4: @ 0x080200E4
push {lr}
bl sub_0806F4E8
pop {pc}
thumb_func_start sub_080200EC
sub_080200EC: @ 0x080200EC
push {lr}
bl sub_0806F3E4
pop {pc}
thumb_func_start sub_080200F4
sub_080200F4: @ 0x080200F4
ldrb r2, [r0, #0x10]
movs r1, #0x7f
ands r1, r2
strb r1, [r0, #0x10]
bx lr
.align 2, 0
thumb_func_start nullsub_5
nullsub_5: @ 0x08020100
bx lr
.align 2, 0
thumb_func_start sub_08020104
sub_08020104: @ 0x08020104
push {lr}
adds r2, r0, #0
ldrb r3, [r2, #0x10]
movs r0, #0x80
ands r0, r3
lsls r0, r0, #0x18
lsrs r1, r0, #0x18
cmp r1, #0
beq _08020128
movs r0, #0x80
orrs r0, r3
strb r0, [r2, #0x10]
adds r2, #0x3a
ldrb r1, [r2]
movs r0, #0xfb
ands r0, r1
strb r0, [r2]
b _0802012E
_08020128:
adds r0, r2, #0
adds r0, #0x45
strb r1, [r0]
_0802012E:
pop {pc}
thumb_func_start sub_08020130
sub_08020130: @ 0x08020130
push {r4, r5, lr}
adds r4, r0, #0
bl sub_0804A720
movs r5, #1
strb r5, [r4, #0xc]
movs r0, #0x10
strb r0, [r4, #0xe]
bl Random
strb r0, [r4, #0xf]
bl Random
movs r1, #0x1f
ands r0, r1
strb r0, [r4, #0x15]
movs r0, #0x12
strb r0, [r4, #0x1c]
bl Random
ands r0, r5
movs r1, #0xfe
cmp r0, #0
beq _08020162
movs r1, #2
_08020162:
adds r0, r4, #0
adds r0, #0x80
strb r1, [r0]
adds r0, #1
strb r5, [r0]
adds r0, #1
strb r5, [r0]
movs r0, #0
strb r0, [r4, #0x14]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_08020180
sub_08020180: @ 0x08020180
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x83
ldrb r0, [r5]
cmp r0, #0
beq _08020192
subs r0, #1
strb r0, [r5]
_08020192:
adds r0, r4, #0
movs r1, #1
bl sub_08049FDC
cmp r0, #0
beq _080201D4
ldrb r0, [r5]
cmp r0, #0
bne _080201D4
ldrb r1, [r4, #0xf]
movs r0, #0xf
ands r0, r1
cmp r0, #0
bne _080201D4
ldr r0, _0802021C @ =gUnk_020000B0
ldr r1, [r0]
adds r0, r4, #0
movs r2, #0x30
bl sub_08049F1C
cmp r0, #0
beq _080201D4
movs r0, #2
strb r0, [r4, #0xc]
bl Random
movs r1, #3
ands r0, r1
strb r0, [r4, #0xd]
movs r0, #0x3c
strb r0, [r4, #0xe]
movs r0, #0xa0
strh r0, [r4, #0x24]
_080201D4:
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802020C
movs r0, #0x10
strb r0, [r4, #0xe]
adds r0, r4, #0
bl sub_08020604
bl Random
movs r1, #3
ands r1, r0
cmp r1, #0
bne _0802020C
bl Random
movs r1, #1
ands r1, r0
movs r2, #0xfe
cmp r1, #0
beq _08020206
movs r2, #2
_08020206:
adds r0, r4, #0
adds r0, #0x80
strb r2, [r0]
_0802020C:
adds r0, r4, #0
bl sub_080AEFE0
adds r0, r4, #0
bl GetNextFrame
pop {r4, r5, pc}
.align 2, 0
_0802021C: .4byte gUnk_020000B0
thumb_func_start sub_08020220
sub_08020220: @ 0x08020220
push {r4, r5, lr}
adds r5, r0, #0
movs r1, #1
bl sub_08049FDC
cmp r0, #0
beq _08020284
ldrb r0, [r5, #0xe]
subs r1, r0, #1
strb r1, [r5, #0xe]
lsls r0, r1, #0x18
cmp r0, #0
beq _0802024C
lsrs r0, r0, #0x1c
movs r1, #3
ands r0, r1
movs r1, #4
subs r1, r1, r0
adds r0, r5, #0
bl UpdateAnimationVariableFrames
b _08020292
_0802024C:
movs r0, #3
strb r0, [r5, #0xc]
movs r0, #0x78
strb r0, [r5, #0xe]
movs r0, #0xc0
strh r0, [r5, #0x24]
ldr r0, _0802027C @ =gUnk_020000B0
ldr r1, [r0]
adds r0, r5, #0
bl GetFacingDirection
adds r4, r0, #0
bl Random
ldr r2, _08020280 @ =gUnk_080CA5D4
movs r1, #1
ands r1, r0
adds r1, r1, r2
ldrb r0, [r1]
adds r0, r0, r4
movs r1, #0x1f
ands r0, r1
strb r0, [r5, #0x15]
b _0802028A
.align 2, 0
_0802027C: .4byte gUnk_020000B0
_08020280: .4byte gUnk_080CA5D4
_08020284:
adds r0, r5, #0
bl sub_080205F8
_0802028A:
adds r0, r5, #0
movs r1, #4
bl UpdateAnimationVariableFrames
_08020292:
pop {r4, r5, pc}
thumb_func_start sub_08020294
sub_08020294: @ 0x08020294
push {r4, lr}
adds r4, r0, #0
movs r1, #1
bl sub_08049FDC
cmp r0, #0
beq _080202F8
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080202B4
adds r0, r4, #0
bl sub_080205F8
_080202B4:
ldrb r1, [r4, #0xe]
cmp r1, #0x3c
bls _080202E6
movs r0, #1
ands r0, r1
cmp r0, #0
beq _080202C8
ldrh r0, [r4, #0x24]
adds r0, #4
strh r0, [r4, #0x24]
_080202C8:
ldr r0, _080202F0 @ =gScreenTransition
ldr r0, [r0]
movs r1, #3
ands r0, r1
cmp r0, #0
bne _080202E6
ldr r0, _080202F4 @ =gUnk_020000B0
ldr r1, [r0]
adds r0, r4, #0
bl GetFacingDirection
adds r1, r0, #0
adds r0, r4, #0
bl sub_08004596
_080202E6:
adds r0, r4, #0
bl sub_080AEFE0
b _080202FE
.align 2, 0
_080202F0: .4byte gScreenTransition
_080202F4: .4byte gUnk_020000B0
_080202F8:
adds r0, r4, #0
bl sub_080205F8
_080202FE:
adds r0, r4, #0
movs r1, #4
bl UpdateAnimationVariableFrames
pop {r4, pc}
thumb_func_start sub_08020308
sub_08020308: @ 0x08020308
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
subs r1, r0, #1
strb r1, [r4, #0xe]
lsls r0, r1, #0x18
cmp r0, #0
bne _08020332
movs r0, #1
strb r0, [r4, #0xc]
strb r0, [r4, #0xe]
movs r0, #0x80
strh r0, [r4, #0x24]
adds r1, r4, #0
adds r1, #0x83
movs r0, #0x78
strb r0, [r1]
adds r0, r4, #0
bl GetNextFrame
b _0802034E
_08020332:
movs r0, #1
ands r1, r0
cmp r1, #0
beq _08020340
ldrh r0, [r4, #0x24]
subs r0, #8
strh r0, [r4, #0x24]
_08020340:
adds r0, r4, #0
bl sub_080AEFE0
adds r0, r4, #0
movs r1, #4
bl UpdateAnimationVariableFrames
_0802034E:
pop {r4, pc}
thumb_func_start sub_08020350
sub_08020350: @ 0x08020350
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0x14]
cmp r0, #2
beq _08020398
movs r1, #0xc0
lsls r1, r1, #5
adds r0, r4, #0
bl sub_080044EC
cmp r0, #0
bne _0802037C
movs r0, #6
strb r0, [r4, #0xc]
movs r0, #0xf0
strb r0, [r4, #0xe]
movs r0, #0xa
strb r0, [r4, #0xf]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x71
strb r0, [r1]
_0802037C:
ldrb r0, [r4, #0x15]
cmp r0, #0xff
bne _0802038A
adds r0, r4, #0
adds r0, #0x3e
ldrb r0, [r0]
strb r0, [r4, #0x15]
_0802038A:
adds r0, r4, #0
bl sub_080AEF88
adds r0, r4, #0
bl GetNextFrame
b _080203BE
_08020398:
movs r1, #0xe0
lsls r1, r1, #5
adds r0, r4, #0
bl sub_08003FC4
movs r1, #0x36
ldrsh r0, [r4, r1]
cmp r0, #0
bne _080203BE
movs r0, #7
strb r0, [r4, #0xc]
movs r0, #0x96
strb r0, [r4, #0xe]
movs r0, #0xa
strb r0, [r4, #0xf]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x71
strb r0, [r1]
_080203BE:
pop {r4, pc}
thumb_func_start sub_080203C0
sub_080203C0: @ 0x080203C0
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xf]
cmp r0, #0
beq _080203DC
subs r0, #1
strb r0, [r4, #0xf]
lsls r0, r0, #0x18
cmp r0, #0
bne _080203DC
adds r0, r4, #0
movs r1, #0x1c
bl sub_0804A9FC
_080203DC:
adds r0, r4, #0
bl sub_0800442E
cmp r0, #0
bne _080203F2
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _08020418
_080203F2:
movs r0, #9
strb r0, [r4, #0xc]
movs r0, #0xc0
lsls r0, r0, #9
str r0, [r4, #0x20]
bl Random
movs r1, #0x1f
ands r0, r1
strb r0, [r4, #0x15]
adds r0, r4, #0
bl sub_0804AA1C
movs r0, #5
strb r0, [r4, #0x14]
adds r0, r4, #0
movs r1, #5
bl InitializeAnimation
_08020418:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0802041C
sub_0802041C: @ 0x0802041C
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xf]
cmp r0, #0
beq _08020438
subs r0, #1
strb r0, [r4, #0xf]
lsls r0, r0, #0x18
cmp r0, #0
bne _08020438
adds r0, r4, #0
movs r1, #0x1c
bl sub_0804A9FC
_08020438:
adds r0, r4, #0
bl sub_0800442E
cmp r0, #0
bne _0802044E
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _08020466
_0802044E:
movs r0, #8
strb r0, [r4, #0xc]
movs r0, #0xf0
strb r0, [r4, #0xe]
bl Random
movs r1, #0x1f
ands r0, r1
strb r0, [r4, #0x15]
adds r0, r4, #0
bl sub_0804AA1C
_08020466:
pop {r4, pc}
thumb_func_start sub_08020468
sub_08020468: @ 0x08020468
push {r4, r5, lr}
adds r4, r0, #0
bl GetNextFrame
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080204A6
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _080204A2
movs r0, #9
strb r0, [r4, #0xc]
movs r0, #0xc0
lsls r0, r0, #9
str r0, [r4, #0x20]
movs r0, #4
strb r0, [r4, #0x14]
adds r0, r4, #0
movs r1, #4
bl InitializeAnimation
b _080204A6
_080204A2:
movs r0, #1
strb r0, [r4, #0xe]
_080204A6:
adds r5, r4, #0
adds r5, #0x5a
ldrb r1, [r5]
movs r0, #2
ands r0, r1
cmp r0, #0
beq _080204C4
movs r0, #0xfd
ands r0, r1
strb r0, [r5]
bl Random
movs r1, #0x1f
ands r0, r1
strb r0, [r4, #0x15]
_080204C4:
ldrb r1, [r5]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _080204D6
adds r0, r4, #0
bl sub_0800442E
b _080204DC
_080204D6:
adds r0, r4, #0
bl sub_080AEF88
_080204DC:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_080204E0
sub_080204E0: @ 0x080204E0
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _0802051A
movs r2, #0
movs r1, #1
strb r1, [r4, #0xc]
adds r3, r4, #0
adds r3, #0x3f
movs r0, #0x70
strb r0, [r3]
adds r0, r4, #0
adds r0, #0x82
strb r1, [r0]
subs r0, #1
strb r1, [r0]
strb r2, [r4, #0x14]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
b _0802053A
_0802051A:
movs r0, #1
ands r0, r1
cmp r0, #0
beq _0802052A
adds r0, r4, #0
bl sub_0800442E
b _0802053A
_0802052A:
movs r1, #0xe0
lsls r1, r1, #5
adds r0, r4, #0
bl sub_08003FC4
adds r0, r4, #0
bl sub_080AEF88
_0802053A:
pop {r4, pc}
thumb_func_start sub_0802053C
sub_0802053C: @ 0x0802053C
push {r4, lr}
adds r4, r0, #0
movs r1, #1
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0xf0
strb r0, [r4, #0xe]
movs r0, #0x28
strb r0, [r4, #0xf]
ldrb r0, [r4, #0x18]
movs r2, #4
rsbs r2, r2, #0
ands r2, r0
orrs r2, r1
ldrb r3, [r4, #0x19]
movs r1, #0x3f
adds r0, r1, #0
ands r0, r3
movs r3, #0x40
orrs r0, r3
strb r0, [r4, #0x19]
ldrb r0, [r4, #0x1b]
ands r1, r0
orrs r1, r3
strb r1, [r4, #0x1b]
movs r0, #0x31
rsbs r0, r0, #0
ands r2, r0
strb r2, [r4, #0x18]
movs r0, #0x20
strh r0, [r4, #0x24]
bl Random
movs r1, #0x10
ands r0, r1
adds r0, #8
strb r0, [r4, #0x15]
adds r0, r4, #0
movs r1, #3
bl InitializeAnimation
pop {r4, pc}
thumb_func_start sub_08020590
sub_08020590: @ 0x08020590
push {r4, r5, lr}
adds r4, r0, #0
bl GetNextFrame
ldrb r0, [r4, #0xe]
subs r1, r0, #1
strb r1, [r4, #0xe]
movs r5, #0xff
lsls r0, r1, #0x18
cmp r0, #0
bne _080205AE
adds r0, r4, #0
bl DeleteEntity
b _080205F2
_080205AE:
lsls r0, r1, #0x18
lsrs r0, r0, #0x18
cmp r0, #0x3b
bhi _080205C8
ldrb r2, [r4, #0x18]
lsls r1, r2, #0x1e
lsrs r1, r1, #0x1e
movs r0, #1
eors r1, r0
subs r0, #5
ands r0, r2
orrs r0, r1
strb r0, [r4, #0x18]
_080205C8:
ldr r0, [r4, #0x34]
ldr r1, _080205F4 @ =0xFFFF4000
adds r0, r0, r1
str r0, [r4, #0x34]
adds r0, r4, #0
bl sub_0806F69C
ldrb r0, [r4, #0xf]
subs r0, #1
strb r0, [r4, #0xf]
ands r0, r5
cmp r0, #0
bne _080205F2
movs r0, #0x28
strb r0, [r4, #0xf]
bl Random
movs r1, #0x10
ands r0, r1
adds r0, #8
strb r0, [r4, #0x15]
_080205F2:
pop {r4, r5, pc}
.align 2, 0
_080205F4: .4byte 0xFFFF4000
thumb_func_start sub_080205F8
sub_080205F8: @ 0x080205F8
movs r1, #4
strb r1, [r0, #0xc]
movs r1, #0x3c
strb r1, [r0, #0xe]
bx lr
.align 2, 0
thumb_func_start sub_08020604
sub_08020604: @ 0x08020604
push {r4, lr}
adds r4, r0, #0
bl sub_08049FA0
cmp r0, #0
bne _08020624
bl Random
movs r1, #3
ands r1, r0
cmp r1, #0
beq _08020624
adds r0, r4, #0
bl sub_08049EE4
b _08020632
_08020624:
adds r0, r4, #0
adds r0, #0x80
ldrb r0, [r0]
ldrb r1, [r4, #0x15]
adds r0, r0, r1
movs r1, #0x1f
ands r0, r1
_08020632:
strb r0, [r4, #0x15]
pop {r4, pc}
.align 2, 0
+41
View File
@@ -0,0 +1,41 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CA2B4:: @ 080CA2B4
.incbin "baserom.gba", 0x0CA2B4, 0x000000A
gUnk_080CA2BE:: @ 080CA2BE
.incbin "baserom.gba", 0x0CA2BE, 0x000002C
gUnk_080CA2EA:: @ 080CA2EA
.incbin "baserom.gba", 0x0CA2EA, 0x0000011
gUnk_080CA2FB:: @ 080CA2FB
.incbin "baserom.gba", 0x0CA2FB, 0x0000041
gUnk_080CA33C:: @ 080CA33C
.incbin "baserom.gba", 0x0CA33C, 0x000001C
gUnk_080CA358:: @ 080CA358
.incbin "baserom.gba", 0x0CA358, 0x000000C
gUnk_080CA364:: @ 080CA364
.incbin "baserom.gba", 0x0CA364, 0x000000C
gUnk_080CA370:: @ 080CA370
.incbin "baserom.gba", 0x0CA370, 0x0000041
gUnk_080CA3B1:: @ 080CA3B1
.incbin "baserom.gba", 0x0CA3B1, 0x0000014
gUnk_080CA3C5:: @ 080CA3C5
.incbin "baserom.gba", 0x0CA3C5, 0x0000069
gUnk_080CA42E:: @ 080CA42E
.incbin "baserom.gba", 0x0CA42E, 0x0000042
gUnk_080CA470:: @ 080CA470
.incbin "baserom.gba", 0x0CA470, 0x000002C
+1 -100
View File
@@ -4,105 +4,6 @@
.section .rodata
.align 2
gUnk_080CA2B4:: @ 080CA2B4
.incbin "baserom.gba", 0x0CA2B4, 0x000000A
gUnk_080CA2BE:: @ 080CA2BE
.incbin "baserom.gba", 0x0CA2BE, 0x000002C
gUnk_080CA2EA:: @ 080CA2EA
.incbin "baserom.gba", 0x0CA2EA, 0x0000011
gUnk_080CA2FB:: @ 080CA2FB
.incbin "baserom.gba", 0x0CA2FB, 0x0000041
gUnk_080CA33C:: @ 080CA33C
.incbin "baserom.gba", 0x0CA33C, 0x000001C
gUnk_080CA358:: @ 080CA358
.incbin "baserom.gba", 0x0CA358, 0x000000C
gUnk_080CA364:: @ 080CA364
.incbin "baserom.gba", 0x0CA364, 0x000000C
gUnk_080CA370:: @ 080CA370
.incbin "baserom.gba", 0x0CA370, 0x0000041
gUnk_080CA3B1:: @ 080CA3B1
.incbin "baserom.gba", 0x0CA3B1, 0x0000014
gUnk_080CA3C5:: @ 080CA3C5
.incbin "baserom.gba", 0x0CA3C5, 0x0000069
gUnk_080CA42E:: @ 080CA42E
.incbin "baserom.gba", 0x0CA42E, 0x0000042
gUnk_080CA470:: @ 080CA470
.incbin "baserom.gba", 0x0CA470, 0x000002C
gUnk_080CA49C:: @ 080CA49C
.incbin "baserom.gba", 0x0CA49C, 0x0000018
gUnk_080CA4B4:: @ 080CA4B4
.incbin "baserom.gba", 0x0CA4B4, 0x0000014
gUnk_080CA4C8:: @ 080CA4C8
.incbin "baserom.gba", 0x0CA4C8, 0x0000002
gUnk_080CA4CA:: @ 080CA4CA
.incbin "baserom.gba", 0x0CA4CA, 0x000000A
gUnk_080CA4D4:: @ 080CA4D4
.incbin "baserom.gba", 0x0CA4D4, 0x000002C
gUnk_080CA500:: @ 080CA500
.incbin "baserom.gba", 0x0CA500, 0x000001C
gUnk_080CA51C:: @ 080CA51C
.incbin "baserom.gba", 0x0CA51C, 0x0000044
gUnk_080CA560:: @ 080CA560
.incbin "baserom.gba", 0x0CA560, 0x0000010
gUnk_080CA570:: @ 080CA570
.incbin "baserom.gba", 0x0CA570, 0x0000018
gUnk_080CA588:: @ 080CA588
.incbin "baserom.gba", 0x0CA588, 0x0000008
gUnk_080CA590:: @ 080CA590
.incbin "baserom.gba", 0x0CA590, 0x0000028
gUnk_080CA5B8:: @ 080CA5B8
.incbin "baserom.gba", 0x0CA5B8, 0x0000004
gUnk_080CA5BC:: @ 080CA5BC
.incbin "baserom.gba", 0x0CA5BC, 0x0000018
gUnk_080CA5D4:: @ 080CA5D4
.incbin "baserom.gba", 0x0CA5D4, 0x0000002
gUnk_080CA5D6:: @ 080CA5D6
.incbin "baserom.gba", 0x0CA5D6, 0x0000011
gUnk_080CA5E7:: @ 080CA5E7
.incbin "baserom.gba", 0x0CA5E7, 0x0000011
gUnk_080CA5F8:: @ 080CA5F8
.incbin "baserom.gba", 0x0CA5F8, 0x000001D
gUnk_080CA615:: @ 080CA615
.incbin "baserom.gba", 0x0CA615, 0x0000011
gUnk_080CA626:: @ 080CA626
.incbin "baserom.gba", 0x0CA626, 0x0000014
gUnk_080CA63A:: @ 080CA63A
.incbin "baserom.gba", 0x0CA63A, 0x0000016
gUnk_080CA650:: @ 080CA650
.incbin "baserom.gba", 0x0CA650, 0x000001C
gUnk_080CA66C:: @ 080CA66C
.incbin "baserom.gba", 0x0CA66C, 0x0000018
@@ -6032,4 +5933,4 @@ gUnk_080D3BC8:: @ 080D3BC8
.incbin "baserom.gba", 0x0D3BC8, 0x0000020
gUnk_080D3BE8:: @ 080D3BE8
.incbin "baserom.gba", 0x0D3BE8, 0x0000010
.incbin "baserom.gba", 0x0D3BE8, 0x0000010
+17
View File
@@ -0,0 +1,17 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CA4D4:: @ 080CA4D4
.incbin "baserom.gba", 0x0CA4D4, 0x000002C
gUnk_080CA500:: @ 080CA500
.incbin "baserom.gba", 0x0CA500, 0x000001C
gUnk_080CA51C:: @ 080CA51C
.incbin "baserom.gba", 0x0CA51C, 0x0000044
gUnk_080CA560:: @ 080CA560
.incbin "baserom.gba", 0x0CA560, 0x0000010
+29
View File
@@ -0,0 +1,29 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CA5D4:: @ 080CA5D4
.incbin "baserom.gba", 0x0CA5D4, 0x0000002
gUnk_080CA5D6:: @ 080CA5D6
.incbin "baserom.gba", 0x0CA5D6, 0x0000011
gUnk_080CA5E7:: @ 080CA5E7
.incbin "baserom.gba", 0x0CA5E7, 0x0000011
gUnk_080CA5F8:: @ 080CA5F8
.incbin "baserom.gba", 0x0CA5F8, 0x000001D
gUnk_080CA615:: @ 080CA615
.incbin "baserom.gba", 0x0CA615, 0x0000011
gUnk_080CA626:: @ 080CA626
.incbin "baserom.gba", 0x0CA626, 0x0000014
gUnk_080CA63A:: @ 080CA63A
.incbin "baserom.gba", 0x0CA63A, 0x0000016
gUnk_080CA650:: @ 080CA650
.incbin "baserom.gba", 0x0CA650, 0x000001C
+6 -1
View File
@@ -328,7 +328,7 @@ SECTIONS {
src/enemy/octorok.o(.text);
src/enemy/chuchu.o(.text);
src/enemy/leever.o(.text);
asm/peahat.o(.text);
src/enemy/peahat.o(.text);
asm/rollobite.o(.text);
asm/darkNut.o(.text);
src/enemy/hangingSeed.o(.text);
@@ -909,6 +909,11 @@ SECTIONS {
src/enemy/octorok.o(.rodata);
data/octorokAnimations.o(.rodata);
src/enemy/chuchu.o(.rodata);
data/chuchuAnimations.o(.rodata);
src/enemy/leever.o(.rodata);
data/leeverAnimations.o(.rodata);
src/enemy/peahat.o(.rodata);
data/peahatAnimations.o(.rodata);
data/data_080CA2B4.o(.rodata);
src/enemy.o(.rodata);
data/data_080D3D94.o(.rodata);
+36 -3
View File
@@ -18,9 +18,10 @@ bool32 sub_0801FDE4(Entity*, s32, s32);
extern void (*const gUnk_080CA49C[])(Entity*);
extern void (*const gUnk_080CA4B4[])(Entity*);
extern Entity* gUnk_020000B0;
extern u8 gUnk_080CA4C8[];
extern u16 gUnk_080CA4CA[];
extern const u8 gUnk_080CA4C8[];
extern const u16 gUnk_080CA4CA[];
extern s16 gSineTable[];
void Leever(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CA49C);
SetChildOffset(this, 0, 1, -0x10);
@@ -113,7 +114,7 @@ void sub_0801FDB4(Entity* this) {
u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
u32 uVar3;
u16* puVar4;
const u16* puVar4;
if (sub_080002D4(x, y, gUnk_020000B0->collisionLayer) != 0) {
return 0;
@@ -176,3 +177,35 @@ void sub_0801FED4(Entity* this) {
}
sub_080AEF88(this);
}
// clang-format off
void (*const gUnk_080CA49C[])(Entity*) = {
sub_0801FC28,
sub_0801FC40,
sub_08001324,
sub_0801FC7C,
sub_08001242,
sub_0801FC28,
};
void (*const gUnk_080CA4B4[])(Entity*) = {
sub_0801FC9C,
sub_0801FCB0,
sub_0801FD2C,
sub_0801FD80,
sub_0801FDB4,
};
const u8 gUnk_080CA4C8[] = {
0x06,
0xFA,
};
const u16 gUnk_080CA4CA[] = {
0x000A,
0x0009,
0x000C,
0x000B,
0xFFFF,
};
// clang-format on
+412
View File
@@ -0,0 +1,412 @@
#include "entity.h"
#include "functions.h"
extern void (*const gUnk_080CA570[])(Entity*);
extern void (*const gUnk_080CA588[])(Entity*);
extern void (*const gUnk_080CA590[])(Entity*);
extern void (*const gUnk_080CA5BC[])(Entity*);
extern const s8 gUnk_080CA5B8[];
extern const s8 gUnk_080CA5D4[];
void sub_080205F8(Entity*);
void sub_08020604(Entity*);
extern u32 sub_0800442E(Entity*);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* gUnk_020000B0;
void Peahat(Entity* this) {
if (this->entityType.form == 0) {
EnemyFunctionHandler(this, gUnk_080CA570);
SetChildOffset(this, 0, 1, -0x10);
} else {
gUnk_080CA588[this->action](this);
}
}
void sub_0801FF9C(Entity* this) {
gUnk_080CA590[this->action](this);
if (this->field_0x80.HALF.HI)
this->height.HALF.HI = gUnk_080CA5B8[(this->field_0xf++ & 0x30) >> 4];
}
void sub_0801FFDC(Entity* this) {
if (this->field_0x82.HALF.LO) {
if (this->bitfield == 0x94) {
Entity* ent = CreateEnemy(3, 1);
if (ent) {
CopyPosition(this, ent);
ent->height.HALF.HI -= 8;
}
this->field_0x82.HALF.LO = 0;
this->animationState = 2;
this->action = 5;
this->nonPlanarMovement = 0x80;
this->hurtBlinkTime = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x9b) {
this->animationState = 1;
this->action = 5;
this->nonPlanarMovement = 0x80;
this->hurtBlinkTime = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x80) {
if (this->animationState == 0) {
this->action = 1;
this->actionDelay = 30;
this->nonPlanarMovement = 0x80;
this->direction = -1;
this->field_0x82.HALF.HI = 0x78;
GetNextFrame(this);
}
}
}
if (this->field_0x43)
sub_0804A9FC(this, 0x1c);
sub_0804AA30(this, gUnk_080CA570);
}
void sub_08020088(Entity* this) {
if (2 >= this->previousActionFlag && !sub_0806F520(this))
return;
gUnk_080CA5BC[this->previousActionFlag](this);
}
void sub_080200B4(Entity* this) {
this->previousActionFlag = 1;
this->field_0x1d = 60;
if (this->animationState == 0) {
this->animationState = 1;
this->action = 5;
this->damageType = 0x71;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
}
}
void sub_080200E4(Entity* this) {
sub_0806F4E8(this);
}
void sub_080200EC(Entity* this) {
sub_0806F3E4(this);
}
void sub_080200F4(Entity* this) {
this->flags &= ~0x80;
}
void nullsub_5(Entity* this) {
}
void sub_08020104(Entity* this) {
if (this->flags & 0x80) {
this->flags |= 0x80;
this->field_0x3a &= 0xfb;
} else {
this->currentHealth = 0;
}
}
void sub_08020130(Entity* this) {
sub_0804A720(this);
this->action = 1;
this->actionDelay = 16;
this->field_0xf = Random();
this->direction = Random() & 0x1f;
this->field_0x1c = 18;
this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2;
this->field_0x80.HALF.HI = 1;
this->field_0x82.HALF.LO = 1;
this->animationState = 0;
InitializeAnimation(this, 0);
}
void sub_08020180(Entity* this) {
if (this->field_0x82.HALF.HI)
this->field_0x82.HALF.HI--;
if (sub_08049FDC(this, 1)) {
if (this->field_0x82.HALF.HI == 0 && (this->field_0xf & 0xf) == 0 && sub_08049F1C(this, gUnk_020000B0, 0x30)) {
this->action = 2;
this->previousActionFlag = Random() & 3;
this->actionDelay = 60;
this->nonPlanarMovement = 160;
}
}
if (--this->actionDelay == 0) {
this->actionDelay = 16;
sub_08020604(this);
if ((Random() & 3) == 0) {
this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2;
}
}
sub_080AEFE0(this);
GetNextFrame(this);
}
void sub_08020220(Entity* this) {
if (sub_08049FDC(this, 1)) {
if (--this->actionDelay) {
UpdateAnimationVariableFrames(this, 4 - ((this->actionDelay >> 4) & 0x3));
return;
} else {
this->action = 3;
this->actionDelay = 120;
this->nonPlanarMovement = 192;
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f;
}
} else {
sub_080205F8(this);
}
UpdateAnimationVariableFrames(this, 4);
}
void sub_08020294(Entity* this) {
if (sub_08049FDC(this, 1)) {
if (--this->actionDelay == 0) {
sub_080205F8(this);
}
if (60 < this->actionDelay) {
if (this->actionDelay & 1)
this->nonPlanarMovement += 4;
if ((gScreenTransition.frameCount & 3) == 0)
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
}
sub_080AEFE0(this);
} else {
sub_080205F8(this);
}
UpdateAnimationVariableFrames(this, 4);
}
void sub_08020308(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 1;
this->actionDelay = 1;
this->nonPlanarMovement = 128;
this->field_0x82.HALF.HI = 120;
GetNextFrame(this);
} else {
if (this->actionDelay & 1)
this->nonPlanarMovement -= 8;
sub_080AEFE0(this);
UpdateAnimationVariableFrames(this, 4);
}
}
void sub_08020350(Entity* this) {
if (this->animationState != 2) {
if (sub_080044EC(this, 0x1800) == 0) {
this->action = 6;
this->actionDelay = -0x10;
this->field_0xf = 10;
this->damageType = 113;
}
if (this->direction == 0xff)
this->direction = this->field_0x3e;
sub_080AEF88(this);
GetNextFrame(this);
} else {
sub_08003FC4(this, 0x1c00);
if (this->height.HALF.HI == 0) {
this->action = 7;
this->actionDelay = -106;
this->field_0xf = 10;
this->damageType = 113;
}
}
}
void sub_080203C0(Entity* this) {
if (this->field_0xf)
if (--this->field_0xf == 0)
sub_0804A9FC(this, 0x1c);
if (!sub_0800442E(this) && --this->actionDelay)
return;
this->action = 9;
this->field_0x20 = 0x18000;
this->direction = Random() & 0x1f;
sub_0804AA1C(this);
this->animationState = 5;
InitializeAnimation(this, 5);
}
void sub_0802041C(Entity* this) {
if (this->field_0xf)
if (--this->field_0xf == 0)
sub_0804A9FC(this, 0x1c);
if (!sub_0800442E(this) && --this->actionDelay)
return;
this->action = 8;
this->actionDelay = -16;
this->direction = Random() & 0x1f;
sub_0804AA1C(this);
}
void sub_08020468(Entity* this) {
GetNextFrame(this);
if (--this->actionDelay == 0) {
if (this->frames.all & 0x80) {
this->action = 9;
this->field_0x20 = 0x18000;
this->animationState = 4;
InitializeAnimation(this, 4);
} else {
this->actionDelay = 1;
}
}
if (this->frames.all & 2) {
this->frames.all &= 0xfd;
this->direction = Random() & 0x1f;
}
if (this->frames.all & 1) {
sub_0800442E(this);
} else {
sub_080AEF88(this);
}
}
void sub_080204E0(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 1;
this->damageType = 0x70;
this->field_0x82.HALF.LO = 1;
this->field_0x80.HALF.HI = 1;
this->animationState = 0;
InitializeAnimation(this, 0);
} else {
if (this->frames.all & 1) {
sub_0800442E(this);
} else {
sub_08003FC4(this, 0x1c00);
sub_080AEF88(this);
}
}
}
void sub_0802053C(Entity* this) {
this->action = 1;
this->actionDelay = -16;
this->field_0xf = 40;
this->spriteSettings.b.draw = 1;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
this->spriteSettings.b.shadow = 0;
this->nonPlanarMovement = 0x20;
this->direction = (Random() & 0x10) + 8;
InitializeAnimation(this, 3);
}
void sub_08020590(Entity* this) {
GetNextFrame(this);
if (--this->actionDelay == '\0') {
DeleteEntity(this);
} else {
if (this->actionDelay < 60)
#if NON_MATCHING
this->spriteSettings.b.draw ^= 1;
#else
asm("ldrb r2, [r4, #0x18]\n\
lsl r1, r2, #0x1e\n\
lsr r1, r1, #0x1e\n\
mov r0, #1\n\
eor r1, r0\n\
sub r0, #5\n\
and r0, r2\n\
orr r0, r1\n\
strb r0, [r4, #0x18]");
#endif
this->height.WORD -= 0xc000;
sub_0806F69C(this);
if (--this->field_0xf == 0) {
this->field_0xf = 40;
this->direction = (Random() & 0x10) + 8;
}
}
}
void sub_080205F8(Entity* this) {
this->action = 4;
this->actionDelay = 60;
}
void sub_08020604(Entity *this){
if (!sub_08049FA0(this) && (Random() & 3)) {
this->direction = sub_08049EE4(this);
} else {
this->direction += this->field_0x80.HALF.LO;
this->direction &= 0x1f;
}
}
// clang-format off
void (*const gUnk_080CA570[])(Entity*) = {
sub_0801FF9C,
sub_0801FFDC,
sub_08001324,
sub_0804A7D4,
sub_08001242,
sub_08020088,
};
void (*const gUnk_080CA588[])(Entity*) = {
sub_0802053C,
sub_08020590,
};
void (*const gUnk_080CA590[])(Entity*) = {
sub_08020130,
sub_08020180,
sub_08020220,
sub_08020294,
sub_08020308,
sub_08020350,
sub_080203C0,
sub_0802041C,
sub_08020468,
sub_080204E0,
};
const s8 gUnk_080CA5B8[] = {
-5,
-6,
-7,
-6,
};
void (*const gUnk_080CA5BC[])(Entity*) = {
sub_080200B4,
sub_080200E4,
sub_080200EC,
sub_080200F4,
nullsub_5,
sub_08020104,
};
// clang-format on