identify and name battle records things

This commit is contained in:
DizzyEggg 2018-05-01 15:33:13 +02:00
parent 95cf853762
commit ae78786723
23 changed files with 300 additions and 644 deletions

View File

@ -14344,7 +14344,7 @@ sub_81A1C4C: @ 81A1C4C
adds r3, r0, 0 adds r3, r0, 0
lsls r0, r5, 3 lsls r0, r5, 3
adds r5, r0, 0x1 adds r5, r0, 0x1
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
ldrb r0, [r0] ldrb r0, [r0]
lsls r3, 24 lsls r3, 24
lsrs r3, 24 lsrs r3, 24
@ -14370,7 +14370,7 @@ sub_81A1C90: @ 81A1C90
push {r4,lr} push {r4,lr}
sub sp, 0x34 sub sp, 0x34
adds r2, r0, 0 adds r2, r0, 0
ldr r3, =gResultsWindowId ldr r3, =gRecordsWindowId
movs r1, 0xAE movs r1, 0xAE
mov r0, sp mov r0, sp
adds r0, 0x2F adds r0, 0x2F
@ -14425,7 +14425,7 @@ sub_81A1CD8: @ 81A1CD8
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r7, r0, 0 adds r7, r0, 0
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r7, [sp] str r7, [sp]
@ -14644,7 +14644,7 @@ sub_81A1EA8: @ 81A1EA8
sub sp, 0xC sub sp, 0xC
lsls r0, 24 lsls r0, 24
lsrs r7, r0, 24 lsrs r7, r0, 24
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -14685,7 +14685,7 @@ _081A1F28:
ldr r0, =gStringVar4 ldr r0, =gStringVar4
movs r1, 0x2 movs r1, 0x2
bl sub_81A1C4C bl sub_81A1C4C
ldr r6, =gResultsWindowId ldr r6, =gRecordsWindowId
ldrb r0, [r6] ldrb r0, [r6]
ldr r2, =gText_Lv502 ldr r2, =gText_Lv502
movs r1, 0x31 movs r1, 0x31
@ -14798,7 +14798,7 @@ sub_81A2008: @ 81A2008
lsrs r6, 24 lsrs r6, 24
lsls r5, 24 lsls r5, 24
lsrs r5, 24 lsrs r5, 24
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r5, [sp] str r5, [sp]
@ -14932,7 +14932,7 @@ sub_81A2134: @ 81A2134
sub sp, 0xC sub sp, 0xC
lsls r0, 24 lsls r0, 24
lsrs r7, r0, 24 lsrs r7, r0, 24
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -14957,7 +14957,7 @@ _081A2184:
ldr r0, =gStringVar4 ldr r0, =gStringVar4
movs r1, 0 movs r1, 0
bl sub_81A1C4C bl sub_81A1C4C
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
ldr r2, =gText_Lv502 ldr r2, =gText_Lv502
movs r6, 0x21 movs r6, 0x21
@ -14969,7 +14969,7 @@ _081A2184:
movs r1, 0x1 movs r1, 0x1
movs r3, 0x8 movs r3, 0x8
bl PrintTextOnWindow bl PrintTextOnWindow
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
ldr r2, =gText_OpenLv ldr r2, =gText_OpenLv
movs r1, 0x61 movs r1, 0x61
@ -15052,10 +15052,10 @@ _081A2184:
mov r1, r8 mov r1, r8
movs r3, 0x40 movs r3, 0x40
bl sub_81A2008 bl sub_81A2008
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
bl PutWindowTilemap bl PutWindowTilemap
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0x3 movs r1, 0x3
bl CopyWindowToVram bl CopyWindowToVram
@ -15091,7 +15091,7 @@ sub_81A22B8: @ 81A22B8
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r7, r0, 0 adds r7, r0, 0
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r7, [sp] str r7, [sp]
@ -15285,7 +15285,7 @@ sub_81A2460: @ 81A2460
sub sp, 0xC sub sp, 0xC
lsls r0, 24 lsls r0, 24
lsrs r7, r0, 24 lsrs r7, r0, 24
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -15310,7 +15310,7 @@ _081A24B0:
ldr r0, =gStringVar4 ldr r0, =gStringVar4
movs r1, 0x2 movs r1, 0x2
bl sub_81A1C4C bl sub_81A1C4C
ldr r6, =gResultsWindowId ldr r6, =gRecordsWindowId
ldrb r0, [r6] ldrb r0, [r6]
ldr r2, =gText_Lv502 ldr r2, =gText_Lv502
movs r1, 0x31 movs r1, 0x31
@ -15420,7 +15420,7 @@ sub_81A258C: @ 81A258C
lsrs r6, 24 lsrs r6, 24
lsls r5, 24 lsls r5, 24
lsrs r5, 24 lsrs r5, 24
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r5, [sp] str r5, [sp]
@ -15533,7 +15533,7 @@ sub_81A2698: @ 81A2698
mov r5, r8 mov r5, r8
push {r5-r7} push {r5-r7}
sub sp, 0xC sub sp, 0xC
ldr r6, =gResultsWindowId ldr r6, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r6] strb r0, [r6]
@ -15672,7 +15672,7 @@ sub_81A27E8: @ 81A27E8
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r7, r0, 0 adds r7, r0, 0
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r7, [sp] str r7, [sp]
@ -15836,7 +15836,7 @@ _081A2956:
sub_81A2968: @ 81A2968 sub_81A2968: @ 81A2968
push {r4-r6,lr} push {r4-r6,lr}
sub sp, 0xC sub sp, 0xC
ldr r5, =gResultsWindowId ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r5] strb r0, [r5]
@ -15935,7 +15935,7 @@ sub_81A2A28: @ 81A2A28
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r6, r0, 0 adds r6, r0, 0
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r6, [sp] str r6, [sp]
@ -16211,7 +16211,7 @@ sub_81A2C94: @ 81A2C94
sub sp, 0xC sub sp, 0xC
lsls r0, 24 lsls r0, 24
lsrs r7, r0, 24 lsrs r7, r0, 24
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -16236,7 +16236,7 @@ _081A2CE0:
ldr r0, =gStringVar4 ldr r0, =gStringVar4
movs r1, 0 movs r1, 0
bl sub_81A1C4C bl sub_81A1C4C
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r8, r0 mov r8, r0
ldrb r0, [r0] ldrb r0, [r0]
ldr r2, =gText_Lv502 ldr r2, =gText_Lv502
@ -16340,7 +16340,7 @@ sub_81A2DB4: @ 81A2DB4
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r7, r0, 0 adds r7, r0, 0
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
str r7, [sp] str r7, [sp]
@ -16506,7 +16506,7 @@ _081A2F26:
sub_81A2F38: @ 81A2F38 sub_81A2F38: @ 81A2F38
push {r4-r6,lr} push {r4-r6,lr}
sub sp, 0xC sub sp, 0xC
ldr r5, =gResultsWindowId ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74 ldr r0, =gUnknown_08611C74
bl AddWindow bl AddWindow
strb r0, [r5] strb r0, [r5]
@ -16584,7 +16584,7 @@ sub_81A2FF8: @ 81A2FF8
mov r6, r8 mov r6, r8
push {r6,r7} push {r6,r7}
sub sp, 0xC sub sp, 0xC
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C7C ldr r0, =gUnknown_08611C7C
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -16750,7 +16750,7 @@ _081A315C:
movs r2, 0x1 movs r2, 0x1
movs r3, 0x4 movs r3, 0x4
bl ConvertIntToDecimalStringN bl ConvertIntToDecimalStringN
ldr r6, =gResultsWindowId ldr r6, =gRecordsWindowId
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x26 movs r1, 0x26
adds r3, r5, 0 adds r3, r5, 0
@ -19026,7 +19026,7 @@ sub_81A4594: @ 81A4594
sub sp, 0x2C sub sp, 0x2C
mov r8, r1 mov r8, r1
adds r6, r3, 0 adds r6, r3, 0
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r5, [r1] ldrb r5, [r1]
lsls r4, r0, 1 lsls r4, r0, 1
adds r4, r0 adds r4, r0
@ -19062,7 +19062,7 @@ sub_81A4594: @ 81A4594
ldrb r2, [r6, 0xE] ldrb r2, [r6, 0xE]
add r0, sp, 0xC add r0, sp, 0xC
bl TVShowConvertInternationalString bl TVShowConvertInternationalString
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
mov r3, r8 mov r3, r8
adds r3, 0x2 adds r3, 0x2
@ -19102,7 +19102,7 @@ _081A4618:
adds r3, r0, 0 adds r3, r0, 0
lsls r3, 24 lsls r3, 24
lsrs r3, 24 lsrs r3, 24
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
str r7, [sp] str r7, [sp]
mov r1, r10 mov r1, r10
@ -19136,7 +19136,7 @@ sub_81A4684: @ 81A4684
adds r7, r1, 0 adds r7, r1, 0
mov r10, r2 mov r10, r2
adds r5, r3, 0 adds r5, r3, 0
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
lsls r2, r6, 1 lsls r2, r6, 1
adds r2, r6 adds r2, r6
@ -19176,7 +19176,7 @@ sub_81A4684: @ 81A4684
ldrb r2, [r5, 0x1A] ldrb r2, [r5, 0x1A]
add r0, sp, 0xC add r0, sp, 0xC
bl TVShowConvertInternationalString bl TVShowConvertInternationalString
ldr r1, =gResultsWindowId ldr r1, =gRecordsWindowId
ldrb r0, [r1] ldrb r0, [r1]
adds r3, r7, 0x2 adds r3, r7, 0x2
lsls r3, 27 lsls r3, 27
@ -19211,7 +19211,7 @@ _081A4734:
adds r1, r4, 0 adds r1, r4, 0
bl StringCopy bl StringCopy
_081A473C: _081A473C:
ldr r2, =gResultsWindowId ldr r2, =gRecordsWindowId
mov r9, r2 mov r9, r2
ldrb r0, [r2] ldrb r0, [r2]
adds r3, r7, 0x4 adds r3, r7, 0x4
@ -19532,7 +19532,7 @@ sub_81A4998: @ 81A4998
ldr r1, [r5] ldr r1, [r5]
adds r0, r6, 0 adds r0, r6, 0
bl StringExpandPlaceholders bl StringExpandPlaceholders
ldr r0, =gResultsWindowId ldr r0, =gRecordsWindowId
mov r8, r0 mov r8, r0
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x1 movs r1, 0x1
@ -19631,7 +19631,7 @@ _081A4A90:
thumb_func_start sub_81A4AA0 thumb_func_start sub_81A4AA0
sub_81A4AA0: @ 81A4AA0 sub_81A4AA0: @ 81A4AA0
push {r4,lr} push {r4,lr}
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C84 ldr r0, =gUnknown_08611C84
bl AddWindow bl AddWindow
strb r0, [r4] strb r0, [r4]
@ -19659,7 +19659,7 @@ sub_81A4AA0: @ 81A4AA0
thumb_func_start sub_81A4AE8 thumb_func_start sub_81A4AE8
sub_81A4AE8: @ 81A4AE8 sub_81A4AE8: @ 81A4AE8
push {r4,lr} push {r4,lr}
ldr r4, =gResultsWindowId ldr r4, =gRecordsWindowId
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x11 movs r1, 0x11
bl FillWindowPixelBuffer bl FillWindowPixelBuffer

View File

@ -1,545 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_813C5A0
sub_813C5A0: @ 813C5A0
push {r4,lr}
ldr r4, =gResultsWindowId
ldrb r0, [r4]
movs r1, 0
bl sub_819746C
ldrb r0, [r4]
bl RemoveWindow
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C5A0
thumb_func_start sub_813C5BC
sub_813C5BC: @ 813C5BC
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0813C5DC
ldr r0, =gTasks
lsls r1, r2, 2
adds r1, r2
lsls r1, 3
adds r1, r0
ldr r0, =sub_813C5EC
str r0, [r1]
_0813C5DC:
pop {r0}
bx r0
.pool
thumb_func_end sub_813C5BC
thumb_func_start sub_813C5EC
sub_813C5EC: @ 813C5EC
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r4, r1, r0
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _0813C610
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0813C61A
_0813C610:
movs r0, 0x5
bl PlaySE
ldr r0, =sub_813C62C
str r0, [r4]
_0813C61A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C5EC
thumb_func_start sub_813C62C
sub_813C62C: @ 813C62C
push {r4,lr}
sub sp, 0x4
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_813C664
str r1, [r0]
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C62C
thumb_func_start sub_813C664
sub_813C664: @ 813C664
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0813C694
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
ldr r0, =gUnknown_0203AB78
ldr r0, [r0]
bl Free
movs r0, 0
bl sub_813C6A8
bl FreeAllWindowBuffers
adds r0, r4, 0
bl DestroyTask
_0813C694:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C664
thumb_func_start sub_813C6A8
sub_813C6A8: @ 813C6A8
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
movs r1, 0
bl FillWindowPixelBuffer
adds r0, r4, 0
bl ClearWindowTilemap
adds r0, r4, 0
movs r1, 0x2
bl CopyWindowToVram
adds r0, r4, 0
bl RemoveWindow
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_813C6A8
thumb_func_start sub_813C6D4
sub_813C6D4: @ 813C6D4
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
movs r3, 0xC0
lsls r3, 19
movs r4, 0xC0
lsls r4, 9
add r0, sp, 0x4
mov r8, r0
mov r2, sp
movs r6, 0
ldr r1, =0x040000d4
movs r5, 0x80
lsls r5, 5
ldr r7, =0x81000800
movs r0, 0x81
lsls r0, 24
mov r12, r0
_0813C6FA:
strh r6, [r2]
mov r0, sp
str r0, [r1]
str r3, [r1, 0x4]
str r7, [r1, 0x8]
ldr r0, [r1, 0x8]
adds r3, r5
subs r4, r5
cmp r4, r5
bhi _0813C6FA
strh r6, [r2]
mov r2, sp
str r2, [r1]
str r3, [r1, 0x4]
lsrs r0, r4, 1
mov r2, r12
orrs r0, r2
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r0, 0xE0
lsls r0, 19
movs r3, 0x80
lsls r3, 3
movs r4, 0
str r4, [sp, 0x4]
ldr r2, =0x040000d4
mov r1, r8
str r1, [r2]
str r0, [r2, 0x4]
lsrs r0, r3, 2
movs r1, 0x85
lsls r1, 24
orrs r0, r1
str r0, [r2, 0x8]
ldr r0, [r2, 0x8]
movs r1, 0xA0
lsls r1, 19
mov r0, sp
strh r4, [r0]
str r0, [r2]
str r1, [r2, 0x4]
lsrs r3, 1
movs r0, 0x81
lsls r0, 24
orrs r3, r0
str r3, [r2, 0x8]
ldr r0, [r2, 0x8]
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0x8
movs r1, 0
bl SetGpuReg
movs r0, 0x10
movs r1, 0
bl SetGpuReg
movs r0, 0x12
movs r1, 0
bl SetGpuReg
movs r0, 0xA
movs r1, 0
bl SetGpuReg
movs r0, 0x14
movs r1, 0
bl SetGpuReg
movs r0, 0x16
movs r1, 0
bl SetGpuReg
movs r0, 0xC
movs r1, 0
bl SetGpuReg
movs r0, 0x18
movs r1, 0
bl SetGpuReg
movs r0, 0x1A
movs r1, 0
bl SetGpuReg
movs r0, 0xE
movs r1, 0
bl SetGpuReg
movs r0, 0x1C
movs r1, 0
bl SetGpuReg
movs r0, 0x1E
movs r1, 0
bl SetGpuReg
movs r0, 0x40
movs r1, 0
bl SetGpuReg
movs r0, 0x44
movs r1, 0
bl SetGpuReg
movs r0, 0x48
movs r1, 0
bl SetGpuReg
movs r0, 0x4A
movs r1, 0
bl SetGpuReg
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x54
movs r1, 0
bl SetGpuReg
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C6D4
thumb_func_start sub_813C80C
sub_813C80C: @ 813C80C
push {lr}
bl ScanlineEffect_Stop
bl ResetTasks
bl ResetSpriteData
bl ResetPaletteFade
bl FreeAllSpritePalettes
pop {r0}
bx r0
thumb_func_end sub_813C80C
thumb_func_start sub_813C828
sub_813C828: @ 813C828
push {lr}
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgY
pop {r0}
bx r0
thumb_func_end sub_813C828
thumb_func_start sub_813C880
sub_813C880: @ 813C880
push {lr}
movs r1, 0x94
lsls r1, 4
movs r0, 0
bl SetGpuReg
pop {r0}
bx r0
thumb_func_end sub_813C880
thumb_func_start sub_813C890
sub_813C890: @ 813C890
push {r4,lr}
sub sp, 0x8
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, =gUnknown_085B3484
adds r0, r4, 0
movs r2, 0xC0
movs r3, 0
bl LoadBgTiles
ldr r1, =gUnknown_085B3564
movs r0, 0x20
str r0, [sp]
str r0, [sp, 0x4]
adds r0, r4, 0
movs r2, 0
movs r3, 0
bl CopyToBgTilemapBufferRect
ldr r0, =gUnknown_085B3544
movs r1, 0
movs r2, 0x20
bl LoadPalette
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C890
thumb_func_start sub_813C8D8
sub_813C8D8: @ 813C8D8
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_813C8D8
thumb_func_start sub_813C8EC
sub_813C8EC: @ 813C8EC
push {lr}
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_813C8EC
thumb_func_start sub_813C904
sub_813C904: @ 813C904
push {lr}
movs r0, 0
bl SetVBlankCallback
ldr r0, =sub_813C91C
bl SetMainCallback2
pop {r0}
bx r0
.pool
thumb_func_end sub_813C904
thumb_func_start sub_813C91C
sub_813C91C: @ 813C91C
push {r4,lr}
sub sp, 0x4
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0x7
bls _0813C930
b _0813CA3C
_0813C930:
lsls r0, 2
ldr r1, =_0813C944
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0813C944:
.4byte _0813C964
.4byte _0813C970
.4byte _0813C976
.4byte _0813C9A8
.4byte _0813C9BE
.4byte _0813C9DE
.4byte _0813C9F0
.4byte _0813CA14
_0813C964:
movs r0, 0
bl SetVBlankCallback
bl sub_813C6D4
b _0813CA00
_0813C970:
bl sub_813C80C
b _0813CA00
_0813C976:
ldr r4, =gUnknown_0203AB78
movs r0, 0x80
lsls r0, 4
bl AllocZeroed
str r0, [r4]
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085B3D64
movs r0, 0
movs r2, 0x2
bl InitBgsFromTemplates
ldr r1, [r4]
movs r0, 0x3
bl SetBgTilemapBuffer
bl sub_813C828
b _0813CA00
.pool
_0813C9A8:
movs r0, 0x3
bl sub_813C890
movs r0, 0
bl stdpal_get
movs r1, 0xF0
movs r2, 0x20
bl LoadPalette
b _0813CA00
_0813C9BE:
bl IsDma3ManagerBusyWithBgCopy
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _0813CA3C
movs r0, 0
bl ShowBg
movs r0, 0x3
bl ShowBg
movs r0, 0x3
bl CopyBgTilemapBufferToVram
b _0813CA00
_0813C9DE:
ldr r0, =gUnknown_085B3D6C
bl InitWindows
bl DeactivateAllTextPrinters
b _0813CA00
.pool
_0813C9F0:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
_0813CA00:
ldr r1, =gMain
movs r0, 0x87
lsls r0, 3
adds r1, r0
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _0813CA3C
.pool
_0813CA14:
bl sub_813C880
ldr r0, =sub_813C8D8
bl SetVBlankCallback
bl sub_81D5C8C
ldr r0, =sub_813C5BC
movs r1, 0x8
bl CreateTask
ldr r0, =sub_813C8EC
bl SetMainCallback2
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
movs r1, 0
strb r1, [r0]
_0813CA3C:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813C91C
.align 2, 0 @ Don't pad with nop.

View File

@ -28718,8 +28718,8 @@ nullsub_2: @ 81D5C88
bx lr bx lr
thumb_func_end nullsub_2 thumb_func_end nullsub_2
thumb_func_start sub_81D5C8C thumb_func_start PrintOnTrainerHillRecordsWindow
sub_81D5C8C: @ 81D5C8C PrintOnTrainerHillRecordsWindow: @ 81D5C8C
push {r4-r7,lr} push {r4-r7,lr}
mov r7, r10 mov r7, r10
mov r6, r9 mov r6, r9
@ -28857,7 +28857,7 @@ _081D5CD6:
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end sub_81D5C8C thumb_func_end PrintOnTrainerHillRecordsWindow
thumb_func_start free_203F458 thumb_func_start free_203F458
free_203F458: @ 81D5DF0 free_203F458: @ 81D5DF0

View File

@ -789,7 +789,7 @@ gUnknown_08277365:: @ 8277365
setvar VAR_0x8004, 0 setvar VAR_0x8004, 0
special ShowLinkBattleRecords special ShowLinkBattleRecords
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -348,7 +348,7 @@ BattleFrontier_BattleArenaLobby_EventScript_256092:: @ 8256092
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -415,7 +415,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D52:: @ 8249D52
setvar VAR_0x8006, 0 setvar VAR_0x8006, 0
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -426,7 +426,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D6B:: @ 8249D6B
setvar VAR_0x8006, 1 setvar VAR_0x8006, 1
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -305,7 +305,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587E1:: @ 82587E1
setvar VAR_0x8006, 0 setvar VAR_0x8006, 0
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -316,7 +316,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587FA:: @ 82587FA
setvar VAR_0x8006, 1 setvar VAR_0x8006, 1
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -366,7 +366,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC50:: @ 824DC50
setvar VAR_0x8006, 0 setvar VAR_0x8006, 0
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -377,7 +377,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC69:: @ 824DC69
setvar VAR_0x8006, 1 setvar VAR_0x8006, 1
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -257,7 +257,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25BA80:: @ 825BA80
setvar VAR_0x8005, 5 setvar VAR_0x8005, 5
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -428,7 +428,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250D42:: @ 8250D42
setvar VAR_0x8005, 6 setvar VAR_0x8005, 6
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -636,7 +636,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFC7:: @ 823EFC7
setvar VAR_0x8006, 0 setvar VAR_0x8006, 0
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -647,7 +647,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFE0:: @ 823EFE0
setvar VAR_0x8006, 1 setvar VAR_0x8006, 1
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -658,7 +658,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFF9:: @ 823EFF9
setvar VAR_0x8006, 2 setvar VAR_0x8006, 2
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -669,7 +669,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F012:: @ 823F012
setvar VAR_0x8006, 3 setvar VAR_0x8006, 3
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -66,7 +66,7 @@ BattleFrontier_RankingHall_EventScript_25E522:: @ 825E522
waitbuttonpress waitbuttonpress
special sub_81A4AE8 special sub_81A4AE8
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -554,7 +554,7 @@ LilycoveCity_ContestLobby_EventScript_21A77A:: @ 821A77A
lockall lockall
special ShowBerryBlenderRecordWindow special ShowBerryBlenderRecordWindow
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end
@ -564,7 +564,7 @@ LilycoveCity_ContestLobby_EventScript_21A784:: @ 821A784
setvar VAR_0x8005, 7 setvar VAR_0x8005, 7
special sub_81A1780 special sub_81A1780
waitbuttonpress waitbuttonpress
special sub_813C5A0 special RemoveRecordsWindow
releaseall releaseall
end end

View File

@ -236,7 +236,7 @@ TrainerHill_Entrance_Movement_268385: @ 8268385
TrainerHill_Entrance_EventScript_268388:: @ 8268388 TrainerHill_Entrance_EventScript_268388:: @ 8268388
lockall lockall
fadescreen 1 fadescreen 1
special sub_813C904 special ShowTrainerHillRecords
waitstate waitstate
releaseall releaseall
end end

View File

@ -526,12 +526,12 @@ gSpecials:: @ 81DBA64
def_special sub_8139ED0 def_special sub_8139ED0
def_special sub_813B968 def_special sub_813B968
def_special sub_80F8B94 def_special sub_80F8B94
def_special sub_813C904 def_special ShowTrainerHillRecords
def_special sub_80B4808 def_special sub_80B4808
def_special sub_813B9A0 def_special sub_813B9A0
def_special sub_81B9918 def_special sub_81B9918
def_special sub_80722E0 def_special sub_80722E0
def_special sub_80B45D0 def_special sub_80B45D0
def_special sub_813C5A0 def_special RemoveRecordsWindow
def_special sub_8139C10 def_special sub_8139C10
def_special sub_80B3BC4 def_special sub_80B3BC4

View File

@ -1,9 +1,12 @@
#ifndef GUARD_BATTLE_RECORDS_H #ifndef GUARD_BATTLE_RECORDS_H
#define GUARD_BATTLE_RECORDS_H #define GUARD_BATTLE_RECORDS_H
extern u8 gRecordsWindowId;
void ClearPlayerLinkBattleRecords(void); void ClearPlayerLinkBattleRecords(void);
void UpdatePlayerLinkBattleRecords(s32 battlerId); void UpdatePlayerLinkBattleRecords(s32 battlerId);
void ShowLinkBattleRecords(void); void ShowLinkBattleRecords(void);
void ShowBattleTowerRecords(void); void RemoveRecordsWindow(void);
void ShowTrainerHillRecords(void);
#endif // GUARD_BATTLE_RECORDS_H #endif // GUARD_BATTLE_RECORDS_H

View File

@ -68,7 +68,7 @@ void UnsetBgTilemapBuffer(u8 bg);
void* GetBgTilemapBuffer(u8 bg); void* GetBgTilemapBuffer(u8 bg);
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset); void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset);
void CopyBgTilemapBufferToVram(u8 bg); void CopyBgTilemapBufferToVram(u8 bg);
void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height); void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height);
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette); void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette);
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2); void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2);
void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height); void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height);

View File

@ -1,8 +1,6 @@
#ifndef GUARD_PALETTE_H #ifndef GUARD_PALETTE_H
#define GUARD_PALETTE_H #define GUARD_PALETTE_H
#include "global.h"
#define gPaletteFade_selectedPalettes (gPaletteFade.multipurpose1) // normal and fast fade #define gPaletteFade_selectedPalettes (gPaletteFade.multipurpose1) // normal and fast fade
#define gPaletteFade_blendCnt (gPaletteFade.multipurpose1) // hardware fade #define gPaletteFade_blendCnt (gPaletteFade.multipurpose1) // hardware fade
#define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade #define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade

View File

@ -185,7 +185,6 @@ SECTIONS {
src/hof_pc.o(.text); src/hof_pc.o(.text);
asm/field_specials.o(.text); asm/field_specials.o(.text);
src/battle_records.o(.text); src/battle_records.o(.text);
asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text); asm/pokedex_area_screen.o(.text);
src/evolution_scene.o(.text); src/evolution_scene.o(.text);
asm/roulette.o(.text); asm/roulette.o(.text);

View File

@ -6,15 +6,34 @@
#include "battle.h" #include "battle.h"
#include "overworld.h" #include "overworld.h"
#include "text.h" #include "text.h"
#include "text_window.h"
#include "strings.h" #include "strings.h"
#include "string_util.h" #include "string_util.h"
#include "trainer_card.h" #include "trainer_card.h"
#include "menu.h" #include "menu.h"
#include "menu_helpers.h" #include "menu_helpers.h"
#include "palette.h"
#include "main.h"
#include "scanline_effect.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "sound.h"
#include "constants/songs.h"
#include "malloc.h"
#include "gpu_regs.h"
#include "constants/game_stat.h" #include "constants/game_stat.h"
extern u8 gResultsWindowId; extern void PrintOnTrainerHillRecordsWindow(void); // pokenav.s
// this file's functions
static void sub_813C5EC(u8 taskId);
static void sub_813C62C(u8 taskId);
static void sub_813C664(u8 taskId);
static void sub_813C6A8(u8 windowId);
static void sub_813C91C(void);
// EWRAM variables
EWRAM_DATA u8 gRecordsWindowId = 0;
EWRAM_DATA static u8 *sUnknown_0203AB78 = NULL;
// const rom data // const rom data
const u32 gUnknown_085B3484[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp"); const u32 gUnknown_085B3484[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
@ -192,7 +211,7 @@ void ClearPlayerLinkBattleRecords(void)
ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries); ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries);
} }
static void IncTrainerCardWins(int battlerId) static void IncTrainerCardWins(s32 battlerId)
{ {
u16 *wins = &gTrainerCards[battlerId].linkBattleWins; u16 *wins = &gTrainerCards[battlerId].linkBattleWins;
(*wins)++; (*wins)++;
@ -200,7 +219,7 @@ static void IncTrainerCardWins(int battlerId)
*wins = 9999; *wins = 9999;
} }
static void IncTrainerCardLosses(int battlerId) static void IncTrainerCardLosses(s32 battlerId)
{ {
u16 *losses = &gTrainerCards[battlerId].linkBattleLosses; u16 *losses = &gTrainerCards[battlerId].linkBattleLosses;
(*losses)++; (*losses)++;
@ -208,7 +227,7 @@ static void IncTrainerCardLosses(int battlerId)
*losses = 9999; *losses = 9999;
} }
static void UpdateTrainerCardWinsLosses(int battlerId) static void UpdateTrainerCardWinsLosses(s32 battlerId)
{ {
switch (gBattleOutcome) switch (gBattleOutcome)
{ {
@ -223,7 +242,7 @@ static void UpdateTrainerCardWinsLosses(int battlerId)
} }
} }
void UpdatePlayerLinkBattleRecords(int battlerId) void UpdatePlayerLinkBattleRecords(s32 battlerId)
{ {
if (InUnionRoom() != TRUE) if (InUnionRoom() != TRUE)
{ {
@ -247,7 +266,7 @@ static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records)
StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD); StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD);
x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0); x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar4, x, 0x11, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 0x11, 0, NULL);
} }
static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 language) static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 language)
@ -255,10 +274,10 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan
if (record->wins == 0 && record->losses == 0 && record->draws == 0) if (record->wins == 0 && record->losses == 0 && record->draws == 0)
{ {
// empty slot // empty slot
PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D84, 8, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D84, 8, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 80, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 80, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 128, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 128, (y * 8) + 1, 0, NULL);
PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 176, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 176, (y * 8) + 1, 0, NULL);
} }
else else
{ {
@ -266,16 +285,16 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan
StringCopyN(gStringVar1, record->name, 7); StringCopyN(gStringVar1, record->name, 7);
ConvertInternationalString(gStringVar1, language); ConvertInternationalString(gStringVar1, language);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar1, 8, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 8, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->wins, STR_CONV_MODE_RIGHT_ALIGN, 4); ConvertIntToDecimalStringN(gStringVar1, record->wins, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar1, 80, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 80, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->losses, STR_CONV_MODE_RIGHT_ALIGN, 4); ConvertIntToDecimalStringN(gStringVar1, record->losses, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar1, 128, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 128, (y * 8) + 1, 0, NULL);
ConvertIntToDecimalStringN(gStringVar1, record->draws, STR_CONV_MODE_RIGHT_ALIGN, 4); ConvertIntToDecimalStringN(gStringVar1, record->draws, STR_CONV_MODE_RIGHT_ALIGN, 4);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar1, 176, (y * 8) + 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 176, (y * 8) + 1, 0, NULL);
} }
} }
@ -283,23 +302,209 @@ void ShowLinkBattleRecords(void)
{ {
s32 i, x; s32 i, x;
gResultsWindowId = AddWindow(&gUnknown_085B3D7C); gRecordsWindowId = AddWindow(&gUnknown_085B3D7C);
NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, FALSE); NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
FillWindowPixelBuffer(gResultsWindowId, 0x11); FillWindowPixelBuffer(gRecordsWindowId, 0x11);
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults); StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
x = GetStringCenterAlignXOffset(1, gStringVar4, 208); x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar4, x, 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 1, 0, NULL);
PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries); PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries);
StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw); StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw);
PrintTextOnWindow(gResultsWindowId, 1, gStringVar4, 0, 41, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, 0, 41, 0, NULL);
for (i = 0; i < LINK_B_RECORDS_COUNT; i++) for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
{ {
PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]); PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]);
} }
PutWindowTilemap(gResultsWindowId); PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gResultsWindowId, 3); CopyWindowToVram(gRecordsWindowId, 3);
}
void RemoveRecordsWindow(void)
{
sub_819746C(gRecordsWindowId, FALSE);
RemoveWindow(gRecordsWindowId);
}
static void sub_813C5BC(u8 taskId)
{
if (!gPaletteFade.active)
gTasks[taskId].func = sub_813C5EC;
}
static void sub_813C5EC(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
task->func = sub_813C62C;
}
}
static void sub_813C62C(u8 taskId)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gTasks[taskId].func = sub_813C664;
}
static void sub_813C664(u8 taskId)
{
if (!gPaletteFade.active)
{
SetMainCallback2(CB2_ReturnToFieldContinueScript);
Free(sUnknown_0203AB78);
sub_813C6A8(0);
FreeAllWindowBuffers();
DestroyTask(taskId);
}
}
static void sub_813C6A8(u8 windowId)
{
FillWindowPixelBuffer(windowId, 0);
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 2);
RemoveWindow(windowId);
}
static void sub_813C6D4(void)
{
DmaClearLarge16(3, (void*)(VRAM), VRAM_SIZE, 0x1000);
DmaClear32(3, OAM, OAM_SIZE);
DmaClear16(3, PLTT, PLTT_SIZE);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG3CNT, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
}
static void sub_813C80C(void)
{
ScanlineEffect_Stop();
ResetTasks();
ResetSpriteData();
ResetPaletteFade();
FreeAllSpritePalettes();
}
static void ResetBgCoordinates(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
}
static void sub_813C880(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP);
}
static void sub_813C890(u8 bgId)
{
LoadBgTiles(bgId, gUnknown_085B3484, sizeof(gUnknown_085B3484), 0);
CopyToBgTilemapBufferRect(bgId, gUnknown_085B3564, 0, 0, 0x20, 0x20);
LoadPalette(gUnknown_085B3544, 0, 0x20);
}
static void sub_813C8D8(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static void sub_813C8EC(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
void ShowTrainerHillRecords(void)
{
SetVBlankCallback(NULL);
SetMainCallback2(sub_813C91C);
}
static void sub_813C91C(void)
{
switch (gMain.state)
{
case 0:
SetVBlankCallback(NULL);
sub_813C6D4();
gMain.state++;
break;
case 1:
sub_813C80C();
gMain.state++;
break;
case 2:
sUnknown_0203AB78 = AllocZeroed(0x800);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_085B3D64, ARRAY_COUNT(gUnknown_085B3D64));
SetBgTilemapBuffer(3, sUnknown_0203AB78);
ResetBgCoordinates();
gMain.state++;
break;
case 3:
sub_813C890(3);
LoadPalette(stdpal_get(0), 0xF0, 0x20);
gMain.state++;
break;
case 4:
if (IsDma3ManagerBusyWithBgCopy() != TRUE)
{
ShowBg(0);
ShowBg(3);
CopyBgTilemapBufferToVram(3);
gMain.state++;
}
break;
case 5:
InitWindows(gUnknown_085B3D6C);
DeactivateAllTextPrinters();
gMain.state++;
break;
case 6:
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
gMain.state++;
break;
case 7:
sub_813C880();
SetVBlankCallback(sub_813C8D8);
PrintOnTrainerHillRecordsWindow();
CreateTask(sub_813C5BC, 8);
SetMainCallback2(sub_813C8EC);
gMain.state = 0;
break;
}
} }

View File

@ -30,6 +30,7 @@
#include "trig.h" #include "trig.h"
#include "tv.h" #include "tv.h"
#include "item_menu.h" #include "item_menu.h"
#include "battle_records.h"
#define BLENDER_SCORE_BEST 0 #define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1 #define BLENDER_SCORE_GOOD 1
@ -131,7 +132,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u8 gInGameOpponentsNo; extern u8 gInGameOpponentsNo;
extern u8 gUnknown_020322D5; extern u8 gUnknown_020322D5;
extern u8 gResultsWindowId;
// graphics // graphics
extern const u8 gBerryBlenderArrowTiles[]; extern const u8 gBerryBlenderArrowTiles[];
@ -3485,13 +3485,13 @@ void ShowBerryBlenderRecordWindow(void)
u8 text[32]; u8 text[32];
winTemplate = sBlenderRecordWindowTemplate; winTemplate = sBlenderRecordWindowTemplate;
gResultsWindowId = AddWindow(&winTemplate); gRecordsWindowId = AddWindow(&winTemplate);
NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, 0); NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, 0);
FillWindowPixelBuffer(gResultsWindowId, 0x11); FillWindowPixelBuffer(gRecordsWindowId, 0x11);
xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90); xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90);
PrintTextOnWindow(gResultsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
PrintTextOnWindow(gResultsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL);
for (i = 0, yPos = 0x29; i < BLENDER_SCORES_NO; i++) for (i = 0, yPos = 0x29; i < BLENDER_SCORES_NO; i++)
{ {
@ -3506,11 +3506,11 @@ void ShowBerryBlenderRecordWindow(void)
txtPtr = StringAppend(txtPtr, sText_RPM); txtPtr = StringAppend(txtPtr, sText_RPM);
xPos = GetStringRightAlignXOffset(1, text, 0x8C); xPos = GetStringRightAlignXOffset(1, text, 0x8C);
PrintTextOnWindow(gResultsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL); PrintTextOnWindow(gRecordsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL);
} }
PutWindowTilemap(gResultsWindowId); PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gResultsWindowId, 3); CopyWindowToVram(gRecordsWindowId, 3);
} }
static void sub_8083F3C(u8 taskId) static void sub_8083F3C(u8 taskId)

View File

@ -965,9 +965,9 @@ void CopyBgTilemapBufferToVram(u8 bg)
} }
} }
void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height) void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
{ {
void* srcCopy; const void* srcCopy;
u16 destX16; u16 destX16;
u16 destY16; u16 destY16;
u16 mode; u16 mode;

View File

@ -713,11 +713,7 @@ gUnknown_0203AB6F: @ 203AB6F
gUnknown_0203AB70: @ 203AB70 gUnknown_0203AB70: @ 203AB70
.space 0x4 .space 0x4
gResultsWindowId: @ 203AB74 .include "src/battle_records.o"
.space 0x4
gUnknown_0203AB78: @ 203AB78
.space 0x4
gUnknown_0203AB7C: @ 203AB7C gUnknown_0203AB7C: @ 203AB7C
.space 0x4 .space 0x4