mirror of https://github.com/zeldaret/tmc.git
book.c OK
This commit is contained in:
parent
c065fe8938
commit
723c063ee0
450
asm/book.s
450
asm/book.s
|
@ -1,450 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
|
|
||||||
thumb_func_start Book
|
|
||||||
Book: @ 0x0809B3AC
|
|
||||||
push {lr}
|
|
||||||
ldr r2, _0809B3C0 @ =gUnk_08123D7C
|
|
||||||
ldrb r1, [r0, #0xc]
|
|
||||||
lsls r1, r1, #2
|
|
||||||
adds r1, r1, r2
|
|
||||||
ldr r1, [r1]
|
|
||||||
bl _call_via_r1
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0809B3C0: .4byte gUnk_08123D7C
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B3C4
|
|
||||||
sub_0809B3C4: @ 0x0809B3C4
|
|
||||||
push {r4, r5, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
adds r0, #0x39
|
|
||||||
bl GetInventoryValue
|
|
||||||
adds r5, r0, #0
|
|
||||||
ldrb r0, [r4, #0xb]
|
|
||||||
cmp r0, #3
|
|
||||||
beq _0809B3E2
|
|
||||||
cmp r5, #0
|
|
||||||
beq _0809B3FE
|
|
||||||
bl DeleteThisEntity
|
|
||||||
b _0809B3FE
|
|
||||||
_0809B3E2:
|
|
||||||
movs r0, #0x73
|
|
||||||
bl CheckLocalFlag
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B3F0
|
|
||||||
bl DeleteThisEntity
|
|
||||||
_0809B3F0:
|
|
||||||
cmp r5, #2
|
|
||||||
beq _0809B3FE
|
|
||||||
ldrb r1, [r4, #0x18]
|
|
||||||
movs r0, #4
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0x18]
|
|
||||||
_0809B3FE:
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r1, #0x63
|
|
||||||
movs r0, #3
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x86
|
|
||||||
ldrh r0, [r0]
|
|
||||||
bl CheckFlags
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B424
|
|
||||||
ldrb r0, [r4, #0xb]
|
|
||||||
cmp r0, #0
|
|
||||||
bne _0809B420
|
|
||||||
ldrh r0, [r4, #0x32]
|
|
||||||
adds r0, #0x30
|
|
||||||
strh r0, [r4, #0x32]
|
|
||||||
_0809B420:
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r4, #0xb]
|
|
||||||
_0809B424:
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl UpdateSpriteForCollisionLayer
|
|
||||||
ldrb r1, [r4, #0xa]
|
|
||||||
adds r1, #0x39
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl InitAnimationForceUpdate
|
|
||||||
ldrb r1, [r4, #0xb]
|
|
||||||
cmp r1, #1
|
|
||||||
beq _0809B46C
|
|
||||||
cmp r1, #1
|
|
||||||
bgt _0809B444
|
|
||||||
cmp r1, #0
|
|
||||||
beq _0809B44E
|
|
||||||
b _0809B4A6
|
|
||||||
_0809B444:
|
|
||||||
cmp r1, #2
|
|
||||||
beq _0809B488
|
|
||||||
cmp r1, #3
|
|
||||||
beq _0809B48E
|
|
||||||
b _0809B4A6
|
|
||||||
_0809B44E:
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
movs r0, #0x16
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r4, #0xf]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x80
|
|
||||||
strb r1, [r0]
|
|
||||||
adds r2, r4, #0
|
|
||||||
adds r2, #0x29
|
|
||||||
ldrb r1, [r2]
|
|
||||||
movs r0, #8
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
b _0809B49E
|
|
||||||
_0809B46C:
|
|
||||||
movs r0, #3
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldr r0, _0809B484 @ =gRoomControls
|
|
||||||
ldrh r0, [r0, #0xc]
|
|
||||||
subs r0, #0x10
|
|
||||||
ldrh r1, [r4, #0x32]
|
|
||||||
subs r1, r1, r0
|
|
||||||
ldrh r0, [r4, #0x36]
|
|
||||||
subs r0, r0, r1
|
|
||||||
strh r0, [r4, #0x36]
|
|
||||||
b _0809B4A6
|
|
||||||
.align 2, 0
|
|
||||||
_0809B484: .4byte gRoomControls
|
|
||||||
_0809B488:
|
|
||||||
movs r0, #4
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
b _0809B4A6
|
|
||||||
_0809B48E:
|
|
||||||
movs r1, #0
|
|
||||||
movs r0, #5
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
strb r1, [r4, #0xd]
|
|
||||||
adds r2, r4, #0
|
|
||||||
adds r2, #0x29
|
|
||||||
ldrb r1, [r2]
|
|
||||||
subs r0, #0xd
|
|
||||||
_0809B49E:
|
|
||||||
ands r0, r1
|
|
||||||
movs r1, #3
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r2]
|
|
||||||
_0809B4A6:
|
|
||||||
pop {r4, r5, pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B4A8
|
|
||||||
sub_0809B4A8: @ 0x0809B4A8
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
bl sub_0800445C
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r1, #0x80
|
|
||||||
ldrb r0, [r1]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B4C0
|
|
||||||
subs r0, #1
|
|
||||||
strb r0, [r1]
|
|
||||||
b _0809B520
|
|
||||||
_0809B4C0:
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl sub_0809B688
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B51C
|
|
||||||
ldrb r0, [r4, #0xe]
|
|
||||||
subs r0, #1
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
lsls r0, r0, #0x18
|
|
||||||
lsrs r3, r0, #0x18
|
|
||||||
cmp r3, #0
|
|
||||||
bne _0809B520
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
movs r0, #0x1e
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
movs r0, #0x40
|
|
||||||
strh r0, [r4, #0x24]
|
|
||||||
movs r0, #0x10
|
|
||||||
strb r0, [r4, #0x15]
|
|
||||||
ldr r2, _0809B510 @ =gPlayerState
|
|
||||||
movs r0, #0x9e
|
|
||||||
strb r0, [r2, #6]
|
|
||||||
movs r0, #5
|
|
||||||
strb r0, [r2, #0xc]
|
|
||||||
ldr r0, [r2, #0x30]
|
|
||||||
movs r1, #1
|
|
||||||
orrs r0, r1
|
|
||||||
str r0, [r2, #0x30]
|
|
||||||
ldr r1, _0809B514 @ =gPlayerEntity
|
|
||||||
strh r3, [r1, #0x2c]
|
|
||||||
strh r3, [r1, #0x30]
|
|
||||||
ldrb r0, [r1, #0x14]
|
|
||||||
lsls r0, r0, #2
|
|
||||||
strb r0, [r1, #0x15]
|
|
||||||
ldr r0, _0809B518 @ =0x0000010F
|
|
||||||
bl EnqueueSFX
|
|
||||||
b _0809B520
|
|
||||||
.align 2, 0
|
|
||||||
_0809B510: .4byte gPlayerState
|
|
||||||
_0809B514: .4byte gPlayerEntity
|
|
||||||
_0809B518: .4byte 0x0000010F
|
|
||||||
_0809B51C:
|
|
||||||
movs r0, #0x16
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
_0809B520:
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B524
|
|
||||||
sub_0809B524: @ 0x0809B524
|
|
||||||
push {lr}
|
|
||||||
adds r2, r0, #0
|
|
||||||
ldrb r0, [r2, #0xe]
|
|
||||||
subs r0, #1
|
|
||||||
strb r0, [r2, #0xe]
|
|
||||||
movs r1, #0xff
|
|
||||||
lsls r0, r0, #0x18
|
|
||||||
cmp r0, #0
|
|
||||||
bne _0809B564
|
|
||||||
ldrb r0, [r2, #0xf]
|
|
||||||
subs r0, #1
|
|
||||||
strb r0, [r2, #0xf]
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
bne _0809B554
|
|
||||||
movs r0, #3
|
|
||||||
strb r0, [r2, #0xc]
|
|
||||||
ldrh r0, [r2, #0x32]
|
|
||||||
adds r0, #0x20
|
|
||||||
strh r0, [r2, #0x32]
|
|
||||||
ldrh r0, [r2, #0x36]
|
|
||||||
subs r0, #0x20
|
|
||||||
strh r0, [r2, #0x36]
|
|
||||||
b _0809B564
|
|
||||||
_0809B554:
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r2, #0xc]
|
|
||||||
movs r0, #0x16
|
|
||||||
strb r0, [r2, #0xe]
|
|
||||||
adds r1, r2, #0
|
|
||||||
adds r1, #0x80
|
|
||||||
movs r0, #0x18
|
|
||||||
strb r0, [r1]
|
|
||||||
_0809B564:
|
|
||||||
adds r0, r2, #0
|
|
||||||
bl sub_0806F69C
|
|
||||||
pop {pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B56C
|
|
||||||
sub_0809B56C: @ 0x0809B56C
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
movs r1, #0xa0
|
|
||||||
lsls r1, r1, #6
|
|
||||||
bl sub_080044EC
|
|
||||||
cmp r0, #1
|
|
||||||
bne _0809B5B0
|
|
||||||
movs r2, #4
|
|
||||||
movs r0, #4
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
adds r3, r4, #0
|
|
||||||
adds r3, #0x29
|
|
||||||
ldrb r1, [r3]
|
|
||||||
subs r0, #0xc
|
|
||||||
ands r0, r1
|
|
||||||
orrs r0, r2
|
|
||||||
strb r0, [r3]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x86
|
|
||||||
ldrh r0, [r0]
|
|
||||||
bl SetFlag
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #2
|
|
||||||
movs r2, #0
|
|
||||||
bl CreateFx
|
|
||||||
adds r1, r0, #0
|
|
||||||
cmp r1, #0
|
|
||||||
beq _0809B5B0
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl ResolveEntityOnTop
|
|
||||||
_0809B5B0:
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B5B4
|
|
||||||
sub_0809B5B4: @ 0x0809B5B4
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldr r0, _0809B5CC @ =gPlayerState
|
|
||||||
ldr r0, [r0, #0x30]
|
|
||||||
movs r1, #0x80
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B5D0
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl sub_0800445C
|
|
||||||
b _0809B5EA
|
|
||||||
.align 2, 0
|
|
||||||
_0809B5CC: .4byte gPlayerState
|
|
||||||
_0809B5D0:
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl sub_08017850
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B5EA
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
adds r0, #0x39
|
|
||||||
movs r1, #0
|
|
||||||
movs r2, #0
|
|
||||||
bl CreateItemEntity
|
|
||||||
bl DeleteThisEntity
|
|
||||||
_0809B5EA:
|
|
||||||
pop {r4, pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B5EC
|
|
||||||
sub_0809B5EC: @ 0x0809B5EC
|
|
||||||
push {r4, r5, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r1, [r4, #0x18]
|
|
||||||
lsls r0, r1, #0x1e
|
|
||||||
lsrs r5, r0, #0x1e
|
|
||||||
cmp r5, #1
|
|
||||||
bne _0809B646
|
|
||||||
ldrb r0, [r4, #0xd]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B606
|
|
||||||
cmp r0, #1
|
|
||||||
beq _0809B630
|
|
||||||
b _0809B682
|
|
||||||
_0809B606:
|
|
||||||
movs r0, #7
|
|
||||||
movs r1, #0x1a
|
|
||||||
movs r2, #7
|
|
||||||
bl FindEntityByID
|
|
||||||
adds r2, r0, #0
|
|
||||||
cmp r2, #0
|
|
||||||
beq _0809B682
|
|
||||||
movs r0, #0x2e
|
|
||||||
ldrsh r1, [r2, r0]
|
|
||||||
movs r3, #0x2e
|
|
||||||
ldrsh r0, [r4, r3]
|
|
||||||
cmp r1, r0
|
|
||||||
blt _0809B682
|
|
||||||
ldrb r0, [r2, #0x14]
|
|
||||||
cmp r0, #4
|
|
||||||
bne _0809B682
|
|
||||||
str r2, [r4, #0x50]
|
|
||||||
strb r5, [r4, #0xd]
|
|
||||||
adds r0, r2, #0
|
|
||||||
b _0809B63E
|
|
||||||
_0809B630:
|
|
||||||
ldr r1, [r4, #0x50]
|
|
||||||
cmp r1, #0
|
|
||||||
beq _0809B650
|
|
||||||
ldr r0, [r1, #4]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B650
|
|
||||||
adds r0, r1, #0
|
|
||||||
_0809B63E:
|
|
||||||
adds r1, r4, #0
|
|
||||||
bl sub_0809B6B0
|
|
||||||
b _0809B682
|
|
||||||
_0809B646:
|
|
||||||
ldrb r0, [r4, #0xd]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0809B656
|
|
||||||
cmp r0, #1
|
|
||||||
beq _0809B668
|
|
||||||
_0809B650:
|
|
||||||
bl DeleteThisEntity
|
|
||||||
b _0809B682
|
|
||||||
_0809B656:
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
adds r0, #0x39
|
|
||||||
bl GetInventoryValue
|
|
||||||
cmp r0, #2
|
|
||||||
bne _0809B682
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r4, #0xd]
|
|
||||||
b _0809B682
|
|
||||||
_0809B668:
|
|
||||||
ldr r0, _0809B684 @ =gTextBox
|
|
||||||
ldrb r0, [r0]
|
|
||||||
movs r2, #0x7f
|
|
||||||
ands r2, r0
|
|
||||||
cmp r2, #0
|
|
||||||
bne _0809B682
|
|
||||||
movs r0, #4
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r1
|
|
||||||
movs r1, #1
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4, #0x18]
|
|
||||||
strb r2, [r4, #0xd]
|
|
||||||
_0809B682:
|
|
||||||
pop {r4, r5, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0809B684: .4byte gTextBox
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B688
|
|
||||||
sub_0809B688: @ 0x0809B688
|
|
||||||
push {lr}
|
|
||||||
ldr r1, _0809B6A8 @ =gPlayerEntity
|
|
||||||
movs r2, #6
|
|
||||||
movs r3, #0xc
|
|
||||||
bl sub_080041A0
|
|
||||||
adds r1, r0, #0
|
|
||||||
cmp r1, #1
|
|
||||||
bne _0809B6A4
|
|
||||||
ldr r0, _0809B6AC @ =gPlayerState
|
|
||||||
ldrb r0, [r0, #0xd]
|
|
||||||
cmp r0, #0x10
|
|
||||||
beq _0809B6A4
|
|
||||||
movs r1, #0
|
|
||||||
_0809B6A4:
|
|
||||||
adds r0, r1, #0
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0809B6A8: .4byte gPlayerEntity
|
|
||||||
_0809B6AC: .4byte gPlayerState
|
|
||||||
|
|
||||||
thumb_func_start sub_0809B6B0
|
|
||||||
sub_0809B6B0: @ 0x0809B6B0
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r1, #0
|
|
||||||
ldr r2, _0809B6EC @ =gUnk_08123D94
|
|
||||||
ldrb r1, [r0, #0x14]
|
|
||||||
lsrs r1, r1, #1
|
|
||||||
adds r1, r1, r2
|
|
||||||
movs r3, #0
|
|
||||||
ldrsb r3, [r1, r3]
|
|
||||||
lsls r3, r3, #0x10
|
|
||||||
adds r1, r4, #0
|
|
||||||
movs r2, #0
|
|
||||||
bl PositionRelative
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
lsls r0, r0, #2
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
strh r0, [r4, #0x36]
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
movs r1, #3
|
|
||||||
subs r1, r1, r0
|
|
||||||
adds r4, #0x29
|
|
||||||
movs r0, #7
|
|
||||||
ands r1, r0
|
|
||||||
ldrb r2, [r4]
|
|
||||||
movs r0, #8
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r2
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4]
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0809B6EC: .4byte gUnk_08123D94
|
|
|
@ -1,16 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.section .rodata
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
gUnk_08123D7C:: @ 08123D7C
|
|
||||||
.4byte sub_0809B3C4
|
|
||||||
.4byte sub_0809B4A8
|
|
||||||
.4byte sub_0809B524
|
|
||||||
.4byte sub_0809B56C
|
|
||||||
.4byte sub_0809B5B4
|
|
||||||
.4byte sub_0809B5EC
|
|
||||||
|
|
||||||
gUnk_08123D94:: @ 08123D94
|
|
||||||
.incbin "baserom.gba", 0x123D94, 0x0000004
|
|
|
@ -81,7 +81,7 @@ typedef struct Entity {
|
||||||
/* */ u8 b0 : 4;
|
/* */ u8 b0 : 4;
|
||||||
/* */ u8 b4 : 4;
|
/* */ u8 b4 : 4;
|
||||||
/* */ } PACKED b;
|
/* */ } PACKED b;
|
||||||
/* */} PACKED palette;
|
/* */ } PACKED palette;
|
||||||
/*0x1b*/ struct {
|
/*0x1b*/ struct {
|
||||||
/* */ u32 b0 : 1;
|
/* */ u32 b0 : 1;
|
||||||
/* */ u32 b1 : 5; //0x10
|
/* */ u32 b1 : 5; //0x10
|
||||||
|
|
|
@ -850,7 +850,7 @@ SECTIONS {
|
||||||
asm/object89.o(.text);
|
asm/object89.o(.text);
|
||||||
asm/object8A.o(.text);
|
asm/object8A.o(.text);
|
||||||
asm/object8B.o(.text);
|
asm/object8B.o(.text);
|
||||||
asm/book.o(.text);
|
src/object/book.o(.text);
|
||||||
asm/fireplace.o(.text);
|
asm/fireplace.o(.text);
|
||||||
asm/object8E.o(.text);
|
asm/object8E.o(.text);
|
||||||
asm/frozenWaterElement.o(.text);
|
asm/frozenWaterElement.o(.text);
|
||||||
|
@ -1129,7 +1129,8 @@ SECTIONS {
|
||||||
data/animations/enemy/mazaalBracelet.o(.rodata);
|
data/animations/enemy/mazaalBracelet.o(.rodata);
|
||||||
data/const/enemy/takkuri.o(.rodata);
|
data/const/enemy/takkuri.o(.rodata);
|
||||||
data/const/enemy/bowMoblin.o(.rodata);
|
data/const/enemy/bowMoblin.o(.rodata);
|
||||||
data/animations/enemy/bowMoblin.o(.rodata); src/enemy/lakitu.o(.rodata);
|
data/animations/enemy/bowMoblin.o(.rodata);
|
||||||
|
src/enemy/lakitu.o(.rodata);
|
||||||
data/animations/enemy/lakitu.o(.rodata);
|
data/animations/enemy/lakitu.o(.rodata);
|
||||||
src/enemy/lakituCloud.o(.rodata);
|
src/enemy/lakituCloud.o(.rodata);
|
||||||
data/const/enemy/enemy49.o(.rodata);
|
data/const/enemy/enemy49.o(.rodata);
|
||||||
|
@ -1591,7 +1592,7 @@ data/const/object/object1D.o(.rodata);
|
||||||
data/const/object/object89.o(.rodata);
|
data/const/object/object89.o(.rodata);
|
||||||
data/const/object/object8A.o(.rodata);
|
data/const/object/object8A.o(.rodata);
|
||||||
data/const/object/object8B.o(.rodata);
|
data/const/object/object8B.o(.rodata);
|
||||||
data/const/object/books.o(.rodata);
|
src/object/book.o(.rodata);
|
||||||
data/const/object/fireplace.o(.rodata);
|
data/const/object/fireplace.o(.rodata);
|
||||||
data/const/object/object8E.o(.rodata);
|
data/const/object/object8E.o(.rodata);
|
||||||
data/const/object/frozenWaterElement.o(.rodata);
|
data/const/object/frozenWaterElement.o(.rodata);
|
||||||
|
|
|
@ -0,0 +1,238 @@
|
||||||
|
#include "entity.h"
|
||||||
|
#include "functions.h"
|
||||||
|
#include "player.h"
|
||||||
|
#include "script.h"
|
||||||
|
#include "flags.h"
|
||||||
|
#include "room.h"
|
||||||
|
#include "textbox.h"
|
||||||
|
|
||||||
|
extern void (*const BookActionFuncs[])(Entity*);
|
||||||
|
extern s8 const gUnk_08123D94[];
|
||||||
|
|
||||||
|
u32 sub_0809B688(Entity*);
|
||||||
|
void sub_0809B6B0(Entity*, Entity*);
|
||||||
|
|
||||||
|
void Book(Entity* this) {
|
||||||
|
BookActionFuncs[this->action](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B3C4(Entity* this) {
|
||||||
|
u32 obtained;
|
||||||
|
|
||||||
|
obtained = GetInventoryValue(this->type + 0x39);
|
||||||
|
if (this->type2 != 3) {
|
||||||
|
if (obtained) {
|
||||||
|
DeleteThisEntity();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (CheckLocalFlag(0x73)) {
|
||||||
|
DeleteThisEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obtained != 2) {
|
||||||
|
this->spriteSettings.b.draw = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->spriteOffsetY = 3;
|
||||||
|
if (CheckFlags(this->field_0x86.HWORD)) {
|
||||||
|
if (this->type2 == 0) {
|
||||||
|
this->y.HALF.HI += 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->type2 = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSpriteForCollisionLayer(this);
|
||||||
|
InitAnimationForceUpdate(this, this->type + 0x39);
|
||||||
|
|
||||||
|
switch (this->type2) {
|
||||||
|
case 0:
|
||||||
|
this->action = 1;
|
||||||
|
this->actionDelay = 22;
|
||||||
|
this->field_0xf = 2;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->spritePriority.b0 = 3;
|
||||||
|
break;
|
||||||
|
case 1: {
|
||||||
|
u32 scroll;
|
||||||
|
u32 height;
|
||||||
|
this->action = 3;
|
||||||
|
scroll = (u16)gRoomControls.roomScrollY - 0x10;
|
||||||
|
height = (u16)this->y.HALF.HI - scroll;
|
||||||
|
this->height.HALF.HI -= height;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
this->action = 4;
|
||||||
|
return;
|
||||||
|
case 3:
|
||||||
|
this->action = 5;
|
||||||
|
this->subAction = 0;
|
||||||
|
this->spritePriority.b0 = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B4A8(Entity* this) {
|
||||||
|
sub_0800445C(this);
|
||||||
|
|
||||||
|
if (this->field_0x80.HALF.LO != 0) {
|
||||||
|
this->field_0x80.HALF.LO--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sub_0809B688(this)) {
|
||||||
|
if (--this->actionDelay) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->action = 2;
|
||||||
|
this->actionDelay = 30;
|
||||||
|
this->speed = 64;
|
||||||
|
this->direction = 16;
|
||||||
|
|
||||||
|
gPlayerState.pushedObject = 0x9e;
|
||||||
|
gPlayerState.playerAction = 5;
|
||||||
|
gPlayerState.flags.all |= 1;
|
||||||
|
|
||||||
|
gPlayerEntity.x.HALF.LO = 0;
|
||||||
|
gPlayerEntity.y.HALF.LO = 0;
|
||||||
|
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||||
|
EnqueueSFX(0x10f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->actionDelay = 0x16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B524(Entity* this) {
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
if (--this->field_0xf == 0) {
|
||||||
|
this->action = 3;
|
||||||
|
this->y.HALF.HI += 32;
|
||||||
|
this->height.HALF.HI -= 32;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->action = 1;
|
||||||
|
this->actionDelay = 22;
|
||||||
|
this->field_0x80.HALF.LO = 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_0806F69C(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B56C(Entity* this) {
|
||||||
|
Entity* fx;
|
||||||
|
|
||||||
|
if (sub_080044EC(this, 0x2800) != 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->action = 4;
|
||||||
|
this->spritePriority.b0 = 4;
|
||||||
|
|
||||||
|
SetFlag(this->field_0x86.HWORD);
|
||||||
|
|
||||||
|
fx = CreateFx(this, 2, 0);
|
||||||
|
if (fx) {
|
||||||
|
ResolveEntityOnTop(this, fx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B5B4(Entity* this) {
|
||||||
|
if (gPlayerState.flags.all & 0x80) {
|
||||||
|
sub_0800445C(this);
|
||||||
|
}
|
||||||
|
else if (sub_08017850(this)) {
|
||||||
|
CreateItemEntity(this->type + 0x39, 0, 0);
|
||||||
|
DeleteThisEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B5EC(Entity* this) {
|
||||||
|
if (this->spriteSettings.b.draw == 1) {
|
||||||
|
switch (this->subAction) {
|
||||||
|
case 0: {
|
||||||
|
Entity* parent;
|
||||||
|
parent = FindEntityByID(7, 26, 7);
|
||||||
|
if (!parent) return;
|
||||||
|
if (parent->x.HALF.HI < this->x.HALF.HI) return;
|
||||||
|
if (parent->animationState != 4) return;
|
||||||
|
|
||||||
|
this->parent = parent;
|
||||||
|
this->subAction = 1;
|
||||||
|
sub_0809B6B0(this->parent, this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
if (!this->parent || !this->parent->next) {
|
||||||
|
DeleteThisEntity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sub_0809B6B0(this->parent, this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (this->subAction) {
|
||||||
|
default: {
|
||||||
|
DeleteThisEntity();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0: {
|
||||||
|
if (GetInventoryValue(this->type + 0x39) == 2) {
|
||||||
|
this->subAction = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
u8 doTextBox = gTextBox.doTextBox & 0x7f;
|
||||||
|
if (!doTextBox) {
|
||||||
|
this->spriteSettings.b.draw = 1;
|
||||||
|
this->subAction = doTextBox;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 sub_0809B688(Entity* this) {
|
||||||
|
u32 ret;
|
||||||
|
|
||||||
|
ret = sub_080041A0(this, &gPlayerEntity, 6, 12);
|
||||||
|
if (ret == 1 && gPlayerState.field_0xd != 16) {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0809B6B0(Entity* parent, Entity* this) {
|
||||||
|
s32 offset;
|
||||||
|
offset = (s32)gUnk_08123D94[parent->animationState >> 1] << 16;
|
||||||
|
|
||||||
|
PositionRelative(parent, this, 0, offset);
|
||||||
|
|
||||||
|
this->height.HALF.HI = -(this->type << 2);
|
||||||
|
this->spritePriority.b0 = 3 - this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void (*const BookActionFuncs[])(Entity*) = {
|
||||||
|
sub_0809B3C4,
|
||||||
|
sub_0809B4A8,
|
||||||
|
sub_0809B524,
|
||||||
|
sub_0809B56C,
|
||||||
|
sub_0809B5B4,
|
||||||
|
sub_0809B5EC
|
||||||
|
};
|
||||||
|
|
||||||
|
const s8 gUnk_08123D94[] = { -22, -20, -20, -20 };
|
Loading…
Reference in New Issue