From 269d7c251022ccbd68f1e4b93cf4d8f4c3424c6e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 27 Oct 2018 17:39:05 +0200 Subject: [PATCH] up to factory --- asm/battle_frontier_2.s | 1397 --------------------------------------- src/battle_dome.c | 18 +- src/battle_frontier_2.c | 378 ++++++++++- src/battle_tower.c | 18 +- 4 files changed, 366 insertions(+), 1445 deletions(-) diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index b0c83b39b..c5477493d 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -7,1403 +7,6 @@ - thumb_func_start sub_81A2134 -sub_81A2134: @ 81A2134 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gRecordsWindowId - ldr r0, =gUnknown_08611C74 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - cmp r7, 0 - bne _081A217C - ldr r0, =gStringVar4 - ldr r1, =gText_SingleBattleTourneyResults - bl StringExpandPlaceholders - b _081A2184 - .pool -_081A217C: - ldr r0, =gStringVar4 - ldr r1, =gText_DoubleBattleTourneyResults - bl StringExpandPlaceholders -_081A2184: - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81A1C4C - ldr r1, =gRecordsWindowId - ldrb r0, [r1] - ldr r2, =gText_Lv502 - movs r6, 0x21 - str r6, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r1, =gRecordsWindowId - ldrb r0, [r1] - ldr r2, =gText_OpenLv - movs r1, 0x61 - str r1, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - movs r0, 0xA - bl PrintHyphens - str r6, [sp] - adds r0, r7, 0 - movs r1, 0 - movs r2, 0x40 - movs r3, 0x79 - bl sub_81A2094 - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - lsls r5, r7, 2 - ldr r1, =0x00000d14 - adds r0, r1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x79 - mov r9, r0 - str r0, [sp] - movs r0, 0x31 - str r0, [sp, 0x4] - ldr r0, =gText_Record - ldr r1, =gText_ClearStreak - movs r3, 0x40 - bl sub_81A2008 - ldr r1, =gText_Total - mov r10, r1 - ldr r0, =gText_Championships - mov r8, r0 - ldr r0, [r4] - ldr r1, =0x00000d1c - adds r0, r1 - adds r0, r5 - ldrh r2, [r0] - movs r6, 0x70 - str r6, [sp] - movs r0, 0x41 - str r0, [sp, 0x4] - mov r0, r10 - mov r1, r8 - movs r3, 0x40 - bl sub_81A2008 - movs r0, 0x61 - str r0, [sp] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0x40 - movs r3, 0x79 - bl sub_81A2094 - ldr r0, [r4] - ldr r1, =0x00000d16 - adds r0, r1 - adds r0, r5 - ldrh r2, [r0] - mov r0, r9 - str r0, [sp] - movs r0, 0x71 - str r0, [sp, 0x4] - ldr r0, =gText_Record - ldr r1, =gText_ClearStreak - movs r3, 0x40 - bl sub_81A2008 - ldr r0, [r4] - ldr r1, =0x00000d1e - adds r0, r1 - adds r0, r5 - ldrh r2, [r0] - str r6, [sp] - movs r0, 0x81 - str r0, [sp, 0x4] - mov r0, r10 - mov r1, r8 - movs r3, 0x40 - bl sub_81A2008 - ldr r1, =gRecordsWindowId - ldrb r0, [r1] - bl PutWindowTilemap - ldr r1, =gRecordsWindowId - ldrb r0, [r1] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2134 - - thumb_func_start sub_81A22B8 -sub_81A22B8: @ 81A22B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r5, r0, 0 - adds r4, r2, 0 - ldr r0, [sp, 0x30] - lsls r1, 16 - lsrs r6, r1, 16 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0xC] - lsls r0, 24 - lsrs r0, 24 - adds r7, r0, 0 - ldr r0, =gRecordsWindowId - mov r10, r0 - ldrb r0, [r0] - str r7, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl AddTextPrinterParameterized - ldr r0, =0x0000270f - cmp r6, r0 - bls _081A2304 - adds r6, r0, 0 -_081A2304: - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_WinStreak - adds r0, r4, 0 - bl StringExpandPlaceholders - mov r1, r10 - ldrb r0, [r1] - str r7, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - ldr r3, [sp, 0xC] - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A22B8 - - thumb_func_start sub_81A2358 -sub_81A2358: @ 81A2358 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, [sp, 0x10] - lsls r0, 24 - lsls r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r4, =gSaveBlock2Ptr - ldr r4, [r4] - lsrs r1, 23 - lsrs r0, 22 - adds r1, r0 - movs r0, 0xDD - lsls r0, 4 - adds r4, r0 - adds r4, r1 - ldrh r1, [r4] - ldr r0, =gText_Record - str r5, [sp] - bl sub_81A22B8 - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2358 - - thumb_func_start sub_81A239C -sub_81A239C: @ 81A239C - push {lr} - lsls r0, 24 - lsls r1, 24 - ldr r2, =gSaveBlock2Ptr - ldr r2, [r2] - lsrs r1, 23 - lsrs r0, 22 - adds r1, r0 - ldr r0, =0x00000dc8 - adds r2, r0 - adds r2, r1 - ldrh r0, [r2] - ldr r1, =0x0000270f - cmp r0, r1 - bls _081A23BC - adds r0, r1, 0 -_081A23BC: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A239C - - thumb_func_start sub_81A23CC -sub_81A23CC: @ 81A23CC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - ldr r4, [sp, 0x20] - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - lsls r4, 24 - lsrs r7, r4, 24 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_81A239C - lsls r0, 16 - lsrs r4, r0, 16 - cmp r5, 0 - beq _081A2404 - cmp r5, 0x1 - beq _081A2410 -_081A2404: - cmp r6, 0 - beq _081A240C - movs r0, 0x20 - b _081A241E -_081A240C: - movs r0, 0x10 - b _081A241E -_081A2410: - cmp r6, 0 - beq _081A241A - movs r0, 0x80 - lsls r0, 16 - b _081A241E -_081A241A: - movs r0, 0x80 - lsls r0, 15 -_081A241E: - bl sub_81A1C24 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081A2440 - ldr r0, =gText_Current - str r7, [sp] - adds r1, r4, 0 - mov r2, r8 - mov r3, r9 - bl sub_81A22B8 - b _081A244E - .pool -_081A2440: - ldr r0, =gText_Prev - str r7, [sp] - adds r1, r4, 0 - mov r2, r8 - mov r3, r9 - bl sub_81A22B8 -_081A244E: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A23CC - - thumb_func_start sub_81A2460 -sub_81A2460: @ 81A2460 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gRecordsWindowId - ldr r0, =gUnknown_08611C74 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - cmp r7, 0 - bne _081A24A8 - ldr r0, =gStringVar4 - ldr r1, =gText_SingleBattleHallResults - bl StringExpandPlaceholders - b _081A24B0 - .pool -_081A24A8: - ldr r0, =gStringVar4 - ldr r1, =gText_DoubleBattleHallResults - bl StringExpandPlaceholders -_081A24B0: - ldr r0, =gStringVar4 - movs r1, 0x2 - bl sub_81A1C4C - ldr r6, =gRecordsWindowId - ldrb r0, [r6] - ldr r2, =gText_Lv502 - movs r1, 0x31 - mov r8, r1 - str r1, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x10 - bl AddTextPrinterParameterized - ldrb r0, [r6] - ldr r2, =gText_OpenLv - movs r1, 0x61 - mov r9, r1 - str r1, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x10 - bl AddTextPrinterParameterized - movs r0, 0xA - bl PrintHyphens - mov r0, r8 - str r0, [sp] - adds r0, r7, 0 - movs r1, 0 - movs r2, 0x48 - movs r3, 0x83 - bl sub_81A23CC - movs r0, 0x41 - str r0, [sp] - adds r0, r7, 0 - movs r1, 0 - movs r2, 0x48 - movs r3, 0x83 - bl sub_81A2358 - mov r1, r9 - str r1, [sp] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0x48 - movs r3, 0x83 - bl sub_81A23CC - movs r0, 0x71 - str r0, [sp] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0x48 - movs r3, 0x83 - bl sub_81A2358 - ldrb r0, [r6] - bl PutWindowTilemap - ldrb r0, [r6] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2460 - - thumb_func_start sub_81A2560 -sub_81A2560: @ 81A2560 - push {lr} - lsls r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsrs r0, 23 - ldr r2, =0x00000e04 - adds r1, r2 - adds r1, r0 - ldrh r0, [r1] - ldr r1, =0x0000270f - cmp r0, r1 - bls _081A257A - adds r0, r1, 0 -_081A257A: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A2560 - - thumb_func_start sub_81A258C -sub_81A258C: @ 81A258C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - mov r12, r0 - adds r7, r1, 0 - adds r4, r2, 0 - ldr r6, [sp, 0x2C] - ldr r5, [sp, 0x30] - lsls r4, 16 - lsrs r4, 16 - lsls r3, 24 - lsrs r3, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gRecordsWindowId - mov r10, r0 - ldrb r0, [r0] - str r5, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - mov r2, r12 - bl AddTextPrinterParameterized - ldr r0, =gStringVar1 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r7, 0 - bl StringExpandPlaceholders - mov r1, r10 - ldrb r0, [r1] - str r5, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r6, 0 - bl AddTextPrinterParameterized - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A258C - - thumb_func_start sub_81A2618 -sub_81A2618: @ 81A2618 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 24 - lsrs r5, r2, 24 - lsls r3, 24 - lsrs r6, r3, 24 - adds r0, r4, 0 - bl sub_81A2560 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r4, 0 - beq _081A2648 - movs r0, 0x80 - lsls r0, 4 - b _081A264C -_081A2648: - movs r0, 0x80 - lsls r0, 3 -_081A264C: - bl sub_81A1C24 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081A2674 - ldr r0, =gText_Current - ldr r1, =gText_RoomsCleared - str r5, [sp] - str r6, [sp, 0x4] - adds r2, r7, 0 - mov r3, r8 - bl sub_81A2008 - b _081A2684 - .pool -_081A2674: - ldr r0, =gText_Prev - ldr r1, =gText_RoomsCleared - str r5, [sp] - str r6, [sp, 0x4] - adds r2, r7, 0 - mov r3, r8 - bl sub_81A2008 -_081A2684: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2618 - - thumb_func_start sub_81A2698 -sub_81A2698: @ 81A2698 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r6, =gRecordsWindowId - ldr r0, =gUnknown_08611C74 - bl AddWindow - strb r0, [r6] - ldrb r0, [r6] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r6] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r4, =gStringVar4 - ldr r1, =gText_BattleChoiceResults - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81A1C4C - ldrb r0, [r6] - ldr r2, =gText_Lv502 - movs r1, 0x21 - str r1, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldrb r0, [r6] - ldr r2, =gText_OpenLv - movs r1, 0x61 - str r1, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - movs r0, 0xA - bl PrintHyphens - movs r0, 0 - movs r1, 0x40 - movs r2, 0x72 - movs r3, 0x21 - bl sub_81A2618 - ldr r0, =gText_Record - mov r10, r0 - ldr r7, =gText_RoomsCleared - ldr r5, =gSaveBlock2Ptr - ldr r0, [r5] - ldr r1, =0x00000e08 - adds r0, r1 - ldrh r2, [r0] - movs r4, 0x72 - str r4, [sp] - movs r0, 0x31 - str r0, [sp, 0x4] - mov r0, r10 - adds r1, r7, 0 - movs r3, 0x40 - bl sub_81A258C - ldr r0, =gText_Total - mov r8, r0 - ldr r1, =gText_TimesCleared - mov r9, r1 - ldr r0, [r5] - ldr r1, =0x00000e0c - adds r0, r1 - ldrh r2, [r0] - str r4, [sp] - movs r0, 0x41 - str r0, [sp, 0x4] - mov r0, r8 - mov r1, r9 - movs r3, 0x40 - bl sub_81A258C - movs r0, 0x1 - movs r1, 0x40 - movs r2, 0x72 - movs r3, 0x61 - bl sub_81A2618 - ldr r0, [r5] - ldr r1, =0x00000e0a - adds r0, r1 - ldrh r2, [r0] - str r4, [sp] - movs r0, 0x71 - str r0, [sp, 0x4] - mov r0, r10 - adds r1, r7, 0 - movs r3, 0x40 - bl sub_81A258C - ldr r0, [r5] - ldr r1, =0x00000e0e - adds r0, r1 - ldrh r2, [r0] - str r4, [sp] - movs r0, 0x81 - str r0, [sp, 0x4] - mov r0, r8 - mov r1, r9 - movs r3, 0x40 - bl sub_81A258C - ldrb r0, [r6] - bl PutWindowTilemap - ldrb r0, [r6] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2698 - - thumb_func_start sub_81A27E8 -sub_81A27E8: @ 81A27E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r5, r0, 0 - adds r4, r2, 0 - ldr r0, [sp, 0x30] - lsls r1, 16 - lsrs r6, r1, 16 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0xC] - lsls r0, 24 - lsrs r0, 24 - adds r7, r0, 0 - ldr r0, =gRecordsWindowId - mov r10, r0 - ldrb r0, [r0] - str r7, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl AddTextPrinterParameterized - ldr r0, =0x0000270f - cmp r6, r0 - bls _081A2834 - adds r6, r0, 0 -_081A2834: - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_KOsInARow - adds r0, r4, 0 - bl StringExpandPlaceholders - mov r1, r10 - ldrb r0, [r1] - str r7, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - ldr r3, [sp, 0xC] - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A27E8 - - thumb_func_start sub_81A2888 -sub_81A2888: @ 81A2888 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsrs r0, 23 - ldr r2, =0x00000dde - adds r1, r2 - adds r1, r0 - ldrh r1, [r1] - ldr r0, =gText_Record - str r3, [sp] - adds r2, r4, 0 - adds r3, r5, 0 - bl sub_81A27E8 - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2888 - - thumb_func_start sub_81A28CC -sub_81A28CC: @ 81A28CC - push {lr} - lsls r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsrs r0, 23 - ldr r2, =0x00000dda - adds r1, r2 - adds r1, r0 - ldrh r0, [r1] - ldr r1, =0x0000270f - cmp r0, r1 - bls _081A28E6 - adds r0, r1, 0 -_081A28E6: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A28CC - - thumb_func_start sub_81A28F8 -sub_81A28F8: @ 81A28F8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r6, r3, 24 - adds r0, r4, 0 - bl sub_81A28CC - lsls r0, 16 - lsrs r5, r0, 16 - cmp r4, 0 - beq _081A2926 - movs r0, 0x80 - b _081A2928 -_081A2926: - movs r0, 0x40 -_081A2928: - bl sub_81A1C24 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081A2948 - ldr r0, =gText_Current - str r6, [sp] - adds r1, r5, 0 - adds r2, r7, 0 - mov r3, r8 - bl sub_81A27E8 - b _081A2956 - .pool -_081A2948: - ldr r0, =gText_Prev - str r6, [sp] - adds r1, r5, 0 - adds r2, r7, 0 - mov r3, r8 - bl sub_81A27E8 -_081A2956: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A28F8 - - thumb_func_start sub_81A2968 -sub_81A2968: @ 81A2968 - push {r4-r6,lr} - sub sp, 0xC - ldr r5, =gRecordsWindowId - ldr r0, =gUnknown_08611C74 - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r5] - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0xA - bl PrintHyphens - ldr r4, =gStringVar4 - ldr r1, =gText_SetKOTourneyResults - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x2 - bl sub_81A1C4C - ldrb r0, [r5] - ldr r2, =gText_Lv502 - movs r1, 0x31 - str r1, [sp] - movs r6, 0xFF - str r6, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x10 - bl AddTextPrinterParameterized - ldrb r0, [r5] - ldr r2, =gText_OpenLv - movs r1, 0x61 - str r1, [sp] - str r6, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x10 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x48 - movs r2, 0x7E - movs r3, 0x31 - bl sub_81A28F8 - movs r0, 0 - movs r1, 0x48 - movs r2, 0x7E - movs r3, 0x41 - bl sub_81A2888 - movs r0, 0x1 - movs r1, 0x48 - movs r2, 0x7E - movs r3, 0x61 - bl sub_81A28F8 - movs r0, 0x1 - movs r1, 0x48 - movs r2, 0x7E - movs r3, 0x71 - bl sub_81A2888 - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2968 - - thumb_func_start sub_81A2A28 -sub_81A2A28: @ 81A2A28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r12, r0 - ldr r4, [sp, 0x38] - ldr r5, [sp, 0x3C] - ldr r0, [sp, 0x40] - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0xC] - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x10] - lsls r5, 24 - lsrs r5, 24 - str r5, [sp, 0x14] - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r0, =gRecordsWindowId - mov r10, r0 - ldrb r0, [r0] - str r6, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - mov r2, r12 - bl AddTextPrinterParameterized - ldr r0, =0x0000270f - cmp r7, r0 - bls _081A2A80 - adds r7, r0, 0 -_081A2A80: - ldr r5, =gStringVar1 - adds r0, r5, 0 - adds r1, r7, 0 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_WinStreak - adds r0, r4, 0 - bl StringExpandPlaceholders - mov r1, r10 - ldrb r0, [r1] - str r6, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - ldr r3, [sp, 0x10] - bl AddTextPrinterParameterized - adds r0, r5, 0 - ldr r1, [sp, 0xC] - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r1, =gText_TimesVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - mov r1, r10 - ldrb r0, [r1] - str r6, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - ldr r3, [sp, 0x14] - bl AddTextPrinterParameterized - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2A28 - - thumb_func_start sub_81A2B04 -sub_81A2B04: @ 81A2B04 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r6, r2, 0 - ldr r4, [sp, 0x24] - ldr r5, [sp, 0x28] - lsls r0, 24 - lsls r1, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r2, =gSaveBlock2Ptr - ldr r2, [r2] - lsrs r1, 23 - lsrs r0, 22 - adds r1, r0 - ldr r7, =0x00000dea - adds r0, r2, r7 - adds r0, r1 - ldrh r0, [r0] - mov r8, r0 - ldr r0, =0x00000dfa - adds r2, r0 - adds r2, r1 - ldrh r2, [r2] - ldr r0, =gText_Record - str r3, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - mov r1, r8 - adds r3, r6, 0 - bl sub_81A2A28 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2B04 - - thumb_func_start sub_81A2B70 -sub_81A2B70: @ 81A2B70 - push {lr} - lsls r0, 24 - lsls r1, 24 - ldr r2, =gSaveBlock2Ptr - ldr r2, [r2] - lsrs r1, 23 - lsrs r0, 22 - adds r1, r0 - ldr r0, =0x00000de2 - adds r2, r0 - adds r2, r1 - ldrh r0, [r2] - ldr r1, =0x0000270f - cmp r0, r1 - bls _081A2B90 - adds r0, r1, 0 -_081A2B90: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A2B70 - - thumb_func_start sub_81A2BA0 -sub_81A2BA0: @ 81A2BA0 - push {lr} - lsls r0, 24 - lsls r1, 24 - ldr r2, =gSaveBlock2Ptr - ldr r2, [r2] - lsrs r1, 23 - lsrs r0, 22 - adds r1, r0 - ldr r0, =0x00000df2 - adds r2, r0 - adds r2, r1 - ldrh r0, [r2] - ldr r1, =0x0000270f - cmp r0, r1 - bls _081A2BC0 - adds r0, r1, 0 -_081A2BC0: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A2BA0 - - thumb_func_start sub_81A2BD0 -sub_81A2BD0: @ 81A2BD0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r4, [sp, 0x30] - ldr r5, [sp, 0x34] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0xC] - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - mov r9, r4 - lsls r5, 24 - lsrs r5, 24 - mov r10, r5 - adds r0, r6, 0 - adds r1, r7, 0 - bl sub_81A2B70 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r6, 0 - adds r1, r7, 0 - bl sub_81A2BA0 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r6, 0 - beq _081A2C20 - cmp r6, 0x1 - beq _081A2C30 -_081A2C20: - cmp r7, 0 - beq _081A2C2A - movs r0, 0x80 - lsls r0, 2 - b _081A2C3E -_081A2C2A: - movs r0, 0x80 - lsls r0, 1 - b _081A2C3E -_081A2C30: - cmp r7, 0 - beq _081A2C3A - movs r0, 0x80 - lsls r0, 18 - b _081A2C3E -_081A2C3A: - movs r0, 0x80 - lsls r0, 17 -_081A2C3E: - bl sub_81A1C24 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081A2C68 - ldr r0, =gText_Current - mov r1, r8 - str r1, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - adds r1, r5, 0 - adds r2, r4, 0 - ldr r3, [sp, 0xC] - bl sub_81A2A28 - b _081A2C80 - .pool -_081A2C68: - ldr r0, =gText_Prev - mov r1, r8 - str r1, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - adds r1, r5, 0 - adds r2, r4, 0 - ldr r3, [sp, 0xC] - bl sub_81A2A28 -_081A2C80: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2BD0 - - thumb_func_start sub_81A2C94 -sub_81A2C94: @ 81A2C94 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gRecordsWindowId - ldr r0, =gUnknown_08611C74 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - cmp r7, 0 - bne _081A2CD8 - ldr r0, =gStringVar4 - ldr r1, =gText_BattleSwapSingleResults - bl StringExpandPlaceholders - b _081A2CE0 - .pool -_081A2CD8: - ldr r0, =gStringVar4 - ldr r1, =gText_BattleSwapDoubleResults - bl StringExpandPlaceholders -_081A2CE0: - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81A1C4C - ldr r0, =gRecordsWindowId - mov r8, r0 - ldrb r0, [r0] - ldr r2, =gText_Lv502 - movs r6, 0x21 - str r6, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - mov r1, r8 - ldrb r0, [r1] - ldr r2, =gText_RentalSwap - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x98 - bl AddTextPrinterParameterized - mov r1, r8 - ldrb r0, [r1] - ldr r2, =gText_OpenLv - movs r1, 0x61 - str r1, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - movs r0, 0xA - bl PrintHyphens - movs r4, 0x9E - str r4, [sp] - movs r0, 0x31 - str r0, [sp, 0x4] - adds r0, r7, 0 - movs r1, 0 - movs r2, 0x8 - movs r3, 0x40 - bl sub_81A2BD0 - str r4, [sp] - movs r0, 0x41 - str r0, [sp, 0x4] - adds r0, r7, 0 - movs r1, 0 - movs r2, 0x8 - movs r3, 0x40 - bl sub_81A2B04 - str r4, [sp] - movs r0, 0x71 - str r0, [sp, 0x4] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0x8 - movs r3, 0x40 - bl sub_81A2BD0 - str r4, [sp] - movs r0, 0x81 - str r0, [sp, 0x4] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0x8 - movs r3, 0x40 - bl sub_81A2B04 - mov r1, r8 - ldrb r0, [r1] - bl PutWindowTilemap - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A2C94 - thumb_func_start sub_81A2DB4 sub_81A2DB4: @ 81A2DB4 push {r4-r7,lr} diff --git a/src/battle_dome.c b/src/battle_dome.c index 00bf9646b..c54abd68c 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2408,7 +2408,7 @@ static void sub_818E9CC(void) gSaveBlock2Ptr->frontier.field_CA9_a = 0; gSaveBlock2Ptr->frontier.field_CA9_b = 0; if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode])) - gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] = 0; + gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0; saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); gTrainerBattleOpponent_A = 0; @@ -2422,7 +2422,7 @@ static void sub_818EA84(void) switch (gSpecialVar_0x8005) { case 0: - gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; + gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]; break; case 1: gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]) != 0); @@ -2490,7 +2490,7 @@ static void sub_818ED28(void) switch (gSpecialVar_0x8005) { case 0: - gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] = gSpecialVar_0x8006; + gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006; break; case 1: if (gSpecialVar_0x8006) @@ -3481,13 +3481,13 @@ static void sub_819033C(void) u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - if (gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] < 999) - gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]++; - if (gSaveBlock2Ptr->frontier.field_D1C[battleMode][lvlMode] < 999) - gSaveBlock2Ptr->frontier.field_D1C[battleMode][lvlMode]++; + if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] < 999) + gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]++; + if (gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode] < 999) + gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode]++; - if (gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.field_D14[battleMode][lvlMode]) - gSaveBlock2Ptr->frontier.field_D14[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; + if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode]) + gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]; } static void ShowDomeOpponentInfo(void) diff --git a/src/battle_frontier_2.c b/src/battle_frontier_2.c index 9e8d20033..6b276106c 100644 --- a/src/battle_frontier_2.c +++ b/src/battle_frontier_2.c @@ -20,11 +20,21 @@ extern u8 gUnknown_0203CEF8[]; extern void (* const gUnknown_08611C18[])(void); extern const u16 gUnknown_08611BFC[][2]; +extern const struct BattleFrontierTrainer gBattleFrontierTrainers[]; +extern const struct WindowTemplate gUnknown_08611C74; extern void sub_81B8558(void); // This file's functions. u8 sub_81A3B30(u8 facility); +void ShowTowerResultsWindow(u8); +void ShowDomeResultsWindow(u8); +void ShowPalaceResultsWindow(u8); +void ShowPikeResultsWindow(void); +void sub_81A2C94(u8); +void ShowArenaResultsWindow(void); +void sub_81A2F38(void); +void sub_81A2FF8(void); void sub_81A1780(void) { @@ -140,8 +150,6 @@ void sub_81A1B1C(void) DoSoftReset(); } -extern const struct BattleFrontierTrainer gBattleFrontierTrainers[]; - void sub_81A1B28(void) { gFacilityTrainers = gBattleFrontierTrainers; @@ -159,15 +167,6 @@ void sub_81A1B38(void) } } -void PutTowerResultsWindow(u8); -void sub_81A2134(u8); -void sub_81A2460(u8); -void sub_81A2698(void); -void sub_81A2C94(u8); -void sub_81A2968(void); -void sub_81A2F38(void); -void sub_81A2FF8(void); - void sub_81A1B98(void) { if (gSpecialVar_0x8006 > 3) @@ -175,22 +174,22 @@ void sub_81A1B98(void) switch (gSpecialVar_0x8005) { case 0: - PutTowerResultsWindow(gSpecialVar_0x8006); + ShowTowerResultsWindow(gSpecialVar_0x8006); break; case 1: - sub_81A2134(gSpecialVar_0x8006); + ShowDomeResultsWindow(gSpecialVar_0x8006); break; case 2: - sub_81A2460(gSpecialVar_0x8006); + ShowPalaceResultsWindow(gSpecialVar_0x8006); break; case 5: - sub_81A2698(); + ShowPikeResultsWindow(); break; case 4: sub_81A2C94(gSpecialVar_0x8006); break; case 3: - sub_81A2968(); + ShowArenaResultsWindow(); break; case 6: sub_81A2F38(); @@ -232,6 +231,7 @@ void PrintHyphens(s32 y) extern const u8 gText_WinStreak[]; extern const u8 gText_Record[]; extern const u8 gText_Current[]; +extern const u8 gText_RoomsCleared[]; extern const u8 gText_Prev[]; extern const u8 gText_SingleBattleRoomResults[]; extern const u8 gText_DoubleBattleRoomResults[]; @@ -239,8 +239,23 @@ extern const u8 gText_MultiBattleRoomResults[]; extern const u8 gText_LinkMultiBattleRoomResults[]; extern const u8 gText_Lv502[]; extern const u8 gText_OpenLv[]; +extern const u8 gText_RentalSwap[]; extern const u8 gText_ClearStreak[]; +extern const u8 gText_Total[]; +extern const u8 gText_Championships[]; +extern const u8 gText_SingleBattleTourneyResults[]; +extern const u8 gText_DoubleBattleTourneyResults[]; +extern const u8 gText_SingleBattleHallResults[]; +extern const u8 gText_DoubleBattleHallResults[]; +extern const u8 gText_BattleChoiceResults[]; +extern const u8 gText_TimesCleared[]; +extern const u8 gText_KOsInARow[]; +extern const u8 gText_SetKOTourneyResults[]; +extern const u8 gText_TimesVar1[]; +extern const u8 gText_BattleSwapSingleResults[]; +extern const u8 gText_BattleSwapDoubleResults[]; +// Battle Tower. void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) { AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); @@ -253,13 +268,13 @@ void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) void TowerPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) { - u16 num = gSaveBlock2Ptr->frontier.field_CF0[battleMode][lvlMode]; + u16 num = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode]; TowerPrintStreak(gText_Record, num, x1, x2, y); } -u16 TowerGetStreak(u8 battleMode, u8 lvlMode) +u16 TowerGetWinStreak(u8 battleMode, u8 lvlMode) { - u16 winStreak = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode]; + u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]; if (winStreak > 9999) return 9999; else @@ -269,7 +284,7 @@ u16 TowerGetStreak(u8 battleMode, u8 lvlMode) void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) { bool8 isCurrent; - u16 winStreak = TowerGetStreak(battleMode, lvlMode); + u16 winStreak = TowerGetWinStreak(battleMode, lvlMode); switch (battleMode) { default: @@ -305,9 +320,7 @@ void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y TowerPrintStreak(gText_Prev, winStreak, x1, x2, y); } -extern const struct WindowTemplate gUnknown_08611C74; - -void PutTowerResultsWindow(u8 battleMode) +void ShowTowerResultsWindow(u8 battleMode) { gRecordsWindowId = AddWindow(&gUnknown_08611C74); NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); @@ -333,16 +346,17 @@ void PutTowerResultsWindow(u8 battleMode) CopyWindowToVram(gRecordsWindowId, 3); } -u16 sub_81A1FD8(u8 battleMode, u8 lvlMode) +// Battle Dome. +u16 DomeGetWinStreak(u8 battleMode, u8 lvlMode) { - u16 winStreak = gSaveBlock2Ptr->frontier.field_D0C[battleMode][lvlMode]; + u16 winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]; if (winStreak > 9999) return 9999; else return winStreak; } -void sub_81A2008(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) +void PrintTwoStrings(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) { AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL); ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); @@ -350,10 +364,10 @@ void sub_81A2008(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } -void sub_81A2094(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) +void DomePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) { bool8 isCurrent; - u16 winStreak = sub_81A1FD8(battleMode, lvlMode); + u16 winStreak = DomeGetWinStreak(battleMode, lvlMode); switch (battleMode) { default: @@ -372,7 +386,311 @@ void sub_81A2094(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) } if (isCurrent == TRUE) - sub_81A2008(gText_Current, gText_ClearStreak, winStreak, x1, x2, y); + PrintTwoStrings(gText_Current, gText_ClearStreak, winStreak, x1, x2, y); else - sub_81A2008(gText_Prev, gText_ClearStreak, winStreak, x1, x2, y); + PrintTwoStrings(gText_Prev, gText_ClearStreak, winStreak, x1, x2, y); } + +void ShowDomeResultsWindow(u8 battleMode) +{ + gRecordsWindowId = AddWindow(&gUnknown_08611C74); + NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); + FillWindowPixelBuffer(gRecordsWindowId, 0x11); + if (battleMode == FRONTIER_MODE_SINGLES) + StringExpandPlaceholders(gStringVar4, gText_SingleBattleTourneyResults); + else + StringExpandPlaceholders(gStringVar4, gText_DoubleBattleTourneyResults); + + sub_81A1C4C(gStringVar4, 0); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + PrintHyphens(10); + DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 64, 121, 33); + PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_50], 64, 121, 49); + PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_50], 64, 112, 65); + DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 64, 121, 97); + PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_OPEN], 64, 121, 113); + PrintTwoStrings(gText_Total, gText_Championships, gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][FRONTIER_LVL_OPEN], 64, 112, 129); + PutWindowTilemap(gRecordsWindowId); + CopyWindowToVram(gRecordsWindowId, 3); +} + +// Battle Palace. +void PalacePrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) +{ + AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + if (num > 9999) + num = 9999; + ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); + StringExpandPlaceholders(gStringVar4, gText_WinStreak); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); +} + +void PalacePrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) +{ + u16 num = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode]; + PalacePrintStreak(gText_Record, num, x1, x2, y); +} + +u16 PalaceGetWinStreak(u8 battleMode, u8 lvlMode) +{ + u16 winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode]; + if (winStreak > 9999) + return 9999; + else + return winStreak; +} + +void PalacePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) +{ + bool8 isCurrent; + u16 winStreak = PalaceGetWinStreak(battleMode, lvlMode); + switch (battleMode) + { + default: + case FRONTIER_MODE_SINGLES: + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x20); + else + isCurrent = sub_81A1C24(0x10); + break; + case FRONTIER_MODE_DOUBLES: + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x800000); + else + isCurrent = sub_81A1C24(0x400000); + } + + if (isCurrent == TRUE) + PalacePrintStreak(gText_Current, winStreak, x1, x2, y); + else + PalacePrintStreak(gText_Prev, winStreak, x1, x2, y); +} + +void ShowPalaceResultsWindow(u8 battleMode) +{ + gRecordsWindowId = AddWindow(&gUnknown_08611C74); + NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); + FillWindowPixelBuffer(gRecordsWindowId, 0x11); + if (battleMode == FRONTIER_MODE_SINGLES) + StringExpandPlaceholders(gStringVar4, gText_SingleBattleHallResults); + else + StringExpandPlaceholders(gStringVar4, gText_DoubleBattleHallResults); + + sub_81A1C4C(gStringVar4, 2); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); + PrintHyphens(10); + PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 131, 49); + PalacePrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 131, 65); + PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 97); + PalacePrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 72, 131, 113); + PutWindowTilemap(gRecordsWindowId); + CopyWindowToVram(gRecordsWindowId, 3); +} + +// Battle Pike. +u16 PikeGetWinStreak(u8 lvlMode) +{ + u16 winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode]; + if (winStreak > 9999) + return 9999; + else + return winStreak; +} + +void PikePrintCleared(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) +{ + AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL); + ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); + StringExpandPlaceholders(gStringVar4, str2); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); +} + +void PikePrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) +{ + bool8 isCurrent; + u16 winStreak = PikeGetWinStreak(lvlMode); + + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x800); + else + isCurrent = sub_81A1C24(0x400); + + if (isCurrent == TRUE) + PrintTwoStrings(gText_Current, gText_RoomsCleared, winStreak, x1, x2, y); + else + PrintTwoStrings(gText_Prev, gText_RoomsCleared, winStreak, x1, x2, y); +} + +void ShowPikeResultsWindow(void) +{ + gRecordsWindowId = AddWindow(&gUnknown_08611C74); + NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); + FillWindowPixelBuffer(gRecordsWindowId, 0x11); + StringExpandPlaceholders(gStringVar4, gText_BattleChoiceResults); + sub_81A1C4C(gStringVar4, 0); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + PrintHyphens(10); + PikePrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 114, 33); + PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_50], 64, 114, 49); + PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_50], 64, 114, 65); + PikePrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 64, 114, 97); + PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_OPEN], 64, 114, 113); + PikePrintCleared(gText_Total, gText_TimesCleared, gSaveBlock2Ptr->frontier.pikeTotalStreaks[FRONTIER_LVL_OPEN], 64, 114, 129); + PutWindowTilemap(gRecordsWindowId); + CopyWindowToVram(gRecordsWindowId, 3); +} + +// Battle Arena. +void ArenaPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) +{ + AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + if (num > 9999) + num = 9999; + ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); + StringExpandPlaceholders(gStringVar4, gText_KOsInARow); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); +} + +void ArenaPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) +{ + u16 num = gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode]; + ArenaPrintStreak(gText_Record, num, x1, x2, y); +} + +u16 ArenaGetWinStreak(u8 lvlMode) +{ + u16 winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode]; + if (winStreak > 9999) + return 9999; + else + return winStreak; +} + +void ArenaPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) +{ + bool8 isCurrent; + u16 winStreak = ArenaGetWinStreak(lvlMode); + + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x80); + else + isCurrent = sub_81A1C24(0x40); + + if (isCurrent == TRUE) + ArenaPrintStreak(gText_Current, winStreak, x1, x2, y); + else + ArenaPrintStreak(gText_Prev, winStreak, x1, x2, y); +} + +void ShowArenaResultsWindow(void) +{ + gRecordsWindowId = AddWindow(&gUnknown_08611C74); + NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); + FillWindowPixelBuffer(gRecordsWindowId, 0x11); + PrintHyphens(10); + StringExpandPlaceholders(gStringVar4, gText_SetKOTourneyResults); + sub_81A1C4C(gStringVar4, 2); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); + ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 72, 126, 49); + ArenaPrintRecordStreak(FRONTIER_LVL_50, 72, 126, 65); + ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 72, 126, 97); + ArenaPrintRecordStreak(FRONTIER_LVL_OPEN, 72, 126, 113); + PutWindowTilemap(gRecordsWindowId); + CopyWindowToVram(gRecordsWindowId, 3); +} + +// Battle Factory. +void sub_81A2A28(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y) +{ + AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + if (num1 > 9999) + num1 = 9999; + ConvertIntToDecimalStringN(gStringVar1, num1, STR_CONV_MODE_RIGHT_ALIGN, 4); + StringExpandPlaceholders(gStringVar4, gText_WinStreak); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + + ConvertIntToDecimalStringN(gStringVar1, num2, STR_CONV_MODE_RIGHT_ALIGN, 4); + StringExpandPlaceholders(gStringVar4, gText_TimesVar1); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x3, y, TEXT_SPEED_FF, NULL); +} + +void sub_81A2B04(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y) +{ + u16 num1 = gSaveBlock2Ptr->frontier.field_DEA[battleMode][lvlMode]; + u16 num2 = gSaveBlock2Ptr->frontier.field_DFA[battleMode][lvlMode]; + sub_81A2A28(gText_Record, num1, num2, x1, x2, x3, y); +} + +u16 sub_81A2B70(u8 battleMode, u8 lvlMode) +{ + u16 winStreak = gSaveBlock2Ptr->frontier.field_DE2[battleMode][lvlMode]; + if (winStreak > 9999) + return 9999; + else + return winStreak; +} + +u16 sub_81A2BA0(u8 battleMode, u8 lvlMode) +{ + u16 rents = gSaveBlock2Ptr->frontier.field_DF2[battleMode][lvlMode]; + if (rents > 9999) + return 9999; + else + return rents; +} + +void sub_81A2BD0(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y) +{ + bool8 isCurrent; + u16 winStreak = sub_81A2B70(battleMode, lvlMode); + u16 rents = sub_81A2BA0(battleMode, lvlMode); + switch (battleMode) + { + default: + case FRONTIER_MODE_SINGLES: + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x200); + else + isCurrent = sub_81A1C24(0x100); + break; + case FRONTIER_MODE_DOUBLES: + if (lvlMode != FRONTIER_LVL_50) + isCurrent = sub_81A1C24(0x2000000); + else + isCurrent = sub_81A1C24(0x1000000); + break; + } + + if (isCurrent == TRUE) + sub_81A2A28(gText_Current, winStreak, rents, x1, x2, x3, y); + else + sub_81A2A28(gText_Prev, winStreak, rents, x1, x2, x3, y); +} + +void sub_81A2C94(u8 battleMode) +{ + gRecordsWindowId = AddWindow(&gUnknown_08611C74); + NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE); + FillWindowPixelBuffer(gRecordsWindowId, 0x11); + if (battleMode == FRONTIER_MODE_SINGLES) + StringExpandPlaceholders(gStringVar4, gText_BattleSwapSingleResults); + else + StringExpandPlaceholders(gStringVar4, gText_BattleSwapDoubleResults); + + sub_81A1C4C(gStringVar4, 0); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + PrintHyphens(10); + sub_81A2BD0(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49); + sub_81A2B04(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65); + sub_81A2BD0(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 113); + sub_81A2B04(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 129); + PutWindowTilemap(gRecordsWindowId); + CopyWindowToVram(gRecordsWindowId, 3); +} + diff --git a/src/battle_tower.c b/src/battle_tower.c index 4b63c2875..4199129b2 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -220,7 +220,7 @@ static void sub_8161F94(void) gSaveBlock2Ptr->frontier.field_CA9_b = 0; sub_81A3ACC(); if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_085DF9AC[battleMode][lvlMode])) - gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = 0; + gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0; ValidateBattleTowerRecordChecksums(); saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); @@ -258,7 +258,7 @@ static void sub_81620F4(void) case 0: break; case 1: - gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = gSpecialVar_0x8006; + gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006; break; case 2: if (gSpecialVar_0x8006) @@ -1179,7 +1179,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) { u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable. u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - u8 challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][0] / 7; + u8 challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][0] / 7; if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6) fixedIV = sub_81A6CA8(challengeNum, 0); else @@ -1480,8 +1480,8 @@ static void SaveCurrentWinStreak(void) u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u16 winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode); - if (gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] < winStreak) - gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] = winStreak; + if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] < winStreak) + gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = winStreak; } static void sub_8163EE4(void) @@ -1535,7 +1535,7 @@ static void SaveBattleTowerProgress(void) { u16 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7); + s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7); if (gSpecialVar_0x8005 == 0 && (challengeNum > 1 || gSaveBlock2Ptr->frontier.curChallengeBattleNum != 0)) sub_8163EE4(); @@ -1625,7 +1625,7 @@ static void sub_81642A0(void) eventObjTemplates = gSaveBlock1Ptr->eventObjectTemplates; lvlMode = gSaveBlock2Ptr->frontier.lvlMode; battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL); species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL); level = SetFacilityPtrsGetLevel(); @@ -1911,7 +1911,7 @@ static void sub_8164B74(void) case 0: if (battleMode == FRONTIER_MODE_LINK_MULTIS) { - challengeNum = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; if (sub_800A520()) { SendBlock(bitmask_all_link_players_but_self(), &challengeNum, sizeof(challengeNum)); @@ -2069,7 +2069,7 @@ static void ClearBattleTowerRecord(struct EmeraldBattleTowerRecord *record) u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode) { - u16 winStreak = gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode]; + u16 winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]; if (winStreak > 9999) return 9999;