From 62a645abafdd17b737562b4ab6b40739d13722c2 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 25 Aug 2018 18:46:15 +0200 Subject: [PATCH] Up To CopyDomeTrainerName --- asm/battle_frontier_1.s | 1661 +-------------------------------------- asm/battle_frontier_2.s | 36 +- asm/battle_tent.s | 6 +- asm/battle_tower.s | 36 +- include/battle_tower.h | 6 +- include/global.h | 4 +- src/battle_frontier_1.c | 581 ++++++++++++-- src/battle_tent.c | 4 +- sym_ewram.txt | 3 +- 9 files changed, 583 insertions(+), 1754 deletions(-) diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index acf2a7b81..193bd5e34 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -6,1667 +6,8 @@ .text - thumb_func_start sub_8194B70 -sub_8194B70: @ 8194B70 - push {lr} - movs r0, 0x3 - movs r1, 0x80 - movs r2, 0x1 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0x80 - movs r2, 0x2 - bl ChangeBgY - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194B70 - thumb_func_start sub_8194BEC -sub_8194BEC: @ 8194BEC - push {lr} - ldr r0, =0x04000006 - ldrh r0, [r0] - adds r1, r0, 0 - cmp r0, 0x29 - bls _08194CC8 - cmp r0, 0x31 - bhi _08194C1C - ldr r1, =0x04000048 - ldr r2, =0x00003b3b - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x989b5558 - b _08194CD4 - .pool -_08194C1C: - cmp r0, 0x39 - bls _08194CC8 - cmp r0, 0x4A - bhi _08194C40 - ldr r1, =0x04000048 - ldr r2, =0x00003b3b - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x90985860 - b _08194CD4 - .pool -_08194C40: - cmp r0, 0x51 - bhi _08194C60 - ldr r1, =0x04000048 - ldr r2, =0x00003b3b - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x989b5558 - b _08194CD4 - .pool -_08194C60: - cmp r0, 0x5E - bls _08194CC8 - cmp r0, 0x66 - bhi _08194C84 - ldr r1, =0x04000048 - ldr r2, =0x00003737 - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x989b5558 - b _08194CD4 - .pool -_08194C84: - cmp r0, 0x76 - bhi _08194CA4 - ldr r1, =0x04000048 - ldr r2, =0x00003737 - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x90985860 - b _08194CD4 - .pool -_08194CA4: - cmp r0, 0x7E - bls _08194CC8 - cmp r1, 0x86 - bhi _08194CC8 - ldr r1, =0x04000048 - ldr r2, =0x00003737 - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - ldr r0, =0x989b5558 - b _08194CD4 - .pool -_08194CC8: - ldr r1, =0x04000048 - ldr r2, =0x00003f3f - adds r0, r2, 0 - strh r0, [r1] - subs r1, 0x8 - movs r0, 0 -_08194CD4: - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194BEC - thumb_func_start sub_8194CE4 -sub_8194CE4: @ 8194CE4 - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - movs r0, 0x2 - movs r1, 0x80 - movs r2, 0x2 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0x80 - movs r2, 0x1 - bl ChangeBgY - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194CE4 - - thumb_func_start sub_8194D48 -sub_8194D48: @ 8194D48 - ldr r1, =gFacilityTrainerMons - ldr r0, =gBattleFrontierMons - str r0, [r1] - ldr r1, =gUnknown_0203BC88 - ldr r0, =gBattleFrontierTrainers - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8194D48 - - thumb_func_start sub_8194D68 -sub_8194D68: @ 8194D68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r3, 0 -_08194D76: - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r0, =gUnknown_0203CEF8 - adds r0, r3, r0 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 1 - ldr r2, =0x00000caa - adds r1, r2 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - mov r10, r0 - movs r6, 0 - adds r0, r3, 0x1 - str r0, [sp] - movs r1, 0x64 - mov r0, r10 - muls r0, r1 - movs r2, 0x8E - lsls r2, 2 - adds r2, r0 - mov r9, r2 - adds r7, r3, 0 - muls r7, r1 -_08194DA8: - movs r5, 0 - adds r0, r6, 0x1 - mov r8, r0 - b _08194DBE - .pool -_08194DBC: - adds r5, 0x1 -_08194DBE: - cmp r5, 0x3 - bgt _08194DEA - ldr r1, =gSaveBlock1Ptr - ldr r0, [r1] - add r0, r9 - adds r1, r5, 0 - adds r1, 0xD - movs r2, 0 - str r3, [sp, 0x4] - bl GetMonData - adds r4, r0, 0 - adds r1, r6, 0 - adds r1, 0xD - ldr r2, =gPlayerParty - adds r0, r7, r2 - movs r2, 0 - bl GetMonData - ldr r3, [sp, 0x4] - cmp r4, r0 - bne _08194DBC -_08194DEA: - cmp r5, 0x4 - bne _08194E00 - lsls r2, r6, 24 - lsrs r2, 24 - ldr r1, =gPlayerParty - adds r0, r7, r1 - movs r1, 0xA6 - str r3, [sp, 0x4] - bl SetMonMoveSlot - ldr r3, [sp, 0x4] -_08194E00: - mov r6, r8 - cmp r6, 0x3 - ble _08194DA8 - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - movs r2, 0x64 - mov r1, r10 - muls r1, r2 - adds r0, r1 - movs r1, 0x8E - lsls r1, 2 - adds r0, r1 - adds r1, r3, 0 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r3, [sp] - cmp r3, 0x1 - ble _08194D76 - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194D68 - - thumb_func_start sub_8194E44 -sub_8194E44: @ 8194E44 - push {r4-r7,lr} - sub sp, 0x4 - movs r4, 0 - ldr r7, =gSaveBlock1Ptr - movs r6, 0x64 - movs r5, 0 -_08194E50: - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r0, =gUnknown_0203CEF8 - adds r0, r4, r0 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 1 - ldr r2, =0x00000caa - adds r1, r2 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - adds r1, r0, 0 - muls r1, r6 - movs r0, 0x8E - lsls r0, 2 - adds r1, r0 - ldr r0, [r7] - adds r0, r1 - movs r1, 0xC - movs r2, 0 - bl GetMonData - mov r1, sp - strh r0, [r1] - ldr r0, =gPlayerParty - adds r0, r5, r0 - movs r1, 0xC - mov r2, sp - bl SetMonData - adds r5, 0x64 - adds r4, 0x1 - cmp r4, 0x1 - ble _08194E50 - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194E44 - - thumb_func_start sub_8194EB4 -sub_8194EB4: @ 8194EB4 - push {lr} - bl sub_80F94E8 - pop {r0} - bx r0 - thumb_func_end sub_8194EB4 - - thumb_func_start sub_8194EC0 -sub_8194EC0: @ 8194EC0 - push {r4,lr} - ldr r0, =gTrainerBattleOpponent_A - ldrh r0, [r0] - bl TrainerIdToTournamentId - adds r4, r0, 0 - ldr r0, =0x000003ff - bl TrainerIdToTournamentId - cmp r4, r0 - ble _08194EE8 - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - b _08194EEC - .pool -_08194EE8: - ldr r1, =gSpecialVar_Result - movs r0, 0x2 -_08194EEC: - strh r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194EC0 - - thumb_func_start sub_8194EF8 -sub_8194EF8: @ 8194EF8 - push {r4,lr} - bl sub_8194D48 - movs r2, 0 - ldr r3, =gSaveBlock2Ptr - ldr r0, [r3] - ldr r1, =0x00000d25 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _08194F2A - adds r4, r3, 0 - adds r3, r1, 0 -_08194F14: - adds r2, 0x1 - cmp r2, 0xF - bgt _08194F2A - ldr r0, [r4] - lsls r1, r2, 2 - adds r0, r1 - adds r0, r3 - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _08194F14 -_08194F2A: - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsls r2, 2 - adds r1, r2 - ldr r2, =0x00000d24 - adds r1, r2 - ldrh r1, [r1] - lsls r1, 22 - lsrs r1, 22 - bl CopyDomeTrainerName - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194EF8 - - thumb_func_start sub_8194F58 -sub_8194F58: @ 8194F58 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x40 - movs r0, 0 - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - ldr r4, =gSaveBlock2Ptr - ldr r2, [r4] - ldr r5, =0x00000d0a - adds r0, r2, r5 - ldrb r1, [r0] - ldr r6, =0x00000d0b - adds r0, r2, r6 - ldrb r0, [r0] - cmn r1, r0 - beq _08194F8C - ldr r1, =0x00000ca8 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08194F8C - b _0819533E -_08194F8C: - movs r0, 0x20 - bl AllocZeroed - str r0, [sp, 0x18] - movs r0, 0x18 - bl AllocZeroed - str r0, [sp, 0x1C] - ldr r1, [r4] - ldr r2, =0x00000ca9 - adds r1, r2 - ldrb r2, [r1] - lsls r0, r2, 30 - lsrs r0, 30 - str r0, [sp, 0x14] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r4] - movs r1, 0x1 - adds r0, r5 - strb r1, [r0] - ldr r0, [r4] - adds r0, r6 - strb r1, [r0] - movs r3, 0 - mov r10, r3 - movs r4, 0 - str r4, [sp, 0x38] - movs r5, 0 - str r5, [sp, 0x3C] -_08194FCC: - mov r0, r10 - cmp r0, 0x4 - bgt _08194FFC - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r4, r0, 16 - b _08195030 - .pool -_08194FFC: - mov r1, r10 - cmp r1, 0xE - bgt _0819501A - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x14 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - adds r4, r0, 0 - adds r4, 0xA - b _08195030 -_0819501A: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - adds r4, r0, 0 - adds r4, 0x1E -_08195030: - movs r6, 0 - cmp r6, r10 - bge _08195064 - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - ldr r3, =0x00000d24 - adds r0, r3 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r4 - beq _08195064 - adds r3, r2, 0 - ldr r2, =0x00000d24 -_0819504C: - adds r6, 0x1 - cmp r6, r10 - bge _08195064 - ldr r0, [r3] - lsls r1, r6, 2 - adds r0, r1 - adds r0, r2 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r4 - bne _0819504C -_08195064: - cmp r6, r10 - bne _08194FCC - ldr r5, =gSaveBlock2Ptr - ldr r3, [r5] - ldr r0, [sp, 0x38] - adds r3, r0 - ldr r1, =0x00000d24 - adds r3, r1 - ldr r2, =0x000003ff - adds r0, r2, 0 - adds r2, r4, 0 - ands r2, r0 - ldrh r0, [r3] - ldr r5, =0xfffffc00 - adds r1, r5, 0 - ands r0, r1 - orrs r0, r2 - strh r0, [r3] - movs r6, 0 - lsls r4, 16 - str r4, [sp, 0x30] - ldr r0, [sp, 0x3C] - str r0, [sp, 0x20] -_08195092: - adds r1, r6, 0x1 - str r1, [sp, 0x24] - lsls r2, r6, 2 - str r2, [sp, 0x2C] - lsls r3, r6, 1 - str r3, [sp, 0x28] -_0819509E: - ldr r4, [sp, 0x30] - lsrs r0, r4, 16 - bl RandomizeFacilityTrainerMonId - lsls r0, 16 - lsrs r5, r0, 16 - movs r7, 0 - cmp r7, r6 - bge _081950F4 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =gFacilityTrainerMons - mov r9, r1 - ldr r2, [sp, 0x8] - mov r8, r2 - ldr r3, [sp, 0xC] - mov r12, r3 - ldr r4, =0x00000d64 - adds r0, r4 - ldr r1, [sp, 0x20] - adds r4, r1, r0 -_081950C8: - ldrh r3, [r4] - cmp r3, r5 - beq _081950F4 - mov r2, r9 - ldr r1, [r2] - lsls r0, r5, 4 - adds r2, r0, r1 - ldrh r0, [r2] - cmp r8, r0 - beq _081950F4 - cmp r12, r0 - beq _081950F4 - lsls r0, r3, 4 - adds r0, r1 - ldrb r0, [r0, 0xA] - ldrb r2, [r2, 0xA] - cmp r0, r2 - beq _081950F4 - adds r4, 0x2 - adds r7, 0x1 - cmp r7, r6 - blt _081950C8 -_081950F4: - cmp r7, r6 - bne _0819509E - ldr r3, =gSaveBlock2Ptr - ldr r0, [r3] - ldr r4, [sp, 0x28] - ldr r2, [sp, 0x3C] - adds r1, r4, r2 - ldr r3, =0x00000d64 - adds r0, r3 - adds r0, r1 - strh r5, [r0] - ldr r2, [sp, 0x2C] - add r2, sp - adds r2, 0x8 - ldr r3, =gFacilityTrainerMons - ldr r1, [r3] - lsls r0, r5, 4 - adds r0, r1 - ldrh r0, [r0] - str r0, [r2] - ldr r6, [sp, 0x24] - cmp r6, 0x2 - ble _08195092 - ldr r4, =gSaveBlock2Ptr - ldr r2, [r4] - ldr r5, [sp, 0x38] - adds r2, r5 - ldr r0, =0x00000d25 - adds r2, r0 - ldrb r0, [r2] - movs r4, 0x5 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r5, =gSaveBlock2Ptr - ldr r2, [r5] - ldr r0, [sp, 0x38] - adds r2, r0 - ldr r1, =0x00000d25 - adds r2, r1 - ldrb r0, [r2] - subs r4, 0x14 - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r1, [r5] - ldr r5, [sp, 0x38] - adds r1, r5 - ldr r0, =0x00000d25 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - strb r0, [r1] - adds r5, 0x4 - str r5, [sp, 0x38] - ldr r1, [sp, 0x3C] - adds r1, 0x6 - str r1, [sp, 0x3C] - movs r2, 0x1 - add r10, r2 - mov r4, r10 - cmp r4, 0xF - bgt _08195178 - b _08194FCC -_08195178: - movs r5, 0 - mov r10, r5 - ldr r5, [sp, 0x18] - movs r0, 0 - str r0, [sp, 0x34] -_08195182: - movs r7, 0 - strh r7, [r5] - ldr r1, =gSaveBlock2Ptr - ldr r0, [r1] - mov r2, r10 - lsls r1, r2, 2 - adds r0, r1 - ldr r3, =0x00000d24 - adds r0, r3 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - bl GetDomeTrainerMonIvs - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r6, 0 - ldr r4, [sp, 0x34] - mov r9, r4 -_081951AA: - ldr r1, =gSaveBlock2Ptr - ldr r0, [r1] - mov r4, r9 - add r4, r10 - adds r4, r6 - lsls r4, 1 - ldr r2, =0x00000d64 - adds r0, r2 - adds r0, r4 - ldrh r1, [r0] - ldr r3, =gFacilityTrainerMons - ldr r0, [r3] - lsls r1, 4 - adds r1, r0 - ldrh r0, [r1] - ldrb r3, [r1, 0xB] - ldrb r1, [r1, 0xC] - str r1, [sp] - ldr r1, [sp, 0x1C] - str r1, [sp, 0x4] - movs r1, 0x32 - mov r2, r8 - bl CalcDomeMonStats - ldr r2, [sp, 0x1C] - ldr r1, [r2, 0x4] - ldrh r0, [r5] - adds r0, r1 - ldr r1, [r2, 0x8] - adds r0, r1 - ldr r1, [r2, 0x10] - adds r0, r1 - ldr r1, [r2, 0x14] - adds r0, r1 - ldr r1, [r2, 0xC] - adds r0, r1 - ldr r1, [r2] - adds r0, r1 - strh r0, [r5] - ldr r3, =gSaveBlock2Ptr - ldr r0, [r3] - ldr r1, =0x00000d64 - adds r0, r1 - adds r0, r4 - ldrh r0, [r0] - ldr r2, =gFacilityTrainerMons - ldr r1, [r2] - lsls r0, 4 - adds r0, r1 - ldrh r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r3, =gBaseStats - adds r1, r3 - ldrb r0, [r1, 0x6] - lsls r0, 2 - ldr r4, =gBitTable - adds r0, r4 - ldr r0, [r0] - orrs r7, r0 - ldrb r0, [r1, 0x7] - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - orrs r7, r0 - adds r6, 0x1 - cmp r6, 0x2 - ble _081951AA - movs r4, 0 - movs r1, 0x1 - movs r6, 0x1F -_0819523A: - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _08195244 - adds r4, 0x1 -_08195244: - asrs r7, 1 - subs r6, 0x1 - cmp r6, 0 - bge _0819523A - movs r1, 0x32 - adds r0, r4, 0 - muls r0, r1 - movs r1, 0x14 - bl __divsi3 - ldrh r1, [r5] - adds r1, r0 - strh r1, [r5] - adds r5, 0x2 - ldr r2, [sp, 0x34] - adds r2, 0x2 - str r2, [sp, 0x34] - movs r3, 0x1 - add r10, r3 - mov r4, r10 - cmp r4, 0xF - ble _08195182 - movs r5, 0 - mov r10, r5 - ldr r7, [sp, 0x18] -_08195276: - mov r6, r10 - adds r6, 0x1 - cmp r6, 0xF - bgt _081952F8 - mov r8, r7 - ldr r5, =0x00000d24 - lsls r0, r6, 1 - ldr r1, [sp, 0x18] - adds r4, r0, r1 -_08195288: - mov r2, r8 - ldrh r1, [r2] - ldrh r0, [r4] - cmp r1, r0 - bcs _081952C4 - mov r0, r10 - adds r1, r6, 0 - ldr r2, [sp, 0x18] - bl SwapDomeTrainers - b _081952F0 - .pool -_081952C4: - cmp r1, r0 - bne _081952F0 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - mov r3, r10 - lsls r0, r3, 2 - adds r0, r1, r0 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 22 - lsls r0, r6, 2 - adds r1, r0 - adds r1, r5 - ldrh r0, [r1] - lsls r0, 22 - cmp r2, r0 - bls _081952F0 - mov r0, r10 - adds r1, r6, 0 - ldr r2, [sp, 0x18] - bl SwapDomeTrainers -_081952F0: - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0xF - ble _08195288 -_081952F8: - adds r7, 0x2 - movs r4, 0x1 - add r10, r4 - mov r5, r10 - cmp r5, 0xE - ble _08195276 - ldr r0, [sp, 0x18] - bl Free - ldr r0, [sp, 0x1C] - bl Free - movs r0, 0 - mov r10, r0 -_08195314: - mov r1, r10 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_8195438 - movs r2, 0x1 - add r10, r2 - mov r3, r10 - cmp r3, 0x3 - ble _08195314 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r4, =0x00000ca9 - adds r1, r4 - ldrb r2, [r1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - ldr r5, [sp, 0x14] - orrs r0, r5 - strb r0, [r1] -_0819533E: - add sp, 0x40 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8194F58 - - thumb_func_start TrainerIdToTournamentId -TrainerIdToTournamentId: @ 8195358 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - ldr r1, =0x00000d24 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r3 - beq _0819538E - adds r5, r4, 0 - adds r4, r1, 0 -_08195376: - adds r2, 0x1 - cmp r2, 0xF - bgt _0819538E - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r1 - adds r0, r4 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r3 - bne _08195376 -_0819538E: - adds r0, r2, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end TrainerIdToTournamentId - - thumb_func_start sub_81953A0 -sub_81953A0: @ 81953A0 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - ldr r1, =0x00000d24 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r3 - beq _081953D6 - adds r5, r4, 0 - adds r4, r1, 0 -_081953BE: - adds r2, 0x1 - cmp r2, 0xF - bgt _081953D6 - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r1 - adds r0, r4 - ldrh r0, [r0] - lsls r0, 22 - lsrs r0, 22 - cmp r0, r3 - bne _081953BE -_081953D6: - adds r0, r2, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81953A0 - - thumb_func_start sub_81953E8 -sub_81953E8: @ 81953E8 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_0860D1A0 - ldr r0, =gUnknown_0860D1C0 - adds r0, r4, r0 - ldrb r0, [r0] - lsrs r0, 1 - lsls r0, 2 - adds r1, r0 - adds r1, r2 - ldrb r0, [r1] - subs r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - bl sub_8192F08 - mov r0, sp - ldrb r0, [r0] - cmp r4, r0 - beq _0819542C - mov r0, sp - ldrb r0, [r0] - b _08195430 - .pool -_0819542C: - mov r0, sp - ldrb r0, [r0, 0x1] -_08195430: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81953E8 - - thumb_func_start sub_8195438 -sub_8195438: @ 8195438 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x40 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0xC] - movs r1, 0 - str r1, [sp, 0x10] - movs r5, 0 - movs r1, 0x3 - ldr r0, [sp] - ands r0, r1 - lsls r0, 3 - str r0, [sp, 0x14] -_0819545E: - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - lsls r4, r5, 2 - adds r1, r0, r4 - ldr r3, =0x00000d25 - adds r0, r1, r3 - ldrb r0, [r0] - lsls r0, 29 - adds r2, r5, 0x1 - str r2, [sp, 0x24] - cmp r0, 0 - bge _08195478 - b _08195876 -_08195478: - subs r3, 0x1 - adds r0, r1, r3 - ldrh r0, [r0] - lsls r1, r0, 22 - ldr r0, =0xffc00000 - cmp r1, r0 - bne _08195488 - b _08195876 -_08195488: - str r5, [sp, 0x4] - lsrs r1, 22 - ldr r0, [sp] - bl TournamentIdOfOpponent - str r0, [sp, 0x8] - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - adds r0, r3, r4 - ldr r1, =0x00000d24 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 22 - ldr r1, =0xff800000 - cmp r0, r1 - bne _08195504 - ldr r2, [sp, 0x8] - cmp r2, 0xFF - beq _08195504 - lsls r2, 2 - adds r1, r3, r2 - ldr r3, =0x00000d25 - adds r1, r3 - ldrb r0, [r1] - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r1, r2 - ldr r2, =0x00000d25 - adds r1, r2 - ldrb r0, [r1] - subs r3, 0x1D - ands r0, r3 - ldr r2, [sp, 0x14] - orrs r0, r2 - strb r0, [r1] - adds r0, r5, 0 - ldr r1, [sp, 0x8] - ldr r2, [sp] - bl GetWinningMove - ldr r3, =gSaveBlock2Ptr - ldr r1, [r3] - ldr r5, [sp, 0x8] - lsls r2, r5, 1 - movs r3, 0xEC - lsls r3, 4 - adds r1, r3 - adds r1, r2 - b _08195874 - .pool -_08195504: - ldr r4, =gSaveBlock2Ptr - ldr r3, [r4] - ldr r0, [sp, 0x8] - lsls r2, r0, 2 - adds r0, r3, r2 - ldr r1, =0x00000d24 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 22 - ldr r1, =0xff800000 - str r2, [sp, 0x30] - cmp r0, r1 - bne _0819557C - ldr r2, [sp, 0x4] - cmp r2, 0xFF - beq _0819557C - lsls r2, 2 - adds r1, r3, r2 - ldr r3, =0x00000d25 - adds r1, r3 - ldrb r0, [r1] - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1] - ldr r1, [r4] - adds r1, r2 - ldr r0, =0x00000d25 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x19 - negs r2, r2 - ands r0, r2 - ldr r3, [sp, 0x14] - orrs r0, r3 - strb r0, [r1] - ldr r0, [sp, 0x8] - ldr r1, [sp, 0x4] - ldr r2, [sp] - bl GetWinningMove - ldr r1, [r4] - ldr r3, [sp, 0x4] - lsls r2, r3, 1 - movs r3, 0xEC - lsls r3, 4 - adds r1, r3 - adds r1, r2 - strh r0, [r1] - adds r5, 0x1 - str r5, [sp, 0x24] - b _08195876 - .pool -_0819557C: - adds r5, 0x1 - str r5, [sp, 0x24] - ldr r5, [sp, 0x8] - cmp r5, 0xFF - bne _08195588 - b _08195876 -_08195588: - movs r0, 0 - mov r10, r0 - lsls r1, r5, 1 - str r1, [sp, 0x2C] - ldr r2, [sp, 0x4] - lsls r2, 1 - str r2, [sp, 0x28] - ldr r3, [sp, 0x4] - adds r0, r2, r3 - lsls r0, 1 - mov r9, r0 - adds r0, r1, r5 - lsls r0, 1 - str r0, [sp, 0x18] -_081955A4: - movs r5, 0 - mov r0, r9 - str r0, [sp, 0x38] -_081955AA: - movs r6, 0 - lsls r7, r5, 1 - ldr r4, [sp, 0x18] -_081955B0: - ldr r2, =gSaveBlock2Ptr - ldr r1, [r2] - ldr r3, =0x00000d64 - adds r1, r3 - ldr r2, [sp, 0x38] - adds r0, r1, r2 - ldrh r0, [r0] - ldr r3, =gFacilityTrainerMons - mov r8, r3 - ldr r2, [r3] - lsls r0, 4 - adds r0, r2 - adds r0, 0x2 - adds r0, r7 - ldrh r0, [r0] - adds r1, r4 - ldrh r1, [r1] - lsls r1, 4 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - bl sub_818FFC0 - ldr r1, [sp, 0xC] - adds r1, r0 - str r1, [sp, 0xC] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x2 - ble _081955B0 - adds r5, 0x1 - cmp r5, 0x3 - ble _081955AA - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - ldr r3, =0x00000d64 - adds r0, r3 - add r0, r9 - ldrh r0, [r0] - mov r5, r8 - ldr r1, [r5] - lsls r0, 4 - adds r0, r1 - ldrh r2, [r0] - ldr r0, =gBaseStats - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1] - ldrb r2, [r1, 0x1] - adds r0, r2 - ldrb r2, [r1, 0x2] - adds r0, r2 - ldrb r2, [r1, 0x3] - adds r0, r2 - ldrb r3, [r1, 0x4] - adds r0, r3 - ldrb r1, [r1, 0x5] - adds r0, r1 - movs r1, 0xA - bl __divsi3 - ldr r5, [sp, 0xC] - adds r5, r0 - str r5, [sp, 0xC] - movs r0, 0x2 - add r9, r0 - movs r1, 0x1 - add r10, r1 - mov r2, r10 - cmp r2, 0x2 - ble _081955A4 - bl Random - movs r1, 0x1F - ands r1, r0 - adds r5, r1 - ldr r3, [sp, 0x4] - adds r5, r3 - str r5, [sp, 0xC] - movs r5, 0 - mov r10, r5 - ldr r1, [sp, 0x2C] - ldr r2, [sp, 0x8] - adds r0, r1, r2 - lsls r0, 1 - str r0, [sp, 0x1C] - ldr r5, [sp, 0x28] - adds r0, r5, r3 - lsls r0, 1 - str r0, [sp, 0x20] -_08195668: - movs r5, 0 - mov r0, r10 - lsls r3, r0, 1 - movs r1, 0x1 - add r10, r1 - ldr r2, [sp, 0x1C] - adds r2, r3 - mov r8, r2 -_08195678: - movs r6, 0 - lsls r7, r5, 1 - adds r5, 0x1 - str r5, [sp, 0x3C] - ldr r4, [sp, 0x20] -_08195682: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - ldr r0, =0x00000d64 - adds r1, r0 - mov r2, r8 - adds r0, r1, r2 - ldrh r0, [r0] - ldr r5, =gFacilityTrainerMons - mov r9, r5 - ldr r2, [r5] - lsls r0, 4 - adds r0, r2 - adds r0, 0x2 - adds r0, r7 - ldrh r0, [r0] - adds r1, r4 - ldrh r1, [r1] - lsls r1, 4 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - str r3, [sp, 0x34] - bl sub_818FFC0 - ldr r1, [sp, 0x10] - adds r1, r0 - str r1, [sp, 0x10] - adds r4, 0x2 - adds r6, 0x1 - ldr r3, [sp, 0x34] - cmp r6, 0x2 - ble _08195682 - ldr r5, [sp, 0x3C] - cmp r5, 0x3 - ble _08195678 - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - ldr r5, [sp, 0x1C] - adds r1, r3, r5 - ldr r2, =0x00000d64 - adds r0, r2 - adds r0, r1 - ldrh r0, [r0] - mov r3, r9 - ldr r1, [r3] - lsls r0, 4 - adds r0, r1 - ldrh r2, [r0] - ldr r0, =gBaseStats - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1] - ldrb r2, [r1, 0x1] - adds r0, r2 - ldrb r5, [r1, 0x2] - adds r0, r5 - ldrb r2, [r1, 0x3] - adds r0, r2 - ldrb r2, [r1, 0x4] - adds r0, r2 - ldrb r1, [r1, 0x5] - adds r0, r1 - movs r1, 0xA - bl __divsi3 - ldr r3, [sp, 0x10] - adds r3, r0 - str r3, [sp, 0x10] - mov r5, r10 - cmp r5, 0x2 - ble _08195668 - bl Random - movs r1, 0x1F - ands r1, r0 - ldr r0, [sp, 0x10] - adds r0, r1 - ldr r1, [sp, 0x8] - adds r0, r1 - str r0, [sp, 0x10] - ldr r2, [sp, 0xC] - cmp r2, r0 - ble _08195784 - ldr r3, =gSaveBlock2Ptr - ldr r1, [r3] - ldr r5, [sp, 0x30] - adds r1, r5 - ldr r0, =0x00000d25 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r1, [r3] - adds r1, r5 - ldr r3, =0x00000d25 - adds r1, r3 - ldrb r0, [r1] - movs r5, 0x19 - negs r5, r5 - ands r0, r5 - ldr r2, [sp, 0x14] - orrs r0, r2 - strb r0, [r1] - ldr r0, [sp, 0x4] - ldr r1, [sp, 0x8] - ldr r2, [sp] - bl GetWinningMove - ldr r3, =gSaveBlock2Ptr - ldr r1, [r3] - movs r5, 0xEC - lsls r5, 4 - adds r1, r5 - ldr r2, [sp, 0x2C] - adds r1, r2 - b _08195874 - .pool -_08195784: - ldr r3, [sp, 0xC] - ldr r5, [sp, 0x10] - cmp r3, r5 - bge _081957DC - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r3, [sp, 0x4] - lsls r2, r3, 2 - adds r1, r2 - ldr r5, =0x00000d25 - adds r1, r5 - ldrb r0, [r1] - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1] - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - adds r1, r2 - ldr r0, =0x00000d25 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x19 - negs r2, r2 - ands r0, r2 - ldr r3, [sp, 0x14] - orrs r0, r3 - strb r0, [r1] - ldr r0, [sp, 0x8] - ldr r1, [sp, 0x4] - ldr r2, [sp] - bl GetWinningMove - ldr r1, [r5] - movs r5, 0xEC - lsls r5, 4 - adds r1, r5 - ldr r2, [sp, 0x28] - adds r1, r2 - b _08195874 - .pool -_081957DC: - ldr r3, [sp, 0x4] - ldr r5, [sp, 0x8] - cmp r3, r5 - ble _08195830 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r2, [sp, 0x30] - adds r1, r2 - ldr r3, =0x00000d25 - adds r1, r3 - ldrb r0, [r1] - movs r5, 0x4 - orrs r0, r5 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r1, r2 - adds r1, r3 - ldrb r0, [r1] - movs r2, 0x19 - negs r2, r2 - ands r0, r2 - ldr r3, [sp, 0x14] - orrs r0, r3 - strb r0, [r1] - ldr r0, [sp, 0x4] - ldr r1, [sp, 0x8] - ldr r2, [sp] - bl GetWinningMove - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r2, 0xEC - lsls r2, 4 - adds r1, r2 - ldr r3, [sp, 0x2C] - b _08195872 - .pool -_08195830: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - ldr r0, [sp, 0x4] - lsls r2, r0, 2 - adds r1, r2 - ldr r3, =0x00000d25 - adds r1, r3 - ldrb r0, [r1] - movs r5, 0x4 - orrs r0, r5 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r1, r2 - adds r1, r3 - ldrb r0, [r1] - movs r2, 0x19 - negs r2, r2 - ands r0, r2 - ldr r3, [sp, 0x14] - orrs r0, r3 - strb r0, [r1] - ldr r0, [sp, 0x8] - ldr r1, [sp, 0x4] - ldr r2, [sp] - bl GetWinningMove - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r2, 0xEC - lsls r2, 4 - adds r1, r2 - ldr r3, [sp, 0x28] -_08195872: - adds r1, r3 -_08195874: - strh r0, [r1] -_08195876: - ldr r5, [sp, 0x24] - cmp r5, 0xF - bgt _0819587E - b _0819545E -_0819587E: - add sp, 0x40 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8195438 - - thumb_func_start CopyDomeTrainerName -CopyDomeTrainerName: @ 8195898 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - movs r4, 0 - bl GetFrontierEnemyMonLevel - ldr r0, =0x000003fe - cmp r5, r0 - bne _081958B8 - adds r0, r6, 0 - bl CopyDomeBrainTrainerName - b _08195902 - .pool -_081958B8: - ldr r0, =0x000003ff - cmp r5, r0 - bne _081958DC - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] -_081958C2: - adds r0, r6, r4 - adds r1, r2, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x6 - ble _081958C2 - b _081958FC - .pool -_081958DC: - ldr r0, =0x0000012b - cmp r5, r0 - bhi _081958FC - ldr r0, =gUnknown_0203BC88 - ldr r1, [r0] - movs r0, 0x34 - muls r0, r5 - adds r0, r1 - adds r2, r0, 0x4 -_081958EE: - adds r0, r6, r4 - adds r1, r2, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x6 - ble _081958EE -_081958FC: - adds r1, r6, r4 - movs r0, 0xFF - strb r0, [r1] -_08195902: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CopyDomeTrainerName - - thumb_func_start GetDomeBrainTrainerPicId -GetDomeBrainTrainerPicId: @ 8195910 - ldr r0, =gTrainers - ldr r1, =0x00007df3 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetDomeBrainTrainerPicId - - thumb_func_start GetDomeBrainTrainerClass -GetDomeBrainTrainerClass: @ 8195924 - ldr r0, =gTrainers - ldr r1, =0x00007df1 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetDomeBrainTrainerClass - - thumb_func_start CopyDomeBrainTrainerName -CopyDomeBrainTrainerName: @ 8195938 - push {r4,lr} - adds r3, r0, 0 - movs r2, 0 - ldr r4, =(gTrainers + 806 * 0x28 + 0x4) @ TRAINER_TUCKER name -_08195940: - adds r0, r3, r2 - adds r1, r2, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x6 - ble _08195940 - adds r1, r3, r2 - movs r0, 0xFF - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end CopyDomeBrainTrainerName thumb_func_start sub_8195960 sub_8195960: @ 8195960 @@ -2004,7 +345,7 @@ sub_8195C50: @ 8195C50 ldr r0, =0x0000012b cmp r1, r0 bhi _08195C6C - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 muls r1, r0 ldr r0, [r2] diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 7d17f5c6c..97279d8fa 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -14195,7 +14195,7 @@ sub_81A1B1C: @ 81A1B1C thumb_func_start sub_81A1B28 sub_81A1B28: @ 81A1B28 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] bx lr @@ -17391,7 +17391,7 @@ _081A370C: ldr r0, =0x0000012b cmp r3, r0 bhi _081A3738 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 adds r1, r3, 0 muls r1, r0 @@ -17443,7 +17443,7 @@ _081A3794: ldr r0, =0x0000012b cmp r3, r0 bhi _081A37B8 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 adds r1, r3, 0 muls r1, r0 @@ -17511,7 +17511,7 @@ _081A3844: ldr r0, =0x0000012b cmp r3, r0 bhi _081A3868 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 adds r1, r3, 0 muls r1, r0 @@ -20046,7 +20046,7 @@ sub_81A4E04: @ 81A4E04 cmp r0, 0x1 bne _081A4E44 ldr r0, =0x000003fe - bl sub_81953A0 + bl TrainerIdToDomeTournamentId lsls r0, 16 lsrs r0, 16 bl GetTrainerMonCountInBits @@ -22329,7 +22329,7 @@ sub_81A61B0: @ 81A61B0 ldrh r0, [r1] movs r1, 0x7 bl __udivsi3 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers ldr r1, =gBattleFrontierTrainers str r1, [r2] ldr r5, =0x00000cb2 @@ -23050,7 +23050,7 @@ sub_81A67EC: @ 81A67EC mov r5, r8 push {r5-r7} sub sp, 0x4C - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] mov r0, sp @@ -26455,7 +26455,7 @@ _081A831A: bne _081A82D2 ldr r5, =gTrainerBattleOpponent_A strh r4, [r5] - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] ldrh r0, [r5] @@ -26500,7 +26500,7 @@ sub_81A8374: @ 81A8374 bl __udivsi3 lsls r0, 16 lsrs r5, r0, 16 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] lsls r7, r5, 24 @@ -26667,7 +26667,7 @@ sub_81A84EC: @ 81A84EC ldr r0, =0x0000012b cmp r1, r0 bhi _081A8542 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 muls r1, r0 ldr r0, [r2] @@ -26684,7 +26684,7 @@ _081A8524: ldr r0, =0x0000012b cmp r1, r0 bhi _081A8542 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 muls r1, r0 ldr r0, [r2] @@ -28498,7 +28498,7 @@ _081A940A: thumb_func_start sub_81A9414 sub_81A9414: @ 81A9414 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] bx lr @@ -28534,7 +28534,7 @@ sub_81A9424: @ 81A9424 lsrs r5, r0, 16 movs r6, 0 ldr r2, =gUnknown_08613C1C - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r5 @@ -28554,7 +28554,7 @@ _081A9488: ldr r4, =gUnknown_08613C1C lsls r3, r6, 1 adds r2, r3, r4 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r5 @@ -29795,7 +29795,7 @@ sub_81A9EDC: @ 81A9EDC push {lr} lsls r0, 16 lsrs r0, 16 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r1, 0x34 muls r1, r0 ldr r0, [r2] @@ -29812,7 +29812,7 @@ sub_81A9EFC: @ 81A9EFC push {lr} lsls r0, 16 lsrs r0, 16 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r1, 0x34 muls r1, r0 ldr r0, [r2] @@ -29829,7 +29829,7 @@ sub_81A9F1C: @ 81A9F1C push {lr} lsls r0, 16 lsrs r0, 16 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r1, 0x34 muls r1, r0 ldr r0, [r2] @@ -29848,7 +29848,7 @@ GetTrainerEncounterMusicIdInBattlePyramind: @ 81A9F3C lsrs r0, 16 movs r4, 0 ldr r3, =gFacilityClassToTrainerClass - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r2, [r1] movs r1, 0x34 muls r0, r1 diff --git a/asm/battle_tent.s b/asm/battle_tent.s index d64345730..ba4a31530 100644 --- a/asm/battle_tent.s +++ b/asm/battle_tent.s @@ -14,7 +14,7 @@ sub_81B9EC0: @ 81B9EC0 mov r5, r8 push {r5-r7} sub sp, 0x3C - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gSlateportBattleTentTrainers str r0, [r1] add r0, sp, 0xC @@ -205,7 +205,7 @@ sub_81BA040: @ 81BA040 sub sp, 0x10 movs r0, 0 mov r10, r0 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gSlateportBattleTentTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -261,7 +261,7 @@ _081BA0AA: ldr r2, =gTrainerBattleOpponent_A strh r3, [r2] ldrh r3, [r2] - ldr r4, =gUnknown_0203BC88 + ldr r4, =gFacilityTrainers ldr r1, [r4] movs r0, 0x34 muls r0, r3 diff --git a/asm/battle_tower.s b/asm/battle_tower.s index e90534266..1ece38af9 100644 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -806,7 +806,7 @@ _08162650: ldr r0, =0x0000012b cmp r4, r0 bhi _0816266C - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -977,7 +977,7 @@ _081627CC: ldr r0, =0x0000012b cmp r4, r0 bhi _081627E8 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -1363,7 +1363,7 @@ _08162AE4: cmp r4, r0 bhi _08162B08 ldr r2, =gFacilityClassToPicIndex - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -1500,7 +1500,7 @@ _08162C38: cmp r4, r0 bhi _08162C60 ldr r2, =gFacilityClassToTrainerClass - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -1617,7 +1617,7 @@ _08162D5C: ldr r0, =0x0000012b cmp r4, r0 bhi _08162D78 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -1751,7 +1751,7 @@ _08162E88: ldr r0, =0x0000012b cmp r5, r0 bhi _08162EB4 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r5 @@ -1878,7 +1878,7 @@ _08162FA4: ldr r0, =0x0000012b cmp r4, r0 bhi _08162FC0 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -2039,7 +2039,7 @@ sub_81630C4: @ 81630C4 str r0, [sp, 0x24] ldr r0, =gTrainerBattleOpponent_A ldrh r2, [r0] - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r2 @@ -2554,7 +2554,7 @@ RandomizeFacilityTrainerMonId: @ 8163524 bl GetFrontierEnemyMonLevel lsls r0, 24 lsrs r6, r0, 24 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r4 @@ -3054,7 +3054,7 @@ _08163950: ldr r0, =0x0000012b cmp r3, r0 bhi _08163974 - ldr r2, =gUnknown_0203BC88 + ldr r2, =gFacilityTrainers movs r0, 0x34 adds r1, r3, 0 muls r1, r0 @@ -4116,7 +4116,7 @@ _0816431A: ldrh r0, [r1] cmp r0, r8 beq _08164368 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r2, [r0] movs r4, 0x34 mov r0, r8 @@ -6354,7 +6354,7 @@ _08165634: movs r0, 0 str r0, [sp, 0x44] movs r2, 0 - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r7 @@ -7095,7 +7095,7 @@ GetFrontierEnemyMonLevel: @ 8165C40 ands r0, r1 cmp r0, 0x2 beq _08165C84 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -7255,7 +7255,7 @@ sub_8165D78: @ 8165D78 lsrs r0, 16 cmp r0, 0x4 bne _08165DA8 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gSlateportBattleTentTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -7265,7 +7265,7 @@ sub_8165D78: @ 8165D78 _08165DA8: cmp r0, 0x2 bne _08165DC8 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gVerdanturfBattleTentTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -7275,7 +7275,7 @@ _08165DA8: _08165DC8: cmp r0, 0x3 bne _08165DE8 - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gFallarborBattleTentTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -7283,7 +7283,7 @@ _08165DC8: b _08165DF2 .pool _08165DE8: - ldr r1, =gUnknown_0203BC88 + ldr r1, =gFacilityTrainers ldr r0, =gBattleFrontierTrainers str r0, [r1] ldr r1, =gFacilityTrainerMons @@ -7390,7 +7390,7 @@ sub_8165EA4: @ 8165EA4 str r0, [sp, 0x20] ldr r0, =gTrainerBattleOpponent_A ldrh r2, [r0] - ldr r0, =gUnknown_0203BC88 + ldr r0, =gFacilityTrainers ldr r1, [r0] movs r0, 0x34 muls r0, r2 diff --git a/include/battle_tower.h b/include/battle_tower.h index e1655f2c6..87581074e 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -24,7 +24,7 @@ union BattleTowerRecord struct BattleFrontierTrainer { - u32 trainerClass; + u32 facilityClass; u8 trainerName[8]; u16 speechBefore[6]; u16 speechWin[6]; @@ -32,7 +32,7 @@ struct BattleFrontierTrainer u16 *btMonPool; }; -extern struct BattleFrontierTrainer *gUnknown_0203BC88; +extern const struct BattleFrontierTrainer *gFacilityTrainers; u16 sub_8164FCC(u8, u8); void sub_81659DC(struct RSBattleTowerRecord *a0, struct RSBattleTowerRecord *a1); @@ -40,7 +40,7 @@ bool32 sub_816587C(union BattleTowerRecord *, union BattleTowerRecord *); void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *); void sub_81628A0(union BattleTowerRecord *); void sub_8162614(u16 trainerId, u8); -void ConvertBattleFrontierTrainerSpeechToString(u16 *words); +void ConvertBattleFrontierTrainerSpeechToString(const u16 *words); void GetFrontierTrainerName(u8 *dest, u16 trainerIdx); void GetEreaderTrainerName(u8 *dest); diff --git a/include/global.h b/include/global.h index a4db847a4..d3abb8269 100644 --- a/include/global.h +++ b/include/global.h @@ -340,8 +340,8 @@ struct FrontierMonData struct BattleDomeTrainer { u16 trainerId:10; - u16 unk1:1; - u16 unk2:2; + u16 isEliminated:1; + u16 eliminatedAt:2; u16 unk3:3; }; diff --git a/src/battle_frontier_1.c b/src/battle_frontier_1.c index 332446d75..1ac84962f 100644 --- a/src/battle_frontier_1.c +++ b/src/battle_frontier_1.c @@ -2,6 +2,7 @@ #include "battle.h" #include "battle_setup.h" #include "battle_frontier_1.h" +#include "battle_tower.h" #include "battle_message.h" #include "event_data.h" #include "overworld.h" @@ -37,7 +38,7 @@ #define DOME_FINAL 3 #define DOME_ROUNDS_COUNT 4 -struct Unknown_0203BC8C_Struct +struct FacilityMon { u16 species; u16 moves[4]; @@ -68,6 +69,7 @@ extern bool8 sub_81A3610(void); extern u16 sub_81A4FF0(u8); extern u8 GetFrontierTrainerFrontSpriteId(u16); extern u8 GetFrontierOpponentClass(u16); +extern void sub_80F94E8(void); extern u8 gUnknown_0203CEF8[]; extern u32 gUnknown_0203CD70; @@ -80,7 +82,7 @@ extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern u16 gBattle_BG3_X; extern u16 gBattle_BG3_Y; -extern struct Unknown_0203BC8C_Struct *gFacilityTrainerMons; +extern const struct FacilityMon *gFacilityTrainerMons; extern struct Unknown_0203CD78_Struct *gUnknown_0203CD78; extern u8 *gUnknown_0203CD7C; @@ -97,7 +99,7 @@ extern const struct SpriteTemplate gUnknown_0860D068; extern const struct SpriteTemplate gUnknown_0860D050; extern const u8 gUnknown_0860D080[]; extern const u8 gUnknown_0860D15C[]; -extern const u8 gUnknown_0860D1A0[]; +extern const u8 gUnknown_0860D1A0[][4]; extern const u8 gUnknown_0860D19C[]; extern const u8 gUnknown_0860D349[]; extern const u8 gUnknown_0860D1C0[]; @@ -120,6 +122,8 @@ extern const u8 *const gBattleDomeOpponentStylePointers[]; extern const u8 *const gBattleDomeOpponentStatsPointers[]; extern const u8 *const gBattleDomeWinStringsPointers[]; extern const u8 *const gBattleDomeMatchNumberPointers[]; +extern const struct FacilityMon gBattleFrontierMons[]; +extern const struct BattleFrontierTrainer gBattleFrontierTrainers[]; // gfx extern const u8 gUnknown_08D83D50[]; @@ -142,7 +146,7 @@ u8 GetDomeTrainerMonIvs(u16 trainerId); void SwapDomeTrainers(s32 id1, s32 id2, u16 *statsArray); void CalcDomeMonStats(u16 species, s32 level, s32 ivs, u8 evBits, u8 nature, s32 *stats); void CreateDomeTrainerMons(u16 tournamentTrainerId); -s32 TrainerIdToTournamentId(u16 trainerId); +static s32 TrainerIdToTournamentId(u16 trainerId); s32 GetTrainerMonCountInBits(u16 tournamentTrainerId); s32 sub_818FCBC(u16 tournamentTrainerId, bool8 arg1); s32 sub_818FDB8(u16 tournamentTrainerId, bool8 arg1); @@ -154,7 +158,7 @@ void sub_8190CD4(u8 taskId); void sub_8194220(u8 taskId); void sub_8194950(u8 taskId); static void CB2_BattleDome(void); -void sub_8194B70(void); +static void VblankCb0_BattleDome(void); static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo); static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId); u8 sub_819221C(u8 taskId); @@ -165,9 +169,9 @@ void CopyDomeBrainTrainerName(u8 *dst); void CopyDomeTrainerName(u8 *dst, u16 trainerId); void sub_8194D48(void); void sub_8194BEC(void); -void sub_8194CE4(void); +static void VblankCb1_BattleDome(void); u8 sub_8193BDC(u8 taskId); -void sub_8195438(u8 roundId); +void DecideRoundWinners(u8 roundId); u8 sub_81953E8(u8 tournamentId, u8); void sub_81948EC(u8, u8); @@ -709,8 +713,8 @@ void InitDomeTrainers(void) gSaveBlock2Ptr->frontier.field_D0A = gSaveBlock2Ptr->frontier.chosenLvl + 1; gSaveBlock2Ptr->frontier.field_D0B = VarGet(VAR_0x40CE) + 1; gSaveBlock2Ptr->frontier.domeTrainers[0].trainerId = TRAINER_PLAYER; - gSaveBlock2Ptr->frontier.domeTrainers[0].unk1 = 0; - gSaveBlock2Ptr->frontier.domeTrainers[0].unk2 = 0; + gSaveBlock2Ptr->frontier.domeTrainers[0].isEliminated = 0; + gSaveBlock2Ptr->frontier.domeTrainers[0].eliminatedAt = 0; gSaveBlock2Ptr->frontier.domeTrainers[0].unk3 = 0; for (i = 0; i < 3; i++) @@ -774,8 +778,8 @@ void InitDomeTrainers(void) species[j] = gFacilityTrainerMons[monTournamentId].species; } - gSaveBlock2Ptr->frontier.domeTrainers[i].unk1 = 0; - gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 = 0; + gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated = 0; + gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt = 0; gSaveBlock2Ptr->frontier.domeTrainers[i].unk3 = 0; } @@ -1575,7 +1579,7 @@ s32 TournamentIdOfOpponent(s32 roundId, s32 trainerId) for (j = gUnknown_0860D10C[i][roundId]; j < val; j++) { - if (gUnknown_0860D14C[j] != i && !gSaveBlock2Ptr->frontier.domeTrainers[gUnknown_0860D14C[j]].unk1) + if (gUnknown_0860D14C[j] != i && !gSaveBlock2Ptr->frontier.domeTrainers[gUnknown_0860D14C[j]].isEliminated) break; } @@ -1586,8 +1590,8 @@ s32 TournamentIdOfOpponent(s32 roundId, s32 trainerId) } else { - if (!gSaveBlock2Ptr->frontier.domeTrainers[gUnknown_0860D10C[i][0]].unk1) - return gUnknown_0860D10C[i][0]; + if (!gSaveBlock2Ptr->frontier.domeTrainers[gUnknown_0860D10C[i][roundId]].isEliminated) + return gUnknown_0860D10C[i][roundId]; else return 0xFF; } @@ -1707,7 +1711,7 @@ void sub_8190400(u8 taskId) gTasks[taskId].data[0]++; break; case 3: - SetVBlankCallback(sub_8194B70); + SetVBlankCallback(VblankCb0_BattleDome); gUnknown_0203CD78 = AllocZeroed(sizeof(*gUnknown_0203CD78)); for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) gUnknown_0203CD78->arr[i] |= 0xFF; @@ -1945,12 +1949,12 @@ void sub_8190B40(struct Sprite *sprite) { if (sprite->data[1]) { - if ((gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].unk1 - && gUnknown_0203CD78->unk_10 - 1 < gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].unk2)) + if ((gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].isEliminated + && gUnknown_0203CD78->unk_10 - 1 < gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].eliminatedAt)) { sprite->invisible = 0; } - else if (!gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].unk1 + else if (!gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].isEliminated && gUnknown_0203CD78->unk_10 - 1 < r12) { sprite->invisible = 0; @@ -2788,12 +2792,12 @@ u8 sub_819221C(u8 taskId) } else if (gMain.newKeys & DPAD_RIGHT) { - if (gSaveBlock2Ptr->frontier.domeTrainers[r10].unk1 && gUnknown_0203CD78->unk_10 - 1 < gSaveBlock2Ptr->frontier.domeTrainers[r10].unk2) + if (gSaveBlock2Ptr->frontier.domeTrainers[r10].isEliminated && gUnknown_0203CD78->unk_10 - 1 < gSaveBlock2Ptr->frontier.domeTrainers[r10].eliminatedAt) { gUnknown_0203CD78->unk_10++; retVal = 4; } - if (!gSaveBlock2Ptr->frontier.domeTrainers[r10].unk1 && gUnknown_0203CD78->unk_10 - 1 < roundId) + if (!gSaveBlock2Ptr->frontier.domeTrainers[r10].isEliminated && gUnknown_0203CD78->unk_10 - 1 < roundId) { gUnknown_0203CD78->unk_10++; retVal = 4; @@ -2803,7 +2807,7 @@ u8 sub_819221C(u8 taskId) if (retVal == 9) { if (gUnknown_0203CD78->unk_10 != 0) - gTasks[taskId2].data[1] = gUnknown_0860D1A0[(r5 / 2) * 4 + (gUnknown_0203CD78->unk_10 - 1)]; + gTasks[taskId2].data[1] = gUnknown_0860D1A0[r5 / 2][gUnknown_0203CD78->unk_10 - 1]; else gTasks[taskId2].data[1] = r5; } @@ -3230,7 +3234,7 @@ s32 sub_8192F08(u8 arg0, u8 *arg1) for (i = gUnknown_0860D3C4[arg0][0]; i < gUnknown_0860D3C4[arg0][0] + gUnknown_0860D3C4[arg0][1]; i++) { tournamentId = gUnknown_0860D3B4[i]; - if (!gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].unk1) + if (!gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].isEliminated) { arg1[count] = tournamentId; if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].trainerId == TRAINER_PLAYER) @@ -3249,12 +3253,12 @@ s32 sub_8192F08(u8 arg0, u8 *arg1) for (i = gUnknown_0860D3C4[arg0][0]; i < gUnknown_0860D3C4[arg0][0] + gUnknown_0860D3C4[arg0][1]; i++) { tournamentId = gUnknown_0860D3B4[i]; - if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].unk1 - && gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].unk2 >= gUnknown_0860D3C4[arg0][2]) + if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].isEliminated + && gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].eliminatedAt >= gUnknown_0860D3C4[arg0][2]) { arg1[count] = tournamentId; count++; - if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].unk2 == gUnknown_0860D3C4[arg0][2]) + if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].eliminatedAt == gUnknown_0860D3C4[arg0][2]) { StringCopy(gStringVar2, gMoveNames[gSaveBlock2Ptr->frontier.field_EC0[tournamentId]]); retVal = gSaveBlock2Ptr->frontier.domeTrainers[tournamentId].unk3 * 2; @@ -3312,8 +3316,8 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) { tournamentIds[i] = gUnknown_0203CD78->unk_11[i]; trainerIds[i] = gSaveBlock2Ptr->frontier.domeTrainers[tournamentIds[i]].trainerId; - if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentIds[i]].unk2 <= gUnknown_0860D3C4[matchNo][2] - && gSaveBlock2Ptr->frontier.domeTrainers[tournamentIds[i]].unk1) + if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentIds[i]].eliminatedAt <= gUnknown_0860D3C4[matchNo][2] + && gSaveBlock2Ptr->frontier.domeTrainers[tournamentIds[i]].isEliminated) lost[i] = TRUE; else lost[i] = FALSE; @@ -3669,21 +3673,21 @@ void sub_8193D7C(void) if (gSpecialVar_0x8005 == 1) { - gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].unk1 = 1; - gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].unk2 = gSaveBlock2Ptr->frontier.field_CB2; + gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].eliminatedAt = gSaveBlock2Ptr->frontier.field_CB2; gSaveBlock2Ptr->frontier.field_EC0[TrainerIdToTournamentId(gTrainerBattleOpponent_A)] = gBattleResults.lastUsedMovePlayer; if (gSaveBlock2Ptr->frontier.field_CB2 < DOME_FINAL) - sub_8195438(gSaveBlock2Ptr->frontier.field_CB2); + DecideRoundWinners(gSaveBlock2Ptr->frontier.field_CB2); } else { - gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].unk1 = 1; - gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].unk2 = gSaveBlock2Ptr->frontier.field_CB2; + gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].eliminatedAt = gSaveBlock2Ptr->frontier.field_CB2; gSaveBlock2Ptr->frontier.field_EC0[TrainerIdToTournamentId(TRAINER_PLAYER)] = gBattleResults.lastUsedMoveOpponent; if (gBattleOutcome == B_OUTCOME_FORFEITED || gSpecialVar_0x8005 == 9) gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].unk3 = 1; for (i = gSaveBlock2Ptr->frontier.field_CB2; i < DOME_ROUNDS_COUNT; i++) - sub_8195438(i); + DecideRoundWinners(i); } } @@ -3908,11 +3912,11 @@ void sub_8194220(u8 taskId) CopyDomeTrainerName(gDisplayedStringBattle, gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId); if (r10 == 1) { - if (gSaveBlock2Ptr->frontier.domeTrainers[i].unk1) + if (gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) { - if (gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 != 0) + if (gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt != 0) { - var2 = gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 - 1; + var2 = gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt - 1; sub_81948EC(i, var2); } } @@ -3923,11 +3927,11 @@ void sub_8194220(u8 taskId) } else if (r10 == 0) { - if (gSaveBlock2Ptr->frontier.domeTrainers[i].unk1) + if (gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) { - if (gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 != 0) + if (gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt != 0) { - var2 = gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 - 1; + var2 = gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt - 1; sub_81948EC(i, var2); } } @@ -3946,9 +3950,9 @@ void sub_8194220(u8 taskId) else var = gSaveBlock2Ptr->frontier.field_CB2 - 1; - if ( ((r10 == 1 && gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 < gSaveBlock2Ptr->frontier.field_CB2 - 1) - || (r10 == 0 && gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 <= var)) - && gSaveBlock2Ptr->frontier.domeTrainers[i].unk1) + if ( ((r10 == 1 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt < gSaveBlock2Ptr->frontier.field_CB2 - 1) + || (r10 == 0 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt <= var)) + && gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) { if (gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId == TRAINER_PLAYER) { @@ -3994,7 +3998,7 @@ void sub_8194220(u8 taskId) CopyWindowToVram(1, 3); CopyWindowToVram(2, 3); SetHBlankCallback(sub_8194BEC); - SetVBlankCallback(sub_8194CE4); + SetVBlankCallback(VblankCb1_BattleDome); if (r4 == 2) { if (r10 == 0) @@ -4082,8 +4086,8 @@ void sub_8194950(u8 taskId) for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) { CopyDomeTrainerName(gDisplayedStringBattle, gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId); - if (gSaveBlock2Ptr->frontier.domeTrainers[i].unk2 == gSaveBlock2Ptr->frontier.field_CB2 - 1 - && gSaveBlock2Ptr->frontier.domeTrainers[i].unk1) + if (gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt == gSaveBlock2Ptr->frontier.field_CB2 - 1 + && gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) { if (gUnknown_0860D3F1[i][0] == 0) textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing); @@ -4095,7 +4099,7 @@ void sub_8194950(u8 taskId) textPrinter.currentY = gUnknown_0860D3F1[i][1]; AddTextPrinter(&textPrinter, 0, NULL); } - if (!gSaveBlock2Ptr->frontier.domeTrainers[i].unk1) + if (!gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) { s32 var = gSaveBlock2Ptr->frontier.field_CB2 - 1; sub_81948EC(i, var); @@ -4132,3 +4136,488 @@ static void CB2_BattleDome(void) UpdatePaletteFade(); RunTasks(); } + +static void VblankCb0_BattleDome(void) +{ + ChangeBgX(3, 0x80, 1); + ChangeBgY(3, 0x80, 2); + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +#define SET_WIN0H_WIN1H(win0H, win1H) \ +{ \ + *(vu32*)(REG_ADDR_WIN0H) = ((win0H << 16) | (win1H)); \ +} + +void sub_8194BEC(void) +{ + register u32 vCount asm("r0") = REG_VCOUNT; + register u32 vCount_ asm("r1") = vCount; + if (vCount > 41) + { + if (vCount < 50) + { + REG_WININ = 0x3B3B; + SET_WIN0H_WIN1H(0x989B, 0x5558); + return; + } + else if (vCount > 57) + { + if (vCount < 75) + { + REG_WININ = 0x3B3B; + SET_WIN0H_WIN1H(0x9098, 0x5860); + return; + } + else if (vCount < 82) + { + REG_WININ = 0x3B3B; + SET_WIN0H_WIN1H(0x989B, 0x5558); + return; + } + else if (vCount > 94) + { + if (vCount < 103) + { + REG_WININ = 0x3737; + SET_WIN0H_WIN1H(0x989B, 0x5558); + return; + } + else if (vCount < 119) + { + REG_WININ = 0x3737; + SET_WIN0H_WIN1H(0x9098, 0x5860); + return; + } + else if (vCount > 126) + { + if (vCount_ < 135) + { + REG_WININ = 0x3737; + SET_WIN0H_WIN1H(0x989B, 0x5558); + return; + } + } + } + } + } + + REG_WININ = 0x3F3F; + SET_WIN0H_WIN1H(0, 0); +} + +static void VblankCb1_BattleDome(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + ChangeBgY(2, 0x80, 2); + ChangeBgY(3, 0x80, 1); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + ScanlineEffect_InitHBlankDmaTransfer(); +} + +void sub_8194D48(void) +{ + gFacilityTrainerMons = gBattleFrontierMons; + gFacilityTrainers = gBattleFrontierTrainers; +} + +void sub_8194D68(void) +{ + s32 i, moveSlot; + + for (i = 0; i < 2; i++) + { + s32 playerMonId = gSaveBlock2Ptr->frontier.field_CAA[gUnknown_0203CEF8[i] - 1] - 1; + s32 count; + + for (moveSlot = 0; moveSlot < 4; moveSlot++) + { + count = 0; + while (count < 4) + { + if (GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_MOVE1 + count, NULL) == GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveSlot, NULL)) + break; + count++; + } + if (count == 4) + SetMonMoveSlot(&gPlayerParty[i], MOVE_SKETCH, moveSlot); + } + + gSaveBlock1Ptr->playerParty[playerMonId] = gPlayerParty[i]; + } +} + +void sub_8194E44(void) +{ + s32 i; + + for (i = 0; i < 2; i++) + { + s32 playerMonId = gSaveBlock2Ptr->frontier.field_CAA[gUnknown_0203CEF8[i] - 1] - 1; + u16 item = GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_HELD_ITEM, NULL); + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item); + } +} + +void sub_8194EB4(void) +{ + sub_80F94E8(); +} + +void sub_8194EC0(void) +{ + if (TrainerIdToTournamentId(gTrainerBattleOpponent_A) > TrainerIdToTournamentId(TRAINER_PLAYER)) + gSpecialVar_Result = 1; + else + gSpecialVar_Result = 2; +} + +void sub_8194EF8(void) +{ + s32 i; + + sub_8194D48(); + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + if (!gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated) + break; + } + CopyDomeTrainerName(gStringVar1, gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId); +} + +void sub_8194F58(void) +{ + s32 i, j, k; + s32 monLevel; + s32 species[3]; + s32 monTypesBits; + s32 trainerId; + s32 monTournamentId; + u8 lvlMode; + u16 *statSums; + s32 *statValues; + u8 ivs = 0; + + species[0] = 0; + species[1] = 0; + species[2] = 0; + if ((gSaveBlock2Ptr->frontier.field_D0A != -gSaveBlock2Ptr->frontier.field_D0B) && gSaveBlock2Ptr->frontier.field_CA8 != 1) + return; + + statSums = AllocZeroed(sizeof(u16) * DOME_TOURNAMENT_TRAINERS_COUNT); + statValues = AllocZeroed(sizeof(s32) * 6); + lvlMode = gSaveBlock2Ptr->frontier.chosenLvl; + gSaveBlock2Ptr->frontier.chosenLvl = 0; + // This one, I'd like to call a 'C fakematching'. + { + u8 one; + gSaveBlock2Ptr->frontier.field_D0A = (one = 1); + gSaveBlock2Ptr->frontier.field_D0B = one; + } + + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + do + { + if (i < 5) + trainerId = Random() % 10; + else if (i < 15) + trainerId = Random() % 20 + 10; + else + trainerId = Random() % 10 + 30; + + for (j = 0; j < i; j++) + { + if (gSaveBlock2Ptr->frontier.domeTrainers[j].trainerId == trainerId) + break; + } + } while (j != i); + + gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId = trainerId; + for (j = 0; j < 3; j++) + { + // Make sure the mon is valid. + do + { + monTournamentId = RandomizeFacilityTrainerMonId(trainerId); + for (k = 0; k < j; k++) + { + s32 checkingMonId = gSaveBlock2Ptr->frontier.domeMonId[i][k]; + if (checkingMonId == monTournamentId + || species[0] == gFacilityTrainerMons[monTournamentId].species + || species[1] == gFacilityTrainerMons[monTournamentId].species + || gFacilityTrainerMons[checkingMonId].itemTableId == gFacilityTrainerMons[monTournamentId].itemTableId) + break; + } + } while (k != j); + + gSaveBlock2Ptr->frontier.domeMonId[i][j] = monTournamentId; + species[j] = gFacilityTrainerMons[monTournamentId].species; + } + gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated = 0; + gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt = 0; + gSaveBlock2Ptr->frontier.domeTrainers[i].unk3 = 0; + } + + monLevel = 50; + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + monTypesBits = 0; + statSums[i] = 0; + ivs = GetDomeTrainerMonIvs(gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId); + for (j = 0; j < 3; j++) + { + CalcDomeMonStats(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species, + monLevel, ivs, + gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].evSpread, + gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].nature, + statValues); + + statSums[i] += statValues[STAT_ATK]; + statSums[i] += statValues[STAT_DEF]; + statSums[i] += statValues[STAT_SPATK]; + statSums[i] += statValues[STAT_SPDEF]; + statSums[i] += statValues[STAT_SPEED]; + statSums[i] += statValues[STAT_HP]; + monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type1]; + monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type2]; + } + + // Because GF hates temporary vars, trainerId acts like monTypesCount here. + for (trainerId = 0, j = 0; j < 32; j++) + { + if (monTypesBits & 1) + trainerId++; + monTypesBits >>= 1; + } + statSums[i] += (trainerId * monLevel) / 20; + } + + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT - 1; i++) + { + for (j = i + 1; j < DOME_TOURNAMENT_TRAINERS_COUNT; j++) + { + if (statSums[i] < statSums[j]) + { + SwapDomeTrainers(i, j, statSums); + } + else if (statSums[i] == statSums[j]) + { + if (gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId > gSaveBlock2Ptr->frontier.domeTrainers[j].trainerId) + SwapDomeTrainers(i, j, statSums); + } + } + } + + Free(statSums); + Free(statValues); + + for (i = 0; i < 4; i++) + DecideRoundWinners(i); + + gSaveBlock2Ptr->frontier.chosenLvl = lvlMode; +} + +static s32 TrainerIdToTournamentId(u16 trainerId) +{ + s32 i; + + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + if (gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId == trainerId) + break; + } + + return i; +} + +// The same as the above one, but has global scope. +s32 TrainerIdToDomeTournamentId(u16 trainerId) +{ + s32 i; + + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + if (gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId == trainerId) + break; + } + + return i; +} + +u8 sub_81953E8(u8 tournamentId, u8 arg1) +{ + u8 arr[2]; + sub_8192F08(gUnknown_0860D1A0[gUnknown_0860D1C0[tournamentId] / 2][arg1] - 16, arr); + if (tournamentId == arr[0]) + return arr[1]; + else + return arr[0]; +} + +void DecideRoundWinners(u8 roundId) +{ + s32 i; + s32 moveSlot, monId1, monId2; + s32 tournamentId1, tournamentId2; + s32 species; + s32 points1 = 0, points2 = 0; + + for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) + { + if (gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated || gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId == TRAINER_PLAYER) + continue; + + tournamentId1 = i; + tournamentId2 = TournamentIdOfOpponent(roundId, gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].trainerId); + // Frontier Brain always wins, check tournamentId1. + if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].trainerId == TRAINER_FRONTIER_BRAIN && tournamentId2 != 0xFF) + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId); + } + // Frontier Brain always wins, check tournamentId2. + else if (gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].trainerId == TRAINER_FRONTIER_BRAIN && tournamentId1 != 0xFF) + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId); + } + // Decide which one of two trainers wins! + else if (tournamentId2 != 0xFF) + { + // BUG: points1 and points2 are not cleared at the beginning of the loop resulting in not fair results. + + // Calculate points for both trainers. + for (monId1 = 0; monId1 < 3; monId1++) + { + for (moveSlot = 0; moveSlot < 4; moveSlot++) + { + for (monId2 = 0; monId2 < 3; monId2++) + { + points1 += sub_818FFC0(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId1]].moves[moveSlot], + gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId2]].species, 2); + } + } + species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId1]].species; + points1 += ( gBaseStats[species].baseHP + + gBaseStats[species].baseAttack + + gBaseStats[species].baseDefense + + gBaseStats[species].baseSpeed + + gBaseStats[species].baseSpAttack + + gBaseStats[species].baseSpDefense) / 10; + } + // Random part of the formula. + points1 += (Random() & 0x1F); + // Favor trainers with higher id; + points1 += tournamentId1; + + for (monId1 = 0; monId1 < 3; monId1++) + { + for (moveSlot = 0; moveSlot < 4; moveSlot++) + { + for (monId2 = 0; monId2 < 3; monId2++) + { + points2 += sub_818FFC0(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId1]].moves[moveSlot], + gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId2]].species, 2); + } + } + species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId1]].species; + points2 += ( gBaseStats[species].baseHP + + gBaseStats[species].baseAttack + + gBaseStats[species].baseDefense + + gBaseStats[species].baseSpeed + + gBaseStats[species].baseSpAttack + + gBaseStats[species].baseSpDefense) / 10; + } + // Random part of the formula. + points2 += (Random() & 0x1F); + // Favor trainers with higher id; + points2 += tournamentId2; + + if (points1 > points2) + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId); + } + else if (points1 < points2) + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId); + } + // Points are the same, so we favor the one with the higher id. + else if (tournamentId1 > tournamentId2) + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId2].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId); + } + else + { + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].isEliminated = 1; + gSaveBlock2Ptr->frontier.domeTrainers[tournamentId1].eliminatedAt = roundId; + gSaveBlock2Ptr->frontier.field_EC0[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId); + } + } + } +} + +void CopyDomeTrainerName(u8 *dst, u16 trainerId) +{ + s32 i = 0; + GetFrontierEnemyMonLevel(); // Unused return value. + + if (trainerId == TRAINER_FRONTIER_BRAIN) + { + CopyDomeBrainTrainerName(dst); + } + else + { + if (trainerId == TRAINER_PLAYER) + { + for (i = 0; i < OT_NAME_LENGTH; i++) + dst[i] = gSaveBlock2Ptr->playerName[i]; + } + else if (trainerId < 300) + { + for (i = 0; i < 7; i++) + dst[i] = gFacilityTrainers[trainerId].trainerName[i]; + } + dst[i] = EOS; + } +} + +u8 GetDomeBrainTrainerPicId(void) +{ + return gTrainers[TRAINER_TUCKER].trainerPic; +} + +u8 GetDomeBrainTrainerClass(void) +{ + return gTrainers[TRAINER_TUCKER].trainerClass; +} + +void CopyDomeBrainTrainerName(u8 *dst) +{ + s32 i; + + for (i = 0; i < 7; i++) + dst[i] = gTrainers[TRAINER_TUCKER].trainerName[i]; + dst[i] = EOS; +} diff --git a/src/battle_tent.c b/src/battle_tent.c index 68d7c5e83..dbea37fb7 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -11,7 +11,7 @@ #include "constants/items.h" #include "constants/region_map_sections.h" -// this file's functions +// This file's functions. void sub_81B99D4(void); void sub_81B9A28(void); void sub_81B9A44(void); @@ -115,7 +115,7 @@ void sub_81B9A60(void) void sub_81B9A90(void) { if (gTrainerBattleOpponent_A < 300) - ConvertBattleFrontierTrainerSpeechToString(gUnknown_0203BC88[gTrainerBattleOpponent_A].speechBefore); + ConvertBattleFrontierTrainerSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore); } void sub_81B9ABC(void) diff --git a/sym_ewram.txt b/sym_ewram.txt index 05c5a5950..c0c8e8a2f 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -607,12 +607,11 @@ gUnknown_0203ABB8: @ 203ABB8 .space 0x4 /*unused var?*/ .include "src/mystery_event_script.o" - .include "src/learn_move.o" .include "src/decoration_inventory.o" .include "src/roamer.o" -gUnknown_0203BC88: @ 203BC88 +gFacilityTrainers: @ 203BC88 .space 0x4 gFacilityTrainerMons: @ 203BC8C