From 5a57485ece9686eadaf2a96365aa285587ab51af Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 23 Jan 2018 21:30:13 -0600 Subject: [PATCH] Decompile naming_screen.c --- asm/battle_frontier_1.s | 6 +- asm/field_effect.s | 26 +- asm/field_player_avatar.s | 6 +- asm/naming_screen.s | 4267 --------------------------------- asm/overworld.s | 2 +- asm/party_menu.s | 2 +- asm/pokemon_icon.s | 8 +- asm/slot_machine.s | 4 +- asm/trade.s | 8 +- data/naming_screen.s | 346 --- graphics/intro/copyright.png | Bin 538 -> 530 bytes graphics_file_rules.mk | 3 - include/field_effect.h | 1 + include/field_player_avatar.h | 1 + include/field_specials.h | 2 + include/gba/macro.h | 21 + include/main.h | 2 + include/naming_screen.h | 91 +- include/new_menu_helpers.h | 2 + include/pokemon_icon.h | 2 + include/strings.h | 3 + include/text.h | 7 + ld_script.txt | 4 +- src/naming_screen.c | 2177 +++++++++++++++++ sym_ewram.txt | 2 +- 25 files changed, 2337 insertions(+), 4656 deletions(-) delete mode 100644 asm/naming_screen.s delete mode 100644 data/naming_screen.s create mode 100644 src/naming_screen.c diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index c2517586ea..91c8215e52 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -7096,7 +7096,7 @@ _081926B0: movs r1, 0x1 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] @@ -8779,7 +8779,7 @@ _081934B0: mov r1, r10 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] @@ -8927,7 +8927,7 @@ _081935FA: movs r1, 0x1 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] diff --git a/asm/field_effect.s b/asm/field_effect.s index 770f1932ce..80f2030aaf 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -764,8 +764,8 @@ _080B608E: bx r0 thumb_func_end sub_80B6070 - thumb_func_start sub_80B609C -sub_80B609C: @ 80B609C + thumb_func_start MultiplyInvertedPaletteRGBComponents +MultiplyInvertedPaletteRGBComponents: @ 80B609C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -832,7 +832,7 @@ sub_80B609C: @ 80B609C pop {r0} bx r0 .pool - thumb_func_end sub_80B609C + thumb_func_end MultiplyInvertedPaletteRGBComponents thumb_func_start sub_80B6128 sub_80B6128: @ 80B6128 @@ -1469,7 +1469,7 @@ _080B65D8: mov r9, r3 add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] adds r4, 0x2 mov r0, r8 @@ -1488,7 +1488,7 @@ _080B65D8: ldrb r2, [r2] add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] adds r4, 0x1 mov r3, r8 @@ -1507,7 +1507,7 @@ _080B65D8: ldrb r2, [r2] add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] lsls r4, 24 lsrs r4, 24 @@ -1527,7 +1527,7 @@ _080B65D8: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r10 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1538,7 +1538,7 @@ _080B65D8: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents movs r3, 0x34 ldrsh r0, [r7, r3] cmp r0, 0x2 @@ -1612,7 +1612,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1624,7 +1624,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1636,7 +1636,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1647,7 +1647,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1658,7 +1658,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents pop {r3} mov r8, r3 pop {r4-r6} diff --git a/asm/field_player_avatar.s b/asm/field_player_avatar.s index 5385e2ebad..1e7d331c76 100644 --- a/asm/field_player_avatar.s +++ b/asm/field_player_avatar.s @@ -2602,8 +2602,8 @@ _0808BD2C: .pool thumb_func_end sub_808BCF4 - thumb_func_start sub_808BD3C -sub_808BD3C: @ 808BD3C + thumb_func_start GetRivalAvatarGraphicsIdByStateIdAndGender +GetRivalAvatarGraphicsIdByStateIdAndGender: @ 808BD3C lsls r0, 24 lsls r1, 24 lsrs r1, 24 @@ -2614,7 +2614,7 @@ sub_808BD3C: @ 808BD3C ldrb r0, [r1] bx lr .pool - thumb_func_end sub_808BD3C + thumb_func_end GetRivalAvatarGraphicsIdByStateIdAndGender thumb_func_start GetPlayerAvatarGraphicsIdByStateIdAndGender @ u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 stateId, u8 gender) diff --git a/asm/naming_screen.s b/asm/naming_screen.s deleted file mode 100644 index 07ec0662f9..0000000000 --- a/asm/naming_screen.s +++ /dev/null @@ -1,4267 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start DoNamingScreen -@ int DoNamingScreen(u8 type, sav2 *sav2_ptr, s16 player_gender, s16 a4, int a5, void ( *after_finishing_callback)()) -DoNamingScreen: @ 80E2D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r1 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r2, 16 - lsrs r5, r2, 16 - lsls r3, 16 - lsrs r6, r3, 16 - ldr r4, =gUnknown_02039F94 - movs r0, 0xF2 - lsls r0, 5 - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _080E2DA8 - ldr r0, [sp, 0x1C] - bl SetMainCallback2 - b _080E2DE2 - .pool -_080E2DA8: - ldr r1, =0x00001e2c - adds r0, r1 - strb r7, [r0] - ldr r0, [r4] - ldr r2, =0x00001e34 - adds r1, r0, r2 - strh r5, [r1] - adds r2, 0x2 - adds r1, r0, r2 - strh r6, [r1] - ldr r1, =0x00001e38 - adds r2, r0, r1 - ldr r1, [sp, 0x18] - str r1, [r2] - ldr r2, =0x00001e30 - adds r1, r0, r2 - mov r2, r8 - str r2, [r1] - ldr r1, =0x00001e3c - adds r0, r1 - ldr r2, [sp, 0x1C] - str r2, [r0] - cmp r7, 0 - bne _080E2DDC - bl StartTimer1 -_080E2DDC: - ldr r0, =c2_choose_name_or_words_screen - bl SetMainCallback2 -_080E2DE2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DoNamingScreen - - thumb_func_start c2_choose_name_or_words_screen -c2_choose_name_or_words_screen: @ 80E2E04 - push {lr} - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x7 - bhi _080E2E9C - lsls r0, 2 - ldr r1, =_080E2E28 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E2E28: - .4byte _080E2E48 - .4byte _080E2E52 - .4byte _080E2E58 - .4byte _080E2E5E - .4byte _080E2E68 - .4byte _080E2E6E - .4byte _080E2E74 - .4byte _080E2E7A -_080E2E48: - bl sub_80E4F70 - bl choose_name_or_words_screen_setup - b _080E2E86 -_080E2E52: - bl choose_name_or_words_screen_init_bgs - b _080E2E86 -_080E2E58: - bl ResetPaletteFade - b _080E2E86 -_080E2E5E: - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080E2E86 -_080E2E68: - bl ResetTasks - b _080E2E86 -_080E2E6E: - bl choose_name_or_words_screen_apply_bg_pals - b _080E2E86 -_080E2E74: - bl choose_name_or_words_screen_load_bg_tile_patterns - b _080E2E86 -_080E2E7A: - bl sub_80E3CC8 - bl UpdatePaletteFade - bl sub_80E501C -_080E2E86: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080E2EA4 - .pool -_080E2E9C: - bl sub_80E4CB8 - bl sub_80E3194 -_080E2EA4: - pop {r0} - bx r0 - thumb_func_end c2_choose_name_or_words_screen - - thumb_func_start choose_name_or_words_screen_setup -@ void choose_name_or_words_screen_setup() -choose_name_or_words_screen_setup: @ 80E2EA8 - push {r4-r7,lr} - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e10 - adds r0, r1 - movs r2, 0 - strb r2, [r0] - ldr r1, [r5] - ldr r3, =0x00001e18 - adds r0, r1, r3 - movs r4, 0 - strh r2, [r0] - ldr r7, =0x00001e1a - adds r0, r1, r7 - strh r2, [r0] - ldr r0, =0x00001e1c - adds r2, r1, r0 - movs r3, 0x1 - movs r0, 0x1 - strh r0, [r2] - adds r7, 0x4 - adds r2, r1, r7 - movs r0, 0x2 - strh r0, [r2] - movs r0, 0xF1 - lsls r0, 5 - adds r1, r0 - strb r4, [r1] - ldr r0, [r5] - ldr r1, =0x00001e21 - adds r0, r1 - strb r3, [r0] - ldr r1, [r5] - ldr r6, =0x00001e28 - adds r3, r1, r6 - ldr r2, =gUnknown_0858BFD8 - ldr r4, =0x00001e2c - adds r0, r1, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - str r0, [r3] - ldrb r0, [r0, 0x4] - ldr r2, =0x00001e22 - adds r1, r2 - strb r0, [r1] - ldr r2, [r5] - adds r0, r2, r6 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 3 - movs r0, 0xF0 - subs r0, r1 - asrs r3, r0, 1 - adds r0, r3, 0x6 - subs r7, 0x8 - adds r1, r2, r7 - strh r0, [r1] - adds r2, r4 - ldrb r0, [r2] - cmp r0, 0x4 - bne _080E2F2C - adds r0, r3, 0 - adds r0, 0x11 - strh r0, [r1] -_080E2F2C: - ldr r0, [r5] - ldr r4, =gKeyRepeatStartDelay - ldrh r1, [r4] - ldr r2, =0x00001e25 - adds r0, r2 - strb r1, [r0] - ldr r0, [r5] - movs r3, 0xC0 - lsls r3, 5 - adds r0, r3 - movs r1, 0xFF - movs r2, 0x10 - bl memset - ldr r1, [r5] - adds r0, r1, r6 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _080E2F64 - movs r7, 0xC0 - lsls r7, 5 - adds r0, r1, r7 - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy -_080E2F64: - movs r0, 0x10 - strh r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_setup - - thumb_func_start sub_80E2FA4 -sub_80E2FA4: @ 80E2FA4 - push {r4,r5,lr} - movs r3, 0 - ldr r4, =gSprites - movs r5, 0x5 - negs r5, r5 -_080E2FAE: - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r4 - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - lsls r0, r1, 31 - cmp r0, 0 - beq _080E2FC8 - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2] -_080E2FC8: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3F - bls _080E2FAE - movs r0, 0 - bl sub_80E3E3C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E2FA4 - - thumb_func_start choose_name_or_words_screen_init_bgs -choose_name_or_words_screen_init_bgs: @ 80E2FE4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0xC - mov r8, r0 - add r2, sp, 0x8 - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_080E300A: - strh r6, [r2] - add r0, sp, 0x8 - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _080E300A - strh r6, [r2] - add r2, sp, 0x8 - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0xC] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - add r0, sp, 0x8 - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0858BE00 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl sub_81971D0 - bl sub_8197200 -_080E30D8: - lsls r0, r4, 3 - ldr r1, =gUnknown_0858BE10 - adds r0, r1 - bl AddWindow - ldr r5, =gUnknown_02039F94 - ldr r1, [r5] - ldr r2, =0x00001e11 - adds r1, r2 - adds r1, r4 - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _080E30D8 - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r1, 0xC8 - lsls r1, 3 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x0000080c - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r5] - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r5] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r5] - movs r2, 0x80 - lsls r2, 5 - adds r1, r2 - movs r0, 0x3 - bl SetBgTilemapBuffer - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_init_bgs - - thumb_func_start sub_80E3194 -sub_80E3194: @ 80E3194 - push {lr} - ldr r0, =sub_80E31B0 - movs r1, 0x2 - bl CreateTask - ldr r0, =sub_80E4F58 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3194 - - thumb_func_start sub_80E31B0 -sub_80E31B0: @ 80E31B0 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x9 - bhi _080E3240 - lsls r0, 2 - ldr r1, =_080E31D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E31D8: - .4byte _080E3200 - .4byte _080E320E - .4byte _080E3218 - .4byte _080E3214 - .4byte _080E321E - .4byte _080E3224 - .4byte _080E322A - .4byte _080E3230 - .4byte _080E3236 - .4byte _080E323C -_080E3200: - bl sub_80E3294 - bl sub_80E2FA4 - bl sub_80E4F84 - b _080E3240 -_080E320E: - bl sub_80E335C - b _080E3240 -_080E3214: - bl sub_80E33A8 -_080E3218: - bl sub_80E3398 - b _080E3240 -_080E321E: - bl sub_80E3640 - b _080E3240 -_080E3224: - bl sub_80E3680 - b _080E3240 -_080E322A: - bl pokemon_store - b _080E3240 -_080E3230: - bl sub_80E3604 - b _080E3240 -_080E3236: - bl sub_80E3448 - b _080E3240 -_080E323C: - bl sub_80E347C -_080E3240: - pop {r0} - bx r0 - thumb_func_end sub_80E31B0 - - thumb_func_start sub_80E3244 -sub_80E3244: @ 80E3244 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0858BEBB - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3244 - - thumb_func_start sub_80E3254 -sub_80E3254: @ 80E3254 - ldr r1, =gUnknown_0858BEBE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3254 - - thumb_func_start sub_80E3274 -sub_80E3274: @ 80E3274 - ldr r1, =gUnknown_0858BEC1 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3274 - - thumb_func_start sub_80E3294 -sub_80E3294: @ 80E3294 - push {r4-r6,lr} - sub sp, 0x4 - ldr r1, =gUnknown_08DD4544 - movs r0, 0x3 - bl sub_80E4CF8 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e22 - adds r0, r1 - movs r6, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r1, =gUnknown_08DD46E0 - movs r0, 0x2 - bl sub_80E4CF8 - ldr r1, =gUnknown_08DD4620 - movs r0, 0x1 - bl sub_80E4CF8 - ldr r0, [r5] - ldr r1, =0x00001e12 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl sub_80E4DE4 - ldr r0, [r5] - ldr r1, =0x00001e11 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_80E4DE4 - movs r0, 0x2 - movs r1, 0 - bl nullsub_10 - movs r0, 0x1 - movs r1, 0x1 - bl nullsub_10 - bl sub_80E4D10 - bl sub_80E4964 - bl sub_80E4EF0 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - str r6, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r5] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3294 - - thumb_func_start sub_80E335C -sub_80E335C: @ 80E335C - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080E3384 - movs r0, 0x1 - bl sub_80E4630 - movs r0, 0x1 - bl sub_80E3E94 - ldr r0, =gUnknown_02039F94 - ldr r1, [r0] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080E3384: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E335C - - thumb_func_start sub_80E3398 -sub_80E3398: @ 80E3398 - push {lr} - bl sub_80E44BC - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80E3398 - - thumb_func_start sub_80E33A8 -sub_80E33A8: @ 80E33A8 - push {lr} - bl sub_80E3F04 - lsls r0, 24 - cmp r0, 0 - beq _080E33CA - movs r0, 0x1 - bl sub_80E4630 - bl sub_80E3E28 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] -_080E33CA: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E33A8 - - thumb_func_start pokemon_store -pokemon_store: @ 80E33D8 - push {r4,lr} - bl sub_80E4BE4 - movs r0, 0 - bl sub_80E4630 - movs r0, 0 - bl sub_80E3E94 - movs r0, 0x3 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 - ldr r4, =gUnknown_02039F94 - ldr r0, [r4] - ldr r1, =0x00001e2c - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _080E342C - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _080E342C - bl pokemon_transfer_to_pc_with_message - ldr r0, [r4] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x7 - strb r1, [r0] - movs r0, 0 - b _080E343A - .pool -_080E342C: - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] - movs r0, 0x1 -_080E343A: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end pokemon_store - - thumb_func_start sub_80E3448 -sub_80E3448: @ 80E3448 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_02039F94 - ldr r1, [r0] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3448 - - thumb_func_start sub_80E347C -sub_80E347C: @ 80E347C - push {r4,r5,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _080E34C6 - ldr r4, =gUnknown_02039F94 - ldr r0, [r4] - ldr r1, =0x00001e2c - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080E34A0 - bl SeedRngAndSetTrainerId -_080E34A0: - ldr r0, [r4] - ldr r1, =0x00001e3c - adds r0, r1 - ldr r0, [r0] - bl SetMainCallback2 - ldr r0, =sub_80E31B0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - bl FreeAllWindowBuffers - ldr r0, [r4] - bl Free - str r5, [r4] -_080E34C6: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E347C - - thumb_func_start pokemon_transfer_to_pc_with_message -pokemon_transfer_to_pc_with_message: @ 80E34E4 - push {r4,r5,lr} - sub sp, 0x10 - movs r5, 0 - bl sub_813B260 - lsls r0, 24 - cmp r0, 0 - bne _080E3534 - ldr r4, =gStringVar1 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - b _080E3574 - .pool -_080E3534: - ldr r4, =gStringVar1 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r4, =gStringVar3 - bl get_unknown_box_id - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - movs r5, 0x2 -_080E3574: - ldr r0, =0x000008ab - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080E3586 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_080E3586: - ldr r4, =gStringVar4 - ldr r1, =gUnknown_0858BDB8 - lsls r0, r5, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParametrized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_transfer_to_pc_with_message - - thumb_func_start sub_80E3604 -sub_80E3604: @ 80E3604 - push {lr} - bl RunTextPrinters - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080E362E - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080E362E - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] -_080E362E: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3604 - - thumb_func_start sub_80E3640 -sub_80E3640: @ 80E3640 - push {lr} - movs r0, 0 - bl sub_80E4630 - bl sub_80E4050 - bl sub_80E373C - movs r0, 0x1 - bl sub_80E3E3C - movs r0, 0 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 - movs r0, 0x6 - bl PlaySE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3640 - - thumb_func_start sub_80E3680 -sub_80E3680: @ 80E3680 - push {r4-r6,lr} - sub sp, 0x4 - bl sub_80E3794 - lsls r0, 24 - cmp r0, 0 - beq _080E3732 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl sub_80E3DFC - bl sub_80E3F70 - movs r5, 0 - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r0, 24 - lsrs r0, 24 - adds r6, r4, 0 - cmp r1, r0 - bne _080E36B2 - movs r5, 0x1 -_080E36B2: - ldr r2, =gUnknown_02039F94 - ldr r0, [r2] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r1, [r2] - ldr r3, =0x00001e22 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r4, [r2] - adds r4, r3 - ldrb r0, [r4] - movs r1, 0x3 - bl __umodsi3 - strb r0, [r4] - cmp r5, 0 - beq _080E36F4 - mov r4, sp - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - b _080E3712 - .pool -_080E36F4: - mov r0, sp - movs r2, 0 - ldrsh r4, [r0, r2] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _080E3714 - mov r4, sp - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 -_080E3712: - strh r0, [r4] -_080E3714: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r6, r2] - bl sub_80E3D78 - bl sub_80E4E5C - movs r0, 0x1 - bl sub_80E4630 - movs r0, 0 - bl sub_80E3E3C -_080E3732: - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80E3680 - - thumb_func_start sub_80E373C -sub_80E373C: @ 80E373C - push {r4,lr} - ldr r4, =sub_80E375C - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E373C - - thumb_func_start sub_80E375C -sub_80E375C: @ 80E375C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0858BEC4 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_080E376E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080E376E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E375C - - thumb_func_start sub_80E3794 -sub_80E3794: @ 80E3794 - push {lr} - ldr r0, =sub_80E375C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _080E37AC - movs r0, 0 - b _080E37AE - .pool -_080E37AC: - movs r0, 0x1 -_080E37AE: - pop {r1} - bx r1 - thumb_func_end sub_80E3794 - - thumb_func_start sub_80E37B4 -sub_80E37B4: @ 80E37B4 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r3, =0x00001e18 - adds r2, r1, r3 - movs r3, 0 - strh r3, [r2] - ldr r2, =0x00001e1a - adds r1, r2 - strh r3, [r1] - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - movs r0, 0 - bx lr - .pool - thumb_func_end sub_80E37B4 - - thumb_func_start sub_80E37DC -sub_80E37DC: @ 80E37DC - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r2, =0x00001e1a - adds r1, r0, r2 - str r1, [sp] - ldr r1, =0x00001e18 - adds r0, r1 - str r0, [sp, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x4 - strh r0, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - movs r1, 0x28 - bl Sin - ldr r1, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - ldrh r0, [r4, 0xA] - adds r0, 0x80 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x28 - bl Sin - ldr r1, [r5] - ldr r2, =0x00001e21 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _080E3852 - ldr r0, [r5] - ldr r1, =0x00001e1c - adds r2, r0, r1 - ldrb r3, [r2] - adds r1, 0x2 - adds r0, r1 - ldrh r1, [r0] - strh r1, [r2] - strh r3, [r0] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080E3852: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E37DC - - thumb_func_start sub_80E3870 -sub_80E3870: @ 80E3870 - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r2, =0x00001e1a - adds r1, r0, r2 - str r1, [sp] - ldr r3, =0x00001e18 - adds r0, r3 - str r0, [sp, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x4 - strh r0, [r4, 0xA] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0x28 - bl Sin - ldr r1, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - ldrh r0, [r4, 0xA] - adds r0, 0x80 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x28 - bl Sin - ldr r1, [r5] - ldr r3, =0x00001e21 - adds r1, r3 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _080E38EA - ldr r0, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r0, r2 - ldrb r2, [r1] - adds r0, r3 - ldrb r0, [r0] - strb r0, [r1] - ldr r0, [r5] - adds r0, r3 - strb r2, [r0] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080E38EA: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3870 - - thumb_func_start sub_80E3904 -sub_80E3904: @ 80E3904 - push {lr} - ldr r0, =sub_80E375C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3904 - - thumb_func_start sub_80E3920 -sub_80E3920: @ 80E3920 - push {lr} - ldr r0, =c3_0809E58C - movs r1, 0x3 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0x3 - strh r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3920 - - thumb_func_start sub_80E3948 -sub_80E3948: @ 80E3948 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r0, =c3_0809E58C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r5, r0 - bne _080E3988 - cmp r6, 0 - bne _080E3988 - strh r7, [r4, 0xA] - movs r0, 0x1 - strh r0, [r4, 0xC] - b _080E39B4 - .pool -_080E3988: - cmp r5, 0x3 - bne _080E3998 - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _080E3998 - cmp r6, 0 - beq _080E39B4 -_080E3998: - ldrh r1, [r4, 0x8] - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - beq _080E39AA - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_80E3AE8 -_080E39AA: - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r7, 0 - bl sub_80E3B10 -_080E39B4: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E3948 - - thumb_func_start c3_0809E58C -c3_0809E58C: @ 80E39BC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - ldrh r1, [r4, 0x8] - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - beq _080E3A6E - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _080E3A6E - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_80E3A74 - lsls r0, 16 - lsrs r0, 16 - ldrb r3, [r4, 0xE] - adds r1, r3, 0 - adds r2, r3, 0 - bl sub_80B609C - ldrh r1, [r4, 0x12] - movs r2, 0x12 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080E3A08 - subs r0, r1, 0x1 - strh r0, [r4, 0x12] - lsls r0, 16 - cmp r0, 0 - bne _080E3A6E -_080E3A08: - movs r0, 0x2 - strh r0, [r4, 0x12] - ldrh r1, [r4, 0x10] - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r0, 0 - blt _080E3A32 - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0xD - bgt _080E3A28 - adds r0, r2, r1 - b _080E3A36 - .pool -_080E3A28: - movs r0, 0x10 - strh r0, [r4, 0xE] - ldrh r0, [r4, 0x14] - adds r0, 0x1 - b _080E3A3C -_080E3A32: - ldrh r3, [r4, 0xE] - adds r0, r1, r3 -_080E3A36: - strh r0, [r4, 0xE] - ldrh r2, [r4, 0x14] - adds r0, r1, r2 -_080E3A3C: - strh r0, [r4, 0x14] - movs r3, 0xE - ldrsh r0, [r4, r3] - ldrh r1, [r4, 0xE] - cmp r0, 0x10 - bne _080E3A5C - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0x16 - bne _080E3A5C - ldr r0, =0x0000fffc - strh r0, [r4, 0x10] - b _080E3A6E - .pool -_080E3A5C: - lsls r0, r1, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _080E3A6E - ldrh r0, [r4, 0xA] - strh r0, [r4, 0xC] - movs r0, 0x2 - strh r0, [r4, 0x10] - strh r1, [r4, 0x14] -_080E3A6E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end c3_0809E58C - - thumb_func_start sub_80E3A74 -sub_80E3A74: @ 80E3A74 - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x4 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - movs r1, 0x87 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - add r6, sp, 0x8 - strh r0, [r6] - movs r0, 0x6 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - adds r0, r5 - mov r1, sp - adds r1, 0xA - strh r0, [r1] - movs r0, 0x7 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - adds r0, r5 - add r1, sp, 0xC - strh r0, [r1] - movs r0, 0x7 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - ldr r1, =0x00000101 - adds r0, r1 - mov r1, sp - adds r1, 0xE - strh r0, [r1] - mov r0, sp - adds r1, r6, 0 - movs r2, 0x8 - bl memcpy - lsls r4, 1 - mov r1, sp - adds r0, r1, r4 - ldrh r0, [r0] - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3A74 - - thumb_func_start sub_80E3AE8 -sub_80E3AE8: @ 80E3AE8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_80E3A74 - lsls r0, 16 - ldr r2, =gPlttBufferFaded - lsrs r0, 15 - adds r2, r0, r2 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3AE8 - - thumb_func_start sub_80E3B10 -sub_80E3B10: @ 80E3B10 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - movs r3, 0 - strh r1, [r0, 0x8] - strh r2, [r0, 0xA] - movs r1, 0x1 - strh r1, [r0, 0xC] - movs r2, 0x4 - strh r2, [r0, 0xE] - movs r1, 0x2 - strh r1, [r0, 0x10] - strh r3, [r0, 0x12] - strh r2, [r0, 0x14] - bx lr - thumb_func_end sub_80E3B10 - - thumb_func_start sub_80E3B30 -sub_80E3B30: @ 80E3B30 - push {r4-r6,lr} - adds r5, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080E3B48 - adds r0, r5, 0 - movs r1, 0 - bl StartSpriteAnim -_080E3B48: - ldrh r0, [r5, 0x36] - movs r1, 0xFF - ands r1, r0 - adds r6, r5, 0 - adds r6, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r6] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6] - movs r0, 0x2E - ldrsh r4, [r5, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E3B7C - ldrb r0, [r6] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r6] -_080E3B7C: - ldrb r1, [r6] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080E3BAC - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _080E3BAC - movs r2, 0x2E - ldrsh r1, [r5, r2] - movs r2, 0x32 - ldrsh r0, [r5, r2] - cmp r1, r0 - bne _080E3BAC - movs r0, 0x30 - ldrsh r1, [r5, r0] - movs r2, 0x34 - ldrsh r0, [r5, r2] - cmp r1, r0 - beq _080E3BB6 -_080E3BAC: - movs r0, 0 - strh r0, [r5, 0x38] - movs r0, 0x2 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x3C] -_080E3BB6: - ldrh r0, [r5, 0x3C] - subs r0, 0x1 - strh r0, [r5, 0x3C] - lsls r0, 16 - cmp r0, 0 - bne _080E3BDE - ldrh r1, [r5, 0x3A] - ldrh r2, [r5, 0x38] - adds r0, r1, r2 - strh r0, [r5, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - beq _080E3BD6 - cmp r0, 0 - bne _080E3BDA -_080E3BD6: - negs r0, r1 - strh r0, [r5, 0x3A] -_080E3BDA: - movs r0, 0x2 - strh r0, [r5, 0x3C] -_080E3BDE: - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _080E3C14 - ldrh r4, [r5, 0x38] - lsls r5, r4, 24 - lsrs r5, 24 - lsls r4, 16 - asrs r4, 17 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 4 - ldr r2, =0x01010000 - adds r0, r2 - lsrs r0, 16 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r5, 0 - bl sub_80B609C -_080E3C14: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3B30 - - thumb_func_start sub_80E3C20 -sub_80E3C20: @ 80E3C20 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r1, =gUnknown_0858BED4 - mov r0, sp - movs r2, 0x8 - bl memcpy - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080E3C44 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _080E3C52 -_080E3C44: - movs r0, 0x8 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0x30] -_080E3C52: - movs r1, 0x30 - ldrsh r0, [r4, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r4, 0x24] - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3C20 - - thumb_func_start sub_80E3C6C -sub_80E3C6C: @ 80E3C6C - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r1, =gUnknown_0858BEDC - mov r0, sp - movs r2, 0x8 - bl memcpy - bl sub_80E4A60 - lsls r0, 24 - ldrh r1, [r4, 0x2E] - lsls r1, 24 - cmp r0, r1 - beq _080E3C98 - movs r0, 0 - strh r0, [r4, 0x26] - strh r0, [r4, 0x30] - b _080E3CBE - .pool -_080E3C98: - movs r1, 0x30 - ldrsh r0, [r4, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080E3CC0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0x30] - movs r0, 0 -_080E3CBE: - strh r0, [r4, 0x32] -_080E3CC0: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80E3C6C - - thumb_func_start sub_80E3CC8 -sub_80E3CC8: @ 80E3CC8 - push {lr} - bl sub_80E3CE4 - bl sub_80E3F8C - bl sub_80E4218 - bl sub_80E4290 - bl sub_80E4354 - pop {r0} - bx r0 - thumb_func_end sub_80E3CC8 - - thumb_func_start sub_80E3CE4 -sub_80E3CE4: @ 80E3CE4 - push {r4-r6,lr} - ldr r0, =gUnknown_0858C138 - movs r1, 0x26 - movs r2, 0x58 - movs r3, 0x1 - bl CreateSprite - ldr r5, =gUnknown_02039F94 - ldr r1, [r5] - ldr r4, =0x00001e23 - adds r1, r4 - strb r0, [r1] - movs r0, 0x1 - bl sub_80E3E3C - ldr r6, =gSprites - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r3, [r1, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r0, [r5] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x1] - ands r2, r1 - orrs r2, r3 - strb r2, [r0, 0x1] - ldr r2, [r5] - adds r2, r4 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - strh r1, [r0, 0x3A] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x2 - strh r1, [r0, 0x3A] - movs r0, 0 - movs r1, 0 - bl sub_80E3D78 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3CE4 - - thumb_func_start sub_80E3D78 -sub_80E3D78: @ 80E3D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsls r1, 16 - lsrs r7, r1, 16 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e23 - adds r1, r2 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r5, r1, r2 - lsrs r1, r0, 16 - mov r8, r1 - asrs r6, r0, 16 - ldr r4, =gUnknown_0858BEA0 - bl sub_80E3274 - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r0, [r0] - cmp r6, r0 - bge _080E3DD8 - bl sub_80E3274 - ldr r1, =gUnknown_0858BEA3 - lsls r0, 24 - lsrs r0, 21 - adds r0, r6, r0 - adds r0, r1 - ldrb r0, [r0] - adds r0, 0x26 - b _080E3DDA - .pool -_080E3DD8: - movs r0, 0 -_080E3DDA: - strh r0, [r5, 0x20] - lsls r0, r7, 16 - asrs r0, 12 - adds r0, 0x58 - strh r0, [r5, 0x22] - ldrh r0, [r5, 0x2E] - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x30] - strh r0, [r5, 0x34] - mov r2, r8 - strh r2, [r5, 0x2E] - strh r7, [r5, 0x30] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E3D78 - - thumb_func_start sub_80E3DFC -sub_80E3DFC: @ 80E3DFC - ldr r2, =gUnknown_02039F94 - ldr r2, [r2] - ldr r3, =0x00001e23 - adds r2, r3 - ldrb r3, [r2] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - ldr r3, =gSprites - adds r2, r3 - ldrh r3, [r2, 0x2E] - strh r3, [r0] - ldrh r0, [r2, 0x30] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_80E3DFC - - thumb_func_start sub_80E3E28 -sub_80E3E28: @ 80E3E28 - push {lr} - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl sub_80E3D78 - pop {r0} - bx r0 - thumb_func_end sub_80E3E28 - - thumb_func_start sub_80E3E3C -sub_80E3E3C: @ 80E3E3C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gSprites - ldr r1, =gUnknown_02039F94 - ldr r4, [r1] - ldr r1, =0x00001e23 - adds r4, r1 - ldrb r1, [r4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - ldrh r3, [r2, 0x36] - ldr r1, =0xffffff00 - ands r1, r3 - strh r1, [r2, 0x36] - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - ldrh r2, [r1, 0x36] - orrs r0, r2 - strh r0, [r1, 0x36] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0 - bl StartSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3E3C - - thumb_func_start sub_80E3E94 -sub_80E3E94: @ 80E3E94 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gSprites - ldr r1, =gUnknown_02039F94 - ldr r4, [r1] - ldr r1, =0x00001e23 - adds r4, r1 - ldrb r1, [r4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - ldrh r3, [r2, 0x36] - movs r1, 0xFF - ands r1, r3 - strh r1, [r2, 0x36] - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsrs r0, 16 - ldrh r2, [r1, 0x36] - orrs r0, r2 - strh r0, [r1, 0x36] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3E94 - - thumb_func_start sub_80E3ED8 -sub_80E3ED8: @ 80E3ED8 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e23 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3ED8 - - thumb_func_start sub_80E3F04 -sub_80E3F04: @ 80E3F04 - ldr r2, =gSprites - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e23 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_80E3F04 - - thumb_func_start sub_80E3F30 -sub_80E3F30: @ 80E3F30 - push {r4,r5,lr} - sub sp, 0x4 - mov r5, sp - adds r5, 0x2 - mov r0, sp - adds r1, r5, 0 - bl sub_80E3DFC - mov r0, sp - movs r1, 0 - ldrsh r4, [r0, r1] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _080E3F64 - ldr r0, =gUnknown_0858BEE4 - movs r2, 0 - ldrsh r1, [r5, r2] - adds r1, r0 - ldrb r0, [r1] - b _080E3F66 - .pool -_080E3F64: - movs r0, 0 -_080E3F66: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80E3F30 - - thumb_func_start sub_80E3F70 -sub_80E3F70: @ 80E3F70 - push {r4,lr} - ldr r4, =gUnknown_0858BEA0 - bl sub_80E3274 - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r0, [r0] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3F70 - - thumb_func_start sub_80E3F8C -sub_80E3F8C: @ 80E3F8C - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_0858C0C0 - movs r1, 0xCC - movs r2, 0x58 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e24 - adds r1, r2 - strb r0, [r1] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r0, =gSprites - mov r8, r0 - add r5, r8 - ldr r1, =gUnknown_0858C050 - adds r0, r5, 0 - bl SetSubspriteTables - adds r1, r5, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r6, 0x4 - orrs r0, r6 - strb r0, [r1] - ldr r0, =gUnknown_0858C0F0 - movs r1, 0xCC - movs r2, 0x54 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x3A] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r8 - ldr r1, =gUnknown_0858C058 - adds r0, r4, 0 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - orrs r0, r6 - strb r0, [r4] - ldr r0, =gUnknown_0858C0D8 - movs r1, 0xCC - movs r2, 0x53 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r6 - strb r1, [r2, 0x5] - strh r0, [r5, 0x3C] - adds r2, 0x3E - ldrb r0, [r2] - orrs r0, r6 - strb r0, [r2] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3F8C - - thumb_func_start sub_80E4050 -sub_80E4050: @ 80E4050 - ldr r0, =gUnknown_02039F94 - ldr r2, [r0] - ldr r1, =0x00001e24 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =0x00001e22 - adds r2, r1 - ldrb r1, [r2] - strh r1, [r0, 0x30] - bx lr - .pool - thumb_func_end sub_80E4050 - - thumb_func_start sub_80E4084 -sub_80E4084: @ 80E4084 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_0858BEE8 -_080E408A: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080E408A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4084 - - thumb_func_start sub_80E40AC -sub_80E40AC: @ 80E40AC - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x3A - ldrsh r0, [r6, r1] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r1, =gSprites - adds r5, r1 - movs r2, 0x3C - ldrsh r0, [r6, r2] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r1 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e22 - adds r0, r1 - ldrb r0, [r0] - bl sub_80E3244 - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_80E41B8 - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E40AC - - thumb_func_start sub_80E4100 -sub_80E4100: @ 80E4100 - movs r0, 0 - bx lr - thumb_func_end sub_80E4100 - - thumb_func_start sub_80E4104 -sub_80E4104: @ 80E4104 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0x3A - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r2, =gSprites - adds r4, r0, r2 - movs r0, 0x3C - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080E4168 - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - ldr r0, =0x0000fffc - strh r0, [r4, 0x26] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r3, 0x30] - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - bl __modsi3 - lsls r0, 24 - lsrs r0, 24 - bl sub_80E3244 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80E41B8 -_080E4168: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4104 - - thumb_func_start sub_80E4178 -sub_80E4178: @ 80E4178 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldrh r0, [r2, 0x26] - adds r0, 0x1 - strh r0, [r2, 0x26] - lsls r0, 16 - cmp r0, 0 - blt _080E41AC - movs r0, 0 - strh r0, [r2, 0x26] - movs r0, 0x1 - strh r0, [r4, 0x2E] -_080E41AC: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4178 - - thumb_func_start sub_80E41B8 -sub_80E41B8: @ 80E41B8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - adds r6, r1, 0 - mov r8, r2 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0858BEF8 - lsls r4, r5, 1 - adds r0, r4, r0 - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 4 - mov r1, r8 - ldrb r2, [r1, 0x5] - movs r1, 0xF - ands r1, r2 - orrs r1, r0 - mov r0, r8 - strb r1, [r0, 0x5] - ldr r0, =gUnknown_0858BEFE - adds r4, r0 - ldrh r0, [r4] - bl GetSpriteTileStartByTag - adds r1, r6, 0 - adds r1, 0x40 - strh r0, [r1] - adds r6, 0x42 - movs r1, 0x3F - ands r1, r5 - ldrb r2, [r6] - movs r0, 0x40 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E41B8 - - thumb_func_start sub_80E4218 -sub_80E4218: @ 80E4218 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_0858C108 - movs r1, 0xCC - movs r2, 0x74 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r6, =gSprites - adds r4, r6 - ldr r0, =gUnknown_0858C070 - mov r8, r0 - adds r0, r4, 0 - mov r1, r8 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - movs r5, 0x4 - orrs r0, r5 - strb r0, [r4] - ldr r0, =gUnknown_0858C120 - movs r1, 0xCC - movs r2, 0x8C - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r6 - adds r0, r4, 0 - mov r1, r8 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - orrs r0, r5 - strb r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4218 - - thumb_func_start sub_80E4290 -sub_80E4290: @ 80E4290 - push {r4-r6,lr} - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e16 - adds r0, r4 - ldrh r1, [r0] - subs r1, 0x5 - ldr r0, =gUnknown_0858C150 - lsls r1, 16 - asrs r1, 16 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - ldr r3, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r5] - adds r4, r0, r4 - ldrh r1, [r4] - movs r5, 0 - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r5, r0 - bcs _080E4334 - adds r6, r3, 0 -_080E42E2: - lsls r1, 16 - asrs r4, r1, 16 - movs r0, 0xC0 - lsls r0, 10 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_0858C168 - movs r2, 0x3C - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - strh r5, [r0, 0x2E] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - adds r4, 0x8 - lsls r4, 16 - lsrs r1, r4, 16 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r5, r0 - bcc _080E42E2 -_080E4334: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4290 - - thumb_func_start sub_80E4354 -sub_80E4354: @ 80E4354 - push {lr} - ldr r1, =gUnknown_0858BF04 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4354 - - thumb_func_start TaskDummy2 -TaskDummy2: @ 80E4380 - bx lr - thumb_func_end TaskDummy2 - - thumb_func_start sub_80E4384 -sub_80E4384: @ 80E4384 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e34 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0 - bl sub_808BD3C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =SpriteCallbackDummy - movs r2, 0 - str r2, [sp] - movs r2, 0x38 - movs r3, 0x25 - bl AddPseudoFieldObject - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x4 - bl StartSpriteAnim - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4384 - - thumb_func_start sub_80E43E0 -sub_80E43E0: @ 80E43E0 - push {r4,lr} - ldr r0, =gUnknown_0858C180 - movs r1, 0x38 - movs r2, 0x29 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - ldr r1, =gUnknown_0858C078 - adds r0, r4, 0 - bl SetSubspriteTables - ldrb r0, [r4, 0x5] - movs r1, 0xC - orrs r0, r1 - strb r0, [r4, 0x5] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E43E0 - - thumb_func_start sub_80E4420 -sub_80E4420: @ 80E4420 - push {lr} - sub sp, 0xC - bl sub_80D2F04 - ldr r0, =gUnknown_02039F94 - ldr r3, [r0] - ldr r1, =0x00001e34 - adds r0, r3, r1 - ldrh r0, [r0] - ldr r1, =SpriteCallbackDummy - movs r2, 0 - str r2, [sp] - ldr r2, =0x00001e38 - adds r3, r2 - ldr r2, [r3] - str r2, [sp, 0x4] - movs r2, 0x1 - str r2, [sp, 0x8] - movs r2, 0x38 - movs r3, 0x28 - bl sub_80D2CC4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x5] - movs r2, 0xC - orrs r0, r2 - strb r0, [r1, 0x5] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4420 - - thumb_func_start sub_80E447C -sub_80E447C: @ 80E447C - push {lr} - sub sp, 0x4 - ldr r1, =SpriteCallbackDummy - movs r0, 0 - str r0, [sp] - movs r0, 0x13 - movs r2, 0x38 - movs r3, 0x25 - bl AddPseudoFieldObject - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x4 - bl StartSpriteAnim - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E447C - - thumb_func_start sub_80E44BC -sub_80E44BC: @ 80E44BC - push {r4,r5,lr} - bl sub_80E460C - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_80E3F30 - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x8 - bne _080E44DA - bl sub_80E45E0 - b _080E44F6 -_080E44DA: - cmp r4, 0x6 - bne _080E44E4 - bl sub_80E4AF8 - b _080E4504 -_080E44E4: - cmp r5, 0x9 - beq _080E4500 - ldr r1, =gUnknown_0858BF18 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080E44F6: - lsls r0, 24 - lsrs r0, 24 - b _080E4506 - .pool -_080E4500: - bl sub_80E3E28 -_080E4504: - movs r0, 0 -_080E4506: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80E44BC - - thumb_func_start sub_80E450C -sub_80E450C: @ 80E450C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - bne _080E4546 - bl sub_80E4B54 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80E3ED8 - cmp r4, 0 - beq _080E4546 - movs r0, 0x2 - bl sub_80E4630 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] -_080E4546: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E450C - - thumb_func_start sub_80E4558 -sub_80E4558: @ 80E4558 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - beq _080E4572 - movs r0, 0 - b _080E457A -_080E4572: - bl sub_80E45E0 - lsls r0, 24 - lsrs r0, 24 -_080E457A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4558 - - thumb_func_start sub_80E4580 -sub_80E4580: @ 80E4580 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - bne _080E459A - bl sub_80E4AF8 -_080E459A: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4580 - - thumb_func_start sub_80E45A4 -sub_80E45A4: @ 80E45A4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - beq _080E45BE - movs r0, 0 - b _080E45D2 -_080E45BE: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x6 - strb r1, [r0] - movs r0, 0x1 -_080E45D2: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E45A4 - - thumb_func_start sub_80E45E0 -sub_80E45E0: @ 80E45E0 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x4 - strb r1, [r0] - movs r0, 0x1 - bx lr - .pool - thumb_func_end sub_80E45E0 - - thumb_func_start sub_80E45F8 -sub_80E45F8: @ 80E45F8 - push {lr} - ldr r0, =sub_80E465C - movs r1, 0x1 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E45F8 - - thumb_func_start sub_80E460C -sub_80E460C: @ 80E460C - push {lr} - ldr r0, =sub_80E465C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0xA] - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E460C - - thumb_func_start sub_80E4630 -sub_80E4630: @ 80E4630 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80E465C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4630 - - thumb_func_start sub_80E465C -sub_80E465C: @ 80E465C - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gUnknown_0858BF28 - ldr r2, =gTasks - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r2, 0x8 - ldrsh r1, [r0, r2] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl _call_via_r1 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E465C - - thumb_func_start sub_80E468C -sub_80E468C: @ 80E468C - movs r1, 0 - strh r1, [r0, 0xA] - bx lr - thumb_func_end sub_80E468C - - thumb_func_start sub_80E4692 -sub_80E4692: @ 80E4692 - push {lr} - adds r2, r0, 0 - movs r0, 0 - strh r0, [r2, 0xA] - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080E46B4 - movs r0, 0x5 - strh r0, [r2, 0xA] - b _080E46E4 - .pool -_080E46B4: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080E46C2 - movs r0, 0x6 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46C2: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080E46D0 - movs r0, 0x8 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46D0: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _080E46DE - movs r0, 0x9 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46DE: - adds r0, r2, 0 - bl sub_80E46F0 -_080E46E4: - pop {r0} - bx r0 - thumb_func_end sub_80E4692 - - thumb_func_start sub_80E46E8 -sub_80E46E8: @ 80E46E8 - movs r1, 0 - strh r1, [r0, 0xA] - bx lr - thumb_func_end sub_80E46E8 - - thumb_func_start sub_80E46F0 -sub_80E46F0: @ 80E46F0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - mov r9, r0 - ldr r1, =gUnknown_0858BF34 - mov r0, sp - movs r2, 0xA - bl memcpy - add r0, sp, 0xC - mov r10, r0 - ldr r1, =gUnknown_0858BF3E - movs r2, 0xA - bl memcpy - mov r1, sp - adds r1, 0x18 - str r1, [sp, 0x2C] - ldr r1, =gUnknown_0858BF48 - ldr r0, [sp, 0x2C] - movs r2, 0x8 - bl memcpy - mov r2, sp - adds r2, 0x20 - str r2, [sp, 0x30] - ldr r1, =gUnknown_0858BF50 - adds r0, r2, 0 - movs r2, 0x6 - bl memcpy - add r4, sp, 0x28 - mov r5, sp - adds r5, 0x2A - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80E3DFC - ldr r0, =gMain - ldrh r2, [r0, 0x30] - movs r0, 0x40 - ands r0, r2 - lsls r0, 16 - lsrs r0, 16 - negs r0, r0 - lsrs r1, r0, 31 - movs r0, 0x80 - ands r0, r2 - adds r6, r4, 0 - cmp r0, 0 - beq _080E475E - movs r1, 0x2 -_080E475E: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _080E4768 - movs r1, 0x3 -_080E4768: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _080E4772 - movs r1, 0x4 -_080E4772: - ldrh r0, [r6] - mov r8, r0 - lsls r1, 1 - mov r2, sp - adds r7, r2, r1 - ldrh r0, [r7] - add r0, r8 - strh r0, [r6] - add r1, r10 - ldrh r0, [r1] - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - movs r2, 0 - ldrsh r0, [r6, r2] - cmp r0, 0 - bge _080E479E - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] -_080E479E: - movs r0, 0 - ldrsh r4, [r6, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - ble _080E47B2 - movs r0, 0 - strh r0, [r6] -_080E47B2: - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _080E481E - movs r2, 0 - ldrsh r4, [r6, r2] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E47F0 - ldrh r0, [r5] - mov r1, r9 - strh r0, [r1, 0xC] - movs r2, 0 - ldrsh r0, [r5, r2] - lsls r0, 1 - ldr r1, [sp, 0x2C] - adds r0, r1, r0 - b _080E481A - .pool -_080E47F0: - mov r2, r8 - lsls r4, r2, 16 - asrs r4, 16 - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E481E - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _080E4810 - mov r2, r9 - ldrh r0, [r2, 0xC] - b _080E481C -_080E4810: - movs r1, 0 - ldrsh r0, [r5, r1] - lsls r0, 1 - ldr r2, [sp, 0x30] - adds r0, r2, r0 -_080E481A: - ldrh r0, [r0] -_080E481C: - strh r0, [r5] -_080E481E: - movs r0, 0 - ldrsh r4, [r6, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E4860 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _080E483A - movs r0, 0x2 - strh r0, [r5] -_080E483A: - movs r2, 0 - ldrsh r0, [r5, r2] - cmp r0, 0x2 - ble _080E4846 - movs r0, 0 - strh r0, [r5] -_080E4846: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _080E4856 - movs r0, 0x1 - mov r2, r9 - strh r0, [r2, 0xC] - b _080E4878 -_080E4856: - cmp r0, 0x2 - bne _080E4878 - mov r1, r9 - strh r0, [r1, 0xC] - b _080E4878 -_080E4860: - movs r2, 0 - ldrsh r0, [r5, r2] - cmp r0, 0 - bge _080E486C - movs r0, 0x3 - strh r0, [r5] -_080E486C: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x3 - ble _080E4878 - movs r0, 0 - strh r0, [r5] -_080E4878: - movs r2, 0 - ldrsh r0, [r6, r2] - movs r2, 0 - ldrsh r1, [r5, r2] - bl sub_80E3D78 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E46F0 - - thumb_func_start sub_80E4894 -sub_80E4894: @ 80E4894 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e14 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =0x00001e28 - adds r1, r2 - ldr r1, [r1] - ldr r2, [r1, 0x8] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4894 - - thumb_func_start sub_80E48E8 -sub_80E48E8: @ 80E48E8 - push {r4,r5,lr} - sub sp, 0x2C - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e34 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - add r0, sp, 0xC - bl StringCopy - ldr r0, [r5] - ldr r1, =0x00001e28 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x8] - add r0, sp, 0xC - movs r2, 0xF - bl StringAppendN - ldr r0, [r5] - ldr r4, =0x00001e14 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - add sp, 0x2C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E48E8 - - thumb_func_start sub_80E4964 -sub_80E4964: @ 80E4964 - push {lr} - ldr r1, =gUnknown_0858BF58 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e2c - adds r0, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4964 - - thumb_func_start sub_80E498C -sub_80E498C: @ 80E498C - push {lr} - ldr r1, =gUnknown_0858BF6C - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E498C - - thumb_func_start TaskDummy3 -TaskDummy3: @ 80E49B8 - bx lr - thumb_func_end TaskDummy3 - - thumb_func_start sub_80E49BC -sub_80E49BC: @ 80E49BC - push {r4,r5,lr} - sub sp, 0x10 - movs r4, 0 - ldr r1, =gText_MaleSymbol - add r0, sp, 0xC - bl StringCopy - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e36 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0xFF - beq _080E4A0C - cmp r0, 0xFE - bne _080E49E6 - ldr r1, =gText_FemaleSymbol - add r0, sp, 0xC - bl StringCopy - movs r4, 0x1 -_080E49E6: - ldr r0, [r5] - ldr r1, =0x00001e13 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r4, 1 - adds r1, r4 - ldr r2, =gUnknown_0858BF74 - adds r1, r2 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - add r1, sp, 0xC - str r1, [sp, 0x8] - movs r1, 0x1 - movs r2, 0x68 - movs r3, 0x1 - bl box_print -_080E4A0C: - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E49BC - - thumb_func_start sub_80E4A2C -sub_80E4A2C: @ 80E4A2C - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - ldr r6, =gUnknown_0858BE40 - bl sub_80E3274 - lsls r4, 16 - asrs r4, 16 - lsls r5, 16 - asrs r5, 13 - adds r4, r5 - lsls r0, 24 - lsrs r0, 19 - adds r4, r0 - adds r4, r6 - ldrb r0, [r4] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4A2C - - thumb_func_start sub_80E4A60 -sub_80E4A60: @ 80E4A60 - push {r4,r5,lr} - movs r2, 0 - ldr r0, =gUnknown_02039F94 - ldr r4, [r0] - ldr r3, =0x00001e28 - adds r1, r4, r3 - ldr r1, [r1] - ldrb r3, [r1, 0x1] - adds r5, r0, 0 - cmp r2, r3 - bcs _080E4A9A - movs r0, 0xC0 - lsls r0, 5 - adds r1, r4, r0 -_080E4A7C: - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080E4A90 - adds r0, r2, 0 - b _080E4AAA - .pool -_080E4A90: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r3 - bcc _080E4A7C -_080E4A9A: - ldr r0, [r5] - ldr r1, =0x00001e28 - adds r0, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_080E4AAA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4A60 - - thumb_func_start sub_80E4AB4 -sub_80E4AB4: @ 80E4AB4 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r2, [r0] - ldr r1, =0x00001e28 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - subs r0, 0x1 - lsls r1, r0, 24 - cmp r1, 0 - ble _080E4AF0 - movs r0, 0xC0 - lsls r0, 5 - adds r3, r2, r0 -_080E4AD0: - asrs r2, r1, 24 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0xFF - beq _080E4AE8 - lsrs r0, r1, 24 - b _080E4AF2 - .pool -_080E4AE8: - subs r0, r2, 0x1 - lsls r1, r0, 24 - cmp r1, 0 - bgt _080E4AD0 -_080E4AF0: - movs r0, 0 -_080E4AF2: - pop {r1} - bx r1 - thumb_func_end sub_80E4AB4 - - thumb_func_start sub_80E4AF8 -sub_80E4AF8: @ 80E4AF8 - push {r4-r6,lr} - bl sub_80E4AB4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_02039F94 - ldr r0, [r6] - movs r5, 0xC0 - lsls r5, 5 - adds r0, r5 - adds r0, r4 - movs r1, 0 - strb r1, [r0] - bl sub_80E4D10 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - adds r0, r5 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] - bl sub_80E3F30 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080E4B38 - cmp r0, 0x2 - bne _080E4B42 -_080E4B38: - movs r0, 0x1 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 -_080E4B42: - movs r0, 0x17 - bl PlaySE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4AF8 - - thumb_func_start sub_80E4B54 -sub_80E4B54: @ 80E4B54 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl sub_80E3DFC - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl sub_80E4A2C - lsls r0, 24 - lsrs r0, 24 - bl sub_80E4BBC - bl sub_80E4D10 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x5 - bl PlaySE - bl sub_80E4AB4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e28 - adds r1, r2 - ldr r1, [r1] - ldrb r1, [r1, 0x1] - subs r1, 0x1 - cmp r0, r1 - bne _080E4BB0 - movs r0, 0x1 - b _080E4BB2 - .pool -_080E4BB0: - movs r0, 0 -_080E4BB2: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4B54 - - thumb_func_start sub_80E4BBC -sub_80E4BBC: @ 80E4BBC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80E4A60 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - movs r2, 0xC0 - lsls r2, 5 - adds r1, r2 - adds r1, r0 - strb r4, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4BBC - - thumb_func_start sub_80E4BE4 -sub_80E4BE4: @ 80E4BE4 - push {r4,r5,lr} - movs r2, 0 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r4, =0x00001e28 - adds r0, r4 - ldr r0, [r0] - adds r5, r1, 0 - b _080E4C44 - .pool -_080E4C00: - ldr r1, [r1] - movs r0, 0xC0 - lsls r0, 5 - adds r3, r1, r0 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080E4C34 - cmp r0, 0xFF - beq _080E4C34 - ldr r2, =0x00001e30 - adds r0, r1, r2 - ldr r0, [r0] - adds r1, r4 - ldr r1, [r1] - ldrb r2, [r1, 0x1] - adds r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r1, r3, 0 - bl StringCopyN - b _080E4C4A - .pool -_080E4C34: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r1, r5, 0 - ldr r0, [r1] - ldr r4, =0x00001e28 - adds r0, r4 - ldr r0, [r0] -_080E4C44: - ldrb r0, [r0, 0x1] - cmp r2, r0 - bcc _080E4C00 -_080E4C4A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4BE4 - - thumb_func_start choose_name_or_words_screen_load_bg_tile_patterns -choose_name_or_words_screen_load_bg_tile_patterns: @ 80E4C54 - push {r4-r6,lr} - ldr r0, =gNamingScreenMenu_Gfx - ldr r6, =gUnknown_02039F94 - ldr r1, [r6] - ldr r4, =0x00001810 - adds r1, r4 - bl LZ77UnCompWram - ldr r1, [r6] - adds r1, r4 - movs r5, 0xC0 - lsls r5, 3 - movs r0, 0x1 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r6] - adds r1, r4 - movs r0, 0x2 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r6] - adds r1, r4 - movs r0, 0x3 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r0, =gUnknown_0858C1C8 - bl LoadSpriteSheets - ldr r0, =gUnknown_0858C230 - bl LoadSpritePalettes - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_load_bg_tile_patterns - - thumb_func_start sub_80E4CB8 -sub_80E4CB8: @ 80E4CB8 - push {lr} - bl sub_80E45F8 - bl sub_80E3920 - pop {r0} - bx r0 - thumb_func_end sub_80E4CB8 - - thumb_func_start choose_name_or_words_screen_apply_bg_pals -choose_name_or_words_screen_apply_bg_pals: @ 80E4CC8 - push {lr} - ldr r0, =gNamingScreenMenu_Pal - movs r1, 0 - movs r2, 0xC0 - bl LoadPalette - ldr r0, =gUnknown_0858BD78 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0x2 - bl stdpal_get - movs r1, 0xB0 - movs r2, 0x20 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_apply_bg_pals - - thumb_func_start sub_80E4CF8 -sub_80E4CF8: @ 80E4CF8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - pop {r0} - bx r0 - thumb_func_end sub_80E4CF8 - - thumb_func_start nullsub_10 -nullsub_10: @ 80E4D0C - bx lr - thumb_func_end nullsub_10 - - thumb_func_start sub_80E4D10 -sub_80E4D10: @ 80E4D10 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r7, =gUnknown_02039F94 - ldr r1, [r7] - ldr r2, =0x00001e28 - adds r0, r1, r2 - ldr r0, [r0] - ldrb r6, [r0, 0x1] - subs r2, 0x12 - adds r0, r1, r2 - ldrh r0, [r0] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldr r0, =0x00001e13 - adds r1, r0 - ldrb r0, [r1] - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r4, 0 - cmp r4, r6 - bcs _080E4DA6 - add r5, sp, 0xC - mov r10, r4 - ldr r0, =gExpandedPlaceholder_Empty - ldrb r0, [r0] - mov r8, r0 -_080E4D52: - ldr r0, [r7] - movs r1, 0xC0 - lsls r1, 5 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - strb r0, [r5] - mov r2, r8 - strb r2, [r5, 0x1] - ldrb r0, [r5] - bl sub_80E503C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r0, 0x1 - bne _080E4D76 - movs r1, 0x2 -_080E4D76: - ldr r0, [r7] - ldr r2, =0x00001e13 - adds r0, r2 - ldrb r0, [r0] - lsls r3, r4, 3 - add r3, r9 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl PrintTextOnWindow - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _080E4D52 -_080E4DA6: - bl sub_80E498C - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e13 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - 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_80E4D10 - - thumb_func_start sub_80E4DE4 -sub_80E4DE4: @ 80E4DE4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_0858BF88 - adds r0, r5, r0 - ldrb r1, [r0] - adds r0, r6, 0 - bl FillWindowPixelBuffer - movs r4, 0 - ldr r1, =gUnknown_0858BF8C - lsls r0, r5, 2 - adds r0, r1 - ldr r7, [r0] - ldr r0, =gUnknown_0858C198 - mov r8, r0 -_080E4E0E: - lsls r3, r4, 4 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - movs r0, 0 - str r0, [sp, 0x4] - lsls r0, r4, 2 - lsls r1, r5, 4 - adds r0, r1 - add r0, r8 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x1 - movs r2, 0 - bl box_print - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _080E4E0E - adds r0, r6, 0 - bl PutWindowTilemap - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4DE4 - - thumb_func_start sub_80E4E5C -sub_80E4E5C: @ 80E4E5C - push {r4-r6,lr} - movs r0, 0xA - bl GetGpuReg - adds r4, r0, 0 - movs r5, 0x3 - ands r4, r5 - movs r0, 0xC - bl GetGpuReg - ands r0, r5 - cmp r4, r0 - bls _080E4E8C - movs r5, 0x1 - movs r6, 0x1 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r2, =0x00001e11 - b _080E4E96 - .pool -_080E4E8C: - movs r5, 0x2 - movs r6, 0x2 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r2, =0x00001e12 -_080E4E96: - adds r0, r2 - ldrb r4, [r0] - adds r0, r1, 0 - ldr r1, =gUnknown_0858BF98 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl sub_80E4CF8 - bl sub_80E3254 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80E4DE4 - bl sub_80E3254 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl nullsub_10 - adds r0, r6, 0 - bl CopyBgTilemapBufferToVram - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4E5C - - thumb_func_start sub_80E4EF0 -sub_80E4EF0: @ 80E4EF0 - push {r4,r5,lr} - sub sp, 0x10 - ldr r1, =gUnknown_0858BFA4 - add r0, sp, 0xC - movs r2, 0x3 - bl memcpy - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e15 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - add r1, sp, 0xC - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gText_MoveOkBack - str r1, [sp, 0x8] - movs r1, 0 - movs r2, 0x2 - movs r3, 0x1 - bl box_print - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4EF0 - - thumb_func_start sub_80E4F58 -sub_80E4F58: @ 80E4F58 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80E4F58 - - thumb_func_start sub_80E4F70 -sub_80E4F70: @ 80E4F70 - push {lr} - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - pop {r0} - bx r0 - thumb_func_end sub_80E4F70 - - thumb_func_start sub_80E4F84 -sub_80E4F84: @ 80E4F84 - push {lr} - ldr r0, =sub_80E4F94 - bl SetVBlankCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4F84 - - thumb_func_start sub_80E4F94 -sub_80E4F94: @ 80E4F94 - push {r4,r5,lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e18 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1a - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - movs r0, 0xA - bl GetGpuReg - ldr r4, =0x0000fffc - adds r1, r4, 0 - ands r1, r0 - movs r0, 0xA - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1c - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xA - bl SetGpuRegBits - movs r0, 0xC - bl GetGpuReg - ands r4, r0 - movs r0, 0xC - adds r1, r4, 0 - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1e - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xC - bl SetGpuRegBits - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4F94 - - thumb_func_start sub_80E501C -sub_80E501C: @ 80E501C - push {lr} - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - pop {r0} - bx r0 - thumb_func_end sub_80E501C - - thumb_func_start sub_80E503C -sub_80E503C: @ 80E503C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0 - ldr r0, =gUnknown_0858BDC8 - ldrb r1, [r0] - adds r3, r0, 0 - cmp r1, 0xFF - beq _080E5066 - adds r1, r3, 0 -_080E5050: - adds r0, r2, r1 - ldrb r0, [r0] - cmp r4, r0 - beq _080E5066 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080E5050 -_080E5066: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E503C - - thumb_func_start sub_80E5074 -sub_80E5074: @ 80E5074 - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E5074 - - thumb_func_start sub_80E509C -sub_80E509C: @ 80E509C - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E509C - - thumb_func_start sub_80E50C4 -sub_80E50C4: @ 80E50C4 - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E50C4 - - thumb_func_start sub_80E50EC -sub_80E50EC: @ 80E50EC - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x3 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E50EC - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/overworld.s b/asm/overworld.s index b667488089..2858fb6d32 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -6698,7 +6698,7 @@ _08087C38: lsls r1, 30 lsrs r1, 31 movs r0, 0 - bl sub_808BD3C + bl GetRivalAvatarGraphicsIdByStateIdAndGender _08087C44: lsls r0, 24 lsrs r0, 24 diff --git a/asm/party_menu.s b/asm/party_menu.s index 730e909325..9695c716fa 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -10415,7 +10415,7 @@ party_menu_link_mon_icon_anim: @ 81B5A2C ldr r0, [sp, 0x20] str r0, [sp, 0x8] adds r0, r5, 0 - bl sub_80D2CC4 + bl CreateMonIcon strb r0, [r4, 0x9] ldr r2, =gSprites ldrb r0, [r4, 0x9] diff --git a/asm/pokemon_icon.s b/asm/pokemon_icon.s index 9157059db1..40291bee49 100644 --- a/asm/pokemon_icon.s +++ b/asm/pokemon_icon.s @@ -5,9 +5,9 @@ .text - thumb_func_start sub_80D2CC4 -@ int sub_80D2CC4(u16 speciesId, int a2, u16 a3, u16 a4, u8 a5, u32 personality, int a7) -sub_80D2CC4: @ 80D2CC4 + thumb_func_start CreateMonIcon +@ int CreateMonIcon(u16 speciesId, int a2, u16 a3, u16 a4, u8 a5, u32 personality, int a7) +CreateMonIcon: @ 80D2CC4 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -84,7 +84,7 @@ _080D2D2A: pop {r1} bx r1 .pool - thumb_func_end sub_80D2CC4 + thumb_func_end CreateMonIcon thumb_func_start sub_80D2D78 sub_80D2D78: @ 80D2D78 diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 800b66a55d..4a331b313b 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -8934,7 +8934,7 @@ sub_812EB48: @ 812EB48 ldrb r3, [r1] adds r1, r3, 0 adds r2, r3, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r0, [r4, 0x38] adds r0, 0x1 movs r1, 0x1 @@ -8979,7 +8979,7 @@ sub_812EBCC: @ 812EBCC movs r1, 0 movs r2, 0 movs r3, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents movs r4, 0 _0812EBEA: ldr r0, =gUnknown_0203AB34 diff --git a/asm/trade.s b/asm/trade.s index cfc5307d39..e2ef96d597 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -646,7 +646,7 @@ _080776E2: str r1, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x28 @@ -705,7 +705,7 @@ _08077756: str r0, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x2E @@ -1264,7 +1264,7 @@ _08077CA8: str r1, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x28 @@ -1323,7 +1323,7 @@ _08077D1E: str r0, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x2E diff --git a/data/naming_screen.s b/data/naming_screen.s deleted file mode 100644 index a23fb96fbb..0000000000 --- a/data/naming_screen.s +++ /dev/null @@ -1,346 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_0858BBF8:: @ 858BBF8 - .incbin "graphics/naming_screen/pc_icon/0.4bpp" - - .align 2 -gUnknown_0858BCB8:: @ 858BCB8 - .incbin "graphics/naming_screen/pc_icon/1.4bpp" - - .align 2 -gUnknown_0858BD78:: @ 858BD78 - .incbin "graphics/naming_screen/0.gbapal" - .incbin "graphics/naming_screen/1.gbapal" - - .align 2 -gUnknown_0858BDB8:: @ 858BDB8 - .4byte gText_PkmnTransferredSomeonesPC - .4byte gText_PkmnTransferredLanettesPC - .4byte gText_PkmnBoxSomeonesPCFull - .4byte gText_PkmnBoxLanettesPCFull - -gUnknown_0858BDC8:: @ 858BDC8 - .string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!$" - - .align 2 -gUnknown_0858BE00:: @ 858BE00 - .4byte 0x000001e0, 0x000011d9, 0x000021ca, 0x000031ff - - .align 2 -gUnknown_0858BE10:: @ 858BE10 - window_template 0x01, 0x03, 0x0a, 0x13, 0x08, 0x0a, 0x0030 - window_template 0x02, 0x03, 0x0a, 0x13, 0x08, 0x0a, 0x00c8 - window_template 0x03, 0x08, 0x06, 0x11, 0x02, 0x0a, 0x0030 - window_template 0x03, 0x08, 0x04, 0x11, 0x02, 0x0a, 0x0052 - window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0b, 0x0074 - null_window_template - -gUnknown_0858BE40:: @ 858BE40 - .string "abcdef .ghijkl ,mnopqrs tuvwxyz ABCDEF .GHIJKL ,MNOPQRS TUVWXYZ 01234 56789 !?♂♀/- …“”‘’ " - -gUnknown_0858BEA0:: @ 858BEA0 - .byte 0x08, 0x08, 0x06 - -gUnknown_0858BEA3:: @ 858BEA3 - .byte 0x00, 0x0c, 0x18, 0x38, 0x44, 0x50, 0x5c, 0x7b, 0x00, 0x0c, 0x18, 0x38, 0x44, 0x50, 0x5c, 0x7b, 0x00, 0x16, 0x2c, 0x42, 0x58, 0x6e, 0x00, 0x00 - -gUnknown_0858BEBB:: @ 858BEBB - .byte 0x00, 0x02, 0x01 - -gUnknown_0858BEBE:: @ 858BEBE - .byte 0x01, 0x00, 0x02 - -gUnknown_0858BEC1:: @ 858BEC1 - .byte 0x02, 0x01, 0x00 - -gUnknown_0858BEC4:: @ 858BEC4 - .4byte sub_80E37B4 - .4byte sub_80E37DC - .4byte sub_80E3870 - .4byte sub_80E3904 - -gUnknown_0858BED4:: @ 858BED4 - .2byte 0x0000, 0xfffc, 0xfffe, 0xffff - -gUnknown_0858BEDC:: @ 858BEDC - .2byte 0x0002, 0x0003, 0x0002, 0x0001 - -gUnknown_0858BEE4:: @ 858BEE4 - .byte 0x01, 0x02, 0x03, 0x00 - -gUnknown_0858BEE8:: @ 858BEE8 - .4byte sub_80E40AC - .4byte sub_80E4100 - .4byte sub_80E4104 - .4byte sub_80E4178 - -gUnknown_0858BEF8:: @ 858BEF8 - .2byte 0x0001, 0x0003, 0x0002 - -gUnknown_0858BEFE:: @ 858BEFE - .2byte 0x0004, 0x0006, 0x0005 - -gUnknown_0858BF04:: @ 858BF04 - .4byte TaskDummy2 - .4byte sub_80E4384 - .4byte sub_80E43E0 - .4byte sub_80E4420 - .4byte sub_80E447C - -gUnknown_0858BF18:: @ 858BF18 - .4byte sub_80E450C - .4byte sub_80E4558 - .4byte sub_80E4580 - .4byte sub_80E45A4 - -gUnknown_0858BF28:: @ 858BF28 - .4byte sub_80E468C - .4byte sub_80E4692 - .4byte sub_80E46E8 - -gUnknown_0858BF34:: @ 858BF34 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00 - -gUnknown_0858BF3E:: @ 858BF3E - .byte 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - -gUnknown_0858BF48:: @ 858BF48 - .byte 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00 - -gUnknown_0858BF50:: @ 858BF50 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_0858BF58:: @ 858BF58 - .4byte sub_80E4894 - .4byte sub_80E4894 - .4byte sub_80E48E8 - .4byte sub_80E48E8 - .4byte sub_80E4894 - - .align 2 -gUnknown_0858BF6C:: @ 858BF6C - .4byte TaskDummy3 - .4byte sub_80E49BC - - .align 2 -gUnknown_0858BF74:: @ 858BF74 - window_template 0x00, 0x09, 0x08, 0x00, 0x05, 0x04, 0x0000 - -gUnknown_0858BF7C:: @ 858BF7C - .4byte 0x0002010D - -gUnknown_0858BF80:: @ 858BF80 - .4byte 0x0002010E - -gUnknown_0858BF84:: @ 858BF84 - .4byte 0x0002010F - -gUnknown_0858BF88:: @ 858BF88 - .byte 0xee, 0xdd, 0xff, 0x00 - -gUnknown_0858BF8C:: @ 858BF8C - .4byte gUnknown_0858BF80 - .4byte gUnknown_0858BF7C - .4byte gUnknown_0858BF84 - -gUnknown_0858BF98:: @ 858BF98 - .4byte gUnknown_08DD4620 - .4byte gUnknown_08DD46E0 - .4byte gUnknown_08DD47A0 - -gUnknown_0858BFA4:: @ 858BFA4 - .byte 0x0f, 0x01, 0x02 - - .align 2 -gUnknown_0858BFA8:: @ 858BFA8 - .byte 0x00, 0x07, 0x01, 0x00, 0x01, 0x23, 0x00, 0x00 - .4byte gText_YourName - - .align 2 -gUnknown_0858BFB4:: @ 858BFB4 - .byte 0x00, 0x08, 0x02, 0x00, 0x01, 0x13, 0x00, 0x00 - .4byte gText_BoxName - - .align 2 -gUnknown_0858BFC0:: @ 858BFC0 - .byte 0x00, 0x0a, 0x03, 0x01, 0x01, 0x23, 0x00, 0x00 - .4byte gText_PkmnsNickname - - .align 2 -gUnknown_0858BFCC:: @ 858BFCC - .byte 0x01, 0x0f, 0x04, 0x00, 0x01, 0x0b, 0x00, 0x00 - .4byte gText_TellHimTheWords - - .align 2 -gUnknown_0858BFD8:: @ 858BFD8 - .4byte gUnknown_0858BFA8 - .4byte gUnknown_0858BFB4 - .4byte gUnknown_0858BFC0 - .4byte gUnknown_0858BFC0 - .4byte gUnknown_0858BFCC - - .align 2 -gOamData_858BFEC:: @ 858BFEC - .2byte 0x0000, 0x0000, 0x0000, 0x0000 - - .align 2 -gOamData_858BFF4:: @ 858BFF4 - .2byte 0x0000, 0x4000, 0x0000, 0x0000 - - .align 2 -gOamData_858BFFC:: @ 858BFFC - .2byte 0x4000, 0x8000, 0x0000, 0x0000 - - .align 2 -gUnknown_0858C004:: @ 858C004 - .byte 0xec, 0xf0, 0x05, 0x40, 0x0c, 0xf0, 0x40, 0x40, 0xec, 0xf8, 0x55, 0x40, 0x0c, 0xf8, 0x90, 0x40, 0xec, 0x00, 0xa5, 0x40, 0x0c, 0x00, 0xe0, 0x40, 0xec, 0x08, 0xf5, 0x40, 0x0c, 0x08, 0x30, 0x41 - - .align 2 -gUnknown_0858C024:: @ 858C024 - .byte 0xf4, 0xfc, 0x01, 0x40, 0x04, 0xfc, 0x20, 0x40 - - .align 2 -gUnknown_0858C02C:: @ 858C02C - .byte 0xec, 0xf4, 0x05, 0x40, 0x0c, 0xf4, 0x40, 0x40, 0xec, 0xfc, 0x55, 0x40, 0x0c, 0xfc, 0x90, 0x40, 0xec, 0x04, 0xa5, 0x40, 0x0c, 0x04, 0xe0, 0x40 - - .align 2 -gUnknown_0858C044:: @ 858C044 - .byte 0xf8, 0xf4, 0x01, 0xc0, 0xf8, 0xfc, 0x21, 0xc0, 0xf8, 0x04, 0x41, 0xc0 - - .align 2 -gUnknown_0858C050:: @ 858C050 - .byte 0x08, 0x00, 0x00, 0x00 - .4byte gUnknown_0858C004 - - .align 2 -gUnknown_0858C058:: @ 858C058 - .4byte 0x02 - .4byte gUnknown_0858C024 - .4byte 0x02 - .4byte gUnknown_0858C024 - .4byte 0x02 - .4byte gUnknown_0858C024 - - .align 2 -gUnknown_0858C070:: @ 858C070 - .4byte 0x06 - .4byte gUnknown_0858C02C - - .align 2 -gUnknown_0858C078:: @ 858C078 - .4byte 0x03 - .4byte gUnknown_0858C044 - - .align 2 -gUnknown_0858C080:: @ 858C080 - obj_frame_tiles gUnknown_0858BBF8, 0x00c0 - obj_frame_tiles gUnknown_0858BCB8, 0x00c0 - - .align 2 -gSpriteAnim_858C090:: @ 858C090 - .2byte 0x0000, 0x0001, 0xfffe, 0x0000 - - .align 2 -gSpriteAnim_858C098:: @ 858C098 - .2byte 0x0004, 0x0008, 0x0008, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858C0A4:: @ 858C0A4 - .2byte 0x0000, 0x0002, 0x0001, 0x0002, 0xfffe, 0x0000 - - .align 2 -gSpriteAnimTable_858C0B0:: @ 858C0B0 - .4byte gSpriteAnim_858C090 - - .align 2 -gSpriteAnimTable_858C0B4:: @ 858C0B4 - .4byte gSpriteAnim_858C090 - .4byte gSpriteAnim_858C098 - - .align 2 -gSpriteAnimTable_858C0BC:: @ 858C0BC - .4byte gSpriteAnim_858C0A4 - - .align 2 -gUnknown_0858C0C0:: @ 858C0C0 - spr_template 0x0002, 0x0004, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E4084 - - .align 2 -gUnknown_0858C0D8:: @ 858C0D8 - spr_template 0x0003, 0x0001, gOamData_858BFFC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C0F0:: @ 858C0F0 - spr_template 0x0004, 0x0004, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C108:: @ 858C108 - spr_template 0x0000, 0x0006, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C120:: @ 858C120 - spr_template 0x0001, 0x0007, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C138:: @ 858C138 - spr_template 0x0007, 0x0005, gOamData_858BFF4, gSpriteAnimTable_858C0B4, NULL, gDummySpriteAffineAnimTable, sub_80E3B30 - - .align 2 -gUnknown_0858C150:: @ 858C150 - spr_template 0x000a, 0x0003, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E3C20 - - .align 2 -gUnknown_0858C168:: @ 858C168 - spr_template 0x000b, 0x0003, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E3C6C - - .align 2 -gUnknown_0858C180:: @ 858C180 - spr_template 0xffff, 0x0000, gOamData_858BFEC, gSpriteAnimTable_858C0BC, gUnknown_0858C080, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C198:: @ 858C198 - .4byte gUnknown_0862B88D - .4byte gUnknown_0862B8AE - .4byte gUnknown_0862B8CF - .4byte gUnknown_0862B8F0 - .4byte gUnknown_0862B911 - .4byte gUnknown_0862B932 - .4byte gUnknown_0862B953 - .4byte gUnknown_0862B974 - .4byte gUnknown_0862B995 - .4byte gUnknown_0862B9AE - .4byte gUnknown_0862B9C7 - .4byte gUnknown_0862B9E0 - - .align 2 -gUnknown_0858C1C8:: @ 858C1C8 - obj_tiles gNamingScreenRWindow_Gfx+0x280, 0x01e0, 0x0000 - obj_tiles gNamingScreenRWindow_Gfx+0x460, 0x01e0, 0x0001 - obj_tiles gNamingScreenRWindow_Gfx, 0x0280, 0x0002 - obj_tiles gNamingScreenKeyboardButton_Gfx+0x20, 0x0100, 0x0003 - obj_tiles gNamingScreenROptions_Gfx, 0x0060, 0x0004 - obj_tiles gNamingScreenROptions_Gfx+0xA0, 0x0060, 0x0005 - obj_tiles gNamingScreenROptions_Gfx+0x140, 0x0060, 0x0006 - obj_tiles gNamingScreenCursor_Gfx, 0x0080, 0x0007 - obj_tiles gNamingScreenCursor_Gfx+0xA0, 0x0080, 0x0008 - obj_tiles gNamingScreenCursor_Gfx+0x140, 0x0080, 0x0009 - obj_tiles gNamingScreenRightPointingTriangleTiles, 0x0020, 0x000a - obj_tiles gNamingScreenUnderscoreTiles, 0x0020, 0x000b - null_obj_tiles - - .align 2 -gUnknown_0858C230:: @ 858C230 - obj_pal gNamingScreenMenu_Pal, 0x0000 - obj_pal gNamingScreenMenu_Pal+0x20, 0x0001 - obj_pal gNamingScreenMenu_Pal+0x40, 0x0002 - obj_pal gNamingScreenMenu_Pal+0x60, 0x0003 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0004 - obj_pal gNamingScreenMenu_Pal+0xA0, 0x0005 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0006 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0007 - null_obj_pal diff --git a/graphics/intro/copyright.png b/graphics/intro/copyright.png index c005ff02c6118df425b6de11222e38c4019cf0e5..988a07318342291d0318c66e2ccea59c5c18f463 100644 GIT binary patch delta 479 zcmV<50U-XG1d;?HiBL{Q4GJ0x0000DNk~Le0003v000081Oos70H0j`K#?Iof1OE0 zK~y-6wUo_m!!Qhmy#kL85O8J(_#w#Bw$#H`ms{j&hJ&7NGoMrJL z9M3~Ojf#(3|2mcdry_R4<9qiB4x>QfYol5IoU$nsZ32oeqX)C%?Iiv5y(YSei7HG0 zMWb=J;25F_x7GcwVy2veO0C1ae+@llB=2x9>FuT#na77Q;It?&hleIETm6X!eA&jC z3FoeuybE0QXsqVaw8R>@xWF|>fimtcs6gh7Am(;qR{VhPxNpCx^}R1S@C-`=PITRr zWlPZ&P9NbFd%`g+cg+PrJfd2Z6*o`@)5A+*NLdQFMBeEZo*`asjE3(#f9*yLSM%M^ zrL5G|ZHO*qm0bdkx3cHL8Bfx^o=#H{lLzt4E&hNJ(}eTRVoDRvvoR|}JZu&T8~Cn0 zbhRP6d=UD0fisbrIeCNomfL{4pKxcw6RwPI$;?R>FEdxXbgNmm8dcSe#`zec<@K+` zW6aNRPq^2fLvKN4NM2D*HCZ(Efa`+UbDYg*_L{A*g3MfP%010yVsWCUDw4Gh(Ju!D V$mwajZ5jXo002ovPDHLkV1gW<+0+04 delta 487 zcmVz@=OH#hY}b8LDq`>?u6c_epyxEgsn+uy+(d4f%M<(} z#|}U3@V(#>&Q|m^vkjJn-+PYj5h$&8M>J*B-Qb&G_xzV;_*Wd>MV>K+e{S=HCOXrm zwB9>|3okLgpW#}>I@BKES~SY`!o_8i|Kb8Z&40?AAajojv+{@OUFv(isaqamU$WvF zD+##hG%Funiax?ovPFztemplateNum = templateNum; + gNamingScreenData->unk1E34 = monSpecies; + gNamingScreenData->unk1E36 = monGender; + gNamingScreenData->unk1E38 = monPersonality; + gNamingScreenData->destBuffer = destBuffer; + gNamingScreenData->returnCallback = returnCallback; + + if (templateNum == 0) + StartTimer1(); + + SetMainCallback2(C2_NamingScreen); + } +} + +static void C2_NamingScreen(void) +{ + switch (gMain.state) + { + case 0: + NamingScreen_TurnOffScreen(); + NamingScreen_Init(); + gMain.state++; + break; + case 1: + choose_name_or_words_screen_init_bgs(); + gMain.state++; + break; + case 2: + ResetPaletteFade(); + gMain.state++; + break; + case 3: + ResetSpriteData(); + FreeAllSpritePalettes(); + gMain.state++; + break; + case 4: + ResetTasks(); + gMain.state++; + break; + case 5: + choose_name_or_words_screen_apply_bg_pals(); + gMain.state++; + break; + case 6: + choose_name_or_words_screen_load_bg_tile_patterns(); + gMain.state++; + break; + case 7: + sub_80E3CC8(); + UpdatePaletteFade(); + sub_80E501C(); + gMain.state++; + break; + default: + sub_80E4CB8(); + sub_80E3194(); + break; + } +} + +static void NamingScreen_Init(void) +{ + gNamingScreenData->state = 0; + gNamingScreenData->bg1vOffset = 0; + gNamingScreenData->bg2vOffset = 0; + gNamingScreenData->unk1E1C = 1; + gNamingScreenData->unk1E1E = 2; + gNamingScreenData->unk1E20 = 0; + gNamingScreenData->unk1E21 = 1; + gNamingScreenData->template = sNamingScreenTemplates[gNamingScreenData->templateNum]; + gNamingScreenData->currentPage = gNamingScreenData->template->unk4; + gNamingScreenData->unk1E16 = (240 - gNamingScreenData->template->maxChars * 8) / 2 + 6; + if (gNamingScreenData->templateNum == 4) + gNamingScreenData->unk1E16 += 11; + gNamingScreenData->unk1E25 = gKeyRepeatStartDelay; + memset(gNamingScreenData->textBuffer, 0xFF, sizeof(gNamingScreenData->textBuffer)); + if (gNamingScreenData->template->unk0 != 0) + StringCopy(gNamingScreenData->textBuffer, gNamingScreenData->destBuffer); + gKeyRepeatStartDelay = 16; +} + +static void sub_80E2FA4(void) +{ + u8 i; + for (i = 0; i < MAX_SPRITES; i++) + { + if (gSprites[i].inUse) + gSprites[i].invisible = FALSE; + } + sub_80E3E3C(0); +} + +static void choose_name_or_words_screen_init_bgs(void) +{ + u8 i; + + DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3, (void *)OAM, OAM_SIZE); + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0858BE00, 4); + + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + + sub_81971D0(); + sub_8197200(); + + for (i = 0; i < 5; i++) + gNamingScreenData->windows[i] = AddWindow(&gUnknown_0858BE10[i]); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0xC, 0x8)); + + SetBgTilemapBuffer(1, gNamingScreenData->tilemapBuffer1); + SetBgTilemapBuffer(2, gNamingScreenData->tilemapBuffer2); + SetBgTilemapBuffer(3, gNamingScreenData->tilemapBuffer3); + + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20); +} + +static void sub_80E3194(void) +{ + CreateTask(sub_80E31B0, 2); + SetMainCallback2(sub_80E4F58); +} + +static void sub_80E31B0(u8 taskId) +{ + switch (gNamingScreenData->state) + { + case 0: + MainState_BeginFadeIn(); + sub_80E2FA4(); + NamingScreen_InitDisplayMode(); + break; + case 1: + MainState_WaitFadeIn(); + break; + case 2: + MainState_HandleInput(); + break; + case 3: + MainState_MoveToOKButton(); + MainState_HandleInput(); + break; + case 4: + MainState_StartPageSwap(); + break; + case 5: + MainState_WaitPageSwap(); + break; + case 6: + MainState_6(); + break; + case 7: + sub_80E3604(); + break; + case 8: + MainState_BeginFadeInOut(); + break; + case 9: + MainState_WaitFadeOutAndExit(); + break; + } +} + +static const u8 gUnknown_0858BEBB[] = { 0, 2, 1 }; +static const u8 gUnknown_0858BEBE[] = { 1, 0, 2 }; +static const u8 gUnknown_0858BEC1[] = { 2, 1, 0 }; + +static u8 sub_80E3244(u8 a1) +{ + return gUnknown_0858BEBB[a1]; +} + +static u8 sub_80E3254(void) +{ + return gUnknown_0858BEBE[gNamingScreenData->currentPage]; +} + +static u8 sub_80E3274(void) +{ + return gUnknown_0858BEC1[gNamingScreenData->currentPage]; +} + +static bool8 MainState_BeginFadeIn(void) +{ + sub_80E4CF8(3, gUnknown_08DD4544); + gNamingScreenData->currentPage = 1; + sub_80E4CF8(2, gUnknown_08DD46E0); + sub_80E4CF8(1, gUnknown_08DD4620); + sub_80E4DE4(gNamingScreenData->windows[1], 0); + sub_80E4DE4(gNamingScreenData->windows[0], 1); + nullsub_10(2, 0); + nullsub_10(1, 1); + sub_80E4D10(); + sub_80E4964(); + sub_80E4EF0(); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + BlendPalettes(-1, 16, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + gNamingScreenData->state++; + return FALSE; +} + +static bool8 MainState_WaitFadeIn(void) +{ + if (!gPaletteFade.active) + { + SetInputState(INPUT_STATE_ENABLED); + sub_80E3E94(1); + gNamingScreenData->state++; + } + return FALSE; +} + +static bool8 MainState_HandleInput(void) +{ + return HandleKeyboardEvent(); +} + +static bool8 MainState_MoveToOKButton(void) +{ + if (IsCursorAnimFinished()) + { + SetInputState(INPUT_STATE_ENABLED); + MoveCursorToOKButton(); + gNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; + } + return FALSE; +} + +static bool8 MainState_6(void) +{ + sub_80E4BE4(); + SetInputState(INPUT_STATE_DISABLED); + sub_80E3E94(0); + sub_80E3948(3, 0, 1); + if (gNamingScreenData->templateNum == NAMING_SCREEN_CAUGHT_MON && + CalculatePlayerPartyCount() >= 6) + { + DisplaySentToPCMessage(); + gNamingScreenData->state = MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE; + return FALSE; + } + else + { + gNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + return TRUE; //Exit the naming screen + } +} + +static bool8 MainState_BeginFadeInOut(void) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + gNamingScreenData->state++; + return FALSE; +} + +static bool8 MainState_WaitFadeOutAndExit(void) +{ + if (!gPaletteFade.active) + { + if (gNamingScreenData->templateNum == NAMING_SCREEN_PLAYER) + SeedRngAndSetTrainerId(); + SetMainCallback2(gNamingScreenData->returnCallback); + DestroyTask(FindTaskIdByFunc(sub_80E31B0)); + FreeAllWindowBuffers(); + FREE_AND_SET_NULL(gNamingScreenData); + } + return FALSE; +} + +static void DisplaySentToPCMessage(void) +{ + u8 stringToDisplay = 0; + + if (!sub_813B260()) + { + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar2, gNamingScreenData->destBuffer); + } + else + { + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar2, gNamingScreenData->destBuffer); + StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id())); + stringToDisplay = 2; + } + + if (FlagGet(FLAG_SYS_PC_LANETTE)) + stringToDisplay++; + + StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]); + sub_81973C4(0, 0); + gTextFlags.flag_0 = TRUE; + AddTextPrinterParametrized(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3); + CopyWindowToVram(0, 3); +} + +static bool8 sub_80E3604(void) +{ + RunTextPrinters(); + + if (!IsTextPrinterActive(0) && (gMain.newKeys & A_BUTTON)) + gNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + + return FALSE; +} + +static bool8 MainState_StartPageSwap(void) +{ + SetInputState(INPUT_STATE_DISABLED); + sub_80E4050(); + StartPageSwapAnim(); + sub_80E3E3C(1); + sub_80E3948(0, 0, 1); + PlaySE(SE_WIN_OPEN); + gNamingScreenData->state = MAIN_STATE_WAIT_PAGE_SWAP; + return FALSE; +} + +static bool8 MainState_WaitPageSwap(void) +{ + s16 cursorX; + s16 cursorY; + bool32 var3; + + if (IsPageSwapAnimNotInProgress()) + { + + GetCursorPos(&cursorX, &cursorY); + var3 = (cursorX == GetCurrentPageColumnCount()); + + gNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; + gNamingScreenData->currentPage++; + gNamingScreenData->currentPage %= 3; + + if (var3) + { + cursorX = GetCurrentPageColumnCount(); + } + else + { + if (cursorX >= GetCurrentPageColumnCount()) + cursorX = GetCurrentPageColumnCount() - 1; + } + + SetCursorPos(cursorX, cursorY); + sub_80E4E5C(); + SetInputState(INPUT_STATE_ENABLED); + sub_80E3E3C(0); + } + return FALSE; +} + +//-------------------------------------------------- +// Page Swap +//-------------------------------------------------- + +#define tState data[0] +#define tFrameCount data[1] + +static bool8 PageSwapAnimState_Init(struct Task *); +static bool8 PageSwapAnimState_1(struct Task *); +static bool8 PageSwapAnimState_2(struct Task *); +static bool8 PageSwapAnimState_Done(struct Task *); + +static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *) = +{ + PageSwapAnimState_Init, + PageSwapAnimState_1, + PageSwapAnimState_2, + PageSwapAnimState_Done, +}; + +static void StartPageSwapAnim(void) +{ + u8 taskId; + + taskId = CreateTask(Task_HandlePageSwapAnim, 0); + Task_HandlePageSwapAnim(taskId); +} + +static void Task_HandlePageSwapAnim(u8 taskId) +{ + while (sPageSwapAnimStateFuncs[gTasks[taskId].tState](&gTasks[taskId]) != 0); +} + +static bool8 IsPageSwapAnimNotInProgress(void) +{ + if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == 0xFF) + return TRUE; + else + return FALSE; +} + +static bool8 PageSwapAnimState_Init(struct Task *task) +{ + gNamingScreenData->bg1vOffset = 0; + gNamingScreenData->bg2vOffset = 0; + task->tState++; + return 0; +} + +static bool8 PageSwapAnimState_1(struct Task *task) +{ + u16 *const arr[] = + { + &gNamingScreenData->bg2vOffset, + &gNamingScreenData->bg1vOffset + }; + + task->tFrameCount += 4; + *arr[gNamingScreenData->unk1E20] = Sin(task->tFrameCount, 40); + *arr[gNamingScreenData->unk1E21] = Sin((task->tFrameCount + 128) & 0xFF, 40); + if (task->tFrameCount >= 64) + { + u8 temp = gNamingScreenData->unk1E1C; //Why u8 and not u16? + + gNamingScreenData->unk1E1C = gNamingScreenData->unk1E1E; + gNamingScreenData->unk1E1E = temp; + task->tState++; + } + return 0; +} + +static bool8 PageSwapAnimState_2(struct Task *task) +{ + u16 *const arr[] = {&gNamingScreenData->bg2vOffset, &gNamingScreenData->bg1vOffset}; + + task->tFrameCount += 4; + *arr[gNamingScreenData->unk1E20] = Sin(task->tFrameCount, 40); + *arr[gNamingScreenData->unk1E21] = Sin((task->tFrameCount + 128) & 0xFF, 40); + if (task->tFrameCount >= 128) + { + u8 temp = gNamingScreenData->unk1E20; + + gNamingScreenData->unk1E20 = gNamingScreenData->unk1E21; + gNamingScreenData->unk1E21 = temp; + task->tState++; + } + return 0; +} + +static bool8 PageSwapAnimState_Done(struct Task *task) +{ + DestroyTask(FindTaskIdByFunc(Task_HandlePageSwapAnim)); + return 0; +} + +#undef tState +#undef tFrameCount + +//-------------------------------------------------- +// +//-------------------------------------------------- + +static void sub_80E3920(void) +{ + u8 taskId; + + taskId = CreateTask(Task_80E39BC, 3); + gTasks[taskId].data[0] = 3; +} + +static void sub_80E3948(u8 a, u8 b, u8 c) +{ + struct Task *task = &gTasks[FindTaskIdByFunc(Task_80E39BC)]; + + if (a == task->data[0] && c == 0) + { + task->data[1] = b; + task->data[2] = 1; + return; + } + if (a == 3 && task->data[1] == 0 && c == 0) + return; + if (task->data[0] != 3) + sub_80E3AE8(task->data[0]); + sub_80E3B10(task, a, b); +} + +static void Task_80E39BC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (task->data[0] == 3 || task->data[2] == 0) + return; + MultiplyInvertedPaletteRGBComponents(sub_80E3A74(task->data[0]), task->data[3], task->data[3], task->data[3]); + if (task->data[5] != 0) + { + task->data[5]--; + if (task->data[5] != 0) + return; + } + task->data[5] = 2; + if (task->data[4] >= 0) + { + if (task->data[3] < 14) + { + task->data[3] += task->data[4]; + task->data[6] += task->data[4]; + } + else + { + task->data[3] = 16; + task->data[6]++; + } + } + else + { + task->data[3] += task->data[4]; + task->data[6] += task->data[4]; + } + + if (task->data[3] == 16 && task->data[6] == 22) + { + task->data[4] = -4; + } + else if (task->data[3] == 0) + { + task->data[2] = task->data[1]; + task->data[4] = 2; + task->data[6] = 0; + } +} + +static u16 sub_80E3A74(u8 a) +{ + const u16 arr[] = + { + IndexOfSpritePaletteTag(4) * 16 + 0x10E, + IndexOfSpritePaletteTag(6) * 16 + 0x10E, + IndexOfSpritePaletteTag(7) * 16 + 0x10E, + IndexOfSpritePaletteTag(7) * 16 + 0x101, + }; + + return arr[a]; +} + +static void sub_80E3AE8(u8 a) +{ + u16 index = sub_80E3A74(a); + + gPlttBufferFaded[index] = gPlttBufferUnfaded[index]; +} + +static void sub_80E3B10(struct Task *task, u8 b, u8 c) +{ + task->data[0] = b; + task->data[1] = c; + task->data[2] = 1; + task->data[3] = 4; + task->data[4] = 2; + task->data[5] = 0; + task->data[6] = 4; +} + +static void sub_80E3B30(struct Sprite *sprite) +{ + if (sprite->animEnded) + StartSpriteAnim(sprite, 0); + sprite->invisible = (sprite->data[4] & 0xFF); + if (sprite->data[0] == GetCurrentPageColumnCount()) + sprite->invisible = TRUE; + if (sprite->invisible || (sprite->data[4] & 0xFF00) == 0 + || sprite->data[0] != sprite->data[2] || sprite->data[1] != sprite->data[3]) + { + sprite->data[5] = 0; + sprite->data[6] = 2; + sprite->data[7] = 2; + } + sprite->data[7]--; + if (sprite->data[7] == 0) + { + sprite->data[5] += sprite->data[6]; + if (sprite->data[5] == 16 || sprite->data[5] == 0) + sprite->data[6] = -sprite->data[6]; + sprite->data[7] = 2; + } + if ((sprite->data[4] & 0xFF00) != 0) + { + s8 gb = sprite->data[5]; + s8 r = sprite->data[5] >> 1; + u16 index = IndexOfSpritePaletteTag(5) * 16 + 0x0101; + + MultiplyInvertedPaletteRGBComponents(index, r, gb, gb); + } +} + +static void sub_80E3C20(struct Sprite *sprite) +{ + const s16 arr[] = {0, -4, -2, -1}; + + if (sprite->data[0] == 0 || --sprite->data[0] == 0) + { + sprite->data[0] = 8; + sprite->data[1] = (sprite->data[1] + 1) & 3; + } + sprite->pos2.x = arr[sprite->data[1]]; +} + +static void sub_80E3C6C(struct Sprite *sprite) +{ + const s16 arr[] = {2, 3, 2, 1}; + u8 var; + + var = GetTextCaretPosition(); + if (var != (u8)sprite->data[0]) + { + sprite->pos2.y = 0; + sprite->data[1] = 0; + sprite->data[2] = 0; + } + else + { + sprite->pos2.y = arr[sprite->data[1]]; + sprite->data[2]++; + if (sprite->data[2] > 8) + { + sprite->data[1] = (sprite->data[1] + 1) & 3; + sprite->data[2] = 0; + } + } +} + +//-------------------------------------------------- +// Cursor +//-------------------------------------------------- + +static void sub_80E3CC8(void) +{ + CursorInit(); + sub_80E3F8C(); + sub_80E4218(); + sub_80E4290(); + sub_80E4354(); +} + +static void CursorInit(void) +{ + gNamingScreenData->cursorSpriteId = CreateSprite(&gUnknown_0858C138, 38, 88, 1); + sub_80E3E3C(1); + gSprites[gNamingScreenData->cursorSpriteId].oam.priority = 1; + gSprites[gNamingScreenData->cursorSpriteId].oam.objMode = 1; + gSprites[gNamingScreenData->cursorSpriteId].data[6] = 1; + gSprites[gNamingScreenData->cursorSpriteId].data[6] = 2; + SetCursorPos(0, 0); +} + +static void SetCursorPos(s16 x, s16 y) +{ + struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId]; + + if (x < gUnknown_0858BEA0[sub_80E3274()]) + cursorSprite->pos1.x = gUnknown_0858BEA3[x + sub_80E3274() * 8] + 38; + else + cursorSprite->pos1.x = 0; + + cursorSprite->pos1.y = y * 16 + 88; + cursorSprite->data[2] = cursorSprite->data[0]; + cursorSprite->data[3] = cursorSprite->data[1]; + cursorSprite->data[0] = x; + cursorSprite->data[1] = y; +} + +static void GetCursorPos(s16 *x, s16 *y) +{ + struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId]; + + *x = cursorSprite->data[0]; + *y = cursorSprite->data[1]; +} + +static void MoveCursorToOKButton(void) +{ + SetCursorPos(GetCurrentPageColumnCount(), 2); +} + +static void sub_80E3E3C(u8 a) +{ + gSprites[gNamingScreenData->cursorSpriteId].data[4] &= -256; + gSprites[gNamingScreenData->cursorSpriteId].data[4] |= a; + StartSpriteAnim(&gSprites[gNamingScreenData->cursorSpriteId], 0); +} + +static void sub_80E3E94(u8 a) +{ + gSprites[gNamingScreenData->cursorSpriteId].data[4] &= 0xFF; + gSprites[gNamingScreenData->cursorSpriteId].data[4] |= a << 8; +} + +static void sub_80E3ED8(void) +{ + StartSpriteAnim(&gSprites[gNamingScreenData->cursorSpriteId], 1); +} + +static bool8 IsCursorAnimFinished(void) +{ + return gSprites[gNamingScreenData->cursorSpriteId].animEnded; +} + +enum +{ + KEY_ROLE_CHAR, + KEY_ROLE_PAGE, + KEY_ROLE_BACKSPACE, + KEY_ROLE_OK, +}; + +static const u8 sKeyRoles[] = {KEY_ROLE_PAGE, KEY_ROLE_BACKSPACE, KEY_ROLE_OK}; + +static u8 GetKeyRoleAtCursorPos(void) +{ + s16 cursorX; + s16 cursorY; + + GetCursorPos(&cursorX, &cursorY); + if (cursorX < GetCurrentPageColumnCount()) + return KEY_ROLE_CHAR; + else + return sKeyRoles[cursorY]; +} + +static u8 GetCurrentPageColumnCount(void) +{ + return gUnknown_0858BEA0[sub_80E3274()]; +} + +static void sub_80E3F8C(void) +{ + u8 spriteId1; + u8 spriteId2; + u8 spriteId3; + + spriteId1 = CreateSprite(&gUnknown_0858C0C0, 0xCC, 0x58, 0); + gNamingScreenData->unk1E24 = spriteId1; + SetSubspriteTables(&gSprites[spriteId1], gUnknown_0858C050); + gSprites[spriteId1].invisible = TRUE; + + spriteId2 = CreateSprite(&gUnknown_0858C0F0, 0xCC, 0x54, 1); + gSprites[spriteId1].data[6] = spriteId2; + SetSubspriteTables(&gSprites[spriteId2], gUnknown_0858C058); + gSprites[spriteId2].invisible = TRUE; + + spriteId3 = CreateSprite(&gUnknown_0858C0D8, 0xCC, 0x53, 2); + gSprites[spriteId3].oam.priority = 1; + gSprites[spriteId1].data[7] = spriteId3; + gSprites[spriteId3].invisible = TRUE; +} + +static void sub_80E4050(void) +{ + struct Sprite *sprite = &gSprites[gNamingScreenData->unk1E24]; + + sprite->data[0] = 2; + sprite->data[1] = gNamingScreenData->currentPage; +} + +static u8 sub_80E40AC(struct Sprite *); +static u8 sub_80E4100(struct Sprite *); +static u8 sub_80E4104(struct Sprite *); +static u8 sub_80E4178(struct Sprite *); + +static u8 (*const gUnknown_0858BEE8[])(struct Sprite *) = +{ + sub_80E40AC, + sub_80E4100, + sub_80E4104, + sub_80E4178, +}; + +static void sub_80E4084(struct Sprite *sprite) +{ + while (gUnknown_0858BEE8[sprite->data[0]](sprite) != 0); +} + +static u8 sub_80E40AC(struct Sprite *sprite) +{ + struct Sprite *sprite1 = &gSprites[sprite->data[6]]; + struct Sprite *sprite2 = &gSprites[sprite->data[7]]; + + sub_80E41B8(sub_80E3244(gNamingScreenData->currentPage), sprite1, sprite2); + sprite->data[0]++; + return 0; +} + +static u8 sub_80E4100(struct Sprite *sprite) +{ + return 0; +} + +static u8 sub_80E4104(struct Sprite *sprite) +{ + struct Sprite *r4 = &gSprites[sprite->data[6]]; + struct Sprite *r5 = &gSprites[sprite->data[7]]; + + r4->pos2.y++; + if (r4->pos2.y > 7) + { + sprite->data[0]++; + r4->pos2.y = -4; + r4->invisible = TRUE; + sub_80E41B8(sub_80E3244(((u8)sprite->data[1] + 1) % 3), r4, r5); + } + return 0; +} + +static u8 sub_80E4178(struct Sprite *sprite) +{ + struct Sprite *r2 = &gSprites[sprite->data[6]]; + + r2->invisible = FALSE; + r2->pos2.y++; + if (r2->pos2.y >= 0) + { + r2->pos2.y = 0; + sprite->data[0] = 1; + } + return 0; +} + +static const u16 gUnknown_0858BEF8[] = {1, 3, 2}; +static const u16 gUnknown_0858BEFE[] = {4, 6, 5}; + +static void sub_80E41B8(u8 a, struct Sprite *b, struct Sprite *c) +{ + c->oam.paletteNum = IndexOfSpritePaletteTag(gUnknown_0858BEF8[a]); + b->sheetTileStart = GetSpriteTileStartByTag(gUnknown_0858BEFE[a]); + b->subspriteTableNum = a; +} + +// + +static void sub_80E4218(void) +{ + u8 spriteId; + + spriteId = CreateSprite(&gUnknown_0858C108, 0xCC, 0x74, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C070); + gSprites[spriteId].invisible = TRUE; + + spriteId = CreateSprite(&gUnknown_0858C120, 0xCC, 0x8C, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C070); + gSprites[spriteId].invisible = TRUE; +} + +static void sub_80E4290(void) +{ + u8 spriteId; + s16 r1; + u8 i; + + r1 = gNamingScreenData->unk1E16 - 5; + spriteId = CreateSprite(&gUnknown_0858C150, r1, 0x38, 0); + gSprites[spriteId].oam.priority = 3; + gSprites[spriteId].invisible = TRUE; + r1 = gNamingScreenData->unk1E16; + for (i = 0; i < gNamingScreenData->template->maxChars; i++, r1 += 8) + { + spriteId = CreateSprite(&gUnknown_0858C168, r1 + 3, 0x3C, 0); + gSprites[spriteId].oam.priority = 3; + gSprites[spriteId].data[0] = i; + gSprites[spriteId].invisible = TRUE; + } +} + +// + +static void TaskDummy2(void); +static void sub_80E4384(void); +static void sub_80E43E0(void); +static void sub_80E4420(void); +static void sub_80E447C(void); + +static void (*const gUnknown_0858BF04[])(void) = +{ + TaskDummy2, + sub_80E4384, + sub_80E43E0, + sub_80E4420, + sub_80E447C, +}; + +static void sub_80E4354(void) +{ + gUnknown_0858BF04[gNamingScreenData->template->unk2](); +} + +static void TaskDummy2(void) +{ + +} + +static void sub_80E4384(void) +{ + u8 rivalGfxId; + u8 spriteId; + + rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, gNamingScreenData->unk1E34); + spriteId = AddPseudoFieldObject(rivalGfxId, SpriteCallbackDummy, 0x38, 0x25, 0); + gSprites[spriteId].oam.priority = 3; + StartSpriteAnim(&gSprites[spriteId], 4); +} + +static void sub_80E43E0(void) +{ + u8 spriteId; + + spriteId = CreateSprite(&gUnknown_0858C180, 0x38, 0x29, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C078); + gSprites[spriteId].oam.priority = 3; +} + +static void sub_80E4420(void) +{ + u8 spriteId; + + sub_80D2F04(); + spriteId = CreateMonIcon(gNamingScreenData->unk1E34, SpriteCallbackDummy, 0x38, 0x28, 0, gNamingScreenData->unk1E38, 1); + gSprites[spriteId].oam.priority = 3; +} + +static void sub_80E447C(void) +{ + u8 spriteId; + + spriteId = AddPseudoFieldObject(0x13, SpriteCallbackDummy, 0x38, 0x25, 0); + gSprites[spriteId].oam.priority = 3; + StartSpriteAnim(&gSprites[spriteId], 4); +} + +//-------------------------------------------------- +// Keyboard handling +//-------------------------------------------------- + +static bool8 KeyboardKeyHandler_Character(u8); +static bool8 KeyboardKeyHandler_Page(u8); +static bool8 KeyboardKeyHandler_Backspace(u8); +static bool8 KeyboardKeyHandler_OK(u8); + +static bool8 (*const sKeyboardKeyHandlers[])(u8) = +{ + KeyboardKeyHandler_Character, + KeyboardKeyHandler_Page, + KeyboardKeyHandler_Backspace, + KeyboardKeyHandler_OK, +}; + +static bool8 HandleKeyboardEvent(void) +{ + u8 event = GetInputEvent(); + u8 keyRole = GetKeyRoleAtCursorPos(); + + if (event == KBEVENT_PRESSED_SELECT) + { + return sub_80E45E0(); + } + else if (event == KBEVENT_PRESSED_B) + { + DeleteTextCharacter(); + return FALSE; + } + else if (event == KBEVENT_PRESSED_START) + { + MoveCursorToOKButton(); + return FALSE; + } + else + { + return sKeyboardKeyHandlers[keyRole](event); + } +} + +static bool8 KeyboardKeyHandler_Character(u8 event) +{ + sub_80E3948(3, 0, 0); + if (event == KBEVENT_PRESSED_A) + { + bool8 var = sub_80E4B54(); + + sub_80E3ED8(); + if (var) + { + SetInputState(INPUT_STATE_2); + gNamingScreenData->state = MAIN_STATE_MOVE_TO_OK_BUTTON; + } + } + return FALSE; +} + +static bool8 KeyboardKeyHandler_Page(u8 event) +{ + sub_80E3948(0, 1, 0); + if (event == KBEVENT_PRESSED_A) + return sub_80E45E0(); + else + return FALSE; +} + +static bool8 KeyboardKeyHandler_Backspace(u8 event) +{ + sub_80E3948(1, 1, 0); + if (event == KBEVENT_PRESSED_A) + DeleteTextCharacter(); + return FALSE; +} + +static bool8 KeyboardKeyHandler_OK(u8 event) +{ + sub_80E3948(2, 1, 0); + if (event == KBEVENT_PRESSED_A) + { + PlaySE(SE_SELECT); + gNamingScreenData->state = MAIN_STATE_6; + return TRUE; + } + else + return FALSE; +} + +static bool8 sub_80E45E0(void) +{ + gNamingScreenData->state = MAIN_STATE_START_PAGE_SWAP; + return TRUE; +} + +//-------------------------------------------------- +// Input handling +//-------------------------------------------------- + +enum +{ + FNKEY_CASE, + FNKEY_BACK, + FNKEY_OK, +}; + +#define tState data[0] +#define tKeyboardEvent data[1] +#define tKbFunctionKey data[2] + + +static void InputState_Disabled(struct Task *); +static void InputState_Enabled(struct Task *); +static void InputState_2(struct Task *); + +static void (*const sInputStateFuncs[])(struct Task *) = +{ + InputState_Disabled, + InputState_Enabled, + InputState_2, +}; + +static void Task_HandleInput(u8); +static void HandleDpadMovement(struct Task *); + +static void InputInit(void) +{ + CreateTask(Task_HandleInput, 1); +} + +static u8 GetInputEvent(void) +{ + u8 taskId = FindTaskIdByFunc(Task_HandleInput); + + return gTasks[taskId].tKeyboardEvent; +} + +static void SetInputState(u8 state) +{ + u8 taskId = FindTaskIdByFunc(Task_HandleInput); + + gTasks[taskId].tState = state; +} + +static void Task_HandleInput(u8 taskId) +{ + sInputStateFuncs[gTasks[taskId].tState](&gTasks[taskId]); +} + +static void InputState_Disabled(struct Task *task) +{ + task->tKeyboardEvent = 0; +} + +static void InputState_Enabled(struct Task *task) +{ + task->tKeyboardEvent = 0; + + if (gMain.newKeys & A_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_A; + else if (gMain.newKeys & B_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_B; + else if (gMain.newKeys & SELECT_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_SELECT; + else if (gMain.newKeys & START_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_START; + else + HandleDpadMovement(task); +} + +static void InputState_2(struct Task *task) +{ + task->tKeyboardEvent = 0; +} + +static void HandleDpadMovement(struct Task *task) +{ + const s16 sDpadDeltaX[] = + { + 0, //none + 0, //up + 0, //down + -1, //left + 1 //right + }; + + const s16 sDpadDeltaY[] = + { + 0, //none + -1, //up + 1, //down + 0, //left + 0 //right + }; + + const s16 s4RowTo3RowTableY[] = {0, 1, 1, 2}; + const s16 gUnknown_0858BF50[] = {0, 0, 3}; + + s16 cursorX; + s16 cursorY; + u16 dpadDir; + s16 prevCursorX; + + GetCursorPos(&cursorX, &cursorY); + dpadDir = 0; + if (gMain.newAndRepeatedKeys & DPAD_UP) + dpadDir = 1; + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + dpadDir = 2; + if (gMain.newAndRepeatedKeys & DPAD_LEFT) + dpadDir = 3; + if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + dpadDir = 4; + + //Get new cursor position + prevCursorX = cursorX; + cursorX += sDpadDeltaX[dpadDir]; + cursorY += sDpadDeltaY[dpadDir]; + + //Wrap cursor position in the X direction + if (cursorX < 0) + cursorX = GetCurrentPageColumnCount(); + if (cursorX > GetCurrentPageColumnCount()) + cursorX = 0; + + //Handle cursor movement in X direction + if (sDpadDeltaX[dpadDir] != 0) + { + if (cursorX == GetCurrentPageColumnCount()) + { + //We are now on the last column + task->tKbFunctionKey = cursorY; + cursorY = s4RowTo3RowTableY[cursorY]; + } + else if (prevCursorX == GetCurrentPageColumnCount()) + { + if (cursorY == 1) + cursorY = task->tKbFunctionKey; + else + cursorY = gUnknown_0858BF50[cursorY]; + } + } + + if (cursorX == GetCurrentPageColumnCount()) + { + //There are only 3 keys on the last column, unlike the others, + //so wrap Y accordingly + if (cursorY < 0) + cursorY = 2; + if (cursorY > 2) + cursorY = 0; + if (cursorY == 0) + task->tKbFunctionKey = FNKEY_BACK; + else if (cursorY == 2) + task->tKbFunctionKey = FNKEY_OK; + } + else + { + if (cursorY < 0) + cursorY = 3; + if (cursorY > 3) + cursorY = 0; + } + SetCursorPos(cursorX, cursorY); +} + +#undef tState +#undef tKeyboardEvent +#undef tKbFunctionKey + +static void sub_80E4894(void) +{ + FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11); + PrintTextOnWindow(gNamingScreenData->windows[3], 1, gNamingScreenData->template->title, 8, 1, 0, 0); + PutWindowTilemap(gNamingScreenData->windows[3]); +} + +static void sub_80E48E8(void) +{ + u8 buffer[0x20]; + + StringCopy(buffer, gSpeciesNames[gNamingScreenData->unk1E34]); + StringAppendN(buffer, gNamingScreenData->template->title, 15); + FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11); + PrintTextOnWindow(gNamingScreenData->windows[3], 1, buffer, 8, 1, 0, 0); + PutWindowTilemap(gNamingScreenData->windows[3]); +} + +static void (*const gUnknown_0858BF58[])(void) = +{ + sub_80E4894, + sub_80E4894, + sub_80E48E8, + sub_80E48E8, + sub_80E4894, +}; + +static void sub_80E4964(void) +{ + gUnknown_0858BF58[gNamingScreenData->templateNum](); +} + +static void TaskDummy3(void); +static void sub_80E49BC(void); + +static void (*const gUnknown_0858BF6C[])(void) = +{ + TaskDummy3, + sub_80E49BC, +}; + +static void sub_80E498C(void) +{ + gUnknown_0858BF6C[gNamingScreenData->template->unk3](); +} + +static void TaskDummy3(void) +{ + +} + +static const struct TextColor sGenderColors[2] = +{ + {0, 9, 8}, + {0, 5, 4} +}; + +static void sub_80E49BC(void) +{ + u8 genderSymbol[2]; + bool8 isFemale = FALSE; + + StringCopy(genderSymbol, gText_MaleSymbol); + + if (gNamingScreenData->unk1E36 != MON_GENDERLESS) + { + if (gNamingScreenData->unk1E36 == MON_FEMALE) + { + StringCopy(genderSymbol, gText_FemaleSymbol); + isFemale = TRUE; + } + box_print(gNamingScreenData->windows[2], 1, 0x68, 1, &sGenderColors[isFemale], -1, genderSymbol); + } +} + +static u8 GetCharAtKeyboardPos(s16 a, s16 b) +{ + return gUnknown_0858BE40[a + b * 8 + sub_80E3274() * 32]; +} + + +static u8 GetTextCaretPosition(void) +{ + u8 i; + + for (i = 0; i < gNamingScreenData->template->maxChars; i++) + { + if (gNamingScreenData->textBuffer[i] == EOS) + return i; + } + return gNamingScreenData->template->maxChars - 1; +} + +static u8 GetPreviousTextCaretPosition(void) +{ + s8 i; + + for (i = gNamingScreenData->template->maxChars - 1; i > 0; i--) + { + if (gNamingScreenData->textBuffer[i] != EOS) + return i; + } + return 0; +} + +static void DeleteTextCharacter(void) +{ + u8 index; + u8 var2; + + index = GetPreviousTextCaretPosition(); + gNamingScreenData->textBuffer[index] = 0; + sub_80E4D10(); + CopyBgTilemapBufferToVram(3); + gNamingScreenData->textBuffer[index] = EOS; + var2 = GetKeyRoleAtCursorPos(); + if (var2 == 0 || var2 == 2) + sub_80E3948(1, 0, 1); + PlaySE(SE_BOWA); +} + +static bool8 sub_80E4B54(void) +{ + s16 x; + s16 y; + + GetCursorPos(&x, &y); + AddTextCharacter(GetCharAtKeyboardPos(x, y)); + sub_80E4D10(); + CopyBgTilemapBufferToVram(3); + PlaySE(SE_SELECT); + + if (GetPreviousTextCaretPosition() != gNamingScreenData->template->maxChars - 1) + return FALSE; + else + return TRUE; +} + +static void AddTextCharacter(u8 ch) +{ + u8 index = GetTextCaretPosition(); + + gNamingScreenData->textBuffer[index] = ch; +} + +static void sub_80E4BE4(void) +{ + u8 i; + + for (i = 0; i < gNamingScreenData->template->maxChars; i++) + { + if (gNamingScreenData->textBuffer[i] != CHAR_SPACE && gNamingScreenData->textBuffer[i] != EOS) + { + StringCopyN(gNamingScreenData->destBuffer, gNamingScreenData->textBuffer, gNamingScreenData->template->maxChars + 1); + break; + } + } +} + +static void choose_name_or_words_screen_load_bg_tile_patterns(void) +{ + LZ77UnCompWram(gNamingScreenMenu_Gfx, gNamingScreenData->tileBuffer); + LoadBgTiles(1, gNamingScreenData->tileBuffer, 0x600, 0); + LoadBgTiles(2, gNamingScreenData->tileBuffer, 0x600, 0); + LoadBgTiles(3, gNamingScreenData->tileBuffer, 0x600, 0); + LoadSpriteSheets(gUnknown_0858C1C8); + LoadSpritePalettes(gUnknown_0858C230); +} + +static void sub_80E4CB8(void) +{ + InputInit(); + sub_80E3920(); +} + +static void choose_name_or_words_screen_apply_bg_pals(void) +{ + LoadPalette(gNamingScreenMenu_Pal, 0, 0xC0); + LoadPalette(gUnknown_0858BD78, 0xA0, sizeof(gUnknown_0858BD78)); + LoadPalette(stdpal_get(2), 0xB0, 0x20); +} + +static void sub_80E4CF8(u8 bg, const void *src) +{ + CopyToBgTilemapBuffer(bg, src, 0, 0); +} + +static void nullsub_10(u8 a1, u8 a2) +{ + +} + +static void sub_80E4D10(void) +{ + u8 i; + u8 temp[2]; + u16 unk2; + u8 maxChars = gNamingScreenData->template->maxChars; + u16 unk = gNamingScreenData->unk1E16 - 0x40; + + FillWindowPixelBuffer(gNamingScreenData->windows[2], 0x11); + + for (i = 0; i < maxChars; i++) + { + temp[0] = gNamingScreenData->textBuffer[i]; + temp[1] = gExpandedPlaceholder_Empty[0]; + unk2 = (sub_80E503C(temp[0]) == 1) ? 2 : 0; + + PrintTextOnWindow(gNamingScreenData->windows[2], 1, temp, i * 8 + unk + unk2, 1, 0xFF, NULL); + } + + sub_80E498C(); + CopyWindowToVram(gNamingScreenData->windows[2], 2); + PutWindowTilemap(gNamingScreenData->windows[2]); +} + +static const struct AlignedTextColor sUnkColor1 = +{ + 13, 1, 2 +}; + +static const struct AlignedTextColor sUnkColor2 = +{ + 14, 1, 2 +}; + +static const struct AlignedTextColor sUnkColor3 = +{ + 15, 1, 2 +}; + +static const u8 sFillValues[3] = +{ + 0xEE, 0xDD, 0xFF +}; + +static const struct AlignedTextColor *const sUnkColors[3] = +{ + &sUnkColor2, + &sUnkColor1, + &sUnkColor3 +}; + +static void sub_80E4DE4(u8 window, u8 a1) +{ + u8 i; + + FillWindowPixelBuffer(window, sFillValues[a1]); + + for (i = 0; i < 4; i++) + { + box_print(window, 1, 0, i * 16 + 1, sUnkColors[a1], 0, gUnknown_0858C198[a1][i]); + } + + PutWindowTilemap(window); +} + +static const u8 *const gUnknown_0858BF98[] = +{ + gUnknown_08DD4620, + gUnknown_08DD46E0, + gUnknown_08DD47A0 +}; + +static void sub_80E4E5C(void) +{ + u8 unk1; + u8 unk2; + u8 unk3; + u8 bg1Priority = GetGpuReg(REG_OFFSET_BG1CNT) & 3; + u8 bg2Priority = GetGpuReg(REG_OFFSET_BG2CNT) & 3; + + if (bg1Priority > bg2Priority) + { + unk1 = 1; + unk2 = 1; + unk3 = gNamingScreenData->windows[0]; + } + else + { + unk1 = 2; + unk2 = 2; + unk3 = gNamingScreenData->windows[1]; + } + + sub_80E4CF8(unk1, gUnknown_0858BF98[gNamingScreenData->currentPage]); + sub_80E4DE4(unk3, sub_80E3254()); + nullsub_10(unk1, sub_80E3254()); + CopyBgTilemapBufferToVram(unk2); +} + +static void sub_80E4EF0(void) +{ + const u8 arr[] = { 15, 1, 2 }; + + FillWindowPixelBuffer(gNamingScreenData->windows[4], 0xFF); + box_print(gNamingScreenData->windows[4], 0, 2, 1, arr, 0, gText_MoveOkBack); + PutWindowTilemap(gNamingScreenData->windows[4]); + CopyWindowToVram(gNamingScreenData->windows[4], 3); +} + +static void sub_80E4F58(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void NamingScreen_TurnOffScreen(void) +{ + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); +} + +static void NamingScreen_InitDisplayMode(void) +{ + SetVBlankCallback(VBlankCB_NamingScreen); +} + +static void VBlankCB_NamingScreen(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + SetGpuReg(REG_OFFSET_BG1VOFS, gNamingScreenData->bg1vOffset); + SetGpuReg(REG_OFFSET_BG2VOFS, gNamingScreenData->bg2vOffset); + SetGpuReg(REG_OFFSET_BG1CNT, GetGpuReg(REG_OFFSET_BG1CNT) & 0xFFFC); + SetGpuRegBits(REG_OFFSET_BG1CNT, gNamingScreenData->unk1E1C); + SetGpuReg(REG_OFFSET_BG2CNT, GetGpuReg(REG_OFFSET_BG2CNT) & 0xFFFC); + SetGpuRegBits(REG_OFFSET_BG2CNT, gNamingScreenData->unk1E1E); +} + +static void sub_80E501C(void) +{ + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} + +static bool8 sub_80E503C(u8 character) +{ + u8 i; + + for (i = 0; gUnknown_0858BDC8[i] != EOS; i++) + { + if (character == gUnknown_0858BDC8[i]) + return FALSE; + } + return FALSE; +} + +static void sub_80E5074(void) +{ + DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E509C(void) +{ + DoNamingScreen(1, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E50C4(void) +{ + DoNamingScreen(2, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E50EC(void) +{ + DoNamingScreen(3, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +//-------------------------------------------------- +// Forward-declared variables +//-------------------------------------------------- + +static const struct NamingScreenTemplate playerNamingScreenTemplate = +{ + .unk0 = 0, + .maxChars = 7, + .unk2 = 1, + .unk3 = 0, + .unk4 = 1, + .unk5 = 35, + .unk6 = 0, + .unk7 = 0, + .title = gText_YourName, +}; + +static const struct NamingScreenTemplate pcBoxNamingTemplate = +{ + .unk0 = 0, + .maxChars = 8, + .unk2 = 2, + .unk3 = 0, + .unk4 = 1, + .unk5 = 19, + .unk6 = 0, + .unk7 = 0, + .title = gText_BoxName, +}; + +static const struct NamingScreenTemplate monNamingScreenTemplate = +{ + .unk0 = 0, + .maxChars = 10, + .unk2 = 3, + .unk3 = 1, + .unk4 = 1, + .unk5 = 35, + .unk6 = 0, + .unk7 = 0, + .title = gText_PkmnsNickname, +}; + +static const struct NamingScreenTemplate wandaWordsScreenTemplate = +{ + .unk0 = 1, + .maxChars = 15, + .unk2 = 4, + .unk3 = 0, + .unk4 = 1, + .unk5 = 11, + .unk6 = 0, + .unk7 = 0, + .title = gText_TellHimTheWords, +}; + +static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = +{ + &playerNamingScreenTemplate, + &pcBoxNamingTemplate, + &monNamingScreenTemplate, + &monNamingScreenTemplate, + &wandaWordsScreenTemplate, +}; + +const struct OamData gOamData_858BFEC = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gOamData_858BFF4 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gOamData_858BFFC = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +static const struct Subsprite gUnknown_0858C004[] = +{ + {-20, -16, 1, 1, 0, 1}, + { 12, -16, 0, 0, 4, 1}, + {-20, -8, 1, 1, 5, 1}, + { 12, -8, 0, 0, 9, 1}, + {-20, 0, 1, 1, 10, 1}, + { 12, 0, 0, 0, 14, 1}, + {-20, 8, 1, 1, 15, 1}, + { 12, 8, 0, 0, 19, 1} +}; + +static const struct Subsprite gUnknown_0858C024[] = +{ + {-12, -4, 1, 0, 0, 1}, + { 4, -4, 0, 0, 2, 1} +}; + +static const struct Subsprite gUnknown_0858C02C[] = +{ + {-20, -12, 1, 1, 0, 1}, + { 12, -12, 0, 0, 4, 1}, + {-20, -4, 1, 1, 5, 1}, + { 12, -4, 0, 0, 9, 1}, + {-20, 4, 1, 1, 10, 1}, + { 12, 4, 0, 0, 14, 1} +}; + +static const struct Subsprite gUnknown_0858C044[] = +{ + {-8, -12, 1, 0, 0, 3}, + {-8, -4, 1, 0, 2, 3}, + {-8, 4, 1, 0, 4, 3} +}; + +static const struct SubspriteTable gUnknown_0858C050[] = +{ + {ARRAY_COUNT(gUnknown_0858C004), gUnknown_0858C004} +}; + +static const struct SubspriteTable gUnknown_0858C058[] = +{ + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024}, + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024}, + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024} +}; + +static const struct SubspriteTable gUnknown_0858C070[] = +{ + {ARRAY_COUNT(gUnknown_0858C02C), gUnknown_0858C02C} +}; + +static const struct SubspriteTable gUnknown_0858C078[] = +{ + {ARRAY_COUNT(gUnknown_0858C044), gUnknown_0858C044} +}; + +static const struct SpriteFrameImage gUnknown_0858C080[] = +{ + {gSpriteImage_858BBF8, sizeof(gSpriteImage_858BBF8)}, + {gSpriteImage_858BCB8, sizeof(gSpriteImage_858BCB8)}, +}; + +static const union AnimCmd gSpriteAnim_858C090[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_858C098[] = +{ + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(8, 8), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_858C0A4[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(1, 2), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0B0[] = +{ + gSpriteAnim_858C090 +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0B4[] = +{ + gSpriteAnim_858C090, + gSpriteAnim_858C098 +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0BC[] = +{ + gSpriteAnim_858C0A4 +}; + +static const struct SpriteTemplate gUnknown_0858C0C0 = +{ + .tileTag = 0x0002, + .paletteTag = 0x0004, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E4084 +}; + +static const struct SpriteTemplate gUnknown_0858C0D8 = +{ + .tileTag = 0x0003, + .paletteTag = 0x0001, + .oam = &gOamData_858BFFC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C0F0 = +{ + .tileTag = 0x0004, + .paletteTag = 0x0004, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C108 = +{ + .tileTag = 0x0000, + .paletteTag = 0x0006, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C120 = +{ + .tileTag = 0x0001, + .paletteTag = 0x0007, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C138 = +{ + .tileTag = 0x0007, + .paletteTag = 0x0005, + .oam = &gOamData_858BFF4, + .anims = gSpriteAnimTable_858C0B4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3B30 +}; + +static const struct SpriteTemplate gUnknown_0858C150 = +{ + .tileTag = 0x000A, + .paletteTag = 0x0003, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3C20 +}; + +static const struct SpriteTemplate gUnknown_0858C168 = +{ + .tileTag = 0x000B, + .paletteTag = 0x0003, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3C6C +}; + +static const struct SpriteTemplate gUnknown_0858C180 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x0000, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0BC, + .images = gUnknown_0858C080, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +extern const u8 gUnknown_0862B88D[]; +extern const u8 gUnknown_0862B8AE[]; +extern const u8 gUnknown_0862B8CF[]; +extern const u8 gUnknown_0862B8F0[]; +extern const u8 gUnknown_0862B911[]; +extern const u8 gUnknown_0862B932[]; +extern const u8 gUnknown_0862B953[]; +extern const u8 gUnknown_0862B974[]; +extern const u8 gUnknown_0862B995[]; +extern const u8 gUnknown_0862B9AE[]; +extern const u8 gUnknown_0862B9C7[]; +extern const u8 gUnknown_0862B9E0[]; + +static const u8* const gUnknown_0858C198[][4] = +{ + { + gUnknown_0862B88D, + gUnknown_0862B8AE, + gUnknown_0862B8CF, + gUnknown_0862B8F0 + }, + { + gUnknown_0862B911, + gUnknown_0862B932, + gUnknown_0862B953, + gUnknown_0862B974 + }, + { + gUnknown_0862B995, + gUnknown_0862B9AE, + gUnknown_0862B9C7, + gUnknown_0862B9E0 + }, +}; + +static const struct SpriteSheet gUnknown_0858C1C8[] = +{ + {gNamingScreenRWindow_Gfx + 0x280, 0x1E0, 0x0000}, + {gNamingScreenRWindow_Gfx + 0x460, 0x1E0, 0x0001}, + {gNamingScreenRWindow_Gfx, 0x280, 0x0002}, + {gNamingScreenKeyboardButton_Gfx + 0x20, 0x100, 0x0003}, + {gNamingScreenROptions_Gfx, 0x060, 0x0004}, + {gNamingScreenROptions_Gfx + 0xA0, 0x060, 0x0005}, + {gNamingScreenROptions_Gfx + 0x140, 0x060, 0x0006}, + {gNamingScreenCursor_Gfx, 0x080, 0x0007}, + {gNamingScreenCursor_Gfx + 0xA0, 0x080, 0x0008}, + {gNamingScreenCursor_Gfx + 0x140, 0x080, 0x0009}, + {gNamingScreenRightPointingTriangleTiles, 0x020, 0x000A}, + {gNamingScreenUnderscoreTiles, 0x020, 0x000B}, + {NULL} +}; + +static const struct SpritePalette gUnknown_0858C230[] = +{ + {gNamingScreenMenu_Pal, 0x0000}, + {gNamingScreenMenu_Pal + 0x10, 0x0001}, + {gNamingScreenMenu_Pal + 0x20, 0x0002}, + {gNamingScreenMenu_Pal + 0x30, 0x0003}, + {gNamingScreenMenu_Pal + 0x40, 0x0004}, + {gNamingScreenMenu_Pal + 0x50, 0x0005}, + {gNamingScreenMenu_Pal + 0x40, 0x0006}, + {gNamingScreenMenu_Pal + 0x40, 0x0007}, + {NULL} +}; diff --git a/sym_ewram.txt b/sym_ewram.txt index c9e3ffac4c..bb2e36fc9e 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -945,7 +945,7 @@ gUnknown_02039F8C: @ 2039F8C gUnknown_02039F90: @ 2039F90 .space 0x4 -gUnknown_02039F94: @ 2039F94 +gNamingScreenData: @ 2039F94 .space 0x4 .include "src/money.o"