summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2018-05-01 15:33:13 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2018-05-01 15:33:13 +0200
commitae7878672379cf8bc1e071c3cc392696785ac3e6 (patch)
treeab06e5b1d7de06f1b1292ee57792c4708360f92d
parent95cf853762e4202dbfece323c5cf454984ca37c5 (diff)
identify and name battle records things
-rw-r--r--asm/battle_frontier_2.s68
-rw-r--r--asm/battle_records.s545
-rw-r--r--asm/pokenav.s6
-rw-r--r--data/scripts/cable_club.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleArenaLobby.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleDomeLobby.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePikeLobby.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleTowerLobby.inc8
-rw-r--r--data/scripts/maps/BattleFrontier_RankingHall.inc2
-rw-r--r--data/scripts/maps/LilycoveCity_ContestLobby.inc4
-rw-r--r--data/scripts/maps/TrainerHill_Entrance.inc2
-rw-r--r--data/specials.inc4
-rw-r--r--include/battle_records.h5
-rw-r--r--include/bg.h2
-rw-r--r--include/palette.h2
-rw-r--r--ld_script.txt1
-rw-r--r--src/battle_records.c247
-rw-r--r--src/berry_blender.c18
-rw-r--r--src/bg.c4
-rw-r--r--sym_ewram.txt6
23 files changed, 300 insertions, 644 deletions
diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s
index 491a87948..0aefd1605 100644
--- a/asm/battle_frontier_2.s
+++ b/asm/battle_frontier_2.s
@@ -14344,7 +14344,7 @@ sub_81A1C4C: @ 81A1C4C
adds r3, r0, 0
lsls r0, r5, 3
adds r5, r0, 0x1
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
ldrb r0, [r0]
lsls r3, 24
lsrs r3, 24
@@ -14370,7 +14370,7 @@ sub_81A1C90: @ 81A1C90
push {r4,lr}
sub sp, 0x34
adds r2, r0, 0
- ldr r3, =gResultsWindowId
+ ldr r3, =gRecordsWindowId
movs r1, 0xAE
mov r0, sp
adds r0, 0x2F
@@ -14425,7 +14425,7 @@ sub_81A1CD8: @ 81A1CD8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@@ -14644,7 +14644,7 @@ sub_81A1EA8: @ 81A1EA8
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@@ -14685,7 +14685,7 @@ _081A1F28:
ldr r0, =gStringVar4
movs r1, 0x2
bl sub_81A1C4C
- ldr r6, =gResultsWindowId
+ ldr r6, =gRecordsWindowId
ldrb r0, [r6]
ldr r2, =gText_Lv502
movs r1, 0x31
@@ -14798,7 +14798,7 @@ sub_81A2008: @ 81A2008
lsrs r6, 24
lsls r5, 24
lsrs r5, 24
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r5, [sp]
@@ -14932,7 +14932,7 @@ sub_81A2134: @ 81A2134
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@@ -14957,7 +14957,7 @@ _081A2184:
ldr r0, =gStringVar4
movs r1, 0
bl sub_81A1C4C
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
ldr r2, =gText_Lv502
movs r6, 0x21
@@ -14969,7 +14969,7 @@ _081A2184:
movs r1, 0x1
movs r3, 0x8
bl PrintTextOnWindow
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
ldr r2, =gText_OpenLv
movs r1, 0x61
@@ -15052,10 +15052,10 @@ _081A2184:
mov r1, r8
movs r3, 0x40
bl sub_81A2008
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
bl PutWindowTilemap
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
movs r1, 0x3
bl CopyWindowToVram
@@ -15091,7 +15091,7 @@ sub_81A22B8: @ 81A22B8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@@ -15285,7 +15285,7 @@ sub_81A2460: @ 81A2460
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@@ -15310,7 +15310,7 @@ _081A24B0:
ldr r0, =gStringVar4
movs r1, 0x2
bl sub_81A1C4C
- ldr r6, =gResultsWindowId
+ ldr r6, =gRecordsWindowId
ldrb r0, [r6]
ldr r2, =gText_Lv502
movs r1, 0x31
@@ -15420,7 +15420,7 @@ sub_81A258C: @ 81A258C
lsrs r6, 24
lsls r5, 24
lsrs r5, 24
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r5, [sp]
@@ -15533,7 +15533,7 @@ sub_81A2698: @ 81A2698
mov r5, r8
push {r5-r7}
sub sp, 0xC
- ldr r6, =gResultsWindowId
+ ldr r6, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r6]
@@ -15672,7 +15672,7 @@ sub_81A27E8: @ 81A27E8
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@@ -15836,7 +15836,7 @@ _081A2956:
sub_81A2968: @ 81A2968
push {r4-r6,lr}
sub sp, 0xC
- ldr r5, =gResultsWindowId
+ ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r5]
@@ -15935,7 +15935,7 @@ sub_81A2A28: @ 81A2A28
lsls r0, 24
lsrs r0, 24
adds r6, r0, 0
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r6, [sp]
@@ -16211,7 +16211,7 @@ sub_81A2C94: @ 81A2C94
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r4]
@@ -16236,7 +16236,7 @@ _081A2CE0:
ldr r0, =gStringVar4
movs r1, 0
bl sub_81A1C4C
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r8, r0
ldrb r0, [r0]
ldr r2, =gText_Lv502
@@ -16340,7 +16340,7 @@ sub_81A2DB4: @ 81A2DB4
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r10, r0
ldrb r0, [r0]
str r7, [sp]
@@ -16506,7 +16506,7 @@ _081A2F26:
sub_81A2F38: @ 81A2F38
push {r4-r6,lr}
sub sp, 0xC
- ldr r5, =gResultsWindowId
+ ldr r5, =gRecordsWindowId
ldr r0, =gUnknown_08611C74
bl AddWindow
strb r0, [r5]
@@ -16584,7 +16584,7 @@ sub_81A2FF8: @ 81A2FF8
mov r6, r8
push {r6,r7}
sub sp, 0xC
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C7C
bl AddWindow
strb r0, [r4]
@@ -16750,7 +16750,7 @@ _081A315C:
movs r2, 0x1
movs r3, 0x4
bl ConvertIntToDecimalStringN
- ldr r6, =gResultsWindowId
+ ldr r6, =gRecordsWindowId
ldrb r0, [r6]
movs r1, 0x26
adds r3, r5, 0
@@ -19026,7 +19026,7 @@ sub_81A4594: @ 81A4594
sub sp, 0x2C
mov r8, r1
adds r6, r3, 0
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r5, [r1]
lsls r4, r0, 1
adds r4, r0
@@ -19062,7 +19062,7 @@ sub_81A4594: @ 81A4594
ldrb r2, [r6, 0xE]
add r0, sp, 0xC
bl TVShowConvertInternationalString
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
mov r3, r8
adds r3, 0x2
@@ -19102,7 +19102,7 @@ _081A4618:
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
str r7, [sp]
mov r1, r10
@@ -19136,7 +19136,7 @@ sub_81A4684: @ 81A4684
adds r7, r1, 0
mov r10, r2
adds r5, r3, 0
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
lsls r2, r6, 1
adds r2, r6
@@ -19176,7 +19176,7 @@ sub_81A4684: @ 81A4684
ldrb r2, [r5, 0x1A]
add r0, sp, 0xC
bl TVShowConvertInternationalString
- ldr r1, =gResultsWindowId
+ ldr r1, =gRecordsWindowId
ldrb r0, [r1]
adds r3, r7, 0x2
lsls r3, 27
@@ -19211,7 +19211,7 @@ _081A4734:
adds r1, r4, 0
bl StringCopy
_081A473C:
- ldr r2, =gResultsWindowId
+ ldr r2, =gRecordsWindowId
mov r9, r2
ldrb r0, [r2]
adds r3, r7, 0x4
@@ -19532,7 +19532,7 @@ sub_81A4998: @ 81A4998
ldr r1, [r5]
adds r0, r6, 0
bl StringExpandPlaceholders
- ldr r0, =gResultsWindowId
+ ldr r0, =gRecordsWindowId
mov r8, r0
ldrb r0, [r0]
movs r1, 0x1
@@ -19631,7 +19631,7 @@ _081A4A90:
thumb_func_start sub_81A4AA0
sub_81A4AA0: @ 81A4AA0
push {r4,lr}
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldr r0, =gUnknown_08611C84
bl AddWindow
strb r0, [r4]
@@ -19659,7 +19659,7 @@ sub_81A4AA0: @ 81A4AA0
thumb_func_start sub_81A4AE8
sub_81A4AE8: @ 81A4AE8
push {r4,lr}
- ldr r4, =gResultsWindowId
+ ldr r4, =gRecordsWindowId
ldrb r0, [r4]
movs r1, 0x11
bl FillWindowPixelBuffer
diff --git a/asm/battle_records.s b/asm/battle_records.s
deleted file mode 100644
index 69e207b61..000000000
--- a/asm/battle_records.s
+++ /dev/null
@@ -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.
diff --git a/asm/pokenav.s b/asm/pokenav.s
index 47f350b29..9c42ed730 100644
--- a/asm/pokenav.s
+++ b/asm/pokenav.s
@@ -28718,8 +28718,8 @@ nullsub_2: @ 81D5C88
bx lr
thumb_func_end nullsub_2
- thumb_func_start sub_81D5C8C
-sub_81D5C8C: @ 81D5C8C
+ thumb_func_start PrintOnTrainerHillRecordsWindow
+PrintOnTrainerHillRecordsWindow: @ 81D5C8C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@@ -28857,7 +28857,7 @@ _081D5CD6:
pop {r0}
bx r0
.pool
- thumb_func_end sub_81D5C8C
+ thumb_func_end PrintOnTrainerHillRecordsWindow
thumb_func_start free_203F458
free_203F458: @ 81D5DF0
diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc
index 870e4e305..499766dc3 100644
--- a/data/scripts/cable_club.inc
+++ b/data/scripts/cable_club.inc
@@ -789,7 +789,7 @@ gUnknown_08277365:: @ 8277365
setvar VAR_0x8004, 0
special ShowLinkBattleRecords
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
index 303a2c4c9..fb61415e4 100644
--- a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
@@ -348,7 +348,7 @@ BattleFrontier_BattleArenaLobby_EventScript_256092:: @ 8256092
setvar VAR_0x8005, 3
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
index 33b5654d0..79a8284e3 100644
--- a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
@@ -415,7 +415,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D52:: @ 8249D52
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -426,7 +426,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249D6B:: @ 8249D6B
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc b/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
index 791a666d5..bfa6d6793 100644
--- a/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
@@ -305,7 +305,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587E1:: @ 82587E1
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -316,7 +316,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2587FA:: @ 82587FA
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
index 2e0f152b4..175d7325b 100644
--- a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
@@ -366,7 +366,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC50:: @ 824DC50
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -377,7 +377,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DC69:: @ 824DC69
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
index 40b5e437f..9e2964071 100644
--- a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
@@ -257,7 +257,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25BA80:: @ 825BA80
setvar VAR_0x8005, 5
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
index 9455479a7..e06a4f00f 100644
--- a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
@@ -428,7 +428,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250D42:: @ 8250D42
setvar VAR_0x8005, 6
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
index def3dd122..8675df345 100644
--- a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
@@ -636,7 +636,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFC7:: @ 823EFC7
setvar VAR_0x8006, 0
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -647,7 +647,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFE0:: @ 823EFE0
setvar VAR_0x8006, 1
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -658,7 +658,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EFF9:: @ 823EFF9
setvar VAR_0x8006, 2
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -669,7 +669,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F012:: @ 823F012
setvar VAR_0x8006, 3
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/BattleFrontier_RankingHall.inc b/data/scripts/maps/BattleFrontier_RankingHall.inc
index b13bfe343..e469024e9 100644
--- a/data/scripts/maps/BattleFrontier_RankingHall.inc
+++ b/data/scripts/maps/BattleFrontier_RankingHall.inc
@@ -66,7 +66,7 @@ BattleFrontier_RankingHall_EventScript_25E522:: @ 825E522
waitbuttonpress
special sub_81A4AE8
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/LilycoveCity_ContestLobby.inc b/data/scripts/maps/LilycoveCity_ContestLobby.inc
index beb96e171..4a7279fb2 100644
--- a/data/scripts/maps/LilycoveCity_ContestLobby.inc
+++ b/data/scripts/maps/LilycoveCity_ContestLobby.inc
@@ -554,7 +554,7 @@ LilycoveCity_ContestLobby_EventScript_21A77A:: @ 821A77A
lockall
special ShowBerryBlenderRecordWindow
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
@@ -564,7 +564,7 @@ LilycoveCity_ContestLobby_EventScript_21A784:: @ 821A784
setvar VAR_0x8005, 7
special sub_81A1780
waitbuttonpress
- special sub_813C5A0
+ special RemoveRecordsWindow
releaseall
end
diff --git a/data/scripts/maps/TrainerHill_Entrance.inc b/data/scripts/maps/TrainerHill_Entrance.inc
index 77b67fb14..eb12efb4b 100644
--- a/data/scripts/maps/TrainerHill_Entrance.inc
+++ b/data/scripts/maps/TrainerHill_Entrance.inc
@@ -236,7 +236,7 @@ TrainerHill_Entrance_Movement_268385: @ 8268385
TrainerHill_Entrance_EventScript_268388:: @ 8268388
lockall
fadescreen 1
- special sub_813C904
+ special ShowTrainerHillRecords
waitstate
releaseall
end
diff --git a/data/specials.inc b/data/specials.inc
index 366413eaf..d598b021a 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -526,12 +526,12 @@ gSpecials:: @ 81DBA64
def_special sub_8139ED0
def_special sub_813B968
def_special sub_80F8B94
- def_special sub_813C904
+ def_special ShowTrainerHillRecords
def_special sub_80B4808
def_special sub_813B9A0
def_special sub_81B9918
def_special sub_80722E0
def_special sub_80B45D0
- def_special sub_813C5A0
+ def_special RemoveRecordsWindow
def_special sub_8139C10
def_special sub_80B3BC4
diff --git a/include/battle_records.h b/include/battle_records.h
index 5db24f3c8..88ff6adc9 100644
--- a/include/battle_records.h
+++ b/include/battle_records.h
@@ -1,9 +1,12 @@
#ifndef GUARD_BATTLE_RECORDS_H
#define GUARD_BATTLE_RECORDS_H
+extern u8 gRecordsWindowId;
+
void ClearPlayerLinkBattleRecords(void);
void UpdatePlayerLinkBattleRecords(s32 battlerId);
void ShowLinkBattleRecords(void);
-void ShowBattleTowerRecords(void);
+void RemoveRecordsWindow(void);
+void ShowTrainerHillRecords(void);
#endif // GUARD_BATTLE_RECORDS_H
diff --git a/include/bg.h b/include/bg.h
index de3897fa4..ea84c1573 100644
--- a/include/bg.h
+++ b/include/bg.h
@@ -68,7 +68,7 @@ void UnsetBgTilemapBuffer(u8 bg);
void* GetBgTilemapBuffer(u8 bg);
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset);
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 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);
diff --git a/include/palette.h b/include/palette.h
index 41cef4048..a1259d327 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -1,8 +1,6 @@
#ifndef GUARD_PALETTE_H
#define GUARD_PALETTE_H
-#include "global.h"
-
#define gPaletteFade_selectedPalettes (gPaletteFade.multipurpose1) // normal and fast fade
#define gPaletteFade_blendCnt (gPaletteFade.multipurpose1) // hardware fade
#define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade
diff --git a/ld_script.txt b/ld_script.txt
index 3af52896b..b9cc74ff1 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -185,7 +185,6 @@ SECTIONS {
src/hof_pc.o(.text);
asm/field_specials.o(.text);
src/battle_records.o(.text);
- asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
src/evolution_scene.o(.text);
asm/roulette.o(.text);
diff --git a/src/battle_records.c b/src/battle_records.c
index 0a0e0bd42..efc9173a7 100644
--- a/src/battle_records.c
+++ b/src/battle_records.c
@@ -6,15 +6,34 @@
#include "battle.h"
#include "overworld.h"
#include "text.h"
+#include "text_window.h"
#include "strings.h"
#include "string_util.h"
#include "trainer_card.h"
#include "menu.h"
#include "menu_helpers.h"
+#include "palette.h"
+#include "main.h"
+#include "scanline_effect.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"
-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 u32 gUnknown_085B3484[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
@@ -192,7 +211,7 @@ void ClearPlayerLinkBattleRecords(void)
ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries);
}
-static void IncTrainerCardWins(int battlerId)
+static void IncTrainerCardWins(s32 battlerId)
{
u16 *wins = &gTrainerCards[battlerId].linkBattleWins;
(*wins)++;
@@ -200,7 +219,7 @@ static void IncTrainerCardWins(int battlerId)
*wins = 9999;
}
-static void IncTrainerCardLosses(int battlerId)
+static void IncTrainerCardLosses(s32 battlerId)
{
u16 *losses = &gTrainerCards[battlerId].linkBattleLosses;
(*losses)++;
@@ -208,7 +227,7 @@ static void IncTrainerCardLosses(int battlerId)
*losses = 9999;
}
-static void UpdateTrainerCardWinsLosses(int battlerId)
+static void UpdateTrainerCardWinsLosses(s32 battlerId)
{
switch (gBattleOutcome)
{
@@ -223,7 +242,7 @@ static void UpdateTrainerCardWinsLosses(int battlerId)
}
}
-void UpdatePlayerLinkBattleRecords(int battlerId)
+void UpdatePlayerLinkBattleRecords(s32 battlerId)
{
if (InUnionRoom() != TRUE)
{
@@ -247,7 +266,7 @@ static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records)
StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD);
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)
@@ -255,10 +274,10 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan
if (record->wins == 0 && record->losses == 0 && record->draws == 0)
{
// empty slot
- PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D84, 8, (y * 8) + 1, 0, NULL);
- PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 80, (y * 8) + 1, 0, NULL);
- PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 128, (y * 8) + 1, 0, NULL);
- PrintTextOnWindow(gResultsWindowId, 1, gUnknown_085B3D8C, 176, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D84, 8, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 80, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 128, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 176, (y * 8) + 1, 0, NULL);
}
else
{
@@ -266,16 +285,16 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan
StringCopyN(gStringVar1, record->name, 7);
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);
- 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);
- 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);
- 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;
- gResultsWindowId = AddWindow(&gUnknown_085B3D7C);
- NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, FALSE);
- FillWindowPixelBuffer(gResultsWindowId, 0x11);
+ gRecordsWindowId = AddWindow(&gUnknown_085B3D7C);
+ NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, 0x11);
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
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);
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++)
{
PrintLinkBattleRecord(&gSaveBlock1Ptr->linkBattleRecords.entries[i], 7 + (i * 2), gSaveBlock1Ptr->linkBattleRecords.languages[i]);
}
- PutWindowTilemap(gResultsWindowId);
- CopyWindowToVram(gResultsWindowId, 3);
+ PutWindowTilemap(gRecordsWindowId);
+ 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;
+ }
}
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 9e6a0fef7..cbe7748b6 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -30,6 +30,7 @@
#include "trig.h"
#include "tv.h"
#include "item_menu.h"
+#include "battle_records.h"
#define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1
@@ -131,7 +132,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u8 gInGameOpponentsNo;
extern u8 gUnknown_020322D5;
-extern u8 gResultsWindowId;
// graphics
extern const u8 gBerryBlenderArrowTiles[];
@@ -3485,13 +3485,13 @@ void ShowBerryBlenderRecordWindow(void)
u8 text[32];
winTemplate = sBlenderRecordWindowTemplate;
- gResultsWindowId = AddWindow(&winTemplate);
- NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, 0);
- FillWindowPixelBuffer(gResultsWindowId, 0x11);
+ gRecordsWindowId = AddWindow(&winTemplate);
+ NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, 0);
+ FillWindowPixelBuffer(gRecordsWindowId, 0x11);
xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90);
- PrintTextOnWindow(gResultsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
- PrintTextOnWindow(gResultsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL);
for (i = 0, yPos = 0x29; i < BLENDER_SCORES_NO; i++)
{
@@ -3506,11 +3506,11 @@ void ShowBerryBlenderRecordWindow(void)
txtPtr = StringAppend(txtPtr, sText_RPM);
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);
- CopyWindowToVram(gResultsWindowId, 3);
+ PutWindowTilemap(gRecordsWindowId);
+ CopyWindowToVram(gRecordsWindowId, 3);
}
static void sub_8083F3C(u8 taskId)
diff --git a/src/bg.c b/src/bg.c
index 22861b64d..975c72a94 100644
--- a/src/bg.c
+++ b/src/bg.c
@@ -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 destY16;
u16 mode;
diff --git a/sym_ewram.txt b/sym_ewram.txt
index b66116714..bb4821630 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -713,11 +713,7 @@ gUnknown_0203AB6F: @ 203AB6F
gUnknown_0203AB70: @ 203AB70
.space 0x4
-gResultsWindowId: @ 203AB74
- .space 0x4
-
-gUnknown_0203AB78: @ 203AB78
- .space 0x4
+ .include "src/battle_records.o"
gUnknown_0203AB7C: @ 203AB7C
.space 0x4