start decompiling scroll_lock

This commit is contained in:
Zhengwen Jiang 2023-04-22 23:36:46 -05:00 committed by Egor Ananyin
parent 3c15dec58d
commit 22ec7cd4b5
30 changed files with 1477 additions and 2732 deletions

File diff suppressed because it is too large Load Diff

945
asm/scroll_lock.s Normal file
View File

@ -0,0 +1,945 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_0811D508
sub_0811D508: @ 0x0811D508
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
mov r5, r8
push {r5, r6, r7}
sub sp, #0x10
adds r7, r0, #0
adds r0, #0x8c
ldr r6, [r0]
subs r0, #0x2c
ldrh r0, [r0]
str r0, [sp, #0xc]
movs r0, #0
b _0811D664
_0811D524:
movs r0, #0xd4
lsls r0, r0, #1
mov r1, sl
muls r1, r0, r1
mov sb, r1
ldr r2, _0811D5B4 @ =gKirbys
add r2, sb
mov r8, r2
mov r0, r8
adds r0, #0x60
ldrh r0, [r0]
ldr r3, [sp, #0xc]
cmp r0, r3
beq _0811D542
b _0811D648
_0811D542:
ldr r1, [r7, #0x40]
ldr r2, [r7, #0x44]
adds r5, r7, #0
adds r5, #0xb0
ldr r4, [r5]
movs r3, #0x1a
ldrsh r0, [r4, r3]
mov ip, r0
movs r3, #0x1c
ldrsh r0, [r4, r3]
str r0, [sp]
ldrh r0, [r4, #0x1e]
str r0, [sp, #4]
ldrh r0, [r4, #0x20]
str r0, [sp, #8]
mov r0, r8
mov r3, ip
bl sub_08039430
lsls r0, r0, #0x18
cmp r0, #0
beq _0811D5C0
ldr r0, _0811D5B8 @ =gKirbys+0xC
add r0, sb
ldr r0, [r0]
movs r1, #0x80
lsls r1, r1, #8
ands r0, r1
cmp r0, #0
bne _0811D5CC
movs r2, #1
mov r0, sl
lsls r2, r0
ldr r0, [r6, #4]
adds r1, r0, #0
ands r1, r2
cmp r1, #0
bne _0811D5A2
orrs r0, r2
str r0, [r6, #4]
movs r0, #0xcd
lsls r0, r0, #3
mov r2, sl
muls r2, r0, r2
adds r0, r2, #0
ldr r3, _0811D5BC @ =gCurLevelInfo+0x1EC
adds r0, r0, r3
str r1, [r0]
_0811D5A2:
mov r0, r8
adds r0, #0x56
ldrb r1, [r0]
ldr r0, [r5]
ldrh r2, [r0, #0x22]
adds r0, r6, #0
bl sub_0811C7D0
b _0811D5CC
.align 2, 0
_0811D5B4: .4byte gKirbys
_0811D5B8: .4byte gKirbys+0xC
_0811D5BC: .4byte gCurLevelInfo+0x1EC
_0811D5C0:
movs r1, #1
mov r0, sl
lsls r1, r0
ldr r0, [r6, #4]
bics r0, r1
str r0, [r6, #4]
_0811D5CC:
movs r0, #0xd4
lsls r0, r0, #1
mov r1, sl
muls r1, r0, r1
adds r0, r1, #0
ldr r2, _0811D63C @ =gKirbys
adds r0, r0, r2
movs r3, #0x80
lsls r3, r3, #1
adds r0, r0, r3
ldrb r0, [r0]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
cmp r0, #0
bgt _0811D5FE
adds r0, r7, #0
mov r1, sl
bl sub_0811DB48
movs r1, #0x10
mov r0, sl
lsls r1, r0
ldr r0, [r6, #4]
bics r0, r1
str r0, [r6, #4]
_0811D5FE:
ldr r5, [r5]
ldrb r0, [r5, #4]
cmp r0, #0
beq _0811D65C
adds r1, r0, #0
adds r0, r7, #0
adds r0, #0x56
ldrb r2, [r0]
movs r0, #0xcd
lsls r0, r0, #3
muls r0, r2, r0
ldr r2, _0811D640 @ =gCurLevelInfo
adds r0, r0, r2
ldr r3, _0811D644 @ =0x0000065E
adds r0, r0, r3
ldrb r2, [r0]
movs r0, #0
bl sub_08002888
adds r1, r0, #0
ldr r0, [r1]
cmp r0, #0
beq _0811D65C
subs r0, #1
str r0, [r1]
ldr r0, [r7, #8]
movs r1, #0x80
lsls r1, r1, #5
orrs r0, r1
str r0, [r7, #8]
b _0811D65C
.align 2, 0
_0811D63C: .4byte gKirbys
_0811D640: .4byte gCurLevelInfo
_0811D644: .4byte 0x0000065E
_0811D648:
movs r0, #0x10
mov r1, sl
lsls r0, r1
ldr r1, [r6, #4]
bics r1, r0
movs r0, #1
mov r2, sl
lsls r0, r2
bics r1, r0
str r1, [r6, #4]
_0811D65C:
mov r0, sl
adds r0, #1
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
_0811D664:
mov sl, r0
ldr r0, _0811D688 @ =gUnk_0203AD44
ldrb r0, [r0]
cmp sl, r0
bhs _0811D670
b _0811D524
_0811D670:
ldrh r0, [r7, #4]
adds r0, #1
strh r0, [r7, #4]
add sp, #0x10
pop {r3, r4, r5}
mov r8, r3
mov sb, r4
mov sl, r5
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_0811D688: .4byte gUnk_0203AD44
thumb_func_start sub_0811D68C
sub_0811D68C: @ 0x0811D68C
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
mov r5, r8
push {r5, r6, r7}
sub sp, #0x10
mov sl, r0
adds r0, #0x8c
ldr r7, [r0]
subs r0, #0x2c
ldrh r0, [r0]
str r0, [sp, #0xc]
mov r0, sl
adds r0, #0x56
ldrb r0, [r0]
mov r8, r0
ldr r0, [r7, #4]
movs r1, #0x80
lsls r1, r1, #0x15
ands r0, r1
cmp r0, #0
beq _0811D6BA
b _0811D818
_0811D6BA:
movs r0, #0
mov sb, r0
ldr r0, _0811D760 @ =gUnk_0203AD44
ldrb r0, [r0]
cmp sb, r0
blo _0811D6C8
b _0811D986
_0811D6C8:
movs r0, #0xd4
lsls r0, r0, #1
mov r1, sb
muls r1, r0, r1
mov r8, r1
ldr r6, _0811D764 @ =gKirbys
add r6, r8
adds r0, r6, #0
adds r0, #0x60
ldrh r0, [r0]
ldr r2, [sp, #0xc]
cmp r0, r2
beq _0811D6E4
b _0811D7F0
_0811D6E4:
mov r3, sl
ldr r1, [r3, #0x40]
ldr r2, [r3, #0x44]
mov r5, sl
adds r5, #0xb0
ldr r4, [r5]
movs r3, #0x1a
ldrsh r0, [r4, r3]
mov ip, r0
movs r3, #0x1c
ldrsh r0, [r4, r3]
str r0, [sp]
ldrh r0, [r4, #0x1e]
str r0, [sp, #4]
ldrh r0, [r4, #0x20]
str r0, [sp, #8]
adds r0, r6, #0
mov r3, ip
bl sub_08039430
lsls r0, r0, #0x18
cmp r0, #0
beq _0811D770
ldr r0, _0811D768 @ =gKirbys+0xC
add r0, r8
ldr r0, [r0]
movs r1, #0x80
lsls r1, r1, #8
ands r0, r1
cmp r0, #0
bne _0811D77C
movs r2, #1
mov r0, sb
lsls r2, r0
ldr r0, [r7, #4]
adds r1, r0, #0
ands r1, r2
cmp r1, #0
bne _0811D746
orrs r0, r2
str r0, [r7, #4]
movs r0, #0xcd
lsls r0, r0, #3
mov r2, sb
muls r2, r0, r2
adds r0, r2, #0
ldr r3, _0811D76C @ =gCurLevelInfo+0x1EC
adds r0, r0, r3
str r1, [r0]
_0811D746:
adds r0, r6, #0
adds r0, #0x56
ldrb r1, [r0]
ldr r0, [r5]
ldrh r2, [r0, #0x22]
adds r0, r7, #0
bl sub_0811C7D0
ldr r0, [r7, #4]
movs r1, #0x80
lsls r1, r1, #0x15
orrs r0, r1
b _0811D77A
.align 2, 0
_0811D760: .4byte gUnk_0203AD44
_0811D764: .4byte gKirbys
_0811D768: .4byte gKirbys+0xC
_0811D76C: .4byte gCurLevelInfo+0x1EC
_0811D770:
movs r1, #1
mov r0, sb
lsls r1, r0
ldr r0, [r7, #4]
bics r0, r1
_0811D77A:
str r0, [r7, #4]
_0811D77C:
movs r0, #0xd4
lsls r0, r0, #1
mov r1, sb
muls r1, r0, r1
adds r0, r1, #0
ldr r2, _0811D7E4 @ =gKirbys
adds r0, r0, r2
movs r3, #0x80
lsls r3, r3, #1
adds r0, r0, r3
ldrb r0, [r0]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
cmp r0, #0
bgt _0811D7A2
mov r0, sl
mov r1, sb
bl sub_0811DB48
_0811D7A2:
ldr r5, [r5]
ldrb r0, [r5, #4]
cmp r0, #0
beq _0811D7FC
adds r1, r0, #0
mov r0, sl
adds r0, #0x56
ldrb r2, [r0]
movs r0, #0xcd
lsls r0, r0, #3
muls r0, r2, r0
ldr r2, _0811D7E8 @ =gCurLevelInfo
adds r0, r0, r2
ldr r3, _0811D7EC @ =0x0000065E
adds r0, r0, r3
ldrb r2, [r0]
movs r0, #0
bl sub_08002888
adds r1, r0, #0
ldr r0, [r1]
cmp r0, #0
beq _0811D7FC
subs r0, #1
str r0, [r1]
mov r1, sl
ldr r0, [r1, #8]
movs r1, #0x80
lsls r1, r1, #5
orrs r0, r1
mov r2, sl
str r0, [r2, #8]
b _0811D7FC
.align 2, 0
_0811D7E4: .4byte gKirbys
_0811D7E8: .4byte gCurLevelInfo
_0811D7EC: .4byte 0x0000065E
_0811D7F0:
movs r1, #1
mov r3, sb
lsls r1, r3
ldr r0, [r7, #4]
bics r0, r1
str r0, [r7, #4]
_0811D7FC:
mov r0, sb
adds r0, #1
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
mov sb, r0
ldr r0, _0811D814 @ =gUnk_0203AD44
ldrb r0, [r0]
cmp sb, r0
bhs _0811D810
b _0811D6C8
_0811D810:
b _0811D986
.align 2, 0
_0811D814: .4byte gUnk_0203AD44
_0811D818:
adds r0, r7, #0
adds r0, #0x46
movs r1, #0
ldrsb r1, [r0, r1]
mov sb, r0
cmp r1, #0
beq _0811D8AA
ldr r4, _0811D898 @ =gCurLevelInfo
movs r0, #0xcd
lsls r0, r0, #3
mov r2, r8
muls r2, r0, r2
adds r0, r4, #0
adds r0, #0x7c
adds r6, r2, r0
mov r0, sb
movs r1, #0
ldrsb r1, [r0, r1]
ldr r0, [r6]
adds r0, r0, r1
str r0, [r6]
adds r0, r4, #0
adds r0, #0x84
adds r5, r2, r0
mov r3, sb
movs r1, #0
ldrsb r1, [r3, r1]
ldr r0, [r5]
adds r0, r0, r1
str r0, [r5]
adds r1, r4, #0
adds r1, #0xa0
adds r1, r2, r1
ldrb r3, [r3]
lsls r3, r3, #0x18
asrs r3, r3, #0x18
ldr r0, [r1]
adds r0, r0, r3
str r0, [r1]
adds r0, r4, #0
adds r0, #0xa8
adds r2, r2, r0
mov r0, sb
movs r1, #0
ldrsb r1, [r0, r1]
ldr r0, [r2]
adds r0, r0, r1
str r0, [r2]
mov r1, sb
movs r0, #0
ldrsb r0, [r1, r0]
cmp r0, #0
beq _0811D8AA
cmp r0, #0
ble _0811D89C
ldr r1, [r5]
ldr r0, [r7, #0x4c]
cmp r1, r0
ble _0811D8AA
movs r0, #0
mov r2, sb
strb r0, [r2]
b _0811D8AA
.align 2, 0
_0811D898: .4byte gCurLevelInfo
_0811D89C:
ldr r1, [r6]
ldr r0, _0811D91C @ =0x000007FF
cmp r1, r0
bgt _0811D8AA
movs r0, #0
mov r3, sb
strb r0, [r3]
_0811D8AA:
adds r0, r7, #0
adds r0, #0x4a
movs r1, #0
ldrsb r1, [r0, r1]
adds r4, r0, #0
cmp r1, #0
beq _0811D932
ldr r5, _0811D920 @ =gCurLevelInfo
movs r0, #0xcd
lsls r0, r0, #3
mov r2, r8
muls r2, r0, r2
adds r0, r5, #0
adds r0, #0x80
adds r0, r0, r2
mov r8, r0
movs r1, #0
ldrsb r1, [r4, r1]
ldr r0, [r0]
adds r0, r0, r1
mov r1, r8
str r0, [r1]
adds r0, r5, #0
adds r0, #0x88
adds r6, r2, r0
movs r1, #0
ldrsb r1, [r4, r1]
ldr r0, [r6]
adds r0, r0, r1
str r0, [r6]
adds r1, r5, #0
adds r1, #0xa4
adds r1, r2, r1
movs r3, #0
ldrsb r3, [r4, r3]
ldr r0, [r1]
adds r0, r0, r3
str r0, [r1]
adds r0, r5, #0
adds r0, #0xac
adds r2, r2, r0
movs r1, #0
ldrsb r1, [r4, r1]
ldr r0, [r2]
adds r0, r0, r1
str r0, [r2]
movs r0, #0
ldrsb r0, [r4, r0]
cmp r0, #0
beq _0811D932
cmp r0, #0
ble _0811D924
ldr r1, [r6]
ldr r0, [r7, #0x50]
cmp r1, r0
ble _0811D932
b _0811D92E
.align 2, 0
_0811D91C: .4byte 0x000007FF
_0811D920: .4byte gCurLevelInfo
_0811D924:
mov r2, r8
ldr r1, [r2]
ldr r0, _0811D9A0 @ =0x000007FF
cmp r1, r0
bgt _0811D932
_0811D92E:
movs r0, #0
strb r0, [r4]
_0811D932:
mov r3, sb
movs r0, #0
ldrsb r0, [r3, r0]
cmp r0, #0
bne _0811D986
movs r0, #0
ldrsb r0, [r4, r0]
cmp r0, #0
bne _0811D986
mov r0, sl
adds r0, #0xb0
ldr r1, [r0]
ldrb r0, [r1, #4]
cmp r0, #0
beq _0811D986
adds r1, r0, #0
ldr r3, _0811D9A4 @ =gCurLevelInfo
mov r0, sl
adds r0, #0x56
ldrb r2, [r0]
movs r0, #0xcd
lsls r0, r0, #3
muls r0, r2, r0
adds r0, r0, r3
ldr r2, _0811D9A8 @ =0x0000065E
adds r0, r0, r2
ldrb r2, [r0]
movs r0, #0
bl sub_08002888
adds r1, r0, #0
ldr r0, [r1]
cmp r0, #0
beq _0811D986
subs r0, #1
str r0, [r1]
mov r3, sl
ldr r0, [r3, #8]
movs r1, #0x80
lsls r1, r1, #5
orrs r0, r1
str r0, [r3, #8]
_0811D986:
mov r1, sl
ldrh r0, [r1, #4]
adds r0, #1
strh r0, [r1, #4]
add sp, #0x10
pop {r3, r4, r5}
mov r8, r3
mov sb, r4
mov sl, r5
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_0811D9A0: .4byte 0x000007FF
_0811D9A4: .4byte gCurLevelInfo
_0811D9A8: .4byte 0x0000065E
thumb_func_start sub_0811D9AC
sub_0811D9AC: @ 0x0811D9AC
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
mov r5, r8
push {r5, r6, r7}
sub sp, #0xc
adds r7, r0, #0
ldrh r1, [r7, #0x12]
movs r0, #0x10
ands r0, r1
cmp r0, #0
beq _0811D9D0
ldrh r0, [r7, #6]
lsls r0, r0, #2
movs r1, #0x80
lsls r1, r1, #0x12
adds r1, r0, r1
b _0811D9D8
_0811D9D0:
ldrh r1, [r7, #6]
movs r0, #0xc0
lsls r0, r0, #0x12
adds r1, r1, r0
_0811D9D8:
adds r0, r1, #0
adds r0, #0x8c
ldr r3, [r0]
subs r0, #0x2c
ldrh r0, [r0]
mov sb, r0
adds r0, r1, #0
adds r0, #0x56
ldrb r0, [r0]
str r0, [sp, #8]
adds r0, r1, #0
adds r0, #0xb0
ldr r1, [r0]
ldrb r0, [r1, #2]
mov sl, r0
ldrb r4, [r1, #3]
str r4, [sp]
ldr r2, _0811DA24 @ =gCurLevelInfo
movs r0, #0xcd
lsls r0, r0, #3
ldr r4, [sp, #8]
muls r0, r4, r0
adds r0, r0, r2
ldr r4, _0811DA28 @ =0x0000065E
adds r0, r0, r4
ldrb r0, [r0]
str r0, [sp, #4]
ldrh r1, [r1, #0x22]
movs r0, #8
ands r0, r1
mov ip, r2
cmp r0, #0
bne _0811DB10
movs r6, #0
ldr r0, _0811DA2C @ =gUnk_0203AD44
mov r8, r0
b _0811DB0A
.align 2, 0
_0811DA24: .4byte gCurLevelInfo
_0811DA28: .4byte 0x0000065E
_0811DA2C: .4byte gUnk_0203AD44
_0811DA30:
movs r0, #0xd4
lsls r0, r0, #1
muls r0, r6, r0
ldr r1, _0811DB40 @ =gKirbys
adds r0, r0, r1
adds r0, #0x60
ldrh r0, [r0]
cmp r0, sb
bne _0811DB02
movs r0, #0xcd
lsls r0, r0, #3
adds r2, r6, #0
muls r2, r0, r2
mov r0, ip
adds r0, #0x7c
adds r5, r2, r0
ldr r1, [r3, #0x38]
ldr r0, [r5]
cmp r1, r0
bne _0811DB02
mov r0, ip
adds r0, #0x80
adds r4, r2, r0
ldr r1, [r3, #0x3c]
ldr r0, [r4]
cmp r1, r0
bne _0811DB02
ldr r0, [r3, #0x18]
str r0, [r5]
ldr r0, [r3, #0x1c]
str r0, [r4]
mov r0, ip
adds r0, #0x84
adds r0, r2, r0
ldr r1, [r3, #0x20]
str r1, [r0]
mov r0, ip
adds r0, #0x88
adds r0, r2, r0
ldr r1, [r3, #0x24]
str r1, [r0]
mov r0, ip
adds r0, #0xa0
adds r0, r2, r0
ldr r1, [r3, #0x28]
str r1, [r0]
mov r0, ip
adds r0, #0xa4
adds r0, r2, r0
ldr r1, [r3, #0x2c]
str r1, [r0]
mov r0, ip
adds r0, #0xa8
adds r0, r2, r0
ldr r1, [r3, #0x30]
str r1, [r0]
mov r0, ip
adds r0, #0xac
adds r0, r2, r0
ldr r1, [r3, #0x34]
str r1, [r0]
mov r0, ip
adds r0, #0x6c
adds r0, r2, r0
ldr r1, [r3, #0x18]
str r1, [r0]
mov r0, ip
adds r0, #0x70
adds r0, r2, r0
ldr r1, [r3, #0x1c]
str r1, [r0]
mov r0, ip
adds r0, #0x74
adds r0, r2, r0
ldr r1, [r3, #0x20]
str r1, [r0]
mov r0, ip
adds r0, #0x78
adds r0, r2, r0
ldr r1, [r3, #0x24]
str r1, [r0]
mov r0, ip
adds r0, #0x90
adds r0, r2, r0
ldr r1, [r3, #0x28]
str r1, [r0]
mov r0, ip
adds r0, #0x94
adds r0, r2, r0
ldr r1, [r3, #0x2c]
str r1, [r0]
mov r0, ip
adds r0, #0x98
adds r0, r2, r0
ldr r1, [r3, #0x30]
str r1, [r0]
mov r0, ip
adds r0, #0x9c
adds r0, r2, r0
ldr r1, [r3, #0x34]
str r1, [r0]
ldr r4, _0811DB44 @ =gCurLevelInfo+0x1EC
adds r1, r2, r4
movs r0, #0
str r0, [r1]
_0811DB02:
adds r0, r6, #1
lsls r0, r0, #0x18
lsrs r6, r0, #0x18
mov r0, r8
_0811DB0A:
ldrb r0, [r0]
cmp r6, r0
blo _0811DA30
_0811DB10:
adds r0, r7, #0
bl ObjectDestroy
mov r1, sl
cmp r1, #0
bne _0811DB22
ldr r4, [sp, #8]
cmp r4, #0xff
beq _0811DB2E
_0811DB22:
mov r0, sl
ldr r1, [sp]
ldr r2, [sp, #4]
movs r3, #1
bl sub_08001678
_0811DB2E:
add sp, #0xc
pop {r3, r4, r5}
mov r8, r3
mov sb, r4
mov sl, r5
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_0811DB40: .4byte gKirbys
_0811DB44: .4byte gCurLevelInfo+0x1EC
thumb_func_start sub_0811DB48
sub_0811DB48: @ 0x0811DB48
push {r4, r5, r6, lr}
lsls r1, r1, #0x18
lsrs r5, r1, #0x18
adds r1, r0, #0
adds r1, #0x8c
ldr r4, [r1]
adds r0, #0x60
ldr r2, _0811DC38 @ =gKirbys
movs r1, #0xd4
lsls r1, r1, #1
muls r1, r5, r1
adds r1, r1, r2
adds r1, #0x60
ldrh r1, [r1]
ldrh r0, [r0]
cmp r1, r0
bne _0811DC30
ldr r3, _0811DC3C @ =gCurLevelInfo
movs r0, #0xcd
lsls r0, r0, #3
adds r2, r5, #0
muls r2, r0, r2
adds r0, r3, #0
adds r0, #0x7c
adds r6, r2, r0
ldr r1, [r4, #0x38]
ldr r0, [r6]
cmp r1, r0
bne _0811DC30
adds r0, r3, #0
adds r0, #0x80
adds r5, r2, r0
ldr r1, [r4, #0x3c]
ldr r0, [r5]
cmp r1, r0
bne _0811DC30
ldr r0, [r4, #0x18]
str r0, [r6]
ldr r0, [r4, #0x1c]
str r0, [r5]
adds r0, r3, #0
adds r0, #0x84
adds r0, r2, r0
ldr r1, [r4, #0x20]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x88
adds r0, r2, r0
ldr r1, [r4, #0x24]
str r1, [r0]
adds r0, r3, #0
adds r0, #0xa0
adds r0, r2, r0
ldr r1, [r4, #0x28]
str r1, [r0]
adds r0, r3, #0
adds r0, #0xa4
adds r0, r2, r0
ldr r1, [r4, #0x2c]
str r1, [r0]
adds r0, r3, #0
adds r0, #0xa8
adds r0, r2, r0
ldr r1, [r4, #0x30]
str r1, [r0]
adds r0, r3, #0
adds r0, #0xac
adds r0, r2, r0
ldr r1, [r4, #0x34]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x6c
adds r0, r2, r0
ldr r1, [r4, #0x18]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x70
adds r0, r2, r0
ldr r1, [r4, #0x1c]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x74
adds r0, r2, r0
ldr r1, [r4, #0x20]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x78
adds r0, r2, r0
ldr r1, [r4, #0x24]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x90
adds r0, r2, r0
ldr r1, [r4, #0x28]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x94
adds r0, r2, r0
ldr r1, [r4, #0x2c]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x98
adds r0, r2, r0
ldr r1, [r4, #0x30]
str r1, [r0]
adds r0, r3, #0
adds r0, #0x9c
adds r0, r2, r0
ldr r1, [r4, #0x34]
str r1, [r0]
movs r1, #0xf6
lsls r1, r1, #1
adds r0, r3, r1
adds r0, r2, r0
movs r1, #0
str r1, [r0]
_0811DC30:
pop {r4, r5, r6}
pop {r0}
bx r0
.align 2, 0
_0811DC38: .4byte gKirbys
_0811DC3C: .4byte gCurLevelInfo

View File

@ -29,6 +29,3 @@ gUnk_08357C54:: @ 08357C54
gUnk_08357C58:: @ 08357C58
.incbin "baserom.gba", 0x357C58, 0x0000004
gUnk_08357C5C:: @ 08357C5C
.incbin "baserom.gba", 0x357C5C, 0x0000004

View File

@ -182,7 +182,7 @@ void sub_080362A4(void);
void sub_08036314(struct ObjectBase *);
void sub_08036378(void);
u8 sub_0803925C(struct ObjectBase*, struct ObjectBase*);
u8 sub_08039430(struct Object2 *, s32, s32, s32, s16, u16, u16);
u8 sub_08039430(struct ObjectBase *, s32, s32, s32, s16, u16, u16);
bool32 sub_080395D4(void);
void sub_08039600(u16);
void sub_08039670(void);

View File

@ -5,8 +5,8 @@
#include "task.h"
void *CreateLavaWall(struct Object *, u8);
void sub_0811C758(struct Object2* arg0);
void sub_0811C758(struct Object2 *);
void sub_0811D9AC(struct Task *);
extern const struct Unk_02021590 gUnk_08357C5C[];
#endif

View File

@ -3,9 +3,39 @@
#include "data.h"
#include "global.h"
#include "object.h"
struct Unk_0811C9D4_0 {
u32 unk0;
u32 unk4;
s32 unk8;
s32 unkC;
s32 unk10;
s32 unk14;
s32 unk18;
s32 unk1C;
s32 unk20;
s32 unk24;
s32 unk28;
s32 unk2C;
s32 unk30;
s32 unk34;
s32 unk38;
s32 unk3C;
s32 filler40;
}; /* size = 0x44 */
struct Unk_0811C9D4 {
struct Unk_0811C9D4_0 unk0;
u16 unk44;
s8 unk46;
u16 unk48;
s8 unk4A;
s32 unk4C;
s32 unk50;
}; /* size = 0x54 */
void* CreateScrollLock(struct Object* arg0, u8 arg1);
void sub_0811C9D4(struct Object2 *);
extern const struct Unk_02021590 gUnk_08357C60[];

View File

@ -340,7 +340,8 @@ SECTIONS {
src/destroyable_rock_block.o(.text);
asm/code_0811C29C.o(.text);
src/lava_wall.o(.text);
asm/lava_wall.o(.text);
src/scroll_lock_2.o(.text);
asm/scroll_lock.o(.text);
src/scroll_lock.o(.text);
src/cannon_fuse.o(.text);
asm/star_stone_block.o(.text);
@ -485,6 +486,7 @@ SECTIONS {
src/fire.o(.rodata);
src/mirror_door.o(.rodata);
data/data_20.o(.rodata);
src/lava_wall.o(.rodata);
src/scroll_lock.o(.rodata);
src/cannon_fuse.o(.rodata);
data/data_19.o(.rodata);

View File

@ -219,7 +219,7 @@ static void sub_080C939C(struct Object2 *batafire)
&& batafire->base.roomId == batafire->kirby3->base.base.base.roomId)
{
if (sub_08039430(&batafire->kirby3->base.base,
if (sub_08039430(&batafire->kirby3->base.base.base,
batafire->base.x, batafire->base.y,
batafire->object->unk1A, batafire->object->unk1C,
batafire->object->unk1E, batafire->object->unk20))

View File

@ -315,7 +315,7 @@ static void sub_080BD2B4(struct Object2* arg0) {
if (arg0->unk83 == 2) {
if (++arg0->base.counter > 0x14) {
if (arg0->object->unk1A != 0 || arg0->object->unk1C != 0 || arg0->object->unk1E != 0 || arg0->object->unk20 != 0) {
if (sub_08039430(&arg0->kirby3->base.base, arg0->base.x, arg0->base.y, arg0->object->unk1A, arg0->object->unk1C, arg0->object->unk1E, arg0->object->unk20) != 0) {
if (sub_08039430(&arg0->kirby3->base.base.base, arg0->base.x, arg0->base.y, arg0->object->unk1A, arg0->object->unk1C, arg0->object->unk1E, arg0->object->unk20) != 0) {
arg0->unk83 = 3;
}
}

View File

@ -156,7 +156,7 @@ static void sub_080D7A6C(struct Object2 *bombar)
bombar->base.flags |= 4;
if (!(bombar->kirby3->base.base.base.unkC & 0x8000)
&& bombar->base.roomId == bombar->kirby3->base.base.base.roomId
&& sub_08039430(&bombar->kirby3->base.base,
&& sub_08039430(&bombar->kirby3->base.base.base,
bombar->base.x, bombar->base.y,
bombar->object->unk1A, bombar->object->unk1C,
bombar->object->unk1E, bombar->object->unk20))

View File

@ -127,7 +127,7 @@ static void sub_080CF68C(struct Object2 *arg0) {
else {
arg0->base.flags &= ~1;
}
if (sub_08039430(&arg0->kirby3->base.base, arg0->object->x * 0x100, arg0->object->y * 0x100, arg0->object->unk1A, arg0->object->unk1C, arg0->object->unk1E, arg0->object->unk20)) {
if (sub_08039430(&arg0->kirby3->base.base.base, arg0->object->x * 0x100, arg0->object->y * 0x100, arg0->object->unk1A, arg0->object->unk1C, arg0->object->unk1E, arg0->object->unk20)) {
Macro_081003EC(arg0, &arg0->kirby3->base.base.base);
arg0->base.flags &= ~0x200;
sub_080CF898(arg0);

View File

@ -195,7 +195,7 @@ static void sub_080C72CC(struct Object2 *boxBoxer)
boxBoxer->base.flags |= 1;
else
boxBoxer->base.flags &= ~1;
if (sub_08039430(&boxBoxer->kirby3->base.base,
if (sub_08039430(&boxBoxer->kirby3->base.base.base,
boxBoxer->object->x * 0x100, boxBoxer->object->y * 0x100,
boxBoxer->object->unk1A, boxBoxer->object->unk1C,
boxBoxer->object->unk1E, boxBoxer->object->unk20))

View File

@ -124,7 +124,7 @@ static void sub_080D571C(struct Boxy *boxy)
boxy->obj2.base.flags |= 1;
else
boxy->obj2.base.flags &= ~1;
if (sub_08039430(&boxy->obj2.kirby3->base.base,
if (sub_08039430(&boxy->obj2.kirby3->base.base.base,
boxy->obj2.object->x * 0x100, boxy->obj2.object->y * 0x100,
boxy->obj2.object->unk1A, boxy->obj2.object->unk1C,
boxy->obj2.object->unk1E, boxy->obj2.object->unk20))

View File

@ -188,7 +188,7 @@ static void sub_080DF4C0(struct CrazyHand *ch)
ch->obj2.base.flags |= 4;
if (!(ch->obj2.kirby3->base.base.base.unkC & 0x8000)
&& ch->obj2.base.roomId == ch->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&ch->obj2.kirby3->base.base,
&& sub_08039430(&ch->obj2.kirby3->base.base.base,
ch->obj2.base.x, ch->obj2.base.y,
ch->obj2.object->unk1A, ch->obj2.object->unk1C,
ch->obj2.object->unk1E, ch->obj2.object->unk20))

View File

@ -208,7 +208,7 @@ static void sub_080F5974(struct DarkMetaKnight *dmk)
dmk->obj2.base.flags |= 4;
if (!(dmk->obj2.kirby3->base.base.base.unkC & 0x8000)
&& dmk->obj2.base.roomId == dmk->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&dmk->obj2.kirby3->base.base, dmk->obj2.base.x, dmk->obj2.base.y, dmk->obj2.object->unk1A, dmk->obj2.object->unk1C, dmk->obj2.object->unk1E, dmk->obj2.object->unk20))
&& sub_08039430(&dmk->obj2.kirby3->base.base.base, dmk->obj2.base.x, dmk->obj2.base.y, dmk->obj2.object->unk1A, dmk->obj2.object->unk1C, dmk->obj2.object->unk1E, dmk->obj2.object->unk20))
{
Macro_081003EC(&dmk->obj2, &dmk->obj2.kirby3->base.base.base);
if (dmk->obj2.object->subtype1)

View File

@ -711,7 +711,7 @@ static void sub_081003EC(struct DarkMindForm1 *r5)
r5->unk0.base.flags |= 4;
if (!(r6->base.base.base.unkC & 0x8000)
&& r5->unk0.base.roomId == r6->base.base.base.roomId
&& sub_08039430(&r6->base.base,
&& sub_08039430(&r6->base.base.base,
r5->unk0.base.x,
r5->unk0.base.y,
r5->unk0.object->unk1A,
@ -6011,7 +6011,7 @@ static void sub_0810BD28(struct DarkMindForm2 *r5)
r5->unk0.base.flags |= 4;
if (!(r5->unk0.kirby3->base.base.base.unkC & 0x8000)
&& r5->unk0.base.roomId == r5->unk0.kirby3->base.base.base.roomId
&& sub_08039430(&r5->unk0.kirby3->base.base,
&& sub_08039430(&r5->unk0.kirby3->base.base.base,
r5->unk0.base.x, r5->unk0.base.y,
r5->unk0.object->unk1A, r5->unk0.object->unk1C,
r5->unk0.object->unk1E, r5->unk0.object->unk20))
@ -10543,7 +10543,7 @@ static void sub_08114B28(struct DarkMindTrigger *r5)
r5->unk0.kirby3 = sub_0803D368(&r5->unk0.base);
r5->unk0.base.flags |= 4;
if (!(r5->unk0.kirby3->base.base.base.unkC & 0x8000) && r5->unk0.base.roomId == r5->unk0.kirby3->base.base.base.roomId
&& sub_08039430(&r5->unk0.kirby3->base.base,
&& sub_08039430(&r5->unk0.kirby3->base.base.base,
r5->unk0.base.x, r5->unk0.base.y,
r5->unk0.object->unk1A, r5->unk0.object->unk1C,
r5->unk0.object->unk1E, r5->unk0.object->unk20))

View File

@ -213,7 +213,7 @@ static void sub_080E3FFC(struct Gobbler *gobbler)
gobbler->obj2.kirby3 = sub_0803D368(&gobbler->obj2.base);
if (!(gobbler->obj2.kirby3->base.base.base.unkC & 0x8000)
&& gobbler->obj2.base.roomId == gobbler->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&gobbler->obj2.kirby3->base.base, gobbler->obj2.base.x, gobbler->obj2.base.y, gobbler->obj2.object->unk1A, gobbler->obj2.object->unk1C, gobbler->obj2.object->unk1E, gobbler->obj2.object->unk20))
&& sub_08039430(&gobbler->obj2.kirby3->base.base.base, gobbler->obj2.base.x, gobbler->obj2.base.y, gobbler->obj2.object->unk1A, gobbler->obj2.object->unk1C, gobbler->obj2.object->unk1E, gobbler->obj2.object->unk20))
{
Macro_081003EC(&gobbler->obj2, &gobbler->obj2.kirby3->base.base.base);
sub_080E43B4(gobbler);

View File

@ -272,14 +272,14 @@ static void sub_080C57D8(struct Object2 *golem)
|| golem->object->unk1E
|| golem->object->unk20)
{
if (sub_08039430(&golem->kirby3->base.base, golem->base.x, golem->base.y,
if (sub_08039430(&golem->kirby3->base.base.base, golem->base.x, golem->base.y,
golem->object->unk1A, golem->object->unk1C,
golem->object->unk1E, golem->object->unk20))
golem->base.flags &= ~8;
}
else
{
if (sub_08039430(&golem->kirby3->base.base, golem->base.x, golem->base.y, -0x28, -0x28, 0x50, 0x3C))
if (sub_08039430(&golem->kirby3->base.base.base, golem->base.x, golem->base.y, -0x28, -0x28, 0x50, 0x3C))
golem->base.flags &= ~8;
}
}

View File

@ -88,7 +88,7 @@ static void sub_080DA2BC(struct KingGolem *kg)
kg->obj2.kirby3 = sub_0803D368(&kg->obj2.base);
if (!(kg->obj2.kirby3->base.base.base.unkC & 0x8000)
&& kg->obj2.base.roomId == kg->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&kg->obj2.kirby3->base.base,
&& sub_08039430(&kg->obj2.kirby3->base.base.base,
kg->obj2.base.x, kg->obj2.base.y,
kg->obj2.object->unk1A, kg->obj2.object->unk1C,
kg->obj2.object->unk1E, kg->obj2.object->unk20))

View File

@ -285,7 +285,7 @@ static void sub_080DBA1C(struct Kracko *kracko)
kracko->obj2.base.flags |= 4;
if (!(kracko->obj2.kirby3->base.base.base.unkC & 0x8000)
&& kracko->obj2.base.roomId == kracko->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&kracko->obj2.kirby3->base.base,
&& sub_08039430(&kracko->obj2.kirby3->base.base.base,
kracko->obj2.base.x, kracko->obj2.base.y,
kracko->obj2.object->unk1A, kracko->obj2.object->unk1C,
kracko->obj2.object->unk1E, kracko->obj2.object->unk20))

View File

@ -3,8 +3,12 @@
#include "kirby.h"
#include "object.h"
void sub_0811C5D8(struct Object2* arg0);
void sub_0811C768(struct Task *);
static void sub_0811C5D8(struct Object2 *);
static void sub_0811C768(struct Task *);
const struct Unk_02021590 gUnk_08357C5C[] = {
{ 0x2D1, 2, 0 },
};
void *CreateLavaWall(struct Object *template, u8 a2)
{
@ -50,42 +54,43 @@ void *CreateLavaWall(struct Object *template, u8 a2)
return lavaWall;
}
void sub_0811C5D8(struct Object2* arg0) {
if (arg0->object->unk22 & 1) {
if (*sub_08002888(0, arg0->object->unk4, gCurLevelInfo[arg0->base.unk56].unk65E) == 0) {
arg0->base.flags |= 0x1000;
static void sub_0811C5D8(struct Object2 *lavaWall) {
if (lavaWall->object->unk22 & 1) {
if (*sub_08002888(0, lavaWall->object->unk4, gCurLevelInfo[lavaWall->base.unk56].unk65E) == 0) {
lavaWall->base.flags |= 0x1000;
}
else {
if (arg0->object->unk22 & 2) {
Macro_080A4728(arg0);
if (lavaWall->object->unk22 & 2) {
Macro_080A4728(lavaWall);
}
Macro_080A4728(arg0);
Macro_080A4728(lavaWall);
}
}
else {
if (arg0->object->unk22 & 2) {
Macro_080A4728(arg0);
if (lavaWall->object->unk22 & 2) {
Macro_080A4728(lavaWall);
}
Macro_080A4728(arg0);
Macro_080A4728(lavaWall);
}
++arg0->base.counter;
++lavaWall->base.counter;
}
void sub_0811C758(struct Object2* arg0) {
arg0->base.counter = 0;
arg0->unk78 = sub_0811C5D8;
void sub_0811C758(struct Object2 *lavaWall) {
lavaWall->base.counter = 0;
lavaWall->unk78 = sub_0811C5D8;
}
void sub_0811C768(struct Task* arg0) {
struct Object2 *obj;
static void sub_0811C768(struct Task* t) {
struct Object2 *lavaWall;
u8 unk3, unk56, r4;
u32 unk2;
obj = TaskGetStructPtr(arg0);
unk56 = obj->base.unk56;
unk2 = obj->object->unk2;
unk3 = obj->object->unk3;
lavaWall = TaskGetStructPtr(t);
unk56 = lavaWall->base.unk56;
unk2 = lavaWall->object->unk2;
unk3 = lavaWall->object->unk3;
r4 = gCurLevelInfo[unk56].unk65E;
ObjectDestroy(arg0);
ObjectDestroy(t);
if (unk2 != 0 || unk56 != 0xff) {
sub_08001678(unk2, unk3, r4, 1);
}

View File

@ -157,7 +157,7 @@ static void sub_080D1780(struct Object2 *mh)
mh->base.flags |= 4;
if (!(mh->kirby3->base.base.base.unkC & 0x8000)
&& mh->base.roomId == mh->kirby3->base.base.base.roomId
&& sub_08039430(&mh->kirby3->base.base,
&& sub_08039430(&mh->kirby3->base.base.base,
mh->base.x, mh->base.y,
mh->object->unk1A, mh->object->unk1C,
mh->object->unk1E, mh->object->unk20))

View File

@ -304,7 +304,7 @@ static void sub_080EDAD0(struct MegaTitan *mt)
mt->obj2.base.flags |= 4;
if (!(mt->obj2.kirby3->base.base.base.unkC & 0x8000)
&& mt->obj2.base.roomId == mt->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&mt->obj2.kirby3->base.base,
&& sub_08039430(&mt->obj2.kirby3->base.base.base,
mt->obj2.base.x, mt->obj2.base.y,
mt->obj2.object->unk1A, mt->obj2.object->unk1C,
mt->obj2.object->unk1E, mt->obj2.object->unk20))

View File

@ -153,7 +153,7 @@ static void sub_080EB2C0(struct Moley *moley)
moley->obj2.base.flags |= 4;
if (!(moley->obj2.kirby3->base.base.base.unkC & 0x8000)
&& moley->obj2.base.roomId == moley->obj2.kirby3->base.base.base.roomId
&& sub_08039430(&moley->obj2.kirby3->base.base,
&& sub_08039430(&moley->obj2.kirby3->base.base.base,
moley->obj2.base.x, moley->obj2.base.y,
moley->obj2.object->unk1A, moley->obj2.object->unk1C,
moley->obj2.object->unk1E, moley->obj2.object->unk20))

View File

@ -168,7 +168,7 @@ static void sub_080CB7E8(struct Object2 *mf)
mf->base.flags |= 1;
else
mf->base.flags &= ~1;
if (sub_08039430(&mf->kirby3->base.base,
if (sub_08039430(&mf->kirby3->base.base.base,
mf->object->x * 0x100, mf->object->y * 0x100,
mf->object->unk1A, mf->object->unk1C,
mf->object->unk1E, mf->object->unk20))

View File

@ -184,7 +184,7 @@ static void sub_080CD6C0(struct Object2 *phanPhan)
phanPhan->base.flags |= 1;
else
phanPhan->base.flags &= ~1;
if (sub_08039430(&phanPhan->kirby3->base.base,
if (sub_08039430(&phanPhan->kirby3->base.base.base,
phanPhan->object->x * 0x100, phanPhan->object->y * 0x100,
phanPhan->object->unk1A, phanPhan->object->unk1C,
phanPhan->object->unk1E, phanPhan->object->unk20))

View File

@ -1,12 +1,16 @@
#include "scroll_lock.h"
#include "object.h"
#include "kirby.h"
#include "functions.h"
#include "lava_wall.h"
void sub_0811D9AC(struct Task *);
const struct Unk_02021590 gUnk_08357C60[] = {
{ 0x2D1, 2, 0 },
};
// TODO: merge with scroll_lock_2.c
void* CreateScrollLock(struct Object* arg0, u8 arg1) {
struct Object2 *obj, *obj2;
struct Task *task = TaskCreate(ObjectMain, sizeof(struct Object2), 0xff6, 0, sub_0811D9AC);

439
src/scroll_lock_2.c Normal file
View File

@ -0,0 +1,439 @@
#include "malloc_ewram.h"
#include "scroll_lock.h"
#include "object.h"
#include "kirby.h"
#include "functions.h"
void sub_0811C8BC(struct Unk_0811C9D4_0 *, u8, u16);
void sub_0811CB44(struct Object2 *);
void sub_0811CBB8(struct Object2 *);
void sub_0811CD1C(struct Object2 *);
void sub_0811CD90(struct Object2 *);
void sub_0811CEF4(struct Object2 *);
void sub_0811D158(struct Object2 *);
void sub_0811D508(struct Object2 *);
void sub_0811D68C(struct Object2 *);
void sub_0811DB48(struct Object2 *, s32);
void sub_0811C7D0(struct Unk_0811C9D4_0 *a1, u8 a2, u16 a3)
{
gCurLevelInfo[a2].unk7C = a1->unk8;
gCurLevelInfo[a2].unk84 = a1->unk10;
gCurLevelInfo[a2].unk80 = a1->unkC;
gCurLevelInfo[a2].unk88 = a1->unk14;
gCurLevelInfo[a2].unkA0 = a1->unk8;
gCurLevelInfo[a2].unkA4 = a1->unkC;
gCurLevelInfo[a2].unkA8 = a1->unk10;
gCurLevelInfo[a2].unkAC = a1->unk14;
if (a3 & 0x10)
{
gCurLevelInfo[a2].unk6C = a1->unk8;
gCurLevelInfo[a2].unk74 = a1->unk10;
gCurLevelInfo[a2].unk70 = a1->unkC;
gCurLevelInfo[a2].unk78 = a1->unk14;
if (!(a1->unk4 & (0x10 << a2)))
{
a1->unk4 |= 0x10 << a2;
gCurLevelInfo[a2].unk90 = a1->unk8;
gCurLevelInfo[a2].unk94 = a1->unkC;
gCurLevelInfo[a2].unk98 = a1->unk10;
gCurLevelInfo[a2].unk9C = a1->unk14;
}
}
else
sub_0811C8BC(a1, a2, a3);
}
void sub_0811C8BC(struct Unk_0811C9D4_0 *a1, u8 a2, u16 a3 __attribute__((unused)))
{
if (!(a1->unk4 & (0x10 << a2))) {
a1->unk4 |= 0x10 << a2;
if (a1->unk10 - a1->unk8 >= 0xF000)
{
if (gCurLevelInfo[a2].unk6C <= gCurLevelInfo[a2].unkC - 0x800)
gCurLevelInfo[a2].unk6C = gCurLevelInfo[a2].unkC - 0x800;
if (gCurLevelInfo[a2].unk74 >= gCurLevelInfo[a2].unkC + 0xF800)
gCurLevelInfo[a2].unk74 = gCurLevelInfo[a2].unkC + 0xF800;
}
if (a1->unk14 - a1->unkC >= 0xA000)
{
if (gCurLevelInfo[a2].unk70 <= gCurLevelInfo[a2].unk10 - 0x800)
gCurLevelInfo[a2].unk70 = gCurLevelInfo[a2].unk10 - 0x800;
if (gCurLevelInfo[a2].unk78 >= gCurLevelInfo[a2].unk10 + 0xA800)
gCurLevelInfo[a2].unk78 = gCurLevelInfo[a2].unk10 + 0xA800;
}
if (gCurLevelInfo[a2].unk90 <= gCurLevelInfo[a2].unkC - 0x800)
gCurLevelInfo[a2].unk90 = gCurLevelInfo[a2].unkC - 0x800;
if (gCurLevelInfo[a2].unk94 <= gCurLevelInfo[a2].unk10 - 0x800)
gCurLevelInfo[a2].unk94 = gCurLevelInfo[a2].unk10 - 0x800;
if (gCurLevelInfo[a2].unk98 >= gCurLevelInfo[a2].unkC + 0xF800)
gCurLevelInfo[a2].unk98 = gCurLevelInfo[a2].unkC + 0xF800;
if (gCurLevelInfo[a2].unk9C >= gCurLevelInfo[a2].unk10 + 0xF800)
gCurLevelInfo[a2].unk9C = gCurLevelInfo[a2].unk10 + 0xF800;
}
}
void sub_0811C9D4(struct Object2 *scrollLock)
{
u8 unk56;
struct Unk_0811C9D4_0 *p;
scrollLock->base.counter = 0;
switch (scrollLock->object->unk22 & 3)
{
case 0:
scrollLock->unk8C = EwramMalloc(sizeof(struct Unk_0811C9D4_0));
CpuFill32(0, scrollLock->unk8C, sizeof(struct Unk_0811C9D4_0));
((struct Unk_0811C9D4_0 *)scrollLock->unk8C)->unk0 = 1;
break;
case 1:
scrollLock->unk8C = EwramMalloc(sizeof(struct Unk_0811C9D4));
CpuFill32(0, scrollLock->unk8C, sizeof(struct Unk_0811C9D4));
((struct Unk_0811C9D4 *)scrollLock->unk8C)->unk0.unk0 = 1; // 2?
break;
case 2:
scrollLock->unk8C = EwramMalloc(sizeof(struct Unk_0811C9D4_0));
CpuFill32(0, scrollLock->unk8C, sizeof(struct Unk_0811C9D4_0));
((struct Unk_0811C9D4_0 *)scrollLock->unk8C)->unk0 = 3;
break;
case 3:
scrollLock->unk8C = EwramMalloc(sizeof(struct Unk_0811C9D4));
CpuFill32(0, scrollLock->unk8C, sizeof(struct Unk_0811C9D4));
((struct Unk_0811C9D4 *)scrollLock->unk8C)->unk0.unk0 = 4;
break;
}
unk56 = scrollLock->base.unk56;
p = (struct Unk_0811C9D4_0 *)scrollLock->unk8C;
p->unk18 = gCurLevelInfo[unk56].unk7C;
p->unk1C = gCurLevelInfo[unk56].unk80;
p->unk20 = gCurLevelInfo[unk56].unk84;
p->unk24 = gCurLevelInfo[unk56].unk88;
p->unk28 = gCurLevelInfo[unk56].unkA0;
p->unk2C = gCurLevelInfo[unk56].unkA4;
p->unk30 = gCurLevelInfo[unk56].unkA8;
p->unk34 = gCurLevelInfo[unk56].unkAC;
switch (p->unk0)
{
case 1:
sub_0811CB44(scrollLock);
break;
case 2:
sub_0811CBB8(scrollLock);
break;
case 3:
sub_0811CD1C(scrollLock);
break;
case 4:
sub_0811CD90(scrollLock);
break;
}
}
void sub_0811CB44(struct Object2 *scrollLock)
{
struct Unk_0811C9D4_0 *p = scrollLock->unk8C;
p->unk8 = (scrollLock->object->unk14 & 0xFF00) << 4;
p->unkC = (scrollLock->object->unk14 & 0xFF) << 12;
p->unk10 = p->unk8 + ((scrollLock->object->unk12 & 0xFF00) << 4);
p->unk14 = p->unkC + ((scrollLock->object->unk12 & 0xFF) << 12);
if (scrollLock->object->unk22 & 4)
{
p->unk8 += 0x800;
p->unkC += 0x800;
p->unk10 += 0x800;
p->unk14 += 0x800;
}
scrollLock->unk78 = sub_0811CEF4;
p->unk38 = p->unk8;
p->unk3C = p->unkC;
}
void sub_0811CBB8(struct Object2 *scrollLock)
{
struct Unk_0811C9D4 *p = scrollLock->unk8C;
p->unk0.unk8 = (scrollLock->object->unk14 & 0xFF00) << 4;
p->unk0.unkC = (scrollLock->object->unk14 & 0xFF) << 12;
p->unk0.unk10 = p->unk0.unk8 + ((scrollLock->object->unk12 & 0xFF00) << 4);
p->unk0.unk14 = p->unk0.unkC + ((scrollLock->object->unk12 & 0xFF) << 12);
#ifndef NONMATCHING
asm(""::"r"(gCurLevelInfo));
asm(""::"r"(&scrollLock->base.unk56));
#endif
p->unk44 = (scrollLock->object->unk18 & 0xFF00) >> 4;
p->unk46 = scrollLock->object->unk18;
p->unk48 = (scrollLock->object->unk16 & 0xFF00) >> 4;
p->unk4A = scrollLock->object->unk16;
if (p->unk46 >= 0)
{
p->unk4C = p->unk0.unk8 + p->unk0.unk10 - p->unk0.unk8 + (p->unk44 << 8);
if (p->unk4C > (gCurLevelInfo[scrollLock->base.unk56].roomWidth << 8) - 0x800)
p->unk4C = (gCurLevelInfo[scrollLock->base.unk56].roomWidth << 8) - 0x800;
}
else
{
p->unk4C = p->unk0.unk8 - (p->unk44 << 8);
if (p->unk4C < 0x800)
p->unk4C = 0x800;
}
if (p->unk4A >= 0)
{
p->unk50 = p->unk0.unkC + p->unk0.unk14 - p->unk0.unkC + (p->unk48 << 8);
if (p->unk50 > (gCurLevelInfo[scrollLock->base.unk56].roomHeight << 8) - 0x1800)
p->unk50 = (gCurLevelInfo[scrollLock->base.unk56].roomHeight << 8) - 0x1800;
}
else
{
p->unk50 = p->unk0.unkC + (p->unk48 << 8);
if (p->unk50 < 0x800)
p->unk50 = 0x800;
}
scrollLock->unk78 = sub_0811D158;
p->unk0.unk38 = p->unk0.unk8;
p->unk0.unk3C = p->unk0.unkC;
}
void sub_0811CD1C(struct Object2 *scrollLock)
{
struct Unk_0811C9D4_0 *p = scrollLock->unk8C;
p->unk8 = (scrollLock->object->unk14 & 0xFF00) << 4;
p->unkC = (scrollLock->object->unk14 & 0xFF) << 12;
p->unk10 = p->unk8 + ((scrollLock->object->unk12 & 0xFF00) << 4);
p->unk14 = p->unkC + ((scrollLock->object->unk12 & 0xFF) << 12);
if (scrollLock->object->unk22 & 4)
{
p->unk8 += 0x800;
p->unkC += 0x800;
p->unk10 += 0x800;
p->unk14 += 0x800;
}
scrollLock->unk78 = sub_0811D508;
p->unk38 = p->unk8;
p->unk3C = p->unkC;
}
void sub_0811CD90(struct Object2 *scrollLock)
{
struct Unk_0811C9D4 *p = scrollLock->unk8C;
p->unk0.unk8 = (scrollLock->object->unk14 & 0xFF00) << 4;
p->unk0.unkC = (scrollLock->object->unk14 & 0xFF) << 12;
p->unk0.unk10 = p->unk0.unk8 + ((scrollLock->object->unk12 & 0xFF00) << 4);
p->unk0.unk14 = p->unk0.unkC + ((scrollLock->object->unk12 & 0xFF) << 12);
#ifndef NONMATCHING
asm(""::"r"(gCurLevelInfo));
asm(""::"r"(&scrollLock->base.unk56));
#endif
p->unk44 = (scrollLock->object->unk18 & 0xFF00) >> 4;
p->unk46 = scrollLock->object->unk18;
p->unk48 = (scrollLock->object->unk16 & 0xFF00) >> 4;
p->unk4A = scrollLock->object->unk16;
if (p->unk46 >= 0)
{
p->unk4C = p->unk0.unk8 + p->unk0.unk10 - p->unk0.unk8 + (p->unk44 << 8);
if (p->unk4C > (gCurLevelInfo[scrollLock->base.unk56].roomWidth << 8) - 0x800)
p->unk4C = (gCurLevelInfo[scrollLock->base.unk56].roomWidth << 8) - 0x800;
}
else
{
p->unk4C = p->unk0.unk8 - (p->unk44 << 8);
if (p->unk4C < 0x800)
p->unk4C = 0x800;
}
if (p->unk4A >= 0)
{
p->unk50 = p->unk0.unkC + p->unk0.unk14 - p->unk0.unkC + (p->unk48 << 8);
if (p->unk50 > (gCurLevelInfo[scrollLock->base.unk56].roomHeight << 8) - 0x1800)
p->unk50 = (gCurLevelInfo[scrollLock->base.unk56].roomHeight << 8) - 0x1800;
}
else
{
p->unk50 = p->unk0.unkC + (p->unk48 << 8);
if (p->unk50 < 0x800)
p->unk50 = 0x800;
}
scrollLock->unk78 = sub_0811D68C;
p->unk0.unk38 = p->unk0.unk8;
p->unk0.unk3C = p->unk0.unkC;
}
void sub_0811CEF4(struct Object2 *scrollLock)
{
struct Unk_0811C9D4_0 *p = scrollLock->unk8C;
s8 i;
u16 roomId = scrollLock->base.roomId;
if (gKirbys[0].base.base.base.roomId == roomId
&& gKirbys[1].base.base.base.roomId == gKirbys[0].base.base.base.roomId
&& gKirbys[2].base.base.base.roomId == gKirbys[1].base.base.base.roomId
&& gKirbys[3].base.base.base.roomId == gKirbys[2].base.base.base.roomId)
{
if (sub_08039430(&gKirbys[0].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[1].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[2].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[3].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20))
{
if (!(p->unk4 & 1))
{
p->unk4 |= 1;
gCurLevelInfo[0].unk1EC = 0;
}
if (!(p->unk4 & 2))
{
p->unk4 |= 2;
gCurLevelInfo[1].unk1EC = 0;
}
if (!(p->unk4 & 4))
{
p->unk4 |= 4;
gCurLevelInfo[2].unk1EC = 0;
}
if (!(p->unk4 & 8))
{
p->unk4 |= 8;
gCurLevelInfo[3].unk1EC = 0;
}
for (i = 0; i < gUnk_0203AD44; ++i)
sub_0811C7D0(p, gKirbys[i].base.base.base.unk56, scrollLock->object->unk22);
}
else
p->unk4 &= ~0xF;
if (gKirbys[i].hp <= 0) // TODO: UB: uninitialized use
sub_0811DB48(scrollLock, i);
if (scrollLock->object->unk4)
{
u32 *pointer = sub_08002888(0, scrollLock->object->unk4, gCurLevelInfo[scrollLock->base.unk56].unk65E);
if (*pointer)
{
--*pointer;
scrollLock->base.flags |= 0x1000;
}
}
}
else
p->unk4 &= ~0xF;
++scrollLock->base.counter;
}
void sub_0811D158(struct Object2 *scrollLock)
{
struct Unk_0811C9D4 *p = scrollLock->unk8C;
u8 i;
u16 roomId = scrollLock->base.roomId;
u8 unk56 = scrollLock->base.unk56;
if (!(p->unk0.unk4 & 0x10000000))
{
if (gKirbys[0].base.base.base.roomId == roomId
&& gKirbys[1].base.base.base.roomId == gKirbys[0].base.base.base.roomId
&& gKirbys[2].base.base.base.roomId == gKirbys[1].base.base.base.roomId
&& gKirbys[3].base.base.base.roomId == gKirbys[2].base.base.base.roomId)
{
if (sub_08039430(&gKirbys[0].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[1].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[2].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20)
&& sub_08039430(&gKirbys[3].base.base.base, scrollLock->base.x, scrollLock->base.y, scrollLock->object->unk1A, scrollLock->object->unk1C, scrollLock->object->unk1E, scrollLock->object->unk20))
{
if (!(p->unk0.unk4 & 1))
{
p->unk0.unk4 |= 1;
gCurLevelInfo[0].unk1EC = 0;
}
if (!(p->unk0.unk4 & 2))
{
p->unk0.unk4 |= 2;
gCurLevelInfo[1].unk1EC = 0;
}
if (!(p->unk0.unk4 & 4))
{
p->unk0.unk4 |= 4;
gCurLevelInfo[2].unk1EC = 0;
}
if (!(p->unk0.unk4 & 8))
{
p->unk0.unk4 |= 8;
gCurLevelInfo[3].unk1EC = 0;
}
for (i = 0; i < gUnk_0203AD44; ++i)
sub_0811C7D0(&p->unk0, gKirbys[i].base.base.base.unk56, scrollLock->object->unk22);
p->unk0.unk4 |= 0x10000000;
}
else
p->unk0.unk4 &= ~0xF;
if (gKirbys[i].hp <= 0) // TODO: UB: uninitialized use
sub_0811DB48(scrollLock, i);
if (scrollLock->object->unk4)
{
u32 *pointer = sub_08002888(0, scrollLock->object->unk4, gCurLevelInfo[scrollLock->base.unk56].unk65E);
if (*pointer)
{
--*pointer;
scrollLock->base.flags |= 0x1000;
}
}
}
else
p->unk0.unk4 &= ~0xF;
}
else
{
if (p->unk46)
{
gCurLevelInfo[unk56].unk7C += p->unk46;
gCurLevelInfo[unk56].unk84 += p->unk46;
gCurLevelInfo[unk56].unkA0 += p->unk46;
gCurLevelInfo[unk56].unkA8 += p->unk46;
if (p->unk46)
{
if (p->unk46 > 0)
{
if (gCurLevelInfo[unk56].unk84 > p->unk4C)
p->unk46 = 0;
}
else
{
if (gCurLevelInfo[unk56].unk7C < 0x800)
p->unk46 = 0;
}
}
}
if (p->unk4A)
{
gCurLevelInfo[unk56].unk80 += p->unk4A;
gCurLevelInfo[unk56].unk88 += p->unk4A;
gCurLevelInfo[unk56].unkA4 += p->unk4A;
gCurLevelInfo[unk56].unkAC += p->unk4A;
if (p->unk4A)
{
if (p->unk4A > 0)
{
if (gCurLevelInfo[unk56].unk88 > p->unk50)
p->unk4A = 0;
}
else
{
if (gCurLevelInfo[unk56].unk80 < 0x800)
p->unk4A = 0;
}
}
}
if (!p->unk46 && !p->unk4A)
{
if (scrollLock->object->unk4)
{
u32 *pointer = sub_08002888(0, scrollLock->object->unk4, gCurLevelInfo[scrollLock->base.unk56].unk65E);
if (*pointer)
{
--*pointer;
scrollLock->base.flags |= 0x1000;
}
}
}
}
++scrollLock->base.counter;
}

View File

@ -110,7 +110,7 @@ static void sub_08023990(struct Object2 *sk)
sk->base.flags |= 4;
if (!(sk->kirby3->base.base.base.unkC & 0x8000)
&& sk->base.roomId == sk->kirby3->base.base.base.roomId
&& sub_08039430(&sk->kirby3->base.base,
&& sub_08039430(&sk->kirby3->base.base.base,
sk->base.x, sk->base.y,
sk->object->unk1A, sk->object->unk1C,
sk->object->unk1E, sk->object->unk20))

View File

@ -154,7 +154,7 @@ static void sub_080E7EBC(struct Object2 *wiz)
wiz->base.flags |= 4;
if (!(wiz->kirby3->base.base.base.unkC & 0x8000)
&& wiz->base.roomId == wiz->kirby3->base.base.base.roomId
&& sub_08039430(&wiz->kirby3->base.base,
&& sub_08039430(&wiz->kirby3->base.base.base,
wiz->base.x, wiz->base.y,
wiz->object->unk1A, wiz->object->unk1C,
wiz->object->unk1E, wiz->object->unk20))