From 4233ae50c38c44923bdd0d31ae99de0903ac86cf Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Sun, 9 Dec 2018 18:38:15 +0530 Subject: [PATCH] Finish decompile ghost --- asm/ghost.s | 2448 ------------------------------------------------- ld_script.txt | 1 - src/ghost.c | 305 +++--- 3 files changed, 165 insertions(+), 2589 deletions(-) delete mode 100644 asm/ghost.s diff --git a/asm/ghost.s b/asm/ghost.s deleted file mode 100644 index 4afba4c9e..000000000 --- a/asm/ghost.s +++ /dev/null @@ -1,2448 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8111C50 -sub_8111C50: @ 8111C50 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r0, 0x1 - bl duplicate_obj_of_side_rel2move_in_transparent_mode - movs r6, 0 - movs r1, 0 - strh r0, [r5, 0x8] - lsls r0, 16 - cmp r0, 0 - bge _08111C80 - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _08111D5C - .pool -_08111C80: - strh r1, [r5, 0xA] - movs r0, 0xF - strh r0, [r5, 0xC] - movs r0, 0x2 - strh r0, [r5, 0xE] - strh r1, [r5, 0x10] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldrh r1, [r5, 0xE] - lsls r1, 8 - ldrh r0, [r5, 0xC] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r4, =gSprites - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x50 - strh r1, [r0, 0x2E] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08111CF4 - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff70 - strh r1, [r0, 0x30] - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x70 - b _08111D12 - .pool -_08111CF4: - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x90 - strh r1, [r0, 0x30] - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff90 -_08111D12: - strh r1, [r0, 0x32] - ldr r4, =gSprites - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r2, 0 - strh r2, [r0, 0x34] - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x36] - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_80A656C - str r1, [r0] - ldr r0, =sub_8111D78 - str r0, [r5] -_08111D5C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8111C50 - - thumb_func_start sub_8111D78 -sub_8111D78: @ 8111D78 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08111E1C - cmp r0, 0x1 - bgt _08111DA0 - cmp r0, 0 - beq _08111DA6 - b _08111E48 - .pool -_08111DA0: - cmp r0, 0x2 - beq _08111E42 - b _08111E48 -_08111DA6: - ldrh r1, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0xA] - movs r0, 0x3 - ands r0, r1 - strh r0, [r4, 0x12] - cmp r0, 0x1 - bne _08111DC4 - ldrh r1, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08111DC4 - subs r0, r1, 0x1 - strh r0, [r4, 0xC] -_08111DC4: - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - bne _08111DDA - ldrh r1, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _08111DDA - adds r0, r1, 0x1 - strh r0, [r4, 0xE] -_08111DDA: - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0xC] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r4, 0xC] - movs r0, 0x80 - lsls r0, 13 - cmp r1, r0 - bne _08111E48 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x50 - ble _08111E48 - movs r2, 0x8 - ldrsh r1, [r4, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl obj_delete_but_dont_free_vram - movs r0, 0x1 - strh r0, [r4, 0x10] - b _08111E48 - .pool -_08111E1C: - ldrh r0, [r4, 0x14] - adds r0, 0x1 - strh r0, [r4, 0x14] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08111E48 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _08111E48 -_08111E42: - adds r0, r2, 0 - bl DestroyAnimVisualTask -_08111E48: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8111D78 - - thumb_func_start sub_8111E50 -sub_8111E50: @ 8111E50 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks - adds r1, r2 - movs r2, 0 - strh r2, [r1, 0x26] - ldr r2, =sub_8111E78 - str r2, [r1] - bl _call_via_r2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8111E50 - - thumb_func_start sub_8111E78 -sub_8111E78: @ 8111E78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r6, r0, 24 - movs r1, 0x26 - ldrsh r0, [r5, r1] - cmp r0, 0x4 - bls _08111EA4 - b _081120C6 -_08111EA4: - lsls r0, 2 - ldr r1, =_08111EBC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08111EBC: - .4byte _08111ED0 - .4byte _08111FD0 - .4byte _08112014 - .4byte _0811207C - .4byte _081120A8 -_08111ED0: - ldr r7, =0x00002771 - adds r0, r7, 0 - bl AllocSpritePalette - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - mov r8, r2 - strh r0, [r5, 0x24] - cmp r0, 0xFF - beq _08111EFE - cmp r0, 0xF - beq _08111EFE - movs r0, 0x1 - bl duplicate_obj_of_side_rel2move_in_transparent_mode - strh r0, [r5, 0x8] - lsls r0, 16 - cmp r0, 0 - bge _08111F0C - adds r0, r7, 0 - bl FreeSpritePaletteByTag -_08111EFE: - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _081120CC - .pool -_08111F0C: - ldr r4, =gSprites - movs r1, 0x8 - ldrsh r0, [r5, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r2, [r5, 0x24] - lsls r2, 4 - ldrb r3, [r1, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r2, 0x8 - ldrsh r0, [r5, r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r2, [r1, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x8 - ldrsh r0, [r5, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - lsls r1, 31 - adds r2, 0x3E - lsrs r1, 31 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - mov r2, r8 - strh r2, [r5, 0xA] - strh r2, [r5, 0xC] - movs r0, 0x10 - strh r0, [r5, 0xE] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - movs r0, 0x22 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r0, 0x10 - lsls r0, 4 - strh r0, [r5, 0x10] - cmp r6, 0x1 - bne _08111FC4 - movs r1, 0x80 - lsls r1, 2 - b _08111FC8 - .pool -_08111FC4: - movs r1, 0x80 - lsls r1, 3 -_08111FC8: - movs r0, 0 - bl ClearGpuRegBits - b _081120C6 -_08111FD0: - movs r1, 0x24 - ldrsh r0, [r5, r1] - adds r0, 0x10 - lsls r0, 4 - strh r0, [r5, 0x24] - movs r2, 0x10 - ldrsh r0, [r5, r2] - lsls r0, 1 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - movs r2, 0x24 - ldrsh r1, [r5, r2] - lsls r1, 1 - ldr r2, =gPlttBufferFaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - ldrh r0, [r5, 0x10] - ldr r3, =0x00003c0d - movs r1, 0x10 - movs r2, 0xA - bl BlendPalette - b _081120C6 - .pool -_08112014: - ldr r2, =gSprites - movs r0, 0x22 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - ldrh r0, [r0, 0x22] - adds r1, r0 - subs r1, 0x20 - lsls r1, 16 - lsrs r2, r1, 16 - cmp r1, 0 - bge _08112034 - movs r2, 0 -_08112034: - cmp r6, 0x1 - bne _08112054 - lsls r0, r2, 24 - lsrs r0, 24 - adds r1, r2, 0 - adds r1, 0x40 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - str r2, [sp] - movs r2, 0x4 - str r2, [sp, 0x4] - str r6, [sp, 0x8] - b _0811206C - .pool -_08112054: - lsls r0, r2, 24 - lsrs r0, 24 - adds r1, r2, 0 - adds r1, 0x40 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - str r2, [sp] - movs r2, 0x8 - str r2, [sp, 0x4] - movs r2, 0x1 - str r2, [sp, 0x8] -_0811206C: - movs r2, 0x2 - movs r3, 0x6 - bl ScanlineEffect_InitWave - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x1C] - b _081120C6 -_0811207C: - cmp r6, 0x1 - bne _08112090 - ldr r1, =0x00003f42 - movs r0, 0x50 - bl SetGpuReg - b _08112098 - .pool -_08112090: - ldr r1, =0x00003f44 - movs r0, 0x50 - bl SetGpuReg -_08112098: - movs r1, 0x80 - lsls r1, 5 - movs r0, 0x52 - bl SetGpuReg - b _081120C6 - .pool -_081120A8: - cmp r6, 0x1 - bne _081120B8 - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - bl SetGpuRegBits - b _081120C2 -_081120B8: - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - bl SetGpuRegBits -_081120C2: - ldr r0, =sub_81120DC - str r0, [r5] -_081120C6: - ldrh r0, [r5, 0x26] - adds r0, 0x1 - strh r0, [r5, 0x26] -_081120CC: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8111E78 - - thumb_func_start sub_81120DC -sub_81120DC: @ 81120DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - ldrh r1, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0xA] - movs r0, 0x1 - ands r0, r1 - strh r0, [r4, 0x12] - cmp r0, 0 - bne _08112114 - ldr r1, =gSineTable - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - movs r1, 0x12 - bl __divsi3 - strh r0, [r4, 0xC] -_08112114: - movs r2, 0x12 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bne _08112136 - ldr r1, =gSineTable - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - movs r1, 0x12 - bl __divsi3 - movs r1, 0x10 - subs r1, r0 - strh r1, [r4, 0xE] -_08112136: - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0xC] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0x80 - bne _0811215E - movs r0, 0 - strh r0, [r4, 0x26] - ldr r1, =sub_8112170 - str r1, [r4] - adds r0, r5, 0 - bl _call_via_r1 -_0811215E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81120DC - - thumb_func_start sub_8112170 -sub_8112170: @ 8112170 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r6, r0, 24 - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _081121DC - cmp r0, 0x1 - bgt _081121A8 - cmp r0, 0 - beq _081121AE - b _08112258 - .pool -_081121A8: - cmp r0, 0x2 - beq _081121F0 - b _08112258 -_081121AE: - ldr r1, =gScanlineEffect - movs r0, 0x3 - strb r0, [r1, 0x15] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x24] - cmp r6, 0x1 - bne _081121D0 - movs r1, 0x80 - lsls r1, 2 - b _081121D4 - .pool -_081121D0: - movs r1, 0x80 - lsls r1, 3 -_081121D4: - movs r0, 0 - bl ClearGpuRegBits - b _08112258 -_081121DC: - ldrh r0, [r4, 0x10] - ldr r3, =0x00003c0d - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - b _08112258 - .pool -_081121F0: - ldr r3, =gSprites - movs r0, 0x24 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - bl obj_delete_but_dont_free_vram - ldr r0, =0x00002771 - bl FreeSpritePaletteByTag - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - cmp r6, 0x1 - bne _08112248 - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - bl SetGpuRegBits - b _08112252 - .pool -_08112248: - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - bl SetGpuRegBits -_08112252: - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08112258: - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8112170 - - thumb_func_start sub_8112264 -sub_8112264: @ 8112264 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r7, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _081122AC - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - movs r2, 0xE0 - lsls r2, 13 - adds r0, r2 - lsrs r5, r0, 16 - ldr r4, =gBattleAnimTarget - b _081122D0 - .pool -_081122AC: - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - movs r2, 0xE0 - lsls r2, 13 - adds r0, r2 - lsrs r5, r0, 16 - ldr r4, =gBattleAnimAttacker -_081122D0: - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - movs r1, 0xE0 - lsls r1, 13 - adds r0, r1 - lsrs r0, 16 - mov r9, r0 - mov r8, r5 - mov r2, r9 - subs r4, r2, r5 - lsls r4, 16 - lsrs r4, 16 - lsls r0, r6, 4 - strh r0, [r7, 0x2E] - lsls r0, r5, 4 - strh r0, [r7, 0x30] - mov r1, r10 - subs r0, r1, r6 - lsls r0, 4 - ldr r5, =gBattleAnimArgs - movs r2, 0x2 - ldrsh r1, [r5, r2] - bl __divsi3 - strh r0, [r7, 0x32] - lsls r4, 16 - asrs r4, 12 - movs r0, 0x2 - ldrsh r1, [r5, r0] - adds r0, r4, 0 - bl __divsi3 - strh r0, [r7, 0x34] - ldrh r0, [r5, 0x2] - strh r0, [r7, 0x36] - mov r1, r10 - strh r1, [r7, 0x38] - mov r2, r9 - strh r2, [r7, 0x3A] - movs r1, 0x36 - ldrsh r0, [r7, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - strh r0, [r7, 0x3C] - ldrb r1, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r7, 0x5] - strh r6, [r7, 0x20] - mov r2, r8 - strh r2, [r7, 0x22] - ldr r0, =sub_8112384 - str r0, [r7, 0x1C] - adds r2, r7, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112264 - - thumb_func_start sub_8112384 -sub_8112384: @ 8112384 - push {r4,lr} - adds r2, r0, 0 - ldrh r3, [r2, 0x36] - movs r1, 0x36 - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _081123BC - ldrh r0, [r2, 0x32] - ldrh r4, [r2, 0x2E] - adds r0, r4 - strh r0, [r2, 0x2E] - ldrh r1, [r2, 0x34] - ldrh r4, [r2, 0x30] - adds r1, r4 - strh r1, [r2, 0x30] - lsls r0, 16 - asrs r0, 20 - strh r0, [r2, 0x20] - lsls r1, 16 - asrs r1, 20 - strh r1, [r2, 0x22] - subs r0, r3, 0x1 - strh r0, [r2, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _081123BC - strh r0, [r2, 0x2E] -_081123BC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8112384 - - thumb_func_start sub_81123C4 -sub_81123C4: @ 81123C4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r1, r0 - str r1, [sp] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 5 - movs r0, 0x52 - bl SetGpuReg - movs r0, 0 - ldr r1, [sp] - strh r0, [r1, 0x12] - strh r0, [r1, 0x14] - strh r0, [r1, 0x16] - strh r0, [r1, 0x18] - movs r0, 0x10 - strh r0, [r1, 0x1A] - ldr r2, =gBattleAnimArgs - ldrh r0, [r2] - strh r0, [r1, 0x1C] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - ldrb r0, [r4] - movs r1, 0x3 - bl sub_80A861C - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _08112434 - b _08112530 -_08112434: - movs r4, 0 -_08112436: - lsls r1, r4, 16 - asrs r3, r1, 16 - ldr r0, =gBattleAnimAttacker - ldrb r2, [r0] - str r1, [sp, 0x10] - cmp r3, r2 - beq _08112502 - movs r0, 0x2 - eors r2, r0 - cmp r3, r2 - beq _08112502 - lsls r0, r4, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _08112502 - ldr r6, [sp, 0x4] - ldr r3, [sp, 0x8] - lsls r0, r3, 16 - asrs r7, r0, 16 - ldr r0, =gUnknown_08596DB8 - adds r1, r6, 0 - adds r2, r7, 0 - movs r3, 0x37 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x40 - beq _08112502 - adds r0, r4, 0 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - adds r0, r4, 0 - movs r1, 0x3 - bl sub_80A861C - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - mov r0, r8 - lsls r5, r0, 4 - add r5, r8 - lsls r5, 2 - ldr r1, =gSprites - adds r4, r5, r1 - lsls r0, r6, 4 - strh r0, [r4, 0x2E] - lsls r0, r7, 4 - strh r0, [r4, 0x30] - mov r2, r10 - subs r0, r2, r6 - lsls r0, 4 - ldr r3, =gBattleAnimArgs - movs r2, 0x2 - ldrsh r1, [r3, r2] - bl __divsi3 - strh r0, [r4, 0x32] - mov r3, r9 - lsls r0, r3, 16 - asrs r0, 16 - subs r0, r7 - lsls r0, 4 - ldr r2, =gBattleAnimArgs - movs r3, 0x2 - ldrsh r1, [r2, r3] - bl __divsi3 - strh r0, [r4, 0x34] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x36] - mov r2, r10 - strh r2, [r4, 0x38] - mov r3, r9 - strh r3, [r4, 0x3A] - ldr r0, =gSprites + 0x1C - adds r5, r0 - ldr r0, =sub_8112384 - str r0, [r5] - ldr r2, [sp] - movs r3, 0x20 - ldrsh r1, [r2, r3] - adds r1, 0xD - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1 - mov r1, r8 - strh r1, [r0] - ldrh r0, [r2, 0x20] - adds r0, 0x1 - strh r0, [r2, 0x20] -_08112502: - ldr r2, [sp, 0x10] - movs r3, 0x80 - lsls r3, 9 - adds r0, r2, r3 - lsrs r4, r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08112436 - b _081125B4 - .pool -_08112530: - ldr r0, =gUnknown_08596DB8 - ldr r7, [sp, 0x4] - ldr r2, [sp, 0x8] - lsls r1, r2, 16 - asrs r1, 16 - str r1, [sp, 0xC] - adds r1, r7, 0 - ldr r2, [sp, 0xC] - movs r3, 0x37 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x40 - beq _081125B4 - movs r3, 0x30 - mov r10, r3 - movs r0, 0x28 - mov r9, r0 - ldr r6, =gSprites - mov r1, r8 - lsls r5, r1, 4 - add r5, r8 - lsls r5, 2 - adds r4, r5, r6 - lsls r0, r7, 4 - strh r0, [r4, 0x2E] - ldr r2, [sp, 0xC] - lsls r0, r2, 4 - strh r0, [r4, 0x30] - subs r0, r3, r7 - lsls r0, 4 - ldr r3, =gBattleAnimArgs - movs r2, 0x2 - ldrsh r1, [r3, r2] - bl __divsi3 - strh r0, [r4, 0x32] - mov r3, r9 - ldr r1, [sp, 0xC] - subs r0, r3, r1 - lsls r0, 4 - ldr r2, =gBattleAnimArgs - movs r3, 0x2 - ldrsh r1, [r2, r3] - bl __divsi3 - strh r0, [r4, 0x34] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x36] - mov r2, r10 - strh r2, [r4, 0x38] - mov r3, r9 - strh r3, [r4, 0x3A] - adds r6, 0x1C - adds r5, r6 - ldr r0, =sub_8112384 - str r0, [r5] - mov r1, r8 - ldr r0, [sp] - strh r1, [r0, 0x22] - movs r0, 0x1 - ldr r2, [sp] - strh r0, [r2, 0x20] -_081125B4: - ldr r0, =sub_81125E0 - ldr r3, [sp] - str r0, [r3] - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81123C4 - - thumb_func_start sub_81125E0 -sub_81125E0: @ 81125E0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0x1 - beq _08112696 - cmp r1, 0x1 - bgt _08112608 - cmp r1, 0 - beq _08112616 - b _08112752 - .pool -_08112608: - cmp r1, 0x2 - bne _0811260E - b _08112728 -_0811260E: - cmp r1, 0x3 - bne _08112614 - b _0811273C -_08112614: - b _08112752 -_08112616: - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0811267C - ldrh r0, [r4, 0x12] - adds r0, 0x1 - strh r0, [r4, 0x12] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0811267C - strh r1, [r4, 0x12] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0811264C - ldrh r1, [r4, 0x18] - movs r2, 0x18 - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _0811265A - adds r0, r1, 0x1 - strh r0, [r4, 0x18] - b _0811265A -_0811264C: - ldrh r1, [r4, 0x1A] - movs r2, 0x1A - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0811265A - subs r0, r1, 0x1 - strh r0, [r4, 0x1A] -_0811265A: - ldrh r1, [r4, 0x1A] - lsls r1, 8 - ldrh r0, [r4, 0x18] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x16 - ldrsh r0, [r4, r1] - cmp r0, 0x17 - ble _0811267C - movs r0, 0 - strh r0, [r4, 0x16] - movs r0, 0x1 - strh r0, [r4, 0x14] -_0811267C: - ldrh r1, [r4, 0x1C] - movs r2, 0x1C - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0811268C - subs r0, r1, 0x1 - strh r0, [r4, 0x1C] - b _08112752 -_0811268C: - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08112752 - b _08112734 -_08112696: - ldrh r0, [r4, 0x12] - adds r0, 0x1 - strh r0, [r4, 0x12] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08112752 - movs r0, 0 - strh r0, [r4, 0x12] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] - ands r0, r1 - lsls r0, 16 - cmp r0, 0 - beq _081126C6 - ldrh r1, [r4, 0x18] - movs r2, 0x18 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _081126D4 - subs r0, r1, 0x1 - strh r0, [r4, 0x18] - b _081126D4 -_081126C6: - ldrh r1, [r4, 0x1A] - movs r2, 0x1A - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _081126D4 - adds r0, r1, 0x1 - strh r0, [r4, 0x1A] -_081126D4: - ldrh r1, [r4, 0x1A] - lsls r1, 8 - ldrh r0, [r4, 0x18] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r4, 0x18] - movs r0, 0x80 - lsls r0, 13 - cmp r1, r0 - bne _08112752 - movs r5, 0 - b _08112718 -_081126F4: - adds r1, r5, 0 - adds r1, 0xD - lsls r1, 1 - adds r0, r4, 0 - adds r0, 0x8 - adds r0, r1 - movs r2, 0 - ldrsh r1, [r0, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_08112718: - movs r1, 0x20 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _081126F4 - b _08112734 - .pool -_08112728: - ldrh r0, [r4, 0x12] - adds r0, 0x1 - strh r0, [r4, 0x12] - lsls r0, 16 - cmp r0, 0 - ble _08112752 -_08112734: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08112752 -_0811273C: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08112752: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81125E0 - - thumb_func_start sub_8112758 -sub_8112758: @ 8112758 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattle_WIN0H - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - ldr r1, =0x00003f3f - movs r0, 0x48 - bl SetGpuReg - ldr r1, =0x00003f1f - movs r0, 0x4A - bl SetGpuReg - movs r0, 0x50 - movs r1, 0xC8 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0x10 - bl SetGpuReg - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _081127A0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _081127B8 -_081127A0: - movs r6, 0x28 - b _081127BA - .pool -_081127B8: - movs r6, 0xC8 -_081127BA: - ldr r1, =gBattle_WIN0H - lsls r3, r6, 16 - asrs r2, r3, 16 - lsls r0, r2, 8 - orrs r0, r2 - strh r0, [r1] - ldr r1, =gBattle_WIN0V - movs r5, 0x28 - ldr r0, =0x00002828 - strh r0, [r1] - lsrs r3, 16 - movs r1, 0xF0 - subs r1, r2 - movs r4, 0x48 - ldr r2, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r2 - strh r3, [r0, 0xA] - strh r1, [r0, 0xC] - strh r5, [r0, 0xE] - strh r4, [r0, 0x10] - strh r6, [r0, 0x12] - strh r5, [r0, 0x14] - ldr r1, =sub_811280C - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112758 - - thumb_func_start sub_811280C -sub_811280C: @ 811280C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r0, 24 - ldr r2, _0811292C @ =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r1, [r4, 0x8] - adds r0, r1, 0x1 - strh r0, [r4, 0x8] - ldrh r5, [r4, 0xA] - ldrh r7, [r4, 0xC] - ldrh r0, [r4, 0xE] - mov r10, r0 - ldrh r2, [r4, 0x10] - str r2, [sp, 0xC] - ldrh r0, [r4, 0x12] - ldrh r2, [r4, 0x14] - mov r8, r2 - lsls r1, 16 - asrs r6, r1, 16 - cmp r6, 0xF - ble _08112848 - b _08112938 -_08112848: - lsls r0, 16 - asrs r0, 16 - bl __floatsidf - str r0, [sp, 0x10] - str r1, [sp, 0x14] - lsls r0, r5, 16 - asrs r0, 16 - bl __floatsidf - ldr r2, _08112930 @ =0x3FB00000 - ldr r3, _08112934 @ =0x00000000 - bl __muldf3 - adds r5, r1, 0 - adds r4, r0, 0 - adds r0, r6, 0 - bl __floatsidf - str r0, [sp, 0x18] - str r1, [sp, 0x1C] - adds r1, r5, 0 - adds r0, r4, 0 - ldr r2, [sp, 0x18] - ldr r3, [sp, 0x1C] - bl __muldf3 - adds r3, r1, 0 - adds r2, r0, 0 - ldr r0, [sp, 0x10] - ldr r1, [sp, 0x14] - bl __subdf3 - bl __fixunsdfsi - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - lsls r0, r7, 16 - asrs r0, 16 - bl __floatsidf - ldr r2, _08112930 @ =0x3FB00000 - ldr r3, _08112934 @ =0x00000000 - bl __muldf3 - ldr r2, [sp, 0x18] - ldr r3, [sp, 0x1C] - bl __muldf3 - adds r3, r1, 0 - adds r2, r0, 0 - ldr r0, [sp, 0x10] - ldr r1, [sp, 0x14] - bl __adddf3 - bl __fixunsdfsi - lsls r0, 16 - lsrs r7, r0, 16 - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - bl __floatsidf - adds r5, r1, 0 - adds r4, r0, 0 - mov r2, r10 - lsls r0, r2, 16 - asrs r0, 16 - bl __floatsidf - ldr r2, _08112930 @ =0x3FB00000 - ldr r3, _08112934 @ =0x00000000 - bl __muldf3 - ldr r2, [sp, 0x18] - ldr r3, [sp, 0x1C] - bl __muldf3 - adds r3, r1, 0 - adds r2, r0, 0 - adds r1, r5, 0 - adds r0, r4, 0 - bl __subdf3 - bl __fixunsdfsi - lsls r0, 16 - lsrs r6, r0, 16 - ldr r1, [sp, 0xC] - lsls r0, r1, 16 - asrs r0, 16 - bl __floatsidf - ldr r2, _08112930 @ =0x3FB00000 - ldr r3, _08112934 @ =0x00000000 - bl __muldf3 - ldr r2, [sp, 0x18] - ldr r3, [sp, 0x1C] - bl __muldf3 - adds r3, r1, 0 - adds r2, r0, 0 - adds r1, r5, 0 - adds r0, r4, 0 - bl __adddf3 - bl __fixunsdfsi - lsls r0, 16 - lsrs r5, r0, 16 - b _08112966 - .align 2, 0 -_0811292C: - .4byte gTasks -_08112930: - .4byte 0x3FB00000 -_08112934: - .4byte 0x00000000 -_08112938: - movs r2, 0 - mov r9, r2 - movs r7, 0xF0 - movs r6, 0 - movs r5, 0x70 - str r6, [sp] - str r6, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r3, 0 - bl sub_80A75AC - lsls r0, 16 - lsrs r0, 16 - str r6, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, _08112988 @=sub_8112994 - str r0, [r4] -_08112966: - ldr r1, _0811298C @=gBattle_WIN0H - mov r2, r9 - lsls r0, r2, 8 - orrs r7, r0 - strh r7, [r1] - ldr r1, _08112990 @=gBattle_WIN0V - lsls r0, r6, 8 - orrs r5, r0 - strh r5, [r1] - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08112988: - .4byte sub_8112994 -_0811298C: - .4byte gBattle_WIN0H -_08112990: - .4byte gBattle_WIN0V - thumb_func_end sub_811280C - - thumb_func_start sub_8112994 -sub_8112994: @ 8112994 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081129DA - ldr r0, =gBattle_WIN0H - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - ldr r4, =0x00003f3f - movs r0, 0x48 - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x4A - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyAnimVisualTask -_081129DA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112994 - - thumb_func_start sub_81129F0 -sub_81129F0: @ 81129F0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08112A24 - movs r2, 0x18 - ldr r3, =0x0000fffe - ldrb r0, [r4, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r0 - movs r0, 0x10 - orrs r1, r0 - strb r1, [r4, 0x3] - b _08112A28 - .pool -_08112A24: - ldr r2, =0x0000ffe8 - movs r3, 0x2 -_08112A28: - lsls r0, r2, 16 - asrs r0, 16 - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - strh r3, [r4, 0x30] - movs r0, 0x3C - strh r0, [r4, 0x2E] - ldr r0, =sub_8112A4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81129F0 - - thumb_func_start sub_8112A4C -sub_8112A4C: @ 8112A4C - push {r4,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x2E] - movs r2, 0x2E - ldrsh r0, [r3, r2] - cmp r0, 0 - ble _08112A5E - subs r0, r1, 0x1 - b _08112AC2 -_08112A5E: - ldrh r0, [r3, 0x30] - ldrh r4, [r3, 0x24] - adds r1, r0, r4 - strh r1, [r3, 0x24] - adds r0, r1, 0x7 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xE - bls _08112AC4 - ldrh r0, [r3, 0x20] - adds r0, r1 - strh r0, [r3, 0x20] - movs r0, 0 - strh r0, [r3, 0x24] - ldrh r2, [r3, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - adds r1, 0x8 - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - ldrh r0, [r3, 0x32] - adds r0, 0x1 - strh r0, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _08112AC0 - movs r0, 0x1E - strh r0, [r3, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r3, 0x1C] - ldr r1, =sub_8112ACC - adds r0, r3, 0 - bl StoreSpriteCallbackInData6 - b _08112AC4 - .pool -_08112AC0: - movs r0, 0x28 -_08112AC2: - strh r0, [r3, 0x2E] -_08112AC4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8112A4C - - thumb_func_start sub_8112ACC -sub_8112ACC: @ 8112ACC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08112AF6 - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0x10 - bl SetGpuReg - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - strh r5, [r4, 0x30] - strh r5, [r4, 0x32] - b _08112B3A -_08112AF6: - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bgt _08112B06 - adds r0, r1, 0x1 - strh r0, [r4, 0x30] - b _08112B3A -_08112B06: - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - movs r1, 0x10 - subs r1, r0 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _08112B3A - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_8112B44 - str r0, [r4, 0x1C] -_08112B3A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112ACC - - thumb_func_start sub_8112B44 -sub_8112B44: @ 8112B44 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - ldr r0, =gBattle_WIN0H - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - adds r0, r4, 0 - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112B44 - - thumb_func_start sub_8112B78 -sub_8112B78: @ 8112B78 - push {r4-r7,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r1, 0xC - bl Sin - strh r0, [r5, 0x24] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08112B9C - ldrh r0, [r5, 0x24] - negs r0, r0 - strh r0, [r5, 0x24] -_08112B9C: - ldrh r0, [r5, 0x2E] - adds r0, 0x6 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x2E] - movs r1, 0x80 - lsls r1, 1 - adds r0, r1, 0 - ldrh r1, [r5, 0x30] - adds r0, r1 - strh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 24 - negs r0, r0 - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x3C] - adds r0, 0x1 - strh r0, [r5, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08112BE8 - ldr r0, =0x0000050b - strh r0, [r5, 0x3A] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldrh r1, [r5, 0x3A] - movs r0, 0x52 - bl SetGpuReg - b _08112C40 - .pool -_08112BE8: - cmp r0, 0x1E - ble _08112C40 - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r1, [r5, 0x3A] - lsls r0, r1, 16 - asrs r0, 24 - lsls r0, 16 - movs r6, 0xFF - ands r6, r1 - movs r1, 0x80 - lsls r1, 9 - adds r0, r1 - lsrs r7, r0, 16 - cmp r7, 0x10 - bls _08112C0C - movs r7, 0x10 -_08112C0C: - subs r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r0, 0 - bge _08112C18 - movs r6, 0 -_08112C18: - lsls r4, r7, 8 - orrs r4, r6 - lsls r1, r4, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - strh r4, [r5, 0x3A] - cmp r7, 0x10 - bne _08112C40 - cmp r6, 0 - bne _08112C40 - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_8112C4C - str r0, [r5, 0x1C] -_08112C40: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112B78 - - thumb_func_start sub_8112C4C -sub_8112C4C: @ 8112C4C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8112C4C - - thumb_func_start sub_8112C6C -sub_8112C6C: @ 8112C6C - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - movs r6, 0 - strh r6, [r4, 0x8] - movs r0, 0x10 - mov r8, r0 - mov r0, r8 - strh r0, [r4, 0xA] - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x1A] - ldrb r0, [r5] - bl GetBattlerYCoordWithElevation - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x1C] - ldrb r0, [r5] - movs r1, 0x1 - bl sub_80A861C - lsls r0, 16 - asrs r1, r0, 16 - lsrs r0, 31 - adds r1, r0 - asrs r1, 1 - adds r1, 0x8 - strh r1, [r4, 0x1E] - strh r6, [r4, 0x16] - ldrb r0, [r5] - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x12] - ldrb r0, [r5] - bl sub_80A82E4 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x2 - strh r0, [r4, 0x14] - strh r6, [r4, 0xE] - mov r0, r8 - strh r0, [r4, 0x10] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 5 - movs r0, 0x52 - bl SetGpuReg - strh r6, [r4, 0x18] - ldr r0, =sub_8112D10 - str r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112C6C - - thumb_func_start sub_8112D10 -sub_8112D10: @ 8112D10 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - bls _08112D2A - b _08112E96 -_08112D2A: - lsls r0, 2 - ldr r1, =_08112D3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08112D3C: - .4byte _08112D54 - .4byte _08112DC4 - .4byte _08112E06 - .4byte _08112E1A - .4byte _08112E70 - .4byte _08112E80 -_08112D54: - movs r6, 0 -_08112D56: - movs r2, 0x1A - ldrsh r1, [r4, r2] - movs r0, 0x1C - ldrsh r2, [r4, r0] - ldrb r3, [r4, 0x14] - ldr r0, =gUnknown_08596E30 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _08112DAA - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r5, r0, r1 - strh r7, [r5, 0x2E] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _08112D8C - movs r1, 0x1 -_08112D8C: - strh r1, [r5, 0x30] - movs r0, 0x2A - muls r0, r6 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x32] - ldrh r0, [r4, 0x1E] - strh r0, [r5, 0x34] - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 1 - strh r0, [r5, 0x38] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] -_08112DAA: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _08112D56 - b _08112E78 - .pool -_08112DC4: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08112DE2 - ldrh r1, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0xD - bgt _08112DF0 - adds r0, r1, 0x1 - strh r0, [r4, 0xE] - b _08112DF0 -_08112DE2: - ldrh r1, [r4, 0x10] - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0x4 - ble _08112DF0 - subs r0, r1, 0x1 - strh r0, [r4, 0x10] -_08112DF0: - movs r1, 0xE - ldrsh r0, [r4, r1] - ldrh r2, [r4, 0xE] - ldrh r1, [r4, 0x10] - cmp r0, 0xE - bne _08112E60 - cmp r1, 0x4 - bne _08112E60 - movs r0, 0 - strh r0, [r4, 0xA] - b _08112E5A -_08112E06: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - ble _08112E96 - movs r0, 0 - strh r0, [r4, 0xA] - b _08112E78 -_08112E1A: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08112E38 - ldrh r1, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08112E46 - subs r0, r1, 0x1 - strh r0, [r4, 0xE] - b _08112E46 -_08112E38: - ldrh r1, [r4, 0x10] - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _08112E46 - adds r0, r1, 0x1 - strh r0, [r4, 0x10] -_08112E46: - movs r1, 0xE - ldrsh r0, [r4, r1] - ldrh r2, [r4, 0xE] - ldrh r1, [r4, 0x10] - cmp r0, 0 - bne _08112E60 - cmp r1, 0x10 - bne _08112E60 - movs r0, 0x1 - strh r0, [r4, 0x18] -_08112E5A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08112E60: - lsls r1, 8 - orrs r1, r2 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - b _08112E96 -_08112E70: - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08112E96 -_08112E78: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08112E96 -_08112E80: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r7, 0 - bl DestroyAnimVisualTask -_08112E96: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8112D10 - - thumb_func_start sub_8112E9C -sub_8112E9C: @ 8112E9C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08112EAE - ldrh r0, [r4, 0x32] - adds r0, 0x2 - b _08112EB2 -_08112EAE: - ldrh r0, [r4, 0x32] - subs r0, 0x2 -_08112EB2: - strh r0, [r4, 0x32] - ldrh r1, [r4, 0x32] - movs r0, 0xFF - ands r0, r1 - strh r0, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r2, 0x34 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - subs r0, 0x41 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x7E - bhi _08112EF4 - ldr r2, =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x12] - adds r1, 0x1 - movs r0, 0x3 - ands r1, r0 - b _08112F08 - .pool -_08112EF4: - ldr r2, =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r2, 0x3 - ldrb r1, [r0, 0x12] - ands r1, r2 -_08112F08: - lsls r1, 2 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r0, 3 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - movs r1, 0x7 - bl Sin - strh r0, [r4, 0x26] - ldr r2, =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r1, r0, r2 - movs r2, 0x18 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _08112F56 - ldrh r0, [r1, 0x16] - subs r0, 0x1 - strh r0, [r1, 0x16] - adds r0, r4, 0 - bl DestroySprite -_08112F56: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112E9C - - thumb_func_start sub_8112F60 -sub_8112F60: @ 8112F60 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r3] - ldr r2, =gBattlerSpriteIds - ldr r1, =gBattleAnimAttacker - ldrb r1, [r1] - adds r1, r2 - ldrb r1, [r1] - strh r1, [r0, 0x38] - movs r1, 0x80 - strh r1, [r0, 0x2E] - movs r1, 0xA - strh r1, [r0, 0x30] - ldr r2, =gBattleAnimArgs - ldrh r1, [r2] - strh r1, [r0, 0x32] - ldrh r1, [r2, 0x2] - strh r1, [r0, 0x34] - ldr r1, =sub_8112FB8 - str r1, [r0, 0x1C] - ldr r2, =gSprites - movs r3, 0x38 - ldrsh r1, [r0, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - adds r1, 0x8 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_8112F60 - - thumb_func_start sub_8112FB8 -sub_8112FB8: @ 8112FB8 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x34] - movs r1, 0x34 - ldrsh r3, [r5, r1] - cmp r3, 0 - beq _08113020 - subs r0, 0x1 - strh r0, [r5, 0x34] - movs r2, 0x2E - ldrsh r0, [r5, r2] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Sin - ldr r4, =gSprites - movs r1, 0x38 - ldrsh r2, [r5, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - strh r0, [r1, 0x24] - movs r2, 0x2E - ldrsh r0, [r5, r2] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Cos - movs r1, 0x38 - ldrsh r2, [r5, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - strh r0, [r1, 0x26] - ldrh r0, [r5, 0x32] - ldrh r2, [r5, 0x2E] - adds r1, r0, r2 - strh r1, [r5, 0x2E] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _08113054 - ldr r2, =0xffffff00 - adds r0, r1, r2 - strh r0, [r5, 0x2E] - b _08113054 - .pool -_08113020: - ldr r2, =gSprites - movs r0, 0x38 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r3, [r0, 0x24] - movs r0, 0x38 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r3, [r0, 0x26] - movs r0, 0x38 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x8 - strh r1, [r0, 0x22] - ldr r0, =move_anim_8074EE0 - str r0, [r5, 0x1C] -_08113054: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8112FB8 - - .align 2, 0 diff --git a/ld_script.txt b/ld_script.txt index 58c940522..bf05b91a0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -168,7 +168,6 @@ SECTIONS { src/bug.o(.text); src/rock.o(.text); src/ghost.o(.text); - asm/ghost.o(.text); src/dragon.o(.text); asm/dark.o(.text); src/ground.o(.text); diff --git a/src/ghost.c b/src/ghost.c index 526e4e519..0464d1491 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -1,10 +1,14 @@ #include "global.h" +#include "battle.h" #include "battle_anim.h" #include "gpu_regs.h" +#include "palette.h" #include "constants/rgb.h" +#include "scanline_effect.h" #include "constants/songs.h" #include "sound.h" #include "trig.h" +#include "util.h" static void sub_811160C(struct Sprite *); static void sub_8111674(struct Sprite *); @@ -18,11 +22,25 @@ static void InitAnimShadowBall(struct Sprite *); static void AnimShadowBallStep(struct Sprite *); static void sub_8111B9C(struct Sprite *); static void sub_8111BB4(struct Sprite *); -extern void sub_8112264(struct Sprite *); -extern void sub_81129F0(struct Sprite *); -extern void sub_8112B78(struct Sprite *); -extern void sub_8112E9C(struct Sprite *); -extern void sub_8112F60(struct Sprite *); +static void sub_8111D78(u8 taskId); +static void sub_8111E78(u8 taskId); +static void sub_81120DC(u8 taskId); +static void sub_8112170(u8 taskId); +static void sub_8112264(struct Sprite *); +static void sub_8112384(struct Sprite *); +static void sub_81125E0(u8 taskId); +static void sub_811280C(u8 taskId); +static void sub_8112994(u8 taskId); +static void sub_81129F0(struct Sprite *); +static void sub_8112A4C(struct Sprite *); +static void sub_8112ACC(struct Sprite *); +static void sub_8112B44(struct Sprite *); +static void sub_8112B78(struct Sprite *); +static void sub_8112C4C(struct Sprite *); +static void sub_8112D10(u8 taskId); +static void sub_8112E9C(struct Sprite *); +static void sub_8112F60(struct Sprite *); +static void sub_8112FB8(struct Sprite *); const union AffineAnimCmd gUnknown_08596CF8[] = { @@ -208,7 +226,7 @@ static void sub_811160C(struct Sprite *sprite) sub_80A6FD4(sprite); sprite->callback = sub_8111674; sprite->data[6] = 16; - SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40); + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); SetGpuReg(REG_OFFSET_BLDALPHA, sprite->data[6]); } @@ -321,8 +339,8 @@ static void sub_8111814(struct Sprite *sprite) void sub_811188C(u8 taskId) { u8 spriteId; - SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40); - SetGpuReg(REG_OFFSET_BLDALPHA, 0x1000); + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10)); spriteId = GetAnimBattlerSpriteId(0); sub_80A7270(spriteId, 1); obj_id_set_rotscale(spriteId, 128, 128, 0); @@ -342,7 +360,7 @@ static void sub_8111914(u8 taskId) gTasks[taskId].data[10] = 0; gTasks[taskId].data[2] += 1; gTasks[taskId].data[3] -= 1; - SetGpuReg(REG_OFFSET_BLDALPHA, gTasks[taskId].data[3] << 8 | gTasks[taskId].data[2]); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[2], gTasks[taskId].data[3])); if (gTasks[taskId].data[2] != 9) return; @@ -487,9 +505,7 @@ static void sub_8111BB4(struct Sprite *sprite) { } } -/* - -void sub_80DE1B0(u8 taskId) +void sub_8111C50(u8 taskId) { struct Task *task; @@ -504,10 +520,10 @@ void sub_80DE1B0(u8 taskId) task->data[2] = 15; task->data[3] = 2; task->data[4] = 0; - REG_BLDCNT = 0x3F40; - REG_BLDALPHA = (task->data[3] << 8) | task->data[2]; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3])); gSprites[task->data[0]].data[0] = 80; - if (GetBattlerSide(gAnimBankTarget) == 0) + if (GetBattlerSide(gBattleAnimTarget) == 0) { gSprites[task->data[0]].data[1] = -144; gSprites[task->data[0]].data[2] = 112; @@ -519,12 +535,12 @@ void sub_80DE1B0(u8 taskId) } gSprites[task->data[0]].data[3] = 0; gSprites[task->data[0]].data[4] = 0; - StoreSpriteCallbackInData(&gSprites[task->data[0]], SpriteCallbackDummy); - gSprites[task->data[0]].callback = sub_8078394; - task->func = sub_80DE2DC; + StoreSpriteCallbackInData6(&gSprites[task->data[0]], SpriteCallbackDummy); + gSprites[task->data[0]].callback = sub_80A656C; + task->func = sub_8111D78; } -static void sub_80DE2DC(u8 taskId) +static void sub_8111D78(u8 taskId) { struct Task *task; @@ -540,7 +556,7 @@ static void sub_80DE2DC(u8 taskId) if (task->data[5] == 3) if (task->data[3] <= 15) task->data[3] += 1; - REG_BLDALPHA = (task->data[3] << 8) | task->data[2]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3])); if (task->data[3] != 16 || task->data[2] != 0) break; if (task->data[1] <= 80) @@ -551,8 +567,8 @@ static void sub_80DE2DC(u8 taskId) case 1: if (++task->data[6] <= 1) break; - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); task->data[4] += 1; break; case 2: @@ -560,27 +576,27 @@ static void sub_80DE2DC(u8 taskId) } } -void sub_80DE3AC(u8 taskId) +void sub_8111E50(u8 taskId) { struct Task *task; task = &gTasks[taskId]; task->data[15] = 0; - task->func = sub_80DE3D4; + task->func = sub_8111E78; task->func(taskId); } -static void sub_80DE3D4(u8 taskId) +static void sub_8111E78(u8 taskId) { s16 startLine; struct Task *task = &gTasks[taskId]; - u8 position = GetBattlerPosition_permutated(gAnimBankTarget); + u8 position = sub_80A8364(gBattleAnimTarget); switch (task->data[15]) { case 0: task->data[14] = AllocSpritePalette(0x2771); - if (task->data[14] == 0xFF) + if (task->data[14] == 0xFF || task->data[14] == 0xF) { DestroyAnimVisualTask(taskId); } @@ -594,19 +610,25 @@ static void sub_80DE3D4(u8 taskId) } else { + s16 mask2; gSprites[task->data[0]].oam.paletteNum = task->data[14]; gSprites[task->data[0]].oam.objMode = ST_OAM_OBJ_NORMAL; gSprites[task->data[0]].oam.priority = 3; + gSprites[task->data[0]].invisible = (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].invisible); task->data[1] = 0; task->data[2] = 0; task->data[3] = 16; task->data[13] = GetAnimBattlerSpriteId(1); task->data[4] = (gSprites[task->data[13]].oam.paletteNum + 16) * 16; - if (position == 1) - REG_DISPCNT &= 0xFDFF; - else - REG_DISPCNT &= 0xFBFF; - + if (position == 1) { + u16 mask = DISPCNT_BG1_ON; + mask2 = mask; + } + else { + u16 mask = DISPCNT_BG2_ON; + mask2 = mask; + } + ClearGpuRegBits(REG_OFFSET_DISPCNT, mask2); task->data[15]++; } } @@ -631,20 +653,20 @@ static void sub_80DE3D4(u8 taskId) break; case 3: if (position == 1) - REG_BLDCNT = 0x3F42; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1)); else - REG_BLDCNT = 0x3F44; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG2)); - REG_BLDALPHA = 0x1000; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10)); task->data[15]++; break; case 4: if (position == 1) - REG_DISPCNT |= DISPCNT_BG1_ON; + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else - REG_DISPCNT |= DISPCNT_BG2_ON; + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); - task->func = sub_80DE61C; + task->func = sub_81120DC; task->data[15]++; break; default: @@ -653,7 +675,7 @@ static void sub_80DE3D4(u8 taskId) } } -static void sub_80DE61C(u8 taskId) +static void sub_81120DC(u8 taskId) { struct Task *task = &gTasks[taskId]; task->data[1]++; @@ -664,19 +686,19 @@ static void sub_80DE61C(u8 taskId) if (task->data[5] == 1) task->data[3] = 16 - (gSineTable[task->data[1]] / 18); - REG_BLDALPHA = (task->data[3] << 8) | task->data[2]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3])); if (task->data[1] == 128) { task->data[15] = 0; - task->func = sub_80DE6B0; + task->func = sub_8112170; task->func(taskId); } } -static void sub_80DE6B0(u8 taskId) +static void sub_8112170(u8 taskId) { struct Task *task = &gTasks[taskId]; - u8 position = GetBattlerPosition_permutated(gAnimBankTarget); + u8 position = sub_80A8364(gBattleAnimTarget); switch (task->data[15]) { @@ -684,9 +706,9 @@ static void sub_80DE6B0(u8 taskId) gScanlineEffect.state = 3; task->data[14] = GetAnimBattlerSpriteId(1); if (position == 1) - REG_DISPCNT &= 0xFDFF; + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else - REG_DISPCNT &= 0xFBFF; + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); break; case 1: BlendPalette(task->data[4], 16, 0, RGB(13, 0, 15)); @@ -695,12 +717,12 @@ static void sub_80DE6B0(u8 taskId) gSprites[task->data[14]].invisible = 1; obj_delete_but_dont_free_vram(&gSprites[task->data[0]]); FreeSpritePaletteByTag(0x2771); - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); if (position == 1) - REG_DISPCNT |= DISPCNT_BG1_ON; + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else - REG_DISPCNT |= DISPCNT_BG2_ON; + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); DestroyAnimVisualTask(taskId); break; @@ -709,7 +731,7 @@ static void sub_80DE6B0(u8 taskId) task->data[15]++; } -static void sub_80DE7B8(struct Sprite *sprite) +static void sub_8112264(struct Sprite *sprite) { s16 battler1X, battler1Y; s16 battler2X, battler2Y; @@ -717,17 +739,17 @@ static void sub_80DE7B8(struct Sprite *sprite) if (gBattleAnimArgs[0] == 0) { - battler1X = GetBattlerSpriteCoord(gAnimBankAttacker, 0); - battler1Y = GetBattlerSpriteCoord(gAnimBankAttacker, 1) + 28; - battler2X = GetBattlerSpriteCoord(gAnimBankTarget, 0); - battler2Y = GetBattlerSpriteCoord(gAnimBankTarget, 1) + 28; + battler1X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); + battler1Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28; + battler2X = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + battler2Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28; } else { - battler1X = GetBattlerSpriteCoord(gAnimBankTarget, 0); - battler1Y = GetBattlerSpriteCoord(gAnimBankTarget, 1) + 28; - battler2X = GetBattlerSpriteCoord(gAnimBankAttacker, 0); - battler2Y = GetBattlerSpriteCoord(gAnimBankAttacker, 1) + 28; + battler1X = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + battler1Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28; + battler2X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); + battler2Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28; } yDiff = battler2Y - battler1Y; @@ -742,11 +764,11 @@ static void sub_80DE7B8(struct Sprite *sprite) sprite->oam.priority = 2; sprite->pos1.x = battler1X; sprite->pos1.y = battler1Y; - sprite->callback = sub_80DE8D8; + sprite->callback = sub_8112384; sprite->invisible = 1; } -static void sub_80DE8D8(struct Sprite *sprite) +static void sub_8112384(struct Sprite *sprite) { if (sprite->data[4]) { @@ -759,7 +781,7 @@ static void sub_80DE8D8(struct Sprite *sprite) } } -void sub_80DE918(u8 taskId) +void sub_81123C4(u8 taskId) { struct Task *task; s16 battler; @@ -768,8 +790,8 @@ void sub_80DE918(u8 taskId) s16 x, y; task = &gTasks[taskId]; - REG_BLDCNT = 0x3F40; - REG_BLDALPHA = 0x1000; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10)); task->data[5] = 0; task->data[6] = 0; task->data[7] = 0; @@ -777,21 +799,21 @@ void sub_80DE918(u8 taskId) task->data[9] = 16; task->data[10] = gBattleAnimArgs[0]; - baseX = GetBattlerSpriteCoord(gAnimBankAttacker, 2); - baseY = sub_807A100(gAnimBankAttacker, 3); + baseX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + baseY = sub_80A861C(gBattleAnimAttacker, 3); if (!IsContest()) { for (battler = 0; battler < 4; battler++) { - if (battler != gAnimBankAttacker - && battler != (gAnimBankAttacker ^ 2) - && IsAnimBankSpriteVisible(battler)) + if (battler != gBattleAnimAttacker + && battler != (gBattleAnimAttacker ^ 2) + && IsBattlerSpriteVisible(battler)) { - spriteId = CreateSprite(&gSpriteTemplate_83DAF08, baseX, baseY, 55); + spriteId = CreateSprite(&gUnknown_08596DB8, baseX, baseY, 55); if (spriteId != MAX_SPRITES) { x = GetBattlerSpriteCoord(battler, 2); - y = sub_807A100(battler, 3); + y = sub_80A861C(battler, 3); gSprites[spriteId].data[0] = baseX << 4; gSprites[spriteId].data[1] = baseY << 4; gSprites[spriteId].data[2] = ((x - baseX) << 4) / gBattleAnimArgs[1]; @@ -799,7 +821,7 @@ void sub_80DE918(u8 taskId) gSprites[spriteId].data[4] = gBattleAnimArgs[1]; gSprites[spriteId].data[5] = x; gSprites[spriteId].data[6] = y; - gSprites[spriteId].callback = sub_80DE8D8; + gSprites[spriteId].callback = sub_8112384; task->data[task->data[12] + 13] = spriteId; task->data[12]++; @@ -809,7 +831,7 @@ void sub_80DE918(u8 taskId) } else { - spriteId = CreateSprite(&gSpriteTemplate_83DAF08, baseX, baseY, 55); + spriteId = CreateSprite(&gUnknown_08596DB8, baseX, baseY, 55); if (spriteId != MAX_SPRITES) { x = 48; @@ -821,17 +843,17 @@ void sub_80DE918(u8 taskId) gSprites[spriteId].data[4] = gBattleAnimArgs[1]; gSprites[spriteId].data[5] = x; gSprites[spriteId].data[6] = y; - gSprites[spriteId].callback = sub_80DE8D8; + gSprites[spriteId].callback = sub_8112384; task->data[13] = spriteId; task->data[12] = 1; } } - task->func = sub_80DEB38; + task->func = sub_81125E0; } -static void sub_80DEB38(u8 taskId) +static void sub_81125E0(u8 taskId) { u16 i; struct Task *task = &gTasks[taskId]; @@ -856,7 +878,7 @@ static void sub_80DEB38(u8 taskId) task->data[9]--; } - REG_BLDALPHA = (task->data[9] << 8) | task->data[8]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[8], task->data[9])); if (task->data[7] >= 24) { task->data[7] = 0; @@ -886,7 +908,7 @@ static void sub_80DEB38(u8 taskId) task->data[9]++; } - REG_BLDALPHA = (task->data[9] << 8) | task->data[8]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[8], task->data[9])); if (task->data[8] == 0 && task->data[9] == 16) { for (i = 0; i < task->data[12]; i++) @@ -901,26 +923,28 @@ static void sub_80DEB38(u8 taskId) task->data[0]++; break; case 3: - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); DestroyAnimVisualTask(taskId); break; } } -void sub_80DECB0(u8 taskId) +void sub_8112758(u8 taskId) { s16 startX, startY; s16 leftDistance, topDistance, bottomDistance, rightDistance; gBattle_WIN0H = 0; gBattle_WIN0V = 0; - REG_WININ = 0x3F3F; - REG_WINOUT = 0x3F1F; - REG_BLDCNT = 0xC8; - REG_BLDY = 0x10; + SetGpuReg(REG_OFFSET_WININ, ((WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR) | + (WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR))); + SetGpuReg(REG_OFFSET_WINOUT, ((WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ) | + (WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR))); + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_DARKEN)); + SetGpuReg(REG_OFFSET_BLDY, 0x10); - if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER || IsContest()) + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER || IsContest()) startX = 40; else startX = 200; @@ -939,10 +963,10 @@ void sub_80DECB0(u8 taskId) gTasks[taskId].data[4] = bottomDistance; gTasks[taskId].data[5] = startX; gTasks[taskId].data[6] = startY; - gTasks[taskId].func = sub_80DED60; + gTasks[taskId].func = sub_811280C; } -static void sub_80DED60(u8 taskId) +static void sub_811280C(u8 taskId) { s16 step; s16 leftDistance, rightDistance, topDistance, bottomDistance; @@ -972,36 +996,38 @@ static void sub_80DED60(u8 taskId) right = 240; top = 0; bottom = 112; - selectedPalettes = sub_80791A8(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0)); - gTasks[taskId].func = sub_80DEEE8; + gTasks[taskId].func = sub_8112994; } gBattle_WIN0H = (left << 8) | right; gBattle_WIN0V = (top << 8) | bottom; } -static void sub_80DEEE8(u8 taskId) +static void sub_8112994(u8 taskId) { if (!gPaletteFade.active) { gBattle_WIN0H = 0; gBattle_WIN0V = 0; - REG_WININ = 0x3F3F; - REG_WINOUT = 0x3F3F; - REG_BLDCNT = 0; - REG_BLDY = 0; + SetGpuReg(REG_OFFSET_WININ, ((WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR) | + (WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR))); + SetGpuReg(REG_OFFSET_WINOUT, ((WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR) | + (WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR))); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); DestroyAnimVisualTask(taskId); } } -static void sub_80DEF3C(struct Sprite *sprite) +static void sub_81129F0(struct Sprite *sprite) { s16 xDelta; s16 xDelta2; InitAnimSpritePos(sprite, 1); - if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) { xDelta = 24; xDelta2 = -2; @@ -1016,10 +1042,10 @@ static void sub_80DEF3C(struct Sprite *sprite) sprite->pos1.x += xDelta; sprite->data[1] = xDelta2; sprite->data[0] = 60; - sprite->callback = sub_80DEF98; + sprite->callback = sub_8112A4C; } -static void sub_80DEF98(struct Sprite *sprite) +static void sub_8112A4C(struct Sprite *sprite) { u16 var0; @@ -1040,7 +1066,7 @@ static void sub_80DEF98(struct Sprite *sprite) { sprite->data[0] = 30; sprite->callback = WaitAnimForDuration; - StoreSpriteCallbackInData(sprite, sub_80DF018); + StoreSpriteCallbackInData6(sprite, sub_8112ACC); } else { @@ -1050,12 +1076,12 @@ static void sub_80DEF98(struct Sprite *sprite) } } -static void sub_80DF018(struct Sprite *sprite) +static void sub_8112ACC(struct Sprite *sprite) { if (sprite->data[0] == 0) { - REG_BLDCNT = 0x3F40; - REG_BLDALPHA = 0x0010; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0)); sprite->data[0]++; sprite->data[1] = 0; sprite->data[2] = 0; @@ -1068,31 +1094,31 @@ static void sub_80DF018(struct Sprite *sprite) { sprite->data[1] = 0; sprite->data[2]++; - REG_BLDALPHA = (16 - sprite->data[2]) | (sprite->data[2] << 8); + SetGpuReg(REG_OFFSET_BLDALPHA, (16 - sprite->data[2]) | (sprite->data[2] << 8)); if (sprite->data[2] == 16) { sprite->invisible = 1; - sprite->callback = sub_80DF090; + sprite->callback = sub_8112B44; } } } -static void sub_80DF090(struct Sprite *sprite) +static void sub_8112B44(struct Sprite *sprite) { - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); gBattle_WIN0H = 0; gBattle_WIN0V = 0; DestroyAnimSprite(sprite); } -static void sub_80DF0B8(struct Sprite *sprite) +static void sub_8112B78(struct Sprite *sprite) { u16 coeffB; u16 coeffA; sprite->pos2.x = Sin(sprite->data[0], 12); - if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos2.x = -sprite->pos2.x; sprite->data[0] = (sprite->data[0] + 6) & 0xFF; @@ -1103,8 +1129,8 @@ static void sub_80DF0B8(struct Sprite *sprite) if (sprite->data[7] == 1) { sprite->data[6] = 0x050B; - REG_BLDCNT = 0x3F40; - REG_BLDALPHA = sprite->data[6]; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, sprite->data[6]); } else if (sprite->data[7] > 30) { @@ -1117,44 +1143,44 @@ static void sub_80DF0B8(struct Sprite *sprite) if (--(s16)coeffA < 0) coeffA = 0; - REG_BLDALPHA = (coeffB << 8) | coeffA; - sprite->data[6] = (coeffB << 8) | coeffA; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(coeffA, coeffB)); + sprite->data[6] = BLDALPHA_BLEND(coeffA, coeffB); if (coeffB == 16 && coeffA == 0) { sprite->invisible = 1; - sprite->callback = sub_80DF18C; + sprite->callback = sub_8112C4C; } } } -static void sub_80DF18C(struct Sprite *sprite) +static void sub_8112C4C(struct Sprite *sprite) { - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); DestroyAnimSprite(sprite); } -void sub_80DF1A4(u8 taskId) +void sub_8112C6C(u8 taskId) { struct Task *task = &gTasks[taskId]; task->data[0] = 0; task->data[1] = 16; - task->data[9] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); - task->data[10] = sub_8077FC0(gAnimBankAttacker); - task->data[11] = (sub_807A100(gAnimBankAttacker, 1) / 2) + 8; + task->data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + task->data[10] = GetBattlerYCoordWithElevation(gBattleAnimAttacker); + task->data[11] = (sub_80A861C(gBattleAnimAttacker, 1) / 2) + 8; task->data[7] = 0; - task->data[5] = sub_8079ED4(gAnimBankAttacker); - task->data[6] = GetBattlerSubpriority(gAnimBankAttacker) - 2; + task->data[5] = sub_80A8328(gBattleAnimAttacker); + task->data[6] = sub_80A82E4(gBattleAnimAttacker) - 2; task->data[3] = 0; task->data[4] = 16; - REG_BLDCNT = 0x3F40; - REG_BLDALPHA = 0x1000; + SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10)); task->data[8] = 0; - task->func = sub_80DF24C; + task->func = sub_8112D10; } -static void sub_80DF24C(u8 taskId) +static void sub_8112D10(u8 taskId) { u16 i; u8 spriteId; @@ -1165,11 +1191,11 @@ static void sub_80DF24C(u8 taskId) case 0: for (i = 0; i < 6; i++) { - spriteId = CreateSprite(&gSpriteTemplate_83DAF80, task->data[9], task->data[10], task->data[6]); + spriteId = CreateSprite(&gUnknown_08596E30, task->data[9], task->data[10], task->data[6]); if (spriteId != MAX_SPRITES) { gSprites[spriteId].data[0] = taskId; - gSprites[spriteId].data[1] = GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER; + gSprites[spriteId].data[1] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER; gSprites[spriteId].data[2] = (i * 42) & 0xFF; gSprites[spriteId].data[3] = task->data[11]; @@ -1198,7 +1224,7 @@ static void sub_80DF24C(u8 taskId) task->data[0]++; } - REG_BLDALPHA = (task->data[4] << 8) | task->data[3]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4])); break; case 2: if (++task->data[1] > 30) @@ -1225,21 +1251,21 @@ static void sub_80DF24C(u8 taskId) task->data[0]++; } - REG_BLDALPHA = (task->data[4] << 8) | task->data[3]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4])); break; case 4: if (task->data[7] == 0) task->data[0]++; break; case 5: - REG_BLDCNT = 0; - REG_BLDALPHA = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); DestroyAnimVisualTask(taskId); break; } } -static void sub_80DF3D8(struct Sprite *sprite) +static void sub_8112E9C(struct Sprite *sprite) { u16 index; @@ -1267,20 +1293,20 @@ static void sub_80DF3D8(struct Sprite *sprite) } } -static void sub_80DF49C(struct Sprite *sprite) +static void sub_8112F60(struct Sprite *sprite) { sprite->invisible = 1; - sprite->data[5] = gBankSpriteIds[gAnimBankAttacker]; + sprite->data[5] = gBattlerSpriteIds[gBattleAnimAttacker]; sprite->data[0] = 128; sprite->data[1] = 10; sprite->data[2] = gBattleAnimArgs[0]; sprite->data[3] = gBattleAnimArgs[1]; - sprite->callback = sub_80DF4F4; + sprite->callback = sub_8112FB8; gSprites[sprite->data[5]].pos1.y += 8; } -static void sub_80DF4F4(struct Sprite *sprite) +static void sub_8112FB8(struct Sprite *sprite) { if (sprite->data[3]) { @@ -1298,5 +1324,4 @@ static void sub_80DF4F4(struct Sprite *sprite) gSprites[sprite->data[5]].pos1.y -= 8; sprite->callback = move_anim_8074EE0; } -}*/ - +}