From 8fd30813062f9588529461f44df333a6bcfde411 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Nov 2017 16:11:34 +0100 Subject: [PATCH] start working on berry blender --- asm/battle_frontier_1.s | 2 +- asm/berry_blender.s | 1887 +++------------------------------- asm/cable_club.s | 52 +- asm/contest.s | 2 +- asm/contest_link_80FC4F4.s | 8 +- asm/item_menu.s | 2 +- asm/link.s | 50 +- asm/menu.s | 2 +- asm/mystery_event_menu.s | 2 +- asm/naming_screen.s | 2 +- asm/new_menu_helpers.s | 12 +- asm/party_menu.s | 2 +- asm/pokeblock_feed.s | 2 +- asm/pokemon_summary_screen.s | 2 +- asm/pokenav.s | 6 +- asm/record_mixing.s | 2 +- asm/rom6.s | 4 +- asm/shop.s | 2 +- asm/trade.s | 14 +- data/graphics.s | 2 +- data/link.s | 20 +- data/scripts/pokeblocks.inc | 4 +- data/specials.inc | 2 +- include/berry.h | 10 + include/decompress.h | 2 + include/flags.h | 1 + include/gba/m4a_internal.h | 2 +- include/item_menu_icons.h | 6 + include/items.h | 4 + include/new_menu_helpers.h | 1 + src/battle_message.c | 4 +- src/berry.c | 22 +- src/berry_blender.c | 947 ++++++++++++++++- src/decompress.c | 5 +- src/m4a_4.c | 4 +- sym_common.txt | 2 +- sym_ewram.txt | 6 +- 37 files changed, 1229 insertions(+), 1870 deletions(-) create mode 100644 include/item_menu_icons.h diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index e52ed0c3d..973e87fbb 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -14531,7 +14531,7 @@ sub_81965D8: @ 81965D8 negs r0, r0 ands r0, r1 strb r0, [r2] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 diff --git a/asm/berry_blender.s b/asm/berry_blender.s index f0d1b48d7..e0571c653 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -5,1590 +5,7 @@ .text - thumb_func_start sub_807F738 -sub_807F738: @ 807F738 - push {lr} - ldr r0, =gMPlay_SE2 - ldr r1, =0x0000ffff - ldr r2, =gUnknown_020322A4 - ldr r2, [r2] - adds r2, 0x4C - movs r3, 0 - ldrsh r2, [r2, r3] - subs r2, 0x80 - lsls r2, 17 - asrs r2, 16 - bl m4aMPlayPitchControl - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F738 - thumb_func_start sub_807F764 -sub_807F764: @ 807F764 - push {r4,lr} - sub sp, 0x10 - bl sub_8082DF4 - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - mov r12, r0 - movs r0, 0xA0 - lsls r0, 1 - add r0, r12 - ldr r1, [r0] - movs r0, 0xA2 - lsls r0, 1 - add r0, r12 - ldr r2, [r0] - movs r0, 0xA4 - lsls r0, 1 - add r0, r12 - movs r4, 0 - ldrsh r3, [r0, r4] - movs r0, 0xA5 - lsls r0, 1 - add r0, r12 - movs r4, 0 - ldrsh r0, [r0, r4] - str r0, [sp] - movs r0, 0xA6 - lsls r0, 1 - add r0, r12 - movs r4, 0 - ldrsh r0, [r0, r4] - str r0, [sp, 0x4] - movs r0, 0xA7 - lsls r0, 1 - add r0, r12 - movs r4, 0 - ldrsh r0, [r0, r4] - str r0, [sp, 0x8] - movs r0, 0xA8 - lsls r0, 1 - add r0, r12 - ldrh r0, [r0] - str r0, [sp, 0xC] - movs r0, 0x2 - bl SetBgAffine - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F764 - - thumb_func_start sub_807F7D8 -sub_807F7D8: @ 807F7D8 - push {r4,r5,lr} - ldr r1, =gUnknown_020322A4 - ldr r0, [r1] - ldrb r0, [r0, 0x1] - adds r5, r1, 0 - cmp r0, 0x9 - bls _0807F7E8 - b _0807F9C8 -_0807F7E8: - lsls r0, 2 - ldr r1, =_0807F7FC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807F7FC: - .4byte _0807F824 - .4byte _0807F854 - .4byte _0807F880 - .4byte _0807F8AC - .4byte _0807F8C8 - .4byte _0807F8F4 - .4byte _0807F910 - .4byte _0807F940 - .4byte _0807F950 - .4byte _0807F980 -_0807F824: - ldr r5, =gUnknown_08D91598 - adds r0, r5, 0 - bl sub_8034974 - adds r0, 0x64 - bl AllocZeroed - adds r1, r0, 0 - ldr r4, =gUnknown_020322A4 - ldr r0, [r4] - ldr r2, =0x000011bc - adds r0, r2 - str r1, [r0] - adds r0, r5, 0 - bl LZDecompressWram - ldr r1, [r4] - b _0807F966 - .pool -_0807F854: - ldr r1, =sBlenderCenterMap - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x2 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r0, =sBlenderCenterPal - movs r2, 0x80 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - b _0807F962 - .pool -_0807F880: - ldr r0, [r5] - ldr r1, =0x000011bc - adds r0, r1 - ldr r4, [r0] - ldr r0, =gUnknown_08D91598 - bl sub_8034974 - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x2 - adds r1, r4, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r5] - b _0807F966 - .pool -_0807F8AC: - ldr r0, =gUnknown_08D91DB8 - ldr r1, [r5] - ldr r2, =0x000011bc - adds r1, r2 - ldr r1, [r1] - bl LZDecompressWram - ldr r1, [r5] - b _0807F966 - .pool -_0807F8C8: - ldr r0, [r5] - ldr r1, =0x000011bc - adds r0, r1 - ldr r4, [r0] - ldr r0, =gUnknown_08D91DB8 - bl sub_8034974 - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - adds r1, r4, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r5] - b _0807F966 - .pool -_0807F8F4: - ldr r0, =gUnknown_08D927EC - ldr r1, [r5] - ldr r2, =0x000011bc - adds r1, r2 - ldr r1, [r1] - bl LZDecompressWram - ldr r1, [r5] - b _0807F966 - .pool -_0807F910: - ldr r0, [r5] - ldr r1, =0x000011bc - adds r0, r1 - ldr r4, [r0] - ldr r0, =gUnknown_08D927EC - bl sub_8034974 - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - adds r1, r4, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r1, [r5] - b _0807F966 - .pool -_0807F940: - ldr r0, =sBlenderOuterPal - movs r1, 0x80 - movs r2, 0x20 - bl LoadPalette - b _0807F962 - .pool -_0807F950: - ldr r0, =sSpriteSheet_BlenderArrow - bl LoadSpriteSheet - ldr r0, =gUnknown_08339BD8 - bl LoadSpriteSheet - ldr r0, =gUnknown_08339B38 - bl LoadSpriteSheet -_0807F962: - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] -_0807F966: - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _0807F9C8 - .pool -_0807F980: - ldr r0, =gUnknown_08339C24 - bl LoadSpriteSheet - ldr r0, =gUnknown_08339C58 - bl LoadSpriteSheet - ldr r0, =sSpritePal_BlenderArrow - bl LoadSpritePalette - ldr r0, =sSpritePal_BlenderMisc - bl LoadSpritePalette - ldr r4, =gUnknown_020322A4 - ldr r0, [r4] - ldr r2, =0x000011bc - adds r0, r2 - ldr r0, [r0] - bl Free - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x1] - movs r0, 0x1 - b _0807F9CA - .pool -_0807F9C8: - movs r0, 0 -_0807F9CA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_807F7D8 - - thumb_func_start sub_807F9D0 -sub_807F9D0: @ 807F9D0 - push {lr} - sub sp, 0x8 - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuRegBits - 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 - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_807F9D0 - - thumb_func_start sub_807FA34 -sub_807FA34: @ 807FA34 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_08339980 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - beq _0807FA74 - bl DeactivateAllTextPrinters - movs r4, 0 -_0807FA4A: - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - adds r4, 0x1 - cmp r4, 0x4 - ble _0807FA4A - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0xE0 - bl sub_81978B0 -_0807FA74: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FA34 - - thumb_func_start sub_807FA80 -sub_807FA80: @ 807FA80 - push {r4,lr} - ldr r4, =gUnknown_020322A4 - ldr r0, [r4] - cmp r0, 0 - bne _0807FA94 - movs r0, 0x8F - lsls r0, 5 - bl AllocZeroed - str r0, [r4] -_0807FA94: - ldr r0, [r4] - adds r0, 0x63 - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x63 - strb r1, [r0] - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - bl sub_807FE54 - ldr r0, =sub_807FAC8 - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FA80 - - thumb_func_start sub_807FAC8 -sub_807FAC8: @ 807FAC8 - push {r4-r6,lr} - sub sp, 0x4 - ldr r1, =gUnknown_020322A4 - ldr r0, [r1] - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0x6 - bls _0807FADA - b _0807FCE2 -_0807FADA: - lsls r0, 2 - ldr r1, =_0807FAEC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807FAEC: - .4byte _0807FB08 - .4byte _0807FBAC - .4byte _0807FC38 - .4byte _0807FC4E - .4byte _0807FC64 - .4byte _0807FC90 - .4byte _0807FCB0 -_0807FB08: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - bl ResetSpriteData - bl FreeAllSpritePalettes - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08339974 - movs r0, 0x1 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r4, =gUnknown_020322A4 - ldr r1, [r4] - movs r0, 0xDC - lsls r0, 1 - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x000009b8 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl sub_809882C - movs r0, 0 - movs r1, 0x14 - movs r2, 0xF0 - bl copy_textbox_border_tile_patterns_to_vram - bl sub_807FA34 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r3, [r4] - movs r1, 0x8C - lsls r1, 1 - adds r0, r3, r1 - movs r1, 0 - strh r2, [r0] - movs r4, 0x8B - lsls r4, 1 - adds r0, r3, r4 - strh r2, [r0] - movs r0, 0x8D - lsls r0, 1 - adds r4, r3, r0 - movs r0, 0x50 - strh r0, [r4] - movs r4, 0x8E - lsls r4, 1 - adds r0, r3, r4 - strh r2, [r0] - adds r4, 0x2 - adds r0, r3, r4 - strh r2, [r0] - strb r1, [r3, 0x1] - bl sub_8082D28 - b _0807FCE2 - .pool -_0807FBAC: - bl sub_807F7D8 - lsls r0, 24 - cmp r0, 0 - bne _0807FBB8 - b _0807FCE2 -_0807FBB8: - movs r4, 0 - ldr r5, =sBlenderSyncArrowsPos - ldr r6, =gUnknown_020322A4 -_0807FBBE: - ldrb r1, [r5] - ldrb r2, [r5, 0x1] - ldr r0, =sBlenderSyncArrow_SpriteTemplate - movs r3, 0x1 - bl CreateSprite - ldr r1, [r6] - adds r1, 0x50 - adds r1, r4 - strb r0, [r1] - ldr r0, [r6] - adds r0, 0x50 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r1, r4, 0 - adds r1, 0x8 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - adds r5, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - ble _0807FBBE - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0807FC14 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0807FC14 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 -_0807FC14: - ldr r0, =sub_807F764 - bl SetVBlankCallback - b _0807FCA0 - .pool -_0807FC38: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl sub_8082D28 - b _0807FCA0 -_0807FC4E: - bl sub_807F9D0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807FCE2 - b _0807FCA0 - .pool -_0807FC64: - ldr r4, [r6] - ldr r0, =0x000011b8 - adds r4, r0 - ldr r5, =gText_BerryBlenderStart - bl sav2_get_text_speed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_808417C - cmp r0, 0 - beq _0807FCE2 - ldr r1, [r6] - b _0807FCA4 - .pool -_0807FC90: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0807FCA0: - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] -_0807FCA4: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807FCE2 - .pool -_0807FCB0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0807FCE2 - bl FreeAllWindowBuffers - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0 - bl SetVBlankCallback - ldr r0, =sub_807FFA4 - bl sub_81AABF0 - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - strb r4, [r0] -_0807FCE2: - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FAC8 - - thumb_func_start sub_807FD08 -sub_807FD08: @ 807FD08 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x30] - adds r0, r1 - strh r0, [r4, 0x30] - ldrh r1, [r4, 0x32] - ldrh r2, [r4, 0x36] - subs r1, r2 - ldrh r0, [r4, 0x3C] - adds r1, r0 - strh r1, [r4, 0x32] - ldrh r3, [r4, 0x2E] - adds r0, r3 - strh r0, [r4, 0x2E] - subs r2, 0x1 - strh r2, [r4, 0x36] - lsls r0, 16 - lsls r1, 16 - cmp r0, r1 - bge _0807FD56 - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x36] - strh r0, [r4, 0x34] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _0807FD50 - adds r0, r4, 0 - bl DestroySprite - b _0807FD56 -_0807FD50: - movs r0, 0x74 - bl PlaySE -_0807FD56: - ldrh r0, [r4, 0x30] - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x32] - strh r0, [r4, 0x22] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_807FD08 - - thumb_func_start sub_807FD64 -sub_807FD64: @ 807FD64 - push {r4-r6,lr} - ldr r5, [sp, 0x10] - ldr r6, [sp, 0x14] - lsls r2, 16 - lsrs r2, 16 - movs r4, 0 - strh r2, [r0, 0x2E] - strh r1, [r0, 0x30] - strh r2, [r0, 0x32] - strh r3, [r0, 0x34] - movs r1, 0xA - strh r1, [r0, 0x36] - strh r4, [r0, 0x38] - strh r5, [r0, 0x3A] - strh r6, [r0, 0x3C] - ldr r1, =sub_807FD08 - str r1, [r0, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FD64 - - thumb_func_start sub_807FD90 -sub_807FD90: @ 807FD90 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x8 - adds r6, r1, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r0, 24 - movs r1, 0xF6 - lsls r1, 23 - adds r0, r1 - lsrs r0, 24 - movs r3, 0x1 - ands r3, r6 - movs r1, 0 - movs r2, 0x50 - bl sub_80D511C - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - mov r8, r2 - add r8, r0 - mov r3, r8 - lsls r3, 2 - mov r8, r3 - ldr r0, =gSprites - add r8, r0 - ldr r5, =gUnknown_08339C78 - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 1 - adds r0, r4, r5 - movs r6, 0 - ldrsh r1, [r0, r6] - adds r0, r5, 0x2 - adds r0, r4, r0 - movs r3, 0 - ldrsh r2, [r0, r3] - adds r0, r5, 0x4 - adds r0, r4, r0 - movs r6, 0 - ldrsh r3, [r0, r6] - adds r0, r5, 0x6 - adds r0, r4, r0 - movs r6, 0 - ldrsh r0, [r0, r6] - str r0, [sp] - adds r5, 0x8 - adds r4, r5 - movs r5, 0 - ldrsh r0, [r4, r5] - str r0, [sp, 0x4] - mov r0, r8 - bl sub_807FD64 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FD90 - - thumb_func_start sub_807FE14 -sub_807FE14: @ 807FE14 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r5, r1, 16 - lsrs r5, 16 - adds r0, r5, 0 - adds r0, 0x7C - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - adds r4, r0, 0 - strh r5, [r6] - adds r0, r6, 0x2 - adds r1, r4, 0 - bl StringCopy - ldrb r0, [r4, 0x15] - strb r0, [r6, 0x9] - ldrb r0, [r4, 0x16] - strb r0, [r6, 0xA] - ldrb r0, [r4, 0x17] - strb r0, [r6, 0xB] - ldrb r0, [r4, 0x18] - strb r0, [r6, 0xC] - ldrb r0, [r4, 0x19] - strb r0, [r6, 0xD] - ldrb r0, [r4, 0x1A] - strb r0, [r6, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_807FE14 - - thumb_func_start sub_807FE54 -sub_807FE54: @ 807FE54 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - beq _0807FE7C - cmp r5, 0x1 - bgt _0807FE68 - cmp r5, 0 - beq _0807FE72 - b _0807FF88 -_0807FE68: - cmp r5, 0x2 - beq _0807FEE8 - cmp r5, 0x3 - beq _0807FF3C - b _0807FF88 -_0807FE72: - ldr r0, =gUnknown_03005D98 - strb r5, [r0] - b _0807FF88 - .pool -_0807FE7C: - ldr r0, =gUnknown_03005D98 - strb r5, [r0] - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - adds r0, 0x7C - movs r1, 0x2 - strb r1, [r0] - ldr r4, =gLinkPlayers + 8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - movs r0, 0xD0 - lsls r0, 2 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _0807FEC8 - adds r0, r4, 0 - adds r0, 0x1C - ldr r1, =sBlenderOpponentsNames - ldr r1, [r1, 0xC] - bl StringCopy - b _0807FED4 - .pool -_0807FEC8: - adds r0, r4, 0 - adds r0, 0x1C - ldr r1, =sBlenderOpponentsNames - ldr r1, [r1] - bl StringCopy -_0807FED4: - ldr r1, =gLinkPlayers - movs r0, 0x2 - strh r0, [r1, 0x1A] - strh r0, [r1, 0x36] - b _0807FF88 - .pool -_0807FEE8: - ldr r0, =gUnknown_03005D98 - strb r5, [r0] - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - adds r0, 0x7C - movs r1, 0x3 - strb r1, [r0] - ldr r6, =gLinkPlayers + 8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r6, 0 - bl StringCopy - adds r0, r6, 0 - adds r0, 0x1C - ldr r4, =sBlenderOpponentsNames - ldr r1, [r4, 0x10] - bl StringCopy - adds r0, r6, 0 - adds r0, 0x38 - ldr r1, [r4, 0x8] - bl StringCopy - adds r0, r6, 0 - subs r0, 0x8 - strh r5, [r0, 0x1A] - strh r5, [r0, 0x36] - adds r0, 0x52 - strh r5, [r0] - b _0807FF88 - .pool -_0807FF3C: - ldr r0, =gUnknown_03005D98 - strb r5, [r0] - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - adds r0, 0x7C - movs r1, 0x4 - strb r1, [r0] - ldr r5, =gLinkPlayers + 8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r5, 0 - bl StringCopy - adds r0, r5, 0 - adds r0, 0x1C - ldr r4, =sBlenderOpponentsNames - ldr r1, [r4, 0x14] - bl StringCopy - adds r0, r5, 0 - adds r0, 0x38 - ldr r1, [r4, 0x4] - bl StringCopy - adds r0, r5, 0 - adds r0, 0x54 - ldr r1, [r4, 0x8] - bl StringCopy - adds r0, r5, 0 - subs r0, 0x8 - movs r1, 0x2 - strh r1, [r0, 0x1A] - strh r1, [r0, 0x36] - adds r0, 0x52 - strh r1, [r0] - adds r0, 0x1C - strh r1, [r0] -_0807FF88: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FE54 - - thumb_func_start sub_807FFA4 -sub_807FFA4: @ 807FFA4 - push {r4,r5,lr} - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r4, =gUnknown_020322A4 - ldr r0, [r4] - cmp r0, 0 - bne _0807FFC0 - movs r0, 0x8F - lsls r0, 5 - bl AllocZeroed - str r0, [r4] -_0807FFC0: - ldr r0, [r4] - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - movs r2, 0x86 - lsls r2, 1 - adds r0, r2 - str r1, [r0] - movs r2, 0 - ldr r5, =gSpecialVar_0x8004 - movs r3, 0 -_0807FFD6: - ldr r0, [r4] - lsls r1, r2, 1 - adds r0, 0x74 - adds r0, r1 - strh r3, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _0807FFD6 - ldrb r0, [r5] - bl sub_807FE54 - ldrh r0, [r5] - cmp r0, 0 - bne _08080008 - ldr r0, =sub_8080018 - bl SetMainCallback2 - b _0808000E - .pool -_08080008: - ldr r0, =sub_80808D4 - bl SetMainCallback2 -_0808000E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807FFA4 - - thumb_func_start sub_8080018 -sub_8080018: @ 8080018 - push {r4-r7,lr} - sub sp, 0x4 - ldr r1, =gUnknown_020322A4 - ldr r0, [r1] - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x15 - bls _0808002A - b _08080546 -_0808002A: - lsls r0, 2 - ldr r1, =_0808003C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0808003C: - .4byte _08080094 - .4byte _08080100 - .4byte _08080120 - .4byte _0808019C - .4byte _080801AE - .4byte _080801C8 - .4byte _08080546 - .4byte _08080546 - .4byte _080801F8 - .4byte _08080248 - .4byte _0808026C - .4byte _08080302 - .4byte _0808035C - .4byte _080803D4 - .4byte _08080408 - .4byte _0808049C - .4byte _080804D0 - .4byte _08080546 - .4byte _080804F8 - .4byte _080804E4 - .4byte _080804EA - .4byte _08080508 -_08080094: - bl sub_8080588 - ldr r1, =gUnknown_020229C6 - ldr r2, =0x00004422 - adds r0, r2, 0 - strh r0, [r1] - ldr r2, =gUnknown_020322A4 - ldr r0, [r2] - adds r0, 0x72 - movs r1, 0 - strb r1, [r0] - movs r5, 0 - movs r6, 0 - movs r7, 0x92 - lsls r7, 1 -_080800B2: - ldr r0, [r2] - lsls r1, r5, 1 - adds r0, 0x64 - adds r0, r1 - strh r6, [r0] - adds r4, r5, 0x1 - adds r1, r5 - lsls r1, 1 - movs r3, 0x2 -_080800C4: - ldr r0, [r2] - adds r0, r7 - adds r0, r1 - strh r6, [r0] - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _080800C4 - adds r5, r4, 0 - cmp r5, 0x3 - ble _080800B2 - ldr r3, =gUnknown_020322A4 - ldr r4, [r3] - adds r1, r4, 0 - adds r1, 0x70 - movs r2, 0 - movs r0, 0 - strh r0, [r1] - subs r1, 0x22 - strh r0, [r1] - strb r2, [r4, 0x1] - ldr r1, [r3] - b _080804FC - .pool -_08080100: - bl sub_807F7D8 - lsls r0, 24 - cmp r0, 0 - bne _0808010C - b _08080546 -_0808010C: - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_8082D28 - b _08080546 - .pool -_08080120: - movs r5, 0 - ldr r4, =sBlenderSyncArrowsPos - ldr r6, =gUnknown_020322A4 -_08080126: - ldrb r1, [r4] - ldrb r2, [r4, 0x1] - ldr r0, =sBlenderSyncArrow_SpriteTemplate - movs r3, 0x1 - bl CreateSprite - ldr r1, [r6] - adds r1, 0x54 - adds r1, r5 - strb r0, [r1] - ldr r0, [r6] - adds r0, 0x54 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r1, r5, 0 - adds r1, 0x8 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _08080126 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0808016A - b _080804F8 -_0808016A: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08080174 - b _080804F8 -_08080174: - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - b _080804F8 - .pool -_0808019C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _080804F8 -_080801AE: - bl sub_807F9D0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080801C0 - b _08080546 -_080801C0: - b _080804F8 - .pool -_080801C8: - ldr r4, =gUnknown_020322A4 - ldr r0, [r4] - ldr r3, =0x000011b8 - adds r0, r3 - ldr r1, =sText_CommunicationStandby - movs r2, 0 - bl sub_808417C - ldr r1, [r4] - movs r2, 0 - movs r0, 0x8 - strb r0, [r1] - ldr r0, [r4] - movs r1, 0x84 - lsls r1, 1 - adds r0, r1 - str r2, [r0] - b _08080546 - .pool -_080801F8: - ldr r4, =gUnknown_020322A4 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - movs r6, 0 - strb r0, [r1] - ldr r0, [r4] - movs r2, 0x8A - lsls r2, 1 - adds r0, r2 - strb r6, [r0] - ldr r0, [r4] - movs r5, 0xAC - lsls r5, 1 - adds r0, r5 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - bl sub_807FE14 - ldr r0, =gUnknown_020228C4 - ldr r1, [r4] - adds r1, r5 - movs r2, 0x10 - bl memcpy - bl sub_800ADF8 - ldr r0, [r4] - movs r3, 0x84 - lsls r3, 1 - adds r0, r3 - str r6, [r0] - b _08080546 - .pool -_08080248: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08080254 - b _08080546 -_08080254: - bl ResetBlockReceivedFlags - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _08080264 - b _080804F8 -_08080264: - movs r0, 0x4 - bl sub_800A4D8 - b _080804F8 -_0808026C: - ldr r6, =gUnknown_020322A4 - ldr r1, [r6] - movs r0, 0x84 - lsls r0, 1 - adds r1, r0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x14 - bgt _08080282 - b _08080546 -_08080282: - movs r0, 0x4 - movs r1, 0x1 - bl sub_8197DF8 - bl GetBlockReceivedStatus - adds r4, r0, 0 - bl sub_800A9D8 - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - beq _0808029E - b _08080546 -_0808029E: - movs r5, 0 - adds r7, r6, 0 - movs r6, 0xAC - lsls r6, 1 - b _080802D4 - .pool -_080802AC: - ldr r0, [r7] - lsls r4, r5, 4 - adds r0, r4, r0 - adds r0, r6 - lsls r1, r5, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x10 - bl memcpy - ldr r0, [r7] - lsls r2, r5, 1 - adds r1, r0, 0 - adds r1, 0x74 - adds r1, r2 - adds r0, r4 - adds r0, r6 - ldrh r0, [r0] - strh r0, [r1] - adds r5, 0x1 -_080802D4: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _080802AC - bl ResetBlockReceivedFlags - b _080804F8 - .pool -_080802EC: - ldrb r1, [r4] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x74 - adds r0, r1 - ldrh r0, [r0] - lsls r1, r5, 24 - lsrs r1, 24 - bl sub_807FD90 - b _08080336 -_08080302: - bl GetLinkPlayerCount - ldr r2, =gUnknown_020322A4 - ldr r1, [r2] - adds r1, 0x7C - strb r0, [r1] - movs r5, 0 - ldr r2, [r2] - movs r1, 0x8A - lsls r1, 1 - adds r4, r2, r1 - ldr r1, =gUnknown_083399D0 - adds r0, r2, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 2 - ldrb r3, [r4] - adds r0, r1 -_08080328: - ldrb r1, [r0] - cmp r3, r1 - beq _080802EC - adds r0, 0x1 - adds r5, 0x1 - cmp r5, 0x3 - ble _08080328 -_08080336: - ldr r3, =gUnknown_020322A4 - ldr r1, [r3] - movs r0, 0x84 - lsls r0, 1 - adds r2, r1, r0 - movs r0, 0 - str r0, [r2] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r1, [r3] - movs r2, 0x8A - lsls r2, 1 - adds r1, r2 - b _080804FC - .pool -_0808035C: - ldr r3, [r2] - movs r0, 0x84 - lsls r0, 1 - adds r1, r3, r0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x3C - bgt _08080370 - b _08080546 -_08080370: - movs r1, 0x8A - lsls r1, 1 - adds r0, r3, r1 - adds r1, r3, 0 - adds r1, 0x7C - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bcc _080803B8 - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - ldr r2, [r2] - ldr r3, =gUnknown_083399DC - ldr r1, =gUnknown_083399E4 - adds r0, r2, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x2 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r3 - ldr r3, =0xffffa800 - adds r1, r3, 0 - ldrh r0, [r0] - adds r1, r0 - adds r2, 0x4A - strh r1, [r2] - b _080803BE - .pool -_080803B8: - ldrb r0, [r3] - subs r0, 0x1 - strb r0, [r3] -_080803BE: - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] - movs r1, 0x84 - lsls r1, 1 - adds r0, r1 - movs r1, 0 - str r1, [r0] - b _08080546 - .pool -_080803D4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _080803E0 - b _08080546 -_080803E0: - ldr r2, =gUnknown_020322A4 - ldr r1, [r2] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2 - bl sub_8082CB4 - movs r0, 0x2B - bl PlaySE - movs r0, 0x2 - bl ShowBg - b _08080546 - .pool -_08080408: - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - bl SetGpuRegBits - ldr r4, =gUnknown_020322A4 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0x4A - movs r3, 0x80 - lsls r3, 2 - adds r0, r3, 0 - ldrh r3, [r1] - adds r0, r3 - strh r0, [r1] - movs r0, 0x8D - lsls r0, 1 - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x4 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xFF - bls _0808048C - movs r0, 0xC - movs r1, 0x2 - bl SetGpuRegBits - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r3, [r4] - movs r2, 0x8D - lsls r2, 1 - adds r1, r3, r2 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r1] - ldr r2, =gUnknown_083399DC - ldr r1, =gUnknown_083399E4 - adds r0, r3, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x2 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r2 - ldrh r0, [r0] - adds r1, r3, 0 - adds r1, 0x4A - strh r0, [r1] - movs r0, 0x84 - lsls r0, 1 - adds r1, r3, r0 - movs r0, 0 - str r0, [r1] - movs r0, 0x34 - bl PlaySE - bl sub_808074C - bl sub_80807BC -_0808048C: - ldr r0, [r4] - b _080804BE - .pool -_0808049C: - bl sub_8083380 - lsls r0, 24 - cmp r0, 0 - beq _080804BA - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - movs r0, 0 - str r0, [r2] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080804BA: - ldr r0, =gUnknown_020322A4 - ldr r0, [r0] -_080804BE: - movs r1, 0xA0 - lsls r1, 1 - adds r0, r1 - bl sub_8082CB4 - b _08080546 - .pool -_080804D0: - ldr r0, =gUnknown_08339C2C - movs r2, 0x10 - negs r2, r2 - movs r1, 0x78 - movs r3, 0x3 - bl CreateSprite - b _080804F8 - .pool -_080804E4: - bl sub_800ADF8 - b _080804F8 -_080804EA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08080546 - bl sub_800A418 -_080804F8: - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] -_080804FC: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08080546 - .pool -_08080508: - ldr r5, =gUnknown_020322A4 - ldr r3, [r5] - adds r1, r3, 0 - adds r1, 0x4C - movs r2, 0 - movs r0, 0x80 - strh r0, [r1] - movs r1, 0x82 - lsls r1, 1 - adds r0, r3, r1 - str r2, [r0] - ldr r0, =sub_8081898 - bl SetMainCallback2 - bl GetCurrentMapMusic - lsls r0, 16 - lsrs r0, 16 - ldr r4, =0x00000193 - cmp r0, r4 - beq _08080540 - bl GetCurrentMapMusic - ldr r1, [r5] - movs r2, 0xAA - lsls r2, 1 - adds r1, r2 - strh r0, [r1] -_08080540: - adds r0, r4, 0 - bl PlayBGM -_08080546: - ldr r0, =gUnknown_020322A4 - ldr r1, [r0] - movs r3, 0x8E - lsls r3, 1 - adds r0, r1, r3 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r3, 0x2 - adds r1, r3 - movs r2, 0 - ldrsh r1, [r1, r2] - bl nullsub_31 - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8080018 thumb_func_start sub_8080588 sub_8080588: @ 8080588 @@ -1599,15 +16,15 @@ sub_8080588: @ 8080588 bl ResetSpriteData bl FreeAllSpritePalettes bl ResetTasks - ldr r0, =sub_807F764 + ldr r0, =VBlankCB0_BerryBlender bl SetVBlankCallback movs r0, 0 bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08339974 + ldr r1, =sBerryBlenderBgTemplates movs r0, 0x1 movs r2, 0x3 bl InitBgsFromTemplates - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r1, [r4] movs r0, 0xDC lsls r0, 1 @@ -1627,7 +44,7 @@ sub_8080588: @ 8080588 movs r1, 0x14 movs r2, 0xF0 bl copy_textbox_border_tile_patterns_to_vram - bl sub_807FA34 + bl InitBerryBlenderWindows ldr r2, [r4] adds r0, r2, 0 adds r0, 0x44 @@ -1660,7 +77,7 @@ task_tutorial_oak_boy_girl: @ 8080624 lsrs r0, 24 adds r2, r0, 0 adds r2, 0x18 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsrs r1, 23 adds r0, 0x96 @@ -1809,7 +226,7 @@ _08080734: sub_808074C: @ 808074C push {r4-r7,lr} movs r4, 0 - ldr r7, =gUnknown_020322A4 + ldr r7, =sBerryBlenderData movs r6, 0xFF ldr r5, =gUnknown_083399D0 _08080756: @@ -1835,7 +252,7 @@ _08080756: cmp r4, 0x3 ble _08080756 movs r3, 0 - ldr r7, =gUnknown_020322A4 + ldr r7, =sBerryBlenderData _08080784: movs r4, 0 adds r6, r3, 0x1 @@ -1886,7 +303,7 @@ sub_80807BC: @ 80807BC mov r10, r0 _080807DE: movs r6, 0 - ldr r7, =gUnknown_020322A4 + ldr r7, =sBerryBlenderData mov r8, r6 _080807E4: ldr r2, [r7] @@ -2002,7 +419,7 @@ _080808B6: sub_80808D4: @ 80808D4 push {r4-r7,lr} sub sp, 0x4 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] ldrb r0, [r0] adds r2, r1, 0 @@ -2047,13 +464,13 @@ _08080950: ldrh r1, [r4] movs r0, 0 bl sub_8082FDC - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData ldr r0, [r5] movs r6, 0xAC lsls r6, 1 adds r0, r6 ldrh r1, [r4] - bl sub_807FE14 + bl Blender_CopyBerryData ldrh r0, [r4] ldr r2, [r5] adds r1, r2, 0 @@ -2063,7 +480,7 @@ _08080950: bl sub_8080674 movs r4, 0 movs r6, 0 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType mov r12, r0 movs r7, 0x92 lsls r7, 1 @@ -2089,7 +506,7 @@ _080809A0: adds r4, r3, 0 cmp r4, 0x3 ble _0808098E - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r3, [r4] adds r1, r3, 0 adds r1, 0x70 @@ -2105,13 +522,13 @@ _080809A0: b _08080CB2 .pool _080809E4: - bl sub_807F7D8 + bl LoadBerryBlenderGfx lsls r0, 24 cmp r0, 0 bne _080809F0 b _08080DAE _080809F0: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] ldrb r0, [r1] adds r0, 0x1 @@ -2122,7 +539,7 @@ _080809F0: _08080A04: movs r4, 0 ldr r5, =sBlenderSyncArrowsPos - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData _08080A0A: ldrb r1, [r5] ldrb r2, [r5, 0x1] @@ -2162,7 +579,7 @@ _08080A58: movs r2, 0x10 movs r3, 0 bl BeginNormalPaletteFade - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r1, [r2] ldrb r0, [r1] adds r0, 0x1 @@ -2175,7 +592,7 @@ _08080A58: b _08080DAE .pool _08080A84: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r1, [r4] movs r5, 0x84 lsls r5, 1 @@ -2201,7 +618,7 @@ _08080AAA: b _08080DAE .pool _08080ABC: - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r1, [r2] movs r3, 0 movs r0, 0xB @@ -2226,7 +643,7 @@ _08080AD8: _08080AEC: movs r4, 0 ldr r2, =gUnknown_083399D0 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r3, [r0] adds r0, r3, 0 adds r0, 0x7C @@ -2247,7 +664,7 @@ _08080B08: cmp r4, 0x3 ble _08080B08 _08080B16: - ldr r3, =gUnknown_020322A4 + ldr r3, =sBerryBlenderData ldr r1, [r3] movs r5, 0x84 lsls r5, 1 @@ -2308,7 +725,7 @@ _08080B94: subs r0, 0x1 _08080B98: strb r0, [r3] - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r3, 0x84 lsls r3, 1 @@ -2318,7 +735,7 @@ _08080B98: b _08080DAE .pool _08080BB0: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r1, [r4] ldrb r0, [r1] adds r0, 0x1 @@ -2340,7 +757,7 @@ _08080BDC: lsls r1, 3 movs r0, 0 bl SetGpuRegBits - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r2, [r4] adds r1, r2, 0 adds r1, 0x4A @@ -2409,13 +826,13 @@ _08080C78: lsls r0, 24 cmp r0, 0 beq _08080C8C - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] _08080C8C: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r1, 0xA0 lsls r1, 1 @@ -2431,7 +848,7 @@ _08080CA0: movs r3, 0x3 bl CreateSprite _08080CAE: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] _08080CB2: ldrb r0, [r1] @@ -2441,7 +858,7 @@ _08080CB2: .pool _08080CC4: bl sub_8080DF8 - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData ldr r4, [r5] adds r1, r4, 0 adds r1, 0x4C @@ -2507,7 +924,7 @@ _08080D5A: ldm r6!, {r0} lsrs r1, r5, 24 bl CreateTask - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r1, [r1] movs r2, 0x90 lsls r2, 1 @@ -2530,7 +947,7 @@ _08080D80: cmp r0, r4 beq _08080D9E bl GetCurrentMapMusic - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r1, [r1] movs r5, 0xAA lsls r5, 1 @@ -2541,9 +958,9 @@ _08080D9E: bl PlayBGM movs r0, 0x35 bl PlaySE - bl sub_807F738 + bl Blender_ControlHitPitch _08080DAE: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r2, 0x8E lsls r2, 1 @@ -2555,7 +972,7 @@ _08080DAE: adds r1, r5 movs r2, 0 ldrsh r1, [r1, r2] - bl nullsub_31 + bl Blender_DummiedOutFunc bl RunTasks bl AnimateSprites bl BuildOamBuffer @@ -2657,7 +1074,7 @@ sub_8080EA4: @ 8080EA4 push {r4-r6,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x4A ldrh r0, [r0] @@ -2791,7 +1208,7 @@ sub_8080FD0: @ 8080FD0 push {r4-r6,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData ldr r3, [r6] adds r0, r3, 0 adds r0, 0x4A @@ -2917,7 +1334,7 @@ sub_80810F8: @ 80810F8 push {r4-r6,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData ldr r3, [r5] adds r0, r3, 0 adds r0, 0x4A @@ -3044,7 +1461,7 @@ sub_8081224: @ 8081224 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r0, 0x4A ldrh r0, [r0] @@ -3186,7 +1603,7 @@ sub_8081370: @ 8081370 lsls r0, 16 lsrs r4, r0, 16 adds r5, r4, 0 - bl sub_807F738 + bl Blender_ControlHitPitch ldr r0, =0x00004523 cmp r4, r0 beq _080813A4 @@ -3204,7 +1621,7 @@ _08081398: b _080814A0 .pool _080813A4: - ldr r7, =gUnknown_020322A4 + ldr r7, =sBerryBlenderData ldr r4, [r7] adds r5, r4, 0 adds r5, 0x4C @@ -3269,7 +1686,7 @@ _080813E0: b _080814A0 .pool _0808143C: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r2, [r0] adds r4, r2, 0 adds r4, 0x4C @@ -3292,7 +1709,7 @@ _0808143C: b _0808149E .pool _08081474: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r4, r0, 0 adds r4, 0x4C @@ -3401,7 +1818,7 @@ _08081532: bge _0808152A _0808153C: movs r7, 0 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r0, 0x7C ldrb r0, [r0] @@ -3431,7 +1848,7 @@ _08081562: bne _08081576 b _080816D2 _08081576: - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData ldr r0, [r6] adds r0, 0x96 ldr r2, [sp, 0x4] @@ -3544,7 +1961,7 @@ _0808166A: cmp r0, r10 bne _080816D2 _08081678: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r2, r0, 0 adds r2, 0x4C @@ -3585,7 +2002,7 @@ _080816D2: movs r1, 0x10 add r8, r1 adds r7, 0x1 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r0, 0x7C ldrb r0, [r0] @@ -3598,7 +2015,7 @@ _080816F6: cmp r0, 0 beq _08081722 movs r7, 0 - ldr r3, =gUnknown_020322A4 + ldr r3, =sBerryBlenderData ldr r0, [r3] adds r0, 0x7C ldrb r0, [r0] @@ -3641,7 +2058,7 @@ sub_8081744: @ 8081744 lsls r0, 24 lsrs r6, r0, 24 _0808175A: - ldr r3, =gUnknown_020322A4 + ldr r3, =sBerryBlenderData ldr r1, [r3] lsls r2, r6, 1 adds r0, r1, 0 @@ -3683,7 +2100,7 @@ _080817B6: cmp r4, 0 beq _0808182C _080817BA: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r1, [r4] lsls r2, r5, 1 adds r0, r1, 0 @@ -3783,7 +2200,7 @@ _0808187E: sub_8081898: @ 8081898 push {r4-r6,lr} bl sub_8082D28 - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] movs r1, 0x82 lsls r1, 1 @@ -3839,7 +2256,7 @@ _080818B4: ldr r0, =sub_8081FC8 bl SetMainCallback2 _0808191A: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r2, 0x8E lsls r2, 1 @@ -3851,7 +2268,7 @@ _0808191A: adds r1, r2 movs r2, 0 ldrsh r1, [r1, r2] - bl nullsub_31 + bl Blender_DummiedOutFunc bl RunTasks bl AnimateSprites bl BuildOamBuffer @@ -3863,10 +2280,10 @@ _0808191A: .pool thumb_func_end sub_8081898 - thumb_func_start nullsub_31 -nullsub_31: @ 8081960 + thumb_func_start Blender_DummiedOutFunc +Blender_DummiedOutFunc: @ 8081960 bx lr - thumb_func_end nullsub_31 + thumb_func_end Blender_DummiedOutFunc thumb_func_start help_system_is_not_first_time help_system_is_not_first_time: @ 8081964 @@ -4533,7 +2950,7 @@ sub_8081E04: @ 8081E04 thumb_func_start sub_8081E20 sub_8081E20: @ 8081E20 push {r4-r6,lr} - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r2, 0x82 lsls r2, 1 @@ -4729,7 +3146,7 @@ sub_8081FC8: @ 8081FC8 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x63 ldrb r0, [r0] @@ -4776,7 +3193,7 @@ _08082038: b _08082064 .pool _0808204C: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r1, 0x90 lsls r1, 1 @@ -4795,7 +3212,7 @@ _08082064: b _08082458 .pool _08082078: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r1, [r4] adds r1, 0x4C ldrh r0, [r1] @@ -4825,14 +3242,14 @@ _080820B0: movs r0, 0x5 _080820B6: strb r0, [r1] - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r0, 0 strb r0, [r1] ldr r0, =gMPlay_SE2 bl m4aMPlayStop _080820C6: - bl sub_807F738 + bl Blender_ControlHitPitch b _0808249E .pool _080820D4: @@ -4856,7 +3273,7 @@ _080820EC: ldrb r0, [r0] cmp r0, 0 beq _0808218C - ldr r3, =gUnknown_020322A4 + ldr r3, =sBerryBlenderData ldr r1, [r3] movs r4, 0x8E lsls r4, 5 @@ -4922,7 +3339,7 @@ _08082172: b _0808245C .pool _0808218C: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r3, [r4] movs r0, 0xCC lsls r0, 1 @@ -4958,7 +3375,7 @@ _080821C8: b _0808249E _080821D4: bl ResetBlockReceivedFlags - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData ldr r1, [r5] adds r1, 0x63 ldrb r0, [r1] @@ -5017,7 +3434,7 @@ _08082220: .pool _08082254: ldr r2, =gBlockRecvBuffer - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r3, [r0] ldrh r0, [r2, 0x4] adds r1, r3, 0 @@ -5045,7 +3462,7 @@ _08082286: bne _08082292 b _0808249E _08082292: - ldr r0, =gUnknown_03005D98 + ldr r0, =gInGameOpponentsNo ldrb r0, [r0] cmp r0, 0 bne _080822A8 @@ -5058,18 +3475,18 @@ _080822A8: bl IncrementGameStat b _08082458 _080822B0: - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData ldr r4, [r6] ldr r5, =0x000011b8 adds r4, r5 ldr r5, =sText_WouldLikeToBlendAnotherBerry - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r4, 0 adds r1, r5, 0 - bl sub_808417C + bl Blender_PrintText cmp r0, 0 bne _080822D2 b _0808249E @@ -5078,7 +3495,7 @@ _080822D2: b _0808245C .pool _080822E4: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x9E movs r1, 0 @@ -5109,7 +3526,7 @@ _08082322: beq _08082328 b _0808249E _08082328: - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r0, [r2] adds r0, 0x9E movs r1, 0x1 @@ -5121,7 +3538,7 @@ _08082328: strb r0, [r1] movs r4, 0 _0808233E: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsls r1, r4, 1 adds r0, 0x8E @@ -5143,7 +3560,7 @@ _0808235C: b _0808249E .pool _0808236C: - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r0, 0x9E strb r2, [r0] @@ -5154,7 +3571,7 @@ _0808236C: strb r0, [r1] movs r4, 0 _08082380: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsls r1, r4, 1 adds r0, 0x8E @@ -5179,7 +3596,7 @@ _080823B0: ldr r6, =gUnknown_03003110 adds r0, r6, 0 bl sub_8081F94 - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r2, [r4] adds r0, r2, 0 adds r0, 0x9E @@ -5233,13 +3650,13 @@ _0808241C: b _0808245E .pool _08082430: - ldr r0, =gUnknown_03005D98 + ldr r0, =gInGameOpponentsNo ldrb r0, [r0] cmp r0, 0 beq _08082458 ldr r0, =sub_8082924 bl SetMainCallback2 - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r0, [r2] adds r0, 0x63 movs r1, 0 @@ -5248,7 +3665,7 @@ _08082430: b _0808249C .pool _08082458: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] _0808245C: adds r1, 0x63 @@ -5259,18 +3676,18 @@ _0808245E: b _0808249E .pool _0808246C: - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData ldr r4, [r6] ldr r0, =0x000011b8 adds r4, r0 ldr r5, =sText_CommunicationStandby - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r4, 0 adds r1, r5, 0 - bl sub_808417C + bl Blender_PrintText cmp r0, 0 beq _0808249E ldr r0, =sub_8082644 @@ -5284,7 +3701,7 @@ _0808249C: strb r1, [r0] _0808249E: bl sub_808330C - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x4C ldrh r0, [r0] @@ -5301,7 +3718,7 @@ _0808249E: adds r1, r5 movs r2, 0 ldrsh r1, [r1, r2] - bl nullsub_31 + bl Blender_DummiedOutFunc bl RunTasks bl AnimateSprites bl BuildOamBuffer @@ -5318,7 +3735,7 @@ _0808249E: thumb_func_start sub_80824FC sub_80824FC: @ 80824FC push {r4,lr} - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] movs r2, 0xD0 lsls r2, 1 @@ -5346,7 +3763,7 @@ _08082524: .4byte _0808261A _08082540: bl sub_800ADF8 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r2, [r0] movs r3, 0xD0 lsls r3, 1 @@ -5359,7 +3776,7 @@ _08082558: lsls r0, 24 cmp r0, 0 beq _0808263C - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r2, 0xD0 lsls r2, 1 @@ -5374,7 +3791,7 @@ _08082558: .pool _08082584: bl sub_8153430 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r2, [r0] b _08082602 .pool @@ -5407,7 +3824,7 @@ _080825BA: lsrs r2, r0, 24 cmp r2, 0 beq _080825E4 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r1, 0xD0 lsls r1, 1 @@ -5417,7 +3834,7 @@ _080825BA: b _0808263C .pool _080825E4: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r3, 0x84 lsls r3, 1 @@ -5474,7 +3891,7 @@ _0808263E: sub_8082644: @ 8082644 push {r4-r6,lr} sub sp, 0x4 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r0, 0x63 ldrb r0, [r0] @@ -5586,13 +4003,13 @@ _08082754: ldr r0, =0x000011b8 adds r4, r0 ldr r5, =gStringVar4 - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r4, 0 adds r1, r5, 0 - bl sub_808417C + bl Blender_PrintText cmp r0, 0 bne _08082774 b _080828DC @@ -5629,7 +4046,7 @@ _080827AA: adds r0, r1 ldr r1, =gText_SavingDontTurnOff2 movs r2, 0 - bl sub_808417C + bl Blender_PrintText bl sub_800ADF8 b _080828BA .pool @@ -5640,7 +4057,7 @@ _080827C8: bne _080827D4 b _080828DC _080827D4: - ldr r3, =gUnknown_020322A4 + ldr r3, =sBerryBlenderData ldr r1, [r3] movs r2, 0x84 lsls r2, 1 @@ -5665,7 +4082,7 @@ _080827FC: beq _080828DC movs r0, 0x37 bl PlaySE - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] b _080828BC .pool @@ -5689,7 +4106,7 @@ _08082828: movs r2, 0 movs r3, 0x10 bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] b _080828BC .pool @@ -5717,7 +4134,7 @@ _0808284C: ldr r0, [r6] bl Free str r4, [r6] - ldr r0, =sub_807FA80 + ldr r0, =DoBerryBlending bl SetMainCallback2 b _080828DC .pool @@ -5759,7 +4176,7 @@ _080828C6: bl SetMainCallback2 _080828DC: bl sub_8082AD4 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r2, 0x8E lsls r2, 1 @@ -5771,7 +4188,7 @@ _080828DC: adds r1, r2 movs r2, 0 ldrsh r1, [r1, r2] - bl nullsub_31 + bl Blender_DummiedOutFunc bl RunTasks bl AnimateSprites bl BuildOamBuffer @@ -5787,7 +4204,7 @@ _080828DC: thumb_func_start sub_8082924 sub_8082924: @ 8082924 push {r4-r6,lr} - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r0, 0x63 ldrb r0, [r0] @@ -5881,13 +4298,13 @@ _08082A00: ldr r2, =0x000011b8 adds r4, r2 ldr r5, =gStringVar4 - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r4, 0 adds r1, r5, 0 - bl sub_808417C + bl Blender_PrintText cmp r0, 0 beq _08082A92 ldr r0, [r6] @@ -5899,7 +4316,7 @@ _08082A00: _08082A30: movs r0, 0x3 bl BeginFastPaletteFade - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] adds r1, 0x63 ldrb r0, [r1] @@ -5919,7 +4336,7 @@ _08082A48: ldrh r0, [r0] cmp r0, 0 bne _08082A70 - ldr r0, =sub_807FA80 + ldr r0, =DoBerryBlending bl SetMainCallback2 b _08082A76 .pool @@ -5932,14 +4349,14 @@ _08082A76: bl UnsetBgTilemapBuffer movs r0, 0x1 bl UnsetBgTilemapBuffer - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] bl Free movs r0, 0 str r0, [r4] _08082A92: bl sub_8082AD4 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r2, 0x8E lsls r2, 1 @@ -5951,7 +4368,7 @@ _08082A92: adds r1, r2 movs r2, 0 ldrsh r1, [r1, r2] - bl nullsub_31 + bl Blender_DummiedOutFunc bl RunTasks bl AnimateSprites bl BuildOamBuffer @@ -5998,11 +4415,11 @@ _08082B24: _08082B26: cmp r3, r0 beq _08082B38 - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData b _08082B48 .pool _08082B38: - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r0, [r2] adds r1, r0, 0 adds r1, 0x6C @@ -6020,7 +4437,7 @@ _08082B58: ldr r0, =0x00002222 cmp r1, r0 bne _08082B66 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r0, 0x64 _08082B64: @@ -6032,7 +4449,7 @@ _08082B66: beq _08082B72 b _08082CA4 _08082B72: - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r0, [r2] adds r0, 0x64 ldrh r1, [r0] @@ -6109,7 +4526,7 @@ _08082C12: lsrs r0, 24 cmp r5, r0 bcs _08082C2E - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsls r1, r5, 1 adds r0, 0x64 @@ -6137,7 +4554,7 @@ _08082C4E: lsrs r0, 24 cmp r5, r0 bcs _08082C6A - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsls r1, r5, 1 adds r0, 0x64 @@ -6161,7 +4578,7 @@ _08082C6A: _08082C90: ldr r0, =0x00001111 strh r0, [r4, 0x2] - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] lsls r1, r5, 1 adds r0, 0x64 @@ -6187,7 +4604,7 @@ sub_8082CB4: @ 8082CB4 lsls r1, 7 str r1, [sp, 0x4] mov r3, sp - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r1, [r1] mov r12, r1 movs r1, 0x8E @@ -6230,7 +4647,7 @@ sub_8082CB4: @ 8082CB4 thumb_func_start sub_8082D18 sub_8082D18: @ 8082D18 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r0, 0x4A ldrh r0, [r0] @@ -6259,7 +4676,7 @@ _08082D3C: beq _08082DCC cmp r1, 0 bne _08082D90 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r3, [r0] adds r2, r3, 0 adds r2, 0x4A @@ -6293,7 +4710,7 @@ _08082D90: lsls r0, 7 cmp r1, r0 bne _08082DEA - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r2, [r0] ldrh r0, [r3, 0xA] movs r4, 0x8B @@ -6311,7 +4728,7 @@ _08082D90: b _08082DEA .pool _08082DCC: - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] adds r2, r1, 0 adds r2, 0x4A @@ -6332,10 +4749,10 @@ _08082DEA: .pool thumb_func_end sub_8082D28 - thumb_func_start sub_8082DF4 -sub_8082DF4: @ 8082DF4 + thumb_func_start BerryBlender_SetGpuRegs +BerryBlender_SetGpuRegs: @ 8082DF4 push {r4-r6,lr} - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] movs r6, 0x8E lsls r6, 1 @@ -6364,7 +4781,7 @@ sub_8082DF4: @ 8082DF4 pop {r0} bx r0 .pool - thumb_func_end sub_8082DF4 + thumb_func_end BerryBlender_SetGpuRegs thumb_func_start sub_8082E3C sub_8082E3C: @ 8082E3C @@ -6433,7 +4850,7 @@ sub_8082E84: @ 8082E84 movs r7, 0x10 _08082EB0: bl Random - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r4, [r1] adds r4, 0x4A lsls r0, 16 @@ -6583,7 +5000,7 @@ sub_8082FDC: @ 8082FDC lsrs r0, 24 lsls r1, 16 lsrs r1, 16 - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r3, [r2] lsls r4, r0, 1 adds r2, r3, 0 @@ -6596,7 +5013,7 @@ sub_8082FDC: @ 8082FDC adds r0, r2 adds r3, r0 adds r0, r3, 0 - bl sub_807FE14 + bl Blender_CopyBerryData pop {r4} pop {r0} bx r0 @@ -6747,7 +5164,7 @@ _08083112: asrs r0, 16 cmp r0, 0xB0 ble _08083130 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] ldrb r0, [r1] adds r0, 0x1 @@ -6770,7 +5187,7 @@ sub_8083140: @ 8083140 lsrs r0, 16 lsls r1, 16 lsrs r3, r1, 16 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r1, [r1] movs r2, 0x8C lsls r2, 1 @@ -6898,7 +5315,7 @@ sub_8083230: @ 8083230 lsrs r0, 16 bl sub_8083210 adds r5, r0, 0 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] adds r1, r0, 0 adds r1, 0x4E @@ -7009,7 +5426,7 @@ _08083308: thumb_func_start sub_808330C sub_808330C: @ 808330C push {r4,lr} - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] movs r1, 0x8E lsls r1, 1 @@ -7073,7 +5490,7 @@ _08083378: thumb_func_start sub_8083380 sub_8083380: @ 8083380 push {r4,r5,lr} - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData ldr r2, [r5] movs r4, 0x84 lsls r4, 1 @@ -7134,7 +5551,7 @@ _080833F0: thumb_func_start sub_80833F8 sub_80833F8: @ 80833F8 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r2, [r1] movs r3, 0x8E lsls r3, 1 @@ -7157,7 +5574,7 @@ UpdateBerryBlenderRecord: @ 8083418 push {lr} ldr r0, =gSaveBlock1Ptr ldr r2, [r0] - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] adds r0, r1, 0 adds r0, 0x7C @@ -7187,7 +5604,7 @@ berry_blender_related: @ 8083450 mov r5, r8 push {r5-r7} sub sp, 0x4C - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] ldrb r0, [r0] adds r4, r1, 0 @@ -7251,7 +5668,7 @@ _080834C8: _080834DC: movs r6, 0 _080834DE: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x46 adds r0, r6 @@ -7291,7 +5708,7 @@ _08083518: adds r1, r4, 0 movs r3, 0x1 bl sub_80840D4 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r2, r0, 0 adds r2, 0x7C @@ -7408,7 +5825,7 @@ _0808361A: movs r2, 0 movs r3, 0x51 bl sub_80840D4 - ldr r6, =gUnknown_020322A4 + ldr r6, =sBerryBlenderData ldr r0, [r6] adds r4, r0, 0 adds r4, 0x9F @@ -7557,7 +5974,7 @@ _080837A8: bl sub_8198070 movs r6, 0 add r7, sp, 0x40 - ldr r5, =gUnknown_020322A4 + ldr r5, =sBerryBlenderData _080837B6: ldr r0, [r5] lsls r2, r6, 1 @@ -7591,7 +6008,7 @@ _080837EA: cmp r6, 0x3 bls _080837B6 bl sub_8081E20 - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r3, [r4] movs r1, 0xAC lsls r1, 1 @@ -7641,13 +6058,13 @@ _0808386C: ldr r0, =0x000011b8 adds r5, r4, r0 adds r4, 0x9F - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r5, 0 adds r1, r4, 0 - bl sub_808417C + bl Blender_PrintText cmp r0, 0 beq _08083898 bl UpdateBerryBlenderRecord @@ -7795,7 +6212,7 @@ sub_80839B4: @ 80839B4 push {r5-r7} sub sp, 0x14 movs r5, 0 - ldr r2, =gUnknown_020322A4 + ldr r2, =sBerryBlenderData ldr r0, [r2] adds r0, 0x7C adds r1, r2, 0 @@ -7876,7 +6293,7 @@ _08083A10: cmp r5, r1 bcc _08083A10 _08083A5E: - ldr r4, =gUnknown_020322A4 + ldr r4, =sBerryBlenderData ldr r0, [r4] adds r0, 0x7C ldrb r1, [r0] @@ -7922,7 +6339,7 @@ _08083AB4: lsrs r3, r0, 24 _08083ABC: movs r5, 0 - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] adds r0, 0x7C ldrb r0, [r0] @@ -7970,7 +6387,7 @@ sub_8083B08: @ 8083B08 mov r5, r8 push {r5-r7} sub sp, 0xC - ldr r1, =gUnknown_020322A4 + ldr r1, =sBerryBlenderData ldr r0, [r1] ldrb r0, [r0] adds r2, r1, 0 @@ -8064,7 +6481,7 @@ _08083B9A: movs r2, 0x34 movs r3, 0 bl CreateSprite - ldr r7, =gUnknown_020322A4 + ldr r7, =sBerryBlenderData ldr r1, [r7] adds r1, 0x46 strb r0, [r1] @@ -8272,7 +6689,7 @@ _08083D8A: movs r0, 0x5 movs r1, 0x3 bl CopyWindowToVram - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] movs r3, 0x84 lsls r3, 1 @@ -8304,7 +6721,7 @@ _08083DE2: beq _08083E12 movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r1, [r0] _08083DF8: ldrb r0, [r1] @@ -8469,7 +6886,7 @@ _08083F62: lsls r0, 24 cmp r0, 0 beq _08083F82 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r0, [r0] movs r1, 0xAA lsls r1, 1 @@ -8518,7 +6935,7 @@ sub_8083F94: @ 8083F94 ldrb r0, [r0] cmp r0, 0 beq _080840C4 - ldr r0, =gUnknown_020322A4 + ldr r0, =sBerryBlenderData ldr r2, [r0] movs r4, 0xD2 lsls r4, 1 @@ -8730,8 +7147,8 @@ _08084148: bx r0 thumb_func_end sub_80840D4 - thumb_func_start sub_808417C -sub_808417C: @ 808417C + thumb_func_start Blender_PrintText +Blender_PrintText: @ 808417C push {r4-r7,lr} sub sp, 0x8 adds r5, r0, 0 @@ -8783,6 +7200,6 @@ _080841DC: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_808417C + thumb_func_end Blender_PrintText .align 2, 0 @ Don't pad with nop. diff --git a/asm/cable_club.s b/asm/cable_club.s index 2ce8bb0b1..611b87eef 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -244,7 +244,7 @@ sub_80B252C: @ 80B252C lsrs r1, r0, 24 cmp r1, 0 bne _080B2570 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType strh r1, [r0] ldr r1, =gTasks lsls r0, r4, 2 @@ -286,7 +286,7 @@ _080B258E: b _080B25BA .pool _080B25A4: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType movs r0, 0 strh r0, [r1] ldr r1, =gTasks @@ -743,7 +743,7 @@ _080B2994: strb r0, [r1] ldrb r0, [r4] bl sub_800AA04 - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 bl sub_80C30A4 ldr r0, =gUnknown_0203CEF8 @@ -833,7 +833,7 @@ _080B2A6C: strb r0, [r1] ldrb r0, [r4] bl sub_800AA04 - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 bl sub_80C30A4 ldr r0, =gUnknown_0203CEF8 @@ -964,7 +964,7 @@ task_map_chg_seq_0807EC34: @ 80B2B94 ldrh r0, [r5] cmp r0, 0x1 bne _080B2C10 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType ldrh r2, [r0] ldr r0, =0x00002266 cmp r2, r0 @@ -1215,20 +1215,20 @@ _080B2DC0: b _080B2E34 _080B2DCA: movs r3, 0x2 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002233 b _080B2E30 .pool _080B2DDC: movs r3, 0x2 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002244 b _080B2E30 .pool _080B2DEC: movs r3, 0x4 movs r2, 0x4 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002255 b _080B2E30 .pool @@ -1243,12 +1243,12 @@ _080B2E00: ands r0, r1 cmp r0, 0 bne _080B2E2C - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002266 b _080B2E30 .pool _080B2E2C: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002277 _080B2E30: adds r0, r4, 0 @@ -1266,7 +1266,7 @@ _080B2E34: thumb_func_start sub_80B2E4C sub_80B2E4C: @ 80B2E4C push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001133 adds r0, r2, 0 strh r0, [r1] @@ -1287,7 +1287,7 @@ sub_80B2E74: @ 80B2E74 ldr r1, =gSpecialVar_Result movs r0, 0 strh r0, [r1] - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00003311 adds r0, r2, 0 strh r0, [r1] @@ -1454,7 +1454,7 @@ _080B2FC6: thumb_func_start sub_80B2FD8 sub_80B2FD8: @ 80B2FD8 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00004411 adds r0, r2, 0 strh r0, [r1] @@ -1472,7 +1472,7 @@ sub_80B2FD8: @ 80B2FD8 thumb_func_start sub_80B3000 sub_80B3000: @ 80B3000 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00006601 adds r0, r2, 0 strh r0, [r1] @@ -1490,7 +1490,7 @@ sub_80B3000: @ 80B3000 thumb_func_start sub_80B3028 sub_80B3028: @ 80B3028 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00006602 adds r0, r2, 0 strh r0, [r1] @@ -1540,17 +1540,17 @@ _080B3084: .4byte _080B3128 .4byte _080B30D8 _080B30A8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002233 b _080B3124 .pool _080B30B8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002244 b _080B3124 .pool _080B30C8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002255 b _080B3124 .pool @@ -1564,22 +1564,22 @@ _080B30D8: ands r0, r1 cmp r0, 0 bne _080B3100 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002266 b _080B3124 .pool _080B3100: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002277 b _080B3124 .pool _080B3110: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001111 b _080B3124 .pool _080B3120: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00003322 _080B3124: adds r0, r2, 0 @@ -1809,7 +1809,7 @@ _080B32F8: movs r0, 0x1 movs r1, 0 bl fade_screen - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] @@ -1922,7 +1922,7 @@ _080B3408: movs r0, 0x1 movs r1, 0 bl fade_screen - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType ldr r2, =0x00002211 adds r1, r2, 0 strh r1, [r0] @@ -2548,7 +2548,7 @@ nullsub_37: @ 80B3964 thumb_func_start sub_80B3968 sub_80B3968: @ 80B3968 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] @@ -2829,7 +2829,7 @@ sub_80B3BC4: @ 80B3BC4 ldrb r0, [r0] cmp r0, 0 bne _080B3BD6 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002288 adds r0, r2, 0 strh r0, [r1] diff --git a/asm/contest.s b/asm/contest.s index 50398c518..88d4203ab 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -14067,7 +14067,7 @@ _080DEC80: b _080DEC9C .pool _080DEC94: - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r1, r0, 24 _080DEC9C: diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index f1e2019da..ba96bf4ea 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -284,7 +284,7 @@ _080FC6FE: lsls r0, 24 cmp r0, 0 beq _080FC7F4 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gUnknown_02039F25 ldrb r1, [r1] lsls r1, 6 @@ -297,7 +297,7 @@ _080FC6FE: b _080FC7F4 .pool _080FC738: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gUnknown_02039F25 ldrb r1, [r1] lsls r1, 6 @@ -487,7 +487,7 @@ _080FC8D8: beq _080FC954 b _080FC96E _080FC8DE: - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer ldrh r0, [r4, 0x1A] strb r0, [r1] bl GetMultiplayerId @@ -1142,7 +1142,7 @@ _080FCE8C: beq _080FCEFC b _080FCF16 _080FCE92: - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0x6E strb r0, [r1] bl GetMultiplayerId diff --git a/asm/item_menu.s b/asm/item_menu.s index a868b2672..61bd5c6e9 100755 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -1863,7 +1863,7 @@ DisplayItemMessage: @ 81ABB4C strh r0, [r4, 0x14] movs r1, 0x11 bl FillWindowPixelBuffer - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 ldrb r1, [r4, 0x14] diff --git a/asm/link.s b/asm/link.s index d2dc05630..9d6adff34 100644 --- a/asm/link.s +++ b/asm/link.s @@ -206,7 +206,7 @@ sub_8009570: @ 8009570 ldr r0, =sub_80096BC bl SetVBlankCallback bl sub_800A2E0 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001111 adds r0, r2, 0 strh r0, [r1] @@ -291,7 +291,7 @@ sub_8009638: @ 8009638 ldr r0, [r4] ldrb r0, [r0, 0x8] strb r0, [r5, 0x13] - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType ldrh r0, [r0] str r0, [r5, 0x14] ldr r0, =gGameLanguage @@ -1185,7 +1185,7 @@ _08009E2C: _08009E38: ldr r0, =gUnknown_03003110 strh r2, [r0] - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldrh r1, [r1] b _08009F04 .pool @@ -1814,7 +1814,7 @@ _0800A30C: str r7, [r4, 0x4] b _0800A336 _0800A324: - ldr r5, =gUnknown_020228C4 + ldr r5, =gBlockSendBuffer cmp r7, r5 beq _0800A334 adds r0, r5, 0 @@ -2772,7 +2772,7 @@ sub_800AA60: @ 800AA60 ldr r0, =gUnknown_02022A74 ldr r2, =0x00002288 mov r8, r2 - ldr r7, =gUnknown_020229C6 + ldr r7, =gLinkType mov r6, r12 adds r6, 0x14 adds r5, r0, 0x4 @@ -3798,7 +3798,7 @@ sub_800B348: @ 800B348 strh r2, [r0] ldrb r2, [r3, 0x2] strb r2, [r0, 0x2] - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r2, 0x3C bl memcpy pop {r4-r6} @@ -10306,7 +10306,7 @@ sub_800E700: @ 800E700 lsrs r1, r0, 16 cmp r1, 0 bne _0800E732 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType strh r1, [r0] bl sub_800AAF4 movs r0, 0 @@ -13149,7 +13149,7 @@ _0800FEC8: str r7, [r5, 0x70] b _0800FF1C _0800FF0A: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer cmp r7, r4 beq _0800FF1A adds r0, r4, 0 @@ -14734,7 +14734,7 @@ _08010B8C: b _08010C4A .pool _08010BC0: - ldr r5, =gUnknown_020228C4 + ldr r5, =gBlockSendBuffer adds r1, r5, 0 ldr r0, =gUnknown_082ED7EC ldm r0!, {r2-r4} @@ -14772,7 +14772,7 @@ _08010BE2: adds r0, 0x1 strh r0, [r1, 0x8] _08010C0A: - ldr r5, =gUnknown_020228C4 + ldr r5, =gBlockSendBuffer ldr r1, =gUnknown_03005000 ldrb r0, [r1, 0xD] strb r0, [r5, 0xF] @@ -14796,7 +14796,7 @@ _08010C20: mov r1, r12 movs r2, 0x8C bl memcpy - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0xA0 bl SendBlock @@ -14921,7 +14921,7 @@ _08010D56: cmp r0, 0 beq _08010DA6 bl sub_800B348 - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0x3C bl SendBlock @@ -16608,7 +16608,7 @@ sub_8011AFC: @ 8011AFC lsls r0, 24 cmp r0, 0 beq _08011B70 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001111 adds r0, r2, 0 strh r0, [r1] @@ -20832,7 +20832,7 @@ _08013FFC: b _0801405A .pool _08014038: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer ldr r0, =gSaveBlock1Ptr ldr r1, [r0] ldr r0, =0x00002be0 @@ -21403,7 +21403,7 @@ _080145D8: .pool _080145F4: bl overworld_free_bg_tilemaps - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl sp000_heal_pokemon @@ -21422,7 +21422,7 @@ _08014620: bl sp000_heal_pokemon bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 movs r0, 0x2 @@ -21438,7 +21438,7 @@ _0801464C: bl sp000_heal_pokemon bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 movs r0, 0x5 @@ -21450,7 +21450,7 @@ _0801464C: b _080146B0 .pool _08014678: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl overworld_free_bg_tilemaps @@ -21463,7 +21463,7 @@ _08014678: b _080146B0 .pool _08014698: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl overworld_free_bg_tilemaps @@ -21503,7 +21503,7 @@ _080146F6: bl sub_801DD98 b _08014764 _080146FC: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0 bl sub_80143E4 ldr r0, =sub_80141A4 @@ -21573,7 +21573,7 @@ sub_8014790: @ 8014790 lsls r0, 3 ldr r1, =gTasks + 0x8 adds r7, r0, r1 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer mov r9, r0 movs r1, 0 ldrsh r0, [r7, r1] @@ -23720,7 +23720,7 @@ _08015BBE: bne _08015BCA bl _08016878 _08015BCA: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 ldr r0, =sub_80140E0 @@ -24247,7 +24247,7 @@ _080160DA: bne _080160E4 b _08016878 _080160E4: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 ldr r0, =sub_80140E0 @@ -33721,7 +33721,7 @@ _0801AE48: beq _0801AE54 b _0801AFAE _0801AE54: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 movs r1, 0 movs r2, 0x20 @@ -33738,7 +33738,7 @@ _0801AE78: movs r0, 0x51 _0801AE7A: strb r0, [r4] - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0x20 bl SendBlock diff --git a/asm/menu.s b/asm/menu.s index 71ff9218c..e1102893a 100755 --- a/asm/menu.s +++ b/asm/menu.s @@ -22,7 +22,7 @@ AddTextPrinterWithCallbackForMessage: @ 8197A9C ands r1, r2 orrs r1, r0 strb r1, [r3] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index df8e443a1..f15346b81 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -232,7 +232,7 @@ _08178B56: ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00005501 adds r0, r2, 0 strh r0, [r1] diff --git a/asm/naming_screen.s b/asm/naming_screen.s index 22d7b260e..cded48783 100644 --- a/asm/naming_screen.s +++ b/asm/naming_screen.s @@ -904,7 +904,7 @@ _080E3586: movs r1, 0x1 orrs r0, r1 strb r0, [r2] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 diff --git a/asm/new_menu_helpers.s b/asm/new_menu_helpers.s index d79f7df32..25f7fe605 100755 --- a/asm/new_menu_helpers.s +++ b/asm/new_menu_helpers.s @@ -185,7 +185,7 @@ AddTextPrinterForMessage: @ 81972C4 ands r1, r2 orrs r1, r0 strb r1, [r3] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 @@ -222,7 +222,7 @@ AddTextPrinterForMessage_2: @ 8197310 ands r1, r2 orrs r1, r0 strb r1, [r3] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 @@ -945,7 +945,7 @@ DisplayItemMessageOnField: @ 81978EC lsls r4, 24 lsrs r4, 24 bl sub_81973A4 - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 movs r2, 0x80 @@ -1021,8 +1021,8 @@ _0819798A: bx r1 thumb_func_end sub_8197964 - thumb_func_start sav2_get_text_speed -sav2_get_text_speed: @ 8197990 + thumb_func_start GetPlayerTextSpeed +GetPlayerTextSpeed: @ 8197990 push {lr} ldr r0, =gSaveBlock2Ptr ldr r2, [r0] @@ -1045,7 +1045,7 @@ _081979AC: pop {r1} bx r1 .pool - thumb_func_end sav2_get_text_speed + thumb_func_end GetPlayerTextSpeed thumb_func_start sub_81979C4 sub_81979C4: @ 81979C4 diff --git a/asm/party_menu.s b/asm/party_menu.s index 018ee7b84..4ae689d4d 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5992,7 +5992,7 @@ sub_81B3300: @ 81B3300 movs r1, 0x1 orrs r0, r1 strb r0, [r2] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 9830db888..167c75730 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -740,7 +740,7 @@ _0817A268: movs r1, 0x1 orrs r0, r1 strb r0, [r2] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index d30c6b4ee..c2c65e49b 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5547,7 +5547,7 @@ DisplayItemMessageInBattlePyramid: @ 81C6DD8 movs r0, 0x2 movs r1, 0x11 bl FillWindowPixelBuffer - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 movs r1, 0x1 diff --git a/asm/pokenav.s b/asm/pokenav.s index 249258404..d6a3cc80c 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -10207,7 +10207,7 @@ sub_81CC158: @ 81CC158 adds r1, 0xF bl sub_81CAF78 adds r5, r0, 0 - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 ldrb r2, [r4, 0x14] @@ -23751,7 +23751,7 @@ sub_81D2BF4: @ 81D2BF4 movs r1, 0x1 orrs r0, r1 strb r0, [r2] - bl sav2_get_text_speed + bl GetPlayerTextSpeed adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 @@ -28068,7 +28068,7 @@ sub_81D4E30: @ 81D4E30 lsls r2, 6 movs r1, 0 bl memset - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00005503 adds r0, r2, 0 strh r0, [r1] diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 35e0557ee..e7d7c8a38 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -993,7 +993,7 @@ _080E75AC: movs r0, 0xC8 muls r0, r2 adds r1, r0 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r2, 0xC8 bl memcpy b _080E75FC diff --git a/asm/rom6.s b/asm/rom6.s index f07689a86..719feaae0 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -2601,7 +2601,7 @@ sub_8136AB4: @ 8136AB4 ldr r1, =gText_ThrowAwayVar1 adds r0, r5, 0 bl StringExpandPlaceholders - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 movs r1, 0x1 @@ -2657,7 +2657,7 @@ sub_8136B78: @ 8136B78 ldr r1, =gText_Var1ThrownAway adds r0, r5, 0 bl StringExpandPlaceholders - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 movs r1, 0x1 diff --git a/asm/shop.s b/asm/shop.s index 94756624c..2d6791a62 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -1219,7 +1219,7 @@ BuyMenuDisplayMessage: @ 80E04E8 adds r6, r2, 0 lsls r4, 24 lsrs r4, 24 - bl sav2_get_text_speed + bl GetPlayerTextSpeed lsls r0, 24 lsrs r0, 24 movs r1, 0x1 diff --git a/asm/trade.s b/asm/trade.s index cbf980b74..74e907aee 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -401,7 +401,7 @@ _080774B2: ldrb r2, [r0] cmp r2, 0 bne _0807754C - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r5, =0x00001122 adds r0, r5, 0 strh r0, [r1] @@ -2142,7 +2142,7 @@ _08078484: .4byte _080786F0 .4byte _08078720 _080784DC: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty movs r2, 0xC8 bl sub_8078438 @@ -2208,7 +2208,7 @@ _08078552: b _080787A2 .pool _0807857C: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty + 200 movs r2, 0xC8 bl sub_8078438 @@ -2247,7 +2247,7 @@ _080785B6: b _080787A2 .pool _080785E0: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty + 400 movs r2, 0xC8 bl sub_8078438 @@ -2286,7 +2286,7 @@ _0807861A: b _080787A2 .pool _08078644: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gSaveBlock1Ptr ldr r1, [r1] ldr r2, =0x00002be0 @@ -2328,7 +2328,7 @@ _0807868A: b _080787A2 .pool _080786B4: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gSaveBlock1Ptr ldr r1, [r1] ldr r2, =0x000031a8 @@ -7258,7 +7258,7 @@ _0807AEAC: ldrb r0, [r0] cmp r0, 0 bne _0807AEC0 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001144 adds r0, r2, 0 strh r0, [r1] diff --git a/data/graphics.s b/data/graphics.s index 87b983a80..72daf144f 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -682,7 +682,7 @@ gMonIcon_Egg:: @ 8D8FC74 .incbin "baserom.gba", 0xd90074, 0x1524 -gUnknown_08D91598:: @ 8D91598 +sBlenderCenterGfx:: @ 8D91598 .incbin "baserom.gba", 0xd91598, 0x820 gUnknown_08D91DB8:: @ 8D91DB8 diff --git a/data/link.s b/data/link.s index d9cf886c5..336383678 100644 --- a/data/link.s +++ b/data/link.s @@ -28,15 +28,15 @@ g2BlankTilesGfx:: @ 82ED168 .incbin "graphics/interface/blank_1x2.4bpp" gUnknown_082ED1A8:: @ 82ED1A8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000C8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000C8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000064 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000DC - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000028 gUnknown_082ED1D0:: @ 82ED1D0 @@ -224,15 +224,15 @@ gUnknown_082ED6A5:: @ 82ED6A5 .align 2 gUnknown_082ED6B8:: @ 82ED6B8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000c8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000c8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000064 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000dc - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000028 .align 2 diff --git a/data/scripts/pokeblocks.inc b/data/scripts/pokeblocks.inc index e77e4d789..d8f2f2e48 100644 --- a/data/scripts/pokeblocks.inc +++ b/data/scripts/pokeblocks.inc @@ -303,7 +303,7 @@ LilycoveCity_ContestLobby_EventScript_293CEE:: @ 8293CEE LilycoveCity_ContestLobby_EventScript_293D2C:: @ 8293D2C copyvar VAR_0x8004, VAR_0x8009 fadescreen 1 - special sub_807FA80 + special DoBerryBlending waitstate releaseall end @@ -635,7 +635,7 @@ LilycoveCity_ContestLobby_EventScript_294147:: @ 8294147 removeobject 239 removeobject 238 removeobject 237 - special sub_807FA80 + special DoBerryBlending waitstate releaseall end diff --git a/data/specials.inc b/data/specials.inc index 51bb34dff..dac9467fd 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -171,7 +171,7 @@ gSpecials:: @ 81DBA64 def_special ChangePokemonNickname def_special sub_81B94B0 def_special sub_8136EF4 - def_special sub_807FA80 + def_special DoBerryBlending def_special sub_8142BC8 def_special sub_813BD60 def_special sub_813BCA8 diff --git a/include/berry.h b/include/berry.h index f51503d41..f1f3a8afb 100644 --- a/include/berry.h +++ b/include/berry.h @@ -11,6 +11,16 @@ enum BERRY_FIRMNESS_SUPER_HARD, }; +enum +{ + FLAVOUR_SPICY, + FLAVOUR_DRY, + FLAVOUR_SWEET, + FLAVOUR_BITTER, + FLAVOUR_SOUR, + FLAVOUR_COUNT +}; + #define NUM_BERRIES 44 extern const u8 *const gBerryTreeFieldObjectGraphicsIdTablePointers[NUM_BERRIES]; diff --git a/include/decompress.h b/include/decompress.h index 36be803e0..34a678cda 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -28,4 +28,6 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); +u32 sub_8034974(const u8 *ptr); + #endif // GUARD_DECOMPRESS_H diff --git a/include/flags.h b/include/flags.h index a891cc13f..1cb56a7f4 100644 --- a/include/flags.h +++ b/include/flags.h @@ -2,6 +2,7 @@ #define GUARD_FLAGS_H #define FLAG_PENDING_DAYCARE_EGG 0x86 +#define FLAG_340 0x340 #define FLAG_TRAINER_FLAG_START 0x500 diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index 6cdfd13e1..659302fd5 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -406,7 +406,7 @@ void m4aSoundVSyncOff(void); void m4aMPlayTempoControl(struct MusicPlayerInfo *mplayInfo, u16 tempo); void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 volume); -void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 pitch); +void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s16 pitch); void m4aMPlayPanpotControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s8 pan); void ClearModM(struct MusicPlayerTrack *track); void m4aMPlayModDepthSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 modDepth); diff --git a/include/item_menu_icons.h b/include/item_menu_icons.h new file mode 100644 index 000000000..553e7c262 --- /dev/null +++ b/include/item_menu_icons.h @@ -0,0 +1,6 @@ +#ifndef GUARD_ITEM_MENU_ICONS +#define GUARD_ITEM_MENU_ICONS + +u8 sub_80D511C(u8 a0, u8 a1, u8 a2, u8 a3); + +#endif // GUARD_ITEM_MENU_ICONS diff --git a/include/items.h b/include/items.h index 1f6c288c5..1a6df42db 100644 --- a/include/items.h +++ b/include/items.h @@ -386,6 +386,10 @@ enum ITEM_OLD_SEA_MAP, // 0x178 }; +#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY +#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY +#define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1)) + #define NUM_TECHNICAL_MACHINES 50 #define NUM_HIDDEN_MACHINES 8 diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index 42b8c60b1..c52184972 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -13,5 +13,6 @@ void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); void sub_8197434(u8 a0, u8 a1); void SetStandardWindowBorderStyle(u8 a0, u8 a1); void sub_8197930(void); +u8 GetPlayerTextSpeed(void); #endif // GUARD_NEW_MENU_HELPERS_H diff --git a/src/battle_message.c b/src/battle_message.c index 4bd6ca5b7..1f39d5397 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -59,7 +59,7 @@ extern const u8* GetTrainer2LoseText(void); // battle_setup extern void GetFrontierTrainerName(u8 *dst, u16 trainerId); extern s32 GetStringCenterAlignXOffsetWithLetterSpacing(u8 fontId, const u8 *str, s32 totalWidth, s16 letterSpacing); extern u8 sub_8185FC4(void); -extern u8 sav2_get_text_speed(void); +extern u8 GetPlayerTextSpeed(void); // this file's functions static void sub_814F8F8(u8 *textPtr); @@ -2266,7 +2266,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) speed = sRecordedBattleTextSpeeds[sub_8185FC4()]; else - speed = sav2_get_text_speed(); + speed = GetPlayerTextSpeed(); gTextFlags.flag_0 = 1; } diff --git a/src/berry.c b/src/berry.c index 6d1fd17a1..0c1553463 100644 --- a/src/berry.c +++ b/src/berry.c @@ -18,12 +18,6 @@ extern u16 gSpecialVar_ItemId; extern const u8 BerryTreeScript[]; -#define BERRY_NAME_LENGTH 6 - -#define FIRST_BERRY ITEM_CHERI_BERRY -#define LAST_BERRY ITEM_ENIGMA_BERRY - - static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); static const u8 sBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are"); @@ -1062,28 +1056,28 @@ u8 GetStageByBerryTreeId(u8 id) u8 ItemIdToBerryType(u16 item) { - u16 berry = item - FIRST_BERRY; + u16 berry = item - FIRST_BERRY_INDEX; - if (berry > LAST_BERRY - FIRST_BERRY) + if (berry > LAST_BERRY_INDEX - FIRST_BERRY_INDEX) return 1; else - return item - FIRST_BERRY + 1; + return ITEM_TO_BERRY(item); } u16 BerryTypeToItemId(u16 berry) { u16 item = berry - 1; - if (item > LAST_BERRY - FIRST_BERRY) - return FIRST_BERRY; + if (item > LAST_BERRY_INDEX - FIRST_BERRY_INDEX) + return FIRST_BERRY_INDEX; else - return berry + FIRST_BERRY - 1; + return berry + FIRST_BERRY_INDEX - 1; } void GetBerryNameByBerryType(u8 berry, u8 *string) { - memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH); - string[BERRY_NAME_LENGTH] = EOS; + memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_COUNT - 1); + string[BERRY_NAME_COUNT - 1] = EOS; } void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount) diff --git a/src/berry_blender.c b/src/berry_blender.c index 8e5a51845..f626fef91 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -3,15 +3,370 @@ #include "window.h" #include "task.h" #include "sprite.h" +#include "sound.h" +#include "songs.h" +#include "m4a.h" +#include "bg.h" +#include "palette.h" +#include "decompress.h" +#include "malloc.h" +#include "gpu_regs.h" +#include "text.h" +#include "event_data.h" +#include "main.h" +#include "link.h" +#include "new_menu_helpers.h" +#include "item_menu_icons.h" +#include "berry.h" +#include "items.h" +#include "string_util.h" // Static type declarations +#define BLENDER_SCORE_BEST 0 +#define BLENDER_SCORE_GOOD 1 +#define BLENDER_SCORE_MISS 2 -// Static RAM declarations -IWRAM_DATA void *berry_blender_c_unused_03000de4; -IWRAM_DATA s16 gUnknown_03000DE8[8]; -IWRAM_DATA s16 gUnknown_03000DF8[6]; -IWRAM_DATA s16 gUnknown_03000E04; -IWRAM_DATA s16 gUnknown_03000E06; +#define BLENDER_MAX_PLAYERS 4 +#define BLENDER_SCORES_NO 3 + +struct BlenderBerry +{ + u16 itemId; + u8 name[BERRY_NAME_COUNT]; + u8 flavours[FLAVOUR_COUNT]; + u8 smoothness; +}; + +struct BerryBlenderData +{ + u8 mainState; + u8 loadGfxState; + u8 field_02; + u8 field_03; + u8 field_04; + u8 field_05; + u8 field_06; + u8 field_07; + u8 field_08; + u8 field_09; + u8 field_0A; + u8 field_0B; + u8 field_0C; + u8 field_0D; + u8 field_0E; + u8 field_0F; + + u8 field_10; + u8 field_11; + u8 field_12; + u8 field_13; + u8 field_14; + u8 field_15; + u8 field_16; + u8 field_17; + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + + u8 field_20; + u8 field_21; + u8 field_22; + u8 field_23; + u8 field_24; + u8 field_25; + u8 field_26; + u8 field_27; + u8 field_28; + u8 field_29; + u8 field_2A; + u8 field_2B; + u8 field_2C; + u8 field_2D; + u8 field_2E; + u8 field_2F; + + u8 field_30; + u8 field_31; + u8 field_32; + u8 field_33; + u8 field_34; + u8 field_35; + u8 field_36; + u8 field_37; + u8 field_38; + u8 field_39; + u8 field_3A; + u8 field_3B; + u8 field_3C; + u8 field_3D; + u8 field_3E; + u8 field_3F; + + u8 field_40; + u8 field_41; + u8 field_42; + u8 field_43; + u8 field_44; + u8 field_45; + u8 field_46; + u8 field_47; + u8 field_48; + u8 field_49; + u16 arrowPos; + s16 field_4C; + s16 field_4E; + + u8 syncArrowSpriteIds[BLENDER_MAX_PLAYERS]; + u8 syncArrowSprite2Ids[BLENDER_MAX_PLAYERS]; + u8 field_58; + u8 field_59; + u8 field_5A; + u8 field_5B; + u8 field_5C; + u8 field_5D; + u8 field_5E; + u8 field_5F; + + u8 field_60; + u8 field_61; + u8 field_62; + u8 field_63; + u16 field_64[BLENDER_MAX_PLAYERS]; + u8 field_6C; + u8 field_6D; + u8 field_6E; + u8 field_6F; + + u16 field_70; + u8 field_72; + u8 field_73; + u16 chosenItemId[BLENDER_MAX_PLAYERS]; + u8 playersNo; + u8 field_7D; + u8 field_7E; + u8 field_7F; + + u8 field_80; + u8 field_81; + u8 field_82; + u8 field_83; + u8 field_84; + u8 field_85; + u8 field_86; + u8 field_87; + u8 field_88; + u8 field_89; + u8 field_8A; + u8 field_8B; + u8 field_8C; + u8 field_8D; + u8 field_8E; + u8 field_8F; + + u8 field_90; + u8 field_91; + u8 field_92; + u8 field_93; + u8 field_94; + u8 field_95; + u8 field_96; + u8 field_97; + u8 field_98; + u8 field_99; + u8 field_9A; + u8 field_9B; + u8 field_9C; + u8 field_9D; + u8 field_9E; + u8 field_9F; + + u8 field_A0; + u8 field_A1; + u8 field_A2; + u8 field_A3; + u8 field_A4; + u8 field_A5; + u8 field_A6; + u8 field_A7; + u8 field_A8; + u8 field_A9; + u8 field_AA; + u8 field_AB; + u8 field_AC; + u8 field_AD; + u8 field_AE; + u8 field_AF; + + u8 field_B0; + u8 field_B1; + u8 field_B2; + u8 field_B3; + u8 field_B4; + u8 field_B5; + u8 field_B6; + u8 field_B7; + u8 field_B8; + u8 field_B9; + u8 field_BA; + u8 field_BB; + u8 field_BC; + u8 field_BD; + u8 field_BE; + u8 field_BF; + + u8 field_C0; + u8 field_C1; + u8 field_C2; + u8 field_C3; + u8 field_C4; + u8 field_C5; + u8 field_C6; + u8 field_C7; + u8 field_C8; + u8 field_C9; + u8 field_CA; + u8 field_CB; + u8 field_CC; + u8 field_CD; + u8 field_CE; + u8 field_CF; + + u8 field_D0; + u8 field_D1; + u8 field_D2; + u8 field_D3; + u8 field_D4; + u8 field_D5; + u8 field_D6; + u8 field_D7; + u8 field_D8; + u8 field_D9; + u8 field_DA; + u8 field_DB; + u8 field_DC; + u8 field_DD; + u8 field_DE; + u8 field_DF; + + u8 field_E0; + u8 field_E1; + u8 field_E2; + u8 field_E3; + u8 field_E4; + u8 field_E5; + u8 field_E6; + u8 field_E7; + u8 field_E8; + u8 field_E9; + u8 field_EA; + u8 field_EB; + u8 field_EC; + u8 field_ED; + u8 field_EE; + u8 field_EF; + + u8 field_F0; + u8 field_F1; + u8 field_F2; + u8 field_F3; + u8 field_F4; + u8 field_F5; + u8 field_F6; + u8 field_F7; + u8 field_F8; + u8 field_F9; + u8 field_FA; + u8 field_FB; + u8 field_FC; + u8 field_FD; + u8 field_FE; + u8 field_FF; + + u8 field_100; + u8 field_101; + u8 field_102; + u8 field_103; + u32 gameFrameTime; + s32 framesToWait; + u32 field_10C; + + u8 field_110; + u8 field_111; + u8 field_112; + u8 field_113; + u8 field_114; + u8 field_115; + u16 field_116; + u16 field_118; + u16 field_11A; + s16 field_11C; + s16 field_11E; + + u8 field_120; + u8 field_121; + u8 field_122; + u8 field_123; + u16 scores[BLENDER_MAX_PLAYERS][BLENDER_SCORES_NO]; + u8 field_13C; + u8 field_13D; + u8 field_13E; + u8 field_13F; + + struct BgAffineSrcData bgAffineSrc; + + u16 field_154; + u8 field_156; + u8 field_157; + struct BlenderBerry blendedBerries[BLENDER_MAX_PLAYERS]; + u8 field_198; + u8 field_199; + u8 field_19A; + u8 field_19B; + u8 field_19C; + u8 field_19D; + u8 field_19E; + u8 field_19F; + + u8 field_1A0; + u8 field_1A1; + u8 field_1A2; + u8 field_1A3; + u8 field_1A4; + u8 field_1A5; + u8 field_1A6; + u8 field_1A7; + u8 field_1A8; + u8 field_1A9; + u8 field_1AA; + u8 field_1AB; + u8 field_1AC; + u8 field_1AD; + u8 field_1AE; + u8 field_1AF; + + u8 field_1B0; + u8 field_1B1; + u8 field_1B2; + u8 field_1B3; + u8 field_1B4; + u8 field_1B5; + u8 field_1B6; + u8 field_1B7; + u8 tilemapBuffers[2][0x800]; + s16 textState; + void *tilesBuffer; + u8 field_11C0[0x20]; +}; + +extern struct MusicPlayerInfo gMPlay_SE2; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u16 gSpecialVar_ItemId; +extern u8 gInGameOpponentsNo; // graphics extern const u8 gBerryBlenderArrowTiles[]; @@ -22,6 +377,20 @@ extern const u8 gBerryBlenderCountdownNumbersTiles[]; extern const u16 gBerryBlenderMiscPalette[]; extern const u16 gBerryBlenderArrowPalette[]; +// text +extern const u8 gText_BerryBlenderStart[]; + +extern void sub_81978B0(u16); +extern void sub_800A418(void); +extern u8 sub_800A9D8(void); +extern bool8 sub_800A4D8(u8); +extern void sub_8197DF8(u8 windowId, bool8 copyToVram); +extern void sub_809882C(u8, u16, u8); +extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8); +extern void sub_81AABF0(void (*callback)(void)); + +// this file's functions +void BerryBlender_SetGpuRegs(void); void sub_8080EA4(u8 taskId); void sub_8080FD0(u8 taskId); void sub_80810F8(u8 taskId); @@ -29,8 +398,30 @@ void sub_80833F8(struct Sprite *sprite); void sub_8082F68(struct Sprite *sprite); void sub_8083010(struct Sprite *sprite); void sub_80830C0(struct Sprite *sprite); +void Blender_SetPlayerNamesLocal(u8 opponentsNum); +void sub_807FAC8(void); +void sub_8082D28(void); +bool32 Blender_PrintText(s16 *textState, const u8 *string, u8 textSpeed); +void sub_807FFA4(void); +void sub_8080018(void); +void sub_80808D4(void); +void Blender_DummiedOutFunc(s16 a0, s16 a1); +void sub_8081898(void); +void sub_8082CB4(struct BgAffineSrcData *bgAffineSrc); +bool8 sub_8083380(void); +void sub_808074C(void); +void sub_80807BC(void); +void sub_8080588(void); + +extern struct BerryBlenderData *sBerryBlenderData; + +// Static RAM declarations +IWRAM_DATA void *berry_blender_c_unused_03000de4; +IWRAM_DATA s16 gUnknown_03000DE8[8]; +IWRAM_DATA s16 gUnknown_03000DF8[6]; +IWRAM_DATA s16 gUnknown_03000E04; +IWRAM_DATA s16 gUnknown_03000E06; -// .rodata // TODO: make those static once the file is decompiled const u16 sBlenderCenterPal[] = INCBIN_U16("graphics/berry_blender/center.gbapal"); const u8 sBlenderCenterMap[] = INCBIN_U8("graphics/berry_blender/center_map.bin"); @@ -67,6 +458,16 @@ const u8* const sBlenderOpponentsNames[] = sText_Miss }; +enum +{ + BLENDER_MISTER, + BLENDER_LADDIE, + BLENDER_LASSIE, + BLENDER_MASTER, + BLENDER_DUDE, + BLENDER_MISS +}; + static const u8 sText_PressAToStart[] = _("Press the A Button to start."); static const u8 sText_PleaseWaitAWhile[] = _("Please wait a while."); const u8 sText_CommunicationStandby[] = _("Communication standby…"); @@ -91,7 +492,7 @@ const u8 sText_TheLevelIs[] = _("The level is "); const u8 sText_TheFeelIs[] = _(", and the feel is "); const u8 sText_Dot2[] = _("."); -const struct BgTemplate gUnknown_08339974[3] = +const struct BgTemplate sBerryBlenderBgTemplates[3] = { { .bg = 0, @@ -122,7 +523,7 @@ const struct BgTemplate gUnknown_08339974[3] = } }; -const struct WindowTemplate gUnknown_08339980[] = +static const struct WindowTemplate sBerryBlender_WindowTemplates[] = { {0, 1, 6, 7, 2, 0xE, 0x28}, {0, 0x16, 6, 7, 2, 0xE, 0x36}, @@ -143,7 +544,7 @@ const s8 gUnknown_083399C0[][2] = {-1, -1}, {1, -1}, {-1, 1}, {1, 1} }; -const u8 sBlenderSyncArrowsPos[][2] = +const u8 sBlenderSyncArrowsPos[BLENDER_MAX_PLAYERS][2] = { {72, 32}, {168, 32}, {72, 128}, {168, 128} }; @@ -594,4 +995,528 @@ static const u8 gUnknown_08339CD2[] = const struct WindowTemplate gUnknown_08339D14[] = {0, 6, 4, 0x12, 0xB, 0xF, 8}; -// .text +// code + +void Blender_ControlHitPitch(void) +{ + m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, 2 * (sBerryBlenderData->field_4C - 128)); +} + +void VBlankCB0_BerryBlender(void) +{ + BerryBlender_SetGpuRegs(); + SetBgAffine(2, sBerryBlenderData->bgAffineSrc.texX, sBerryBlenderData->bgAffineSrc.texY, + sBerryBlenderData->bgAffineSrc.scrX, sBerryBlenderData->bgAffineSrc.scrY, + sBerryBlenderData->bgAffineSrc.sx, sBerryBlenderData->bgAffineSrc.sy, + sBerryBlenderData->bgAffineSrc.alpha); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +extern const u8 sBlenderCenterGfx[]; +extern const u8 gUnknown_08D91DB8[]; +extern const u8 gUnknown_08D927EC[]; + +bool8 LoadBerryBlenderGfx(void) +{ + switch (sBerryBlenderData->loadGfxState) + { + case 0: + sBerryBlenderData->tilesBuffer = AllocZeroed(sub_8034974(sBlenderCenterGfx) + 100); + LZDecompressWram(sBlenderCenterGfx, sBerryBlenderData->tilesBuffer); + sBerryBlenderData->loadGfxState++; + break; + case 1: + CopyToBgTilemapBuffer(2, sBlenderCenterMap, 0x400, 0); + CopyBgTilemapBufferToVram(2); + LoadPalette(sBlenderCenterPal, 0, 0x100); + sBerryBlenderData->loadGfxState++; + break; + case 2: + LoadBgTiles(2, sBerryBlenderData->tilesBuffer, sub_8034974(sBlenderCenterGfx), 0); + sBerryBlenderData->loadGfxState++; + break; + case 3: + LZDecompressWram(gUnknown_08D91DB8, sBerryBlenderData->tilesBuffer); + sBerryBlenderData->loadGfxState++; + break; + case 4: + LoadBgTiles(1, sBerryBlenderData->tilesBuffer, sub_8034974(gUnknown_08D91DB8), 0); + sBerryBlenderData->loadGfxState++; + break; + case 5: + LZDecompressWram(gUnknown_08D927EC, sBerryBlenderData->tilesBuffer); + sBerryBlenderData->loadGfxState++; + break; + case 6: + CopyToBgTilemapBuffer(1, sBerryBlenderData->tilesBuffer, sub_8034974(gUnknown_08D927EC), 0); + CopyBgTilemapBufferToVram(1); + sBerryBlenderData->loadGfxState++; + break; + case 7: + LoadPalette(sBlenderOuterPal, 0x80, 0x20); + sBerryBlenderData->loadGfxState++; + break; + case 8: + LoadSpriteSheet(&sSpriteSheet_BlenderArrow); + LoadSpriteSheet(&gUnknown_08339BD8); + LoadSpriteSheet(&gUnknown_08339B38); + sBerryBlenderData->loadGfxState++; + break; + case 9: + LoadSpriteSheet(&gUnknown_08339C24); + LoadSpriteSheet(&gUnknown_08339C58); + LoadSpritePalette(&sSpritePal_BlenderArrow); + LoadSpritePalette(&sSpritePal_BlenderMisc); + Free(sBerryBlenderData->tilesBuffer); + sBerryBlenderData->loadGfxState = 0; + return TRUE; + } + + return FALSE; +} + +void sub_807F9D0(void) +{ + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + CopyBgTilemapBufferToVram(0); + ShowBg(0); + ShowBg(1); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); +} + +void InitBerryBlenderWindows(void) +{ + if (InitWindows(sBerryBlender_WindowTemplates)) + { + s32 i; + + DeactivateAllTextPrinters(); + for (i = 0; i < 5; i++) + FillWindowPixelBuffer(i, 0); + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + sub_81978B0(0xE0); + } +} + +void DoBerryBlending(void) +{ + if (sBerryBlenderData == NULL) + sBerryBlenderData = AllocZeroed(sizeof(*sBerryBlenderData)); + + sBerryBlenderData->field_63 = 0; + sBerryBlenderData->mainState = 0; + sBerryBlenderData->field_63 = 0; + + Blender_SetPlayerNamesLocal(gSpecialVar_0x8004); + SetMainCallback2(sub_807FAC8); +} + +void sub_807FAC8(void) +{ + s32 i; + + switch (sBerryBlenderData->mainState) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetSpriteData(); + FreeAllSpritePalettes(); + SetVBlankCallback(NULL); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(1, sBerryBlenderBgTemplates, ARRAY_COUNT(sBerryBlenderBgTemplates)); + SetBgTilemapBuffer(1, sBerryBlenderData->tilemapBuffers[0]); + SetBgTilemapBuffer(2, sBerryBlenderData->tilemapBuffers[1]); + sub_809882C(0, 1, 0xD0); + copy_textbox_border_tile_patterns_to_vram(0, 0x14, 0xF0); + InitBerryBlenderWindows(); + + sBerryBlenderData->mainState++; + sBerryBlenderData->field_118 = 0; + sBerryBlenderData->field_116 = 0; + sBerryBlenderData->field_11A = 0x50; + sBerryBlenderData->field_11C = 0; + sBerryBlenderData->field_11E = 0; + sBerryBlenderData->loadGfxState = 0; + + sub_8082D28(); + break; + case 1: + if (LoadBerryBlenderGfx()) + { + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + sBerryBlenderData->syncArrowSpriteIds[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1); + StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSpriteIds[i]], i + 8); + } + if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) + { + sub_800E0E8(); + sub_800DFB4(0, 0); + } + SetVBlankCallback(VBlankCB0_BerryBlender); + sBerryBlenderData->mainState++; + } + break; + case 2: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + sub_8082D28(); + sBerryBlenderData->mainState++; + break; + case 3: + sub_807F9D0(); + if (!gPaletteFade.active) + sBerryBlenderData->mainState++; + break; + case 4: + if (Blender_PrintText(&sBerryBlenderData->textState, gText_BerryBlenderStart, GetPlayerTextSpeed())) + sBerryBlenderData->mainState++; + break; + case 5: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + sBerryBlenderData->mainState++; + break; + case 6: + if (!gPaletteFade.active) + { + FreeAllWindowBuffers(); + UnsetBgTilemapBuffer(2); + UnsetBgTilemapBuffer(1); + SetVBlankCallback(NULL); + sub_81AABF0(sub_807FFA4); + + sBerryBlenderData->mainState = 0; + } + break; + } + + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +void sub_807FD08(struct Sprite* sprite) +{ + sprite->data1 += sprite->data6; + sprite->data2 -= sprite->data4; + sprite->data2 += sprite->data7; + sprite->data0 += sprite->data7; + sprite->data4--; + + if (sprite->data0 < sprite->data2) + { + sprite->data3 = sprite->data4 = sprite->data3 - 1; + + if (++sprite->data5 > 3) + DestroySprite(sprite); + else + PlaySE(SE_TB_KARA); + } + sprite->pos1.x = sprite->data1; + sprite->pos1.y = sprite->data2; +} + +void sub_807FD64(struct Sprite* sprite, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) +{ + sprite->data0 = a3; + sprite->data1 = a2; + sprite->data2 = a3; + sprite->data3 = a4; + sprite->data4 = 10; + sprite->data5 = 0; + sprite->data6 = a5; + sprite->data7 = a6; + sprite->callback = sub_807FD08; +} + +void sub_807FD90(u16 a0, u8 a1) +{ + u8 spriteId = sub_80D511C(a0 + 123, 0, 80, a1 & 1); + sub_807FD64(&gSprites[spriteId], gUnknown_08339C78[a1][0], gUnknown_08339C78[a1][1], gUnknown_08339C78[a1][2], gUnknown_08339C78[a1][3], gUnknown_08339C78[a1][4]); +} + +void Blender_CopyBerryData(struct BlenderBerry* berry, u16 itemId) +{ + const struct Berry *berryInfo = GetBerryInfo(ITEM_TO_BERRY(itemId)); + + berry->itemId = itemId; + StringCopy(berry->name, berryInfo->name); + berry->flavours[FLAVOUR_SPICY] = berryInfo->spicy; + berry->flavours[FLAVOUR_DRY] = berryInfo->dry; + berry->flavours[FLAVOUR_SWEET] = berryInfo->sweet; + berry->flavours[FLAVOUR_BITTER] = berryInfo->bitter; + berry->flavours[FLAVOUR_SOUR] = berryInfo->sour; + berry->smoothness = berryInfo->smoothness; +} + +void Blender_SetPlayerNamesLocal(u8 opponentsNum) +{ + switch (opponentsNum) + { + case 0: + gInGameOpponentsNo = 0; + break; + case 1: + gInGameOpponentsNo = 1; + sBerryBlenderData->playersNo = 2; + StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName); + + if (!FlagGet(FLAG_340)) + StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MASTER]); + else + StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MISTER]); + + gLinkPlayers[0].language = GAME_LANGUAGE; + gLinkPlayers[1].language = GAME_LANGUAGE; + break; + case 2: + gInGameOpponentsNo = 2; + sBerryBlenderData->playersNo = 3; + StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName); + StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_DUDE]); + StringCopy(gLinkPlayers[2].name, sBlenderOpponentsNames[BLENDER_LASSIE]); + + gLinkPlayers[0].language = GAME_LANGUAGE; + gLinkPlayers[1].language = GAME_LANGUAGE; + gLinkPlayers[2].language = GAME_LANGUAGE; + break; + case 3: + gInGameOpponentsNo = 3; + sBerryBlenderData->playersNo = 4; + StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName); + StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MISS]); + StringCopy(gLinkPlayers[2].name, sBlenderOpponentsNames[BLENDER_LADDIE]); + StringCopy(gLinkPlayers[3].name, sBlenderOpponentsNames[BLENDER_LASSIE]); + + gLinkPlayers[0].language = GAME_LANGUAGE; + gLinkPlayers[1].language = GAME_LANGUAGE; + gLinkPlayers[2].language = GAME_LANGUAGE; + gLinkPlayers[3].language = GAME_LANGUAGE; + break; + } +} + +void sub_807FFA4(void) +{ + s32 i; + + SetGpuReg(REG_OFFSET_DISPCNT, 0); + if (sBerryBlenderData == NULL) + sBerryBlenderData = AllocZeroed(sizeof(*sBerryBlenderData)); + + sBerryBlenderData->mainState = 0; + sBerryBlenderData->field_10C = 0; + + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + sBerryBlenderData->chosenItemId[i] = ITEM_NONE; + + Blender_SetPlayerNamesLocal(gSpecialVar_0x8004); + + if (gSpecialVar_0x8004 == 0) + SetMainCallback2(sub_8080018); + else + SetMainCallback2(sub_80808D4); +} + +void sub_8080018(void) +{ + s32 i, j; + + switch (sBerryBlenderData->mainState) + { + case 0: + sub_8080588(); + gLinkType = 0x4422; + sBerryBlenderData->field_72 = 0; + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + sBerryBlenderData->field_64[i] = 0; + for (j = 0; j < 3; j++) + { + sBerryBlenderData->scores[i][j] = 0; + } + } + sBerryBlenderData->field_70 = 0; + sBerryBlenderData->field_4E = 0; + sBerryBlenderData->loadGfxState = 0; + sBerryBlenderData->mainState++; + break; + case 1: + if (LoadBerryBlenderGfx()) + { + sBerryBlenderData->mainState++; + sub_8082D28(); + } + break; + case 2: + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + sBerryBlenderData->syncArrowSprite2Ids[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1); + StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSprite2Ids[i]], i + 8); + } + if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) + { + sub_800E0E8(); + sub_800DFB4(0, 0); + } + sBerryBlenderData->mainState++; + break; + case 3: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + sBerryBlenderData->mainState++; + break; + case 4: + sub_807F9D0(); + if (!gPaletteFade.active) + { + sBerryBlenderData->mainState++; + } + break; + case 5: + Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, 0); + sBerryBlenderData->mainState = 8; + sBerryBlenderData->framesToWait = 0; + break; + case 8: + sBerryBlenderData->mainState++; + sBerryBlenderData->field_114 = 0; + Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId); + memcpy(gBlockSendBuffer, &sBerryBlenderData->blendedBerries[0], sizeof(struct BlenderBerry)); + sub_800ADF8(); + sBerryBlenderData->framesToWait = 0; + break; + case 9: + if (sub_800A520()) + { + ResetBlockReceivedFlags(); + if (GetMultiplayerId() == 0) + sub_800A4D8(4); + sBerryBlenderData->mainState++; + } + break; + case 10: + if (++sBerryBlenderData->framesToWait > 20) + { + sub_8197DF8(4, TRUE); + if (GetBlockReceivedStatus() == sub_800A9D8()) + { + for (i = 0; i < GetLinkPlayerCount(); i++) + { + memcpy(&sBerryBlenderData->blendedBerries[i], &gBlockRecvBuffer[i][0], sizeof(struct BlenderBerry)); + sBerryBlenderData->chosenItemId[i] = sBerryBlenderData->blendedBerries[i].itemId; + } + + ResetBlockReceivedFlags(); + sBerryBlenderData->mainState++; + } + } + break; + case 11: + sBerryBlenderData->playersNo = GetLinkPlayerCount(); + + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + if (sBerryBlenderData->field_114 == gUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]) + { + sub_807FD90(sBerryBlenderData->chosenItemId[sBerryBlenderData->field_114], i); + break; + } + } + + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + sBerryBlenderData->field_114++; + break; + case 12: + if (++sBerryBlenderData->framesToWait > 60) + { + if (sBerryBlenderData->field_114 >= sBerryBlenderData->playersNo) + { + sBerryBlenderData->mainState++; + sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528; + } + else + { + sBerryBlenderData->mainState--; + } + sBerryBlenderData->framesToWait = 0; + } + break; + case 13: + if (sub_800A520()) + { + sBerryBlenderData->mainState++; + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + PlaySE(SE_RU_HYUU); + ShowBg(2); + } + break; + case 14: + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); + sBerryBlenderData->arrowPos += 0x200; + sBerryBlenderData->field_11A += 4; + if (sBerryBlenderData->field_11A > 255) + { + SetGpuRegBits(REG_OFFSET_BG2CNT, 2); + sBerryBlenderData->mainState++; + sBerryBlenderData->field_11A = 256; + sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]]; + sBerryBlenderData->framesToWait = 0; + PlaySE(SE_TRACK_DOOR); + sub_808074C(); + sub_80807BC(); + } + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + break; + case 15: + if (sub_8083380()) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + } + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + break; + case 16: + CreateSprite(&gUnknown_08339C2C, 120, -16, 3); + sBerryBlenderData->mainState++; + break; + case 18: + sBerryBlenderData->mainState++; + break; + case 19: + sub_800ADF8(); + sBerryBlenderData->mainState++; + break; + case 20: + if (sub_800A520()) + { + sub_800A418(); + sBerryBlenderData->mainState++; + } + break; + case 21: + sBerryBlenderData->field_4C = 128; + sBerryBlenderData->gameFrameTime = 0; + SetMainCallback2(sub_8081898); + if (GetCurrentMapMusic() != BGM_CYCLING) + { + sBerryBlenderData->field_154 = GetCurrentMapMusic(); + } + PlayBGM(BGM_CYCLING); + break; + } + + Blender_DummiedOutFunc(sBerryBlenderData->field_11C, sBerryBlenderData->field_11E); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} diff --git a/src/decompress.c b/src/decompress.c index 9210799ec..e2ae6ce83 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -459,10 +459,9 @@ _08034964:\n\ .syntax divided"); } -u32 sub_8034974(void* ptr) +u32 sub_8034974(const u8 *ptr) { - u8* ptr_ = (u8*)(ptr); - return (ptr_[3] << 16) | (ptr_[2] << 8) | (ptr_[1]); + return (ptr[3] << 16) | (ptr[2] << 8) | (ptr[1]); } bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src) diff --git a/src/m4a_4.c b/src/m4a_4.c index 99195ec00..e645fbef5 100644 --- a/src/m4a_4.c +++ b/src/m4a_4.c @@ -45,7 +45,7 @@ void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 mplayInfo->ident = ID_NUMBER; } -void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 pitch) +void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s16 pitch) { s32 i; u32 bit; @@ -66,7 +66,7 @@ void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 { if (track->flags & MPT_FLG_EXIST) { - track->keyShiftX = (s16)pitch >> 8; + track->keyShiftX = pitch >> 8; track->pitX = pitch; track->flags |= MPT_FLG_PITCHG; } diff --git a/sym_common.txt b/sym_common.txt index 1a199dbb3..82248165d 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -248,7 +248,7 @@ gSaveBlock2Ptr: @ 3005D90 gPokemonStoragePtr: @ 3005D94 .space 0x4 -gUnknown_03005D98: @ 3005D98 +gInGameOpponentsNo: @ 3005D98 .space 0x4 gUnknown_03005D9C: @ 3005D9C diff --git a/sym_ewram.txt b/sym_ewram.txt index f037d9ace..088ca2746 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -34,13 +34,13 @@ gUnknown_020223C0: @ 20223C0 gBlockRecvBuffer: @ 20223C4 .space 0x500 -gUnknown_020228C4: @ 20228C4 gBlockSendBuffer +gBlockSendBuffer: @ 20228C4 gBlockSendBuffer .space 0x100 gUnknown_020229C4: @ 20229C4 .space 0x2 -gUnknown_020229C6: @ 20229C6 +gLinkType: @ 20229C6 .space 0x2 gUnknown_020229C8: @ 20229C8 @@ -571,7 +571,7 @@ gUnknown_0203229C: @ 203229C gUnknown_020322A0: @ 20322A0 .space 0x4 -gUnknown_020322A4: @ 20322A4 +sBerryBlenderData: @ 20322A4 .space 0x4 gUnknown_020322A8: @ 20322A8