summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@users.noreply.github.com>2019-01-08 11:01:15 -0500
committerGitHub <noreply@github.com>2019-01-08 11:01:15 -0500
commit01e0d0430f3b596ac082e65aea266ee09c2ebd58 (patch)
treef7c2c662942eee5d3289914e3d49ae3eade84edc
parent8f7400809626c0f72dfe751665126f94181fd7c1 (diff)
parentb9979f71e7d21f3ebab282dfd9351517c98a5bbe (diff)
Merge pull request #40 from PikalaxALT/trainer_tower
Trainer tower (finish)
-rw-r--r--asm/trainer_tower.s1020
-rw-r--r--common_syms/fieldmap.txt2
-rw-r--r--data/connections.s501
-rw-r--r--data/data.s32
-rw-r--r--data/fieldmap.s6
-rw-r--r--data/trainer_tower.s632
-rw-r--r--include/global.h27
-rw-r--r--include/new_menu_helpers.h1
-rw-r--r--include/pokemon.h50
-rw-r--r--ld_script.txt4
-rw-r--r--src/pokemon.c4
-rw-r--r--src/trainer_tower.c678
12 files changed, 1232 insertions, 1725 deletions
diff --git a/asm/trainer_tower.s b/asm/trainer_tower.s
deleted file mode 100644
index a1ca0da57..000000000
--- a/asm/trainer_tower.s
+++ /dev/null
@@ -1,1020 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start sub_815E5F0
-sub_815E5F0: @ 815E5F0
- push {lr}
- ldr r0, _0815E620 @ =gSaveBlock1Ptr
- ldr r2, [r0]
- ldr r1, _0815E624 @ =0x00003d34
- adds r0, r2, r1
- ldr r1, [r0]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 2
- adds r2, r0
- ldr r0, _0815E628 @ =0x00003d42
- adds r2, r0
- ldrb r1, [r2]
- lsls r0, r1, 28
- cmp r0, 0
- bge _0815E630
- movs r0, 0x9
- negs r0, r0
- ands r0, r1
- strb r0, [r2]
- ldr r1, _0815E62C @ =gSpecialVar_Result
- movs r0, 0
- b _0815E64C
- .align 2, 0
-_0815E620: .4byte gSaveBlock1Ptr
-_0815E624: .4byte 0x00003d34
-_0815E628: .4byte 0x00003d42
-_0815E62C: .4byte gSpecialVar_Result
-_0815E630:
- lsls r0, r1, 27
- cmp r0, 0
- bge _0815E648
- movs r0, 0x11
- negs r0, r0
- ands r0, r1
- strb r0, [r2]
- ldr r1, _0815E644 @ =gSpecialVar_Result
- movs r0, 0x1
- b _0815E64C
- .align 2, 0
-_0815E644: .4byte gSpecialVar_Result
-_0815E648:
- ldr r1, _0815E654 @ =gSpecialVar_Result
- movs r0, 0x2
-_0815E64C:
- strh r0, [r1]
- pop {r0}
- bx r0
- .align 2, 0
-_0815E654: .4byte gSpecialVar_Result
- thumb_func_end sub_815E5F0
-
- thumb_func_start sub_815E658
-sub_815E658: @ 815E658
- push {r4-r6,lr}
- ldr r4, _0815E700 @ =gSaveBlock1Ptr
- ldr r2, [r4]
- ldr r6, _0815E704 @ =0x00003d34
- adds r0, r2, r6
- ldr r1, [r0]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 2
- ldr r5, _0815E708 @ =0x00003d38
- adds r2, r5
- adds r2, r0
- ldr r1, [r2]
- ldr r0, _0815E70C @ =0x00034bbe
- cmp r1, r0
- bls _0815E690
- bl DisableVBlankCounter1
- ldr r1, [r4]
- adds r0, r1, r6
- ldr r2, [r0]
- lsls r0, r2, 1
- adds r0, r2
- lsls r0, 2
- adds r1, r5
- adds r1, r0
- ldr r0, _0815E710 @ =0x00034bbf
- str r0, [r1]
-_0815E690:
- ldr r1, [r4]
- adds r0, r1, r6
- ldr r2, [r0]
- lsls r0, r2, 1
- adds r0, r2
- lsls r0, 2
- adds r1, r5
- adds r1, r0
- ldr r4, [r1]
- movs r5, 0xE1
- lsls r5, 4
- adds r0, r4, 0
- adds r1, r5, 0
- bl __divsi3
- adds r6, r0, 0
- adds r0, r4, 0
- adds r1, r5, 0
- bl __modsi3
- adds r4, r0, 0
- movs r1, 0x3C
- bl __divsi3
- adds r5, r0, 0
- adds r0, r4, 0
- movs r1, 0x3C
- bl __modsi3
- movs r1, 0xA8
- muls r0, r1
- movs r1, 0x64
- bl __divsi3
- adds r4, r0, 0
- ldr r0, _0815E714 @ =gStringVar1
- adds r1, r6, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815E718 @ =gStringVar2
- adds r1, r5, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815E71C @ =gStringVar3
- adds r1, r4, 0
- movs r2, 0x2
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_0815E700: .4byte gSaveBlock1Ptr
-_0815E704: .4byte 0x00003d34
-_0815E708: .4byte 0x00003d38
-_0815E70C: .4byte 0x00034bbe
-_0815E710: .4byte 0x00034bbf
-_0815E714: .4byte gStringVar1
-_0815E718: .4byte gStringVar2
-_0815E71C: .4byte gStringVar3
- thumb_func_end sub_815E658
-
- thumb_func_start sub_815E720
-sub_815E720: @ 815E720
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0xC
- bl sub_815EC0C
- ldr r0, _0815E85C @ =gUnknown_847A218
- bl AddWindow
- lsls r0, 24
- lsrs r7, r0, 24
- bl sub_80F6E9C
- adds r0, r7, 0
- movs r1, 0
- bl sub_80F6F1C
- ldr r2, _0815E860 @ =gUnknown_83FE982
- movs r1, 0
- str r1, [sp]
- movs r0, 0xFF
- str r0, [sp, 0x4]
- str r1, [sp, 0x8]
- adds r0, r7, 0
- movs r1, 0x2
- movs r3, 0x4A
- bl AddTextPrinterParameterized
- movs r0, 0
- mov r8, r0
- movs r1, 0xB8
- lsls r1, 22
- mov r10, r1
- movs r0, 0x90
- lsls r0, 22
- mov r9, r0
-_0815E76C:
- ldr r0, _0815E864 @ =gSaveBlock1Ptr
- ldr r2, [r0]
- ldr r1, _0815E868 @ =0x00003d34
- adds r0, r2, r1
- ldr r1, [r0]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 2
- adds r0, r2
- ldr r1, _0815E86C @ =0x00003d3c
- adds r0, r1
- bl sub_815EDDC
- adds r4, r0, 0
- movs r5, 0xE1
- lsls r5, 4
- adds r1, r5, 0
- bl __divsi3
- adds r6, r0, 0
- adds r0, r4, 0
- adds r1, r5, 0
- bl __modsi3
- adds r4, r0, 0
- movs r1, 0x3C
- bl __divsi3
- adds r5, r0, 0
- adds r0, r4, 0
- movs r1, 0x3C
- bl __modsi3
- movs r1, 0xA8
- muls r0, r1
- movs r1, 0x64
- bl __divsi3
- adds r4, r0, 0
- ldr r0, _0815E870 @ =gStringVar1
- adds r1, r6, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815E874 @ =gStringVar2
- adds r1, r5, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815E878 @ =gStringVar3
- adds r1, r4, 0
- movs r2, 0x2
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815E87C @ =gStringVar4
- ldr r1, _0815E880 @ =gUnknown_83FE998
- bl StringExpandPlaceholders
- ldr r1, _0815E884 @ =gUnknown_83FE9C4
- mov r0, r8
- subs r0, 0x1
- lsls r0, 2
- adds r0, r1
- ldr r2, [r0]
- mov r1, r9
- lsrs r0, r1, 24
- str r0, [sp]
- movs r0, 0xFF
- str r0, [sp, 0x4]
- movs r1, 0
- str r1, [sp, 0x8]
- adds r0, r7, 0
- movs r1, 0x2
- movs r3, 0x18
- bl AddTextPrinterParameterized
- mov r1, r10
- lsrs r0, r1, 24
- str r0, [sp]
- movs r0, 0xFF
- str r0, [sp, 0x4]
- movs r1, 0
- str r1, [sp, 0x8]
- adds r0, r7, 0
- movs r1, 0x2
- ldr r2, _0815E87C @ =gStringVar4
- movs r3, 0x60
- bl AddTextPrinterParameterized
- movs r0, 0xA0
- lsls r0, 21
- add r10, r0
- add r9, r0
- movs r1, 0x1
- add r8, r1
- mov r0, r8
- cmp r0, 0x3
- ble _0815E76C
- adds r0, r7, 0
- bl PutWindowTilemap
- adds r0, r7, 0
- movs r1, 0x3
- bl CopyWindowToVram
- ldr r0, _0815E888 @ =0x00004001
- adds r1, r7, 0
- bl VarSet
- add sp, 0xC
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_0815E85C: .4byte gUnknown_847A218
-_0815E860: .4byte gUnknown_83FE982
-_0815E864: .4byte gSaveBlock1Ptr
-_0815E868: .4byte 0x00003d34
-_0815E86C: .4byte 0x00003d3c
-_0815E870: .4byte gStringVar1
-_0815E874: .4byte gStringVar2
-_0815E878: .4byte gStringVar3
-_0815E87C: .4byte gStringVar4
-_0815E880: .4byte gUnknown_83FE998
-_0815E884: .4byte gUnknown_83FE9C4
-_0815E888: .4byte 0x00004001
- thumb_func_end sub_815E720
-
- thumb_func_start sub_815E88C
-sub_815E88C: @ 815E88C
- push {r4,lr}
- ldr r0, _0815E8B0 @ =0x00004001
- bl VarGet
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- adds r0, r4, 0
- movs r1, 0x1
- bl sub_810F4D8
- adds r0, r4, 0
- bl RemoveWindow
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0815E8B0: .4byte 0x00004001
- thumb_func_end sub_815E88C
-
- thumb_func_start sub_815E8B4
-sub_815E8B4: @ 815E8B4
- push {r4,lr}
- ldr r4, _0815E8C8 @ =gSpecialVar_Result
- bl GetMonsStateToDoubles
- lsls r0, 24
- lsrs r0, 24
- strh r0, [r4]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0815E8C8: .4byte gSpecialVar_Result
- thumb_func_end sub_815E8B4
-
- thumb_func_start sub_815E8CC
-sub_815E8CC: @ 815E8CC
- push {lr}
- ldr r0, _0815E8EC @ =gUnknown_203F458
- ldr r1, [r0]
- ldrb r0, [r1, 0x4]
- ldrb r2, [r1, 0xD]
- cmp r0, r2
- beq _0815E8F8
- ldr r0, _0815E8F0 @ =gStringVar1
- ldrb r1, [r1, 0x4]
- movs r2, 0
- movs r3, 0x1
- bl ConvertIntToDecimalStringN
- ldr r1, _0815E8F4 @ =gSpecialVar_Result
- movs r0, 0x1
- b _0815E8FC
- .align 2, 0
-_0815E8EC: .4byte gUnknown_203F458
-_0815E8F0: .4byte gStringVar1
-_0815E8F4: .4byte gSpecialVar_Result
-_0815E8F8:
- ldr r1, _0815E904 @ =gSpecialVar_Result
- movs r0, 0
-_0815E8FC:
- strh r0, [r1]
- pop {r0}
- bx r0
- .align 2, 0
-_0815E904: .4byte gSpecialVar_Result
- thumb_func_end sub_815E8CC
-
- thumb_func_start sub_815E908
-sub_815E908: @ 815E908
- push {lr}
- ldr r0, _0815E928 @ =gMapHeader
- ldrh r1, [r0, 0x12]
- ldr r0, _0815E92C @ =0x00000129
- cmp r1, r0
- bne _0815E938
- ldr r0, _0815E930 @ =0x00004082
- bl VarGet
- lsls r0, 16
- lsrs r1, r0, 16
- cmp r1, 0
- bne _0815E938
- ldr r0, _0815E934 @ =gSpecialVar_Result
- strh r1, [r0]
- b _0815E93E
- .align 2, 0
-_0815E928: .4byte gMapHeader
-_0815E92C: .4byte 0x00000129
-_0815E930: .4byte 0x00004082
-_0815E934: .4byte gSpecialVar_Result
-_0815E938:
- ldr r1, _0815E944 @ =gSpecialVar_Result
- movs r0, 0
- strh r0, [r1]
-_0815E93E:
- pop {r0}
- bx r0
- .align 2, 0
-_0815E944: .4byte gSpecialVar_Result
- thumb_func_end sub_815E908
-
- thumb_func_start sub_815E948
-sub_815E948: @ 815E948
- push {r4,lr}
- ldr r0, _0815E97C @ =0x00004001
- bl VarGet
- lsls r0, 16
- lsrs r2, r0, 16
- ldr r0, _0815E980 @ =gUnknown_203F458
- ldr r3, [r0]
- lsls r1, r2, 2
- adds r1, r2
- lsls r1, 3
- adds r1, r2
- lsls r1, 3
- ldrb r2, [r3]
- lsls r0, r2, 5
- subs r0, r2
- lsls r0, 5
- adds r1, r0
- adds r3, r1
- ldrb r1, [r3, 0x1B]
- movs r3, 0
- ldr r2, _0815E984 @ =gUnknown_847A074
- ldr r0, _0815E988 @ =gFacilityClassToTrainerClass
- adds r1, r0
- b _0815E994
- .align 2, 0
-_0815E97C: .4byte 0x00004001
-_0815E980: .4byte gUnknown_203F458
-_0815E984: .4byte gUnknown_847A074
-_0815E988: .4byte gFacilityClassToTrainerClass
-_0815E98C:
- adds r2, 0x4
- adds r3, 0x1
- cmp r3, 0x68
- bhi _0815E99C
-_0815E994:
- ldrb r0, [r2]
- ldrb r4, [r1]
- cmp r0, r4
- bne _0815E98C
-_0815E99C:
- cmp r3, 0x69
- beq _0815E9B0
- ldr r1, _0815E9AC @ =gUnknown_847A074
- lsls r0, r3, 2
- adds r0, r1
- ldrb r2, [r0, 0x1]
- b _0815E9B2
- .align 2, 0
-_0815E9AC: .4byte gUnknown_847A074
-_0815E9B0:
- movs r2, 0
-_0815E9B2:
- ldr r0, _0815E9C4 @ =gUnknown_847A2D2
- lsls r1, r2, 1
- adds r1, r0
- ldrh r0, [r1]
- bl PlayNewMapMusic
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0815E9C4: .4byte gUnknown_847A2D2
- thumb_func_end sub_815E948
-
- thumb_func_start sub_815E9C8
-sub_815E9C8: @ 815E9C8
- ldr r3, _0815E9EC @ =gSpecialVar_Result
- ldr r0, _0815E9F0 @ =gSaveBlock1Ptr
- ldr r1, [r0]
- ldr r2, _0815E9F4 @ =0x00003d34
- adds r0, r1, r2
- ldr r2, [r0]
- lsls r0, r2, 1
- adds r0, r2
- lsls r0, 2
- adds r1, r0
- ldr r0, _0815E9F8 @ =0x00003d42
- adds r1, r0
- ldrb r0, [r1]
- lsls r0, 29
- lsrs r0, 31
- strh r0, [r3]
- bx lr
- .align 2, 0
-_0815E9EC: .4byte gSpecialVar_Result
-_0815E9F0: .4byte gSaveBlock1Ptr
-_0815E9F4: .4byte 0x00003d34
-_0815E9F8: .4byte 0x00003d42
- thumb_func_end sub_815E9C8
-
- thumb_func_start sub_815E9FC
-sub_815E9FC: @ 815E9FC
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0x4
- ldr r0, _0815EABC @ =0x00004001
- bl VarGet
- lsls r0, 16
- lsrs r4, r0, 16
- bl sub_815EBB8
- mov r9, r0
- ldr r0, _0815EAC0 @ =gSaveBlock1Ptr
- ldr r1, [r0]
- ldr r2, _0815EAC4 @ =0x00003d34
- adds r0, r1, r2
- ldr r2, [r0]
- lsls r0, r2, 1
- adds r0, r2
- lsls r0, 2
- adds r1, r0
- movs r0, 0xF5
- lsls r0, 6
- adds r1, r0
- ldrb r5, [r1]
- bl ZeroEnemyPartyMons
- ldr r1, _0815EAC8 @ =gUnknown_203F458
- mov r10, r1
- ldr r6, [r1]
- ldrb r1, [r6]
- lsls r0, r1, 5
- subs r0, r1
- lsls r7, r0, 5
- adds r0, r6, r7
- ldrb r0, [r0, 0xE]
- cmp r0, 0x1
- beq _0815EAD4
- cmp r0, 0x1
- ble _0815EA56
- cmp r0, 0x2
- bne _0815EA56
- b _0815EB58
-_0815EA56:
- movs r6, 0
- lsls r5, 1
- str r5, [sp]
- lsls r0, r4, 2
- mov r5, r10
- adds r0, r4
- lsls r0, 3
- adds r0, r4
- lsls r7, r0, 3
- adds r2, r7, 0x4
- mov r8, r2
-_0815EA6C:
- ldr r1, _0815EACC @ =gUnknown_847A2EE
- ldr r2, [sp]
- adds r0, r6, r2
- adds r0, r1
- ldrb r2, [r0]
- ldr r3, [r5]
- movs r0, 0x2C
- adds r4, r2, 0
- muls r4, r0
- adds r2, r4, r7
- ldrb r1, [r3]
- lsls r0, r1, 5
- subs r0, r1
- lsls r0, 5
- adds r2, r0
- adds r3, r2
- adds r3, 0x5C
- mov r0, r9
- strb r0, [r3]
- movs r0, 0x64
- muls r0, r6
- ldr r1, _0815EAD0 @ =gEnemyParty
- adds r0, r1
- ldr r1, [r5]
- ldrb r3, [r1]
- lsls r2, r3, 5
- subs r2, r3
- lsls r2, 5
- adds r2, 0xC
- adds r1, r2
- add r1, r8
- adds r4, 0x40
- adds r1, r4
- bl sub_803E0A4
- adds r6, 0x1
- cmp r6, 0x1
- ble _0815EA6C
- b _0815EB9E
- .align 2, 0
-_0815EABC: .4byte 0x00004001
-_0815EAC0: .4byte gSaveBlock1Ptr
-_0815EAC4: .4byte 0x00003d34
-_0815EAC8: .4byte gUnknown_203F458
-_0815EACC: .4byte gUnknown_847A2EE
-_0815EAD0: .4byte gEnemyParty
-_0815EAD4:
- ldr r4, _0815EB50 @ =gUnknown_847A2FE
- lsls r5, 1
- adds r0, r5, r4
- ldrb r2, [r0]
- movs r1, 0x2C
- mov r8, r1
- mov r3, r8
- muls r3, r2
- adds r0, r3, r7
- adds r0, r6, r0
- adds r0, 0x5C
- mov r2, r9
- strb r2, [r0]
- ldr r6, _0815EB54 @ =gEnemyParty
- mov r0, r10
- ldr r1, [r0]
- ldrb r2, [r1]
- lsls r0, r2, 5
- subs r0, r2
- lsls r0, 5
- adds r0, 0xC
- adds r1, r0
- adds r3, 0x44
- adds r1, r3
- adds r0, r6, 0
- bl sub_803E0A4
- adds r4, 0x1
- adds r5, r4
- ldrb r2, [r5]
- mov r0, r10
- ldr r1, [r0]
- mov r3, r8
- muls r3, r2
- ldrb r2, [r1]
- lsls r0, r2, 5
- subs r0, r2
- lsls r0, 5
- adds r0, r3, r0
- adds r1, r0
- movs r2, 0xD2
- lsls r2, 1
- adds r1, r2
- mov r0, r9
- strb r0, [r1]
- adds r6, 0x64
- mov r2, r10
- ldr r1, [r2]
- ldrb r2, [r1]
- lsls r0, r2, 5
- subs r0, r2
- lsls r0, 5
- adds r0, 0xC
- adds r1, r0
- movs r0, 0xC6
- lsls r0, 1
- adds r3, r0
- adds r1, r3
- adds r0, r6, 0
- bl sub_803E0A4
- b _0815EB9E
- .align 2, 0
-_0815EB50: .4byte gUnknown_847A2FE
-_0815EB54: .4byte gEnemyParty
-_0815EB58:
- ldr r1, _0815EBB0 @ =gUnknown_847A30E
- lsls r0, r5, 1
- adds r0, r5
- adds r0, r4, r0
- adds r0, r1
- ldrb r2, [r0]
- movs r0, 0x2C
- adds r5, r2, 0
- muls r5, r0
- lsls r3, r4, 2
- adds r3, r4
- lsls r3, 3
- adds r3, r4
- lsls r3, 3
- adds r0, r5, r3
- adds r0, r7
- adds r0, r6, r0
- adds r0, 0x5C
- mov r1, r9
- strb r1, [r0]
- ldr r0, _0815EBB4 @ =gEnemyParty
- mov r2, r10
- ldr r1, [r2]
- ldrb r4, [r1]
- lsls r2, r4, 5
- subs r2, r4
- lsls r2, 5
- adds r2, 0xC
- adds r1, r2
- adds r3, 0x4
- adds r1, r3
- adds r5, 0x40
- adds r1, r5
- bl sub_803E0A4
-_0815EB9E:
- add sp, 0x4
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_0815EBB0: .4byte gUnknown_847A30E
-_0815EBB4: .4byte gEnemyParty
- thumb_func_end sub_815E9FC
-
- thumb_func_start sub_815EBB8
-sub_815EBB8: @ 815EBB8
- push {r4-r6,lr}
- movs r6, 0
- movs r5, 0
-_0815EBBE:
- movs r0, 0x64
- adds r1, r5, 0
- muls r1, r0
- ldr r0, _0815EC08 @ =gPlayerParty
- adds r4, r1, r0
- adds r0, r4, 0
- movs r1, 0xB
- movs r2, 0
- bl GetMonData
- cmp r0, 0
- beq _0815EBF8
- adds r0, r4, 0
- movs r1, 0x41
- movs r2, 0
- bl GetMonData
- movs r1, 0xCE
- lsls r1, 1
- cmp r0, r1
- beq _0815EBF8
- adds r0, r4, 0
- movs r1, 0x38
- movs r2, 0
- bl GetMonData
- cmp r0, r6
- ble _0815EBF8
- adds r6, r0, 0
-_0815EBF8:
- adds r5, 0x1
- cmp r5, 0x5
- ble _0815EBBE
- adds r0, r6, 0
- pop {r4-r6}
- pop {r1}
- bx r1
- .align 2, 0
-_0815EC08: .4byte gPlayerParty
- thumb_func_end sub_815EBB8
-
- thumb_func_start sub_815EC0C
-sub_815EC0C: @ 815EC0C
- push {r4,lr}
- ldr r4, _0815EC70 @ =gSaveBlock1Ptr
- ldr r2, [r4]
- ldr r1, _0815EC74 @ =0x00003d34
- adds r0, r2, r1
- ldr r1, [r0]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 2
- adds r2, r0
- ldr r0, _0815EC78 @ =0x00003d41
- adds r2, r0
- ldr r0, _0815EC7C @ =gUnknown_203F458
- ldr r0, [r0]
- ldrb r1, [r0, 0x5]
- ldrb r0, [r2]
- cmp r0, r1
- beq _0815EC6A
- strb r1, [r2]
- ldr r2, [r4]
- ldr r1, _0815EC74 @ =0x00003d34
- adds r0, r2, r1
- ldr r1, [r0]
- lsls r0, r1, 1
- adds r0, r1
- lsls r0, 2
- adds r0, r2
- ldr r2, _0815EC80 @ =0x00003d3c
- adds r0, r2
- ldr r1, _0815EC84 @ =0x00034bbf
- bl sub_815EDF4
- ldr r1, [r4]
- ldr r2, _0815EC74 @ =0x00003d34
- adds r0, r1, r2
- ldr r2, [r0]
- lsls r0, r2, 1
- adds r0, r2
- lsls r0, 2
- adds r1, r0
- ldr r0, _0815EC88 @ =0x00003d42
- adds r1, r0
- ldrb r2, [r1]
- movs r0, 0x2
- negs r0, r0
- ands r0, r2
- strb r0, [r1]
-_0815EC6A:
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0815EC70: .4byte gSaveBlock1Ptr
-_0815EC74: .4byte 0x00003d34
-_0815EC78: .4byte 0x00003d41
-_0815EC7C: .4byte gUnknown_203F458
-_0815EC80: .4byte 0x00003d3c
-_0815EC84: .4byte 0x00034bbf
-_0815EC88: .4byte 0x00003d42
- thumb_func_end sub_815EC0C
-
- thumb_func_start sub_815EC8C
-sub_815EC8C: @ 815EC8C
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0xC
- movs r0, 0
- mov r8, r0
- bl sub_815DC8C
- movs r0, 0xD8
- str r0, [sp]
- movs r0, 0x90
- str r0, [sp, 0x4]
- movs r0, 0
- movs r1, 0
- movs r2, 0
- movs r3, 0
- bl FillWindowPixelRect
- bl sub_815EC0C
- ldr r4, _0815EDB4 @ =gUnknown_847A22C
- str r4, [sp]
- mov r0, r8
- str r0, [sp, 0x4]
- ldr r0, _0815EDB8 @ =gUnknown_83FE982
- str r0, [sp, 0x8]
- movs r0, 0
- movs r1, 0x2
- movs r2, 0x4A
- movs r3, 0
- bl box_print
- movs r7, 0
- movs r0, 0x90
- lsls r0, 22
- mov r10, r0
- ldr r0, _0815EDBC @ =0x00003d38
- mov r9, r0
-_0815ECDC:
- ldr r0, _0815EDC0 @ =gSaveBlock1Ptr
- ldr r0, [r0]
- add r0, r9
- adds r0, 0x4
- bl sub_815EDDC
- adds r4, r0, 0
- movs r5, 0xE1
- lsls r5, 4
- adds r1, r5, 0
- bl __divsi3
- adds r6, r0, 0
- adds r0, r4, 0
- adds r1, r5, 0
- bl __modsi3
- adds r4, r0, 0
- movs r1, 0x3C
- bl __divsi3
- adds r5, r0, 0
- adds r0, r4, 0
- movs r1, 0x3C
- bl __modsi3
- movs r1, 0xA8
- muls r0, r1
- movs r1, 0x64
- bl __divsi3
- adds r4, r0, 0
- ldr r0, _0815EDC4 @ =gStringVar1
- adds r1, r6, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815EDC8 @ =gStringVar2
- adds r1, r5, 0
- movs r2, 0x1
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815EDCC @ =gStringVar3
- adds r1, r4, 0
- movs r2, 0x2
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- ldr r0, _0815EDD0 @ =gStringVar4
- ldr r1, _0815EDD4 @ =gUnknown_83FE998
- bl StringExpandPlaceholders
- lsls r1, r7, 2
- mov r0, r10
- lsrs r4, r0, 24
- ldr r0, _0815EDB4 @ =gUnknown_847A22C
- str r0, [sp]
- movs r0, 0
- str r0, [sp, 0x4]
- ldr r0, _0815EDD8 @ =gUnknown_83FE9C4
- adds r1, r0
- ldr r0, [r1]
- str r0, [sp, 0x8]
- mov r0, r8
- movs r1, 0x2
- movs r2, 0x18
- adds r3, r4, 0
- bl box_print
- ldr r0, _0815EDB4 @ =gUnknown_847A22C
- str r0, [sp]
- movs r0, 0
- str r0, [sp, 0x4]
- ldr r0, _0815EDD0 @ =gStringVar4
- str r0, [sp, 0x8]
- mov r0, r8
- movs r1, 0x2
- movs r2, 0x60
- adds r3, r4, 0
- bl box_print
- movs r0, 0xA0
- lsls r0, 21
- add r10, r0
- movs r0, 0xC
- add r9, r0
- adds r7, 0x1
- cmp r7, 0x3
- ble _0815ECDC
- mov r0, r8
- bl PutWindowTilemap
- mov r0, r8
- movs r1, 0x3
- bl CopyWindowToVram
- bl sub_815DD2C
- add sp, 0xC
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_0815EDB4: .4byte gUnknown_847A22C
-_0815EDB8: .4byte gUnknown_83FE982
-_0815EDBC: .4byte 0x00003d38
-_0815EDC0: .4byte gSaveBlock1Ptr
-_0815EDC4: .4byte gStringVar1
-_0815EDC8: .4byte gStringVar2
-_0815EDCC: .4byte gStringVar3
-_0815EDD0: .4byte gStringVar4
-_0815EDD4: .4byte gUnknown_83FE998
-_0815EDD8: .4byte gUnknown_83FE9C4
- thumb_func_end sub_815EC8C
-
- thumb_func_start sub_815EDDC
-sub_815EDDC: @ 815EDDC
- ldr r1, _0815EDF0 @ =gSaveBlock2Ptr
- ldr r1, [r1]
- movs r2, 0xF2
- lsls r2, 4
- adds r1, r2
- ldr r0, [r0]
- ldr r1, [r1]
- eors r0, r1
- bx lr
- .align 2, 0
-_0815EDF0: .4byte gSaveBlock2Ptr
- thumb_func_end sub_815EDDC
-
- thumb_func_start sub_815EDF4
-sub_815EDF4: @ 815EDF4
- ldr r2, _0815EE08 @ =gSaveBlock2Ptr
- ldr r2, [r2]
- movs r3, 0xF2
- lsls r3, 4
- adds r2, r3
- ldr r2, [r2]
- eors r2, r1
- str r2, [r0]
- bx lr
- .align 2, 0
-_0815EE08: .4byte gSaveBlock2Ptr
- thumb_func_end sub_815EDF4
-
- thumb_func_start sub_815EE0C
-sub_815EE0C: @ 815EE0C
- push {r4-r6,lr}
- ldr r6, _0815EE30 @ =gSaveBlock1Ptr
- ldr r5, _0815EE34 @ =0x00003d38
- movs r4, 0x3
-_0815EE14:
- ldr r0, [r6]
- adds r0, r5
- adds r0, 0x4
- ldr r1, _0815EE38 @ =0x00034bbf
- bl sub_815EDF4
- adds r5, 0xC
- subs r4, 0x1
- cmp r4, 0
- bge _0815EE14
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_0815EE30: .4byte gSaveBlock1Ptr
-_0815EE34: .4byte 0x00003d38
-_0815EE38: .4byte 0x00034bbf
- thumb_func_end sub_815EE0C
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/common_syms/fieldmap.txt b/common_syms/fieldmap.txt
index b593fc3f2..dedf055bd 100644
--- a/common_syms/fieldmap.txt
+++ b/common_syms/fieldmap.txt
@@ -1 +1 @@
-VMap \ No newline at end of file
+VMap
diff --git a/data/connections.s b/data/connections.s
new file mode 100644
index 000000000..15c02ebbe
--- /dev/null
+++ b/data/connections.s
@@ -0,0 +1,501 @@
+ .include "asm/macros.inc"
+
+ .section .rodata
+
+gUnknown_8352754:: @ 8352754
+ connection up, 0, 0x313
+ connection down, 0, 0x327
+
+gUnknown_835276C:: @ 835276C
+ .4byte 2
+ .4byte gUnknown_8352754
+
+gUnknown_8352774:: @ 8352774
+ connection up, 12, 0x314
+ connection down, 12, 0x313
+ connection left, 10, 0x329
+
+gUnknown_8352798:: @ 8352798
+ .4byte 3
+ .4byte gUnknown_8352774
+
+gUnknown_83527A0:: @ 83527A0
+ connection down, 12, 0x314
+ connection right, 10, 0x315
+
+gUnknown_83527B8:: @ 83527B8
+ .4byte 2
+ .4byte gUnknown_83527A0
+
+gUnknown_83527C0:: @ 83527C0
+ connection up, 12, 0x32B
+ connection down, 0, 0x317
+ connection left, 10, 0x316
+ connection right, 10, 0x31B
+
+gUnknown_83527F0:: @ 83527F0
+ .4byte 4
+ .4byte gUnknown_83527C0
+
+gUnknown_83527F8:: @ 83527F8
+ connection up, 0, 0x31C
+ connection down, 0, 0x31E
+ connection left, 0, 0x31A
+
+gUnknown_835281C:: @ 835281C
+ .4byte 3
+ .4byte gUnknown_83527F8
+
+gUnknown_8352824:: @ 8352824
+ connection up, 12, 0x318
+ connection right, 10, 0x31D
+
+gUnknown_835283C:: @ 835283C
+ .4byte 2
+ .4byte gUnknown_8352824
+
+gUnknown_8352844:: @ 8352844
+ connection left, 10, 0x322
+ connection right, 10, 0x319
+
+gUnknown_835285C:: @ 835285C
+ .4byte 2
+ .4byte gUnknown_8352844
+
+gUnknown_8352864:: @ 8352864
+ connection down, 12, 0x325
+ connection left, 10, 0x324
+ connection right, 10, 0x321
+
+gUnknown_8352888:: @ 8352888
+ .4byte 3
+ .4byte gUnknown_8352864
+
+gUnknown_8352890:: @ 8352890
+ connection up, 0, 0x328
+ connection right, 0, 0x326
+
+gUnknown_83528A8:: @ 83528A8
+ .4byte 2
+ .4byte gUnknown_8352890
+
+gUnknown_83528B0:: @ 83528B0
+ connection down, 0, 0x32A
+
+gUnknown_83528BC:: @ 83528BC
+ .4byte 1
+ .4byte gUnknown_83528B0
+
+gUnknown_83528C4:: @ 83528C4
+ connection up, 0, 0x317
+ connection down, 12, 0x318
+ connection left, 10, 0x319
+ connection right, 10, 0x31A
+
+gUnknown_83528F4:: @ 83528F4
+ .4byte 4
+ .4byte gUnknown_83528C4
+
+gUnknown_83528FC:: @ 83528FC
+ connection up, 0, 0x317
+ connection down, 12, 0x318
+ connection left, 10, 0x319
+ connection right, 10, 0x31A
+
+gUnknown_835292C:: @ 835292C
+ .4byte 4
+ .4byte gUnknown_83528FC
+
+gUnknown_8352934:: @ 8352934
+ connection down, 0, 0x32E
+ connection right, -120, 0x32D
+
+gUnknown_835294C:: @ 835294C
+ .4byte 2
+ .4byte gUnknown_8352934
+
+gUnknown_8352954:: @ 8352954
+ connection up, 24, 0x32F
+
+gUnknown_8352960:: @ 8352960
+ .4byte 1
+ .4byte gUnknown_8352954
+
+gUnknown_8352968:: @ 8352968
+ connection down, 0, 0x331
+ connection left, 0, 0x330
+
+gUnknown_8352980:: @ 8352980
+ .4byte 2
+ .4byte gUnknown_8352968
+
+gUnknown_8352988:: @ 8352988
+ connection up, -48, 0x337
+ connection right, 0, 0x338
+
+gUnknown_83529A0:: @ 83529A0
+ .4byte 2
+ .4byte gUnknown_8352988
+
+gUnknown_83529A8:: @ 83529A8
+ connection up, -48, 0x33E
+ connection down, 0, 0x33F
+
+gUnknown_83529C0:: @ 83529C0
+ .4byte 2
+ .4byte gUnknown_83529A8
+
+gUnknown_83529C8:: @ 83529C8
+ connection right, -40, 0x33C
+
+gUnknown_83529D4:: @ 83529D4
+ .4byte 1
+ .4byte gUnknown_83529C8
+
+gUnknown_83529DC:: @ 83529DC
+ connection up, -12, 0x301
+ connection down, 0, 0x300
+
+gUnknown_83529F4:: @ 83529F4
+ .4byte 2
+ .4byte gUnknown_83529DC
+
+gUnknown_83529FC:: @ 83529FC
+ connection up, -12, 0x302
+ connection down, -12, 0x301
+
+gUnknown_8352A14:: @ 8352A14
+ .4byte 2
+ .4byte gUnknown_83529FC
+
+gUnknown_8352A1C:: @ 8352A1C
+ connection up, 60, 0x316
+ connection left, -10, 0x302
+
+gUnknown_8352A34:: @ 8352A34
+ .4byte 2
+ .4byte gUnknown_8352A1C
+
+gUnknown_8352A3C:: @ 8352A3C
+ connection down, -60, 0x315
+ connection right, -10, 0x303
+
+gUnknown_8352A54:: @ 8352A54
+ .4byte 2
+ .4byte gUnknown_8352A3C
+
+gUnknown_8352A5C:: @ 8352A5C
+ connection up, 0, 0x303
+ connection down, 0, 0x30B
+
+gUnknown_8352A74:: @ 8352A74
+ .4byte 2
+ .4byte gUnknown_8352A5C
+
+gUnknown_8352A7C:: @ 8352A7C
+ connection up, 0, 0x30B
+ connection down, -12, 0x305
+
+gUnknown_8352A94:: @ 8352A94
+ .4byte 2
+ .4byte gUnknown_8352A7C
+
+gUnknown_8352A9C:: @ 8352A9C
+ connection left, -10, 0x306
+ connection right, -10, 0x30B
+
+gUnknown_8352AB4:: @ 8352AB4
+ .4byte 2
+ .4byte gUnknown_8352A9C
+
+gUnknown_8352ABC:: @ 8352ABC
+ connection left, -10, 0x30B
+ connection right, 0, 0x304
+
+gUnknown_8352AD4:: @ 8352AD4
+ .4byte 2
+ .4byte gUnknown_8352ABC
+
+gUnknown_8352ADC:: @ 8352ADC
+ connection left, -10, 0x303
+ connection right, 0, 0x31C
+
+gUnknown_8352AF4:: @ 8352AF4
+ .4byte 2
+ .4byte gUnknown_8352ADC
+
+gUnknown_8352AFC:: @ 8352AFC
+ connection down, 0, 0x304
+ connection left, 0, 0x31B
+
+gUnknown_8352B14:: @ 8352B14
+ .4byte 2
+ .4byte gUnknown_8352AFC
+
+gUnknown_8352B1C:: @ 8352B1C
+ connection left, -10, 0x305
+ connection right, -60, 0x31E
+
+gUnknown_8352B34:: @ 8352B34
+ .4byte 2
+ .4byte gUnknown_8352B1C
+
+gUnknown_8352B3C:: @ 8352B3C
+ connection up, 0, 0x304
+ connection down, -48, 0x31F
+ connection left, 60, 0x31D
+
+gUnknown_8352B60:: @ 8352B60
+ .4byte 3
+ .4byte gUnknown_8352B3C
+
+gUnknown_8352B68:: @ 8352B68
+ connection up, 48, 0x31E
+ connection left, 0, 0x320
+
+gUnknown_8352B80:: @ 8352B80
+ .4byte 2
+ .4byte gUnknown_8352B68
+
+gUnknown_8352B88:: @ 8352B88
+ connection left, 40, 0x321
+ connection right, 0, 0x31F
+
+gUnknown_8352BA0:: @ 8352BA0
+ .4byte 2
+ .4byte gUnknown_8352B88
+
+gUnknown_8352BA8:: @ 8352BA8
+ connection left, -10, 0x307
+ connection right, -40, 0x320
+
+gUnknown_8352BC0:: @ 8352BC0
+ .4byte 2
+ .4byte gUnknown_8352BA8
+
+gUnknown_8352BC8:: @ 8352BC8
+ connection down, 0, 0x323
+ connection right, -10, 0x306
+
+gUnknown_8352BE0:: @ 8352BE0
+ .4byte 2
+ .4byte gUnknown_8352BC8
+
+gUnknown_8352BE8:: @ 8352BE8
+ connection up, 0, 0x322
+ connection down, 0, 0x324
+
+gUnknown_8352C00:: @ 8352C00
+ .4byte 2
+ .4byte gUnknown_8352BE8
+
+gUnknown_8352C08:: @ 8352C08
+ connection up, 0, 0x323
+ connection right, -10, 0x307
+
+gUnknown_8352C20:: @ 8352C20
+ .4byte 2
+ .4byte gUnknown_8352C08
+
+gUnknown_8352C28:: @ 8352C28
+ connection up, -12, 0x307
+ connection left, 40, 0x326
+
+gUnknown_8352C40:: @ 8352C40
+ .4byte 2
+ .4byte gUnknown_8352C28
+
+gUnknown_8352C48:: @ 8352C48
+ connection left, 0, 0x308
+ connection right, -40, 0x325
+
+gUnknown_8352C60:: @ 8352C60
+ .4byte 2
+ .4byte gUnknown_8352C48
+
+gUnknown_8352C68:: @ 8352C68
+ connection up, 0, 0x300
+ connection down, 0, 0x328
+
+gUnknown_8352C80:: @ 8352C80
+ .4byte 2
+ .4byte gUnknown_8352C68
+
+gUnknown_8352C88:: @ 8352C88
+ connection up, 0, 0x327
+ connection down, 0, 0x308
+
+gUnknown_8352CA0:: @ 8352CA0
+ .4byte 2
+ .4byte gUnknown_8352C88
+
+gUnknown_8352CA8:: @ 8352CA8
+ connection up, 0, 0x32A
+ connection right, -10, 0x301
+
+gUnknown_8352CC0:: @ 8352CC0
+ .4byte 2
+ .4byte gUnknown_8352CA8
+
+gUnknown_8352CC8:: @ 8352CC8
+ connection up, 0, 0x309
+ connection down, 0, 0x329
+
+gUnknown_8352CE0:: @ 8352CE0
+ .4byte 2
+ .4byte gUnknown_8352CC8
+
+gUnknown_8352CE8:: @ 8352CE8
+ connection down, -12, 0x303
+ connection right, 0, 0x32C
+
+gUnknown_8352D00:: @ 8352D00
+ .4byte 2
+ .4byte gUnknown_8352CE8
+
+gUnknown_8352D08:: @ 8352D08
+ connection left, 0, 0x32B
+
+gUnknown_8352D14:: @ 8352D14
+ .4byte 1
+ .4byte gUnknown_8352D08
+
+gUnknown_8352D1C:: @ 8352D1C
+ connection left, 120, 0x30C
+
+gUnknown_8352D28:: @ 8352D28
+ .4byte 1
+ .4byte gUnknown_8352D1C
+
+gUnknown_8352D30:: @ 8352D30
+ connection up, 0, 0x30C
+
+gUnknown_8352D3C:: @ 8352D3C
+ .4byte 1
+ .4byte gUnknown_8352D30
+
+gUnknown_8352D44:: @ 8352D44
+ connection down, -24, 0x30D
+
+gUnknown_8352D50:: @ 8352D50
+ .4byte 1
+ .4byte gUnknown_8352D44
+
+gUnknown_8352D58:: @ 8352D58
+ connection right, 0, 0x30E
+
+gUnknown_8352D64:: @ 8352D64
+ .4byte 1
+ .4byte gUnknown_8352D58
+
+gUnknown_8352D6C:: @ 8352D6C
+ connection up, 0, 0x30E
+
+gUnknown_8352D78:: @ 8352D78
+ .4byte 1
+ .4byte gUnknown_8352D6C
+
+gUnknown_8352D80:: @ 8352D80
+ connection up, 0, 0x30E
+
+gUnknown_8352D8C:: @ 8352D8C
+ .4byte 1
+ .4byte gUnknown_8352D80
+
+gUnknown_8352D94:: @ 8352D94
+ connection up, 0, 0x30E
+
+gUnknown_8352DA0:: @ 8352DA0
+ .4byte 1
+ .4byte gUnknown_8352D94
+
+gUnknown_8352DA8:: @ 8352DA8
+ connection down, -48, 0x337
+
+gUnknown_8352DB4:: @ 8352DB4
+ .4byte 1
+ .4byte gUnknown_8352DA8
+
+gUnknown_8352DBC:: @ 8352DBC
+ connection up, 48, 0x336
+ connection down, 48, 0x310
+
+gUnknown_8352DD4:: @ 8352DD4
+ .4byte 2
+ .4byte gUnknown_8352DBC
+
+gUnknown_8352DDC:: @ 8352DDC
+ connection left, 0, 0x310
+ connection right, 20, 0x339
+
+gUnknown_8352DF4:: @ 8352DF4
+ .4byte 2
+ .4byte gUnknown_8352DDC
+
+gUnknown_8352DFC:: @ 8352DFC
+ connection left, -20, 0x338
+
+gUnknown_8352E08:: @ 8352E08
+ .4byte 1
+ .4byte gUnknown_8352DFC
+
+gUnknown_8352E10:: @ 8352E10
+ connection down, 0, 0x33B
+
+gUnknown_8352E1C:: @ 8352E1C
+ .4byte 1
+ .4byte gUnknown_8352E10
+
+gUnknown_8352E24:: @ 8352E24
+ connection up, 0, 0x33A
+ connection right, 0, 0x33C
+
+gUnknown_8352E3C:: @ 8352E3C
+ .4byte 2
+ .4byte gUnknown_8352E24
+
+gUnknown_8352E44:: @ 8352E44
+ connection left, 0, 0x33B
+ connection left, 40, 0x312
+ connection left, 80, 0x33D
+
+gUnknown_8352E68:: @ 8352E68
+ .4byte 3
+ .4byte gUnknown_8352E44
+
+gUnknown_8352E70:: @ 8352E70
+ connection right, -80, 0x33C
+
+gUnknown_8352E7C:: @ 8352E7C
+ .4byte 1
+ .4byte gUnknown_8352E70
+
+gUnknown_8352E84:: @ 8352E84
+ connection down, 48, 0x311
+
+gUnknown_8352E90:: @ 8352E90
+ .4byte 1
+ .4byte gUnknown_8352E84
+
+gUnknown_8352E98:: @ 8352E98
+ connection up, 0, 0x311
+ connection right, 20, 0x340
+
+gUnknown_8352EB0:: @ 8352EB0
+ .4byte 2
+ .4byte gUnknown_8352E98
+
+gUnknown_8352EB8:: @ 8352EB8
+ connection down, -48, 0x341
+ connection left, -20, 0x33F
+
+gUnknown_8352ED0:: @ 8352ED0
+ .4byte 2
+ .4byte gUnknown_8352EB8
+
+gUnknown_8352ED8:: @ 8352ED8
+ connection up, 48, 0x340
+
+gUnknown_8352EE4:: @ 8352EE4
+ .4byte 1
+ .4byte gUnknown_8352ED8
diff --git a/data/data.s b/data/data.s
index dd692cb33..e17c041a2 100644
--- a/data/data.s
+++ b/data/data.s
@@ -909,7 +909,15 @@ gUnknown_826D2B0:: @ 826D2B0
.incbin "baserom.gba", 0x26D2B0, 0x28
gDirectionToVectors:: @ 826D2D8
- .incbin "baserom.gba", 0x26D2D8, 0x48
+ .4byte 0, 0
+ .4byte 0, 1
+ .4byte 0, -1
+ .4byte -1, 0
+ .4byte 1, 0
+ .4byte -1, 1
+ .4byte 1, 1
+ .4byte -1, -1
+ .4byte 1, -1
gUnknown_826D320:: @ 826D320
.incbin "baserom.gba", 0x26D320, 0x10
@@ -918,13 +926,29 @@ gUnknown_826D330:: @ 826D330
.incbin "baserom.gba", 0x26D330, 0xC
gUnknown_826D33C:: @ 826D33C
- .incbin "baserom.gba", 0x26D33C, 0xC
+ .4byte sub_8058684
+ .4byte sub_80586A4
+ .4byte sub_80586A8
gUnknown_826D348:: @ 826D348
- .incbin "baserom.gba", 0x26D348, 0x2C
+ .4byte sub_80586C8
+ .4byte sub_80586CC
+ .4byte sub_80586CC
+ .4byte sub_80586CC
+ .4byte sub_80586CC
+ .4byte sub_80586C8
+ .4byte sub_80586C8
+ .4byte sub_8058734
+ .4byte sub_8058734
+ .4byte sub_8058734
+ .4byte sub_8058734
gUnknown_826D374:: @ 826D374
- .incbin "baserom.gba", 0x26D374, 0x78258
+ .4byte sub_805874C
+ .4byte sub_8058754
+
+gUnknown_826D37C:: @ 826D37C
+ .incbin "baserom.gba", 0x26D37C, 0x78250
gUnknown_82E55CC:: @ 82E55CC
.incbin "baserom.gba", 0x2E55CC, 0x695C0
diff --git a/data/fieldmap.s b/data/fieldmap.s
deleted file mode 100644
index 3b24a4f86..000000000
--- a/data/fieldmap.s
+++ /dev/null
@@ -1,6 +0,0 @@
- .include "asm/macros.inc"
-
- .section .rodata
-
-gUnknown_8352754:: @ 8352754
- .incbin "baserom.gba", 0x352754, 0x798
diff --git a/data/trainer_tower.s b/data/trainer_tower.s
deleted file mode 100644
index 6065500b5..000000000
--- a/data/trainer_tower.s
+++ /dev/null
@@ -1,632 +0,0 @@
-#include "constants/items.h"
- .include "asm/macros.inc"
- .include "constants/gba_constants.inc"
- .include "constants/misc_constants.inc"
-
- .section .rodata
-
- .align 2
-gUnknown_8479D34::
- .byte 0x03, 0x26
- .align 2
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x27
- .align 2
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0x9a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x01, 0x1f
- .align 2
- .byte 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x01, 0x22
- .align 2
- .byte 0x53, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x41
- .align 2
- .byte 0x40, 0x41, 0x42, 0x43, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x01, 0x02
- .align 2
- .byte 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0xff, 0xff
- .byte 0x54, 0x55, 0x56, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x01, 0x6d
- .align 2
- .byte 0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0x66
- .byte 0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0xff
- .byte 0x5a, 0x5c, 0x60, 0x61, 0x62, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x2e
- .align 2
- .byte 0x6b, 0x6c, 0x6d, 0x6e, 0xff, 0xff, 0xff, 0xff
- .byte 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xff, 0xff
- .byte 0x6b, 0x6c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x30
- .align 2
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xa6, 0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x0f
- .align 2
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xa8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xa9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x39
- .align 2
- .byte 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x36
- .align 2
- .byte 0xae, 0xb0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xaf, 0xb1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x3a
- .align 2
- .byte 0xb2, 0xb3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x3b
- .align 2
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xb4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
- .align 2
- .byte 0x03, 0x3e
- .align 2
- .byte 0xb9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xba, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-
-gUnknown_8479ED8:: @ 8479ED8
- .align 2
- .byte 0x1c, 0x03, 0x01
- .align 2
- .byte 0x38, 0x04, 0x00
- .align 2
- .byte 0x25, 0x06, 0x01
- .align 2
- .byte 0x26, 0x07, 0x00
- .align 2
- .byte 0x29, 0x08, 0x00
- .align 2
- .byte 0x2a, 0x09, 0x01
- .align 2
- .byte 0x34, 0x0a, 0x00
- .align 2
- .byte 0x1c, 0x0b, 0x01
- .align 2
- .byte 0x1d, 0x0c, 0x01
- .align 2
- .byte 0x13, 0x0d, 0x00
- .align 2
- .byte 0x34, 0x0e, 0x00
- .align 2
- .byte 0x2d, 0x0f, 0x00
- .align 2
- .byte 0x36, 0x10, 0x00
- .align 2
- .byte 0x1a, 0x11, 0x00
- .align 2
- .byte 0x1a, 0x12, 0x00
- .align 2
- .byte 0x27, 0x13, 0x00
- .align 2
- .byte 0x34, 0x14, 0x00
- .align 2
- .byte 0x13, 0x15, 0x00
- .align 2
- .byte 0x17, 0x16, 0x01
- .align 2
- .byte 0x3d, 0x17, 0x00
- .align 2
- .byte 0x13, 0x1d, 0x00
- .align 2
- .byte 0x17, 0x1e, 0x01
- .align 2
- .byte 0x1e, 0x20, 0x00
- .align 2
- .byte 0x1f, 0x21, 0x01
- .align 2
- .byte 0x20, 0x22, 0x00
- .align 2
- .byte 0x23, 0x23, 0x01
- .align 2
- .byte 0x12, 0x24, 0x00
- .align 2
- .byte 0x39, 0x26, 0x00
- .align 2
- .byte 0x29, 0x2d, 0x00
- .align 2
- .byte 0x1a, 0x2e, 0x00
- .align 2
- .byte 0x10, 0x2f, 0x00
- .align 2
- .byte 0x18, 0x30, 0x01
- .align 2
- .byte 0x1d, 0x31, 0x01
- .align 2
- .byte 0x2e, 0x32, 0x01
- .align 2
- .byte 0x28, 0x33, 0x01
- .align 2
- .byte 0x3e, 0x35, 0x00
- .align 2
- .byte 0x1b, 0x38, 0x00
- .align 2
- .byte 0x19, 0x40, 0x00
- .align 2
- .byte 0x1c, 0x41, 0x01
- .align 2
- .byte 0x27, 0x42, 0x00
- .align 2
- .byte 0x28, 0x43, 0x01
- .align 2
- .byte 0x16, 0x47, 0x01
- .align 2
- .byte 0x14, 0x48, 0x00
- .align 2
- .byte 0x38, 0x49, 0x00
- .align 2
- .byte 0x12, 0x58, 0x00
- .align 2
- .byte 0x14, 0x59, 0x00
- .align 2
- .byte 0x16, 0x5a, 0x01
- .align 2
- .byte 0x3e, 0x5b, 0x00
- .align 2
- .byte 0x27, 0x5c, 0x00
- .align 2
- .byte 0x28, 0x5d, 0x01
- .align 2
- .byte 0x34, 0x5e, 0x00
- .align 2
- .byte 0x34, 0x5f, 0x00
- .align 2
- .byte 0x38, 0x60, 0x00
- .align 2
- .byte 0x35, 0x61, 0x00
- .align 2
- .byte 0x34, 0x62, 0x00
- .align 2
- .byte 0x1e, 0x63, 0x00
- .align 2
- .byte 0x39, 0x64, 0x00
- .align 2
- .byte 0x2d, 0x65, 0x00
- .align 2
- .byte 0x35, 0x66, 0x00
- .align 2
- .byte 0x20, 0x67, 0x00
- .align 2
- .byte 0x1d, 0x68, 0x01
- .align 2
- .byte 0x2e, 0x69, 0x01
- .align 2
- .byte 0x13, 0x6a, 0x00
- .align 2
- .byte 0x1a, 0x6b, 0x00
- .align 2
- .byte 0x1a, 0x6c, 0x00
- .align 2
- .byte 0x19, 0x6d, 0x00
- .align 2
- .byte 0x1a, 0x6e, 0x00
- .align 2
- .byte 0x36, 0x6f, 0x00
- .align 2
- .byte 0x37, 0x71, 0x00
- .align 2
- .byte 0x29, 0x74, 0x00
- .align 2
- .byte 0x2a, 0x75, 0x01
- .align 2
- .byte 0x3d, 0x7a, 0x00
- .align 2
- .byte 0x3a, 0x7d, 0x01
- .align 2
- .byte 0x17, 0x89, 0x01
- .align 2
- .byte 0x18, 0x8a, 0x01
- .align 2
- .byte 0x25, 0x8b, 0x01
- .align 2
- .byte 0x1c, 0x8c, 0x01
- .align 2
- .byte 0x27, 0x8d, 0x00
- .align 2
- .byte 0x28, 0x8e, 0x01
- .align 2
- .byte 0x1c, 0x8f, 0x01
- .align 2
- .byte 0x38, 0x90, 0x00
- .align 2
- .byte 0x1c, 0x91, 0x01
- .align 2
- .byte 0x16, 0x92, 0x01
- .align 2
-
-gUnknown_847A024:: @ 847A024
- .byte 0x1d, 0x17, 0x1f, 0x01, 0x01
- .align 2
- .byte 0x11, 0x11, 0x34, 0x01, 0x01
- .align 2
- .byte 0x1d, 0x19, 0x4a, 0x01, 0x00
- .align 2
- .byte 0x20, 0x23, 0x4b, 0x00, 0x01
- .align 2
- .byte 0x26, 0x2e, 0x4c, 0x00, 0x01
- .align 2
- .byte 0x11, 0x11, 0x7e, 0x01, 0x01
- .align 2
- .byte 0x29, 0x2a, 0x7f, 0x00, 0x01
- .align 2
- .byte 0x1d, 0x19, 0x80, 0x01, 0x00
- .align 2
- .byte 0x18, 0x36, 0x81, 0x01, 0x00
- .align 2
- .byte 0x2e, 0x26, 0x82, 0x01, 0x00
-
- .align 2
-gUnknown_847A074:: @ 847A074
- .byte 0x03, 0x06
- .align 2
- .byte 0x37, 0x06
- .align 2
- .byte 0x02, 0x06
- .align 2
- .byte 0x67, 0x01
- .align 2
- .byte 0x04, 0x01
- .align 2
- .byte 0x24, 0x04
- .align 2
- .byte 0x4a, 0x01
- .align 2
- .byte 0x26, 0x01
- .align 2
- .byte 0x2a, 0x00
- .align 2
- .byte 0x42, 0x03
- .align 2
- .byte 0x1b, 0x09
- .align 2
- .byte 0x4c, 0x03
- .align 2
- .byte 0x44, 0x03
- .align 2
- .byte 0x21, 0x04
- .align 2
- .byte 0x43, 0x03
- .align 2
- .byte 0x6a, 0x01
- .align 2
- .byte 0x5d, 0x05
- .align 2
- .byte 0x56, 0x05
- .align 2
- .byte 0x09, 0x05
- .align 2
- .byte 0x11, 0x04
- .align 2
- .byte 0x48, 0x03
- .align 2
- .byte 0x3c, 0x00
- .align 2
- .byte 0x29, 0x00
- .align 2
- .byte 0x5c, 0x09
- .align 2
- .byte 0x28, 0x09
- .align 2
- .byte 0x06, 0x0c
- .align 2
- .byte 0x68, 0x0b
- .align 2
- .byte 0x05, 0x0b
- .align 2
- .byte 0x58, 0x0d
- .align 2
- .byte 0x16, 0x0d
- .align 2
- .byte 0x46, 0x08
- .align 2
- .byte 0x0f, 0x01
- .align 2
- .byte 0x3f, 0x03
- .align 2
- .byte 0x0e, 0x03
- .align 2
- .byte 0x5f, 0x04
- .align 2
- .byte 0x63, 0x04
- .align 2
- .byte 0x50, 0x04
- .align 2
- .byte 0x10, 0x04
- .align 2
- .byte 0x52, 0x03
- .align 2
- .byte 0x35, 0x04
- .align 2
- .byte 0x5b, 0x03
- .align 2
- .byte 0x14, 0x03
- .align 2
- .byte 0x3d, 0x00
- .align 2
- .byte 0x13, 0x00
- .align 2
- .byte 0x12, 0x0b
- .align 2
- .byte 0x30, 0x07
- .align 2
- .byte 0x38, 0x07
- .align 2
- .byte 0x2f, 0x07
- .align 2
- .byte 0x3b, 0x01
- .align 2
- .byte 0x31, 0x01
- .align 2
- .byte 0x4e, 0x0b
- .align 2
- .byte 0x3a, 0x00
- .align 2
- .byte 0x32, 0x00
- .align 2
- .byte 0x23, 0x03
- .align 2
- .byte 0x0d, 0x0d
- .align 2
- .byte 0x0a, 0x03
- .align 2
- .byte 0x49, 0x01
- .align 2
- .byte 0x0c, 0x01
- .align 2
- .byte 0x69, 0x01
- .align 2
- .byte 0x0b, 0x01
- .align 2
- .byte 0x25, 0x01
- .align 2
- .byte 0x3e, 0x02
- .align 2
- .byte 0x27, 0x02
- .align 2
- .byte 0x65, 0x01
- .align 2
- .byte 0x2d, 0x01
- .align 2
- .byte 0x61, 0x01
- .align 2
- .byte 0x2b, 0x03
- .align 2
- .byte 0x66, 0x05
- .align 2
- .byte 0x2e, 0x05
- .align 2
- .byte 0x2c, 0x00
- .align 2
- .byte 0x5e, 0x02
- .align 2
- .byte 0x34, 0x02
- .align 2
- .byte 0x51, 0x00
- .align 2
- .byte 0x59, 0x00
- .align 2
- .byte 0x40, 0x03
- .align 2
- .byte 0x55, 0x06
- .align 2
- .byte 0x53, 0x06
- .align 2
- .byte 0x4b, 0x04
- .align 2
- .byte 0x15, 0x04
- .align 2
- .byte 0x1a, 0x09
- .align 2
- .byte 0x57, 0x0a
- .align 2
- .byte 0x17, 0x01
- .align 2
- .byte 0x47, 0x03
- .align 2
- .byte 0x62, 0x01
- .align 2
- .byte 0x39, 0x00
- .align 2
- .byte 0x1d, 0x00
- .align 2
- .byte 0x1c, 0x04
- .align 2
- .byte 0x20, 0x00
- .align 2
- .byte 0x4f, 0x05
- .align 2
- .byte 0x22, 0x05
- .align 2
- .byte 0x45, 0x0b
- .align 2
- .byte 0x1f, 0x0b
- .align 2
- .byte 0x5a, 0x00
- .align 2
- .byte 0x1e, 0x00
- .align 2
- .byte 0x08, 0x00
- .align 2
- .byte 0x64, 0x02
- .align 2
- .byte 0x07, 0x02
- .align 2
- .byte 0x60, 0x08
- .align 2
- .byte 0x36, 0x08
- .align 2
- .byte 0x41, 0x0b
- .align 2
- .byte 0x33, 0x0b
- .align 2
- .byte 0x54, 0x00
- .align 2
- .byte 0x18, 0x01
- .align 2
- .byte 0x4d, 0x0b
- .align 2
- .byte 0x19, 0x00
-
- .align 2
-gUnknown_847A218:: @ 847A218
- @ window template
- .byte 0x00, 0x03, 0x01, 0x1b, 0x12, 0x0f
- .2byte 0x0001
-
-gUnknown_847A220:: @ 847A220
- .byte 0xFF, 0, 0, 0, 0, 0
- .2byte 0
-
-gUnknown_847A228::
- .4byte 0x70
-
-gUnknown_847A22C:: @ 847A22C
- .byte 0x00, 0x02, 0x03
-
- .align 2
-gUnknown_847A230:: @ 847A230
- .4byte sub_815DD44
- .4byte sub_815DF54
- .4byte sub_815E160
- .4byte sub_815E1C0
- .4byte sub_815E1F0
- .4byte sub_815E218
- .4byte sub_815E28C
- .4byte sub_815E394
- .4byte sub_815E408
- .4byte sub_815E4B0
- .4byte sub_815E56C
- .4byte sub_815E5C4
- .4byte sub_815E5F0
- .4byte sub_815E658
- .4byte sub_815E720
- .4byte sub_815E88C
- .4byte sub_815E8B4
- .4byte sub_815E8CC
- .4byte sub_815E908
- .4byte sub_815E948
- .4byte sub_815E9C8
-
-gUnknown_847A284:: @ 847A284
- .2byte 0x012a, 0x016e, 0x0176
- .2byte 0x012b, 0x016f, 0x0177
- .2byte 0x012c, 0x0170, 0x0178
- .2byte 0x012d, 0x0171, 0x0179
- .2byte 0x012e, 0x0172, 0x017a
- .2byte 0x012f, 0x0173, 0x017b
- .2byte 0x0130, 0x0174, 0x017c
- .2byte 0x0131, 0x0175, 0x017d
-
-gUnknown_847A2B4:: @ 847A2B4
- .2byte ITEM_HP_UP
- .2byte ITEM_PROTEIN
- .2byte ITEM_IRON
- .2byte ITEM_CARBOS
- .2byte ITEM_CALCIUM
- .2byte ITEM_ZINC
- .2byte ITEM_BRIGHT_POWDER
- .2byte ITEM_WHITE_HERB
- .2byte ITEM_MENTAL_HERB
- .2byte ITEM_CHOICE_BAND
- .2byte ITEM_KINGS_ROCK
- .2byte ITEM_SCOPE_LENS
- .2byte ITEM_METAL_COAT
- .2byte ITEM_DRAGON_SCALE
- .2byte ITEM_UP_GRADE
-
-gUnknown_847A2D2:: @ 847A2D2
- .2byte 0x011d
- .2byte 0x011c
- .2byte 0x011c
- .2byte 0x011b
- .2byte 0x011d
- .2byte 0x011d
- .2byte 0x011b
- .2byte 0x011b
- .2byte 0x011d
- .2byte 0x011c
- .2byte 0x011d
- .2byte 0x011d
- .2byte 0x011d
- .2byte 0x011d
-
-gUnknown_847A2EE:: @ 847A2EE
- .byte 0x00, 0x02
- .byte 0x01, 0x03
- .byte 0x02, 0x04
- .byte 0x03, 0x05
- .byte 0x04, 0x01
- .byte 0x05, 0x02
- .byte 0x00, 0x03
- .byte 0x01, 0x04
-
-gUnknown_847A2FE:: @ 847A2FE
- .byte 0x00, 0x01
- .byte 0x01, 0x03
- .byte 0x02, 0x00
- .byte 0x03, 0x04
- .byte 0x04, 0x02
- .byte 0x05, 0x02
- .byte 0x00, 0x03
- .byte 0x01, 0x05
-
-gUnknown_847A30E:: @ 847A30E
- .byte 0x00, 0x02
- .byte 0x04, 0x01
- .byte 0x03, 0x05
- .byte 0x02, 0x03
- .byte 0x01, 0x03
- .byte 0x04, 0x00
- .byte 0x04, 0x01
- .byte 0x02, 0x05
- .byte 0x00, 0x03
- .byte 0x00, 0x05
- .byte 0x02, 0x01
- .byte 0x04, 0x05
- .byte 0x00, 0x00
diff --git a/include/global.h b/include/global.h
index 26ce4a8cc..8e85b3123 100644
--- a/include/global.h
+++ b/include/global.h
@@ -241,33 +241,6 @@ struct LinkBattleRecords
u8 languages[LINK_B_RECORDS_COUNT];
};
-struct BattleTowerPokemon
-{
- u16 species;
- u16 heldItem;
- u16 moves[4];
- u8 level;
- u8 ppBonuses;
- u8 hpEV;
- u8 attackEV;
- u8 defenseEV;
- u8 speedEV;
- u8 spAttackEV;
- u8 spDefenseEV;
- u32 otId;
- u32 hpIV:5;
- u32 attackIV:5;
- u32 defenseIV:5;
- u32 speedIV:5;
- u32 spAttackIV:5;
- u32 spDefenseIV:5;
- u32 gap:1;
- u32 altAbility:1;
- u32 personality;
- u8 nickname[POKEMON_NAME_LENGTH + 1];
- u8 friendship;
-};
-
struct UnknownSaveBlock2Struct
{
u8 field_0;
diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h
index 32b46b552..e22f89f44 100644
--- a/include/new_menu_helpers.h
+++ b/include/new_menu_helpers.h
@@ -23,5 +23,6 @@ void sub_80F7974(const u8 *);
u8 GetStartMenuWindowId(void);
void sub_80F7998(void);
void sub_80F69E8(u8 bgId, const void *src, u32 size, u16 offset, u8 mode);
+void sub_80F6F1C(u8 windowId, bool8 copyNow);
#endif // GUARD_NEW_MENU_HELPERS_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 4c6240cd4..f1f04c9eb 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -310,31 +310,31 @@ struct PokemonStorage
/*0x83C2*/ u8 boxWallpapers[14];
};
-struct UnknownPokemonStruct
+struct BattleTowerPokemon
{
- u16 species;
- u16 heldItem;
- u16 moves[4];
- u8 level;
- u8 ppBonuses;
- u8 hpEV;
- u8 attackEV;
- u8 defenseEV;
- u8 speedEV;
- u8 spAttackEV;
- u8 spDefenseEV;
- u32 otId;
- u32 hpIV:5;
- u32 attackIV:5;
- u32 defenseIV:5;
- u32 speedIV:5;
- u32 spAttackIV:5;
- u32 spDefenseIV:5;
- u32 gap:1;
- u32 altAbility:1;
- u32 personality;
- u8 nickname[POKEMON_NAME_LENGTH + 1];
- u8 friendship;
+ /*0x00*/ u16 species;
+ /*0x02*/ u16 heldItem;
+ /*0x04*/ u16 moves[4];
+ /*0x0C*/ u8 level;
+ /*0x0D*/ u8 ppBonuses;
+ /*0x0E*/ u8 hpEV;
+ /*0x0F*/ u8 attackEV;
+ /*0x10*/ u8 defenseEV;
+ /*0x11*/ u8 speedEV;
+ /*0x12*/ u8 spAttackEV;
+ /*0x13*/ u8 spDefenseEV;
+ /*0x14*/ u32 otId;
+ /*0x18*/ u32 hpIV:5;
+ u32 attackIV:5;
+ u32 defenseIV:5;
+ u32 speedIV:5;
+ u32 spAttackIV:5;
+ u32 spDefenseIV:5;
+ u32 gap:1;
+ u32 altAbility:1;
+ /*0x1C*/ u32 personality;
+ /*0x20*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
+ /*0x2B*/ u8 friendship;
};
#define BATTLE_STATS_NO 8
@@ -671,5 +671,7 @@ void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u
void BattleAnimateBackSprite(struct Sprite* sprite, u16 species);
void PlayMapChosenOrBattleBGM(u16 songId);
+u8 GetMonsStateToDoubles(void);
+void sub_803E0A4(struct Pokemon *mon, struct BattleTowerPokemon *src);
#endif // GUARD_POKEMON_H
diff --git a/ld_script.txt b/ld_script.txt
index 7d2adefe7..b342f0b8a 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -267,7 +267,6 @@ SECTIONS {
asm/ss_anne.o(.text);
asm/cereader_tool.o(.text);
src/trainer_tower.o(.text);
- asm/trainer_tower.o(.text);
asm/unk_815EDDC.o(.text);
asm/unk_815F138.o(.text);
asm/berry_fix_program.o(.text);
@@ -367,7 +366,7 @@ SECTIONS {
src/bg_regs.o(.rodata);
src/string_util.o(.rodata);
data/data.o(.rodata);
- data/fieldmap.o(.rodata);
+ data/connections.o(.rodata);
src/fieldmap.o(.rodata);
src/metatile_behavior.o(.rodata);
data/metatile_behavior.o(.rodata);
@@ -395,7 +394,6 @@ SECTIONS {
src/quest_log_8150454.o(.rodata);
data/data_8471F00.o(.rodata);
src/trainer_tower.o(.rodata);
- data/trainer_tower.o(.rodata);
data/data_8471F00.o(.rodata.after_trainer_tower);
src/mystery_event_msg.o(.rodata);
data/mystery_event_msg.o(.rodata);
diff --git a/src/pokemon.c b/src/pokemon.c
index 5cd2cd2d7..9d902f901 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -351,7 +351,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI
CalculateMonStats(mon);
}
-void sub_803E0A4(struct Pokemon *mon, struct UnknownPokemonStruct *src)
+void sub_803E0A4(struct Pokemon *mon, struct BattleTowerPokemon *src)
{
s32 i;
u8 value;
@@ -410,7 +410,7 @@ void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u
SetMonData(mon, MON_DATA_OBEDIENCE, &obedient);
}
-void sub_803E23C(struct Pokemon *mon, struct UnknownPokemonStruct *dest)
+void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest)
{
s32 i;
u16 heldItem;
diff --git a/src/trainer_tower.c b/src/trainer_tower.c
index f4e18eee6..ef34c1629 100644
--- a/src/trainer_tower.c
+++ b/src/trainer_tower.c
@@ -3,6 +3,8 @@
#include "task.h"
#include "constants/flags.h"
#include "constants/vars.h"
+#include "constants/items.h"
+#include "constants/species.h"
#include "malloc.h"
#include "save.h"
#include "util.h"
@@ -18,6 +20,10 @@
#include "battle_2.h"
#include "overworld.h"
#include "item.h"
+#include "window.h"
+#include "menu.h"
+#include "new_menu_helpers.h"
+#include "sound.h"
struct UnkStruct_8479D34
{
@@ -98,6 +104,12 @@ struct UnkStruct_847A024
bool8 unk4;
};
+struct UnkStruct_847A074
+{
+ u8 unk0;
+ u8 unk1;
+};
+
EWRAM_DATA struct UnkStruct_203F458 * gUnknown_203F458 = NULL;
EWRAM_DATA struct UnkStruct_203F45C * gUnknown_203F45C = NULL;
@@ -129,18 +141,429 @@ void sub_815E908(void);
void sub_815E948(void);
void sub_815E9C8(void);
void sub_815E9FC(void);
+static s32 GetPartyMaxLevel(void);
void sub_815EC0C(void);
u32 sub_815EDDC(u32 *);
void sub_815EDF4(u32 *, u32);
-extern const struct UnkStruct_8479D34 gUnknown_8479D34[15];
-extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83];
-extern const struct UnkStruct_847A024 gUnknown_847A024[10];
-extern void (*const gUnknown_847A230[])(void);
+extern const u8 gUnknown_83FE982[];
+extern const u8 gUnknown_83FE998[];
+extern const u8 *const gUnknown_83FE9C4[];
+
+const struct UnkStruct_8479D34 gUnknown_8479D34[] = {
+ {
+ 0x03, 0x26,
+ .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x27,
+ .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0x9a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x01, 0x1f,
+ .flags1 = {0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x01, 0x22,
+ .flags1 = {0x53, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x41,
+ .flags1 = {0x40, 0x41, 0x42, 0x43, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x01, 0x02,
+ .flags1 = {0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0xff, 0xff},
+ .flags2 = {0x54, 0x55, 0x56, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x01, 0x6d,
+ .flags1 = {0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0x66},
+ .flags2 = {0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0xff},
+ .flags3 = {0x5a, 0x5c, 0x60, 0x61, 0x62, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x2e,
+ .flags1 = {0x6b, 0x6c, 0x6d, 0x6e, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xff, 0xff},
+ .flags3 = {0x6b, 0x6c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x30,
+ .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xa6, 0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x0f,
+ .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xa8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xa9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x39,
+ .flags1 = {0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x36,
+ .flags1 = {0xae, 0xb0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xaf, 0xb1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x3a,
+ .flags1 = {0xb2, 0xb3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x3b,
+ .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xb4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+ {
+ 0x03, 0x3e,
+ .flags1 = {0xb9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags2 = {0xba, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+ },
+};
+
+const struct UnkStruct_8479ED8 gUnknown_8479ED8[] = {
+ {0x1c, 0x03, 0x01},
+ {0x38, 0x04, 0x00},
+ {0x25, 0x06, 0x01},
+ {0x26, 0x07, 0x00},
+ {0x29, 0x08, 0x00},
+ {0x2a, 0x09, 0x01},
+ {0x34, 0x0a, 0x00},
+ {0x1c, 0x0b, 0x01},
+ {0x1d, 0x0c, 0x01},
+ {0x13, 0x0d, 0x00},
+ {0x34, 0x0e, 0x00},
+ {0x2d, 0x0f, 0x00},
+ {0x36, 0x10, 0x00},
+ {0x1a, 0x11, 0x00},
+ {0x1a, 0x12, 0x00},
+ {0x27, 0x13, 0x00},
+ {0x34, 0x14, 0x00},
+ {0x13, 0x15, 0x00},
+ {0x17, 0x16, 0x01},
+ {0x3d, 0x17, 0x00},
+ {0x13, 0x1d, 0x00},
+ {0x17, 0x1e, 0x01},
+ {0x1e, 0x20, 0x00},
+ {0x1f, 0x21, 0x01},
+ {0x20, 0x22, 0x00},
+ {0x23, 0x23, 0x01},
+ {0x12, 0x24, 0x00},
+ {0x39, 0x26, 0x00},
+ {0x29, 0x2d, 0x00},
+ {0x1a, 0x2e, 0x00},
+ {0x10, 0x2f, 0x00},
+ {0x18, 0x30, 0x01},
+ {0x1d, 0x31, 0x01},
+ {0x2e, 0x32, 0x01},
+ {0x28, 0x33, 0x01},
+ {0x3e, 0x35, 0x00},
+ {0x1b, 0x38, 0x00},
+ {0x19, 0x40, 0x00},
+ {0x1c, 0x41, 0x01},
+ {0x27, 0x42, 0x00},
+ {0x28, 0x43, 0x01},
+ {0x16, 0x47, 0x01},
+ {0x14, 0x48, 0x00},
+ {0x38, 0x49, 0x00},
+ {0x12, 0x58, 0x00},
+ {0x14, 0x59, 0x00},
+ {0x16, 0x5a, 0x01},
+ {0x3e, 0x5b, 0x00},
+ {0x27, 0x5c, 0x00},
+ {0x28, 0x5d, 0x01},
+ {0x34, 0x5e, 0x00},
+ {0x34, 0x5f, 0x00},
+ {0x38, 0x60, 0x00},
+ {0x35, 0x61, 0x00},
+ {0x34, 0x62, 0x00},
+ {0x1e, 0x63, 0x00},
+ {0x39, 0x64, 0x00},
+ {0x2d, 0x65, 0x00},
+ {0x35, 0x66, 0x00},
+ {0x20, 0x67, 0x00},
+ {0x1d, 0x68, 0x01},
+ {0x2e, 0x69, 0x01},
+ {0x13, 0x6a, 0x00},
+ {0x1a, 0x6b, 0x00},
+ {0x1a, 0x6c, 0x00},
+ {0x19, 0x6d, 0x00},
+ {0x1a, 0x6e, 0x00},
+ {0x36, 0x6f, 0x00},
+ {0x37, 0x71, 0x00},
+ {0x29, 0x74, 0x00},
+ {0x2a, 0x75, 0x01},
+ {0x3d, 0x7a, 0x00},
+ {0x3a, 0x7d, 0x01},
+ {0x17, 0x89, 0x01},
+ {0x18, 0x8a, 0x01},
+ {0x25, 0x8b, 0x01},
+ {0x1c, 0x8c, 0x01},
+ {0x27, 0x8d, 0x00},
+ {0x28, 0x8e, 0x01},
+ {0x1c, 0x8f, 0x01},
+ {0x38, 0x90, 0x00},
+ {0x1c, 0x91, 0x01},
+ {0x16, 0x92, 0x01}
+};
+
+const struct UnkStruct_847A024 gUnknown_847A024[] = {
+ {0x1d, 0x17, 0x1f, 0x01, 0x01},
+ {0x11, 0x11, 0x34, 0x01, 0x01},
+ {0x1d, 0x19, 0x4a, 0x01, 0x00},
+ {0x20, 0x23, 0x4b, 0x00, 0x01},
+ {0x26, 0x2e, 0x4c, 0x00, 0x01},
+ {0x11, 0x11, 0x7e, 0x01, 0x01},
+ {0x29, 0x2a, 0x7f, 0x00, 0x01},
+ {0x1d, 0x19, 0x80, 0x01, 0x00},
+ {0x18, 0x36, 0x81, 0x01, 0x00},
+ {0x2e, 0x26, 0x82, 0x01, 0x00}
+};
+
+const struct UnkStruct_847A074 gUnknown_847A074[105] = {
+ {0x03, 0x06},
+ {0x37, 0x06},
+ {0x02, 0x06},
+ {0x67, 0x01},
+ {0x04, 0x01},
+ {0x24, 0x04},
+ {0x4a, 0x01},
+ {0x26, 0x01},
+ {0x2a, 0x00},
+ {0x42, 0x03},
+ {0x1b, 0x09},
+ {0x4c, 0x03},
+ {0x44, 0x03},
+ {0x21, 0x04},
+ {0x43, 0x03},
+ {0x6a, 0x01},
+ {0x5d, 0x05},
+ {0x56, 0x05},
+ {0x09, 0x05},
+ {0x11, 0x04},
+ {0x48, 0x03},
+ {0x3c, 0x00},
+ {0x29, 0x00},
+ {0x5c, 0x09},
+ {0x28, 0x09},
+ {0x06, 0x0c},
+ {0x68, 0x0b},
+ {0x05, 0x0b},
+ {0x58, 0x0d},
+ {0x16, 0x0d},
+ {0x46, 0x08},
+ {0x0f, 0x01},
+ {0x3f, 0x03},
+ {0x0e, 0x03},
+ {0x5f, 0x04},
+ {0x63, 0x04},
+ {0x50, 0x04},
+ {0x10, 0x04},
+ {0x52, 0x03},
+ {0x35, 0x04},
+ {0x5b, 0x03},
+ {0x14, 0x03},
+ {0x3d, 0x00},
+ {0x13, 0x00},
+ {0x12, 0x0b},
+ {0x30, 0x07},
+ {0x38, 0x07},
+ {0x2f, 0x07},
+ {0x3b, 0x01},
+ {0x31, 0x01},
+ {0x4e, 0x0b},
+ {0x3a, 0x00},
+ {0x32, 0x00},
+ {0x23, 0x03},
+ {0x0d, 0x0d},
+ {0x0a, 0x03},
+ {0x49, 0x01},
+ {0x0c, 0x01},
+ {0x69, 0x01},
+ {0x0b, 0x01},
+ {0x25, 0x01},
+ {0x3e, 0x02},
+ {0x27, 0x02},
+ {0x65, 0x01},
+ {0x2d, 0x01},
+ {0x61, 0x01},
+ {0x2b, 0x03},
+ {0x66, 0x05},
+ {0x2e, 0x05},
+ {0x2c, 0x00},
+ {0x5e, 0x02},
+ {0x34, 0x02},
+ {0x51, 0x00},
+ {0x59, 0x00},
+ {0x40, 0x03},
+ {0x55, 0x06},
+ {0x53, 0x06},
+ {0x4b, 0x04},
+ {0x15, 0x04},
+ {0x1a, 0x09},
+ {0x57, 0x0a},
+ {0x17, 0x01},
+ {0x47, 0x03},
+ {0x62, 0x01},
+ {0x39, 0x00},
+ {0x1d, 0x00},
+ {0x1c, 0x04},
+ {0x20, 0x00},
+ {0x4f, 0x05},
+ {0x22, 0x05},
+ {0x45, 0x0b},
+ {0x1f, 0x0b},
+ {0x5a, 0x00},
+ {0x1e, 0x00},
+ {0x08, 0x00},
+ {0x64, 0x02},
+ {0x07, 0x02},
+ {0x60, 0x08},
+ {0x36, 0x08},
+ {0x41, 0x0b},
+ {0x33, 0x0b},
+ {0x54, 0x00},
+ {0x18, 0x01},
+ {0x4d, 0x0b},
+ {0x19, 0x00}
+};
+
+const struct WindowTemplate gUnknown_847A218[] = {
+ {0, 3, 1, 27, 18, 15, 0x001},
+ DUMMY_WIN_TEMPLATE
+};
+
+const u32 gUnknown_847A228 = 0x70; // unused
+
+const struct TextColor gUnknown_847A22C = {0, 2, 3};
+
+void (*const gUnknown_847A230[])(void) = {
+ sub_815DD44,
+ sub_815DF54,
+ sub_815E160,
+ sub_815E1C0,
+ sub_815E1F0,
+ sub_815E218,
+ sub_815E28C,
+ sub_815E394,
+ sub_815E408,
+ sub_815E4B0,
+ sub_815E56C,
+ sub_815E5C4,
+ sub_815E5F0,
+ sub_815E658,
+ sub_815E720,
+ sub_815E88C,
+ sub_815E8B4,
+ sub_815E8CC,
+ sub_815E908,
+ sub_815E948,
+ sub_815E9C8
+};
+
+const u16 gUnknown_847A284[8][3] = {
+ {0x012a, 0x016e, 0x0176},
+ {0x012b, 0x016f, 0x0177},
+ {0x012c, 0x0170, 0x0178},
+ {0x012d, 0x0171, 0x0179},
+ {0x012e, 0x0172, 0x017a},
+ {0x012f, 0x0173, 0x017b},
+ {0x0130, 0x0174, 0x017c},
+ {0x0131, 0x0175, 0x017d}
+};
+
+const u16 gUnknown_847A2B4[] = {
+ ITEM_HP_UP,
+ ITEM_PROTEIN,
+ ITEM_IRON,
+ ITEM_CARBOS,
+ ITEM_CALCIUM,
+ ITEM_ZINC,
+ ITEM_BRIGHT_POWDER,
+ ITEM_WHITE_HERB,
+ ITEM_MENTAL_HERB,
+ ITEM_CHOICE_BAND,
+ ITEM_KINGS_ROCK,
+ ITEM_SCOPE_LENS,
+ ITEM_METAL_COAT,
+ ITEM_DRAGON_SCALE,
+ ITEM_UP_GRADE
+};
+
+const u16 gUnknown_847A2D2[] = {
+ 0x011d,
+ 0x011c,
+ 0x011c,
+ 0x011b,
+ 0x011d,
+ 0x011d,
+ 0x011b,
+ 0x011b,
+ 0x011d,
+ 0x011c,
+ 0x011d,
+ 0x011d,
+ 0x011d,
+ 0x011d
+};
+
+const u8 gUnknown_847A2EE[][2] = {
+ {0x00, 0x02},
+ {0x01, 0x03},
+ {0x02, 0x04},
+ {0x03, 0x05},
+ {0x04, 0x01},
+ {0x05, 0x02},
+ {0x00, 0x03},
+ {0x01, 0x04}
+};
+
+const u8 gUnknown_847A2FE[][2] = {
+ {0x00, 0x01},
+ {0x01, 0x03},
+ {0x02, 0x00},
+ {0x03, 0x04},
+ {0x04, 0x02},
+ {0x05, 0x02},
+ {0x00, 0x03},
+ {0x01, 0x05}
+};
+
+const u8 gUnknown_847A30E[][3] = {
+ {0x00, 0x02, 0x04},
+ {0x01, 0x03, 0x05},
+ {0x02, 0x03, 0x01},
+ {0x03, 0x04, 0x00},
+ {0x04, 0x01, 0x02},
+ {0x05, 0x00, 0x03},
+ {0x00, 0x05, 0x02},
+ {0x01, 0x04, 0x05}
+};
+
extern const struct Unk_203F458_Header gUnknown_84827AC;
extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8];
-extern const u16 gUnknown_847A284[8][3];
-extern const u16 gUnknown_847A2B4[];
bool32 sub_815D7BC(void * dest, void * buffer)
{
@@ -858,3 +1281,246 @@ void sub_815E5C4(void)
{
gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3 = 1;
}
+
+void sub_815E5F0(void)
+{
+ if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3)
+ {
+ gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3 = FALSE;
+ gSpecialVar_Result = 0;
+ }
+ else if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_4)
+ {
+ gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_4 = FALSE;
+ gSpecialVar_Result = 1;
+ }
+ else
+ {
+ gSpecialVar_Result = 2;
+ }
+}
+
+#define PRINT_TOWER_TIME(src) ({ \
+ s32 minutes, seconds, centiseconds, frames; \
+ \
+ frames = (src); \
+ \
+ minutes = frames / 3600; \
+ frames %= 3600; \
+ seconds = frames / 60; \
+ frames %= 60; \
+ centiseconds = frames * 168 / 100; \
+ \
+ ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_RIGHT_ALIGN, 2); \
+ ConvertIntToDecimalStringN(gStringVar2, seconds, STR_CONV_MODE_RIGHT_ALIGN, 2); \
+ ConvertIntToDecimalStringN(gStringVar3, centiseconds, STR_CONV_MODE_LEADING_ZEROS, 2); \
+})
+
+void sub_815E658(void)
+{
+ if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 >= 215999)
+ {
+ DisableVBlankCounter1();
+ gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 = 215999;
+ }
+
+ PRINT_TOWER_TIME(gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0);
+}
+
+void sub_815E720(void)
+{
+ u8 windowId;
+ s32 i;
+ s32 minutes, seconds, centiseconds;
+
+ sub_815EC0C();
+ windowId = AddWindow(gUnknown_847A218);
+ sub_80F6E9C();
+ sub_80F6F1C(windowId, FALSE);
+ AddTextPrinterParameterized(windowId, 2, gUnknown_83FE982, 0x4A, 0, 0xFF, NULL);
+
+ for (i = 0; i < 4; i++)
+ {
+ PRINT_TOWER_TIME(sub_815EDDC(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4));
+
+ StringExpandPlaceholders(gStringVar4, gUnknown_83FE998);
+ AddTextPrinterParameterized(windowId, 2, gUnknown_83FE9C4[i - 1], 0x18, 0x24 + 0x14 * i, 0xFF, NULL);
+ AddTextPrinterParameterized(windowId, 2, gStringVar4, 0x60, 0x2E + 0x14 * i, 0xFF, NULL);
+ }
+
+ PutWindowTilemap(windowId);
+ CopyWindowToVram(windowId, 3);
+ VarSet(VAR_0x4001, windowId);
+}
+
+void sub_815E88C(void)
+{
+ u8 windowId = VarGet(VAR_0x4001);
+ sub_810F4D8(windowId, TRUE);
+ RemoveWindow(windowId);
+}
+
+void sub_815E8B4(void)
+{
+ gSpecialVar_Result = GetMonsStateToDoubles();
+}
+
+void sub_815E8CC(void)
+{
+ if (gUnknown_203F458->unk_0004.unk_0000.unk0 != gUnknown_203F458->unk_0004.unk_0008[0].unk_001)
+ {
+ ConvertIntToDecimalStringN(gStringVar1, gUnknown_203F458->unk_0004.unk_0000.unk0, STR_CONV_MODE_LEFT_ALIGN, 1);
+ gSpecialVar_Result = TRUE;
+ }
+ else
+ {
+ gSpecialVar_Result = FALSE;
+ }
+}
+
+void sub_815E908(void)
+{
+ if (gMapHeader.mapDataId == 0x0129 && VarGet(VAR_0x4082) == 0)
+ {
+ gSpecialVar_Result = FALSE;
+ }
+ else
+ {
+ gSpecialVar_Result = FALSE;
+ }
+}
+
+void sub_815E948(void)
+{
+ s32 i;
+ u16 var_4001 = VarGet(VAR_0x4001);
+ u8 r1 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[var_4001].unk_00B;
+
+ for (i = 0; i < NELEMS(gUnknown_847A074); i++)
+ {
+ if (gUnknown_847A074[i].unk0 == gFacilityClassToTrainerClass[r1])
+ break;
+ }
+ if (i != NELEMS(gUnknown_847A074))
+ {
+ var_4001 = gUnknown_847A074[i].unk1;
+ }
+ else
+ {
+ var_4001 = 0;
+ }
+ PlayNewMapMusic(gUnknown_847A2D2[var_4001]);
+}
+
+void sub_815E9C8(void)
+{
+ gSpecialVar_Result = gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2;
+}
+
+void sub_815E9FC(void)
+{
+ u16 r4 = VarGet(VAR_0x4001);
+ s32 r9 = GetPartyMaxLevel();
+ u8 r5 = gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8;
+ s32 r6;
+ u8 r2;
+
+ ZeroEnemyPartyMons();
+
+ switch (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002)
+ {
+ case 0:
+ default:
+ for (r6 = 0; r6 < 2; r6++)
+ {
+ r2 = gUnknown_847A2EE[r5][r6];
+ gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9;
+ sub_803E0A4(&gEnemyParty[r6], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]);
+ }
+ break;
+ case 1:
+ r2 = gUnknown_847A2FE[r5][0];
+ gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2].level = r9;
+ sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2]);
+ r2 = gUnknown_847A2FE[r5][1];
+ gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2].level = r9;
+ sub_803E0A4(&gEnemyParty[1], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2]);
+ break;
+ case 2:
+ r2 = gUnknown_847A30E[r5][r4];
+ gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9;
+ sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]);
+ break;
+ }
+}
+
+static s32 GetPartyMaxLevel(void)
+{
+ s32 topLevel = 0;
+ s32 i;
+
+ for (i = 0; i < PARTY_SIZE; i++)
+ {
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != 0 && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG)
+ {
+ s32 currLevel = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL, NULL);
+ if (currLevel > topLevel)
+ topLevel = currLevel;
+ }
+ }
+
+ return topLevel;
+}
+
+void sub_815EC0C(void)
+{
+ if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 != gUnknown_203F458->unk_0004.unk_0000.unk1)
+ {
+ gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 = gUnknown_203F458->unk_0004.unk_0000.unk1;
+ sub_815EDF4(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4, 215999);
+ gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 = FALSE;
+ }
+}
+
+void sub_815EC8C(void)
+{
+ s32 i;
+ u8 windowId = 0;
+
+ sub_815DC8C();
+ FillWindowPixelRect(0, 0, 0, 0, 0xd8, 0x90);
+ sub_815EC0C();
+ box_print(0, 2, 0x4a, 0, &gUnknown_847A22C, 0, gUnknown_83FE982);
+
+ for (i = 0; i < 4; i++)
+ {
+ PRINT_TOWER_TIME(sub_815EDDC(&gSaveBlock1Ptr->unkArray[i].unk4));
+ StringExpandPlaceholders(gStringVar4, gUnknown_83FE998);
+ box_print(windowId, 2, 0x18, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gUnknown_83FE9C4[i]);
+ box_print(windowId, 2, 0x60, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gStringVar4);
+ }
+
+ PutWindowTilemap(windowId);
+ CopyWindowToVram(windowId, 3);
+ sub_815DD2C();
+}
+
+u32 sub_815EDDC(u32 * counter)
+{
+ return *counter ^ gSaveBlock2Ptr->encryptionKey;
+}
+
+void sub_815EDF4(u32 * counter, u32 value)
+{
+ *counter = value ^ gSaveBlock2Ptr->encryptionKey;
+}
+
+void sub_815EE0C(void)
+{
+ s32 i;
+
+ for (i = 0; i < 4; i++)
+ {
+ sub_815EDF4(&gSaveBlock1Ptr->unkArray[i].unk4, 215999);
+ }
+}