summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-05-03 08:42:44 -0700
committerGitHub <noreply@github.com>2018-05-03 08:42:44 -0700
commitcdb5e9e3143b2f1086d8bd4f02a76186c164d02a (patch)
treebb3fc1e833b039b93548dd88971fa8edfbe97554
parent9dc867a91c06c7e7a72ad24343726051cd49d448 (diff)
parentb80fb98d9a316d2f8f0400b398fa0bc9974ac085 (diff)
Merge pull request #242 from DizzyEggg/decompile_battle_records
Decompile battle records
-rw-r--r--asm/battle_frontier_2.s68
-rw-r--r--asm/battle_records.s1285
-rw-r--r--asm/cable_club.s6
-rw-r--r--asm/pokenav.s6
-rw-r--r--asm/rom_8011DC0.s4
-rw-r--r--asm/trainer_card.s4
-rw-r--r--data/battle_records.s37
-rw-r--r--data/scripts/cable_club.inc4
-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.inc6
-rw-r--r--include/battle_records.h12
-rw-r--r--include/bg.h2
-rw-r--r--include/global.h12
-rw-r--r--include/palette.h2
-rw-r--r--include/strings.h3
-rw-r--r--include/trainer_card.h35
-rw-r--r--ld_script.txt4
-rw-r--r--src/battle_records.c510
-rw-r--r--src/berry_blender.c18
-rw-r--r--src/bg.c4
-rw-r--r--src/new_game.c12
-rw-r--r--src/tv.c6
-rw-r--r--sym_ewram.txt8
32 files changed, 659 insertions, 1423 deletions
diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s
index 71f105df8..7f2dbcc73 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 1880e7b45..000000000
--- a/asm/battle_records.s
+++ /dev/null
@@ -1,1285 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start sub_813BF94
-sub_813BF94: @ 813BF94
- push {r4,lr}
- sub sp, 0x4
- adds r4, r0, 0
- mov r1, sp
- movs r0, 0
- strh r0, [r1]
- ldr r2, =0x01000008
- mov r0, sp
- adds r1, r4, 0
- bl CpuSet
- movs r0, 0xFF
- strb r0, [r4]
- movs r0, 0
- strh r0, [r4, 0x8]
- strh r0, [r4, 0xA]
- strh r0, [r4, 0xC]
- strh r0, [r4, 0xE]
- add sp, 0x4
- pop {r4}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813BF94
-
- thumb_func_start sub_813BFC4
-sub_813BFC4: @ 813BFC4
- push {r4,r5,lr}
- adds r4, r0, 0
- movs r5, 0x4
-_0813BFCA:
- adds r0, r4, 0
- bl sub_813BF94
- adds r4, 0x10
- subs r5, 0x1
- cmp r5, 0
- bge _0813BFCA
- movs r0, 0x17
- movs r1, 0
- bl SetGameStat
- movs r0, 0x18
- movs r1, 0
- bl SetGameStat
- movs r0, 0x19
- movs r1, 0
- bl SetGameStat
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_813BFC4
-
- thumb_func_start sub_813BFF8
-sub_813BFF8: @ 813BFF8
- adds r1, r0, 0
- ldrh r0, [r1, 0xA]
- ldrh r2, [r1, 0xC]
- adds r0, r2
- ldrh r1, [r1, 0xE]
- adds r0, r1
- bx lr
- thumb_func_end sub_813BFF8
-
- thumb_func_start sub_813C008
-sub_813C008: @ 813C008
- push {r4-r7,lr}
- adds r7, r1, 0
- lsls r2, 16
- lsrs r6, r2, 16
- movs r5, 0
- adds r4, r0, 0
-_0813C014:
- adds r0, r4, 0
- adds r1, r7, 0
- movs r2, 0x7
- bl StringCompareN
- cmp r0, 0
- bne _0813C02C
- ldrh r0, [r4, 0x8]
- cmp r0, r6
- bne _0813C02C
- adds r0, r5, 0
- b _0813C036
-_0813C02C:
- adds r4, 0x10
- adds r5, 0x1
- cmp r5, 0x4
- ble _0813C014
- movs r0, 0x5
-_0813C036:
- pop {r4-r7}
- pop {r1}
- bx r1
- thumb_func_end sub_813C008
-
- thumb_func_start sub_813C03C
-sub_813C03C: @ 813C03C
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0x18
- mov r10, r0
- movs r1, 0x4
-_0813C04C:
- subs r3, r1, 0x1
- adds r6, r3, 0
- cmp r3, 0
- blt _0813C0BA
- lsls r0, r1, 4
- add r0, r10
- str r0, [sp, 0x14]
- lsls r0, r3, 4
- mov r2, r10
- adds r5, r0, r2
- movs r4, 0x50
- add r4, r10
- mov r9, r4
- add r1, r9
- mov r8, r1
-_0813C06A:
- ldr r0, [sp, 0x14]
- str r3, [sp, 0x10]
- bl sub_813BFF8
- adds r4, r0, 0
- adds r0, r5, 0
- bl sub_813BFF8
- ldr r3, [sp, 0x10]
- cmp r4, r0
- ble _0813C0B2
- mov r1, sp
- ldr r0, [sp, 0x14]
- ldm r0!, {r2,r4,r7}
- stm r1!, {r2,r4,r7}
- ldr r0, [r0]
- str r0, [r1]
- ldr r1, [sp, 0x14]
- adds r0, r5, 0
- ldm r0!, {r2,r4,r7}
- stm r1!, {r2,r4,r7}
- ldr r0, [r0]
- str r0, [r1]
- adds r1, r5, 0
- mov r0, sp
- ldm r0!, {r2,r4,r7}
- stm r1!, {r2,r4,r7}
- ldr r0, [r0]
- str r0, [r1]
- mov r7, r8
- ldrb r2, [r7]
- mov r0, r9
- adds r1, r0, r6
- ldrb r0, [r1]
- strb r0, [r7]
- strb r2, [r1]
-_0813C0B2:
- subs r5, 0x10
- subs r6, 0x1
- cmp r6, 0
- bge _0813C06A
-_0813C0BA:
- adds r1, r3, 0
- cmp r1, 0
- bgt _0813C04C
- add sp, 0x18
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- thumb_func_end sub_813C03C
-
- thumb_func_start sub_813C0D0
-sub_813C0D0: @ 813C0D0
- push {lr}
- adds r2, r0, 0
- cmp r1, 0x2
- beq _0813C100
- cmp r1, 0x2
- bgt _0813C0E2
- cmp r1, 0x1
- beq _0813C0E8
- b _0813C12A
-_0813C0E2:
- cmp r1, 0x3
- beq _0813C118
- b _0813C12A
-_0813C0E8:
- ldrh r0, [r2, 0xA]
- adds r0, 0x1
- strh r0, [r2, 0xA]
- lsls r0, 16
- lsrs r0, 16
- ldr r1, =0x0000270f
- cmp r0, r1
- bls _0813C12A
- strh r1, [r2, 0xA]
- b _0813C12A
- .pool
-_0813C100:
- ldrh r0, [r2, 0xC]
- adds r0, 0x1
- strh r0, [r2, 0xC]
- lsls r0, 16
- lsrs r0, 16
- ldr r1, =0x0000270f
- cmp r0, r1
- bls _0813C12A
- strh r1, [r2, 0xC]
- b _0813C12A
- .pool
-_0813C118:
- ldrh r0, [r2, 0xE]
- adds r0, 0x1
- strh r0, [r2, 0xE]
- lsls r0, 16
- lsrs r0, 16
- ldr r1, =0x0000270f
- cmp r0, r1
- bls _0813C12A
- strh r1, [r2, 0xE]
-_0813C12A:
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C0D0
-
- thumb_func_start sub_813C134
-sub_813C134: @ 813C134
- push {r4,lr}
- cmp r0, 0x2
- beq _0813C14E
- cmp r0, 0x2
- bgt _0813C144
- cmp r0, 0x1
- beq _0813C14A
- b _0813C166
-_0813C144:
- cmp r0, 0x3
- beq _0813C152
- b _0813C166
-_0813C14A:
- movs r4, 0x17
- b _0813C154
-_0813C14E:
- movs r4, 0x18
- b _0813C154
-_0813C152:
- movs r4, 0x19
-_0813C154:
- adds r0, r4, 0
- bl GetGameStat
- ldr r1, =0x0000270e
- cmp r0, r1
- bhi _0813C166
- adds r0, r4, 0
- bl IncrementGameStat
-_0813C166:
- pop {r4}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C134
-
- thumb_func_start sub_813C170
-sub_813C170: @ 813C170
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- adds r6, r0, 0
- mov r8, r1
- mov r10, r3
- ldr r0, [sp, 0x20]
- lsls r2, 16
- lsrs r7, r2, 16
- lsls r0, 24
- lsrs r0, 24
- mov r9, r0
- mov r0, r10
- bl sub_813C134
- adds r0, r6, 0
- bl sub_813C03C
- adds r0, r6, 0
- mov r1, r8
- adds r2, r7, 0
- bl sub_813C008
- adds r5, r0, 0
- cmp r5, 0x5
- bne _0813C1D4
- movs r5, 0x4
- adds r4, r6, 0
- adds r4, 0x40
- adds r0, r4, 0
- bl sub_813BF94
- adds r0, r4, 0
- mov r1, r8
- movs r2, 0x7
- bl StringCopyN
- strh r7, [r4, 0x8]
- adds r2, r6, 0
- adds r2, 0x54
- ldr r1, =gLinkPlayers
- mov r3, r9
- lsls r0, r3, 3
- subs r0, r3
- lsls r0, 2
- adds r0, r1
- ldrh r0, [r0, 0x1A]
- strb r0, [r2]
-_0813C1D4:
- lsls r0, r5, 4
- adds r0, r6, r0
- mov r1, r10
- bl sub_813C0D0
- adds r0, r6, 0
- bl sub_813C03C
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C170
-
- thumb_func_start InitLinkBattleRecords
-InitLinkBattleRecords: @ 813C1F8
- push {lr}
- ldr r0, =gSaveBlock1Ptr
- ldr r0, [r0]
- ldr r1, =0x00003150
- adds r0, r1
- bl sub_813BFC4
- pop {r0}
- bx r0
- .pool
- thumb_func_end InitLinkBattleRecords
-
- thumb_func_start sub_813C214
-sub_813C214: @ 813C214
- push {lr}
- movs r1, 0x64
- muls r1, r0
- ldr r0, =gUnknown_02039B6C
- adds r1, r0
- ldrh r0, [r1]
- adds r0, 0x1
- strh r0, [r1]
- lsls r0, 16
- lsrs r0, 16
- ldr r2, =0x0000270f
- cmp r0, r2
- bls _0813C230
- strh r2, [r1]
-_0813C230:
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C214
-
- thumb_func_start sub_813C23C
-sub_813C23C: @ 813C23C
- push {lr}
- movs r1, 0x64
- muls r1, r0
- ldr r0, =gUnknown_02039B6E
- adds r1, r0
- ldrh r0, [r1]
- adds r0, 0x1
- strh r0, [r1]
- lsls r0, 16
- lsrs r0, 16
- ldr r2, =0x0000270f
- cmp r0, r2
- bls _0813C258
- strh r2, [r1]
-_0813C258:
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C23C
-
- thumb_func_start sub_813C264
-sub_813C264: @ 813C264
- push {r4,lr}
- adds r4, r0, 0
- ldr r0, =gBattleOutcome
- ldrb r0, [r0]
- cmp r0, 0x1
- beq _0813C27C
- cmp r0, 0x2
- beq _0813C28A
- b _0813C298
- .pool
-_0813C27C:
- eors r0, r4
- bl sub_813C214
- adds r0, r4, 0
- bl sub_813C23C
- b _0813C298
-_0813C28A:
- movs r0, 0x1
- eors r0, r4
- bl sub_813C23C
- adds r0, r4, 0
- bl sub_813C214
-_0813C298:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_813C264
-
- thumb_func_start sub_813C2A0
-sub_813C2A0: @ 813C2A0
- push {r4,lr}
- sub sp, 0x4
- adds r4, r0, 0
- bl InUnionRoom
- cmp r0, 0x1
- beq _0813C2DA
- adds r0, r4, 0
- bl sub_813C264
- ldr r0, =gSaveBlock1Ptr
- ldr r0, [r0]
- ldr r1, =0x00003150
- adds r0, r1
- movs r1, 0x64
- adds r3, r4, 0
- muls r3, r1
- ldr r2, =gUnknown_02039B88
- adds r1, r3, r2
- subs r2, 0x30
- adds r3, r2
- ldrh r2, [r3, 0xE]
- ldr r3, =gBattleOutcome
- ldrb r3, [r3]
- lsls r4, 24
- lsrs r4, 24
- str r4, [sp]
- bl sub_813C170
-_0813C2DA:
- add sp, 0x4
- pop {r4}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C2A0
-
- thumb_func_start sub_813C2F4
-sub_813C2F4: @ 813C2F4
- push {r4,lr}
- sub sp, 0xC
- ldr r4, =gStringVar1
- movs r0, 0x17
- bl GetGameStat
- adds r1, r0, 0
- adds r0, r4, 0
- movs r2, 0
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- ldr r4, =gStringVar2
- movs r0, 0x18
- bl GetGameStat
- adds r1, r0, 0
- adds r0, r4, 0
- movs r2, 0
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- ldr r4, =gStringVar3
- movs r0, 0x19
- bl GetGameStat
- adds r1, r0, 0
- adds r0, r4, 0
- movs r2, 0
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- ldr r4, =gStringVar4
- ldr r1, =gText_TotalRecordWLD
- adds r0, r4, 0
- bl StringExpandPlaceholders
- movs r0, 0x1
- adds r1, r4, 0
- movs r2, 0xD0
- bl GetStringCenterAlignXOffset
- adds r3, r0, 0
- ldr r0, =gResultsWindowId
- ldrb r0, [r0]
- lsls r3, 24
- lsrs r3, 24
- movs r1, 0x11
- str r1, [sp]
- movs r1, 0
- str r1, [sp, 0x4]
- str r1, [sp, 0x8]
- movs r1, 0x1
- adds r2, r4, 0
- bl PrintTextOnWindow
- add sp, 0xC
- pop {r4}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C2F4
-
- thumb_func_start sub_813C384
-sub_813C384: @ 813C384
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- sub sp, 0xC
- adds r6, r0, 0
- adds r5, r2, 0
- lsls r1, 24
- lsrs r4, r1, 24
- ldrh r0, [r6, 0xA]
- cmp r0, 0
- bne _0813C40C
- ldr r7, [r6, 0xC]
- cmp r7, 0
- bne _0813C40C
- ldr r0, =gResultsWindowId
- mov r8, r0
- ldrb r0, [r0]
- ldr r2, =gUnknown_085B3D84
- lsls r4, 3
- adds r4, 0x1
- lsls r4, 24
- lsrs r4, 24
- str r4, [sp]
- str r7, [sp, 0x4]
- str r7, [sp, 0x8]
- movs r1, 0x1
- movs r3, 0x8
- bl PrintTextOnWindow
- mov r1, r8
- ldrb r0, [r1]
- ldr r5, =gUnknown_085B3D8C
- str r4, [sp]
- str r7, [sp, 0x4]
- str r7, [sp, 0x8]
- movs r1, 0x1
- adds r2, r5, 0
- movs r3, 0x50
- bl PrintTextOnWindow
- mov r1, r8
- ldrb r0, [r1]
- str r4, [sp]
- str r7, [sp, 0x4]
- str r7, [sp, 0x8]
- movs r1, 0x1
- adds r2, r5, 0
- movs r3, 0x80
- bl PrintTextOnWindow
- mov r1, r8
- ldrb r0, [r1]
- str r4, [sp]
- str r7, [sp, 0x4]
- str r7, [sp, 0x8]
- movs r1, 0x1
- adds r2, r5, 0
- movs r3, 0xB0
- bl PrintTextOnWindow
- b _0813C4A8
- .pool
-_0813C40C:
- ldr r0, =gStringVar1
- movs r1, 0x8
- bl StringFillWithTerminator
- ldr r0, =gStringVar1
- adds r1, r6, 0
- movs r2, 0x7
- bl StringCopyN
- lsls r1, r5, 24
- lsrs r1, 24
- ldr r0, =gStringVar1
- bl ConvertInternationalString
- ldr r0, =gResultsWindowId
- mov r8, r0
- ldrb r0, [r0]
- lsls r4, 3
- adds r4, 0x1
- lsls r4, 24
- lsrs r4, 24
- str r4, [sp]
- movs r5, 0
- str r5, [sp, 0x4]
- str r5, [sp, 0x8]
- movs r1, 0x1
- ldr r2, =gStringVar1
- movs r3, 0x8
- bl PrintTextOnWindow
- ldrh r1, [r6, 0xA]
- ldr r0, =gStringVar1
- movs r2, 0x1
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- mov r1, r8
- ldrb r0, [r1]
- str r4, [sp]
- str r5, [sp, 0x4]
- str r5, [sp, 0x8]
- movs r1, 0x1
- ldr r2, =gStringVar1
- movs r3, 0x50
- bl PrintTextOnWindow
- ldrh r1, [r6, 0xC]
- ldr r0, =gStringVar1
- movs r2, 0x1
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- mov r1, r8
- ldrb r0, [r1]
- str r4, [sp]
- str r5, [sp, 0x4]
- str r5, [sp, 0x8]
- movs r1, 0x1
- ldr r2, =gStringVar1
- movs r3, 0x80
- bl PrintTextOnWindow
- ldrh r1, [r6, 0xE]
- ldr r0, =gStringVar1
- movs r2, 0x1
- movs r3, 0x4
- bl ConvertIntToDecimalStringN
- mov r1, r8
- ldrb r0, [r1]
- str r4, [sp]
- str r5, [sp, 0x4]
- str r5, [sp, 0x8]
- movs r1, 0x1
- ldr r2, =gStringVar1
- movs r3, 0xB0
- bl PrintTextOnWindow
-_0813C4A8:
- add sp, 0xC
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C384
-
- thumb_func_start sub_813C4BC
-sub_813C4BC: @ 813C4BC
- push {r4-r7,lr}
- mov r7, r9
- mov r6, r8
- push {r6,r7}
- sub sp, 0xC
- ldr r6, =gResultsWindowId
- ldr r0, =gUnknown_085B3D7C
- bl AddWindow
- strb r0, [r6]
- ldrb r0, [r6]
- movs r1, 0
- bl NewMenuHelpers_DrawStdWindowFrame
- ldrb r0, [r6]
- movs r1, 0x11
- bl FillWindowPixelBuffer
- ldr r5, =gStringVar4
- ldr r1, =gText_PlayersBattleResults
- adds r0, r5, 0
- bl StringExpandPlaceholders
- movs r0, 0x1
- adds r1, r5, 0
- movs r2, 0xD0
- bl GetStringCenterAlignXOffset
- adds r3, r0, 0
- ldrb r0, [r6]
- lsls r3, 24
- lsrs r3, 24
- movs r1, 0x1
- str r1, [sp]
- movs r4, 0
- str r4, [sp, 0x4]
- str r4, [sp, 0x8]
- adds r2, r5, 0
- bl PrintTextOnWindow
- ldr r0, =gSaveBlock1Ptr
- mov r8, r0
- ldr r0, [r0]
- ldr r1, =0x00003150
- mov r9, r1
- add r0, r9
- bl sub_813C2F4
- ldr r1, =gText_WinLoseDraw
- adds r0, r5, 0
- bl StringExpandPlaceholders
- ldrb r0, [r6]
- movs r1, 0x29
- str r1, [sp]
- str r4, [sp, 0x4]
- str r4, [sp, 0x8]
- movs r1, 0x1
- adds r2, r5, 0
- movs r3, 0
- bl PrintTextOnWindow
- mov r7, r8
- movs r6, 0xE0
- lsls r6, 19
- mov r5, r9
-_0813C540:
- ldr r2, [r7]
- adds r0, r2, r5
- lsrs r1, r6, 24
- ldr r3, =0x000031a0
- adds r2, r3
- adds r2, r4
- ldrb r2, [r2]
- bl sub_813C384
- movs r0, 0x80
- lsls r0, 18
- adds r6, r0
- adds r5, 0x10
- adds r4, 0x1
- cmp r4, 0x4
- ble _0813C540
- ldr r4, =gResultsWindowId
- ldrb r0, [r4]
- bl PutWindowTilemap
- ldrb r0, [r4]
- movs r1, 0x3
- bl CopyWindowToVram
- add sp, 0xC
- pop {r3,r4}
- mov r8, r3
- mov r9, r4
- pop {r4-r7}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_813C4BC
-
- 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/cable_club.s b/asm/cable_club.s
index 16264b9da..7ef499226 100644
--- a/asm/cable_club.s
+++ b/asm/cable_club.s
@@ -960,7 +960,7 @@ task_map_chg_seq_0807EC34: @ 80B2B94
push {r4,r5,lr}
adds r5, r0, 0
adds r4, r1, 0
- ldr r1, =gUnknown_02039B58
+ ldr r1, =gTrainerCards
ldrh r0, [r5]
cmp r0, 0x1
bne _080B2C10
@@ -1044,7 +1044,7 @@ sub_80B2C30: @ 80B2C30
_080B2C5C:
movs r0, 0x64
muls r0, r4
- ldr r1, =gUnknown_02039B58
+ ldr r1, =gTrainerCards
adds r0, r1
lsls r1, r4, 8
ldr r2, =gBlockRecvBuffer
@@ -2171,7 +2171,7 @@ sub_80B360C: @ 80B360C
ldrb r0, [r0]
movs r5, 0x1
eors r0, r5
- bl sub_813C2A0
+ bl UpdatePlayerLinkBattleRecords
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
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/asm/rom_8011DC0.s b/asm/rom_8011DC0.s
index 21a9cca33..2ba5926aa 100644
--- a/asm/rom_8011DC0.s
+++ b/asm/rom_8011DC0.s
@@ -3181,7 +3181,7 @@ _08014138:
adds r3, r1, r0
movs r0, 0x64
muls r0, r4
- ldr r1, =gUnknown_02039B58
+ ldr r1, =gTrainerCards
adds r0, r1
ldrb r2, [r5]
adds r1, r3, 0
@@ -10615,7 +10615,7 @@ sub_8018220: @ 8018220
lsrs r0, 24
movs r1, 0x64
muls r1, r0
- ldr r0, =gUnknown_02039B58
+ ldr r0, =gTrainerCards
adds r1, r0
mov r8, r1
bl UnkTextUtil_Reset
diff --git a/asm/trainer_card.s b/asm/trainer_card.s
index a56dbd157..6d1be17cb 100644
--- a/asm/trainer_card.s
+++ b/asm/trainer_card.s
@@ -3894,7 +3894,7 @@ _080C48F6:
sub_80C4904: @ 80C4904
lsls r0, 24
lsrs r0, 24
- ldr r2, =gUnknown_02039B58
+ ldr r2, =gTrainerCards
movs r1, 0x64
muls r0, r1
adds r0, r2
@@ -4578,7 +4578,7 @@ sub_80C4E74: @ 80C4E74
ldr r0, [r5]
ldr r1, =0x00000534
adds r0, r1
- ldr r2, =gUnknown_02039B58
+ ldr r2, =gTrainerCards
movs r1, 0x64
muls r1, r4
adds r1, r2
diff --git a/data/battle_records.s b/data/battle_records.s
deleted file mode 100644
index 86dc9d8b9..000000000
--- a/data/battle_records.s
+++ /dev/null
@@ -1,37 +0,0 @@
-
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
-
- .align 2
-gUnknown_085B3484:: @ 85B3484
- .incbin "graphics/unknown/unknown_5B3484.4bpp"
-
- .align 2
-gUnknown_085B3544:: @ 85B3544
- .incbin "graphics/unknown/unknown_5B3484.gbapal"
-
- .align 2
-gUnknown_085B3564:: @ 85B3564
- .incbin "graphics/unknown/unknown_5B3564.bin"
-
- .align 2
-gUnknown_085B3D64:: @ 85B3D64
- .4byte 0x000001f0, 0x000031e7
-
- .align 2
-gUnknown_085B3D6C:: @ 85B3D6C
- window_template 0x00, 0x02, 0x01, 0x1a, 0x12, 0x0f, 0x0014
- null_window_template
-
- .align 2
-gUnknown_085B3D7C:: @ 85B3D7C
- window_template 0x00, 0x02, 0x01, 0x1a, 0x11, 0x0f, 0x0001
-
-gUnknown_085B3D84:: @ 85B3D84
- .string "-------$"
-
-gUnknown_085B3D8C:: @ 85B3D8C
- .string "----$"
-
diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc
index 4c9f2d4d7..bd633a115 100644
--- a/data/scripts/cable_club.inc
+++ b/data/scripts/cable_club.inc
@@ -787,9 +787,9 @@ MossdeepCity_GameCorner_1F_Movement_277360: @ 8277360
gUnknown_08277365:: @ 8277365
lockall
setvar VAR_0x8004, 0
- special sub_813C4BC
+ 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 85147b418..176b153f7 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 aebe5abe3..f985606de 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 5822ca318..4a52743a5 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 5cb6baad0..11fc42ced 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 05eb8ea33..f78cec646 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 17218658e..eab2bb18c 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 350d1f05a..774507df9 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 04867ee66..06b4a8f94 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -207,7 +207,7 @@ gSpecials:: @ 81DBA64
def_special ScriptHatchMon
def_special EggHatch
def_special sub_8071614
- def_special sub_813C4BC
+ def_special ShowLinkBattleRecords
def_special IsEnoughForCostInVar0x8005
def_special SubtractMoneyFromVar0x8005
def_special sub_80F972C
@@ -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
new file mode 100644
index 000000000..88ff6adc9
--- /dev/null
+++ b/include/battle_records.h
@@ -0,0 +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 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/global.h b/include/global.h
index b0c3bed4a..7a01c4175 100644
--- a/include/global.h
+++ b/include/global.h
@@ -489,6 +489,8 @@ struct RecordMixing_UnknownStruct
u16 unk74[0x2];
};
+#define LINK_B_RECORDS_COUNT 5
+
struct LinkBattleRecord
{
u8 name[8];
@@ -498,6 +500,12 @@ struct LinkBattleRecord
u16 draws;
};
+struct LinkBattleRecords
+{
+ struct LinkBattleRecord entries[LINK_B_RECORDS_COUNT];
+ u8 languages[LINK_B_RECORDS_COUNT];
+};
+
struct RecordMixingGiftData
{
u8 unk0;
@@ -703,9 +711,7 @@ struct SaveBlock1
/*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
/*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum
/*0x3030*/ struct DayCare daycare;
- /*0x3150*/ struct LinkBattleRecord linkBattleRecords[5];
- /*0x31A0*/ u8 unk_31A0;
- /*0x31A1*/ u8 filler_31A1[7];
+ /*0x3150*/ struct LinkBattleRecords linkBattleRecords;
/*0x31A8*/ u8 giftRibbons[52];
/*0x31DC*/ struct Roamer roamer;
/*0x31F8*/ struct EnigmaBerry enigmaBerry;
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/include/strings.h b/include/strings.h
index ec2a5b4aa..d8b76a998 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -433,5 +433,8 @@ extern const u8 gText_TooImportantToToss[];
extern const u8 gText_ConfirmTossItems[];
extern const u8 gText_MoveVar1Where[];
+extern const u8 gText_TotalRecordWLD[];
+extern const u8 gText_PlayersBattleResults[];
+extern const u8 gText_WinLoseDraw[];
#endif //GUARD_STRINGS_H
diff --git a/include/trainer_card.h b/include/trainer_card.h
new file mode 100644
index 000000000..5cb93dba0
--- /dev/null
+++ b/include/trainer_card.h
@@ -0,0 +1,35 @@
+#ifndef GUARD_TRAINER_CARD_H
+#define GUARD_TRAINER_CARD_H
+
+struct TrainerCard
+{
+ /*0x00*/ u8 gender;
+ /*0x01*/ u8 stars;
+ /*0x02*/ bool8 hasPokedex;
+ /*0x03*/ bool8 var_3;
+ /*0x04*/ bool8 var_4;
+ /*0x05*/ u8 var_5;
+ /*0x06*/ u16 firstHallOfFameA;
+ /*0x08*/ u16 firstHallOfFameB;
+ /*0x0A*/ u16 firstHallOfFameC;
+ /*0x0C*/ u16 pokedexSeen;
+ /*0x0E*/ u16 trainerId;
+ /*0x10*/ u16 playTimeHours;
+ /*0x12*/ u16 playTimeMinutes;
+ /*0x14*/ u16 linkBattleWins;
+ /*0x16*/ u16 linkBattleLosses;
+ /*0x18*/ u16 battleTowerWins;
+ /*0x1A*/ u16 battleTowerLosses;
+ /*0x1C*/ u16 contestsWithFriends;
+ /*0x1E*/ u16 pokeblocksWithFriends;
+ /*0x20*/ u16 pokemonTrades;
+ /*0x22*/ u16 var_22;
+ /*0x24*/ u32 money;
+ /*0x28*/ u16 var_28[4];
+ /*0x30*/ u8 playerName[8];
+ /*0x38*/ u8 emeraldAddedUnknownFields[0x64-0x38];
+};
+
+extern struct TrainerCard gTrainerCards[4];
+
+#endif // GUARD_TRAINER_CARD_H
diff --git a/ld_script.txt b/ld_script.txt
index e947e648f..c629685f1 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -183,7 +183,7 @@ SECTIONS {
src/birch_pc.o(.text);
src/hof_pc.o(.text);
asm/field_specials.o(.text);
- asm/battle_records.o(.text);
+ src/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
src/evolution_scene.o(.text);
asm/roulette.o(.text);
@@ -472,7 +472,7 @@ SECTIONS {
src/fldeff_flash.o(.rodata);
src/time_events.o(.rodata);
data/field_specials.o(.rodata);
- data/battle_records.o(.rodata);
+ src/battle_records.o(.rodata);
data/pokedex_area_screen.o(.rodata);
src/evolution_scene.o(.rodata);
data/roulette.o(.rodata);
diff --git a/src/battle_records.c b/src/battle_records.c
new file mode 100644
index 000000000..a148f998f
--- /dev/null
+++ b/src/battle_records.c
@@ -0,0 +1,510 @@
+#include "global.h"
+#include "battle_records.h"
+#include "bg.h"
+#include "window.h"
+#include "link.h"
+#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 void PrintOnTrainerHillRecordsWindow(void); // pokenav.s
+
+// this file's functions
+static void Task_CloseTrainerHillRecordsOnButton(u8 taskId);
+static void Task_BeginPaletteFade(u8 taskId);
+static void Task_ExitTrainerHillRecords(u8 taskId);
+static void RemoveTrainerHillRecordsWindow(u8 windowId);
+static void CB2_ShowTrainerHillRecords(void);
+
+// EWRAM variables
+EWRAM_DATA u8 gRecordsWindowId = 0;
+EWRAM_DATA static u8 *sTilemapBuffer = NULL;
+
+// const rom data
+static const u32 sTrainerHillWindowTileset[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
+static const u16 sTrainerHillWindowPalette[] = INCBIN_U16("graphics/unknown/unknown_5B3484.gbapal");
+static const u32 sTrainerHillWindowTilemap[] = INCBIN_U32("graphics/unknown/unknown_5B3564.bin");
+
+static const struct BgTemplate sTrainerHillRecordsBgTemplates[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ }
+};
+
+static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] =
+{
+ {0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14},
+ DUMMY_WIN_TEMPLATE
+};
+
+static const struct WindowTemplate sLinkBattleRecordsWindow = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1};
+
+static const u8 sText_DashesNoPlayer[] = _("-------");
+static const u8 sText_DashesNoScore[] = _("----");
+
+// code
+static void ClearLinkBattleRecord(struct LinkBattleRecord *record)
+{
+ CpuFill16(0, record, sizeof(struct LinkBattleRecord));
+ record->name[0] = EOS;
+ record->trainerId = 0;
+ record->wins = 0;
+ record->losses = 0;
+ record->draws = 0;
+}
+
+static void ClearLinkBattleRecords(struct LinkBattleRecord *records)
+{
+ s32 i;
+ for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
+ {
+ ClearLinkBattleRecord(records + i);
+ }
+ SetGameStat(GAME_STAT_LINK_BATTLE_WINS, 0);
+ SetGameStat(GAME_STAT_LINK_BATTLE_LOSSES, 0);
+ SetGameStat(GAME_STAT_LINK_BATTLE_DRAWS, 0);
+}
+
+static s32 GetLinkBattleRecordTotalBattles(struct LinkBattleRecord *record)
+{
+ return record->wins + record->losses + record->draws;
+}
+
+static s32 FindLinkBattleRecord(struct LinkBattleRecord *records, const u8 *name, u16 trainerId)
+{
+ s32 i;
+
+ for (i = 0; i < LINK_B_RECORDS_COUNT; i++)
+ {
+ if (!StringCompareN(records[i].name, name, OT_NAME_LENGTH) && records[i].trainerId == trainerId)
+ return i;
+ }
+
+ return LINK_B_RECORDS_COUNT;
+}
+
+static void SortLinkBattleRecords(struct LinkBattleRecords *records)
+{
+ s32 i, j;
+
+ for (i = LINK_B_RECORDS_COUNT - 1; i > 0; i--)
+ {
+ for (j = i - 1; j >= 0; j--)
+ {
+ s32 totalBattlesI = GetLinkBattleRecordTotalBattles(&records->entries[i]);
+ s32 totalBattlesJ = GetLinkBattleRecordTotalBattles(&records->entries[j]);
+
+ if (totalBattlesI > totalBattlesJ)
+ {
+ struct LinkBattleRecord temp1;
+ u8 temp2;
+
+ temp1 = records->entries[i];
+ records->entries[i] = records->entries[j];
+ records->entries[j] = temp1;
+
+ temp2 = records->languages[i];
+ records->languages[i] = records->languages[j];
+ records->languages[j] = temp2;
+ }
+ }
+ }
+}
+
+static void UpdateLinkBattleRecord(struct LinkBattleRecord *record, s32 battleOutcome)
+{
+ switch (battleOutcome)
+ {
+ case B_OUTCOME_WON:
+ record->wins++;
+ if (record->wins > 9999)
+ record->wins = 9999;
+ break;
+ case B_OUTCOME_LOST:
+ record->losses++;
+ if (record->losses > 9999)
+ record->losses = 9999;
+ break;
+ case B_OUTCOME_DREW:
+ record->draws++;
+ if (record->draws > 9999)
+ record->draws = 9999;
+ break;
+ }
+}
+
+static void UpdateLinkBattleGameStats(s32 battleOutcome)
+{
+ u8 stat;
+
+ switch (battleOutcome)
+ {
+ case B_OUTCOME_WON:
+ stat = GAME_STAT_LINK_BATTLE_WINS;
+ break;
+ case B_OUTCOME_LOST:
+ stat = GAME_STAT_LINK_BATTLE_LOSSES;
+ break;
+ case B_OUTCOME_DREW:
+ stat = GAME_STAT_LINK_BATTLE_DRAWS;
+ break;
+ default:
+ return;
+ }
+
+ if (GetGameStat(stat) < 9999)
+ IncrementGameStat(stat);
+}
+
+static void UpdateLinkBattleRecords(struct LinkBattleRecords *records, const u8 *name, u16 trainerId, s32 battleOutcome, u8 battlerId)
+{
+ s32 index;
+
+ UpdateLinkBattleGameStats(battleOutcome);
+ SortLinkBattleRecords(records);
+ index = FindLinkBattleRecord(records->entries, name, trainerId);
+ if (index == LINK_B_RECORDS_COUNT)
+ {
+ index = LINK_B_RECORDS_COUNT - 1;
+ ClearLinkBattleRecord(&records->entries[index]);
+ StringCopyN(records->entries[index].name, name, OT_NAME_LENGTH);
+ records->entries[index].trainerId = trainerId;
+ records->languages[index] = gLinkPlayers[battlerId].language;
+ }
+ UpdateLinkBattleRecord(&records->entries[index], battleOutcome);
+ SortLinkBattleRecords(records);
+}
+
+void ClearPlayerLinkBattleRecords(void)
+{
+ ClearLinkBattleRecords(gSaveBlock1Ptr->linkBattleRecords.entries);
+}
+
+static void IncTrainerCardWins(s32 battlerId)
+{
+ u16 *wins = &gTrainerCards[battlerId].linkBattleWins;
+ (*wins)++;
+ if (*wins > 9999)
+ *wins = 9999;
+}
+
+static void IncTrainerCardLosses(s32 battlerId)
+{
+ u16 *losses = &gTrainerCards[battlerId].linkBattleLosses;
+ (*losses)++;
+ if (*losses > 9999)
+ *losses = 9999;
+}
+
+static void UpdateTrainerCardWinsLosses(s32 battlerId)
+{
+ switch (gBattleOutcome)
+ {
+ case B_OUTCOME_WON:
+ IncTrainerCardWins(BATTLE_OPPOSITE(battlerId));
+ IncTrainerCardLosses(battlerId);
+ break;
+ case B_OUTCOME_LOST:
+ IncTrainerCardLosses(BATTLE_OPPOSITE(battlerId));
+ IncTrainerCardWins(battlerId);
+ break;
+ }
+}
+
+void UpdatePlayerLinkBattleRecords(s32 battlerId)
+{
+ if (InUnionRoom() != TRUE)
+ {
+ UpdateTrainerCardWinsLosses(battlerId);
+ UpdateLinkBattleRecords(
+ &gSaveBlock1Ptr->linkBattleRecords,
+ gTrainerCards[battlerId].playerName,
+ gTrainerCards[battlerId].trainerId,
+ gBattleOutcome,
+ battlerId);
+ }
+}
+
+static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records)
+{
+ s32 x;
+
+ ConvertIntToDecimalStringN(gStringVar1, GetGameStat(GAME_STAT_LINK_BATTLE_WINS), STR_CONV_MODE_LEFT_ALIGN, 4);
+ ConvertIntToDecimalStringN(gStringVar2, GetGameStat(GAME_STAT_LINK_BATTLE_LOSSES), STR_CONV_MODE_LEFT_ALIGN, 4);
+ ConvertIntToDecimalStringN(gStringVar3, GetGameStat(GAME_STAT_LINK_BATTLE_DRAWS), STR_CONV_MODE_LEFT_ALIGN, 4);
+ StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD);
+
+ x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0);
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 0x11, 0, NULL);
+}
+
+static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 language)
+{
+ if (record->wins == 0 && record->losses == 0 && record->draws == 0)
+ {
+ // empty slot
+ PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoPlayer, 8, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 80, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 128, (y * 8) + 1, 0, NULL);
+ PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 176, (y * 8) + 1, 0, NULL);
+ }
+ else
+ {
+ StringFillWithTerminator(gStringVar1, 8);
+ StringCopyN(gStringVar1, record->name, 7);
+ ConvertInternationalString(gStringVar1, language);
+
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 8, (y * 8) + 1, 0, NULL);
+
+ ConvertIntToDecimalStringN(gStringVar1, record->wins, STR_CONV_MODE_RIGHT_ALIGN, 4);
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 80, (y * 8) + 1, 0, NULL);
+
+ ConvertIntToDecimalStringN(gStringVar1, record->losses, STR_CONV_MODE_RIGHT_ALIGN, 4);
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 128, (y * 8) + 1, 0, NULL);
+
+ ConvertIntToDecimalStringN(gStringVar1, record->draws, STR_CONV_MODE_RIGHT_ALIGN, 4);
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar1, 176, (y * 8) + 1, 0, NULL);
+ }
+}
+
+void ShowLinkBattleRecords(void)
+{
+ s32 i, x;
+
+ gRecordsWindowId = AddWindow(&sLinkBattleRecordsWindow);
+ NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
+
+ x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
+ PrintTextOnWindow(gRecordsWindowId, 1, gStringVar4, x, 1, 0, NULL);
+ PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries);
+
+ StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw);
+ 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(gRecordsWindowId);
+ CopyWindowToVram(gRecordsWindowId, 3);
+}
+
+void RemoveRecordsWindow(void)
+{
+ sub_819746C(gRecordsWindowId, FALSE);
+ RemoveWindow(gRecordsWindowId);
+}
+
+static void Task_TrainerHillWaitForPaletteFade(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ gTasks[taskId].func = Task_CloseTrainerHillRecordsOnButton;
+}
+
+static void Task_CloseTrainerHillRecordsOnButton(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
+ {
+ PlaySE(SE_SELECT);
+ task->func = Task_BeginPaletteFade;
+ }
+}
+
+static void Task_BeginPaletteFade(u8 taskId)
+{
+ BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
+ gTasks[taskId].func = Task_ExitTrainerHillRecords;
+}
+
+static void Task_ExitTrainerHillRecords(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ {
+ SetMainCallback2(CB2_ReturnToFieldContinueScript);
+ Free(sTilemapBuffer);
+ RemoveTrainerHillRecordsWindow(0);
+ FreeAllWindowBuffers();
+ DestroyTask(taskId);
+ }
+}
+
+static void RemoveTrainerHillRecordsWindow(u8 windowId)
+{
+ FillWindowPixelBuffer(windowId, 0);
+ ClearWindowTilemap(windowId);
+ CopyWindowToVram(windowId, 2);
+ RemoveWindow(windowId);
+}
+
+static void ClearVramOamPlttRegs(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 ClearTasksAndGraphicalStructs(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 SetDispcntReg(void)
+{
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP);
+}
+
+static void LoadTrainerHillRecordsWindowGfx(u8 bgId)
+{
+ LoadBgTiles(bgId, sTrainerHillWindowTileset, sizeof(sTrainerHillWindowTileset), 0);
+ CopyToBgTilemapBufferRect(bgId, sTrainerHillWindowTilemap, 0, 0, 0x20, 0x20);
+ LoadPalette(sTrainerHillWindowPalette, 0, 0x20);
+}
+
+static void VblankCB_TrainerHillRecords(void)
+{
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+}
+
+static void MainCB2_TrainerHillRecords(void)
+{
+ RunTasks();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+}
+
+void ShowTrainerHillRecords(void)
+{
+ SetVBlankCallback(NULL);
+ SetMainCallback2(CB2_ShowTrainerHillRecords);
+}
+
+static void CB2_ShowTrainerHillRecords(void)
+{
+ switch (gMain.state)
+ {
+ case 0:
+ SetVBlankCallback(NULL);
+ ClearVramOamPlttRegs();
+ gMain.state++;
+ break;
+ case 1:
+ ClearTasksAndGraphicalStructs();
+ gMain.state++;
+ break;
+ case 2:
+ sTilemapBuffer = AllocZeroed(0x800);
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
+ SetBgTilemapBuffer(3, sTilemapBuffer);
+ ResetBgCoordinates();
+ gMain.state++;
+ break;
+ case 3:
+ LoadTrainerHillRecordsWindowGfx(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(sTrainerHillRecordsWindowTemplates);
+ DeactivateAllTextPrinters();
+ gMain.state++;
+ break;
+ case 6:
+ BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
+ gMain.state++;
+ break;
+ case 7:
+ SetDispcntReg();
+ SetVBlankCallback(VblankCB_TrainerHillRecords);
+ PrintOnTrainerHillRecordsWindow();
+ CreateTask(Task_TrainerHillWaitForPaletteFade, 8);
+ SetMainCallback2(MainCB2_TrainerHillRecords);
+ gMain.state = 0;
+ break;
+ }
+}
diff --git a/src/berry_blender.c b/src/berry_blender.c
index e050ce11e..c3b0cc80d 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/src/new_game.c b/src/new_game.c
index 89771e92b..37336016e 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -20,8 +20,10 @@
#include "tv.h"
#include "coins.h"
#include "text.h"
+#include "overworld.h"
+#include "mail.h"
+#include "battle_records.h"
-extern u8 gPlayerPartyCount;
extern u8 gDifferentSaveFile;
extern u16 gSaveFileStatus;
extern u8 gUnknown_030060B0;
@@ -29,19 +31,15 @@ extern u8 gUnknown_030060B0;
// TODO: replace those declarations with file headers
extern u16 GetGeneratedTrainerIdLower(void);
extern void ClearContestWinnerPicsInContestHall(void);
-extern void Overworld_SetWarpDestination(s8 mapBank, s8 mapNo, s8 warpNo, s8 xPos, s8 yPos);
extern void warp_in(void);
extern void sub_80BB358(void);
extern void ResetBagScrollPositions(void);
extern void ResetPokedex(void);
extern void sub_8084400(void);
-extern void ClearMailData(void);
extern void ResetGabbyAndTy(void);
extern void ResetSecretBases(void);
extern void ResetLinkContestBoolean(void);
-extern void ResetGameStats(void);
extern void sub_8052DA8(void);
-extern void InitLinkBattleRecords(void);
extern void ResetPokemonStorageSystem(void);
extern void ClearBag(void);
extern void NewGameInitPCItems(void);
@@ -58,7 +56,7 @@ extern void ResetContestLinkResults(void);
extern void ResetPokeJumpResults(void);
extern void SetBerryPowder(u32* powder, u32 newValue);
-extern u8 EventScript_2715DE[];
+extern const u8 EventScript_2715DE[];
void WriteUnalignedWord(u32 var, u8 *dataPtr)
{
@@ -178,7 +176,7 @@ void NewGameInitData(void)
ResetLinkContestBoolean();
ResetGameStats();
ClearAllContestWinnerPics();
- InitLinkBattleRecords();
+ ClearPlayerLinkBattleRecords();
InitSeedotSizeRecord();
InitLotadSizeRecord();
gPlayerPartyCount = 0;
diff --git a/src/tv.c b/src/tv.c
index 21b81347c..8fc95b9b8 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -1380,13 +1380,13 @@ void PutFanClubSpecialOnTheAir(void)
StringCopy(show->fanClubSpecial.idolName, name);
tv_store_id_2x(show);
show->fanClubSpecial.language = gGameLanguage;
- if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->unk_31A0 == LANGUAGE_JAPANESE)
+ if (show->fanClubSpecial.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->linkBattleRecords.languages[0] == LANGUAGE_JAPANESE)
{
show->fanClubSpecial.idolNameLanguage = LANGUAGE_JAPANESE;
}
else
{
- show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->unk_31A0;
+ show->fanClubSpecial.idolNameLanguage = gSaveBlock1Ptr->linkBattleRecords.languages[0];
}
}
@@ -2465,7 +2465,7 @@ bool8 sub_80EE7C0(void)
{
return TRUE;
}
- if (gSaveBlock1Ptr->linkBattleRecords[0].name[0] == EOS)
+ if (gSaveBlock1Ptr->linkBattleRecords.entries[0].name[0] == EOS)
{
return TRUE;
}
diff --git a/sym_ewram.txt b/sym_ewram.txt
index 02ecb0eee..24b5a3d68 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -318,7 +318,7 @@ gUnknown_02039B52: @ 2039B52
gUnknown_02039B54: @ 2039B54
.space 0x4
-gUnknown_02039B58: @ 2039B58
+gTrainerCards: @ 2039B58
.space 0x14
gUnknown_02039B6C: @ 2039B6C
@@ -710,11 +710,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