Decompile a few pokemon summary screen functions

This commit is contained in:
DizzyEggg 2018-07-28 23:26:19 +02:00
parent 919e7b4387
commit 4080c6f831
3 changed files with 276 additions and 896 deletions

View File

@ -5,869 +5,7 @@
.text
thumb_func_start sub_81C3E2C
sub_81C3E2C: @ 81C3E2C
push {r4,lr}
sub sp, 0x8
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x4
bne _081C3E48
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
ldr r1, =0x000040c4
b _081C3E50
.pool
_081C3E48:
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
lsls r1, 1
adds r0, 0x84
_081C3E50:
adds r0, r1
ldrh r4, [r0]
cmp r4, 0
beq _081C3E82
ldr r0, =gUnknown_0861CD14
movs r1, 0x2
bl sub_81C2D2C
lsls r0, 24
lsrs r0, 24
ldr r3, =gContestEffectDescriptionPointers
ldr r2, =gContestMoves
lsls r1, r4, 3
adds r1, r2
ldrb r1, [r1]
lsls r1, 2
adds r1, r3
ldr r1, [r1]
movs r2, 0
str r2, [sp]
str r2, [sp, 0x4]
movs r2, 0x6
movs r3, 0x1
bl sub_81C25A4
_081C3E82:
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C3E2C
thumb_func_start sub_81C3E9C
sub_81C3E9C: @ 81C3E9C
push {r4-r6,lr}
sub sp, 0x8
lsls r0, 16
lsrs r4, r0, 16
adds r6, r4, 0
ldr r0, =gUnknown_0861CD14
movs r1, 0x2
bl sub_81C2D2C
lsls r0, 24
lsrs r5, r0, 24
adds r0, r5, 0
movs r1, 0
bl FillWindowPixelBuffer
cmp r4, 0
beq _081C3F30
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
ldr r1, =0x000040c0
adds r0, r1
ldrb r0, [r0]
cmp r0, 0x2
bne _081C3F00
adds r0, r4, 0
bl sub_81C3C5C
ldr r1, =gMoveDescriptionPointers
subs r0, r4, 0x1
lsls r0, 2
adds r0, r1
ldr r1, [r0]
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
adds r0, r5, 0
movs r2, 0x6
movs r3, 0x1
bl sub_81C25A4
b _081C3F20
.pool
_081C3F00:
ldr r2, =gContestEffectDescriptionPointers
ldr r1, =gContestMoves
lsls r0, r6, 3
adds r0, r1
ldrb r0, [r0]
lsls r0, 2
adds r0, r2
ldr r1, [r0]
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
adds r0, r5, 0
movs r2, 0x6
movs r3, 0x1
bl sub_81C25A4
_081C3F20:
adds r0, r5, 0
bl PutWindowTilemap
b _081C3F36
.pool
_081C3F30:
adds r0, r5, 0
bl ClearWindowTilemap
_081C3F36:
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_81C3E9C
thumb_func_start sub_81C3F44
sub_81C3F44: @ 81C3F44
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
ldr r4, =gUnknown_0861CD14
adds r0, r4, 0
movs r1, 0
bl sub_81C2D2C
lsls r0, 24
lsrs r6, r0, 24
adds r7, r6, 0
adds r0, r4, 0
movs r1, 0x1
bl sub_81C2D2C
lsls r0, 24
lsrs r0, 24
mov r8, r0
ldr r0, =gUnknown_0203CF1C
ldr r1, [r0]
ldr r2, =0x000040c4
adds r0, r1, r2
ldrh r2, [r0]
cmp r2, 0
bne _081C3F9C
ldr r1, =gText_Cancel
str r2, [sp]
movs r0, 0x1
str r0, [sp, 0x4]
adds r0, r6, 0
movs r2, 0
movs r3, 0x41
bl sub_81C25A4
b _081C4044
.pool
_081C3F9C:
ldrh r5, [r0]
ldr r2, =0x000040c0
adds r0, r1, r2
ldrb r0, [r0]
cmp r0, 0x2
bne _081C3FD0
movs r0, 0xD
adds r1, r5, 0
muls r1, r0
ldr r0, =gMoveNames
adds r1, r0
movs r0, 0
str r0, [sp]
movs r0, 0x6
str r0, [sp, 0x4]
adds r0, r6, 0
movs r2, 0
movs r3, 0x41
bl sub_81C25A4
b _081C3FEC
.pool
_081C3FD0:
movs r0, 0xD
adds r1, r5, 0
muls r1, r0
ldr r0, =gMoveNames
adds r1, r0
movs r0, 0
str r0, [sp]
movs r0, 0x5
str r0, [sp, 0x4]
adds r0, r7, 0
movs r2, 0
movs r3, 0x41
bl sub_81C25A4
_081C3FEC:
ldr r4, =gStringVar1
ldr r1, =gBattleMoves
lsls r0, r5, 1
adds r0, r5
lsls r0, 2
adds r0, r1
ldrb r1, [r0, 0x4]
adds r0, r4, 0
movs r2, 0x1
movs r3, 0x2
bl ConvertIntToDecimalStringN
bl DynamicPlaceholderTextUtil_Reset
movs r0, 0
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r0, 0x1
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
ldr r4, =gStringVar4
ldr r1, =gUnknown_0861CE97
adds r0, r4, 0
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
movs r0, 0x1
adds r1, r4, 0
movs r2, 0x2C
bl GetStringRightAlignXOffset
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
movs r0, 0
str r0, [sp]
movs r0, 0xC
str r0, [sp, 0x4]
mov r0, r8
adds r1, r4, 0
movs r3, 0x41
bl sub_81C25A4
_081C4044:
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C3F44
thumb_func_start sub_81C4064
sub_81C4064: @ 81C4064
push {r4,lr}
sub sp, 0x8
ldr r0, =gUnknown_0861CD14
movs r1, 0
bl sub_81C2D2C
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0x48
str r0, [sp]
movs r0, 0x10
str r0, [sp, 0x4]
adds r0, r4, 0
movs r1, 0
movs r2, 0
movs r3, 0x42
bl FillWindowPixelRect
adds r0, r4, 0
movs r1, 0x2
bl CopyWindowToVram
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C4064
thumb_func_start sub_81C40A0
sub_81C40A0: @ 81C40A0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r9, r0
mov r10, r1
lsls r0, 24
lsrs r0, 24
mov r9, r0
mov r0, r10
lsls r0, 24
lsrs r0, 24
mov r10, r0
ldr r5, =gUnknown_0861CD14
adds r0, r5, 0
movs r1, 0
bl sub_81C2D2C
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
movs r1, 0x1
bl sub_81C2D2C
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
mov r0, r9
lsls r6, r0, 4
movs r0, 0x48
mov r8, r0
str r0, [sp]
movs r0, 0x10
str r0, [sp, 0x4]
adds r0, r4, 0
movs r1, 0
movs r2, 0
adds r3, r6, 0
bl FillWindowPixelRect
mov r0, r10
lsls r7, r0, 4
mov r0, r8
str r0, [sp]
movs r0, 0x10
str r0, [sp, 0x4]
adds r0, r4, 0
movs r1, 0
movs r2, 0
adds r3, r7, 0
bl FillWindowPixelRect
movs r4, 0x30
str r4, [sp]
movs r0, 0x10
str r0, [sp, 0x4]
adds r0, r5, 0
movs r1, 0
movs r2, 0
adds r3, r6, 0
bl FillWindowPixelRect
str r4, [sp]
movs r0, 0x10
str r0, [sp, 0x4]
adds r0, r5, 0
movs r1, 0
movs r2, 0
adds r3, r7, 0
bl FillWindowPixelRect
mov r0, r9
bl sub_81C3B08
mov r0, r10
bl sub_81C3B08
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C40A0
thumb_func_start sub_81C4154
sub_81C4154: @ 81C4154
push {r4,lr}
sub sp, 0x8
ldr r0, =gUnknown_0861CD14
movs r1, 0x2
bl sub_81C2D2C
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
movs r1, 0
bl FillWindowPixelBuffer
ldr r1, =gText_HMMovesCantBeForgotten2
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
adds r0, r4, 0
movs r2, 0x6
movs r3, 0x1
bl sub_81C25A4
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C4154
thumb_func_start sub_81C4190
sub_81C4190: @ 81C4190
push {r4,r5,lr}
movs r2, 0
ldr r5, =gUnknown_0203CF1C
ldr r4, =0x000040d3
movs r3, 0xFF
_081C419A:
ldr r0, [r5]
adds r0, r4
adds r0, r2
ldrb r1, [r0]
orrs r1, r3
strb r1, [r0]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x1B
bls _081C419A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C4190
thumb_func_start sub_81C41C0
sub_81C41C0: @ 81C41C0
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r5, =gUnknown_0203CF1C
ldr r0, [r5]
ldr r1, =0x000040d3
adds r0, r1
adds r1, r0, r4
ldrb r0, [r1]
cmp r0, 0xFF
beq _081C41F2
adds r1, r0, 0
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl DestroySprite
ldr r0, [r5]
ldr r1, =0x000040d3
adds r0, r1
adds r0, r4
movs r1, 0xFF
strb r1, [r0]
_081C41F2:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C41C0
thumb_func_start sub_81C4204
sub_81C4204: @ 81C4204
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
ldr r3, =gSprites
ldr r2, =gUnknown_0203CF1C
ldr r2, [r2]
ldr r4, =0x000040d3
adds r2, r4
adds r2, r0
ldrb r0, [r2]
lsls r2, r0, 4
adds r2, r0
lsls r2, 2
adds r2, r3
adds r2, 0x3E
movs r0, 0x1
ands r1, r0
lsls r1, 2
ldrb r3, [r2]
movs r0, 0x5
negs r0, r0
ands r0, r3
orrs r0, r1
strb r0, [r2]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C4204
thumb_func_start sub_81C424C
sub_81C424C: @ 81C424C
push {r4,lr}
movs r4, 0x3
_081C4250:
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
ldr r1, =0x000040d3
adds r0, r1
adds r0, r4
ldrb r0, [r0]
cmp r0, 0xFF
beq _081C4268
adds r0, r4, 0
movs r1, 0x1
bl sub_81C4204
_081C4268:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x1B
bls _081C4250
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C424C
thumb_func_start sub_81C4280
sub_81C4280: @ 81C4280
push {lr}
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
ldr r1, =0x000040c0
adds r0, r1
ldrb r0, [r0]
cmp r0, 0x2
beq _081C42B0
cmp r0, 0x2
bgt _081C42A4
cmp r0, 0
beq _081C42AA
b _081C42C2
.pool
_081C42A4:
cmp r0, 0x3
beq _081C42BA
b _081C42C2
_081C42AA:
bl sub_81C43A0
b _081C42C2
_081C42B0:
bl sub_81C4420
bl sub_81C44F0
b _081C42C2
_081C42BA:
bl sub_81C4484
bl sub_81C44F0
_081C42C2:
pop {r0}
bx r0
thumb_func_end sub_81C4280
thumb_func_start sub_81C42C8
sub_81C42C8: @ 81C42C8
push {r4,r5,lr}
movs r4, 0x3
ldr r5, =gUnknown_0203CF1C
_081C42CE:
ldr r0, [r5]
ldr r1, =0x000040d3
adds r0, r1
adds r0, r4
ldrb r0, [r0]
cmp r0, 0xFF
bne _081C42F2
ldr r0, =gUnknown_0861CFC4
movs r1, 0
movs r2, 0
movs r3, 0x2
bl CreateSprite
ldr r1, [r5]
ldr r2, =0x000040d3
adds r1, r2
adds r1, r4
strb r0, [r1]
_081C42F2:
adds r0, r4, 0
movs r1, 0x1
bl sub_81C4204
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081C42CE
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C42C8
thumb_func_start sub_81C4318
sub_81C4318: @ 81C4318
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0x4
adds r5, r0, 0
adds r6, r1, 0
mov r8, r2
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
mov r0, r8
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r3, 24
lsrs r3, 24
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
ldr r1, =0x000040d3
adds r0, r1
adds r0, r3
ldrb r0, [r0]
lsls r4, r0, 4
adds r4, r0
lsls r4, 2
ldr r0, =gSprites
adds r4, r0
adds r0, r4, 0
adds r1, r5, 0
str r3, [sp]
bl StartSpriteAnim
ldr r0, =gUnknown_0861CFDC
adds r5, r0
ldrb r1, [r5]
lsls r1, 4
ldrb r2, [r4, 0x5]
movs r0, 0xF
ands r0, r2
orrs r0, r1
strb r0, [r4, 0x5]
adds r6, 0x10
strh r6, [r4, 0x20]
movs r0, 0x8
add r8, r0
mov r1, r8
strh r1, [r4, 0x22]
ldr r3, [sp]
adds r0, r3, 0
movs r1, 0
bl sub_81C4204
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C4318
thumb_func_start sub_81C43A0
sub_81C43A0: @ 81C43A0
push {r4,r5,lr}
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
adds r5, r0, 0
adds r5, 0x70
ldrb r0, [r5, 0x4]
cmp r0, 0
beq _081C43CC
movs r0, 0x9
movs r1, 0x78
movs r2, 0x30
movs r3, 0x3
bl sub_81C4318
movs r0, 0x4
movs r1, 0x1
bl sub_81C4204
b _081C4418
.pool
_081C43CC:
ldr r4, =gBaseStats
ldrh r1, [r5]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r4
ldrb r0, [r0, 0x6]
movs r1, 0x78
movs r2, 0x30
movs r3, 0x3
bl sub_81C4318
ldrh r1, [r5]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r1, r0, r4
ldrb r0, [r1, 0x6]
ldrb r2, [r1, 0x7]
cmp r0, r2
beq _081C4410
ldrb r0, [r1, 0x7]
movs r1, 0xA0
movs r2, 0x30
movs r3, 0x4
bl sub_81C4318
movs r0, 0x4
movs r1, 0
bl sub_81C4204
b _081C4418
.pool
_081C4410:
movs r0, 0x4
movs r1, 0x1
bl sub_81C4204
_081C4418:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81C43A0
thumb_func_start sub_81C4420
sub_81C4420: @ 81C4420
push {r4-r6,lr}
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
adds r5, r0, 0
adds r5, 0x70
movs r4, 0
ldr r6, =gBattleMoves
_081C442E:
lsls r0, r4, 1
adds r1, r5, 0
adds r1, 0x14
adds r1, r0
ldrh r0, [r1]
cmp r0, 0
beq _081C4468
adds r1, r0, 0
lsls r0, r1, 1
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r0, [r0, 0x2]
lsls r2, r4, 28
movs r1, 0x80
lsls r1, 22
adds r2, r1
lsrs r2, 24
adds r3, r4, 0x3
lsls r3, 24
lsrs r3, 24
movs r1, 0x55
bl sub_81C4318
b _081C4474
.pool
_081C4468:
adds r0, r4, 0x3
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_81C4204
_081C4474:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x3
bls _081C442E
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_81C4420
thumb_func_start sub_81C4484
sub_81C4484: @ 81C4484
push {r4,r5,lr}
ldr r0, =gUnknown_0203CF1C
ldr r0, [r0]
adds r5, r0, 0
adds r5, 0x70
movs r4, 0
_081C4490:
lsls r0, r4, 1
adds r1, r5, 0
adds r1, 0x14
adds r2, r1, r0
ldrh r0, [r2]
cmp r0, 0
beq _081C44D4
ldr r1, =gContestMoves
lsls r0, 3
adds r0, r1
ldrb r0, [r0, 0x1]
lsls r0, 29
lsrs r0, 5
movs r1, 0x90
lsls r1, 21
adds r0, r1
lsrs r0, 24
lsls r2, r4, 28
movs r1, 0x80
lsls r1, 22
adds r2, r1
lsrs r2, 24
adds r3, r4, 0x3
lsls r3, 24
lsrs r3, 24
movs r1, 0x55
bl sub_81C4318
b _081C44E0
.pool
_081C44D4:
adds r0, r4, 0x3
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_81C4204
_081C44E0:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x3
bls _081C4490
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81C4484
thumb_func_start sub_81C44F0
sub_81C44F0: @ 81C44F0
push {lr}
ldr r0, =gUnknown_0203CF1C
ldr r1, [r0]
ldr r0, =0x000040c4
adds r3, r1, r0
ldrh r0, [r3]
cmp r0, 0
bne _081C4514
movs r0, 0x7
movs r1, 0x1
bl sub_81C4204
b _081C4560
.pool
_081C4514:
ldr r2, =0x000040c0
adds r0, r1, r2
ldrb r0, [r0]
cmp r0, 0x2
bne _081C4540
ldr r2, =gBattleMoves
ldrh r1, [r3]
lsls r0, r1, 1
adds r0, r1
lsls r0, 2
adds r0, r2
ldrb r0, [r0, 0x2]
movs r1, 0x55
movs r2, 0x60
movs r3, 0x7
bl sub_81C4318
b _081C4560
.pool
_081C4540:
ldr r1, =gContestMoves
ldrh r0, [r3]
lsls r0, 3
adds r0, r1
ldrb r0, [r0, 0x1]
lsls r0, 29
lsrs r0, 5
movs r1, 0x90
lsls r1, 21
adds r0, r1
lsrs r0, 24
movs r1, 0x55
movs r2, 0x60
movs r3, 0x7
bl sub_81C4318
_081C4560:
pop {r0}
bx r0
.pool
thumb_func_end sub_81C44F0
thumb_func_start sub_81C4568
sub_81C4568: @ 81C4568

View File

@ -1,6 +1,21 @@
#ifndef GUARD_CONTEST_H
#define GUARD_CONTEST_H
struct ContestMove
{
u8 effect;
u8 contestCategory:3;
u8 comboStarterId;
u8 comboMoves[4];
};
struct ContestEffect
{
u8 effectType;
u8 appeal;
u8 jam;
};
struct ContestStruct_02039E00
{
u16 unk_00;

View File

@ -27,21 +27,8 @@
#include "scanline_effect.h"
#include "menu_helpers.h"
#include "daycare.h"
struct ContestMove
{
u8 effect;
u8 type;
u8 comboID;
u8 combo[4];
};
struct ContestEffect
{
u8 type;
u8 appeal;
u8 jam;
};
#include "data2.h"
#include "contest.h"
extern struct UnkSummaryStruct* gUnknown_0203CF1C;
extern struct BgTemplate gUnknown_0861CBB4;
@ -69,6 +56,8 @@ extern u8 gUnknown_0861CE74[];
extern u8 gUnknown_0861CE7B[];
extern struct WindowTemplate gUnknown_0861CCEC;
extern struct WindowTemplate gUnknown_0861CD14;
extern const u8 *const gContestEffectDescriptionPointers[];
extern const u8 *const gMoveDescriptionPointers[];
void sub_81C488C(u8 a);
extern u8 sub_81221EC();
@ -96,6 +85,7 @@ extern u8 gText_PkmnInfo[];
extern u8 gText_PkmnSkills[];
extern u8 gText_BattleMoves[];
extern u8 gText_ContestMoves[];
extern u8 gText_HMMovesCantBeForgotten2[];
extern u8 gText_Cancel2[];
extern u8 gText_Info[];
extern u8 gText_Switch[];
@ -144,7 +134,9 @@ extern u8 gUnknown_0861CE8E[];
extern u8 gText_OneDash[];
extern u8 gText_TwoDashes[];
extern u8 gText_ThreeDashes[];
extern u8 gText_Cancel[];
extern u8 gUnknown_0861CE97[];
extern const struct SpriteTemplate gUnknown_0861CFC4;
extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f);
extern bool8 sub_81A6BF4();
@ -173,6 +165,9 @@ void sub_81C4984();
void sub_81C4A08();
void sub_81C4A88();
void sub_81C4280();
void sub_81C43A0();
void sub_81C4484();
void sub_81C4420();
void sub_81C0510(u8 taskId);
void sub_81C171C(u8 taskId);
void ResetAllBgsCoordinates();
@ -341,10 +336,7 @@ struct UnkSummaryStruct
u8 unk40C9;
u8 unk40CA;
u8 unk40CB[8];
u8 unk40D3;
u8 unk40D4;
u8 unk40D5;
u8 unk_filler5[0x19];
u8 unk40D3[0x1C];
u8 unk40EF;
s16 unk40F0;
u8 unk_filler4[6];
@ -506,8 +498,8 @@ bool8 sub_81BFB10(void)
gMain.state++;
break;
case 17:
gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0);
if (gUnknown_0203CF1C->unk40D3 != 0xFF)
gUnknown_0203CF1C->unk40D3[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0);
if (gUnknown_0203CF1C->unk40D3[0] != 0xFF)
{
gUnknown_0203CF1C->unk40F0 = 0;
gMain.state++;
@ -890,10 +882,10 @@ void sub_81C0704(u8 taskId)
break;
case 1:
sub_81C4898();
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]);
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3[0]]);
break;
case 2:
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]);
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3[1]]);
break;
case 3:
sub_81C0098(&gUnknown_0203CF1C->currentMon);
@ -916,10 +908,10 @@ void sub_81C0704(u8 taskId)
data[1] = 0;
break;
case 8:
gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]);
if (gUnknown_0203CF1C->unk40D3 == 0xFF)
gUnknown_0203CF1C->unk40D3[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]);
if (gUnknown_0203CF1C->unk40D3[0] == 0xFF)
return;
gSprites[gUnknown_0203CF1C->unk40D3].data[2] = 1;
gSprites[gUnknown_0203CF1C->unk40D3[0]].data[2] = 1;
sub_81C0E24();
data[1] = 0;
break;
@ -934,7 +926,7 @@ void sub_81C0704(u8 taskId)
sub_81C2524();
break;
case 12:
gSprites[gUnknown_0203CF1C->unk40D3].data[2] = 0;
gSprites[gUnknown_0203CF1C->unk40D3[0]].data[2] = 0;
break;
default:
if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0)
@ -1139,7 +1131,7 @@ void sub_81C0E48(u8 taskId)
gUnknown_0203CF1C->unk40C6 = 0;
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6];
ClearWindowTilemap(0x13);
if (gSprites[gUnknown_0203CF1C->unk40D5].invisible == 0)
if (gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible == 0)
ClearWindowTilemap(0xD);
sub_81C1DA4(9, -3);
sub_81C1EFC(9, -3, move);
@ -1245,7 +1237,7 @@ void sub_81C1070(s16 *a, s8 b, u8 *c)
if ((*c == 4 && gUnknown_0203CF1C->unk40C4 == 0) || a[1] == 1)
{
ClearWindowTilemap(19);
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
ClearWindowTilemap(13);
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(9, -3);
@ -1889,7 +1881,7 @@ void sub_81C1940(u8 taskId)
{
ClearWindowTilemap(19);
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
ClearWindowTilemap(13);
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6];
gTasks[taskId].func = sub_81C174C;
@ -1903,7 +1895,7 @@ void sub_81C1940(u8 taskId)
if (gUnknown_0203CF1C->unk40C0 != 3)
{
ClearWindowTilemap(19);
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
ClearWindowTilemap(13);
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6];
gTasks[taskId].func = sub_81C174C;
@ -1915,7 +1907,7 @@ void sub_81C1940(u8 taskId)
else if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
ClearWindowTilemap(19);
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
ClearWindowTilemap(13);
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6];
sub_81C3E9C(move);
@ -2208,7 +2200,7 @@ void sub_81C1E20(u8 taskId)
}
else
{
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
PutWindowTilemap(13);
PutWindowTilemap(19);
}
@ -2259,7 +2251,7 @@ void sub_81C1F80(u8 taskId)
}
else
{
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible)
{
PutWindowTilemap(13);
}
@ -3591,3 +3583,238 @@ void sub_81C3D54(u8 taskId)
}
data[0]++;
}
void sub_81C3E2C(u8 moveSlot)
{
u16 move;
if (moveSlot == 4)
move = gUnknown_0203CF1C->unk40C4;
else
move = gUnknown_0203CF1C->summary.moves[moveSlot];
if (move != MOVE_NONE)
{
u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2);
sub_81C25A4(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0);
}
}
void sub_81C3E9C(u16 move)
{
u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2);
FillWindowPixelBuffer(windowId, 0);
if (move != MOVE_NONE)
{
if (gUnknown_0203CF1C->unk40C0 == 2)
{
sub_81C3C5C(move);
sub_81C25A4(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0);
}
else
{
sub_81C25A4(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0);
}
PutWindowTilemap(windowId);
}
else
{
ClearWindowTilemap(windowId);
}
schedule_bg_copy_tilemap_to_vram(0);
}
void sub_81C3F44(void)
{
u8 windowId1 = sub_81C2D2C(&gUnknown_0861CD14, 0);
u8 windowId2 = sub_81C2D2C(&gUnknown_0861CD14, 1);
if (gUnknown_0203CF1C->unk40C4 == MOVE_NONE)
{
sub_81C25A4(windowId1, gText_Cancel, 0, 0x41, 0, 1);
}
else
{
u16 move = gUnknown_0203CF1C->unk40C4;
if (gUnknown_0203CF1C->unk40C0 == 2)
sub_81C25A4(windowId1, gMoveNames[move], 0, 0x41, 0, 6);
else
sub_81C25A4(windowId1, gMoveNames[move], 0, 0x41, 0, 5);
ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].pp, 1, 2);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar1);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97);
sub_81C25A4(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x2C), 0x41, 0, 12);
}
}
void sub_81C4064(void)
{
u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 0);
FillWindowPixelRect(windowId, 0, 0, 0x42, 0x48, 0x10);
CopyWindowToVram(windowId, 2);
}
void sub_81C40A0(u8 a, u8 b)
{
u8 windowId1 = sub_81C2D2C(&gUnknown_0861CD14, 0);
u8 windowId2 = sub_81C2D2C(&gUnknown_0861CD14, 1);
FillWindowPixelRect(windowId1, 0, 0, a * 16, 0x48, 0x10);
FillWindowPixelRect(windowId1, 0, 0, b * 16, 0x48, 0x10);
FillWindowPixelRect(windowId2, 0, 0, a * 16, 0x30, 0x10);
FillWindowPixelRect(windowId2, 0, 0, b * 16, 0x30, 0x10);
sub_81C3B08(a);
sub_81C3B08(b);
}
void sub_81C4154(void)
{
u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2);
FillWindowPixelBuffer(windowId, 0);
sub_81C25A4(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0);
}
void sub_81C4190(void)
{
u8 i;
for (i = 0; i < 28; i++)
gUnknown_0203CF1C->unk40D3[i] |= 0xFF;
}
void sub_81C41C0(u8 spriteArrayId)
{
if (gUnknown_0203CF1C->unk40D3[spriteArrayId] != 0xFF)
{
DestroySprite(&gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]]);
gUnknown_0203CF1C->unk40D3[spriteArrayId] = 0xFF;
}
}
void sub_81C4204(u8 spriteArrayId, bool8 invisible)
{
gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]].invisible = invisible;
}
void sub_81C424C(void)
{
u8 i;
for (i = 3; i < 28; i++)
{
if (gUnknown_0203CF1C->unk40D3[i] != 0xFF)
sub_81C4204(i, TRUE);
}
}
void sub_81C4280(void)
{
switch (gUnknown_0203CF1C->unk40C0)
{
case 0:
sub_81C43A0();
break;
case 2:
sub_81C4420();
sub_81C44F0();
break;
case 3:
sub_81C4484();
sub_81C44F0();
break;
}
}
void sub_81C42C8(void)
{
u8 i;
for (i = 3; i < 8; i++)
{
if (gUnknown_0203CF1C->unk40D3[i] == 0xFF)
gUnknown_0203CF1C->unk40D3[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2);
sub_81C4204(i, TRUE);
}
}
extern const u8 gUnknown_0861CFDC[];
void sub_81C4318(u8 typeId, u8 x, u8 y, u8 spriteArrayId)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]];
StartSpriteAnim(sprite, typeId);
sprite->oam.paletteNum = gUnknown_0861CFDC[typeId];
sprite->pos1.x = x + 16;
sprite->pos1.y = y + 8;
sub_81C4204(spriteArrayId, FALSE);
}
void sub_81C43A0(void)
{
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
if (summary->isEgg)
{
sub_81C4318(TYPE_MYSTERY, 0x78, 0x30, 3);
sub_81C4204(4, TRUE);
}
else
{
sub_81C4318(gBaseStats[summary->species].type1, 0x78, 0x30, 3);
if (gBaseStats[summary->species].type1 != gBaseStats[summary->species].type2)
{
sub_81C4318(gBaseStats[summary->species].type2, 0xA0, 0x30, 4);
sub_81C4204(4, FALSE);
}
else
{
sub_81C4204(4, TRUE);
}
}
}
void sub_81C4420(void)
{
u8 i;
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
for (i = 0; i < 4; i++)
{
if (summary->moves[i] != MOVE_NONE)
sub_81C4318(gBattleMoves[summary->moves[i]].type, 0x55, 0x20 + (i * 0x10), i + 3);
else
sub_81C4204(i + 3, TRUE);
}
}
void sub_81C4484(void)
{
u8 i;
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
for (i = 0; i < 4; i++)
{
if (summary->moves[i] != MOVE_NONE)
sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[summary->moves[i]].contestCategory, 0x55, 0x20 + (i * 0x10), i + 3);
else
sub_81C4204(i + 3, TRUE);
}
}
void sub_81C44F0(void)
{
if (gUnknown_0203CF1C->unk40C4 == MOVE_NONE)
{
sub_81C4204(7, TRUE);
}
else
{
if (gUnknown_0203CF1C->unk40C0 == 2)
sub_81C4318(gBattleMoves[gUnknown_0203CF1C->unk40C4].type, 0x55, 0x60, 7);
else
sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[gUnknown_0203CF1C->unk40C4].contestCategory, 0x55, 0x60, 7);
}
}