diff --git a/asm/trade.s b/asm/trade.s index 7c37a9310..88ba38cdb 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -6,2111 +6,6 @@ .text - thumb_func_start sub_807CFC8 -sub_807CFC8: @ 807CFC8 - push {r4-r7,lr} - sub sp, 0x14 - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r5, [r1] - ldr r1, =0x0000010b - adds r7, r0, 0 - cmp r5, r1 - bls _0807CFE0 - bl _0807E400 -_0807CFE0: - lsls r0, r5, 2 - ldr r1, =_0807CFF8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807CFF8: - .4byte _0807D428 - .4byte _0807D4A0 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D4FC - .4byte _0807D544 - .4byte _0807D5B8 - .4byte _0807E400 - .4byte _0807D624 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D648 - .4byte _0807D678 - .4byte _0807D68A - .4byte _0807D6AC - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D7A4 - .4byte _0807D7C4 - .4byte _0807D830 - .4byte _0807D8B4 - .4byte _0807D8D8 - .4byte _0807D924 - .4byte _0807D970 - .4byte _0807D9CC - .4byte _0807DA38 - .4byte _0807DA4C - .4byte _0807DA60 - .4byte _0807DA74 - .4byte _0807DB9C - .4byte _0807DC6C - .4byte _0807DCF4 - .4byte _0807DD94 - .4byte _0807DDA4 - .4byte _0807DDC4 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DEE8 - .4byte _0807DEF8 - .4byte _0807DF16 - .4byte _0807E400 - .4byte _0807DF3C - .4byte _0807DF7C - .4byte _0807DFBC - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DFDC - .4byte _0807E004 - .4byte _0807E020 - .4byte _0807E040 - .4byte _0807E0E8 - .4byte _0807E11C - .4byte _0807E168 - .4byte _0807E228 - .4byte _0807E2A0 - .4byte _0807E2EC - .4byte _0807E2FC - .4byte _0807E302 - .4byte _0807E328 - .4byte _0807E384 - .4byte _0807E3A8 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D6F4 - .4byte _0807D728 - .4byte _0807D77C - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DE1C - .4byte _0807DE84 - .4byte _0807DEC0 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E264 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D85C - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E284 -_0807D428: - ldr r3, =gSprites - ldr r0, [r7] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =0x0000ff4c - strh r1, [r0, 0x24] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldr r2, =gMonFrontPicCoords - adds r0, r4, 0 - adds r0, 0xF0 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - strh r0, [r1, 0x26] - adds r1, r4, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - bl GetCurrentMapMusic - ldr r1, [r7] - adds r1, 0xF4 - strh r0, [r1] - ldr r0, =0x00000179 - bl PlayNewMapMusic - bl _0807E400 - .pool -_0807D4A0: - ldr r5, [r7] - adds r6, r5, 0 - adds r6, 0xE6 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - ble _0807D4D4 - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x24] - adds r1, 0x3 - strh r1, [r0, 0x24] - ldrh r0, [r6] - subs r0, 0x3 - strh r0, [r6] - bl _0807E400 - .pool -_0807D4D4: - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x24] - strh r1, [r6] - adds r1, r5, 0 - adds r1, 0x94 - movs r0, 0xA - strh r0, [r1] - bl _0807E400 - .pool -_0807D4FC: - ldr r4, =gStringVar4 - ldr r1, =gText_XWillBeSentToY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xF0 - ldrh r1, [r2] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _0807D52A - adds r0, r1, 0 - movs r1, 0 - bl PlayCry1 -_0807D52A: - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xB - bl _0807E252 - .pool -_0807D544: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x50 - beq _0807D554 - bl _0807E400 -_0807D554: - adds r0, r1, 0 - adds r0, 0x8E - ldrb r0, [r0] - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - movs r2, 0x78 - movs r3, 0x20 - bl sub_807671C - ldr r1, [r7] - adds r1, 0xD2 - strb r0, [r1] - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_ByeByeVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - bl _0807E400 - .pool -_0807D5B8: - ldr r5, =gSprites - ldr r0, [r7] - adds r0, 0xD2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r5, 0 - adds r4, 0x1C - adds r0, r4 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807D5D8 - bl _0807E400 -_0807D5D8: - ldr r0, =gSpriteTemplate_8338D28 - movs r1, 0x78 - movs r2, 0x20 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0xD3 - strb r0, [r1] - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_807E5D8 - str r1, [r0] - adds r2, 0xD2 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - ldr r1, [r7] - bl _0807E398 - .pool -_0807D624: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x14 - strh r1, [r0] - bl _0807E400 - .pool -_0807D648: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D658 - bl _0807E400 -_0807D658: - movs r0, 0x4 - bl sub_807B62C - movs r0, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - bl _0807E394 - .pool -_0807D678: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl _0807E390 -_0807D68A: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D69A - bl _0807E400 -_0807D69A: - ldr r0, [r7] - adds r0, 0x94 - movs r1, 0x17 - strh r1, [r0] - bl _0807E400 - .pool -_0807D6AC: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xEA - ldrh r1, [r2] - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bls _0807D6CC - adds r0, r1, 0 - subs r0, 0x34 - strh r0, [r2] - b _0807D6E6 - .pool -_0807D6CC: - movs r0, 0x1 - bl sub_807B62C - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0xEA - movs r2, 0 - movs r0, 0x80 - strh r0, [r1] - subs r1, 0x56 - movs r0, 0x7C - strh r0, [r1] - str r2, [r3, 0x64] -_0807D6E6: - ldr r0, =gUnknown_020322A0 - ldr r4, [r0] - bl _0807DFA8 - .pool -_0807D6F4: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x14 - bhi _0807D704 - bl _0807E400 -_0807D704: - movs r0, 0x3 - bl sub_807B62C - ldr r0, =gSpriteTemplate_8338E8C - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r7] - bl _0807E398 - .pool -_0807D728: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807D748 - bl _0807E400 -_0807D748: - adds r0, r1, 0 - bl DestroySprite - ldr r1, =0x00000452 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x82 - lsls r1, 3 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =c3_08054588 - movs r1, 0x5 - bl CreateTask - ldr r1, [r7] - bl _0807E398 - .pool -_0807D77C: - ldr r0, =c3_08054588 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0807D78C - bl _0807E400 -_0807D78C: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x1A - strh r1, [r0] - bl _0807E400 - .pool -_0807D7A4: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xE0 - ldrh r1, [r0] - subs r1, 0x1 - strh r1, [r0] - lsls r1, 16 - movs r0, 0x9E - lsls r0, 17 - cmp r1, r0 - beq _0807D7BE - bl _0807E400 -_0807D7BE: - adds r1, r2, 0 - bl _0807E398 -_0807D7C4: - ldr r0, =gUnknown_08338D88 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x3 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - ldr r5, =gSprites - ldr r0, [r4] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807AA4C - str r1, [r0] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, [r4] - bl _0807E398 - .pool -_0807D830: - ldr r2, [r7] - adds r1, r2, 0 - adds r1, 0xE0 - ldrh r0, [r1] - subs r0, 0x3 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA6 - bne _0807D84A - subs r1, 0x4C - movs r0, 0xC8 - strh r0, [r1] -_0807D84A: - ldr r1, =0x00001241 - movs r0, 0 - bl SetGpuReg - bl _0807E400 - .pool -_0807D85C: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r2, 0x22 - ldrsh r1, [r0, r2] - movs r0, 0x8 - negs r0, r0 - cmp r1, r0 - blt _0807D8A2 - bl _0807E400 -_0807D8A2: - adds r1, r4, 0 - adds r1, 0x94 - movs r0, 0x1D - strh r0, [r1] - bl _0807E400 - .pool -_0807D8B4: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x1E - strh r1, [r0] - bl _0807E400 - .pool -_0807D8D8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D8E8 - bl _0807E400 -_0807D8E8: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - movs r0, 0x2 - bl sub_807B62C - ldr r1, [r7] - bl _0807E398 - .pool -_0807D924: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r5, =gSpriteTemplate_8338DC8 - adds r0, r5, 0 - movs r1, 0x6F - movs r2, 0xAA - movs r3, 0 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - movs r2, 0xA - negs r2, r2 - adds r0, r5, 0 - movs r1, 0x81 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r4] - bl _0807E398 - .pool -_0807D970: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807D98E - movs r0, 0x2E - bl PlaySE - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807D98E: - ldr r3, =gSprites - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - bl _0807E400 - .pool -_0807D9CC: - ldr r5, =gSprites - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x90 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r6, r4, 0 - adds r6, 0x91 - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r5 - movs r0, 0x26 - ldrsh r1, [r3, r0] - movs r0, 0x5A - negs r0, r0 - cmp r1, r0 - ble _0807DA12 - bl _0807E400 -_0807DA12: - movs r2, 0x1 - strh r2, [r3, 0x30] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x30] - adds r1, r4, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r0, =c3_0805465C - b _0807DC5A - .pool -_0807DA38: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA4C: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA60: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA74: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0xF0 - ldrh r0, [r0] - bl IsMonSpriteNotFlipped - lsls r0, 24 - cmp r0, 0 - bne _0807DAEC - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x10 - adds r0, r1 - ldr r1, =gSpriteAffineAnimTable_8338ECC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - movs r2, 0x3 - orrs r1, r2 - strb r1, [r0, 0x1] - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - b _0807DB02 - .pool -_0807DAEC: - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAffineAnim -_0807DB02: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - ldr r2, [r5] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x28 - strh r1, [r0, 0x20] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xC8 - strh r1, [r0, 0x20] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xC0 - strh r1, [r0, 0x22] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffe0 - strh r1, [r0, 0x22] - ldrb r0, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - ldr r1, [r5] - bl _0807E398 - .pool -_0807DB9C: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - movs r5, 0 - strh r1, [r0, 0x26] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x26] - adds r0, 0xA3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _0807DBE4 - movs r0, 0x2D - bl PlaySE -_0807DBE4: - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0x26 - ldrsh r1, [r0, r6] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - blt _0807DC04 - bl _0807E400 -_0807DC04: - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r0, r2, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r7] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - ldr r0, =sub_807F39C -_0807DC5A: - movs r1, 0x5 - bl CreateTask - b _0807E400 - .pool -_0807DC6C: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r2, 0x26 - ldrsh r1, [r0, r2] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - ble _0807DCAE - b _0807E400 -_0807DCAE: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x90 - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - b _0807E400 - .pool -_0807DCF4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DD02 - b _0807E400 -_0807DD02: - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x1 - bl sub_807B62C - ldr r0, [r7] - adds r0, 0xE0 - movs r1, 0xA6 - strh r1, [r0] - movs r0, 0x3 - bl sub_807B62C - ldr r0, [r7] - adds r0, 0xE4 - movs r1, 0xCE - lsls r1, 1 - strh r1, [r0] - ldr r0, =gUnknown_08338D88 - movs r4, 0x14 - negs r4, r4 - movs r1, 0x78 - adds r2, r4, 0 - movs r3, 0x3 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x90 - strb r0, [r1] - ldr r5, =gSprites - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807AA4C - str r1, [r0] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x78 - adds r2, r4, 0 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - b _0807E400 - .pool -_0807DD94: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - b _0807E390 -_0807DDA4: - movs r1, 0x92 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DDBC - b _0807E400 -_0807DDBC: - b _0807E394 - .pool -_0807DDC4: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x4 - strh r1, [r0, 0x26] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x4 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r6, 0x26 - ldrsh r1, [r0, r6] - movs r2, 0x22 - ldrsh r0, [r0, r2] - adds r1, r0 - cmp r1, 0x40 - beq _0807DE0A - b _0807E400 -_0807DE0A: - adds r0, r4, 0 - adds r0, 0x94 - movs r1, 0x90 - strh r1, [r0] - movs r0, 0 - str r0, [r4, 0x64] - b _0807E400 - .pool -_0807DE1C: - movs r1, 0xB2 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gUnknown_020322A0 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0xE0 - ldrh r0, [r1] - adds r0, 0x3 - strh r0, [r1] - adds r1, 0x4 - ldrh r0, [r1] - adds r0, 0x3 - strh r0, [r1] - ldr r0, [r2, 0x64] - adds r0, 0x1 - str r0, [r2, 0x64] - cmp r0, 0xA - bne _0807DE60 - ldr r0, =c3_08054588 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0x1 - strh r0, [r1, 0xC] -_0807DE60: - ldr r1, [r4] - adds r3, r1, 0 - adds r3, 0xE0 - movs r6, 0 - ldrsh r0, [r3, r6] - movs r2, 0x9E - lsls r2, 1 - cmp r0, r2 - bgt _0807DE74 - b _0807E400 -_0807DE74: - strh r2, [r3] - b _0807E398 - .pool -_0807DE84: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r3, [r7] - adds r2, r3, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - movs r1, 0 - strh r0, [r2] - str r1, [r3, 0x64] - b _0807E400 - .pool -_0807DEC0: - ldr r0, =c3_08054588 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0807DED0 - b _0807E400 -_0807DED0: - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r1, r2, 0 - adds r1, 0x94 - movs r0, 0x2E - strh r0, [r1] - str r3, [r2, 0x64] - b _0807E400 - .pool -_0807DEE8: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - beq _0807DEF6 - b _0807E400 -_0807DEF6: - b _0807E398 -_0807DEF8: - ldr r1, [r7] - adds r5, r1, 0 - adds r5, 0xE0 - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - asrs r0, 16 - movs r6, 0xAE - lsls r6, 1 - cmp r0, r6 - bgt _0807DF12 - b _0807E400 -_0807DF12: - strh r6, [r5] - b _0807E398 -_0807DF16: - ldr r0, =gSpriteTemplate_8338E74 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r2, =gUnknown_020322A0 - ldr r1, [r2] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x94 - movs r1, 0x32 - strh r1, [r0] - b _0807E400 - .pool -_0807DF3C: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807DF5A - b _0807E400 -_0807DF5A: - adds r0, r1, 0 - bl DestroySprite - movs r0, 0x6 - bl sub_807B62C - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x9F - bl PlaySE - b _0807E400 - .pool -_0807DF7C: - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0xEA - ldrh r3, [r2] - ldr r0, =0x000003ff - cmp r3, r0 - bhi _0807DF98 - adds r0, r3, 0 - adds r0, 0x34 - strh r0, [r2] - b _0807DFA6 - .pool -_0807DF98: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r2] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807DFA6: - ldr r4, [r7] -_0807DFA8: - adds r0, r4, 0 - adds r0, 0xEA - ldrh r1, [r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - adds r4, 0xE8 - strh r0, [r4] - b _0807E400 -_0807DFBC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x3C - strh r1, [r0] - b _0807E400 - .pool -_0807DFDC: - ldr r4, =gPaletteFade - ldrb r1, [r4, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DFEA - b _0807E400 -_0807DFEA: - movs r0, 0x5 - bl sub_807B62C - movs r0, 0x7 - bl sub_807B62C - ldrb r0, [r4, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r4, 0x8] - b _0807E394 - .pool -_0807E004: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - b _0807E390 - .pool -_0807E020: - movs r1, 0xA2 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807E038 - b _0807E400 -_0807E038: - b _0807E394 - .pool -_0807E040: - ldr r0, =gSpriteTemplate_8338D28 - movs r2, 0x8 - negs r2, r2 - movs r1, 0x78 - movs r3, 0 - bl CreateSprite - ldr r5, =gUnknown_020322A0 - ldr r1, [r5] - adds r1, 0xD3 - movs r6, 0 - strb r0, [r1] - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0xD3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x4A - strh r1, [r0, 0x34] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807E6AC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - bl StartSpriteAffineAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r2, =0x0000ffff - movs r1, 0x10 - bl BlendPalettes - ldr r2, [r5] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - str r6, [r2, 0x64] - b _0807E400 - .pool -_0807E0E8: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r7] - b _0807E398 - .pool -_0807E11C: - ldr r2, =gSprites - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807E13A - b _0807E400 -_0807E13A: - adds r0, r3, 0 - adds r0, 0xF2 - ldrh r2, [r0] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - ldr r3, [r3, 0x6C] - bl HandleLoadSpecialPokePic_2 - ldr r1, [r7] - b _0807E398 - .pool -_0807E168: - ldr r4, =gSprites - ldr r2, [r7] - adds r6, r2, 0 - adds r6, 0x8F - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r5, 0 - movs r1, 0x78 - strh r1, [r0, 0x20] - ldrb r0, [r6] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r3, =gMonFrontPicCoords - adds r2, 0xF2 - ldrh r0, [r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - adds r0, 0x3C - strh r0, [r1, 0x22] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x24] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x26] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAnim - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0x8F - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - adds r3, 0xF2 - ldrh r2, [r3] - str r2, [sp, 0x10] - movs r2, 0x78 - movs r3, 0x54 - bl CreatePokeballSpriteToReleaseMon - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FreeSpriteOamMatrix - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, [r7] - b _0807E398 - .pool -_0807E228: - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gStringVar4 - ldr r1, =gText_XSentOverY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xA7 -_0807E252: - strh r0, [r1] - str r2, [r3, 0x64] - b _0807E400 - .pool -_0807E264: - ldr r3, [r7] - ldr r0, [r3, 0x64] - adds r0, 0x1 - str r0, [r3, 0x64] - cmp r0, 0x3C - bhi _0807E272 - b _0807E400 -_0807E272: - adds r0, r3, 0 - adds r0, 0x94 - movs r2, 0 - ldr r1, =0x0000010b - strh r1, [r0] - str r2, [r3, 0x64] - b _0807E400 - .pool -_0807E284: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0807E290 - b _0807E400 -_0807E290: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x44 - strh r1, [r0] - b _0807E400 - .pool -_0807E2A0: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - bne _0807E2B2 - ldr r0, =0x00000173 - bl PlayFanfare -_0807E2B2: - ldr r1, [r7] - ldr r0, [r1, 0x64] - cmp r0, 0xFA - beq _0807E2BC - b _0807E400 -_0807E2BC: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - movs r5, 0 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_TakeGoodCareOfX - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, [r7] - str r5, [r0, 0x64] - b _0807E400 - .pool -_0807E2EC: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - beq _0807E2FA - b _0807E400 -_0807E2FA: - b _0807E398 -_0807E2FC: - bl sub_807F14C - b _0807E394 -_0807E302: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xEE - ldrb r0, [r0] - cmp r0, 0 - beq _0807E312 - movs r0, 0x1 - b _0807E402 -_0807E312: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0807E400 - adds r1, r2, 0 - b _0807E398 - .pool -_0807E328: - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] - movs r1, 0 - bl sub_807B4D0 - ldr r1, =gCB2_AfterEvolution - ldr r0, =sub_807B60C - str r0, [r1] - ldr r7, =gUnknown_02032298 - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x1 - movs r2, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _0807E394 - ldrb r3, [r7] - adds r0, r3, 0 - muls r0, r6 - adds r0, r5 - ldr r1, =gUnknown_020322A0 - ldr r1, [r1] - adds r1, 0x8F - ldrb r2, [r1] - adds r1, r4, 0 - bl TradeEvolutionScene - b _0807E394 - .pool -_0807E384: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 -_0807E390: - bl BeginNormalPaletteFade -_0807E394: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] -_0807E398: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _0807E400 - .pool -_0807E3A8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0807E400 - ldr r0, [r7] - adds r0, 0xF4 - ldrh r0, [r0] - bl PlayNewMapMusic - ldr r0, [r7] - cmp r0, 0 - beq _0807E3F6 - bl FreeAllWindowBuffers - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeMonSpritesGfx - ldr r0, [r7] - bl Free - str r4, [r7] -_0807E3F6: - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - bl sub_807E784 -_0807E400: - movs r0, 0 -_0807E402: - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_807CFC8 - thumb_func_start c2_08053788 c2_08053788: @ 807E414 push {r4-r7,lr} diff --git a/src/trade.c b/src/trade.c index c996c3348..ebcbf8534 100644 --- a/src/trade.c +++ b/src/trade.c @@ -200,6 +200,7 @@ extern const struct SpriteTemplate gUnknown_08338D88; extern const struct SpriteTemplate gSpriteTemplate_8338DC8; extern const union AffineAnimCmd *const gSpriteAffineAnimTable_8338ECC[]; extern const struct SpriteTemplate gSpriteTemplate_8338E74; +extern const struct SpriteTemplate gSpriteTemplate_8338E8C; // external to this file extern const struct CompressedSpriteSheet gMonFrontPicTable[]; @@ -251,7 +252,9 @@ void sub_807AAE0(struct Sprite *); void sub_807E6AC(struct Sprite *); void sub_807F14C(void); void sub_807E784(void); +void c3_08054588(u8); void c3_0805465C(u8); +void sub_807F39C(u8); bool8 sub_8077170(const void *a0, u32 a1) { @@ -3727,14 +3730,13 @@ bool8 sub_807BBEC(void) gUnknown_020322A0->unk_94++; } break; - /*case 13: + case 13: // The game waits here for the sprite to finish its animation sequence. - break;*/ + break; case 14: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); gUnknown_020322A0->unk_94 = 20; break; - case 20: if (!gPaletteFade.active) { @@ -4162,3 +4164,518 @@ bool8 sub_807BBEC(void) } return FALSE; } + +bool8 sub_807CFC8(void) +{ + u16 evoTarget; + + switch (gUnknown_020322A0->unk_94) + { + case 0: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = -180; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[0]].y_offset; + gUnknown_020322A0->unk_94++; + gUnknown_020322A0->unk_F4 = GetCurrentMapMusic(); + PlayNewMapMusic(MUS_SHINKA); + break; + case 1: + if (gUnknown_020322A0->bg2hofs > 0) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x += 3; + gUnknown_020322A0->bg2hofs -= 3; + } + else + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = 0; + gUnknown_020322A0->bg2hofs = 0; + gUnknown_020322A0->unk_94 = 10; + } + break; + case 10: + StringExpandPlaceholders(gStringVar4, gText_XWillBeSentToY); + sub_807F1A8(0, gStringVar4, 0); + + if (gUnknown_020322A0->tradeSpecies[0] != SPECIES_EGG) + { + PlayCry1(gUnknown_020322A0->tradeSpecies[0], 0); + } + + gUnknown_020322A0->unk_94 = 11; + gUnknown_020322A0->unk_64 = 0; + break; + case 11: + if (++gUnknown_020322A0->unk_64 == 80) + { + gUnknown_020322A0->unk_D2 = sub_807671C(gUnknown_020322A0->pokePicSpriteIdxs[0], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.paletteNum, 120, 32, 2, 1, 0x14, 0xfffff); + gUnknown_020322A0->unk_94++; + StringExpandPlaceholders(gStringVar4, gText_ByeByeVar1); + sub_807F1A8(0, gStringVar4, 0); + } + break; + case 12: + if (gSprites[gUnknown_020322A0->unk_D2].callback == SpriteCallbackDummy) + { + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, 32, 0); + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E5D8; + DestroySprite(&gSprites[gUnknown_020322A0->unk_D2]); + gUnknown_020322A0->unk_94++; + } + break; + case 13: + // The game waits here for the sprite to finish its animation sequence. + break; + case 14: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->unk_94 = 20; + break; + case 20: + if (!gPaletteFade.active) + { + sub_807B62C(4); + FillWindowPixelBuffer(0, 0xFF); + CopyWindowToVram(0, 3); + gUnknown_020322A0->unk_94++; + } + break; + case 21: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_94++; + break; + case 22: + if (!gPaletteFade.active) + { + gUnknown_020322A0->unk_94 = 23; + } + break; + case 23: + if (gUnknown_020322A0->unk_EA > 0x100) + { + gUnknown_020322A0->unk_EA -= 0x34; + } + else + { + sub_807B62C(1); + gUnknown_020322A0->unk_EA = 0x80; + gUnknown_020322A0->unk_94 = 124; + gUnknown_020322A0->unk_64 = 0; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 124: + if (++gUnknown_020322A0->unk_64 > 20) + { + sub_807B62C(3); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E8C, 120, 80, 0); + gUnknown_020322A0->unk_94++; + } + break; + case 125: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | + BLDCNT_TGT1_OBJ | + BLDCNT_EFFECT_BLEND | + BLDCNT_TGT2_BG2); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 4)); + CreateTask(c3_08054588, 5); + gUnknown_020322A0->unk_94++; + } + break; + case 126: + if (!FuncIsActiveTask(c3_08054588)) + { + gUnknown_020322A0->unk_94 = 26; + } + break; + case 26: + if (--gUnknown_020322A0->bg1vofs == 316) + { + gUnknown_020322A0->unk_94++; + } + break; + case 27: + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 120, 80, 3); + gSprites[gUnknown_020322A0->unk_90].callback = sub_807AA4C; + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 120, 80, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + gUnknown_020322A0->unk_94++; + break; + case 28: + if ((gUnknown_020322A0->bg1vofs -= 3) == 166) + { + gUnknown_020322A0->unk_94 = 200; + } + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + break; + case 200: + gSprites[gUnknown_020322A0->unk_90].pos1.y -= 2; + gSprites[gUnknown_020322A0->unk_91].pos1.y -= 2; + if (gSprites[gUnknown_020322A0->unk_90].pos1.y < -8) + { + gUnknown_020322A0->unk_94 = 29; + } + break; + case 29: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->unk_94 = 30; + break; + case 30: + if (!gPaletteFade.active) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(2); + gUnknown_020322A0->unk_94++; + } + break; + case 31: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_90 = CreateSprite(&gSpriteTemplate_8338DC8, 111, 170, 0); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 129, -10, 0); + gUnknown_020322A0->unk_94++; + break; + case 32: + if (!gPaletteFade.active) + { + PlaySE(SE_TK_WARPOUT); + gUnknown_020322A0->unk_94++; + } + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + break; + case 33: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -90) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 1; + gSprites[gUnknown_020322A0->unk_91].data[1] = 1; + gUnknown_020322A0->unk_94++; + CreateTask(c3_0805465C, 5); + } + break; + case 34: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->unk_94++; + break; + case 35: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->unk_94++; + break; + case 36: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->unk_94++; + break; + case 37: + if (!IsMonSpriteNotFlipped(gUnknown_020322A0->tradeSpecies[0])) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].affineAnims = gSpriteAffineAnimTable_8338ECC; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.affineMode = 3; + CalcCenterToCornerVec(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0, 3, 3); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + else + { + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.x = 40; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 200; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.y = 192; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = -32; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = FALSE; + gUnknown_020322A0->unk_94++; + break; + case 38: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y -= 3; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y += 3; + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -160 && gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y >= -163) + { + PlaySE(SE_TK_WARPIN); + } + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -222) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 0; + gSprites[gUnknown_020322A0->unk_91].data[1] = 0; + gUnknown_020322A0->unk_94++; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = TRUE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = TRUE; + CreateTask(sub_807F39C, 5); + } + break; + case 39: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -222) + { + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->unk_94++; + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + } + break; + case 40: + if (!gPaletteFade.active) + { + gUnknown_020322A0->unk_94++; + sub_807B62C(1); + gUnknown_020322A0->bg1vofs = 166; + sub_807B62C(3); + gUnknown_020322A0->bg2vofs = 412; + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 120, -20, 3); + gSprites[gUnknown_020322A0->unk_90].callback = sub_807AA4C; + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 120, -20, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + } + break; + case 41: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_94++; + break; + case 42: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->unk_94++; + } + break; + case 43: + gSprites[gUnknown_020322A0->unk_90].pos2.y += 4; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 4; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y + gSprites[gUnknown_020322A0->unk_90].pos1.y == 64) + { + gUnknown_020322A0->unk_94 = 144; + gUnknown_020322A0->unk_64 = 0; + } + break; + case 144: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + gUnknown_020322A0->bg1vofs += 3; + gUnknown_020322A0->bg2vofs += 3; + if (++gUnknown_020322A0->unk_64 == 10) + { + u8 taskId = CreateTask(c3_08054588, 5); + gTasks[taskId].data[2] = 1; + } + if (gUnknown_020322A0->bg1vofs > 316) + { + gUnknown_020322A0->bg1vofs = 316; + gUnknown_020322A0->unk_94++; + } + break; + case 145: + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + gUnknown_020322A0->unk_94++; + gUnknown_020322A0->unk_64 = 0; + break; + case 146: + if (!FuncIsActiveTask(c3_08054588)) + { + gUnknown_020322A0->unk_94 = 46; + gUnknown_020322A0->unk_64 = 0; + } + break; + case 46: + if (++gUnknown_020322A0->unk_64 == 10) + { + gUnknown_020322A0->unk_94++; + } + break; + case 47: + if (++gUnknown_020322A0->bg1vofs > 348) + { + gUnknown_020322A0->bg1vofs = 348; + gUnknown_020322A0->unk_94++; + } + break; + case 48: + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E74, 120, 80, 0); + gUnknown_020322A0->unk_94 = 50; + break; + case 50: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(6); + gUnknown_020322A0->unk_94++; + PlaySE(SE_W028); + } + break; + case 51: + if (gUnknown_020322A0->unk_EA < 0x400) + { + gUnknown_020322A0->unk_EA += 0x34; + } + else + { + gUnknown_020322A0->unk_EA = 0x400; + gUnknown_020322A0->unk_94++; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 52: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->unk_94 = 60; + break; + case 60: + if (!gPaletteFade.active) + { + sub_807B62C(5); + sub_807B62C(7); + gPaletteFade.bufferTransferDisabled = TRUE; + gUnknown_020322A0->unk_94++; + } + break; + case 61: + gPaletteFade.bufferTransferDisabled = FALSE; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_94++; + break; + case 62: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->unk_94++; + } + break; + case 63: + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, -8, 0); + gSprites[gUnknown_020322A0->unk_D3].data[3] = 74; + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E6AC; + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_D3], 1); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->unk_D3], 2); + BlendPalettes(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 16, RGB_WHITEALPHA); + gUnknown_020322A0->unk_94++; + gUnknown_020322A0->unk_64 = 0; + break; + case 64: + BeginNormalPaletteFade(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 1, 16, 0, RGB_WHITEALPHA); + gUnknown_020322A0->unk_94++; + break; + case 65: + if (gSprites[gUnknown_020322A0->unk_D3].callback == SpriteCallbackDummy) + { + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[gUnknown_020322A0->tradeSpecies[1]], gMonSpritesGfxPtr->sprites[3], gUnknown_020322A0->tradeSpecies[1], gUnknown_020322A0->unk_68[1]); + gUnknown_020322A0->unk_94++; + } + break; + case 66: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 120; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[1]].y_offset + 60; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.x = 0; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y = 0; + StartSpriteAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + CreatePokeballSpriteToReleaseMon(gUnknown_020322A0->pokePicSpriteIdxs[1], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, gUnknown_020322A0->tradeSpecies[1]); + FreeSpriteOamMatrix(&gSprites[gUnknown_020322A0->unk_D3]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_D3]); + gUnknown_020322A0->unk_94++; + break; + case 67: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG0_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + StringExpandPlaceholders(gStringVar4, gText_XSentOverY); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->unk_94 = 167; + gUnknown_020322A0->unk_64 = 0; + break; + // 167 and 267 are extra cases added in for animations + case 167: + if (++gUnknown_020322A0->unk_64 > 60) + { + gUnknown_020322A0->unk_94 = 267; + gUnknown_020322A0->unk_64 = 0; + } + break; + case 267: + if (IsCryFinished()) + { + gUnknown_020322A0->unk_94 = 68; + } + break; + case 68: + if (++gUnknown_020322A0->unk_64 == 10) + { + PlayFanfare(MUS_FANFA5); + } + if (gUnknown_020322A0->unk_64 == 250) + { + gUnknown_020322A0->unk_94++; + StringExpandPlaceholders(gStringVar4, gText_TakeGoodCareOfX); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->unk_64 = 0; + } + break; + case 69: + if (++gUnknown_020322A0->unk_64 == 60) + { + gUnknown_020322A0->unk_94++; + } + break; + case 70: + sub_807F14C(); + gUnknown_020322A0->unk_94++; + break; + case 71: + if (gUnknown_020322A0->isLinkTrade) + { + return TRUE; + } + else if (gMain.newKeys & A_BUTTON) + { + gUnknown_020322A0->unk_94++; + } + break; + case 72: // Only if in-game trade + sub_807B4D0(gSpecialVar_0x8005, 0); + gCB2_AfterEvolution = sub_807B60C; + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gUnknown_02032298[0]], TRUE, ITEM_NONE); + if (evoTarget != SPECIES_NONE) + { + TradeEvolutionScene(&gPlayerParty[gUnknown_02032298[0]], evoTarget, gUnknown_020322A0->pokePicSpriteIdxs[1], gUnknown_02032298[0]); + } + gUnknown_020322A0->unk_94++; + break; + case 73: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->unk_94++; + break; + case 74: + if (!gPaletteFade.active) + { + PlayNewMapMusic(gUnknown_020322A0->unk_F4); + if (gUnknown_020322A0) + { + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeMonSpritesGfx(); + FREE_AND_SET_NULL(gUnknown_020322A0); + } + SetMainCallback2(CB2_ReturnToField); + sub_807E784(); + } + break; + } + return FALSE; +}