From 3f08e0c76c0e273954021491b7336f1748c0b557 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 24 Dec 2018 03:03:02 -0600 Subject: [PATCH] Some more trade nonsense --- asm/trade.s | 1073 ---------------------- include/pokemon_icon.h | 1 + src/trade.c | 1904 ++++++++++++++++++++++++++-------------- 3 files changed, 1249 insertions(+), 1729 deletions(-) diff --git a/asm/trade.s b/asm/trade.s index e7880b100..98891cd0c 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -6,1079 +6,6 @@ .text - thumb_func_start sub_8079EA8 -sub_8079EA8: @ 8079EA8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - movs r7, 0 - ldr r3, =gUnknown_0203229C - ldr r0, [r3] - adds r0, 0x36 - add r0, r12 - ldrb r0, [r0] - cmp r7, r0 - bge _08079F5A - ldr r6, =gSprites - mov r9, r3 - mov r1, r12 - lsls r0, r1, 1 - add r0, r12 - lsls r2, r0, 1 - mov r10, r2 - ldr r1, =gUnknown_0832DE24 - movs r2, 0 - mov r8, r2 - lsls r0, 2 - adds r5, r0, r1 -_08079EE0: - mov r1, r9 - ldr r0, [r1] - mov r2, r10 - adds r4, r7, r2 - adds r0, 0x28 - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - mov r0, r9 - ldr r3, [r0] - adds r2, r3, 0 - adds r2, 0x28 - adds r2, r4 - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r5] - lsls r0, 3 - adds r0, 0xE - strh r0, [r1, 0x20] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r5, 0x1] - lsls r0, 3 - subs r0, 0xC - strh r0, [r1, 0x22] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r8 - strh r1, [r0, 0x24] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r2, r8 - strh r2, [r0, 0x26] - adds r5, 0x2 - adds r7, 0x1 - adds r3, 0x36 - add r3, r12 - ldrb r3, [r3] - cmp r7, r3 - blt _08079EE0 -_08079F5A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079EA8 - - thumb_func_start sub_8079F74 -sub_8079F74: @ 8079F74 - push {lr} - movs r0, 0x1 - bl rbox_fill_rectangle - movs r0, 0x1 - bl sub_8079BE0 - pop {r0} - bx r0 - thumb_func_end sub_8079F74 - - thumb_func_start sub_8079F88 -sub_8079F88: @ 8079F88 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTradePartyBoxTilemap - lsls r2, r4, 4 - subs r2, r4 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0xF - str r0, [sp] - movs r0, 0x11 - str r0, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r0, 0x1 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - adds r0, r4, 0 - bl sub_8079E44 - adds r0, r4, 0 - bl sub_8079BE0 - adds r0, r4, 0 - bl sub_8079EA8 - ldr r0, =gUnknown_0832DE94 - ldr r0, [r0, 0x4] - ldr r5, =gUnknown_0203229C - ldr r1, [r5] - adds r1, 0x72 - ldrh r1, [r1] - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - movs r2, 0x18 - bl sub_807A308 - ldr r0, [r5] - adds r0, 0x74 - adds r0, r4 - strb r6, [r0] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079F88 - - thumb_func_start sub_807A000 -sub_807A000: @ 807A000 - 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 - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_807A000 - - thumb_func_start sub_807A024 -sub_807A024: @ 807A024 - 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 - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_807A024 - - thumb_func_start sub_807A048 -sub_807A048: @ 807A048 - push {r4-r7,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r6, r1, 24 - movs r3, 0 - ldr r4, =gUnknown_0203229C - mov r12, r4 - movs r7, 0x8D - lsls r7, 4 -_0807A05C: - mov r1, r12 - ldr r0, [r1] - lsls r1, r3, 3 - adds r2, r0, r1 - adds r0, r2, r7 - ldrb r0, [r0] - cmp r0, 0 - bne _0807A090 - ldr r3, =0x000008d2 - adds r0, r2, r3 - strh r5, [r0] - adds r3, 0x2 - adds r0, r2, r3 - strb r6, [r0] - ldr r0, [r4] - adds r0, r1 - movs r1, 0x8D - lsls r1, 4 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - b _0807A096 - .pool -_0807A090: - adds r3, 0x1 - cmp r3, 0x3 - ble _0807A05C -_0807A096: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_807A048 - - thumb_func_start sub_807A09C -sub_807A09C: @ 807A09C - push {lr} - movs r3, 0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - movs r2, 0x8D - lsls r2, 4 - adds r1, r0, r2 - movs r2, 0x3 -_0807A0AC: - ldrb r0, [r1] - adds r3, r0 - adds r1, 0x8 - subs r2, 0x1 - cmp r2, 0 - bge _0807A0AC - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_807A09C - - thumb_func_start sub_807A0C4 -sub_807A0C4: @ 807A0C4 - push {r4,r5,lr} - movs r4, 0 - ldr r3, =gUnknown_0203229C -_0807A0CA: - ldr r0, [r3] - lsls r1, r4, 3 - adds r2, r0, r1 - movs r5, 0x8D - lsls r5, 4 - adds r0, r2, r5 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0 - beq _0807A18C - ldr r0, =0x000008d2 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0807A0F8 - subs r0, 0x1 - strh r0, [r1] - b _0807A18C - .pool -_0807A0F8: - ldr r1, =0x000008d4 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x8 - bhi _0807A17A - lsls r0, 2 - ldr r1, =_0807A114 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807A114: - .4byte _0807A138 - .4byte _0807A14C - .4byte _0807A154 - .4byte _0807A15C - .4byte _0807A15C - .4byte _0807A15C - .4byte _0807A164 - .4byte _0807A16C - .4byte _0807A174 -_0807A138: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x80 - movs r1, 0x14 - bl sub_8077170 - b _0807A17A - .pool -_0807A14C: - movs r0, 0 - bl sub_807A19C - b _0807A17A -_0807A154: - movs r0, 0x2 - bl sub_807A19C - b _0807A17A -_0807A15C: - movs r0, 0x3 - bl sub_807A19C - b _0807A17A -_0807A164: - movs r0, 0x6 - bl sub_807A19C - b _0807A17A -_0807A16C: - movs r0, 0x7 - bl sub_807A19C - b _0807A17A -_0807A174: - movs r0, 0x8 - bl sub_807A19C -_0807A17A: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r1, r5 - movs r2, 0x8D - lsls r2, 4 - adds r1, r2 - movs r2, 0 - strb r2, [r1] - adds r3, r0, 0 -_0807A18C: - adds r4, 0x1 - cmp r4, 0x3 - ble _0807A0CA - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A0C4 - - thumb_func_start sub_807A19C -sub_807A19C: @ 807A19C - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0832DEBC - lsls r4, 2 - adds r4, r0 - ldr r2, [r4] - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x14 - movs r2, 0xC - bl sub_8098858 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A19C - - thumb_func_start sub_807A1F0 -sub_807A1F0: @ 807A1F0 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r3, r1, 0 - adds r3, 0xA8 - ldrb r1, [r3] - adds r4, r0, 0 - cmp r1, 0xD - bhi _0807A22C - ldr r1, =gUnknown_02032188 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp] - ldr r0, =0xffff0000 - ldr r2, [sp, 0x4] - ands r2, r0 - movs r0, 0x80 - lsls r0, 1 - orrs r2, r0 - str r2, [sp, 0x4] - ldrb r1, [r3] - adds r1, 0xC8 - lsls r1, 16 - ldr r0, =0x0000ffff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x4] -_0807A22C: - ldr r0, [r4] - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0x11 - bhi _0807A2FC - lsls r0, 2 - ldr r1, =_0807A254 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807A254: - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A2A0 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2BC - .4byte _0807A2C8 - .4byte _0807A2D4 - .4byte _0807A2F0 -_0807A29C: - mov r0, sp - b _0807A2D6 -_0807A2A0: - mov r0, sp - bl LoadSpriteSheet - ldr r1, =gUnknown_0203229C - ldr r1, [r1] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - b _0807A2DE - .pool -_0807A2B8: - mov r0, sp - b _0807A2D6 -_0807A2BC: - ldr r0, =gSpritePalette_TradeScreenText - bl LoadSpritePalette - b _0807A2DA - .pool -_0807A2C8: - ldr r0, =gUnknown_0832DC44 - bl LoadSpritePalette - b _0807A2DA - .pool -_0807A2D4: - ldr r0, =gUnknown_0832DC3C -_0807A2D6: - bl LoadSpriteSheet -_0807A2DA: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] -_0807A2DE: - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807A2FC - .pool -_0807A2F0: - ldr r0, [r4] - adds r0, 0xA8 - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 - b _0807A2FE -_0807A2FC: - movs r0, 0 -_0807A2FE: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_807A1F0 - - thumb_func_start sub_807A308 -sub_807A308: @ 807A308 - push {lr} - sub sp, 0x4 - movs r2, 0x6 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_807A308 - - thumb_func_start sub_807A320 -sub_807A320: @ 807A320 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0 - beq _0807A338 - cmp r0, 0x1 - beq _0807A3CC - b _0807A458 -_0807A338: - movs r7, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x36 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A348 - b _0807A458 -_0807A348: - adds r6, r1, 0 - movs r5, 0 - mov r9, r5 -_0807A34E: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - adds r1, r0, 0 - cmp r1, 0x1 - bne _0807A380 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - mov r2, r9 - strb r2, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A3B0 - .pool -_0807A380: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - cmp r1, 0 - bne _0807A39E - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A3B0 -_0807A39E: - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - mov r1, r9 -_0807A3B0: - strb r1, [r0] - ldr r0, =gUnknown_0203229C - adds r5, 0x1 - adds r7, 0x1 - ldr r0, [r0] - adds r0, 0x36 - add r0, r8 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A34E - b _0807A458 - .pool -_0807A3CC: - movs r7, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r7, r0 - bge _0807A458 - adds r6, r1, 0 - movs r5, 0x6 - movs r2, 0 - mov r9, r2 -_0807A3E2: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - adds r1, r0, 0 - cmp r1, 0x1 - bne _0807A414 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - mov r2, r9 - strb r2, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A444 - .pool -_0807A414: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - cmp r1, 0 - bne _0807A432 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A444 -_0807A432: - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - mov r1, r9 -_0807A444: - strb r1, [r0] - ldr r0, =gUnknown_0203229C - adds r5, 0x1 - adds r7, 0x1 - ldr r0, [r0] - adds r0, 0x36 - add r0, r8 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A3E2 -_0807A458: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A320 - - thumb_func_start sub_807A468 -sub_807A468: @ 807A468 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0807A478 - cmp r0, 0x1 - beq _0807A4D8 - b _0807A52C -_0807A478: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bcs _0807A52C - adds r7, r1, 0 -_0807A488: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r0, r5, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl GetHPBarLevel - ldr r1, [r7] - adds r1, 0x5D - adds r1, r6 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, [r7] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bcc _0807A488 - b _0807A52C - .pool -_0807A4D8: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bcs _0807A52C - adds r7, r1, 0 -_0807A4E8: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r0, r5, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl GetHPBarLevel - ldr r1, [r7] - adds r1, 0x63 - adds r1, r6 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, [r7] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bcc _0807A4E8 -_0807A52C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A468 - - thumb_func_start sub_807A53C -sub_807A53C: @ 807A53C - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r5, 0 -_0807A544: - movs r4, 0 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - adds r0, 0x36 - adds r0, r5 - adds r1, r5, 0x1 - mov r8, r1 - ldrb r0, [r0] - cmp r4, r0 - bge _0807A596 - adds r6, r2, 0 - lsls r0, r5, 1 - adds r0, r5 - lsls r7, r0, 1 -_0807A560: - ldr r2, [r6] - adds r3, r4, r7 - adds r0, r2, 0 - adds r0, 0x28 - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r2, 0x5D - adds r2, r3 - ldrb r2, [r2] - movs r1, 0x4 - subs r1, r2 - lsls r1, 24 - lsrs r1, 24 - bl sub_80D32C8 - adds r4, 0x1 - ldr r0, [r6] - adds r0, 0x36 - adds r0, r5 - ldrb r0, [r0] - cmp r4, r0 - blt _0807A560 -_0807A596: - mov r5, r8 - cmp r5, 0x1 - ble _0807A544 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A53C - - thumb_func_start sub_807A5B0 -sub_807A5B0: @ 807A5B0 - push {r4,r5,lr} - movs r3, 0 - ldr r5, =gSaveBlock1Ptr - ldr r4, =0x000031a8 -_0807A5B8: - ldr r0, [r5] - adds r0, r4 - adds r2, r0, r3 - ldrb r0, [r2] - cmp r0, 0 - bne _0807A5DA - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA9 - adds r0, r3 - ldrb r0, [r0] - adds r1, r0, 0 - cmp r1, 0 - beq _0807A5DA - cmp r1, 0x3F - bhi _0807A5DA - strb r0, [r2] -_0807A5DA: - adds r3, 0x1 - cmp r3, 0xA - ble _0807A5B8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A5B0 - - thumb_func_start sub_807A5F4 -sub_807A5F4: @ 807A5F4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x30 - mov r8, r0 - adds r7, r1, 0 - mov r9, r2 - movs r5, 0 - cmp r5, r7 - bge _0807A62E - mov r6, sp -_0807A60C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - add r4, r8 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - str r0, [r6, 0x18] - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - stm r6!, {r0} - adds r5, 0x1 - cmp r5, r7 - blt _0807A60C -_0807A62E: - bl IsNationalPokedexEnabled - mov r1, r9 - lsls r4, r1, 2 - cmp r0, 0 - bne _0807A65C - add r0, sp, 0x18 - adds r0, r4 - ldr r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _0807A64C - movs r0, 0x3 - b _0807A718 -_0807A64C: - lsls r0, r1, 16 - lsrs r0, 16 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A65C - movs r0, 0x2 - b _0807A718 -_0807A65C: - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r0, =gLinkPlayers - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bls _0807A6AC - ldrb r1, [r1, 0x12] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _0807A6AC - add r0, sp, 0x18 - adds r0, r4 - ldr r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _0807A6A0 - movs r0, 0x5 - b _0807A718 - .pool -_0807A6A0: - lsls r0, r1, 16 - lsrs r0, 16 - bl IsSpeciesInHoennDex - cmp r0, 0 - beq _0807A6D2 -_0807A6AC: - mov r1, sp - adds r0, r1, r4 - ldr r1, [r0] - movs r0, 0xCD - lsls r0, 1 - cmp r1, r0 - beq _0807A6BE - cmp r1, 0x97 - bne _0807A6D6 -_0807A6BE: - movs r0, 0x64 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - add r0, r8 - movs r1, 0x50 - bl GetMonData - cmp r0, 0 - bne _0807A6D6 -_0807A6D2: - movs r0, 0x4 - b _0807A718 -_0807A6D6: - cmp r7, 0 - ble _0807A6F4 - movs r3, 0xCE - lsls r3, 1 - movs r2, 0 - add r1, sp, 0x18 - adds r5, r7, 0 -_0807A6E4: - ldr r0, [r1] - cmp r0, r3 - bne _0807A6EC - str r2, [r1] -_0807A6EC: - adds r1, 0x4 - subs r5, 0x1 - cmp r5, 0 - bne _0807A6E4 -_0807A6F4: - movs r2, 0 - movs r5, 0 - cmp r2, r7 - bge _0807A70E - add r1, sp, 0x18 -_0807A6FE: - cmp r5, r9 - beq _0807A706 - ldr r0, [r1] - adds r2, r0 -_0807A706: - adds r1, 0x4 - adds r5, 0x1 - cmp r5, r7 - blt _0807A6FE -_0807A70E: - cmp r2, 0 - bne _0807A716 - movs r0, 0x1 - b _0807A718 -_0807A716: - movs r0, 0 -_0807A718: - add sp, 0x30 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_807A5F4 - thumb_func_start sub_807A728 sub_807A728: @ 807A728 push {r4-r7,lr} diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 926b7585b..17c7d5573 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -17,5 +17,6 @@ u8 UpdateMonIconFrame(struct Sprite *sprite); void LoadMonIconPalette(u16 species); void sub_80D328C(struct Sprite *sprite); void sub_80D3014(struct Sprite *sprite); +void sub_80D32C8(struct Sprite *sprite, u8 animNum); #endif // GUARD_POKEMON_ICON_H diff --git a/src/trade.c b/src/trade.c index c9a9db607..4327c9793 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1,6 +1,7 @@ #include "global.h" #include "alloc.h" #include "battle_anim.h" +#include "battle_interface.h" #include "bg.h" #include "cable_club.h" #include "data2.h" @@ -36,8 +37,7 @@ extern struct { u8 unk_0; u8 unk_1; u8 filler_2[0x28 - 2]; - u8 unk_28[PARTY_SIZE]; - u8 unk_2E[PARTY_SIZE]; + u8 unk_28[2][PARTY_SIZE]; u8 unk_34; u8 unk_35; u8 unk_36[2]; @@ -45,7 +45,8 @@ extern struct { u8 unk_44; u8 unk_45[12]; u8 unk_51[2][PARTY_SIZE]; - u8 filler_5D[0x69 - 0x5D]; + u8 unk_5D[PARTY_SIZE]; + u8 unk_63[PARTY_SIZE]; u8 unk_69; u8 filler_6A[0x6F - 0x6A]; u8 unk_6F; @@ -65,7 +66,12 @@ extern struct { u8 filler_84[0xA8 - 0x84]; u8 unk_A8; u8 unk_A9[11]; - u8 filler_B4[0x8F0-0xB4]; + u8 filler_B4[0x8D0-0xB4]; + struct { + bool8 unk_0; + u16 unk_2; + u8 unk_4; + } unk_8D0[4]; u16 tilemapBuffer[0x400]; // 8F0 } *gUnknown_0203229C; extern u8 *gUnknown_02032184; @@ -97,6 +103,10 @@ extern const u8 gText_NewLine3[]; extern const u8 gText_FourQuestionMarks[]; extern const u8 gUnknown_0832DE3E[][6][2]; extern const u8 gUnknown_0832DE56[][6][2]; +extern const u8 *gUnknown_0832DEBC[]; +extern const struct SpritePalette gSpritePalette_TradeScreenText; +extern const struct SpritePalette gUnknown_0832DC44; +extern const struct SpriteSheet gUnknown_0832DC3C; bool32 sub_8077260(void); void sub_80773D0(void); @@ -121,7 +131,7 @@ void sub_8079E44(u8); void sub_807967C(u8); void sub_807A048(u16, u8); void sub_8079F74(void); -u32 sub_807A5F4(struct Pokemon *, u8, u8); +u32 sub_807A5F4(struct Pokemon *, int, int); void sub_8079F88(u8); u32 sub_807A09C(void); u8 sub_8079A3C(u8 *, bool8, u8); @@ -392,7 +402,7 @@ void sub_80773D0(void) for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++) { struct Pokemon *mon = &gPlayerParty[i]; - gUnknown_0203229C->unk_28[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2), + gUnknown_0203229C->unk_28[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2), sub_80D3014, (gUnknown_0832DE24[i][0] * 8) + 14, (gUnknown_0832DE24[i][1] * 8) - 12, @@ -404,7 +414,7 @@ void sub_80773D0(void) for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++) { struct Pokemon *mon = &gEnemyParty[i]; - gUnknown_0203229C->unk_2E[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + gUnknown_0203229C->unk_28[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sub_80D3014, (gUnknown_0832DE24[i + PARTY_SIZE][0] * 8) + 14, (gUnknown_0832DE24[i + PARTY_SIZE][1] * 8) - 12, @@ -416,11 +426,11 @@ void sub_80773D0(void) break; case 8: sub_81B5D30(); - sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 0); + sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 0); gMain.state++; break; case 9: - sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 1); + sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 1); gMain.state++; break; case 10: @@ -578,7 +588,7 @@ void sub_8077B74(void) for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++) { struct Pokemon *mon = &gPlayerParty[i]; - gUnknown_0203229C->unk_28[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + gUnknown_0203229C->unk_28[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sub_80D3014, (gUnknown_0832DE24[i][0] * 8) + 14, (gUnknown_0832DE24[i][1] * 8) - 12, @@ -590,7 +600,7 @@ void sub_8077B74(void) for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++) { struct Pokemon *mon = &gEnemyParty[i]; - gUnknown_0203229C->unk_2E[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + gUnknown_0203229C->unk_28[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sub_80D3014, (gUnknown_0832DE24[i + PARTY_SIZE][0] * 8) + 14, (gUnknown_0832DE24[i + PARTY_SIZE][1] * 8) - 12, @@ -602,11 +612,11 @@ void sub_8077B74(void) break; case 8: sub_81B5D30(); - sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 0); + sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 0); gMain.state++; break; case 9: - sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 1); + sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 1); gMain.state++; break; case 10: @@ -832,7 +842,7 @@ void sub_8078388(void) { if (i < gUnknown_0203229C->unk_36[0]) { - gSprites[gUnknown_0203229C->unk_28[i]].invisible = FALSE; + gSprites[gUnknown_0203229C->unk_28[0][i]].invisible = FALSE; gUnknown_0203229C->unk_38[i] = TRUE; } else @@ -842,7 +852,7 @@ void sub_8078388(void) if (i < gUnknown_0203229C->unk_36[1]) { - gSprites[gUnknown_0203229C->unk_2E[i]].invisible = FALSE; + gSprites[gUnknown_0203229C->unk_28[1][i]].invisible = FALSE; gUnknown_0203229C->unk_38[i + PARTY_SIZE] = TRUE; } else @@ -1186,240 +1196,240 @@ NAKED void sub_80789FC(void) { asm_unified("push {r4-r6,lr}\n\ - sub sp, 0x4\n\ - ldr r6, =gUnknown_0203229C\n\ - ldr r2, [r6]\n\ - adds r1, r2, 0\n\ - adds r1, 0x78\n\ - ldrb r0, [r1]\n\ - cmp r0, 0\n\ - bne _08078A10\n\ - b _08078B44\n\ + sub sp, 0x4\n\ + ldr r6, =gUnknown_0203229C\n\ + ldr r2, [r6]\n\ + adds r1, r2, 0\n\ + adds r1, 0x78\n\ + ldrb r0, [r1]\n\ + cmp r0, 0\n\ + bne _08078A10\n\ + b _08078B44\n\ _08078A10:\n\ - adds r0, r2, 0\n\ - adds r0, 0x79\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - bne _08078A1C\n\ - b _08078B44\n\ + adds r0, r2, 0\n\ + adds r0, 0x79\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _08078A1C\n\ + b _08078B44\n\ _08078A1C:\n\ - ldrh r1, [r1]\n\ - ldr r0, =0x00000101\n\ - cmp r1, r0\n\ - bne _08078A64\n\ - adds r1, r2, 0\n\ - adds r1, 0x6F\n\ - movs r0, 0x6\n\ - strb r0, [r1]\n\ - ldr r2, [r6]\n\ - adds r1, r2, 0\n\ - adds r1, 0x80\n\ - movs r4, 0\n\ - ldr r0, =0x0000dddd\n\ - strh r0, [r1]\n\ - adds r0, r2, 0\n\ - adds r0, 0x35\n\ - ldrb r1, [r0]\n\ - adds r0, 0x4D\n\ - strh r1, [r0]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - ldr r0, [r6]\n\ - adds r2, r0, 0\n\ - adds r2, 0x79\n\ - strb r4, [r2]\n\ - adds r0, 0x78\n\ - strb r4, [r0]\n\ - b _08078B44\n\ - .pool\n\ + ldrh r1, [r1]\n\ + ldr r0, =0x00000101\n\ + cmp r1, r0\n\ + bne _08078A64\n\ + adds r1, r2, 0\n\ + adds r1, 0x6F\n\ + movs r0, 0x6\n\ + strb r0, [r1]\n\ + ldr r2, [r6]\n\ + adds r1, r2, 0\n\ + adds r1, 0x80\n\ + movs r4, 0\n\ + ldr r0, =0x0000dddd\n\ + strh r0, [r1]\n\ + adds r0, r2, 0\n\ + adds r0, 0x35\n\ + ldrb r1, [r0]\n\ + adds r0, 0x4D\n\ + strh r1, [r0]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + ldr r0, [r6]\n\ + adds r2, r0, 0\n\ + adds r2, 0x79\n\ + strb r4, [r2]\n\ + adds r0, 0x78\n\ + strb r4, [r0]\n\ + b _08078B44\n\ + .pool\n\ _08078A64:\n\ - ldr r0, =0x00000201\n\ - cmp r1, r0\n\ - bne _08078AB4\n\ - movs r0, 0x1\n\ - bl sub_807A19C\n\ - ldr r1, [r6]\n\ - adds r2, r1, 0\n\ - adds r2, 0x80\n\ - movs r4, 0\n\ - movs r3, 0\n\ - ldr r0, =0x0000eecc\n\ - strh r0, [r2]\n\ - adds r1, 0x82\n\ - strh r3, [r1]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - ldr r0, [r6]\n\ - adds r1, r0, 0\n\ - adds r1, 0x7B\n\ - strb r4, [r1]\n\ - adds r0, 0x7A\n\ - strb r4, [r0]\n\ - ldr r0, [r6]\n\ - adds r1, r0, 0\n\ - adds r1, 0x79\n\ - strb r4, [r1]\n\ - adds r0, 0x78\n\ - strb r4, [r0]\n\ - ldr r0, [r6]\n\ - adds r0, 0x6F\n\ - movs r1, 0x8\n\ - b _08078B42\n\ - .pool\n\ + ldr r0, =0x00000201\n\ + cmp r1, r0\n\ + bne _08078AB4\n\ + movs r0, 0x1\n\ + bl sub_807A19C\n\ + ldr r1, [r6]\n\ + adds r2, r1, 0\n\ + adds r2, 0x80\n\ + movs r4, 0\n\ + movs r3, 0\n\ + ldr r0, =0x0000eecc\n\ + strh r0, [r2]\n\ + adds r1, 0x82\n\ + strh r3, [r1]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + ldr r0, [r6]\n\ + adds r1, r0, 0\n\ + adds r1, 0x7B\n\ + strb r4, [r1]\n\ + adds r0, 0x7A\n\ + strb r4, [r0]\n\ + ldr r0, [r6]\n\ + adds r1, r0, 0\n\ + adds r1, 0x79\n\ + strb r4, [r1]\n\ + adds r0, 0x78\n\ + strb r4, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x6F\n\ + movs r1, 0x8\n\ + b _08078B42\n\ + .pool\n\ _08078AB4:\n\ - movs r0, 0x81\n\ - lsls r0, 1\n\ - cmp r1, r0\n\ - bne _08078B00\n\ - movs r0, 0x5\n\ - bl sub_807A19C\n\ - ldr r1, [r6]\n\ - adds r2, r1, 0\n\ - adds r2, 0x80\n\ - movs r4, 0\n\ - movs r3, 0\n\ - ldr r0, =0x0000ddee\n\ - strh r0, [r2]\n\ - adds r1, 0x82\n\ - strh r3, [r1]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - ldr r0, [r6]\n\ - adds r1, r0, 0\n\ - adds r1, 0x7B\n\ - strb r4, [r1]\n\ - adds r0, 0x7A\n\ - strb r4, [r0]\n\ - ldr r0, [r6]\n\ - adds r1, r0, 0\n\ - adds r1, 0x79\n\ - strb r4, [r1]\n\ - adds r0, 0x78\n\ - strb r4, [r0]\n\ - ldr r0, [r6]\n\ - adds r0, 0x6F\n\ - movs r1, 0x8\n\ - b _08078B42\n\ - .pool\n\ + movs r0, 0x81\n\ + lsls r0, 1\n\ + cmp r1, r0\n\ + bne _08078B00\n\ + movs r0, 0x5\n\ + bl sub_807A19C\n\ + ldr r1, [r6]\n\ + adds r2, r1, 0\n\ + adds r2, 0x80\n\ + movs r4, 0\n\ + movs r3, 0\n\ + ldr r0, =0x0000ddee\n\ + strh r0, [r2]\n\ + adds r1, 0x82\n\ + strh r3, [r1]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + ldr r0, [r6]\n\ + adds r1, r0, 0\n\ + adds r1, 0x7B\n\ + strb r4, [r1]\n\ + adds r0, 0x7A\n\ + strb r4, [r0]\n\ + ldr r0, [r6]\n\ + adds r1, r0, 0\n\ + adds r1, 0x79\n\ + strb r4, [r1]\n\ + adds r0, 0x78\n\ + strb r4, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x6F\n\ + movs r1, 0x8\n\ + b _08078B42\n\ + .pool\n\ _08078B00:\n\ - ldr r0, =0x00000202\n\ - cmp r1, r0\n\ - bne _08078B44\n\ - adds r1, r2, 0\n\ - adds r1, 0x80\n\ - movs r5, 0\n\ - movs r4, 0\n\ - ldr r0, =0x0000eebb\n\ - strh r0, [r1]\n\ - adds r0, r2, 0\n\ - adds r0, 0x82\n\ - strh r4, [r0]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - movs r0, 0x1\n\ - negs r0, r0\n\ - str r4, [sp]\n\ - movs r1, 0\n\ - movs r2, 0\n\ - movs r3, 0x10\n\ - bl BeginNormalPaletteFade\n\ - ldr r0, [r6]\n\ - adds r1, r0, 0\n\ - adds r1, 0x79\n\ - strb r5, [r1]\n\ - adds r0, 0x78\n\ - strb r5, [r0]\n\ - ldr r0, [r6]\n\ - adds r0, 0x6F\n\ - movs r1, 0xB\n\ + ldr r0, =0x00000202\n\ + cmp r1, r0\n\ + bne _08078B44\n\ + adds r1, r2, 0\n\ + adds r1, 0x80\n\ + movs r5, 0\n\ + movs r4, 0\n\ + ldr r0, =0x0000eebb\n\ + strh r0, [r1]\n\ + adds r0, r2, 0\n\ + adds r0, 0x82\n\ + strh r4, [r0]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + str r4, [sp]\n\ + movs r1, 0\n\ + movs r2, 0\n\ + movs r3, 0x10\n\ + bl BeginNormalPaletteFade\n\ + ldr r0, [r6]\n\ + adds r1, r0, 0\n\ + adds r1, 0x79\n\ + strb r5, [r1]\n\ + adds r0, 0x78\n\ + strb r5, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x6F\n\ + movs r1, 0xB\n\ _08078B42:\n\ - strb r1, [r0]\n\ + strb r1, [r0]\n\ _08078B44:\n\ - ldr r5, =gUnknown_0203229C\n\ - ldr r3, [r5]\n\ - adds r1, r3, 0\n\ - adds r1, 0x7A\n\ - ldrb r0, [r1]\n\ - cmp r0, 0\n\ - beq _08078BDC\n\ - adds r0, r3, 0\n\ - adds r0, 0x7B\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _08078BDC\n\ - ldrh r1, [r1]\n\ - ldr r0, =0x00000101\n\ - cmp r1, r0\n\ - bne _08078B92\n\ - adds r1, r3, 0\n\ - adds r1, 0x80\n\ - movs r4, 0\n\ - movs r2, 0\n\ - ldr r0, =0x0000ccdd\n\ - strh r0, [r1]\n\ - adds r0, r3, 0\n\ - adds r0, 0x82\n\ - strh r2, [r0]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - ldr r0, [r5]\n\ - adds r0, 0x7A\n\ - strb r4, [r0]\n\ - ldr r0, [r5]\n\ - adds r0, 0x7B\n\ - strb r4, [r0]\n\ - ldr r0, [r5]\n\ - adds r0, 0x6F\n\ - movs r1, 0x9\n\ - strb r1, [r0]\n\ + ldr r5, =gUnknown_0203229C\n\ + ldr r3, [r5]\n\ + adds r1, r3, 0\n\ + adds r1, 0x7A\n\ + ldrb r0, [r1]\n\ + cmp r0, 0\n\ + beq _08078BDC\n\ + adds r0, r3, 0\n\ + adds r0, 0x7B\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _08078BDC\n\ + ldrh r1, [r1]\n\ + ldr r0, =0x00000101\n\ + cmp r1, r0\n\ + bne _08078B92\n\ + adds r1, r3, 0\n\ + adds r1, 0x80\n\ + movs r4, 0\n\ + movs r2, 0\n\ + ldr r0, =0x0000ccdd\n\ + strh r0, [r1]\n\ + adds r0, r3, 0\n\ + adds r0, 0x82\n\ + strh r2, [r0]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + ldr r0, [r5]\n\ + adds r0, 0x7A\n\ + strb r4, [r0]\n\ + ldr r0, [r5]\n\ + adds r0, 0x7B\n\ + strb r4, [r0]\n\ + ldr r0, [r5]\n\ + adds r0, 0x6F\n\ + movs r1, 0x9\n\ + strb r1, [r0]\n\ _08078B92:\n\ - ldr r1, [r5]\n\ - adds r0, r1, 0\n\ - adds r0, 0x7A\n\ - ldrb r0, [r0]\n\ - cmp r0, 0x2\n\ - beq _08078BA8\n\ - adds r0, r1, 0\n\ - adds r0, 0x7B\n\ - ldrb r0, [r0]\n\ - cmp r0, 0x2\n\ - bne _08078BDC\n\ + ldr r1, [r5]\n\ + adds r0, r1, 0\n\ + adds r0, 0x7A\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x2\n\ + beq _08078BA8\n\ + adds r0, r1, 0\n\ + adds r0, 0x7B\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x2\n\ + bne _08078BDC\n\ _08078BA8:\n\ - movs r0, 0x1\n\ - bl sub_807A19C\n\ - ldr r1, [r5]\n\ - adds r2, r1, 0\n\ - adds r2, 0x80\n\ - movs r4, 0\n\ - movs r3, 0\n\ - ldr r0, =0x0000ddee\n\ - strh r0, [r2]\n\ - adds r1, 0x82\n\ - strh r3, [r1]\n\ - movs r0, 0x5\n\ - movs r1, 0\n\ - bl sub_807A048\n\ - ldr r0, [r5]\n\ - adds r0, 0x7A\n\ - strb r4, [r0]\n\ - ldr r0, [r5]\n\ - adds r0, 0x7B\n\ - strb r4, [r0]\n\ - ldr r0, [r5]\n\ - adds r0, 0x6F\n\ - movs r1, 0x8\n\ - strb r1, [r0]\n\ + movs r0, 0x1\n\ + bl sub_807A19C\n\ + ldr r1, [r5]\n\ + adds r2, r1, 0\n\ + adds r2, 0x80\n\ + movs r4, 0\n\ + movs r3, 0\n\ + ldr r0, =0x0000ddee\n\ + strh r0, [r2]\n\ + adds r1, 0x82\n\ + strh r3, [r1]\n\ + movs r0, 0x5\n\ + movs r1, 0\n\ + bl sub_807A048\n\ + ldr r0, [r5]\n\ + adds r0, 0x7A\n\ + strb r4, [r0]\n\ + ldr r0, [r5]\n\ + adds r0, 0x7B\n\ + strb r4, [r0]\n\ + ldr r0, [r5]\n\ + adds r0, 0x6F\n\ + movs r1, 0x8\n\ + strb r1, [r0]\n\ _08078BDC:\n\ - add sp, 0x4\n\ - pop {r4-r6}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n"); + add sp, 0x4\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); } #endif // NONMATCHING @@ -1966,7 +1976,7 @@ void sub_80796B4(u8 a0) case 1: for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++) { - gSprites[gUnknown_0203229C->unk_28[i + (sp60 * 6)]].invisible = TRUE; + gSprites[gUnknown_0203229C->unk_28[0][i + (sp60 * 6)]].invisible = TRUE; } for (i = 0; i < 6; i++) @@ -1974,13 +1984,13 @@ void sub_80796B4(u8 a0) ClearWindowTilemap(i + (a0 * 6 + 2)); } - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].invisible = FALSE; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[0] = 20; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[2] = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[4] = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12; - StoreSpriteCallbackInData6(&gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]], sub_80D3014); + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].invisible = FALSE; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[0] = 20; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[2] = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[4] = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12; + StoreSpriteCallbackInData6(&gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]], sub_80D3014); gUnknown_0203229C->unk_74[a0]++; - sub_80A6DEC(&gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]]); + sub_80A6DEC(&gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]]); CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(0); @@ -1991,7 +2001,7 @@ void sub_80796B4(u8 a0) } break; case 2: - if (gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].callback == sub_80D3014) + if (gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].callback == sub_80D3014) { gUnknown_0203229C->unk_74[a0] = 3; } @@ -1999,10 +2009,10 @@ void sub_80796B4(u8 a0) case 3: CopyToBgTilemapBufferRect_ChangePalette(1, gTradeMovesBoxTilemap, sp60 * 15, 0, 15, 17, 0); CopyBgTilemapBufferToVram(1); - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos1.x = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos1.y = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos2.x = 0; - gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos2.y = 0; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos1.x = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos1.y = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos2.x = 0; + gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos2.y = 0; test = sub_8079A3C(sp14, sp60, r10); AddTextPrinterParameterized3((a0 * 2) + 14, 0, (80 - test) / 2, 4, gUnknown_0832DEE0, 0, sp14); sub_8079AA4(sp28, sp60, r10); @@ -2024,427 +2034,427 @@ NAKED void sub_80796B4(u8 a0) { asm_unified("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x68\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - ldr r0, =gUnknown_0203229C\n\ - ldr r4, [r0]\n\ - adds r0, r4, 0\n\ - adds r0, 0x76\n\ - adds r0, r7\n\ - ldrb r0, [r0]\n\ - movs r1, 0x1\n\ - str r1, [sp, 0x60]\n\ - cmp r0, 0x5\n\ - bhi _080796DC\n\ - movs r2, 0\n\ - str r2, [sp, 0x60]\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x68\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r4, [r0]\n\ + adds r0, r4, 0\n\ + adds r0, 0x76\n\ + adds r0, r7\n\ + ldrb r0, [r0]\n\ + movs r1, 0x1\n\ + str r1, [sp, 0x60]\n\ + cmp r0, 0x5\n\ + bhi _080796DC\n\ + movs r2, 0\n\ + str r2, [sp, 0x60]\n\ _080796DC:\n\ - movs r1, 0x6\n\ - bl __umodsi3\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - mov r10, r0\n\ - movs r0, 0\n\ - mov r8, r0\n\ - adds r0, r4, 0\n\ - adds r0, 0x74\n\ - adds r3, r0, r7\n\ - ldrb r0, [r3]\n\ - cmp r0, 0x2\n\ - bne _080796FA\n\ - b _08079884\n\ + movs r1, 0x6\n\ + bl __umodsi3\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r10, r0\n\ + movs r0, 0\n\ + mov r8, r0\n\ + adds r0, r4, 0\n\ + adds r0, 0x74\n\ + adds r3, r0, r7\n\ + ldrb r0, [r3]\n\ + cmp r0, 0x2\n\ + bne _080796FA\n\ + b _08079884\n\ _080796FA:\n\ - cmp r0, 0x2\n\ - bgt _08079708\n\ - cmp r0, 0x1\n\ - beq _08079716\n\ - b _08079A24\n\ - .pool\n\ + cmp r0, 0x2\n\ + bgt _08079708\n\ + cmp r0, 0x1\n\ + beq _08079716\n\ + b _08079A24\n\ + .pool\n\ _08079708:\n\ - cmp r0, 0x3\n\ - bne _0807970E\n\ - b _080798BC\n\ + cmp r0, 0x3\n\ + bne _0807970E\n\ + b _080798BC\n\ _0807970E:\n\ - cmp r0, 0x4\n\ - bne _08079714\n\ - b _080799EC\n\ + cmp r0, 0x4\n\ + bne _08079714\n\ + b _080799EC\n\ _08079714:\n\ - b _08079A24\n\ + b _08079A24\n\ _08079716:\n\ - movs r5, 0\n\ - adds r0, r4, 0\n\ - adds r0, 0x36\n\ - adds r0, r7\n\ - ldr r1, [sp, 0x60]\n\ - lsls r1, 1\n\ - mov r9, r1\n\ - lsls r6, r7, 1\n\ - lsls r2, r7, 4\n\ - str r2, [sp, 0x64]\n\ - ldrb r0, [r0]\n\ - cmp r8, r0\n\ - bcs _0807976A\n\ - ldr r0, =gSprites\n\ - mov r8, r0\n\ - ldr r4, =gUnknown_0203229C\n\ - ldr r0, [sp, 0x60]\n\ - add r0, r9\n\ - lsls r2, r0, 1\n\ - movs r3, 0x4\n\ + movs r5, 0\n\ + adds r0, r4, 0\n\ + adds r0, 0x36\n\ + adds r0, r7\n\ + ldr r1, [sp, 0x60]\n\ + lsls r1, 1\n\ + mov r9, r1\n\ + lsls r6, r7, 1\n\ + lsls r2, r7, 4\n\ + str r2, [sp, 0x64]\n\ + ldrb r0, [r0]\n\ + cmp r8, r0\n\ + bcs _0807976A\n\ + ldr r0, =gSprites\n\ + mov r8, r0\n\ + ldr r4, =gUnknown_0203229C\n\ + ldr r0, [sp, 0x60]\n\ + add r0, r9\n\ + lsls r2, r0, 1\n\ + movs r3, 0x4\n\ _0807973E:\n\ - ldr r0, [r4]\n\ - adds r1, r5, r2\n\ - adds r0, 0x28\n\ - adds r0, r1\n\ - ldrb r1, [r0]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - add r0, r8\n\ - adds r0, 0x3E\n\ - ldrb r1, [r0]\n\ - orrs r1, r3\n\ - strb r1, [r0]\n\ - adds r0, r5, 0x1\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - ldr r0, [r4]\n\ - adds r0, 0x36\n\ - adds r0, r7\n\ - ldrb r0, [r0]\n\ - cmp r5, r0\n\ - bcc _0807973E\n\ + ldr r0, [r4]\n\ + adds r1, r5, r2\n\ + adds r0, 0x28\n\ + adds r0, r1\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r8\n\ + adds r0, 0x3E\n\ + ldrb r1, [r0]\n\ + orrs r1, r3\n\ + strb r1, [r0]\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + ldr r0, [r4]\n\ + adds r0, 0x36\n\ + adds r0, r7\n\ + ldrb r0, [r0]\n\ + cmp r5, r0\n\ + bcc _0807973E\n\ _0807976A:\n\ - movs r5, 0\n\ - adds r0, r6, r7\n\ - lsls r0, 1\n\ - adds r4, r0, 0x2\n\ + movs r5, 0\n\ + adds r0, r6, r7\n\ + lsls r0, 1\n\ + adds r4, r0, 0x2\n\ _08079772:\n\ - lsls r0, r5, 24\n\ - asrs r0, 24\n\ - adds r0, r4\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - bl ClearWindowTilemap\n\ - adds r0, r5, 0x1\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - cmp r5, 0x5\n\ - bls _08079772\n\ - ldr r1, =gSprites\n\ - mov r8, r1\n\ - ldr r2, =gUnknown_0203229C\n\ - ldr r0, [r2]\n\ - ldr r6, [sp, 0x60]\n\ - add r6, r9\n\ - lsls r3, r6, 1\n\ - add r10, r3\n\ - adds r0, 0x28\n\ - add r0, r10\n\ - ldrb r1, [r0]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - add r0, r8\n\ - adds r0, 0x3E\n\ - ldrb r2, [r0]\n\ - movs r1, 0x5\n\ - negs r1, r1\n\ - ands r1, r2\n\ - strb r1, [r0]\n\ - ldr r0, =gUnknown_0203229C\n\ - ldr r4, [r0]\n\ - adds r4, 0x28\n\ - add r4, r10\n\ - ldrb r1, [r4]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - add r0, r8\n\ - movs r1, 0x14\n\ - strh r1, [r0, 0x2E]\n\ - ldrb r0, [r4]\n\ - lsls r2, r0, 4\n\ - adds r2, r0\n\ - lsls r2, 2\n\ - add r2, r8\n\ - ldr r5, =gUnknown_0832DE24\n\ - lsls r6, 2\n\ - adds r0, r6, r5\n\ - ldrb r0, [r0]\n\ - adds r3, 0x1\n\ - lsls r3, 1\n\ - adds r3, r5\n\ - ldrb r1, [r3]\n\ - adds r0, r1\n\ - asrs r0, 1\n\ - lsls r0, 3\n\ - adds r0, 0xE\n\ - strh r0, [r2, 0x32]\n\ - ldrb r0, [r4]\n\ - lsls r1, r0, 4\n\ - adds r1, r0\n\ - lsls r1, 2\n\ - add r1, r8\n\ - adds r5, 0x1\n\ - adds r6, r5\n\ - ldrb r0, [r6]\n\ - lsls r0, 3\n\ - subs r0, 0xC\n\ - strh r0, [r1, 0x36]\n\ - ldrb r1, [r4]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - add r0, r8\n\ - ldr r1, =sub_80D3014\n\ - bl StoreSpriteCallbackInData6\n\ - ldr r2, =gUnknown_0203229C\n\ - ldr r1, [r2]\n\ - adds r1, 0x74\n\ - adds r1, r7\n\ - ldrb r0, [r1]\n\ - adds r0, 0x1\n\ - strb r0, [r1]\n\ - ldr r0, [r2]\n\ - adds r0, 0x28\n\ - add r0, r10\n\ - ldrb r1, [r0]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - add r0, r8\n\ - bl sub_80A6DEC\n\ - ldr r1, =gTradePartyBoxTilemap\n\ - ldr r0, [sp, 0x64]\n\ - subs r2, r0, r7\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - movs r0, 0xF\n\ - str r0, [sp]\n\ - movs r0, 0x11\n\ - str r0, [sp, 0x4]\n\ - movs r0, 0\n\ - str r0, [sp, 0x8]\n\ - movs r0, 0x1\n\ - movs r3, 0\n\ - bl CopyToBgTilemapBufferRect_ChangePalette\n\ - movs r0, 0x1\n\ - bl CopyBgTilemapBufferToVram\n\ - movs r0, 0\n\ - bl CopyBgTilemapBufferToVram\n\ - ldr r1, [sp, 0x60]\n\ - cmp r1, 0\n\ - beq _08079868\n\ - b _08079A24\n\ + lsls r0, r5, 24\n\ + asrs r0, 24\n\ + adds r0, r4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + bl ClearWindowTilemap\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x5\n\ + bls _08079772\n\ + ldr r1, =gSprites\n\ + mov r8, r1\n\ + ldr r2, =gUnknown_0203229C\n\ + ldr r0, [r2]\n\ + ldr r6, [sp, 0x60]\n\ + add r6, r9\n\ + lsls r3, r6, 1\n\ + add r10, r3\n\ + adds r0, 0x28\n\ + add r0, r10\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r8\n\ + adds r0, 0x3E\n\ + ldrb r2, [r0]\n\ + movs r1, 0x5\n\ + negs r1, r1\n\ + ands r1, r2\n\ + strb r1, [r0]\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r4, [r0]\n\ + adds r4, 0x28\n\ + add r4, r10\n\ + ldrb r1, [r4]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r8\n\ + movs r1, 0x14\n\ + strh r1, [r0, 0x2E]\n\ + ldrb r0, [r4]\n\ + lsls r2, r0, 4\n\ + adds r2, r0\n\ + lsls r2, 2\n\ + add r2, r8\n\ + ldr r5, =gUnknown_0832DE24\n\ + lsls r6, 2\n\ + adds r0, r6, r5\n\ + ldrb r0, [r0]\n\ + adds r3, 0x1\n\ + lsls r3, 1\n\ + adds r3, r5\n\ + ldrb r1, [r3]\n\ + adds r0, r1\n\ + asrs r0, 1\n\ + lsls r0, 3\n\ + adds r0, 0xE\n\ + strh r0, [r2, 0x32]\n\ + ldrb r0, [r4]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + add r1, r8\n\ + adds r5, 0x1\n\ + adds r6, r5\n\ + ldrb r0, [r6]\n\ + lsls r0, 3\n\ + subs r0, 0xC\n\ + strh r0, [r1, 0x36]\n\ + ldrb r1, [r4]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r8\n\ + ldr r1, =sub_80D3014\n\ + bl StoreSpriteCallbackInData6\n\ + ldr r2, =gUnknown_0203229C\n\ + ldr r1, [r2]\n\ + adds r1, 0x74\n\ + adds r1, r7\n\ + ldrb r0, [r1]\n\ + adds r0, 0x1\n\ + strb r0, [r1]\n\ + ldr r0, [r2]\n\ + adds r0, 0x28\n\ + add r0, r10\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r8\n\ + bl sub_80A6DEC\n\ + ldr r1, =gTradePartyBoxTilemap\n\ + ldr r0, [sp, 0x64]\n\ + subs r2, r0, r7\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + movs r0, 0xF\n\ + str r0, [sp]\n\ + movs r0, 0x11\n\ + str r0, [sp, 0x4]\n\ + movs r0, 0\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0x1\n\ + movs r3, 0\n\ + bl CopyToBgTilemapBufferRect_ChangePalette\n\ + movs r0, 0x1\n\ + bl CopyBgTilemapBufferToVram\n\ + movs r0, 0\n\ + bl CopyBgTilemapBufferToVram\n\ + ldr r1, [sp, 0x60]\n\ + cmp r1, 0\n\ + beq _08079868\n\ + b _08079A24\n\ _08079868:\n\ - bl sub_8079F74\n\ - b _08079A24\n\ - .pool\n\ + bl sub_8079F74\n\ + b _08079A24\n\ + .pool\n\ _08079884:\n\ - ldr r2, =gSprites\n\ - ldr r1, [sp, 0x60]\n\ - lsls r0, r1, 1\n\ - adds r0, r1\n\ - lsls r0, 1\n\ - add r0, r10\n\ - adds r1, r4, 0\n\ - adds r1, 0x28\n\ - adds r1, r0\n\ - ldrb r1, [r1]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r2, 0x1C\n\ - adds r0, r2\n\ - ldr r1, [r0]\n\ - ldr r0, =sub_80D3014\n\ - cmp r1, r0\n\ - beq _080798AC\n\ - b _08079A24\n\ + ldr r2, =gSprites\n\ + ldr r1, [sp, 0x60]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + add r0, r10\n\ + adds r1, r4, 0\n\ + adds r1, 0x28\n\ + adds r1, r0\n\ + ldrb r1, [r1]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r2, 0x1C\n\ + adds r0, r2\n\ + ldr r1, [r0]\n\ + ldr r0, =sub_80D3014\n\ + cmp r1, r0\n\ + beq _080798AC\n\ + b _08079A24\n\ _080798AC:\n\ - movs r0, 0x3\n\ - strb r0, [r3]\n\ - b _08079A24\n\ - .pool\n\ + movs r0, 0x3\n\ + strb r0, [r3]\n\ + b _08079A24\n\ + .pool\n\ _080798BC:\n\ - ldr r1, =gTradeMovesBoxTilemap\n\ - ldr r0, [sp, 0x60]\n\ - lsls r2, r0, 4\n\ - subs r2, r0\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - movs r0, 0xF\n\ - str r0, [sp]\n\ - movs r0, 0x11\n\ - str r0, [sp, 0x4]\n\ - mov r0, r8\n\ - str r0, [sp, 0x8]\n\ - movs r0, 0x1\n\ - movs r3, 0\n\ - bl CopyToBgTilemapBufferRect_ChangePalette\n\ - movs r0, 0x1\n\ - bl CopyBgTilemapBufferToVram\n\ - ldr r6, =gSprites\n\ - ldr r1, =gUnknown_0203229C\n\ - ldr r4, [r1]\n\ - ldr r2, [sp, 0x60]\n\ - lsls r3, r2, 1\n\ - adds r3, r2\n\ - lsls r1, r3, 1\n\ - mov r2, r10\n\ - adds r0, r2, r1\n\ - adds r4, 0x28\n\ - adds r4, r0\n\ - ldrb r0, [r4]\n\ - lsls r2, r0, 4\n\ - adds r2, r0\n\ - lsls r2, 2\n\ - adds r2, r6\n\ - ldr r5, =gUnknown_0832DE24\n\ - lsls r3, 2\n\ - adds r0, r3, r5\n\ - ldrb r0, [r0]\n\ - adds r1, 0x1\n\ - lsls r1, 1\n\ - adds r1, r5\n\ - ldrb r1, [r1]\n\ - adds r0, r1\n\ - asrs r0, 1\n\ - lsls r0, 3\n\ - adds r0, 0xE\n\ - strh r0, [r2, 0x20]\n\ - ldrb r0, [r4]\n\ - lsls r1, r0, 4\n\ - adds r1, r0\n\ - lsls r1, 2\n\ - adds r1, r6\n\ - adds r5, 0x1\n\ - adds r3, r5\n\ - ldrb r0, [r3]\n\ - lsls r0, 3\n\ - subs r0, 0xC\n\ - strh r0, [r1, 0x22]\n\ - ldrb r1, [r4]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r6\n\ - mov r1, r8\n\ - strh r1, [r0, 0x24]\n\ - ldrb r1, [r4]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r6\n\ - mov r2, r8\n\ - strh r2, [r0, 0x26]\n\ - add r0, sp, 0x14\n\ - ldr r1, [sp, 0x60]\n\ - mov r2, r10\n\ - bl sub_8079A3C\n\ - lsls r4, r7, 1\n\ - adds r5, r4, 0\n\ - adds r5, 0xE\n\ - lsls r5, 24\n\ - lsrs r5, 24\n\ - lsls r0, 24\n\ - asrs r0, 24\n\ - movs r2, 0x50\n\ - subs r2, r0\n\ - lsrs r0, r2, 31\n\ - adds r2, r0\n\ - asrs r2, 1\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - ldr r0, =gUnknown_0832DEE0\n\ - mov r8, r0\n\ - str r0, [sp]\n\ - movs r1, 0\n\ - str r1, [sp, 0x4]\n\ - add r0, sp, 0x14\n\ - str r0, [sp, 0x8]\n\ - adds r0, r5, 0\n\ - movs r3, 0x4\n\ - bl AddTextPrinterParameterized3\n\ - add r6, sp, 0x28\n\ - adds r0, r6, 0\n\ - ldr r1, [sp, 0x60]\n\ - mov r2, r10\n\ - bl sub_8079AA4\n\ - adds r4, 0xF\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - movs r1, 0\n\ - str r1, [sp]\n\ - str r1, [sp, 0x4]\n\ - mov r2, r8\n\ - str r2, [sp, 0x8]\n\ - str r1, [sp, 0xC]\n\ - str r6, [sp, 0x10]\n\ - adds r0, r4, 0\n\ - movs r1, 0x1\n\ - movs r2, 0\n\ - movs r3, 0\n\ - bl AddTextPrinterParameterized4\n\ - adds r0, r5, 0\n\ - bl PutWindowTilemap\n\ - adds r0, r5, 0\n\ - movs r1, 0x3\n\ - bl CopyWindowToVram\n\ - adds r0, r4, 0\n\ - bl PutWindowTilemap\n\ - adds r0, r4, 0\n\ - movs r1, 0x3\n\ - bl CopyWindowToVram\n\ - ldr r0, =gUnknown_0203229C\n\ - ldr r1, [r0]\n\ - b _08079A1A\n\ - .pool\n\ + ldr r1, =gTradeMovesBoxTilemap\n\ + ldr r0, [sp, 0x60]\n\ + lsls r2, r0, 4\n\ + subs r2, r0\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + movs r0, 0xF\n\ + str r0, [sp]\n\ + movs r0, 0x11\n\ + str r0, [sp, 0x4]\n\ + mov r0, r8\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0x1\n\ + movs r3, 0\n\ + bl CopyToBgTilemapBufferRect_ChangePalette\n\ + movs r0, 0x1\n\ + bl CopyBgTilemapBufferToVram\n\ + ldr r6, =gSprites\n\ + ldr r1, =gUnknown_0203229C\n\ + ldr r4, [r1]\n\ + ldr r2, [sp, 0x60]\n\ + lsls r3, r2, 1\n\ + adds r3, r2\n\ + lsls r1, r3, 1\n\ + mov r2, r10\n\ + adds r0, r2, r1\n\ + adds r4, 0x28\n\ + adds r4, r0\n\ + ldrb r0, [r4]\n\ + lsls r2, r0, 4\n\ + adds r2, r0\n\ + lsls r2, 2\n\ + adds r2, r6\n\ + ldr r5, =gUnknown_0832DE24\n\ + lsls r3, 2\n\ + adds r0, r3, r5\n\ + ldrb r0, [r0]\n\ + adds r1, 0x1\n\ + lsls r1, 1\n\ + adds r1, r5\n\ + ldrb r1, [r1]\n\ + adds r0, r1\n\ + asrs r0, 1\n\ + lsls r0, 3\n\ + adds r0, 0xE\n\ + strh r0, [r2, 0x20]\n\ + ldrb r0, [r4]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + adds r1, r6\n\ + adds r5, 0x1\n\ + adds r3, r5\n\ + ldrb r0, [r3]\n\ + lsls r0, 3\n\ + subs r0, 0xC\n\ + strh r0, [r1, 0x22]\n\ + ldrb r1, [r4]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r6\n\ + mov r1, r8\n\ + strh r1, [r0, 0x24]\n\ + ldrb r1, [r4]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r6\n\ + mov r2, r8\n\ + strh r2, [r0, 0x26]\n\ + add r0, sp, 0x14\n\ + ldr r1, [sp, 0x60]\n\ + mov r2, r10\n\ + bl sub_8079A3C\n\ + lsls r4, r7, 1\n\ + adds r5, r4, 0\n\ + adds r5, 0xE\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + movs r2, 0x50\n\ + subs r2, r0\n\ + lsrs r0, r2, 31\n\ + adds r2, r0\n\ + asrs r2, 1\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + ldr r0, =gUnknown_0832DEE0\n\ + mov r8, r0\n\ + str r0, [sp]\n\ + movs r1, 0\n\ + str r1, [sp, 0x4]\n\ + add r0, sp, 0x14\n\ + str r0, [sp, 0x8]\n\ + adds r0, r5, 0\n\ + movs r3, 0x4\n\ + bl AddTextPrinterParameterized3\n\ + add r6, sp, 0x28\n\ + adds r0, r6, 0\n\ + ldr r1, [sp, 0x60]\n\ + mov r2, r10\n\ + bl sub_8079AA4\n\ + adds r4, 0xF\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + movs r1, 0\n\ + str r1, [sp]\n\ + str r1, [sp, 0x4]\n\ + mov r2, r8\n\ + str r2, [sp, 0x8]\n\ + str r1, [sp, 0xC]\n\ + str r6, [sp, 0x10]\n\ + adds r0, r4, 0\n\ + movs r1, 0x1\n\ + movs r2, 0\n\ + movs r3, 0\n\ + bl AddTextPrinterParameterized4\n\ + adds r0, r5, 0\n\ + bl PutWindowTilemap\n\ + adds r0, r5, 0\n\ + movs r1, 0x3\n\ + bl CopyWindowToVram\n\ + adds r0, r4, 0\n\ + bl PutWindowTilemap\n\ + adds r0, r4, 0\n\ + movs r1, 0x3\n\ + bl CopyWindowToVram\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r1, [r0]\n\ + b _08079A1A\n\ + .pool\n\ _080799EC:\n\ - ldr r0, =gUnknown_0832DF99\n\ - lsls r1, r7, 1\n\ - adds r4, r1, r0\n\ - ldrb r2, [r4]\n\ - adds r2, 0x4\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - adds r0, 0x1\n\ - adds r1, r0\n\ - ldrb r3, [r1]\n\ - adds r3, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - ldrb r0, [r4]\n\ - str r0, [sp]\n\ - ldrb r0, [r1]\n\ - str r0, [sp, 0x4]\n\ - adds r0, r7, 0\n\ - mov r1, r10\n\ - bl sub_8079C4C\n\ - ldr r2, =gUnknown_0203229C\n\ - ldr r1, [r2]\n\ + ldr r0, =gUnknown_0832DF99\n\ + lsls r1, r7, 1\n\ + adds r4, r1, r0\n\ + ldrb r2, [r4]\n\ + adds r2, 0x4\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r0, 0x1\n\ + adds r1, r0\n\ + ldrb r3, [r1]\n\ + adds r3, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + ldrb r0, [r4]\n\ + str r0, [sp]\n\ + ldrb r0, [r1]\n\ + str r0, [sp, 0x4]\n\ + adds r0, r7, 0\n\ + mov r1, r10\n\ + bl sub_8079C4C\n\ + ldr r2, =gUnknown_0203229C\n\ + ldr r1, [r2]\n\ _08079A1A:\n\ - adds r1, 0x74\n\ - adds r1, r7\n\ - ldrb r0, [r1]\n\ - adds r0, 0x1\n\ - strb r0, [r1]\n\ + adds r1, 0x74\n\ + adds r1, r7\n\ + ldrb r0, [r1]\n\ + adds r0, 0x1\n\ + strb r0, [r1]\n\ _08079A24:\n\ - add sp, 0x68\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + add sp, 0x68\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } #endif // NONMATCHING @@ -2594,6 +2604,8 @@ void sub_8079C4C(u8 a0, u8 a1, u8 a2, u8 a3, u8 a4, u8 a5) gUnknown_0203229C->tilemapBuffer[(a3 - 1) * 32 + a2 + 1] = r2; } +// Very close but loop preamble not working. +#ifdef NONMATCHING void sub_8079E44(u8 a0) { int i; @@ -2603,3 +2615,583 @@ void sub_8079E44(u8 a0) sub_8079C4C(a0, i, gUnknown_0832DE3E[a0][i][0], gUnknown_0832DE3E[a0][i][1], gUnknown_0832DE56[a0][i][0], gUnknown_0832DE56[a0][i][1]); } } +#else +NAKED +void sub_8079E44(u8 a0) +{ + asm_unified("push {r4-r7,lr}\n\ + sub sp, 0x8\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + movs r7, 0\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + adds r0, r6\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + bge _08079E94\n\ + lsls r0, r6, 1\n\ + adds r0, r6\n\ + ldr r1, =gUnknown_0832DE3E\n\ + lsls r0, 2\n\ + adds r5, r0, r1\n\ + ldr r1, =gUnknown_0832DE56\n\ + adds r4, r0, r1\n\ +_08079E6A:\n\ + lsls r1, r7, 24\n\ + lsrs r1, 24\n\ + ldrb r2, [r5]\n\ + ldrb r3, [r5, 0x1]\n\ + ldrb r0, [r4]\n\ + str r0, [sp]\n\ + ldrb r0, [r4, 0x1]\n\ + str r0, [sp, 0x4]\n\ + adds r0, r6, 0\n\ + bl sub_8079C4C\n\ + adds r5, 0x2\n\ + adds r4, 0x2\n\ + adds r7, 0x1\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + adds r0, r6\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + blt _08079E6A\n\ +_08079E94:\n\ + add sp, 0x8\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +void sub_8079EA8(u8 a0) +{ + int i; + + for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++) + { + gSprites[gUnknown_0203229C->unk_28[a0][i]].invisible = FALSE; + gSprites[gUnknown_0203229C->unk_28[a0][i]].pos1.x = gUnknown_0832DE24[(a0 * 6) + i][0] * 8 + 14; + gSprites[gUnknown_0203229C->unk_28[a0][i]].pos1.y = gUnknown_0832DE24[(a0 * 6) + i][1] * 8 - 12; + gSprites[gUnknown_0203229C->unk_28[a0][i]].pos2.x = 0; + gSprites[gUnknown_0203229C->unk_28[a0][i]].pos2.y = 0; + } +} + +void sub_8079F74(void) +{ + rbox_fill_rectangle(1); + sub_8079BE0(1); +} + +void sub_8079F88(u8 a0) +{ + CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0); + CopyBgTilemapBufferToVram(1); + sub_8079E44(a0); + sub_8079BE0(a0); + sub_8079EA8(a0); + sub_807A308(gUnknown_0832DE94[1], (void *)(OBJ_VRAM0 + (gUnknown_0203229C->unk_72 * 32)), 24); + gUnknown_0203229C->unk_74[a0] = 0; +} + +void sub_807A000(void) +{ + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); +} + +void sub_807A024(void) +{ + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); +} + +void sub_807A048(u16 a0, u8 a1) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (!gUnknown_0203229C->unk_8D0[i].unk_0) + { + gUnknown_0203229C->unk_8D0[i].unk_2 = a0; + gUnknown_0203229C->unk_8D0[i].unk_4 = a1; + gUnknown_0203229C->unk_8D0[i].unk_0 = TRUE; + break; + } + } +} + +u32 sub_807A09C(void) +{ + u32 acc = 0; + int i; + + for (i = 0; i < 4; i++) + { + acc += gUnknown_0203229C->unk_8D0[i].unk_0; + } + + return acc; +} + +void sub_807A0C4(void) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (gUnknown_0203229C->unk_8D0[i].unk_0) + { + if (gUnknown_0203229C->unk_8D0[i].unk_2) + { + gUnknown_0203229C->unk_8D0[i].unk_2--; + } + else + { + switch (gUnknown_0203229C->unk_8D0[i].unk_4) + { + case 0: + sub_8077170(gUnknown_0203229C->unk_80, 20); + break; + case 1: + sub_807A19C(0); + break; + case 2: + sub_807A19C(2); + break; + case 3: + case 4: + case 5: + sub_807A19C(3); + break; + case 6: + sub_807A19C(6); + break; + case 7: + sub_807A19C(7); + break; + case 8: + sub_807A19C(8); + break; + } + gUnknown_0203229C->unk_8D0[i].unk_0 = 0; + } + } + } +} + +void sub_807A19C(u8 a0) +{ + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParameterized(0, 1, gUnknown_0832DEBC[a0], 0, 1, TEXT_SPEED_FF, NULL); + sub_8098858(0, 20, 12); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); +} + +bool8 sub_807A1F0(void) +{ + struct SpriteSheet sheet; + + if (gUnknown_0203229C->unk_A8 < 14) + { + sheet.data = gUnknown_02032188[gUnknown_0203229C->unk_A8]; + sheet.size = 0x100; + sheet.tag = 200 + gUnknown_0203229C->unk_A8; + } + + switch (gUnknown_0203229C->unk_A8) + { + case 0 ... 7: + LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 8: + gUnknown_0203229C->unk_72 = LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 9 ... 13: + LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 14: + LoadSpritePalette(&gSpritePalette_TradeScreenText); + gUnknown_0203229C->unk_A8++; + break; + case 15: + LoadSpritePalette(&gUnknown_0832DC44); + gUnknown_0203229C->unk_A8++; + break; + case 16: + LoadSpriteSheet(&gUnknown_0832DC3C); + gUnknown_0203229C->unk_A8++; + break; + case 17: + gUnknown_0203229C->unk_A8 = 0; + return TRUE; + } + + return FALSE; +} + +void sub_807A308(const u8 *a0, u8 *a1, u8 unused) +{ + sub_80C6D80(a0, a1, 0, 0, 6); +} + +#ifdef NONMATCHING +void sub_807A320(u8 a0) +{ + int i; + + switch (a0) + { + case 0: + for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) == TRUE) + { + gUnknown_0203229C->unk_45[i] = 0; + gUnknown_0203229C->unk_51[0][i] = 1; + } + else if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0) + { + gUnknown_0203229C->unk_45[i] = 0; + gUnknown_0203229C->unk_51[0][i] = 0; + } + else + { + gUnknown_0203229C->unk_45[i] = 1; + gUnknown_0203229C->unk_51[0][i] = 0; + } + } + break; + case 1: + for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++) + { + if (GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) == TRUE) + { + gUnknown_0203229C->unk_45[i + 6] = 0; + gUnknown_0203229C->unk_51[1][i] = 1; + } + else if (GetMonData(&gEnemyParty[i], MON_DATA_HP) == 0) + { + gUnknown_0203229C->unk_45[i + 6] = 0; + gUnknown_0203229C->unk_51[1][i] = 0; + } + else + { + gUnknown_0203229C->unk_45[i + 6] = 1; + gUnknown_0203229C->unk_51[1][i] = 0; + } + } + break; + } +} +#else +NAKED +void sub_807A320(u8 a0) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + cmp r0, 0\n\ + beq _0807A338\n\ + cmp r0, 0x1\n\ + beq _0807A3CC\n\ + b _0807A458\n\ +_0807A338:\n\ + movs r7, 0\n\ + ldr r1, =gUnknown_0203229C\n\ + ldr r0, [r1]\n\ + adds r0, 0x36\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + blt _0807A348\n\ + b _0807A458\n\ +_0807A348:\n\ + adds r6, r1, 0\n\ + movs r5, 0\n\ + mov r9, r5\n\ +_0807A34E:\n\ + movs r0, 0x64\n\ + adds r1, r7, 0\n\ + muls r1, r0\n\ + ldr r0, =gPlayerParty\n\ + adds r4, r1, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0x2D\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + cmp r1, 0x1\n\ + bne _0807A380\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + mov r2, r9\n\ + strb r2, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + b _0807A3B0\n\ + .pool\n\ +_0807A380:\n\ + adds r0, r4, 0\n\ + movs r1, 0x39\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + cmp r1, 0\n\ + bne _0807A39E\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + b _0807A3B0\n\ +_0807A39E:\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + movs r1, 0x1\n\ + strb r1, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + mov r1, r9\n\ +_0807A3B0:\n\ + strb r1, [r0]\n\ + ldr r0, =gUnknown_0203229C\n\ + adds r5, 0x1\n\ + adds r7, 0x1\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + add r0, r8\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + blt _0807A34E\n\ + b _0807A458\n\ + .pool\n\ +_0807A3CC:\n\ + movs r7, 0\n\ + ldr r1, =gUnknown_0203229C\n\ + ldr r0, [r1]\n\ + adds r0, 0x37\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + bge _0807A458\n\ + adds r6, r1, 0\n\ + movs r5, 0x6\n\ + movs r2, 0\n\ + mov r9, r2\n\ +_0807A3E2:\n\ + movs r0, 0x64\n\ + adds r1, r7, 0\n\ + muls r1, r0\n\ + ldr r0, =gEnemyParty\n\ + adds r4, r1, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0x2D\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + cmp r1, 0x1\n\ + bne _0807A414\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + mov r2, r9\n\ + strb r2, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + b _0807A444\n\ + .pool\n\ +_0807A414:\n\ + adds r0, r4, 0\n\ + movs r1, 0x39\n\ + bl GetMonData\n\ + adds r1, r0, 0\n\ + cmp r1, 0\n\ + bne _0807A432\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + b _0807A444\n\ +_0807A432:\n\ + ldr r0, [r6]\n\ + adds r0, 0x45\n\ + adds r0, r5\n\ + movs r1, 0x1\n\ + strb r1, [r0]\n\ + ldr r0, [r6]\n\ + adds r0, 0x51\n\ + adds r0, r5\n\ + mov r1, r9\n\ +_0807A444:\n\ + strb r1, [r0]\n\ + ldr r0, =gUnknown_0203229C\n\ + adds r5, 0x1\n\ + adds r7, 0x1\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + add r0, r8\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + blt _0807A3E2\n\ +_0807A458:\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +void sub_807A468(u8 a0) +{ + u16 i, hp, maxHp; + + switch (a0) + { + case 0: + for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++) + { + hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); + maxHp = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP); + gUnknown_0203229C->unk_5D[i] = GetHPBarLevel(hp, maxHp); + } + break; + case 1: + for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++) + { + hp = GetMonData(&gEnemyParty[i], MON_DATA_HP); + maxHp = GetMonData(&gEnemyParty[i], MON_DATA_MAX_HP); + gUnknown_0203229C->unk_63[i] = GetHPBarLevel(hp, maxHp); + } + break; + } +} + +void sub_807A53C(void) +{ + int i, j; + + for (i = 0; i < 2; i++) + { + for (j = 0; j < gUnknown_0203229C->unk_36[i]; j++) + { + sub_80D32C8(&gSprites[gUnknown_0203229C->unk_28[i][j]], 4 - gUnknown_0203229C->unk_5D[i * 6 + j]); + } + } +} + +void sub_807A5B0(void) +{ + int i; + + for (i = 0; i < 11; i++) + { + if (gSaveBlock1Ptr->giftRibbons[i] == 0 && gUnknown_0203229C->unk_A9[i] != 0) + { + if (gUnknown_0203229C->unk_A9[i] < 64) + { + gSaveBlock1Ptr->giftRibbons[i] = gUnknown_0203229C->unk_A9[i]; + } + } + } +} + +u32 sub_807A5F4(struct Pokemon *a0, int a1, int a2) +{ + int i, sum; + struct LinkPlayer *player; + u32 species[6]; + u32 species2[6]; + + for (i = 0; i < a1; i++) + { + species2[i] = GetMonData(&a0[i], MON_DATA_SPECIES2); + species[i] = GetMonData(&a0[i], MON_DATA_SPECIES); + } + + if (!IsNationalPokedexEnabled()) + { + if (species2[a2] == SPECIES_EGG) + { + return 3; + } + + if (!IsSpeciesInHoennDex(species2[a2])) + { + return 2; + } + } + + player = &gLinkPlayers[GetMultiplayerId() ^ 1]; + if ((player->version & 0xFF) != VERSION_RUBY && + (player->version & 0xFF) != VERSION_SAPPHIRE) + { + if ((player->name[10] & 0xF) == 0) + { + if (species2[a2] == SPECIES_EGG) + { + return 5; + } + + if (!IsSpeciesInHoennDex(species2[a2])) + { + return 4; + } + } + } + + if (species[a2] == SPECIES_DEOXYS || species[a2] == SPECIES_MEW) + { + if (!GetMonData(&a0[a2], MON_DATA_OBEDIENCE)) + { + return 4; + } + } + + for (i = 0; i < a1; i++) + { + if (species2[i] == SPECIES_EGG) + { + species2[i] = SPECIES_NONE; + } + } + + for (sum = 0, i = 0; i < a1; i++) + { + if (i != a2) + { + sum += species2[i]; + } + } + + if (sum != 0) + { + return 0; + } + else + { + return 1; + } +}