decompile Bobomb

This commit is contained in:
Behemoth 2020-09-21 23:08:16 +02:00
parent 5b454deef6
commit 0df7cfe8d9
5 changed files with 371 additions and 830 deletions

View File

@ -1,784 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Bobomb
Bobomb: @ 0x0802C660
push {lr}
ldr r1, _0802C66C @ =gUnk_080CD5D4
bl EnemyFunctionHandler
pop {pc}
.align 2, 0
_0802C66C: .4byte gUnk_080CD5D4
thumb_func_start sub_0802C670
sub_0802C670: @ 0x0802C670
push {lr}
ldr r2, _0802C684 @ =gUnk_080CD5EC
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0802C684: .4byte gUnk_080CD5EC
thumb_func_start sub_0802C688
sub_0802C688: @ 0x0802C688
push {r4, lr}
adds r4, r0, #0
adds r0, #0x41
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
bne _0802C69A
b _0802C79E
_0802C69A:
movs r0, #0x7f
ands r0, r1
cmp r0, #0x16
bhi _0802C740
lsls r0, r0, #2
ldr r1, _0802C6AC @ =_0802C6B0
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0802C6AC: .4byte _0802C6B0
_0802C6B0: @ jump table
.4byte _0802C70C @ case 0
.4byte _0802C70C @ case 1
.4byte _0802C740 @ case 2
.4byte _0802C740 @ case 3
.4byte _0802C740 @ case 4
.4byte _0802C740 @ case 5
.4byte _0802C740 @ case 6
.4byte _0802C740 @ case 7
.4byte _0802C740 @ case 8
.4byte _0802C740 @ case 9
.4byte _0802C740 @ case 10
.4byte _0802C740 @ case 11
.4byte _0802C740 @ case 12
.4byte _0802C740 @ case 13
.4byte _0802C72C @ case 14
.4byte _0802C740 @ case 15
.4byte _0802C740 @ case 16
.4byte _0802C740 @ case 17
.4byte _0802C740 @ case 18
.4byte _0802C740 @ case 19
.4byte _0802C72C @ case 20
.4byte _0802C72C @ case 21
.4byte _0802C72C @ case 22
_0802C70C:
adds r0, r4, #0
adds r0, #0x82
ldrb r0, [r0]
cmp r0, #0
beq _0802C7A6
adds r1, r4, #0
adds r1, #0x42
movs r0, #0
strb r0, [r1]
ldr r0, _0802C728 @ =gPlayerEntity
adds r0, #0x42
movs r1, #4
strb r1, [r0]
b _0802C7A6
.align 2, 0
_0802C728: .4byte gPlayerEntity
_0802C72C:
movs r1, #0
movs r0, #3
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x42
strb r1, [r0]
adds r0, r4, #0
bl sub_0802CBC4
b _0802C7A6
_0802C740:
adds r2, r4, #0
adds r2, #0x82
ldrb r0, [r2]
adds r0, #1
strb r0, [r2]
adds r1, r4, #0
adds r1, #0x80
movs r0, #0x1c
strb r0, [r1]
ldrb r0, [r2]
cmp r0, #1
beq _0802C75E
cmp r0, #2
beq _0802C770
b _0802C79E
_0802C75E:
adds r0, r4, #0
bl sub_0802CB68
ldr r0, _0802C76C @ =0x0000014D
bl EnqueueSFX
b _0802C79E
.align 2, 0
_0802C76C: .4byte 0x0000014D
_0802C770:
movs r0, #3
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x6e
strb r0, [r1]
movs r1, #1
strb r1, [r4, #0xf]
movs r0, #0xc0
lsls r0, r0, #9
str r0, [r4, #0x20]
movs r0, #0
strh r0, [r4, #0x24]
adds r0, r4, #0
adds r0, #0x81
strb r1, [r0]
ldrb r1, [r4, #0x15]
lsrs r1, r1, #4
movs r0, #6
orrs r1, r0
adds r0, r4, #0
bl InitializeAnimation
_0802C79E:
ldr r1, _0802C7A8 @ =gUnk_080CD5D4
adds r0, r4, #0
bl sub_0804AA30
_0802C7A6:
pop {r4, pc}
.align 2, 0
_0802C7A8: .4byte gUnk_080CD5D4
thumb_func_start sub_0802C7AC
sub_0802C7AC: @ 0x0802C7AC
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xd]
cmp r0, #2
bhi _0802C7F6
adds r0, r4, #0
bl sub_0806F520
adds r1, r0, #0
cmp r1, #0
bne _0802C7F6
strb r1, [r4, #0xd]
movs r0, #1
strb r0, [r4, #0xf]
strh r1, [r4, #0x36]
adds r0, r4, #0
adds r0, #0x82
ldrb r0, [r0]
cmp r0, #2
beq _0802C7E2
movs r1, #0x80
cmp r0, #0
beq _0802C7E0
movs r0, #0x80
lsls r0, r0, #2
adds r1, r0, #0
_0802C7E0:
strh r1, [r4, #0x24]
_0802C7E2:
movs r0, #0xc0
lsls r0, r0, #9
str r0, [r4, #0x20]
adds r0, r4, #0
adds r0, #0x83
movs r1, #0
strb r1, [r0]
subs r0, #2
strb r1, [r0]
b _0802C816
_0802C7F6:
ldr r0, _0802C818 @ =0x0000FFFF
strh r0, [r4, #0x36]
ldr r1, _0802C81C @ =gUnk_080CD600
ldrb r0, [r4, #0xd]
lsls r0, r0, #2
adds r0, r0, r1
ldr r1, [r0]
adds r0, r4, #0
bl _call_via_r1
ldrb r0, [r4, #0xe]
cmp r0, #0
beq _0802C816
adds r0, r4, #0
bl GetNextFrame
_0802C816:
pop {r4, pc}
.align 2, 0
_0802C818: .4byte 0x0000FFFF
_0802C81C: .4byte gUnk_080CD600
thumb_func_start sub_0802C820
sub_0802C820: @ 0x0802C820
movs r1, #1
strb r1, [r0, #0xd]
movs r1, #0x3c
strb r1, [r0, #0x1d]
bx lr
.align 2, 0
thumb_func_start sub_0802C82C
sub_0802C82C: @ 0x0802C82C
push {lr}
bl sub_0806F4E8
pop {pc}
thumb_func_start sub_0802C834
sub_0802C834: @ 0x0802C834
push {lr}
bl sub_0806F3E4
pop {pc}
thumb_func_start sub_0802C83C
sub_0802C83C: @ 0x0802C83C
push {r4, lr}
adds r4, r0, #0
adds r1, r4, #0
adds r1, #0x82
ldrb r0, [r1]
cmp r0, #0
beq _0802C88C
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802C884
movs r0, #3
strb r0, [r4, #0xc]
ldr r0, _0802C86C @ =gPlayerEntity
ldrb r0, [r0, #0x14]
movs r1, #6
ands r1, r0
cmp r1, #2
beq _0802C870
cmp r1, #6
beq _0802C876
b _0802C87C
.align 2, 0
_0802C86C: .4byte gPlayerEntity
_0802C870:
ldrh r0, [r4, #0x2e]
subs r0, #6
b _0802C87A
_0802C876:
ldrh r0, [r4, #0x2e]
adds r0, #6
_0802C87A:
strh r0, [r4, #0x2e]
_0802C87C:
adds r0, r4, #0
bl sub_0802CBC4
b _0802C8B2
_0802C884:
adds r0, r4, #0
bl sub_0802CC18
b _0802C8A2
_0802C88C:
movs r0, #2
strb r0, [r1]
movs r0, #0x78
strb r0, [r4, #0xe]
ldrb r1, [r4, #0x15]
lsrs r1, r1, #4
movs r0, #6
orrs r1, r0
adds r0, r4, #0
bl InitializeAnimation
_0802C8A2:
ldrb r1, [r4, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r4, #0x10]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x6e
strb r0, [r1]
_0802C8B2:
pop {r4, pc}
thumb_func_start nullsub_149
nullsub_149: @ 0x0802C8B4
bx lr
.align 2, 0
thumb_func_start sub_0802C8B8
sub_0802C8B8: @ 0x0802C8B8
push {lr}
movs r1, #3
strb r1, [r0, #0xc]
bl sub_0802CBC4
pop {pc}
thumb_func_start sub_0802C8C4
sub_0802C8C4: @ 0x0802C8C4
push {r4, lr}
adds r4, r0, #0
bl sub_0804A7D4
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
strb r0, [r4, #0x18]
pop {r4, pc}
thumb_func_start sub_0802C8D8
sub_0802C8D8: @ 0x0802C8D8
push {r4, r5, lr}
adds r5, r0, #0
movs r4, #0
movs r0, #1
strb r0, [r5, #0xc]
movs r0, #0x3c
strb r0, [r5, #0xe]
strb r4, [r5, #0xf]
bl Random
movs r1, #0x18
ands r0, r1
movs r1, #4
orrs r0, r1
strb r0, [r5, #0x15]
strb r4, [r5, #0x16]
movs r0, #0x12
strb r0, [r5, #0x1c]
adds r0, r5, #0
adds r0, #0x82
strb r4, [r0]
adds r0, #1
strb r4, [r0]
subs r0, #3
strb r4, [r0]
adds r0, #1
strb r4, [r0]
ldrb r1, [r5, #0x15]
lsrs r1, r1, #4
adds r0, r5, #0
bl InitializeAnimation
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_0802C91C
sub_0802C91C: @ 0x0802C91C
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
bl ProcessMovement
adds r0, r4, #0
adds r0, #0x82
ldrb r0, [r0]
cmp r0, #0
beq _0802C97A
ldrh r0, [r4, #0x2a]
cmp r0, #0
beq _0802C950
adds r1, r0, #0
adds r0, r4, #0
bl sub_0800417E
ldrb r1, [r4, #0x15]
lsrs r1, r1, #4
movs r0, #2
orrs r1, r0
adds r0, r4, #0
bl InitializeAnimation
_0802C950:
ldrb r0, [r4, #0xe]
subs r1, r0, #1
strb r1, [r4, #0xe]
lsls r0, r1, #0x18
cmp r0, #0
bne _0802C964
adds r0, r4, #0
bl sub_0802CBC4
b _0802C9B4
_0802C964:
movs r0, #0xf
ands r1, r0
cmp r1, #8
bne _0802C972
adds r0, r4, #0
bl CreateDustSmall
_0802C972:
adds r0, r4, #0
bl sub_0802CC18
b _0802C9B4
_0802C97A:
ldrh r0, [r4, #0x2a]
cmp r0, #0
beq _0802C992
adds r1, r0, #0
adds r0, r4, #0
bl sub_0800417E
ldrb r1, [r4, #0x15]
lsrs r1, r1, #4
adds r0, r4, #0
bl InitializeAnimation
_0802C992:
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802C9B4
movs r0, #0x3c
strb r0, [r4, #0xe]
ldrb r1, [r4, #0x15]
adds r1, #8
movs r0, #0x1c
ands r1, r0
strb r1, [r4, #0x15]
lsrs r1, r1, #4
adds r0, r4, #0
bl InitializeAnimation
_0802C9B4:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0802C9B8
sub_0802C9B8: @ 0x0802C9B8
push {lr}
ldr r2, _0802C9CC @ =gUnk_080CD618
ldrb r1, [r0, #0xd]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0802C9CC: .4byte gUnk_080CD618
thumb_func_start sub_0802C9D0
sub_0802C9D0: @ 0x0802C9D0
push {r4, lr}
adds r4, r0, #0
movs r2, #1
strb r2, [r4, #0xd]
ldrb r1, [r4, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r4, #0x10]
adds r3, r4, #0
adds r3, #0x29
ldrb r1, [r3]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
strb r0, [r3]
adds r0, r4, #0
adds r0, #0x83
strb r2, [r0]
adds r0, r4, #0
bl sub_0802CC18
ldrb r1, [r4, #0x15]
lsrs r1, r1, #4
movs r0, #6
orrs r1, r0
adds r0, r4, #0
bl InitializeAnimation
adds r0, r4, #0
bl GetNextFrame
pop {r4, pc}
thumb_func_start sub_0802CA10
sub_0802CA10: @ 0x0802CA10
push {r4, lr}
adds r4, r0, #0
ldr r0, _0802CA30 @ =gPlayerState
ldrb r0, [r0, #5]
cmp r0, #5
beq _0802CA42
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802CA34
adds r0, r4, #0
bl sub_0802CBC4
b _0802CA66
.align 2, 0
_0802CA30: .4byte gPlayerState
_0802CA34:
adds r0, r4, #0
bl sub_0802CC18
adds r0, r4, #0
bl GetNextFrame
b _0802CA66
_0802CA42:
adds r1, r4, #0
adds r1, #0x83
movs r0, #2
strb r0, [r1]
ldr r0, _0802CA68 @ =gPlayerEntity
ldrb r0, [r0, #0x14]
lsls r0, r0, #2
movs r1, #4
orrs r0, r1
movs r1, #0x1c
ands r0, r1
strb r0, [r4, #0x15]
adds r0, r4, #0
bl sub_0802CC18
adds r0, r4, #0
bl GetNextFrame
_0802CA66:
pop {r4, pc}
.align 2, 0
_0802CA68: .4byte gPlayerEntity
thumb_func_start sub_0802CA6C
sub_0802CA6C: @ 0x0802CA6C
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802CA84
adds r0, r4, #0
bl sub_0802CBC4
b _0802CA90
_0802CA84:
adds r0, r4, #0
bl sub_0802CC18
adds r0, r4, #0
bl GetNextFrame
_0802CA90:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0802CA94
sub_0802CA94: @ 0x0802CA94
push {lr}
adds r3, r0, #0
movs r2, #0
movs r0, #3
strb r0, [r3, #0xc]
ldrb r1, [r3, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r3, #0x10]
movs r0, #1
strb r0, [r3, #0xf]
movs r0, #0x29
adds r0, r0, r3
mov ip, r0
ldrb r1, [r0]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #8
orrs r0, r1
mov r1, ip
strb r0, [r1]
movs r0, #0xc0
lsls r0, r0, #9
str r0, [r3, #0x20]
movs r0, #0
strh r2, [r3, #0x24]
adds r1, r3, #0
adds r1, #0x83
strb r0, [r1]
subs r1, #2
strb r0, [r1]
ldr r0, _0802CAF4 @ =gPlayerEntity
ldrb r1, [r0, #0x14]
lsls r1, r1, #2
movs r0, #4
orrs r1, r0
movs r0, #0x1c
ands r1, r0
strb r1, [r3, #0x15]
lsrs r1, r1, #4
movs r0, #6
orrs r1, r0
adds r0, r3, #0
bl InitializeAnimation
pop {pc}
.align 2, 0
_0802CAF4: .4byte gPlayerEntity
thumb_func_start sub_0802CAF8
sub_0802CAF8: @ 0x0802CAF8
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802CB10
adds r0, r4, #0
bl sub_0802CBC4
b _0802CB62
_0802CB10:
adds r0, r4, #0
adds r0, #0x81
ldrb r0, [r0]
cmp r0, #0
beq _0802CB30
movs r1, #0xa0
lsls r1, r1, #6
adds r0, r4, #0
bl sub_080044EC
cmp r0, #1
bne _0802CB30
movs r0, #0x82
lsls r0, r0, #1
bl EnqueueSFX
_0802CB30:
adds r0, r4, #0
bl sub_0802CC18
adds r0, r4, #0
bl sub_08078930
ldrb r0, [r4, #0xf]
cmp r0, #0
beq _0802CB5C
movs r1, #0x36
ldrsh r0, [r4, r1]
cmp r0, #0
bne _0802CB5C
strb r0, [r4, #0xf]
ldrb r0, [r4, #0x10]
movs r1, #0x80
orrs r1, r0
strb r1, [r4, #0x10]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x6e
strb r0, [r1]
_0802CB5C:
adds r0, r4, #0
bl GetNextFrame
_0802CB62:
pop {r4, pc}
thumb_func_start nullsub_150
nullsub_150: @ 0x0802CB64
bx lr
.align 2, 0
thumb_func_start sub_0802CB68
sub_0802CB68: @ 0x0802CB68
push {r4, r5, lr}
adds r5, r0, #0
movs r4, #0
movs r1, #0
movs r0, #1
strb r0, [r5, #0xc]
strb r1, [r5, #0xd]
bl Random
adds r2, r0, #0
movs r0, #0x18
ands r2, r0
movs r0, #4
orrs r2, r0
orrs r2, r4
strb r2, [r5, #0x15]
ldrb r0, [r5, #0x10]
movs r1, #0x80
orrs r0, r1
strb r0, [r5, #0x10]
adds r0, r5, #0
adds r0, #0x82
ldrb r0, [r0]
cmp r0, #0
beq _0802CBB2
movs r0, #0xc8
strb r0, [r5, #0xe]
movs r0, #0x80
lsls r0, r0, #2
strh r0, [r5, #0x24]
lsrs r1, r2, #4
movs r0, #2
orrs r1, r0
adds r0, r5, #0
bl InitializeAnimation
b _0802CBC2
_0802CBB2:
movs r0, #0x3c
strb r0, [r5, #0xe]
movs r0, #0x80
strh r0, [r5, #0x24]
lsrs r1, r2, #4
adds r0, r5, #0
bl InitializeAnimation
_0802CBC2:
pop {r4, r5, pc}
thumb_func_start sub_0802CBC4
sub_0802CBC4: @ 0x0802CBC4
push {r4, lr}
adds r4, r0, #0
movs r2, #0
movs r0, #4
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #8
ands r0, r1
strb r0, [r4, #0x18]
ldrb r1, [r4, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r4, #0x10]
adds r0, r4, #0
adds r0, #0x45
strb r2, [r0]
adds r0, #0x3e
ldrb r0, [r0]
cmp r0, #0
beq _0802CBF0
bl sub_08079184
_0802CBF0:
adds r0, r4, #0
bl sub_08078954
adds r0, r4, #0
movs r1, #0x20
movs r2, #0
movs r3, #0
bl CreateObjectWithParent
adds r2, r0, #0
cmp r2, #0
beq _0802CC14
adds r0, r4, #0
adds r0, #0x38
ldrb r1, [r0]
adds r0, r2, #0
adds r0, #0x38
strb r1, [r0]
_0802CC14:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0802CC18
sub_0802CC18: @ 0x0802CC18
push {lr}
adds r1, r0, #0
adds r1, #0x80
ldrb r0, [r1]
subs r0, #1
strb r0, [r1]
lsls r0, r0, #0x18
cmp r0, #0
bne _0802CC34
movs r0, #0x1c
strb r0, [r1]
ldr r0, _0802CC38 @ =0x0000014D
bl EnqueueSFX
_0802CC34:
pop {pc}
.align 2, 0
_0802CC38: .4byte 0x0000014D

37
data/animations/bobomb.s Normal file
View File

@ -0,0 +1,37 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnk_080CD628:: @ 080CD628
.incbin "baserom.gba", 0x0CD628, 0x0000011
gUnk_080CD639:: @ 080CD639
.incbin "baserom.gba", 0x0CD639, 0x0000011
gUnk_080CD64A:: @ 080CD64A
.incbin "baserom.gba", 0x0CD64A, 0x0000011
gUnk_080CD65B:: @ 080CD65B
.incbin "baserom.gba", 0x0CD65B, 0x0000011
gUnk_080CD66C:: @ 080CD66C
.incbin "baserom.gba", 0x0CD66C, 0x0000005
gUnk_080CD671:: @ 080CD671
.incbin "baserom.gba", 0x0CD671, 0x0000005
gUnk_080CD676:: @ 080CD676
.incbin "baserom.gba", 0x0CD676, 0x0000009
gUnk_080CD67F:: @ 080CD67F
.incbin "baserom.gba", 0x0CD67F, 0x0000009
gUnk_080CD688:: @ 080CD688
.incbin "baserom.gba", 0x0CD688, 0x0000024
gUnk_080CD6AC:: @ 080CD6AC
.incbin "baserom.gba", 0x0CD6AC, 0x0000024
gUnk_080CD6D0:: @ 080CD6D0
.incbin "baserom.gba", 0x0CD6D0, 0x000002C

View File

@ -3,51 +3,6 @@
.section .rodata
gUnk_080CD5D4:: @ 080CD5D4
.incbin "baserom.gba", 0x0CD5D4, 0x0000018
gUnk_080CD5EC:: @ 080CD5EC
.incbin "baserom.gba", 0x0CD5EC, 0x0000014
gUnk_080CD600:: @ 080CD600
.incbin "baserom.gba", 0x0CD600, 0x0000018
gUnk_080CD618:: @ 080CD618
.incbin "baserom.gba", 0x0CD618, 0x0000010
gUnk_080CD628:: @ 080CD628
.incbin "baserom.gba", 0x0CD628, 0x0000011
gUnk_080CD639:: @ 080CD639
.incbin "baserom.gba", 0x0CD639, 0x0000011
gUnk_080CD64A:: @ 080CD64A
.incbin "baserom.gba", 0x0CD64A, 0x0000011
gUnk_080CD65B:: @ 080CD65B
.incbin "baserom.gba", 0x0CD65B, 0x0000011
gUnk_080CD66C:: @ 080CD66C
.incbin "baserom.gba", 0x0CD66C, 0x0000005
gUnk_080CD671:: @ 080CD671
.incbin "baserom.gba", 0x0CD671, 0x0000005
gUnk_080CD676:: @ 080CD676
.incbin "baserom.gba", 0x0CD676, 0x0000009
gUnk_080CD67F:: @ 080CD67F
.incbin "baserom.gba", 0x0CD67F, 0x0000009
gUnk_080CD688:: @ 080CD688
.incbin "baserom.gba", 0x0CD688, 0x0000024
gUnk_080CD6AC:: @ 080CD6AC
.incbin "baserom.gba", 0x0CD6AC, 0x0000024
gUnk_080CD6D0:: @ 080CD6D0
.incbin "baserom.gba", 0x0CD6D0, 0x000002C
gUnk_080CD6FC:: @ 080CD6FC
.incbin "baserom.gba", 0x0CD6FC, 0x0000018

View File

@ -359,7 +359,7 @@ SECTIONS {
src/enemy/sensorBladeTrap.o(.text);
src/enemy/helmasaur.o(.text);
src/enemy/fallingBoulder.o(.text);
asm/bobomb.o(.text);
src/enemy/bobomb.o(.text);
asm/wallMaster2.o(.text);
asm/gleerok.o(.text);
asm/vaatiEyesMacro.o(.text);
@ -969,6 +969,8 @@ SECTIONS {
data/animations/helmasaur.o(.rodata);
src/enemy/fallingBoulder.o(.rodata);
data/animations/fallingBoulder.o(.rodata);
src/enemy/bobomb.o(.rodata);
data/animations/bobomb.o(.rodata);
data/data_080CC6FC.o(.rodata);
src/enemy.o(.rodata);
data/data_080D3D94.o(.rodata);

331
src/enemy/bobomb.c Normal file
View File

@ -0,0 +1,331 @@
#include "enemy.h"
#include "functions.h"
extern void CreateDustSmall(Entity*);
extern void sub_08078930(Entity*);
extern void sub_08078954(Entity*);
void sub_0802CB68(Entity*);
void sub_0802CBC4(Entity*);
void sub_0802CC18(Entity*);
extern void (*const gUnk_080CD5D4[])(Entity*);
extern void (*const gUnk_080CD5EC[])(Entity*);
extern void (*const gUnk_080CD600[])(Entity*);
extern void (*const gUnk_080CD618[])(Entity*);
void Bobomb(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CD5D4);
}
void sub_0802C670(Entity* this) {
gUnk_080CD5EC[this->action](this);
}
void sub_0802C688(Entity* this) {
if (this->bitfield & 0x80) {
switch (this->bitfield & 0x7f) {
case 0:
case 1:
if (this->field_0x82.HALF.LO) {
this->field_0x42 = 0;
gPlayerEntity.field_0x42 = 4;
}
return;
case 0xe:
case 0x14:
case 0x15:
case 0x16:
this->action = 3;
this->field_0x42 = 0;
sub_0802CBC4(this);
return;
}
this->field_0x82.HALF.LO++;
this->field_0x80.HALF.LO = 28;
switch (this->field_0x82.HALF.LO) {
case 1:
sub_0802CB68(this);
EnqueueSFX(0x14d);
break;
case 2:
this->action = 3;
this->damageType = 0x6e;
this->field_0xf = 1;
this->field_0x20 = 0x18000;
this->nonPlanarMovement = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
break;
}
}
sub_0804AA30(this, gUnk_080CD5D4);
}
void sub_0802C7AC(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
this->previousActionFlag = 0;
this->field_0xf = 1;
this->height.HALF.HI = 0;
if (this->field_0x82.HALF.LO != 2) {
this->nonPlanarMovement = this->field_0x82.HALF.LO ? 0x200 : 0x80;
}
this->field_0x20 = 0x18000;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
} else {
this->height.HALF.HI = -1;
gUnk_080CD600[this->previousActionFlag](this);
if (this->actionDelay != 0) {
GetNextFrame(this);
}
}
}
void sub_0802C820(Entity* this) {
this->previousActionFlag = 1;
this->field_0x1d = 60;
}
void sub_0802C82C(Entity* this) {
sub_0806F4E8(this);
}
void sub_0802C834(Entity* this) {
sub_0806F3E4(this);
}
void sub_0802C83C(Entity* this) {
if (this->field_0x82.HALF.LO) {
if (--this->actionDelay == 0) {
this->action = 3;
switch (gPlayerEntity.animationState & 6) {
case 2:
this->x.HALF.HI -= 6;
break;
case 6:
this->x.HALF.HI += 6;
break;
}
sub_0802CBC4(this);
} else {
sub_0802CC18(this);
this->flags &= ~0x80;
this->damageType = 0x6e;
}
} else {
this->field_0x82.HALF.LO = 2;
this->actionDelay = 120;
InitializeAnimation(this, (this->direction >> 4) | 6);
this->flags &= ~0x80;
this->damageType = 0x6e;
}
}
void nullsub_149(Entity* this) {
/* ... */
}
void sub_0802C8B8(Entity* this) {
this->action = 3;
sub_0802CBC4(this);
}
void sub_0802C8C4(Entity* this) {
sub_0804A7D4(this);
this->spriteSettings.b.draw = 0;
}
void sub_0802C8D8(Entity* this) {
this->action = 1;
this->actionDelay = 0x3c;
this->field_0xf = 0;
this->direction = (Random() & 0x18) | 4;
this->field_0x16 = 0;
this->field_0x1c = 0x12;
this->field_0x82.HALF.LO = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.LO = 0;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->direction >> 4);
}
void sub_0802C91C(Entity* this) {
GetNextFrame(this);
ProcessMovement(this);
if (this->field_0x82.HALF.LO) {
if (this->collisions) {
sub_0800417E(this, this->collisions);
InitializeAnimation(this, (this->direction >> 4) | 2);
}
if (--this->actionDelay == 0) {
sub_0802CBC4(this);
} else {
if ((this->actionDelay & 0xf) == 8) {
CreateDustSmall(this);
}
sub_0802CC18(this);
}
} else {
if (this->collisions) {
sub_0800417E(this, this->collisions);
InitializeAnimation(this, this->direction >> 4);
}
if (--this->actionDelay == 0) {
this->actionDelay = 60;
this->direction = (this->direction + 8) & 0x1c;
InitializeAnimation(this, this->direction >> 4);
}
}
}
void sub_0802C9B8(Entity* this) {
gUnk_080CD618[this->previousActionFlag](this);
}
void sub_0802C9D0(Entity* this) {
this->previousActionFlag = 1;
this->flags &= ~0x80;
this->spritePriority.b1 = 0;
this->field_0x82.HALF.HI = 1;
sub_0802CC18(this);
InitializeAnimation(this, (this->direction >> 4) | 6);
GetNextFrame(this);
}
void sub_0802CA10(Entity* this) {
if (gPlayerState.heldObject != 5) {
if (--this->actionDelay == 0) {
sub_0802CBC4(this);
} else {
sub_0802CC18(this);
GetNextFrame(this);
}
} else {
this->field_0x82.HALF.HI = 2;
this->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c;
sub_0802CC18(this);
GetNextFrame(this);
}
}
void sub_0802CA6C(Entity* this) {
if (--this->actionDelay == 0) {
sub_0802CBC4(this);
} else {
sub_0802CC18(this);
GetNextFrame(this);
}
}
void sub_0802CA94(Entity* this) {
this->action = 3;
this->flags &= ~0x80;
this->field_0xf = 1;
this->spritePriority.b1 = 1;
this->field_0x20 = 0x18000;
this->nonPlanarMovement = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c;
InitializeAnimation(this, (this->direction >> 4) | 6);
}
void sub_0802CAF8(Entity* this) {
if (--this->actionDelay == 0) {
sub_0802CBC4(this);
} else {
if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) {
EnqueueSFX(0x104);
}
sub_0802CC18(this);
sub_08078930(this);
if (this->field_0xf && this->height.HALF.HI == 0) {
this->field_0xf = 0;
this->flags = this->flags | 0x80;
this->damageType = 0x6e;
}
GetNextFrame(this);
}
}
void nullsub_150(Entity* this) {
/* ... */
}
void sub_0802CB68(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->direction = Random() & 0x18;
this->direction |= 4;
this->flags |= 0x80;
if (this->field_0x82.HALF.LO) {
this->actionDelay = 200;
this->nonPlanarMovement = 0x200;
InitializeAnimation(this, (this->direction >> 4) | 2);
} else {
this->actionDelay = 0x3c;
this->nonPlanarMovement = 0x80;
InitializeAnimation(this, this->direction >> 4);
}
}
void sub_0802CBC4(Entity* this) {
Entity* ent;
this->action = 4;
this->spriteSettings.b.draw = 0;
this->flags &= ~0x80;
this->currentHealth = 0;
if (this->field_0x82.HALF.HI) {
sub_08079184();
}
sub_08078954(this);
ent = CreateObjectWithParent(this, 0x20, 0, 0);
if (ent) {
ent->collisionLayer = this->collisionLayer;
}
}
void sub_0802CC18(Entity* this) {
if (--this->field_0x80.HALF.LO == 0) {
this->field_0x80.HALF.LO = 28;
EnqueueSFX(0x14d);
}
}
// clang-format off
void (*const gUnk_080CD5D4[])(Entity*) = {
sub_0802C670,
sub_0802C688,
sub_08001324,
sub_0802C8C4,
sub_08001242,
sub_0802C7AC,
};
void (*const gUnk_080CD5EC[])(Entity*) = {
sub_0802C8D8,
sub_0802C91C,
sub_0802C9B8,
sub_0802CAF8,
nullsub_150,
};
void (*const gUnk_080CD600[])(Entity*) = {
sub_0802C820,
sub_0802C82C,
sub_0802C834,
sub_0802C83C,
nullsub_149,
sub_0802C8B8,
};
void (*const gUnk_080CD618[])(Entity*) = {
sub_0802C9D0,
sub_0802CA10,
sub_0802CA6C,
sub_0802CA94,
};
// clang-format on