Decompile remaining functions in use_pokeblock.s

This commit is contained in:
Marcus Huderle 2019-03-23 17:19:08 -05:00 committed by huderlem
parent cd192e303d
commit 4fd2b0b484
5 changed files with 278 additions and 969 deletions

View File

@ -5,936 +5,4 @@
.text
thumb_func_start sub_8167BA0
sub_8167BA0: @ 8167BA0
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0xC
lsls r0, 16
lsrs r4, r0, 16
lsls r1, 24
lsrs r1, 24
mov r8, r1
movs r0, 0
movs r1, 0
bl FillWindowPixelBuffer
movs r0, 0x1
movs r1, 0
bl FillWindowPixelBuffer
ldr r7, =gUnknown_0203BCAC
ldr r3, [r7]
ldr r1, =0x00008041
adds r0, r3, r1
ldrb r1, [r0]
ldr r2, =0x00008040
adds r0, r3, r2
ldrb r0, [r0]
subs r0, 0x1
cmp r1, r0
beq _08167C46
lsls r2, r4, 6
ldr r0, =0x00007b95
adds r2, r0
adds r2, r3, r2
movs r0, 0x1
str r0, [sp]
movs r5, 0
str r5, [sp, 0x4]
str r5, [sp, 0x8]
movs r0, 0
movs r1, 0x1
movs r3, 0
bl AddTextPrinterParameterized
ldr r0, [r7]
ldr r1, =0x00008041
adds r0, r1
ldrb r0, [r0]
bl sub_81672A4
lsls r0, 24
lsrs r0, 24
movs r1, 0x64
muls r0, r1
ldr r1, =gPlayerParty
adds r0, r1
bl GetNature
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r0, [r7]
ldr r6, =0x0000804a
adds r0, r6
ldr r1, =gText_NatureSlash
bl StringCopy
ldr r1, =gNatureNamePointers
lsls r4, 2
adds r4, r1
ldr r1, [r4]
bl StringCopy
ldr r0, =gUnknown_085DFCC9
str r0, [sp]
str r5, [sp, 0x4]
ldr r0, [r7]
adds r0, r6
str r0, [sp, 0x8]
movs r0, 0x1
movs r1, 0x1
movs r2, 0x2
movs r3, 0x1
bl AddTextPrinterParameterized3
_08167C46:
mov r2, r8
cmp r2, 0
beq _08167C84
movs r0, 0
movs r1, 0x3
bl CopyWindowToVram
movs r0, 0x1
movs r1, 0x3
bl CopyWindowToVram
b _08167C94
.pool
_08167C84:
movs r0, 0
movs r1, 0x2
bl CopyWindowToVram
movs r0, 0x1
movs r1, 0x2
bl CopyWindowToVram
_08167C94:
add sp, 0xC
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8167BA0
thumb_func_start sub_8167CA0
sub_8167CA0: @ 8167CA0
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r7, r0, 24
cmp r7, 0
beq _08167CC0
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r1, =0x00007fb5
adds r0, r1
b _08167CC8
.pool
_08167CC0:
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r2, =0x00007fb4
adds r0, r2
_08167CC8:
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
lsls r0, 16
lsrs r6, r0, 16
ldr r5, =gUnknown_0203BCAC
ldr r2, [r5]
ldr r3, =0x00007c58
adds r0, r2, r3
ldr r4, =0x00007fb3
adds r1, r2, r4
movs r3, 0
ldrsb r3, [r1, r3]
lsls r1, r3, 2
adds r1, r3
lsls r1, 2
ldr r4, =0x00007c6c
adds r1, r4
adds r1, r2, r1
lsls r3, r6, 2
adds r3, r6
lsls r3, 2
adds r3, r4
adds r2, r3
bl sub_81D1F84
ldr r4, [r5]
ldr r1, =0x00008041
adds r0, r4, r1
ldrb r1, [r0]
ldr r2, =0x00008040
mov r12, r2
adds r0, r4, r2
ldrb r0, [r0]
subs r0, 0x1
eors r1, r0
negs r0, r1
orrs r0, r1
lsrs r0, 31
mov r8, r0
cmp r7, 0
beq _08167D98
ldr r3, =0x00007fb4
adds r0, r4, r3
ldrb r1, [r0]
subs r2, 0x8B
adds r0, r4, r2
strb r1, [r0]
ldr r0, [r5]
ldr r4, =0x00007fb3
adds r1, r0, r4
ldrb r1, [r1]
adds r0, r3
strb r1, [r0]
ldr r0, [r5]
adds r0, r4
strb r6, [r0]
ldr r0, [r5]
adds r2, r0, r2
ldrb r1, [r2]
ldr r2, =0x00007fb6
adds r0, r2
strb r1, [r0]
ldr r1, [r5]
adds r3, 0x8D
adds r0, r1, r3
ldrb r0, [r0]
cmp r0, 0
bne _08167D58
mov r4, r12
adds r0, r1, r4
ldrb r0, [r0]
_08167D58:
subs r2, r0, 0x1
ldr r0, =0x00008041
adds r1, r0
strb r2, [r1]
ldr r1, =gUnknown_0203BCAC
ldr r3, [r1]
adds r0, r3, r0
ldrb r0, [r0]
adds r6, r1, 0
cmp r0, 0
bne _08167D74
ldr r1, =0x00008040
adds r0, r3, r1
ldrb r0, [r0]
_08167D74:
subs r1, r0, 0x1
b _08167E1E
.pool
_08167D98:
ldr r3, =0x00007fb5
adds r0, r4, r3
ldrb r1, [r0]
ldr r2, =0x00007fb4
adds r0, r4, r2
strb r1, [r0]
ldr r0, [r5]
ldr r4, =0x00007fb3
adds r1, r0, r4
ldrb r1, [r1]
adds r0, r3
strb r1, [r0]
ldr r0, [r5]
adds r0, r4
strb r6, [r0]
ldr r0, [r5]
adds r2, r0, r2
ldrb r1, [r2]
ldr r2, =0x00007fb6
adds r0, r2
strb r1, [r0]
ldr r2, [r5]
adds r3, 0x8C
adds r0, r2, r3
ldrb r1, [r0]
adds r4, 0x8D
adds r0, r2, r4
ldrb r0, [r0]
subs r0, 0x1
cmp r1, r0
bge _08167DEC
adds r3, r1, 0x1
b _08167DEE
.pool
_08167DEC:
movs r3, 0
_08167DEE:
ldr r1, =0x00008041
adds r0, r2, r1
strb r3, [r0]
ldr r2, =gUnknown_0203BCAC
ldr r3, [r2]
adds r1, r3, r1
ldrb r1, [r1]
ldr r4, =0x00008040
adds r0, r3, r4
ldrb r0, [r0]
subs r0, 0x1
adds r6, r2, 0
cmp r1, r0
bge _08167E1C
adds r1, 0x1
b _08167E1E
.pool
_08167E1C:
movs r1, 0
_08167E1E:
ldr r2, =0x00007b4c
adds r0, r3, r2
strb r1, [r0]
adds r5, r6, 0
ldr r0, [r5]
ldr r3, =0x00008041
adds r1, r0, r3
ldrb r2, [r1]
ldr r4, =0x00008040
adds r1, r0, r4
ldrb r1, [r1]
subs r1, 0x1
eors r2, r1
negs r1, r2
orrs r1, r2
lsrs r4, r1, 31
ldr r1, =0x00007b1c
adds r0, r1
bl sub_81D3520
mov r2, r8
cmp r2, 0
bne _08167E70
ldr r0, [r5]
ldr r3, =0x00008044
adds r0, r3
ldr r1, =sub_8167EA4
b _08167E90
.pool
_08167E70:
cmp r4, 0
bne _08167E88
ldr r0, [r5]
ldr r4, =0x00008044
adds r0, r4
ldr r1, =sub_8167FA4
b _08167E90
.pool
_08167E88:
ldr r0, [r6]
ldr r1, =0x00008044
adds r0, r1
ldr r1, =sub_8168048
_08167E90:
str r1, [r0]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8167CA0
thumb_func_start sub_8167EA4
sub_8167EA4: @ 8167EA4
push {r4-r6,lr}
ldr r4, =gUnknown_0203BCAC
ldr r1, [r4]
ldr r5, =0x00008048
adds r0, r1, r5
ldrb r0, [r0]
cmp r0, 0x1
beq _08167EE4
cmp r0, 0x1
bgt _08167EC8
cmp r0, 0
beq _08167ED2
b _08167F9C
.pool
_08167EC8:
cmp r0, 0x2
beq _08167F08
cmp r0, 0x3
beq _08167F48
b _08167F9C
_08167ED2:
ldr r2, =0x00007fb3
adds r0, r1, r2
ldrb r0, [r0]
bl sub_8167608
b _08167F2C
.pool
_08167EE4:
ldr r6, =0x00007fb3
adds r0, r1, r6
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl sub_8167BA0
ldr r1, [r4]
ldr r0, =0x00008048
adds r1, r0
b _08167F30
.pool
_08167F08:
ldr r2, =0x00007c58
adds r0, r1, r2
ldr r6, =0x00007b0e
adds r1, r6
bl sub_81D3178
lsls r0, 24
cmp r0, 0
bne _08167F9C
ldr r1, [r4]
ldr r2, =0x00007b4c
adds r0, r1, r2
ldrb r0, [r0]
ldr r6, =0x00007fb6
adds r1, r6
ldrb r1, [r1]
bl sub_816753C
_08167F2C:
ldr r1, [r4]
adds r1, r5
_08167F30:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08167F9C
.pool
_08167F48:
ldr r2, =0x00007b1c
adds r0, r1, r2
bl sub_81D3464
ldr r3, [r4]
ldr r6, =0x00008041
adds r0, r3, r6
ldrb r1, [r0]
ldr r2, =0x00008040
adds r0, r3, r2
ldrb r0, [r0]
subs r0, 0x1
cmp r1, r0
beq _08167F82
subs r6, 0x8E
adds r0, r3, r6
movs r1, 0
ldrsb r1, [r0, r1]
subs r2, 0x90
adds r0, r3, r2
adds r0, r1
ldrb r2, [r0]
ldr r6, =0x00007b1c
adds r0, r3, r6
subs r6, 0xC
adds r1, r3, r6
ldrb r1, [r1]
bl sub_81D3480
_08167F82:
ldr r0, [r4]
adds r0, r5
movs r1, 0
strb r1, [r0]
movs r0, 0
b _08167F9E
.pool
_08167F9C:
movs r0, 0x1
_08167F9E:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8167EA4
thumb_func_start sub_8167FA4
sub_8167FA4: @ 8167FA4
push {r4,r5,lr}
ldr r4, =gUnknown_0203BCAC
ldr r1, [r4]
ldr r5, =0x00008048
adds r2, r1, r5
ldrb r0, [r2]
cmp r0, 0x1
beq _08167FF0
cmp r0, 0x1
bgt _08167FC8
cmp r0, 0
beq _08167FD2
b _0816803E
.pool
_08167FC8:
cmp r0, 0x2
beq _08168014
cmp r0, 0x3
beq _08168038
b _0816803E
_08167FD2:
ldr r2, =0x00007c58
adds r0, r1, r2
ldr r2, =0x00007b0e
adds r1, r2
bl sub_81D31A4
lsls r0, 24
cmp r0, 0
bne _0816803E
b _08168024
.pool
_08167FF0:
ldr r2, =0x00007fb3
adds r0, r1, r2
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl sub_8167BA0
ldr r1, [r4]
ldr r0, =0x00008048
adds r1, r0
b _08168028
.pool
_08168014:
ldr r2, =0x00007b4c
adds r0, r1, r2
ldrb r0, [r0]
ldr r2, =0x00007fb6
adds r1, r2
ldrb r1, [r1]
bl sub_816753C
_08168024:
ldr r1, [r4]
adds r1, r5
_08168028:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _0816803E
.pool
_08168038:
movs r0, 0
strb r0, [r2]
b _08168040
_0816803E:
movs r0, 0x1
_08168040:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8167FA4
thumb_func_start sub_8168048
sub_8168048: @ 8168048
push {r4-r6,lr}
ldr r4, =gUnknown_0203BCAC
ldr r1, [r4]
ldr r5, =0x00008048
adds r0, r1, r5
ldrb r0, [r0]
cmp r0, 0x1
beq _081680A8
cmp r0, 0x1
bgt _0816806C
cmp r0, 0
beq _08168076
b _08168160
.pool
_0816806C:
cmp r0, 0x2
beq _081680CC
cmp r0, 0x3
beq _0816810C
b _08168160
_08168076:
ldr r2, =0x00007c58
adds r0, r1, r2
bl sub_81D2074
ldr r0, [r4]
ldr r6, =0x00007b0e
adds r0, r6
bl sub_81D3150
lsls r0, 24
cmp r0, 0
bne _08168160
ldr r0, [r4]
ldr r1, =0x00007fb3
adds r0, r1
ldrb r0, [r0]
bl sub_8167608
b _081680F0
.pool
_081680A8:
ldr r2, =0x00007fb3
adds r0, r1, r2
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl sub_8167BA0
ldr r1, [r4]
ldr r6, =0x00008048
adds r1, r6
b _081680F4
.pool
_081680CC:
ldr r2, =0x00007c58
adds r0, r1, r2
ldr r6, =0x00007b0e
adds r1, r6
bl sub_81D3178
lsls r0, 24
cmp r0, 0
bne _08168160
ldr r1, [r4]
ldr r2, =0x00007b4c
adds r0, r1, r2
ldrb r0, [r0]
ldr r6, =0x00007fb6
adds r1, r6
ldrb r1, [r1]
bl sub_816753C
_081680F0:
ldr r1, [r4]
adds r1, r5
_081680F4:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08168160
.pool
_0816810C:
ldr r2, =0x00007b1c
adds r0, r1, r2
bl sub_81D3464
ldr r3, [r4]
ldr r6, =0x00008041
adds r0, r3, r6
ldrb r1, [r0]
ldr r2, =0x00008040
adds r0, r3, r2
ldrb r0, [r0]
subs r0, 0x1
cmp r1, r0
beq _08168146
subs r6, 0x8E
adds r0, r3, r6
movs r1, 0
ldrsb r1, [r0, r1]
subs r2, 0x90
adds r0, r3, r2
adds r0, r1
ldrb r2, [r0]
ldr r6, =0x00007b1c
adds r0, r3, r6
subs r6, 0xC
adds r1, r3, r6
ldrb r1, [r1]
bl sub_81D3480
_08168146:
ldr r0, [r4]
adds r0, r5
movs r1, 0
strb r1, [r0]
movs r0, 0
b _08168162
.pool
_08168160:
movs r0, 0x1
_08168162:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8168048
thumb_func_start sub_8168168
sub_8168168: @ 8168168
ldr r1, =gUnknown_0203BCAC
ldr r1, [r1]
ldr r2, =0x00007b0e
adds r1, r2
ldrh r1, [r1]
adds r1, 0x26
strh r1, [r0, 0x20]
bx lr
.pool
thumb_func_end sub_8168168
thumb_func_start sub_8168180
sub_8168180: @ 8168180
push {lr}
adds r2, r0, 0
movs r0, 0x2E
ldrsh r1, [r2, r0]
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r3, =0x00008041
adds r0, r3
ldrb r0, [r0]
cmp r1, r0
bne _081681A8
adds r0, r2, 0
movs r1, 0
bl StartSpriteAnim
b _081681B0
.pool
_081681A8:
adds r0, r2, 0
movs r1, 0x1
bl StartSpriteAnim
_081681B0:
pop {r0}
bx r0
thumb_func_end sub_8168180
thumb_func_start sub_81681B4
sub_81681B4: @ 81681B4
push {r4,lr}
adds r4, r0, 0
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r2, =0x00008041
adds r1, r0, r2
ldrb r1, [r1]
subs r2, 0x1
adds r0, r2
ldrb r0, [r0]
subs r0, 0x1
cmp r1, r0
bne _081681DC
movs r0, 0x65
b _081681DE
.pool
_081681DC:
movs r0, 0x66
_081681DE:
bl IndexOfSpritePaletteTag
lsls r0, 4
ldrb r2, [r4, 0x5]
movs r1, 0xF
ands r1, r2
orrs r1, r0
strb r1, [r4, 0x5]
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81681B4
thumb_func_start sub_81681F4
sub_81681F4: @ 81681F4
push {r4,lr}
lsls r0, 24
lsrs r0, 24
movs r1, 0x64
muls r0, r1
ldr r1, =gPlayerParty
adds r0, r1
movs r1, 0x30
bl GetMonData
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r3, =0x00007fb3
adds r1, r0, r3
ldrb r1, [r1]
lsls r1, 24
asrs r1, 24
subs r3, 0x3
adds r0, r3
adds r4, r0, r1
cmp r2, 0xFF
beq _0816823C
adds r0, r2, 0
movs r1, 0x1D
bl __udivsi3
b _0816823E
.pool
_0816823C:
movs r0, 0x9
_0816823E:
strb r0, [r4]
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81681F4
thumb_func_start sub_8168248
sub_8168248: @ 8168248
push {lr}
sub sp, 0x10
ldr r0, =gUnknown_085DFDB8
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [sp, 0x8]
str r1, [sp, 0xC]
ldr r0, =gUsePokeblockCondition_Gfx
str r0, [sp]
ldr r1, =0xffff0000
ldr r0, [sp, 0x4]
ands r0, r1
movs r1, 0x80
lsls r1, 4
orrs r0, r1
ldr r1, =0x0000ffff
ands r0, r1
adds r1, 0x1
orrs r0, r1
str r0, [sp, 0x4]
mov r0, sp
bl LoadCompressedSpriteSheet
add r0, sp, 0x8
bl LoadSpritePalette
add sp, 0x10
pop {r0}
bx r0
.pool
thumb_func_end sub_8168248
thumb_func_start sub_8168294
sub_8168294: @ 8168294
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r1, =0x00007b44
adds r7, r0, r1
ldr r0, =gUnknown_085DFDA0
mov r10, r0
movs r6, 0
movs r1, 0x40
mov r9, r1
movs r0, 0x60
negs r0, r0
mov r8, r0
_081682B6:
mov r5, r9
muls r5, r6
mov r0, r8
adds r1, r0, r5
lsls r1, 16
asrs r1, 16
movs r0, 0x11
lsls r2, r0, 16
mov r0, r10
asrs r2, 16
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x40
beq _081682FE
ldr r0, =gSprites
lsls r4, r1, 4
adds r4, r1
lsls r4, 2
adds r4, r0
movs r1, 0x8
strh r1, [r4, 0x2E]
movs r0, 0x20
orrs r5, r0
strh r5, [r4, 0x30]
strh r6, [r4, 0x32]
lsls r1, r6, 24
lsrs r1, 24
adds r0, r4, 0
bl StartSpriteAnim
lsls r0, r6, 2
adds r0, r7
str r4, [r0]
_081682FE:
adds r0, r6, 0x1
lsls r0, 16
lsrs r6, r0, 16
cmp r6, 0x1
bls _081682B6
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8168294
thumb_func_start sub_8168328
sub_8168328: @ 8168328
push {r4,r5,lr}
ldr r4, =gUnknown_0203BCAC
ldr r0, [r4]
ldr r5, =0x00008048
adds r0, r5
ldrb r0, [r0]
cmp r0, 0
beq _08168348
cmp r0, 0x1
beq _08168360
b _0816836C
.pool
_08168348:
bl sub_8168248
ldr r1, [r4]
ldr r0, =0x00008048
adds r1, r0
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
movs r0, 0x1
b _0816836E
.pool
_08168360:
bl sub_8168294
ldr r0, [r4]
adds r0, r5
movs r1, 0
strb r1, [r0]
_0816836C:
movs r0, 0
_0816836E:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8168328
thumb_func_start sub_8168374
sub_8168374: @ 8168374
push {r4,lr}
adds r2, r0, 0
ldrh r0, [r2, 0x20]
ldrh r1, [r2, 0x2E]
adds r3, r0, r1
strh r3, [r2, 0x20]
lsls r0, 16
asrs r4, r0, 16
movs r0, 0x30
ldrsh r1, [r2, r0]
cmp r4, r1
bgt _08168398
lsls r0, r3, 16
asrs r0, 16
cmp r0, r1
bge _081683A0
cmp r4, r1
blt _081683A8
_08168398:
lsls r0, r3, 16
asrs r0, 16
cmp r0, r1
bgt _081683A8
_081683A0:
ldrh r0, [r2, 0x30]
strh r0, [r2, 0x20]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_081683A8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8168374
.align 2, 0 @ Don't pad with nop.

View File

@ -4905,4 +4905,7 @@ extern const u16 gEasyChatCursor_Pal[];
extern const u32 gEasyChatRightWindow_Gfx[];
extern const u16 gEasyChatRightWindow_Pal[];
// Use Pokeblock
extern const u32 gUsePokeblockCondition_Gfx[];
#endif //GUARD_GRAPHICS_H

View File

@ -43,6 +43,10 @@ bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D354C(struct Sprite **);
void sub_81D3464(struct Sprite **arg0);
void sub_81D3480(struct Sprite **arg0, u8 arg1, u8 arg2);
u8 sub_81D3178(struct UnknownStruct_81D1ED4*, u16*);
u8 sub_81D31A4(struct UnknownStruct_81D1ED4*, u16*);
bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0);
u8 sub_81D3150(u16 *arg0);
void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1);
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2);
void MoveRelearnerPrintText(u8 *str);

View File

@ -13,6 +13,7 @@ extern const u8 gText_GetsAPokeBlockQuestion[];
extern const u8 gText_WontEatAnymore[];
extern const u8 gText_WasEnhanced[];
extern const u8 gText_NothingChanged[];
extern const u8 gText_NatureSlash[];
extern const u8 gText_Cool[];
extern const u8 gText_Beauty[];

View File

@ -2,6 +2,8 @@
#include "main.h"
#include "pokeblock.h"
#include "alloc.h"
#include "decompress.h"
#include "graphics.h"
#include "palette.h"
#include "pokenav.h"
#include "menu_specialized.h"
@ -42,6 +44,8 @@ struct UsePokeblockSubStruct
/*0x71*/ u8 field_71;
/*0x74*/ u8 (*unk74)(void);
/*0x78*/ u8 unk78;
/*0x79*/ u8 filler79[0x1];
/*0x7A*/ u8 field_7A[0x22];
};
struct Unk7FB8
@ -59,16 +63,19 @@ struct UsePokeblockStruct
/*0x7B10*/ u8 field_7B10;
/*0x7B11*/ u8 field_7B11[0xB];
/*0x7B1C*/ struct Sprite *field_7B1C[10];
/*0x7B44*/ struct Sprite *field_7B44[0x45];
/*0x7B44*/ struct Sprite *field_7B44[2];
/*0x7B4C*/ u8 field_7B4C;
/*0x7B4D*/ u8 filler7B4D[0x47];
/*0x7B94*/ u8 filler7B94;
/*0x7B95*/ u8 field_7B95[3][64];
/*0x7C58*/ struct UnknownStruct_81D1ED4 field_7C58;
/*0x7FB0*/ u8 unk7FB0[3];
/*0x7FB3*/ s8 field_7FB3;
/*0x7FB4*/ s8 field_7FB4;
/*0x7FB5*/ s8 field_7FB5;
/*0x7FB6*/ u8 filler7FB6[0x2];
/*0x7FB6*/ s8 field_7FB6;
/*0x7FB8*/ struct Unk7FB8 field_7FB8[6];
/*0x7FD0*/ struct UsePokeblockSubStruct info;
/*0x804C*/ u8 filler804C[0x20];
};
extern u16 gKeyRepeatStartDelay;
@ -84,12 +91,12 @@ void sub_81668F8(void);
void sub_8167420(void);
void sub_8167760(void);
u8 sub_81672E4(u8 arg0);
bool8 sub_8168328(void);
static bool8 sub_8168328(void);
bool8 sub_8167930(void);
void sub_8167608(u8 arg0);
void sub_8167BA0(u16 arg0, u8 copyToVramMode);
void sub_8166634(void);
void sub_8167CA0(bool8);
static void sub_8167CA0(bool8);
void sub_8166BEC(void);
void sub_8166D44(void);
s8 sub_8166DE4(void);
@ -101,7 +108,6 @@ u8 sub_81672A4(u8 a0);
void sub_8166A34(void);
void sub_8167104(void);
void sub_8167338(void);
extern void sub_81D2074(void);
void sub_81681F4(u8);
void sub_8166E24(void);
bool8 sub_8166EDC(void);
@ -112,13 +118,16 @@ extern u32 sub_81D2C68(s32, s32, s32, u8 *);
void sub_81673DC(struct Sprite *sprite);
void sub_81674BC(void);
void sub_816753C(s16, u8);
static u8 sub_8167EA4(void);
static u8 sub_8167FA4(void);
static u8 sub_8168048(void);
extern void sub_81D2ED4(u8, u8, u16, u8, u8, u8, u8);
extern void sub_81D2F78(u8, u8, s16, u16, u8, u8, u8, u8);
extern void sub_81D3094(u8, u8, s16, u16, u8, u8, u8);
extern void sub_81D31D0(struct SpritePalette *, struct SpritePalette *, struct SpritePalette *);
extern void sub_81D321C(struct SpriteSheet *, struct SpriteTemplate *, struct SpritePalette*);
void sub_8168180(void);
void sub_81681B4(void);
void sub_8168180(struct Sprite *sprite);
void sub_81681B4(struct Sprite *sprite);
extern void sub_81D32B0(struct SpriteSheet *, struct SpritePalette*);
extern void sub_81D21DC(u8);
@ -139,6 +148,11 @@ extern const u32 gUnknown_085DFA60[];
extern const u32 gUnknown_085DFC0C[];
extern const u16 gUnknown_086231E8[];
extern const u16 gUnknown_08623208[];
extern const u8 gUnknown_085DFCC9[];
extern const struct SpritePalette gUnknown_085DFDB8;
extern const struct SpriteTemplate gUnknown_085DFDA0;
extern const u8 *const gNatureNamePointers[];
// ram variables
EWRAM_DATA struct UsePokeblockSubStruct *gUnknown_0203BC90 = NULL;
@ -1800,63 +1814,282 @@ bool8 sub_8167930(void)
return retvalue;
}
void sub_8167BA0(u16 arg0, u8 copyToVramMode)
{
u8 partyIndex;
u8 nature;
u8 *str;
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(1, PIXEL_FILL(0));
if (gUnknown_0203BCAC->info.field_71 != gUnknown_0203BCAC->info.field_70 - 1)
{
AddTextPrinterParameterized(0, 1, gUnknown_0203BCAC->field_7B95[arg0], 0, 1, 0, NULL);
partyIndex = sub_81672A4(gUnknown_0203BCAC->info.field_71);
nature = GetNature(&gPlayerParty[partyIndex]);
str = StringCopy(gUnknown_0203BCAC->info.field_7A, gText_NatureSlash);
str = StringCopy(str, gNatureNamePointers[nature]);
AddTextPrinterParameterized3(1, 1, 2, 1, gUnknown_085DFCC9, 0, gUnknown_0203BCAC->info.field_7A);
}
if (copyToVramMode)
{
CopyWindowToVram(0, 3);
CopyWindowToVram(1, 3);
}
else
{
CopyWindowToVram(0, 2);
CopyWindowToVram(1, 2);
}
}
static void sub_8167CA0(bool8 arg0)
{
u16 var0;
int var1;
int r8;
int r4;
if (arg0)
var0 = gUnknown_0203BCAC->field_7FB5;
else
var0 = gUnknown_0203BCAC->field_7FB4;
sub_81D1F84(
&gUnknown_0203BCAC->field_7C58,
gUnknown_0203BCAC->field_7C58.unk14[gUnknown_0203BCAC->field_7FB3],
gUnknown_0203BCAC->field_7C58.unk14[var0]);
r8 = (gUnknown_0203BCAC->info.field_71 ^ (gUnknown_0203BCAC->info.field_70 - 1)) ? 1 : 0;
if (arg0)
{
gUnknown_0203BCAC->field_7FB5 = gUnknown_0203BCAC->field_7FB4;
gUnknown_0203BCAC->field_7FB4 = gUnknown_0203BCAC->field_7FB3;
gUnknown_0203BCAC->field_7FB3 = var0;
gUnknown_0203BCAC->field_7FB6 = gUnknown_0203BCAC->field_7FB5;
gUnknown_0203BCAC->info.field_71 = gUnknown_0203BCAC->info.field_71 == 0
? gUnknown_0203BCAC->info.field_70 - 1
: gUnknown_0203BCAC->info.field_71 - 1;
gUnknown_0203BCAC->field_7B4C = gUnknown_0203BCAC->info.field_71 == 0
? gUnknown_0203BCAC->info.field_70 - 1
: gUnknown_0203BCAC->info.field_71 - 1;
}
else
{
gUnknown_0203BCAC->field_7FB4 = gUnknown_0203BCAC->field_7FB5;
gUnknown_0203BCAC->field_7FB5 = gUnknown_0203BCAC->field_7FB3;
gUnknown_0203BCAC->field_7FB3 = var0;
gUnknown_0203BCAC->field_7FB6 = gUnknown_0203BCAC->field_7FB4;
gUnknown_0203BCAC->info.field_71 = gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1
? gUnknown_0203BCAC->info.field_71 + 1
: 0;
gUnknown_0203BCAC->field_7B4C = gUnknown_0203BCAC->info.field_71 < gUnknown_0203BCAC->info.field_70 - 1
? gUnknown_0203BCAC->info.field_71 + 1
: 0;
}
r4 = (gUnknown_0203BCAC->info.field_71 ^ (gUnknown_0203BCAC->info.field_70 - 1)) ? 1 : 0;
sub_81D3520(gUnknown_0203BCAC->field_7B1C);
if (!r8)
gUnknown_0203BCAC->info.unk74 = sub_8167EA4;
else if (!r4)
gUnknown_0203BCAC->info.unk74 = sub_8167FA4;
else
gUnknown_0203BCAC->info.unk74 = sub_8168048;
}
static u8 sub_8167EA4(void)
{
switch (gUnknown_0203BCAC->info.unk78)
{
case 0:
sub_8167608(gUnknown_0203BCAC->field_7FB3);
gUnknown_0203BCAC->info.unk78++;
break;
case 1:
sub_8167BA0(gUnknown_0203BCAC->field_7FB3, 0);
gUnknown_0203BCAC->info.unk78++;
break;
case 2:
if (!sub_81D3178(&gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7B0E))
{
sub_816753C(gUnknown_0203BCAC->field_7B4C, gUnknown_0203BCAC->field_7FB6);
gUnknown_0203BCAC->info.unk78++;
}
break;
case 3:
sub_81D3464(gUnknown_0203BCAC->field_7B1C);
if (gUnknown_0203BCAC->info.field_71 != gUnknown_0203BCAC->info.field_70 - 1)
{
u8 var0 = gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3];
sub_81D3480(gUnknown_0203BCAC->field_7B1C, gUnknown_0203BCAC->field_7B10, var0);
}
gUnknown_0203BCAC->info.unk78 = 0;
return FALSE;
}
return TRUE;
}
static u8 sub_8167FA4(void)
{
switch (gUnknown_0203BCAC->info.unk78)
{
case 0:
if (!sub_81D31A4(&gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7B0E))
gUnknown_0203BCAC->info.unk78++;
break;
case 1:
sub_8167BA0(gUnknown_0203BCAC->field_7FB3, 0);
gUnknown_0203BCAC->info.unk78++;
break;
case 2:
sub_816753C(gUnknown_0203BCAC->field_7B4C, gUnknown_0203BCAC->field_7FB6);
gUnknown_0203BCAC->info.unk78++;
break;
case 3:
gUnknown_0203BCAC->info.unk78 = 0;
return FALSE;
}
return TRUE;
}
static u8 sub_8168048(void)
{
switch (gUnknown_0203BCAC->info.unk78)
{
case 0:
sub_81D2074(&gUnknown_0203BCAC->field_7C58);
if (!sub_81D3150(&gUnknown_0203BCAC->field_7B0E))
{
sub_8167608(gUnknown_0203BCAC->field_7FB3);
gUnknown_0203BCAC->info.unk78++;
}
break;
case 1:
sub_8167BA0(gUnknown_0203BCAC->field_7FB3, 0);
gUnknown_0203BCAC->info.unk78++;
break;
case 2:
if (!sub_81D3178(&gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7B0E))
{
sub_816753C(gUnknown_0203BCAC->field_7B4C, gUnknown_0203BCAC->field_7FB6);
gUnknown_0203BCAC->info.unk78++;
}
break;
case 3:
sub_81D3464(gUnknown_0203BCAC->field_7B1C);
if (gUnknown_0203BCAC->info.field_71 != gUnknown_0203BCAC->info.field_70 - 1)
{
u8 var0 = gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3];
sub_81D3480(gUnknown_0203BCAC->field_7B1C, gUnknown_0203BCAC->field_7B10, var0);
}
gUnknown_0203BCAC->info.unk78 = 0;
return FALSE;
}
return TRUE;
}
void sub_8168168(struct Sprite *sprite)
{
sprite->pos1.x = gUnknown_0203BCAC->field_7B0E + 38;
}
void sub_8168180(struct Sprite *sprite)
{
if (sprite->data[0] == gUnknown_0203BCAC->info.field_71)
StartSpriteAnim(sprite, 0);
else
StartSpriteAnim(sprite, 1);
}
void sub_81681B4(struct Sprite *sprite)
{
if (gUnknown_0203BCAC->info.field_71 == gUnknown_0203BCAC->info.field_70 - 1)
sprite->oam.paletteNum = IndexOfSpritePaletteTag(101);
else
sprite->oam.paletteNum = IndexOfSpritePaletteTag(102);
}
void sub_81681F4(u8 monIndex)
{
u8 sheen = GetMonData(&gPlayerParty[monIndex], MON_DATA_SHEEN);
gUnknown_0203BCAC->unk7FB0[gUnknown_0203BCAC->field_7FB3] = sheen != 255
? sheen / 29
: 9;
}
static void sub_8168248(void)
{
struct CompressedSpriteSheet spriteSheet;
struct SpritePalette spritePalette;
spritePalette = gUnknown_085DFDB8;
spriteSheet.data = gUsePokeblockCondition_Gfx;
spriteSheet.size = 0x800;
spriteSheet.tag = 1;
LoadCompressedSpriteSheet(&spriteSheet);
LoadSpritePalette(&spritePalette);
}
static void sub_8168294(void)
{
u16 i;
s16 xDiff, xStart;
int yStart = 17;
int var = 8;
struct Sprite **sprites = gUnknown_0203BCAC->field_7B44;
const struct SpriteTemplate *template = &gUnknown_085DFDA0;
for (i = 0, xDiff = 64, xStart = -96; i < 2; i++)
{
u8 spriteId = CreateSprite(template, i * xDiff + xStart, yStart, 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = var;
gSprites[spriteId].data[1] = (i * xDiff) | 32;
gSprites[spriteId].data[2] = i;
StartSpriteAnim(&gSprites[spriteId], i);
sprites[i] = &gSprites[spriteId];
}
}
}
static bool8 sub_8168328(void)
{
switch (gUnknown_0203BCAC->info.unk78)
{
case 0:
sub_8168248();
gUnknown_0203BCAC->info.unk78++;
return TRUE;
case 1:
sub_8168294();
gUnknown_0203BCAC->info.unk78 = 0;
return FALSE;
}
return FALSE;
}
void sub_8168374(struct Sprite *sprite)
{
s16 prevX = sprite->pos1.x;
sprite->pos1.x += sprite->data[0];
if ((prevX <= sprite->data[1] && sprite->pos1.x >= sprite->data[1])
|| (prevX >= sprite->data[1] && sprite->pos1.x <= sprite->data[1]))
{
sprite->pos1.x = sprite->data[1];
sprite->callback = SpriteCallbackDummy;
}
}