Decompile FrozenWaterElement

This commit is contained in:
octorock 2022-02-12 11:46:10 +01:00
parent d1a2586001
commit cea5d6cc1c
7 changed files with 180 additions and 887 deletions

View File

@ -1,276 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start DeathFx
DeathFx: @ 0x0808161C
push {lr}
ldr r2, _08081630 @ =gUnk_0811EBFC
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08081630: .4byte gUnk_0811EBFC
thumb_func_start sub_08081634
DeathFx_Action0: @ 0x08081634
push {r4, r5, lr}
adds r4, r0, #0
adds r0, #0x6c
ldrb r1, [r0]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _0808169C
movs r5, #0
movs r0, #0x65
strh r0, [r4, #0x12]
movs r1, #2
strb r1, [r4, #0xc]
strb r5, [r4, #0x15]
movs r0, #0x40
strh r0, [r4, #0x24]
adds r0, r4, #0
adds r0, #0x38
strb r1, [r0]
adds r0, r4, #0
bl UpdateSpriteForCollisionLayer
ldrb r0, [r4, #0x19]
movs r1, #3
orrs r0, r1
strb r0, [r4, #0x19]
ldrb r0, [r4, #0xe]
movs r2, #0x80
cmp r0, #0
beq _08081674
adds r2, r0, #0
strb r5, [r4, #0xe]
_08081674:
adds r0, r4, #0
adds r1, r2, #0
movs r3, #0
bl sub_0805EC9C
adds r0, r4, #0
movs r1, #4
movs r2, #0
bl LoadSwapGFX
adds r0, r4, #0
movs r1, #0
bl InitAnimationForceUpdate
ldr r0, _08081698 @ =0x00000129
bl SoundReq
b _0808170C
.align 2, 0
_08081698: .4byte 0x00000129
_0808169C:
movs r0, #0xc
ands r0, r1
cmp r0, #0
beq _080816B2
adds r0, r4, #0
bl sub_08081790
adds r0, r4, #0
bl sub_0808180C
b _08081702
_080816B2:
movs r0, #2
ands r0, r1
cmp r0, #0
beq _080816C4
adds r0, r4, #0
movs r1, #2
bl InitializeAnimation
b _08081702
_080816C4:
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #3
orrs r0, r1
strb r0, [r2]
ldr r1, _08081718 @ =gUnk_0811EC08
ldrb r0, [r4, #0xa]
lsrs r0, r0, #2
adds r0, r0, r1
ldrb r2, [r0]
ldrb r0, [r4, #0xa]
movs r1, #3
ands r0, r1
lsls r0, r0, #1
asrs r2, r0
ands r2, r1
ldr r1, [r4, #0x50]
cmp r1, #0
beq _080816FA
ldr r0, _0808171C @ =gUnk_0811EC20
adds r0, r2, r0
ldrb r0, [r0]
strb r0, [r1, #0xe]
_080816FA:
adds r0, r4, #0
adds r1, r2, #0
bl InitializeAnimation
_08081702:
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0xff
bl EnqueueSFX
_0808170C:
adds r0, r4, #0
movs r1, #3
bl SetDefaultPriority
pop {r4, r5, pc}
.align 2, 0
_08081718: .4byte gUnk_0811EC08
_0808171C: .4byte gUnk_0811EC20
thumb_func_start sub_08081720
DeathFx_Action1: @ 0x08081720
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 _08081744
adds r0, r4, #0
bl sub_08081790
adds r0, r4, #0
bl sub_0808180C
b _0808175E
_08081744:
movs r0, #1
ands r0, r1
cmp r0, #0
beq _0808175E
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #4
orrs r0, r1
strb r0, [r2]
_0808175E:
pop {r4, pc}
thumb_func_start sub_08081760
DeathFx_Action2: @ 0x08081760
push {r4, lr}
adds r4, r0, #0
bl UpdateAnimationSingleFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _0808177E
adds r0, r4, #0
bl sub_0808180C
b _0808178C
_0808177E:
movs r0, #1
ands r0, r1
cmp r0, #0
beq _0808178C
adds r0, r4, #0
bl LinearMoveUpdate
_0808178C:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08081790
sub_08081790: @ 0x08081790
push {lr}
adds r2, r0, #0
adds r1, r2, #0
adds r1, #0x6d
ldrb r0, [r1]
cmp r0, #0xef
bhi _080817B4
ldr r0, _080817B0 @ =gUnk_0811EC64
ldrb r1, [r1]
adds r1, r1, r0
ldrb r1, [r1]
adds r0, r2, #0
bl CreateRandomItemDrop
b _080817C6
.align 2, 0
_080817B0: .4byte gUnk_0811EC64
_080817B4:
ldr r0, _080817C8 @ =gUnk_0811EC24
ldrb r1, [r1]
subs r1, #0xf0
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r2, #0
bl _call_via_r1
_080817C6:
pop {pc}
.align 2, 0
_080817C8: .4byte gUnk_0811EC24
thumb_func_start sub_080817CC
DeathFx_DropRandom9: @ 0x080817CC
push {lr}
movs r1, #9
bl CreateRandomItemDrop
pop {pc}
.align 2, 0
thumb_func_start sub_080817D8
DeathFx_DropRandom13: @ 0x080817D8
push {lr}
movs r1, #0xd
bl CreateRandomItemDrop
pop {pc}
.align 2, 0
thumb_func_start sub_080817E4
DeathFx_DropRandom14: @ 0x080817E4
push {lr}
movs r1, #0xe
bl CreateRandomItemDrop
pop {pc}
.align 2, 0
thumb_func_start sub_080817F0
DeathFx_DropRandom1: @ 0x080817F0
push {lr}
movs r1, #1
bl CreateRandomItemDrop
pop {pc}
.align 2, 0
thumb_func_start sub_080817FC
DeathFx_DropFixedItem: @ 0x080817FC
push {lr}
adds r1, r0, #0
adds r1, #0x6e
ldrb r1, [r1]
movs r2, #0
bl CreateItemDrop
pop {pc}
thumb_func_start sub_0808180C
DeathFx_Delete: @ 0x0808180C
push {lr}
bl DeleteThisEntity
pop {pc}

View File

@ -1,560 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start FrozenWaterElement
FrozenWaterElement: @ 0x0809BEB4
push {lr}
ldr r2, _0809BEC8 @ =gUnk_08123DB4
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809BEC8: .4byte gUnk_08123DB4
thumb_func_start sub_0809BECC
sub_0809BECC: @ 0x0809BECC
push {r4, lr}
adds r4, r0, #0
movs r0, #0x9b
bl CheckFlags
cmp r0, #0
beq _0809BEDE
bl DeleteThisEntity
_0809BEDE:
movs r0, #0x91
movs r1, #0
movs r2, #0
bl CreateObject
str r0, [r4, #0x54]
cmp r0, #0
beq _0809BF1A
movs r2, #0
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x11]
subs r0, #0x11
ands r0, r1
movs r1, #3
orrs r0, r1
strb r0, [r4, #0x11]
strb r2, [r4, #0x1e]
ldrb r0, [r4, #0x19]
orrs r0, r1
strb r0, [r4, #0x19]
adds r0, r4, #0
bl sub_0809C0A8
adds r0, r4, #0
movs r1, #0xcc
movs r2, #0xcc
movs r3, #0
bl sub_0805EC9C
_0809BF1A:
pop {r4, pc}
thumb_func_start sub_0809BF1C
sub_0809BF1C: @ 0x0809BF1C
push {r4, lr}
adds r4, r0, #0
movs r1, #0xcc
movs r2, #0xcc
movs r3, #0
bl sub_0805EC9C
movs r0, #0x37
bl CheckFlags
cmp r0, #0
beq _0809BF6C
movs r0, #0x90
movs r1, #0
movs r2, #0
bl CreateObject
adds r1, r0, #0
cmp r1, #0
beq _0809BF6C
ldr r0, _0809BF70 @ =gRoomControls
str r1, [r0, #0x30]
ldr r0, [r4, #0x54]
str r1, [r0, #0x54]
movs r3, #0x80
lsls r3, r3, #0xb
adds r0, r4, #0
movs r2, #0
bl PositionRelative
movs r0, #2
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x74
movs r0, #0xa0
lsls r0, r0, #1
strh r0, [r1]
adds r0, #0x73
bl EnqueueSFX
_0809BF6C:
pop {r4, pc}
.align 2, 0
_0809BF70: .4byte gRoomControls
thumb_func_start sub_0809BF74
sub_0809BF74: @ 0x0809BF74
push {r4, r5, r6, r7, lr}
adds r7, r0, #0
adds r5, r7, #0
adds r5, #0x74
ldrh r0, [r5]
subs r1, r0, #1
strh r1, [r5]
lsls r0, r1, #0x10
cmp r0, #0
bne _0809BFA0
ldr r1, [r7, #0x54]
movs r0, #1
strb r0, [r1, #0xf]
adds r0, r7, #0
bl sub_0809C23C
movs r0, #0x9b
bl CheckFlags
bl DeleteThisEntity
b _0809C09A
_0809BFA0:
movs r0, #0x1f
ands r1, r0
cmp r1, #0
bne _0809BFAE
ldr r0, _0809C09C @ =0x000001B3
bl EnqueueSFX
_0809BFAE:
ldrh r0, [r5]
cmp r0, #0x77
bhi _0809BFE0
movs r1, #0x78
subs r1, r1, r0
lsls r4, r1, #5
adds r4, #0xcc
lsls r1, r1, #4
adds r1, #0xcc
adds r0, r7, #0
adds r2, r4, #0
movs r3, #0
bl sub_0805EC9C
adds r0, r7, #0
adds r1, r4, #0
movs r2, #8
movs r3, #0
bl sub_0806FCF4
adds r1, r7, #0
adds r1, #0x63
ldrb r0, [r1]
adds r0, #8
strb r0, [r1]
_0809BFE0:
ldr r1, _0809C0A0 @ =gUnk_08123DC0
ldrh r0, [r5]
lsrs r0, r0, #5
adds r0, r0, r1
ldrb r6, [r0]
movs r0, #0xf
movs r1, #0x11
movs r2, #0x40
bl CreateObject
adds r5, r0, #0
cmp r5, #0
beq _0809C044
bl Random
adds r4, r0, #0
asrs r0, r4, #0x10
ands r0, r6
adds r2, r6, #1
lsrs r1, r2, #1
subs r0, r0, r1
mov ip, r0
lsrs r0, r6, #1
ands r0, r4
lsrs r2, r2, #2
subs r4, r0, r2
adds r2, r5, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #3
orrs r0, r1
strb r0, [r2]
adds r1, r7, #0
adds r1, #0x80
ldr r2, _0809C0A4 @ =gRoomControls
ldrh r0, [r2, #6]
ldrh r1, [r1]
adds r0, r0, r1
add r0, ip
strh r0, [r5, #0x2e]
adds r1, r7, #0
adds r1, #0x82
ldrh r0, [r2, #8]
ldrh r1, [r1]
adds r0, r0, r1
adds r0, r0, r4
strh r0, [r5, #0x32]
_0809C044:
movs r0, #0xf
movs r1, #2
movs r2, #0x40
bl CreateObject
adds r5, r0, #0
cmp r5, #0
beq _0809C09A
bl Random
adds r4, r0, #0
asrs r1, r4, #0x10
ands r1, r6
adds r0, r6, #1
lsrs r0, r0, #1
subs r1, r1, r0
mov ip, r1
lsrs r3, r6, #1
ands r3, r4
adds r2, r5, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #3
orrs r0, r1
strb r0, [r2]
adds r1, r7, #0
adds r1, #0x80
ldr r2, _0809C0A4 @ =gRoomControls
ldrh r0, [r2, #6]
ldrh r1, [r1]
adds r0, r0, r1
add r0, ip
strh r0, [r5, #0x2e]
adds r1, r7, #0
adds r1, #0x82
ldrh r0, [r2, #8]
ldrh r1, [r1]
adds r0, r0, r1
adds r0, r0, r3
strh r0, [r5, #0x32]
_0809C09A:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0809C09C: .4byte 0x000001B3
_0809C0A0: .4byte gUnk_08123DC0
_0809C0A4: .4byte gRoomControls
thumb_func_start sub_0809C0A8
sub_0809C0A8: @ 0x0809C0A8
push {r4, r5, r6, lr}
adds r4, r0, #0
movs r1, #0x2e
ldrsh r0, [r4, r1]
ldr r3, _0809C214 @ =gRoomControls
ldrh r1, [r3, #6]
subs r0, r0, r1
asrs r6, r0, #4
movs r2, #0x3f
ands r6, r2
movs r1, #0x32
ldrsh r0, [r4, r1]
ldrh r1, [r3, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
orrs r6, r0
ldr r5, _0809C218 @ =0x00004022
adds r1, r6, #0
subs r1, #0x41
adds r4, #0x38
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
subs r1, #0x40
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
subs r1, #0x3f
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
subs r1, r6, #2
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
subs r1, r6, #1
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldrb r2, [r4]
adds r0, r5, #0
adds r1, r6, #0
bl SetTile
adds r1, r6, #1
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #2
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x3e
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x3f
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x40
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x41
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x42
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x7f
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x80
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
adds r1, r6, #0
adds r1, #0x81
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C21C @ =0x0000013F
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
movs r0, #0xa0
lsls r0, r0, #1
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C220 @ =0x00000141
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C224 @ =0x0000017F
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C228 @ =0x00000181
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C22C @ =0x000001BD
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
movs r0, #0xdf
lsls r0, r0, #1
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C230 @ =0x000001BF
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C234 @ =0x000001C1
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
movs r0, #0xe1
lsls r0, r0, #1
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
ldr r0, _0809C238 @ =0x000001C3
adds r1, r6, r0
ldrb r2, [r4]
adds r0, r5, #0
bl SetTile
pop {r4, r5, r6, pc}
.align 2, 0
_0809C214: .4byte gRoomControls
_0809C218: .4byte 0x00004022
_0809C21C: .4byte 0x0000013F
_0809C220: .4byte 0x00000141
_0809C224: .4byte 0x0000017F
_0809C228: .4byte 0x00000181
_0809C22C: .4byte 0x000001BD
_0809C230: .4byte 0x000001BF
_0809C234: .4byte 0x000001C1
_0809C238: .4byte 0x000001C3
thumb_func_start sub_0809C23C
sub_0809C23C: @ 0x0809C23C
push {r4, r5, lr}
adds r4, r0, #0
movs r1, #0x2e
ldrsh r0, [r4, r1]
ldr r3, _0809C370 @ =gRoomControls
ldrh r1, [r3, #6]
subs r0, r0, r1
asrs r5, r0, #4
movs r2, #0x3f
ands r5, r2
movs r1, #0x32
ldrsh r0, [r4, r1]
ldrh r1, [r3, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
orrs r5, r0
adds r0, r5, #0
subs r0, #0x41
adds r4, #0x38
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
subs r0, #0x40
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
subs r0, #0x3f
ldrb r1, [r4]
bl sub_0807BA8C
subs r0, r5, #2
ldrb r1, [r4]
bl sub_0807BA8C
subs r0, r5, #1
ldrb r1, [r4]
bl sub_0807BA8C
ldrb r1, [r4]
adds r0, r5, #0
bl sub_0807BA8C
adds r0, r5, #1
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #2
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x3e
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x3f
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x40
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x41
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x42
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x7f
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x80
ldrb r1, [r4]
bl sub_0807BA8C
adds r0, r5, #0
adds r0, #0x81
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C374 @ =0x0000013F
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
movs r1, #0xa0
lsls r1, r1, #1
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C378 @ =0x00000141
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C37C @ =0x0000017F
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C380 @ =0x00000181
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C384 @ =0x000001BD
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
movs r1, #0xdf
lsls r1, r1, #1
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C388 @ =0x000001BF
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C38C @ =0x000001C1
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
movs r1, #0xe1
lsls r1, r1, #1
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
ldr r1, _0809C390 @ =0x000001C3
adds r0, r5, r1
ldrb r1, [r4]
bl sub_0807BA8C
pop {r4, r5, pc}
.align 2, 0
_0809C370: .4byte gRoomControls
_0809C374: .4byte 0x0000013F
_0809C378: .4byte 0x00000141
_0809C37C: .4byte 0x0000017F
_0809C380: .4byte 0x00000181
_0809C384: .4byte 0x000001BD
_0809C388: .4byte 0x000001BF
_0809C38C: .4byte 0x000001C1
_0809C390: .4byte 0x000001C3

View File

@ -25239,11 +25239,6 @@
"size": 13,
"type": "animation"
},
{
"path": "armos/gUnk_080CE164.bin",
"start": 844132,
"size": 8
},
{
"path": "animations/gSpriteAnimations_Armos_0.bin",
"start": 844140,
@ -25292,11 +25287,6 @@
"size": 6,
"type": "animation"
},
{
"path": "armos/gUnk_080CE160.bin",
"start": 844128,
"size": 4
},
{
"path": "animations/gSpriteAnimations_Eyegore_2.bin",
"start": 844556,
@ -31336,11 +31326,6 @@
"start": 1037736,
"size": 12
},
{
"path": "data_080FC8A4/gItemMetaData.bin",
"start": 1037748,
"size": 944
},
{
"path": "data_080FC8A4/gUnk_080FD964_EU.bin",
"variants": [
@ -41836,21 +41821,6 @@
"size": 89,
"type": "animation"
},
{
"path": "deathFx/gUnk_0811EC08.bin",
"start": 1174536,
"size": 24
},
{
"path": "deathFx/gUnk_0811EC20.bin",
"start": 1174560,
"size": 4
},
{
"path": "deathFx/gUnk_0811EC64.bin",
"start": 1174628,
"size": 112
},
{
"path": "button/gUnk_0811EE50.bin",
"start": 1175120,
@ -45341,11 +45311,6 @@
"start": 1195368,
"size": 20
},
{
"path": "frozenWaterElement/gUnk_08123DC0.bin",
"start": 1195456,
"size": 12
},
{
"path": "object91/gUnk_08123DDC.bin",
"start": 1195484,

View File

@ -1,13 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08123DB4:: @ 08123DB4
.4byte sub_0809BECC
.4byte sub_0809BF1C
.4byte sub_0809BF74
gUnk_08123DC0:: @ 08123DC0
.incbin "frozenWaterElement/gUnk_08123DC0.bin"

View File

@ -369,7 +369,7 @@ void DoubleBookshelf(Entity*);
void Book(Entity*);
void Fireplace(Entity*);
void Object8E(Entity*);
void FrozenWaterElement(Entity*);
void FrozenWaterElement();
void Object90(Entity*);
void Object91(Entity*);
void BakerOven(Entity*);

View File

@ -789,7 +789,7 @@ SECTIONS {
src/object/book.o(.text);
src/object/fireplace.o(.text);
asm/object/object8E.o(.text);
asm/object/frozenWaterElement.o(.text);
src/object/frozenWaterElement.o(.text);
asm/object/object90.o(.text);
asm/object/object91.o(.text);
src/object/bakerOven.o(.text);
@ -1544,7 +1544,7 @@ SECTIONS {
src/object/book.o(.rodata);
data/const/object/fireplace.o(.rodata);
data/const/object/object8E.o(.rodata);
data/const/object/frozenWaterElement.o(.rodata);
src/object/frozenWaterElement.o(.rodata);
data/const/object/object90.o(.rodata);
data/const/object/object91.o(.rodata);
data/const/object/bakerOven.o(.rodata);

View File

@ -0,0 +1,177 @@
/**
* @file frozenWaterElement.c
* @ingroup Objects
*
* @brief Frozen Water Element object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0xc];
/*0x74*/ u16 unk_74;
/*0x76*/ u8 unk_76[0xa];
/*0x80*/ u16 unk_80;
/*0x82*/ u16 unk_82;
} FrozenWaterElementEntity;
void sub_0809C0A8(FrozenWaterElementEntity*);
void sub_0809C23C(FrozenWaterElementEntity*);
void sub_0809BECC(FrozenWaterElementEntity*);
void sub_0809BF1C(FrozenWaterElementEntity*);
void sub_0809BF74(FrozenWaterElementEntity*);
void FrozenWaterElement(FrozenWaterElementEntity* this) {
static void (*const gUnk_08123DB4[])(FrozenWaterElementEntity*) = {
sub_0809BECC,
sub_0809BF1C,
sub_0809BF74,
};
gUnk_08123DB4[super->action](this);
}
void sub_0809BECC(FrozenWaterElementEntity* this) {
Entity* obj;
if (CheckFlags(0x9b)) {
DeleteThisEntity();
}
obj = CreateObject(OBJECT_91, 0, 0);
super->child = obj;
if (obj != NULL) {
super->action = 1;
super->updatePriority = 3;
super->frameIndex = 0;
super->spriteRendering.b0 = 3;
sub_0809C0A8(this);
sub_0805EC9C(super, 0xcc, 0xcc, 0);
}
}
void sub_0809BF1C(FrozenWaterElementEntity* this) {
sub_0805EC9C(super, 0xcc, 0xcc, 0);
if (CheckFlags(OUGONTEKI_G)) {
Entity* obj = CreateObject(OBJECT_90, 0, 0);
if (obj != NULL) {
gRoomControls.camera_target = obj;
(super->child)->child = obj;
PositionRelative(super, obj, 0, 0x40000);
super->action = 2;
this->unk_74 = 0x140;
EnqueueSFX(SFX_ICE_BLOCK_MELT);
}
}
}
void sub_0809BF74(FrozenWaterElementEntity* this) {
static const u8 gUnk_08123DC0[] = {
3, 7, 15, 31, 63, 63, 63, 63, 63, 63, 63, 0,
};
s32 rand;
u32 value;
Entity* effect;
s32 tmp;
s32 tmp2;
if (--this->unk_74 == 0) {
(super->child)->field_0xf = 1;
sub_0809C23C(this);
CheckFlags(0x9b);
DeleteThisEntity();
} else {
if ((this->unk_74 & 0x1f) == 0) {
EnqueueSFX(SFX_ICE_BLOCK_MELT);
}
if (this->unk_74 < 0x78) {
tmp2 = ((0x78 - this->unk_74) << 5);
tmp2 += 0xcc;
sub_0805EC9C(super, ((0x78 - this->unk_74) << 4) + 0xcc, tmp2, 0);
sub_0806FCF4(super, tmp2, 8, 0);
super->spriteOffsetY += 8;
}
value = gUnk_08123DC0[this->unk_74 >> 5];
effect = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (effect != NULL) {
rand = Random();
tmp = (((rand >> 0x10) & value) - ((value + 1) >> 1));
tmp2 = (((value >> 1) & rand) - ((value + 1) >> 2));
effect->spritePriority.b0 = 3;
effect->x.HALF.HI = this->unk_80 + gRoomControls.origin_x + tmp;
effect->y.HALF.HI = this->unk_82 + gRoomControls.origin_y + tmp2;
}
effect = CreateObject(SPECIAL_FX, 2, 0x40);
if (effect != NULL) {
rand = Random();
tmp = (((rand >> 0x10) & value) - ((value + 1) >> 1));
tmp2 = ((value >> 1) & rand);
effect->spritePriority.b0 = 3;
effect->x.HALF.HI = this->unk_80 + gRoomControls.origin_x + tmp;
effect->y.HALF.HI = this->unk_82 + gRoomControls.origin_y + tmp2;
}
}
}
void sub_0809C0A8(FrozenWaterElementEntity* this) {
u32 position = COORD_TO_TILE(super);
SetTile(0x4022, position - 0x41, super->collisionLayer);
SetTile(0x4022, position - 0x40, super->collisionLayer);
SetTile(0x4022, position - 0x3f, super->collisionLayer);
SetTile(0x4022, position - 2, super->collisionLayer);
SetTile(0x4022, position - 1, super->collisionLayer);
SetTile(0x4022, position, super->collisionLayer);
SetTile(0x4022, position + 1, super->collisionLayer);
SetTile(0x4022, position + 2, super->collisionLayer);
SetTile(0x4022, position + 0x3e, super->collisionLayer);
SetTile(0x4022, position + 0x3f, super->collisionLayer);
SetTile(0x4022, position + 0x40, super->collisionLayer);
SetTile(0x4022, position + 0x41, super->collisionLayer);
SetTile(0x4022, position + 0x42, super->collisionLayer);
SetTile(0x4022, position + 0x7f, super->collisionLayer);
SetTile(0x4022, position + 0x80, super->collisionLayer);
SetTile(0x4022, position + 0x81, super->collisionLayer);
SetTile(0x4022, position + 0x13f, super->collisionLayer);
SetTile(0x4022, position + 0x140, super->collisionLayer);
SetTile(0x4022, position + 0x141, super->collisionLayer);
SetTile(0x4022, position + 0x17f, super->collisionLayer);
SetTile(0x4022, position + 0x181, super->collisionLayer);
SetTile(0x4022, position + 0x1bd, super->collisionLayer);
SetTile(0x4022, position + 0x1be, super->collisionLayer);
SetTile(0x4022, position + 0x1bf, super->collisionLayer);
SetTile(0x4022, position + 0x1c1, super->collisionLayer);
SetTile(0x4022, position + 0x1c2, super->collisionLayer);
SetTile(0x4022, position + 0x1c3, super->collisionLayer);
}
void sub_0809C23C(FrozenWaterElementEntity* this) {
u32 position = COORD_TO_TILE(super);
sub_0807BA8C(position - 0x41, super->collisionLayer);
sub_0807BA8C(position - 0x40, super->collisionLayer);
sub_0807BA8C(position - 0x3f, super->collisionLayer);
sub_0807BA8C(position - 2, super->collisionLayer);
sub_0807BA8C(position - 1, super->collisionLayer);
sub_0807BA8C(position, super->collisionLayer);
sub_0807BA8C(position + 1, super->collisionLayer);
sub_0807BA8C(position + 2, super->collisionLayer);
sub_0807BA8C(position + 0x3e, super->collisionLayer);
sub_0807BA8C(position + 0x3f, super->collisionLayer);
sub_0807BA8C(position + 0x40, super->collisionLayer);
sub_0807BA8C(position + 0x41, super->collisionLayer);
sub_0807BA8C(position + 0x42, super->collisionLayer);
sub_0807BA8C(position + 0x7f, super->collisionLayer);
sub_0807BA8C(position + 0x80, super->collisionLayer);
sub_0807BA8C(position + 0x81, super->collisionLayer);
sub_0807BA8C(position + 0x13f, super->collisionLayer);
sub_0807BA8C(position + 0x140, super->collisionLayer);
sub_0807BA8C(position + 0x141, super->collisionLayer);
sub_0807BA8C(position + 0x17f, super->collisionLayer);
sub_0807BA8C(position + 0x181, super->collisionLayer);
sub_0807BA8C(position + 0x1bd, super->collisionLayer);
sub_0807BA8C(position + 0x1be, super->collisionLayer);
sub_0807BA8C(position + 0x1bf, super->collisionLayer);
sub_0807BA8C(position + 0x1c1, super->collisionLayer);
sub_0807BA8C(position + 0x1c2, super->collisionLayer);
sub_0807BA8C(position + 0x1c3, super->collisionLayer);
}