From 368a63d5a74dee114797218d443b2cb0db68b9ea Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Thu, 8 Feb 2018 16:01:24 -0500 Subject: [PATCH] decompiled up to task_new_game_prof_birch_speech_10 --- asm/main_menu.s | 435 ------------------------------------------------ src/main_menu.c | 172 +++++++++++++++++-- 2 files changed, 156 insertions(+), 451 deletions(-) diff --git a/asm/main_menu.s b/asm/main_menu.s index 8f4e9fb8a4..ab2186a681 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -5,441 +5,6 @@ .text - thumb_func_start task_new_game_prof_birch_speech_5 -task_new_game_prof_birch_speech_5: @ 8030A2C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_8197224 - lsls r0, 16 - cmp r0, 0 - bne _08030A58 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082C8A1F - bl StringExpandPlaceholders - movs r0, 0x1 - bl AddTextPrinterForMessage - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_new_game_prof_birch_speech_6 - str r1, [r0] -_08030A58: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_5 - - thumb_func_start sub_8030A70 -sub_8030A70: @ 8030A70 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x14 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gTasks - ldr r0, =gUnknown_03000DD0 - mov r8, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r6 - ldrb r0, [r0, 0x1A] - ldr r1, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - movs r5, 0 - movs r1, 0x64 - strh r1, [r2, 0x20] - movs r1, 0x4B - strh r1, [r2, 0x22] - movs r1, 0x3E - adds r1, r2 - mov r12, r1 - ldrb r3, [r1] - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - mov r3, r12 - strb r1, [r3] - strh r5, [r2, 0x2E] - ldrb r1, [r2, 0x5] - lsrs r1, 4 - str r5, [sp] - str r5, [sp, 0x4] - movs r2, 0x20 - str r2, [sp, 0x8] - ldr r2, =0x0000ffff - str r2, [sp, 0xC] - ldr r2, =0x00000127 - str r2, [sp, 0x10] - movs r2, 0x70 - movs r3, 0x3A - bl CreatePokeballSpriteToReleaseMon - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r6 - ldr r1, =sub_8030B14 - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r6 - strh r5, [r0, 0x16] - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8030A70 - - thumb_func_start sub_8030B14 -sub_8030B14: @ 8030B14 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - subs r1, 0x8 - mov r8, r1 - ldr r2, =gUnknown_03000DD0 - ldrb r1, [r2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - mov r1, r8 - adds r6, r0, r1 - movs r0, 0x1A - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r3, r0, r1 - movs r1, 0 - ldrsh r0, [r5, r1] - adds r7, r2, 0 - cmp r0, 0 - beq _08030B64 - cmp r0, 0x1 - beq _08030B7C - b _08030B98 - .pool -_08030B64: - ldr r1, [r3, 0x1C] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08030BBA - ldrb r1, [r3, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r3, 0x1] - b _08030B98 - .pool -_08030B7C: - movs r1, 0x16 - ldrsh r0, [r6, r1] - cmp r0, 0x5F - ble _08030BBA - adds r0, r4, 0 - bl DestroyTask - ldrb r1, [r7] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - mov r1, r8 - adds r2, r0, r1 - b _08030BAA -_08030B98: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - ldr r2, =gTasks - ldrb r1, [r7] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r2, r0, r2 -_08030BAA: - ldrh r3, [r2, 0x16] - movs r0, 0x16 - ldrsh r1, [r2, r0] - ldr r0, =0x00003fff - cmp r1, r0 - bgt _08030BBA - adds r0, r3, 0x1 - strh r0, [r2, 0x16] -_08030BBA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8030B14 - - thumb_func_start task_new_game_prof_birch_speech_6 -task_new_game_prof_birch_speech_6: @ 8030BCC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_8197224 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - bne _08030BFE - ldr r0, =gUnknown_02022D04 - strb r1, [r0] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082C8BD0 - bl StringExpandPlaceholders - movs r0, 0x1 - bl AddTextPrinterForMessage - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_new_game_prof_birch_speech_7 - str r1, [r0] -_08030BFE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_6 - - thumb_func_start task_new_game_prof_birch_speech_7 -task_new_game_prof_birch_speech_7: @ 8030C18 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl sub_8197224 - lsls r0, 16 - cmp r0, 0 - bne _08030C7C - ldr r5, =gSprites - ldr r0, =gTasks - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 3 - adds r4, r0 - movs r1, 0x18 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r3, [r1, 0x1] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1, 0x1] - movs r0, 0x1A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - ands r2, r1 - orrs r2, r3 - strb r2, [r0, 0x1] - adds r0, r6, 0 - movs r1, 0x2 - bl sub_8031ACC - adds r0, r6, 0 - movs r1, 0x1 - bl sub_8031C88 - movs r0, 0x40 - strh r0, [r4, 0x16] - ldr r0, =task_new_game_prof_birch_speech_8 - str r0, [r4] -_08030C7C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_7 - - thumb_func_start task_new_game_prof_birch_speech_8 -task_new_game_prof_birch_speech_8: @ 8030C90 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r2, r1, r2 - ldrh r3, [r2, 0x10] - movs r0, 0x10 - ldrsh r1, [r2, r0] - movs r0, 0x3C - negs r0, r0 - cmp r1, r0 - beq _08030CC0 - subs r0, r3, 0x2 - strh r0, [r2, 0x10] - ldrh r1, [r2, 0x10] - movs r0, 0x14 - bl SetGpuReg - b _08030CC8 - .pool -_08030CC0: - ldr r0, =0x0000ffc4 - strh r0, [r2, 0x10] - ldr r0, =task_new_game_prof_birch_speech_9 - str r0, [r2] -_08030CC8: - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_8 - - thumb_func_start task_new_game_prof_birch_speech_9 -task_new_game_prof_birch_speech_9: @ 8030CD4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08030D7A - ldr r2, =gSprites - movs r0, 0x18 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r7, 0x4 - orrs r1, r7 - strb r1, [r0] - movs r0, 0x1A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r7 - strb r1, [r0] - ldrh r0, [r4, 0x16] - movs r1, 0x16 - ldrsh r6, [r4, r1] - cmp r6, 0 - beq _08030D34 - subs r0, 0x1 - strh r0, [r4, 0x16] - b _08030D7A - .pool -_08030D34: - ldrb r3, [r4, 0x1C] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r1, r2 - movs r0, 0xB4 - strh r0, [r1, 0x20] - movs r0, 0x3C - strh r0, [r1, 0x22] - movs r2, 0x3E - adds r2, r1 - mov r12, r2 - ldrb r2, [r2] - subs r0, 0x41 - ands r0, r2 - mov r2, r12 - strb r0, [r2] - ldrb r2, [r1, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r7 - strb r0, [r1, 0x1] - strh r3, [r4, 0xC] - strh r6, [r4, 0x14] - adds r0, r5, 0 - movs r1, 0x2 - bl sub_8031BAC - adds r0, r5, 0 - movs r1, 0x1 - bl sub_8031D34 - ldr r0, =task_new_game_prof_birch_speech_10 - str r0, [r4] -_08030D7A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_9 - - thumb_func_start task_new_game_prof_birch_speech_10 -task_new_game_prof_birch_speech_10: @ 8030D84 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r3, r1, r2 - movs r1, 0x12 - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _08030DB8 - ldr r2, =gSprites - movs r1, 0xC - ldrsh r0, [r3, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, =task_new_game_prof_birch_speech_11 - str r0, [r3] -_08030DB8: - pop {r0} - bx r0 - .pool - thumb_func_end task_new_game_prof_birch_speech_10 - thumb_func_start task_new_game_prof_birch_speech_11 task_new_game_prof_birch_speech_11: @ 8030DC8 push {r4,lr} diff --git a/src/main_menu.c b/src/main_menu.c index ed9fef53a5..9ae3e6af03 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -4,14 +4,15 @@ #include "bg.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/species.h" #include "decompress.h" #include "event_data.h" #include "gpu_regs.h" #include "main.h" #include "menu.h" #include "menu_indicators.h" -#include "new_menu_helpers.h" #include "palette.h" +#include "pokeball.h" #include "rtc.h" #include "save.h" #include "scanline_effect.h" @@ -60,7 +61,7 @@ extern u8 gJPText_No1MSubCircuit[]; extern u16 gUnknown_02022D06; extern struct WindowTemplate gUnknown_082FF070[]; extern u8 gText_BatteryRunDry[]; -extern struct TextColor gUnknown_082FF0E0; +extern u8 gUnknown_082FF0E0[]; extern u8 gText_MainMenuNewGame[]; extern struct WindowTemplate gUnknown_082FF048[]; extern struct ArrowStruct gUnknown_082FF0F4; @@ -80,6 +81,9 @@ extern u16 gUnknown_082FF028[]; extern struct WindowTemplate gUnknown_082FF080[]; extern u8 gUnknown_082C897B[]; extern u8 gText_ThisIsAPokemon[]; +extern u8 gUnknown_082C8A1F[]; +extern u8 gUnknown_02022D04; +extern u8 gUnknown_082C8BD0[]; u32 InitMainMenu(bool8); void Task_MainMenuCheckSaveFile(u8); @@ -107,6 +111,15 @@ void sub_8032318(u8); void task_new_game_prof_birch_speech_4(u8); void task_new_game_prof_birch_speech_5(u8); void sub_80323A0(struct TextPrinter*, u16); +void task_new_game_prof_birch_speech_6(u8); +void sub_8030B14(u8); +void task_new_game_prof_birch_speech_7(u8); +void sub_8031ACC(u8, u8); +void sub_8031C88(u8, u8); +void task_new_game_prof_birch_speech_8(u8); +void task_new_game_prof_birch_speech_9(u8); +void task_new_game_prof_birch_speech_10(u8); +void task_new_game_prof_birch_speech_11(u8); extern void LoadMainMenuWindowFrameTiles(u8, u16); extern bool8 sub_80093CC(void); @@ -367,8 +380,8 @@ void Task_DisplayMainMenu(u8 taskId) default: FillWindowPixelBuffer(0, 0xAA); FillWindowPixelBuffer(1, 0xAA); - box_print(0, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuNewGame); - box_print(1, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuOption); + box_print(0, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuNewGame); + box_print(1, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuOption); PutWindowTilemap(0); PutWindowTilemap(1); CopyWindowToVram(0, 2); @@ -380,9 +393,9 @@ void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(2, 0xAA); FillWindowPixelBuffer(3, 0xAA); FillWindowPixelBuffer(4, 0xAA); - box_print(2, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuContinue); - box_print(3, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuNewGame); - box_print(4, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuOption); + box_print(2, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuContinue); + box_print(3, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuNewGame); + box_print(4, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuOption); fmt_savegame(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -399,10 +412,10 @@ void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(3, 0xAA); FillWindowPixelBuffer(4, 0xAA); FillWindowPixelBuffer(5, 0xAA); - box_print(2, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuContinue); - box_print(3, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuNewGame); - box_print(4, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuMysteryGift); - box_print(5, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuOption); + box_print(2, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuContinue); + box_print(3, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuNewGame); + box_print(4, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuMysteryGift); + box_print(5, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuOption); fmt_savegame(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -423,11 +436,11 @@ void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(4, 0xAA); FillWindowPixelBuffer(5, 0xAA); FillWindowPixelBuffer(6, 0xAA); - box_print(2, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuContinue); - box_print(3, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuNewGame); - box_print(4, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuMysteryGift2); - box_print(5, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuMysteryEvents); - box_print(6, 1, 0, 1, &gUnknown_082FF0E0, -1, gText_MainMenuOption); + box_print(2, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuContinue); + box_print(3, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuNewGame); + box_print(4, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuMysteryGift2); + box_print(5, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuMysteryEvents); + box_print(6, 1, 0, 1, gUnknown_082FF0E0, -1, gText_MainMenuOption); fmt_savegame(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -909,3 +922,130 @@ void task_new_game_prof_birch_speech_4(u8 taskId) gUnknown_03000DD0 = taskId; } } + +void task_new_game_prof_birch_speech_5(u8 taskId) +{ + if (!sub_8197224()) + { + StringExpandPlaceholders(gStringVar4, gUnknown_082C8A1F); + AddTextPrinterForMessage(1); + gTasks[taskId].func = task_new_game_prof_birch_speech_6; + } +} + +void sub_8030A70(u8 taskId) +{ + u8 spriteId = gTasks[gUnknown_03000DD0].data[9]; + + gSprites[spriteId].pos1.x = 0x64; + gSprites[spriteId].pos1.y = 0x4B; + gSprites[spriteId].invisible = 0; + gSprites[spriteId].data[0] = 0; + + CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 0x70, 0x3A, 0, 0, 0x20, 0xFFFF, SPECIES_LOTAD); + gTasks[taskId].func = sub_8030B14; + gTasks[gUnknown_03000DD0].data[7] = 0; +} + +void sub_8030B14(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + struct Sprite *sprite = &gSprites[gTasks[gUnknown_03000DD0].data[9]]; + + switch (data[0]) + { + case 0: + if (sprite->callback == SpriteCallbackDummy) + { + sprite->oam.affineMode = 0; + goto _08030B98_inc_data0; + } + break; + case 1: + if (gTasks[gUnknown_03000DD0].data[7] >= 0x60) + { + DestroyTask(taskId); + if (gTasks[gUnknown_03000DD0].data[7] < 0x4000) + gTasks[gUnknown_03000DD0].data[7]++; + } + break; + _08030B98_inc_data0: + default: + data[0]++; + if (gTasks[gUnknown_03000DD0].data[7] < 0x4000) + gTasks[gUnknown_03000DD0].data[7]++; + break; + } +} + +void task_new_game_prof_birch_speech_6(u8 taskId) +{ + if (!sub_8197224()) + { + gUnknown_02022D04 = 0; + StringExpandPlaceholders(gStringVar4, gUnknown_082C8BD0); + AddTextPrinterForMessage(1); + gTasks[taskId].func = task_new_game_prof_birch_speech_7; + } +} + +void task_new_game_prof_birch_speech_7(u8 taskId) +{ + if (!sub_8197224()) + { + gSprites[gTasks[taskId].data[8]].oam.objMode = 1; + gSprites[gTasks[taskId].data[9]].oam.objMode = 1; + sub_8031ACC(taskId, 2); + sub_8031C88(taskId, 1); + gTasks[taskId].data[7] = 0x40; + gTasks[taskId].func = task_new_game_prof_birch_speech_8; + } +} + +void task_new_game_prof_birch_speech_8(u8 taskId) +{ + if (gTasks[taskId].data[4] != -60) + { + gTasks[taskId].data[4] -= 2; + SetGpuReg(REG_OFFSET_BG1HOFS, gTasks[taskId].data[4]); + } + else + { + gTasks[taskId].data[4] = -60; + gTasks[taskId].func = task_new_game_prof_birch_speech_9; + } +} + +void task_new_game_prof_birch_speech_9(u8 taskId) +{ + if (gTasks[taskId].data[5]) + { + gSprites[gTasks[taskId].data[8]].invisible = 1; + gSprites[gTasks[taskId].data[9]].invisible = 1; + if (gTasks[taskId].data[7]) + gTasks[taskId].data[7]--; + else + { + u8 spriteId = gTasks[taskId].data[10]; + + gSprites[spriteId].pos1.x = 0xB4; + gSprites[spriteId].pos1.y = 0x3C; + gSprites[spriteId].invisible = 0; + gSprites[spriteId].oam.objMode = 1; + gTasks[taskId].data[2] = spriteId; + gTasks[taskId].data[6] = 0; + sub_8031BAC(taskId, 2); + sub_8031D34(taskId, 1); + gTasks[taskId].func = task_new_game_prof_birch_speech_10; + } + } +} + +void task_new_game_prof_birch_speech_10(u8 taskId) +{ + if (gTasks[taskId].data[5]) + { + gSprites[gTasks[taskId].data[2]].oam.objMode = 0; + gTasks[taskId].func = task_new_game_prof_birch_speech_11; + } +}