This commit is contained in:
Seth Barberee 2021-06-28 14:28:21 -05:00
parent 7d9a587432
commit f308c79eba
17 changed files with 2506 additions and 3280 deletions

File diff suppressed because it is too large Load Diff

1333
asm/code_80869E4.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -660,276 +660,4 @@ _08017AEE:
bx r0
thumb_func_end sub_8017A1C
thumb_func_start sub_8017AF8
sub_8017AF8:
push {lr}
movs r0, 0x1
bl sub_801A6E8
cmp r0, 0x3
beq _08017B14
cmp r0, 0x3
bhi _08017B0E
cmp r0, 0x2
beq _08017B78
b _08017B82
_08017B0E:
cmp r0, 0x4
beq _08017B50
b _08017B82
_08017B14:
bl sub_801AEA8
cmp r0, 0
beq _08017B2A
movs r0, 0
bl sub_8099690
movs r0, 0x12
bl UpdateKangaskhanStorageState
b _08017B82
_08017B2A:
bl sub_801A8AC
ldr r1, _08017B48
ldr r2, [r1]
str r0, [r2, 0x10]
ldr r1, _08017B4C
ldr r1, [r1]
lsls r0, 2
adds r1, r0
ldr r0, [r1]
str r0, [r2, 0xC]
movs r0, 0xF
bl UpdateKangaskhanStorageState
b _08017B82
.align 2, 0
_08017B48: .4byte gUnknown_203B208
_08017B4C: .4byte gUnknown_203B460
_08017B50:
bl sub_801A8AC
ldr r1, _08017B70
ldr r2, [r1]
str r0, [r2, 0x10]
ldr r1, _08017B74
ldr r1, [r1]
lsls r0, 2
adds r1, r0
ldr r0, [r1]
str r0, [r2, 0xC]
movs r0, 0x10
bl UpdateKangaskhanStorageState
b _08017B82
.align 2, 0
_08017B70: .4byte gUnknown_203B208
_08017B74: .4byte gUnknown_203B460
_08017B78:
bl sub_801A928
movs r0, 0x1
bl UpdateKangaskhanStorageState
_08017B82:
pop {r0}
bx r0
thumb_func_end sub_8017AF8
thumb_func_start sub_8017B88
sub_8017B88:
push {r4,lr}
movs r0, 0x1
bl sub_801CA08
cmp r0, 0x2
beq _08017C10
cmp r0, 0x2
bhi _08017B9E
cmp r0, 0x1
beq _08017C1C
b _08017C22
_08017B9E:
cmp r0, 0x3
beq _08017BA8
cmp r0, 0x4
beq _08017BE4
b _08017C22
_08017BA8:
bl sub_801CFB8
cmp r0, 0
beq _08017BB8
movs r0, 0x1C
bl UpdateKangaskhanStorageState
b _08017C22
_08017BB8:
bl sub_801CB24
ldr r4, _08017BE0
ldr r1, [r4]
strb r0, [r1, 0x14]
ldr r1, [r4]
adds r0, r1, 0
adds r0, 0xC
ldrb r1, [r1, 0x14]
movs r2, 0
bl sub_8090A8C
ldr r1, [r4]
movs r0, 0x1
strb r0, [r1, 0xD]
movs r0, 0x19
bl UpdateKangaskhanStorageState
b _08017C22
.align 2, 0
_08017BE0: .4byte gUnknown_203B208
_08017BE4:
bl sub_801CB24
ldr r4, _08017C0C
ldr r1, [r4]
strb r0, [r1, 0x14]
ldr r1, [r4]
adds r0, r1, 0
adds r0, 0xC
ldrb r1, [r1, 0x14]
movs r2, 0
bl sub_8090A8C
ldr r1, [r4]
movs r0, 0x1
strb r0, [r1, 0xD]
movs r0, 0x1A
bl UpdateKangaskhanStorageState
b _08017C22
.align 2, 0
_08017C0C: .4byte gUnknown_203B208
_08017C10:
bl sub_801CBB8
movs r0, 0x1
bl UpdateKangaskhanStorageState
b _08017C22
_08017C1C:
movs r0, 0
bl sub_801AD34
_08017C22:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8017B88
thumb_func_start sub_8017C28
sub_8017C28:
push {r4,lr}
movs r0, 0
bl sub_801CA08
ldr r4, _08017C54
ldr r0, [r4]
adds r0, 0x58
bl sub_8012FD8
ldr r0, [r4]
adds r0, 0xA8
bl sub_8013BBC
cmp r0, 0x1
beq _08017C58
cmp r0, 0x1
bcc _08017C76
cmp r0, 0x2
beq _08017C70
cmp r0, 0x3
beq _08017C5E
b _08017C76
.align 2, 0
_08017C54: .4byte gUnknown_203B208
_08017C58:
bl sub_8017598
b _08017C76
_08017C5E:
ldr r0, [r4]
adds r1, r0, 0
adds r1, 0xA8
ldr r1, [r1]
strb r1, [r0, 0xD]
movs r0, 0x1B
bl UpdateKangaskhanStorageState
b _08017C76
_08017C70:
movs r0, 0x17
bl UpdateKangaskhanStorageState
_08017C76:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8017C28
thumb_func_start sub_8017C7C
sub_8017C7C:
push {r4,lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
bl sub_801A6E8
ldr r4, _08017CBC
ldr r0, [r4]
adds r0, 0x58
bl sub_8012FD8
lsls r0, 24
cmp r0, 0
bne _08017CAC
ldr r0, [r4]
adds r0, 0x58
mov r1, sp
bl sub_8013114
ldr r1, [sp]
cmp r1, 0x1
beq _08017CAC
ldr r0, [r4]
str r1, [r0, 0x1C]
_08017CAC:
ldr r0, [sp]
cmp r0, 0x2
beq _08017CC6
cmp r0, 0x2
bgt _08017CC0
cmp r0, 0x1
beq _08017D14
b _08017D1A
.align 2, 0
_08017CBC: .4byte gUnknown_203B208
_08017CC0:
cmp r0, 0x6
beq _08017D06
b _08017D1A
_08017CC6:
movs r0, 0
bl sub_8099690
ldr r4, _08017CE4
ldr r0, [r4]
ldrb r0, [r0, 0xE]
bl sub_8091524
lsls r0, 24
cmp r0, 0
bne _08017CE8
movs r0, 0x9
bl UpdateKangaskhanStorageState
b _08017D1A
.align 2, 0
_08017CE4: .4byte gUnknown_203B208
_08017CE8:
ldr r0, [r4]
ldr r0, [r0, 0x10]
bl sub_801ADA0
lsls r0, 24
cmp r0, 0
bne _08017CFE
movs r0, 0xA
bl UpdateKangaskhanStorageState
b _08017D1A
_08017CFE:
movs r0, 0x11
bl UpdateKangaskhanStorageState
b _08017D1A
_08017D06:
movs r0, 0
bl sub_8099690
movs r0, 0x10
bl UpdateKangaskhanStorageState
b _08017D1A
_08017D14:
movs r0, 0xE
bl UpdateKangaskhanStorageState
_08017D1A:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8017C7C
.align 2,0

View File

@ -5,409 +5,6 @@
.text
thumb_func_start sub_8017F28
sub_8017F28:
push {r4-r7,lr}
ldr r4, _08017F48
ldr r0, [r4]
adds r0, 0xF0
bl sub_8006518
ldr r0, [r4]
ldr r0, [r0]
cmp r0, 0xD
bls _08017F3E
b _080180BC
_08017F3E:
lsls r0, 2
ldr r1, _08017F4C
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_08017F48: .4byte gUnknown_203B20C
_08017F4C: .4byte _08017F50
.align 2, 0
_08017F50:
.4byte _080180BC
.4byte _08017F88
.4byte _080180BC
.4byte _080180BC
.4byte _08017FE8
.4byte _08017FE8
.4byte _0801809C
.4byte _080180BC
.4byte _080180BC
.4byte _080180BC
.4byte _08018034
.4byte _08018034
.4byte _08018084
.4byte _0801809C
_08017F88:
ldr r4, _08017FDC
ldr r1, [r4]
ldr r2, _08017FE0
adds r1, 0xF0
adds r0, r2, 0
ldm r0!, {r3,r5,r6}
stm r1!, {r3,r5,r6}
ldm r0!, {r3,r5,r7}
stm r1!, {r3,r5,r7}
ldr r1, [r4]
movs r6, 0x84
lsls r6, 1
adds r1, r6
adds r0, r2, 0
ldm r0!, {r3,r5,r7}
stm r1!, {r3,r5,r7}
ldm r0!, {r3,r6,r7}
stm r1!, {r3,r6,r7}
ldr r0, [r4]
adds r0, 0xF0
ldm r2!, {r5-r7}
stm r0!, {r5-r7}
ldm r2!, {r1,r3,r5}
stm r0!, {r1,r3,r5}
bl sub_80182E4
ldr r2, [r4]
movs r0, 0x90
lsls r0, 1
adds r2, r0
ldr r1, _08017FE4
ldm r1!, {r3,r6,r7}
stm r2!, {r3,r6,r7}
ldm r1!, {r5-r7}
stm r2!, {r5-r7}
ldr r1, [r4]
adds r0, r1, r0
adds r1, 0x20
bl sub_8012CAC
b _080180E0
.align 2, 0
_08017FDC: .4byte gUnknown_203B20C
_08017FE0: .4byte gUnknown_80DB7B8
_08017FE4: .4byte gUnknown_80DB7D0
_08017FE8:
ldr r3, _0801802C
ldr r1, [r3]
ldr r2, _08018030
adds r1, 0xF0
adds r0, r2, 0
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4,r5,r7}
stm r1!, {r4,r5,r7}
ldr r1, [r3]
movs r6, 0x84
lsls r6, 1
adds r1, r6
adds r0, r2, 0
ldm r0!, {r4,r5,r7}
stm r1!, {r4,r5,r7}
ldm r0!, {r4,r6,r7}
stm r1!, {r4,r6,r7}
ldr r1, [r3]
movs r5, 0x90
lsls r5, 1
adds r1, r5
adds r0, r2, 0
ldm r0!, {r4,r6,r7}
stm r1!, {r4,r6,r7}
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
ldr r0, [r3]
adds r0, 0xF0
ldm r2!, {r1,r3,r4}
stm r0!, {r1,r3,r4}
ldm r2!, {r5-r7}
stm r0!, {r5-r7}
b _080180E0
.align 2, 0
_0801802C: .4byte gUnknown_203B20C
_08018030: .4byte gUnknown_80DB7B8
_08018034:
ldr r3, _08018078
ldr r1, [r3]
ldr r2, _0801807C
adds r1, 0xF0
adds r0, r2, 0
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4,r5,r7}
stm r1!, {r4,r5,r7}
ldr r1, [r3]
movs r6, 0x84
lsls r6, 1
adds r1, r6
adds r0, r2, 0
ldm r0!, {r4,r5,r7}
stm r1!, {r4,r5,r7}
ldm r0!, {r4,r6,r7}
stm r1!, {r4,r6,r7}
ldr r0, [r3]
movs r5, 0x90
lsls r5, 1
adds r0, r5
ldm r2!, {r1,r6,r7}
stm r0!, {r1,r6,r7}
ldm r2!, {r4-r6}
stm r0!, {r4-r6}
ldr r1, [r3]
adds r1, 0xF0
ldr r0, _08018080
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
b _080180E0
.align 2, 0
_08018078: .4byte gUnknown_203B20C
_0801807C: .4byte gUnknown_80DB7B8
_08018080: .4byte gUnknown_80DB800
_08018084:
ldr r0, _08018094
ldr r1, [r0]
movs r7, 0x84
lsls r7, 1
adds r1, r7
ldr r0, _08018098
b _080180A8
.align 2, 0
_08018094: .4byte gUnknown_203B20C
_08018098: .4byte gUnknown_80DB818
_0801809C:
ldr r0, _080180B4
ldr r1, [r0]
movs r0, 0x90
lsls r0, 1
adds r1, r0
ldr r0, _080180B8
_080180A8:
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
b _080180E0
.align 2, 0
_080180B4: .4byte gUnknown_203B20C
_080180B8: .4byte gUnknown_80DB7E8
_080180BC:
ldr r0, _080180F8
mov r12, r0
ldr r4, _080180FC
movs r3, 0
movs r2, 0x3
_080180C6:
mov r5, r12
ldr r1, [r5]
adds r1, r3
adds r1, 0xF0
adds r0, r4, 0
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _080180C6
_080180E0:
bl ResetUnusedInputStruct
ldr r0, _080180F8
ldr r0, [r0]
adds r0, 0xF0
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080180F8: .4byte gUnknown_203B20C
_080180FC: .4byte gUnknown_80DB7B8
thumb_func_end sub_8017F28
thumb_func_start sub_8018100
sub_8018100:
push {r4,lr}
sub sp, 0x8
ldr r1, _0801811C
ldr r0, [r1]
ldr r0, [r0]
adds r4, r1, 0
cmp r0, 0xE
bls _08018112
b _08018278
_08018112:
lsls r0, 2
ldr r1, _08018120
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801811C: .4byte gUnknown_203B20C
_08018120: .4byte _08018124
.align 2, 0
_08018124:
.4byte _08018278
.4byte _08018160
.4byte _08018278
.4byte _08018278
.4byte _08018172
.4byte _08018180
.4byte _08018188
.4byte _080181A8
.4byte _08018278
.4byte _08018278
.4byte _080181B2
.4byte _080181C0
.4byte _080181CE
.4byte _0801823C
.4byte _08018270
_08018160:
ldr r2, [r4]
adds r0, r2, 0
adds r0, 0x70
adds r1, r2, 0
adds r1, 0x20
adds r3, r2, 0
adds r3, 0x60
ldr r2, [r2, 0x14]
b _0801825C
_08018172:
movs r0, 0x3
movs r1, 0x3
movs r2, 0
movs r3, 0xA
bl sub_801A5D8
b _08018278
_08018180:
movs r0, 0x1
bl sub_801A8D0
b _08018278
_08018188:
bl sub_801A9E0
bl sub_801841C
ldr r0, _080181A4
ldr r2, [r0]
adds r0, r2, 0
adds r0, 0x70
adds r1, r2, 0
adds r1, 0x20
adds r3, r2, 0
adds r3, 0x60
ldr r2, [r2, 0x18]
b _0801825C
.align 2, 0
_080181A4: .4byte gUnknown_203B20C
_080181A8:
ldr r0, [r4]
adds r0, 0x8
bl sub_801B3C0
b _08018278
_080181B2:
movs r0, 0x1
movs r1, 0x3
movs r2, 0
movs r3, 0xA
bl sub_801C8C4
b _080181C6
_080181C0:
movs r0, 0x1
bl sub_801CB5C
_080181C6:
movs r0, 0
bl sub_801AD34
b _08018278
_080181CE:
ldr r2, [r4]
adds r1, r2, 0
adds r1, 0xD0
movs r0, 0x2
str r0, [r1]
subs r1, 0x8
movs r0, 0x1
str r0, [r1]
ldr r0, _080181F8
ldr r1, [r0]
ldrb r0, [r2, 0xA]
lsls r0, 1
adds r1, 0x50
adds r3, r1, r0
ldrh r0, [r3]
cmp r0, 0x63
bls _080181FC
adds r1, r2, 0
adds r1, 0xCC
movs r0, 0x63
b _08018202
.align 2, 0
_080181F8: .4byte gUnknown_203B460
_080181FC:
adds r1, r2, 0
adds r1, 0xCC
ldrh r0, [r3]
_08018202:
str r0, [r1]
ldr r2, [r4]
adds r1, r2, 0
adds r1, 0xC4
adds r0, r2, 0
adds r0, 0xCC
ldr r0, [r0]
str r0, [r1]
adds r1, 0x10
movs r0, 0x1
str r0, [r1]
adds r1, 0x4
movs r3, 0x84
lsls r3, 1
adds r0, r2, r3
str r0, [r1]
adds r1, 0x4
movs r0, 0x28
str r0, [r1]
adds r1, 0x4
movs r0, 0x12
str r0, [r1]
adds r0, r2, 0
adds r0, 0xC0
bl sub_8013AA0
bl sub_8018280
b _08018278
_0801823C:
bl sub_801CCD8
movs r0, 0
bl sub_801AD34
bl sub_80184D4
ldr r0, _0801826C
ldr r2, [r0]
adds r0, r2, 0
adds r0, 0x70
adds r1, r2, 0
adds r1, 0x20
adds r3, r2, 0
adds r3, 0x60
ldr r2, [r2, 0x1C]
_0801825C:
str r2, [sp]
movs r2, 0x2
str r2, [sp, 0x4]
movs r2, 0
bl sub_8012D60
b _08018278
.align 2, 0
_0801826C: .4byte gUnknown_203B20C
_08018270:
ldr r0, [r4]
adds r0, 0x8
bl sub_801B3C0
_08018278:
add sp, 0x8
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8018100
thumb_func_start sub_8018280
sub_8018280:
push {r4,lr}

View File

@ -1430,298 +1430,4 @@ _0808E8C4:
bx r1
thumb_func_end sub_808E858
thumb_func_start GetUnownIndex
GetUnownIndex:
push {lr}
lsls r0, 16
asrs r1, r0, 16
cmp r1, 0xCA
bne _0808E8D6
movs r0, 0x1
b _0808E9B2
_0808E8D6:
cmp r1, 0xCB
bne _0808E8DE
movs r0, 0x2
b _0808E9B2
_0808E8DE:
cmp r1, 0xCC
bne _0808E8E6
movs r0, 0x3
b _0808E9B2
_0808E8E6:
cmp r1, 0xCD
bne _0808E8EE
movs r0, 0x4
b _0808E9B2
_0808E8EE:
cmp r1, 0xCE
bne _0808E8F6
movs r0, 0x5
b _0808E9B2
_0808E8F6:
cmp r1, 0xCF
bne _0808E8FE
movs r0, 0x6
b _0808E9B2
_0808E8FE:
cmp r1, 0xD0
bne _0808E906
movs r0, 0x7
b _0808E9B2
_0808E906:
cmp r1, 0xD1
bne _0808E90E
movs r0, 0x8
b _0808E9B2
_0808E90E:
cmp r1, 0xD2
bne _0808E916
movs r0, 0x9
b _0808E9B2
_0808E916:
cmp r1, 0xD3
bne _0808E91E
movs r0, 0xA
b _0808E9B2
_0808E91E:
cmp r1, 0xD4
bne _0808E926
movs r0, 0xB
b _0808E9B2
_0808E926:
cmp r1, 0xD5
bne _0808E92E
movs r0, 0xC
b _0808E9B2
_0808E92E:
cmp r1, 0xD6
bne _0808E936
movs r0, 0xD
b _0808E9B2
_0808E936:
cmp r1, 0xD7
bne _0808E93E
movs r0, 0xE
b _0808E9B2
_0808E93E:
cmp r1, 0xD8
bne _0808E946
movs r0, 0xF
b _0808E9B2
_0808E946:
cmp r1, 0xD9
bne _0808E94E
movs r0, 0x10
b _0808E9B2
_0808E94E:
cmp r1, 0xDA
bne _0808E956
movs r0, 0x11
b _0808E9B2
_0808E956:
cmp r1, 0xDB
bne _0808E95E
movs r0, 0x12
b _0808E9B2
_0808E95E:
cmp r1, 0xDC
bne _0808E966
movs r0, 0x13
b _0808E9B2
_0808E966:
cmp r1, 0xDD
bne _0808E96E
movs r0, 0x14
b _0808E9B2
_0808E96E:
cmp r1, 0xDE
bne _0808E976
movs r0, 0x15
b _0808E9B2
_0808E976:
cmp r1, 0xDF
bne _0808E97E
movs r0, 0x16
b _0808E9B2
_0808E97E:
cmp r1, 0xE0
bne _0808E986
movs r0, 0x17
b _0808E9B2
_0808E986:
cmp r1, 0xE1
bne _0808E98E
movs r0, 0x18
b _0808E9B2
_0808E98E:
cmp r1, 0xE2
bne _0808E996
movs r0, 0x19
b _0808E9B2
_0808E996:
ldr r0, _0808E9A0
cmp r1, r0
bne _0808E9A4
movs r0, 0x1A
b _0808E9B2
.align 2, 0
_0808E9A0: .4byte 0x0000019f
_0808E9A4:
movs r0, 0xD0
lsls r0, 1
cmp r1, r0
beq _0808E9B0
movs r0, 0
b _0808E9B2
_0808E9B0:
movs r0, 0x1B
_0808E9B2:
pop {r1}
bx r1
thumb_func_end GetUnownIndex
thumb_func_start sub_808E9B8
sub_808E9B8:
ldrh r1, [r0]
ldr r0, _0808E9C0
ands r0, r1
bx lr
.align 2, 0
_0808E9C0: .4byte 0x000001ff
thumb_func_end sub_808E9B8
thumb_func_start sub_808E9C4
sub_808E9C4:
lsls r1, 16
asrs r1, 16
ldrh r3, [r0]
movs r2, 0xFE
lsls r2, 8
ands r2, r3
orrs r2, r1
strh r2, [r0]
bx lr
thumb_func_end sub_808E9C4
thumb_func_start sub_808E9D8
sub_808E9D8:
lsls r2, 16
asrs r2, 16
lsls r1, 9
orrs r2, r1
strh r2, [r0]
bx lr
thumb_func_end sub_808E9D8
thumb_func_start sub_808E9E4
sub_808E9E4:
ldrh r0, [r0]
lsrs r0, 9
bx lr
thumb_func_end sub_808E9E4
thumb_func_start sub_808E9EC
sub_808E9EC:
push {r4-r6,lr}
adds r3, r1, 0
ldrb r2, [r0, 0x18]
str r2, [r3]
ldrb r1, [r0, 0x19]
str r1, [r3, 0x4]
ldrb r1, [r0, 0x1A]
str r1, [r3, 0x8]
ldrb r1, [r0, 0x1B]
str r1, [r3, 0xC]
movs r1, 0
strb r1, [r3, 0x10]
strb r1, [r3, 0x11]
strb r1, [r3, 0x12]
strb r1, [r3, 0x13]
adds r1, r0, 0
adds r1, 0x28
ldrb r0, [r1]
cmp r0, 0
beq _0808EA96
adds r4, r0, 0
adds r5, r4, 0
cmp r4, 0x13
bne _0808EA2A
ldr r1, _0808EA9C
ldrh r0, [r1]
strb r0, [r3, 0x10]
movs r6, 0
ldrsh r0, [r1, r6]
adds r0, r2, r0
str r0, [r3]
_0808EA2A:
cmp r4, 0x21
bne _0808EA42
ldr r1, _0808EAA0
ldrb r0, [r1]
ldrb r2, [r3, 0x11]
adds r0, r2
strb r0, [r3, 0x11]
movs r6, 0
ldrsh r1, [r1, r6]
ldr r0, [r3, 0x4]
adds r0, r1
str r0, [r3, 0x4]
_0808EA42:
cmp r4, 0x2B
bne _0808EA66
ldr r2, _0808EAA4
ldrb r0, [r2]
ldrb r6, [r3, 0x10]
adds r1, r0, r6
strb r1, [r3, 0x10]
ldrb r1, [r3, 0x11]
adds r0, r1
strb r0, [r3, 0x11]
movs r6, 0
ldrsh r1, [r2, r6]
ldr r0, [r3]
adds r0, r1
str r0, [r3]
ldr r0, [r3, 0x4]
adds r0, r1
str r0, [r3, 0x4]
_0808EA66:
cmp r4, 0x1E
bne _0808EA7E
ldr r1, _0808EAA8
ldrb r0, [r1]
ldrb r2, [r3, 0x12]
adds r0, r2
strb r0, [r3, 0x12]
movs r6, 0
ldrsh r1, [r1, r6]
ldr r0, [r3, 0x8]
adds r0, r1
str r0, [r3, 0x8]
_0808EA7E:
cmp r5, 0x22
bne _0808EA96
ldr r1, _0808EAAC
ldrb r0, [r1]
ldrb r2, [r3, 0x13]
adds r0, r2
strb r0, [r3, 0x13]
movs r6, 0
ldrsh r1, [r1, r6]
ldr r0, [r3, 0xC]
adds r0, r1
str r0, [r3, 0xC]
_0808EA96:
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_0808EA9C: .4byte gUnknown_810AC60
_0808EAA0: .4byte gUnknown_810AC62
_0808EAA4: .4byte gUnknown_810AC68
_0808EAA8: .4byte gUnknown_810AC64
_0808EAAC: .4byte gUnknown_810AC66
thumb_func_end sub_808E9EC
.align 2, 0 @ Don't pad with nop.

View File

@ -10,7 +10,7 @@ struct subStruct_8048524
/* 0xE */ s16 HP; // HP??
s16 unk10;
u8 fill12[0x46 - 0x12];
u8 unk46;
s8 unk46;
u8 fill47[0xA4 - 0x47];
u8 unkA4;
u8 fillA5[0xAC - 0xA5];
@ -38,7 +38,9 @@ struct unkDungeon_8041D5C
u32 unk8;
s32 unkC;
s32 unk10;
u8 fill14[0x70 - 0x14];
u8 fill14[0x20 - 0x14];
u8 unk20;
u8 unk21[0x70 - 0x21];
struct subStruct_8048524 *unk70;
};

View File

@ -2,19 +2,86 @@
#define GUARD_BG_MUSIC_H
#define MUS_TEAM_BASE 1
#define MUS_FRIEND_AREA_SWAMP 2
#define MUS_FRIEND_AREA_CAVES 3
#define MUS_DREAM 4
#define MUS_BENEVOLENT_SPIRT 5
#define MUS_LEGEND_OF_NINETALES 6
#define MUS_POKEMON_SQUARE 7
#define MUS_LOADING_SCREEN 8
#define MUS_RISING_FEAR 9
#define MUS_THERES_TROUBLE 10
#define MUS_DECISIVE_BATTLE 11
#define MUS_WELCOME_TO_WORLD_POKEMON 12
#define MUS_BURIED_RELIC 13
#define MUS_THUNDERWAVE_CAVE 14
#define MUS_SINISTER_WOODS 15
#define MUS_FRIEND_AREA_POND 16
#define MUS_KECLEON_SHOP 17
#define MUS_STOP_THIEF 18
#define MUS_WORLD_CALAMITY 19
#define MUS_WORLD_CALAMITY 19 // GIANT_STAR_APPROACHING
#define MUS_GRAND_CANYON 20
#define MUS_STORMY_SEA 21
#define MUS_SKY_TOWER 22
#define MUS_SKY_TOWER_SUMMIT 23
#define MUS_RUN_AWAY 24
#define MUS_MT_BLAZE 25
#define MUS_SKY_TOWER_END 26
#define MUS_FRIEND_AREA_STRATOS_LOOKOUT 27
#define MUS_FRIEND_AREA_RAINBOW_PEAK 28
#define MUS_GENGAR_DREAM 29
#define MUS_FRIEND_AREA_DEEPSEA_CURRENT 30
#define MUS_FRIEND_AREA_SEAFLOOR_CAVE 31
#define MUS_LAST_BATTLE 32
#define MUS_MT_BLAZE_PEAK 33
#define MUS_FRIEND_AREA_VOLCANIC_PIT 34
#define MUS_FRIEND_AREA_CRYPTIC_CAVE 35
#define MUS_THROUGH_THE_LAND_OF_ICE_AND_SNOW 36
#define MUS_GENGAR_DARK_WORLD 37
#define MUS_MT_BLAZE_END 38
#define MUS_FROSTY_GROTTO 39
#define MUS_INTRO 40
#define MUS_AFTER_THE_BATTLE 41
#define MUS_NEVER_FORGET 42
#define MUS_TITLE_SCREEN 43
#define MUS_CREDITS 44
#define MUS_EPILOGUE 45
#define MUS_OPENING_TITLE 46
#define MUS_DUNGEON_FAIL 51
#define MUS_DUNGEON_COMPLETE 52
// 53 - 99 are blank/empty slots for BG Music
#define MUS_FRIEND_AREA_UNUSED_1 100
#define MUS_MEETING_WITH_PARTNER 101
#define MUS_LAPIS_CAVE 102
#define MUS_A_SUCCESSFUL_RESCUE 103
#define MUS_FROSTY_FOREST 104
#define MUS_FRIEND_AREA_STEPPE 105
#define MUS_FRIEND_AREA_OCEANIC 106
#define MUS_FRIEND_AREA_FIELD 107
#define MUS_MAGMA_CAVERN 108
#define MUS_FRIEND_AREA_UNUSED_2 109
#define MUS_MAKUHITA_DOJO 110
#define MUS_MT_THUNDER 111
#define MUS_FRIEND_AREA_LAB 112
#define MUS_SILENT_CHASM 113
#define MUS_IN_THE_DEPTHS_OF_PIT 114
#define MUS_MT_FREEZE 115
#define MUS_FRIEND_AREA_WILDS 116
#define MUS_FRIEND_AREA_LEGENDARY_ISLAND 117
#define MUS_FRIEND_AREA_SOUTHERN_ISLAND 118
#define MUS_FRIEND_AREA_ENCLOSED_ISLAND 119
#define MUS_MT_STEEL 120
#define MUS_FRIEND_AREA_FOREST 121
#define MUS_FRIEND_AREA_FINAL_ISLAND 122
#define MUS_MT_FREEZE_PEAK 123
#define MUS_MAGMA_CAVERN_PIT 124
#define MUS_TINY_WOODS 125
#define MUS_MT_THUNDER_PEAK 126
#define MUS_FRIEND_AREA_HEALING_FOREST 127
#define MUS_MONSTER_HOUSE 128
#define NUM_BG_SONGS 128
#endif //GUARD_BG_MUSIC_H

View File

@ -3,6 +3,7 @@
#include "text.h"
#include "menu.h"
#include "gUnknown_203B460.h"
struct unkStruct_203B208
{
@ -10,11 +11,10 @@ struct unkStruct_203B208
u32 unk0;
u32 currState;
u32 unk8;
u16 unkC;
u8 itemIndex;
u8 unkF;
struct ItemStruct_203B460 unkC;
u32 unk10;
u32 unk14;
u8 unk14; // another itemIndex?
u8 fill15[0x3];
u32 unk18;
u32 unk1C;
u32 unk20;

View File

@ -156,5 +156,6 @@ u8 GetPokemonOverworldPalette(s16 index, u32 r1);
bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 r1);
struct OpenedFile *OpenPokemonDialogueSpriteFile(s16 index);
struct OpenedFile *GetDialogueSpriteDataPtr(s16 index);
s32 GetUnownIndex(s16 index);
#endif // POKEMON_H

View File

@ -180,6 +180,8 @@ SECTIONS {
src/code_8057824.o(.text);
asm/code_8057824.o(.text);
asm/code_807001C.o(.text);
src/code_80869E4.o(.text);
asm/code_80869E4.o(.text);
src/code_8057824_1.o(.text);
asm/jirachi_wish.o(.text);
src/code_80521D0_1.o(.text);

View File

@ -3,16 +3,18 @@
#include "bg.h"
extern u16 gRawKeyInput;
extern u8 gBldAlpha_CoeffA;
extern u8 gBldAlpha_CoeffB;
extern u16 gBldAlpha;
extern u8 gUnknown_202D7FE;
extern struct BGControlStruct gBG0Control;
extern struct BGControlStruct gBG1Control;
extern struct BGControlStruct gBG2Control;
extern struct BGControlStruct gBG3Control;
extern u8 gBldAlpha_CoeffA;
extern u8 gBldAlpha_CoeffB;
extern u16 gBldAlpha;
extern u8 gUnknown_202D7FE;
void ReadKeyInput(struct Inputs *r0)
{
u16 keyInput = REG_KEYINPUT ^ KEYS_MASK;

498
src/code_80869E4.c Normal file
View File

@ -0,0 +1,498 @@
#include "global.h"
#include "code_8041D5C.h"
#include "gUnknown_203B418.h"
#include "random.h"
struct unkStruct_202F3D0
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 unk4;
u8 unk5;
};
EWRAM_DATA struct unkStruct_202F3D0 gUnknown_202F3D0;
extern struct unkStruct_203B418 *gUnknown_203B418;
s8 sub_8002984(s8, u8);
void sub_803E708(u32, u32);
void sub_80869E4(struct unkDungeon_8041D5C *r0, u32, u8, s8);
extern void sub_80859F0(u32);
extern void sub_803E46C(u32);
extern void sub_803E9D0(void);
extern void sub_8085C54(u32, u32, u32, u32, u32);
extern void PlaySoundEffect(u32);
extern struct unkDungeon_8041D5C *sub_8085480(void);
void SpriteLookAroundEffect(struct unkDungeon_8041D5C *r0);
extern void sub_8052910(u32);
void sub_8086494();
extern u32 gUnknown_8107314[];
extern u32 gUnknown_202EDC8;
extern void sub_8085EB0(void);
extern void sub_803E748(void);
extern void sub_80855E4(void *);
extern u32 sub_803F994(void);
extern u32 sub_803F9B0(void);
extern void sub_803F878(u32, u32);
extern void sub_8086384(struct unkDungeon_8041D5C *r0);
extern void sub_8085930(u32);
extern void sub_804539C(struct unkDungeon_8041D5C *, u32, u32);
extern void sub_806CE68(struct unkDungeon_8041D5C *, u32);
extern void sub_806CDD4(struct unkDungeon_8041D5C *, u8, u32);
extern void sub_804535C(struct unkDungeon_8041D5C *, u32 *);
extern void sub_8086A54(struct unkDungeon_8041D5C *);
extern void sub_8086A3C(struct unkDungeon_8041D5C *);
extern void PlaySoundEffect(u32);
extern void sub_80861F8(u32, struct unkDungeon_8041D5C *, u32);
void sub_80862BC(struct unkDungeon_8041D5C *r0)
{
PlaySoundEffect(0xE8 << 1);
sub_80861F8(0x143, r0, 0);
}
void sub_80862DC(struct unkDungeon_8041D5C *r0)
{
u32 array[2];
array[0] = r0->unkC;
array[1] = r0->unk10 + (0xE0 << 6);
sub_804535C(r0, array);
sub_806CDD4(r0, 0, 4);
sub_8086A54(r0);
}
void sub_8086310(struct unkDungeon_8041D5C *r0)
{
u32 array[2];
array[0] = r0->unkC;
array[1] = r0->unk10 + (0x90 << 8);
sub_804535C(r0, array);
sub_806CE68(r0, 0);
sub_8086A3C(r0);
r0->unk20 = 0;
}
void sub_8086348(struct unkDungeon_8041D5C *r0)
{
u32 array[2];
array[0] = r0->unkC + (0xF0 << 7);
array[1] = r0->unk10 + 0xffffe000;
sub_804535C(r0, array);
sub_806CDD4(r0, 0, 6);
sub_8086A54(r0);
}
void sub_8086384(struct unkDungeon_8041D5C *r0)
{
u32 array[2];
array[0] = r0->unkC + (0xF0 << 7);
array[1] = r0->unk10;
sub_804535C(r0, array);
sub_806CDD4(r0, 0, 6);
sub_8086A54(r0);
}
void sub_80863B8(struct unkDungeon_8041D5C *r0)
{
sub_806CDD4(r0, 0, 4);
}
void sub_80863C8(struct unkDungeon_8041D5C *r0)
{
sub_806CDD4(r0, 0, 0);
}
void sub_80863D8(struct unkDungeon_8041D5C *r0)
{
sub_806CDD4(r0, 0, 6);
}
void sub_80863E8(struct unkDungeon_8041D5C *r0)
{
sub_806CDD4(r0, 6, 4);
}
void sub_80863F8(struct unkDungeon_8041D5C *r0)
{
sub_806CE68(r0, 4);
}
void sub_8086404(struct unkDungeon_8041D5C *r0)
{
sub_806CE68(r0, 6);
}
void sub_8086410(struct unkDungeon_8041D5C *r0)
{
sub_804539C(r0, 0, 0xffffff00);
}
void sub_8086424(struct unkDungeon_8041D5C *r0)
{
sub_804539C(r0, 0, 0x80 << 1);
}
void sub_8086434(struct unkDungeon_8041D5C *r0)
{
sub_804539C(r0, 0xffffff00, 0);
}
void sub_8086448(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_80862DC);
for(iVar1 = 0; iVar1 < 0x38; iVar1++)
{
retVar = sub_803F994();
retVar2 = sub_803F9B0();
retVar2 += (0x80 << 1);
sub_803F878(retVar, retVar2);
sub_80855E4(sub_8086410);
sub_803E46C(0x46);
}
sub_80855E4(sub_80863F8);
}
void sub_8086494(void)
{
s32 iVar1;
sub_8085930(3);
sub_803E708(4, 0x46);
sub_8085930(2);
sub_803E708(4, 0x46);
sub_8085930(1);
sub_803E708(4, 0x46);
sub_8085930(0);
sub_803E708(4, 0x46);
sub_80855E4(sub_80863C8);
for(iVar1 = 0; iVar1 < 0x90; iVar1++)
{
sub_80855E4(sub_8086424);
sub_803E46C(0x46);
}
sub_80855E4(sub_8086310);
}
void sub_8086500(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_8086348);
for(iVar1 = 0; iVar1 < 0x48; iVar1++)
{
retVar = sub_803F994();
retVar += (0x80 << 1);
retVar2 = sub_803F9B0();
sub_803F878(retVar, retVar2);
sub_80855E4(sub_8086434);
sub_803E46C(0x46);
}
sub_80855E4(sub_8086404);
}
void sub_808654C(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_8086384);
for(iVar1 = 0; iVar1 < 0x78; iVar1++)
{
retVar = sub_803F994();
retVar += (0x80 << 1);
retVar2 = sub_803F9B0();
sub_803F878(retVar, retVar2);
sub_80855E4(sub_8086434);
sub_803E46C(0x46);
}
sub_80855E4(sub_8086404);
}
void sub_8086598(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_80863B8);
for(iVar1 = 0; iVar1 < 0x18; iVar1++)
{
retVar = sub_803F994();
retVar2 = sub_803F9B0();
sub_803F878(retVar, retVar2 + (0xffffff00));
sub_80855E4(sub_8086410);
sub_803E46C(0x46);
}
sub_80855E4(sub_80863F8);
}
void sub_80865E8(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_80863E8);
for(iVar1 = 0; iVar1 < 0xC; iVar1++)
{
retVar = sub_803F994();
retVar2 = sub_803F9B0();
sub_803F878(retVar, retVar2 + (0x80 << 2));
sub_80855E4(sub_8086424);
sub_80855E4(sub_8086424);
sub_803E46C(0x46);
}
sub_80855E4(sub_80863F8);
}
void sub_808663C(void)
{
s32 iVar1;
u32 retVar;
u32 retVar2;
sub_80855E4(sub_80863E8);
for(iVar1 = 0; iVar1 < 0x10; iVar1++)
{
retVar = sub_803F994();
retVar2 = sub_803F9B0();
sub_803F878(retVar, retVar2 + (0x80 << 2));
sub_80855E4(sub_8086424);
sub_80855E4(sub_8086424);
sub_803E46C(0x46);
}
sub_80855E4(sub_80863F8);
}
void sub_8086690(void)
{
s32 iVar1;
sub_80855E4(sub_80863D8);
for(iVar1 = 0; iVar1 < 0x30; iVar1++)
{
sub_80855E4(sub_8086434);
sub_803E46C(0x46);
}
sub_80855E4(sub_8086404);
}
void sub_80866C4(u32 r0)
{
SpriteLookAroundEffect(sub_8085480());
sub_803E708(0xA, 0x46);
sub_8052910(r0);
sub_803E708(0xA, 0x46);
sub_8086494();
gUnknown_203B418->unk2 = 1;
}
void sub_80866FC(void)
{
s32 iVar1;
for(iVar1 = 0; iVar1 >= -0xFA; iVar1 -= 0xA)
{
sub_8085C54(iVar1, iVar1, iVar1, 1, 0);
sub_803E46C(0x46);
}
}
void sub_808627C(void)
{
sub_803E748();
}
void sub_8086738(void)
{
s32 iVar1;
for(iVar1 = 0; iVar1 < 0xFA; iVar1 += 0xA)
{
sub_8085C54(iVar1, iVar1, iVar1, 1, 0);
sub_803E46C(0x46);
}
}
void sub_8086764(void)
{
s32 iVar1;
for(iVar1 = 0xFA; iVar1 >= 0; iVar1 -= 5)
{
sub_8085C54(iVar1, iVar1, iVar1, 1, 0);
sub_803E46C(0x46);
}
sub_8085EB0();
}
void sub_8086794(void)
{
s32 iVar1;
gUnknown_202EDC8 = 0;
for(iVar1 = 0; iVar1 < 0xC8; iVar1++)
{
sub_8085C54(0, 0, 0, 1, 0);
sub_803E9D0();
sub_803E46C(0x46);
if((iVar1 & 3) == 0)
{
gUnknown_202EDC8++;
if(gUnknown_202EDC8 == 0x1F)
break;
}
}
sub_803E46C(0x46);
gUnknown_203B418->unk7 = 0;
}
void sub_80867F4(void)
{
gUnknown_202F3D0.unk0 = 0;
gUnknown_202F3D0.unk1 = 0;
gUnknown_202F3D0.unk2 = 0;
gUnknown_202F3D0.unk3 = 0;
gUnknown_202F3D0.unk4 = 0;
gUnknown_202F3D0.unk5 = 0;
}
void sub_808680C(void)
{
gUnknown_202F3D0.unk0 = 1;
if(gUnknown_202F3D0.unk3 != 0)
PlaySoundEffect(0x1F9);
}
void sub_808682C(u8 r0)
{
gUnknown_202F3D0.unk0 = 0;
}
void sub_8086838(u8 r0, u8 r1, u8 r2)
{
gUnknown_202F3D0.unk1 = r0;
gUnknown_202F3D0.unk2 = r1;
gUnknown_202F3D0.unk3 = r2;
}
void sub_8086848(u8 r0, u8 r1)
{
gUnknown_202F3D0.unk4 = r0;
gUnknown_202F3D0.unk5 = r1;
}
void sub_8086854(void)
{
if(gUnknown_202F3D0.unk0 != 0)
{
if(gUnknown_202F3D0.unk4 == 0)
{
if(gUnknown_202F3D0.unk1 != 0)
{
gUnknown_202F3D0.unk4 = 0x50;
gUnknown_202F3D0.unk5 = 0x10;
}
else
{
gUnknown_202F3D0.unk4 = RandomCapped(0x6) + 2;
gUnknown_202F3D0.unk5 = RandomCapped(0x6) + 2;
}
if(gUnknown_202F3D0.unk3 != 0)
PlaySoundEffect(0x1F9);
}
else
{
gUnknown_202F3D0.unk4--;
}
if(gUnknown_202F3D0.unk5 != 0)
gUnknown_202F3D0.unk5--;
gUnknown_203B418->unk181FC = gUnknown_8107314[gUnknown_202F3D0.unk5];
}
else
{
gUnknown_203B418->unk181FC = 0;
}
}
void sub_80868F4(struct unkDungeon_8041D5C *r0)
{
r0->unk70->unk15C = 1;
r0->unk70->unk15D = 1;
}
void sub_8086910(struct unkDungeon_8041D5C *r0)
{
r0->unk70->unk15C = 0;
r0->unk70->unk15D = 0;
}
void sub_808692C(void)
{
sub_80859F0(5);
sub_803E708(0x4, 0x46);
sub_80859F0(6);
sub_803E708(0x4, 0x46);
sub_80859F0(7);
sub_803E708(0x4, 0x46);
sub_80859F0(0);
sub_803E708(0x4, 0x46);
}
void SpriteLookAroundEffect(struct unkDungeon_8041D5C *r0)
{
s8 r4;
s8 r3;
r4 = sub_8002984(r0->unk70->unk46, 4);
sub_80869E4(r0, 4, 2, r4);
sub_803E708(0xF, 0x46);
r4 = sub_8002984(r4, 5);
sub_80869E4(r0, 4, 1, r4);
sub_803E708(0xF, 0x46);
r3 = sub_8002984(r4, 4);
sub_80869E4(r0, 4, 2, r3);
sub_803E708(0xF, 0x46);
}

View File

@ -137,49 +137,37 @@ void sub_8090B08(struct ItemStruct_203B460 *param_1,u8 itemIndex)
}
}
NAKED
void sub_8090B64(u32 r0, u32 r1)
void sub_8090B64(struct ItemStruct_203B460 *param_1,struct ItemStruct_203B460 *param_2)
{
asm_unified("\tpush {r4-r6,lr}\n"
"\tadds r4, r0, 0\n"
"\tadds r5, r1, 0\n"
"\tldrb r1, [r5]\n"
"\tadds r0, r1, 0\n"
"\tcmp r0, 0\n"
"\tbeq _08090BA4\n"
"\tmovs r0, 0x1\n"
"\tstrb r0, [r4]\n"
"\tstrb r1, [r4, 0x2]\n"
"\tldrb r0, [r4, 0x2]\n"
"\tbl sub_8090A60\n"
"\tlsls r0, 24\n"
"\tlsrs r6, r0, 24\n"
"\tcmp r6, 0\n"
"\tbne _08090B9A\n"
"\tldrb r0, [r4, 0x2]\n"
"\tbl GetItemType\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r0, 0x6\n"
"\tbeq _08090B9A\n"
"\tldrb r0, [r4, 0x2]\n"
"\tcmp r0, 0x7C\n"
"\tbne _08090BA0\n"
"_08090B9A:\n"
"\tldrb r0, [r5, 0x1]\n"
"\tstrb r0, [r4, 0x1]\n"
"\tb _08090BAA\n"
"_08090BA0:\n"
"\tstrb r6, [r4, 0x1]\n"
"\tb _08090BAA\n"
"_08090BA4:\n"
"\tstrb r0, [r4, 0x2]\n"
"\tstrb r0, [r4, 0x1]\n"
"\tstrb r0, [r4]\n"
"_08090BAA:\n"
"\tpop {r4-r6}\n"
"\tpop {r0}\n"
"\tbx r0");
u8 r6;
if(param_2->unk0 != 0)
{
param_1->unk0 = 1;
param_1->itemIndex = param_2->unk0;
r6 = sub_8090A60(param_1->itemIndex);
if(r6 != 0 || GetItemType(param_1->itemIndex) == ITEM_TYPE_MONEY)
{
param_1->numItems = param_2->numItems;
}
else
{
if(param_1->itemIndex == 0x7C)
{
param_1->numItems = param_2->numItems;
}
else
{
param_1->numItems = r6;
}
}
}
else
{
param_1->itemIndex = 0;
param_1->numItems = 0;
param_1->unk0 = 0;
}
}
void sub_8090BB0(struct ItemStruct_203B460 *param_1,struct ItemStruct_203B460 *param_2)

View File

@ -3,17 +3,42 @@
#include "memory.h"
#include "text.h"
#include "item.h"
#include "input.h"
#include "kangaskhan_storage.h"
#include "gUnknown_203B460.h"
extern struct unkStruct_203B208 *gUnknown_203B208;
extern struct unkStruct_203B460 *gUnknown_203B460;
struct unkStruct_203B20C
{
u32 state;
u8 unk4[0x10];
u8 unk4[4];
u8 unk8;
u8 unk9;
u8 unkA;
u8 unkB;
u8 fillC[0x14 - 0xC];
u32 unk14;
u32 unk18;
u32 unk1C;
u32 unk20;
u8 fill24[0x60 - 0x24];
u32 unk60;
u8 fill64[0x70 - 0x64];
u32 unk70;
u8 fill74[0xC0 - 0x74];
u32 unkC0;
u32 unkC4;
u32 unkC8;
u32 unkCC;
u32 unkD0;
u32 unkD4;
struct UnkTextStruct2 *unkD8;
u32 unkDC;
u32 unkE0;
u8 fillE4[0xF0 - 0xE4];
struct UnkTextStruct2 unkF0[4];
};
extern struct unkStruct_203B20C *gUnknown_203B20C;
@ -38,13 +63,172 @@ extern u32 sub_801B410(void);
extern u8 sub_8012FD8(u32 *r0);
extern void sub_8013114(u32 *, s32 *);
extern void sub_801CBB8();
extern void sub_801CA08();
extern u8 sub_8091524(u8);
extern u8 sub_801ADA0(u32);
extern void sub_8099690(u32);
extern u32 sub_8013BBC(u32 *);
extern void sub_8017598(void);
extern u32 sub_801CA08(u32);
extern u32 sub_801CFB8(void);
extern u8 sub_801CB24();
extern void sub_8090A8C(struct ItemStruct_203B460 *, u8, u32);
extern void sub_801AD34(u32);
extern u32 sub_801A6E8(u32);
extern u32 sub_801AEA8(void);
extern u32 sub_801A8AC(void);
extern void sub_801A928(void);
extern void sub_8012CAC(struct UnkTextStruct2 *, u32 *);
extern void sub_80182E4(void);
extern void sub_801A9E0();
extern void sub_801841C();
extern void sub_801CCD8();
extern void sub_80184D4();
extern void sub_8018280();
extern void sub_8013AA0(u32 *);
extern void sub_801B3C0(u8 *);
extern void sub_801A5D8(u32, u32, u32, u32);
extern void sub_801C8C4(u32, u32, u32, u32);
extern void sub_8012D60(u32 *, u32 *, u32, u32 *, u32, u32);
extern void sub_801CB5C(u32);
extern void sub_801A8D0(u32);
extern struct UnkTextStruct2 gUnknown_80DB7B8;
extern struct UnkTextStruct2 gUnknown_80DB7E8;
extern struct UnkTextStruct2 gUnknown_80DB7D0;
extern struct UnkTextStruct2 gUnknown_80DB800;
extern struct UnkTextStruct2 gUnknown_80DB818;
void sub_8017AF8(void)
{
switch(sub_801A6E8(1))
{
case 3:
if(sub_801AEA8() != 0)
{
sub_8099690(0);
UpdateKangaskhanStorageState(0x12);
}
else
{
gUnknown_203B208->unk10 = sub_801A8AC();
gUnknown_203B208->unkC = gUnknown_203B460->fill0[gUnknown_203B208->unk10];
UpdateKangaskhanStorageState(0xF);
}
break;
case 4:
gUnknown_203B208->unk10 = sub_801A8AC();
gUnknown_203B208->unkC = gUnknown_203B460->fill0[gUnknown_203B208->unk10];
UpdateKangaskhanStorageState(0x10);
break;
case 2:
sub_801A928();
UpdateKangaskhanStorageState(1);
break;
}
}
void sub_8017B88(void)
{
switch(sub_801CA08(1))
{
case 3:
if(sub_801CFB8() != 0){
UpdateKangaskhanStorageState(0x1C);
}
else
{
gUnknown_203B208->unk14 = sub_801CB24();
sub_8090A8C(&gUnknown_203B208->unkC, gUnknown_203B208->unk14, 0);
gUnknown_203B208->unkC.numItems = 1;
UpdateKangaskhanStorageState(0x19);
}
break;
case 4:
gUnknown_203B208->unk14 = sub_801CB24();
sub_8090A8C(&gUnknown_203B208->unkC, gUnknown_203B208->unk14, 0);
gUnknown_203B208->unkC.numItems = 1;
UpdateKangaskhanStorageState(0x1A);
break;
case 2:
sub_801CBB8();
UpdateKangaskhanStorageState(1);
break;
case 1:
sub_801AD34(0);
break;
}
}
void sub_8017C28(void)
{
sub_801CA08(0);
sub_8012FD8(&gUnknown_203B208->unk58);
switch(sub_8013BBC(&gUnknown_203B208->unkA8))
{
case 1:
sub_8017598();
break;
case 3:
gUnknown_203B208->unkC.numItems = gUnknown_203B208->unkA8;
UpdateKangaskhanStorageState(0x1B);
break;
case 2:
UpdateKangaskhanStorageState(0x17);
break;
case 0:
default:
break;
}
}
void sub_8017C7C(void)
{
s32 menuAction;
menuAction = 0;
sub_801A6E8(0);
if (sub_8012FD8(&gUnknown_203B208->unk58) == 0) {
sub_8013114(&gUnknown_203B208->unk58, &menuAction);
if(menuAction != 1) gUnknown_203B208->unk1C = menuAction;
}
switch(menuAction)
{
case 2:
sub_8099690(0);
if(sub_8091524(gUnknown_203B208->unkC.itemIndex) == 0)
{
UpdateKangaskhanStorageState(9);
}
else
{
if(sub_801ADA0(gUnknown_203B208->unk10) == 0)
{
UpdateKangaskhanStorageState(0xA);
}
else
{
UpdateKangaskhanStorageState(0x11);
}
}
break;
case 6:
sub_8099690(0);
UpdateKangaskhanStorageState(0x10);
break;
case 1:
UpdateKangaskhanStorageState(0xE);
break;
}
}
void sub_8017D24(void)
{
s32 menuAction;
menuAction = 0;
sub_801CA08();
sub_801CA08(0);
if (sub_8012FD8(&gUnknown_203B208->unk58) == 0) {
sub_8013114(&gUnknown_203B208->unk58, &menuAction);
if(menuAction != 1) gUnknown_203B208->unk20 = menuAction;
@ -56,11 +240,11 @@ void sub_8017D24(void)
if (sub_8090A34() > 0x13)
{
sub_801CBB8();
UpdateKangaskhanStorageState(0x6);
UpdateKangaskhanStorageState(6);
}
else
{
if(sub_8090A60(gUnknown_203B208->itemIndex))
if(sub_8090A60(gUnknown_203B208->unkC.itemIndex))
UpdateKangaskhanStorageState(0x18);
else
UpdateKangaskhanStorageState(0x1B);
@ -182,3 +366,112 @@ void sub_8017F10(u32 newState)
sub_8017F28();
sub_8018100();
}
void sub_8017F28(void)
{
s32 iVar2;
sub_8006518(gUnknown_203B20C->unkF0);
switch(gUnknown_203B20C->state)
{
case 1:
gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8;
sub_80182E4();
gUnknown_203B20C->unkF0[2] = gUnknown_80DB7D0;
sub_8012CAC(&gUnknown_203B20C->unkF0[2], &gUnknown_203B20C->unk20);
break;
case 4:
case 5:
gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[2] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8;
break;
case 10:
case 11:
gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[2] = gUnknown_80DB7B8;
gUnknown_203B20C->unkF0[0] = gUnknown_80DB800;
break;
case 12:
gUnknown_203B20C->unkF0[1] = gUnknown_80DB818;
break;
case 6:
case 13:
gUnknown_203B20C->unkF0[2] = gUnknown_80DB7E8;
break;
default:
case 0:
for(iVar2 = 0; iVar2 < 4; iVar2++)
{
gUnknown_203B20C->unkF0[iVar2] = gUnknown_80DB7B8;
}
break;
}
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B20C->unkF0, 1, 1);
}
void sub_8018100(void)
{
switch(gUnknown_203B20C->state)
{
case 1:
sub_8012D60(&gUnknown_203B20C->unk70, &gUnknown_203B20C->unk20, 0, &gUnknown_203B20C->unk60, gUnknown_203B20C->unk14, 2);
break;
case 4:
sub_801A5D8(3, 3, 0, 0xA);
break;
case 5:
sub_801A8D0(1);
break;
case 6:
sub_801A9E0();
sub_801841C();
sub_8012D60(&gUnknown_203B20C->unk70, &gUnknown_203B20C->unk20, 0, &gUnknown_203B20C->unk60, gUnknown_203B20C->unk18, 2);
break;
case 7:
sub_801B3C0(&gUnknown_203B20C->unk8);
break;
case 10:
sub_801C8C4(1, 3, 0, 0xA);
sub_801AD34(0);
break;
case 11:
sub_801CB5C(1);
sub_801AD34(0);
break;
case 12:
gUnknown_203B20C->unkD0 = 2;
gUnknown_203B20C->unkC8 = 1;
if(gUnknown_203B460->unk50[gUnknown_203B20C->unkA] > 0x63)
gUnknown_203B20C->unkCC = 0x63;
else
gUnknown_203B20C->unkCC = gUnknown_203B460->unk50[gUnknown_203B20C->unkA];
gUnknown_203B20C->unkC4 = gUnknown_203B20C->unkCC;
gUnknown_203B20C->unkD4 = 1;
gUnknown_203B20C->unkD8 = &gUnknown_203B20C->unkF0[1];
gUnknown_203B20C->unkDC = 0x28;
gUnknown_203B20C->unkE0 = 0x12;
sub_8013AA0(&gUnknown_203B20C->unkC0);
sub_8018280();
break;
case 13:
sub_801CCD8();
sub_801AD34(0);
sub_80184D4();
sub_8012D60(&gUnknown_203B20C->unk70, &gUnknown_203B20C->unk20, 0, &gUnknown_203B20C->unk60, gUnknown_203B20C->unk1C, 2);
break;
case 14:
sub_801B3C0(&gUnknown_203B20C->unk8);
break;
case 0:
default:
break;
}
}

View File

@ -447,7 +447,6 @@ void sub_800BDDC(void)
void StartNewBGM(u16 songIndex)
{
bool8 interrupt_flag;
u16 temp_store;
if(!IsBGSong(songIndex))
return;
@ -455,8 +454,7 @@ void StartNewBGM(u16 songIndex)
return;
if(songIndex == gCurrentBGSong)
{
temp_store = gBGMusicPlayerState - 1;
if(temp_store <= 1)
if((u16)(gBGMusicPlayerState - 1) <= 1)
return;
}
if(sub_800CAE0(songIndex))

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "pokemon.h"
extern u32 gIQSkillNames[];
extern u32 gIQSkillDescriptions[];
@ -10,9 +11,269 @@ extern s16 gUnknown_810A378[];
extern s32 gUnknown_810A390[];
extern u32 gUnknown_81076E4[];
struct unkStruct_808E9EC
{
u32 unk0;
u32 unk4;
u32 unk8;
u32 unkC;
u8 unk10;
u8 unk11;
u8 unk12;
u8 unk13;
};
extern s16 gUnknown_810AC60; // 0xC
extern s16 gUnknown_810AC62; // 0xC
extern s16 gUnknown_810AC68; // 0x8
extern s16 gUnknown_810AC64; // 0x8
extern s16 gUnknown_810AC66; // 0x8
extern bool8 sub_808ECD0(u8 *, u32);
extern void sub_808EC30(u8 *, u32);
s32 GetUnownIndex(s16 index)
{
if(index == SPECIES_UNOWN_B)
return 1;
if(index == SPECIES_UNOWN_C)
return 2;
if(index == SPECIES_UNOWN_D)
return 3;
if(index == SPECIES_UNOWN_E)
return 4;
if(index == SPECIES_UNOWN_F)
return 5;
if(index == SPECIES_UNOWN_G)
return 6;
if(index == SPECIES_UNOWN_H)
return 7;
if(index == SPECIES_UNOWN_I)
return 8;
if(index == SPECIES_UNOWN_J)
return 9;
if(index == SPECIES_UNOWN_K)
return 10;
if(index == SPECIES_UNOWN_L)
return 11;
if(index == SPECIES_UNOWN_M)
return 12;
if(index == SPECIES_UNOWN_N)
return 13;
if(index == SPECIES_UNOWN_O)
return 14;
if(index == SPECIES_UNOWN_P)
return 15;
if(index == SPECIES_UNOWN_Q)
return 16;
if(index == SPECIES_UNOWN_R)
return 17;
if(index == SPECIES_UNOWN_S)
return 18;
if(index == SPECIES_UNOWN_T)
return 19;
if(index == SPECIES_UNOWN_U)
return 20;
if(index == SPECIES_UNOWN_V)
return 21;
if(index == SPECIES_UNOWN_W)
return 22;
if(index == SPECIES_UNOWN_X)
return 23;
if(index == SPECIES_UNOWN_Y)
return 24;
if(index == SPECIES_UNOWN_Z)
return 25;
if(index == SPECIES_UNOWN_EMARK)
return 26;
if(index == SPECIES_UNOWN_QMARK)
return 27;
return 0;
}
u32 sub_808E9B8(struct PokemonStruct *r0)
{
return r0->unk0 & 0x000001ff;
}
void sub_808E9C4(struct PokemonStruct *r0, s16 r1)
{
s32 r1_s32 = r1; // cast needed to match
r0->unk0 = ((0xFE << 8) & r0->unk0) | r1_s32 ;
}
void sub_808E9D8(struct PokemonStruct *r0, s32 r1, s16 r2)
{
s32 r2_32 = r2; // dumb cast to match
r0->unk0 = r2_32 | (r1 << 9) ;
}
u32 sub_808E9E4(struct PokemonStruct *r0)
{
return (r0->unk0 >> 9);
}
// Unused
#ifdef NONMATCHING
void sub_808E9EC(struct PokemonStruct *r0, struct unkStruct_808E9EC *r1)
{
u8 pokeAtt;
u8 r4;
u32 reg1_8;
s16 reg1;
pokeAtt = r0->pokeAtt;
r1->unk0 = pokeAtt;
r1->unk4 = r0->pokeSPAtt;
r1->unk8 = r0->pokeDef;
r1->unkC = r0->pokeSPDef;
r1->unk10 = 0;
r1->unk11 = 0;
r1->unk12 = 0;
r1->unk13 = 0;
if(r0->unk28 != 0)
{
r4 = r0->unk28;
if(r4 == 0x13)
{
r1->unk10 = gUnknown_810AC60;
r1->unk0 = pokeAtt + gUnknown_810AC60;
}
if(r4 == 0x21)
{
r1->unk11 += gUnknown_810AC62;
r1->unk4 += gUnknown_810AC62;
}
if(r4 == 0x2B)
{
// TODO: regs get a little f**ked
reg1_8 = (u8)gUnknown_810AC68;
r1->unk10 += reg1_8;
r1->unk11 += reg1_8;
reg1 = gUnknown_810AC68;
r1->unk0 += reg1;
r1->unk4 += reg1;
}
if(r4 == 0x1E)
{
r1->unk12 += gUnknown_810AC64;
r1->unk8 += gUnknown_810AC64;
}
if(r4 == 0x22)
{
r1->unk13 += gUnknown_810AC66;
r1->unkC += gUnknown_810AC66;
}
}
}
#else
NAKED
void sub_808E9EC(struct PokemonStruct *r0, struct unkStruct_808E9EC *r1)
{
asm_unified("\tpush {r4-r6,lr}\n"
"\tadds r3, r1, 0\n"
"\tldrb r2, [r0, 0x18]\n"
"\tstr r2, [r3]\n"
"\tldrb r1, [r0, 0x19]\n"
"\tstr r1, [r3, 0x4]\n"
"\tldrb r1, [r0, 0x1A]\n"
"\tstr r1, [r3, 0x8]\n"
"\tldrb r1, [r0, 0x1B]\n"
"\tstr r1, [r3, 0xC]\n"
"\tmovs r1, 0\n"
"\tstrb r1, [r3, 0x10]\n"
"\tstrb r1, [r3, 0x11]\n"
"\tstrb r1, [r3, 0x12]\n"
"\tstrb r1, [r3, 0x13]\n"
"\tadds r1, r0, 0\n"
"\tadds r1, 0x28\n"
"\tldrb r0, [r1]\n"
"\tcmp r0, 0\n"
"\tbeq _0808EA96\n"
"\tadds r4, r0, 0\n"
"\tadds r5, r4, 0\n"
"\tcmp r4, 0x13\n"
"\tbne _0808EA2A\n"
"\tldr r1, _0808EA9C\n"
"\tldrh r0, [r1]\n"
"\tstrb r0, [r3, 0x10]\n"
"\tmovs r6, 0\n"
"\tldrsh r0, [r1, r6]\n"
"\tadds r0, r2, r0\n"
"\tstr r0, [r3]\n"
"_0808EA2A:\n"
"\tcmp r4, 0x21\n"
"\tbne _0808EA42\n"
"\tldr r1, _0808EAA0\n"
"\tldrb r0, [r1]\n"
"\tldrb r2, [r3, 0x11]\n"
"\tadds r0, r2\n"
"\tstrb r0, [r3, 0x11]\n"
"\tmovs r6, 0\n"
"\tldrsh r1, [r1, r6]\n"
"\tldr r0, [r3, 0x4]\n"
"\tadds r0, r1\n"
"\tstr r0, [r3, 0x4]\n"
"_0808EA42:\n"
"\tcmp r4, 0x2B\n"
"\tbne _0808EA66\n"
"\tldr r2, _0808EAA4\n"
"\tldrb r0, [r2]\n"
"\tldrb r6, [r3, 0x10]\n"
"\tadds r1, r0, r6\n"
"\tstrb r1, [r3, 0x10]\n"
"\tldrb r1, [r3, 0x11]\n"
"\tadds r0, r1\n"
"\tstrb r0, [r3, 0x11]\n"
"\tmovs r6, 0\n"
"\tldrsh r1, [r2, r6]\n"
"\tldr r0, [r3]\n"
"\tadds r0, r1\n"
"\tstr r0, [r3]\n"
"\tldr r0, [r3, 0x4]\n"
"\tadds r0, r1\n"
"\tstr r0, [r3, 0x4]\n"
"_0808EA66:\n"
"\tcmp r4, 0x1E\n"
"\tbne _0808EA7E\n"
"\tldr r1, _0808EAA8\n"
"\tldrb r0, [r1]\n"
"\tldrb r2, [r3, 0x12]\n"
"\tadds r0, r2\n"
"\tstrb r0, [r3, 0x12]\n"
"\tmovs r6, 0\n"
"\tldrsh r1, [r1, r6]\n"
"\tldr r0, [r3, 0x8]\n"
"\tadds r0, r1\n"
"\tstr r0, [r3, 0x8]\n"
"_0808EA7E:\n"
"\tcmp r5, 0x22\n"
"\tbne _0808EA96\n"
"\tldr r1, _0808EAAC\n"
"\tldrb r0, [r1]\n"
"\tldrb r2, [r3, 0x13]\n"
"\tadds r0, r2\n"
"\tstrb r0, [r3, 0x13]\n"
"\tmovs r6, 0\n"
"\tldrsh r1, [r1, r6]\n"
"\tldr r0, [r3, 0xC]\n"
"\tadds r0, r1\n"
"\tstr r0, [r3, 0xC]\n"
"_0808EA96:\n"
"\tpop {r4-r6}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_0808EA9C: .4byte gUnknown_810AC60\n"
"_0808EAA0: .4byte gUnknown_810AC62\n"
"_0808EAA4: .4byte gUnknown_810AC68\n"
"_0808EAA8: .4byte gUnknown_810AC64\n"
"_0808EAAC: .4byte gUnknown_810AC66");
}
#endif
u32 GetIQSkillName(u8 r0)
{
return gIQSkillNames[r0];

View File

@ -11,7 +11,6 @@ extern const char gUnknown_810763C[];
extern void ExpandPlaceholdersBuffer(u8 *buffer, const char *r2, ...);
extern s16 sub_808E770(u32);
extern s32 GetUnownIndex(s32);
extern void sub_80922B4(u8 *, u8 *, s32);
extern void ExpandPlaceholdersBuffer(u8 *buffer, const char *r2, ...);