From 95827ab64bc2fe148a3c52b0c341002deec72b0e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 27 Jan 2018 11:57:46 +0100 Subject: [PATCH] more pokemon anim functions decompiled --- asm/pokemon_animation.s | 3209 -------------------------------------- data/pokemon_animation.s | 10 - include/blend_palette.h | 10 +- src/pokemon_animation.c | 1310 +++++++++++++++- 4 files changed, 1309 insertions(+), 3230 deletions(-) diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index b45d5258b..562300f3f 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -7,3215 +7,6 @@ - thumb_func_start sub_8180714 -sub_8180714: @ 8180714 - push {r4-r6,lr} - adds r4, r0, 0 - movs r6, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818072A - adds r0, r4, 0 - bl HandleStartAffineAnim - strh r6, [r4, 0x34] -_0818072A: - adds r0, r4, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - cmp r2, r0 - ble _08180760 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - strh r6, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _081807FE - .pool -_08180760: - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08180796 - adds r2, r0, 0 - lsls r0, r2, 1 - cmp r1, r0 - bge _08180796 - movs r0, 0x80 - adds r1, r2, 0 - bl __divsi3 - ldrh r1, [r4, 0x34] - adds r1, r0 - strh r1, [r4, 0x34] -_08180796: - lsls r0, r5, 16 - asrs r1, r0, 16 - movs r2, 0x80 - lsls r2, 1 - adds r5, r0, 0 - cmp r1, r2 - ble _081807B0 - subs r0, r2, r1 - cmp r0, 0 - bge _081807AC - adds r0, 0x7 -_081807AC: - lsls r0, 13 - lsrs r6, r0, 16 -_081807B0: - movs r1, 0x34 - ldrsh r0, [r4, r1] - movs r1, 0xA - bl Sin - negs r0, r0 - lsls r1, r6, 16 - asrs r1, 16 - subs r0, r1 - strh r0, [r4, 0x26] - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - asrs r1, 16 - asrs r2, r5, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - movs r0, 0x2E - ldrsh r1, [r4, r0] - movs r0, 0x80 - bl __divsi3 - ldrh r1, [r4, 0x36] - adds r1, r0 - movs r0, 0xFF - ands r1, r0 - strh r1, [r4, 0x36] -_081807FE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8180714 - - thumb_func_start pokemonanimfunc_00 -pokemonanimfunc_00: @ 818080C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x10 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_8180714 - ldr r0, =sub_8180714 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_00 - - thumb_func_start sub_8180828 -sub_8180828: @ 8180828 - push {r4-r6,lr} - adds r5, r0, 0 - movs r6, 0 - movs r0, 0x32 - ldrsh r4, [r5, r0] - movs r2, 0x3A - ldrsh r1, [r5, r2] - movs r0, 0x80 - bl __divsi3 - movs r2, 0x3C - ldrsh r1, [r5, r2] - muls r0, r1 - cmp r4, r0 - ble _08180868 - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - strh r6, [r5, 0x26] - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r5, 0x1C] - b _081808D0 - .pool -_08180868: - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - ble _08180894 - subs r0, r1, r0 - cmp r0, 0 - bge _08180890 - adds r0, 0x7 -_08180890: - lsls r0, 13 - lsrs r6, r0, 16 -_08180894: - lsls r0, r6, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x30 - bl Sin - adds r1, r0, 0 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - lsls r2, r4, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x3A] - ldrh r1, [r5, 0x36] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x36] -_081808D0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8180828 - - thumb_func_start pokemonanimfunc_13 -pokemonanimfunc_13: @ 81808D8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081808F2 - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x3 - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] -_081808F2: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_13 - - thumb_func_start sub_8180900 -sub_8180900: @ 8180900 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x2E] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_03001240 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x6] - str r1, [sp] - ldr r5, =gUnknown_0860AD8E - movs r3, 0x36 - ldrsh r2, [r4, r3] - lsls r1, r2, 1 - adds r1, r2 - movs r3, 0x8 - ldrsh r2, [r0, r3] - lsls r0, r2, 1 - adds r0, r2 - lsls r6, r0, 3 - adds r1, r6 - adds r2, r1, r5 - adds r0, r5, 0x1 - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - ldrb r2, [r2] - lsls r2, 24 - asrs r2, 24 - mov r9, r2 - subs r0, r2 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldrh r7, [r4, 0x34] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818096C - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_0818096C: - movs r2, 0x36 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - adds r0, r6 - adds r5, 0x2 - mov r8, r5 - adds r1, r0, r5 - movs r5, 0 - ldrsb r5, [r1, r5] - cmp r5, 0 - bne _081809B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180A3A - .pool -_081809B0: - lsls r0, r7, 16 - asrs r5, r0, 16 - lsls r0, r5, 7 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - mov r3, r10 - lsls r0, r3, 16 - asrs r0, 16 - muls r0, r5 - movs r1, 0x36 - ldrsh r2, [r4, r1] - lsls r1, r2, 1 - adds r1, r2 - adds r1, r6 - add r1, r8 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl __divsi3 - add r0, r9 - strh r0, [r4, 0x24] - ldr r2, [sp] - lsls r0, r2, 16 - asrs r0, 16 - movs r3, 0x24 - ldrsh r1, [r4, r3] - muls r0, r1 - negs r0, r0 - cmp r0, 0 - bge _08180A04 - adds r0, 0x7 -_08180A04: - lsls r3, r0, 13 - lsrs r3, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - adds r0, r6 - add r0, r8 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r5, r0 - bne _08180A34 - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r0, 0 - b _08180A38 -_08180A34: - ldrh r0, [r4, 0x34] - adds r0, 0x1 -_08180A38: - strh r0, [r4, 0x34] -_08180A3A: - adds r0, r4, 0 - bl sub_817F70C - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8180900 - - thumb_func_start pokemonanimfunc_05 -pokemonanimfunc_05: @ 8180A50 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 5 - strh r0, [r1, 0x6] - ldrh r0, [r4, 0x3A] - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_8180900 - ldr r0, =sub_8180900 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_05 - - thumb_func_start pokemonanimfunc_20 -pokemonanimfunc_20: @ 8180A8C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180AA8 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180AA8: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180ACC - ldrh r0, [r4, 0x3C] - ldr r3, =0x000002df - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180AE8 - .pool -_08180ACC: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x000002df - movs r1, 0x10 - bl BlendPalette -_08180AE8: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_20 - - thumb_func_start pokemonanimfunc_21 -pokemonanimfunc_21: @ 8180AF8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180B14 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180B14: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180B34 - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0x1F - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180B50 - .pool -_08180B34: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - movs r1, 0x10 - movs r3, 0x1F - bl BlendPalette -_08180B50: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_21 - - thumb_func_start pokemonanimfunc_22 -pokemonanimfunc_22: @ 8180B5C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180B78 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180B78: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180B98 - ldrh r0, [r4, 0x3C] - movs r3, 0xF8 - lsls r3, 7 - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180BB6 - .pool -_08180B98: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - movs r3, 0xF8 - lsls r3, 7 - movs r1, 0x10 - bl BlendPalette -_08180BB6: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_22 - - thumb_func_start pokemonanimfunc_23 -pokemonanimfunc_23: @ 8180BC4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180BE0 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180BE0: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180C04 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180C20 - .pool -_08180C04: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x000003ff - movs r1, 0x10 - bl BlendPalette -_08180C20: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_23 - - thumb_func_start pokemonanimfunc_24 -pokemonanimfunc_24: @ 8180C30 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180C4C - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180C4C: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180C70 - ldrh r0, [r4, 0x3C] - ldr r3, =0x00006018 - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08180C8C - .pool -_08180C70: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x00006018 - movs r1, 0x10 - bl BlendPalette -_08180C8C: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_24 - - thumb_func_start pokemonanimfunc_25 -pokemonanimfunc_25: @ 8180C9C - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - ldr r0, =sub_8180CB4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_25 - - thumb_func_start sub_8180CB4 -sub_8180CB4: @ 8180CB4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x24] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _08180CD6 - movs r0, 0x8 - strh r0, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x3C] - ldr r0, =sub_8180CE8 - str r0, [r4, 0x1C] -_08180CD6: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180CB4 - - thumb_func_start sub_8180CE8 -sub_8180CE8: @ 8180CE8 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - ldrh r0, [r4, 0x3C] - subs r1, r0 - strh r1, [r4, 0x24] - adds r0, 0x1 - adds r2, r0, 0 - strh r0, [r4, 0x3C] - lsls r1, 16 - cmp r1, 0 - bgt _08180D32 - lsls r0, r2, 24 - lsrs r2, r0, 24 - movs r0, 0 - strh r0, [r4, 0x3A] - ldrh r1, [r4, 0x24] - ldr r5, =sub_8180D44 - movs r3, 0x8 - negs r3, r3 -_08180D14: - subs r0, r1, r2 - lsls r0, 16 - ldrh r1, [r4, 0x3A] - adds r1, 0x1 - strh r1, [r4, 0x3A] - adds r1, r2, 0x1 - lsls r1, 24 - lsrs r2, r1, 24 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, r3 - bgt _08180D14 - movs r0, 0x1 - strh r0, [r4, 0x38] - str r5, [r4, 0x1C] -_08180D32: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180CE8 - - thumb_func_start sub_8180D44 -sub_8180D44: @ 8180D44 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x3C] - subs r0, r1 - strh r0, [r4, 0x24] - adds r1, 0x1 - strh r1, [r4, 0x3C] - movs r0, 0x38 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl __divsi3 - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r1, [r4, r3] - cmp r0, r1 - ble _08180D84 - strh r2, [r4, 0x38] -_08180D84: - movs r2, 0x80 - lsls r2, 1 - lsls r3, r5, 8 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r1, 0x8 - negs r1, r1 - cmp r0, r1 - bge _08180DAE - strh r1, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0 - strh r0, [r4, 0x34] - strh r5, [r4, 0x32] - ldr r0, =sub_8180DC0 - str r0, [r4, 0x1C] -_08180DAE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180D44 - - thumb_func_start sub_8180DC0 -sub_8180DC0: @ 8180DC0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0xB - ble _08180E08 - ldrh r0, [r4, 0x32] - subs r0, 0x2 - strh r0, [r4, 0x32] - lsls r0, 16 - cmp r0, 0 - bge _08180DE2 - movs r0, 0 - strh r0, [r4, 0x32] -_08180DE2: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x32] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180E1C - ldr r0, =sub_8180E28 - str r0, [r4, 0x1C] - b _08180E1C - .pool -_08180E08: - ldrh r0, [r4, 0x36] - ldrh r2, [r4, 0x24] - adds r0, r2 - strh r0, [r4, 0x24] - movs r2, 0x36 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x36] - adds r0, r1, 0x1 - strh r0, [r4, 0x34] -_08180E1C: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8180DC0 - - thumb_func_start sub_8180E28 -sub_8180E28: @ 8180E28 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x2 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - ble _08180E4A - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08180E4A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180E28 - - thumb_func_start pokemonanimfunc_26 -pokemonanimfunc_26: @ 8180E5C - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r0, 0 - strh r0, [r4, 0x34] - ldr r0, =sub_8180E78 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_26 - - thumb_func_start sub_8180E78 -sub_8180E78: @ 8180E78 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x24] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08180EA2 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - bgt _08180EA2 - movs r0, 0xA - strh r0, [r4, 0x34] -_08180EA2: - movs r1, 0x24 - ldrsh r0, [r4, r1] - cmp r0, 0x7 - ble _08180EBA - movs r1, 0 - movs r0, 0x8 - strh r0, [r4, 0x24] - ldr r0, =0x0000fff8 - strh r0, [r4, 0x26] - strh r1, [r4, 0x36] - ldr r0, =sub_8180ED0 - str r0, [r4, 0x1C] -_08180EBA: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180E78 - - thumb_func_start sub_8180ED0 -sub_8180ED0: @ 8180ED0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Cos - subs r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x26] - movs r1, 0x36 - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08180F08 - movs r0, 0xA0 - strh r0, [r4, 0x32] - movs r0, 0xA - strh r0, [r4, 0x34] - ldr r0, =sub_8180F2C - str r0, [r4, 0x1C] -_08180F08: - ldrh r0, [r4, 0x36] - adds r0, 0x8 - strh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x40 - ble _08180F1A - movs r0, 0x40 - strh r0, [r4, 0x36] -_08180F1A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180ED0 - - thumb_func_start sub_8180F2C -sub_8180F2C: @ 8180F2C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08180F44 - subs r0, r1, 0x1 - strh r0, [r4, 0x34] - b _08180F96 -_08180F44: - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl Cos - subs r0, 0x4 - movs r5, 0 - strh r0, [r4, 0x24] - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0x5 - bl Sin - negs r0, r0 - adds r0, 0x4 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - subs r0, 0x4 - strh r0, [r4, 0x32] - movs r0, 0x32 - ldrsh r3, [r4, r0] - subs r3, 0x20 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 25 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bgt _08180F96 - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08180F96: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180F2C - - thumb_func_start pokemonanimfunc_27 -pokemonanimfunc_27: @ 8180FA8 - push {r4,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x34] - movs r2, 0x34 - ldrsh r0, [r3, r2] - cmp r0, 0 - ble _08180FBA - subs r0, r1, 0x1 - b _08180FFE -_08180FBA: - movs r2, 0 - movs r1, 0x36 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _08180FC6 - movs r2, 0x1 -_08180FC6: - strh r2, [r3, 0x36] - movs r0, 0x3E - adds r0, r3 - mov r12, r0 - lsls r2, 2 - ldrb r1, [r0] - movs r4, 0x5 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - orrs r0, r2 - mov r1, r12 - strb r0, [r1] - ldrh r0, [r3, 0x32] - adds r0, 0x1 - strh r0, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _08180FFC - ldrb r0, [r1] - adds r1, r4, 0 - ands r1, r0 - mov r2, r12 - strb r1, [r2] - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r3, 0x1C] -_08180FFC: - movs r0, 0x2 -_08180FFE: - strh r0, [r3, 0x34] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_27 - - thumb_func_start pokemonanimfunc_28 -pokemonanimfunc_28: @ 818100C - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - ldr r0, =sub_8181024 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_28 - - thumb_func_start sub_8181024 -sub_8181024: @ 8181024 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - subs r0, 0x1 - strh r0, [r4, 0x24] - ldrh r1, [r4, 0x26] - adds r1, 0x1 - strh r1, [r4, 0x26] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bgt _08181054 - ldr r0, =0x0000fff0 - strh r0, [r4, 0x24] - movs r0, 0x10 - strh r0, [r4, 0x26] - ldr r0, =sub_8181068 - str r0, [r4, 0x1C] - movs r0, 0xA0 - strh r0, [r4, 0x32] -_08181054: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181024 - - thumb_func_start sub_8181068 -sub_8181068: @ 8181068 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - subs r0, 0x4 - strh r0, [r4, 0x32] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x16 - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x16 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r0, 0x32 - ldrsh r3, [r4, r0] - subs r3, 0x20 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 25 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bgt _081810B2 - ldr r0, =sub_81810C4 - str r0, [r4, 0x1C] -_081810B2: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181068 - - thumb_func_start sub_81810C4 -sub_81810C4: @ 81810C4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - subs r1, 0x1 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - cmp r1, 0 - bgt _081810E8 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_081810E8: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81810C4 - - thumb_func_start pokemonanimfunc_29 -pokemonanimfunc_29: @ 81810F8 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - ldr r0, =sub_8181110 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_29 - - thumb_func_start sub_8181110 -sub_8181110: @ 8181110 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - adds r1, 0x1 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0xF - ble _08181134 - movs r0, 0 - strh r0, [r4, 0x32] - ldr r0, =sub_8181144 - str r0, [r4, 0x1C] -_08181134: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181110 - - thumb_func_start sub_8181144 -sub_8181144: @ 8181144 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - adds r0, 0x10 - strh r0, [r4, 0x32] - ldrh r2, [r4, 0x24] - movs r0, 0x24 - ldrsh r1, [r4, r0] - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - bgt _0818117C - ldr r0, =0x0000fff0 - strh r0, [r4, 0x24] - movs r0, 0x10 - strh r0, [r4, 0x26] - movs r0, 0 - strh r0, [r4, 0x32] - ldr r0, =sub_81811A4 - str r0, [r4, 0x1C] - b _08181186 - .pool -_0818117C: - subs r0, r2, 0x2 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] -_08181186: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x32] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181144 - - thumb_func_start sub_81811A4 -sub_81811A4: @ 81811A4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - adds r1, 0x1 - movs r2, 0 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - cmp r1, 0 - blt _081811CE - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_081811CE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81811A4 - - thumb_func_start pokemonanimfunc_2A -pokemonanimfunc_2A: @ 81811E0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x2 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_8181214 - ldr r0, =sub_8181214 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2A - - thumb_func_start sub_8181214 -sub_8181214: @ 8181214 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrh r0, [r1] - cmp r0, 0 - beq _08181238 - subs r0, 0x1 - strh r0, [r1] - b _0818134A - .pool -_08181238: - adds r0, r4, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - movs r1, 0x32 - ldrsh r5, [r4, r1] - cmp r5, 0 - bne _08181270 - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r2, 0x2E - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrh r0, [r0, 0x2] - strh r0, [r4, 0x3C] - ldr r0, =0x0000ffff - strh r0, [r4, 0x34] - movs r0, 0x1 - negs r0, r0 - strh r0, [r4, 0x36] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3A] -_08181270: - movs r3, 0x3C - ldrsh r1, [r4, r3] - movs r6, 0x34 - ldrsh r0, [r4, r6] - lsls r0, 1 - muls r1, r0 - ldrh r0, [r4, 0x24] - adds r1, r0 - strh r1, [r4, 0x24] - ldrh r2, [r4, 0x3C] - ldrh r0, [r4, 0x36] - adds r3, r0, 0 - muls r3, r2 - adds r0, r3, 0 - ldrh r6, [r4, 0x26] - adds r2, r0, r6 - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x3A] - adds r0, 0x8 - strh r0, [r4, 0x3A] - adds r1, 0xF - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x1E - bls _081812B8 - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 4 - strh r0, [r4, 0x24] - movs r2, 0x34 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x34] - b _081812D4 - .pool -_081812B8: - adds r0, r2, 0 - adds r0, 0xF - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bls _081812DA - movs r3, 0x36 - ldrsh r0, [r4, r3] - lsls r0, 4 - strh r0, [r4, 0x26] - movs r6, 0x36 - ldrsh r0, [r4, r6] - negs r0, r0 - strh r0, [r4, 0x36] -_081812D4: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081812DA: - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - ble _08181332 - movs r2, 0x24 - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08181332 - movs r3, 0 - strh r3, [r4, 0x24] - strh r3, [r4, 0x26] - ldr r5, =gUnknown_03001240 - movs r6, 0x2E - ldrsh r0, [r4, r6] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r2, [r1, 0x4] - movs r6, 0x4 - ldrsh r0, [r1, r6] - cmp r0, 0x1 - ble _08181328 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r4, 0x38] - strh r3, [r4, 0x3A] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xA - strh r1, [r0] - b _08181332 - .pool -_08181328: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08181332: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F70C -_0818134A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181214 - - thumb_func_start pokemonanimfunc_2B -pokemonanimfunc_2B: @ 8181354 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r0, 0 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] - ldr r0, =sub_8181370 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2B - - thumb_func_start sub_8181370 -sub_8181370: @ 8181370 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - movs r1, 0x3A - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 1 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0xC0 - ble _081813BA - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _081813BA - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - b _081813D2 -_081813BA: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x40 - ble _081813DE - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081813DE - ldr r1, =0xffffff00 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 -_081813D2: - movs r3, 0 - bl HandleSetAffineData - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] -_081813DE: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0xFF - ble _08181404 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08181404: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181370 - - thumb_func_start pokemonanimfunc_2C -pokemonanimfunc_2C: @ 8181418 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08181442 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - strh r2, [r4, 0x3A] - strh r2, [r4, 0x38] - strh r2, [r4, 0x36] -_08181442: - ldr r1, =gUnknown_0860AA64 - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r2, r0, 1 - adds r0, r1, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08181464 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _081814CE - .pool -_08181464: - movs r3, 0x36 - ldrsh r0, [r4, r3] - cmp r0, 0x1 - bne _0818149A - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08181488 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - b _08181494 - .pool -_08181488: - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette -_08181494: - movs r0, 0 - strh r0, [r4, 0x36] - ldr r1, =gUnknown_0860AA64 -_0818149A: - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - bne _081814C8 - movs r1, 0 - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - b _081814CE - .pool -_081814C8: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081814CE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_2C - - thumb_func_start sub_81814D4 -sub_81814D4: @ 81814D4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081814E6 - adds r0, r6, 0 - bl HandleStartAffineAnim -_081814E6: - adds r0, r6, 0 - bl sub_817F70C - ldr r4, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r6, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r3, 0x8 - ldrsh r0, [r2, r3] - cmp r1, r0 - ble _0818154C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r3, 0 - strh r3, [r6, 0x24] - movs r0, 0x2E - ldrsh r1, [r6, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r2, [r1, 0x4] - movs r4, 0x4 - ldrsh r0, [r1, r4] - cmp r0, 0x1 - ble _0818153C - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r6, 0x32] - b _08181588 - .pool -_0818153C: - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r6, 0x1C] - b _08181588 - .pool -_0818154C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r3, 0x8 - ldrsh r1, [r2, r3] - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r6, 0x24] - movs r5, 0x80 - lsls r5, 1 - ldr r1, =0x00000ccc - adds r0, r4, 0 - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl HandleSetAffineData -_08181588: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81814D4 - - thumb_func_start pokemonanimfunc_2D -pokemonanimfunc_2D: @ 81815A0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81814D4 - ldr r0, =sub_81814D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2D - - thumb_func_start sub_81815D4 -sub_81815D4: @ 81815D4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081815E6 - adds r0, r6, 0 - bl HandleStartAffineAnim -_081815E6: - adds r0, r6, 0 - bl sub_817F70C - ldr r4, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r6, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r3, 0x8 - ldrsh r0, [r2, r3] - cmp r1, r0 - ble _0818164C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r3, 0 - strh r3, [r6, 0x24] - movs r0, 0x2E - ldrsh r1, [r6, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r2, [r1, 0x4] - movs r4, 0x4 - ldrsh r0, [r1, r4] - cmp r0, 0x1 - ble _0818163C - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r6, 0x32] - b _0818168A - .pool -_0818163C: - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r6, 0x1C] - b _0818168A - .pool -_0818164C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r3, 0x8 - ldrsh r1, [r2, r3] - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r6, 0x24] - movs r5, 0x80 - lsls r5, 1 - ldr r1, =0x00000ccc - adds r0, r4, 0 - bl Sin - adds r3, r0, 0 - negs r3, r3 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl HandleSetAffineData -_0818168A: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81815D4 - - thumb_func_start pokemonanimfunc_2E -pokemonanimfunc_2E: @ 81816A0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81815D4 - ldr r0, =sub_81815D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2E - - thumb_func_start pokemonanimfunc_2F -pokemonanimfunc_2F: @ 81816D4 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - adds r0, r4, 0 - adds r0, 0x28 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - movs r1, 0xA - bl __divsi3 - negs r0, r0 - strh r0, [r4, 0x3A] - movs r0, 0x80 - strh r0, [r4, 0x3C] - ldr r0, =sub_8181708 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2F - - thumb_func_start sub_8181708 -sub_8181708: @ 8181708 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - subs r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Cos - ldrh r1, [r4, 0x3A] - adds r0, r1 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - subs r3, 0x80 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x78 - bgt _08181760 - movs r0, 0x78 - strh r0, [r4, 0x3C] - movs r0, 0 - strh r0, [r4, 0x34] - ldr r0, =sub_8181770 - str r0, [r4, 0x1C] -_08181760: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181708 - - thumb_func_start sub_8181770 -sub_8181770: @ 8181770 - push {lr} - adds r1, r0, 0 - movs r2, 0x34 - ldrsh r0, [r1, r2] - cmp r0, 0x14 - bne _08181784 - ldr r0, =sub_8181794 - str r0, [r1, 0x1C] - movs r0, 0 - strh r0, [r1, 0x34] -_08181784: - ldrh r0, [r1, 0x34] - adds r0, 0x1 - strh r0, [r1, 0x34] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181770 - - thumb_func_start sub_8181794 -sub_8181794: @ 8181794 - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - adds r0, 0x2 - movs r6, 0 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Cos - ldrh r1, [r4, 0x3A] - adds r0, r1 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r5, 0x80 - lsls r5, 1 - ldrh r3, [r4, 0x3C] - subs r3, 0x80 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl HandleSetAffineData - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _08181800 - strh r6, [r4, 0x24] - strh r6, [r4, 0x26] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - movs r3, 0 - bl HandleSetAffineData - strh r6, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =pokemonanimfunc_10 - str r0, [r4, 0x1C] -_08181800: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181794 - - thumb_func_start sub_8181810 -sub_8181810: @ 8181810 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r4, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r0, [r1] - adds r6, r0, 0 - cmp r6, 0 - beq _08181834 - subs r0, 0x1 - strh r0, [r1] - b _08181950 - .pool -_08181834: - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0818184A - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r6, [r5, 0x36] - strh r6, [r5, 0x38] - movs r0, 0x1 - strh r0, [r5, 0x32] -_0818184A: - movs r3, 0x38 - ldrsh r0, [r5, r3] - cmp r0, 0 - bne _081818A2 - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - bl Sin - strh r0, [r5, 0x3C] - movs r3, 0x36 - ldrsh r0, [r5, r3] - movs r1, 0x10 - bl Sin - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - adds r1, r0, 0 - strh r1, [r5, 0x3A] - subs r1, r4, r1 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r5, 0x3C] - adds r2, r4 - lsls r2, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl HandleSetAffineData - movs r3, 0x36 - ldrsh r0, [r5, r3] - cmp r0, 0x80 - bne _0818193A - strh r6, [r5, 0x36] - movs r0, 0x1 - strh r0, [r5, 0x38] - b _0818193A -_081818A2: - cmp r0, 0x1 - bne _0818193A - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - strh r0, [r5, 0x3C] - movs r3, 0x36 - ldrsh r0, [r5, r3] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x80 - bl Sin - adds r1, r0, 0 - strh r1, [r5, 0x3A] - movs r3, 0x80 - lsls r3, 1 - adds r2, r3, 0 - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - ldrh r0, [r5, 0x3C] - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl HandleSetAffineData - movs r1, 0x36 - ldrsh r0, [r5, r1] - cmp r0, 0x80 - bne _0818193A - movs r3, 0x2E - ldrsh r0, [r5, r3] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r2, [r1, 0x4] - movs r3, 0x4 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _08181922 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xA - strh r1, [r0] - strh r6, [r5, 0x36] - strh r6, [r5, 0x38] - b _0818193A -_08181922: - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r5, 0x1C] -_0818193A: - ldr r2, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r5, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x6] - ldrh r1, [r5, 0x36] - adds r0, r1 - strh r0, [r5, 0x36] -_08181950: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181810 - - thumb_func_start pokemonanimfunc_30 -pokemonanimfunc_30: @ 8181960 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - adds r0, r4, 0 - bl sub_8181810 - ldr r0, =sub_8181810 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_30 - - thumb_func_start pokemonanimfunc_31 -pokemonanimfunc_31: @ 8181994 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r4, [r5, r0] - adds r0, r5, 0 - bl sub_817F70C - movs r0, 0x80 - lsls r0, 2 - cmp r4, r0 - ble _081819B8 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r5, 0x1C] - movs r0, 0 - strh r0, [r5, 0x24] - b _08181A62 - .pool -_081819B8: - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _081819C2 - adds r0, 0x7F -_081819C2: - asrs r0, 7 - cmp r0, 0x1 - beq _081819F8 - cmp r0, 0x1 - bgt _081819D2 - cmp r0, 0 - beq _081819DC - b _08181A48 -_081819D2: - cmp r0, 0x2 - beq _08181A12 - cmp r0, 0x3 - beq _08181A2A - b _08181A48 -_081819DC: - adds r0, r4, 0 - cmp r4, 0 - bge _081819E4 - adds r0, 0x7F -_081819E4: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _081819F4 - adds r0, 0x7F -_081819F4: - asrs r0, 7 - b _08181A46 -_081819F8: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A00 - adds r0, 0x7F -_08181A00: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - cmp r0, 0 - bge _08181A0C - adds r0, 0xF -_08181A0C: - asrs r0, 4 - subs r0, 0x8 - b _08181A46 -_08181A12: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A1A - adds r0, 0x7F -_08181A1A: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - cmp r0, 0 - bge _08181A26 - adds r0, 0xF -_08181A26: - asrs r0, 4 - b _08181A46 -_08181A2A: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A32 - adds r0, 0x7F -_08181A32: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _08181A42 - adds r0, 0x7F -_08181A42: - asrs r0, 7 - adds r0, 0x8 -_08181A46: - strh r0, [r5, 0x24] -_08181A48: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A50 - adds r0, 0x7F -_08181A50: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_08181A62: - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x32] - adds r0, 0xC - strh r0, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_31 - - thumb_func_start pokemonanimfunc_32 -pokemonanimfunc_32: @ 8181A78 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldr r0, =0x0000ffff - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl HandleStartAffineAnim - strh r5, [r4, 0x34] - adds r0, r4, 0 - bl sub_8181ABC - ldr r0, =sub_8181ABC - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_32 - - thumb_func_start sub_8181ABC -sub_8181ABC: @ 8181ABC - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrh r0, [r1] - adds r5, r0, 0 - cmp r5, 0 - beq _08181AE0 - subs r0, 0x1 - strh r0, [r1] - b _08181B44 - .pool -_08181AE0: - adds r0, r4, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r0, 0x80 - ble _08181AFC - strh r5, [r4, 0x32] - ldr r0, =sub_8181B4C - str r0, [r4, 0x1C] - b _08181B3E - .pool -_08181AFC: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - movs r3, 0x8 - ldrsh r0, [r1, r3] - lsls r3, r0, 3 - adds r0, r2, 0 - cmp r2, 0 - bge _08181B16 - adds r0, 0x7F -_08181B16: - asrs r0, 7 - lsls r0, 7 - subs r1, r2, r0 - adds r0, r3, 0 - muls r0, r1 - cmp r0, 0 - bge _08181B26 - adds r0, 0x7F -_08181B26: - asrs r0, 7 - strh r0, [r4, 0x24] - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] -_08181B3E: - adds r0, r4, 0 - bl sub_817F70C -_08181B44: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8181ABC - - thumb_func_start sub_8181B4C -sub_8181B4C: @ 8181B4C - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x30 - ble _08181B7C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r0, 0 - strh r0, [r4, 0x26] - strh r0, [r4, 0x32] - ldr r0, =sub_8181C2C - str r0, [r4, 0x1C] - b _08181C1A - .pool -_08181B7C: - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x40 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r6, r1, 0 - adds r0, r6 - lsls r0, 16 - lsrs r3, r0, 16 - ldrh r0, [r4, 0x32] - subs r0, 0x10 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xF - bhi _08181BBA - ldrh r0, [r4, 0x34] - adds r0, 0x8 - strh r0, [r4, 0x34] - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x24] - ldrh r0, [r0, 0x8] - subs r1, r0 - strh r1, [r4, 0x24] -_08181BBA: - movs r5, 0 - lsls r1, r3, 16 - asrs r2, r1, 16 - lsls r0, r6, 16 - asrs r0, 16 - adds r6, r1, 0 - cmp r2, r0 - ble _08181BD6 - subs r0, r2 - cmp r0, 0 - bge _08181BD2 - adds r0, 0x7 -_08181BD2: - lsls r0, 13 - lsrs r5, r0, 16 -_08181BD6: - movs r1, 0x34 - ldrsh r0, [r4, r1] - movs r1, 0x14 - bl Sin - negs r0, r0 - lsls r1, r5, 16 - asrs r1, 16 - subs r0, r1 - strh r0, [r4, 0x26] - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - asrs r1, 16 - asrs r2, r6, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x36] - adds r0, 0x8 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x36] -_08181C1A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181B4C - - thumb_func_start sub_8181C2C -sub_8181C2C: @ 8181C2C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r3, [r4, r0] - cmp r3, 0x80 - ble _08181C90 - ldr r3, =gUnknown_03001240 - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrh r2, [r1, 0x4] - movs r5, 0x4 - ldrsh r0, [r1, r5] - cmp r0, 0x1 - ble _08181C7C - subs r0, r2, 0x1 - movs r2, 0 - strh r0, [r1, 0x4] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0xA - strh r1, [r0] - strh r2, [r4, 0x34] - strh r2, [r4, 0x32] - strh r2, [r4, 0x36] - ldr r0, =sub_8181ABC - b _08181C84 - .pool -_08181C7C: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd -_08181C84: - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _08181CD0 - .pool -_08181C90: - ldr r2, =gUnknown_03001240 - movs r5, 0x2E - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x8 - ldrsh r5, [r0, r1] - lsls r1, r5, 3 - adds r0, r3, 0 - cmp r3, 0 - bge _08181CAC - adds r0, 0x7F -_08181CAC: - asrs r0, 7 - lsls r0, 7 - subs r2, r3, r0 - adds r0, r1, 0 - muls r0, r2 - cmp r0, 0 - bge _08181CBC - adds r0, 0x7F -_08181CBC: - asrs r0, 7 - lsls r1, r5, 3 - subs r0, r1 - strh r0, [r4, 0x24] - lsls r0, r2, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_08181CD0: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181C2C - - thumb_func_start sub_8181CE8 -sub_8181CE8: @ 8181CE8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08181D00 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08181D00: - adds r0, r4, 0 - bl sub_817F70C - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r0, 0xFE - ble _08181D60 - movs r5, 0 - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - ldrh r2, [r1, 0x4] - movs r3, 0x4 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _08181D48 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r5, [r4, 0x32] - strh r5, [r4, 0x3C] - b _08181D52 - .pool -_08181D48: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08181D52: - adds r0, r4, 0 - bl sub_817F70C - b _08181DA6 - .pool -_08181D60: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r3, 0x3C - ldrsh r0, [r4, r3] - movs r1, 0x20 - bl Sin - adds r3, r0, 0 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x6] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F70C -_08181DA6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181CE8 - - thumb_func_start pokemonanimfunc_33 -pokemonanimfunc_33: @ 8181DB0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - adds r0, r4, 0 - bl sub_8181CE8 - ldr r0, =sub_8181CE8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_33 - - thumb_func_start pokemonanimfunc_34 -pokemonanimfunc_34: @ 8181DE4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08181DFC - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08181DFC: - adds r0, r4, 0 - bl sub_817F70C - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0xFE - ble _08181E34 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - adds r0, r4, 0 - bl sub_817F70C - b _08181E8A - .pool -_08181E34: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08181E4E - adds r0, 0x7F -_08181E4E: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - adds r3, r0, 0 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F70C -_08181E8A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_34 - - thumb_func_start pokemonanimfunc_35 -pokemonanimfunc_35: @ 8181E90 - push {r4,r5,lr} - adds r3, r0, 0 - movs r1, 0x32 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _08181E9E - strh r0, [r3, 0x3C] -_08181E9E: - ldrh r4, [r3, 0x32] - movs r5, 0x32 - ldrsh r1, [r3, r5] - ldrh r2, [r3, 0x3C] - movs r5, 0x3C - ldrsh r0, [r3, r5] - cmp r1, r0 - bne _08181EC8 - movs r0, 0 - strh r0, [r3, 0x3C] - adds r0, r4, 0x1 - strh r0, [r3, 0x32] - adds r1, r3, 0 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r2, r1, 0 - b _08181ED8 -_08181EC8: - adds r0, r2, 0x1 - strh r0, [r3, 0x3C] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_08181ED8: - movs r1, 0x32 - ldrsh r0, [r3, r1] - cmp r0, 0xA - ble _08181EEE - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r3, 0x1C] -_08181EEE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_35 - - thumb_func_start pokemonanimfunc_36 -pokemonanimfunc_36: @ 8181EF8 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r0, 0 - strh r0, [r4, 0x3C] - ldr r0, =sub_8181F14 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_36 - - thumb_func_start sub_8181F14 -sub_8181F14: @ 8181F14 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x1F - ble _08181F34 - movs r0, 0 - movs r1, 0x20 - strh r1, [r4, 0x3C] - strh r0, [r4, 0x32] - ldr r0, =sub_8181F50 - str r0, [r4, 0x1C] - b _08181F38 - .pool -_08181F34: - adds r0, r1, 0x4 - strh r0, [r4, 0x3C] -_08181F38: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181F14 - - thumb_func_start sub_8181F50 -sub_8181F50: @ 8181F50 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08181F74 - ldr r0, =sub_8181FC0 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08181FAE - .pool -_08181F74: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 4 - negs r0, r0 - cmp r0, 0 - bge _08181F84 - ldr r1, =0x000001ff - adds r0, r1 -_08181F84: - asrs r0, 9 - strh r0, [r4, 0x24] - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08181F94 - adds r0, 0x7F -_08181F94: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] -_08181FAE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181F50 - - thumb_func_start sub_8181FC0 -sub_8181FC0: @ 8181FC0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - subs r0, 0x2 - movs r1, 0 - strh r0, [r4, 0x3C] - lsls r0, 16 - cmp r0, 0 - bge _08181FEC - strh r1, [r4, 0x3C] - strh r1, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08181FFE - .pool -_08181FEC: - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsls r0, 17 - asrs r0, 16 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] -_08181FFE: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181FC0 - thumb_func_start pokemonanimfunc_37 pokemonanimfunc_37: @ 818201C push {r4,r5,lr} diff --git a/data/pokemon_animation.s b/data/pokemon_animation.s index ef9a35a49..08254b40d 100644 --- a/data/pokemon_animation.s +++ b/data/pokemon_animation.s @@ -3,16 +3,6 @@ .section .rodata -gUnknown_0860AD70:: @ 860AD70 - .byte 0xff, 0xff, 0x06, 0x02, 0x00, 0x06, 0xfe, 0x02, 0x06, 0x02, 0x00, 0x06, 0xfe, 0xfe, 0x06, 0x02, 0x00, 0x06, 0xfe, 0x02, 0x06, 0x02, 0x00, 0x06, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00 - -gUnknown_0860AD8E:: @ 860AD8E - .byte 0x00, 0x08, 0x08, 0x08, 0xf8, 0x0c, 0xf8, 0x08, 0x0c, 0x08, 0xf8, 0x0c, 0xf8, 0x08, 0x0c, 0x08, 0xf8, 0x0c, 0xf8, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x08, 0xf8, 0x18, 0xf8, 0x08 - .byte 0x18, 0x08, 0xf8, 0x18, 0xf8, 0x08, 0x18, 0x08, 0xf8, 0x18, 0xf8, 0x00, 0x18, 0x00, 0x00, 0x00 - -gUnknown_0860ADBE:: @ 860ADBE - .byte 0x01, 0x01, 0x0c, 0xfe, 0x00, 0x0c, 0x01, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 - gUnknown_0860ADCC:: @ 860ADCC .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 .byte 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 diff --git a/include/blend_palette.h b/include/blend_palette.h index 1db3f4eb0..a00847bc3 100644 --- a/include/blend_palette.h +++ b/include/blend_palette.h @@ -1,12 +1,6 @@ #ifndef GUARD_BLEND_PALETTE_H #define GUARD_BLEND_PALETTE_H -// Exported type declarations +void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); -// Exported RAM declarations - -// Exported ROM declarations - -void BlendPalette(u16, u16, u8, u16); - -#endif //GUARD_BLEND_PALETTE_H +#endif // GUARD_BLEND_PALETTE_H diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 1cac2c473..87949e88b 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -592,7 +592,23 @@ static const u8 sSpeciesToBackAnimId[] = 0x11, // SPECIES_CHIMECHO }; -const u8 gUnknown_0860AA64[] = {0x00, 0x05, 0x01, 0x01, 0x00, 0x0f, 0x01, 0x04, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x00, 0xff}; +const u8 gUnknown_0860AA64[][2] = +{ + {0, 5}, + {1, 1}, + {0, 15}, + {1, 4}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {0, 0xFF} +}; const u8 gUnknown_0860AA80[][2] = { @@ -834,8 +850,6 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_860AD68[] = gSpriteAffineAnim_860AD58 }; -extern const s8 gUnknown_0860AD70[][3]; - // code void MonAnimDummySpriteCallback(struct Sprite *sprite) { @@ -1301,6 +1315,20 @@ void pokemonanimfunc_09(struct Sprite *sprite) sprite->data[2]++; } +static const s8 gUnknown_0860AD70[][3] = +{ + {-1, -1, 6}, + {2, 0, 6}, + {-2, 2, 6}, + {2, 0, 6}, + {-2, -2, 6}, + {2, 0, 6}, + {-2, 2, 6}, + {2, 0, 6}, + {-1, -1, 6}, + {0, 0, 0}, +}; + void sub_817FC20(struct Sprite *sprite) { sub_817F70C(sprite); @@ -1828,3 +1856,1279 @@ void pokemonanimfunc_1D(struct Sprite *sprite) sprite->data[2]++; sub_817F70C(sprite); } + +void sub_8180714(struct Sprite *sprite) +{ + s16 posY = 0; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + } + + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0] * 3) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale = Sin(sprite->data[4], 32) + 256; + + if (sprite->data[2] > sprite->data[0] && sprite->data[2] < sprite->data[0] * 2) + sprite->data[3] += (128 / sprite->data[0]); + if (yScale > 256) + posY = (256 - yScale) / 8; + + sprite->pos2.y = -(Sin(sprite->data[3], 10)) - posY; + HandleSetAffineData(sprite, 0x100 - Sin(sprite->data[4], 32), yScale, 0); + sprite->data[2]++; + sprite->data[4] = (sprite->data[4] + 128 / sprite->data[0]) & 0xFF; + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_00(struct Sprite *sprite) +{ + sprite->data[0] = 16; + sub_8180714(sprite); + sprite->callback = sub_8180714; +} + +void sub_8180828(struct Sprite *sprite) +{ + s16 posY = 0; + + if (sprite->data[2] > (128 / sprite->data[6]) * sprite->data[7]) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale = Sin(sprite->data[4], 32) + 256; + + if (yScale > 256) + posY = (256 - yScale) / 8; + + sprite->pos2.y = -(posY); + HandleSetAffineData(sprite, Sin(sprite->data[4], 48) + 256, yScale, 0); + sprite->data[2]++; + sprite->data[4] = (sprite->data[4] + sprite->data[6]) & 0xFF; + } +} + +void pokemonanimfunc_13(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 3; + sprite->data[6] = 8; + } + + sub_8180828(sprite); +} + +static const s8 gUnknown_0860AD8E[][8][3] = +{ + { + {0, 8, 8}, + {8, -8, 12}, + {-8, 8, 12}, + {8, -8, 12}, + {-8, 8, 12}, + {8, -8, 12}, + {-8, 0, 12}, + {0, 0, 0} + }, + { + {0, 8, 16}, + {8, -8, 24}, + {-8, 8, 24}, + {8, -8, 24}, + {-8, 8, 24}, + {8, -8, 24}, + {-8, 0, 24}, + {0, 0, 0} + }, +}; + +void sub_8180900(struct Sprite *sprite) +{ + s16 var; + u8 structId; + s8 r9; + s16 r10; + s16 r7; + u32 arrId; + + sub_817F70C(sprite); + structId = sprite->data[0]; + var = gUnknown_03001240[structId].field_6; + r9 = gUnknown_0860AD8E[gUnknown_03001240[structId].field_8][sprite->data[4]][0]; + r10 = gUnknown_0860AD8E[gUnknown_03001240[structId].field_8][sprite->data[4]][1] - r9; + arrId = gUnknown_03001240[structId].field_8; + r7 = sprite->data[3]; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + if (gUnknown_0860AD8E[arrId][sprite->data[4]][2] == 0) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + u16 rotation; + + sprite->pos2.y = -(Sin(r7 * 128 / gUnknown_0860AD8E[arrId][sprite->data[4]][2], 10)); + sprite->pos2.x = (r10 * r7 / gUnknown_0860AD8E[arrId][sprite->data[4]][2]) + r9; + + rotation = -(var * sprite->pos2.x) / 8; + HandleSetAffineData(sprite, 0x100, 0x100, rotation); + + if (r7 == gUnknown_0860AD8E[arrId][sprite->data[4]][2]) + { + sprite->data[4]++; + sprite->data[3] = 0; + } + else + { + sprite->data[3]++; + } + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_05(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_6 = 4096; + gUnknown_03001240[id].field_8 = sprite->data[6]; + sub_8180900(sprite); + sprite->callback = sub_8180900; +} + +const u8 gUnknown_0860ADBE[] = {0x01, 0x01, 0x0c, 0xfe, 0x00, 0x0c, 0x01, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00}; + +void pokemonanimfunc_20(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, 0x2DF); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x2DF); + } + + sprite->data[2] += 2; +} + +void pokemonanimfunc_21(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, 0x1F); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x1F); + } + + sprite->data[2] += 2; +} + +void pokemonanimfunc_22(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, 0x7C00); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x7C00); + } + + sprite->data[2] += 2; +} + +void pokemonanimfunc_23(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x3FF); + } + + sprite->data[2] += 2; +} + +void pokemonanimfunc_24(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, 0x6018); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x6018); + } + + sprite->data[2] += 2; +} + +void sub_8180CB4(struct Sprite *sprite); +void sub_8180CE8(struct Sprite *sprite); +void sub_8180D44(struct Sprite *sprite); +void sub_8180DC0(struct Sprite *sprite); +void sub_8180E28(struct Sprite *sprite); + +void pokemonanimfunc_25(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8180CB4; +} + +void sub_8180CB4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (++sprite->pos2.x > 7) + { + sprite->pos2.x = 8; + sprite->data[7] = 2; + sprite->callback = sub_8180CE8; + } + sub_817F70C(sprite); +} + +void sub_8180CE8(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + sprite->pos2.x -= sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x <= 0) + { + s16 subResult; + u8 var = sprite->data[7]; + sprite->data[6] = 0; + subResult = sprite->pos2.x; + + do + { + subResult -= var; + sprite->data[6]++; + var++; + } + while (subResult > -8); + + sprite->data[5] = 1; + sprite->callback = sub_8180D44; + } + + sub_817F70C(sprite); +} + +void sub_8180D44(struct Sprite *sprite) +{ + u8 rotation; + + sub_817F70C(sprite); + sprite->pos2.x -= sprite->data[7]; + sprite->data[7]++; + rotation = (sprite->data[5] * 6) / sprite->data[6]; + + if (++sprite->data[5] > sprite->data[6]) + sprite->data[5] = sprite->data[6]; + + HandleSetAffineData(sprite, 0x100, 0x100, rotation * 256); + + if (sprite->pos2.x < -8) + { + sprite->pos2.x = -8; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = rotation; + sprite->callback = sub_8180DC0; + } + + sub_817F70C(sprite); +} + +void sub_8180DC0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[3] > 11) + { + sprite->data[2] -= 2; + if (sprite->data[2] < 0) + sprite->data[2] = 0; + + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[2] << 8); + if (sprite->data[2] == 0) + sprite->callback = sub_8180E28; + } + else + { + sprite->pos2.x += sprite->data[4]; + sprite->data[4] *= -1; + sprite->data[3]++; + } + + sub_817F70C(sprite); +} + +void sub_8180E28(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + sprite->pos2.x += 2; + if (sprite->pos2.x > 0) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +void sub_8180E78(struct Sprite *sprite); +void sub_8180ED0(struct Sprite *sprite); +void sub_8180F2C(struct Sprite *sprite); + +void pokemonanimfunc_26(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sprite->callback = sub_8180E78; +} + +void sub_8180E78(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--; + + if (sprite->pos2.x % 2 == 0 && sprite->data[3] <= 0) + sprite->data[3] = 10; + if (sprite->pos2.x > 7) + { + sprite->pos2.x = 8; + sprite->pos2.y = -8; + sprite->data[4] = 0; + sprite->callback = sub_8180ED0; + } + + sub_817F70C(sprite); +} + +void sub_8180ED0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x = Cos(sprite->data[4], 16) - 8; + sprite->pos2.y = Sin(sprite->data[4], 16) - 8; + + if (sprite->data[4] > 63) + { + sprite->data[2] = 160; + sprite->data[3] = 10; + sprite->callback = sub_8180F2C; + } + sprite->data[4] += 8; + if (sprite->data[4] > 64) + sprite->data[4] = 64; + + sub_817F70C(sprite); +} + +void sub_8180F2C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[3] > 0) + { + sprite->data[3]--; + } + else + { + u32 rotation; + + sprite->pos2.x = Cos(sprite->data[2], 5) - 4; + sprite->pos2.y = -(Sin(sprite->data[2], 5)) + 4; + sprite->data[2] -= 4; + rotation = sprite->data[2] - 32; + HandleSetAffineData(sprite, 0x100, 0x100, rotation * 512); + + if (sprite->data[2] <= 32) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_27(struct Sprite *sprite) +{ + if (sprite->data[3] > 0) + { + sprite->data[3]--; + } + else + { + sprite->data[4] = (sprite->data[4] == 0) ? 1 : 0; + sprite->invisible = sprite->data[4]; + if (++sprite->data[2] > 19) + { + sprite->invisible = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + sprite->data[3] = 2; + } +} + +void sub_8181024(struct Sprite *sprite); +void sub_8181068(struct Sprite *sprite); +void sub_81810C4(struct Sprite *sprite); + +void pokemonanimfunc_28(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8181024; +} + +void sub_8181024(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x--; + sprite->pos2.y++; + + if (sprite->pos2.x <= -16) + { + sprite->pos2.x = -16; + sprite->pos2.y = 16; + sprite->callback = sub_8181068; + sprite->data[2] = 160; + } + + sub_817F70C(sprite); +} + +void sub_8181068(struct Sprite *sprite) +{ + u32 rotation; + + sub_817F70C(sprite); + sprite->data[2] -= 4; + sprite->pos2.x = Cos(sprite->data[2], 22); + sprite->pos2.y = -(Sin(sprite->data[2], 22)); + rotation = sprite->data[2] - 32; + HandleSetAffineData(sprite, 0x100, 0x100, rotation * 512); + + if (sprite->data[2] <= 32) + sprite->callback = sub_81810C4; + + sub_817F70C(sprite); +} + +void sub_81810C4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x--; + sprite->pos2.y++; + + if (sprite->pos2.x <= 0) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +void sub_8181110(struct Sprite *sprite); +void sub_8181144(struct Sprite *sprite); +void sub_81811A4(struct Sprite *sprite); + +void pokemonanimfunc_29(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8181110; +} + +void sub_8181110(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--; + + if (sprite->pos2.x > 15) + { + sprite->data[2] = 0; + sprite->callback = sub_8181144; + } + + sub_817F70C(sprite); +} + +void sub_8181144(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[2] += 16; + + if (sprite->pos2.x <= -16) + { + sprite->pos2.x = -16; + sprite->pos2.y = 16; + sprite->data[2] = 0; + sprite->callback = sub_81811A4; + } + else + { + sprite->pos2.x -= 2; + sprite->pos2.y += 2; + } + + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[2] << 8); + sub_817F70C(sprite); +} + +void sub_81811A4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--;; + + if (sprite->pos2.x >= 0) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +void sub_8181214(struct Sprite *sprite); + +void pokemonanimfunc_2A(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_2 = 2; + sub_8181214(sprite); + sprite->callback = sub_8181214; +} + +void sub_8181214(struct Sprite *sprite) +{ + if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + { + gUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + sprite->data[2]++; + HandleStartAffineAnim(sprite); + sprite->data[7] = gUnknown_03001240[sprite->data[0]].field_2; + sprite->data[3] = -1; + sprite->data[4] = -1; + sprite->data[5] = 0; + sprite->data[6] = 0; + } + + sprite->pos2.x += (sprite->data[7] * 2 * sprite->data[3]); + sprite->pos2.y += (sprite->data[7] * sprite->data[4]); + sprite->data[6] += 8; + if (sprite->pos2.x <= -16 || sprite->pos2.x >= 16) + { + sprite->pos2.x = sprite->data[3] * 16; + sprite->data[3] *= -1; + sprite->data[5]++; + } + else if (sprite->pos2.y <= -16 || sprite->pos2.y >= 16) + { + sprite->pos2.y = sprite->data[4] * 16; + sprite->data[4] *= -1; + sprite->data[5]++; + } + + if (sprite->data[5] > 5 && sprite->pos2.x <= 0) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[5] = 0; + sprite->data[6] = 0; + gUnknown_03001240[sprite->data[0]].field_0 = 10; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6] << 8); + sub_817F70C(sprite); + } +} + +void sub_8181370(struct Sprite *sprite); + +void pokemonanimfunc_2B(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[6] = 0; + sprite->data[7] = 0; + sprite->callback = sub_8181370; +} + +void sub_8181370(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[6] += 4; + sprite->pos2.x = -(Sin(sprite->data[6], 16)); + sprite->pos2.y = -(Sin((sprite->data[6] * 2) & 0xFF, 8)); + if (sprite->data[6] > 192 && sprite->data[7] == 1) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->data[7]++; + } + else if (sprite->data[6] > 64 && sprite->data[7] == 0) + { + HandleSetAffineData(sprite, -0x100, 0x100, 0); + sprite->data[7]++; + } + + if (sprite->data[6] > 255) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + sub_817F70C(sprite); +} + +void pokemonanimfunc_2C(struct Sprite *sprite) +{ + if (++sprite->data[2] == 1) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[6] = 0; + sprite->data[5] = 0; + sprite->data[4] = 0; + } + + if (gUnknown_0860AA64[sprite->data[6]][1] == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + if (sprite->data[4] == 1) + { + if (gUnknown_0860AA64[sprite->data[6]][0] != 0) + BlendPalette(sprite->data[7], 0x10, 0x10, 0x3FF); + else + BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + + sprite->data[4] = 0; + } + + if (gUnknown_0860AA64[sprite->data[6]][1] == sprite->data[5]) + { + sprite->data[4] = 1; + sprite->data[5] = 0; + sprite->data[6]++; + } + else + { + sprite->data[5]++; + } + } +} + +void sub_81814D4(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + sub_817F70C(sprite); + if (sprite->data[2] > gUnknown_03001240[sprite->data[0]].field_8) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.x = 0; + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + s16 index = (sprite->data[2] * 256) / gUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = -(Sin(index, 10)); + HandleSetAffineData(sprite, 0x100, 0x100, Sin(index, 3276)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_2D(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_8 = 50; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +void sub_81815D4(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + sub_817F70C(sprite); + if (sprite->data[2] > gUnknown_03001240[sprite->data[0]].field_8) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.x = 0; + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + s16 index = (sprite->data[2] * 256) / gUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = -(Sin(index, 10)); + HandleSetAffineData(sprite, 0x100, 0x100, -(Sin(index, 3276))); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_2E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_8 = 50; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +void sub_8181708(struct Sprite *sprite); +void sub_8181770(struct Sprite *sprite); +void sub_8181794(struct Sprite *sprite); + +void pokemonanimfunc_2F(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[6] = -(14 * sprite->centerToCornerVecX / 10); + sprite->data[7] = 128; + sprite->callback = sub_8181708; +} + +void sub_8181708(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7]--; + sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + + HandleSetAffineData(sprite, 0x100, 0x100, (sprite->data[7] - 128) << 8); + if (sprite->data[7] <= 120) + { + sprite->data[7] = 120; + sprite->data[3] = 0; + sprite->callback = sub_8181770; + } + + sub_817F70C(sprite); +} + +void sub_8181770(struct Sprite *sprite) +{ + if (sprite->data[3] == 20) + { + sprite->callback = sub_8181794; + sprite->data[3] = 0; + } + + sprite->data[3]++; +} + +void sub_8181794(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] += 2; + sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + + HandleSetAffineData(sprite, 0x100, 0x100, (sprite->data[7] - 128) << 8); + if (sprite->data[7] >= 128) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->data[2] = 0; + sub_817F77C(sprite); + sprite->callback = pokemonanimfunc_10; + } + + sub_817F70C(sprite); +} + +void sub_8181810(struct Sprite *sprite) +{ + if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + { + gUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[4] = 0; + sprite->data[5] = 0; + sprite->data[2] = 1; + } + + if (sprite->data[5] == 0) + { + sprite->data[7] = Sin(sprite->data[4], 256); + sprite->pos2.y = Sin(sprite->data[4], 16); + sprite->data[6] = Sin(sprite->data[4], 32); + HandleSetAffineData(sprite, 0x100 - sprite->data[6], 0x100 + sprite->data[7], 0); + if (sprite->data[4] == 128) + { + sprite->data[4] = 0; + sprite->data[5] = 1; + } + } + else if (sprite->data[5] == 1) + { + sprite->data[7] = Sin(sprite->data[4], 32); + sprite->pos2.y = -(Sin(sprite->data[4], 8)); + sprite->data[6] = Sin(sprite->data[4], 128); + HandleSetAffineData(sprite, 0x100 + sprite->data[6], 0x100 - sprite->data[7], 0); + if (sprite->data[4] == 128) + { + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + gUnknown_03001240[sprite->data[0]].field_0 = 10; + sprite->data[4] = 0; + sprite->data[5] = 0; + } + else + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + } + + sprite->data[4] += gUnknown_03001240[sprite->data[0]].field_6; + } +} + +void pokemonanimfunc_30(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_6 = 4; + sub_8181810(sprite); + sprite->callback = sub_8181810; +} + +void pokemonanimfunc_31(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + sub_817F70C(sprite); + if (counter > 512) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + switch (sprite->data[2] / 128) + { + case 0: + sprite->pos2.x = -(counter % 128 * 8) / 128; + break; + case 1: + sprite->pos2.x = (counter % 128 / 16) - 8; + break; + case 2: + sprite->pos2.x = (counter % 128 / 16); + break; + case 3: + sprite->pos2.x = -(counter % 128 * 8) / 128 + 8; + break; + } + + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; + sub_817F70C(sprite); +} + +void sub_8181ABC(struct Sprite *sprite); +void sub_8181B4C(struct Sprite *sprite); +void sub_8181C2C(struct Sprite *sprite); + +void pokemonanimfunc_32(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_8 = -1; + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sub_8181ABC(sprite); + sprite->callback = sub_8181ABC; +} + +void sub_8181ABC(struct Sprite *sprite) +{ + if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + { + gUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + s32 counter; + + sub_817F70C(sprite); + counter = sprite->data[2]; + if (sprite->data[2] > 128) + { + sprite->data[2] = 0; + sprite->callback = sub_8181B4C; + } + else + { + s32 var = 8 * gUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = var * (counter % 128) / 128; + sprite->pos2.y = -(Sin(counter % 128, 8)); + sprite->data[2] += 12; + } + + sub_817F70C(sprite); + } +} + +void sub_8181B4C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 48) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sprite->data[2] = 0; + sprite->callback = sub_8181C2C; + } + else + { + s16 yDelta; + s16 yScale = Sin(sprite->data[4], 64) + 256; + if (sprite->data[2] >= 16 && sprite->data[2] <= 31) + { + sprite->data[3] += 8; + sprite->pos2.x -= gUnknown_03001240[sprite->data[0]].field_8; + } + + yDelta = 0; + if (yScale > 256) + yDelta = (256 - yScale) / 8; + + sprite->pos2.y = -(Sin(sprite->data[3], 20)) - yDelta; + HandleSetAffineData(sprite, 256 - Sin(sprite->data[4], 32), yScale, 0); + sprite->data[2]++; + sprite->data[4] += 8; + sprite->data[4] &= 0xFF; + } + + sub_817F70C(sprite); +} + +void sub_8181C2C(struct Sprite *sprite) +{ + s32 counter; + + sub_817F70C(sprite); + counter = sprite->data[2]; + if (counter > 128) + { + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + gUnknown_03001240[sprite->data[0]].field_0 = 10; + sprite->data[3] = 0; + sprite->data[2] = 0; + sprite->data[4] = 0; + sprite->callback = sub_8181ABC; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + register s32 var asm("r4") = gUnknown_03001240[sprite->data[0]].field_8; + + sprite->pos2.x = (var << 3) * (counter % 128) / 128 - (gUnknown_03001240[sprite->data[0]].field_8 * 8); + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; + sub_817F70C(sprite); +} + +void sub_8181CE8(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 254) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + { + gUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + sprite->data[7] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); + } + else + { + u16 rotation; + + sprite->pos2.x = -(Sin(sprite->data[7], 16)); + rotation = Sin(sprite->data[7], 32); + HandleSetAffineData(sprite, 0x100, 0x100, rotation << 8); + sprite->data[7] += gUnknown_03001240[sprite->data[0]].field_6; + sub_817F70C(sprite); + } +} + +void pokemonanimfunc_33(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + gUnknown_03001240[id].field_6 = 4; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +void pokemonanimfunc_34(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 254) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sub_817F70C(sprite); + } + else + { + u16 rotation; + + sprite->pos2.x = -(Sin(sprite->data[7], 16)); + sprite->pos2.y = -(Sin(sprite->data[7] % 128, 16)); + rotation = Sin(sprite->data[7], 32); + HandleSetAffineData(sprite, 0x100, 0x100, rotation << 8); + sprite->data[7] += 8; + sub_817F70C(sprite); + } +} + +void pokemonanimfunc_35(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = 0; + + if (sprite->data[2] == sprite->data[7]) + { + sprite->data[7] = 0; + sprite->data[2]++; + sprite->invisible = 0; + } + else + { + sprite->data[7]++; + sprite->invisible = 1; + } + + if (sprite->data[2] > 10) + { + sprite->invisible = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } +} + +void sub_8181F14(struct Sprite *sprite); +void sub_8181F50(struct Sprite *sprite); +void sub_8181FC0(struct Sprite *sprite); + +void pokemonanimfunc_36(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->callback = sub_8181F14; +} + +void sub_8181F14(struct Sprite *sprite) +{ + if (sprite->data[7] > 31) + { + sprite->data[7] = 32; + sprite->data[2] = 0; + sprite->callback = sub_8181F50; + } + else + { + sprite->data[7] += 4; + } + + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[7] << 8); +} + +void sub_8181F50(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 512) + { + sprite->callback = sub_8181FC0; + sprite->data[6] = 0; + } + else + { + sprite->pos2.x = -(sprite->data[2] * 16) / 512; + sprite->pos2.y = -(Sin(sprite->data[2] % 128, 4)); + sprite->data[2] += 12; + } + + sub_817F70C(sprite); +} + +void sub_8181FC0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] -= 2; + if (sprite->data[7] < 0) + { + sprite->data[7] = 0; + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->pos2.x = -(Sin(sprite->data[7] * 2, 16)); + } + + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[7] << 8); + sub_817F70C(sprite); +}