Merge pull request #275 from hatal175/takkuri

This commit is contained in:
notyourav 2022-01-11 19:34:08 -08:00 committed by GitHub
commit 28ab5262ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 391 additions and 862 deletions

View File

@ -1,805 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Takkuri
Takkuri: @ 0x0803BB7C
push {r4, r5, lr}
adds r5, r0, #0
ldr r4, _0803BB94 @ =gUnk_080CFF3C
bl GetNextFunction
lsls r0, r0, #2
adds r0, r0, r4
ldr r1, [r0]
adds r0, r5, #0
bl _call_via_r1
pop {r4, r5, pc}
.align 2, 0
_0803BB94: .4byte gUnk_080CFF3C
thumb_func_start sub_0803BB98
sub_0803BB98: @ 0x0803BB98
push {lr}
ldr r2, _0803BBAC @ =gUnk_080CFF54
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0803BBAC: .4byte gUnk_080CFF54
thumb_func_start sub_0803BBB0
sub_0803BBB0: @ 0x0803BBB0
push {r4, r5, lr}
adds r4, r0, #0
adds r0, #0x41
ldrb r1, [r0]
movs r2, #0x80
adds r0, r2, #0
ands r0, r1
cmp r0, #0
beq _0803BC2C
movs r5, #0x7f
adds r0, r5, #0
ands r0, r1
cmp r0, #0
bne _0803BC06
adds r0, r4, #0
bl sub_0803C0AC
ldrb r1, [r4, #0x10]
adds r0, r5, #0
ands r0, r1
strb r0, [r4, #0x10]
ldrb r2, [r4, #0x15]
adds r0, r2, #4
movs r1, #8
ands r0, r1
cmp r0, #0
bne _0803BBF6
movs r0, #0x10
ands r0, r2
cmp r0, #0
beq _0803BBF2
adds r0, r2, #2
b _0803BBF4
_0803BBF2:
subs r0, r2, #2
_0803BBF4:
strb r0, [r4, #0x15]
_0803BBF6:
ldrb r1, [r4, #0x15]
movs r0, #0x20
subs r0, r0, r1
strb r0, [r4, #0x15]
adds r0, r4, #0
bl sub_0803BF2C
b _0803BC1E
_0803BC06:
adds r0, r4, #0
adds r0, #0x3d
ldrb r1, [r0]
adds r0, r2, #0
ands r0, r1
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
cmp r0, #0
bne _0803BC1E
adds r1, r4, #0
adds r1, #0x45
strb r0, [r1]
_0803BC1E:
adds r1, r4, #0
adds r1, #0x82
ldrh r0, [r1]
cmp r0, #0x10
bls _0803BC2C
subs r0, #0xc
strh r0, [r1]
_0803BC2C:
adds r0, r4, #0
bl GetNextFrame
pop {r4, r5, pc}
thumb_func_start sub_0803BC34
sub_0803BC34: @ 0x0803BC34
push {r4, lr}
adds r4, r0, #0
ldr r0, _0803BC78 @ =gUnk_080CFF6C
ldrb r1, [r4, #0xd]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
adds r0, r4, #0
bl GetNextFrame
adds r0, r4, #0
bl sub_0806F520
cmp r0, #0
bne _0803BC74
movs r1, #2
strb r1, [r4, #0xc]
strb r0, [r4, #0xd]
adds r0, r4, #0
adds r0, #0x84
strb r1, [r0]
movs r0, #8
strb r0, [r4, #0xe]
movs r0, #0xe0
lsls r0, r0, #1
strh r0, [r4, #0x24]
adds r0, r4, #0
bl sub_0803BF2C
_0803BC74:
pop {r4, pc}
.align 2, 0
_0803BC78: .4byte gUnk_080CFF6C
thumb_func_start sub_0803BC7C
sub_0803BC7C: @ 0x0803BC7C
movs r1, #1
strb r1, [r0, #0xd]
movs r1, #0x3c
strb r1, [r0, #0x1d]
bx lr
.align 2, 0
thumb_func_start sub_0803BC88
sub_0803BC88: @ 0x0803BC88
push {lr}
bl sub_0806F4E8
pop {pc}
thumb_func_start sub_0803BC90
sub_0803BC90: @ 0x0803BC90
push {r4, lr}
adds r4, r0, #0
bl sub_0806F3E4
cmp r0, #0
beq _0803BCA2
adds r0, r4, #0
bl sub_0804A7D4
_0803BCA2:
pop {r4, pc}
thumb_func_start sub_0803BCA4
sub_0803BCA4: @ 0x0803BCA4
push {r4, r5, r6, lr}
adds r6, r0, #0
bl sub_0804A720
movs r4, #0
movs r5, #1
strb r5, [r6, #0xc]
strb r4, [r6, #0xf]
adds r0, r6, #0
movs r1, #1
bl sub_08049F84
strb r0, [r6, #0x15]
adds r0, r6, #0
adds r0, #0x80
strb r4, [r0]
adds r0, #1
strb r4, [r0]
strb r5, [r6, #0x1c]
adds r2, r6, #0
adds r2, #0x3c
ldrb r1, [r2]
movs r0, #0x10
orrs r0, r1
strb r0, [r2]
adds r1, r6, #0
adds r1, #0x38
movs r0, #3
strb r0, [r1]
ldrb r1, [r6, #0x1b]
movs r0, #0x3f
ands r0, r1
movs r1, #0x40
orrs r0, r1
strb r0, [r6, #0x1b]
ldrh r1, [r6, #0x2e]
adds r0, r6, #0
adds r0, #0x78
strh r1, [r0]
ldrh r0, [r6, #0x32]
adds r1, r6, #0
adds r1, #0x7a
strh r0, [r1]
adds r0, r6, #0
bl UpdateSpriteForCollisionLayer
adds r0, r6, #0
bl sub_0803BF2C
pop {r4, r5, r6, pc}
thumb_func_start sub_0803BD08
sub_0803BD08: @ 0x0803BD08
push {r4, r5, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xf]
cmp r0, #0
beq _0803BD2C
adds r0, r4, #0
bl CheckOnScreen
cmp r0, #0
bne _0803BD80
strb r0, [r4, #0xf]
ldrb r0, [r4, #0x18]
movs r1, #4
rsbs r1, r1, #0
ands r1, r0
movs r0, #1
orrs r1, r0
strb r1, [r4, #0x18]
_0803BD2C:
adds r0, r4, #0
bl sub_0803BEE8
adds r0, r4, #0
bl GetNextFrame
movs r0, #1
bl sub_08049DF4
cmp r0, #0
beq _0803BD80
ldr r5, _0803BD84 @ =gUnk_020000B0
ldr r1, [r5]
adds r0, r4, #0
movs r2, #0x88
movs r3, #0x50
bl EntityInRectRadius
cmp r0, #0
beq _0803BD80
ldr r0, [r5]
movs r2, #0x32
ldrsh r1, [r0, r2]
movs r2, #0x32
ldrsh r0, [r4, r2]
adds r0, #8
cmp r1, r0
ble _0803BD80
movs r1, #0
movs r2, #2
strb r2, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x84
strb r1, [r0]
movs r0, #0x10
strb r0, [r4, #0xe]
adds r0, r4, #0
adds r0, #0x81
strb r2, [r0]
adds r0, r4, #0
bl sub_0803BF2C
_0803BD80:
pop {r4, r5, pc}
.align 2, 0
_0803BD84: .4byte gUnk_020000B0
thumb_func_start sub_0803BD88
sub_0803BD88: @ 0x0803BD88
push {lr}
bl sub_0803BF70
pop {pc}
thumb_func_start sub_0803BD90
sub_0803BD90: @ 0x0803BD90
push {r4, lr}
adds r4, r0, #0
bl CheckOnScreen
cmp r0, #0
bne _0803BDC8
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 r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #8
orrs r0, r1
strb r0, [r2]
movs r0, #8
strb r0, [r4, #0xe]
b _0803BDD4
_0803BDC8:
adds r0, r4, #0
bl sub_0803BF48
adds r0, r4, #0
bl GetNextFrame
_0803BDD4:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0803BDD8
sub_0803BDD8: @ 0x0803BDD8
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 _0803BE76
adds r0, r4, #0
movs r1, #1
bl sub_08049FDC
cmp r0, #0
beq _0803BDFE
adds r0, r4, #0
bl sub_08049FA0
cmp r0, #0
bne _0803BE06
_0803BDFE:
adds r0, r4, #0
bl sub_0803C120
b _0803BE70
_0803BE06:
ldrb r1, [r4, #0x15]
movs r0, #0x10
ands r0, r1
cmp r0, #0
beq _0803BE20
movs r0, #8
strb r0, [r4, #0x15]
ldr r1, _0803BE1C @ =gRoomControls
ldrh r0, [r1, #0xa]
subs r0, #0x20
b _0803BE30
.align 2, 0
_0803BE1C: .4byte gRoomControls
_0803BE20:
movs r0, #0x18
strb r0, [r4, #0x15]
ldr r1, _0803BE78 @ =gRoomControls
movs r2, #0x88
lsls r2, r2, #1
adds r0, r2, #0
ldrh r2, [r1, #0xa]
adds r0, r0, r2
_0803BE30:
strh r0, [r4, #0x2e]
ldrh r0, [r1, #0xc]
adds r0, #8
strh r0, [r4, #0x32]
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r4, #0x18]
ldrb r1, [r4, #0x10]
movs r0, #0x80
orrs r0, r1
strb r0, [r4, #0x10]
movs r0, #2
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x84
movs r0, #1
strb r0, [r1]
movs r0, #0x18
strb r0, [r4, #0xe]
subs r1, #2
movs r0, #0x96
lsls r0, r0, #1
strh r0, [r1]
adds r0, #0x94
strh r0, [r4, #0x24]
subs r1, #1
movs r0, #4
strb r0, [r1]
_0803BE70:
adds r0, r4, #0
bl sub_0803BF2C
_0803BE76:
pop {r4, pc}
.align 2, 0
_0803BE78: .4byte gRoomControls
thumb_func_start sub_0803BE7C
sub_0803BE7C: @ 0x0803BE7C
push {r4, r5, lr}
adds r4, r0, #0
bl CheckOnScreen
adds r5, r0, #0
cmp r5, #0
bne _0803BEE6
movs r2, #1
movs r3, #1
strb r3, [r4, #0xc]
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
ldrb r1, [r4, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r4, #0x10]
movs r0, #8
strb r0, [r4, #0xe]
strb r3, [r4, #0xf]
adds r0, r4, #0
movs r1, #1
bl sub_08049F84
strb r0, [r4, #0x15]
adds r0, r4, #0
adds r0, #0x80
strb r5, [r0]
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #0x18
orrs r0, r1
strb r0, [r2]
adds r0, r4, #0
adds r0, #0x81
strb r5, [r0]
adds r1, r4, #0
adds r1, #0x38
movs r0, #3
strb r0, [r1]
adds r0, r4, #0
bl UpdateSpriteForCollisionLayer
adds r0, r4, #0
bl sub_0803BF2C
_0803BEE6:
pop {r4, r5, pc}
thumb_func_start sub_0803BEE8
sub_0803BEE8: @ 0x0803BEE8
push {r4, r5, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0803BF28
ldrb r0, [r4, #0x15]
adds r5, r4, #0
adds r5, #0x80
strb r0, [r5]
adds r0, r4, #0
movs r1, #1
bl sub_08049F84
cmp r0, #0xff
beq _0803BF0E
strb r0, [r4, #0x15]
_0803BF0E:
movs r0, #8
strb r0, [r4, #0xe]
ldrb r2, [r5]
movs r0, #0x10
adds r1, r0, #0
ands r1, r2
ldrb r2, [r4, #0x15]
ands r0, r2
cmp r1, r0
beq _0803BF28
adds r0, r4, #0
bl sub_0803BF2C
_0803BF28:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_0803BF2C
sub_0803BF2C: @ 0x0803BF2C
push {lr}
ldrb r2, [r0, #0x15]
movs r1, #0x10
ands r1, r2
lsls r1, r1, #0x18
lsrs r1, r1, #0x1c
adds r2, r0, #0
adds r2, #0x81
ldrb r2, [r2]
adds r1, r1, r2
bl InitializeAnimation
pop {pc}
.align 2, 0
thumb_func_start sub_0803BF48
sub_0803BF48: @ 0x0803BF48
push {r4, lr}
adds r4, r0, #0
bl LinearMoveUpdate
adds r1, r4, #0
adds r1, #0x38
movs r0, #3
strb r0, [r1]
ldrb r2, [r4, #0x1b]
movs r1, #0x3f
adds r0, r1, #0
ands r0, r2
movs r2, #0x40
orrs r0, r2
strb r0, [r4, #0x1b]
ldrb r0, [r4, #0x19]
ands r1, r0
orrs r1, r2
strb r1, [r4, #0x19]
pop {r4, pc}
thumb_func_start sub_0803BF70
sub_0803BF70: @ 0x0803BF70
push {r4, r5, r6, lr}
adds r5, r0, #0
adds r2, r5, #0
adds r2, #0x84
ldrb r0, [r2]
cmp r0, #1
beq _0803BFC0
cmp r0, #1
bgt _0803BF88
cmp r0, #0
beq _0803BF8E
b _0803C0A2
_0803BF88:
cmp r0, #2
beq _0803BFEA
b _0803C0A2
_0803BF8E:
ldrb r1, [r5, #0xe]
movs r3, #1
adds r0, r3, #0
ands r0, r1
cmp r0, #0
beq _0803BFA0
ldrh r0, [r5, #0x36]
subs r0, #1
strh r0, [r5, #0x36]
_0803BFA0:
subs r0, r1, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0803C0A2
strb r3, [r2]
movs r0, #0x18
strb r0, [r5, #0xe]
ldrb r0, [r5, #0x10]
movs r1, #0x80
orrs r0, r1
strb r0, [r5, #0x10]
adds r1, r5, #0
adds r1, #0x81
movs r0, #2
b _0803BFE0
_0803BFC0:
ldrb r0, [r5, #0xe]
subs r0, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0803C0A2
movs r0, #2
strb r0, [r2]
movs r0, #8
strb r0, [r5, #0xe]
movs r0, #0xe0
lsls r0, r0, #1
strh r0, [r5, #0x24]
adds r1, r5, #0
adds r1, #0x81
movs r0, #4
_0803BFE0:
strb r0, [r1]
adds r0, r5, #0
bl sub_0803BF2C
b _0803C0A2
_0803BFEA:
adds r1, r5, #0
adds r1, #0x82
ldrh r0, [r1]
subs r0, #1
movs r3, #0
strh r0, [r1]
lsls r0, r0, #0x10
adds r6, r1, #0
cmp r0, #0
bne _0803C02C
movs r0, #3
strb r0, [r5, #0xc]
strb r3, [r2]
strb r3, [r5, #0xe]
movs r0, #0xc0
lsls r0, r0, #1
strh r0, [r5, #0x24]
ldrb r2, [r5, #0x15]
adds r0, r2, #0
adds r0, #0x18
movs r1, #0x10
ands r0, r1
cmp r0, #0
beq _0803C024
movs r0, #0x10
subs r0, r0, r2
movs r1, #0x1f
ands r0, r1
strb r0, [r5, #0x15]
_0803C024:
adds r0, r5, #0
bl sub_0803BF2C
b _0803C09C
_0803C02C:
ldrb r0, [r5, #0xe]
subs r0, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0803C09C
movs r0, #8
strb r0, [r5, #0xe]
ldrb r0, [r5, #0x15]
adds r4, r5, #0
adds r4, #0x80
strb r0, [r4]
adds r0, r5, #0
movs r1, #1
bl sub_08049F84
adds r1, r0, #0
adds r0, r5, #0
bl sub_08004596
ldrb r3, [r5, #0x15]
adds r0, r3, #0
adds r0, #0x18
movs r1, #0x10
ands r0, r1
cmp r0, #0
beq _0803C07E
ldrb r0, [r4]
cmp r0, #0x10
bne _0803C076
ands r3, r0
cmp r3, #0
beq _0803C072
movs r0, #0x12
b _0803C074
_0803C072:
movs r0, #0xe
_0803C074:
strb r0, [r4]
_0803C076:
ldrb r0, [r4]
strb r0, [r5, #0x15]
movs r0, #1
strh r0, [r6]
_0803C07E:
ldrb r2, [r4]
movs r0, #0x10
adds r1, r0, #0
ands r1, r2
lsls r1, r1, #0x18
ldrb r2, [r5, #0x15]
ands r0, r2
lsls r0, r0, #0x18
lsrs r2, r0, #0x1c
cmp r1, r0
beq _0803C09C
adds r1, r2, #4
adds r0, r5, #0
bl InitializeAnimation
_0803C09C:
adds r0, r5, #0
bl sub_0803BF48
_0803C0A2:
adds r0, r5, #0
bl GetNextFrame
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_0803C0AC
sub_0803C0AC: @ 0x0803C0AC
push {r4, r5, r6, lr}
movs r0, #1
bl sub_08049DF4
adds r5, r0, #0
cmp r5, #0
beq _0803C11C
ldr r0, _0803C0D4 @ =gSave
adds r0, #0xc0
ldrh r1, [r0]
ldr r0, _0803C0D8 @ =0x000001F3
cmp r1, r0
bls _0803C0DC
movs r6, #0x56
movs r4, #5
movs r0, #0x64
rsbs r0, r0, #0
bl ModRupees
b _0803C118
.align 2, 0
_0803C0D4: .4byte gSave
_0803C0D8: .4byte 0x000001F3
_0803C0DC:
cmp r1, #0x63
bls _0803C0EE
movs r6, #0x55
movs r4, #5
movs r0, #0x19
rsbs r0, r0, #0
bl ModRupees
b _0803C118
_0803C0EE:
movs r6, #0x54
adds r4, r1, #0
cmp r4, #4
bls _0803C0F8
movs r4, #5
_0803C0F8:
rsbs r0, r4, #0
bl ModRupees
b _0803C118
_0803C100:
movs r0, #0x1a
adds r1, r6, #0
movs r2, #0
bl CreateObject
adds r1, r0, #0
cmp r1, #0
beq _0803C116
adds r0, r5, #0
bl CopyPosition
_0803C116:
subs r4, #1
_0803C118:
cmp r4, #0
bne _0803C100
_0803C11C:
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_0803C120
sub_0803C120: @ 0x0803C120
adds r2, r0, #0
movs r0, #5
strb r0, [r2, #0xc]
ldrb r1, [r2, #0x18]
subs r0, #9
ands r0, r1
strb r0, [r2, #0x18]
ldrb r1, [r2, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r2, #0x10]
adds r0, r2, #0
adds r0, #0x78
ldrh r0, [r0]
strh r0, [r2, #0x2e]
adds r0, r2, #0
adds r0, #0x7a
ldrh r0, [r0]
strh r0, [r2, #0x32]
ldrh r0, [r2, #0x36]
adds r0, #8
strh r0, [r2, #0x36]
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #0x18
orrs r0, r1
strb r0, [r2]
bx lr
.align 2, 0

View File

@ -1,26 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CFF3C:: @ 080CFF3C
.4byte sub_0803BB98
.4byte sub_0803BBB0
.4byte sub_08001324
.4byte sub_0804A7D4
.4byte sub_08001242
.4byte sub_0803BC34
gUnk_080CFF54:: @ 080CFF54
.4byte sub_0803BCA4
.4byte sub_0803BD08
.4byte sub_0803BD88
.4byte sub_0803BD90
.4byte sub_0803BDD8
.4byte sub_0803BE7C
gUnk_080CFF6C:: @ 080CFF6C
.4byte sub_0803BC7C
.4byte sub_0803BC88
.4byte sub_0803BC90

View File

@ -1,10 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081206C4:: @ 081206C4
.4byte sub_080869DC
.4byte sub_08086A28
.4byte sub_08086A5C

View File

@ -6,17 +6,17 @@
#include "save.h" #include "save.h"
typedef struct { typedef struct {
u8 unk_0x0; /*0x00*/ u8 unk_0x0;
u8 filler0[0x4]; /*0x02*/ u8 filler0[0x4];
u8 state; /*0x06*/ u8 state;
u8 subState; /*0x07*/ u8 subState;
u16 timer; /*0x08*/ u16 timer;
u8 fillerA[0x5]; /*0x0a*/ u8 fillerA[0x5];
s16 unk_0x10; /*0x10*/ s16 unk_0x10;
u16 unk_0x12; /*0x12*/ u16 unk_0x12;
u8 fillerB[0xC]; /*0x14*/ u8 fillerB[0xC];
u8 unk_0x20; /*0x20*/ u8 unk_0x20;
u8 fillerC[0xF]; /*0x21*/ u8 fillerC[0xF];
} ChooseFileState; } ChooseFileState;
static_assert(sizeof(ChooseFileState) == 0x30); static_assert(sizeof(ChooseFileState) == 0x30);

View File

@ -56,7 +56,7 @@ typedef enum {
OBJECT_17, OBJECT_17,
EVIL_SPIRIT, EVIL_SPIRIT,
HOUSE_DOOR_EXT, HOUSE_DOOR_EXT,
OBJECT_1A, RUPEE_OBJECT,
GREAT_FAIRY, GREAT_FAIRY,
OBJECT_1C, OBJECT_1C,
OBJECT_1D, OBJECT_1D,
@ -252,7 +252,7 @@ void FloatingPlatform(Entity*);
void Object17(Entity*); void Object17(Entity*);
void EvilSpirit(Entity*); void EvilSpirit(Entity*);
void HouseDoorExterior(Entity*); void HouseDoorExterior(Entity*);
void Object1A(Entity*); void Rupee(Entity*);
void GreatFairy(Entity*); void GreatFairy(Entity*);
void Object1C(Entity*); void Object1C(Entity*);
void Object1D(Entity*); void Object1D(Entity*);

View File

@ -390,7 +390,7 @@ SECTIONS {
asm/enemy/stalfos.o(.text); asm/enemy/stalfos.o(.text);
src/enemy/flyingSkull.o(.text); src/enemy/flyingSkull.o(.text);
src/enemy/mazaalBracelet.o(.text); src/enemy/mazaalBracelet.o(.text);
asm/enemy/takkuri.o(.text); src/enemy/takkuri.o(.text);
src/enemy/bowMoblin.o(.text); src/enemy/bowMoblin.o(.text);
src/enemy/lakitu.o(.text); src/enemy/lakitu.o(.text);
src/enemy/lakituCloud.o(.text); src/enemy/lakituCloud.o(.text);
@ -669,7 +669,7 @@ SECTIONS {
asm/object/object17.o(.text); asm/object/object17.o(.text);
asm/object/evilSpirit.o(.text); asm/object/evilSpirit.o(.text);
src/object/houseDoorExterior.o(.text); src/object/houseDoorExterior.o(.text);
src/object/object1A.o(.text); src/object/rupee.o(.text);
src/object/greatFairy.o(.text); src/object/greatFairy.o(.text);
src/object/object1C.o(.text); src/object/object1C.o(.text);
src/object/object1D.o(.text); src/object/object1D.o(.text);
@ -1063,7 +1063,7 @@ SECTIONS {
data/animations/enemy/flyingSkull.o(.rodata); data/animations/enemy/flyingSkull.o(.rodata);
src/enemy/mazaalBracelet.o(.rodata); src/enemy/mazaalBracelet.o(.rodata);
data/animations/enemy/mazaalBracelet.o(.rodata); data/animations/enemy/mazaalBracelet.o(.rodata);
data/const/enemy/takkuri.o(.rodata); src/enemy/takkuri.o(.rodata);
src/enemy/bowMoblin.o(.rodata); src/enemy/bowMoblin.o(.rodata);
data/animations/enemy/bowMoblin.o(.rodata); data/animations/enemy/bowMoblin.o(.rodata);
src/enemy/lakitu.o(.rodata); src/enemy/lakitu.o(.rodata);
@ -1384,7 +1384,7 @@ SECTIONS {
data/const/object/evilSpirit.o(.rodata); data/const/object/evilSpirit.o(.rodata);
data/animations/object/evilSpirit.o(.rodata); data/animations/object/evilSpirit.o(.rodata);
data/const/object/houseDoorExterior.o(.rodata); data/const/object/houseDoorExterior.o(.rodata);
data/const/object/object1A.o(.rodata); src/object/rupee.o(.rodata);
src/object/greatFairy.o(.rodata); src/object/greatFairy.o(.rodata);
data/animations/npc/greatFairy.o(.rodata); data/animations/npc/greatFairy.o(.rodata);
data/const/object/object1D.o(.rodata); data/const/object/object1D.o(.rodata);

364
src/enemy/takkuri.c Normal file
View File

@ -0,0 +1,364 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "enemy.h"
#include "save.h"
#include "object.h"
#include "item.h"
typedef struct {
Entity base;
u8 filler[0x10];
u16 x_0x78;
u16 y_0x7a;
u8 filler2[0x4];
u8 unk_0x80;
u8 unk_0x81;
u16 unk_0x82;
u8 unk_0x84;
} TakkuriEntity;
static_assert(sizeof(TakkuriEntity) == 0x88);
extern void sub_0803C0AC(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
void (*const gUnk_080CFF3C[])(Entity*);
void (*const gUnk_080CFF54[])(TakkuriEntity*);
void (*const gUnk_080CFF6C[])(TakkuriEntity*);
void sub_0803BF2C(TakkuriEntity*);
void sub_0803BEE8(TakkuriEntity* this);
void sub_0803BF70(TakkuriEntity* this);
void sub_0803BF48(TakkuriEntity* this);
void sub_0803C120(TakkuriEntity* this);
void Takkuri(Entity* this) {
gUnk_080CFF3C[GetNextFunction(this)](this);
}
void sub_0803BB98(TakkuriEntity* this) {
gUnk_080CFF54[super->action](this);
}
void sub_0803BBB0(TakkuriEntity* this) {
if (super->bitfield & 0x80) {
if ((super->bitfield & 0x7f) == 0) {
u32 direction;
sub_0803C0AC(super);
COLLISION_OFF(super);
direction = super->direction;
if (!DirectionIsHorizontal(DirectionRoundUp(direction))) {
if (DirectionIsVertical(direction)) {
super->direction += 2;
} else {
super->direction -= 2;
}
}
super->direction = 0x20 - super->direction;
sub_0803BF2C(this);
} else {
if (((u8)super->iframes & 0x80) == 0) {
super->health = 0;
}
}
if (this->unk_0x82 >= 0x11) {
this->unk_0x82 -= 0xc;
}
}
GetNextFrame(super);
}
void sub_0803BC34(TakkuriEntity* this) {
gUnk_080CFF6C[super->subAction](this);
GetNextFrame(super);
if (sub_0806F520(super) == 0) {
super->action = 2;
super->subAction = 0;
this->unk_0x84 = 2;
super->actionDelay = 8;
super->speed = 0x1c0;
sub_0803BF2C(this);
}
}
void sub_0803BC7C(TakkuriEntity* this) {
super->subAction = 1;
super->field_0x1d = 0x3c;
}
void sub_0803BC88(TakkuriEntity* this) {
sub_0806F4E8(super);
}
void sub_0803BC90(TakkuriEntity* this) {
if (sub_0806F3E4(super)) {
sub_0804A7D4(super);
}
}
void sub_0803BCA4(TakkuriEntity* this) {
sub_0804A720(super);
super->action = 1;
super->field_0xf = 0;
super->direction = sub_08049F84(super, 1);
this->unk_0x80 = 0;
this->unk_0x81 = 0;
super->field_0x1c = 1;
super->field_0x3c |= 0x10;
super->collisionLayer = 3;
super->spriteOrientation.flipY = 1;
this->x_0x78 = super->x.HALF.HI;
this->y_0x7a = super->y.HALF.HI;
UpdateSpriteForCollisionLayer(super);
sub_0803BF2C(this);
}
void sub_0803BD08(TakkuriEntity* this) {
Entity* ent;
if (super->field_0xf) {
if (CheckOnScreen(super) == 0) {
super->field_0xf = 0;
super->spriteSettings.draw = 1;
} else {
return;
}
}
sub_0803BEE8(this);
GetNextFrame(super);
ent = sub_08049DF4(1);
if (ent) {
if (EntityInRectRadius(super, gUnk_020000B0, 0x88, 0x50)) {
if (gUnk_020000B0->y.HALF.HI > super->y.HALF.HI + 8) {
super->action = 2;
this->unk_0x84 = 0;
super->actionDelay = 0x10;
this->unk_0x81 = 2;
sub_0803BF2C(this);
}
}
}
}
void sub_0803BD88(TakkuriEntity* this) {
sub_0803BF70(this);
}
void sub_0803BD90(TakkuriEntity* this) {
if (CheckOnScreen(super) == 0) {
super->action = 4;
super->spriteSettings.draw = 4;
COLLISION_OFF(super);
super->spritePriority.b1 = 1;
super->actionDelay = 8;
} else {
sub_0803BF48(this);
GetNextFrame(super);
}
}
void sub_0803BDD8(TakkuriEntity* this) {
if (--super->actionDelay) {
return;
}
if (sub_08049FDC(super, 1) == 0 || sub_08049FA0(super) == 0) {
sub_0803C120(this);
} else {
if (super->direction & 0x10) {
super->direction = 0x8;
super->x.HALF.HI = gRoomControls.scroll_x - 0x20;
} else {
super->direction = 0x18;
super->x.HALF.HI = gRoomControls.scroll_x + 0x110;
}
super->y.HALF.HI = gRoomControls.scroll_y + 8;
super->spriteSettings.draw = 1;
COLLISION_ON(super);
super->action = 2;
this->unk_0x84 = 1;
super->actionDelay = 0x18;
this->unk_0x82 = 0x12c;
super->speed = 0x12c + 0x94;
this->unk_0x81 = 4;
}
sub_0803BF2C(this);
}
void sub_0803BE7C(TakkuriEntity* this) {
if (CheckOnScreen(super))
return;
super->action = 1;
super->spriteSettings.draw = 1;
COLLISION_OFF(super);
super->actionDelay = 0x8;
super->field_0xf = 1;
super->direction = sub_08049F84(super, 1);
this->unk_0x80 = 0;
super->spritePriority.b1 = 3;
this->unk_0x81 = 0;
super->collisionLayer = 3;
UpdateSpriteForCollisionLayer(super);
sub_0803BF2C(this);
}
void sub_0803BEE8(TakkuriEntity* this) {
if (--super->actionDelay == 0) {
u32 direction;
this->unk_0x80 = super->direction;
direction = sub_08049F84(super, 1);
if (direction != 0xff) {
super->direction = direction;
}
super->actionDelay = 8;
if (DirectionIsVertical(this->unk_0x80) != DirectionIsVertical(super->direction)) {
sub_0803BF2C(this);
}
}
}
void sub_0803BF2C(TakkuriEntity* this) {
InitializeAnimation(super, ((super->direction & 0x10) >> 4) + this->unk_0x81);
}
void sub_0803BF48(TakkuriEntity* this) {
LinearMoveUpdate(super);
super->collisionLayer = 3;
super->spriteOrientation.flipY = 1;
super->spriteRendering.b3 = 1;
}
void sub_0803BF70(TakkuriEntity* this) {
u32 tmp1, tmp2, tmp3;
switch (this->unk_0x84) {
case 0:
if (super->actionDelay & 0x1) {
super->z.HALF.HI--;
}
if (--super->actionDelay == 0) {
this->unk_0x84 = 1;
super->actionDelay = 0x18;
COLLISION_ON(super);
this->unk_0x81 = 2;
sub_0803BF2C(this);
}
break;
case 1:
if (--super->actionDelay == 0) {
this->unk_0x84 = 2;
super->actionDelay = 8;
super->speed = 0x1c0;
this->unk_0x81 = 4;
sub_0803BF2C(this);
}
break;
case 2:
if (--this->unk_0x82 == 0) {
super->action = 3;
this->unk_0x84 = 0;
super->actionDelay = 0;
super->speed = 0x180;
if ((super->direction + 0x18) & 0x10) {
super->direction = (0x10 - super->direction) & 0x1f;
}
sub_0803BF2C(this);
} else {
if (--super->actionDelay == 0) {
super->actionDelay = 8;
this->unk_0x80 = super->direction;
sub_08004596(super, sub_08049F84(super, 1));
if ((super->direction + 0x18) & 0x10) {
if (this->unk_0x80 == 0x10) {
if (this->unk_0x80 & super->direction) {
this->unk_0x80 = 0x12;
} else {
this->unk_0x80 = 0xe;
}
}
super->direction = this->unk_0x80;
this->unk_0x82 = 1;
}
if ((((u32)this->unk_0x80 & 0x10)) >> 4 != ((((u32)super->direction) & 0x10)) >> 4) {
InitializeAnimation(super, (((u32)super->direction & 0x10) >> 4) + 4);
}
}
}
sub_0803BF48(this);
break;
}
GetNextFrame(super);
}
void sub_0803C0AC(Entity* this) {
u32 index, rupeeType, rupees;
Entity* ent;
ent = sub_08049DF4(1);
if (!ent)
return;
rupees = gSave.stats.rupees;
if (rupees >= 500) {
rupeeType = ITEM_RUPEE20;
index = 5;
ModRupees(-100);
} else if (rupees >= 100) {
rupeeType = ITEM_RUPEE5;
index = 5;
ModRupees(-25);
} else {
rupeeType = ITEM_RUPEE1;
index = rupees;
if (rupees >= 0x5) {
index = 5;
}
ModRupees(-index);
}
for (; index != 0; index--) {
Entity* obj = CreateObject(RUPEE_OBJECT, rupeeType, 0);
if (obj) {
CopyPosition(ent, obj);
}
}
}
void sub_0803C120(TakkuriEntity* this) {
super->action = 5;
super->spriteSettings.draw = 0;
super->flags &= 0x7f;
super->x.HALF.HI = this->x_0x78;
super->y.HALF.HI = this->y_0x7a;
super->z.HALF.HI += 8;
super->spritePriority.b1 = 3;
}
void (*const gUnk_080CFF3C[])(Entity*) = {
(EntityActionPtr)sub_0803BB98, (EntityActionPtr)sub_0803BBB0, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)sub_0803BC34,
};
void (*const gUnk_080CFF54[])(TakkuriEntity*) = {
sub_0803BCA4, sub_0803BD08, sub_0803BD88, sub_0803BD90, sub_0803BDD8, sub_0803BE7C,
};
void (*const gUnk_080CFF6C[])(TakkuriEntity*) = {
sub_0803BC7C,
sub_0803BC88,
sub_0803BC90,
};

View File

@ -28,7 +28,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[OBJECT_17] = Object17, [OBJECT_17] = Object17,
[EVIL_SPIRIT] = EvilSpirit, [EVIL_SPIRIT] = EvilSpirit,
[HOUSE_DOOR_EXT] = HouseDoorExterior, [HOUSE_DOOR_EXT] = HouseDoorExterior,
[OBJECT_1A] = Object1A, [RUPEE_OBJECT] = Rupee,
[GREAT_FAIRY] = GreatFairy, [GREAT_FAIRY] = GreatFairy,
[OBJECT_1C] = Object1C, [OBJECT_1C] = Object1C,
[OBJECT_1D] = Object1D, [OBJECT_1D] = Object1D,

View File

@ -1,14 +1,14 @@
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_08086A6C(Entity*); void sub_08086A6C(Entity*);
extern void (*gUnk_081206C4[99])(Entity*); void (*const gUnk_081206C4[])(Entity*);
extern Hitbox gUnk_080FD1A8; extern Hitbox gUnk_080FD1A8;
// Main // Main
void Object1A(Entity* ent) { void Rupee(Entity* ent) {
gUnk_081206C4[ent->action](ent); gUnk_081206C4[ent->action](ent);
} }
@ -55,3 +55,9 @@ void sub_08086A6C(Entity* ent) {
ent->direction = DirectionNormalize(uVar1 >> 16); ent->direction = DirectionNormalize(uVar1 >> 16);
ent->speed = uVar1 & 480; ent->speed = uVar1 & 480;
} }
void (*const gUnk_081206C4[])(Entity*) = {
sub_080869DC,
sub_08086A28,
sub_08086A5C,
};