From 19864d3cd93e57880da1430489c365907fb0a7a3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 21 Jan 2018 19:16:15 -0500 Subject: [PATCH 01/15] Fix for windows --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 37344066e..c38d8fe76 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,11 @@ LDFLAGS = -Map ../../$(MAP) OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy -LIB := -L ../../tools/agbcc/lib -lgcc -lc +ifeq ($(OS),Windows_NT) + LIB := ../../tools/agbcc/lib/libgcc.a ../../tools/agbcc/lib/libc.a +else + LIB := -L ../../tools/agbcc/lib -lgcc -lc +endif SHA1 := sha1sum -c From ad73f920612f747a963d9aed8867aa930ebc8173 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 22 Jan 2018 21:32:50 +0100 Subject: [PATCH 02/15] start decompiling pokemon animation --- asm/pokemon_animation.s | 538 ------------------- data/pokemon_animation.s | 198 ------- include/pokemon_animation.h | 4 +- include/sprite.h | 1 + ld_script.txt | 2 + src/pokemon_animation.c | 1015 +++++++++++++++++++++++++++++++++++ 6 files changed, 1020 insertions(+), 738 deletions(-) create mode 100644 src/pokemon_animation.c diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index a625f8511..7f0d24cd0 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -4,547 +4,9 @@ .syntax unified .text - - thumb_func_start nullsub_69 -nullsub_69: @ 817F3EC - bx lr - thumb_func_end nullsub_69 - thumb_func_start sub_817F3F0 -sub_817F3F0: @ 817F3F0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x4 - mov r9, r0 - mov r8, r1 - adds r5, r2, 0 - adds r4, r3, 0 - lsls r5, 16 - negs r5, r5 - lsls r4, 16 - negs r4, r4 - lsrs r4, 16 - mov r0, r8 - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - asrs r5, 16 - adds r1, r5, 0 - bl Cos - adds r6, r0, 0 - lsls r4, 16 - asrs r4, 16 - mov r0, r8 - adds r1, r4, 0 - bl Sin - subs r6, r0 - lsls r6, 16 - lsrs r6, 16 - mov r0, r8 - adds r1, r4, 0 - bl Cos - adds r2, r0, 0 - mov r0, r8 - adds r1, r5, 0 - str r2, [sp] - bl Sin - ldr r2, [sp] - adds r2, r0 - negs r5, r5 - negs r4, r4 - lsls r6, 16 - asrs r6, 16 - lsls r5, 16 - asrs r5, 16 - adds r6, r5 - mov r0, r9 - strh r6, [r0, 0x24] - lsls r2, 16 - asrs r2, 16 - lsls r4, 16 - asrs r4, 16 - adds r2, r4 - strh r2, [r0, 0x26] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817F3F0 - thumb_func_start GetSpeciesBackAnimId -GetSpeciesBackAnimId: @ 817F474 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_0860A8C8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0817F48C - movs r0, 0 - b _0817F492 - .pool -_0817F48C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_0817F492: - pop {r1} - bx r1 - thumb_func_end GetSpeciesBackAnimId - - thumb_func_start sub_817F498 -sub_817F498: @ 817F498 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r6, r5, 2 - adds r0, r6, r5 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0xA - ldrsh r0, [r2, r3] - lsls r3, r0, 16 - movs r4, 0xC - ldrsh r0, [r2, r4] - orrs r3, r0 - movs r0, 0x8 - ldrsh r4, [r2, r0] - mov r8, r1 - ldr r0, =SpriteCallbackDummy - mov r12, r0 - cmp r4, 0 - bne _0817F508 - ldrh r0, [r3, 0x2E] - strh r0, [r2, 0x10] - ldrh r0, [r3, 0x32] - strh r0, [r2, 0x12] - movs r0, 0x1 - strh r0, [r3, 0x30] - strh r4, [r3, 0x2E] - movs r0, 0x2 - adds r1, r6, 0 - ldr r6, =gUnknown_0860AA88 - ldr r7, =gUnknown_03001274 - movs r4, 0 - adds r2, r3, 0 - adds r2, 0x32 -_0817F4E2: - strh r4, [r2] - adds r2, 0x2 - adds r0, 0x1 - cmp r0, 0x7 - bls _0817F4E2 - adds r1, r5 - lsls r1, 3 - add r1, r8 - movs r2, 0xE - ldrsh r0, [r1, r2] - lsls r0, 2 - adds r0, r6 - ldr r0, [r0] - str r0, [r3, 0x1C] - movs r0, 0 - str r0, [r7] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0817F508: - ldr r0, [r3, 0x1C] - cmp r0, r12 - bne _0817F528 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - add r0, r8 - ldrh r1, [r0, 0x10] - movs r2, 0 - strh r1, [r3, 0x2E] - ldrh r0, [r0, 0x12] - strh r0, [r3, 0x32] - strh r2, [r3, 0x30] - adds r0, r5, 0 - bl DestroyTask -_0817F528: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817F498 - - thumb_func_start LaunchAnimationTaskForFrontSprite -LaunchAnimationTaskForFrontSprite: @ 817F544 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - ldr r0, =sub_817F498 - movs r1, 0x80 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - lsrs r0, r5, 16 - strh r0, [r1, 0xA] - strh r5, [r1, 0xC] - strh r4, [r1, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchAnimationTaskForFrontSprite - - thumb_func_start sub_817F578 -sub_817F578: @ 817F578 - lsls r1, 24 - ldr r3, =gUnknown_03001274 - movs r2, 0x1 - str r2, [r3] - ldr r2, =gUnknown_0860AA88 - lsrs r1, 22 - adds r1, r2 - ldr r1, [r1] - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_817F578 - - thumb_func_start LaunchAnimationTaskForBackSprite -LaunchAnimationTaskForBackSprite: @ 817F594 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r6, r1, 24 - lsrs r6, 24 - ldr r0, =sub_817F498 - movs r1, 0x80 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - lsrs r0, r5, 16 - strh r0, [r4, 0xA] - strh r5, [r4, 0xC] - ldrh r0, [r5, 0x2E] - lsls r0, 24 - ldr r1, =gBattlePartyID - lsrs r0, 23 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNature - lsls r0, 24 - lsrs r0, 24 - lsls r1, r6, 1 - ldr r2, =gUnknown_0860AD2F - adds r0, r2 - adds r1, r6 - ldrb r0, [r0] - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_0860ACE4 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchAnimationTaskForBackSprite - - thumb_func_start sub_817F60C -sub_817F60C: @ 817F60C - ldr r1, =nullsub_69 - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_817F60C - - thumb_func_start sub_817F618 -sub_817F618: @ 817F618 - push {r4,r5,lr} - sub sp, 0x10 - lsls r1, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r4, =0xffff0000 - lsls r2, 16 - lsrs r1, 16 - orrs r1, r2 - str r1, [sp] - ldr r1, [sp, 0x4] - ands r1, r4 - orrs r1, r3 - str r1, [sp, 0x4] - ldrb r4, [r0, 0x3] - lsls r4, 26 - lsrs r4, 27 - add r5, sp, 0x8 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ObjAffineSet - ldr r0, =gOamMatrices - lsls r4, 3 - adds r4, r0 - ldrh r0, [r5] - strh r0, [r4] - ldrh r0, [r5, 0x2] - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x4] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x6] - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817F618 - - thumb_func_start sub_817F670 -sub_817F670: @ 817F670 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r0, =gSpriteAffineAnimTable_860AD68 - str r0, [r4, 0x10] - ldr r0, =gUnknown_03001274 - ldr r0, [r0] - cmp r0, 0x1 - bne _0817F68E - adds r0, r4, 0 - bl InitSpriteAffineAnim -_0817F68E: - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817F6A8 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _0817F6B0 - .pool -_0817F6A8: - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim -_0817F6B0: - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F670 - - thumb_func_start sub_817F6D4 -sub_817F6D4: @ 817F6D4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - movs r5, 0x30 - ldrsh r0, [r4, r5] - cmp r0, 0 - bne _0817F6F8 - lsls r0, r1, 16 - negs r0, r0 - lsrs r1, r0, 16 - negs r0, r3 - lsls r0, 16 - lsrs r3, r0, 16 -_0817F6F8: - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - bl sub_817F618 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817F6D4 - - thumb_func_start sub_817F70C -sub_817F70C: @ 817F70C - push {lr} - adds r1, r0, 0 - movs r2, 0x30 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0817F720 - movs r2, 0x24 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0x24] -_0817F720: - pop {r0} - bx r0 - thumb_func_end sub_817F70C - - thumb_func_start sub_817F724 -sub_817F724: @ 817F724 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bhi _0817F750 - ldr r1, =gUnknown_03001240 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r2, 0 - strh r2, [r0, 0x6] - strh r2, [r0] - movs r1, 0x1 - strh r1, [r0, 0x4] - strh r2, [r0, 0x2] - strh r2, [r0, 0x8] - movs r0, 0x1 - b _0817F752 - .pool -_0817F750: - movs r0, 0 -_0817F752: - pop {r1} - bx r1 - thumb_func_end sub_817F724 - - thumb_func_start sub_817F758 -sub_817F758: @ 817F758 - push {r4,lr} - ldr r4, =gUnknown_03001270 - ldrb r1, [r4] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 2 - lsls r0, 2 - subs r0, r2, r0 - strb r0, [r4] - ldrb r0, [r4] - bl sub_817F724 - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817F758 - - thumb_func_start sub_817F77C -sub_817F77C: @ 817F77C - push {r4,r5,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - movs r3, 0x4 - negs r3, r3 - ands r3, r0 - movs r5, 0x1 - orrs r3, r5 - strb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - ldr r0, =gUnknown_03001274 - ldr r0, [r0] - cmp r0, 0x1 - bne _0817F800 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817F7C0 - adds r1, r4, 0 - adds r1, 0x3F - ldrb r0, [r1] - orrs r0, r5 - strb r0, [r1] - adds r5, r1, 0 - b _0817F7D0 - .pool -_0817F7C0: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r2, [r0] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - adds r5, r0, 0 -_0817F7D0: - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r2, [r4, 0x3] - lsls r1, r2, 26 - lsrs r1, 27 - ldrb r0, [r5] - lsls r0, 31 - lsrs r0, 31 - lsls r0, 3 - orrs r1, r0 - lsls r1, 1 - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] -_0817F800: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817F77C thumb_func_start pokemonanimfunc_01 pokemonanimfunc_01: @ 817F808 diff --git a/data/pokemon_animation.s b/data/pokemon_animation.s index 535c91b2d..ef9a35a49 100644 --- a/data/pokemon_animation.s +++ b/data/pokemon_animation.s @@ -3,204 +3,6 @@ .section .rodata -gUnknown_0860A8C8:: @ 860A8C8 - .byte 0x00, 0x13, 0x02, 0x08, 0x12, 0x15, 0x17, 0x12, 0x12, 0x19, 0x02, 0x13, 0x11, 0x02, 0x13, 0x01, 0x0f, 0x15, 0x0f, 0x0a, 0x0a, 0x0f, 0x15, 0x0f, 0x09, 0x16, 0x16, 0x12, 0x10, 0x12, 0x15, 0x09 - .byte 0x12, 0x15, 0x09, 0x13, 0x13, 0x10, 0x01, 0x13, 0x06, 0x11, 0x09, 0x02, 0x02, 0x14, 0x02, 0x08, 0x0a, 0x11, 0x09, 0x09, 0x10, 0x0f, 0x02, 0x14, 0x10, 0x10, 0x15, 0x15, 0x12, 0x09, 0x0e, 0x14 - .byte 0x14, 0x0d, 0x15, 0x09, 0x09, 0x0b, 0x0b, 0x0b, 0x02, 0x02, 0x0e, 0x08, 0x08, 0x17, 0x15, 0x02, 0x13, 0x0f, 0x0f, 0x02, 0x0f, 0x15, 0x13, 0x02, 0x0b, 0x0c, 0x13, 0x0f, 0x01, 0x01, 0x14, 0x09 - .byte 0x13, 0x14, 0x0a, 0x09, 0x15, 0x15, 0x02, 0x10, 0x15, 0x10, 0x02, 0x0f, 0x02, 0x06, 0x06, 0x0e, 0x0e, 0x12, 0x0b, 0x12, 0x13, 0x11, 0x11, 0x11, 0x13, 0x19, 0x14, 0x0f, 0x13, 0x16, 0x17, 0x0e - .byte 0x0e, 0x10, 0x09, 0x19, 0x05, 0x12, 0x19, 0x16, 0x17, 0x01, 0x13, 0x13, 0x13, 0x15, 0x15, 0x13, 0x19, 0x16, 0x17, 0x02, 0x0f, 0x09, 0x0d, 0x12, 0x12, 0x02, 0x09, 0x12, 0x15, 0x17, 0x15, 0x15 - .byte 0x09, 0x12, 0x10, 0x11, 0x0f, 0x0a, 0x11, 0x0a, 0x02, 0x0f, 0x0b, 0x16, 0x12, 0x13, 0x13, 0x13, 0x11, 0x12, 0x14, 0x12, 0x13, 0x16, 0x11, 0x12, 0x13, 0x02, 0x10, 0x11, 0x11, 0x11, 0x10, 0x13 - .byte 0x02, 0x11, 0x0b, 0x02, 0x14, 0x14, 0x12, 0x13, 0x01, 0x14, 0x0b, 0x14, 0x08, 0x09, 0x0f, 0x05, 0x09, 0x15, 0x09, 0x0d, 0x15, 0x13, 0x15, 0x0f, 0x13, 0x09, 0x17, 0x17, 0x0a, 0x08, 0x02, 0x02 - .byte 0x05, 0x0f, 0x02, 0x15, 0x09, 0x09, 0x19, 0x15, 0x0e, 0x01, 0x13, 0x02, 0x0f, 0x07, 0x02, 0x08, 0x17, 0x02, 0x13, 0x16, 0x17, 0x19, 0x0e, 0x09, 0x0e, 0x19, 0x17, 0x18, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x15, 0x09, 0x12, 0x10, 0x17, 0x02, 0x12, 0x19, 0x12, 0x08 - .byte 0x0f, 0x15, 0x0b, 0x08, 0x11, 0x08, 0x0f, 0x02, 0x10, 0x10, 0x13, 0x09, 0x14, 0x0a, 0x01, 0x14, 0x12, 0x15, 0x13, 0x15, 0x07, 0x11, 0x11, 0x03, 0x11, 0x19, 0x19, 0x13, 0x12, 0x01, 0x13, 0x14 - .byte 0x0e, 0x17, 0x01, 0x0b, 0x09, 0x04, 0x0f, 0x15, 0x03, 0x19, 0x04, 0x15, 0x13, 0x01, 0x0f, 0x0e, 0x0e, 0x15, 0x09, 0x0e, 0x17, 0x13, 0x09, 0x09, 0x0a, 0x08, 0x0f, 0x0f, 0x13, 0x13, 0x10, 0x10 - .byte 0x14, 0x12, 0x12, 0x09, 0x14, 0x14, 0x11, 0x11, 0x12, 0x01, 0x01, 0x18, 0x02, 0x10, 0x08, 0x0b, 0x0b, 0x0e, 0x13, 0x09, 0x0d, 0x13, 0x11, 0x11, 0x14, 0x01, 0x01, 0x0b, 0x15, 0x02, 0x15, 0x09 - .byte 0x0e, 0x11, 0x11, 0x11, 0x0c, 0x0b, 0x0f, 0x09, 0x14, 0x14, 0x14, 0x09, 0x09, 0x08, 0x0f, 0x15, 0x09, 0x09, 0x09, 0x09, 0x19, 0x17, 0x0d, 0x01, 0x01, 0x11, 0x14, 0x11 - -gUnknown_0860AA64:: @ 860AA64 - .byte 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 - -gUnknown_0860AA80:: @ 860AA80 - .byte 0x06, 0x1e, 0xfe, 0x0f, 0x06, 0x1e, 0xff, 0x00 - - .align 2 -gUnknown_0860AA88:: @ 860AA88 - .4byte pokemonanimfunc_00 - .4byte pokemonanimfunc_01 - .4byte pokemonanimfunc_02 - .4byte pokemonanimfunc_03 - .4byte pokemonanimfunc_04 - .4byte pokemonanimfunc_05 - .4byte pokemonanimfunc_06 - .4byte pokemonanimfunc_07 - .4byte pokemonanimfunc_08 - .4byte pokemonanimfunc_09 - .4byte pokemonanimfunc_0A - .4byte pokemonanimfunc_0B - .4byte pokemonanimfunc_0C - .4byte pokemonanimfunc_0D - .4byte pokemonanimfunc_0E - .4byte pokemonanimfunc_0F - .4byte pokemonanimfunc_10 - .4byte pokemonanimfunc_11 - .4byte pokemonanimfunc_12 - .4byte pokemonanimfunc_13 - .4byte pokemonanimfunc_14 - .4byte pokemonanimfunc_15 - .4byte pokemonanimfunc_16 - .4byte pokemonanimfunc_17 - .4byte pokemonanimfunc_18 - .4byte pokemonanimfunc_19 - .4byte pokemonanimfunc_1A - .4byte pokemonanimfunc_1B - .4byte pokemonanimfunc_1C - .4byte pokemonanimfunc_1D - .4byte pokemonanimfunc_1E - .4byte pokemonanimfunc_1F - .4byte pokemonanimfunc_20 - .4byte pokemonanimfunc_21 - .4byte pokemonanimfunc_22 - .4byte pokemonanimfunc_23 - .4byte pokemonanimfunc_24 - .4byte pokemonanimfunc_25 - .4byte pokemonanimfunc_26 - .4byte pokemonanimfunc_27 - .4byte pokemonanimfunc_28 - .4byte pokemonanimfunc_29 - .4byte pokemonanimfunc_2A - .4byte pokemonanimfunc_2B - .4byte pokemonanimfunc_2C - .4byte pokemonanimfunc_2D - .4byte pokemonanimfunc_2E - .4byte pokemonanimfunc_2F - .4byte pokemonanimfunc_30 - .4byte pokemonanimfunc_31 - .4byte pokemonanimfunc_32 - .4byte pokemonanimfunc_33 - .4byte pokemonanimfunc_34 - .4byte pokemonanimfunc_35 - .4byte pokemonanimfunc_36 - .4byte pokemonanimfunc_37 - .4byte pokemonanimfunc_38 - .4byte pokemonanimfunc_39 - .4byte pokemonanimfunc_3A - .4byte pokemonanimfunc_3B - .4byte pokemonanimfunc_3C - .4byte pokemonanimfunc_3D - .4byte pokemonanimfunc_3E - .4byte pokemonanimfunc_3F - .4byte pokemonanimfunc_40 - .4byte pokemonanimfunc_41 - .4byte pokemonanimfunc_42 - .4byte pokemonanimfunc_43 - .4byte pokemonanimfunc_44 - .4byte pokemonanimfunc_45 - .4byte pokemonanimfunc_46 - .4byte pokemonanimfunc_47 - .4byte pokemonanimfunc_48 - .4byte pokemonanimfunc_49 - .4byte pokemonanimfunc_4A - .4byte pokemonanimfunc_4B - .4byte pokemonanimfunc_4C - .4byte pokemonanimfunc_4D - .4byte pokemonanimfunc_4E - .4byte pokemonanimfunc_4F - .4byte pokemonanimfunc_50 - .4byte pokemonanimfunc_51 - .4byte pokemonanimfunc_52 - .4byte pokemonanimfunc_53 - .4byte pokemonanimfunc_54 - .4byte pokemonanimfunc_55 - .4byte pokemonanimfunc_56 - .4byte pokemonanimfunc_57 - .4byte pokemonanimfunc_58 - .4byte pokemonanimfunc_59 - .4byte pokemonanimfunc_5A - .4byte pokemonanimfunc_5B - .4byte pokemonanimfunc_5C - .4byte pokemonanimfunc_5D - .4byte pokemonanimfunc_5E - .4byte pokemonanimfunc_5F - .4byte pokemonanimfunc_60 - .4byte pokemonanimfunc_61 - .4byte pokemonanimfunc_62 - .4byte pokemonanimfunc_63 - .4byte pokemonanimfunc_64 - .4byte pokemonanimfunc_65 - .4byte pokemonanimfunc_66 - .4byte pokemonanimfunc_67 - .4byte pokemonanimfunc_68 - .4byte pokemonanimfunc_69 - .4byte pokemonanimfunc_6A - .4byte pokemonanimfunc_6B - .4byte pokemonanimfunc_6C - .4byte pokemonanimfunc_6D - .4byte pokemonanimfunc_6E - .4byte pokemonanimfunc_6F - .4byte pokemonanimfunc_70 - .4byte pokemonanimfunc_71 - .4byte pokemonanimfunc_72 - .4byte pokemonanimfunc_73 - .4byte pokemonanimfunc_74 - .4byte pokemonanimfunc_75 - .4byte pokemonanimfunc_76 - .4byte pokemonanimfunc_77 - .4byte pokemonanimfunc_78 - .4byte pokemonanimfunc_79 - .4byte pokemonanimfunc_7A - .4byte pokemonanimfunc_7B - .4byte pokemonanimfunc_7C - .4byte pokemonanimfunc_7D - .4byte pokemonanimfunc_7E - .4byte pokemonanimfunc_7F - .4byte pokemonanimfunc_80 - .4byte pokemonanimfunc_81 - .4byte pokemonanimfunc_82 - .4byte pokemonanimfunc_83 - .4byte pokemonanimfunc_84 - .4byte pokemonanimfunc_85 - .4byte pokemonanimfunc_86 - .4byte pokemonanimfunc_87 - .4byte pokemonanimfunc_88 - .4byte pokemonanimfunc_89 - .4byte pokemonanimfunc_8A - .4byte pokemonanimfunc_8B - .4byte pokemonanimfunc_8C - .4byte pokemonanimfunc_8D - .4byte pokemonanimfunc_8E - .4byte pokemonanimfunc_8F - .4byte pokemonanimfunc_90 - .4byte pokemonanimfunc_91 - .4byte pokemonanimfunc_92 - .4byte pokemonanimfunc_93 - .4byte pokemonanimfunc_94 - .4byte pokemonanimfunc_95 - .4byte pokemonanimfunc_96 - -gUnknown_0860ACE4:: @ 860ACE4 - .byte 0x60, 0x5f, 0x02, 0x5e, 0x03, 0x46, 0x6d, 0x3e, 0x6e, 0x6f, 0x70, 0x3f, 0x71, 0x13, 0x72, 0x6c, 0x6b, 0x3a, 0x64, 0x14, 0x4f, 0x5d, 0x0f, 0x4c, 0x61, 0x57, 0x58, 0x67, 0x66, 0x59, 0x74, 0x73 - .byte 0x5a, 0x75, 0x76, 0x5b, 0x77, 0x78, 0x65, 0x63, 0x5c, 0x62, 0x6a, 0x69, 0x68, 0x7b, 0x7a, 0x79, 0x7e, 0x7d, 0x7c, 0x81, 0x80, 0x7f, 0x84, 0x82, 0x83, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b - .byte 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96 - -gUnknown_0860AD2F:: @ 860AD2F - .byte 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01 - - .align 2 -gSpriteAffineAnim_860AD48:: @ 860AD48 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_860AD58:: @ 860AD58 - obj_rot_scal_anim_frame -0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_860AD68:: @ 860AD68 - .4byte gSpriteAffineAnim_860AD48 - .4byte gSpriteAffineAnim_860AD58 - 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 diff --git a/include/pokemon_animation.h b/include/pokemon_animation.h index 42fc10809..b6d8c868e 100644 --- a/include/pokemon_animation.h +++ b/include/pokemon_animation.h @@ -1,7 +1,7 @@ #ifndef GUARD_POKEMON_ANIMATION_H #define GUARD_POKEMON_ANIMATION_H -void LaunchAnimationTaskForFrontSprite(struct Sprite* sprite, u8 frontAnimId); -void LaunchAnimationTaskForBackSprite(struct Sprite* sprite, u8 backAnimId); +void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId); +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimId); #endif // GUARD_POKEMON_ANIMATION_H diff --git a/include/sprite.h b/include/sprite.h index d5c6bc402..b5a1b6ae5 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -233,6 +233,7 @@ extern s16 gSpriteCoordOffsetX; extern s16 gSpriteCoordOffsetY; extern struct Sprite gSprites[]; +extern struct OamMatrix gOamMatrices[]; void ResetSpriteData(void); void AnimateSprites(void); diff --git a/ld_script.txt b/ld_script.txt index 2e52eb343..f21991734 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -240,6 +240,7 @@ SECTIONS { src/bard_music.o(.text); src/fldeff_teleport.o(.text); asm/battle_link_817C95C.o(.text); + src/pokemon_animation.o(.text); asm/pokemon_animation.o(.text); src/recorded_battle.o(.text); src/battle_controller_recorded_opponent.o(.text); @@ -514,6 +515,7 @@ SECTIONS { src/evolution_graphics.o(.rodata); src/bard_music.o(.rodata); data/battle_link_817C95C.o(.rodata); + src/pokemon_animation.o(.rodata); data/pokemon_animation.o(.rodata); src/battle_controller_recorded_opponent.o(.rodata); src/battle_controller_recorded_player.o(.rodata); diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c new file mode 100644 index 000000000..960b42dd1 --- /dev/null +++ b/src/pokemon_animation.c @@ -0,0 +1,1015 @@ +#include "global.h" +#include "pokemon.h" +#include "sprite.h" +#include "pokemon_animation.h" +#include "trig.h" +#include "task.h" + +struct UnkAnimStruct +{ + s16 field_0; + s16 field_2; + s16 field_4; + s16 field_6; + s16 field_8; +}; + +extern u16 gBattlePartyID[]; +extern bool32 gUnknown_03001274; +extern struct UnkAnimStruct gUnknown_03001240[]; +extern u8 gUnknown_03001270; + +// this file's functions +void pokemonanimfunc_00(struct Sprite *sprite); +void pokemonanimfunc_01(struct Sprite *sprite); +void pokemonanimfunc_02(struct Sprite *sprite); +void pokemonanimfunc_03(struct Sprite *sprite); +void pokemonanimfunc_04(struct Sprite *sprite); +void pokemonanimfunc_05(struct Sprite *sprite); +void pokemonanimfunc_06(struct Sprite *sprite); +void pokemonanimfunc_07(struct Sprite *sprite); +void pokemonanimfunc_08(struct Sprite *sprite); +void pokemonanimfunc_09(struct Sprite *sprite); +void pokemonanimfunc_0A(struct Sprite *sprite); +void pokemonanimfunc_0B(struct Sprite *sprite); +void pokemonanimfunc_0C(struct Sprite *sprite); +void pokemonanimfunc_0D(struct Sprite *sprite); +void pokemonanimfunc_0E(struct Sprite *sprite); +void pokemonanimfunc_0F(struct Sprite *sprite); +void pokemonanimfunc_10(struct Sprite *sprite); +void pokemonanimfunc_11(struct Sprite *sprite); +void pokemonanimfunc_12(struct Sprite *sprite); +void pokemonanimfunc_13(struct Sprite *sprite); +void pokemonanimfunc_14(struct Sprite *sprite); +void pokemonanimfunc_15(struct Sprite *sprite); +void pokemonanimfunc_16(struct Sprite *sprite); +void pokemonanimfunc_17(struct Sprite *sprite); +void pokemonanimfunc_18(struct Sprite *sprite); +void pokemonanimfunc_19(struct Sprite *sprite); +void pokemonanimfunc_1A(struct Sprite *sprite); +void pokemonanimfunc_1B(struct Sprite *sprite); +void pokemonanimfunc_1C(struct Sprite *sprite); +void pokemonanimfunc_1D(struct Sprite *sprite); +void pokemonanimfunc_1E(struct Sprite *sprite); +void pokemonanimfunc_1F(struct Sprite *sprite); +void pokemonanimfunc_20(struct Sprite *sprite); +void pokemonanimfunc_21(struct Sprite *sprite); +void pokemonanimfunc_22(struct Sprite *sprite); +void pokemonanimfunc_23(struct Sprite *sprite); +void pokemonanimfunc_24(struct Sprite *sprite); +void pokemonanimfunc_25(struct Sprite *sprite); +void pokemonanimfunc_26(struct Sprite *sprite); +void pokemonanimfunc_27(struct Sprite *sprite); +void pokemonanimfunc_28(struct Sprite *sprite); +void pokemonanimfunc_29(struct Sprite *sprite); +void pokemonanimfunc_2A(struct Sprite *sprite); +void pokemonanimfunc_2B(struct Sprite *sprite); +void pokemonanimfunc_2C(struct Sprite *sprite); +void pokemonanimfunc_2D(struct Sprite *sprite); +void pokemonanimfunc_2E(struct Sprite *sprite); +void pokemonanimfunc_2F(struct Sprite *sprite); +void pokemonanimfunc_30(struct Sprite *sprite); +void pokemonanimfunc_31(struct Sprite *sprite); +void pokemonanimfunc_32(struct Sprite *sprite); +void pokemonanimfunc_33(struct Sprite *sprite); +void pokemonanimfunc_34(struct Sprite *sprite); +void pokemonanimfunc_35(struct Sprite *sprite); +void pokemonanimfunc_36(struct Sprite *sprite); +void pokemonanimfunc_37(struct Sprite *sprite); +void pokemonanimfunc_38(struct Sprite *sprite); +void pokemonanimfunc_39(struct Sprite *sprite); +void pokemonanimfunc_3A(struct Sprite *sprite); +void pokemonanimfunc_3B(struct Sprite *sprite); +void pokemonanimfunc_3C(struct Sprite *sprite); +void pokemonanimfunc_3D(struct Sprite *sprite); +void pokemonanimfunc_3E(struct Sprite *sprite); +void pokemonanimfunc_3F(struct Sprite *sprite); +void pokemonanimfunc_40(struct Sprite *sprite); +void pokemonanimfunc_41(struct Sprite *sprite); +void pokemonanimfunc_42(struct Sprite *sprite); +void pokemonanimfunc_43(struct Sprite *sprite); +void pokemonanimfunc_44(struct Sprite *sprite); +void pokemonanimfunc_45(struct Sprite *sprite); +void pokemonanimfunc_46(struct Sprite *sprite); +void pokemonanimfunc_47(struct Sprite *sprite); +void pokemonanimfunc_48(struct Sprite *sprite); +void pokemonanimfunc_49(struct Sprite *sprite); +void pokemonanimfunc_4A(struct Sprite *sprite); +void pokemonanimfunc_4B(struct Sprite *sprite); +void pokemonanimfunc_4C(struct Sprite *sprite); +void pokemonanimfunc_4D(struct Sprite *sprite); +void pokemonanimfunc_4E(struct Sprite *sprite); +void pokemonanimfunc_4F(struct Sprite *sprite); +void pokemonanimfunc_50(struct Sprite *sprite); +void pokemonanimfunc_51(struct Sprite *sprite); +void pokemonanimfunc_52(struct Sprite *sprite); +void pokemonanimfunc_53(struct Sprite *sprite); +void pokemonanimfunc_54(struct Sprite *sprite); +void pokemonanimfunc_55(struct Sprite *sprite); +void pokemonanimfunc_56(struct Sprite *sprite); +void pokemonanimfunc_57(struct Sprite *sprite); +void pokemonanimfunc_58(struct Sprite *sprite); +void pokemonanimfunc_59(struct Sprite *sprite); +void pokemonanimfunc_5A(struct Sprite *sprite); +void pokemonanimfunc_5B(struct Sprite *sprite); +void pokemonanimfunc_5C(struct Sprite *sprite); +void pokemonanimfunc_5D(struct Sprite *sprite); +void pokemonanimfunc_5E(struct Sprite *sprite); +void pokemonanimfunc_5F(struct Sprite *sprite); +void pokemonanimfunc_60(struct Sprite *sprite); +void pokemonanimfunc_61(struct Sprite *sprite); +void pokemonanimfunc_62(struct Sprite *sprite); +void pokemonanimfunc_63(struct Sprite *sprite); +void pokemonanimfunc_64(struct Sprite *sprite); +void pokemonanimfunc_65(struct Sprite *sprite); +void pokemonanimfunc_66(struct Sprite *sprite); +void pokemonanimfunc_67(struct Sprite *sprite); +void pokemonanimfunc_68(struct Sprite *sprite); +void pokemonanimfunc_69(struct Sprite *sprite); +void pokemonanimfunc_6A(struct Sprite *sprite); +void pokemonanimfunc_6B(struct Sprite *sprite); +void pokemonanimfunc_6C(struct Sprite *sprite); +void pokemonanimfunc_6D(struct Sprite *sprite); +void pokemonanimfunc_6E(struct Sprite *sprite); +void pokemonanimfunc_6F(struct Sprite *sprite); +void pokemonanimfunc_70(struct Sprite *sprite); +void pokemonanimfunc_71(struct Sprite *sprite); +void pokemonanimfunc_72(struct Sprite *sprite); +void pokemonanimfunc_73(struct Sprite *sprite); +void pokemonanimfunc_74(struct Sprite *sprite); +void pokemonanimfunc_75(struct Sprite *sprite); +void pokemonanimfunc_76(struct Sprite *sprite); +void pokemonanimfunc_77(struct Sprite *sprite); +void pokemonanimfunc_78(struct Sprite *sprite); +void pokemonanimfunc_79(struct Sprite *sprite); +void pokemonanimfunc_7A(struct Sprite *sprite); +void pokemonanimfunc_7B(struct Sprite *sprite); +void pokemonanimfunc_7C(struct Sprite *sprite); +void pokemonanimfunc_7D(struct Sprite *sprite); +void pokemonanimfunc_7E(struct Sprite *sprite); +void pokemonanimfunc_7F(struct Sprite *sprite); +void pokemonanimfunc_80(struct Sprite *sprite); +void pokemonanimfunc_81(struct Sprite *sprite); +void pokemonanimfunc_82(struct Sprite *sprite); +void pokemonanimfunc_83(struct Sprite *sprite); +void pokemonanimfunc_84(struct Sprite *sprite); +void pokemonanimfunc_85(struct Sprite *sprite); +void pokemonanimfunc_86(struct Sprite *sprite); +void pokemonanimfunc_87(struct Sprite *sprite); +void pokemonanimfunc_88(struct Sprite *sprite); +void pokemonanimfunc_89(struct Sprite *sprite); +void pokemonanimfunc_8A(struct Sprite *sprite); +void pokemonanimfunc_8B(struct Sprite *sprite); +void pokemonanimfunc_8C(struct Sprite *sprite); +void pokemonanimfunc_8D(struct Sprite *sprite); +void pokemonanimfunc_8E(struct Sprite *sprite); +void pokemonanimfunc_8F(struct Sprite *sprite); +void pokemonanimfunc_90(struct Sprite *sprite); +void pokemonanimfunc_91(struct Sprite *sprite); +void pokemonanimfunc_92(struct Sprite *sprite); +void pokemonanimfunc_93(struct Sprite *sprite); +void pokemonanimfunc_94(struct Sprite *sprite); +void pokemonanimfunc_95(struct Sprite *sprite); +void pokemonanimfunc_96(struct Sprite *sprite); + +// const rom data +static const u8 sSpeciesToBackAnimId[] = +{ + 0x00, // SPECIES_NONE + 0x13, // SPECIES_BULBASAUR + 0x02, // SPECIES_IVYSAUR + 0x08, // SPECIES_VENUSAUR + 0x12, // SPECIES_CHARMANDER + 0x15, // SPECIES_CHARMELEON + 0x17, // SPECIES_CHARIZARD + 0x12, // SPECIES_SQUIRTLE + 0x12, // SPECIES_WARTORTLE + 0x19, // SPECIES_BLASTOISE + 0x02, // SPECIES_CATERPIE + 0x13, // SPECIES_METAPOD + 0x11, // SPECIES_BUTTERFREE + 0x02, // SPECIES_WEEDLE + 0x13, // SPECIES_KAKUNA + 0x01, // SPECIES_BEEDRILL + 0x0f, // SPECIES_PIDGEY + 0x15, // SPECIES_PIDGEOTTO + 0x0f, // SPECIES_PIDGEOT + 0x0a, // SPECIES_RATTATA + 0x0a, // SPECIES_RATICATE + 0x0f, // SPECIES_SPEAROW + 0x15, // SPECIES_FEAROW + 0x0f, // SPECIES_EKANS + 0x09, // SPECIES_ARBOK + 0x16, // SPECIES_PIKACHU + 0x16, // SPECIES_RAICHU + 0x12, // SPECIES_SANDSHREW + 0x10, // SPECIES_SANDSLASH + 0x12, // SPECIES_NIDORAN_F + 0x15, // SPECIES_NIDORINA + 0x09, // SPECIES_NIDOQUEEN + 0x12, // SPECIES_NIDORAN_M + 0x15, // SPECIES_NIDORINO + 0x09, // SPECIES_NIDOKING + 0x13, // SPECIES_CLEFAIRY + 0x13, // SPECIES_CLEFABLE + 0x10, // SPECIES_VULPIX + 0x01, // SPECIES_NINETALES + 0x13, // SPECIES_JIGGLYPUFF + 0x06, // SPECIES_WIGGLYTUFF + 0x11, // SPECIES_ZUBAT + 0x09, // SPECIES_GOLBAT + 0x02, // SPECIES_ODDISH + 0x02, // SPECIES_GLOOM + 0x14, // SPECIES_VILEPLUME + 0x02, // SPECIES_PARAS + 0x08, // SPECIES_PARASECT + 0x0a, // SPECIES_VENONAT + 0x11, // SPECIES_VENOMOTH + 0x09, // SPECIES_DIGLETT + 0x09, // SPECIES_DUGTRIO + 0x10, // SPECIES_MEOWTH + 0x0f, // SPECIES_PERSIAN + 0x02, // SPECIES_PSYDUCK + 0x14, // SPECIES_GOLDUCK + 0x10, // SPECIES_MANKEY + 0x10, // SPECIES_PRIMEAPE + 0x15, // SPECIES_GROWLITHE + 0x15, // SPECIES_ARCANINE + 0x12, // SPECIES_POLIWAG + 0x09, // SPECIES_POLIWHIRL + 0x0e, // SPECIES_POLIWRATH + 0x14, // SPECIES_ABRA + 0x14, // SPECIES_KADABRA + 0x0d, // SPECIES_ALAKAZAM + 0x15, // SPECIES_MACHOP + 0x09, // SPECIES_MACHOKE + 0x09, // SPECIES_MACHAMP + 0x0b, // SPECIES_BELLSPROUT + 0x0b, // SPECIES_WEEPINBELL + 0x0b, // SPECIES_VICTREEBEL + 0x02, // SPECIES_TENTACOOL + 0x02, // SPECIES_TENTACRUEL + 0x0e, // SPECIES_GEODUDE + 0x08, // SPECIES_GRAVELER + 0x08, // SPECIES_GOLEM + 0x17, // SPECIES_PONYTA + 0x15, // SPECIES_RAPIDASH + 0x02, // SPECIES_SLOWPOKE + 0x13, // SPECIES_SLOWBRO + 0x0f, // SPECIES_MAGNEMITE + 0x0f, // SPECIES_MAGNETON + 0x02, // SPECIES_FARFETCHD + 0x0f, // SPECIES_DODUO + 0x15, // SPECIES_DODRIO + 0x13, // SPECIES_SEEL + 0x02, // SPECIES_DEWGONG + 0x0b, // SPECIES_GRIMER + 0x0c, // SPECIES_MUK + 0x13, // SPECIES_SHELLDER + 0x0f, // SPECIES_CLOYSTER + 0x01, // SPECIES_GASTLY + 0x01, // SPECIES_HAUNTER + 0x14, // SPECIES_GENGAR + 0x09, // SPECIES_ONIX + 0x13, // SPECIES_DROWZEE + 0x14, // SPECIES_HYPNO + 0x0a, // SPECIES_KRABBY + 0x09, // SPECIES_KINGLER + 0x15, // SPECIES_VOLTORB + 0x15, // SPECIES_ELECTRODE + 0x02, // SPECIES_EXEGGCUTE + 0x10, // SPECIES_EXEGGUTOR + 0x15, // SPECIES_CUBONE + 0x10, // SPECIES_MAROWAK + 0x02, // SPECIES_HITMONLEE + 0x0f, // SPECIES_HITMONCHAN + 0x02, // SPECIES_LICKITUNG + 0x06, // SPECIES_KOFFING + 0x06, // SPECIES_WEEZING + 0x0e, // SPECIES_RHYHORN + 0x0e, // SPECIES_RHYDON + 0x12, // SPECIES_CHANSEY + 0x0b, // SPECIES_TANGELA + 0x12, // SPECIES_KANGASKHAN + 0x13, // SPECIES_HORSEA + 0x11, // SPECIES_SEADRA + 0x11, // SPECIES_GOLDEEN + 0x11, // SPECIES_SEAKING + 0x13, // SPECIES_STARYU + 0x19, // SPECIES_STARMIE + 0x14, // SPECIES_MR_MIME + 0x0f, // SPECIES_SCYTHER + 0x13, // SPECIES_JYNX + 0x16, // SPECIES_ELECTABUZZ + 0x17, // SPECIES_MAGMAR + 0x0e, // SPECIES_PINSIR + 0x0e, // SPECIES_TAUROS + 0x10, // SPECIES_MAGIKARP + 0x09, // SPECIES_GYARADOS + 0x19, // SPECIES_LAPRAS + 0x05, // SPECIES_DITTO + 0x12, // SPECIES_EEVEE + 0x19, // SPECIES_VAPOREON + 0x16, // SPECIES_JOLTEON + 0x17, // SPECIES_FLAREON + 0x01, // SPECIES_PORYGON + 0x13, // SPECIES_OMANYTE + 0x13, // SPECIES_OMASTAR + 0x13, // SPECIES_KABUTO + 0x15, // SPECIES_KABUTOPS + 0x15, // SPECIES_AERODACTYL + 0x13, // SPECIES_SNORLAX + 0x19, // SPECIES_ARTICUNO + 0x16, // SPECIES_ZAPDOS + 0x17, // SPECIES_MOLTRES + 0x02, // SPECIES_DRATINI + 0x0f, // SPECIES_DRAGONAIR + 0x09, // SPECIES_DRAGONITE + 0x0d, // SPECIES_MEWTWO + 0x12, // SPECIES_MEW + 0x12, // SPECIES_CHIKORITA + 0x02, // SPECIES_BAYLEEF + 0x09, // SPECIES_MEGANIUM + 0x12, // SPECIES_CYNDAQUIL + 0x15, // SPECIES_QUILAVA + 0x17, // SPECIES_TYPHLOSION + 0x15, // SPECIES_TOTODILE + 0x15, // SPECIES_CROCONAW + 0x09, // SPECIES_FERALIGATR + 0x12, // SPECIES_SENTRET + 0x10, // SPECIES_FURRET + 0x11, // SPECIES_HOOTHOOT + 0x0f, // SPECIES_NOCTOWL + 0x0a, // SPECIES_LEDYBA + 0x11, // SPECIES_LEDIAN + 0x0a, // SPECIES_SPINARAK + 0x02, // SPECIES_ARIADOS + 0x0f, // SPECIES_CROBAT + 0x0b, // SPECIES_CHINCHOU + 0x16, // SPECIES_LANTURN + 0x12, // SPECIES_PICHU + 0x13, // SPECIES_CLEFFA + 0x13, // SPECIES_IGGLYBUFF + 0x13, // SPECIES_TOGEPI + 0x11, // SPECIES_TOGETIC + 0x12, // SPECIES_NATU + 0x14, // SPECIES_XATU + 0x12, // SPECIES_MAREEP + 0x13, // SPECIES_FLAAFFY + 0x16, // SPECIES_AMPHAROS + 0x11, // SPECIES_BELLOSSOM + 0x12, // SPECIES_MARILL + 0x13, // SPECIES_AZUMARILL + 0x02, // SPECIES_SUDOWOODO + 0x10, // SPECIES_POLITOED + 0x11, // SPECIES_HOPPIP + 0x11, // SPECIES_SKIPLOOM + 0x11, // SPECIES_JUMPLUFF + 0x10, // SPECIES_AIPOM + 0x13, // SPECIES_SUNKERN + 0x02, // SPECIES_SUNFLORA + 0x11, // SPECIES_YANMA + 0x0b, // SPECIES_WOOPER + 0x02, // SPECIES_QUAGSIRE + 0x14, // SPECIES_ESPEON + 0x14, // SPECIES_UMBREON + 0x12, // SPECIES_MURKROW + 0x13, // SPECIES_SLOWKING + 0x01, // SPECIES_MISDREAVUS + 0x14, // SPECIES_UNOWN + 0x0b, // SPECIES_WOBBUFFET + 0x14, // SPECIES_GIRAFARIG + 0x08, // SPECIES_PINECO + 0x09, // SPECIES_FORRETRESS + 0x0f, // SPECIES_DUNSPARCE + 0x05, // SPECIES_GLIGAR + 0x09, // SPECIES_STEELIX + 0x15, // SPECIES_SNUBBULL + 0x09, // SPECIES_GRANBULL + 0x0d, // SPECIES_QWILFISH + 0x15, // SPECIES_SCIZOR + 0x13, // SPECIES_SHUCKLE + 0x15, // SPECIES_HERACROSS + 0x0f, // SPECIES_SNEASEL + 0x13, // SPECIES_TEDDIURSA + 0x09, // SPECIES_URSARING + 0x17, // SPECIES_SLUGMA + 0x17, // SPECIES_MAGCARGO + 0x0a, // SPECIES_SWINUB + 0x08, // SPECIES_PILOSWINE + 0x02, // SPECIES_CORSOLA + 0x02, // SPECIES_REMORAID + 0x05, // SPECIES_OCTILLERY + 0x0f, // SPECIES_DELIBIRD + 0x02, // SPECIES_MANTINE + 0x15, // SPECIES_SKARMORY + 0x09, // SPECIES_HOUNDOUR + 0x09, // SPECIES_HOUNDOOM + 0x19, // SPECIES_KINGDRA + 0x15, // SPECIES_PHANPY + 0x0e, // SPECIES_DONPHAN + 0x01, // SPECIES_PORYGON2 + 0x13, // SPECIES_STANTLER + 0x02, // SPECIES_SMEARGLE + 0x0f, // SPECIES_TYROGUE + 0x07, // SPECIES_HITMONTOP + 0x02, // SPECIES_SMOOCHUM + 0x08, // SPECIES_ELEKID + 0x17, // SPECIES_MAGBY + 0x02, // SPECIES_MILTANK + 0x13, // SPECIES_BLISSEY + 0x16, // SPECIES_RAIKOU + 0x17, // SPECIES_ENTEI + 0x19, // SPECIES_SUICUNE + 0x0e, // SPECIES_LARVITAR + 0x09, // SPECIES_PUPITAR + 0x0e, // SPECIES_TYRANITAR + 0x19, // SPECIES_LUGIA + 0x17, // SPECIES_HO_OH + 0x18, // SPECIES_CELEBI + 0x00, // SPECIES_OLD_UNOWN_B + 0x00, // SPECIES_OLD_UNOWN_C + 0x00, // SPECIES_OLD_UNOWN_D + 0x00, // SPECIES_OLD_UNOWN_E + 0x00, // SPECIES_OLD_UNOWN_F + 0x00, // SPECIES_OLD_UNOWN_G + 0x00, // SPECIES_OLD_UNOWN_H + 0x00, // SPECIES_OLD_UNOWN_I + 0x00, // SPECIES_OLD_UNOWN_J + 0x00, // SPECIES_OLD_UNOWN_K + 0x00, // SPECIES_OLD_UNOWN_L + 0x00, // SPECIES_OLD_UNOWN_M + 0x00, // SPECIES_OLD_UNOWN_N + 0x00, // SPECIES_OLD_UNOWN_O + 0x00, // SPECIES_OLD_UNOWN_P + 0x00, // SPECIES_OLD_UNOWN_Q + 0x00, // SPECIES_OLD_UNOWN_R + 0x00, // SPECIES_OLD_UNOWN_S + 0x00, // SPECIES_OLD_UNOWN_T + 0x00, // SPECIES_OLD_UNOWN_U + 0x00, // SPECIES_OLD_UNOWN_V + 0x00, // SPECIES_OLD_UNOWN_W + 0x00, // SPECIES_OLD_UNOWN_X + 0x00, // SPECIES_OLD_UNOWN_Y + 0x00, // SPECIES_OLD_UNOWN_Z + 0x10, // SPECIES_TREECKO + 0x15, // SPECIES_GROVYLE + 0x09, // SPECIES_SCEPTILE + 0x12, // SPECIES_TORCHIC + 0x10, // SPECIES_COMBUSKEN + 0x17, // SPECIES_BLAZIKEN + 0x02, // SPECIES_MUDKIP + 0x12, // SPECIES_MARSHTOMP + 0x19, // SPECIES_SWAMPERT + 0x12, // SPECIES_POOCHYENA + 0x08, // SPECIES_MIGHTYENA + 0x0f, // SPECIES_ZIGZAGOON + 0x15, // SPECIES_LINOONE + 0x0b, // SPECIES_WURMPLE + 0x08, // SPECIES_SILCOON + 0x11, // SPECIES_BEAUTIFLY + 0x08, // SPECIES_CASCOON + 0x0f, // SPECIES_DUSTOX + 0x02, // SPECIES_LOTAD + 0x10, // SPECIES_LOMBRE + 0x10, // SPECIES_LUDICOLO + 0x13, // SPECIES_SEEDOT + 0x09, // SPECIES_NUZLEAF + 0x14, // SPECIES_SHIFTRY + 0x0a, // SPECIES_NINCADA + 0x01, // SPECIES_NINJASK + 0x14, // SPECIES_SHEDINJA + 0x12, // SPECIES_TAILLOW + 0x15, // SPECIES_SWELLOW + 0x13, // SPECIES_SHROOMISH + 0x15, // SPECIES_BRELOOM + 0x07, // SPECIES_SPINDA + 0x11, // SPECIES_WINGULL + 0x11, // SPECIES_PELIPPER + 0x03, // SPECIES_SURSKIT + 0x11, // SPECIES_MASQUERAIN + 0x19, // SPECIES_WAILMER + 0x19, // SPECIES_WAILORD + 0x13, // SPECIES_SKITTY + 0x12, // SPECIES_DELCATTY + 0x01, // SPECIES_KECLEON + 0x13, // SPECIES_BALTOY + 0x14, // SPECIES_CLAYDOL + 0x0e, // SPECIES_NOSEPASS + 0x17, // SPECIES_TORKOAL + 0x01, // SPECIES_SABLEYE + 0x0b, // SPECIES_BARBOACH + 0x09, // SPECIES_WHISCASH + 0x04, // SPECIES_LUVDISC + 0x0f, // SPECIES_CORPHISH + 0x15, // SPECIES_CRAWDAUNT + 0x03, // SPECIES_FEEBAS + 0x19, // SPECIES_MILOTIC + 0x04, // SPECIES_CARVANHA + 0x15, // SPECIES_SHARPEDO + 0x13, // SPECIES_TRAPINCH + 0x01, // SPECIES_VIBRAVA + 0x0f, // SPECIES_FLYGON + 0x0e, // SPECIES_MAKUHITA + 0x0e, // SPECIES_HARIYAMA + 0x15, // SPECIES_ELECTRIKE + 0x09, // SPECIES_MANECTRIC + 0x0e, // SPECIES_NUMEL + 0x17, // SPECIES_CAMERUPT + 0x13, // SPECIES_SPHEAL + 0x09, // SPECIES_SEALEO + 0x09, // SPECIES_WALREIN + 0x0a, // SPECIES_CACNEA + 0x08, // SPECIES_CACTURNE + 0x0f, // SPECIES_SNORUNT + 0x0f, // SPECIES_GLALIE + 0x13, // SPECIES_LUNATONE + 0x13, // SPECIES_SOLROCK + 0x10, // SPECIES_AZURILL + 0x10, // SPECIES_SPOINK + 0x14, // SPECIES_GRUMPIG + 0x12, // SPECIES_PLUSLE + 0x12, // SPECIES_MINUN + 0x09, // SPECIES_MAWILE + 0x14, // SPECIES_MEDITITE + 0x14, // SPECIES_MEDICHAM + 0x11, // SPECIES_SWABLU + 0x11, // SPECIES_ALTARIA + 0x12, // SPECIES_WYNAUT + 0x01, // SPECIES_DUSKULL + 0x01, // SPECIES_DUSCLOPS + 0x18, // SPECIES_ROSELIA + 0x02, // SPECIES_SLAKOTH + 0x10, // SPECIES_VIGOROTH + 0x08, // SPECIES_SLAKING + 0x0b, // SPECIES_GULPIN + 0x0b, // SPECIES_SWALOT + 0x0e, // SPECIES_TROPIUS + 0x13, // SPECIES_WHISMUR + 0x09, // SPECIES_LOUDRED + 0x0d, // SPECIES_EXPLOUD + 0x13, // SPECIES_CLAMPERL + 0x11, // SPECIES_HUNTAIL + 0x11, // SPECIES_GOREBYSS + 0x14, // SPECIES_ABSOL + 0x01, // SPECIES_SHUPPET + 0x01, // SPECIES_BANETTE + 0x0b, // SPECIES_SEVIPER + 0x15, // SPECIES_ZANGOOSE + 0x02, // SPECIES_RELICANTH + 0x15, // SPECIES_ARON + 0x09, // SPECIES_LAIRON + 0x0e, // SPECIES_AGGRON + 0x11, // SPECIES_CASTFORM + 0x11, // SPECIES_VOLBEAT + 0x11, // SPECIES_ILLUMISE + 0x0c, // SPECIES_LILEEP + 0x0b, // SPECIES_CRADILY + 0x0f, // SPECIES_ANORITH + 0x09, // SPECIES_ARMALDO + 0x14, // SPECIES_RALTS + 0x14, // SPECIES_KIRLIA + 0x14, // SPECIES_GARDEVOIR + 0x09, // SPECIES_BAGON + 0x09, // SPECIES_SHELGON + 0x08, // SPECIES_SALAMENCE + 0x0f, // SPECIES_BELDUM + 0x15, // SPECIES_METANG + 0x09, // SPECIES_METAGROSS + 0x09, // SPECIES_REGIROCK + 0x09, // SPECIES_REGICE + 0x09, // SPECIES_REGISTEEL + 0x19, // SPECIES_KYOGRE + 0x17, // SPECIES_GROUDON + 0x0d, // SPECIES_RAYQUAZA + 0x01, // SPECIES_LATIAS + 0x01, // SPECIES_LATIOS + 0x11, // SPECIES_JIRACHI + 0x14, // SPECIES_DEOXYS + 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_0860AA80[] = {0x06, 0x1e, 0xfe, 0x0f, 0x06, 0x1e, 0xff, 0x00}; + +static void (* const sMonAnimFunctions[])(struct Sprite *sprite) = +{ + pokemonanimfunc_00, + pokemonanimfunc_01, + pokemonanimfunc_02, + pokemonanimfunc_03, + pokemonanimfunc_04, + pokemonanimfunc_05, + pokemonanimfunc_06, + pokemonanimfunc_07, + pokemonanimfunc_08, + pokemonanimfunc_09, + pokemonanimfunc_0A, + pokemonanimfunc_0B, + pokemonanimfunc_0C, + pokemonanimfunc_0D, + pokemonanimfunc_0E, + pokemonanimfunc_0F, + pokemonanimfunc_10, + pokemonanimfunc_11, + pokemonanimfunc_12, + pokemonanimfunc_13, + pokemonanimfunc_14, + pokemonanimfunc_15, + pokemonanimfunc_16, + pokemonanimfunc_17, + pokemonanimfunc_18, + pokemonanimfunc_19, + pokemonanimfunc_1A, + pokemonanimfunc_1B, + pokemonanimfunc_1C, + pokemonanimfunc_1D, + pokemonanimfunc_1E, + pokemonanimfunc_1F, + pokemonanimfunc_20, + pokemonanimfunc_21, + pokemonanimfunc_22, + pokemonanimfunc_23, + pokemonanimfunc_24, + pokemonanimfunc_25, + pokemonanimfunc_26, + pokemonanimfunc_27, + pokemonanimfunc_28, + pokemonanimfunc_29, + pokemonanimfunc_2A, + pokemonanimfunc_2B, + pokemonanimfunc_2C, + pokemonanimfunc_2D, + pokemonanimfunc_2E, + pokemonanimfunc_2F, + pokemonanimfunc_30, + pokemonanimfunc_31, + pokemonanimfunc_32, + pokemonanimfunc_33, + pokemonanimfunc_34, + pokemonanimfunc_35, + pokemonanimfunc_36, + pokemonanimfunc_37, + pokemonanimfunc_38, + pokemonanimfunc_39, + pokemonanimfunc_3A, + pokemonanimfunc_3B, + pokemonanimfunc_3C, + pokemonanimfunc_3D, + pokemonanimfunc_3E, + pokemonanimfunc_3F, + pokemonanimfunc_40, + pokemonanimfunc_41, + pokemonanimfunc_42, + pokemonanimfunc_43, + pokemonanimfunc_44, + pokemonanimfunc_45, + pokemonanimfunc_46, + pokemonanimfunc_47, + pokemonanimfunc_48, + pokemonanimfunc_49, + pokemonanimfunc_4A, + pokemonanimfunc_4B, + pokemonanimfunc_4C, + pokemonanimfunc_4D, + pokemonanimfunc_4E, + pokemonanimfunc_4F, + pokemonanimfunc_50, + pokemonanimfunc_51, + pokemonanimfunc_52, + pokemonanimfunc_53, + pokemonanimfunc_54, + pokemonanimfunc_55, + pokemonanimfunc_56, + pokemonanimfunc_57, + pokemonanimfunc_58, + pokemonanimfunc_59, + pokemonanimfunc_5A, + pokemonanimfunc_5B, + pokemonanimfunc_5C, + pokemonanimfunc_5D, + pokemonanimfunc_5E, + pokemonanimfunc_5F, + pokemonanimfunc_60, + pokemonanimfunc_61, + pokemonanimfunc_62, + pokemonanimfunc_63, + pokemonanimfunc_64, + pokemonanimfunc_65, + pokemonanimfunc_66, + pokemonanimfunc_67, + pokemonanimfunc_68, + pokemonanimfunc_69, + pokemonanimfunc_6A, + pokemonanimfunc_6B, + pokemonanimfunc_6C, + pokemonanimfunc_6D, + pokemonanimfunc_6E, + pokemonanimfunc_6F, + pokemonanimfunc_70, + pokemonanimfunc_71, + pokemonanimfunc_72, + pokemonanimfunc_73, + pokemonanimfunc_74, + pokemonanimfunc_75, + pokemonanimfunc_76, + pokemonanimfunc_77, + pokemonanimfunc_78, + pokemonanimfunc_79, + pokemonanimfunc_7A, + pokemonanimfunc_7B, + pokemonanimfunc_7C, + pokemonanimfunc_7D, + pokemonanimfunc_7E, + pokemonanimfunc_7F, + pokemonanimfunc_80, + pokemonanimfunc_81, + pokemonanimfunc_82, + pokemonanimfunc_83, + pokemonanimfunc_84, + pokemonanimfunc_85, + pokemonanimfunc_86, + pokemonanimfunc_87, + pokemonanimfunc_88, + pokemonanimfunc_89, + pokemonanimfunc_8A, + pokemonanimfunc_8B, + pokemonanimfunc_8C, + pokemonanimfunc_8D, + pokemonanimfunc_8E, + pokemonanimfunc_8F, + pokemonanimfunc_90, + pokemonanimfunc_91, + pokemonanimfunc_92, + pokemonanimfunc_93, + pokemonanimfunc_94, + pokemonanimfunc_95, + pokemonanimfunc_96 +}; + +// counting from Id 1, because 0 in sSpeciesToBackAnimId is used for mons with no back animation +static const u8 sBackAnimationIds[] = +{ + 0x60, 0x5f, 0x02, // 1 + 0x5e, 0x03, 0x46, // 2 + 0x6d, 0x3e, 0x6e, // 3 + 0x6f, 0x70, 0x3f, // 4 + 0x71, 0x13, 0x72, // 5 + 0x6c, 0x6b, 0x3a, // 6 + 0x64, 0x14, 0x4f, // 7 + 0x5d, 0x0f, 0x4c, // 8 + 0x61, 0x57, 0x58, // 9 + 0x67, 0x66, 0x59, // 0xA + 0x74, 0x73, 0x5a, // 0xB + 0x75, 0x76, 0x5b, // 0xC + 0x77, 0x78, 0x65, // 0xD + 0x63, 0x5c, 0x62, // 0xE + 0x6a, 0x69, 0x68, // 0xF + 0x7b, 0x7a, 0x79, // 0x10 + 0x7e, 0x7d, 0x7c, // 0x11 + 0x81, 0x80, 0x7f, // 0x12 + 0x84, 0x82, 0x83, // 0x13 + 0x85, 0x86, 0x87, // 0x14 + 0x88, 0x89, 0x8a, // 0x15 + 0x8b, 0x8c, 0x8d, // 0x16 + 0x8e, 0x8f, 0x90, // 0x17 + 0x91, 0x92, 0x93, // 0x18 + 0x94, 0x95, 0x96, // 0x19 +}; + +static const u8 sBackAnimNatureModTable[] = +{ + 0x00, // NATURE_HARDY + 0x02, // NATURE_LONELY + 0x00, // NATURE_BRAVE + 0x00, // NATURE_ADAMANT + 0x00, // NATURE_NAUGHTY + 0x01, // NATURE_BOLD + 0x01, // NATURE_DOCILE + 0x01, // NATURE_RELAXED + 0x00, // NATURE_IMPISH + 0x01, // NATURE_LAX + 0x02, // NATURE_TIMID + 0x00, // NATURE_HASTY + 0x01, // NATURE_SERIOUS + 0x00, // NATURE_JOLLY + 0x00, // NATURE_NAIVE + 0x02, // NATURE_MODEST + 0x02, // NATURE_MILD + 0x02, // NATURE_QUIET + 0x02, // NATURE_BASHFUL + 0x01, // NATURE_RASH + 0x01, // NATURE_CALM + 0x02, // NATURE_GENTLE + 0x01, // NATURE_SASSY + 0x02, // NATURE_CAREFUL + 0x01, // NATURE_QUIRKY +}; + +static const union AffineAnimCmd gSpriteAffineAnim_860AD48[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMDTYPE_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_860AD58[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMDTYPE_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_860AD68[] = +{ + gSpriteAffineAnim_860AD48, + gSpriteAffineAnim_860AD58 +}; + +// code +void MonAnimDummySpriteCallback(struct Sprite *sprite) +{ +} + +void sub_817F3F0(struct Sprite *sprite, s16 index, s16 amplitudeX, s16 amplitudeY) +{ + s16 xAdder, yAdder; + + amplitudeX *= -1; + amplitudeY *= -1; + + xAdder = Cos(index, amplitudeX) - Sin(index, amplitudeY); + yAdder = Cos(index, amplitudeY) + Sin(index, amplitudeX); + + amplitudeX *= -1; + amplitudeY *= -1; + + sprite->pos2.x = xAdder + amplitudeX; + sprite->pos2.y = yAdder + amplitudeY; +} + +u8 GetSpeciesBackAnimId(u16 species) +{ + if (sSpeciesToBackAnimId[species] != 0) + return sSpeciesToBackAnimId[species] - 1; + else + return 0; +} + +void sub_817F498(u8 taskId) +{ + u32 i; + struct Sprite *sprite = (struct Sprite*)(u32)((gTasks[taskId].data[1] << 0x10) | (gTasks[taskId].data[2])); + + if (gTasks[taskId].data[0] == 0) + { + gTasks[taskId].data[4] = sprite->data[0]; + gTasks[taskId].data[5] = sprite->data[2]; + sprite->data[1] = 1; + sprite->data[0] = 0; + + for (i = 2; i < 8; i++) + sprite->data[i] = 0; + + sprite->callback = sMonAnimFunctions[gTasks[taskId].data[3]]; + gUnknown_03001274 = FALSE; + + gTasks[taskId].data[0]++; + } + if (sprite->callback == SpriteCallbackDummy) + { + sprite->data[0] = gTasks[taskId].data[4]; + sprite->data[2] = gTasks[taskId].data[5]; + sprite->data[1] = 0; + + DestroyTask(taskId); + } +} + +void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId) +{ + u8 taskId = CreateTask(sub_817F498, 128); + gTasks[taskId].data[1] = (u32)(sprite) >> 0x10; + gTasks[taskId].data[2] = (u32)(sprite); + gTasks[taskId].data[3] = frontAnimId; +} + +void sub_817F578(struct Sprite *sprite, u8 frontAnimId) +{ + gUnknown_03001274 = TRUE; + sprite->callback = sMonAnimFunctions[frontAnimId]; +} + +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimId) +{ + u8 nature, taskId, animId, bank; + + taskId = CreateTask(sub_817F498, 128); + gTasks[taskId].data[1] = (u32)(sprite) >> 0x10; + gTasks[taskId].data[2] = (u32)(sprite); + + bank = sprite->data[0]; + nature = GetNature(&gPlayerParty[gBattlePartyID[bank]]); + + animId = 3 * backAnimId + sBackAnimNatureModTable[nature]; + gTasks[taskId].data[3] = sBackAnimationIds[animId]; +} + +void sub_817F60C(struct Sprite *sprite) +{ + sprite->callback = MonAnimDummySpriteCallback; +} + +void sub_817F618(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +{ + u8 matrixNum; + struct ObjAffineSrcData affineSrcData; + struct OamMatrix dest; + + affineSrcData.xScale = xScale; + affineSrcData.yScale = yScale; + affineSrcData.rotation = rotation; + + matrixNum = sprite->oam.matrixNum; + + ObjAffineSet(&affineSrcData, &dest, 1, 2); + gOamMatrices[matrixNum].a = dest.a; + gOamMatrices[matrixNum].b = dest.b; + gOamMatrices[matrixNum].c = dest.c; + gOamMatrices[matrixNum].d = dest.d; +} + +void sub_817F670(struct Sprite *sprite) +{ + sprite->oam.affineMode = 3; + sprite->affineAnims = gSpriteAffineAnimTable_860AD68; + + if (gUnknown_03001274 == TRUE) + InitSpriteAffineAnim(sprite); + + if (!sprite->data[1]) + StartSpriteAffineAnim(sprite, 1); + else + StartSpriteAffineAnim(sprite, 0); + + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); + sprite->affineAnimPaused = 1; +} + +void sub_817F6D4(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +{ + if (!sprite->data[1]) + { + xScale *= -1; + rotation *= -1; + } + + sub_817F618(sprite, xScale, yScale, rotation); +} + +void sub_817F70C(struct Sprite *sprite) +{ + if (!sprite->data[1]) + sprite->pos2.x *= -1; +} + +bool32 sub_817F724(u8 id) +{ + if (id >= 4) + { + return FALSE; + } + else + { + gUnknown_03001240[id].field_6 = 0; + gUnknown_03001240[id].field_0 = 0; + gUnknown_03001240[id].field_4 = 1; + gUnknown_03001240[id].field_2 = 0; + gUnknown_03001240[id].field_8 = 0; + return TRUE; + } +} + +u8 sub_817F758(void) +{ + gUnknown_03001270 = (gUnknown_03001270 + 1) % 4; + sub_817F724(gUnknown_03001270); + return gUnknown_03001270; +} + +void sub_817F77C(struct Sprite *sprite) +{ + sprite->oam.affineMode = 1; + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); + + if (gUnknown_03001274 == TRUE) + { + if (!sprite->data[1]) + sprite->hFlip = 1; + else + sprite->hFlip = 0; + + FreeOamMatrix(sprite->oam.matrixNum); + sprite->oam.matrixNum |= (sprite->hFlip << 3); + sprite->oam.affineMode = 0; + } +} From 4e43a251b002c91074ae066849437700b4f724e9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 24 Jan 2018 19:37:30 +0100 Subject: [PATCH 03/15] more pokemon anim funcs --- asm/pokemon_animation.s | 2337 ++++----------------------------------- src/pokemon_animation.c | 827 +++++++++++++- 2 files changed, 1011 insertions(+), 2153 deletions(-) diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index 7f0d24cd0..b45d5258b 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -7,1963 +7,6 @@ - - thumb_func_start pokemonanimfunc_01 -pokemonanimfunc_01: @ 817F808 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0817F81A - adds r0, r6, 0 - bl sub_817F670 -_0817F81A: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x28 - ble _0817F840 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _0817F88C - .pool -_0817F840: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 9 - movs r1, 0x28 - bl __divsi3 - adds r4, r0, 0 - cmp r0, 0 - bge _0817F854 - adds r4, 0xFF -_0817F854: - asrs r4, 8 - lsls r4, 8 - subs r4, r0, r4 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - bl Cos - adds r0, r5 - strh r0, [r6, 0x38] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F6D4 -_0817F88C: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_01 - - thumb_func_start pokemonanimfunc_02 -pokemonanimfunc_02: @ 817F898 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _0817F8B4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F8EE - .pool -_0817F8B4: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _0817F8C0 - movs r5, 0x1 -_0817F8C0: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F8D4 - adds r0, 0xFF -_0817F8D4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_0817F8EE: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_02 - - thumb_func_start sub_817F8FC -sub_817F8FC: @ 817F8FC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _0817F91C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F946 - .pool -_0817F91C: - movs r0, 0x32 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F936 - adds r0, 0xFF -_0817F936: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin -_0817F946: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F8FC - - thumb_func_start pokemonanimfunc_03 -pokemonanimfunc_03: @ 817F95C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_03 - - thumb_func_start sub_817F978 -sub_817F978: @ 817F978 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _0817F998 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F9C4 - .pool -_0817F998: - movs r0, 0x32 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F9B2 - adds r0, 0xFF -_0817F9B2: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - negs r0, r0 -_0817F9C4: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F978 - - thumb_func_start pokemonanimfunc_04 -pokemonanimfunc_04: @ 817F9D8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F978 - ldr r0, =sub_817F978 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_04 - - thumb_func_start sub_817F9F4 -sub_817F9F4: @ 817F9F4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0xC0 - lsls r0, 1 - cmp r1, r0 - ble _0817FA14 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0817FA5E - .pool -_0817FA14: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FA1C - adds r0, 0x7F -_0817FA1C: - asrs r2, r0, 7 - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0 - blt _0817FA60 - cmp r0, 0x1 - ble _0817FA48 - cmp r0, 0x3 - bgt _0817FA60 - ldr r2, =0xffffff00 - adds r1, r2 - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x2E - ldrsh r2, [r4, r1] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 16 - b _0817FA56 - .pool -_0817FA48: - lsls r0, r2, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x2E - ldrsh r1, [r4, r2] - lsls r1, 17 -_0817FA56: - asrs r1, 16 - bl Sin - negs r0, r0 -_0817FA5E: - strh r0, [r4, 0x26] -_0817FA60: - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F9F4 - - thumb_func_start pokemonanimfunc_1E -pokemonanimfunc_1E: @ 817FA6C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F9F4 - ldr r0, =sub_817F9F4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1E - - thumb_func_start pokemonanimfunc_06 -pokemonanimfunc_06: @ 817FA88 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0xC0 - lsls r0, 2 - cmp r2, r0 - ble _0817FAA8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0817FB56 - .pool -_0817FAA8: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FAB0 - adds r0, 0x7F -_0817FAB0: - lsls r0, 9 - asrs r0, 16 - cmp r0, 0x5 - bhi _0817FB3C - lsls r0, 2 - ldr r1, =_0817FAC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0817FAC8: - .4byte _0817FAE0 - .4byte _0817FAE0 - .4byte _0817FAE4 - .4byte _0817FAE8 - .4byte _0817FB04 - .4byte _0817FB1E -_0817FAE0: - movs r0, 0 - b _0817FB3A -_0817FAE4: - movs r2, 0 - b _0817FB3C -_0817FAE8: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FAF0 - adds r0, 0x7F -_0817FAF0: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _0817FB00 - adds r0, 0x7F -_0817FB00: - asrs r0, 7 - b _0817FB3A -_0817FB04: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB0C - adds r0, 0x7F -_0817FB0C: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - cmp r0, 0 - bge _0817FB18 - adds r0, 0x7 -_0817FB18: - asrs r0, 3 - subs r0, 0x8 - b _0817FB3A -_0817FB1E: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB26 - adds r0, 0x7F -_0817FB26: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _0817FB36 - adds r0, 0x7F -_0817FB36: - asrs r0, 7 - adds r0, 0x8 -_0817FB3A: - strh r0, [r4, 0x24] -_0817FB3C: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB44 - adds r0, 0x7F -_0817FB44: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_0817FB56: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_06 - - thumb_func_start pokemonanimfunc_09 -pokemonanimfunc_09: @ 817FB64 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0817FB76 - adds r0, r6, 0 - bl sub_817F670 -_0817FB76: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x28 - ble _0817FB9C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _0817FC12 - .pool -_0817FB9C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817FBB0 - adds r0, 0xFF -_0817FBB0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - lsrs r4, r0, 16 - ldrh r0, [r6, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0817FBE0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - b _0817FBFA -_0817FBE0: - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x8 -_0817FBFA: - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F6D4 -_0817FC12: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_09 - - thumb_func_start sub_817FC20 -sub_817FC20: @ 817FC20 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FC32 - strh r0, [r4, 0x34] -_0817FC32: - ldr r2, =gUnknown_0860AD70 - movs r5, 0x34 - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r2, 0x2 - adds r3, r0, r1 - movs r1, 0 - ldrsb r1, [r3, r1] - movs r5, 0x32 - ldrsh r0, [r4, r5] - cmp r1, r0 - bne _0817FC6A - adds r0, r1, 0 - cmp r0, 0 - bne _0817FC60 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FC6A - .pool -_0817FC60: - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x34] - strh r1, [r4, 0x32] -_0817FC6A: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r1, r0, r1 - adds r0, r2, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _0817FC8C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FCBE - .pool -_0817FC8C: - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r5, 0x34 - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C -_0817FCBE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817FC20 - - thumb_func_start pokemonanimfunc_0A -pokemonanimfunc_0A: @ 817FCC4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817FC20 - ldr r0, =sub_817FC20 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0A - - thumb_func_start sub_817FCDC -sub_817FCDC: @ 817FCDC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r1, r0 - ble _0817FCF8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817FD12 - .pool -_0817FCF8: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FD00 - adds r0, 0xFF -_0817FD00: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl Sin -_0817FD12: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817FCDC - - thumb_func_start pokemonanimfunc_0F -pokemonanimfunc_0F: @ 817FD24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0F - - thumb_func_start sub_817FD44 -sub_817FD44: @ 817FD44 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r1, r0 - ble _0817FD60 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817FD78 - .pool -_0817FD60: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FD68 - adds r0, 0xFF -_0817FD68: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x3 - bl Sin -_0817FD78: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817FD44 - - thumb_func_start pokemonanimfunc_10 -pokemonanimfunc_10: @ 817FD88 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817FD44 - ldr r0, =sub_817FD44 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_10 - - thumb_func_start pokemonanimfunc_11 -pokemonanimfunc_11: @ 817FDA4 - push {r4-r7,lr} - adds r7, r0, 0 - ldrh r2, [r7, 0x32] - movs r0, 0x32 - ldrsh r1, [r7, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _0817FDC8 - ldr r0, =sub_8184D88 - str r0, [r7, 0x1C] - movs r0, 0 - strh r0, [r7, 0x24] - strh r0, [r7, 0x26] - b _0817FE24 - .pool -_0817FDC8: - movs r0, 0x1 - ands r0, r2 - movs r5, 0xFF - cmp r0, 0 - bne _0817FDD4 - movs r5, 0x1 -_0817FDD4: - movs r1, 0x32 - ldrsh r0, [r7, r1] - cmp r0, 0 - bge _0817FDDE - adds r0, 0x3 -_0817FDDE: - asrs r0, 2 - movs r1, 0x8 - bl Sin - lsls r0, 16 - asrs r6, r0, 16 - movs r0, 0x32 - ldrsh r1, [r7, r0] - adds r4, r1, 0 - cmp r1, 0 - bge _0817FDF6 - adds r4, 0xFF -_0817FDF6: - asrs r4, 8 - lsls r4, 8 - subs r4, r1, r4 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - adds r1, r6, 0 - bl Sin - lsls r5, 24 - asrs r5, 24 - adds r1, r0, 0 - muls r1, r5 - adds r0, r1, 0 - strh r0, [r7, 0x26] - adds r0, r4, 0 - adds r1, r6, 0 - bl Cos - adds r1, r0, 0 - muls r1, r5 - adds r0, r1, 0 - strh r0, [r7, 0x24] -_0817FE24: - ldrh r0, [r7, 0x32] - adds r0, 0x9 - strh r0, [r7, 0x32] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_11 - - thumb_func_start sub_817FE30 -sub_817FE30: @ 817FE30 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r2, =gUnknown_03001240 - ldrh r6, [r4, 0x2E] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - ldrh r0, [r5] - cmp r0, 0 - beq _0817FE54 - subs r0, 0x1 - strh r0, [r5] - b _0817FEF8 - .pool -_0817FE54: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FE70 - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _0817FE70 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_0817FE70: - ldr r2, =gUnknown_03001240 - lsls r1, r6, 16 - asrs r1, 16 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x6 - ldrsh r0, [r5, r2] - cmp r1, r0 - ble _0817FEC4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r1, [r5, 0x4] - movs r2, 0x4 - ldrsh r0, [r5, r2] - cmp r0, 0x1 - ble _0817FEB4 - subs r0, r1, 0x1 - movs r1, 0 - strh r0, [r5, 0x4] - movs r0, 0xA - strh r0, [r5] - strh r1, [r4, 0x32] - b _0817FEF2 - .pool -_0817FEB4: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FEF2 - .pool -_0817FEC4: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _0817FED0 - adds r0, 0xFF -_0817FED0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x80 - lsls r1, 5 - bl Sin - strh r0, [r4, 0x3A] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0817FEF2: - ldrh r0, [r4, 0x32] - adds r0, 0x10 - strh r0, [r4, 0x32] -_0817FEF8: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817FE30 - - thumb_func_start pokemonanimfunc_12 -pokemonanimfunc_12: @ 817FF00 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - 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, 2 - strh r0, [r1, 0x6] - strh r3, [r1] - adds r0, r4, 0 - bl sub_817FE30 - ldr r0, =sub_817FE30 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_12 - - thumb_func_start sub_817FF3C -sub_817FF3C: @ 817FF3C - push {r4-r6,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FF54 - adds r0, r4, 0 - bl sub_817F670 -_0817FF54: - movs r2, 0x32 - ldrsh r6, [r4, r2] - ldr r1, =gUnknown_03001240 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - cmp r6, r1 - ble _0817FF8C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FFAA - .pool -_0817FF8C: - movs r2, 0x8 - ldrsh r1, [r0, r2] - movs r0, 0x80 - lsls r0, 9 - bl __divsi3 - muls r0, r6 - strh r0, [r4, 0x3A] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0817FFAA: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817FF3C - - thumb_func_start pokemonanimfunc_1F -pokemonanimfunc_1F: @ 817FFB8 - 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, 0x3C - strh r0, [r1] - movs r0, 0x14 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_817FF3C - ldr r0, =sub_817FF3C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1F - - thumb_func_start sub_817FFF0 -sub_817FFF0: @ 817FFF0 - push {r4-r7,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x2E] - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r5, 0 - bl sub_817F70C - ldr r1, =gUnknown_03001240 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r6, r0, r1 - movs r0, 0x32 - ldrsh r1, [r5, r0] - movs r2, 0x6 - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818002C - movs r0, 0 - strh r0, [r5, 0x24] - strh r0, [r5, 0x26] - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - b _0818006A - .pool -_0818002C: - movs r0, 0x32 - ldrsh r1, [r5, r0] - adds r0, r1, 0 - adds r0, 0xC0 - adds r4, r0, 0 - cmp r0, 0 - bge _0818003E - ldr r2, =0x000001bf - adds r4, r1, r2 -_0818003E: - asrs r4, 8 - lsls r4, 8 - subs r4, r0, r4 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x8 - ldrsh r1, [r6, r0] - lsls r1, 17 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - negs r0, r0 - strh r0, [r5, 0x24] - movs r2, 0x8 - ldrsh r1, [r6, r2] - adds r0, r4, 0 - bl Sin - ldrh r1, [r6, 0x8] - adds r0, r1 - strh r0, [r5, 0x26] -_0818006A: - ldr r0, =gUnknown_03001240 - lsls r1, r7, 1 - adds r1, r7 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x2] - ldrh r1, [r5, 0x32] - adds r0, r1 - strh r0, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F70C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817FFF0 - - thumb_func_start pokemonanimfunc_14 -pokemonanimfunc_14: @ 8180090 - 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, 2 - strh r0, [r1, 0x6] - movs r0, 0x6 - strh r0, [r1, 0x8] - movs r0, 0x18 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_14 - - thumb_func_start pokemonanimfunc_15 -pokemonanimfunc_15: @ 81800D0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081800EC - 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] -_081800EC: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _0818010C - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180128 - .pool -_0818010C: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0x10 - 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, 0 - bl BlendPalette -_08180128: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_15 - - thumb_func_start pokemonanimfunc_16 -pokemonanimfunc_16: @ 8180134 - push {r4-r7,lr} - adds r6, r0, 0 - movs r7, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180148 - adds r0, r6, 0 - bl sub_817F670 -_08180148: - ldrh r5, [r6, 0x32] - movs r2, 0x32 - ldrsh r0, [r6, r2] - cmp r0, 0x28 - ble _08180170 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180204 - .pool -_08180170: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r5, 0 - subs r0, 0xA - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x13 - bhi _08180196 - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r7, 0xFF - ands r7, r0 -_08180196: - movs r2, 0x30 - ldrsh r0, [r6, r2] - cmp r0, 0 - bne _081801C4 - lsls r5, r4, 16 - asrs r0, r5, 16 - movs r1, 0x28 - bl Sin - adds r4, r0, 0 - adds r0, r7, 0 - movs r1, 0x10 - bl Sin - ldr r1, =0xffffff00 - adds r0, r1 - adds r4, r0 - strh r4, [r6, 0x36] - adds r4, r5, 0 - b _081801E4 - .pool -_081801C4: - adds r0, r7, 0 - movs r1, 0x10 - bl Sin - adds r5, r0, 0 - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x28 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r5 - subs r1, r0 - strh r1, [r6, 0x36] -_081801E4: - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r6, 0x38] - movs r2, 0x36 - ldrsh r1, [r6, r2] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F618 -_08180204: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_16 - - thumb_func_start pokemonanimfunc_17 -pokemonanimfunc_17: @ 8180210 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - movs r0, 0 - mov r8, r0 - movs r7, 0 - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0818022C - adds r0, r5, 0 - bl sub_817F670 -_0818022C: - ldrh r6, [r5, 0x32] - movs r2, 0x32 - ldrsh r0, [r5, r2] - cmp r0, 0x28 - ble _08180258 - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - mov r0, r8 - strh r0, [r5, 0x26] - b _0818030A - .pool -_08180258: - movs r1, 0x32 - ldrsh r0, [r5, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r6, 0 - subs r0, 0xA - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x13 - bhi _0818027E - ldrh r0, [r5, 0x3C] - adds r0, 0x33 - strh r0, [r5, 0x3C] - movs r7, 0xFF - ands r7, r0 -_0818027E: - movs r2, 0x30 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _081802A0 - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - ldr r2, =0xffffff00 - adds r1, r2, 0 - subs r1, r0 - strh r1, [r5, 0x36] - b _081802B2 - .pool -_081802A0: - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r5, 0x36] -_081802B2: - adds r6, r4, 0 - adds r0, r7, 0 - movs r1, 0x8 - bl Sin - adds r4, r0, 0 - asrs r0, r6, 16 - movs r1, 0x28 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r4, r1, r4 - subs r4, r0 - strh r4, [r5, 0x38] - lsls r4, 16 - asrs r4, 16 - lsls r1, 16 - asrs r1, 16 - cmp r4, r1 - beq _081802F0 - movs r2, 0x38 - ldrsh r0, [r5, r2] - subs r0, r1, r0 - cmp r0, 0 - bge _081802EA - adds r0, 0x7 -_081802EA: - lsls r0, 13 - lsrs r0, 16 - mov r8, r0 -_081802F0: - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r5, 0x26] - movs r2, 0x36 - ldrsh r1, [r5, r2] - movs r0, 0x38 - ldrsh r2, [r5, r0] - adds r0, r5, 0 - movs r3, 0 - bl sub_817F618 -_0818030A: - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_17 - - thumb_func_start sub_818031C -sub_818031C: @ 818031C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gUnknown_0860AA80 - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r0, 1 - adds r1, r0, r2 - ldrb r5, [r1] - adds r2, 0x1 - adds r0, r2 - ldrb r6, [r0] - movs r1, 0 - cmp r5, 0xFE - beq _08180358 - subs r0, r6, r7 - muls r0, r5 - adds r1, r6, 0 - bl __divsi3 - lsls r0, 24 - lsrs r1, r0, 24 -_08180358: - cmp r5, 0xFF - bne _08180370 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - b _08180394 - .pool -_08180370: - mov r0, r8 - bl Sin - strh r0, [r4, 0x26] - cmp r7, r6 - bne _08180386 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r0, 0 - b _08180392 -_08180386: - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 -_08180392: - strh r0, [r4, 0x3A] -_08180394: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_818031C - - thumb_func_start pokemonanimfunc_19 -pokemonanimfunc_19: @ 81803A0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x30 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_818031C - ldr r0, =sub_818031C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_19 - - thumb_func_start pokemonanimfunc_1A -pokemonanimfunc_1A: @ 81803BC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - lsls r7, r0, 24 - lsrs r5, r7, 24 - mov r8, r5 - cmp r0, 0 - bne _081803DA - adds r0, r4, 0 - bl sub_817F670 -_081803DA: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x23 - ble _08180404 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0818045E - .pool -_08180404: - adds r6, r5, 0 - subs r6, 0xA - lsls r0, r6, 7 - movs r1, 0x14 - bl __divsi3 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r5, 0x9 - bhi _0818042A - movs r2, 0x80 - lsls r2, 1 - lsrs r3, r7, 25 - lsls r3, 9 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - b _0818045E -_0818042A: - lsls r0, r6, 24 - lsrs r0, 24 - cmp r0, 0x13 - bhi _08180442 - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x5 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - b _0818045E -_08180442: - movs r2, 0x80 - lsls r2, 1 - movs r3, 0x23 - mov r0, r8 - subs r3, r0 - lsrs r0, r3, 31 - adds r3, r0 - asrs r3, 1 - lsls r3, 26 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0818045E: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_1A - - thumb_func_start pokemonanimfunc_1B -pokemonanimfunc_1B: @ 8180474 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180486 - adds r0, r6, 0 - bl sub_817F670 -_08180486: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _081804B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r0, 0 - strh r0, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _081804E8 - .pool -_081804B0: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - strh r0, [r6, 0x26] - 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 sub_817F6D4 -_081804E8: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1B - - thumb_func_start sub_81804F8 -sub_81804F8: @ 81804F8 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0818050C - adds r0, r6, 0 - bl sub_817F670 -_0818050C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _08180534 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180582 - .pool -_08180534: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x2E - ldrsh r1, [r6, r0] - adds r0, r4, 0 - bl Sin - strh r0, [r6, 0x26] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_08180582: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81804F8 - - thumb_func_start pokemonanimfunc_1C -pokemonanimfunc_1C: @ 8180594 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0xA - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81804F8 - ldr r0, =sub_81804F8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1C - - thumb_func_start sub_81805B0 -sub_81805B0: @ 81805B0 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081805C4 - adds r0, r6, 0 - bl sub_817F670 -_081805C4: - movs r2, 0x32 - ldrsh r0, [r6, r2] - cmp r0, 0x64 - ble _081805EC - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180644 - .pool -_081805EC: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r0, r4, 16 - lsrs r4, 31 - adds r0, r4 - asrs r0, 1 - movs r2, 0x2E - ldrsh r1, [r6, r2] - lsls r1, 17 - asrs r1, 16 - bl Sin - negs r0, r0 - strh r0, [r6, 0x26] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_08180644: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81805B0 - - thumb_func_start pokemonanimfunc_18 -pokemonanimfunc_18: @ 8180654 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81805B0 - ldr r0, =sub_81805B0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_18 - - thumb_func_start pokemonanimfunc_1D -pokemonanimfunc_1D: @ 8180670 - push {r4-r6,lr} - adds r6, r0, 0 - bl sub_817F70C - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180688 - adds r0, r6, 0 - bl sub_817F670 -_08180688: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _081806B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x24] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _081806FC - .pool -_081806B0: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - strh r0, [r6, 0x24] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_081806FC: - 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 pokemonanimfunc_1D - thumb_func_start sub_8180714 sub_8180714: @ 8180714 push {r4-r6,lr} @@ -1974,7 +17,7 @@ sub_8180714: @ 8180714 cmp r0, 0 bne _0818072A adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r6, [r4, 0x34] _0818072A: adds r0, r4, 0 @@ -1992,11 +35,11 @@ _0818072A: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData strh r6, [r4, 0x26] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _081807FE .pool @@ -2064,7 +107,7 @@ _081807B0: asrs r2, r5, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -2122,11 +165,11 @@ sub_8180828: @ 8180828 adds r0, r5, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData strh r6, [r5, 0x26] adds r0, r5, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r5, 0x1C] b _081808D0 .pool @@ -2172,7 +215,7 @@ _08180894: asrs r2, 16 adds r0, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r0, [r5, 0x32] adds r0, 0x1 strh r0, [r5, 0x32] @@ -2197,7 +240,7 @@ pokemonanimfunc_13: @ 81808D8 cmp r0, 0 bne _081808F2 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x3 strh r0, [r4, 0x3C] movs r0, 0x8 @@ -2260,7 +303,7 @@ sub_8180900: @ 8180900 cmp r0, 0 bne _0818096C adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -2282,12 +325,12 @@ _0818096C: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData strh r5, [r4, 0x24] strh r5, [r4, 0x26] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180A3A .pool @@ -2338,7 +381,7 @@ _08180A04: lsls r2, 1 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r0, 0x36 ldrsh r1, [r4, r0] lsls r0, r1, 1 @@ -2427,7 +470,7 @@ _08180AA8: movs r1, 0x10 movs r2, 0 bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180AE8 .pool @@ -2480,7 +523,7 @@ _08180B14: movs r2, 0 movs r3, 0x1F bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180B50 .pool @@ -2533,7 +576,7 @@ _08180B78: movs r1, 0x10 movs r2, 0 bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180BB6 .pool @@ -2586,7 +629,7 @@ _08180BE0: movs r1, 0x10 movs r2, 0 bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180C20 .pool @@ -2639,7 +682,7 @@ _08180C4C: movs r1, 0x10 movs r2, 0 bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08180C8C .pool @@ -2670,7 +713,7 @@ _08180C8C: pokemonanimfunc_25: @ 8180C9C push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldr r0, =sub_8180CB4 str r0, [r4, 0x1C] pop {r4} @@ -2792,7 +835,7 @@ _08180D84: lsls r3, r5, 8 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x24 ldrsh r0, [r4, r1] movs r1, 0x8 @@ -2842,7 +885,7 @@ _08180DE2: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x32 ldrsh r0, [r4, r1] cmp r0, 0 @@ -2885,7 +928,7 @@ sub_8180E28: @ 8180E28 strh r0, [r4, 0x24] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08180E4A: adds r0, r4, 0 @@ -2900,7 +943,7 @@ _08180E4A: pokemonanimfunc_26: @ 8180E5C push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0 strh r0, [r4, 0x34] ldr r0, =sub_8180E78 @@ -3041,7 +1084,7 @@ _08180F44: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x32 ldrsh r0, [r4, r1] cmp r0, 0x20 @@ -3050,7 +1093,7 @@ _08180F44: strh r5, [r4, 0x26] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08180F96: adds r0, r4, 0 @@ -3105,7 +1148,7 @@ _08180FC6: ands r1, r0 mov r2, r12 strb r1, [r2] - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r3, 0x1C] _08180FFC: movs r0, 0x2 @@ -3121,7 +1164,7 @@ _08180FFE: pokemonanimfunc_28: @ 818100C push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldr r0, =sub_8181024 str r0, [r4, 0x1C] pop {r4} @@ -3192,7 +1235,7 @@ sub_8181068: @ 8181068 lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x32 ldrsh r0, [r4, r1] cmp r0, 0x20 @@ -3224,7 +1267,7 @@ sub_81810C4: @ 81810C4 bgt _081810E8 adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _081810E8: adds r0, r4, 0 @@ -3239,7 +1282,7 @@ _081810E8: pokemonanimfunc_29: @ 81810F8 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldr r0, =sub_8181110 str r0, [r4, 0x1C] pop {r4} @@ -3315,7 +1358,7 @@ _08181186: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -3342,7 +1385,7 @@ sub_81811A4: @ 81811A4 strh r2, [r4, 0x26] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _081811CE: adds r0, r4, 0 @@ -3407,7 +1450,7 @@ _08181238: adds r0, 0x1 strh r0, [r4, 0x32] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r2, 0x2E ldrsh r1, [r4, r2] lsls r0, r1, 1 @@ -3519,7 +1562,7 @@ _081812DA: _08181328: adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08181332: movs r2, 0x80 @@ -3529,7 +1572,7 @@ _08181332: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C _0818134A: @@ -3543,7 +1586,7 @@ _0818134A: pokemonanimfunc_2B: @ 8181354 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0 strh r0, [r4, 0x3A] strh r0, [r4, 0x3C] @@ -3606,7 +1649,7 @@ _081813BA: adds r0, r4, 0 _081813D2: movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r0, [r4, 0x3C] adds r0, 0x1 strh r0, [r4, 0x3C] @@ -3623,10 +1666,10 @@ _081813DE: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08181404: adds r0, r4, 0 @@ -3670,7 +1713,7 @@ _08181442: ldrb r0, [r0] cmp r0, 0xFF bne _08181464 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _081814CE .pool @@ -3739,7 +1782,7 @@ sub_81814D4: @ 81814D4 cmp r0, 0 bne _081814E6 adds r0, r6, 0 - bl sub_817F670 + bl HandleStartAffineAnim _081814E6: adds r0, r6, 0 bl sub_817F70C @@ -3761,7 +1804,7 @@ _081814E6: adds r0, r6, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r3, 0 strh r3, [r6, 0x24] movs r0, 0x2E @@ -3783,7 +1826,7 @@ _081814E6: _0818153C: adds r0, r6, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r6, 0x1C] b _08181588 .pool @@ -3813,7 +1856,7 @@ _0818154C: adds r0, r6, 0 adds r1, r5, 0 adds r2, r5, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08181588: ldrh r0, [r6, 0x32] adds r0, 0x1 @@ -3860,7 +1903,7 @@ sub_81815D4: @ 81815D4 cmp r0, 0 bne _081815E6 adds r0, r6, 0 - bl sub_817F670 + bl HandleStartAffineAnim _081815E6: adds r0, r6, 0 bl sub_817F70C @@ -3882,7 +1925,7 @@ _081815E6: adds r0, r6, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r3, 0 strh r3, [r6, 0x24] movs r0, 0x2E @@ -3904,7 +1947,7 @@ _081815E6: _0818163C: adds r0, r6, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r6, 0x1C] b _0818168A .pool @@ -3935,7 +1978,7 @@ _0818164C: adds r0, r6, 0 adds r1, r5, 0 adds r2, r5, 0 - bl sub_817F6D4 + bl HandleSetAffineData _0818168A: ldrh r0, [r6, 0x32] adds r0, 0x1 @@ -3977,7 +2020,7 @@ pokemonanimfunc_2E: @ 81816A0 pokemonanimfunc_2F: @ 81816D4 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim adds r0, r4, 0 adds r0, 0x28 movs r1, 0 @@ -4030,7 +2073,7 @@ sub_8181708: @ 8181708 lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x3C ldrsh r0, [r4, r1] cmp r0, 0x78 @@ -4104,7 +2147,7 @@ sub_8181794: @ 8181794 adds r0, r4, 0 adds r1, r5, 0 adds r2, r5, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x3C ldrsh r0, [r4, r1] cmp r0, 0x7F @@ -4115,7 +2158,7 @@ sub_8181794: @ 8181794 adds r1, r5, 0 adds r2, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData strh r6, [r4, 0x32] adds r0, r4, 0 bl sub_817F77C @@ -4155,7 +2198,7 @@ _08181834: cmp r0, 0 bne _0818184A adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r6, [r5, 0x36] strh r6, [r5, 0x38] movs r0, 0x1 @@ -4192,7 +2235,7 @@ _0818184A: asrs r2, 16 adds r0, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r3, 0x36 ldrsh r0, [r5, r3] cmp r0, 0x80 @@ -4233,7 +2276,7 @@ _081818A2: asrs r2, 16 adds r0, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x36 ldrsh r0, [r5, r1] cmp r0, 0x80 @@ -4268,10 +2311,10 @@ _08181922: adds r0, r5, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r5, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r5, 0x1C] _0818193A: ldr r2, =gUnknown_03001240 @@ -4329,7 +2372,7 @@ pokemonanimfunc_31: @ 8181994 lsls r0, 2 cmp r4, r0 ble _081819B8 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r5, 0x1C] movs r0, 0 strh r0, [r5, 0x24] @@ -4466,7 +2509,7 @@ pokemonanimfunc_32: @ 8181A78 ldr r0, =0x0000ffff strh r0, [r1, 0x8] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r5, [r4, 0x34] adds r0, r4, 0 bl sub_8181ABC @@ -4568,7 +2611,7 @@ sub_8181B4C: @ 8181B4C adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r0, 0 strh r0, [r4, 0x26] strh r0, [r4, 0x32] @@ -4646,7 +2689,7 @@ _08181BD6: asrs r2, r6, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -4705,7 +2748,7 @@ sub_8181C2C: @ 8181C2C _08181C7C: adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd _08181C84: str r0, [r4, 0x1C] movs r0, 0 @@ -4768,7 +2811,7 @@ sub_8181CE8: @ 8181CE8 cmp r0, 0 bne _08181D00 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -4787,7 +2830,7 @@ _08181D00: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldr r2, =gUnknown_03001240 movs r0, 0x2E ldrsh r1, [r4, r0] @@ -4809,7 +2852,7 @@ _08181D00: _08181D48: adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08181D52: adds r0, r4, 0 @@ -4834,7 +2877,7 @@ _08181D60: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldr r2, =gUnknown_03001240 movs r0, 0x2E ldrsh r1, [r4, r0] @@ -4889,7 +2932,7 @@ pokemonanimfunc_34: @ 8181DE4 cmp r0, 0 bne _08181DFC adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -4908,10 +2951,10 @@ _08181DFC: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] adds r0, r4, 0 bl sub_817F70C @@ -4951,7 +2994,7 @@ _08181E4E: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r0, [r4, 0x3C] adds r0, 0x8 strh r0, [r4, 0x3C] @@ -5013,7 +3056,7 @@ _08181ED8: negs r1, r1 ands r1, r0 strb r1, [r2] - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r3, 0x1C] _08181EEE: pop {r4,r5} @@ -5026,7 +3069,7 @@ _08181EEE: pokemonanimfunc_36: @ 8181EF8 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0 strh r0, [r4, 0x3C] ldr r0, =sub_8181F14 @@ -5065,7 +3108,7 @@ _08181F38: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData pop {r4} pop {r0} bx r0 @@ -5144,7 +3187,7 @@ sub_8181FC0: @ 8181FC0 strh r1, [r4, 0x24] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08181FFE .pool @@ -5165,7 +3208,7 @@ _08181FFE: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -5182,7 +3225,7 @@ pokemonanimfunc_37: @ 818201C cmp r5, 0 bne _08182036 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -5201,7 +3244,7 @@ _08182036: strh r0, [r4, 0x3C] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _081820A6 .pool @@ -5263,7 +3306,7 @@ _081820B2: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4,r5} @@ -5275,7 +3318,7 @@ _081820B2: pokemonanimfunc_38: @ 81820E0 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0 strh r0, [r4, 0x3C] strh r0, [r4, 0x36] @@ -5333,7 +3376,7 @@ _0818214A: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -5380,7 +3423,7 @@ _081821AA: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -5441,7 +3484,7 @@ _08182224: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -5464,7 +3507,7 @@ sub_8182248: @ 8182248 strh r0, [r4, 0x3C] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _0818228E .pool @@ -5491,7 +3534,7 @@ _0818228E: lsrs r3, 16 adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F70C pop {r4} @@ -5509,7 +3552,7 @@ pokemonanimfunc_39: @ 81822B0 ldrsh r0, [r4, r2] cmp r0, 0x28 ble _081822D0 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x24] @@ -5609,7 +3652,7 @@ pokemonanimfunc_3A: @ 8182370 cmp r5, 0 bne _08182392 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r5, [r4, 0x38] strh r5, [r4, 0x3A] strh r5, [r4, 0x3C] @@ -5653,7 +3696,7 @@ _08182392: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData b _08182494 _081823E4: movs r2, 0x38 @@ -5671,10 +3714,10 @@ _081823E4: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08182410: movs r2, 0x3C @@ -5743,7 +3786,7 @@ _08182474: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08182494: adds r0, r4, 0 bl sub_817F70C @@ -5761,7 +3804,7 @@ pokemonanimfunc_3B: @ 81824A0 cmp r5, 0 bne _081824BA adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -5780,10 +3823,10 @@ _081824BA: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08182540 .pool @@ -5830,7 +3873,7 @@ _08182518: asrs r2, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08182540: pop {r4,r5} pop {r0} @@ -5846,7 +3889,7 @@ pokemonanimfunc_3C: @ 8182548 cmp r5, 0 bne _08182562 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -5864,10 +3907,10 @@ _08182562: adds r1, r5, 0 adds r2, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _081825D4 .pool @@ -5903,7 +3946,7 @@ _081825AE: adds r0, r4, 0 adds r1, r5, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _081825D4: pop {r4,r5} pop {r0} @@ -5914,7 +3957,7 @@ _081825D4: pokemonanimfunc_3D: @ 81825DC push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldr r0, =sub_81825F8 str r0, [r4, 0x1C] movs r0, 0 @@ -5961,7 +4004,7 @@ _08182620: asrs r2, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData pop {r4} pop {r0} bx r0 @@ -6041,7 +4084,7 @@ _081826C8: asrs r2, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r1, 0x3A ldrsh r0, [r4, r1] cmp r0, 0x3 @@ -6082,7 +4125,7 @@ sub_81826F8: @ 81826F8 ble _08182742 adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x26] @@ -6091,7 +4134,7 @@ sub_81826F8: @ 81826F8 adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08182742: movs r1, 0x80 lsls r1, 1 @@ -6102,7 +4145,7 @@ _08182742: asrs r2, 16 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData pop {r4,r5} pop {r0} bx r0 @@ -6123,14 +4166,14 @@ sub_8182764: @ 8182764 strh r0, [r4, 0x24] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r2, 0x80 lsls r2, 1 adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData b _081827F4 .pool _08182798: @@ -6178,7 +4221,7 @@ _081827CC: lsls r2, 1 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _081827F4: pop {r4} pop {r0} @@ -6194,7 +4237,7 @@ pokemonanimfunc_3E: @ 81827FC cmp r5, 0 bne _08182822 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -6227,14 +4270,14 @@ sub_8182830: @ 8182830 strh r0, [r4, 0x24] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r2, 0x80 lsls r2, 1 adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData b _081828C0 .pool _08182864: @@ -6282,7 +4325,7 @@ _08182898: lsls r2, 1 adds r0, r4, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _081828C0: pop {r4} pop {r0} @@ -6298,7 +4341,7 @@ pokemonanimfunc_3F: @ 81828C8 cmp r5, 0 bne _081828EE adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -6327,7 +4370,7 @@ pokemonanimfunc_40: @ 81828FC cmp r5, 0 bne _0818291A adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -6348,8 +4391,8 @@ _0818291A: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 + bl HandleSetAffineData + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _0818299E .pool @@ -6395,7 +4438,7 @@ _08182978: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _0818299E: adds r0, r4, 0 bl sub_817F70C @@ -6414,7 +4457,7 @@ pokemonanimfunc_41: @ 81829AC cmp r5, 0 bne _081829CA adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -6435,8 +4478,8 @@ _081829CA: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 + bl HandleSetAffineData + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08182A5E .pool @@ -6490,7 +4533,7 @@ _08182A30: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08182A5E: adds r0, r4, 0 bl sub_817F70C @@ -6509,7 +4552,7 @@ pokemonanimfunc_42: @ 8182A6C cmp r5, 0 bne _08182A8A adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -6530,8 +4573,8 @@ _08182A8A: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 + bl HandleSetAffineData + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08182B16 .pool @@ -6581,7 +4624,7 @@ _08182AEA: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08182B16: adds r0, r4, 0 bl sub_817F70C @@ -6601,7 +4644,7 @@ pokemonanimfunc_43: @ 8182B24 lsls r0, 4 cmp r1, r0 ble _08182B48 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x3A] @@ -6843,7 +4886,7 @@ _08182D08: movs r0, 0 strh r0, [r4, 0x24] strh r0, [r4, 0x26] - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _08182D12: adds r0, r4, 0 @@ -7220,7 +5263,7 @@ pokemonanimfunc_56: @ 8182FB8 movs r0, 0x2 strh r0, [r1, 0x4] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r5, [r4, 0x34] adds r0, r4, 0 bl sub_8181ABC @@ -7398,7 +5441,7 @@ sub_8183140: @ 8183140 lsls r0, 4 cmp r2, r0 ble _0818315C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 b _08183180 @@ -7481,7 +5524,7 @@ pokemonanimfunc_59: @ 81831D4 lsls r0, 4 cmp r1, r0 ble _081831F8 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x3A] @@ -7625,7 +5668,7 @@ sub_81832C8: @ 81832C8 adds r0, r6, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r1, [r6, 0x36] movs r2, 0x36 ldrsh r0, [r6, r2] @@ -7633,7 +5676,7 @@ sub_81832C8: @ 81832C8 bgt _08183310 adds r0, r6, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r6, 0x1C] b _081833DC .pool @@ -7733,7 +5776,7 @@ _08183392: asrs r2, 16 adds r0, r6, 0 movs r3, 0 - bl sub_817F618 + bl SetAffineData ldrh r0, [r6, 0x38] adds r0, 0x1 strh r0, [r6, 0x38] @@ -7757,7 +5800,7 @@ pokemonanimfunc_5A: @ 81833E8 movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x28 strh r0, [r5, 0x3A] @@ -7794,7 +5837,7 @@ sub_8183418: @ 8183418 adds r0, r6, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r1, [r6, 0x36] movs r2, 0x36 ldrsh r0, [r6, r2] @@ -7802,7 +5845,7 @@ sub_8183418: @ 8183418 bgt _08183460 adds r0, r6, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r6, 0x1C] b _08183538 .pool @@ -7906,7 +5949,7 @@ _08183522: lsls r2, 1 adds r0, r6, 0 movs r3, 0 - bl sub_817F618 + bl SetAffineData ldrh r0, [r6, 0x38] adds r0, 0x1 strh r0, [r6, 0x38] @@ -7930,7 +5973,7 @@ pokemonanimfunc_5B: @ 8183544 movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x28 strh r0, [r5, 0x3A] @@ -7989,7 +6032,7 @@ _081835A6: _081835C2: cmp r5, 0xFF bne _081835D8 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x26] @@ -8092,7 +6135,7 @@ pokemonanimfunc_5F: @ 8183674 ldrsh r0, [r4, r2] cmp r0, 0x28 ble _08183690 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 b _081836CA @@ -8146,7 +6189,7 @@ pokemonanimfunc_60: @ 81836D8 ldrsh r0, [r4, r2] cmp r0, 0x28 ble _081836F4 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 b _0818372E @@ -8297,7 +6340,7 @@ sub_81837DC: @ 81837DC adds r0, r7, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData ldrh r1, [r7, 0x36] movs r2, 0x36 ldrsh r0, [r7, r2] @@ -8305,7 +6348,7 @@ sub_81837DC: @ 81837DC bgt _08183824 adds r0, r7, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r7, 0x1C] b _0818392C .pool @@ -8431,7 +6474,7 @@ _081838EA: asrs r2, 16 adds r0, r7, 0 movs r3, 0 - bl sub_817F618 + bl SetAffineData ldrh r0, [r7, 0x38] adds r0, 0x1 strh r0, [r7, 0x38] @@ -8456,7 +6499,7 @@ pokemonanimfunc_65: @ 818393C movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x28 strh r0, [r5, 0x3A] @@ -8482,7 +6525,7 @@ pokemonanimfunc_66: @ 818396C lsls r0, 4 cmp r1, r0 ble _08183990 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x3A] @@ -8614,7 +6657,7 @@ pokemonanimfunc_67: @ 8183A60 lsls r0, 4 cmp r1, r0 ble _08183A84 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x3A] @@ -8784,7 +6827,7 @@ _08183B8C: lsls r0, 16 cmp r0, 0 bne _08183BC8 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08183C06 .pool @@ -8894,14 +6937,14 @@ sub_8183C6C: @ 8183C6C bgt _08183CA4 adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r2, 0x80 lsls r2, 1 adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData b _08183CE8 .pool _08183CA4: @@ -8938,7 +6981,7 @@ _08183CC2: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08183CE8: pop {r4,r5} pop {r0} @@ -8955,7 +6998,7 @@ pokemonanimfunc_6B: @ 8183CF0 cmp r5, 0 bne _08183D16 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -8984,7 +7027,7 @@ pokemonanimfunc_6C: @ 8183D28 cmp r5, 0 bne _08183D4E adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -9012,7 +7055,7 @@ pokemonanimfunc_6D: @ 8183D60 cmp r5, 0 bne _08183D88 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -9041,7 +7084,7 @@ pokemonanimfunc_6E: @ 8183D94 cmp r5, 0 bne _08183DBA adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -9069,7 +7112,7 @@ pokemonanimfunc_6F: @ 8183DC8 cmp r5, 0 bne _08183DF0 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -9098,7 +7141,7 @@ pokemonanimfunc_70: @ 8183DFC cmp r5, 0 bne _08183E22 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x32] adds r0, 0x1 strh r0, [r4, 0x32] @@ -9126,7 +7169,7 @@ pokemonanimfunc_71: @ 8183E30 cmp r0, 0 bne _08183E4A adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x5 strh r0, [r4, 0x3C] movs r0, 0x8 @@ -9148,7 +7191,7 @@ pokemonanimfunc_72: @ 8183E58 cmp r0, 0 bne _08183E72 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x3 strh r0, [r4, 0x3C] movs r0, 0x4 @@ -9172,7 +7215,7 @@ pokemonanimfunc_73: @ 8183E80 movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x1E strh r0, [r5, 0x3A] @@ -9198,7 +7241,7 @@ pokemonanimfunc_74: @ 8183EB0 movs r0, 0x1 strh r0, [r4, 0x32] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x2 strh r0, [r4, 0x36] movs r0, 0x14 @@ -9225,7 +7268,7 @@ pokemonanimfunc_75: @ 8183EE0 movs r0, 0x1 strh r0, [r4, 0x32] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x2 strh r0, [r4, 0x36] movs r0, 0x14 @@ -9253,7 +7296,7 @@ pokemonanimfunc_76: @ 8183F14 movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x1E strh r0, [r5, 0x3A] @@ -9280,7 +7323,7 @@ pokemonanimfunc_77: @ 8183F44 movs r0, 0x1 strh r0, [r4, 0x32] adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x2 strh r0, [r4, 0x36] movs r0, 0x14 @@ -9308,7 +7351,7 @@ pokemonanimfunc_78: @ 8183F78 movs r4, 0x1 strh r4, [r5, 0x32] adds r0, r5, 0 - bl sub_817F670 + bl HandleStartAffineAnim strh r4, [r5, 0x36] movs r0, 0x1E strh r0, [r5, 0x3A] @@ -9337,7 +7380,7 @@ sub_8183FA8: @ 8183FA8 ldrsh r0, [r4, r3] cmp r0, 0x1 bgt _08183FD0 - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] movs r0, 0 strh r0, [r4, 0x24] @@ -9499,7 +7542,7 @@ sub_81840C4: @ 81840C4 ldrsh r0, [r5, r3] cmp r1, r0 bgt _081840EC - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r5, 0x1C] b _081840F4 .pool @@ -9772,7 +7815,7 @@ sub_8184290: @ 8184290 ldrh r3, [r4, 0x3A] adds r0, r4, 0 adds r1, r2, 0 - bl sub_817F6D4 + bl HandleSetAffineData pop {r4} pop {r0} bx r0 @@ -9787,7 +7830,7 @@ pokemonanimfunc_82: @ 81842DC cmp r5, 0 bne _08184300 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x3C strh r0, [r4, 0x3C] movs r0, 0x8 @@ -9809,7 +7852,7 @@ _08184300: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r2, 0 strh r2, [r4, 0x24] strh r2, [r4, 0x26] @@ -9824,7 +7867,7 @@ _08184300: bgt _08184348 adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08184358 .pool @@ -9853,7 +7896,7 @@ pokemonanimfunc_83: @ 8184360 cmp r5, 0 bne _08184384 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x5A strh r0, [r4, 0x3C] movs r0, 0x8 @@ -9875,7 +7918,7 @@ _08184384: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r2, 0 strh r2, [r4, 0x24] strh r2, [r4, 0x26] @@ -9890,7 +7933,7 @@ _08184384: bgt _081843CC adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _081843DC .pool @@ -9919,7 +7962,7 @@ pokemonanimfunc_84: @ 81843E4 cmp r5, 0 bne _08184408 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r0, 0x1E strh r0, [r4, 0x3C] movs r0, 0x8 @@ -9941,7 +7984,7 @@ _08184408: adds r0, r4, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData movs r2, 0 strh r2, [r4, 0x24] strh r2, [r4, 0x26] @@ -9956,7 +7999,7 @@ _08184408: bgt _08184450 adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _08184460 .pool @@ -9993,10 +8036,10 @@ sub_8184468: @ 8184468 adds r0, r6, 0 adds r1, r2, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData adds r0, r6, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r6, 0x1C] b _08184544 .pool @@ -10080,7 +8123,7 @@ _08184530: ldrsh r2, [r6, r0] adds r0, r6, 0 movs r3, 0 - bl sub_817F6D4 + bl HandleSetAffineData _08184544: ldrh r0, [r6, 0x32] adds r0, 0x1 @@ -10099,7 +8142,7 @@ pokemonanimfunc_85: @ 8184550 cmp r0, 0 bne _08184570 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x26] adds r0, 0x2 strh r0, [r4, 0x26] @@ -10124,7 +8167,7 @@ pokemonanimfunc_86: @ 818457C cmp r0, 0 bne _0818459A adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x26] adds r0, 0x2 strh r0, [r4, 0x26] @@ -10148,7 +8191,7 @@ pokemonanimfunc_87: @ 81845A8 cmp r0, 0 bne _081845C6 adds r0, r4, 0 - bl sub_817F670 + bl HandleStartAffineAnim ldrh r0, [r4, 0x26] adds r0, 0x2 strh r0, [r4, 0x26] @@ -10299,7 +8342,7 @@ sub_81846B8: @ 81846B8 strh r0, [r4, 0x24] adds r0, r4, 0 bl sub_817F77C - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] _081846DA: adds r0, r4, 0 @@ -10314,7 +8357,7 @@ _081846DA: pokemonanimfunc_88: @ 81846EC push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r2, 0 movs r1, 0x4 strh r1, [r4, 0x3C] @@ -10338,7 +8381,7 @@ pokemonanimfunc_88: @ 81846EC pokemonanimfunc_89: @ 8184718 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r2, 0 movs r1, 0x2 strh r1, [r4, 0x3C] @@ -10362,7 +8405,7 @@ pokemonanimfunc_89: @ 8184718 pokemonanimfunc_8A: @ 8184744 push {r4,lr} adds r4, r0, 0 - bl sub_817F670 + bl HandleStartAffineAnim movs r1, 0 strh r1, [r4, 0x3C] movs r0, 0x6 @@ -10427,7 +8470,7 @@ sub_8184798: @ 8184798 bne _081847D0 movs r0, 0 strh r0, [r4, 0x24] - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _0818482E .pool @@ -10594,7 +8637,7 @@ sub_81848E0: @ 81848E0 movs r2, 0 movs r3, 0x1F bl BlendPalette - ldr r0, =sub_8184D88 + ldr r0, =SpriteCB_SetDummyOnAnimEnd str r0, [r4, 0x1C] b _0818492A .pool @@ -11223,8 +9266,8 @@ _08184D7A: bx r0 thumb_func_end pokemonanimfunc_96 - thumb_func_start sub_8184D88 -sub_8184D88: @ 8184D88 + thumb_func_start SpriteCB_SetDummyOnAnimEnd +SpriteCB_SetDummyOnAnimEnd: @ 8184D88 push {lr} adds r2, r0, 0 adds r0, 0x3F @@ -11239,6 +9282,6 @@ _08184D9C: pop {r0} bx r0 .pool - thumb_func_end sub_8184D88 + thumb_func_end SpriteCB_SetDummyOnAnimEnd .align 2, 0 @ Don't pad with nop. diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 960b42dd1..1cac2c473 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -4,10 +4,11 @@ #include "pokemon_animation.h" #include "trig.h" #include "task.h" +#include "blend_palette.h" struct UnkAnimStruct { - s16 field_0; + u16 field_0; s16 field_2; s16 field_4; s16 field_6; @@ -172,6 +173,8 @@ void pokemonanimfunc_94(struct Sprite *sprite); void pokemonanimfunc_95(struct Sprite *sprite); void pokemonanimfunc_96(struct Sprite *sprite); +void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite); + // const rom data static const u8 sSpeciesToBackAnimId[] = { @@ -591,7 +594,13 @@ static const u8 sSpeciesToBackAnimId[] = 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_0860AA80[] = {0x06, 0x1e, 0xfe, 0x0f, 0x06, 0x1e, 0xff, 0x00}; +const u8 gUnknown_0860AA80[][2] = +{ + {6, 30}, + {0xFE, 15}, + {6, 30}, + {0xFF, 0} +}; static void (* const sMonAnimFunctions[])(struct Sprite *sprite) = { @@ -825,6 +834,8 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_860AD68[] = gSpriteAffineAnim_860AD58 }; +extern const s8 gUnknown_0860AD70[][3]; + // code void MonAnimDummySpriteCallback(struct Sprite *sprite) { @@ -919,7 +930,7 @@ void sub_817F60C(struct Sprite *sprite) sprite->callback = MonAnimDummySpriteCallback; } -void sub_817F618(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +void SetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) { u8 matrixNum; struct ObjAffineSrcData affineSrcData; @@ -938,7 +949,7 @@ void sub_817F618(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) gOamMatrices[matrixNum].d = dest.d; } -void sub_817F670(struct Sprite *sprite) +void HandleStartAffineAnim(struct Sprite *sprite) { sprite->oam.affineMode = 3; sprite->affineAnims = gSpriteAffineAnimTable_860AD68; @@ -955,7 +966,7 @@ void sub_817F670(struct Sprite *sprite) sprite->affineAnimPaused = 1; } -void sub_817F6D4(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +void HandleSetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) { if (!sprite->data[1]) { @@ -963,7 +974,7 @@ void sub_817F6D4(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) rotation *= -1; } - sub_817F618(sprite, xScale, yScale, rotation); + SetAffineData(sprite, xScale, yScale, rotation); } void sub_817F70C(struct Sprite *sprite) @@ -1013,3 +1024,807 @@ void sub_817F77C(struct Sprite *sprite) sprite->oam.affineMode = 0; } } + +void pokemonanimfunc_01(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 var = (sprite->data[2] * 512 / 40) % 256; + + sprite->data[4] = Sin(var, 32) + 256; + sprite->data[5] = Cos(var, 32) + 256; + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_02(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 var; + + if (!(sprite->data[2] & 1)) + var = 1; + else + var = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 6) * var; + } + + sprite->data[2]++; +} + +void sub_817F8FC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + sprite->pos2.x = Sin((sprite->data[2] * 384 / sprite->data[0]) % 256, 6); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_03(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +void sub_817F978(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = -(Sin((sprite->data[2] * 384 / sprite->data[0]) % 256, 6)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_04(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sub_817F978(sprite); + sprite->callback = sub_817F978; +} + +#ifdef NONMATCHING +void sub_817F9F4(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 384) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s32 divCounter = counter / 128; + + switch (divCounter) + { + case 0: + case 1: + sprite->pos2.y = -(Sin(counter % 128, sprite->data[0] * 2)); + break; + case 2: + case 3: + sprite->pos2.y = -(Sin(counter - 256, sprite->data[0] * 3)); + break; + } + } + + sprite->data[2] += 12; +} + +#else +__attribute__((naked)) +void sub_817F9F4(struct Sprite *sprite) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r4, r0, 0\n\ + movs r0, 0x32\n\ + ldrsh r1, [r4, r0]\n\ + movs r0, 0xC0\n\ + lsls r0, 1\n\ + cmp r1, r0\n\ + ble _0817FA14\n\ + ldr r0, =SpriteCB_SetDummyOnAnimEnd\n\ + str r0, [r4, 0x1C]\n\ + movs r0, 0\n\ + strh r0, [r4, 0x24]\n\ + b _0817FA5E\n\ + .pool\n\ +_0817FA14:\n\ + adds r0, r1, 0\n\ + cmp r1, 0\n\ + bge _0817FA1C\n\ + adds r0, 0x7F\n\ +_0817FA1C:\n\ + asrs r2, r0, 7\n\ + lsls r0, r2, 16\n\ + asrs r0, 16\n\ + cmp r0, 0\n\ + blt _0817FA60\n\ + cmp r0, 0x1\n\ + ble _0817FA48\n\ + cmp r0, 0x3\n\ + bgt _0817FA60\n\ + ldr r2, =0xffffff00\n\ + adds r1, r2\n\ + lsls r0, r1, 16\n\ + asrs r0, 16\n\ + movs r1, 0x2E\n\ + ldrsh r2, [r4, r1]\n\ + lsls r1, r2, 1\n\ + adds r1, r2\n\ + lsls r1, 16\n\ + b _0817FA56\n\ + .pool\n\ +_0817FA48:\n\ + lsls r0, r2, 7\n\ + subs r0, r1, r0\n\ + lsls r0, 16\n\ + asrs r0, 16\n\ + movs r2, 0x2E\n\ + ldrsh r1, [r4, r2]\n\ + lsls r1, 17\n\ +_0817FA56:\n\ + asrs r1, 16\n\ + bl Sin\n\ + negs r0, r0\n\ +_0817FA5E:\n\ + strh r0, [r4, 0x26]\n\ +_0817FA60:\n\ + ldrh r0, [r4, 0x32]\n\ + adds r0, 0xC\n\ + strh r0, [r4, 0x32]\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +#endif // NONMATCHING + +void pokemonanimfunc_1E(struct Sprite *sprite) +{ + sprite->data[0] = 4; + sub_817F9F4(sprite); + sprite->callback = sub_817F9F4; +} + +void pokemonanimfunc_06(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 768) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s16 divCounter = counter / 128; + + switch (divCounter) + { + case 0: + case 1: + sprite->pos2.x = 0; + break; + case 2: + counter = 0; + break; + case 3: + sprite->pos2.x = -(counter % 128 * 8) / 128; + break; + case 4: + sprite->pos2.x = (counter % 128) / 8 - 8; + break; + case 5: + sprite->pos2.x = -(counter % 128 * 8) / 128 + 8; + break; + } + + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; +} + +void pokemonanimfunc_09(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] * 256 / 40) % 256; + + if (sprite->data[2] % 2 == 0) + { + sprite->data[4] = Sin(index, 32) + 256; + sprite->data[5] = Sin(index, 32) + 256; + } + else + { + sprite->data[4] = Sin(index, 8) + 256; + sprite->data[5] = Sin(index, 8) + 256; + } + + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +void sub_817FC20(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] == 0) + sprite->data[3] = 0; + + if (gUnknown_0860AD70[sprite->data[3]][2] == sprite->data[2]) + { + if (gUnknown_0860AD70[sprite->data[3]][2] == 0) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[3]++; + sprite->data[2] = 0; + } + } + + if (gUnknown_0860AD70[sprite->data[3]][2] == 0) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->pos2.x += gUnknown_0860AD70[sprite->data[3]][0]; + sprite->pos2.y += gUnknown_0860AD70[sprite->data[3]][1]; + sprite->data[2]++; + sub_817F70C(sprite); + } +} + +void pokemonanimfunc_0A(struct Sprite *sprite) +{ + sub_817FC20(sprite); + sprite->callback = sub_817FC20; +} + +void sub_817FCDC(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + sprite->pos2.x = Sin(counter % 256, sprite->data[7]); + } + + sprite->data[2] += sprite->data[0]; +} + +void pokemonanimfunc_0F(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sprite->data[7] = 3; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +void sub_817FD44(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin(counter % 256, 3); + } + + sprite->data[2] += sprite->data[0]; +} + +void pokemonanimfunc_10(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sub_817FD44(sprite); + sprite->callback = sub_817FD44; +} + +void pokemonanimfunc_11(struct Sprite *sprite) +{ + if (sprite->data[2] > 512) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s8 var; + s32 index, amplitude; + + if (!(sprite->data[2] & 1)) + var = 1; + else + var = -1; + + amplitude = Sin(sprite->data[2] / 4, 8); + index = sprite->data[2] % 256; + + sprite->pos2.y = Sin(index, amplitude) * var; + sprite->pos2.x = Cos(index, amplitude) * var; + } + + sprite->data[2] += 9; +} + +void sub_817FE30(struct Sprite *sprite) +{ + s16 id = sprite->data[0]; + + if (gUnknown_03001240[id].field_0 != 0) + { + gUnknown_03001240[id].field_0--; + } + else + { + if (sprite->data[2] == 0 && gUnknown_03001240[id].field_8 == 0) + { + HandleStartAffineAnim(sprite); + gUnknown_03001240[id].field_8++; + } + + if (sprite->data[2] > gUnknown_03001240[id].field_6) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + + if (gUnknown_03001240[id].field_4 > 1) + { + gUnknown_03001240[id].field_4--; + gUnknown_03001240[id].field_0 = 10; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + sprite->data[6] = Sin(sprite->data[2] % 256, 4096); + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6]); + } + + sprite->data[2] += 16; + } +} + +void pokemonanimfunc_12(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 512; + gUnknown_03001240[id].field_0 = 0; + sub_817FE30(sprite); + sprite->callback = sub_817FE30; +} + +void sub_817FF3C(struct Sprite *sprite) +{ + u8 id = sprite->data[0]; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > gUnknown_03001240[id].field_0) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = (65536 / gUnknown_03001240[id].field_8) * sprite->data[2]; + HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6]); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_1F(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_0 = 60; + gUnknown_03001240[id].field_8 = 20; + sub_817FF3C(sprite); + sprite->callback = sub_817FF3C; +} + +void sub_817FFF0(struct Sprite *sprite) +{ + u8 id = sprite->data[0]; + + sub_817F70C(sprite); + + if (sprite->data[2] > gUnknown_03001240[id].field_6) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] + 192) % 256; + + sprite->pos2.x = -(Cos(index, gUnknown_03001240[id].field_8 * 2)); + sprite->pos2.y = Sin(index, gUnknown_03001240[id].field_8) + gUnknown_03001240[id].field_8; + } + + sprite->data[2] += gUnknown_03001240[id].field_2; + sub_817F70C(sprite); +} + +void pokemonanimfunc_14(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 512; + gUnknown_03001240[id].field_8 = 6; + gUnknown_03001240[id].field_2 = 24; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +void pokemonanimfunc_15(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, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 16); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_16(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index2 = (sprite->data[2] * 128) / 40; + + if (sprite->data[2] >= 10 && sprite->data[2] <= 29) + { + sprite->data[7] += 51; + index1 = 0xFF & sprite->data[7]; + } + + if (sprite->data[1] == 0) + sprite->data[4] = (Sin(index2, 40) - 256) + Sin(index1, 16); + else + sprite->data[4] = (256 - Sin(index2, 40)) - Sin(index1, 16); + + sprite->data[5] = Sin(index2, 16) + 256; + SetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_17(struct Sprite *sprite) +{ + s16 posY = 0, index1 = 0, index2 = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = posY; + } + else + { + index2 = (sprite->data[2] * 128) / 40; + + if (sprite->data[2] >= 10 && sprite->data[2] <= 29) + { + sprite->data[7] += 51; + index1 = 0xFF & sprite->data[7]; + } + + if (sprite->data[1] == 0) + sprite->data[4] = -(Sin(index2, 16)) - 256; + else + sprite->data[4] = Sin(index2, 16) + 256; + + sprite->data[5] = (256 - Sin(index2, 40)) - Sin(index1, 8); + + if (sprite->data[5] != 256) + posY = (256 - sprite->data[5]) / 8; + + sprite->pos2.y = -(posY); + SetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +void sub_818031C(struct Sprite *sprite) +{ + u8 index = sprite->data[2]; + u8 var7 = sprite->data[6]; + u8 var5 = gUnknown_0860AA80[sprite->data[5]][0]; + u8 var6 = gUnknown_0860AA80[sprite->data[5]][1]; + u8 amplitude = 0; + + if (var5 != 0xFE) + amplitude = (var6 - var7) * var5 / var6; + else + amplitude = 0; + + if (var5 == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin(index, amplitude); + + if (var7 == var6) + { + sprite->data[5]++; + sprite->data[6] = 0; + } + else + { + sprite->data[2] += sprite->data[0]; + sprite->data[6]++; + } + } +} + +void pokemonanimfunc_19(struct Sprite *sprite) +{ + sprite->data[0] = 48; + sub_818031C(sprite); + sprite->callback = sub_818031C; +} + +void pokemonanimfunc_1A(struct Sprite *sprite) +{ + u8 counter = 0; + + sub_817F70C(sprite); + counter = sprite->data[2]; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 35) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s16 index = ((counter - 10) * 128) / 20; + + if (counter < 10) + HandleSetAffineData(sprite, 0x100, 0x100, counter / 2 * 512); + else if (counter >= 10 && counter <= 29) + sprite->pos2.x = -(Sin(index, 5)); + else + HandleSetAffineData(sprite, 0x100, 0x100, (35 - counter) / 2 * 1024); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_1B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] * 256) / 100; + sprite->pos2.y = Sin(index, 10); + HandleSetAffineData(sprite, 0x100, 0x100, Sin(index, 3276)); + } + + sprite->data[2]++; +} + +void sub_81804F8(struct Sprite *sprite) +{ + s32 var = 0; + s16 index = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index = (sprite->data[2] * 256) / 100; + var = (sprite->data[2] * 512) / 100; + var &= 0xFF; + sprite->pos2.y = Sin(index, sprite->data[0]); + HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_1C(struct Sprite *sprite) +{ + sprite->data[0] = 10; + sub_81804F8(sprite); + sprite->callback = sub_81804F8; +} + +void sub_81805B0(struct Sprite *sprite) +{ + s32 var = 0; + s16 index = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index = (sprite->data[2] * 256) / 100; + var = (sprite->data[2] * 512) / 100; + var &= 0xFF; + sprite->pos2.y = -(Sin(index / 2, sprite->data[0] * 2)); + HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + } + + sprite->data[2]++; +} + +void pokemonanimfunc_18(struct Sprite *sprite) +{ + sprite->data[0] = 5; + sub_81805B0(sprite); + sprite->callback = sub_81805B0; +} + +void pokemonanimfunc_1D(struct Sprite *sprite) +{ + s32 var; + s16 index = 0; + + sub_817F70C(sprite); + var = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 toDiv = 100; + + index = (sprite->data[2] * 256) / toDiv; + var = (sprite->data[2] * 512) / toDiv; + var &= 0xFF; + sprite->pos2.x = Sin(index, 8); + HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} From 7231aa2658e9c38f14ba3f319f45f83c9da0dea5 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 24 Jan 2018 16:45:37 -0500 Subject: [PATCH 04/15] got it almost matching --- src/text.c | 4117 ++++++++++++++++++++++++++++------------------------ 1 file changed, 2211 insertions(+), 1906 deletions(-) diff --git a/src/text.c b/src/text.c index 5db3ba308..6be46b7b1 100644 --- a/src/text.c +++ b/src/text.c @@ -1,6 +1,9 @@ #include "global.h" +#include "battle.h" #include "main.h" +#include "m4a.h" #include "palette.h" +#include "sound.h" #include "string_util.h" #include "window.h" #include "text.h" @@ -14,6 +17,7 @@ extern u16 Font6Func(struct TextPrinter *textPrinter); extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); extern void PlaySE(u16 songNum); extern u8* UnkTextUtil_GetPtrI(u8 a1); +extern int sub_8197964(); EWRAM_DATA struct TextPrinter gTempTextPrinter = {0}; EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {0}; @@ -24,6 +28,7 @@ static u16 gLastTextFgColor; static u16 gLastTextShadowColor; extern struct Main gMain; +extern struct MusicPlayerInfo gMPlayInfo_BGM; const struct FontInfo *gFonts; u8 gUnknown_03002F84; @@ -35,22 +40,22 @@ u8 gGlyphDimensions[0x2]; TextFlags gTextFlags; const u8 gFontHalfRowOffsets[] = { - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x09, 0x0A, 0x0B, 0x09, 0x0C, 0x0D, 0x0E, 0x0C, 0x0F, 0x10, 0x11, 0x0F, 0x09, 0x0A, 0x0B, 0x09, 0x12, 0x13, 0x14, 0x12, 0x15, 0x16, 0x17, 0x15, 0x18, 0x19, 0x1A, 0x18, 0x12, 0x13, 0x14, 0x12, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x1B, 0x1C, 0x1D, 0x1B, 0x1E, 0x1F, 0x20, 0x1E, 0x21, 0x22, 0x23, 0x21, 0x1B, 0x1C, 0x1D, 0x1B, 0x24, 0x25, 0x26, 0x24, 0x27, 0x28, 0x29, 0x27, 0x2A, 0x2B, 0x2C, 0x2A, 0x24, 0x25, 0x26, 0x24, - 0x2D, 0x2E, 0x2F, 0x2D, 0x30, 0x31, 0x32, 0x30, 0x33, 0x34, 0x35, 0x33, 0x2D, 0x2E, 0x2F, 0x2D, + 0x2D, 0x2E, 0x2F, 0x2D, 0x30, 0x31, 0x32, 0x30, 0x33, 0x34, 0x35, 0x33, 0x2D, 0x2E, 0x2F, 0x2D, 0x1B, 0x1C, 0x1D, 0x1B, 0x1E, 0x1F, 0x20, 0x1E, 0x21, 0x22, 0x23, 0x21, 0x1B, 0x1C, 0x1D, 0x1B, 0x36, 0x37, 0x38, 0x36, 0x39, 0x3A, 0x3B, 0x39, 0x3C, 0x3D, 0x3E, 0x3C, 0x36, 0x37, 0x38, 0x36, - 0x3F, 0x40, 0x41, 0x3F, 0x42, 0x43, 0x44, 0x42, 0x45, 0x46, 0x47, 0x45, 0x3F, 0x40, 0x41, 0x3F, + 0x3F, 0x40, 0x41, 0x3F, 0x42, 0x43, 0x44, 0x42, 0x45, 0x46, 0x47, 0x45, 0x3F, 0x40, 0x41, 0x3F, 0x48, 0x49, 0x4A, 0x48, 0x4B, 0x4C, 0x4D, 0x4B, 0x4E, 0x4F, 0x50, 0x4E, 0x48, 0x49, 0x4A, 0x48, 0x36, 0x37, 0x38, 0x36, 0x39, 0x3A, 0x3B, 0x39, 0x3C, 0x3D, 0x3E, 0x3C, 0x36, 0x37, 0x38, 0x36, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x09, 0x0A, 0x0B, 0x09, 0x0C, 0x0D, 0x0E, 0x0C, 0x0F, 0x10, 0x11, 0x0F, 0x09, 0x0A, 0x0B, 0x09, 0x12, 0x13, 0x14, 0x12, 0x15, 0x16, 0x17, 0x15, 0x18, 0x19, 0x1A, 0x18, 0x12, 0x13, 0x14, 0x12, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 }; const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4bpp"); @@ -378,460 +383,460 @@ __attribute__((naked)) void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x24\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - lsl r1, #24\n\ - lsr r1, #24\n\ - lsl r2, #24\n\ - lsr r2, #24\n\ - ldr r3, =gFontHalfRowLookupTable\n\ - ldr r4, =gLastTextBgColor\n\ - strh r1, [r4]\n\ - ldr r4, =gLastTextFgColor\n\ - strh r0, [r4]\n\ - ldr r4, =gLastTextShadowColor\n\ - strh r2, [r4]\n\ - lsl r5, r1, #12\n\ - lsl r6, r0, #12\n\ - lsl r4, r2, #12\n\ - mov r8, r4\n\ - lsl r7, r1, #8\n\ - str r7, [sp]\n\ - lsl r4, r1, #4\n\ - mov r9, r4\n\ - orr r7, r4\n\ - str r7, [sp, #0x4]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #8\n\ - mov r10, r7\n\ - mov r4, r10\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x8]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #8\n\ - mov r12, r7\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0xC]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #4\n\ - mov r9, r7\n\ - ldr r4, [sp]\n\ - orr r4, r7\n\ - str r4, [sp, #0x10]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r10\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x14]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r12\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x18]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #4\n\ - mov r9, r7\n\ - mov r4, r9\n\ - ldr r7, [sp]\n\ - orr r7, r4\n\ - str r7, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r9\n\ - mov r4, r10\n\ - orr r4, r7\n\ - str r4, [sp, #0x20]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x4]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x8]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0xC]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x10]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x14]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x18]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x1C]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x20]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r4, #0\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r0, [sp, #0x4]\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x8]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0xC]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x10]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x14]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x18]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x20]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - orr r7, r4\n\ - orr r5, r7\n\ - strh r5, [r3]\n\ - add r3, #0x2\n\ - orr r6, r7\n\ - strh r6, [r3]\n\ - orr r0, r7\n\ - strh r0, [r3, #0x2]\n\ - add sp, #0x24\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, #0x24\n\ + lsl r0, #24\n\ + lsr r0, #24\n\ + lsl r1, #24\n\ + lsr r1, #24\n\ + lsl r2, #24\n\ + lsr r2, #24\n\ + ldr r3, =gFontHalfRowLookupTable\n\ + ldr r4, =gLastTextBgColor\n\ + strh r1, [r4]\n\ + ldr r4, =gLastTextFgColor\n\ + strh r0, [r4]\n\ + ldr r4, =gLastTextShadowColor\n\ + strh r2, [r4]\n\ + lsl r5, r1, #12\n\ + lsl r6, r0, #12\n\ + lsl r4, r2, #12\n\ + mov r8, r4\n\ + lsl r7, r1, #8\n\ + str r7, [sp]\n\ + lsl r4, r1, #4\n\ + mov r9, r4\n\ + orr r7, r4\n\ + str r7, [sp, #0x4]\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r0, #8\n\ + mov r10, r7\n\ + mov r4, r10\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x8]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r2, #8\n\ + mov r12, r7\n\ + mov r4, r12\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0xC]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r0, #4\n\ + mov r9, r7\n\ + ldr r4, [sp]\n\ + orr r4, r7\n\ + str r4, [sp, #0x10]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r10\n\ + add r4, r7, #0\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x14]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r12\n\ + add r4, r7, #0\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x18]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r2, #4\n\ + mov r9, r7\n\ + mov r4, r9\n\ + ldr r7, [sp]\n\ + orr r7, r4\n\ + str r7, [sp, #0x1C]\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r9\n\ + mov r4, r10\n\ + orr r4, r7\n\ + str r4, [sp, #0x20]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r4, r12\n\ + mov r7, r9\n\ + orr r4, r7\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x4]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x8]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0xC]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x10]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x14]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x18]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x1C]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x20]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r4, #0\n\ + orr r7, r0\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r0, [sp, #0x4]\n\ + orr r7, r0\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x8]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0xC]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x10]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x14]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x18]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x1C]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x20]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + orr r7, r4\n\ + orr r5, r7\n\ + strh r5, [r3]\n\ + add r3, #0x2\n\ + orr r6, r7\n\ + strh r6, [r3]\n\ + orr r0, r7\n\ + strh r0, [r3, #0x2]\n\ + add sp, #0x24\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } #endif @@ -874,165 +879,165 @@ __attribute__((naked)) void DecompressGlyphTile(const u16 *src, u16 *dest) { asm("push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - ldrh r7, [r0]\n\ - ldr r5, =gFontHalfRowLookupTable\n\ - ldr r4, =gFontHalfRowOffsets\n\ - mov r2, #0xFF\n\ - mov r8, r2\n\ - add r2, r7, #0\n\ - mov r3, r8\n\ - and r2, r3\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r3, [r2]\n\ - lsl r3, #16\n\ - lsr r2, r7, #8\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r2, [r2]\n\ - orr r3, r2\n\ - add r6, r1, #0\n\ - stmia r6!, {r3}\n\ - ldrh r7, [r0, #0x2]\n\ - add r0, #0x4\n\ - add r2, r7, #0\n\ - mov r3, r8\n\ - and r2, r3\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r3, [r2]\n\ - lsl r3, #16\n\ - lsr r2, r7, #8\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r2, [r2]\n\ - orr r3, r2\n\ - str r3, [r1, #0x4]\n\ - add r6, #0x4\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - mov r2, r8\n\ - and r1, r2\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - mov r3, r8\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0, #0x2]\n\ - add r0, r7, #0\n\ - and r0, r3\n\ - add r0, r4\n\ - ldrb r0, [r0]\n\ - lsl r0, #1\n\ - add r0, r5\n\ - ldrh r1, [r0]\n\ - lsl r1, #16\n\ - lsr r0, r7, #8\n\ - add r0, r4\n\ - ldrb r0, [r0]\n\ - lsl r0, #1\n\ - add r0, r5\n\ - ldrh r0, [r0]\n\ - orr r1, r0\n\ - str r1, [r6]\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + mov r7, r8\n\ + push {r7}\n\ + ldrh r7, [r0]\n\ + ldr r5, =gFontHalfRowLookupTable\n\ + ldr r4, =gFontHalfRowOffsets\n\ + mov r2, #0xFF\n\ + mov r8, r2\n\ + add r2, r7, #0\n\ + mov r3, r8\n\ + and r2, r3\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r3, [r2]\n\ + lsl r3, #16\n\ + lsr r2, r7, #8\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r2, [r2]\n\ + orr r3, r2\n\ + add r6, r1, #0\n\ + stmia r6!, {r3}\n\ + ldrh r7, [r0, #0x2]\n\ + add r0, #0x4\n\ + add r2, r7, #0\n\ + mov r3, r8\n\ + and r2, r3\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r3, [r2]\n\ + lsl r3, #16\n\ + lsr r2, r7, #8\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r2, [r2]\n\ + orr r3, r2\n\ + str r3, [r1, #0x4]\n\ + add r6, #0x4\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + mov r2, r8\n\ + and r1, r2\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + mov r3, r8\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0, #0x2]\n\ + add r0, r7, #0\n\ + and r0, r3\n\ + add r0, r4\n\ + ldrb r0, [r0]\n\ + lsl r0, #1\n\ + add r0, r5\n\ + ldrh r1, [r0]\n\ + lsl r1, #16\n\ + lsr r0, r7, #8\n\ + add r0, r4\n\ + ldrb r0, [r0]\n\ + lsl r0, #1\n\ + add r0, r5\n\ + ldrh r0, [r0]\n\ + orr r1, r0\n\ + str r1, [r6]\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } #endif @@ -1055,703 +1060,703 @@ __attribute__((naked)) void CopyGlyphToWindow(struct TextPrinter *x) { asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x8C\n\ - add r3, r0, #0\n\ - ldrb r1, [r3, #0x4]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - ldr r1, =gWindows\n\ - add r1, r0, r1\n\ - add r2, r1, #0\n\ - ldrb r7, [r1, #0x3]\n\ - lsl r0, r7, #3\n\ - ldrb r6, [r3, #0x8]\n\ - sub r4, r0, r6\n\ - ldr r5, =gUnknown_03002F90\n\ - add r0, r5, #0\n\ - add r0, #0x80\n\ - ldrb r0, [r0]\n\ - cmp r4, r0\n\ - ble _08004DD2\n\ - add r4, r0, #0\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, #0x8C\n\ + add r3, r0, #0\n\ + ldrb r1, [r3, #0x4]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + ldr r1, =gWindows\n\ + add r1, r0, r1\n\ + add r2, r1, #0\n\ + ldrb r7, [r1, #0x3]\n\ + lsl r0, r7, #3\n\ + ldrb r6, [r3, #0x8]\n\ + sub r4, r0, r6\n\ + ldr r5, =gUnknown_03002F90\n\ + add r0, r5, #0\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + ble _08004DD2\n\ + add r4, r0, #0\n\ _08004DD2:\n\ - ldrb r0, [r1, #0x4]\n\ - lsl r0, #3\n\ - ldrb r3, [r3, #0x9]\n\ - sub r0, r3\n\ - add r1, r5, #0\n\ - add r1, #0x81\n\ - ldrb r1, [r1]\n\ - cmp r0, r1\n\ - ble _08004DE6\n\ - add r0, r1, #0\n\ + ldrb r0, [r1, #0x4]\n\ + lsl r0, #3\n\ + ldrb r3, [r3, #0x9]\n\ + sub r0, r3\n\ + add r1, r5, #0\n\ + add r1, #0x81\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + ble _08004DE6\n\ + add r0, r1, #0\n\ _08004DE6:\n\ - str r6, [sp]\n\ - mov r8, r3\n\ - add r3, r5, #0\n\ - ldr r2, [r2, #0x8]\n\ - mov r9, r2\n\ - lsl r1, r7, #5\n\ - str r1, [sp, #0x4]\n\ - cmp r4, #0x8\n\ - ble _08004DFA\n\ - b _08004F94\n\ + str r6, [sp]\n\ + mov r8, r3\n\ + add r3, r5, #0\n\ + ldr r2, [r2, #0x8]\n\ + mov r9, r2\n\ + lsl r1, r7, #5\n\ + str r1, [sp, #0x4]\n\ + cmp r4, #0x8\n\ + ble _08004DFA\n\ + b _08004F94\n\ _08004DFA:\n\ - cmp r0, #0x8\n\ - bgt _08004E84\n\ - mov r1, r8\n\ - str r3, [sp, #0x8]\n\ - add r2, r6, #0\n\ - add r2, r4\n\ - mov r8, r2\n\ - add r0, r1, r0\n\ - str r0, [sp, #0xC]\n\ - str r6, [sp, #0x10]\n\ - cmp r1, r0\n\ - bcc _08004E14\n\ - b _080052AA\n\ + cmp r0, #0x8\n\ + bgt _08004E84\n\ + mov r1, r8\n\ + str r3, [sp, #0x8]\n\ + add r2, r6, #0\n\ + add r2, r4\n\ + mov r8, r2\n\ + add r0, r1, r0\n\ + str r0, [sp, #0xC]\n\ + str r6, [sp, #0x10]\n\ + cmp r1, r0\n\ + bcc _08004E14\n\ + b _080052AA\n\ _08004E14:\n\ - ldr r3, [sp, #0x8]\n\ - ldm r3!, {r5}\n\ - str r3, [sp, #0x8]\n\ - ldr r4, [sp, #0x10]\n\ - add r0, r1, #0x1\n\ - mov r10, r0\n\ - cmp r4, r8\n\ - bcs _08004E72\n\ - mov r2, #0x7\n\ - mov r12, r2\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, r12\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r3, [sp, #0x8]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x8]\n\ + ldr r4, [sp, #0x10]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _08004E72\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08004E38:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _08004E6A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _08004E6A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004E6A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08004E38\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004E38\n\ _08004E72:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0xC]\n\ - cmp r1, r2\n\ - bcc _08004E14\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0xC]\n\ + cmp r1, r2\n\ + bcc _08004E14\n\ + b _080052AA\n\ + .pool\n\ _08004E84:\n\ - mov r1, r8\n\ - str r3, [sp, #0x14]\n\ - ldr r3, [sp]\n\ - add r3, r4\n\ - mov r12, r3\n\ - add r2, r1, #0\n\ - add r2, #0x8\n\ - str r2, [sp, #0x18]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x1C]\n\ - mov r2, r12\n\ - str r2, [sp, #0x74]\n\ - ldr r3, [sp, #0x18]\n\ - str r3, [sp, #0x88]\n\ - sub r0, #0x8\n\ - str r0, [sp, #0x80]\n\ - cmp r1, r3\n\ - bcs _08004F0E\n\ + mov r1, r8\n\ + str r3, [sp, #0x14]\n\ + ldr r3, [sp]\n\ + add r3, r4\n\ + mov r12, r3\n\ + add r2, r1, #0\n\ + add r2, #0x8\n\ + str r2, [sp, #0x18]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x1C]\n\ + mov r2, r12\n\ + str r2, [sp, #0x74]\n\ + ldr r3, [sp, #0x18]\n\ + str r3, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + cmp r1, r3\n\ + bcs _08004F0E\n\ _08004EA8:\n\ - ldr r0, [sp, #0x14]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x14]\n\ - ldr r4, [sp, #0x1C]\n\ - add r2, r1, #0x1\n\ - mov r8, r2\n\ - cmp r4, r12\n\ - bcs _08004F06\n\ - mov r3, #0x7\n\ - mov r10, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r10\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x14]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x14]\n\ + ldr r4, [sp, #0x1C]\n\ + add r2, r1, #0x1\n\ + mov r8, r2\n\ + cmp r4, r12\n\ + bcs _08004F06\n\ + mov r3, #0x7\n\ + mov r10, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r10\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _08004ECC:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _08004EFE\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r10\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004EFE\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r10\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004EFE:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _08004ECC\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004ECC\n\ _08004F06:\n\ - mov r1, r8\n\ - ldr r2, [sp, #0x18]\n\ - cmp r1, r2\n\ - bcc _08004EA8\n\ + mov r1, r8\n\ + ldr r2, [sp, #0x18]\n\ + cmp r1, r2\n\ + bcc _08004EA8\n\ _08004F0E:\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FD0\n\ - str r3, [sp, #0x20]\n\ - ldr r0, [sp, #0x74]\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x24]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x28]\n\ - cmp r1, r2\n\ - bcc _08004F28\n\ - b _080052AA\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x20]\n\ + ldr r0, [sp, #0x74]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x24]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x28]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ _08004F28:\n\ - ldr r0, [sp, #0x20]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x20]\n\ - ldr r4, [sp, #0x28]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r8\n\ - bcs _08004F86\n\ - mov r3, #0x7\n\ - mov r12, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x20]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x20]\n\ + ldr r4, [sp, #0x28]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08004F86\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _08004F4C:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _08004F7E\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004F7E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004F7E:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08004F4C\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004F4C\n\ _08004F86:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x24]\n\ - cmp r1, r2\n\ - bcc _08004F28\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x24]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ + .pool\n\ _08004F94:\n\ - cmp r0, #0x8\n\ - ble _08004F9A\n\ - b _080050A4\n\ + cmp r0, #0x8\n\ + ble _08004F9A\n\ + b _080050A4\n\ _08004F9A:\n\ - mov r1, r8\n\ - str r3, [sp, #0x2C]\n\ - ldr r3, [sp]\n\ - add r3, #0x8\n\ - mov r12, r3\n\ - add r0, r8\n\ - str r0, [sp, #0x30]\n\ - ldr r0, [sp]\n\ - str r0, [sp, #0x34]\n\ - ldr r2, [sp, #0x30]\n\ - str r2, [sp, #0x78]\n\ - str r3, [sp, #0x84]\n\ - sub r4, #0x8\n\ - str r4, [sp, #0x7C]\n\ - cmp r8, r2\n\ - bcs _0800501C\n\ + mov r1, r8\n\ + str r3, [sp, #0x2C]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + add r0, r8\n\ + str r0, [sp, #0x30]\n\ + ldr r0, [sp]\n\ + str r0, [sp, #0x34]\n\ + ldr r2, [sp, #0x30]\n\ + str r2, [sp, #0x78]\n\ + str r3, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800501C\n\ _08004FBA:\n\ - ldr r0, [sp, #0x2C]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x2C]\n\ - ldr r4, [sp, #0x34]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r12\n\ - bcs _08005014\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, #0x7\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x2C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x2C]\n\ + ldr r4, [sp, #0x34]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r12\n\ + bcs _08005014\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, #0x7\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08004FDA:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _0800500C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, #0x7\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800500C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800500C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _08004FDA\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004FDA\n\ _08005014:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x30]\n\ - cmp r1, r2\n\ - bcc _08004FBA\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x30]\n\ + cmp r1, r2\n\ + bcc _08004FBA\n\ _0800501C:\n\ - mov r1, r8\n\ - ldr r3, =gUnknown_03002FB0\n\ - str r3, [sp, #0x38]\n\ - ldr r0, [sp, #0x84]\n\ - ldr r2, [sp, #0x7C]\n\ - add r0, r2\n\ - mov r8, r0\n\ - ldr r3, [sp, #0x78]\n\ - str r3, [sp, #0x3C]\n\ - ldr r0, [sp, #0x84]\n\ - str r0, [sp, #0x40]\n\ - cmp r1, r3\n\ - bcc _08005038\n\ - b _080052AA\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x38]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x78]\n\ + str r3, [sp, #0x3C]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x40]\n\ + cmp r1, r3\n\ + bcc _08005038\n\ + b _080052AA\n\ _08005038:\n\ - ldr r2, [sp, #0x38]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x38]\n\ - ldr r4, [sp, #0x40]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r8\n\ - bcs _08005096\n\ - mov r0, #0x7\n\ - mov r12, r0\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x38]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x38]\n\ + ldr r4, [sp, #0x40]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _08005096\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _0800505C:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800508E\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800508E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800508E:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _0800505C\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800505C\n\ _08005096:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x3C]\n\ - cmp r1, r2\n\ - bcc _08005038\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x3C]\n\ + cmp r1, r2\n\ + bcc _08005038\n\ + b _080052AA\n\ + .pool\n\ _080050A4:\n\ - mov r1, r8\n\ - str r5, [sp, #0x44]\n\ - ldr r3, [sp]\n\ - add r3, #0x8\n\ - mov r12, r3\n\ - mov r2, r8\n\ - add r2, #0x8\n\ - str r2, [sp, #0x48]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x4C]\n\ - str r2, [sp, #0x88]\n\ - sub r0, #0x8\n\ - str r0, [sp, #0x80]\n\ - mov r0, r12\n\ - str r0, [sp, #0x84]\n\ - sub r4, #0x8\n\ - str r4, [sp, #0x7C]\n\ - cmp r8, r2\n\ - bcs _0800512C\n\ + mov r1, r8\n\ + str r5, [sp, #0x44]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + mov r2, r8\n\ + add r2, #0x8\n\ + str r2, [sp, #0x48]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x4C]\n\ + str r2, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + mov r0, r12\n\ + str r0, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800512C\n\ _080050CA:\n\ - ldr r2, [sp, #0x44]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x44]\n\ - ldr r4, [sp, #0x4C]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r12\n\ - bcs _08005124\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, #0x7\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x44]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x44]\n\ + ldr r4, [sp, #0x4C]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r12\n\ + bcs _08005124\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, #0x7\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _080050EA:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800511C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, #0x7\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800511C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800511C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _080050EA\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _080050EA\n\ _08005124:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x48]\n\ - cmp r1, r2\n\ - bcc _080050CA\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x48]\n\ + cmp r1, r2\n\ + bcc _080050CA\n\ _0800512C:\n\ - mov r1, r8\n\ - ldr r3, =gUnknown_03002FB0\n\ - str r3, [sp, #0x50]\n\ - ldr r0, [sp, #0x84]\n\ - ldr r2, [sp, #0x7C]\n\ - add r0, r2\n\ - mov r8, r0\n\ - ldr r3, [sp, #0x88]\n\ - str r3, [sp, #0x54]\n\ - ldr r0, [sp, #0x84]\n\ - str r0, [sp, #0x58]\n\ - cmp r1, r3\n\ - bcs _080051AC\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x50]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x88]\n\ + str r3, [sp, #0x54]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x58]\n\ + cmp r1, r3\n\ + bcs _080051AC\n\ _08005146:\n\ - ldr r2, [sp, #0x50]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x50]\n\ - ldr r4, [sp, #0x58]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r8\n\ - bcs _080051A4\n\ - mov r0, #0x7\n\ - mov r12, r0\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x50]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x50]\n\ + ldr r4, [sp, #0x58]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _080051A4\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _0800516A:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800519C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800519C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800519C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _0800516A\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800516A\n\ _080051A4:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x54]\n\ - cmp r1, r2\n\ - bcc _08005146\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x54]\n\ + cmp r1, r2\n\ + bcc _08005146\n\ _080051AC:\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FD0\n\ - str r3, [sp, #0x5C]\n\ - ldr r0, [sp, #0x84]\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x60]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x64]\n\ - cmp r1, r2\n\ - bcs _0800522A\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x5C]\n\ + ldr r0, [sp, #0x84]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x60]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x64]\n\ + cmp r1, r2\n\ + bcs _0800522A\n\ _080051C4:\n\ - ldr r0, [sp, #0x5C]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x5C]\n\ - ldr r4, [sp, #0x64]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r8\n\ - bcs _08005222\n\ - mov r3, #0x7\n\ - mov r12, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x5C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x5C]\n\ + ldr r4, [sp, #0x64]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08005222\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _080051E8:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800521A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800521A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800521A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _080051E8\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _080051E8\n\ _08005222:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x60]\n\ - cmp r1, r2\n\ - bcc _080051C4\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x60]\n\ + cmp r1, r2\n\ + bcc _080051C4\n\ _0800522A:\n\ - ldr r4, [sp, #0x84]\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FF0\n\ - str r3, [sp, #0x68]\n\ - ldr r0, [sp, #0x7C]\n\ - add r0, r4\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x6C]\n\ - str r4, [sp, #0x70]\n\ - cmp r1, r2\n\ - bcs _080052AA\n\ + ldr r4, [sp, #0x84]\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FF0\n\ + str r3, [sp, #0x68]\n\ + ldr r0, [sp, #0x7C]\n\ + add r0, r4\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x6C]\n\ + str r4, [sp, #0x70]\n\ + cmp r1, r2\n\ + bcs _080052AA\n\ _08005244:\n\ - ldr r3, [sp, #0x68]\n\ - ldm r3!, {r5}\n\ - str r3, [sp, #0x68]\n\ - ldr r4, [sp, #0x70]\n\ - add r0, r1, #0x1\n\ - mov r10, r0\n\ - cmp r4, r8\n\ - bcs _080052A2\n\ - mov r2, #0x7\n\ - mov r12, r2\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, r12\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r3, [sp, #0x68]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x68]\n\ + ldr r4, [sp, #0x70]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _080052A2\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08005268:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _0800529A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800529A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800529A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08005268\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08005268\n\ _080052A2:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x6C]\n\ - cmp r1, r2\n\ - bcc _08005244\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x6C]\n\ + cmp r1, r2\n\ + bcc _08005244\n\ _080052AA:\n\ - add sp, #0x8C\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + add sp, #0x8C\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } void ClearTextSpan(struct TextPrinter *textPrinter, u32 width) @@ -2046,733 +2051,1033 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c } } } - +#ifdef NONMATCHING +u16 RenderText(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct* r4 = &textPrinter->sub_union.sub; + int temp; + int r4two; + int jpnvar; + u8* tempTwo; + u16 songId; + int dummy; + u8 dummyTwo; + + switch (textPrinter->state) // _080057C4 + { + case 0: // _080057F0 + if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && r4->font_type_upper) + textPrinter->delayCounter = 0; + if (textPrinter->delayCounter && textPrinter->text_speed) //_0800580A + { + textPrinter->delayCounter--; + if (gTextFlags.flag_0 && (gMain.newKeys & (A_BUTTON | B_BUTTON))) + { + r4->font_type_upper = 1; + textPrinter->delayCounter = 0; + } + return 3; + } + else // _0800584C + { + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.flag_2) + textPrinter->delayCounter = 3; + else + textPrinter->delayCounter = textPrinter->text_speed; + temp = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + switch (temp) //_0800588A + { + case 0xF8+6: //_080058B8 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY += (gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing); + return 2; + case 0xF8+5: //_080058DC + textPrinter->subPrinter.current_text_offset++; + return 2; + case 0xF8+4: //_080058E0 + temp = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + switch (temp) // _080058F0 + { + + case 1: // _08005960 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 2: // _08005982 + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 3: // _080059A6 + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 4: // _080059C0 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 5: // _08005A0E + textPrinter->subPrinter.current_text_offset++; + return 2; + case 6: //_08005A12 + r4->font_type = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 7: // _08005A0A + return 2; + case 8: // _08005A2A + textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->state = 6; + return 2; + case 9: // _08005A3A + textPrinter->state = 1; + if (gTextFlags.flag_2) + r4->frames_visible_counter = 0; + return 3; + case 10: // _08005A58 + textPrinter->state = 5; + return 3; + case 11: // _08005A5C + songId = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + songId |= *textPrinter->subPrinter.current_text_offset << 8; + textPrinter->subPrinter.current_text_offset++; + PlayBGM(songId); + return 2; + case 16: // _08005A76 + songId = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + songId |= (*textPrinter->subPrinter.current_text_offset << 8); + textPrinter->subPrinter.current_text_offset++; + PlaySE(songId); + return 2; + case 13: // _08005A90 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 14: // _08005A98 + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 15: // _08005AA4 + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | textPrinter->subPrinter.bgColor << 4); + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + return 2; + case 23: // _08005ABE + m4aMPlayStop(&gMPlayInfo_BGM); + return 2; + case 24: // _08005ACC + m4aMPlayContinue(&gMPlayInfo_BGM); + return 2; + case 17: // _08005AD8 + temp = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + if (temp > 0) + { + ClearTextSpan(textPrinter, temp); + textPrinter->subPrinter.currentX += temp; + return 0; + } + return 2; + case 18: // _08005AF2 + textPrinter->subPrinter.currentX = *textPrinter->subPrinter.current_text_offset + textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 19: // _08005B02 + temp = *textPrinter->subPrinter.current_text_offset; + temp += textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + r4two = temp - textPrinter->subPrinter.currentX; + if (temp - textPrinter->subPrinter.currentX > 0) + { + ClearTextSpan(textPrinter, r4two); + textPrinter->subPrinter.currentX += r4two; + return 0; + } + return 2; + case 20: // _08005B26 + textPrinter->minLetterSpacing = *textPrinter->subPrinter.current_text_offset++; + return 2; + case 21: // _08005B36 + textPrinter->japanese = 1; + return 2; + case 22: // _08005B3E + textPrinter->japanese = 0; + return 2; + case 12: // _08005B5A + dummyTwo = *textPrinter->subPrinter.current_text_offset; + dummy = 0x100; + temp = dummy | dummyTwo; + textPrinter->subPrinter.current_text_offset++; + break; + } + break; + case 0xF8+3: // _08005B48 + textPrinter->state = 2; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+2: // _08005B4C + textPrinter->state = 3; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+1: // _08005B5A + dummyTwo = *textPrinter->subPrinter.current_text_offset; + dummy = 0x100; + temp = dummy | dummyTwo; + textPrinter->subPrinter.current_text_offset++; + break; + case 0xF8+0: // _08005B6C + temp = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + gUnknown_03002F90[0x80] = DrawKeypadIcon(textPrinter->subPrinter.windowId, temp, textPrinter->subPrinter.currentX, textPrinter->subPrinter.currentY); + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing; + return 0; + case 0xF8+7: // _08005D6C + return 1; + } + + } + switch (r4->font_type) // _08005B90 + { + case 0: // _08005BCC + jpnvar = textPrinter->japanese; + DecompressGlyphFont0(temp, jpnvar); + break; + case 1: // _08005BDA + jpnvar = textPrinter->japanese; + DecompressGlyphFont1(temp, jpnvar); + break; + case 2: + case 3: + case 4: + case 5: // _08005BE8 + jpnvar = textPrinter->japanese; + DecompressGlyphFont2(temp, jpnvar); + break; + case 7: // _08005BF6 + jpnvar = textPrinter->japanese; + DecompressGlyphFont7(temp, jpnvar); + break; + case 8: // _08005C04 + jpnvar = textPrinter->japanese; + DecompressGlyphFont8(temp, jpnvar); + break; + case 6: // _08005C10 + break; + } + CopyGlyphToWindow(textPrinter); // _08005C10 + if (textPrinter->minLetterSpacing) + { + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + r4two = textPrinter->minLetterSpacing - gUnknown_03002F90[0x80]; + if (r4two > 0) + { + ClearTextSpan(textPrinter, r4two); + textPrinter->subPrinter.currentX += r4two; + } + } + else // _08005C48 + { + if (textPrinter->japanese) + textPrinter->subPrinter.currentX += (gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing); + else + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + } + return 0; + case 1: // _08005C78 + if (TextPrinterWait(textPrinter)) + textPrinter->state = 0; + return 3; + case 2: // _08005C8C + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, (textPrinter->subPrinter.bgColor << 4) | textPrinter->subPrinter.bgColor); + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + textPrinter->state = 0; + } + return 3; + case 3: // _08005CB8 + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + TextPrinterClearDownArrow(textPrinter); + textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->state = 4; + } + return 3; + case 4: // _08005CF0 + if (textPrinter->scrollDistance) + { + int scrollSpeed = sub_8197964(); + int r4two = gWindowVerticalScrollSpeeds[scrollSpeed]; + if (textPrinter->scrollDistance < r4two) + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance = 0; + } + else + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, (int)r4two, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance -= r4two; + } + CopyWindowToVram(textPrinter->subPrinter.windowId, 2); + } + else + textPrinter->state = 0; + return 3; + case 5: // _08005D48 + if (!IsSEPlaying()) + textPrinter->state = 0; + return 3; + case 6: // _08005D5A + if (textPrinter->delayCounter != 0) + textPrinter->delayCounter--; + else + textPrinter->state = 0; + return 3; + } + return 1; +} +#else __attribute__((naked)) -u16 RenderText(struct TextPrinter *textPrinter) // 80057B4 +u16 RenderText(struct TextPrinter *textPrinter) { asm("push {r4-r6,lr}\n\ - add r6, r0, #0\n\ - add r4, r6, #0\n\ - add r4, #0x14\n\ - ldrb r0, [r6, #0x1C]\n\ - cmp r0, #0x6\n\ - bls _080057C4\n\ - b _08005D6C\n\ + add r6, r0, #0\n\ + add r4, r6, #0\n\ + add r4, #0x14\n\ + ldrb r0, [r6, #0x1C]\n\ + cmp r0, #0x6\n\ + bls _080057C4\n\ + b _08005D6C\n\ _080057C4:\n\ - lsl r0, #2\n\ - ldr r1, =_080057D4\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_080057D4\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _080057D4:\n\ - .4byte _080057F0\n\ - .4byte _08005C78\n\ - .4byte _08005C8C\n\ - .4byte _08005CB8\n\ - .4byte _08005CF0\n\ - .4byte _08005D48\n\ - .4byte _08005D5A\n\ + .4byte _080057F0\n\ + .4byte _08005C78\n\ + .4byte _08005C8C\n\ + .4byte _08005CB8\n\ + .4byte _08005CF0\n\ + .4byte _08005D48\n\ + .4byte _08005D5A\n\ _080057F0:\n\ - ldr r2, =gMain\n\ - ldrh r1, [r2, #0x2C]\n\ - mov r0, #0x3\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _0800580A\n\ - ldrb r1, [r4]\n\ - mov r0, #0x10\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _0800580A\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1E]\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, #0x2C]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + ldrb r1, [r4]\n\ + mov r0, #0x10\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ _0800580A:\n\ - ldrb r1, [r6, #0x1E]\n\ - cmp r1, #0\n\ - beq _0800584C\n\ - ldrb r0, [r6, #0x1D]\n\ - cmp r0, #0\n\ - beq _0800584C\n\ - sub r0, r1, #0x1\n\ - strb r0, [r6, #0x1E]\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x1\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005828\n\ - b _08005B56\n\ + ldrb r1, [r6, #0x1E]\n\ + cmp r1, #0\n\ + beq _0800584C\n\ + ldrb r0, [r6, #0x1D]\n\ + cmp r0, #0\n\ + beq _0800584C\n\ + sub r0, r1, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x1\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005828\n\ + b _08005B56\n\ _08005828:\n\ - ldrh r1, [r2, #0x2E]\n\ - mov r0, #0x3\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005834\n\ - b _08005B56\n\ + ldrh r1, [r2, #0x2E]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005834\n\ + b _08005B56\n\ _08005834:\n\ - ldrb r0, [r4]\n\ - mov r1, #0x10\n\ - orr r0, r1\n\ - strb r0, [r4]\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1E]\n\ - b _08005B56\n\ - .pool\n\ + ldrb r0, [r4]\n\ + mov r1, #0x10\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ + .pool\n\ _0800584C:\n\ - ldr r0, =gBattleTypeFlags\n\ - ldr r0, [r0]\n\ - mov r1, #0x80\n\ - lsl r1, #17\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005874\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x4\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _08005874\n\ - mov r0, #0x3\n\ - b _08005876\n\ - .pool\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + mov r1, #0x80\n\ + lsl r1, #17\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005874\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _08005874\n\ + mov r0, #0x3\n\ + b _08005876\n\ + .pool\n\ _08005874:\n\ - ldrb r0, [r6, #0x1D]\n\ + ldrb r0, [r6, #0x1D]\n\ _08005876:\n\ - strb r0, [r6, #0x1E]\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - add r0, r3, #0\n\ - sub r0, #0xF8\n\ - cmp r0, #0x7\n\ - bls _0800588A\n\ - b _08005B90\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + add r0, r3, #0\n\ + sub r0, #0xF8\n\ + cmp r0, #0x7\n\ + bls _0800588A\n\ + b _08005B90\n\ _0800588A:\n\ - lsl r0, #2\n\ - ldr r1, =_08005898\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_08005898\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005898:\n\ - .4byte _08005B6C\n\ - .4byte _08005B5A\n\ - .4byte _08005B4C\n\ - .4byte _08005B48\n\ - .4byte _080058E0\n\ - .4byte _080058DC\n\ - .4byte _080058B8\n\ - .4byte _08005D6C\n\ + .4byte _08005B6C\n\ + .4byte _08005B5A\n\ + .4byte _08005B4C\n\ + .4byte _08005B48\n\ + .4byte _080058E0\n\ + .4byte _080058DC\n\ + .4byte _080058B8\n\ + .4byte _08005D6C\n\ _080058B8:\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - ldrb r1, [r6, #0x5]\n\ - ldr r0, =gFonts\n\ - ldr r2, [r0]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - add r0, r2\n\ - ldrb r1, [r6, #0xB]\n\ - ldrb r0, [r0, #0x5]\n\ - add r1, r0\n\ - ldrb r0, [r6, #0x9]\n\ - add r0, r1\n\ - b _08005ABA\n\ - .pool\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x9]\n\ + add r0, r1\n\ + b _08005ABA\n\ + .pool\n\ _080058DC:\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _080058E0:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - sub r0, r3, #0x1\n\ - cmp r0, #0x17\n\ - bls _080058F0\n\ - b _08005B90\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + sub r0, r3, #0x1\n\ + cmp r0, #0x17\n\ + bls _080058F0\n\ + b _08005B90\n\ _080058F0:\n\ - lsl r0, #2\n\ - ldr r1, =_08005900\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_08005900\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005900:\n\ - .4byte _08005960\n\ - .4byte _08005982\n\ - .4byte _080059A6\n\ - .4byte _080059C0\n\ - .4byte _08005A0E\n\ - .4byte _08005A12\n\ - .4byte _08005A0A\n\ - .4byte _08005A2A\n\ - .4byte _08005A3A\n\ - .4byte _08005A58\n\ - .4byte _08005A5C\n\ - .4byte _08005B5A\n\ - .4byte _08005A90\n\ - .4byte _08005A98\n\ - .4byte _08005AA4\n\ - .4byte _08005A76\n\ - .4byte _08005AD8\n\ - .4byte _08005AF2\n\ - .4byte _08005B02\n\ - .4byte _08005B26\n\ - .4byte _08005B36\n\ - .4byte _08005B3E\n\ - .4byte _08005ABE\n\ - .4byte _08005ACC\n\ + .4byte _08005960 @0\n\ + .4byte _08005982 @1\n\ + .4byte _080059A6 @2\n\ + .4byte _080059C0 @3\n\ + .4byte _08005A0E @4\n\ + .4byte _08005A12 @5\n\ + .4byte _08005A0A @6\n\ + .4byte _08005A2A @7\n\ + .4byte _08005A3A @8\n\ + .4byte _08005A58 @9\n\ + .4byte _08005A5C @10\n\ + .4byte _08005B5A @11\n\ + .4byte _08005A90 @12\n\ + .4byte _08005A98 @13\n\ + .4byte _08005AA4 @14\n\ + .4byte _08005A76 @15\n\ + .4byte _08005AD8 @16\n\ + .4byte _08005AF2 @17\n\ + .4byte _08005B02 @18\n\ + .4byte _08005B26 @19\n\ + .4byte _08005B36 @20\n\ + .4byte _08005B3E @21\n\ + .4byte _08005ABE @22\n\ + .4byte _08005ACC @23\n\ _08005960:\n\ - ldr r2, [r6]\n\ - ldrb r1, [r2]\n\ - lsl r1, #4\n\ - ldrb r3, [r6, #0xC]\n\ - mov r0, #0xF\n\ - and r0, r3\n\ - orr r0, r1\n\ - strb r0, [r6, #0xC]\n\ - add r2, #0x1\n\ - str r2, [r6]\n\ - lsl r0, #24\n\ - lsr r0, #28\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsr r2, #4\n\ - b _08005A06\n\ + ldr r2, [r6]\n\ + ldrb r1, [r2]\n\ + lsl r1, #4\n\ + ldrb r3, [r6, #0xC]\n\ + mov r0, #0xF\n\ + and r0, r3\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r2, #0x1\n\ + str r2, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ _08005982:\n\ - ldr r1, [r6]\n\ - ldrb r2, [r1]\n\ - mov r0, #0xF\n\ - and r0, r2\n\ - ldrb r3, [r6, #0xD]\n\ - mov r2, #0x10\n\ - neg r2, r2\n\ - and r2, r3\n\ - orr r2, r0\n\ - strb r2, [r6, #0xD]\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, #0xC]\n\ - lsr r0, #4\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsr r2, #4\n\ - b _08005A06\n\ + ldr r1, [r6]\n\ + ldrb r2, [r1]\n\ + mov r0, #0xF\n\ + and r0, r2\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0x10\n\ + neg r2, r2\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ _080059A6:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - lsl r0, #4\n\ - ldrb r3, [r6, #0xD]\n\ - mov r2, #0xF\n\ - and r2, r3\n\ - orr r2, r0\n\ - strb r2, [r6, #0xD]\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, #0xC]\n\ - lsr r0, #4\n\ - b _080059FE\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + lsl r0, #4\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0xF\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + b _080059FE\n\ _080059C0:\n\ - ldr r3, [r6]\n\ - ldrb r1, [r3]\n\ - lsl r1, #4\n\ - ldrb r4, [r6, #0xC]\n\ - mov r2, #0xF\n\ - add r0, r2, #0\n\ - and r0, r4\n\ - orr r0, r1\n\ - strb r0, [r6, #0xC]\n\ - add r5, r3, #0x1\n\ - str r5, [r6]\n\ - ldrb r3, [r3, #0x1]\n\ - add r1, r2, #0\n\ - and r1, r3\n\ - ldrb r4, [r6, #0xD]\n\ - mov r3, #0x10\n\ - neg r3, r3\n\ - and r3, r4\n\ - orr r3, r1\n\ - strb r3, [r6, #0xD]\n\ - add r4, r5, #0x1\n\ - str r4, [r6]\n\ - ldrb r1, [r5, #0x1]\n\ - lsl r1, #4\n\ - and r2, r3\n\ - orr r2, r1\n\ - strb r2, [r6, #0xD]\n\ - add r4, #0x1\n\ - str r4, [r6]\n\ - lsl r0, #24\n\ - lsr r0, #28\n\ + ldr r3, [r6]\n\ + ldrb r1, [r3]\n\ + lsl r1, #4\n\ + ldrb r4, [r6, #0xC]\n\ + mov r2, #0xF\n\ + add r0, r2, #0\n\ + and r0, r4\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r5, r3, #0x1\n\ + str r5, [r6]\n\ + ldrb r3, [r3, #0x1]\n\ + add r1, r2, #0\n\ + and r1, r3\n\ + ldrb r4, [r6, #0xD]\n\ + mov r3, #0x10\n\ + neg r3, r3\n\ + and r3, r4\n\ + orr r3, r1\n\ + strb r3, [r6, #0xD]\n\ + add r4, r5, #0x1\n\ + str r4, [r6]\n\ + ldrb r1, [r5, #0x1]\n\ + lsl r1, #4\n\ + and r2, r3\n\ + orr r2, r1\n\ + strb r2, [r6, #0xD]\n\ + add r4, #0x1\n\ + str r4, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ _080059FE:\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsl r2, #24\n\ - lsr r2, #28\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsl r2, #24\n\ + lsr r2, #28\n\ _08005A06:\n\ - bl GenerateFontHalfRowLookupTable\n\ + bl GenerateFontHalfRowLookupTable\n\ _08005A0A:\n\ - mov r0, #0x2\n\ - b _08005D6E\n\ + mov r0, #0x2\n\ + b _08005D6E\n\ _08005A0E:\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _08005A12:\n\ - ldr r0, [r6]\n\ - ldrb r0, [r0]\n\ - mov r1, #0xF\n\ - and r1, r0\n\ - ldrb r2, [r4]\n\ - mov r0, #0x10\n\ - neg r0, r0\n\ - and r0, r2\n\ - orr r0, r1\n\ - strb r0, [r4]\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + ldrb r0, [r0]\n\ + mov r1, #0xF\n\ + and r1, r0\n\ + ldrb r2, [r4]\n\ + mov r0, #0x10\n\ + neg r0, r0\n\ + and r0, r2\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _08005A2A:\n\ - ldr r0, [r6]\n\ - ldrb r1, [r0]\n\ - strb r1, [r6, #0x1E]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - mov r0, #0x6\n\ - strb r0, [r6, #0x1C]\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r1, [r0]\n\ + strb r1, [r6, #0x1E]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + mov r0, #0x6\n\ + strb r0, [r6, #0x1C]\n\ + b _08005A0A\n\ _08005A3A:\n\ - mov r0, #0x1\n\ - strb r0, [r6, #0x1C]\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x4\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005A4C\n\ - b _08005B56\n\ + mov r0, #0x1\n\ + strb r0, [r6, #0x1C]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005A4C\n\ + b _08005B56\n\ _08005A4C:\n\ - mov r0, #0\n\ - strb r0, [r4, #0x2]\n\ - b _08005B56\n\ - .pool\n\ + mov r0, #0\n\ + strb r0, [r4, #0x2]\n\ + b _08005B56\n\ + .pool\n\ _08005A58:\n\ - mov r0, #0x5\n\ - b _08005D56\n\ + mov r0, #0x5\n\ + b _08005D56\n\ _08005A5C:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r1, r0, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, #0x1]\n\ - lsl r0, #8\n\ - orr r3, r0\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - add r0, r3, #0\n\ - bl PlayBGM\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl PlayBGM\n\ + b _08005A0A\n\ _08005A76:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r1, r0, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, #0x1]\n\ - lsl r0, #8\n\ - orr r3, r0\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - add r0, r3, #0\n\ - bl PlaySE\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl PlaySE\n\ + b _08005A0A\n\ _08005A90:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, #0x6]\n\ - b _08005AF8\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x6]\n\ + b _08005AF8\n\ _08005A98:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r2, [r6, #0x7]\n\ - add r0, r2\n\ - strb r0, [r6, #0x9]\n\ - b _08005AFC\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r2, [r6, #0x7]\n\ + add r0, r2\n\ + strb r0, [r6, #0x9]\n\ + b _08005AFC\n\ _08005AA4:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r2, #28\n\ - lsr r1, r2, #4\n\ - orr r1, r2\n\ - lsr r1, #24\n\ - bl FillWindowPixelBuffer\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - ldrb r0, [r6, #0x7]\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ _08005ABA:\n\ - strb r0, [r6, #0x9]\n\ - b _08005A0A\n\ + strb r0, [r6, #0x9]\n\ + b _08005A0A\n\ _08005ABE:\n\ - ldr r0, =gMPlayInfo_BGM\n\ - bl m4aMPlayStop\n\ - b _08005A0A\n\ - .pool\n\ + ldr r0, =gMPlayInfo_BGM\n\ + bl m4aMPlayStop\n\ + b _08005A0A\n\ + .pool\n\ _08005ACC:\n\ - ldr r0, =gMPlayInfo_BGM\n\ - bl m4aMPlayContinue\n\ - b _08005A0A\n\ - .pool\n\ + ldr r0, =gMPlayInfo_BGM\n\ + bl m4aMPlayContinue\n\ + b _08005A0A\n\ + .pool\n\ _08005AD8:\n\ - ldr r0, [r6]\n\ - ldrb r4, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - cmp r4, #0\n\ - ble _08005A0A\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ + ldr r0, [r6]\n\ + ldrb r4, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + cmp r4, #0\n\ + ble _08005A0A\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ _08005AF2:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r6, #0x6]\n\ - ldrb r3, [r1]\n\ + ldr r1, [r6]\n\ + ldrb r0, [r6, #0x6]\n\ + ldrb r3, [r1]\n\ _08005AF8:\n\ - add r0, r3\n\ - strb r0, [r6, #0x8]\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ _08005AFC:\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - b _08005A0A\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + b _08005A0A\n\ _08005B02:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - ldrb r1, [r6, #0x6]\n\ - add r2, r1\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, #0x8]\n\ - sub r4, r2, r0\n\ - cmp r4, #0\n\ - bgt _08005B18\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + ldrb r1, [r6, #0x6]\n\ + add r2, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x8]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + bgt _08005B18\n\ + b _08005A0A\n\ _08005B18:\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ _08005B26:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - add r1, r6, #0\n\ - add r1, #0x20\n\ - strb r2, [r1]\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + add r1, r6, #0\n\ + add r1, #0x20\n\ + strb r2, [r1]\n\ _08005B30:\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - b _08005A0A\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005A0A\n\ _08005B36:\n\ - add r1, r6, #0\n\ - add r1, #0x21\n\ - mov r0, #0x1\n\ - b _08005B44\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0x1\n\ + b _08005B44\n\ _08005B3E:\n\ - add r1, r6, #0\n\ - add r1, #0x21\n\ - mov r0, #0\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0\n\ _08005B44:\n\ - strb r0, [r1]\n\ - b _08005A0A\n\ + strb r0, [r1]\n\ + b _08005A0A\n\ _08005B48:\n\ - mov r0, #0x2\n\ - b _08005B4E\n\ + mov r0, #0x2\n\ + b _08005B4E\n\ _08005B4C:\n\ - mov r0, #0x3\n\ + mov r0, #0x3\n\ _08005B4E:\n\ - strb r0, [r6, #0x1C]\n\ - add r0, r6, #0\n\ - bl TextPrinterInitDownArrowCounters\n\ + strb r0, [r6, #0x1C]\n\ + add r0, r6, #0\n\ + bl TextPrinterInitDownArrowCounters\n\ _08005B56:\n\ - mov r0, #0x3\n\ - b _08005D6E\n\ + mov r0, #0x3\n\ + b _08005D6E\n\ _08005B5A:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - mov r2, #0x80\n\ - lsl r2, #1\n\ - add r1, r2, #0\n\ - orr r3, r1\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - b _08005B90\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + mov r2, #0x80\n\ + lsl r2, #1\n\ + add r1, r2, #0\n\ + orr r3, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005B90\n\ _08005B6C:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, #0x4]\n\ - add r1, r3, #0\n\ - ldrb r2, [r6, #0x8]\n\ - ldrb r3, [r6, #0x9]\n\ - bl DrawKeypadIcon\n\ - ldr r1, =gUnknown_03002F90\n\ - add r1, #0x80\n\ - strb r0, [r1]\n\ - ldrb r3, [r6, #0xA]\n\ - add r0, r3\n\ - b _08005C6A\n\ - .pool\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x4]\n\ + add r1, r3, #0\n\ + ldrb r2, [r6, #0x8]\n\ + ldrb r3, [r6, #0x9]\n\ + bl DrawKeypadIcon\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + strb r0, [r1]\n\ + ldrb r3, [r6, #0xA]\n\ + add r0, r3\n\ + b _08005C6A\n\ + .pool\n\ _08005B90:\n\ - ldr r0, [r4]\n\ - lsl r0, #28\n\ - lsr r0, #28\n\ - cmp r0, #0x8\n\ - bhi _08005C10\n\ - lsl r0, #2\n\ - ldr r1, =_08005BA8\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + ldr r0, [r4]\n\ + lsl r0, #28\n\ + lsr r0, #28\n\ + cmp r0, #0x8\n\ + bhi _08005C10\n\ + lsl r0, #2\n\ + ldr r1, =_08005BA8\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005BA8:\n\ - .4byte _08005BCC\n\ - .4byte _08005BDA\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005C10\n\ - .4byte _08005BF6\n\ - .4byte _08005C04\n\ + .4byte _08005BCC\n\ + .4byte _08005BDA\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005C10\n\ + .4byte _08005BF6\n\ + .4byte _08005C04\n\ _08005BCC:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont0\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont0\n\ + b _08005C10\n\ _08005BDA:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont1\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont1\n\ + b _08005C10\n\ _08005BE8:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont2\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont2\n\ + b _08005C10\n\ _08005BF6:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont7\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont7\n\ + b _08005C10\n\ _08005C04:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont8\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont8\n\ _08005C10:\n\ - add r0, r6, #0\n\ - bl CopyGlyphToWindow\n\ - add r2, r6, #0\n\ - add r2, #0x20\n\ - ldrb r0, [r2]\n\ - cmp r0, #0\n\ - beq _08005C48\n\ - ldr r1, =gUnknown_03002F90\n\ - add r1, #0x80\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, #0x8]\n\ - add r0, r3\n\ - strb r0, [r6, #0x8]\n\ - ldrb r2, [r2]\n\ - ldrb r0, [r1]\n\ - sub r4, r2, r0\n\ - cmp r4, #0\n\ - ble _08005C70\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ - .pool\n\ + add r0, r6, #0\n\ + bl CopyGlyphToWindow\n\ + add r2, r6, #0\n\ + add r2, #0x20\n\ + ldrb r0, [r2]\n\ + cmp r0, #0\n\ + beq _08005C48\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x8]\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ + ldrb r2, [r2]\n\ + ldrb r0, [r1]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + ble _08005C70\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ + .pool\n\ _08005C48:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r0, [r0]\n\ - cmp r0, #0\n\ - beq _08005C64\n\ - ldr r0, =gUnknown_03002F90\n\ - add r0, #0x80\n\ - ldrb r1, [r6, #0xA]\n\ - ldrb r0, [r0]\n\ - add r1, r0\n\ - ldrb r0, [r6, #0x8]\n\ - b _08005C6C\n\ - .pool\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r0, [r0]\n\ + cmp r0, #0\n\ + beq _08005C64\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r1, [r6, #0xA]\n\ + ldrb r0, [r0]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x8]\n\ + b _08005C6C\n\ + .pool\n\ _08005C64:\n\ - ldr r0, =gUnknown_03002F90\n\ - add r0, #0x80\n\ - ldrb r0, [r0]\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ _08005C6A:\n\ - ldrb r1, [r6, #0x8]\n\ + ldrb r1, [r6, #0x8]\n\ _08005C6C:\n\ - add r0, r1\n\ + add r0, r1\n\ _08005C6E:\n\ - strb r0, [r6, #0x8]\n\ + strb r0, [r6, #0x8]\n\ _08005C70:\n\ - mov r0, #0\n\ - b _08005D6E\n\ - .pool\n\ + mov r0, #0\n\ + b _08005D6E\n\ + .pool\n\ _08005C78:\n\ - add r0, r6, #0\n\ - bl TextPrinterWait\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005C86\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWait\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C86\n\ + b _08005B56\n\ _08005C86:\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005C8C:\n\ - add r0, r6, #0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005C9A\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C9A\n\ + b _08005B56\n\ _08005C9A:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r2, #28\n\ - lsr r1, r2, #4\n\ - orr r1, r2\n\ - lsr r1, #24\n\ - bl FillWindowPixelBuffer\n\ - ldrb r0, [r6, #0x6]\n\ - mov r1, #0\n\ - strb r0, [r6, #0x8]\n\ - ldrb r0, [r6, #0x7]\n\ - strb r0, [r6, #0x9]\n\ - strb r1, [r6, #0x1C]\n\ - b _08005B56\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + mov r1, #0\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ + strb r0, [r6, #0x9]\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ _08005CB8:\n\ - add r0, r6, #0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005CC6\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005CC6\n\ + b _08005B56\n\ _08005CC6:\n\ - add r0, r6, #0\n\ - bl TextPrinterClearDownArrow\n\ - ldrb r1, [r6, #0x5]\n\ - ldr r0, =gFonts\n\ - ldr r2, [r0]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - add r0, r2\n\ - ldrb r1, [r6, #0xB]\n\ - ldrb r0, [r0, #0x5]\n\ - add r1, r0\n\ - strb r1, [r6, #0x1F]\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - mov r0, #0x4\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ - .pool\n\ + add r0, r6, #0\n\ + bl TextPrinterClearDownArrow\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + strb r1, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + mov r0, #0x4\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ + .pool\n\ _08005CF0:\n\ - ldrb r0, [r6, #0x1F]\n\ - cmp r0, #0\n\ - beq _08005D44\n\ - bl sub_8197964\n\ - ldr r1, =gWindowVerticalScrollSpeeds\n\ - add r0, r1\n\ - ldrb r4, [r0]\n\ - ldrb r2, [r6, #0x1F]\n\ - cmp r2, r4\n\ - bge _08005D20\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r1, [r6, #0xD]\n\ - lsl r1, #28\n\ - lsr r3, r1, #4\n\ - orr r3, r1\n\ - lsr r3, #24\n\ - mov r1, #0\n\ - bl ScrollWindow\n\ - mov r0, #0\n\ - b _08005D38\n\ - .pool\n\ + ldrb r0, [r6, #0x1F]\n\ + cmp r0, #0\n\ + beq _08005D44\n\ + bl sub_8197964\n\ + ldr r1, =gWindowVerticalScrollSpeeds\n\ + add r0, r1\n\ + ldrb r4, [r0]\n\ + ldrb r2, [r6, #0x1F]\n\ + cmp r2, r4\n\ + bge _08005D20\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + bl ScrollWindow\n\ + mov r0, #0\n\ + b _08005D38\n\ + .pool\n\ _08005D20:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r1, [r6, #0xD]\n\ - lsl r1, #28\n\ - lsr r3, r1, #4\n\ - orr r3, r1\n\ - lsr r3, #24\n\ - mov r1, #0\n\ - add r2, r4, #0\n\ - bl ScrollWindow\n\ - ldrb r0, [r6, #0x1F]\n\ - sub r0, r4\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + add r2, r4, #0\n\ + bl ScrollWindow\n\ + ldrb r0, [r6, #0x1F]\n\ + sub r0, r4\n\ _08005D38:\n\ - strb r0, [r6, #0x1F]\n\ - ldrb r0, [r6, #0x4]\n\ - mov r1, #0x2\n\ - bl CopyWindowToVram\n\ - b _08005B56\n\ + strb r0, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x4]\n\ + mov r1, #0x2\n\ + bl CopyWindowToVram\n\ + b _08005B56\n\ _08005D44:\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D48:\n\ - bl IsSEPlaying\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - cmp r0, #0\n\ - beq _08005D56\n\ - b _08005B56\n\ + bl IsSEPlaying\n\ + lsl r0, #24\n\ + lsr r0, #24\n\ + cmp r0, #0\n\ + beq _08005D56\n\ + b _08005B56\n\ _08005D56:\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D5A:\n\ - ldrb r0, [r6, #0x1E]\n\ - add r1, r0, #0\n\ - cmp r1, #0\n\ - beq _08005D68\n\ - sub r0, #0x1\n\ - strb r0, [r6, #0x1E]\n\ - b _08005B56\n\ + ldrb r0, [r6, #0x1E]\n\ + add r1, r0, #0\n\ + cmp r1, #0\n\ + beq _08005D68\n\ + sub r0, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ _08005D68:\n\ - strb r1, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D6C:\n\ - mov r0, #0x1\n\ + mov r0, #0x1\n\ _08005D6E:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1"); + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n"); } +#endif u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing) { From 95827ab64bc2fe148a3c52b0c341002deec72b0e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 27 Jan 2018 11:57:46 +0100 Subject: [PATCH 05/15] 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); +} From 8ca9bbe425ef909716317fb7d8751886f8db8c3b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 27 Jan 2018 21:10:00 +0100 Subject: [PATCH 06/15] more pokemon anim functions decompiled --- asm/pokemon_animation.s | 2860 +-------------------------------------- src/pokemon_animation.c | 1082 ++++++++++++++- 2 files changed, 1073 insertions(+), 2869 deletions(-) diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index 562300f3f..96ec4f77a 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -5,2865 +5,7 @@ .text - - - thumb_func_start pokemonanimfunc_37 -pokemonanimfunc_37: @ 818201C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182036 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182036: - adds r0, r4, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0xFF - ble _08182060 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _081820A6 - .pool -_08182060: - adds r0, r1, 0 - adds r0, 0x10 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182072 - adds r0, 0x7F -_08182072: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _08182092 - adds r0, 0x7F -_08182092: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_081820A6: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081820B2 - adds r0, 0x7F -_081820B2: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - 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 - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_37 - - thumb_func_start pokemonanimfunc_38 -pokemonanimfunc_38: @ 81820E0 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r0, 0 - strh r0, [r4, 0x3C] - strh r0, [r4, 0x36] - ldr r0, =sub_81820FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_38 - - thumb_func_start sub_81820FC -sub_81820FC: @ 81820FC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x18 - ble _0818212C - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _0818214A - movs r0, 0 - strh r0, [r4, 0x36] - ldr r0, =sub_818216C - str r0, [r4, 0x1C] - b _0818214A - .pool -_0818212C: - adds r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_0818214A: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - 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_81820FC - - thumb_func_start sub_818216C -sub_818216C: @ 818216C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x20 - ble _0818218C - movs r0, 0x1 - strh r0, [r4, 0x3A] - ldr r0, =sub_81821CC - str r0, [r4, 0x1C] - b _081821AA - .pool -_0818218C: - adds r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_081821AA: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - 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_818216C - - thumb_func_start sub_81821CC -sub_81821CC: @ 81821CC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x9 - ble _081821F0 - movs r0, 0x20 - strh r0, [r4, 0x3C] - ldr r0, =sub_8182248 - str r0, [r4, 0x1C] -_081821F0: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - subs r0, 0x1D - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x6 - bls _08182224 - movs r1, 0x3A - ldrsh r0, [r4, r1] - negs r0, r0 - strh r0, [r4, 0x3A] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_08182224: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - 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 - .pool - thumb_func_end sub_81821CC - - thumb_func_start sub_8182248 -sub_8182248: @ 8182248 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08182270 - movs r0, 0 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _0818228E - .pool -_08182270: - subs r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_0818228E: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - 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_8182248 - - thumb_func_start pokemonanimfunc_39 -pokemonanimfunc_39: @ 81822B0 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _081822D0 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0818235C - .pool -_081822D0: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _081822DC - movs r5, 0x1 -_081822DC: - movs r0, 0x32 - ldrsh r2, [r4, r0] - adds r0, r2, 0 - cmp r2, 0 - bge _081822E8 - adds r0, r2, 0x3 -_081822E8: - asrs r0, 2 - lsls r0, 2 - subs r0, r2, r0 - lsls r0, 16 - asrs r1, r0, 16 - lsrs r0, 31 - adds r1, r0 - asrs r1, 1 - cmp r1, 0 - bne _0818232C - lsls r0, r2, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0818230C - adds r0, 0xFF -_0818230C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 - strh r0, [r4, 0x24] - negs r0, r0 - b _0818235A -_0818232C: - lsls r0, r2, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0818233C - adds r0, 0xFF -_0818233C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - lsls r0, 16 - asrs r0, 16 - negs r0, r0 - lsls r1, r5, 24 - asrs r1, 24 - muls r0, r1 - strh r0, [r4, 0x24] -_0818235A: - strh r0, [r4, 0x26] -_0818235C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_39 - - thumb_func_start pokemonanimfunc_3A -pokemonanimfunc_3A: @ 8182370 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182392 - adds r0, r4, 0 - bl HandleStartAffineAnim - strh r5, [r4, 0x38] - strh r5, [r4, 0x3A] - strh r5, [r4, 0x3C] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08182392: - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _081823E4 - subs r0, r1, 0x1 - strh r0, [r4, 0x3A] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - beq _08182494 - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r0, 3 - movs r1, 0x14 - bl __divsi3 - adds r1, r0, 0 - ldrh r0, [r4, 0x3C] - lsls r1, 16 - asrs r1, 16 - subs r0, r1 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x40 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - lsls r0, 16 - asrs r0, 16 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - b _08182494 -_081823E4: - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - bne _08182424 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08182410 - movs r0, 0x40 - strh r0, [r4, 0x3C] - 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] -_08182410: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x40 - bl Cos - lsls r0, 16 - lsrs r3, r0, 16 - b _08182474 - .pool -_08182424: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x40 - bl Sin - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x3F - ble _08182448 - movs r0, 0 - movs r1, 0x3 - strh r1, [r4, 0x38] - movs r1, 0xA - strh r1, [r4, 0x3A] - strh r0, [r4, 0x3C] - b _08182474 -_08182448: - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x30 - ble _0818245C - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _0818245C - movs r0, 0x2 - b _0818246E -_0818245C: - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08182474 - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08182474 - movs r0, 0x1 -_0818246E: - strh r0, [r4, 0x38] - movs r0, 0x14 - strh r0, [r4, 0x3A] -_08182474: - ldrh r0, [r4, 0x3C] - adds r0, 0x2 - strh r0, [r4, 0x3C] - movs r0, 0x80 - lsls r0, 1 - adds r2, r0, 0 - lsls r0, r3, 16 - asrs r0, 16 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_08182494: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3A - - thumb_func_start pokemonanimfunc_3B -pokemonanimfunc_3B: @ 81824A0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081824BA - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_081824BA: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _081824E8 - movs r0, 0 - 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] - b _08182540 - .pool -_081824E8: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081824F4 - adds r0, 0xFF -_081824F4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182518 - adds r0, 0x7F -_08182518: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - movs r1, 0x80 - lsls r1, 1 - lsls r2, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData -_08182540: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3B - - thumb_func_start pokemonanimfunc_3C -pokemonanimfunc_3C: @ 8182548 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182562 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182562: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r5, 0x80 - lsls r5, 1 - cmp r0, r5 - ble _08182590 - movs r0, 0 - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - movs r3, 0 - bl HandleSetAffineData - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _081825D4 - .pool -_08182590: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x4 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081825AE - adds r0, 0x3F -_081825AE: - asrs r0, 6 - lsls r0, 6 - subs r0, r1, r0 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x80 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - asrs r2, 16 - adds r2, r5 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r5, 0 - movs r3, 0 - bl HandleSetAffineData -_081825D4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3C - - thumb_func_start pokemonanimfunc_3D -pokemonanimfunc_3D: @ 81825DC - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - ldr r0, =sub_81825F8 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_3D - - thumb_func_start sub_81825F8 -sub_81825F8: @ 81825F8 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - movs r1, 0 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _0818261C - strh r1, [r4, 0x3C] - strh r1, [r4, 0x3A] - ldr r0, =sub_8182648 - str r0, [r4, 0x1C] - movs r0, 0x40 - b _08182620 - .pool -_0818261C: - movs r1, 0x3C - ldrsh r0, [r4, r1] -_08182620: - movs r1, 0x80 - bl Sin - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x80 - lsls r1, 1 - lsls r2, r0, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81825F8 - - thumb_func_start sub_8182648 -sub_8182648: @ 8182648 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x4 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5F - ble _08182672 - movs r0, 0 - movs r1, 0x80 - bl Cos - lsls r0, 16 - lsrs r2, r0, 16 - movs r0, 0 - strh r0, [r4, 0x3C] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - b _081826C8 -_08182672: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - movs r2, 0x3A - ldrsh r1, [r4, r2] - lsls r1, 2 - negs r1, r1 - subs r1, r0 - strh r1, [r4, 0x26] - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x3F - ble _081826A4 - ldr r5, =0x0000ffff - adds r0, r1, 0 - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - b _081826A8 - .pool -_081826A4: - movs r5, 0x1 - movs r0, 0 -_081826A8: - lsls r0, 16 - asrs r0, 15 - ldrh r1, [r4, 0x3C] - adds r0, r1 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x80 - bl Cos - lsls r1, r5, 16 - asrs r1, 16 - adds r2, r1, 0 - muls r2, r0 - adds r0, r2, 0 - lsls r0, 16 - lsrs r2, r0, 16 -_081826C8: - movs r1, 0x80 - lsls r1, 1 - lsls r2, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x3 - bne _081826EE - movs r0, 0 - strh r0, [r4, 0x3C] - ldr r0, =sub_81826F8 - str r0, [r4, 0x1C] -_081826EE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8182648 - - thumb_func_start sub_81826F8 -sub_81826F8: @ 81826F8 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x80 - bl Cos - lsls r0, 16 - lsrs r5, r0, 16 - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0xC - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08182742 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_08182742: - movs r1, 0x80 - lsls r1, 1 - lsls r2, r5, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81826F8 - - thumb_func_start sub_8182764 -sub_8182764: @ 8182764 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08182798 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - b _081827F4 - .pool -_08182798: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081827A4 - adds r0, 0xFF -_081827A4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _081827CC - adds r0, 0x7F -_081827CC: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - movs r0, 0x80 - lsls r0, 17 - adds r1, r0 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData -_081827F4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8182764 - - thumb_func_start pokemonanimfunc_3E -pokemonanimfunc_3E: @ 81827FC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182822 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r1, 0x8 - strh r1, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] -_08182822: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3E - - thumb_func_start sub_8182830 -sub_8182830: @ 8182830 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08182864 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - b _081828C0 - .pool -_08182864: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182870 - adds r0, 0xFF -_08182870: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _08182898 - adds r0, 0x3F -_08182898: - asrs r0, 6 - lsls r0, 6 - subs r0, r1, r0 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x80 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - movs r0, 0x80 - lsls r0, 17 - adds r1, r0 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - movs r3, 0 - bl HandleSetAffineData -_081828C0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8182830 - - thumb_func_start pokemonanimfunc_3F -pokemonanimfunc_3F: @ 81828C8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081828EE - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - adds r0, 0xFC - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_081828EE: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3F - - thumb_func_start pokemonanimfunc_40 -pokemonanimfunc_40: @ 81828FC - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _0818291A - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_0818291A: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08182948 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _0818299E - .pool -_08182948: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182954 - adds r0, 0xFF -_08182954: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182978 - adds r0, 0x7F -_08182978: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_0818299E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_40 - - thumb_func_start pokemonanimfunc_41 -pokemonanimfunc_41: @ 81829AC - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081829CA - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_081829CA: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _081829F8 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08182A5E - .pool -_081829F8: - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182A04 - adds r1, 0xFF -_08182A04: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182A30 - adds r1, 0xFF -_08182A30: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x40 - bl Sin - adds r2, r0, 0 - negs r2, r2 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_08182A5E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_41 - - thumb_func_start pokemonanimfunc_42 -pokemonanimfunc_42: @ 8182A6C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182A8A - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182A8A: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08182AB8 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08182B16 - .pool -_08182AB8: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182AC4 - adds r0, 0xFF -_08182AC4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182AEA - adds r1, 0xFF -_08182AEA: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_08182B16: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_42 - - thumb_func_start pokemonanimfunc_43 -pokemonanimfunc_43: @ 8182B24 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08182B48 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08182C08 - .pool -_08182B48: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08182B56 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08182B56: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08182B62 - adds r0, r1, 0x3 -_08182B62: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08182BA4 - cmp r0, 0x1 - bgt _08182B80 - cmp r0, 0 - beq _08182B8A - b _08182BE2 - .pool -_08182B80: - cmp r0, 0x2 - beq _08182BB8 - cmp r0, 0x3 - beq _08182BCA - b _08182BE2 -_08182B8A: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08182B9C - ldr r1, =0x000001ff - adds r0, r1 -_08182B9C: - asrs r0, 9 - b _08182BE0 - .pool -_08182BA4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08182BB2 - adds r0, 0x1F -_08182BB2: - asrs r0, 5 - subs r0, 0x10 - b _08182BE0 -_08182BB8: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08182BC6 - adds r0, 0x1F -_08182BC6: - asrs r0, 5 - b _08182BE0 -_08182BCA: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08182BDC - ldr r1, =0x000001ff - adds r0, r1 -_08182BDC: - asrs r0, 9 - adds r0, 0x10 -_08182BE0: - strh r0, [r4, 0x24] -_08182BE2: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182BEE - adds r0, 0x7F -_08182BEE: - 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, 0x18 - strh r0, [r4, 0x32] -_08182C08: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_43 - - thumb_func_start pokemonanimfunc_44 -pokemonanimfunc_44: @ 8182C18 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08182C34 - strh r0, [r4, 0x3A] - movs r0, 0x40 - strh r0, [r4, 0x3C] - adds r0, r1, 0x1 - strh r0, [r4, 0x32] -_08182C34: - ldrh r0, [r4, 0x3C] - adds r1, r0, 0 - adds r1, 0x8 - movs r3, 0 - strh r1, [r4, 0x3C] - ldrh r2, [r4, 0x3A] - movs r5, 0x3A - ldrsh r0, [r4, r5] - cmp r0, 0x4 - bne _08182C52 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _08182C60 - b _08182C5A -_08182C52: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _08182C60 -_08182C5A: - strh r3, [r4, 0x3C] - adds r0, r2, 0x1 - strh r0, [r4, 0x3A] -_08182C60: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _08182D08 - lsls r0, 2 - ldr r1, =_08182C78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08182C78: - .4byte _08182CEC - .4byte _08182C8C - .4byte _08182CAA - .4byte _08182CCC - .4byte _08182CEC -_08182C8C: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Cos - negs r0, r0 - strh r0, [r4, 0x24] - movs r5, 0x3C - ldrsh r0, [r4, r5] - movs r1, 0x8 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x26] - b _08182D12 -_08182CAA: - ldrh r0, [r4, 0x3C] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - b _08182D12 -_08182CCC: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x26] - b _08182D12 -_08182CEC: - movs r5, 0x3C - ldrsh r0, [r4, r5] - movs r1, 0x8 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x26] - b _08182D12 -_08182D08: - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_08182D12: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_44 - - thumb_func_start pokemonanimfunc_45 -pokemonanimfunc_45: @ 8182D24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x20 - 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_45 - - thumb_func_start pokemonanimfunc_46 -pokemonanimfunc_46: @ 8182D40 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_46 - - thumb_func_start pokemonanimfunc_47 -pokemonanimfunc_47: @ 8182D5C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F978 - ldr r0, =sub_817F978 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_47 - - thumb_func_start pokemonanimfunc_48 -pokemonanimfunc_48: @ 8182D78 - 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, 4 - 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_48 - - thumb_func_start pokemonanimfunc_49 -pokemonanimfunc_49: @ 8182DB4 - push {lr} - movs r1, 0x1 - strh r1, [r0, 0x3A] - bl pokemonanimfunc_05 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_49 - - thumb_func_start pokemonanimfunc_4A -pokemonanimfunc_4A: @ 8182DC4 - push {lr} - movs r1, 0x1 - strh r1, [r0, 0x3A] - bl pokemonanimfunc_48 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_4A - - thumb_func_start pokemonanimfunc_4B -pokemonanimfunc_4B: @ 8182DD4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08182DE2 - strh r0, [r4, 0x2E] -_08182DE2: - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08182DF6 - adds r0, r4, 0 - bl sub_817FC20 - movs r0, 0x1 - b _08182DF8 -_08182DF6: - subs r0, r1, 0x1 -_08182DF8: - strh r0, [r4, 0x2E] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_4B - - thumb_func_start pokemonanimfunc_4C -pokemonanimfunc_4C: @ 8182E00 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4C - - thumb_func_start pokemonanimfunc_4D -pokemonanimfunc_4D: @ 8182E20 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817FD44 - ldr r0, =sub_817FD44 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4D - - thumb_func_start pokemonanimfunc_4E -pokemonanimfunc_4E: @ 8182E3C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - 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, 3 - strh r0, [r1, 0x6] - strh r3, [r1] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_817FE30 - ldr r0, =sub_817FE30 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4E - - thumb_func_start pokemonanimfunc_4F -pokemonanimfunc_4F: @ 8182E7C - 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, 2 - strh r0, [r1, 0x6] - movs r0, 0x3 - strh r0, [r1, 0x8] - movs r0, 0xC - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4F - - thumb_func_start pokemonanimfunc_50 -pokemonanimfunc_50: @ 8182EBC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x18 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_818031C - ldr r0, =sub_818031C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_50 - - thumb_func_start pokemonanimfunc_51 -pokemonanimfunc_51: @ 8182ED8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81804F8 - ldr r0, =sub_81804F8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_51 - - thumb_func_start pokemonanimfunc_52 -pokemonanimfunc_52: @ 8182EF4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F9F4 - ldr r0, =sub_817F9F4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_52 - - thumb_func_start pokemonanimfunc_53 -pokemonanimfunc_53: @ 8182F10 - 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, 0x3C - strh r0, [r1] - movs r0, 0x1E - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_817FF3C - ldr r0, =sub_817FF3C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_53 - - thumb_func_start pokemonanimfunc_54 -pokemonanimfunc_54: @ 8182F48 - 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, 0x1 - strh r0, [r1, 0x2] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_54 - - thumb_func_start pokemonanimfunc_55 -pokemonanimfunc_55: @ 8182F80 - 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] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_55 - - thumb_func_start pokemonanimfunc_56 -pokemonanimfunc_56: @ 8182FB8 - 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 - movs r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_56 - - thumb_func_start pokemonanimfunc_07 -pokemonanimfunc_07: @ 8182FFC - 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, 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_07 - - thumb_func_start pokemonanimfunc_08 -pokemonanimfunc_08: @ 8183030 - 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] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_08 - - thumb_func_start pokemonanimfunc_0B -pokemonanimfunc_0B: @ 8183068 - 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, 0x64 - 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_0B - - thumb_func_start pokemonanimfunc_0C -pokemonanimfunc_0C: @ 818309C - 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] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_0C - - thumb_func_start pokemonanimfunc_0D -pokemonanimfunc_0D: @ 81830D4 - 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, 0x64 - 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_0D - - thumb_func_start pokemonanimfunc_0E -pokemonanimfunc_0E: @ 8183108 - 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] - movs r0, 0x2 - strh r0, [r1, 0x4] - 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_0E - - thumb_func_start sub_8183140 -sub_8183140: @ 8183140 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r2, r0 - ble _0818315C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - b _08183180 - .pool -_0818315C: - adds r1, r2, 0 - adds r1, 0xC0 - adds r0, r1, 0 - cmp r1, 0 - bge _0818316A - ldr r3, =0x000001bf - adds r0, r2, r3 -_0818316A: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl Sin - ldrh r1, [r4, 0x3C] - adds r0, r1 -_08183180: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - ldrh r3, [r4, 0x32] - adds r0, r3 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8183140 - - thumb_func_start pokemonanimfunc_57 -pokemonanimfunc_57: @ 8183194 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_57 - - thumb_func_start pokemonanimfunc_58 -pokemonanimfunc_58: @ 81831B4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_58 - - thumb_func_start pokemonanimfunc_59 -pokemonanimfunc_59: @ 81831D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _081831F8 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _081832BC - .pool -_081831F8: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08183206 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08183206: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08183212 - adds r0, r1, 0x3 -_08183212: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183268 - cmp r0, 0x1 - bgt _08183230 - cmp r0, 0 - beq _0818323A - b _08183298 - .pool -_08183230: - cmp r0, 0x2 - beq _0818324C - cmp r0, 0x3 - beq _08183284 - b _08183298 -_0818323A: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183248 - adds r0, 0x1F -_08183248: - asrs r0, 5 - b _08183296 -_0818324C: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _0818325E - ldr r1, =0x000001ff - adds r0, r1 -_0818325E: - asrs r0, 9 - b _08183296 - .pool -_08183268: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _0818327A - ldr r1, =0x000001ff - adds r0, r1 -_0818327A: - asrs r0, 9 - adds r0, 0x10 - b _08183296 - .pool -_08183284: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183292 - adds r0, 0x1F -_08183292: - asrs r0, 5 - subs r0, 0x10 -_08183296: - strh r0, [r4, 0x24] -_08183298: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081832A4 - adds r0, 0x7F -_081832A4: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x18 - strh r0, [r4, 0x32] -_081832BC: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_59 - - thumb_func_start sub_81832C8 -sub_81832C8: @ 81832C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - movs r0, 0 - mov r8, r0 - movs r2, 0x38 - ldrsh r1, [r6, r2] - movs r2, 0x3A - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818331A - mov r0, r8 - strh r0, [r6, 0x26] - strh r0, [r6, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r1, [r6, 0x36] - movs r2, 0x36 - ldrsh r0, [r6, r2] - cmp r0, 0x1 - bgt _08183310 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r6, 0x1C] - b _081833DC - .pool -_08183310: - subs r0, r1, 0x1 - strh r0, [r6, 0x36] - mov r0, r8 - strh r0, [r6, 0x3C] - b _081833DC -_0818331A: - movs r1, 0x38 - ldrsh r5, [r6, r1] - lsls r0, r5, 7 - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r4, 0 - bge _08183334 - adds r4, 0x3 -_08183334: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r5, r1 - blt _08183358 - cmp r5, r0 - bge _08183358 - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r1, 0xFF - mov r8, r1 - ands r1, r0 - mov r8, r1 -_08183358: - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0818337C - lsls r4, r2, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - ldr r2, =0xffffff00 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - b _08183392 - .pool -_0818337C: - lsls r4, r2, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 -_08183392: - adds r7, r4, 0 - ldrh r4, [r6, 0x34] - lsls r4, 24 - lsrs r4, 24 - mov r5, r8 - adds r0, r4, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl Sin - adds r5, r0, 0 - asrs r0, r7, 16 - adds r1, r4, 0 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - subs r2, r5 - subs r2, r0 - mov r0, r9 - lsls r1, r0, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r6, 0 - movs r3, 0 - bl SetAffineData - ldrh r0, [r6, 0x38] - adds r0, 0x1 - strh r0, [r6, 0x38] -_081833DC: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81832C8 - - thumb_func_start pokemonanimfunc_5A -pokemonanimfunc_5A: @ 81833E8 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _0818340A - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_0818340A: - adds r0, r5, 0 - bl sub_81832C8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5A - - thumb_func_start sub_8183418 -sub_8183418: @ 8183418 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - movs r0, 0 - mov r8, r0 - movs r2, 0x38 - ldrsh r1, [r6, r2] - movs r2, 0x3A - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818346A - mov r0, r8 - strh r0, [r6, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r1, [r6, 0x36] - movs r2, 0x36 - ldrsh r0, [r6, r2] - cmp r0, 0x1 - bgt _08183460 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r6, 0x1C] - b _08183538 - .pool -_08183460: - subs r0, r1, 0x1 - strh r0, [r6, 0x36] - mov r0, r8 - strh r0, [r6, 0x3C] - b _08183538 -_0818346A: - movs r1, 0x38 - ldrsh r5, [r6, r1] - lsls r0, r5, 7 - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - cmp r4, 0 - bge _08183486 - adds r4, 0x3 -_08183486: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r5, r1 - blt _081834AC - cmp r5, r0 - bge _081834AC - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r1, 0xFF - mov r8, r1 - mov r2, r8 - ands r2, r0 - mov r8, r2 -_081834AC: - ldrh r0, [r6, 0x34] - lsls r0, 24 - lsrs r7, r0, 24 - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081834F0 - mov r2, r9 - lsls r0, r2, 16 - asrs r0, 16 - adds r1, r7, 0 - bl Sin - adds r4, r0, 0 - mov r5, r8 - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r5, 0 - bl Sin - ldr r1, =0xffffff00 - adds r0, r1 - adds r4, r0 - lsls r4, 16 - lsrs r1, r4, 16 - b _08183522 - .pool -_081834F0: - mov r4, r8 - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r4, 0 - bl Sin - adds r4, r0, 0 - mov r2, r9 - lsls r0, r2, 16 - asrs r0, 16 - adds r1, r7, 0 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r4 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 -_08183522: - lsls r1, 16 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - movs r3, 0 - bl SetAffineData - ldrh r0, [r6, 0x38] - adds r0, 0x1 - strh r0, [r6, 0x38] -_08183538: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183418 - - thumb_func_start pokemonanimfunc_5B -pokemonanimfunc_5B: @ 8183544 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183566 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183566: - adds r0, r5, 0 - bl sub_8183418 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5B - - thumb_func_start sub_8183574 -sub_8183574: @ 8183574 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r3, =gUnknown_0860AA80 - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r0, r1, r3 - ldrb r5, [r0] - adds r2, r5, 0 - cmp r5, 0xFF - beq _081835A6 - ldrh r0, [r4, 0x3C] - lsls r0, 24 - lsrs r5, r0, 24 -_081835A6: - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - movs r7, 0 - cmp r2, 0xFE - beq _081835C2 - mov r1, r9 - subs r0, r6, r1 - muls r0, r5 - adds r1, r6, 0 - bl __divsi3 - lsls r0, 24 - lsrs r7, r0, 24 -_081835C2: - cmp r5, 0xFF - bne _081835D8 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - b _0818360A - .pool -_081835D8: - mov r1, r8 - adds r1, 0xC0 - adds r0, r1, 0 - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - adds r1, r7, 0 - bl Sin - adds r0, r7 - strh r0, [r4, 0x26] - cmp r9, r6 - bne _081835FC - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r0, 0 - b _08183608 -_081835FC: - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 -_08183608: - strh r0, [r4, 0x3A] -_0818360A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183574 + thumb_func_start pokemonanimfunc_5C pokemonanimfunc_5C: @ 8183618 diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 87949e88b..1496069df 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -1071,14 +1071,13 @@ void pokemonanimfunc_02(struct Sprite *sprite) } else { - s8 var; - + s8 sign; if (!(sprite->data[2] & 1)) - var = 1; + sign = 1; else - var = -1; + sign = -1; - sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 6) * var; + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 6) * sign; } sprite->data[2]++; @@ -1427,19 +1426,19 @@ void pokemonanimfunc_11(struct Sprite *sprite) } else { - s8 var; + s8 sign; s32 index, amplitude; if (!(sprite->data[2] & 1)) - var = 1; + sign = 1; else - var = -1; + sign = -1; amplitude = Sin(sprite->data[2] / 4, 8); index = sprite->data[2] % 256; - sprite->pos2.y = Sin(index, amplitude) * var; - sprite->pos2.x = Cos(index, amplitude) * var; + sprite->pos2.y = Sin(index, amplitude) * sign; + sprite->pos2.x = Cos(index, amplitude) * sign; } sprite->data[2] += 9; @@ -3132,3 +3131,1066 @@ void sub_8181FC0(struct Sprite *sprite) HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[7] << 8); sub_817F70C(sprite); } + +void pokemonanimfunc_37(struct Sprite *sprite) +{ + u16 rotation; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 255) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[7] = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[7] += 16; + sprite->pos2.x = -(Sin(sprite->data[7] % 128, 8)); + sprite->pos2.y = -(Sin(sprite->data[7] % 128, 8)); + } + + rotation = Sin(sprite->data[7] % 128, 16); + HandleSetAffineData(sprite, 0x100, 0x100, rotation << 8); + sub_817F70C(sprite); +} + +void sub_81820FC(struct Sprite *sprite); +void sub_818216C(struct Sprite *sprite); +void sub_81821CC(struct Sprite *sprite); +void sub_8182248(struct Sprite *sprite); + +void pokemonanimfunc_38(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->data[4] = 0; + sprite->callback = sub_81820FC; +} + +void sub_81820FC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] > 24) + { + if (++sprite->data[4] > 4) + { + sprite->data[4] = 0; + sprite->callback = sub_818216C; + } + } + else + { + sprite->data[7] += 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +void sub_818216C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] > 32) + { + sprite->data[6] = 1; + sprite->callback = sub_81821CC; + } + else + { + sprite->data[7] += 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +void sub_81821CC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] += (sprite->data[6] * 4); + if (sprite->data[5] > 9) + { + sprite->data[7] = 32; + sprite->callback = sub_8182248; + } + + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + if (sprite->data[7] <= 28 || sprite->data[7] >= 36) + { + sprite->data[6] *= -1; + sprite->data[5]++; + } + + HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +void sub_8182248(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] <= 0) + { + sprite->data[7] = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[7] -= 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +void pokemonanimfunc_39(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + if ((sprite->data[2] % 4) / 2 == 0) + { + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 16) * sign; + sprite->pos2.y = -(sprite->pos2.x); + } + else + { + sprite->pos2.x = -(Sin((sprite->data[2] * 128 / 40) % 256, 16)) * sign; + sprite->pos2.y = sprite->pos2.x; + } + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +void pokemonanimfunc_3A(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[5] = 0; + sprite->data[6] = 0; + sprite->data[7] = 0; + sprite->data[2]++; + } + + if (sprite->data[6] > 0) + { + sprite->data[6]--; + if (sprite->data[5] != 3) + { + s16 scale = (8 * sprite->data[6]) / 20; + scale = Sin(sprite->data[7] - scale, 64); + HandleSetAffineData(sprite, 0x100 - scale, 0x100 - scale, 0); + } + } + else + { + s16 var; + + if (sprite->data[5] == 3) + { + if (sprite->data[7] > 63) + { + sprite->data[7] = 64; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + var = Cos(sprite->data[7], 64); + } + else + { + var = Sin(sprite->data[7], 64); + if (sprite->data[7] > 63) + { + sprite->data[5] = 3; + sprite->data[6] = 10; + sprite->data[7] = 0; + } + else + { + if (var > 48 && sprite->data[5] == 1) + { + sprite->data[5] = 2; + sprite->data[6] = 20; + } + else if (var > 16 && sprite->data[5] == 0) + { + sprite->data[5] = 1; + sprite->data[6] = 20; + } + } + } + + sprite->data[7] += 2; + HandleSetAffineData(sprite, 0x100 - var, 0x100 - var, 0); + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_3B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale; + + sprite->pos2.y = Sin(sprite->data[7] % 256, 8); + sprite->data[7] += 8; + yScale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 0x100, yScale + 0x100, 0); + } +} + +void pokemonanimfunc_3C(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 256) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale; + + sprite->pos2.y = Sin(sprite->data[7], 16); + sprite->data[7] += 4; + yScale = Sin((sprite->data[7] % 64) * 2, 128); + HandleSetAffineData(sprite, 0x100, yScale + 0x100, 0); + } +} + +void sub_81825F8(struct Sprite *sprite); +void sub_8182648(struct Sprite *sprite); +void sub_81826F8(struct Sprite *sprite); + +void pokemonanimfunc_3D(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_81825F8; + sprite->data[7] = 0; +} + +void sub_81825F8(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 8; + if (sprite->data[7] > 63) + { + sprite->data[7] = 0; + sprite->data[6] = 0; + sprite->callback = sub_8182648; + yScale = Sin(64, 128); // 128 * 1 = 128 + } + else + { + yScale = Sin(sprite->data[7], 128); + } + + HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); +} + +void sub_8182648(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 4; + if (sprite->data[7] > 95) + { + yScale = Cos(0, 128); // 128 * (-1) = -128 + sprite->data[7] = 0; + sprite->data[6]++; + } + else + { + s16 sign, index; + + sprite->pos2.y = -(sprite->data[6] * 4) - Sin(sprite->data[7], 8); + if (sprite->data[7] > 63) + { + sign = -1; + index = sprite->data[7] - 64; + } + else + { + sign = 1; + index = 0; + } + + yScale = Cos((index * 2) + sprite->data[7], 128) * sign; + } + + HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); + if (sprite->data[6] == 3) + { + sprite->data[7] = 0; + sprite->callback = sub_81826F8; + } +} + +void sub_81826F8(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 8; + yScale = Cos(sprite->data[7], 128); + sprite->pos2.y = -(Cos(sprite->data[7], 12)); + if (sprite->data[7] > 63) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + } + + HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); +} + +void sub_8182764(struct Sprite *sprite) +{ + if (sprite->data[7] > sprite->data[5]) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + } + else + { + s16 xScale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); + sprite->data[7] += sprite->data[6]; + xScale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 0x100 + xScale, 0x100, 0); + } +} + +void pokemonanimfunc_3E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 8; + } + + sub_8182764(sprite); +} + +void sub_8182830(struct Sprite *sprite) +{ + if (sprite->data[7] > sprite->data[5]) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + } + else + { + s16 xScale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); + sprite->data[7] += sprite->data[6]; + xScale = Sin((sprite->data[7] % 64) * 2, 128); + HandleSetAffineData(sprite, 0x100 + xScale, 0x100, 0); + } +} + +void pokemonanimfunc_3F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 256; + sprite->data[4] = 16; + } + + sub_8182830(sprite); +} + +void pokemonanimfunc_40(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, 8); + sprite->data[7] += 8; + scale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_41(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = -(Sin((sprite->data[7] % 256) / 2, 16)); + sprite->data[7] += 8; + scale = -(Sin((sprite->data[7] % 256) / 2, 64)); + HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_42(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 0x100, 0x100, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = -(Sin(sprite->data[7] % 256 , 8)); + sprite->data[7] += 8; + scale = Sin((sprite->data[7] % 256) / 2, 96); + HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_43(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 caseVar = (sprite->data[2] / 512) % 4; + switch (caseVar) + { + case 0: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = (sprite->data[2] % 512 / 32) - 16; + break; + case 2: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 3: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + } + + sprite->pos2.y = -(Sin(sprite->data[2] % 128, 4)); + sprite->data[2] += 24; + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_44(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + sprite->data[6] = 0; + sprite->data[7] = 64; + sprite->data[2]++; + } + + sprite->data[7] += 8; + if (sprite->data[6] == 4) + { + if (sprite->data[7] > 63) + { + sprite->data[7] = 0; + sprite->data[6]++; + } + } + else + { + if (sprite->data[7] > 127) + { + sprite->data[7] = 0; + sprite->data[6]++; + } + } + + switch (sprite->data[6]) + { + case 1: + sprite->pos2.x = -(Cos(sprite->data[7], 8)); + sprite->pos2.y = Sin(sprite->data[7], 8) - 8; + break; + case 2: + sprite->pos2.x = Sin(sprite->data[7] + 128, 8) + 8; + sprite->pos2.y = -(Cos(sprite->data[7], 8)); + break; + case 3: + sprite->pos2.x = Cos(sprite->data[7], 8); + sprite->pos2.y = Sin(sprite->data[7] + 128, 8) + 8; + break; + case 0: + case 4: + sprite->pos2.x = Sin(sprite->data[7], 8) - 8; + sprite->pos2.y = Cos(sprite->data[7], 8); + break; + default: + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + break; + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_45(struct Sprite *sprite) +{ + sprite->data[0] = 32; + sub_8180714(sprite); + sprite->callback = sub_8180714; +} + +void pokemonanimfunc_46(struct Sprite *sprite) +{ + sprite->data[0] = 80; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +void pokemonanimfunc_47(struct Sprite *sprite) +{ + sprite->data[0] = 80; + sub_817F978(sprite); + sprite->callback = sub_817F978; +} + +void pokemonanimfunc_48(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 2048; + gUnknown_03001240[id].field_8 = sprite->data[6]; + sub_8180900(sprite); + sprite->callback = sub_8180900; +} + +void pokemonanimfunc_49(struct Sprite *sprite) +{ + sprite->data[6] = 1; + pokemonanimfunc_05(sprite); +} + +void pokemonanimfunc_4A(struct Sprite *sprite) +{ + sprite->data[6] = 1; + pokemonanimfunc_48(sprite); +} + +void pokemonanimfunc_4B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[0] = 0; + + if (sprite->data[0] <= 0) + { + sub_817FC20(sprite); + sprite->data[0] = 1; + } + else + { + sprite->data[0]--; + } +} + +void pokemonanimfunc_4C(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sprite->data[7] = 3; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +void pokemonanimfunc_4D(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sub_817FD44(sprite); + sprite->callback = sub_817FD44; +} + +void pokemonanimfunc_4E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 1024; + gUnknown_03001240[id].field_0 = 0; + gUnknown_03001240[id].field_4 = 2; + sub_817FE30(sprite); + sprite->callback = sub_817FE30; +} + +void pokemonanimfunc_4F(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 512; + gUnknown_03001240[id].field_8 = 3; + gUnknown_03001240[id].field_2 = 12; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +void pokemonanimfunc_50(struct Sprite *sprite) +{ + sprite->data[0] = 24; + sub_818031C(sprite); + sprite->callback = sub_818031C; +} + +void pokemonanimfunc_51(struct Sprite *sprite) +{ + sprite->data[0] = 5; + sub_81804F8(sprite); + sprite->callback = sub_81804F8; +} + +void pokemonanimfunc_52(struct Sprite *sprite) +{ + sprite->data[0] = 3; + sub_817F9F4(sprite); + sprite->callback = sub_817F9F4; +} + +void pokemonanimfunc_53(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_0 = 60; + gUnknown_03001240[id].field_8 = 30; + sub_817FF3C(sprite); + sprite->callback = sub_817FF3C; +} + +void pokemonanimfunc_54(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_2 = 1; + gUnknown_03001240[id].field_4 = 2; + sub_8181214(sprite); + sprite->callback = sub_8181214; +} + +void pokemonanimfunc_55(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 4; + gUnknown_03001240[id].field_4 = 2; + sub_8181810(sprite); + sprite->callback = sub_8181810; +} + +void pokemonanimfunc_56(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_8 = 1; + gUnknown_03001240[id].field_4 = 2; + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sub_8181ABC(sprite); + sprite->callback = sub_8181ABC; +} + +void pokemonanimfunc_07(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 2; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +void pokemonanimfunc_08(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 4; + gUnknown_03001240[id].field_4 = 2; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +void pokemonanimfunc_0B(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_8 = 100; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +void pokemonanimfunc_0C(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_8 = 50; + gUnknown_03001240[id].field_4 = 2; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +void pokemonanimfunc_0D(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_8 = 100; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +void pokemonanimfunc_0E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_8 = 50; + gUnknown_03001240[id].field_4 = 2; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +void sub_8183140(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin((counter + 192) % 256, sprite->data[7]) + sprite->data[7]; + } + + sprite->data[2] += sprite->data[0]; +} + +void pokemonanimfunc_57(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sprite->data[7] = 3; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +void pokemonanimfunc_58(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sprite->data[7] = 3; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +void pokemonanimfunc_59(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 128, 4); + sprite->data[2] += 24; + } + + sub_817F70C(sprite); +} + +void sub_81832C8(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + + if (sprite->data[5] > sprite->data[6]) + { + sprite->pos2.y = 0; + sprite->data[5] = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale, yScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + if (sprite->data[1] == 0) + xScale = -0x100 - Sin(index2, 16); + else + xScale = 0x100 + Sin(index2, 16); + + amplitude = sprite->data[3]; + yScale = 0x100 - Sin(index2, amplitude) - Sin(index1, amplitude / 5); + SetAffineData(sprite, xScale, yScale, 0); + sprite->data[5]++; + } +} + +void pokemonanimfunc_5A(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +void sub_8183418(struct Sprite *sprite) +{ + s16 index1 = 0, index2; + + if (sprite->data[5] > sprite->data[6]) + { + sprite->data[5] = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + amplitude = sprite->data[3]; + + if (sprite->data[1] == 0) + xScale = -0x100 + Sin(index2, amplitude) + Sin(index1, amplitude / 5 * 2); + else + xScale = 0x100 - Sin(index2, amplitude) - Sin(index1, amplitude / 5 * 2); + + SetAffineData(sprite, xScale, 0x100, 0); + sprite->data[5]++; + } +} + +void pokemonanimfunc_5B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +void sub_8183574(struct Sprite *sprite) +{ + u8 var6, var7; + u8 var8 = sprite->data[2]; + u8 var9 = sprite->data[6]; + u8 var5 = gUnknown_0860AA80[sprite->data[5]][0]; + u8 var2 = var5; + if (var5 != 0xFF) + var5 = sprite->data[7]; + else + var5 = 0xFF; // needed to match + + var6 = gUnknown_0860AA80[sprite->data[5]][1]; + var7 = 0; + if (var2 != 0xFE) + var7 = (var6 - var9) * var5 / var6; + + if (var5 == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin((var8 + 192) % 256, var7) + var7; + if (var9 == var6) + { + sprite->data[5]++; + sprite->data[6] = 0; + } + else + { + sprite->data[2] += sprite->data[0]; + sprite->data[6]++; + } + } +} From 16c46905ff08ab61fbd36c9e30e8d18aa7a03467 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 28 Jan 2018 00:51:20 +0100 Subject: [PATCH 07/15] more pokemon animation functions --- asm/pokemon_animation.s | 1450 -------------------------------------- data/pokemon_animation.s | 1 + src/pokemon_animation.c | 606 +++++++++++++++- 3 files changed, 605 insertions(+), 1452 deletions(-) diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index 96ec4f77a..919c1a31e 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -5,1458 +5,8 @@ .text - - thumb_func_start pokemonanimfunc_5C -pokemonanimfunc_5C: @ 8183618 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5C - thumb_func_start pokemonanimfunc_5D -pokemonanimfunc_5D: @ 8183638 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x46 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5D - - thumb_func_start pokemonanimfunc_5E -pokemonanimfunc_5E: @ 8183658 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x14 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5E - - thumb_func_start pokemonanimfunc_5F -pokemonanimfunc_5F: @ 8183674 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _08183690 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - b _081836CA - .pool -_08183690: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _0818369C - movs r5, 0x1 -_0818369C: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081836B0 - adds r0, 0xFF -_081836B0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x9 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_081836CA: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5F - - thumb_func_start pokemonanimfunc_60 -pokemonanimfunc_60: @ 81836D8 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _081836F4 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - b _0818372E - .pool -_081836F4: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _08183700 - movs r5, 0x1 -_08183700: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _08183714 - adds r0, 0xFF -_08183714: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0xC - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_0818372E: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_60 - - thumb_func_start pokemonanimfunc_61 -pokemonanimfunc_61: @ 818373C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x46 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_61 - - thumb_func_start pokemonanimfunc_62 -pokemonanimfunc_62: @ 818375C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x18 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_62 - - thumb_func_start pokemonanimfunc_63 -pokemonanimfunc_63: @ 818377C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x38 - strh r0, [r4, 0x2E] - movs r0, 0x9 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_63 - - thumb_func_start pokemonanimfunc_64 -pokemonanimfunc_64: @ 818379C - 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, 3 - strh r0, [r1, 0x6] - movs r0, 0x6 - strh r0, [r1, 0x8] - movs r0, 0x18 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_64 - - thumb_func_start sub_81837DC -sub_81837DC: @ 81837DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r7, r0, 0 - movs r5, 0 - movs r0, 0x38 - ldrsh r1, [r7, r0] - movs r2, 0x3A - ldrsh r0, [r7, r2] - cmp r1, r0 - ble _0818382C - strh r5, [r7, 0x26] - strh r5, [r7, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r7, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - ldrh r1, [r7, 0x36] - movs r2, 0x36 - ldrsh r0, [r7, r2] - cmp r0, 0x1 - bgt _08183824 - adds r0, r7, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r7, 0x1C] - b _0818392C - .pool -_08183824: - subs r0, r1, 0x1 - strh r0, [r7, 0x36] - strh r5, [r7, 0x3C] - b _0818392C -_0818382C: - movs r0, 0x38 - ldrsh r6, [r7, r0] - lsls r0, r6, 7 - movs r1, 0x3A - ldrsh r4, [r7, r1] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r4, 0 - bge _08183846 - adds r4, 0x3 -_08183846: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r6, r1 - blt _08183866 - cmp r6, r0 - bge _08183866 - ldrh r0, [r7, 0x3C] - adds r0, 0x33 - strh r0, [r7, 0x3C] - movs r5, 0xFF - ands r5, r0 -_08183866: - ldrh r0, [r7, 0x34] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r1, 0x30 - ldrsh r0, [r7, r1] - cmp r0, 0 - bne _081838B0 - lsls r2, 16 - mov r8, r2 - asrs r0, r2, 16 - mov r1, r9 - bl Sin - adds r4, r0, 0 - lsls r6, r5, 16 - asrs r5, r6, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r5, 0 - bl Sin - ldr r2, =0xffffff00 - adds r4, r2 - adds r0, r4 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - mov r0, r8 - b _081838EA - .pool -_081838B0: - lsls r2, 16 - mov r8, r2 - asrs r0, r2, 16 - mov r1, r9 - bl Sin - adds r6, r0, 0 - lsls r5, 16 - asrs r4, r5, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r4, 0 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r6 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - mov r10, r1 - mov r0, r8 - adds r6, r5, 0 -_081838EA: - asrs r0, 16 - mov r1, r9 - bl Sin - adds r5, r0, 0 - asrs r4, r6, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - subs r2, r5 - subs r2, r0 - mov r0, r10 - lsls r1, r0, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r7, 0 - movs r3, 0 - bl SetAffineData - ldrh r0, [r7, 0x38] - adds r0, 0x1 - strh r0, [r7, 0x38] -_0818392C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81837DC - - thumb_func_start pokemonanimfunc_65 -pokemonanimfunc_65: @ 818393C - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _0818395E - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_0818395E: - adds r0, r5, 0 - bl sub_81837DC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_65 - - thumb_func_start pokemonanimfunc_66 -pokemonanimfunc_66: @ 818396C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08183990 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08183A54 - .pool -_08183990: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _0818399E - ldr r1, =0x000001ff - adds r0, r2, r1 -_0818399E: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _081839AA - adds r0, r1, 0x3 -_081839AA: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183A00 - cmp r0, 0x1 - bgt _081839C8 - cmp r0, 0 - beq _081839D2 - b _08183A30 - .pool -_081839C8: - cmp r0, 0x2 - beq _081839E4 - cmp r0, 0x3 - beq _08183A1C - b _08183A30 -_081839D2: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _081839E0 - adds r0, 0x1F -_081839E0: - asrs r0, 5 - b _08183A2E -_081839E4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _081839F6 - ldr r1, =0x000001ff - adds r0, r1 -_081839F6: - asrs r0, 9 - b _08183A2E - .pool -_08183A00: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183A12 - ldr r1, =0x000001ff - adds r0, r1 -_08183A12: - asrs r0, 9 - adds r0, 0x10 - b _08183A2E - .pool -_08183A1C: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183A2A - adds r0, 0x1F -_08183A2A: - asrs r0, 5 - subs r0, 0x10 -_08183A2E: - strh r0, [r4, 0x24] -_08183A30: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08183A3C - adds r0, 0x7F -_08183A3C: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x30 - strh r0, [r4, 0x32] -_08183A54: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_66 - - thumb_func_start pokemonanimfunc_67 -pokemonanimfunc_67: @ 8183A60 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08183A84 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08183B40 - .pool -_08183A84: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08183A92 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08183A92: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08183A9E - adds r0, r1, 0x3 -_08183A9E: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183AF4 - cmp r0, 0x1 - bgt _08183ABC - cmp r0, 0 - beq _08183AC6 - b _08183B24 - .pool -_08183ABC: - cmp r0, 0x2 - beq _08183AD8 - cmp r0, 0x3 - beq _08183B10 - b _08183B24 -_08183AC6: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183AD4 - adds r0, 0x1F -_08183AD4: - asrs r0, 5 - b _08183B22 -_08183AD8: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183AEA - ldr r1, =0x000001ff - adds r0, r1 -_08183AEA: - asrs r0, 9 - b _08183B22 - .pool -_08183AF4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183B06 - ldr r1, =0x000001ff - adds r0, r1 -_08183B06: - asrs r0, 9 - adds r0, 0x10 - b _08183B22 - .pool -_08183B10: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183B1E - adds r0, 0x1F -_08183B1E: - asrs r0, 5 - subs r0, 0x10 -_08183B22: - strh r0, [r4, 0x24] -_08183B24: - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x60 - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x40 - strh r0, [r4, 0x32] -_08183B40: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_67 - - thumb_func_start sub_8183B4C -sub_8183B4C: @ 8183B4C - push {r4-r7,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183B5E - strh r0, [r4, 0x34] -_08183B5E: - ldr r7, =gUnknown_0860ADBE - movs r2, 0x34 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - adds r5, r7, 0x2 - adds r0, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl __divsi3 - movs r2, 0x32 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _08183B8C - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x34] - strh r1, [r4, 0x32] -_08183B8C: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r6, r0, r1 - adds r0, r6, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - movs r1, 0x38 - ldrsh r5, [r4, r1] - adds r1, r5, 0 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bne _08183BCC - ldrh r0, [r4, 0x3A] - subs r0, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - cmp r0, 0 - bne _08183BC8 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08183C06 - .pool -_08183BC8: - strh r1, [r4, 0x32] - b _08183C06 -_08183BCC: - adds r0, r6, r7 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - muls r0, r5 - ldrh r2, [r4, 0x24] - adds r0, r2 - strh r0, [r4, 0x24] - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r7, 0x1 - adds r0, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - ldrh r0, [r4, 0x38] - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C -_08183C06: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183B4C - - thumb_func_start pokemonanimfunc_68 -pokemonanimfunc_68: @ 8183C0C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - strh r0, [r4, 0x38] - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_68 - - thumb_func_start pokemonanimfunc_69 -pokemonanimfunc_69: @ 8183C2C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strh r0, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_69 - - thumb_func_start pokemonanimfunc_6A -pokemonanimfunc_6A: @ 8183C4C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strh r0, [r4, 0x38] - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_6A - - thumb_func_start sub_8183C6C -sub_8183C6C: @ 8183C6C - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0xFF - ble _08183CAE - ldrh r1, [r4, 0x38] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bgt _08183CA4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - b _08183CE8 - .pool -_08183CA4: - subs r0, r1, 0x1 - movs r1, 0 - strh r0, [r4, 0x38] - strh r1, [r4, 0x3C] - b _08183CE8 -_08183CAE: - ldrh r0, [r4, 0x3A] - adds r0, r1, r0 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - movs r5, 0x80 - lsls r5, 1 - cmp r0, r5 - ble _08183CC2 - strh r5, [r4, 0x3C] -_08183CC2: - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x40 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - asrs r2, 16 - subs r2, r5, r2 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData -_08183CE8: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8183C6C - - thumb_func_start pokemonanimfunc_6B -pokemonanimfunc_6B: @ 8183CF0 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D16 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - movs r0, 0x1 - strh r0, [r4, 0x38] -_08183D16: - adds r0, r4, 0 - bl sub_8183C6C - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6B - - thumb_func_start pokemonanimfunc_6C -pokemonanimfunc_6C: @ 8183D28 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D4E - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x2 - strh r0, [r4, 0x38] -_08183D4E: - adds r0, r4, 0 - bl sub_8183C6C - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6C - - thumb_func_start pokemonanimfunc_6D -pokemonanimfunc_6D: @ 8183D60 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D88 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183D88: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6D - - thumb_func_start pokemonanimfunc_6E -pokemonanimfunc_6E: @ 8183D94 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183DBA - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - adds r0, 0xFC - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183DBA: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6E - - thumb_func_start pokemonanimfunc_6F -pokemonanimfunc_6F: @ 8183DC8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183DF0 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183DF0: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6F - - thumb_func_start pokemonanimfunc_70 -pokemonanimfunc_70: @ 8183DFC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183E22 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r1, 0x8 - strh r1, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] -_08183E22: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_70 - - thumb_func_start pokemonanimfunc_71 -pokemonanimfunc_71: @ 8183E30 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183E4A - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x5 - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] -_08183E4A: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_71 - - thumb_func_start pokemonanimfunc_72 -pokemonanimfunc_72: @ 8183E58 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183E72 - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x3 - strh r0, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] -_08183E72: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_72 - - thumb_func_start pokemonanimfunc_73 -pokemonanimfunc_73: @ 8183E80 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183EA2 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x3C] -_08183EA2: - adds r0, r5, 0 - bl sub_81832C8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_73 - - thumb_func_start pokemonanimfunc_74 -pokemonanimfunc_74: @ 8183EB0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183ED4 - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x3C] -_08183ED4: - adds r0, r4, 0 - bl sub_81832C8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_74 - - thumb_func_start pokemonanimfunc_75 -pokemonanimfunc_75: @ 8183EE0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183F06 - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3C] -_08183F06: - adds r0, r4, 0 - bl sub_8183418 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_75 - - thumb_func_start pokemonanimfunc_76 -pokemonanimfunc_76: @ 8183F14 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183F38 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183F38: - adds r0, r5, 0 - bl sub_8183418 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_76 - - thumb_func_start pokemonanimfunc_77 -pokemonanimfunc_77: @ 8183F44 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183F6A - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3C] -_08183F6A: - adds r0, r4, 0 - bl sub_81837DC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_77 - - thumb_func_start pokemonanimfunc_78 -pokemonanimfunc_78: @ 8183F78 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183F9C - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl HandleStartAffineAnim - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183F9C: - adds r0, r5, 0 - bl sub_81837DC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_78 - - thumb_func_start sub_8183FA8 -sub_8183FA8: @ 8183FA8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0xFF - ble _08183FEA - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r0, [r4, r3] - cmp r0, 0x1 - bgt _08183FD0 - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - b _0818403E - .pool -_08183FD0: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08183FDC - adds r0, 0xFF -_08183FDC: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - strh r0, [r4, 0x3C] - subs r0, r2, 0x1 - strh r0, [r4, 0x3A] - b _0818403E -_08183FEA: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r3, 0x3C - ldrsh r2, [r4, r3] - adds r1, r2, 0 - adds r1, 0xC0 - adds r0, r1, 0 - cmp r1, 0 - bge _0818400C - ldr r3, =0x000001bf - adds r0, r2, r3 -_0818400C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x26] - lsls r0, 16 - cmp r0, 0 - ble _0818402E - movs r3, 0x26 - ldrsh r0, [r4, r3] - negs r0, r0 - strh r0, [r4, 0x26] -_0818402E: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x34] - ldrh r2, [r4, 0x3C] - adds r0, r2 - strh r0, [r4, 0x3C] -_0818403E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8183FA8 - - thumb_func_start pokemonanimfunc_79 -pokemonanimfunc_79: @ 8184048 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _08184066 - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x4 - strh r0, [r1, 0x34] -_08184066: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_79 - - thumb_func_start pokemonanimfunc_7A -pokemonanimfunc_7A: @ 8184070 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _0818408E - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x6 - strh r0, [r1, 0x34] -_0818408E: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7A - - thumb_func_start pokemonanimfunc_7B -pokemonanimfunc_7B: @ 8184098 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _081840B8 - movs r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0x2 - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x8 - strh r0, [r1, 0x34] -_081840B8: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7B thumb_func_start sub_81840C4 sub_81840C4: @ 81840C4 diff --git a/data/pokemon_animation.s b/data/pokemon_animation.s index 08254b40d..cbab5295f 100644 --- a/data/pokemon_animation.s +++ b/data/pokemon_animation.s @@ -3,6 +3,7 @@ .section .rodata + .align 2 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/src/pokemon_animation.c b/src/pokemon_animation.c index 1496069df..67915d228 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -2025,8 +2025,6 @@ void pokemonanimfunc_05(struct Sprite *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) @@ -4194,3 +4192,607 @@ void sub_8183574(struct Sprite *sprite) } } } + +void pokemonanimfunc_5C(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sprite->data[7] = 6; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +void pokemonanimfunc_5D(struct Sprite *sprite) +{ + sprite->data[0] = 70; + sprite->data[7] = 6; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +void pokemonanimfunc_5E(struct Sprite *sprite) +{ + sprite->data[0] = 20; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +void pokemonanimfunc_5F(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 9) * sign; + } + + sprite->data[2]++; +} + +void pokemonanimfunc_60(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 12) * sign; + } + + sprite->data[2]++; +} + +void pokemonanimfunc_61(struct Sprite *sprite) +{ + sprite->data[0] = 70; + sprite->data[7] = 6; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +void pokemonanimfunc_62(struct Sprite *sprite) +{ + sprite->data[0] = 24; + sprite->data[7] = 6; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +void pokemonanimfunc_63(struct Sprite *sprite) +{ + sprite->data[0] = 56; + sprite->data[7] = 9; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +void pokemonanimfunc_64(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + gUnknown_03001240[id].field_6 = 1024; + gUnknown_03001240[id].field_8 = 6; + gUnknown_03001240[id].field_2 = 24; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +void sub_81837DC(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + if (sprite->data[5] > sprite->data[6]) + { + sprite->pos2.y = 0; + sprite->data[5] = 0; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale, yScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + amplitude = sprite->data[3]; + + if (sprite->data[1] == 0) + xScale = Sin(index2, amplitude) + (Sin(index1, amplitude / 5 * 2) - 0x100); + else + xScale = 0x100 - Sin(index1, amplitude / 5 * 2) - Sin(index2, amplitude); + + yScale = 0x100 - Sin(index1, amplitude / 5) - Sin(index2, amplitude); + SetAffineData(sprite, xScale, yScale, 0); + sprite->data[5]++; + } +} + +void pokemonanimfunc_65(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +void pokemonanimfunc_66(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 128, 4); + sprite->data[2] += 48; + } + + sub_817F70C(sprite); +} + +void pokemonanimfunc_67(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 96, 4); + sprite->data[2] += 64; + } + + sub_817F70C(sprite); +} + +static const s8 gUnknown_0860ADBE[][3] = +{ +// x y timer + {1, 1, 12}, + {-2, 0, 12}, + {1, -1, 12}, + {0, 0, 0} +}; + +void sub_8183B4C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + sprite->data[3] = 0; + + if (gUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == sprite->data[2]) + { + sprite->data[3]++; + sprite->data[2] = 0; + } + + if (gUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == 0) + { + if (--sprite->data[6] == 0) + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + else + sprite->data[2] = 0; + } + else + { + s32 amplitude = sprite->data[5]; + sprite->pos2.x += (gUnknown_0860ADBE[sprite->data[3]][0] * amplitude); + sprite->pos2.y += (gUnknown_0860ADBE[sprite->data[3]][1] * sprite->data[5]); // what's the point of the var if you're not reusing it? + sprite->data[2]++; + sub_817F70C(sprite); + } +} + +void pokemonanimfunc_68(struct Sprite *sprite) +{ + sprite->data[5] = 1; + sprite->data[6] = 1; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +void pokemonanimfunc_69(struct Sprite *sprite) +{ + sprite->data[5] = 2; + sprite->data[6] = 1; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +void pokemonanimfunc_6A(struct Sprite *sprite) +{ + sprite->data[5] = 2; + sprite->data[6] = 2; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +void sub_8183C6C(struct Sprite *sprite) +{ + if (sprite->data[7] > 255) + { + if (sprite->data[5] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 0x100, 0x100, 0); + } + else + { + sprite->data[5]--; + sprite->data[7] = 0; + } + } + else + { + s16 scale; + + sprite->data[7] += sprite->data[6]; + if (sprite->data[7] > 256) + sprite->data[7] = 256; + + scale = Sin(sprite->data[7] / 2, 64); + HandleSetAffineData(sprite, 0x100 - scale, 0x100 - scale, 0); + } +} + +void pokemonanimfunc_6B(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 1; + } + + sub_8183C6C(sprite); + sub_817F70C(sprite); +} + +void pokemonanimfunc_6C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 2; + } + + sub_8183C6C(sprite); + sub_817F70C(sprite); +} + +void pokemonanimfunc_6D(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 16; + } + + sub_8182764(sprite); +} + +void pokemonanimfunc_6E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 256; + sprite->data[4] = 16; + } + + sub_8182764(sprite); +} + +void pokemonanimfunc_6F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 16; + } + + sub_8182830(sprite); +} + +void pokemonanimfunc_70(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 8; + } + + sub_8182830(sprite); +} + +void pokemonanimfunc_71(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 5; + sprite->data[6] = 8; + } + + sub_8180828(sprite); +} + +void pokemonanimfunc_72(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 3; + sprite->data[6] = 4; + } + + sub_8180828(sprite); +} + +void pokemonanimfunc_73(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +void pokemonanimfunc_74(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +void pokemonanimfunc_75(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +void pokemonanimfunc_76(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +void pokemonanimfunc_77(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +void pokemonanimfunc_78(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +void sub_8183FA8(struct Sprite *sprite) +{ + if (sprite->data[7] > 255) + { + if (sprite->data[6] <= 1) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + sprite->data[7] %= 256; + sprite->data[6]--; + } + } + else + { + sprite->pos2.x = -(Sin(sprite->data[7], sprite->data[5])); + sprite->pos2.y = Sin((sprite->data[7] + 192) % 256, sprite->data[4]); + if (sprite->pos2.y > 0) + sprite->pos2.y *= -1; + + sprite->pos2.y += sprite->data[4]; + sprite->data[7] += sprite->data[3]; + } +} + +void pokemonanimfunc_79(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 4; + } + + sub_8183FA8(sprite); +} + +void pokemonanimfunc_7A(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 6; + } + + sub_8183FA8(sprite); +} + +void pokemonanimfunc_7B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 8; + } + + sub_8183FA8(sprite); +} From b377112cd6cf91ad01e8c469328d120d93ed2edc Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Sat, 27 Jan 2018 22:58:44 -0500 Subject: [PATCH 08/15] decompile item_use --- asm/item_use.s | 2863 ------------------------------------------------ ld_script.txt | 2 +- src/item_use.c | 1271 +++++++++++++++++++++ 3 files changed, 1272 insertions(+), 2864 deletions(-) delete mode 100644 asm/item_use.s create mode 100755 src/item_use.c diff --git a/asm/item_use.s b/asm/item_use.s deleted file mode 100644 index 0d9f30ec3..000000000 --- a/asm/item_use.s +++ /dev/null @@ -1,2863 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start SetUpItemUseCallback -@ void SetUpItemUseCallback(u8 taskId) -SetUpItemUseCallback: @ 80FD060 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gSpecialVar_ItemId - ldrh r0, [r1] - cmp r0, 0xAF - bne _080FD084 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrb r0, [r1, 0x10] - b _080FD08A - .pool -_080FD084: - ldrh r0, [r1] - bl ItemId_GetType -_080FD08A: - subs r0, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FD0B8 - ldr r0, =gUnknown_0203CE54 - ldr r2, [r0] - ldr r1, =gUnknown_085920D8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - adds r0, r5, 0 - bl unknown_ItemMenu_Confirm - b _080FD0CC - .pool -_080FD0B8: - ldr r0, =gUnknown_0203CF2C - ldr r2, [r0] - ldr r1, =gUnknown_085920D8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - adds r0, r5, 0 - bl sub_81C5B14 -_080FD0CC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetUpItemUseCallback - - thumb_func_start SetUpItemUseOnFieldCallback -@ void SetUpItemUseOnFieldCallback() -SetUpItemUseOnFieldCallback: @ 80FD0DC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _080FD110 - ldr r1, =gFieldCallback - ldr r0, =MapPostLoadHook_UseItem - str r0, [r1] - adds r0, r2, 0 - bl SetUpItemUseCallback - b _080FD11A - .pool -_080FD110: - ldr r0, =gUnknown_0203A0F4 - ldr r1, [r0] - adds r0, r2, 0 - bl _call_via_r1 -_080FD11A: - pop {r0} - bx r0 - .pool - thumb_func_end SetUpItemUseOnFieldCallback - - thumb_func_start MapPostLoadHook_UseItem -@ void MapPostLoadHook_UseItem() -MapPostLoadHook_UseItem: @ 80FD124 - push {lr} - bl pal_fill_black - ldr r0, =Task_CallItemUseOnFieldCallback - movs r1, 0x8 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end MapPostLoadHook_UseItem - - thumb_func_start Task_CallItemUseOnFieldCallback -@ void Task_CallItemUseOnFieldCallback(u8 taskId) -Task_CallItemUseOnFieldCallback: @ 80FD13C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD158 - ldr r0, =gUnknown_0203A0F4 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 -_080FD158: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end Task_CallItemUseOnFieldCallback - - thumb_func_start DisplayCannotUseItemMessage -@ void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField, u8 *str) -DisplayCannotUseItemMessage: @ 80FD164 - push {r4-r6,lr} - adds r4, r1, 0 - adds r1, r2, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gStringVar4 - adds r0, r6, 0 - bl StringExpandPlaceholders - cmp r4, 0 - bne _080FD1B4 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FD1A0 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl DisplayItemMessage - b _080FD1BE - .pool -_080FD1A0: - ldr r1, =gText_DadsAdvice - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid - b _080FD1BE - .pool -_080FD1B4: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r6, 0 - bl DisplayItemMessageOnField -_080FD1BE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DisplayCannotUseItemMessage - - thumb_func_start DisplayDadsAdviceCannotUseItemMessage -@ void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) -DisplayDadsAdviceCannotUseItemMessage: @ 80FD1C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gText_DadsAdvice - bl DisplayCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end DisplayDadsAdviceCannotUseItemMessage - - thumb_func_start DisplayCannotDismountBikeMessage -@ void DisplayCannotDismountBikeMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) -DisplayCannotDismountBikeMessage: @ 80FD1E0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gText_CantDismountBike - bl DisplayCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end DisplayCannotDismountBikeMessage - - thumb_func_start CleanUpAfterFailingToUseRegisteredKeyItemOnField -@ void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId) -CleanUpAfterFailingToUseRegisteredKeyItemOnField: @ 80FD1F8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - adds r0, r4, 0 - bl DestroyTask - bl sub_80984F4 - bl ScriptContext2_Disable - pop {r4} - pop {r0} - bx r0 - thumb_func_end CleanUpAfterFailingToUseRegisteredKeyItemOnField - - thumb_func_start CheckIfItemIsTMHMOrEvolutionStone -@ u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId) -CheckIfItemIsTMHMOrEvolutionStone: @ 80FD21C - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl ItemId_GetFieldFunc - ldr r1, =ItemUseOutOfBattle_TMHM - cmp r0, r1 - bne _080FD238 - movs r0, 0x1 - b _080FD24E - .pool -_080FD238: - adds r0, r4, 0 - bl ItemId_GetFieldFunc - ldr r1, =ItemUseOutOfBattle_EvolutionStone - cmp r0, r1 - beq _080FD24C - movs r0, 0 - b _080FD24E - .pool -_080FD24C: - movs r0, 0x2 -_080FD24E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end CheckIfItemIsTMHMOrEvolutionStone - - thumb_func_start sub_80FD254 -sub_80FD254: @ 80FD254 - push {lr} - sub sp, 0x24 - mov r1, sp - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - strh r0, [r1, 0x20] - ldr r1, =bag_menu_mail_related - mov r0, sp - movs r2, 0 - bl ReadMail - add sp, 0x24 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FD254 - - thumb_func_start ItemUseOutOfBattle_Mail -@ void ItemUseOutOfBattle_Mail(int taskId) -ItemUseOutOfBattle_Mail: @ 80FD278 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - ldr r2, [r1] - ldr r1, =sub_80FD254 - str r1, [r2] - bl unknown_ItemMenu_Confirm - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Mail - - thumb_func_start ItemUseOutOfBattle_Bike -@ void ItemUseOutOfBattle_Bike(int taskId) -ItemUseOutOfBattle_Bike: @ 80FD298 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =0x0000088b - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsVerticalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsHorizontalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsIsolatedVerticalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsIsolatedHorizontalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD320 -_080FD30E: - ldrb r1, [r6, 0x6] - adds r0, r5, 0 - bl DisplayCannotDismountBikeMessage - b _080FD350 - .pool -_080FD320: - bl sav1_map_is_biking_allowed - cmp r0, 0x1 - bne _080FD348 - bl IsBikingDisallowedByPlayer - lsls r0, 24 - cmp r0, 0 - bne _080FD348 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Bike - str r0, [r1] - adds r0, r5, 0 - bl SetUpItemUseOnFieldCallback - b _080FD350 - .pool -_080FD348: - ldrb r1, [r6, 0x6] - adds r0, r5, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FD350: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end ItemUseOutOfBattle_Bike - - thumb_func_start ItemUseOnFieldCB_Bike -ItemUseOnFieldCB_Bike: @ 80FD358 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetSecondaryId - lsls r0, 24 - cmp r0, 0 - bne _080FD378 - movs r0, 0x2 - bl GetOnOffBike - b _080FD37E - .pool -_080FD378: - movs r0, 0x4 - bl GetOnOffBike -_080FD37E: - bl sub_80984F4 - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end ItemUseOnFieldCB_Bike - - thumb_func_start CanFish -@ bool8 CanFish() -CanFish: @ 80FD394 - push {r4-r6,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 16 - lsrs r6, r0, 16 - lsls r0, r6, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl MetatileBehavior_IsWaterfall - lsls r0, 24 - cmp r0, 0 - bne _080FD41C - movs r0, 0x10 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _080FD41C - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _080FD3EC - bl IsPlayerFacingSurfableFishableWater - lsls r0, 24 - cmp r0, 0 - beq _080FD41C -_080FD3E8: - movs r0, 0x1 - b _080FD41E -_080FD3EC: - adds r0, r5, 0 - bl MetatileBehavior_IsSurfableWaterOrUnderwater - lsls r0, 24 - cmp r0, 0 - beq _080FD40C - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridIsImpassableAt - lsls r0, 24 - cmp r0, 0 - beq _080FD3E8 -_080FD40C: - lsls r0, r6, 24 - lsrs r0, 24 - bl MetatileBehavior_8089510 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD3E8 -_080FD41C: - movs r0, 0 -_080FD41E: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end CanFish - - thumb_func_start ItemUseOutOfBattle_Rod -ItemUseOutOfBattle_Rod: @ 80FD428 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl CanFish - cmp r0, 0x1 - bne _080FD44C - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Rod - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FD45E - .pool -_080FD44C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FD45E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Rod - - thumb_func_start ItemUseOnFieldCB_Rod -ItemUseOnFieldCB_Rod: @ 80FD468 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetSecondaryId - lsls r0, 24 - lsrs r0, 24 - bl StartFishing - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOnFieldCB_Rod - - thumb_func_start ItemUseOutOfBattle_Itemfinder -ItemUseOutOfBattle_Itemfinder: @ 80FD490 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x27 - bl IncrementGameStat - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Itemfinder - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Itemfinder - - thumb_func_start ItemUseOnFieldCB_Itemfinder -ItemUseOnFieldCB_Itemfinder: @ 80FD4B8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMapHeader - ldr r0, [r0, 0x4] - adds r1, r4, 0 - bl ItemfinderCheckForHiddenItems - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD4EC - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FD504 - str r0, [r1] - b _080FD4F6 - .pool -_080FD4EC: - ldr r1, =gText_ItemFinderNothing - ldr r2, =sub_80FD5CC - adds r0, r4, 0 - bl DisplayItemMessageOnField -_080FD4F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOnFieldCB_Itemfinder - - thumb_func_start sub_80FD504 -sub_80FD504: @ 80FD504 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r6, r5, 2 - adds r0, r6, r5 - lsls r7, r0, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r4, r7, r0 - movs r1, 0x6 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FD5B8 - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x4 - bne _080FD5AC - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - bl sub_80FD9B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080FD564 - ldr r1, =gUnknown_085920E4 - subs r0, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl sub_80FDA24 - mov r0, r8 - subs r0, 0x8 - adds r0, r7, r0 - ldr r1, =sub_80FDA94 - str r1, [r0] - b _080FD5C2 - .pool -_080FD564: - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - adds r3, r6, 0 - ldr r7, =gUnknown_085920E4 - movs r6, 0x3 -_080FD574: - adds r0, r1, r7 - adds r1, 0x1 - ldrb r0, [r0] - cmp r2, r0 - bne _080FD584 - adds r0, r1, 0 - ands r0, r6 - strh r0, [r4, 0xA] -_080FD584: - lsls r0, r1, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _080FD574 - ldr r1, =gTasks - adds r0, r3, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80FDADC - str r1, [r0] - movs r0, 0 - strh r0, [r4, 0x6] - strh r0, [r4, 0x4] - b _080FD5C2 - .pool -_080FD5AC: - movs r0, 0x48 - bl PlaySE - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080FD5B8: - ldrh r0, [r4, 0x6] - adds r0, 0x1 - movs r1, 0x1F - ands r0, r1 - strh r0, [r4, 0x6] -_080FD5C2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80FD504 - - thumb_func_start sub_80FD5CC -sub_80FD5CC: @ 80FD5CC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - bl sub_80984F4 - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FD5CC - - thumb_func_start ItemfinderCheckForHiddenItems -@ bool8 ItemfinderCheckForHiddenItems(struct map_events *events, u8 taskId) -ItemfinderCheckForHiddenItems: @ 80FD5F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r5, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - movs r3, 0 - mov r9, r4 - ldrb r0, [r5, 0x3] - cmp r3, r0 - bge _080FD6A4 - subs r1, 0x5 - mov r8, r1 -_080FD628: - lsls r3, 16 - asrs r1, r3, 16 - ldr r2, [r5, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r4, r0, 2 - adds r1, r4, r2 - ldrb r0, [r1, 0x5] - adds r7, r3, 0 - cmp r0, 0x7 - bne _080FD694 - movs r2, 0xFA - lsls r2, 1 - adds r0, r2, 0 - ldrh r1, [r1, 0xA] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080FD694 - ldr r1, [r5, 0x10] - adds r1, r4, r1 - ldrh r2, [r1] - adds r2, 0x7 - mov r0, sp - ldrh r0, [r0] - subs r2, r0 - ldrh r0, [r1, 0x2] - adds r0, 0x7 - mov r3, r9 - ldrh r1, [r3] - subs r0, r1 - lsls r0, 16 - lsrs r0, 16 - lsls r2, 16 - asrs r1, r2, 16 - movs r3, 0xE0 - lsls r3, 11 - adds r2, r3 - lsrs r2, 16 - cmp r2, 0xE - bhi _080FD694 - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, r8 - blt _080FD694 - cmp r2, 0x5 - bgt _080FD694 - adds r0, r6, 0 - bl sub_80FD8E0 -_080FD694: - movs r1, 0x80 - lsls r1, 9 - adds r0, r7, r1 - lsrs r3, r0, 16 - asrs r0, 16 - ldrb r2, [r5, 0x3] - cmp r0, r2 - blt _080FD628 -_080FD6A4: - adds r0, r6, 0 - bl sub_80FD7C8 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r3, 0xC - ldrsh r0, [r1, r3] - cmp r0, 0x1 - beq _080FD6C4 - movs r0, 0 - b _080FD6C6 - .pool -_080FD6C4: - movs r0, 0x1 -_080FD6C6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end ItemfinderCheckForHiddenItems - - thumb_func_start sub_80FD6D4 -sub_80FD6D4: @ 80FD6D4 - push {r4-r6,lr} - lsls r1, 16 - lsrs r3, r1, 16 - lsls r2, 16 - lsrs r4, r2, 16 - ldrb r2, [r0, 0x3] - ldr r5, [r0, 0x10] - movs r1, 0 - cmp r1, r2 - bge _080FD728 - lsls r0, r3, 16 - asrs r6, r0, 16 - lsls r0, r4, 16 - asrs r4, r0, 16 - adds r3, r5, 0 -_080FD6F2: - ldrb r0, [r3, 0x5] - cmp r0, 0x7 - bne _080FD720 - ldrh r0, [r3] - cmp r6, r0 - bne _080FD720 - ldrh r0, [r3, 0x2] - cmp r4, r0 - bne _080FD720 - movs r1, 0xFA - lsls r1, 1 - adds r0, r1, 0 - ldrh r3, [r3, 0xA] - adds r0, r3 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080FD728 - movs r0, 0x1 - b _080FD72A -_080FD720: - adds r3, 0xC - adds r1, 0x1 - cmp r1, r2 - blt _080FD6F2 -_080FD728: - movs r0, 0 -_080FD72A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80FD6D4 - - thumb_func_start sub_80FD730 -sub_80FD730: @ 80FD730 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - bl mapconnection_get_mapheader - adds r3, r0, 0 - ldrb r0, [r4] - cmp r0, 0x2 - beq _080FD758 - cmp r0, 0x2 - bgt _080FD74E - cmp r0, 0x1 - beq _080FD76C - b _080FD7AC -_080FD74E: - cmp r0, 0x3 - beq _080FD784 - cmp r0, 0x4 - beq _080FD78E - b _080FD7AC -_080FD758: - ldr r0, [r4, 0x4] - adds r0, 0x7 - subs r0, r5, r0 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, [r3] - ldr r0, [r0, 0x4] - subs r0, 0x7 - adds r0, r6 - b _080FD7A2 -_080FD76C: - ldr r0, [r4, 0x4] - adds r0, 0x7 - subs r0, r5, r0 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x4] - b _080FD79E - .pool -_080FD784: - ldr r0, [r3] - ldr r0, [r0] - subs r0, 0x7 - adds r0, r5 - b _080FD798 -_080FD78E: - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x7 - subs r0, r5, r0 -_080FD798: - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, [r4, 0x4] -_080FD79E: - adds r0, 0x7 - subs r0, r6, r0 -_080FD7A2: - lsls r0, 16 - lsrs r2, r0, 16 - b _080FD7B0 - .pool -_080FD7AC: - movs r0, 0 - b _080FD7C2 -_080FD7B0: - ldr r0, [r3, 0x4] - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - bl sub_80FD6D4 - lsls r0, 24 - lsrs r0, 24 -_080FD7C2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80FD730 - - thumb_func_start sub_80FD7C8 -sub_80FD7C8: @ 80FD7C8 - 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 - str r0, [sp, 0x4] - ldr r0, =gMapHeader - ldr r1, [r0] - ldr r0, [r1] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - ldr r0, [r1, 0x4] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - ldrh r0, [r0] - subs r0, 0x7 - lsls r0, 16 - lsrs r3, r0, 16 - asrs r0, 16 - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - adds r1, 0x7 - cmp r0, r1 - bgt _080FD8CC -_080FD816: - mov r5, sp - ldrh r0, [r5, 0x2] - subs r0, 0x5 - lsls r0, 16 - lsrs r4, r0, 16 - lsls r2, r4, 16 - asrs r1, r2, 16 - movs r6, 0x2 - ldrsh r0, [r5, r6] - adds r0, 0x5 - lsls r3, 16 - mov r8, r3 - cmp r1, r0 - bgt _080FD8B6 - movs r0, 0x7 - str r0, [sp, 0x10] - mov r1, r8 - asrs r1, 16 - mov r9, r1 - mov r10, r0 -_080FD83E: - ldr r3, [sp, 0x10] - cmp r3, r9 - bgt _080FD860 - ldr r5, [sp, 0x8] - lsls r0, r5, 16 - asrs r0, 16 - cmp r9, r0 - bge _080FD860 - asrs r1, r2, 16 - cmp r10, r1 - bgt _080FD860 - ldr r6, [sp, 0xC] - lsls r0, r6, 16 - asrs r0, 16 - lsls r7, r4, 16 - cmp r1, r0 - blt _080FD89E -_080FD860: - mov r0, r8 - asrs r5, r0, 16 - lsls r4, 16 - asrs r6, r4, 16 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8088A8C - adds r7, r4, 0 - cmp r0, 0 - beq _080FD89E - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_80FD730 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD89E - mov r0, sp - ldrh r1, [r0] - subs r1, r5, r1 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r0, 0x2] - subs r2, r6, r2 - lsls r2, 16 - asrs r2, 16 - ldr r0, [sp, 0x4] - bl sub_80FD8E0 -_080FD89E: - movs r1, 0x80 - lsls r1, 9 - adds r0, r7, r1 - lsrs r4, r0, 16 - lsls r2, r4, 16 - asrs r1, r2, 16 - mov r3, sp - movs r5, 0x2 - ldrsh r0, [r3, r5] - adds r0, 0x5 - cmp r1, r0 - ble _080FD83E -_080FD8B6: - movs r1, 0x80 - lsls r1, 9 - add r1, r8 - lsrs r3, r1, 16 - asrs r1, 16 - mov r0, sp - movs r6, 0 - ldrsh r0, [r0, r6] - adds r0, 0x7 - cmp r1, r0 - ble _080FD816 -_080FD8CC: - 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_80FD7C8 - - thumb_func_start sub_80FD8E0 -sub_80FD8E0: @ 80FD8E0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r12, r2 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r3, r1, r0 - movs r1, 0x4 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080FD918 - strh r7, [r3] - mov r0, r12 - strh r0, [r3, 0x2] - movs r0, 0x1 - strh r0, [r3, 0x4] - b _080FD9A2 - .pool -_080FD918: - movs r1, 0 - ldrsh r0, [r3, r1] - cmp r0, 0 - bge _080FD928 - negs r0, r0 - lsls r0, 16 - lsrs r4, r0, 16 - b _080FD92A -_080FD928: - ldrh r4, [r3] -_080FD92A: - movs r1, 0x2 - ldrsh r0, [r3, r1] - ldrh r1, [r3, 0x2] - mov r9, r1 - cmp r0, 0 - bge _080FD93E - negs r0, r0 - lsls r0, 16 - lsrs r2, r0, 16 - b _080FD940 -_080FD93E: - ldrh r2, [r3, 0x2] -_080FD940: - lsls r1, r7, 16 - asrs r0, r1, 16 - cmp r0, 0 - bge _080FD950 - negs r0, r0 - lsls r0, 16 - lsrs r6, r0, 16 - b _080FD952 -_080FD950: - lsrs r6, r1, 16 -_080FD952: - mov r1, r12 - lsls r0, r1, 16 - asrs r1, r0, 16 - mov r8, r0 - cmp r1, 0 - bge _080FD964 - negs r0, r1 - lsls r0, 16 - b _080FD966 -_080FD964: - mov r0, r8 -_080FD966: - lsrs r5, r0, 16 - lsls r0, r4, 16 - asrs r0, 16 - lsls r1, r2, 16 - asrs r2, r1, 16 - adds r4, r0, r2 - lsls r0, r6, 16 - asrs r0, 16 - lsls r1, r5, 16 - asrs r1, 16 - adds r0, r1 - cmp r4, r0 - ble _080FD988 - strh r7, [r3] - mov r1, r12 - strh r1, [r3, 0x2] - b _080FD9A2 -_080FD988: - cmp r4, r0 - bne _080FD9A2 - cmp r2, r1 - bgt _080FD99C - cmp r2, r1 - bne _080FD9A2 - mov r1, r9 - lsls r0, r1, 16 - cmp r0, r8 - bge _080FD9A2 -_080FD99C: - strh r7, [r3] - mov r0, r12 - strh r0, [r3, 0x2] -_080FD9A2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80FD8E0 - - thumb_func_start sub_80FD9B0 -sub_80FD9B0: @ 80FD9B0 - push {r4,r5,lr} - lsls r0, 16 - lsls r1, 16 - lsrs r1, 16 - lsrs r2, r0, 16 - cmp r0, 0 - bne _080FD9C2 - cmp r1, 0 - beq _080FDA1C -_080FD9C2: - lsls r0, r2, 16 - asrs r2, r0, 16 - adds r5, r0, 0 - cmp r2, 0 - bge _080FD9D4 - negs r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 - b _080FD9D6 -_080FD9D4: - lsrs r4, r5, 16 -_080FD9D6: - lsls r0, r1, 16 - asrs r2, r0, 16 - adds r1, r0, 0 - cmp r2, 0 - bge _080FD9E8 - negs r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - b _080FD9EA -_080FD9E8: - lsrs r3, r1, 16 -_080FD9EA: - lsls r0, r4, 16 - asrs r2, r0, 16 - lsls r0, r3, 16 - asrs r0, 16 - cmp r2, r0 - ble _080FDA02 - cmp r5, 0 - bge _080FD9FE - movs r0, 0x4 - b _080FDA1E -_080FD9FE: - movs r0, 0x2 - b _080FDA1E -_080FDA02: - cmp r2, r0 - bge _080FDA0C - cmp r1, 0 - blt _080FDA14 - b _080FDA18 -_080FDA0C: - cmp r2, r0 - bne _080FDA1C - cmp r1, 0 - bge _080FDA18 -_080FDA14: - movs r0, 0x1 - b _080FDA1E -_080FDA18: - movs r0, 0x3 - b _080FDA1E -_080FDA1C: - movs r0, 0 -_080FDA1E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80FD9B0 - - thumb_func_start sub_80FDA24 -sub_80FDA24: @ 80FDA24 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r4, =gMapObjects - adds r0, r4 - bl FieldObjectClearAnimIfSpecialAnimFinished - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FieldObjectClearAnim - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl npc_sync_anim_pause_bits - adds r0, r5, 0 - bl PlayerTurnInPlace - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDA24 - - thumb_func_start sub_80FDA94 -sub_80FDA94: @ 80FDA94 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r0, r1 - bl FieldObjectCheckIfSpecialAnimFinishedOrInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDACA - ldr r1, =gText_ItemFinderNearby - ldr r2, =sub_80FD5CC - adds r0, r4, 0 - bl DisplayItemMessageOnField -_080FDACA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDA94 - - thumb_func_start sub_80FDADC -sub_80FDADC: @ 80FDADC - 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 + 0x8 - adds r4, r0, r1 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r0, r1 - bl FieldObjectCheckIfSpecialAnimFinishedOrInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FDB1C - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FDB50 -_080FDB1C: - ldr r1, =gUnknown_085920E4 - movs r2, 0xA - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r0, [r0] - bl sub_80FDA24 - movs r0, 0x1 - strh r0, [r4, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bne _080FDB50 - ldr r1, =gText_ItemFinderOnTop - ldr r2, =sub_80FD5CC - adds r0, r5, 0 - bl DisplayItemMessageOnField -_080FDB50: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDADC - - thumb_func_start ItemUseOutOfBattle_PokeblockCase -ItemUseOutOfBattle_PokeblockCase: @ 80FDB6C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDB98 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage - b _080FDBDA - .pool -_080FDB98: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r5, r1, r0 - movs r1, 0xE - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _080FDBC8 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =sub_80FDBEC - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FDBDA - .pool -_080FDBC8: - ldr r0, =gFieldCallback - ldr r1, =sub_80AF6D4 - str r1, [r0] - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r0, =sub_80FDC00 - str r0, [r5] -_080FDBDA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PokeblockCase - - thumb_func_start sub_80FDBEC -sub_80FDBEC: @ 80FDBEC - push {lr} - ldr r1, =bag_menu_mail_related - movs r0, 0 - bl OpenPokeblockCase - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDBEC - - thumb_func_start sub_80FDC00 -sub_80FDC00: @ 80FDC00 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080FDC24 - bl overworld_free_bg_tilemaps - ldr r1, =c2_exit_to_overworld_2_switch - movs r0, 0 - bl OpenPokeblockCase - adds r0, r4, 0 - bl DestroyTask -_080FDC24: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDC00 - - thumb_func_start ItemUseOutOfBattle_CoinCase -ItemUseOutOfBattle_CoinCase: @ 80FDC34 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gStringVar1 - bl GetCoins - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_CoinCase - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080FDC90 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _080FDC9A - .pool -_080FDC90: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_080FDC9A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_CoinCase - - thumb_func_start ItemUseOutOfBattle_PowderJar -ItemUseOutOfBattle_PowderJar: @ 80FDCA4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gStringVar1 - bl sub_80247BC - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_PowderQty - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080FDCFC - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _080FDD06 - .pool -_080FDCFC: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_080FDD06: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PowderJar - - thumb_func_start sub_80FDD10 -sub_80FDD10: @ 80FDD10 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsPlayerFacingPlantedBerryTree - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDD58 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDD74 - str r0, [r1] - ldr r1, =gFieldCallback - ldr r0, =MapPostLoadHook_UseItem - str r0, [r1] - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =c2_exit_to_overworld_2_switch - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FDD68 - .pool -_080FDD58: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetFieldFunc - adds r1, r0, 0 - adds r0, r4, 0 - bl _call_via_r1 -_080FDD68: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDD10 - - thumb_func_start sub_80FDD74 -sub_80FDD74: @ 80FDD74 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - bl ScriptContext2_Enable - ldr r0, =Route102_EventScript_274482 - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDD74 - - thumb_func_start ItemUseOutOfBattle_WailmerPail -ItemUseOutOfBattle_WailmerPail: @ 80FDDA4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_80FDE2C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDDC8 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDE7C - b _080FDDD8 - .pool -_080FDDC8: - bl TryToWaterBerryTree - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDDEC - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDE08 -_080FDDD8: - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FDDFE - .pool -_080FDDEC: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r5, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FDDFE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_WailmerPail - - thumb_func_start sub_80FDE08 -sub_80FDE08: @ 80FDE08 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - ldr r0, =Route102_EventScript_2744C0 - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDE08 - - thumb_func_start sub_80FDE2C -sub_80FDE2C: @ 80FDE2C - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - bl PlayerGetZCoord - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - mov r0, sp - ldrh r0, [r0] - ldrh r1, [r4] - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x10 - beq _080FDE68 - ldr r0, =gMapObjects - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x5] - cmp r0, 0xE4 - beq _080FDE70 -_080FDE68: - movs r0, 0 - b _080FDE72 - .pool -_080FDE70: - movs r0, 0x1 -_080FDE72: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80FDE2C - - thumb_func_start sub_80FDE7C -sub_80FDE7C: @ 80FDE7C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - ldr r0, =BattleFrontier_OutsideEast_EventScript_242CFC - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDE7C - - thumb_func_start ItemUseOutOfBattle_Medicine -ItemUseOutOfBattle_Medicine: @ 80FDEA0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =ItemUseCB_Medicine - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Medicine - - thumb_func_start ItemUseOutOfBattle_ReduceEV -ItemUseOutOfBattle_ReduceEV: @ 80FDEBC - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B67C8 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_ReduceEV - - thumb_func_start ItemUseOutOfBattle_SacredAsh -ItemUseOutOfBattle_SacredAsh: @ 80FDED8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B79E8 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_SacredAsh - - thumb_func_start ItemUseOutOfBattle_PPRecovery -ItemUseOutOfBattle_PPRecovery: @ 80FDEF4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_ether - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PPRecovery - - thumb_func_start ItemUseOutOfBattle_PPUp -ItemUseOutOfBattle_PPUp: @ 80FDF10 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_pp_up - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PPUp - - thumb_func_start ItemUseOutOfBattle_RareCandy -ItemUseOutOfBattle_RareCandy: @ 80FDF2C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_rare_candy - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_RareCandy - - thumb_func_start ItemUseOutOfBattle_TMHM -ItemUseOutOfBattle_TMHM: @ 80FDF48 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r1, [r0] - movs r0, 0xA9 - lsls r0, 1 - cmp r1, r0 - bls _080FDF74 - ldr r2, =gText_BootedUpHM - ldr r3, =sub_80FDF90 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FDF80 - .pool -_080FDF74: - ldr r2, =gText_BootedUpTM - ldr r3, =sub_80FDF90 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage -_080FDF80: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_TMHM - - thumb_func_start sub_80FDF90 -sub_80FDF90: @ 80FDF90 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - bl PlaySE - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task08_0809AD8C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDF90 - - thumb_func_start task08_0809AD8C -task08_0809AD8C: @ 80FDFBC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080FE000 - ldr r4, =gStringVar1 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemIdToBattleMoveId - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_TMHMContainedVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_80FE024 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage -_080FE000: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task08_0809AD8C - - thumb_func_start sub_80FE024 -sub_80FE024: @ 80FE024 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_085920E8 - movs r1, 0x6 - bl bag_menu_yes_no - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE024 - - thumb_func_start sub_80FE03C -sub_80FE03C: @ 80FE03C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B6DC4 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE03C - - thumb_func_start sub_80FE058 -sub_80FE058: @ 80FE058 - push {r4,lr} - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - ldrh r0, [r4] - ldr r1, =gStringVar2 - bl CopyItemName - ldr r0, =gStringVar4 - ldr r1, =gText_PlayerUsedVar2 - bl StringExpandPlaceholders - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE0AC - ldrh r0, [r4] - bl ItemId_GetPocket - lsls r0, 24 - lsrs r0, 24 - bl sub_81AB9A8 - ldrh r0, [r4] - bl ItemId_GetPocket - lsls r0, 24 - lsrs r0, 24 - bl sub_81ABA88 - b _080FE0B4 - .pool -_080FE0AC: - bl sub_81C5924 - bl sub_81C59BC -_080FE0B4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FE058 - - thumb_func_start ItemUseOutOfBattle_Repel -ItemUseOutOfBattle_Repel: @ 80FE0BC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =0x00004021 - bl VarGet - lsls r0, 16 - cmp r0, 0 - bne _080FE0EC - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FE124 - str r0, [r1] - b _080FE116 - .pool -_080FE0EC: - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE10C - ldr r2, =gText_RepelEffectsLingered - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE116 - .pool -_080FE10C: - ldr r1, =gText_RepelEffectsLingered - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE116: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Repel - - thumb_func_start sub_80FE124 -sub_80FE124: @ 80FE124 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r5, =gTasks + 0x8 - adds r1, r4, r5 - ldrh r0, [r1, 0x10] - adds r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE156 - movs r0, 0 - strh r0, [r1, 0x10] - movs r0, 0x2F - bl PlaySE - adds r0, r5, 0 - subs r0, 0x8 - adds r0, r4, r0 - ldr r1, =sub_80FE164 - str r1, [r0] -_080FE156: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE124 - - thumb_func_start sub_80FE164 -sub_80FE164: @ 80FE164 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _080FE1C2 - ldr r4, =0x00004021 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetHoldEffectParam - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl VarSet - bl sub_80FE058 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE1B8 - ldr r2, =gStringVar4 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE1C2 - .pool -_080FE1B8: - ldr r1, =gStringVar4 - ldr r2, =sub_81C6714 - adds r0, r6, 0 - bl DisplayItemMessageInBattlePyramid -_080FE1C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE164 - - thumb_func_start sub_80FE1D0 -sub_80FE1D0: @ 80FE1D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE226 - movs r0, 0x75 - bl PlaySE - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE21C - ldr r2, =gStringVar4 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE226 - .pool -_080FE21C: - ldr r1, =gStringVar4 - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE226: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE1D0 - - thumb_func_start ItemUseOutOfBattle_BlackWhiteFlute -ItemUseOutOfBattle_BlackWhiteFlute: @ 80FE234 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - ldr r1, =gStringVar2 - bl CopyItemName - ldrh r0, [r4] - cmp r0, 0x2B - bne _080FE278 - ldr r0, =0x000008ad - bl FlagSet - ldr r0, =0x000008ae - bl FlagClear - ldr r0, =gStringVar4 - ldr r1, =gText_UsedVar2WildLured - bl StringExpandPlaceholders - b _080FE28C - .pool -_080FE278: - ldr r0, =0x000008ae - bl FlagSet - ldr r0, =0x000008ad - bl FlagClear - ldr r0, =gStringVar4 - ldr r1, =gText_UsedVar2WildRepelled - bl StringExpandPlaceholders -_080FE28C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x18] - ldr r1, =sub_80FE1D0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_BlackWhiteFlute - - thumb_func_start task08_080A1C44 -task08_080A1C44: @ 80FE2BC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl player_avatar_init_params_reset - bl sub_80B7CC8 - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end task08_080A1C44 - - thumb_func_start re_escape_rope -re_escape_rope: @ 80FE2D8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl flagmods_08054D70 - bl sub_80FE058 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x8] - ldr r1, =gStringVar4 - ldr r2, =task08_080A1C44 - adds r0, r4, 0 - bl DisplayItemMessageOnField - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end re_escape_rope - - thumb_func_start sub_80FE314 -sub_80FE314: @ 80FE314 - push {lr} - ldr r0, =gMapHeader - ldrb r1, [r0, 0x1A] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080FE32C - movs r0, 0 - b _080FE32E - .pool -_080FE32C: - movs r0, 0x1 -_080FE32E: - pop {r1} - bx r1 - thumb_func_end sub_80FE314 - - thumb_func_start ItemUseOutOfBattle_EscapeRope -ItemUseOutOfBattle_EscapeRope: @ 80FE334 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80FE314 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FE35C - ldr r1, =gUnknown_0203A0F4 - ldr r0, =re_escape_rope - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FE36E - .pool -_080FE35C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FE36E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EscapeRope - - thumb_func_start ItemUseOutOfBattle_EvolutionStone -ItemUseOutOfBattle_EvolutionStone: @ 80FE378 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B7C74 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EvolutionStone - - thumb_func_start ItemUseInBattle_PokeBall -ItemUseInBattle_PokeBall: @ 80FE394 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl IsPlayerPartyAndPokemonStorageFull - lsls r0, 24 - cmp r0, 0 - bne _080FE3D0 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE3C8 - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE3FA - .pool -_080FE3C8: - adds r0, r4, 0 - bl sub_81C5B14 - b _080FE3FA -_080FE3D0: - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE3F0 - ldr r2, =gText_BoxFull - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE3FA - .pool -_080FE3F0: - ldr r1, =gText_BoxFull - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE3FA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_PokeBall - - thumb_func_start sub_80FE408 -sub_80FE408: @ 80FE408 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080FE43A - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE434 - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE43A - .pool -_080FE434: - adds r0, r5, 0 - bl sub_81C5B14 -_080FE43A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FE408 - - thumb_func_start sub_80FE440 -sub_80FE440: @ 80FE440 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE4AC - movs r0, 0x1 - bl PlaySE - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE49C - ldrh r0, [r4] - bl sub_806CF78 - adds r2, r0, 0 - ldr r3, =sub_80FE408 - adds r0, r5, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE4AC - .pool -_080FE49C: - ldrh r0, [r4] - bl sub_806CF78 - adds r1, r0, 0 - ldr r2, =sub_80FE408 - adds r0, r6, 0 - bl DisplayItemMessageInBattlePyramid -_080FE4AC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE440 - - thumb_func_start ItemUseInBattle_StatIncrease -ItemUseInBattle_StatIncrease: @ 80FE4B8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gBattlePartyID - ldr r0, =gBankInMenu - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - lsls r2, 24 - lsrs r2, 24 - movs r3, 0 - bl ExecuteTableBasedItemEffect_ - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080FE52C - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE518 - ldr r2, =gText_WontHaveEffect - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE53C - .pool -_080FE518: - ldr r1, =gText_WontHaveEffect - ldr r2, =sub_81C6714 - adds r0, r4, 0 - bl DisplayItemMessageInBattlePyramid - b _080FE53C - .pool -_080FE52C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FE440 - str r0, [r1] - strh r2, [r1, 0x18] -_080FE53C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_StatIncrease - - thumb_func_start sub_80FE54C -sub_80FE54C: @ 80FE54C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE574 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =sub_81B89F0 - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE582 - .pool -_080FE574: - ldr r0, =gUnknown_0203CF2C - ldr r1, [r0] - ldr r0, =sub_81B89F0 - str r0, [r1] - adds r0, r4, 0 - bl sub_81C5B14 -_080FE582: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE54C - - thumb_func_start ItemUseInBattle_Medicine -ItemUseInBattle_Medicine: @ 80FE590 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =ItemUseCB_Medicine - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_Medicine - - thumb_func_start sub_80FE5AC -sub_80FE5AC: @ 80FE5AC - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B79E8 - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE5AC - - thumb_func_start ItemUseInBattle_PPRecovery -ItemUseInBattle_PPRecovery: @ 80FE5C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_ether - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_PPRecovery - - thumb_func_start ItemUseInBattle_Escape -ItemUseInBattle_Escape: @ 80FE5E4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - bne _080FE634 - bl sub_80FE058 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE620 - ldr r2, =gStringVar4 - ldr r3, =unknown_ItemMenu_Confirm - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE646 - .pool -_080FE620: - ldr r1, =gStringVar4 - ldr r2, =sub_81C5B14 - adds r0, r4, 0 - bl DisplayItemMessageInBattlePyramid - b _080FE646 - .pool -_080FE634: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FE646: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_Escape - - thumb_func_start ItemUseOutOfBattle_EnigmaBerry -ItemUseOutOfBattle_EnigmaBerry: @ 80FE650 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x14 - bls _080FE66A - b _080FE75C -_080FE66A: - lsls r0, 2 - ldr r1, =_080FE67C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FE67C: - .4byte _080FE708 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE75C - .4byte _080FE75C - .4byte _080FE6EC - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE75C - .4byte _080FE724 - .4byte _080FE724 - .4byte _080FE740 -_080FE6D0: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_Medicine - b _080FE770 - .pool -_080FE6EC: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_SacredAsh - b _080FE770 - .pool -_080FE708: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_RareCandy - b _080FE770 - .pool -_080FE724: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_PPUp - b _080FE770 - .pool -_080FE740: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_PPRecovery - b _080FE770 - .pool -_080FE75C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x4 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_CannotUse -_080FE770: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EnigmaBerry - - thumb_func_start ItemUseInBattle_EnigmaBerry -ItemUseInBattle_EnigmaBerry: @ 80FE77C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x15 - bhi _080FE814 - lsls r0, 2 - ldr r1, =_080FE7A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FE7A4: - .4byte _080FE7FC - .4byte _080FE814 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE814 - .4byte _080FE804 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE80C -_080FE7FC: - adds r0, r4, 0 - bl ItemUseInBattle_StatIncrease - b _080FE81A -_080FE804: - adds r0, r4, 0 - bl ItemUseInBattle_Medicine - b _080FE81A -_080FE80C: - adds r0, r4, 0 - bl ItemUseInBattle_PPRecovery - b _080FE81A -_080FE814: - adds r0, r4, 0 - bl ItemUseOutOfBattle_CannotUse -_080FE81A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end ItemUseInBattle_EnigmaBerry - - thumb_func_start ItemUseOutOfBattle_CannotUse -ItemUseOutOfBattle_CannotUse: @ 80FE820 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r1, [r1, 0xE] - bl DisplayDadsAdviceCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_CannotUse - - .align 2, 0 @ Don't pad with nop. diff --git a/ld_script.txt b/ld_script.txt index f2a9d8196..efeb8f322 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -162,7 +162,7 @@ SECTIONS { asm/rotating_gate.o(.text); src/safari_zone.o(.text); asm/contest_link_80FC4F4.o(.text); - asm/item_use.o(.text); + src/item_use.o(.text); asm/battle_anim_80FE840.o(.text); src/bike.o(.text); asm/easy_chat.o(.text); diff --git a/src/item_use.c b/src/item_use.c new file mode 100755 index 000000000..8c24e4a71 --- /dev/null +++ b/src/item_use.c @@ -0,0 +1,1271 @@ +#include "global.h" +#include "battle.h" +#include "berry.h" +#include "bike.h" +#include "coins.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "constants/vars.h" +#include "data2.h" +#include "event_data.h" +#include "fieldmap.h" +#include "field_map_obj.h" +#include "field_player_avatar.h" +#include "field_screen.h" +#include "field_weather.h" +#include "item.h" +#include "map_obj_8097404.h" +#include "mail.h" +#include "metatile_behavior.h" +#include "overworld.h" +#include "palette.h" +#include "pokemon.h" +#include "rom_818CFC8.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "task.h" +#include "text.h" + +extern u16 gSpecialVar_ItemId; +extern void(**gUnknown_0203CE54)(void); +extern void(**gUnknown_0203CF2C)(void); +extern void(*gUnknown_0203A0F4)(u8 taskId); +extern void(*gUnknown_085920D8[])(void); +extern void (*gUnknown_03006328)(u8, u16, TaskFunc); +extern void unknown_ItemMenu_Confirm(u8 taskId); +extern void sub_81C5B14(u8 taskId); +extern u8 gText_DadsAdvice[]; +extern u8 gText_CantDismountBike[]; +extern void sub_8197434(u8 a, u8 b); +extern void sub_80984F4(void); +extern void ItemUseOutOfBattle_TMHM(u8 a); +extern void ItemUseOutOfBattle_EvolutionStone(u8 b); +extern void bag_menu_mail_related(void); +extern void OpenPokeblockCase(u8 a, void(*b)(void)); +extern void overworld_free_bg_tilemaps(void); +extern bool32 sav1_map_is_biking_allowed(void); +extern bool8 IsPlayerFacingSurfableFishableWater(void); +extern bool8 sub_81221AC(void); +extern u8 gText_ItemFinderNothing[]; +extern u8 gText_ItemFinderNearby[]; +extern u8 gText_ItemFinderOnTop[]; +extern u8 gText_CoinCase[]; +extern u8 gText_PowderQty[]; +extern u8 gUnknown_085920E4[]; +extern u8 Route102_EventScript_274482[]; +extern u8 Route102_EventScript_2744C0[]; +extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; +extern u8 gText_BootedUpHM[]; +extern u8 gText_BootedUpTM[]; +extern u8 gText_TMHMContainedVar1[]; +extern u8 gText_PlayerUsedVar2[]; +extern u8 gText_RepelEffectsLingered[]; +extern u8 gText_UsedVar2WildLured[]; +extern u8 gText_UsedVar2WildRepelled[]; +extern u8 gText_BoxFull[]; +extern u8 gText_WontHaveEffect[]; +extern int sub_80247BC(void); +extern struct MapHeader* mapconnection_get_mapheader(struct MapConnection *connection); +extern void SetUpItemUseCallback(u8 taskId); +extern void ItemUseCB_Medicine(u8, u16, TaskFunc); +extern void sub_81B67C8(u8, u16, TaskFunc); +extern void sub_81B79E8(u8, u16, TaskFunc); +extern void dp05_ether(u8, u16, TaskFunc); +extern void dp05_pp_up(u8, u16, TaskFunc); +extern void dp05_rare_candy(u8, u16, TaskFunc); +extern void sub_81B6DC4(u8, u16, TaskFunc); +extern void sub_81B7C74(u8, u16, TaskFunc); +extern u16 ItemIdToBattleMoveId(u16); +extern void bag_menu_yes_no(u8, u8, void(**)(u8 taskId)); +extern void (*gUnknown_085920E8[])(u8 taskId); +extern void sub_81C5924(void); +extern void sub_81C59BC(void); +extern void sub_81AB9A8(u8); +extern void sub_81ABA88(u8); +extern void sub_80B7CC8(void); +extern void flagmods_08054D70(void); +extern u8* sub_806CF78(u16); +extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8); +extern u8 gBankInMenu; +extern u16 gBattlePartyID[]; +extern void sub_81B89F0(void); +extern u8 GetItemEffectType(u16); + +void MapPostLoadHook_UseItem(void); +extern void sub_80AF6D4(void); +void Task_CallItemUseOnFieldCallback(u8 taskId); +void bag_menu_inits_lists_menu(u8 taskId); +void ItemUseOnFieldCB_Bike(u8 taskId); +void ItemUseOnFieldCB_Rod(u8 taskId); +void ItemUseOnFieldCB_Itemfinder(u8 taskId); +void sub_80FD504(u8 taskId); +void sub_80FD5CC(u8 taskId); +void sub_80FDA94(u8 taskId); +void sub_80FDADC(u8 taskId); +void sub_80FD7C8(u8 taskId); +void sub_80FDC00(u8 taskId); +void sub_80FDD74(u8 taskId); +void sub_80FDE08(u8 taskId); +void sub_80FDE7C(u8 taskId); +void sub_80FDF90(u8 taskId); +void task08_0809AD8C(u8 taskId); +void sub_80FE024(u8 taskId); +void sub_80FE124(u8 taskId); +void sub_80FE164(u8 taskId); + +void DisplayItemMessage(u8 taskId, u8 a, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId)); +void sub_81C6714(u8 taskId); +void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId); +void StartFishing(u8 a); +bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8); +u8 sub_80FD9B0(s16 a, s16 b); +void sub_80FDA24(u8 a); +void sub_80FD8E0(u8 taskId, s16 x, s16 y); +void sub_80FDBEC(void); +bool8 sub_80FDE2C(void); +void ItemUseOutOfBattle_CannotUse(u8 taskId); + +void SetUpItemUseCallback(u8 taskId) +{ + u8 type; + if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY) + type = gTasks[taskId].data[4] - 1; + else + type = ItemId_GetType(gSpecialVar_ItemId) - 1; + if (!InBattlePyramid()) + { + *gUnknown_0203CE54 = gUnknown_085920D8[type]; + unknown_ItemMenu_Confirm(taskId); + } + else + { + *gUnknown_0203CF2C = gUnknown_085920D8[type]; + sub_81C5B14(taskId); + } +} + +void SetUpItemUseOnFieldCallback(u8 taskId) +{ + if (gTasks[taskId].data[3] != 1) + { + gFieldCallback = MapPostLoadHook_UseItem; + SetUpItemUseCallback(taskId); + } + else + gUnknown_0203A0F4(taskId); +} + +void MapPostLoadHook_UseItem(void) +{ + pal_fill_black(); + CreateTask(Task_CallItemUseOnFieldCallback, 8); +} + +void Task_CallItemUseOnFieldCallback(u8 taskId) +{ + if (sub_80ABDFC() == 1) + gUnknown_0203A0F4(taskId); +} + +void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField, u8 *str) +{ + StringExpandPlaceholders(gStringVar4, str); + if (!isUsingRegisteredKeyItemOnField) + { + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, sub_81C6714); + } + else + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); +} + +void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) +{ + DisplayCannotUseItemMessage(taskId, isUsingRegisteredKeyItemOnField, gText_DadsAdvice); +} + +void DisplayCannotDismountBikeMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) +{ + DisplayCannotUseItemMessage(taskId, isUsingRegisteredKeyItemOnField, gText_CantDismountBike); +} + +void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId) +{ + sub_8197434(0, 1); + DestroyTask(taskId); + sub_80984F4(); + ScriptContext2_Disable(); +} + +u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId) +{ + if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_TMHM) + return 1; + else if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_EvolutionStone) + return 2; + else + return 0; +} + +void sub_80FD254() +{ + struct MailStruct mail; + mail.itemId = gSpecialVar_ItemId; + ReadMail(&mail, bag_menu_mail_related, 0); +} + +void ItemUseOutOfBattle_Mail(u8 taskId) +{ + *gUnknown_0203CE54 = sub_80FD254; + unknown_ItemMenu_Confirm(taskId); +} + +void ItemUseOutOfBattle_Bike(u8 taskId) +{ + s16* data = gTasks[taskId].data; + s16 coordsY; + s16 coordsX; + u8 behavior; + PlayerGetDestCoords(&coordsX, &coordsY); + behavior = MapGridGetMetatileBehaviorAt(coordsX, coordsY); + if (FlagGet(FLAG_SYS_CYCLING_ROAD) == TRUE || MetatileBehavior_IsVerticalRail(behavior) == TRUE || MetatileBehavior_IsHorizontalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedVerticalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedHorizontalRail(behavior) == TRUE) + DisplayCannotDismountBikeMessage(taskId, data[3]); + else + { + if (sav1_map_is_biking_allowed() == TRUE && IsBikingDisallowedByPlayer() == 0) + { + gUnknown_0203A0F4 = ItemUseOnFieldCB_Bike; + SetUpItemUseOnFieldCallback(taskId); + } + else + DisplayDadsAdviceCannotUseItemMessage(taskId, data[3]); + } +} + +void ItemUseOnFieldCB_Bike(u8 taskId) +{ + if (!ItemId_GetSecondaryId(gSpecialVar_ItemId)) + GetOnOffBike(2); + else + GetOnOffBike(4); + sub_80984F4(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +bool32 CanFish() +{ + s16 x, y; + u16 tileBehavior; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + tileBehavior = MapGridGetMetatileBehaviorAt(x, y); + + if (MetatileBehavior_IsWaterfall(tileBehavior)) + return FALSE; + + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) + return FALSE; + + if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + { + if (IsPlayerFacingSurfableFishableWater()) + return TRUE; + } + else + { + if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior) && !MapGridIsImpassableAt(x, y)) + return TRUE; + if (MetatileBehavior_8089510(tileBehavior) == TRUE) + return TRUE; + } + + return FALSE; +} + +void ItemUseOutOfBattle_Rod(u8 taskId) +{ + if (CanFish() == TRUE) + { + gUnknown_0203A0F4 = ItemUseOnFieldCB_Rod; + SetUpItemUseOnFieldCallback(taskId); + } + else + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); +} + +void ItemUseOnFieldCB_Rod(u8 taskId) +{ + StartFishing(ItemId_GetSecondaryId(gSpecialVar_ItemId)); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_Itemfinder(u8 var) +{ + IncrementGameStat(0x27); + gUnknown_0203A0F4 = ItemUseOnFieldCB_Itemfinder; + SetUpItemUseOnFieldCallback(var); +} + +void ItemUseOnFieldCB_Itemfinder(u8 taskId) +{ + if (ItemfinderCheckForHiddenItems(gMapHeader.events, taskId) == TRUE) + gTasks[taskId].func = sub_80FD504; + else + DisplayItemMessageOnField(taskId, gText_ItemFinderNothing, sub_80FD5CC); +} + +void sub_80FD504(u8 taskId) +{ + u8 playerDir; + u8 playerDirToItem; + u8 i; + s16* data = gTasks[taskId].data; + if (!data[3]) + { + if (data[4] == 4) + { + playerDirToItem = sub_80FD9B0(data[0], data[1]); + if (playerDirToItem) + { + sub_80FDA24(gUnknown_085920E4[playerDirToItem - 1]); + gTasks[taskId].func = sub_80FDA94; + } + else + { + playerDir = player_get_direction_lower_nybble(); + for (i = 0; i < 4; i++) + { + if (playerDir == gUnknown_085920E4[i]) + data[5] = (i + 1) & 3; + } + gTasks[taskId].func = sub_80FDADC; + data[3] = 0; + data[2] = 0; + } + return; + } + PlaySE(SE_DAUGI); + data[4]++; + } + data[3] = (data[3] + 1) & 0x1F; +} + +void sub_80FD5CC(u8 taskId) +{ + sub_8197434(0, 1); + sub_80984F4(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId) +{ + int distanceX, distanceY; + s16 x, y, i, newDistanceX, newDistanceY; + PlayerGetDestCoords(&x, &y); + gTasks[taskId].data[2] = FALSE; + for (i = 0; i < events->bgEventCount; i++) + { + if (events->bgEvents[i].kind == 7 && !FlagGet(events->bgEvents[i].bgUnion.hiddenItem.hiddenItemId + 0x1F4)) + { + distanceX = (u16)events -> bgEvents[i].x + 7; + newDistanceX = distanceX - x; + distanceY = (u16)events -> bgEvents[i].y + 7; + newDistanceY = distanceY - y; + + if ((u16)(newDistanceX + 7) < 15 && (newDistanceY >= -5) && (newDistanceY < 6)) + sub_80FD8E0(taskId, newDistanceX, newDistanceY); + } + } + + sub_80FD7C8(taskId); + if (gTasks[taskId].data[2] == TRUE) + return TRUE; + else + return FALSE; +} + +bool8 sub_80FD6D4(struct MapEvents *events, s16 x, s16 y) +{ + u8 bgEventCount = events->bgEventCount; + struct BgEvent *bgEvent = events->bgEvents; + int i; + + for (i = 0; i < bgEventCount; i++) + { + if (bgEvent[i].kind == 7 && x == (u16)bgEvent[i].x && y == (u16)bgEvent[i].y) // hidden item and coordinates matches x and y passed? + { + if (!FlagGet(bgEvent[i].bgUnion.hiddenItem.hiddenItemId + 0x1F4)) + return TRUE; + else + return FALSE; + } + } + return FALSE; +} + +bool8 sub_80FD730(struct MapConnection *connection, int x, int y) +{ + struct MapHeader *mapHeader; + u16 localX, localY; + u32 localOffset; + s32 localLength; + + mapHeader = mapconnection_get_mapheader(connection); + + switch (connection->direction) + { + // same weird temp variable behavior seen in sub_80FD6D4 + case 2: + localOffset = connection->offset + 7; + localX = x - localOffset; + localLength = mapHeader->mapData->height - 7; + localY = localLength + y; // additions are reversed for some reason + break; + case 1: + localOffset = connection->offset + 7; + localX = x - localOffset; + localLength = gMapHeader.mapData->height + 7; + localY = y - localLength; + break; + case 3: + localLength = mapHeader->mapData->width - 7; + localX = localLength + x; // additions are reversed for some reason + localOffset = connection->offset + 7; + localY = y - localOffset; + break; + case 4: + localLength = gMapHeader.mapData->width + 7; + localX = x - localLength; + localOffset = connection->offset + 7; + localY = y - localOffset; + break; + default: + return FALSE; + } + return sub_80FD6D4(mapHeader->events, localX, localY); +} + +// weird math +#ifdef NONMATCHING +void sub_80FD7C8(u8 taskId) +{ + s16 x, y; + s16 curX, curY; + s16 width = gMapHeader.mapData->width + 7; + s16 height = gMapHeader.mapData->height + 7; + + PlayerGetDestCoords(&x, &y); + + for (curX = x - 7; curX <= x + 7; curX++) + { + for (curY = y - 5; curY <= y + 5; curY++) + { + if (7 > curX + || curX >= width + || 7 > curY + || curY >= height) + { + struct MapConnection *conn = sub_8088A8C(curX, curY); + if (conn && sub_80FD730(conn, curX, curY) == TRUE) + sub_80FD8E0(taskId, curX - x, curY - y); + } + } + } +} +#else +__attribute__((naked)) +void sub_80FD7C8(u8 taskId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x14\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x4]\n\ + ldr r0, =gMapHeader\n\ + ldr r1, [r0]\n\ + ldr r0, [r1]\n\ + adds r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0x8]\n\ + ldr r0, [r1, 0x4]\n\ + adds r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0xC]\n\ + mov r4, sp\n\ + adds r4, 0x2\n\ + mov r0, sp\n\ + adds r1, r4, 0\n\ + bl PlayerGetDestCoords\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + subs r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + asrs r0, 16\n\ + mov r1, sp\n\ + movs r2, 0\n\ + ldrsh r1, [r1, r2]\n\ + adds r1, 0x7\n\ + cmp r0, r1\n\ + bgt _080FD8CC\n\ +_080FD816:\n\ + mov r5, sp\n\ + ldrh r0, [r5, 0x2]\n\ + subs r0, 0x5\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + lsls r2, r4, 16\n\ + asrs r1, r2, 16\n\ + movs r6, 0x2\n\ + ldrsh r0, [r5, r6]\n\ + adds r0, 0x5\n\ + lsls r3, 16\n\ + mov r8, r3\n\ + cmp r1, r0\n\ + bgt _080FD8B6\n\ + movs r0, 0x7\n\ + str r0, [sp, 0x10]\n\ + mov r1, r8\n\ + asrs r1, 16\n\ + mov r9, r1\n\ + mov r10, r0\n\ +_080FD83E:\n\ + ldr r3, [sp, 0x10]\n\ + cmp r3, r9\n\ + bgt _080FD860\n\ + ldr r5, [sp, 0x8]\n\ + lsls r0, r5, 16\n\ + asrs r0, 16\n\ + cmp r9, r0\n\ + bge _080FD860\n\ + asrs r1, r2, 16\n\ + cmp r10, r1\n\ + bgt _080FD860\n\ + ldr r6, [sp, 0xC]\n\ + lsls r0, r6, 16\n\ + asrs r0, 16\n\ + lsls r7, r4, 16\n\ + cmp r1, r0\n\ + blt _080FD89E\n\ +_080FD860:\n\ + mov r0, r8\n\ + asrs r5, r0, 16\n\ + lsls r4, 16\n\ + asrs r6, r4, 16\n\ + adds r0, r5, 0\n\ + adds r1, r6, 0\n\ + bl sub_8088A8C\n\ + adds r7, r4, 0\n\ + cmp r0, 0\n\ + beq _080FD89E\n\ + adds r1, r5, 0\n\ + adds r2, r6, 0\n\ + bl sub_80FD730\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bne _080FD89E\n\ + mov r0, sp\n\ + ldrh r1, [r0]\n\ + subs r1, r5, r1\n\ + lsls r1, 16\n\ + asrs r1, 16\n\ + ldrh r2, [r0, 0x2]\n\ + subs r2, r6, r2\n\ + lsls r2, 16\n\ + asrs r2, 16\n\ + ldr r0, [sp, 0x4]\n\ + bl sub_80FD8E0\n\ +_080FD89E:\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r0, r7, r1\n\ + lsrs r4, r0, 16\n\ + lsls r2, r4, 16\n\ + asrs r1, r2, 16\n\ + mov r3, sp\n\ + movs r5, 0x2\n\ + ldrsh r0, [r3, r5]\n\ + adds r0, 0x5\n\ + cmp r1, r0\n\ + ble _080FD83E\n\ +_080FD8B6:\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + add r1, r8\n\ + lsrs r3, r1, 16\n\ + asrs r1, 16\n\ + mov r0, sp\n\ + movs r6, 0\n\ + ldrsh r0, [r0, r6]\n\ + adds r0, 0x7\n\ + cmp r1, r0\n\ + ble _080FD816\n\ +_080FD8CC:\n\ + add sp, 0x14\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_80FD8E0(u8 taskId, s16 x, s16 y) +{ + s16 *data = gTasks[taskId].data; + s16 var1, var2, var3, var4; + + if (data[2] == FALSE) + { + data[0] = x; + data[1] = y; + data[2] = TRUE; + } + else + { + // data[0] and data[1] contain the player's coordinates. + // x and y contain the item's coordinates. + if (data[0] < 0) + var1 = data[0] * -1; // item is to the left + else + var1 = data[0]; // item is to the right + + if (data[1] < 0) + var2 = data[1] * -1; // item is to the north + else + var2 = data[1]; // item is to the south + + if (x < 0) + var3 = x * -1; + else + var3 = x; + + if (y < 0) + var4 = y * -1; + else + var4 = y; + + if (var1 + var2 > var3 + var4) + { + data[0] = x; + data[1] = y; + } + else + { + if (var1 + var2 == var3 + var4 && (var2 > var4 || (var2 == var4 && data[1] < y))) + { + data[0] = x; + data[1] = y; + } + } + } +} + +u8 sub_80FD9B0(s16 itemX, s16 itemY) +{ + s16 abX, abY; + + if (itemX == 0 && itemY == 0) + return DIR_NONE; // player is standing on the item. + + // get absolute X distance. + if (itemX < 0) + abX = itemX * -1; + else + abX = itemX; + + // get absolute Y distance. + if (itemY < 0) + abY = itemY * -1; + else + abY = itemY; + + if (abX > abY) + { + if (itemX < 0) + return DIR_EAST; + else + return DIR_NORTH; + } + else + { + if (abX < abY) + { + if (itemY < 0) + return DIR_SOUTH; + else + return DIR_WEST; + } + if (abX == abY) + { + if (itemY < 0) + return DIR_SOUTH; + else + return DIR_WEST; + } + return DIR_NONE; // should never get here. return something so it doesnt crash. + } +} + +void sub_80FDA24(u8 direction) +{ + FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + FieldObjectClearAnim(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + npc_sync_anim_pause_bits(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + PlayerTurnInPlace(direction); +} + +void sub_80FDA94(u8 taskId) +{ + if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE) + DisplayItemMessageOnField(taskId, gText_ItemFinderNearby, sub_80FD5CC); +} + +void sub_80FDADC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE + || data[2] == FALSE) + { + sub_80FDA24(gUnknown_085920E4[data[5]]); + data[2] = 1; + data[5] = (data[5] + 1) & 3; + data[3]++; + + if (data[3] == 4) + DisplayItemMessageOnField(taskId, gText_ItemFinderOnTop, sub_80FD5CC); + } +} + +void ItemUseOutOfBattle_PokeblockCase(u8 taskId) +{ + if (sub_81221AC() == TRUE) + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } + else if (gTasks[taskId].data[3] != TRUE) + { + *gUnknown_0203CE54 = sub_80FDBEC; + unknown_ItemMenu_Confirm(taskId); + } + else + { + gFieldCallback = sub_80AF6D4; + fade_screen(1, 0); + gTasks[taskId].func = sub_80FDC00; + } +} + +void sub_80FDBEC(void) +{ + OpenPokeblockCase(0, bag_menu_mail_related); +} + +void sub_80FDC00(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + OpenPokeblockCase(0, c2_exit_to_overworld_2_switch); + DestroyTask(taskId); + } +} + +void ItemUseOutOfBattle_CoinCase(u8 taskId) +{ + ConvertIntToDecimalStringN(gStringVar1, GetCoins(), 0, 4); + StringExpandPlaceholders(gStringVar4, gText_CoinCase); + + if (!gTasks[taskId].data[3]) + { + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + } + else + { + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); + } +} + +void ItemUseOutOfBattle_PowderJar(u8 taskId) +{ + ConvertIntToDecimalStringN(gStringVar1, sub_80247BC(), 0, 5); + StringExpandPlaceholders(gStringVar4, gText_PowderQty); + + if (!gTasks[taskId].data[3]) + { + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + } + else + { + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); + } +} + +void sub_80FDD10(u8 taskId) +{ + if (IsPlayerFacingPlantedBerryTree() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDD74; + gFieldCallback = MapPostLoadHook_UseItem; + *gUnknown_0203CE54 = c2_exit_to_overworld_2_switch; + unknown_ItemMenu_Confirm(taskId); + } + else + { + ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + } +} + +void sub_80FDD74(u8 taskId) +{ + RemoveBagItem(gSpecialVar_ItemId, 1); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Route102_EventScript_274482); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_WailmerPail(u8 taskId) +{ + if (sub_80FDE2C() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDE7C; + SetUpItemUseOnFieldCallback(taskId); + } + else if (TryToWaterBerryTree() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDE08; + SetUpItemUseOnFieldCallback(taskId); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void sub_80FDE08(u8 taskId) +{ + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Route102_EventScript_2744C0); + DestroyTask(taskId); +} + +bool8 sub_80FDE2C(void) +{ + u16 x, y; + u8 z; + u8 objId; + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + z = PlayerGetZCoord(); + objId = GetFieldObjectIdByXYZ(x, y, z); + if (objId == 16 || gMapObjects[objId].graphicsId != 0xE4) + { + return FALSE; + } + else + return TRUE; +} + +void sub_80FDE7C(u8 taskId) +{ + ScriptContext2_Enable(); + ScriptContext1_SetupScript(BattleFrontier_OutsideEast_EventScript_242CFC); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_Medicine(u8 taskId) +{ + gUnknown_03006328 = ItemUseCB_Medicine; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_ReduceEV(u8 taskId) +{ + gUnknown_03006328 = sub_81B67C8; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_SacredAsh(u8 taskId) +{ + gUnknown_03006328 = sub_81B79E8; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_PPRecovery(u8 taskId) +{ + gUnknown_03006328 = dp05_ether; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_PPUp(u8 taskId) +{ + gUnknown_03006328 = dp05_pp_up; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_RareCandy(u8 taskId) +{ + gUnknown_03006328 = dp05_rare_candy; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_TMHM(u8 taskId) +{ + if (gSpecialVar_ItemId >= ITEM_HM01) + DisplayItemMessage(taskId, 1, gText_BootedUpHM, sub_80FDF90); // HM + else + DisplayItemMessage(taskId, 1, gText_BootedUpTM, sub_80FDF90); // TM +} + +void sub_80FDF90(u8 taskId) +{ + PlaySE(SE_PC_LOGIN); + gTasks[taskId].func = task08_0809AD8C; +} + +void task08_0809AD8C(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]); + StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1); + DisplayItemMessage(taskId, 1, gStringVar4, sub_80FE024); + } +} + +void sub_80FE024(u8 taskId) +{ + bag_menu_yes_no(taskId, 6, gUnknown_085920E8); +} + +void sub_80FE03C(u8 taskId) +{ + gUnknown_03006328 = sub_81B6DC4; + SetUpItemUseCallback(taskId); +} + +void sub_80FE058(void) +{ + RemoveBagItem(gSpecialVar_ItemId, 1); + CopyItemName(gSpecialVar_ItemId, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); + if (!InBattlePyramid()) + { + sub_81AB9A8(ItemId_GetPocket(gSpecialVar_ItemId)); + sub_81ABA88(ItemId_GetPocket(gSpecialVar_ItemId)); + } + else + { + sub_81C5924(); + sub_81C59BC(); + } +} + +void ItemUseOutOfBattle_Repel(u8 taskId) +{ + if (VarGet(VAR_REPEL_STEP_COUNT) == 0) + gTasks[taskId].func = sub_80FE124; + else if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gText_RepelEffectsLingered, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, sub_81C6714); +} + +void sub_80FE124(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (++data[8] > 7) + { + data[8] = 0; + PlaySE(SE_TU_SAA); + gTasks[taskId].func = sub_80FE164; + } +} + +void sub_80FE164(u8 taskId) +{ + if (!IsSEPlaying()) + { + VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId)); + sub_80FE058(); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C6714); + } +} + +void sub_80FE1D0(u8 taskId) +{ + if(++gTasks[taskId].data[8] > 7) + { + PlaySE(SE_BIDORO); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C6714); + } +} + +void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId) +{ + CopyItemName(gSpecialVar_ItemId, gStringVar2); + if (gSpecialVar_ItemId == ITEM_WHITE_FLUTE) + { + FlagSet(FLAG_SYS_ENC_UP_ITEM); + FlagClear(FLAG_SYS_ENC_DOWN_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); + } + else + { + FlagSet(FLAG_SYS_ENC_DOWN_ITEM); + FlagClear(FLAG_SYS_ENC_UP_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildRepelled); + } + gTasks[taskId].data[8] = 0; + gTasks[taskId].func = sub_80FE1D0; +} + +void task08_080A1C44(u8 taskId) +{ + player_avatar_init_params_reset(); + sub_80B7CC8(); + DestroyTask(taskId); +} + +void re_escape_rope(u8 taskId) +{ + flagmods_08054D70(); + sub_80FE058(); + gTasks[taskId].data[0] = 0; + DisplayItemMessageOnField(taskId, gStringVar4, task08_080A1C44); +} + +bool8 sub_80FE314(void) +{ + if (gMapHeader.flags & 2) + return TRUE; + else + return FALSE; +} + +void ItemUseOutOfBattle_EscapeRope(u8 taskId) +{ + if (sub_80FE314() == TRUE) + { + gUnknown_0203A0F4 = re_escape_rope; + SetUpItemUseOnFieldCallback(taskId); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void ItemUseOutOfBattle_EvolutionStone(u8 taskId) +{ + gUnknown_03006328 = sub_81B7C74; + SetUpItemUseCallback(taskId); +} + +void ItemUseInBattle_PokeBall(u8 taskId) +{ + if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? + { + RemoveBagItem(gSpecialVar_ItemId, 1); + if (!InBattlePyramid()) + unknown_ItemMenu_Confirm(taskId); + else + sub_81C5B14(taskId); + } + else if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gText_BoxFull, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, sub_81C6714); +} + +void sub_80FE408(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + if (!InBattlePyramid()) + unknown_ItemMenu_Confirm(taskId); + else + sub_81C5B14(taskId); + } +} + +void sub_80FE440(u8 taskId) +{ + if(++gTasks[taskId].data[8] > 7) + { + PlaySE(SE_KAIFUKU); + RemoveBagItem(gSpecialVar_ItemId, 1); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, sub_806CF78(gSpecialVar_ItemId), sub_80FE408); + else + DisplayItemMessageInBattlePyramid(taskId, sub_806CF78(gSpecialVar_ItemId), sub_80FE408); + } +} + +void ItemUseInBattle_StatIncrease(u8 taskId) +{ + u16 partyId = gBattlePartyID[gBankInMenu]; + + if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) + { + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gText_WontHaveEffect, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, sub_81C6714); + } + else + { + gTasks[taskId].func = sub_80FE440; + gTasks[taskId].data[8] = 0; + } +} + +void sub_80FE54C(u8 taskId) +{ + if (!InBattlePyramid()) + { + *gUnknown_0203CE54 = sub_81B89F0; + unknown_ItemMenu_Confirm(taskId); + } + else + { + *gUnknown_0203CF2C = sub_81B89F0; + sub_81C5B14(taskId); + } +} + +void ItemUseInBattle_Medicine(u8 taskId) +{ + gUnknown_03006328 = ItemUseCB_Medicine; + sub_80FE54C(taskId); +} + +void sub_80FE5AC(u8 taskId) +{ + gUnknown_03006328 = sub_81B79E8; + sub_80FE54C(taskId); +} + +void ItemUseInBattle_PPRecovery(u8 taskId) +{ + gUnknown_03006328 = dp05_ether; + sub_80FE54C(taskId); +} + +void ItemUseInBattle_Escape(u8 taskId) +{ + + if((gBattleTypeFlags & BATTLE_TYPE_TRAINER) == FALSE) + { + sub_80FE058(); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, unknown_ItemMenu_Confirm); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C5B14); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void ItemUseOutOfBattle_EnigmaBerry(u8 taskId) +{ + switch (GetItemEffectType(gSpecialVar_ItemId) - 1) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_Medicine(taskId); + break; + case 9: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_SacredAsh(taskId); + break; + case 0: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_RareCandy(taskId); + break; + case 18: + case 19: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_PPUp(taskId); + break; + case 20: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_PPRecovery(taskId); + break; + default: + gTasks[taskId].data[4] = 4; + ItemUseOutOfBattle_CannotUse(taskId); + } +} + +void ItemUseInBattle_EnigmaBerry(u8 taskId) +{ + switch (GetItemEffectType(gSpecialVar_ItemId)) + { + case 0: + ItemUseInBattle_StatIncrease(taskId); + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 11: + ItemUseInBattle_Medicine(taskId); + break; + case 21: + ItemUseInBattle_PPRecovery(taskId); + break; + default: + ItemUseOutOfBattle_CannotUse(taskId); + } +} + +void ItemUseOutOfBattle_CannotUse(u8 taskId) +{ + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); +} From ed546d680f726e068183f94d0104a251f75fbfe2 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 12:36:56 +0100 Subject: [PATCH 09/15] pokemon animation is decompiled --- asm/pokemon_animation.s | 1770 ----------------------------- data/pokemon_animation.s | 33 - include/pokemon_animation.h | 5 +- ld_script.txt | 2 - src/hall_of_fame.c | 3 +- src/pokemon_3.c | 11 +- src/pokemon_animation.c | 2133 ++++++++++++++++++++++++----------- sym_bss.txt | 12 +- 8 files changed, 1507 insertions(+), 2462 deletions(-) delete mode 100644 asm/pokemon_animation.s delete mode 100644 data/pokemon_animation.s diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s deleted file mode 100644 index 919c1a31e..000000000 --- a/asm/pokemon_animation.s +++ /dev/null @@ -1,1770 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - thumb_func_start sub_81840C4 -sub_81840C4: @ 81840C4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - movs r1, 0x80 - lsls r1, 1 - cmp r0, r1 - ble _081840FC - movs r2, 0x3A - ldrsh r1, [r5, r2] - ldrh r2, [r5, 0x36] - movs r3, 0x36 - ldrsh r0, [r5, r3] - cmp r1, r0 - bgt _081840EC - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r5, 0x1C] - b _081840F4 - .pool -_081840EC: - adds r0, r2, 0x1 - movs r1, 0 - strh r0, [r5, 0x36] - strh r1, [r5, 0x3C] -_081840F4: - movs r0, 0 - strh r0, [r5, 0x24] - strh r0, [r5, 0x26] - b _08184188 -_081840FC: - cmp r0, 0x9F - ble _08184126 - cmp r0, r1 - ble _08184106 - strh r1, [r5, 0x3C] -_08184106: - movs r0, 0x3C - ldrsh r1, [r5, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08184112 - adds r0, 0xFF -_08184112: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - b _08184154 -_08184126: - cmp r0, 0x5F - ble _0818414A - movs r0, 0x60 - movs r1, 0x6 - bl Sin - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - subs r0, 0x60 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x4 - bl Sin - subs r4, r0 - strh r4, [r5, 0x26] - b _08184156 -_0818414A: - movs r2, 0x3C - ldrsh r0, [r5, r2] - movs r1, 0x6 - bl Sin -_08184154: - strh r0, [r5, 0x26] -_08184156: - movs r3, 0x3C - ldrsh r0, [r5, r3] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r2, 0x38 - ldrsh r1, [r5, r2] - bl Sin - negs r0, r0 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r5, 0x36] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0818417E - lsls r0, r2, 16 - negs r0, r0 - lsrs r2, r0, 16 -_0818417E: - strh r2, [r5, 0x24] - ldrh r0, [r5, 0x34] - ldrh r3, [r5, 0x3C] - adds r0, r3 - strh r0, [r5, 0x3C] -_08184188: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81840C4 - - thumb_func_start pokemonanimfunc_7C -pokemonanimfunc_7C: @ 8184190 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _081841B0 - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x2 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x4 - strh r0, [r2, 0x34] -_081841B0: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7C - - thumb_func_start pokemonanimfunc_7D -pokemonanimfunc_7D: @ 81841BC - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _081841DC - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x2 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x6 - strh r0, [r2, 0x34] -_081841DC: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7D - - thumb_func_start pokemonanimfunc_7E -pokemonanimfunc_7E: @ 81841E8 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _08184208 - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x3 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x8 - strh r0, [r2, 0x34] -_08184208: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7E - - thumb_func_start pokemonanimfunc_7F -pokemonanimfunc_7F: @ 8184214 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r1, [r2, r0] - cmp r1, 0 - bne _08184232 - movs r0, 0x1 - strh r0, [r2, 0x32] - strh r0, [r2, 0x3A] - strh r1, [r2, 0x3C] - movs r1, 0x4 - strh r1, [r2, 0x38] - movs r0, 0x6 - strh r0, [r2, 0x36] - strh r1, [r2, 0x34] -_08184232: - adds r0, r2, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7F - - thumb_func_start pokemonanimfunc_80 -pokemonanimfunc_80: @ 818423C - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _0818425A - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0x4 - strh r0, [r1, 0x38] - movs r0, 0x6 - strh r0, [r1, 0x36] - strh r0, [r1, 0x34] -_0818425A: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_80 - - thumb_func_start pokemonanimfunc_81 -pokemonanimfunc_81: @ 8184264 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _08184286 - movs r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0x2 - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0x4 - strh r0, [r1, 0x38] - movs r0, 0x6 - strh r0, [r1, 0x36] - movs r0, 0x8 - strh r0, [r1, 0x34] -_08184286: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_81 - - thumb_func_start sub_8184290 -sub_8184290: @ 8184290 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r0, r1, 8 - negs r0, r0 - strh r0, [r4, 0x3A] - movs r0, 0x36 - ldrsh r2, [r4, r0] - adds r0, r4, 0 - movs r3, 0 - bl sub_817F3F0 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl HandleSetAffineData - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8184290 - - thumb_func_start pokemonanimfunc_82 -pokemonanimfunc_82: @ 81842DC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184300 - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x3C - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x1 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184300: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _0818434C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _08184348 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08184358 - .pool -_08184348: - strh r2, [r4, 0x32] - b _08184352 -_0818434C: - adds r0, r4, 0 - bl sub_8184290 -_08184352: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08184358: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_82 - - thumb_func_start pokemonanimfunc_83 -pokemonanimfunc_83: @ 8184360 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184384 - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x5A - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x1 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184384: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _081843D0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _081843CC - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _081843DC - .pool -_081843CC: - strh r2, [r4, 0x32] - b _081843D6 -_081843D0: - adds r0, r4, 0 - bl sub_8184290 -_081843D6: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_081843DC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_83 - - thumb_func_start pokemonanimfunc_84 -pokemonanimfunc_84: @ 81843E4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184408 - adds r0, r4, 0 - bl HandleStartAffineAnim - movs r0, 0x1E - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x2 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184408: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _08184454 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _08184450 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _08184460 - .pool -_08184450: - strh r2, [r4, 0x32] - b _0818445A -_08184454: - adds r0, r4, 0 - bl sub_8184290 -_0818445A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08184460: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_84 - - thumb_func_start sub_8184468 -sub_8184468: @ 8184468 - push {r4-r6,lr} - adds r6, r0, 0 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r2, 0x3C - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818449C - movs r0, 0 - strh r0, [r6, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl HandleSetAffineData - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r6, 0x1C] - b _08184544 - .pool -_0818449C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __modsi3 - lsls r0, 24 - lsrs r0, 16 - adds r1, r4, 0 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081844BC - adds r0, 0xFF -_081844BC: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - lsrs r4, r0, 16 - ldrh r0, [r6, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081844F8 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - adds r0, r4, 0 - movs r1, 0x20 - b _0818451E -_081844F8: - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r5, r2, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - adds r0, r4, 0 - movs r1, 0x8 -_0818451E: - bl Sin - lsls r0, 24 - lsrs r0, 24 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bge _08184530 - adds r0, 0x7 -_08184530: - lsrs r0, 3 - strh r0, [r6, 0x26] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl HandleSetAffineData -_08184544: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8184468 - - thumb_func_start pokemonanimfunc_85 -pokemonanimfunc_85: @ 8184550 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08184570 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x28 - strh r0, [r4, 0x3A] - movs r0, 0x50 - strh r0, [r4, 0x3C] -_08184570: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_85 - - thumb_func_start pokemonanimfunc_86 -pokemonanimfunc_86: @ 818457C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818459A - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x28 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] -_0818459A: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_86 - - thumb_func_start pokemonanimfunc_87 -pokemonanimfunc_87: @ 81845A8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081845C6 - adds r0, r4, 0 - bl HandleStartAffineAnim - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x50 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] -_081845C6: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_87 - - thumb_func_start sub_81845D4 -sub_81845D4: @ 81845D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x32] - subs r0, r1 - strh r0, [r4, 0x24] - movs r0, 0x24 - ldrsh r1, [r4, r0] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmn r1, r0 - bgt _081845FE - ldrh r0, [r4, 0x3A] - negs r0, r0 - strh r0, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x3C] - ldr r0, =sub_8184610 - str r0, [r4, 0x1C] -_081845FE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81845D4 - - thumb_func_start sub_8184610 -sub_8184610: @ 8184610 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - ldrh r2, [r4, 0x24] - adds r1, r0, r2 - strh r1, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x3C] - lsls r1, 16 - cmp r1, 0 - blt _0818462E - ldr r0, =sub_8184640 - str r0, [r4, 0x1C] -_0818462E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8184610 - - thumb_func_start sub_8184640 -sub_8184640: @ 8184640 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - ldrh r2, [r4, 0x24] - adds r1, r0, r2 - strh r1, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x3C] - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _08184668 - strh r2, [r4, 0x24] - ldr r0, =sub_8184678 - str r0, [r4, 0x1C] -_08184668: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8184640 - - thumb_func_start sub_8184678 -sub_8184678: @ 8184678 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r2, [r4, 0x34] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - blt _08184698 - ldr r0, =sub_81846B8 - str r0, [r4, 0x1C] - b _081846AC - .pool -_08184698: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r3, 0x36 - ldrsh r0, [r4, r3] - negs r0, r0 - strh r0, [r4, 0x36] - adds r0, r2, 0x1 - strh r0, [r4, 0x34] -_081846AC: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8184678 - - thumb_func_start sub_81846B8 -sub_81846B8: @ 81846B8 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - subs r0, 0x2 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - bgt _081846DA - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] -_081846DA: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81846B8 - - thumb_func_start pokemonanimfunc_88 -pokemonanimfunc_88: @ 81846EC - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r2, 0 - movs r1, 0x4 - strh r1, [r4, 0x3C] - movs r0, 0xC - strh r0, [r4, 0x3A] - movs r0, 0x10 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_88 - - thumb_func_start pokemonanimfunc_89 -pokemonanimfunc_89: @ 8184718 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r2, 0 - movs r1, 0x2 - strh r1, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0xC - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_89 - - thumb_func_start pokemonanimfunc_8A -pokemonanimfunc_8A: @ 8184744 - push {r4,lr} - adds r4, r0, 0 - bl HandleStartAffineAnim - movs r1, 0 - strh r1, [r4, 0x3C] - movs r0, 0x6 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r1, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_8A - - thumb_func_start sub_8184770 -sub_8184770: @ 8184770 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - strh r0, [r1, 0x24] - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _0818478E - movs r2, 0x30 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0x30] - movs r0, 0 - b _08184790 -_0818478E: - adds r0, r2, 0x1 -_08184790: - strh r0, [r1, 0x2E] - pop {r0} - bx r0 - thumb_func_end sub_8184770 - - thumb_func_start sub_8184798 -sub_8184798: @ 8184798 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r1, =gUnknown_0860AE7C - movs r2, 0x34 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - adds r0, r4, 0 - bl sub_8184770 - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1, 0x1] - cmp r0, 0xFF - bne _081847D0 - movs r0, 0 - strh r0, [r4, 0x24] - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _0818482E - .pool -_081847D0: - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bne _08184800 - ldrb r0, [r1] - cmp r0, 0 - beq _081847F0 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - b _081847FC - .pool -_081847F0: - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette -_081847FC: - movs r0, 0 - strh r0, [r4, 0x36] -_08184800: - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08184828 - 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 _0818482E - .pool -_08184828: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_0818482E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8184798 - - thumb_func_start pokemonanimfunc_8B -pokemonanimfunc_8B: @ 8184834 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08184860 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - strh r3, [r2, 0x34] -_08184860: - adds r0, r2, 0 - bl sub_8184798 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8B - - thumb_func_start pokemonanimfunc_8C -pokemonanimfunc_8C: @ 818486C - push {r4,r5,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0x1 - bne _08184898 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r5, 0x80 - lsls r5, 1 - adds r1, r5, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - strh r4, [r2, 0x34] -_08184898: - adds r0, r2, 0 - bl sub_8184798 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8C - - thumb_func_start pokemonanimfunc_8D -pokemonanimfunc_8D: @ 81848A4 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _081848D2 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - movs r0, 0x2 - strh r0, [r2, 0x34] -_081848D2: - adds r0, r2, 0 - bl sub_8184798 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8D - - thumb_func_start sub_81848E0 -sub_81848E0: @ 81848E0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _08184904 - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0x1F - bl BlendPalette - ldr r0, =SpriteCB_SetDummyOnAnimEnd - str r0, [r4, 0x1C] - b _0818492A - .pool -_08184904: - movs r5, 0x32 - ldrsh r0, [r4, r5] - 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, =gUnknown_0860AE88 - movs r5, 0x30 - ldrsh r1, [r4, r5] - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette -_0818492A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81848E0 - - thumb_func_start sub_8184934 -sub_8184934: @ 8184934 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r1, r0 - bge _081849CC - adds r0, r4, 0 - bl sub_817F70C - movs r3, 0x38 - ldrsh r1, [r4, r3] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08184970 - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x36 - ldrsh r1, [r4, r3] - cmp r0, r1 - bge _0818496C - strh r2, [r4, 0x38] -_0818496C: - strh r2, [r4, 0x24] - b _081849C6 -_08184970: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r0, 1 - lsls r0, 1 - subs r1, r0 - lsls r1, 16 - asrs r1, 15 - movs r0, 0x1 - subs r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r3, 0x2E - ldrsh r1, [r4, r3] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081849A4 - adds r0, 0xFF -_081849A4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r1, 0 - muls r2, r0 - adds r0, r2, 0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081849C6: - adds r0, r4, 0 - bl sub_817F70C -_081849CC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8184934 - - thumb_func_start pokemonanimfunc_8E -pokemonanimfunc_8E: @ 81849D4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _081849FE - 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] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_081849FE: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184A0E - adds r0, r4, 0 - bl sub_81848E0 -_08184A0E: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184A30 - adds r0, r4, 0 - bl sub_8184934 -_08184A30: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8E - - thumb_func_start pokemonanimfunc_8F -pokemonanimfunc_8F: @ 8184A3C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184A66 - 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] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_08184A66: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184A76 - adds r0, r4, 0 - bl sub_81848E0 -_08184A76: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184A98 - adds r0, r4, 0 - bl sub_8184934 -_08184A98: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8F - - thumb_func_start pokemonanimfunc_90 -pokemonanimfunc_90: @ 8184AA4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184ACE - 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] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_08184ACE: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184ADE - adds r0, r4, 0 - bl sub_81848E0 -_08184ADE: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184B00 - adds r0, r4, 0 - bl sub_8184934 -_08184B00: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_90 - - thumb_func_start pokemonanimfunc_91 -pokemonanimfunc_91: @ 8184B0C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184B38 - 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] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x30] -_08184B38: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184B48 - adds r0, r4, 0 - bl sub_81848E0 -_08184B48: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184B6A - adds r0, r4, 0 - bl sub_8184934 -_08184B6A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_91 - - thumb_func_start pokemonanimfunc_92 -pokemonanimfunc_92: @ 8184B78 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184BA2 - 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] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184BA2: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184BB2 - adds r0, r4, 0 - bl sub_81848E0 -_08184BB2: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184BD4 - adds r0, r4, 0 - bl sub_8184934 -_08184BD4: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_92 - - thumb_func_start pokemonanimfunc_93 -pokemonanimfunc_93: @ 8184BE0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184C0A - 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] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184C0A: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184C1A - adds r0, r4, 0 - bl sub_81848E0 -_08184C1A: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184C3C - adds r0, r4, 0 - bl sub_8184934 -_08184C3C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_93 - - thumb_func_start pokemonanimfunc_94 -pokemonanimfunc_94: @ 8184C48 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184C72 - 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] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184C72: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184C82 - adds r0, r4, 0 - bl sub_81848E0 -_08184C82: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184CA4 - adds r0, r4, 0 - bl sub_8184934 -_08184CA4: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_94 - - thumb_func_start pokemonanimfunc_95 -pokemonanimfunc_95: @ 8184CB0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184CDC - 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] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x30] -_08184CDC: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184CEC - adds r0, r4, 0 - bl sub_81848E0 -_08184CEC: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184D0E - adds r0, r4, 0 - bl sub_8184934 -_08184D0E: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_95 - - thumb_func_start pokemonanimfunc_96 -pokemonanimfunc_96: @ 8184D1C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184D48 - 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] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x30] -_08184D48: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184D58 - adds r0, r4, 0 - bl sub_81848E0 -_08184D58: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184D7A - adds r0, r4, 0 - bl sub_8184934 -_08184D7A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_96 - - thumb_func_start SpriteCB_SetDummyOnAnimEnd -SpriteCB_SetDummyOnAnimEnd: @ 8184D88 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08184D9C - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_08184D9C: - pop {r0} - bx r0 - .pool - thumb_func_end SpriteCB_SetDummyOnAnimEnd - - .align 2, 0 @ Don't pad with nop. diff --git a/data/pokemon_animation.s b/data/pokemon_animation.s deleted file mode 100644 index cbab5295f..000000000 --- a/data/pokemon_animation.s +++ /dev/null @@ -1,33 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -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 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - -gUnknown_0860AE1C:: @ 860AE1C - .byte 0x00, 0x05, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - -gUnknown_0860AE54:: @ 860AE54 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - - .align 2 -gUnknown_0860AE7C:: @ 860AE7C - .4byte gUnknown_0860ADCC - .4byte gUnknown_0860AE1C - .4byte gUnknown_0860AE54 - - .align 1 -gUnknown_0860AE88:: @ 860AE88 - .2byte 0x001f, 0x03e0, 0x7c00, 0x0000 diff --git a/include/pokemon_animation.h b/include/pokemon_animation.h index b6d8c868e..c1ab8d817 100644 --- a/include/pokemon_animation.h +++ b/include/pokemon_animation.h @@ -1,7 +1,10 @@ #ifndef GUARD_POKEMON_ANIMATION_H #define GUARD_POKEMON_ANIMATION_H +u8 GetSpeciesBackAnimSet(u16 species); void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId); -void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimId); +void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId); +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet); +void SetSpriteCB_MonAnimDummy(struct Sprite *sprite); #endif // GUARD_POKEMON_ANIMATION_H diff --git a/ld_script.txt b/ld_script.txt index f21991734..35b0ce582 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -241,7 +241,6 @@ SECTIONS { src/fldeff_teleport.o(.text); asm/battle_link_817C95C.o(.text); src/pokemon_animation.o(.text); - asm/pokemon_animation.o(.text); src/recorded_battle.o(.text); src/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); @@ -516,7 +515,6 @@ SECTIONS { src/bard_music.o(.rodata); data/battle_link_817C95C.o(.rodata); src/pokemon_animation.o(.rodata); - data/pokemon_animation.o(.rodata); src/battle_controller_recorded_opponent.o(.rodata); src/battle_controller_recorded_player.o(.rodata); src/battle_dome_cards.o(.rodata); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 3e70e22fa..38183e807 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -25,6 +25,7 @@ #include "random.h" #include "event_data.h" #include "overworld.h" +#include "new_menu_helpers.h" struct HallofFameMon { @@ -53,7 +54,6 @@ static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL; extern bool8 gHasHallOfFameRecords; extern u32 gUnknown_0203BCD4; -extern u8 gDecompressionBuffer[]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern MainCallback gGameContinueCallback; extern u32 gDamagedSaveSectors; @@ -82,7 +82,6 @@ extern const u8 gContestConfetti_Gfx[]; extern const u8 gContestConfetti_Pal[]; extern void sub_81973C4(u8, u8); -extern u16 AddTextPrinterParametrized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); extern void sub_8175620(void); extern u8 TrySavingData(u8); extern u8 sub_818D3E4(u16 species, u32 trainerId, u32 personality, u8 flags, s16 x, s16 y, u8, u16); diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 95ec4b6a2..7ffb2f36a 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -74,8 +74,6 @@ extern u8 GetFrontierOpponentClass(u16 trainerId); extern u8 pokemon_order_func(u8 bankPartyId); extern void GetFrontierTrainerName(u8* dest, u16 trainerId); extern void sub_81C488C(u8); -extern void sub_817F578(struct Sprite*, u8 frontAnimId); -extern u8 GetSpeciesBackAnimId(u16 species); static void sub_806E6CC(u8 taskId); @@ -1508,7 +1506,7 @@ static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) { if (--gTasks[taskId].data[3] == 0) { - sub_817F578(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); + StartMonSummaryAnimation(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); sub_81C488C(0xFF); DestroyTask(taskId); } @@ -1523,7 +1521,6 @@ void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u } extern void SpriteCallbackDummy_2(struct Sprite*); -extern void sub_817F60C(struct Sprite*); void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) { @@ -1580,11 +1577,11 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF gTasks[taskId].data[2] = gMonFrontAnimIdsTable[species - 1]; gTasks[taskId].data[3] = gMonAnimationDelayTable[species - 1]; sub_81C488C(taskId); - sub_817F60C(sprite); + SetSpriteCB_MonAnimDummy(sprite); } else { - sub_817F578(sprite, gMonFrontAnimIdsTable[species - 1]); + StartMonSummaryAnimation(sprite, gMonFrontAnimIdsTable[species - 1]); } } @@ -1603,7 +1600,7 @@ void BattleAnimateBackSprite(struct Sprite* sprite, u16 species) } else { - LaunchAnimationTaskForBackSprite(sprite, GetSpeciesBackAnimId(species)); + LaunchAnimationTaskForBackSprite(sprite, GetSpeciesBackAnimSet(species)); sprite->callback = SpriteCallbackDummy_2; } } diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 67915d228..c8fcff93a 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -16,167 +16,171 @@ struct UnkAnimStruct }; extern u16 gBattlePartyID[]; -extern bool32 gUnknown_03001274; -extern struct UnkAnimStruct gUnknown_03001240[]; -extern u8 gUnknown_03001270; // this file's functions -void pokemonanimfunc_00(struct Sprite *sprite); -void pokemonanimfunc_01(struct Sprite *sprite); -void pokemonanimfunc_02(struct Sprite *sprite); -void pokemonanimfunc_03(struct Sprite *sprite); -void pokemonanimfunc_04(struct Sprite *sprite); -void pokemonanimfunc_05(struct Sprite *sprite); -void pokemonanimfunc_06(struct Sprite *sprite); -void pokemonanimfunc_07(struct Sprite *sprite); -void pokemonanimfunc_08(struct Sprite *sprite); -void pokemonanimfunc_09(struct Sprite *sprite); -void pokemonanimfunc_0A(struct Sprite *sprite); -void pokemonanimfunc_0B(struct Sprite *sprite); -void pokemonanimfunc_0C(struct Sprite *sprite); -void pokemonanimfunc_0D(struct Sprite *sprite); -void pokemonanimfunc_0E(struct Sprite *sprite); -void pokemonanimfunc_0F(struct Sprite *sprite); -void pokemonanimfunc_10(struct Sprite *sprite); -void pokemonanimfunc_11(struct Sprite *sprite); -void pokemonanimfunc_12(struct Sprite *sprite); -void pokemonanimfunc_13(struct Sprite *sprite); -void pokemonanimfunc_14(struct Sprite *sprite); -void pokemonanimfunc_15(struct Sprite *sprite); -void pokemonanimfunc_16(struct Sprite *sprite); -void pokemonanimfunc_17(struct Sprite *sprite); -void pokemonanimfunc_18(struct Sprite *sprite); -void pokemonanimfunc_19(struct Sprite *sprite); -void pokemonanimfunc_1A(struct Sprite *sprite); -void pokemonanimfunc_1B(struct Sprite *sprite); -void pokemonanimfunc_1C(struct Sprite *sprite); -void pokemonanimfunc_1D(struct Sprite *sprite); -void pokemonanimfunc_1E(struct Sprite *sprite); -void pokemonanimfunc_1F(struct Sprite *sprite); -void pokemonanimfunc_20(struct Sprite *sprite); -void pokemonanimfunc_21(struct Sprite *sprite); -void pokemonanimfunc_22(struct Sprite *sprite); -void pokemonanimfunc_23(struct Sprite *sprite); -void pokemonanimfunc_24(struct Sprite *sprite); -void pokemonanimfunc_25(struct Sprite *sprite); -void pokemonanimfunc_26(struct Sprite *sprite); -void pokemonanimfunc_27(struct Sprite *sprite); -void pokemonanimfunc_28(struct Sprite *sprite); -void pokemonanimfunc_29(struct Sprite *sprite); -void pokemonanimfunc_2A(struct Sprite *sprite); -void pokemonanimfunc_2B(struct Sprite *sprite); -void pokemonanimfunc_2C(struct Sprite *sprite); -void pokemonanimfunc_2D(struct Sprite *sprite); -void pokemonanimfunc_2E(struct Sprite *sprite); -void pokemonanimfunc_2F(struct Sprite *sprite); -void pokemonanimfunc_30(struct Sprite *sprite); -void pokemonanimfunc_31(struct Sprite *sprite); -void pokemonanimfunc_32(struct Sprite *sprite); -void pokemonanimfunc_33(struct Sprite *sprite); -void pokemonanimfunc_34(struct Sprite *sprite); -void pokemonanimfunc_35(struct Sprite *sprite); -void pokemonanimfunc_36(struct Sprite *sprite); -void pokemonanimfunc_37(struct Sprite *sprite); -void pokemonanimfunc_38(struct Sprite *sprite); -void pokemonanimfunc_39(struct Sprite *sprite); -void pokemonanimfunc_3A(struct Sprite *sprite); -void pokemonanimfunc_3B(struct Sprite *sprite); -void pokemonanimfunc_3C(struct Sprite *sprite); -void pokemonanimfunc_3D(struct Sprite *sprite); -void pokemonanimfunc_3E(struct Sprite *sprite); -void pokemonanimfunc_3F(struct Sprite *sprite); -void pokemonanimfunc_40(struct Sprite *sprite); -void pokemonanimfunc_41(struct Sprite *sprite); -void pokemonanimfunc_42(struct Sprite *sprite); -void pokemonanimfunc_43(struct Sprite *sprite); -void pokemonanimfunc_44(struct Sprite *sprite); -void pokemonanimfunc_45(struct Sprite *sprite); -void pokemonanimfunc_46(struct Sprite *sprite); -void pokemonanimfunc_47(struct Sprite *sprite); -void pokemonanimfunc_48(struct Sprite *sprite); -void pokemonanimfunc_49(struct Sprite *sprite); -void pokemonanimfunc_4A(struct Sprite *sprite); -void pokemonanimfunc_4B(struct Sprite *sprite); -void pokemonanimfunc_4C(struct Sprite *sprite); -void pokemonanimfunc_4D(struct Sprite *sprite); -void pokemonanimfunc_4E(struct Sprite *sprite); -void pokemonanimfunc_4F(struct Sprite *sprite); -void pokemonanimfunc_50(struct Sprite *sprite); -void pokemonanimfunc_51(struct Sprite *sprite); -void pokemonanimfunc_52(struct Sprite *sprite); -void pokemonanimfunc_53(struct Sprite *sprite); -void pokemonanimfunc_54(struct Sprite *sprite); -void pokemonanimfunc_55(struct Sprite *sprite); -void pokemonanimfunc_56(struct Sprite *sprite); -void pokemonanimfunc_57(struct Sprite *sprite); -void pokemonanimfunc_58(struct Sprite *sprite); -void pokemonanimfunc_59(struct Sprite *sprite); -void pokemonanimfunc_5A(struct Sprite *sprite); -void pokemonanimfunc_5B(struct Sprite *sprite); -void pokemonanimfunc_5C(struct Sprite *sprite); -void pokemonanimfunc_5D(struct Sprite *sprite); -void pokemonanimfunc_5E(struct Sprite *sprite); -void pokemonanimfunc_5F(struct Sprite *sprite); -void pokemonanimfunc_60(struct Sprite *sprite); -void pokemonanimfunc_61(struct Sprite *sprite); -void pokemonanimfunc_62(struct Sprite *sprite); -void pokemonanimfunc_63(struct Sprite *sprite); -void pokemonanimfunc_64(struct Sprite *sprite); -void pokemonanimfunc_65(struct Sprite *sprite); -void pokemonanimfunc_66(struct Sprite *sprite); -void pokemonanimfunc_67(struct Sprite *sprite); -void pokemonanimfunc_68(struct Sprite *sprite); -void pokemonanimfunc_69(struct Sprite *sprite); -void pokemonanimfunc_6A(struct Sprite *sprite); -void pokemonanimfunc_6B(struct Sprite *sprite); -void pokemonanimfunc_6C(struct Sprite *sprite); -void pokemonanimfunc_6D(struct Sprite *sprite); -void pokemonanimfunc_6E(struct Sprite *sprite); -void pokemonanimfunc_6F(struct Sprite *sprite); -void pokemonanimfunc_70(struct Sprite *sprite); -void pokemonanimfunc_71(struct Sprite *sprite); -void pokemonanimfunc_72(struct Sprite *sprite); -void pokemonanimfunc_73(struct Sprite *sprite); -void pokemonanimfunc_74(struct Sprite *sprite); -void pokemonanimfunc_75(struct Sprite *sprite); -void pokemonanimfunc_76(struct Sprite *sprite); -void pokemonanimfunc_77(struct Sprite *sprite); -void pokemonanimfunc_78(struct Sprite *sprite); -void pokemonanimfunc_79(struct Sprite *sprite); -void pokemonanimfunc_7A(struct Sprite *sprite); -void pokemonanimfunc_7B(struct Sprite *sprite); -void pokemonanimfunc_7C(struct Sprite *sprite); -void pokemonanimfunc_7D(struct Sprite *sprite); -void pokemonanimfunc_7E(struct Sprite *sprite); -void pokemonanimfunc_7F(struct Sprite *sprite); -void pokemonanimfunc_80(struct Sprite *sprite); -void pokemonanimfunc_81(struct Sprite *sprite); -void pokemonanimfunc_82(struct Sprite *sprite); -void pokemonanimfunc_83(struct Sprite *sprite); -void pokemonanimfunc_84(struct Sprite *sprite); -void pokemonanimfunc_85(struct Sprite *sprite); -void pokemonanimfunc_86(struct Sprite *sprite); -void pokemonanimfunc_87(struct Sprite *sprite); -void pokemonanimfunc_88(struct Sprite *sprite); -void pokemonanimfunc_89(struct Sprite *sprite); -void pokemonanimfunc_8A(struct Sprite *sprite); -void pokemonanimfunc_8B(struct Sprite *sprite); -void pokemonanimfunc_8C(struct Sprite *sprite); -void pokemonanimfunc_8D(struct Sprite *sprite); -void pokemonanimfunc_8E(struct Sprite *sprite); -void pokemonanimfunc_8F(struct Sprite *sprite); -void pokemonanimfunc_90(struct Sprite *sprite); -void pokemonanimfunc_91(struct Sprite *sprite); -void pokemonanimfunc_92(struct Sprite *sprite); -void pokemonanimfunc_93(struct Sprite *sprite); -void pokemonanimfunc_94(struct Sprite *sprite); -void pokemonanimfunc_95(struct Sprite *sprite); -void pokemonanimfunc_96(struct Sprite *sprite); +static void pokemonanimfunc_00(struct Sprite *sprite); +static void pokemonanimfunc_01(struct Sprite *sprite); +static void pokemonanimfunc_02(struct Sprite *sprite); +static void pokemonanimfunc_03(struct Sprite *sprite); +static void pokemonanimfunc_04(struct Sprite *sprite); +static void pokemonanimfunc_05(struct Sprite *sprite); +static void pokemonanimfunc_06(struct Sprite *sprite); +static void pokemonanimfunc_07(struct Sprite *sprite); +static void pokemonanimfunc_08(struct Sprite *sprite); +static void pokemonanimfunc_09(struct Sprite *sprite); +static void pokemonanimfunc_0A(struct Sprite *sprite); +static void pokemonanimfunc_0B(struct Sprite *sprite); +static void pokemonanimfunc_0C(struct Sprite *sprite); +static void pokemonanimfunc_0D(struct Sprite *sprite); +static void pokemonanimfunc_0E(struct Sprite *sprite); +static void pokemonanimfunc_0F(struct Sprite *sprite); +static void pokemonanimfunc_10(struct Sprite *sprite); +static void pokemonanimfunc_11(struct Sprite *sprite); +static void pokemonanimfunc_12(struct Sprite *sprite); +static void pokemonanimfunc_13(struct Sprite *sprite); +static void pokemonanimfunc_14(struct Sprite *sprite); +static void pokemonanimfunc_15(struct Sprite *sprite); +static void pokemonanimfunc_16(struct Sprite *sprite); +static void pokemonanimfunc_17(struct Sprite *sprite); +static void pokemonanimfunc_18(struct Sprite *sprite); +static void pokemonanimfunc_19(struct Sprite *sprite); +static void pokemonanimfunc_1A(struct Sprite *sprite); +static void pokemonanimfunc_1B(struct Sprite *sprite); +static void pokemonanimfunc_1C(struct Sprite *sprite); +static void pokemonanimfunc_1D(struct Sprite *sprite); +static void pokemonanimfunc_1E(struct Sprite *sprite); +static void pokemonanimfunc_1F(struct Sprite *sprite); +static void pokemonanimfunc_20(struct Sprite *sprite); +static void pokemonanimfunc_21(struct Sprite *sprite); +static void pokemonanimfunc_22(struct Sprite *sprite); +static void pokemonanimfunc_23(struct Sprite *sprite); +static void pokemonanimfunc_24(struct Sprite *sprite); +static void pokemonanimfunc_25(struct Sprite *sprite); +static void pokemonanimfunc_26(struct Sprite *sprite); +static void pokemonanimfunc_27(struct Sprite *sprite); +static void pokemonanimfunc_28(struct Sprite *sprite); +static void pokemonanimfunc_29(struct Sprite *sprite); +static void pokemonanimfunc_2A(struct Sprite *sprite); +static void pokemonanimfunc_2B(struct Sprite *sprite); +static void pokemonanimfunc_2C(struct Sprite *sprite); +static void pokemonanimfunc_2D(struct Sprite *sprite); +static void pokemonanimfunc_2E(struct Sprite *sprite); +static void pokemonanimfunc_2F(struct Sprite *sprite); +static void pokemonanimfunc_30(struct Sprite *sprite); +static void pokemonanimfunc_31(struct Sprite *sprite); +static void pokemonanimfunc_32(struct Sprite *sprite); +static void pokemonanimfunc_33(struct Sprite *sprite); +static void pokemonanimfunc_34(struct Sprite *sprite); +static void pokemonanimfunc_35(struct Sprite *sprite); +static void pokemonanimfunc_36(struct Sprite *sprite); +static void pokemonanimfunc_37(struct Sprite *sprite); +static void pokemonanimfunc_38(struct Sprite *sprite); +static void pokemonanimfunc_39(struct Sprite *sprite); +static void pokemonanimfunc_3A(struct Sprite *sprite); +static void pokemonanimfunc_3B(struct Sprite *sprite); +static void pokemonanimfunc_3C(struct Sprite *sprite); +static void pokemonanimfunc_3D(struct Sprite *sprite); +static void pokemonanimfunc_3E(struct Sprite *sprite); +static void pokemonanimfunc_3F(struct Sprite *sprite); +static void pokemonanimfunc_40(struct Sprite *sprite); +static void pokemonanimfunc_41(struct Sprite *sprite); +static void pokemonanimfunc_42(struct Sprite *sprite); +static void pokemonanimfunc_43(struct Sprite *sprite); +static void pokemonanimfunc_44(struct Sprite *sprite); +static void pokemonanimfunc_45(struct Sprite *sprite); +static void pokemonanimfunc_46(struct Sprite *sprite); +static void pokemonanimfunc_47(struct Sprite *sprite); +static void pokemonanimfunc_48(struct Sprite *sprite); +static void pokemonanimfunc_49(struct Sprite *sprite); +static void pokemonanimfunc_4A(struct Sprite *sprite); +static void pokemonanimfunc_4B(struct Sprite *sprite); +static void pokemonanimfunc_4C(struct Sprite *sprite); +static void pokemonanimfunc_4D(struct Sprite *sprite); +static void pokemonanimfunc_4E(struct Sprite *sprite); +static void pokemonanimfunc_4F(struct Sprite *sprite); +static void pokemonanimfunc_50(struct Sprite *sprite); +static void pokemonanimfunc_51(struct Sprite *sprite); +static void pokemonanimfunc_52(struct Sprite *sprite); +static void pokemonanimfunc_53(struct Sprite *sprite); +static void pokemonanimfunc_54(struct Sprite *sprite); +static void pokemonanimfunc_55(struct Sprite *sprite); +static void pokemonanimfunc_56(struct Sprite *sprite); +static void pokemonanimfunc_57(struct Sprite *sprite); +static void pokemonanimfunc_58(struct Sprite *sprite); +static void pokemonanimfunc_59(struct Sprite *sprite); +static void pokemonanimfunc_5A(struct Sprite *sprite); +static void pokemonanimfunc_5B(struct Sprite *sprite); +static void pokemonanimfunc_5C(struct Sprite *sprite); +static void pokemonanimfunc_5D(struct Sprite *sprite); +static void pokemonanimfunc_5E(struct Sprite *sprite); +static void pokemonanimfunc_5F(struct Sprite *sprite); +static void pokemonanimfunc_60(struct Sprite *sprite); +static void pokemonanimfunc_61(struct Sprite *sprite); +static void pokemonanimfunc_62(struct Sprite *sprite); +static void pokemonanimfunc_63(struct Sprite *sprite); +static void pokemonanimfunc_64(struct Sprite *sprite); +static void pokemonanimfunc_65(struct Sprite *sprite); +static void pokemonanimfunc_66(struct Sprite *sprite); +static void pokemonanimfunc_67(struct Sprite *sprite); +static void pokemonanimfunc_68(struct Sprite *sprite); +static void pokemonanimfunc_69(struct Sprite *sprite); +static void pokemonanimfunc_6A(struct Sprite *sprite); +static void pokemonanimfunc_6B(struct Sprite *sprite); +static void pokemonanimfunc_6C(struct Sprite *sprite); +static void pokemonanimfunc_6D(struct Sprite *sprite); +static void pokemonanimfunc_6E(struct Sprite *sprite); +static void pokemonanimfunc_6F(struct Sprite *sprite); +static void pokemonanimfunc_70(struct Sprite *sprite); +static void pokemonanimfunc_71(struct Sprite *sprite); +static void pokemonanimfunc_72(struct Sprite *sprite); +static void pokemonanimfunc_73(struct Sprite *sprite); +static void pokemonanimfunc_74(struct Sprite *sprite); +static void pokemonanimfunc_75(struct Sprite *sprite); +static void pokemonanimfunc_76(struct Sprite *sprite); +static void pokemonanimfunc_77(struct Sprite *sprite); +static void pokemonanimfunc_78(struct Sprite *sprite); +static void pokemonanimfunc_79(struct Sprite *sprite); +static void pokemonanimfunc_7A(struct Sprite *sprite); +static void pokemonanimfunc_7B(struct Sprite *sprite); +static void pokemonanimfunc_7C(struct Sprite *sprite); +static void pokemonanimfunc_7D(struct Sprite *sprite); +static void pokemonanimfunc_7E(struct Sprite *sprite); +static void pokemonanimfunc_7F(struct Sprite *sprite); +static void pokemonanimfunc_80(struct Sprite *sprite); +static void pokemonanimfunc_81(struct Sprite *sprite); +static void pokemonanimfunc_82(struct Sprite *sprite); +static void pokemonanimfunc_83(struct Sprite *sprite); +static void pokemonanimfunc_84(struct Sprite *sprite); +static void pokemonanimfunc_85(struct Sprite *sprite); +static void pokemonanimfunc_86(struct Sprite *sprite); +static void pokemonanimfunc_87(struct Sprite *sprite); +static void pokemonanimfunc_88(struct Sprite *sprite); +static void pokemonanimfunc_89(struct Sprite *sprite); +static void pokemonanimfunc_8A(struct Sprite *sprite); +static void pokemonanimfunc_8B(struct Sprite *sprite); +static void pokemonanimfunc_8C(struct Sprite *sprite); +static void pokemonanimfunc_8D(struct Sprite *sprite); +static void pokemonanimfunc_8E(struct Sprite *sprite); +static void pokemonanimfunc_8F(struct Sprite *sprite); +static void pokemonanimfunc_90(struct Sprite *sprite); +static void pokemonanimfunc_91(struct Sprite *sprite); +static void pokemonanimfunc_92(struct Sprite *sprite); +static void pokemonanimfunc_93(struct Sprite *sprite); +static void pokemonanimfunc_94(struct Sprite *sprite); +static void pokemonanimfunc_95(struct Sprite *sprite); +static void pokemonanimfunc_96(struct Sprite *sprite); -void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite); +static void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite); + +#define STRUCT_COUNT 4 + +// IWRAM bss +static IWRAM_DATA struct UnkAnimStruct sUnknown_03001240[STRUCT_COUNT]; +static IWRAM_DATA u8 sUnknown_03001270; +static IWRAM_DATA bool32 sUnknown_03001274; // const rom data -static const u8 sSpeciesToBackAnimId[] = +static const u8 sSpeciesToBackAnimSet[] = { 0x00, // SPECIES_NONE 0x13, // SPECIES_BULBASAUR @@ -592,7 +596,7 @@ static const u8 sSpeciesToBackAnimId[] = 0x11, // SPECIES_CHIMECHO }; -const u8 gUnknown_0860AA64[][2] = +static const u8 sUnknown_0860AA64[][2] = { {0, 5}, {1, 1}, @@ -610,7 +614,7 @@ const u8 gUnknown_0860AA64[][2] = {0, 0xFF} }; -const u8 gUnknown_0860AA80[][2] = +static const u8 sUnknown_0860AA80[][2] = { {6, 30}, {0xFE, 15}, @@ -773,7 +777,7 @@ static void (* const sMonAnimFunctions[])(struct Sprite *sprite) = pokemonanimfunc_96 }; -// counting from Id 1, because 0 in sSpeciesToBackAnimId is used for mons with no back animation +// counting from Id 1, because 0 in sSpeciesToBackAnimSet is used for mons with no back animation static const u8 sBackAnimationIds[] = { 0x60, 0x5f, 0x02, // 1 @@ -832,30 +836,30 @@ static const u8 sBackAnimNatureModTable[] = 0x01, // NATURE_QUIRKY }; -static const union AffineAnimCmd gSpriteAffineAnim_860AD48[] = +static const union AffineAnimCmd sSpriteAffineAnim_860AD48[] = { - AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(256, 256, 0, 0), AFFINEANIMCMDTYPE_END }; -static const union AffineAnimCmd gSpriteAffineAnim_860AD58[] = +static const union AffineAnimCmd sSpriteAffineAnim_860AD58[] = { - AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-256, 256, 0, 0), AFFINEANIMCMDTYPE_END }; -static const union AffineAnimCmd *const gSpriteAffineAnimTable_860AD68[] = +static const union AffineAnimCmd *const sSpriteAffineAnimTable_860AD68[] = { - gSpriteAffineAnim_860AD48, - gSpriteAffineAnim_860AD58 + sSpriteAffineAnim_860AD48, + sSpriteAffineAnim_860AD58 }; // code -void MonAnimDummySpriteCallback(struct Sprite *sprite) +static void MonAnimDummySpriteCallback(struct Sprite *sprite) { } -void sub_817F3F0(struct Sprite *sprite, s16 index, s16 amplitudeX, s16 amplitudeY) +static void sub_817F3F0(struct Sprite *sprite, u16 index, s16 amplitudeX, s16 amplitudeY) { s16 xAdder, yAdder; @@ -872,38 +876,45 @@ void sub_817F3F0(struct Sprite *sprite, s16 index, s16 amplitudeX, s16 amplitude sprite->pos2.y = yAdder + amplitudeY; } -u8 GetSpeciesBackAnimId(u16 species) +u8 GetSpeciesBackAnimSet(u16 species) { - if (sSpeciesToBackAnimId[species] != 0) - return sSpeciesToBackAnimId[species] - 1; + if (sSpeciesToBackAnimSet[species] != 0) + return sSpeciesToBackAnimSet[species] - 1; else return 0; } -void sub_817F498(u8 taskId) +#define tState data[0] +#define tPtrLO data[1] +#define tPtrHI data[2] +#define tAnimId data[3] +#define tSaved0 data[4] +#define tSaved2 data[5] + +static void Task_HandleMonAnimation(u8 taskId) { u32 i; - struct Sprite *sprite = (struct Sprite*)(u32)((gTasks[taskId].data[1] << 0x10) | (gTasks[taskId].data[2])); + struct Sprite *sprite = (struct Sprite*)(u32)((gTasks[taskId].tPtrLO << 0x10) | (gTasks[taskId].tPtrHI)); - if (gTasks[taskId].data[0] == 0) + if (gTasks[taskId].tState == 0) { - gTasks[taskId].data[4] = sprite->data[0]; - gTasks[taskId].data[5] = sprite->data[2]; + gTasks[taskId].tSaved0 = sprite->data[0]; + gTasks[taskId].tSaved2 = sprite->data[2]; sprite->data[1] = 1; sprite->data[0] = 0; for (i = 2; i < 8; i++) sprite->data[i] = 0; - sprite->callback = sMonAnimFunctions[gTasks[taskId].data[3]]; - gUnknown_03001274 = FALSE; + sprite->callback = sMonAnimFunctions[gTasks[taskId].tAnimId]; + sUnknown_03001274 = FALSE; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } if (sprite->callback == SpriteCallbackDummy) { - sprite->data[0] = gTasks[taskId].data[4]; - sprite->data[2] = gTasks[taskId].data[5]; + sprite->data[0] = gTasks[taskId].tSaved0; + sprite->data[2] = gTasks[taskId].tSaved2; sprite->data[1] = 0; DestroyTask(taskId); @@ -912,39 +923,46 @@ void sub_817F498(u8 taskId) void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId) { - u8 taskId = CreateTask(sub_817F498, 128); - gTasks[taskId].data[1] = (u32)(sprite) >> 0x10; - gTasks[taskId].data[2] = (u32)(sprite); - gTasks[taskId].data[3] = frontAnimId; + u8 taskId = CreateTask(Task_HandleMonAnimation, 128); + gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10; + gTasks[taskId].tPtrHI = (u32)(sprite); + gTasks[taskId].tAnimId = frontAnimId; } -void sub_817F578(struct Sprite *sprite, u8 frontAnimId) +void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId) { - gUnknown_03001274 = TRUE; + sUnknown_03001274 = TRUE; sprite->callback = sMonAnimFunctions[frontAnimId]; } -void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimId) +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet) { u8 nature, taskId, animId, bank; - taskId = CreateTask(sub_817F498, 128); - gTasks[taskId].data[1] = (u32)(sprite) >> 0x10; - gTasks[taskId].data[2] = (u32)(sprite); + taskId = CreateTask(Task_HandleMonAnimation, 128); + gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10; + gTasks[taskId].tPtrHI = (u32)(sprite); bank = sprite->data[0]; nature = GetNature(&gPlayerParty[gBattlePartyID[bank]]); - animId = 3 * backAnimId + sBackAnimNatureModTable[nature]; - gTasks[taskId].data[3] = sBackAnimationIds[animId]; + animId = 3 * backAnimSet + sBackAnimNatureModTable[nature]; + gTasks[taskId].tAnimId = sBackAnimationIds[animId]; } -void sub_817F60C(struct Sprite *sprite) +#undef tState +#undef tPtrLO +#undef tPtrHI +#undef tAnimId +#undef tSaved0 +#undef tSaved2 + +void SetSpriteCB_MonAnimDummy(struct Sprite *sprite) { sprite->callback = MonAnimDummySpriteCallback; } -void SetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +static void SetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) { u8 matrixNum; struct ObjAffineSrcData affineSrcData; @@ -963,12 +981,12 @@ void SetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) gOamMatrices[matrixNum].d = dest.d; } -void HandleStartAffineAnim(struct Sprite *sprite) +static void HandleStartAffineAnim(struct Sprite *sprite) { sprite->oam.affineMode = 3; - sprite->affineAnims = gSpriteAffineAnimTable_860AD68; + sprite->affineAnims = sSpriteAffineAnimTable_860AD68; - if (gUnknown_03001274 == TRUE) + if (sUnknown_03001274 == TRUE) InitSpriteAffineAnim(sprite); if (!sprite->data[1]) @@ -980,7 +998,7 @@ void HandleStartAffineAnim(struct Sprite *sprite) sprite->affineAnimPaused = 1; } -void HandleSetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +static void HandleSetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) { if (!sprite->data[1]) { @@ -991,42 +1009,42 @@ void HandleSetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rota SetAffineData(sprite, xScale, yScale, rotation); } -void sub_817F70C(struct Sprite *sprite) +static void sub_817F70C(struct Sprite *sprite) { if (!sprite->data[1]) sprite->pos2.x *= -1; } -bool32 sub_817F724(u8 id) +static bool32 sub_817F724(u8 id) { - if (id >= 4) + if (id >= STRUCT_COUNT) { return FALSE; } else { - gUnknown_03001240[id].field_6 = 0; - gUnknown_03001240[id].field_0 = 0; - gUnknown_03001240[id].field_4 = 1; - gUnknown_03001240[id].field_2 = 0; - gUnknown_03001240[id].field_8 = 0; + sUnknown_03001240[id].field_6 = 0; + sUnknown_03001240[id].field_0 = 0; + sUnknown_03001240[id].field_4 = 1; + sUnknown_03001240[id].field_2 = 0; + sUnknown_03001240[id].field_8 = 0; return TRUE; } } -u8 sub_817F758(void) +static u8 sub_817F758(void) { - gUnknown_03001270 = (gUnknown_03001270 + 1) % 4; - sub_817F724(gUnknown_03001270); - return gUnknown_03001270; + sUnknown_03001270 = (sUnknown_03001270 + 1) % STRUCT_COUNT; + sub_817F724(sUnknown_03001270); + return sUnknown_03001270; } -void sub_817F77C(struct Sprite *sprite) +static void sub_817F77C(struct Sprite *sprite) { sprite->oam.affineMode = 1; CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); - if (gUnknown_03001274 == TRUE) + if (sUnknown_03001274 == TRUE) { if (!sprite->data[1]) sprite->hFlip = 1; @@ -1039,14 +1057,14 @@ void sub_817F77C(struct Sprite *sprite) } } -void pokemonanimfunc_01(struct Sprite *sprite) +static void pokemonanimfunc_01(struct Sprite *sprite) { if (sprite->data[2] == 0) HandleStartAffineAnim(sprite); if (sprite->data[2] > 40) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -1062,7 +1080,7 @@ void pokemonanimfunc_01(struct Sprite *sprite) sprite->data[2]++; } -void pokemonanimfunc_02(struct Sprite *sprite) +static void pokemonanimfunc_02(struct Sprite *sprite) { if (sprite->data[2] > 40) { @@ -1083,7 +1101,7 @@ void pokemonanimfunc_02(struct Sprite *sprite) sprite->data[2]++; } -void sub_817F8FC(struct Sprite *sprite) +static void sub_817F8FC(struct Sprite *sprite) { sub_817F70C(sprite); @@ -1101,14 +1119,14 @@ void sub_817F8FC(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_03(struct Sprite *sprite) +static void pokemonanimfunc_03(struct Sprite *sprite) { sprite->data[0] = 40; sub_817F8FC(sprite); sprite->callback = sub_817F8FC; } -void sub_817F978(struct Sprite *sprite) +static void sub_817F978(struct Sprite *sprite) { sub_817F70C(sprite); @@ -1126,7 +1144,7 @@ void sub_817F978(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_04(struct Sprite *sprite) +static void pokemonanimfunc_04(struct Sprite *sprite) { sprite->data[0] = 40; sub_817F978(sprite); @@ -1134,7 +1152,7 @@ void pokemonanimfunc_04(struct Sprite *sprite) } #ifdef NONMATCHING -void sub_817F9F4(struct Sprite *sprite) +static void sub_817F9F4(struct Sprite *sprite) { s32 counter = sprite->data[2]; @@ -1166,7 +1184,7 @@ void sub_817F9F4(struct Sprite *sprite) #else __attribute__((naked)) -void sub_817F9F4(struct Sprite *sprite) +static void sub_817F9F4(struct Sprite *sprite) { asm(".syntax unified\n\ push {r4,lr}\n\ @@ -1235,14 +1253,14 @@ _0817FA60:\n\ #endif // NONMATCHING -void pokemonanimfunc_1E(struct Sprite *sprite) +static void pokemonanimfunc_1E(struct Sprite *sprite) { sprite->data[0] = 4; sub_817F9F4(sprite); sprite->callback = sub_817F9F4; } -void pokemonanimfunc_06(struct Sprite *sprite) +static void pokemonanimfunc_06(struct Sprite *sprite) { s32 counter = sprite->data[2]; @@ -1282,14 +1300,14 @@ void pokemonanimfunc_06(struct Sprite *sprite) sprite->data[2] += 12; } -void pokemonanimfunc_09(struct Sprite *sprite) +static void pokemonanimfunc_09(struct Sprite *sprite) { if (sprite->data[2] == 0) HandleStartAffineAnim(sprite); if (sprite->data[2] > 40) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -1314,7 +1332,7 @@ void pokemonanimfunc_09(struct Sprite *sprite) sprite->data[2]++; } -static const s8 gUnknown_0860AD70[][3] = +static const s8 sUnknown_0860AD70[][3] = { {-1, -1, 6}, {2, 0, 6}, @@ -1328,16 +1346,16 @@ static const s8 gUnknown_0860AD70[][3] = {0, 0, 0}, }; -void sub_817FC20(struct Sprite *sprite) +static void sub_817FC20(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) sprite->data[3] = 0; - if (gUnknown_0860AD70[sprite->data[3]][2] == sprite->data[2]) + if (sUnknown_0860AD70[sprite->data[3]][2] == sprite->data[2]) { - if (gUnknown_0860AD70[sprite->data[3]][2] == 0) + if (sUnknown_0860AD70[sprite->data[3]][2] == 0) { sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -1348,26 +1366,26 @@ void sub_817FC20(struct Sprite *sprite) } } - if (gUnknown_0860AD70[sprite->data[3]][2] == 0) + if (sUnknown_0860AD70[sprite->data[3]][2] == 0) { sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { - sprite->pos2.x += gUnknown_0860AD70[sprite->data[3]][0]; - sprite->pos2.y += gUnknown_0860AD70[sprite->data[3]][1]; + sprite->pos2.x += sUnknown_0860AD70[sprite->data[3]][0]; + sprite->pos2.y += sUnknown_0860AD70[sprite->data[3]][1]; sprite->data[2]++; sub_817F70C(sprite); } } -void pokemonanimfunc_0A(struct Sprite *sprite) +static void pokemonanimfunc_0A(struct Sprite *sprite) { sub_817FC20(sprite); sprite->callback = sub_817FC20; } -void sub_817FCDC(struct Sprite *sprite) +static void sub_817FCDC(struct Sprite *sprite) { s32 counter = sprite->data[2]; @@ -1384,7 +1402,7 @@ void sub_817FCDC(struct Sprite *sprite) sprite->data[2] += sprite->data[0]; } -void pokemonanimfunc_0F(struct Sprite *sprite) +static void pokemonanimfunc_0F(struct Sprite *sprite) { sprite->data[0] = 60; sprite->data[7] = 3; @@ -1392,7 +1410,7 @@ void pokemonanimfunc_0F(struct Sprite *sprite) sprite->callback = sub_817FCDC; } -void sub_817FD44(struct Sprite *sprite) +static void sub_817FD44(struct Sprite *sprite) { s32 counter = sprite->data[2]; @@ -1409,14 +1427,14 @@ void sub_817FD44(struct Sprite *sprite) sprite->data[2] += sprite->data[0]; } -void pokemonanimfunc_10(struct Sprite *sprite) +static void pokemonanimfunc_10(struct Sprite *sprite) { sprite->data[0] = 60; sub_817FD44(sprite); sprite->callback = sub_817FD44; } -void pokemonanimfunc_11(struct Sprite *sprite) +static void pokemonanimfunc_11(struct Sprite *sprite) { if (sprite->data[2] > 512) { @@ -1444,30 +1462,30 @@ void pokemonanimfunc_11(struct Sprite *sprite) sprite->data[2] += 9; } -void sub_817FE30(struct Sprite *sprite) +static void sub_817FE30(struct Sprite *sprite) { s16 id = sprite->data[0]; - if (gUnknown_03001240[id].field_0 != 0) + if (sUnknown_03001240[id].field_0 != 0) { - gUnknown_03001240[id].field_0--; + sUnknown_03001240[id].field_0--; } else { - if (sprite->data[2] == 0 && gUnknown_03001240[id].field_8 == 0) + if (sprite->data[2] == 0 && sUnknown_03001240[id].field_8 == 0) { HandleStartAffineAnim(sprite); - gUnknown_03001240[id].field_8++; + sUnknown_03001240[id].field_8++; } - if (sprite->data[2] > gUnknown_03001240[id].field_6) + if (sprite->data[2] > sUnknown_03001240[id].field_6) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); - if (gUnknown_03001240[id].field_4 > 1) + if (sUnknown_03001240[id].field_4 > 1) { - gUnknown_03001240[id].field_4--; - gUnknown_03001240[id].field_0 = 10; + sUnknown_03001240[id].field_4--; + sUnknown_03001240[id].field_0 = 10; sprite->data[2] = 0; } else @@ -1479,62 +1497,62 @@ void sub_817FE30(struct Sprite *sprite) else { sprite->data[6] = Sin(sprite->data[2] % 256, 4096); - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6]); + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); } sprite->data[2] += 16; } } -void pokemonanimfunc_12(struct Sprite *sprite) +static void pokemonanimfunc_12(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 512; - gUnknown_03001240[id].field_0 = 0; + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_0 = 0; sub_817FE30(sprite); sprite->callback = sub_817FE30; } -void sub_817FF3C(struct Sprite *sprite) +static void sub_817FF3C(struct Sprite *sprite) { u8 id = sprite->data[0]; if (sprite->data[2] == 0) HandleStartAffineAnim(sprite); - if (sprite->data[2] > gUnknown_03001240[id].field_0) + if (sprite->data[2] > sUnknown_03001240[id].field_0) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { - sprite->data[6] = (65536 / gUnknown_03001240[id].field_8) * sprite->data[2]; - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6]); + sprite->data[6] = (65536 / sUnknown_03001240[id].field_8) * sprite->data[2]; + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); } sprite->data[2]++; } -void pokemonanimfunc_1F(struct Sprite *sprite) +static void pokemonanimfunc_1F(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_0 = 60; - gUnknown_03001240[id].field_8 = 20; + sUnknown_03001240[id].field_0 = 60; + sUnknown_03001240[id].field_8 = 20; sub_817FF3C(sprite); sprite->callback = sub_817FF3C; } -void sub_817FFF0(struct Sprite *sprite) +static void sub_817FFF0(struct Sprite *sprite) { u8 id = sprite->data[0]; sub_817F70C(sprite); - if (sprite->data[2] > gUnknown_03001240[id].field_6) + if (sprite->data[2] > sUnknown_03001240[id].field_6) { sprite->pos2.x = 0; sprite->pos2.y = 0; @@ -1544,26 +1562,26 @@ void sub_817FFF0(struct Sprite *sprite) { s16 index = (sprite->data[2] + 192) % 256; - sprite->pos2.x = -(Cos(index, gUnknown_03001240[id].field_8 * 2)); - sprite->pos2.y = Sin(index, gUnknown_03001240[id].field_8) + gUnknown_03001240[id].field_8; + sprite->pos2.x = -(Cos(index, sUnknown_03001240[id].field_8 * 2)); + sprite->pos2.y = Sin(index, sUnknown_03001240[id].field_8) + sUnknown_03001240[id].field_8; } - sprite->data[2] += gUnknown_03001240[id].field_2; + sprite->data[2] += sUnknown_03001240[id].field_2; sub_817F70C(sprite); } -void pokemonanimfunc_14(struct Sprite *sprite) +static void pokemonanimfunc_14(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 512; - gUnknown_03001240[id].field_8 = 6; - gUnknown_03001240[id].field_2 = 24; + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_8 = 6; + sUnknown_03001240[id].field_2 = 24; sub_817FFF0(sprite); sprite->callback = sub_817FFF0; } -void pokemonanimfunc_15(struct Sprite *sprite) +static void pokemonanimfunc_15(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -1582,7 +1600,7 @@ void pokemonanimfunc_15(struct Sprite *sprite) sprite->data[2]++; } -void pokemonanimfunc_16(struct Sprite *sprite) +static void pokemonanimfunc_16(struct Sprite *sprite) { s16 index1 = 0, index2 = 0; @@ -1591,7 +1609,7 @@ void pokemonanimfunc_16(struct Sprite *sprite) if (sprite->data[2] > 40) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -1617,7 +1635,7 @@ void pokemonanimfunc_16(struct Sprite *sprite) sprite->data[2]++; } -void pokemonanimfunc_17(struct Sprite *sprite) +static void pokemonanimfunc_17(struct Sprite *sprite) { s16 posY = 0, index1 = 0, index2 = 0; @@ -1626,7 +1644,7 @@ void pokemonanimfunc_17(struct Sprite *sprite) if (sprite->data[2] > 40) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; sprite->pos2.y = posY; @@ -1658,12 +1676,12 @@ void pokemonanimfunc_17(struct Sprite *sprite) sprite->data[2]++; } -void sub_818031C(struct Sprite *sprite) +static void sub_818031C(struct Sprite *sprite) { u8 index = sprite->data[2]; u8 var7 = sprite->data[6]; - u8 var5 = gUnknown_0860AA80[sprite->data[5]][0]; - u8 var6 = gUnknown_0860AA80[sprite->data[5]][1]; + u8 var5 = sUnknown_0860AA80[sprite->data[5]][0]; + u8 var6 = sUnknown_0860AA80[sprite->data[5]][1]; u8 amplitude = 0; if (var5 != 0xFE) @@ -1693,14 +1711,14 @@ void sub_818031C(struct Sprite *sprite) } } -void pokemonanimfunc_19(struct Sprite *sprite) +static void pokemonanimfunc_19(struct Sprite *sprite) { sprite->data[0] = 48; sub_818031C(sprite); sprite->callback = sub_818031C; } -void pokemonanimfunc_1A(struct Sprite *sprite) +static void pokemonanimfunc_1A(struct Sprite *sprite) { u8 counter = 0; @@ -1712,7 +1730,7 @@ void pokemonanimfunc_1A(struct Sprite *sprite) if (sprite->data[2] > 35) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; sprite->pos2.x = 0; @@ -1722,25 +1740,25 @@ void pokemonanimfunc_1A(struct Sprite *sprite) s16 index = ((counter - 10) * 128) / 20; if (counter < 10) - HandleSetAffineData(sprite, 0x100, 0x100, counter / 2 * 512); + HandleSetAffineData(sprite, 256, 256, counter / 2 * 512); else if (counter >= 10 && counter <= 29) sprite->pos2.x = -(Sin(index, 5)); else - HandleSetAffineData(sprite, 0x100, 0x100, (35 - counter) / 2 * 1024); + HandleSetAffineData(sprite, 256, 256, (35 - counter) / 2 * 1024); } sprite->data[2]++; sub_817F70C(sprite); } -void pokemonanimfunc_1B(struct Sprite *sprite) +static void pokemonanimfunc_1B(struct Sprite *sprite) { if (sprite->data[2] == 0) HandleStartAffineAnim(sprite); if (sprite->data[2] > 100) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1749,13 +1767,13 @@ void pokemonanimfunc_1B(struct Sprite *sprite) { s16 index = (sprite->data[2] * 256) / 100; sprite->pos2.y = Sin(index, 10); - HandleSetAffineData(sprite, 0x100, 0x100, Sin(index, 3276)); + HandleSetAffineData(sprite, 256, 256, Sin(index, 3276)); } sprite->data[2]++; } -void sub_81804F8(struct Sprite *sprite) +static void sub_81804F8(struct Sprite *sprite) { s32 var = 0; s16 index = 0; @@ -1765,7 +1783,7 @@ void sub_81804F8(struct Sprite *sprite) if (sprite->data[2] > 100) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1776,20 +1794,20 @@ void sub_81804F8(struct Sprite *sprite) var = (sprite->data[2] * 512) / 100; var &= 0xFF; sprite->pos2.y = Sin(index, sprite->data[0]); - HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); } sprite->data[2]++; } -void pokemonanimfunc_1C(struct Sprite *sprite) +static void pokemonanimfunc_1C(struct Sprite *sprite) { sprite->data[0] = 10; sub_81804F8(sprite); sprite->callback = sub_81804F8; } -void sub_81805B0(struct Sprite *sprite) +static void sub_81805B0(struct Sprite *sprite) { s32 var = 0; s16 index = 0; @@ -1799,7 +1817,7 @@ void sub_81805B0(struct Sprite *sprite) if (sprite->data[2] > 100) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1810,20 +1828,20 @@ void sub_81805B0(struct Sprite *sprite) var = (sprite->data[2] * 512) / 100; var &= 0xFF; sprite->pos2.y = -(Sin(index / 2, sprite->data[0] * 2)); - HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); } sprite->data[2]++; } -void pokemonanimfunc_18(struct Sprite *sprite) +static void pokemonanimfunc_18(struct Sprite *sprite) { sprite->data[0] = 5; sub_81805B0(sprite); sprite->callback = sub_81805B0; } -void pokemonanimfunc_1D(struct Sprite *sprite) +static void pokemonanimfunc_1D(struct Sprite *sprite) { s32 var; s16 index = 0; @@ -1836,7 +1854,7 @@ void pokemonanimfunc_1D(struct Sprite *sprite) if (sprite->data[2] > 100) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.x = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1849,14 +1867,14 @@ void pokemonanimfunc_1D(struct Sprite *sprite) var = (sprite->data[2] * 512) / toDiv; var &= 0xFF; sprite->pos2.x = Sin(index, 8); - HandleSetAffineData(sprite, 0x100, 0x100, Sin(var, 3276)); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); } sprite->data[2]++; sub_817F70C(sprite); } -void sub_8180714(struct Sprite *sprite) +static void sub_8180714(struct Sprite *sprite) { s16 posY = 0; @@ -1870,7 +1888,7 @@ void sub_8180714(struct Sprite *sprite) if (sprite->data[2] > sprite->data[0] * 3) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1885,7 +1903,7 @@ void sub_8180714(struct Sprite *sprite) posY = (256 - yScale) / 8; sprite->pos2.y = -(Sin(sprite->data[3], 10)) - posY; - HandleSetAffineData(sprite, 0x100 - Sin(sprite->data[4], 32), yScale, 0); + HandleSetAffineData(sprite, 256 - Sin(sprite->data[4], 32), yScale, 0); sprite->data[2]++; sprite->data[4] = (sprite->data[4] + 128 / sprite->data[0]) & 0xFF; } @@ -1893,20 +1911,20 @@ void sub_8180714(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_00(struct Sprite *sprite) +static void pokemonanimfunc_00(struct Sprite *sprite) { sprite->data[0] = 16; sub_8180714(sprite); sprite->callback = sub_8180714; } -void sub_8180828(struct Sprite *sprite) +static 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); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -1925,7 +1943,7 @@ void sub_8180828(struct Sprite *sprite) } } -void pokemonanimfunc_13(struct Sprite *sprite) +static void pokemonanimfunc_13(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -1937,7 +1955,7 @@ void pokemonanimfunc_13(struct Sprite *sprite) sub_8180828(sprite); } -static const s8 gUnknown_0860AD8E[][8][3] = +static const s8 sUnknown_0860AD8E[][8][3] = { { {0, 8, 8}, @@ -1961,7 +1979,7 @@ static const s8 gUnknown_0860AD8E[][8][3] = }, }; -void sub_8180900(struct Sprite *sprite) +static void sub_8180900(struct Sprite *sprite) { s16 var; u8 structId; @@ -1972,10 +1990,10 @@ void sub_8180900(struct Sprite *sprite) 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; + var = sUnknown_03001240[structId].field_6; + r9 = sUnknown_0860AD8E[sUnknown_03001240[structId].field_8][sprite->data[4]][0]; + r10 = sUnknown_0860AD8E[sUnknown_03001240[structId].field_8][sprite->data[4]][1] - r9; + arrId = sUnknown_03001240[structId].field_8; r7 = sprite->data[3]; if (sprite->data[2] == 0) @@ -1984,9 +2002,9 @@ void sub_8180900(struct Sprite *sprite) sprite->data[2]++; } - if (gUnknown_0860AD8E[arrId][sprite->data[4]][2] == 0) + if (sUnknown_0860AD8E[arrId][sprite->data[4]][2] == 0) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.x = 0; sprite->pos2.y = 0; sub_817F77C(sprite); @@ -1996,13 +2014,13 @@ void sub_8180900(struct Sprite *sprite) { 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; + sprite->pos2.y = -(Sin(r7 * 128 / sUnknown_0860AD8E[arrId][sprite->data[4]][2], 10)); + sprite->pos2.x = (r10 * r7 / sUnknown_0860AD8E[arrId][sprite->data[4]][2]) + r9; rotation = -(var * sprite->pos2.x) / 8; - HandleSetAffineData(sprite, 0x100, 0x100, rotation); + HandleSetAffineData(sprite, 256, 256, rotation); - if (r7 == gUnknown_0860AD8E[arrId][sprite->data[4]][2]) + if (r7 == sUnknown_0860AD8E[arrId][sprite->data[4]][2]) { sprite->data[4]++; sprite->data[3] = 0; @@ -2016,16 +2034,16 @@ void sub_8180900(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_05(struct Sprite *sprite) +static 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]; + sUnknown_03001240[id].field_6 = 4096; + sUnknown_03001240[id].field_8 = sprite->data[6]; sub_8180900(sprite); sprite->callback = sub_8180900; } -void pokemonanimfunc_20(struct Sprite *sprite) +static void pokemonanimfunc_20(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -2044,7 +2062,7 @@ void pokemonanimfunc_20(struct Sprite *sprite) sprite->data[2] += 2; } -void pokemonanimfunc_21(struct Sprite *sprite) +static void pokemonanimfunc_21(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -2063,7 +2081,7 @@ void pokemonanimfunc_21(struct Sprite *sprite) sprite->data[2] += 2; } -void pokemonanimfunc_22(struct Sprite *sprite) +static void pokemonanimfunc_22(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -2082,7 +2100,7 @@ void pokemonanimfunc_22(struct Sprite *sprite) sprite->data[2] += 2; } -void pokemonanimfunc_23(struct Sprite *sprite) +static void pokemonanimfunc_23(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -2101,7 +2119,7 @@ void pokemonanimfunc_23(struct Sprite *sprite) sprite->data[2] += 2; } -void pokemonanimfunc_24(struct Sprite *sprite) +static void pokemonanimfunc_24(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; @@ -2120,19 +2138,19 @@ void pokemonanimfunc_24(struct Sprite *sprite) 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); +static void sub_8180CB4(struct Sprite *sprite); +static void sub_8180CE8(struct Sprite *sprite); +static void sub_8180D44(struct Sprite *sprite); +static void sub_8180DC0(struct Sprite *sprite); +static void sub_8180E28(struct Sprite *sprite); -void pokemonanimfunc_25(struct Sprite *sprite) +static void pokemonanimfunc_25(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->callback = sub_8180CB4; } -void sub_8180CB4(struct Sprite *sprite) +static void sub_8180CB4(struct Sprite *sprite) { sub_817F70C(sprite); if (++sprite->pos2.x > 7) @@ -2144,7 +2162,7 @@ void sub_8180CB4(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180CE8(struct Sprite *sprite) +static void sub_8180CE8(struct Sprite *sprite) { sub_817F70C(sprite); @@ -2172,7 +2190,7 @@ void sub_8180CE8(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180D44(struct Sprite *sprite) +static void sub_8180D44(struct Sprite *sprite) { u8 rotation; @@ -2184,7 +2202,7 @@ void sub_8180D44(struct Sprite *sprite) if (++sprite->data[5] > sprite->data[6]) sprite->data[5] = sprite->data[6]; - HandleSetAffineData(sprite, 0x100, 0x100, rotation * 256); + HandleSetAffineData(sprite, 256, 256, rotation * 256); if (sprite->pos2.x < -8) { @@ -2198,7 +2216,7 @@ void sub_8180D44(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180DC0(struct Sprite *sprite) +static void sub_8180DC0(struct Sprite *sprite) { sub_817F70C(sprite); @@ -2208,7 +2226,7 @@ void sub_8180DC0(struct Sprite *sprite) if (sprite->data[2] < 0) sprite->data[2] = 0; - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[2] << 8); + HandleSetAffineData(sprite, 256, 256, sprite->data[2] << 8); if (sprite->data[2] == 0) sprite->callback = sub_8180E28; } @@ -2222,7 +2240,7 @@ void sub_8180DC0(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180E28(struct Sprite *sprite) +static void sub_8180E28(struct Sprite *sprite) { sub_817F70C(sprite); @@ -2237,18 +2255,18 @@ void sub_8180E28(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180E78(struct Sprite *sprite); -void sub_8180ED0(struct Sprite *sprite); -void sub_8180F2C(struct Sprite *sprite); +static void sub_8180E78(struct Sprite *sprite); +static void sub_8180ED0(struct Sprite *sprite); +static void sub_8180F2C(struct Sprite *sprite); -void pokemonanimfunc_26(struct Sprite *sprite) +static void pokemonanimfunc_26(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->data[3] = 0; sprite->callback = sub_8180E78; } -void sub_8180E78(struct Sprite *sprite) +static void sub_8180E78(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x++; @@ -2267,7 +2285,7 @@ void sub_8180E78(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180ED0(struct Sprite *sprite) +static void sub_8180ED0(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x = Cos(sprite->data[4], 16) - 8; @@ -2286,7 +2304,7 @@ void sub_8180ED0(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8180F2C(struct Sprite *sprite) +static void sub_8180F2C(struct Sprite *sprite) { sub_817F70C(sprite); @@ -2302,7 +2320,7 @@ void sub_8180F2C(struct Sprite *sprite) sprite->pos2.y = -(Sin(sprite->data[2], 5)) + 4; sprite->data[2] -= 4; rotation = sprite->data[2] - 32; - HandleSetAffineData(sprite, 0x100, 0x100, rotation * 512); + HandleSetAffineData(sprite, 256, 256, rotation * 512); if (sprite->data[2] <= 32) { @@ -2316,7 +2334,7 @@ void sub_8180F2C(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_27(struct Sprite *sprite) +static void pokemonanimfunc_27(struct Sprite *sprite) { if (sprite->data[3] > 0) { @@ -2335,17 +2353,17 @@ void pokemonanimfunc_27(struct Sprite *sprite) } } -void sub_8181024(struct Sprite *sprite); -void sub_8181068(struct Sprite *sprite); -void sub_81810C4(struct Sprite *sprite); +static void sub_8181024(struct Sprite *sprite); +static void sub_8181068(struct Sprite *sprite); +static void sub_81810C4(struct Sprite *sprite); -void pokemonanimfunc_28(struct Sprite *sprite) +static void pokemonanimfunc_28(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->callback = sub_8181024; } -void sub_8181024(struct Sprite *sprite) +static void sub_8181024(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x--; @@ -2362,7 +2380,7 @@ void sub_8181024(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181068(struct Sprite *sprite) +static void sub_8181068(struct Sprite *sprite) { u32 rotation; @@ -2371,7 +2389,7 @@ void sub_8181068(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256, 256, rotation * 512); if (sprite->data[2] <= 32) sprite->callback = sub_81810C4; @@ -2379,7 +2397,7 @@ void sub_8181068(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_81810C4(struct Sprite *sprite) +static void sub_81810C4(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x--; @@ -2394,17 +2412,17 @@ void sub_81810C4(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181110(struct Sprite *sprite); -void sub_8181144(struct Sprite *sprite); -void sub_81811A4(struct Sprite *sprite); +static void sub_8181110(struct Sprite *sprite); +static void sub_8181144(struct Sprite *sprite); +static void sub_81811A4(struct Sprite *sprite); -void pokemonanimfunc_29(struct Sprite *sprite) +static void pokemonanimfunc_29(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->callback = sub_8181110; } -void sub_8181110(struct Sprite *sprite) +static void sub_8181110(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x++; @@ -2419,7 +2437,7 @@ void sub_8181110(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181144(struct Sprite *sprite) +static void sub_8181144(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[2] += 16; @@ -2437,11 +2455,11 @@ void sub_8181144(struct Sprite *sprite) sprite->pos2.y += 2; } - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[2] << 8); + HandleSetAffineData(sprite, 256, 256, sprite->data[2] << 8); sub_817F70C(sprite); } -void sub_81811A4(struct Sprite *sprite) +static void sub_81811A4(struct Sprite *sprite) { sub_817F70C(sprite); sprite->pos2.x++; @@ -2458,21 +2476,21 @@ void sub_81811A4(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181214(struct Sprite *sprite); +static void sub_8181214(struct Sprite *sprite); -void pokemonanimfunc_2A(struct Sprite *sprite) +static void pokemonanimfunc_2A(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_2 = 2; + sUnknown_03001240[id].field_2 = 2; sub_8181214(sprite); sprite->callback = sub_8181214; } -void sub_8181214(struct Sprite *sprite) +static void sub_8181214(struct Sprite *sprite) { - if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) { - gUnknown_03001240[sprite->data[0]].field_0--; + sUnknown_03001240[sprite->data[0]].field_0--; } else { @@ -2481,7 +2499,7 @@ void sub_8181214(struct Sprite *sprite) { sprite->data[2]++; HandleStartAffineAnim(sprite); - sprite->data[7] = gUnknown_03001240[sprite->data[0]].field_2; + sprite->data[7] = sUnknown_03001240[sprite->data[0]].field_2; sprite->data[3] = -1; sprite->data[4] = -1; sprite->data[5] = 0; @@ -2508,12 +2526,12 @@ void sub_8181214(struct Sprite *sprite) { sprite->pos2.x = 0; sprite->pos2.y = 0; - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_4--; sprite->data[5] = 0; sprite->data[6] = 0; - gUnknown_03001240[sprite->data[0]].field_0 = 10; + sUnknown_03001240[sprite->data[0]].field_0 = 10; } else { @@ -2522,14 +2540,14 @@ void sub_8181214(struct Sprite *sprite) } } - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[6] << 8); + HandleSetAffineData(sprite, 256, 256, sprite->data[6] << 8); sub_817F70C(sprite); } } -void sub_8181370(struct Sprite *sprite); +static void sub_8181370(struct Sprite *sprite); -void pokemonanimfunc_2B(struct Sprite *sprite) +static void pokemonanimfunc_2B(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->data[6] = 0; @@ -2537,7 +2555,7 @@ void pokemonanimfunc_2B(struct Sprite *sprite) sprite->callback = sub_8181370; } -void sub_8181370(struct Sprite *sprite) +static void sub_8181370(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[6] += 4; @@ -2545,12 +2563,12 @@ void sub_8181370(struct Sprite *sprite) sprite->pos2.y = -(Sin((sprite->data[6] * 2) & 0xFF, 8)); if (sprite->data[6] > 192 && sprite->data[7] == 1) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->data[7]++; } else if (sprite->data[6] > 64 && sprite->data[7] == 0) { - HandleSetAffineData(sprite, -0x100, 0x100, 0); + HandleSetAffineData(sprite, -256, 256, 0); sprite->data[7]++; } @@ -2558,14 +2576,14 @@ void sub_8181370(struct Sprite *sprite) { sprite->pos2.x = 0; sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } sub_817F70C(sprite); } -void pokemonanimfunc_2C(struct Sprite *sprite) +static void pokemonanimfunc_2C(struct Sprite *sprite) { if (++sprite->data[2] == 1) { @@ -2575,7 +2593,7 @@ void pokemonanimfunc_2C(struct Sprite *sprite) sprite->data[4] = 0; } - if (gUnknown_0860AA64[sprite->data[6]][1] == 0xFF) + if (sUnknown_0860AA64[sprite->data[6]][1] == 0xFF) { sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -2583,7 +2601,7 @@ void pokemonanimfunc_2C(struct Sprite *sprite) { if (sprite->data[4] == 1) { - if (gUnknown_0860AA64[sprite->data[6]][0] != 0) + if (sUnknown_0860AA64[sprite->data[6]][0] != 0) BlendPalette(sprite->data[7], 0x10, 0x10, 0x3FF); else BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); @@ -2591,7 +2609,7 @@ void pokemonanimfunc_2C(struct Sprite *sprite) sprite->data[4] = 0; } - if (gUnknown_0860AA64[sprite->data[6]][1] == sprite->data[5]) + if (sUnknown_0860AA64[sprite->data[6]][1] == sprite->data[5]) { sprite->data[4] = 1; sprite->data[5] = 0; @@ -2604,19 +2622,19 @@ void pokemonanimfunc_2C(struct Sprite *sprite) } } -void sub_81814D4(struct Sprite *sprite) +static 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) + if (sprite->data[2] > sUnknown_03001240[sprite->data[0]].field_8) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.x = 0; - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_4--; sprite->data[2] = 0; } else @@ -2627,36 +2645,36 @@ void sub_81814D4(struct Sprite *sprite) } else { - s16 index = (sprite->data[2] * 256) / gUnknown_03001240[sprite->data[0]].field_8; + s16 index = (sprite->data[2] * 256) / sUnknown_03001240[sprite->data[0]].field_8; sprite->pos2.x = -(Sin(index, 10)); - HandleSetAffineData(sprite, 0x100, 0x100, Sin(index, 3276)); + HandleSetAffineData(sprite, 256, 256, Sin(index, 3276)); } sprite->data[2]++; sub_817F70C(sprite); } -void pokemonanimfunc_2D(struct Sprite *sprite) +static void pokemonanimfunc_2D(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 50; + sUnknown_03001240[id].field_8 = 50; sub_81814D4(sprite); sprite->callback = sub_81814D4; } -void sub_81815D4(struct Sprite *sprite) +static 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) + if (sprite->data[2] > sUnknown_03001240[sprite->data[0]].field_8) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.x = 0; - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_4--; sprite->data[2] = 0; } else @@ -2667,28 +2685,28 @@ void sub_81815D4(struct Sprite *sprite) } else { - s16 index = (sprite->data[2] * 256) / gUnknown_03001240[sprite->data[0]].field_8; + s16 index = (sprite->data[2] * 256) / sUnknown_03001240[sprite->data[0]].field_8; sprite->pos2.x = -(Sin(index, 10)); - HandleSetAffineData(sprite, 0x100, 0x100, -(Sin(index, 3276))); + HandleSetAffineData(sprite, 256, 256, -(Sin(index, 3276))); } sprite->data[2]++; sub_817F70C(sprite); } -void pokemonanimfunc_2E(struct Sprite *sprite) +static void pokemonanimfunc_2E(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 50; + sUnknown_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); +static void sub_8181708(struct Sprite *sprite); +static void sub_8181770(struct Sprite *sprite); +static void sub_8181794(struct Sprite *sprite); -void pokemonanimfunc_2F(struct Sprite *sprite) +static void pokemonanimfunc_2F(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->data[6] = -(14 * sprite->centerToCornerVecX / 10); @@ -2696,7 +2714,7 @@ void pokemonanimfunc_2F(struct Sprite *sprite) sprite->callback = sub_8181708; } -void sub_8181708(struct Sprite *sprite) +static void sub_8181708(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[7]--; @@ -2704,7 +2722,7 @@ void sub_8181708(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); if (sprite->data[7] <= 120) { sprite->data[7] = 120; @@ -2715,7 +2733,7 @@ void sub_8181708(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181770(struct Sprite *sprite) +static void sub_8181770(struct Sprite *sprite) { if (sprite->data[3] == 20) { @@ -2726,7 +2744,7 @@ void sub_8181770(struct Sprite *sprite) sprite->data[3]++; } -void sub_8181794(struct Sprite *sprite) +static void sub_8181794(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[7] += 2; @@ -2734,12 +2752,12 @@ void sub_8181794(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); if (sprite->data[7] >= 128) { sprite->pos2.x = 0; sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->data[2] = 0; sub_817F77C(sprite); sprite->callback = pokemonanimfunc_10; @@ -2748,11 +2766,11 @@ void sub_8181794(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181810(struct Sprite *sprite) +static void sub_8181810(struct Sprite *sprite) { - if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) { - gUnknown_03001240[sprite->data[0]].field_0--; + sUnknown_03001240[sprite->data[0]].field_0--; } else { @@ -2769,7 +2787,7 @@ void sub_8181810(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256 - sprite->data[6], 256 + sprite->data[7], 0); if (sprite->data[4] == 128) { sprite->data[4] = 0; @@ -2781,38 +2799,38 @@ void sub_8181810(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256 + sprite->data[6], 256 - sprite->data[7], 0); if (sprite->data[4] == 128) { - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; - gUnknown_03001240[sprite->data[0]].field_0 = 10; + sUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_0 = 10; sprite->data[4] = 0; sprite->data[5] = 0; } else { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } } } - sprite->data[4] += gUnknown_03001240[sprite->data[0]].field_6; + sprite->data[4] += sUnknown_03001240[sprite->data[0]].field_6; } } -void pokemonanimfunc_30(struct Sprite *sprite) +static void pokemonanimfunc_30(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_6 = 4; sub_8181810(sprite); sprite->callback = sub_8181810; } -void pokemonanimfunc_31(struct Sprite *sprite) +static void pokemonanimfunc_31(struct Sprite *sprite) { s32 counter = sprite->data[2]; sub_817F70C(sprite); @@ -2847,25 +2865,25 @@ void pokemonanimfunc_31(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181ABC(struct Sprite *sprite); -void sub_8181B4C(struct Sprite *sprite); -void sub_8181C2C(struct Sprite *sprite); +static void sub_8181ABC(struct Sprite *sprite); +static void sub_8181B4C(struct Sprite *sprite); +static void sub_8181C2C(struct Sprite *sprite); -void pokemonanimfunc_32(struct Sprite *sprite) +static void pokemonanimfunc_32(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = -1; + sUnknown_03001240[id].field_8 = -1; HandleStartAffineAnim(sprite); sprite->data[3] = 0; sub_8181ABC(sprite); sprite->callback = sub_8181ABC; } -void sub_8181ABC(struct Sprite *sprite) +static void sub_8181ABC(struct Sprite *sprite) { - if (gUnknown_03001240[sprite->data[0]].field_0 != 0) + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) { - gUnknown_03001240[sprite->data[0]].field_0--; + sUnknown_03001240[sprite->data[0]].field_0--; } else { @@ -2880,7 +2898,7 @@ void sub_8181ABC(struct Sprite *sprite) } else { - s32 var = 8 * gUnknown_03001240[sprite->data[0]].field_8; + s32 var = 8 * sUnknown_03001240[sprite->data[0]].field_8; sprite->pos2.x = var * (counter % 128) / 128; sprite->pos2.y = -(Sin(counter % 128, 8)); sprite->data[2] += 12; @@ -2890,12 +2908,12 @@ void sub_8181ABC(struct Sprite *sprite) } } -void sub_8181B4C(struct Sprite *sprite) +static void sub_8181B4C(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 48) { - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->pos2.y = 0; sprite->data[2] = 0; sprite->callback = sub_8181C2C; @@ -2907,7 +2925,7 @@ void sub_8181B4C(struct Sprite *sprite) if (sprite->data[2] >= 16 && sprite->data[2] <= 31) { sprite->data[3] += 8; - sprite->pos2.x -= gUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x -= sUnknown_03001240[sprite->data[0]].field_8; } yDelta = 0; @@ -2924,7 +2942,7 @@ void sub_8181B4C(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181C2C(struct Sprite *sprite) +static void sub_8181C2C(struct Sprite *sprite) { s32 counter; @@ -2932,10 +2950,10 @@ void sub_8181C2C(struct Sprite *sprite) counter = sprite->data[2]; if (counter > 128) { - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; - gUnknown_03001240[sprite->data[0]].field_0 = 10; + sUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_0 = 10; sprite->data[3] = 0; sprite->data[2] = 0; sprite->data[4] = 0; @@ -2952,9 +2970,9 @@ void sub_8181C2C(struct Sprite *sprite) } else { - register s32 var asm("r4") = gUnknown_03001240[sprite->data[0]].field_8; + register s32 var asm("r4") = sUnknown_03001240[sprite->data[0]].field_8; - sprite->pos2.x = (var << 3) * (counter % 128) / 128 - (gUnknown_03001240[sprite->data[0]].field_8 * 8); + sprite->pos2.x = (var << 3) * (counter % 128) / 128 - (sUnknown_03001240[sprite->data[0]].field_8 * 8); sprite->pos2.y = -(Sin(counter % 128, 8)); } @@ -2962,7 +2980,7 @@ void sub_8181C2C(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181CE8(struct Sprite *sprite) +static void sub_8181CE8(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -2975,10 +2993,10 @@ void sub_8181CE8(struct Sprite *sprite) { sprite->pos2.x = 0; sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); - if (gUnknown_03001240[sprite->data[0]].field_4 > 1) + HandleSetAffineData(sprite, 256, 256, 0); + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) { - gUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_4--; sprite->data[2] = 0; sprite->data[7] = 0; } @@ -2996,21 +3014,21 @@ void sub_8181CE8(struct Sprite *sprite) 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; + HandleSetAffineData(sprite, 256, 256, rotation << 8); + sprite->data[7] += sUnknown_03001240[sprite->data[0]].field_6; sub_817F70C(sprite); } } -void pokemonanimfunc_33(struct Sprite *sprite) +static void pokemonanimfunc_33(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_6 = 4; sub_8181CE8(sprite); sprite->callback = sub_8181CE8; } -void pokemonanimfunc_34(struct Sprite *sprite) +static void pokemonanimfunc_34(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -3023,7 +3041,7 @@ void pokemonanimfunc_34(struct Sprite *sprite) { sprite->pos2.x = 0; sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; sub_817F70C(sprite); @@ -3035,13 +3053,13 @@ void pokemonanimfunc_34(struct Sprite *sprite) 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); + HandleSetAffineData(sprite, 256, 256, rotation << 8); sprite->data[7] += 8; sub_817F70C(sprite); } } -void pokemonanimfunc_35(struct Sprite *sprite) +static void pokemonanimfunc_35(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[7] = 0; @@ -3065,18 +3083,18 @@ void pokemonanimfunc_35(struct Sprite *sprite) } } -void sub_8181F14(struct Sprite *sprite); -void sub_8181F50(struct Sprite *sprite); -void sub_8181FC0(struct Sprite *sprite); +static void sub_8181F14(struct Sprite *sprite); +static void sub_8181F50(struct Sprite *sprite); +static void sub_8181FC0(struct Sprite *sprite); -void pokemonanimfunc_36(struct Sprite *sprite) +static void pokemonanimfunc_36(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->data[7] = 0; sprite->callback = sub_8181F14; } -void sub_8181F14(struct Sprite *sprite) +static void sub_8181F14(struct Sprite *sprite) { if (sprite->data[7] > 31) { @@ -3089,10 +3107,10 @@ void sub_8181F14(struct Sprite *sprite) sprite->data[7] += 4; } - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[7] << 8); + HandleSetAffineData(sprite, 256, 256, sprite->data[7] << 8); } -void sub_8181F50(struct Sprite *sprite) +static void sub_8181F50(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 512) @@ -3110,7 +3128,7 @@ void sub_8181F50(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_8181FC0(struct Sprite *sprite) +static void sub_8181FC0(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[7] -= 2; @@ -3126,11 +3144,11 @@ void sub_8181FC0(struct Sprite *sprite) sprite->pos2.x = -(Sin(sprite->data[7] * 2, 16)); } - HandleSetAffineData(sprite, 0x100, 0x100, sprite->data[7] << 8); + HandleSetAffineData(sprite, 256, 256, sprite->data[7] << 8); sub_817F70C(sprite); } -void pokemonanimfunc_37(struct Sprite *sprite) +static void pokemonanimfunc_37(struct Sprite *sprite) { u16 rotation; @@ -3158,16 +3176,16 @@ void pokemonanimfunc_37(struct Sprite *sprite) } rotation = Sin(sprite->data[7] % 128, 16); - HandleSetAffineData(sprite, 0x100, 0x100, rotation << 8); + HandleSetAffineData(sprite, 256, 256, rotation << 8); sub_817F70C(sprite); } -void sub_81820FC(struct Sprite *sprite); -void sub_818216C(struct Sprite *sprite); -void sub_81821CC(struct Sprite *sprite); -void sub_8182248(struct Sprite *sprite); +static void sub_81820FC(struct Sprite *sprite); +static void sub_818216C(struct Sprite *sprite); +static void sub_81821CC(struct Sprite *sprite); +static void sub_8182248(struct Sprite *sprite); -void pokemonanimfunc_38(struct Sprite *sprite) +static void pokemonanimfunc_38(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->data[7] = 0; @@ -3175,7 +3193,7 @@ void pokemonanimfunc_38(struct Sprite *sprite) sprite->callback = sub_81820FC; } -void sub_81820FC(struct Sprite *sprite) +static void sub_81820FC(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[7] > 24) @@ -3193,11 +3211,11 @@ void sub_81820FC(struct Sprite *sprite) sprite->pos2.y = -(Sin(sprite->data[7], 8)); } - HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); sub_817F70C(sprite); } -void sub_818216C(struct Sprite *sprite) +static void sub_818216C(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[7] > 32) @@ -3212,11 +3230,11 @@ void sub_818216C(struct Sprite *sprite) sprite->pos2.y = -(Sin(sprite->data[7], 8)); } - HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); sub_817F70C(sprite); } -void sub_81821CC(struct Sprite *sprite) +static void sub_81821CC(struct Sprite *sprite) { sub_817F70C(sprite); sprite->data[7] += (sprite->data[6] * 4); @@ -3234,11 +3252,11 @@ void sub_81821CC(struct Sprite *sprite) sprite->data[5]++; } - HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); sub_817F70C(sprite); } -void sub_8182248(struct Sprite *sprite) +static void sub_8182248(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[7] <= 0) @@ -3254,11 +3272,11 @@ void sub_8182248(struct Sprite *sprite) sprite->pos2.y = -(Sin(sprite->data[7], 8)); } - HandleSetAffineData(sprite, 0x100, 0x100, -(sprite->data[7]) << 8); + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); sub_817F70C(sprite); } -void pokemonanimfunc_39(struct Sprite *sprite) +static void pokemonanimfunc_39(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 40) @@ -3290,7 +3308,7 @@ void pokemonanimfunc_39(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_3A(struct Sprite *sprite) +static void pokemonanimfunc_3A(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -3309,7 +3327,7 @@ void pokemonanimfunc_3A(struct Sprite *sprite) { s16 scale = (8 * sprite->data[6]) / 20; scale = Sin(sprite->data[7] - scale, 64); - HandleSetAffineData(sprite, 0x100 - scale, 0x100 - scale, 0); + HandleSetAffineData(sprite, 256 - scale, 256 - scale, 0); } } else @@ -3321,7 +3339,7 @@ void pokemonanimfunc_3A(struct Sprite *sprite) if (sprite->data[7] > 63) { sprite->data[7] = 64; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -3352,13 +3370,13 @@ void pokemonanimfunc_3A(struct Sprite *sprite) } sprite->data[7] += 2; - HandleSetAffineData(sprite, 0x100 - var, 0x100 - var, 0); + HandleSetAffineData(sprite, 256 - var, 256 - var, 0); } sub_817F70C(sprite); } -void pokemonanimfunc_3B(struct Sprite *sprite) +static void pokemonanimfunc_3B(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -3370,7 +3388,7 @@ void pokemonanimfunc_3B(struct Sprite *sprite) if (sprite->data[7] > 512) { sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -3381,11 +3399,11 @@ void pokemonanimfunc_3B(struct Sprite *sprite) sprite->pos2.y = Sin(sprite->data[7] % 256, 8); sprite->data[7] += 8; yScale = Sin(sprite->data[7] % 128, 96); - HandleSetAffineData(sprite, 0x100, yScale + 0x100, 0); + HandleSetAffineData(sprite, 256, yScale + 256, 0); } } -void pokemonanimfunc_3C(struct Sprite *sprite) +static void pokemonanimfunc_3C(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -3397,7 +3415,7 @@ void pokemonanimfunc_3C(struct Sprite *sprite) if (sprite->data[7] > 256) { sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } @@ -3408,22 +3426,22 @@ void pokemonanimfunc_3C(struct Sprite *sprite) sprite->pos2.y = Sin(sprite->data[7], 16); sprite->data[7] += 4; yScale = Sin((sprite->data[7] % 64) * 2, 128); - HandleSetAffineData(sprite, 0x100, yScale + 0x100, 0); + HandleSetAffineData(sprite, 256, yScale + 256, 0); } } -void sub_81825F8(struct Sprite *sprite); -void sub_8182648(struct Sprite *sprite); -void sub_81826F8(struct Sprite *sprite); +static void sub_81825F8(struct Sprite *sprite); +static void sub_8182648(struct Sprite *sprite); +static void sub_81826F8(struct Sprite *sprite); -void pokemonanimfunc_3D(struct Sprite *sprite) +static void pokemonanimfunc_3D(struct Sprite *sprite) { HandleStartAffineAnim(sprite); sprite->callback = sub_81825F8; sprite->data[7] = 0; } -void sub_81825F8(struct Sprite *sprite) +static void sub_81825F8(struct Sprite *sprite) { s16 yScale; @@ -3440,10 +3458,10 @@ void sub_81825F8(struct Sprite *sprite) yScale = Sin(sprite->data[7], 128); } - HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); + HandleSetAffineData(sprite, 256, 256 + yScale, 0); } -void sub_8182648(struct Sprite *sprite) +static void sub_8182648(struct Sprite *sprite) { s16 yScale; @@ -3473,7 +3491,7 @@ void sub_8182648(struct Sprite *sprite) yScale = Cos((index * 2) + sprite->data[7], 128) * sign; } - HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); + HandleSetAffineData(sprite, 256, 256 + yScale, 0); if (sprite->data[6] == 3) { sprite->data[7] = 0; @@ -3481,7 +3499,7 @@ void sub_8182648(struct Sprite *sprite) } } -void sub_81826F8(struct Sprite *sprite) +static void sub_81826F8(struct Sprite *sprite) { s16 yScale; @@ -3493,20 +3511,20 @@ void sub_81826F8(struct Sprite *sprite) sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; sprite->pos2.y = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); } - HandleSetAffineData(sprite, 0x100, 0x100 + yScale, 0); + HandleSetAffineData(sprite, 256, 256 + yScale, 0); } -void sub_8182764(struct Sprite *sprite) +static void sub_8182764(struct Sprite *sprite) { if (sprite->data[7] > sprite->data[5]) { sprite->pos2.x = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); } else { @@ -3515,11 +3533,11 @@ void sub_8182764(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); sprite->data[7] += sprite->data[6]; xScale = Sin(sprite->data[7] % 128, 96); - HandleSetAffineData(sprite, 0x100 + xScale, 0x100, 0); + HandleSetAffineData(sprite, 256 + xScale, 256, 0); } } -void pokemonanimfunc_3E(struct Sprite *sprite) +static void pokemonanimfunc_3E(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -3534,14 +3552,14 @@ void pokemonanimfunc_3E(struct Sprite *sprite) sub_8182764(sprite); } -void sub_8182830(struct Sprite *sprite) +static void sub_8182830(struct Sprite *sprite) { if (sprite->data[7] > sprite->data[5]) { sprite->pos2.x = 0; sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); } else { @@ -3550,11 +3568,11 @@ void sub_8182830(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); sprite->data[7] += sprite->data[6]; xScale = Sin((sprite->data[7] % 64) * 2, 128); - HandleSetAffineData(sprite, 0x100 + xScale, 0x100, 0); + HandleSetAffineData(sprite, 256 + xScale, 256, 0); } } -void pokemonanimfunc_3F(struct Sprite *sprite) +static void pokemonanimfunc_3F(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -3569,7 +3587,7 @@ void pokemonanimfunc_3F(struct Sprite *sprite) sub_8182830(sprite); } -void pokemonanimfunc_40(struct Sprite *sprite) +static void pokemonanimfunc_40(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -3583,7 +3601,7 @@ void pokemonanimfunc_40(struct Sprite *sprite) { sprite->pos2.x = 0; sub_817F77C(sprite); - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else @@ -3593,13 +3611,13 @@ void pokemonanimfunc_40(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[7] % 256, 8); sprite->data[7] += 8; scale = Sin(sprite->data[7] % 128, 96); - HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); } sub_817F70C(sprite); } -void pokemonanimfunc_41(struct Sprite *sprite) +static void pokemonanimfunc_41(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -3613,7 +3631,7 @@ void pokemonanimfunc_41(struct Sprite *sprite) { sprite->pos2.x = 0; sub_817F77C(sprite); - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else @@ -3623,13 +3641,13 @@ void pokemonanimfunc_41(struct Sprite *sprite) sprite->pos2.x = -(Sin((sprite->data[7] % 256) / 2, 16)); sprite->data[7] += 8; scale = -(Sin((sprite->data[7] % 256) / 2, 64)); - HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); } sub_817F70C(sprite); } -void pokemonanimfunc_42(struct Sprite *sprite) +static void pokemonanimfunc_42(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -3643,7 +3661,7 @@ void pokemonanimfunc_42(struct Sprite *sprite) { sprite->pos2.x = 0; sub_817F77C(sprite); - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else @@ -3653,13 +3671,13 @@ void pokemonanimfunc_42(struct Sprite *sprite) sprite->pos2.x = -(Sin(sprite->data[7] % 256 , 8)); sprite->data[7] += 8; scale = Sin((sprite->data[7] % 256) / 2, 96); - HandleSetAffineData(sprite, 0x100 + scale, 0x100 + scale, 0); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); } sub_817F70C(sprite); } -void pokemonanimfunc_43(struct Sprite *sprite) +static void pokemonanimfunc_43(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 2048) @@ -3693,7 +3711,7 @@ void pokemonanimfunc_43(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_44(struct Sprite *sprite) +static void pokemonanimfunc_44(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -3750,50 +3768,50 @@ void pokemonanimfunc_44(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_45(struct Sprite *sprite) +static void pokemonanimfunc_45(struct Sprite *sprite) { sprite->data[0] = 32; sub_8180714(sprite); sprite->callback = sub_8180714; } -void pokemonanimfunc_46(struct Sprite *sprite) +static void pokemonanimfunc_46(struct Sprite *sprite) { sprite->data[0] = 80; sub_817F8FC(sprite); sprite->callback = sub_817F8FC; } -void pokemonanimfunc_47(struct Sprite *sprite) +static void pokemonanimfunc_47(struct Sprite *sprite) { sprite->data[0] = 80; sub_817F978(sprite); sprite->callback = sub_817F978; } -void pokemonanimfunc_48(struct Sprite *sprite) +static void pokemonanimfunc_48(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 2048; - gUnknown_03001240[id].field_8 = sprite->data[6]; + sUnknown_03001240[id].field_6 = 2048; + sUnknown_03001240[id].field_8 = sprite->data[6]; sub_8180900(sprite); sprite->callback = sub_8180900; } -void pokemonanimfunc_49(struct Sprite *sprite) +static void pokemonanimfunc_49(struct Sprite *sprite) { sprite->data[6] = 1; pokemonanimfunc_05(sprite); } -void pokemonanimfunc_4A(struct Sprite *sprite) +static void pokemonanimfunc_4A(struct Sprite *sprite) { sprite->data[6] = 1; pokemonanimfunc_48(sprite); } -void pokemonanimfunc_4B(struct Sprite *sprite) +static void pokemonanimfunc_4B(struct Sprite *sprite) { if (sprite->data[2] == 0) sprite->data[0] = 0; @@ -3809,7 +3827,7 @@ void pokemonanimfunc_4B(struct Sprite *sprite) } } -void pokemonanimfunc_4C(struct Sprite *sprite) +static void pokemonanimfunc_4C(struct Sprite *sprite) { sprite->data[0] = 30; sprite->data[7] = 3; @@ -3817,156 +3835,156 @@ void pokemonanimfunc_4C(struct Sprite *sprite) sprite->callback = sub_817FCDC; } -void pokemonanimfunc_4D(struct Sprite *sprite) +static void pokemonanimfunc_4D(struct Sprite *sprite) { sprite->data[0] = 30; sub_817FD44(sprite); sprite->callback = sub_817FD44; } -void pokemonanimfunc_4E(struct Sprite *sprite) +static void pokemonanimfunc_4E(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 1024; - gUnknown_03001240[id].field_0 = 0; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_6 = 1024; + sUnknown_03001240[id].field_0 = 0; + sUnknown_03001240[id].field_4 = 2; sub_817FE30(sprite); sprite->callback = sub_817FE30; } -void pokemonanimfunc_4F(struct Sprite *sprite) +static void pokemonanimfunc_4F(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 512; - gUnknown_03001240[id].field_8 = 3; - gUnknown_03001240[id].field_2 = 12; + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_8 = 3; + sUnknown_03001240[id].field_2 = 12; sub_817FFF0(sprite); sprite->callback = sub_817FFF0; } -void pokemonanimfunc_50(struct Sprite *sprite) +static void pokemonanimfunc_50(struct Sprite *sprite) { sprite->data[0] = 24; sub_818031C(sprite); sprite->callback = sub_818031C; } -void pokemonanimfunc_51(struct Sprite *sprite) +static void pokemonanimfunc_51(struct Sprite *sprite) { sprite->data[0] = 5; sub_81804F8(sprite); sprite->callback = sub_81804F8; } -void pokemonanimfunc_52(struct Sprite *sprite) +static void pokemonanimfunc_52(struct Sprite *sprite) { sprite->data[0] = 3; sub_817F9F4(sprite); sprite->callback = sub_817F9F4; } -void pokemonanimfunc_53(struct Sprite *sprite) +static void pokemonanimfunc_53(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_0 = 60; - gUnknown_03001240[id].field_8 = 30; + sUnknown_03001240[id].field_0 = 60; + sUnknown_03001240[id].field_8 = 30; sub_817FF3C(sprite); sprite->callback = sub_817FF3C; } -void pokemonanimfunc_54(struct Sprite *sprite) +static void pokemonanimfunc_54(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_2 = 1; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_2 = 1; + sUnknown_03001240[id].field_4 = 2; sub_8181214(sprite); sprite->callback = sub_8181214; } -void pokemonanimfunc_55(struct Sprite *sprite) +static void pokemonanimfunc_55(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 4; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_4 = 2; sub_8181810(sprite); sprite->callback = sub_8181810; } -void pokemonanimfunc_56(struct Sprite *sprite) +static void pokemonanimfunc_56(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 1; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_8 = 1; + sUnknown_03001240[id].field_4 = 2; HandleStartAffineAnim(sprite); sprite->data[3] = 0; sub_8181ABC(sprite); sprite->callback = sub_8181ABC; } -void pokemonanimfunc_07(struct Sprite *sprite) +static void pokemonanimfunc_07(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 2; + sUnknown_03001240[id].field_6 = 2; sub_8181CE8(sprite); sprite->callback = sub_8181CE8; } -void pokemonanimfunc_08(struct Sprite *sprite) +static void pokemonanimfunc_08(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 4; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_4 = 2; sub_8181CE8(sprite); sprite->callback = sub_8181CE8; } -void pokemonanimfunc_0B(struct Sprite *sprite) +static void pokemonanimfunc_0B(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 100; + sUnknown_03001240[id].field_8 = 100; sub_81814D4(sprite); sprite->callback = sub_81814D4; } -void pokemonanimfunc_0C(struct Sprite *sprite) +static void pokemonanimfunc_0C(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 50; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_8 = 50; + sUnknown_03001240[id].field_4 = 2; sub_81814D4(sprite); sprite->callback = sub_81814D4; } -void pokemonanimfunc_0D(struct Sprite *sprite) +static void pokemonanimfunc_0D(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 100; + sUnknown_03001240[id].field_8 = 100; sub_81815D4(sprite); sprite->callback = sub_81815D4; } -void pokemonanimfunc_0E(struct Sprite *sprite) +static void pokemonanimfunc_0E(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_8 = 50; - gUnknown_03001240[id].field_4 = 2; + sUnknown_03001240[id].field_8 = 50; + sUnknown_03001240[id].field_4 = 2; sub_81815D4(sprite); sprite->callback = sub_81815D4; } -void sub_8183140(struct Sprite *sprite) +static void sub_8183140(struct Sprite *sprite) { s32 counter = sprite->data[2]; if (counter > 2304) @@ -3982,7 +4000,7 @@ void sub_8183140(struct Sprite *sprite) sprite->data[2] += sprite->data[0]; } -void pokemonanimfunc_57(struct Sprite *sprite) +static void pokemonanimfunc_57(struct Sprite *sprite) { sprite->data[0] = 60; sprite->data[7] = 3; @@ -3990,7 +4008,7 @@ void pokemonanimfunc_57(struct Sprite *sprite) sprite->callback = sub_8183140; } -void pokemonanimfunc_58(struct Sprite *sprite) +static void pokemonanimfunc_58(struct Sprite *sprite) { sprite->data[0] = 30; sprite->data[7] = 3; @@ -3998,7 +4016,7 @@ void pokemonanimfunc_58(struct Sprite *sprite) sprite->callback = sub_8183140; } -void pokemonanimfunc_59(struct Sprite *sprite) +static void pokemonanimfunc_59(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 2048) @@ -4032,7 +4050,7 @@ void pokemonanimfunc_59(struct Sprite *sprite) sub_817F70C(sprite); } -void sub_81832C8(struct Sprite *sprite) +static void sub_81832C8(struct Sprite *sprite) { s16 index1 = 0, index2 = 0; @@ -4040,7 +4058,7 @@ void sub_81832C8(struct Sprite *sprite) { sprite->pos2.y = 0; sprite->data[5] = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); if (sprite->data[4] <= 1) { sub_817F77C(sprite); @@ -4067,18 +4085,18 @@ void sub_81832C8(struct Sprite *sprite) } if (sprite->data[1] == 0) - xScale = -0x100 - Sin(index2, 16); + xScale = -256 - Sin(index2, 16); else - xScale = 0x100 + Sin(index2, 16); + xScale = 256 + Sin(index2, 16); amplitude = sprite->data[3]; - yScale = 0x100 - Sin(index2, amplitude) - Sin(index1, amplitude / 5); + yScale = 256 - Sin(index2, amplitude) - Sin(index1, amplitude / 5); SetAffineData(sprite, xScale, yScale, 0); sprite->data[5]++; } } -void pokemonanimfunc_5A(struct Sprite *sprite) +static void pokemonanimfunc_5A(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4094,14 +4112,14 @@ void pokemonanimfunc_5A(struct Sprite *sprite) sub_81832C8(sprite); } -void sub_8183418(struct Sprite *sprite) +static void sub_8183418(struct Sprite *sprite) { s16 index1 = 0, index2; if (sprite->data[5] > sprite->data[6]) { sprite->data[5] = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); if (sprite->data[4] <= 1) { sub_817F77C(sprite); @@ -4130,16 +4148,16 @@ void sub_8183418(struct Sprite *sprite) amplitude = sprite->data[3]; if (sprite->data[1] == 0) - xScale = -0x100 + Sin(index2, amplitude) + Sin(index1, amplitude / 5 * 2); + xScale = -256 + Sin(index2, amplitude) + Sin(index1, amplitude / 5 * 2); else - xScale = 0x100 - Sin(index2, amplitude) - Sin(index1, amplitude / 5 * 2); + xScale = 256 - Sin(index2, amplitude) - Sin(index1, amplitude / 5 * 2); - SetAffineData(sprite, xScale, 0x100, 0); + SetAffineData(sprite, xScale, 256, 0); sprite->data[5]++; } } -void pokemonanimfunc_5B(struct Sprite *sprite) +static void pokemonanimfunc_5B(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4155,19 +4173,19 @@ void pokemonanimfunc_5B(struct Sprite *sprite) sub_8183418(sprite); } -void sub_8183574(struct Sprite *sprite) +static void sub_8183574(struct Sprite *sprite) { u8 var6, var7; u8 var8 = sprite->data[2]; u8 var9 = sprite->data[6]; - u8 var5 = gUnknown_0860AA80[sprite->data[5]][0]; + u8 var5 = sUnknown_0860AA80[sprite->data[5]][0]; u8 var2 = var5; if (var5 != 0xFF) var5 = sprite->data[7]; else var5 = 0xFF; // needed to match - var6 = gUnknown_0860AA80[sprite->data[5]][1]; + var6 = sUnknown_0860AA80[sprite->data[5]][1]; var7 = 0; if (var2 != 0xFE) var7 = (var6 - var9) * var5 / var6; @@ -4193,7 +4211,7 @@ void sub_8183574(struct Sprite *sprite) } } -void pokemonanimfunc_5C(struct Sprite *sprite) +static void pokemonanimfunc_5C(struct Sprite *sprite) { sprite->data[0] = 40; sprite->data[7] = 6; @@ -4201,7 +4219,7 @@ void pokemonanimfunc_5C(struct Sprite *sprite) sprite->callback = sub_8183574; } -void pokemonanimfunc_5D(struct Sprite *sprite) +static void pokemonanimfunc_5D(struct Sprite *sprite) { sprite->data[0] = 70; sprite->data[7] = 6; @@ -4209,14 +4227,14 @@ void pokemonanimfunc_5D(struct Sprite *sprite) sprite->callback = sub_817FCDC; } -void pokemonanimfunc_5E(struct Sprite *sprite) +static void pokemonanimfunc_5E(struct Sprite *sprite) { sprite->data[0] = 20; sub_817F8FC(sprite); sprite->callback = sub_817F8FC; } -void pokemonanimfunc_5F(struct Sprite *sprite) +static void pokemonanimfunc_5F(struct Sprite *sprite) { if (sprite->data[2] > 40) { @@ -4237,7 +4255,7 @@ void pokemonanimfunc_5F(struct Sprite *sprite) sprite->data[2]++; } -void pokemonanimfunc_60(struct Sprite *sprite) +static void pokemonanimfunc_60(struct Sprite *sprite) { if (sprite->data[2] > 40) { @@ -4258,7 +4276,7 @@ void pokemonanimfunc_60(struct Sprite *sprite) sprite->data[2]++; } -void pokemonanimfunc_61(struct Sprite *sprite) +static void pokemonanimfunc_61(struct Sprite *sprite) { sprite->data[0] = 70; sprite->data[7] = 6; @@ -4266,7 +4284,7 @@ void pokemonanimfunc_61(struct Sprite *sprite) sprite->callback = sub_8183140; } -void pokemonanimfunc_62(struct Sprite *sprite) +static void pokemonanimfunc_62(struct Sprite *sprite) { sprite->data[0] = 24; sprite->data[7] = 6; @@ -4274,7 +4292,7 @@ void pokemonanimfunc_62(struct Sprite *sprite) sprite->callback = sub_8183574; } -void pokemonanimfunc_63(struct Sprite *sprite) +static void pokemonanimfunc_63(struct Sprite *sprite) { sprite->data[0] = 56; sprite->data[7] = 9; @@ -4282,25 +4300,25 @@ void pokemonanimfunc_63(struct Sprite *sprite) sprite->callback = sub_8183574; } -void pokemonanimfunc_64(struct Sprite *sprite) +static void pokemonanimfunc_64(struct Sprite *sprite) { u8 id = sprite->data[0] = sub_817F758(); - gUnknown_03001240[id].field_6 = 1024; - gUnknown_03001240[id].field_8 = 6; - gUnknown_03001240[id].field_2 = 24; + sUnknown_03001240[id].field_6 = 1024; + sUnknown_03001240[id].field_8 = 6; + sUnknown_03001240[id].field_2 = 24; sub_817FFF0(sprite); sprite->callback = sub_817FFF0; } -void sub_81837DC(struct Sprite *sprite) +static void sub_81837DC(struct Sprite *sprite) { s16 index1 = 0, index2 = 0; if (sprite->data[5] > sprite->data[6]) { sprite->pos2.y = 0; sprite->data[5] = 0; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); if (sprite->data[4] <= 1) { sub_817F77C(sprite); @@ -4329,17 +4347,17 @@ void sub_81837DC(struct Sprite *sprite) amplitude = sprite->data[3]; if (sprite->data[1] == 0) - xScale = Sin(index2, amplitude) + (Sin(index1, amplitude / 5 * 2) - 0x100); + xScale = Sin(index2, amplitude) + (Sin(index1, amplitude / 5 * 2) - 256); else - xScale = 0x100 - Sin(index1, amplitude / 5 * 2) - Sin(index2, amplitude); + xScale = 256 - Sin(index1, amplitude / 5 * 2) - Sin(index2, amplitude); - yScale = 0x100 - Sin(index1, amplitude / 5) - Sin(index2, amplitude); + yScale = 256 - Sin(index1, amplitude / 5) - Sin(index2, amplitude); SetAffineData(sprite, xScale, yScale, 0); sprite->data[5]++; } } -void pokemonanimfunc_65(struct Sprite *sprite) +static void pokemonanimfunc_65(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4355,7 +4373,7 @@ void pokemonanimfunc_65(struct Sprite *sprite) sub_81837DC(sprite); } -void pokemonanimfunc_66(struct Sprite *sprite) +static void pokemonanimfunc_66(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 2048) @@ -4389,7 +4407,7 @@ void pokemonanimfunc_66(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_67(struct Sprite *sprite) +static void pokemonanimfunc_67(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] > 2048) @@ -4423,7 +4441,7 @@ void pokemonanimfunc_67(struct Sprite *sprite) sub_817F70C(sprite); } -static const s8 gUnknown_0860ADBE[][3] = +static const s8 sUnknown_0860ADBE[][3] = { // x y timer {1, 1, 12}, @@ -4432,19 +4450,19 @@ static const s8 gUnknown_0860ADBE[][3] = {0, 0, 0} }; -void sub_8183B4C(struct Sprite *sprite) +static void sub_8183B4C(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) sprite->data[3] = 0; - if (gUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == sprite->data[2]) + if (sUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == sprite->data[2]) { sprite->data[3]++; sprite->data[2] = 0; } - if (gUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == 0) + if (sUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == 0) { if (--sprite->data[6] == 0) sprite->callback = SpriteCB_SetDummyOnAnimEnd; @@ -4454,14 +4472,14 @@ void sub_8183B4C(struct Sprite *sprite) else { s32 amplitude = sprite->data[5]; - sprite->pos2.x += (gUnknown_0860ADBE[sprite->data[3]][0] * amplitude); - sprite->pos2.y += (gUnknown_0860ADBE[sprite->data[3]][1] * sprite->data[5]); // what's the point of the var if you're not reusing it? + sprite->pos2.x += (sUnknown_0860ADBE[sprite->data[3]][0] * amplitude); + sprite->pos2.y += (sUnknown_0860ADBE[sprite->data[3]][1] * sprite->data[5]); // what's the point of the var if you're not reusing it? sprite->data[2]++; sub_817F70C(sprite); } } -void pokemonanimfunc_68(struct Sprite *sprite) +static void pokemonanimfunc_68(struct Sprite *sprite) { sprite->data[5] = 1; sprite->data[6] = 1; @@ -4469,7 +4487,7 @@ void pokemonanimfunc_68(struct Sprite *sprite) sprite->callback = sub_8183B4C; } -void pokemonanimfunc_69(struct Sprite *sprite) +static void pokemonanimfunc_69(struct Sprite *sprite) { sprite->data[5] = 2; sprite->data[6] = 1; @@ -4477,7 +4495,7 @@ void pokemonanimfunc_69(struct Sprite *sprite) sprite->callback = sub_8183B4C; } -void pokemonanimfunc_6A(struct Sprite *sprite) +static void pokemonanimfunc_6A(struct Sprite *sprite) { sprite->data[5] = 2; sprite->data[6] = 2; @@ -4485,7 +4503,7 @@ void pokemonanimfunc_6A(struct Sprite *sprite) sprite->callback = sub_8183B4C; } -void sub_8183C6C(struct Sprite *sprite) +static void sub_8183C6C(struct Sprite *sprite) { if (sprite->data[7] > 255) { @@ -4493,7 +4511,7 @@ void sub_8183C6C(struct Sprite *sprite) { sub_817F77C(sprite); sprite->callback = SpriteCB_SetDummyOnAnimEnd; - HandleSetAffineData(sprite, 0x100, 0x100, 0); + HandleSetAffineData(sprite, 256, 256, 0); } else { @@ -4510,11 +4528,11 @@ void sub_8183C6C(struct Sprite *sprite) sprite->data[7] = 256; scale = Sin(sprite->data[7] / 2, 64); - HandleSetAffineData(sprite, 0x100 - scale, 0x100 - scale, 0); + HandleSetAffineData(sprite, 256 - scale, 256 - scale, 0); } } -void pokemonanimfunc_6B(struct Sprite *sprite) +static void pokemonanimfunc_6B(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -4530,7 +4548,7 @@ void pokemonanimfunc_6B(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_6C(struct Sprite *sprite) +static void pokemonanimfunc_6C(struct Sprite *sprite) { sub_817F70C(sprite); if (sprite->data[2] == 0) @@ -4546,7 +4564,7 @@ void pokemonanimfunc_6C(struct Sprite *sprite) sub_817F70C(sprite); } -void pokemonanimfunc_6D(struct Sprite *sprite) +static void pokemonanimfunc_6D(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4561,7 +4579,7 @@ void pokemonanimfunc_6D(struct Sprite *sprite) sub_8182764(sprite); } -void pokemonanimfunc_6E(struct Sprite *sprite) +static void pokemonanimfunc_6E(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4576,7 +4594,7 @@ void pokemonanimfunc_6E(struct Sprite *sprite) sub_8182764(sprite); } -void pokemonanimfunc_6F(struct Sprite *sprite) +static void pokemonanimfunc_6F(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4591,7 +4609,7 @@ void pokemonanimfunc_6F(struct Sprite *sprite) sub_8182830(sprite); } -void pokemonanimfunc_70(struct Sprite *sprite) +static void pokemonanimfunc_70(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4606,7 +4624,7 @@ void pokemonanimfunc_70(struct Sprite *sprite) sub_8182830(sprite); } -void pokemonanimfunc_71(struct Sprite *sprite) +static void pokemonanimfunc_71(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4618,7 +4636,7 @@ void pokemonanimfunc_71(struct Sprite *sprite) sub_8180828(sprite); } -void pokemonanimfunc_72(struct Sprite *sprite) +static void pokemonanimfunc_72(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4630,7 +4648,7 @@ void pokemonanimfunc_72(struct Sprite *sprite) sub_8180828(sprite); } -void pokemonanimfunc_73(struct Sprite *sprite) +static void pokemonanimfunc_73(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4645,7 +4663,7 @@ void pokemonanimfunc_73(struct Sprite *sprite) sub_81832C8(sprite); } -void pokemonanimfunc_74(struct Sprite *sprite) +static void pokemonanimfunc_74(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4660,7 +4678,7 @@ void pokemonanimfunc_74(struct Sprite *sprite) sub_81832C8(sprite); } -void pokemonanimfunc_75(struct Sprite *sprite) +static void pokemonanimfunc_75(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4676,7 +4694,7 @@ void pokemonanimfunc_75(struct Sprite *sprite) sub_8183418(sprite); } -void pokemonanimfunc_76(struct Sprite *sprite) +static void pokemonanimfunc_76(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4692,7 +4710,7 @@ void pokemonanimfunc_76(struct Sprite *sprite) sub_8183418(sprite); } -void pokemonanimfunc_77(struct Sprite *sprite) +static void pokemonanimfunc_77(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4708,7 +4726,7 @@ void pokemonanimfunc_77(struct Sprite *sprite) sub_81837DC(sprite); } -void pokemonanimfunc_78(struct Sprite *sprite) +static void pokemonanimfunc_78(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4724,7 +4742,7 @@ void pokemonanimfunc_78(struct Sprite *sprite) sub_81837DC(sprite); } -void sub_8183FA8(struct Sprite *sprite) +static void sub_8183FA8(struct Sprite *sprite) { if (sprite->data[7] > 255) { @@ -4752,7 +4770,7 @@ void sub_8183FA8(struct Sprite *sprite) } } -void pokemonanimfunc_79(struct Sprite *sprite) +static void pokemonanimfunc_79(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4767,7 +4785,7 @@ void pokemonanimfunc_79(struct Sprite *sprite) sub_8183FA8(sprite); } -void pokemonanimfunc_7A(struct Sprite *sprite) +static void pokemonanimfunc_7A(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4782,7 +4800,7 @@ void pokemonanimfunc_7A(struct Sprite *sprite) sub_8183FA8(sprite); } -void pokemonanimfunc_7B(struct Sprite *sprite) +static void pokemonanimfunc_7B(struct Sprite *sprite) { if (sprite->data[2] == 0) { @@ -4796,3 +4814,844 @@ void pokemonanimfunc_7B(struct Sprite *sprite) sub_8183FA8(sprite); } + +static void sub_81840C4(struct Sprite *sprite) +{ + if (sprite->data[7] > 256) + { + if (sprite->data[6] <= sprite->data[4]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]++; + sprite->data[7] = 0; + } + + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s16 posX; + + if (sprite->data[7] > 159) + { + if (sprite->data[7] > 256) + sprite->data[7] = 256; + + sprite->pos2.y = -(Sin(sprite->data[7] % 256, 8)); + } + else if (sprite->data[7] > 95) + { + sprite->pos2.y = Sin(96, 6) - Sin((sprite->data[7] - 96) * 2, 4); + } + else + { + sprite->pos2.y = Sin(sprite->data[7], 6); + } + + posX = -(Sin(sprite->data[7] / 2, sprite->data[5])); + if (sprite->data[4] % 2 == 0) + posX *= -1; + + sprite->pos2.x = posX; + sprite->data[7] += sprite->data[3]; + } +} + +static void pokemonanimfunc_7C(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 4; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7D(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 6; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 3; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 8; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 4; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_80(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 6; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_81(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 8; + } + + sub_8183FA8(sprite); +} + +static void sub_8184290(struct Sprite *sprite) +{ + u16 index = Sin((sprite->data[2] * 128) / sprite->data[7], sprite->data[5]); + sprite->data[6] = -(index << 8); + sub_817F3F0(sprite, index, sprite->data[4], 0); + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); +} + +static void pokemonanimfunc_82(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 60; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 1; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_83(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 90; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 1; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_84(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 30; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 2; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void sub_8184468(struct Sprite *sprite) +{ + if (sprite->data[2] > sprite->data[7]) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + u8 posY_unsigned; + s8 posY_signed; + s32 posY; + s16 index = (u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6] % 256; + if (sprite->data[2] % 2 == 0) + { + sprite->data[4] = Sin(index, 32) + 256; + sprite->data[5] = Sin(index, 32) + 256; + posY_unsigned = Sin(index, 32); + posY_signed = posY_unsigned; + } + else + { + sprite->data[4] = Sin(index, 8) + 256; + sprite->data[5] = Sin(index, 8) + 256; + posY_unsigned = Sin(index, 8); + posY_signed = posY_unsigned; + } + + posY = posY_signed; + if (posY < 0) + posY += 7; + sprite->pos2.y = (u32)(posY) >> 3; + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_85(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 40; + sprite->data[7] = 80; + } + + sub_8184468(sprite); +} + +static void pokemonanimfunc_86(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 40; + sprite->data[7] = 40; + } + + sub_8184468(sprite); +} + +static void pokemonanimfunc_87(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 80; + sprite->data[7] = 80; + } + + sub_8184468(sprite); +} + +static void sub_8184610(struct Sprite *sprite); +static void sub_8184640(struct Sprite *sprite); +static void sub_8184678(struct Sprite *sprite); +static void sub_81846B8(struct Sprite *sprite); + +static void sub_81845D4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x -= sprite->data[2]; + if (sprite->pos2.x <= -sprite->data[6]) + { + sprite->pos2.x = -sprite->data[6]; + sprite->data[7] = 2; + sprite->callback = sub_8184610; + } + + sub_817F70C(sprite); +} + +static void sub_8184610(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x += sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x >= 0) + sprite->callback = sub_8184640; + + sub_817F70C(sprite); +} + +static void sub_8184640(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x += sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x > sprite->data[6]) + { + sprite->pos2.x = sprite->data[6]; + sprite->callback = sub_8184678; + } + + sub_817F70C(sprite); +} + +static void sub_8184678(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[3] >= sprite->data[5]) + { + sprite->callback = sub_81846B8; + } + else + { + sprite->pos2.x += sprite->data[4]; + sprite->data[4] *= -1; + sprite->data[3]++; + } + + sub_817F70C(sprite); +} + +static void sub_81846B8(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); +} + +static void pokemonanimfunc_88(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 4; + sprite->data[6] = 12; + sprite->data[5] = 16; + sprite->data[4] = 4; + sprite->data[3] = 0; + sprite->data[2] = 2; + sprite->callback = sub_81845D4; +} + +static void pokemonanimfunc_89(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 2; + sprite->data[6] = 8; + sprite->data[5] = 12; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = 1; + sprite->callback = sub_81845D4; +} + +static void pokemonanimfunc_8A(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->data[6] = 6; + sprite->data[5] = 6; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = 1; + sprite->callback = sub_81845D4; +} + +static void sub_8184770(struct Sprite *sprite) +{ + sprite->pos2.x = sprite->data[1]; + if (sprite->data[0] > 1) + { + sprite->data[1] *= -1; + sprite->data[0] = 0; + } + else + { + sprite->data[0]++; + } +} + +struct YellowBlendStruct +{ + u8 field_0; + u8 field_1; +}; + +static const struct YellowBlendStruct sUnknown_0860ADCC[] = +{ + {0, 1}, + {1, 2}, + {0, 15}, + {1, 1}, + {0, 15}, + {1, 1}, + {0, 15}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {0, 0xFF} +}; + +static const struct YellowBlendStruct sUnknown_0860AE1C[] = +{ + {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} +}; + +static const struct YellowBlendStruct sUnknown_0860AE54[] = +{ + {0, 1}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 1}, + {0, 0xFF} +}; + +static const struct YellowBlendStruct *const sUnknown_0860AE7C[] = +{ + sUnknown_0860ADCC, + sUnknown_0860AE1C, + sUnknown_0860AE54 +}; + +static void BackAnimBlendYellow(struct Sprite *sprite) +{ + const struct YellowBlendStruct *array = sUnknown_0860AE7C[sprite->data[3]]; + sub_8184770(sprite); + if (array[sprite->data[6]].field_1 == 0xFF) + { + sprite->pos2.x = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + if (sprite->data[4] == 1) + { + if (array[sprite->data[6]].field_0 != 0) + BlendPalette(sprite->data[7], 0x10, 0x10, 0x3FF); + else + BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + + sprite->data[4] = 0; + } + + if (array[sprite->data[6]].field_1 == sprite->data[5]) + { + sprite->data[4] = 1; + sprite->data[5] = 0; + sprite->data[6]++; + } + else + { + sprite->data[5]++; + } + } +} + +static void pokemonanimfunc_8B(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; + sprite->data[3] = 0; + } + + BackAnimBlendYellow(sprite); +} + +static void pokemonanimfunc_8C(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; + sprite->data[3] = 1; + } + + BackAnimBlendYellow(sprite); +} + +static void pokemonanimfunc_8D(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; + sprite->data[3] = 2; + } + + BackAnimBlendYellow(sprite); +} + +static const u16 sUnknown_0860AE88[] = +{ + 0x1F, 0x3E0, 0x7C00, 0x0 +}; + +static void BackAnimBlend(struct Sprite *sprite) +{ + if (sprite->data[2] > 127) + { + 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], sUnknown_0860AE88[sprite->data[1]]); + } +} + +static void sub_8184934(struct Sprite *sprite) +{ + if (sprite->data[3] < sprite->data[4]) + { + sub_817F70C(sprite); + if (sprite->data[5] > sprite->data[0]) + { + if (++sprite->data[3] < sprite->data[4]) + sprite->data[5] = 0; + + sprite->pos2.x = 0; + } + else + { + s8 sign = 1 - (sprite->data[3] % 2 * 2); + sprite->pos2.x = sign * Sin((sprite->data[5] * 384 / sprite->data[0]) % 256, 6); + sprite->data[5]++; + } + + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_8E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_8F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_90(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_91(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_92(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_93(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_94(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_95(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_96(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite) +{ + if (sprite->animEnded) + sprite->callback = SpriteCallbackDummy; +} diff --git a/sym_bss.txt b/sym_bss.txt index 409690e38..f930a5b98 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -74,16 +74,8 @@ gUnknown_03001204: @ 3001204 .space 0x4 .include "src/battle_transition.o" - -gUnknown_03001240: @ 3001240 - .space 0x30 - -gUnknown_03001270: @ 3001270 - .space 0x4 - -gUnknown_03001274: @ 3001274 - .space 0x4 - + .include "src/pokemon_animation.o" + gUnknown_03001278: @ 3001278 .space 0x1 From 78728ae454b6c184b69f4a8c145f32904d406f19 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 14:36:13 +0100 Subject: [PATCH 10/15] add rgb constants --- data/battle_anim_scripts.s | 181 +++++++++++++++++++------------------ include/constants/rgb.h | 15 +++ include/gba/defines.h | 5 - src/battle_interface.c | 15 +-- src/palette.c | 1 + src/pokemon_animation.c | 49 +++++----- 6 files changed, 140 insertions(+), 126 deletions(-) create mode 100644 include/constants/rgb.h diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index a0c3b39d2..878b48ccb 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1,6 +1,7 @@ +#include "constants/rgb.h" +#include "constants/songs.h" .include "asm/macros/battle_anim_script.inc" .include "include/constants/battle_anim.h" - .include "include/constants/songs.h" .section script_data, "aw", %progbits @@ -684,7 +685,7 @@ Move_FLAME_WHEEL: createsprite gUnknown_0857FE70, 0x2, 0, 24, 0, 0, 6 delay 0x4 createvisualtask sub_80D51AC, 0x2, 1, 5, 0, 8, 1 - createvisualtask sub_80A7B98, 0x3, 1, 31, 12, 1, 1 + createvisualtask sub_80A7B98, 0x3, 1, RGB_RED, 12, 1, 1 playsewithpan SE_W172B, +63 call AnimScript_82D2D18 delay 0x7 @@ -789,7 +790,7 @@ Move_DOUBLE_EDGE: waitplaysewithpan SE_W207, -64, 0x8 createvisualtask sub_80D5830, 0x2, 0, 18, 6, 2, 4 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 16, 16, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 0, 16, 16, RGB_WHITE createsprite gUnknown_0857FE70, 0x2, 0, 20, 0, 0, 4 delay 0x3 waitforvisualfinish @@ -801,7 +802,7 @@ Move_DOUBLE_EDGE: createvisualtask sub_80D6134, 0x2, 8, -256, 1, 0 createvisualtask sub_80D5484, 0x2, 0, 4, 0, 12, 1 createvisualtask sub_80D5484, 0x2, 1, 4, 0, 12, 1 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_WHITE waitforvisualfinish createvisualtask sub_80D6134, 0x2, 8, -256, 0, 1 createvisualtask sub_80D6134, 0x2, 8, -256, 1, 1 @@ -942,7 +943,7 @@ Move_MEGA_PUNCH: loadspritegfx 0x279F monbg ANIM_TARGET delay 0x2 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, RGB_BLACK setalpha 0x80C playsewithpan SE_W025, +63 createsprite gUnknown_08595F48, 0x3, 0, 0, 0, 50 @@ -990,7 +991,7 @@ Move_MEGA_KICK: loadspritegfx 0x279F monbg ANIM_TARGET delay 0x2 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, RGB_BLACK setalpha 0x80C playsewithpan SE_W025, +63 createsprite gUnknown_08595F48, 0x3, 0, 0, 1, 50 @@ -1232,7 +1233,7 @@ Move_HIDDEN_POWER: createvisualtask sub_80D6064, 0x5, -7, -7, 11, 0, 0 waitforvisualfinish delay 0x1E - createvisualtask sub_80A7B98, 0x5, 0, 20479, 12, 5, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(31, 31, 19), 12, 5, 1 delay 0x4 createvisualtask sub_80D6064, 0x5, -7, -7, 11, 0, 0 playsewithpan SE_W179, -64 @@ -1705,7 +1706,7 @@ Move_PROTECT: Move_DETECT: loadspritegfx 0x2757 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 9, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 9, RGB_BLACK waitforvisualfinish createvisualtask sub_8116620, 0xA, 2, 1, 0, 9, 0x7FFF delay 0x12 @@ -1713,7 +1714,7 @@ Move_DETECT: createsprite gUnknown_0853EE84, 0xD, 20, -20 waitforvisualfinish delay 0xA - createsprite gUnknown_08597274, 0x2, 1, 2, 9, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 9, 0, RGB_BLACK createvisualtask sub_8116620, 0xA, 2, 2, 9, 0, 0x7FFF waitforvisualfinish end @@ -2118,12 +2119,12 @@ Move_MEAN_LOOK: loadspritegfx 0x27CB monbg ANIM_DEF_PARTNER playsewithpan SE_W060, -64 - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, RGB_BLACK loopsewithpan SE_W109, +63, 0xF, 0x4 waitplaysewithpan SE_W043, +63, 0x55 createsprite gUnknown_085CE104, 0x2 delay 0x78 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_BLACK delay 0x1E clearmonbg ANIM_DEF_PARTNER waitforvisualfinish @@ -2792,7 +2793,7 @@ Move_RAGE: loadspritegfx 0x2767 monbg ANIM_TARGET setalpha 0x80C - createvisualtask sub_80A7B98, 0x3, 0, 31, 10, 0, 2 + createvisualtask sub_80A7B98, 0x3, 0, RGB_RED, 10, 0, 2 createsprite gUnknown_0859368C, 0x2, 0, -20, -28 playsewithpan SE_W207B, -64 delay 0x14 @@ -3068,7 +3069,7 @@ Move_SUPER_FANG: playsewithpan SE_W082, -64 waitforvisualfinish createvisualtask sub_80D5484, 0x2, 0, 3, 0, 48, 1 - createvisualtask sub_80A7B98, 0x2, 0, 1247, 12, 4, 1 + createvisualtask sub_80A7B98, 0x2, 0, RGB(31, 6, 1), 12, 4, 1 waitforvisualfinish delay 0x14 createsprite gUnknown_0857FE28, 0x2, 4, 4 @@ -3137,7 +3138,7 @@ Move_NIGHTMARE: end AnimScript_82CD4CF: - createvisualtask sub_80A7B98, 0x2, 0, 0x7FFF, 10, 2, 1 + createvisualtask sub_80A7B98, 0x2, 0, RGB_WHITE, 10, 2, 1 createvisualtask sub_80D51AC, 0x2, 0, 3, 0, 32, 1 playsewithpan SE_W171, +63 waitforvisualfinish @@ -3220,7 +3221,7 @@ Move_FORESIGHT: delay 0x18 playsewithpan SE_W166, +63 delay 0xA - createvisualtask sub_80A7B98, 0x5, 1, 0x7FFF, 12, 2, 1 + createvisualtask sub_80A7B98, 0x5, 1, RGB_WHITE, 12, 2, 1 playsewithpan SE_W197, +63 waitforvisualfinish blendoff @@ -3418,7 +3419,7 @@ Move_MOONLIGHT: loadspritegfx 0x27D3 loadspritegfx 0x272F setalpha 0x1000 - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, RGB_BLACK waitforvisualfinish createsprite gUnknown_08592EBC, 0x2, 120, 56 createvisualtask sub_80A7A74, 0x3, 0, 16, 16, 0, 1 @@ -3517,7 +3518,7 @@ Move_UPROAR: Move_HEAT_WAVE: loadspritegfx 0x2815 - createvisualtask sub_8116848, 0x5, 10261, 0, 6, 6, 31 + createvisualtask sub_8116848, 0x5, 10261, 0, 6, 6, RGB_RED createvisualtask sub_8110BCC, 0x5, 1 createvisualtask sub_810A060, 0x6, 6, 31 panse_1B SE_W257, -64, +63, +2, 0x0 @@ -3555,7 +3556,7 @@ Move_TORMENT: loadspritegfx 0x27E1 createvisualtask sub_815AFF0, 0x2 waitforvisualfinish - createvisualtask sub_80A7B98, 0x2, 1, 31, 10, 1, 1 + createvisualtask sub_80A7B98, 0x2, 1, RGB_RED, 10, 1, 1 createsprite gUnknown_0859368C, 0x82, 1, -20, -28 playsewithpan SE_W207B, +63 delay 0x14 @@ -3625,7 +3626,7 @@ Move_CHARGE: loadspritegfx 0x27E5 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask sub_810AAFC, 0x2, 0, 60, 2, 12 playsewithpan SE_W268, -64 @@ -3649,7 +3650,7 @@ Move_CHARGE: createsprite gUnknown_0859598C, 0x2, 0, -16, -16 playsewithpan SE_W085B, -64 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff end @@ -3688,7 +3689,7 @@ Move_HELPING_HAND: delay 0x14 playsewithpan SE_W227, 0 createvisualtask sub_80D52D0, 0x2, 2, 3, 0, 10, 1 - createvisualtask sub_80A7B98, 0x2, 2, 1023, 12, 1, 1 + createvisualtask sub_80A7B98, 0x2, 2, RGB_YELLOW, 12, 1, 1 end Move_ASSIST: @@ -3750,7 +3751,7 @@ Move_RECYCLE: createsprite gUnknown_085CE9B0, 0x2 loopsewithpan SE_W036, -64, 0x18, 0x3 waitforvisualfinish - createvisualtask sub_80A7B98, 0x5, 0, 0x7FFF, 12, 2, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB_WHITE, 12, 2, 1 playsewithpan SE_W036, -64 waitforvisualfinish blendoff @@ -3780,13 +3781,13 @@ AnimScript_82CE0A7: playsewithpan SE_W233, +63 delay 0x14 createvisualtask sub_80D5C50, 0x2, 0, -24, 0, 24, 10, 24, 3 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, RGB_BLACK delay 0x25 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 1 createsprite gUnknown_08595E98, 0x4, 0, 0, 10, 1, 0 playsewithpan SE_W233B, +63 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3807,7 +3808,7 @@ AnimScript_82CE154: playsewithpan SE_W233, +63 delay 0x14 createvisualtask sub_80D5C50, 0x2, 0, -24, 0, 24, 10, 24, 3 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, RGB_BLACK delay 0x25 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 1 createsprite gUnknown_08595E98, 0x4, 0, 0, 10, 1, 0 @@ -3819,7 +3820,7 @@ AnimScript_82CE154: createsprite gUnknown_08595FA8, 0x2, 1, 3, 8, 12 playsewithpan SE_W280, +63 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3845,7 +3846,7 @@ Move_ENDEAVOR: loadspritegfx 0x2797 createvisualtask sub_815DCA4, 0x2, 0, 2 loopsewithpan SE_W039, -64, 0x18, 0x2 - createvisualtask sub_80A7B98, 0x5, 0, 703, 12, 1, 2 + createvisualtask sub_80A7B98, 0x5, 0, RGB(31, 21, 0), 12, 1, 2 delay 0x6 createvisualtask sub_80D6388, 0x5, 0, 1, 8, 1, 0 createsprite gUnknown_08597358, 0x82, 12, -12, 1, 2 @@ -3858,7 +3859,7 @@ Move_ENDEAVOR: Move_ERUPTION: loadspritegfx 0x27D9 - createsprite gUnknown_08597274, 0x2, 31, 2, 0, 4, 31 + createsprite gUnknown_08597274, 0x2, 31, 2, 0, 4, RGB_RED waitforvisualfinish createvisualtask sub_8109460, 0x2 waitplaysewithpan SE_W153, -64, 0x3C @@ -3878,18 +3879,18 @@ Move_ERUPTION: createvisualtask sub_81152DC, 0x5, 4, 8, 60 loopsewithpan SE_W088, +63, 0x10, 0xC delay 0x50 - createsprite gUnknown_08597274, 0x28, 31, 4, 4, 0, 31 + createsprite gUnknown_08597274, 0x28, 31, 4, 4, 0, RGB_RED end Move_SKILL_SWAP: loadspritegfx 0x280B call AnimScript_82D7CD1 createvisualtask sub_810FBF0, 0x3, 1 - createvisualtask sub_80A7B98, 0x5, 1, 0x7FFF, 12, 3, 1 + createvisualtask sub_80A7B98, 0x5, 1, RGB_WHITE, 12, 3, 1 loopsewithpan SE_W179, -64, 0x18, 0x3 delay 0x10 createvisualtask sub_810FBF0, 0x3, 0 - createvisualtask sub_80A7B98, 0x5, 0, 0x7FFF, 12, 3, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB_WHITE, 12, 3, 1 waitforvisualfinish call AnimScript_82D7CDD end @@ -3951,13 +3952,13 @@ Move_TAIL_GLOW: loadspritegfx 0x27E4 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createsprite gUnknown_08596AC8, 0x42, 0 delay 0x12 loopsewithpan SE_W234, -64, 0x10, 0x6 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff delay 0x1 @@ -4193,7 +4194,7 @@ Move_AROMATHERAPY: loadspritegfx 0x27AF loadspritegfx 0x27DB loadspritegfx 0x2741 - createsprite gUnknown_08597274, 0x0, 1, 0, 0, 7, 13293 + createsprite gUnknown_08597274, 0x0, 1, 0, 0, 7, RGB(13, 31, 12) delay 0x1 monbg ANIM_ATTACKER delay 0x1 @@ -4211,7 +4212,7 @@ Move_AROMATHERAPY: waitforvisualfinish clearmonbg ANIM_ATTACKER delay 0x1 - createsprite gUnknown_08597274, 0x0, 1, 0, 7, 0, 13293 + createsprite gUnknown_08597274, 0x0, 1, 0, 7, 0, RGB(13, 31, 12) delay 0x1 playsewithpan SE_W287, -64 createvisualtask sub_815DFCC, 0x2, 1 @@ -4222,7 +4223,7 @@ Move_AROMATHERAPY: createsprite gUnknown_08592B94, 0x10, 12, -5, 0, 0, 32, 60, 1 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x0, 43, 3, 10, 0, 13293 + createsprite gUnknown_08597274, 0x0, 43, 3, 10, 0, RGB(13, 31, 12) createsprite gUnknown_08593868, 0x10, 0, 0, 0, 1 waitforvisualfinish end @@ -4231,7 +4232,7 @@ Move_FAKE_TEARS: loadspritegfx 0x27AB loadspritegfx 0x27E1 loadspritegfx 0x2758 - createvisualtask sub_8116848, 0x5, 10155, 0, 4, 4, 32108 + createvisualtask sub_8116848, 0x5, 10155, 0, 4, 4, RGB(12, 11, 31) waitforvisualfinish createvisualtask sub_815C478, 0x5, 0, 2, 1 loopsewithpan SE_W039, -64, 0xC, 0x4 @@ -4289,7 +4290,7 @@ Move_ODOR_SLEUTH: Move_GRASS_WHISTLE: loadspritegfx 0x2758 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 13298 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB(18, 31, 12) waitforvisualfinish createvisualtask sub_8102BE8, 0x2 waitforvisualfinish @@ -4320,19 +4321,19 @@ Move_GRASS_WHISTLE: delay 0x4 waitforvisualfinish createvisualtask sub_8102CA0, 0x2 - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 13298 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB(18, 31, 12) waitforvisualfinish end Move_TICKLE: loadspritegfx 0x27EA - createsprite gUnknown_08597274, 0x2, 2, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 2, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gUnknown_08593A84, 0x0, -16, -8 createsprite gUnknown_08593A84, 0x0, 16, -8 playsewithpan SE_W197, -64 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 2, 0, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 2, 0, 16, 0, RGB_BLACK waitforvisualfinish delay 0x14 createvisualtask sub_80D5EB8, 0x3, 0, 6, 1280, 3, 0 @@ -4384,11 +4385,11 @@ Move_EXTRASENSORY: call AnimScript_82D7CD1 monbg ANIM_DEF_PARTNER setalpha 0x80C - createvisualtask sub_80A7B98, 0x5, 0, 891, 12, 1, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(27, 27, 0), 12, 1, 1 createvisualtask sub_810FE14, 0x5, 0 playsewithpan SE_W020, +63 waitforvisualfinish - createvisualtask sub_80A7B98, 0x5, 0, 891, 12, 1, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(27, 27, 0), 12, 1, 1 createvisualtask sub_810FE14, 0x5, 1 playsewithpan SE_W020, +63 waitforvisualfinish @@ -4607,7 +4608,7 @@ Move_SHOCK_WAVE: loadspritegfx 0x2735 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask sub_810AAFC, 0x2, 0, 20, 0, 2 playsewithpan SE_W268, -64 @@ -4725,7 +4726,7 @@ Move_ICE_PUNCH: loadspritegfx 0x279D loadspritegfx 0x2797 loadspritegfx 0x279F - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, RGB_BLACK createvisualtask sub_8116620, 0xA, 4, 2, 0, 9, 32588 delay 0x14 playsewithpan SE_W081, +63 @@ -4750,7 +4751,7 @@ Move_ICE_PUNCH: delay 0x5 createvisualtask sub_8116620, 0xA, 4, 2, 9, 0, 32588 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -4829,7 +4830,7 @@ Move_THUNDER: waitbgfadeout createvisualtask sub_8117660, 0x5, -256, 0, 1, -1 waitbgfadein - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, RGB_BLACK delay 0x10 createvisualtask sub_8115F10, 0x2, 257, 257, 257 playsewithpan SE_W086, +63 @@ -4873,7 +4874,7 @@ Move_THUNDER: delay 0x2 createvisualtask sub_8115F10, 0x2, 257, 257, 257 delay 0x1 - createsprite gUnknown_08597274, 0x82, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x82, 1, 2, 16, 0, RGB_BLACK waitforvisualfinish restorebg waitbgfadeout @@ -4887,7 +4888,7 @@ Move_THUNDER_PUNCH: loadspritegfx 0x2735 monbg ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, RGB_BLACK waitforvisualfinish playsewithpan SE_W004, +63 createsprite gUnknown_08595E98, 0x84, 0, 0, 8, 1, 0 @@ -4907,7 +4908,7 @@ Move_THUNDER_PUNCH: createvisualtask sub_80D51AC, 0x2, 1, 0, 3, 15, 1 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 2 delay 0x1 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_BLACK delay 0x14 waitforvisualfinish clearmonbg ANIM_TARGET @@ -5413,7 +5414,7 @@ Move_ICE_BEAM: monbgprio_28 ANIM_TARGET setalpha 0x80C loadspritegfx 0x279D - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, RGB_BLACK waitforvisualfinish createsoundtask sub_8158C58, 183, -64, 63, 4, 4, 0, 10 createsprite gUnknown_08595B2C, 0x2, 20, 12, 0, 12, 20 @@ -5422,7 +5423,7 @@ Move_ICE_BEAM: call AnimScript_82D07C1 call AnimScript_82D07C1 call AnimScript_82D07C1 - createsprite gUnknown_08597274, 0x2, 4, -31, 0, 7, 32384 + createsprite gUnknown_08597274, 0x2, 4, -31, 0, 7, RGB(0, 20, 31) createvisualtask sub_80D52D0, 0x2, 1, 2, 0, 25, 1 call AnimScript_82D07C1 call AnimScript_82D07C1 @@ -5438,9 +5439,9 @@ Move_ICE_BEAM: waitforvisualfinish delay 0x14 call AnimScript_82D7720 - createsprite gUnknown_08597274, 0x2, 4, 5, 7, 0, 32384 + createsprite gUnknown_08597274, 0x2, 4, 5, 7, 0, RGB(0, 20, 31) waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -5648,7 +5649,7 @@ AnimScript_82D0CB2: Move_POWDER_SNOW: loadspritegfx 0x279D monbg ANIM_DEF_PARTNER - createsprite gUnknown_08597274, 0x2, 31, 1, 0, 3, 0 + createsprite gUnknown_08597274, 0x2, 31, 1, 0, 3, RGB_BLACK waitforvisualfinish panse_1B SE_W016, -64, +63, +2, 0x0 call AnimScript_82D0D03 @@ -5660,7 +5661,7 @@ Move_POWDER_SNOW: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 0x14 - createsprite gUnknown_08597274, 0x2, 31, 1, 3, 0, 0 + createsprite gUnknown_08597274, 0x2, 31, 1, 3, 0, RGB_BLACK end AnimScript_82D0D03: @@ -5778,7 +5779,7 @@ Move_ABSORB: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 2 @@ -5791,7 +5792,7 @@ Move_ABSORB: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5831,7 +5832,7 @@ Move_MEGA_DRAIN: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 8, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 8, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 1 @@ -5844,7 +5845,7 @@ Move_MEGA_DRAIN: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 8, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 8, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5892,7 +5893,7 @@ Move_GIGA_DRAIN: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 12, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 12, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 0 @@ -5905,7 +5906,7 @@ Move_GIGA_DRAIN: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 12, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 12, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -6446,14 +6447,14 @@ Move_WHIRLPOOL: monbgprio_28 ANIM_TARGET setalpha 0x80C delay 0x0 - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_W250, +63 createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 50, 1 call AnimScript_82D1F5B call AnimScript_82D1F5B call AnimScript_82D1F5B delay 0xC - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -7354,7 +7355,7 @@ Move_POISON_TAIL: loadspritegfx 0x2797 loadspritegfx 0x27A6 loopsewithpan SE_W231, -64, 0x1C, 0x2 - createvisualtask sub_81144F8, 0x5, 1, 1, 23768 + createvisualtask sub_81144F8, 0x5, 1, 1, RGB(24, 6, 23) waitforvisualfinish monbg ANIM_TARGET setalpha 0x80C @@ -7783,7 +7784,7 @@ Move_SOFT_BOILED: delay 0x78 delay 0x7 playsewithpan SE_W030, -64 - createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, 31500 + createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, RGB(12, 24, 30) createsprite gUnknown_0859381C, 0x3, 31, 16, 0, 1 delay 0x8 createsprite gUnknown_0859381C, 0x3, 31, 16, 0, 1 @@ -7855,7 +7856,7 @@ Move_FAKE_OUT: createvisualtask sub_80D52D0, 0x2, 1, 4, 0, 5, 1 createvisualtask sub_8106020, 0x3 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, RGB_WHITE end Move_SCARY_FACE: @@ -8270,7 +8271,7 @@ Move_STOCKPILE: call AnimScript_82D4972 call AnimScript_82D4972 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 2, 0, 12, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 2, 0, 12, 0, RGB_WHITE end AnimScript_82D4972: @@ -8585,7 +8586,7 @@ Move_REFRESH: call AnimScript_82D79B4 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, 31500 + createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, RGB(12, 24, 30) createsprite gUnknown_0859381C, 0x3, 0, 0, 0, 0 end @@ -8622,7 +8623,7 @@ Move_HYPER_VOICE: end AnimScript_82D50FA: - createsprite gUnknown_08597274, 0x2, 31, 3, 8, 0, 1023 + createsprite gUnknown_08597274, 0x2, 31, 3, 8, 0, RGB_YELLOW createvisualtask sub_80D6064, 0x5, -5, -5, 5, 0, 0 createsprite gUnknown_08593880, 0x0, 45, 0, 0, 0, 0, 0, 1 createvisualtask sub_80D52D0, 0x2, 1, 1, 0, 6, 1 @@ -8633,14 +8634,14 @@ AnimScript_82D50FA: Move_SAND_TOMB: loadspritegfx 0x275A - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(19, 17, 0) createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 43, 1 playsewithpan SE_W328, +63 call AnimScript_82D51B7 call AnimScript_82D51B7 call AnimScript_82D51B7 delay 0x16 - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish end @@ -9422,7 +9423,7 @@ Move_OVERHEAT: loadspritegfx 0x2797 monbg ANIM_DEF_PARTNER setalpha 0x120C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 5, 28 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 5, RGB(28, 0, 0) waitforvisualfinish createvisualtask sub_8117C44, 0x5 waitforvisualfinish @@ -9433,7 +9434,7 @@ Move_OVERHEAT: playsewithpan SE_W082, -64 createvisualtask sub_8117CA0, 0x5, 1, 0 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, 1, 0, 13, 28 + createsprite gUnknown_08597274, 0x2, 2, 1, 0, 13, RGB(28, 0, 0) createvisualtask sub_80D51AC, 0x5, 0, 2, 0, 15, 1 waitforvisualfinish playsewithpan SE_W172B, -64 @@ -9479,12 +9480,12 @@ Move_OVERHEAT: playsewithpan SE_W007, +63 createvisualtask sub_8117DD8, 0x5, 1 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, -1, 0, 13, 19026 + createsprite gUnknown_08597274, 0x2, 2, -1, 0, 13, RGB(18, 18, 18) createvisualtask sub_80D51AC, 0x5, 0, 3, 0, 15, 1 waitforvisualfinish createvisualtask sub_8117D3C, 0x5, 0, 1 delay 0x1 - createsprite gUnknown_08597274, 0x2, 1, 1, 5, 0, 28 + createsprite gUnknown_08597274, 0x2, 1, 1, 5, 0, RGB(28, 0, 0) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -9492,7 +9493,7 @@ Move_OVERHEAT: delay 0xF createvisualtask sub_8117D3C, 0x5, 1, 0 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, 0, 13, 0, 19026 + createsprite gUnknown_08597274, 0x2, 2, 0, 13, 0, RGB(18, 18, 18) waitforvisualfinish createvisualtask sub_8117C70, 0x5 waitforvisualfinish @@ -9643,7 +9644,7 @@ Move_WATER_PULSE: monbg ANIM_TARGET monbgprio_28 ANIM_TARGET playsewithpan SE_W145C, -64 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 7, 29472 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 7, RGB(0, 25, 28) delay 0xA createsprite gUnknown_085952F8, 0x42, 100, 100, 8, 1, 20, 40, 0 createsprite gUnknown_085952F8, 0x42, 20, 100, 16, 2, 10, 35, 1 @@ -9663,7 +9664,7 @@ Move_WATER_PULSE: delay 0xD createvisualtask sub_80D51AC, 0x2, 1, 0, 8, 18, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 7, 0, 29472 + createsprite gUnknown_08597274, 0x2, 1, 1, 7, 0, RGB(0, 25, 28) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -10560,13 +10561,13 @@ AnimScript_82D800E: monbgprio_28 ANIM_TARGET setalpha 0x80C delay 0x0 - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_W250, +63 createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 30, 1 call AnimScript_82D1F5B call AnimScript_82D1F5B delay 0xC - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish stopsound clearmonbg ANIM_DEF_PARTNER @@ -10591,13 +10592,13 @@ AnimScript_82D8062: AnimScript_82D80BF: loadspritegfx 0x275A - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(19, 17, 0) createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 30, 1 playsewithpan SE_W328, +63 call AnimScript_82D51B7 call AnimScript_82D51B7 delay 0x16 - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish stopsound end @@ -10619,7 +10620,7 @@ Anim_ItemEffect: call AnimScript_82D79B4 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x2, 2, 3, 7, 0, 26609 + createsprite gUnknown_08597274, 0x2, 2, 3, 7, 0, RGB(17, 31, 25) createsprite gUnknown_0859381C, 0x3, 0, 0, 0, 0 waitforvisualfinish end @@ -10663,11 +10664,11 @@ Anim_SmokeBallEscape: end Anim_HangedOn: - createsprite gUnknown_08597274, 0x0, 2, 7, 0, 9, 31 + createsprite gUnknown_08597274, 0x0, 2, 7, 0, 9, RGB_RED playsewithpan SE_W082, -64 createvisualtask sub_815DB90, 0x5, 30, 128, 0, 1, 2, 0, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x0, 2, 4, 9, 0, 31 + createsprite gUnknown_08597274, 0x0, 2, 4, 9, 0, RGB_RED waitforvisualfinish delay 0x6 createsprite gUnknown_0857FE58, 0x0, 0, 0, 15 @@ -10769,7 +10770,7 @@ Anim_FutureSightHit: Anim_DoomDesireHit: createvisualtask sub_8117F10, 0x2 loadspritegfx 0x27D6 - createsprite gUnknown_08597274, 0x2, 1, 3, 0, 16, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 0, 16, RGB_WHITE waitforvisualfinish delay 0xA createvisualtask sub_815C0A4, 0x5 @@ -10796,7 +10797,7 @@ Anim_DoomDesireHit: playsewithpan SE_W120, +63 createsprite gUnknown_0859371C, 0x3, 16, 16, 1, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, RGB_WHITE waitforvisualfinish end @@ -10818,7 +10819,7 @@ Status_Ingrain: loadspritegfx 0x272F monbg ANIM_DEF_PARTNER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish delay 0x3 call AnimScript_82D1009 @@ -10826,7 +10827,7 @@ Status_Ingrain: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff diff --git a/include/constants/rgb.h b/include/constants/rgb.h new file mode 100644 index 000000000..2c22df32a --- /dev/null +++ b/include/constants/rgb.h @@ -0,0 +1,15 @@ +#ifndef GUARD_RGB_H +#define GUARD_RGB_H + +#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) + +#define RGB_BLACK RGB(0, 0, 0) +#define RGB_WHITE RGB(31, 31, 31) +#define RGB_RED RGB(31, 0, 0) +#define RGB_GREEN RGB(0, 31, 0) +#define RGB_BLUE RGB(0, 0, 31) +#define RGB_YELLOW RGB(31, 31, 0) +#define RGB_MAGENTA RGB(31, 0, 31) +#define RGB_CYAN RGB(0, 31, 31) + +#endif // GUARD_RGB_H diff --git a/include/gba/defines.h b/include/gba/defines.h index 41cc84f4a..5c07347ce 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -60,11 +60,6 @@ #define TOTAL_OBJ_TILE_COUNT 1024 -#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) - -#define RGB_BLACK RGB(0, 0, 0) -#define RGB_WHITE RGB(31, 31, 31) - #define WIN_RANGE(a, b) (((a) << 8) | (b)) #endif // GUARD_GBA_DEFINES diff --git a/src/battle_interface.c b/src/battle_interface.c index 6a6bf00a2..da6f97942 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -20,6 +20,7 @@ #include "international_string_util.h" #include "safari_zone.h" #include "battle_anim.h" +#include "constants/rgb.h" struct TestingBar { @@ -555,13 +556,13 @@ enum PAL_STATUS_BRN }; -static const u16 sStatusIconPalettes[] = +static const u16 sStatusIconColors[] = { - 0x6198, // PAL_STATUS_PSN - 0xEF7, // PAL_STATUS_PAR - 0x4694, // PAL_STATUS_SLP - 0x72D1, // PAL_STATUS_FRZ - 0x29DC // PAL_STATUS_BRN + RGB(24, 12, 24), // PAL_STATUS_PSN + RGB(23, 23, 3), // PAL_STATUS_PAR + RGB(20, 20, 17), // PAL_STATUS_SLP + RGB(17, 22, 28), // PAL_STATUS_FRZ + RGB(28, 14, 10) // PAL_STATUS_BRN }; static const struct WindowTemplate sHealthboxWindowTemplate = {0, 0, 0, 8, 2, 0, 0}; // width = 8, height = 2 @@ -2071,7 +2072,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16; pltAdder += bank + 12; - FillPalette(sStatusIconPalettes[statusPalId], pltAdder + 0x100, 2); + FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2); CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2); CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96); if (IsDoubleBattle() == TRUE || GetBankSide(bank) == SIDE_OPPONENT) diff --git a/src/palette.c b/src/palette.c index d7b6ad479..cc2046b14 100644 --- a/src/palette.c +++ b/src/palette.c @@ -4,6 +4,7 @@ #include "decompress.h" #include "gpu_regs.h" #include "task.h" +#include "constants/rgb.h" enum { diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index c8fcff93a..2bd4e3ef9 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -5,6 +5,7 @@ #include "trig.h" #include "task.h" #include "blend_palette.h" +#include "constants/rgb.h" struct UnkAnimStruct { @@ -903,7 +904,7 @@ static void Task_HandleMonAnimation(u8 taskId) sprite->data[1] = 1; sprite->data[0] = 0; - for (i = 2; i < 8; i++) + for (i = 2; i < ARRAY_COUNT(sprite->data); i++) sprite->data[i] = 0; sprite->callback = sMonAnimFunctions[gTasks[taskId].tAnimId]; @@ -1588,13 +1589,13 @@ static void pokemonanimfunc_15(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0); + BlendPalette(sprite->data[7], 0x10, 0, RGB_BLACK); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 16); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_BLACK); } sprite->data[2]++; @@ -2050,13 +2051,13 @@ static void pokemonanimfunc_20(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0x2DF); + BlendPalette(sprite->data[7], 0x10, 0, RGB(31, 22, 0)); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x2DF); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB(31, 22, 0)); } sprite->data[2] += 2; @@ -2069,13 +2070,13 @@ static void pokemonanimfunc_21(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0x1F); + BlendPalette(sprite->data[7], 0x10, 0, RGB_RED); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x1F); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_RED); } sprite->data[2] += 2; @@ -2088,13 +2089,13 @@ static void pokemonanimfunc_22(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0x7C00); + BlendPalette(sprite->data[7], 0x10, 0, RGB_BLUE); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x7C00); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_BLUE); } sprite->data[2] += 2; @@ -2107,13 +2108,13 @@ static void pokemonanimfunc_23(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x3FF); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_YELLOW); } sprite->data[2] += 2; @@ -2126,13 +2127,13 @@ static void pokemonanimfunc_24(struct Sprite *sprite) if (sprite->data[2] > 128) { - BlendPalette(sprite->data[7], 0x10, 0, 0x6018); + BlendPalette(sprite->data[7], 0x10, 0, RGB(24, 0, 24)); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], 0x6018); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB(24, 0, 24)); } sprite->data[2] += 2; @@ -2602,9 +2603,9 @@ static void pokemonanimfunc_2C(struct Sprite *sprite) if (sprite->data[4] == 1) { if (sUnknown_0860AA64[sprite->data[6]][0] != 0) - BlendPalette(sprite->data[7], 0x10, 0x10, 0x3FF); + BlendPalette(sprite->data[7], 0x10, 0x10, RGB_YELLOW); else - BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); sprite->data[4] = 0; } @@ -5357,9 +5358,9 @@ static void BackAnimBlendYellow(struct Sprite *sprite) if (sprite->data[4] == 1) { if (array[sprite->data[6]].field_0 != 0) - BlendPalette(sprite->data[7], 0x10, 0x10, 0x3FF); + BlendPalette(sprite->data[7], 0x10, 0x10, RGB_YELLOW); else - BlendPalette(sprite->data[7], 0x10, 0, 0x3FF); + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); sprite->data[4] = 0; } @@ -5419,22 +5420,22 @@ static void pokemonanimfunc_8D(struct Sprite *sprite) BackAnimBlendYellow(sprite); } -static const u16 sUnknown_0860AE88[] = -{ - 0x1F, 0x3E0, 0x7C00, 0x0 -}; - static void BackAnimBlend(struct Sprite *sprite) { + static const u16 sColors[] = + { + RGB_RED, RGB_GREEN, RGB_BLUE, RGB_BLACK + }; + if (sprite->data[2] > 127) { - BlendPalette(sprite->data[7], 0x10, 0, 0x1F); + BlendPalette(sprite->data[7], 0x10, 0, RGB_RED); sprite->callback = SpriteCB_SetDummyOnAnimEnd; } else { sprite->data[6] = Sin(sprite->data[2], 12); - BlendPalette(sprite->data[7], 0x10, sprite->data[6], sUnknown_0860AE88[sprite->data[1]]); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], sColors[sprite->data[1]]); } } From d728124a7b51d5db257d58ae9b47a5285c696748 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 15:55:34 +0100 Subject: [PATCH 11/15] decompile time events --- asm/field_screen.s | 6 +- asm/time_events.s | 225 ---------------------------------------- data/time_events.s | 7 -- include/field_weather.h | 169 +++++++++++++++++++++++++++++- include/overworld.h | 2 + include/time_events.h | 8 ++ ld_script.txt | 4 +- src/time_events.c | 118 +++++++++++++++++++++ 8 files changed, 299 insertions(+), 240 deletions(-) delete mode 100644 asm/time_events.s delete mode 100644 data/time_events.s create mode 100644 include/time_events.h create mode 100644 src/time_events.c diff --git a/asm/field_screen.s b/asm/field_screen.s index 6b49b9c7c..1792b9cc8 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -2472,15 +2472,15 @@ _080AC3B6: bx r0 thumb_func_end play_some_sound - thumb_func_start sub_80AC3BC -sub_80AC3BC: @ 80AC3BC + thumb_func_start IsWeatherChangeComplete +IsWeatherChangeComplete: @ 80AC3BC ldr r0, =gUnknown_02038454 ldr r1, =0x000006d3 adds r0, r1 ldrb r0, [r0] bx lr .pool - thumb_func_end sub_80AC3BC + thumb_func_end IsWeatherChangeComplete thumb_func_start sub_80AC3D0 sub_80AC3D0: @ 80AC3D0 diff --git a/asm/time_events.s b/asm/time_events.s deleted file mode 100644 index de2d2d165..000000000 --- a/asm/time_events.s +++ /dev/null @@ -1,225 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start GetMirageRnd -GetMirageRnd: @ 8137890 - push {r4,lr} - ldr r0, =0x00004024 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004025 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - orrs r4, r0 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetMirageRnd - - thumb_func_start SetMirageRnd -SetMirageRnd: @ 81378BC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =0x00004024 - lsrs r1, r4, 16 - bl VarSet - ldr r0, =0x00004025 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl VarSet - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetMirageRnd - - thumb_func_start InitMirageRnd -InitMirageRnd: @ 81378E4 - push {r4,lr} - bl Random - adds r4, r0, 0 - bl Random - lsls r4, 16 - lsls r0, 16 - lsrs r0, 16 - orrs r4, r0 - adds r0, r4, 0 - bl SetMirageRnd - pop {r4} - pop {r0} - bx r0 - thumb_func_end InitMirageRnd - - thumb_func_start UpdateMirageRnd -UpdateMirageRnd: @ 8137904 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl GetMirageRnd - adds r1, r0, 0 - cmp r4, 0 - beq _08137928 - ldr r3, =0x41c64e6d - ldr r2, =0x00003039 -_08137918: - adds r0, r1, 0 - muls r0, r3 - adds r1, r0, r2 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - bne _08137918 -_08137928: - adds r0, r1, 0 - bl SetMirageRnd - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateMirageRnd - - thumb_func_start IsMirageIslandPresent -IsMirageIslandPresent: @ 813793C - push {r4-r6,lr} - bl GetMirageRnd - lsrs r6, r0, 16 - movs r5, 0 -_08137946: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _08137978 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldr r1, =0x0000ffff - ands r1, r0 - cmp r1, r6 - bne _08137978 - movs r0, 0x1 - b _08137980 - .pool -_08137978: - adds r5, 0x1 - cmp r5, 0x5 - ble _08137946 - movs r0, 0 -_08137980: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end IsMirageIslandPresent - - thumb_func_start UpdateShoalTideFlag -UpdateShoalTideFlag: @ 8137988 - push {lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r0, 24 - bl is_light_level_1_2_3_5_or_6 - lsls r0, 24 - cmp r0, 0 - beq _081379CE - bl RtcCalcLocalTime - ldr r1, =gUnknown_085B2B44 - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081379C8 - ldr r0, =0x0000089a - bl FlagSet - b _081379CE - .pool -_081379C8: - ldr r0, =0x0000089a - bl FlagClear -_081379CE: - pop {r0} - bx r0 - .pool - thumb_func_end UpdateShoalTideFlag - - thumb_func_start Task_WaitWeather -Task_WaitWeather: @ 81379D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80AC3BC - lsls r0, 24 - cmp r0, 0 - beq _081379F2 - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_081379F2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end Task_WaitWeather - - thumb_func_start WaitWeather -WaitWeather: @ 81379F8 - push {lr} - ldr r0, =Task_WaitWeather - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end WaitWeather - - thumb_func_start InitBirchState -InitBirchState: @ 8137A0C - push {lr} - ldr r0, =0x00004049 - bl GetVarPointer - movs r1, 0 - strh r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end InitBirchState - - thumb_func_start UpdateBirchState -UpdateBirchState: @ 8137A20 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004049 - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0x7 - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateBirchState diff --git a/data/time_events.s b/data/time_events.s deleted file mode 100644 index 7a543fff5..000000000 --- a/data/time_events.s +++ /dev/null @@ -1,7 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085B2B44:: @ 85B2B44 - .byte 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01 diff --git a/include/field_weather.h b/include/field_weather.h index e12107e70..0bdebf747 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -1,12 +1,175 @@ #ifndef GUARD_WEATHER_H #define GUARD_WEATHER_H -void fade_screen(u8, s8); +#include "sprite.h" +// Controls how the weather should be changing the screen palettes. +enum { + WEATHER_PAL_STATE_CHANGING_WEATHER, + WEATHER_PAL_STATE_SCREEN_FADING_IN, + WEATHER_PAL_STATE_SCREEN_FADING_OUT, + WEATHER_PAL_STATE_IDLE, +}; + +struct Weather +{ + union + { + struct + { + struct Sprite *rainSprites[24]; + struct Sprite *snowflakeSprites[101]; + struct Sprite *cloudSprites[3]; + } s1; + struct + { + u8 filler0[0xA0]; + struct Sprite *fog1Sprites[20]; + struct Sprite *ashSprites[20]; + struct Sprite *fog2Sprites[20]; + struct Sprite *sandstormSprites1[20]; + struct Sprite *sandstormSprites2[5]; + } s2; + } sprites; + u8 gammaShifts[19][32]; + u8 altGammaShifts[19][32]; + s8 gammaIndex; + s8 gammaTargetIndex; + u8 gammaStepDelay; + u8 gammaStepFrameCounter; + u16 fadeDestColor; + u8 palProcessingState; + u8 fadeScreenCounter; + bool8 readyForInit; + u8 taskId; + u8 unknown_6CA; + u8 unknown_6CB; + u16 initStep; + u16 finishStep; + u8 currWeather; + u8 nextWeather; + u8 weatherGfxLoaded; + bool8 weatherChangeComplete; + u8 weatherPicSpritePalIndex; + u8 altGammaSpritePalIndex; + u16 unknown_6D6; + u8 unknown_6D8; + u8 unknown_6D9; + u8 rainSpriteCount; + u8 unknown_6DB; + u8 unknown_6DC; + u8 rainStrength; + /*0x6DE*/ u8 cloudSpritesCreated; + u8 filler_6DF[1]; + u16 unknown_6E0; + u16 unknown_6E2; + u8 snowflakeSpriteCount; + u8 unknown_6E5; + u16 unknown_6E6; + u16 thunderCounter; + u8 unknown_6EA; + u8 unknown_6EB; + u8 unknown_6EC; + u8 unknown_6ED; + u16 fog1ScrollPosX; + u16 unknown_6F0; + u16 unknown_6F2; + u8 lightenedFogSpritePals[6]; + u8 lightenedFogSpritePalsCount; + u8 fog1SpritesCreated; + u16 unknown_6FC; + u16 unknown_6FE; + u8 ashSpritesCreated; + u8 filler_701[3]; + u32 unknown_704; + u32 unknown_708; + u8 filler_70C[2]; + u16 unknown_70E; + u16 unknown_710; + u16 unknown_712; + u16 unknown_714; + u8 sandstormSprites1Created; + u8 sandstormSprites2Created; + u16 unknown_718; + u16 unknown_71A; + u16 unknown_71C; + u16 unknown_71E; + u16 unknown_720; + u16 unknown_722; + u8 fog2SpritesCreated; + u8 filler_725[1]; + u16 unknown_726; + u16 unknown_728; + u16 unknown_72A; + u16 unknown_72C; + u8 unknown_72E; + u8 filler_72F; + u16 currBlendEVA; + u16 currBlendEVB; + u16 targetBlendEVA; + u16 targetBlendEVB; + u8 blendUpdateCounter; + u8 blendFrameCounter; + u8 blendDelay; + u8 filler_73B[0x3C-0x3B]; + s16 unknown_73C; + s16 unknown_73E; + s16 unknown_740; + s16 unknown_742; + u8 filler_744[0xD-4]; + s8 loadDroughtPalsIndex; + u8 loadDroughtPalsOffset; +}; + +void StartWeather(void); +void ChangeWeather(u8 weather); +void sub_807C988(u8 effect); +void sub_807C9B4(u8 effect); +void Task_WeatherInit(u8); +void Task_WeatherMain(u8); +void sub_807CAE8(void); +void nullsub_38(void); +void SetWeatherScreenFadeOut(void); + +enum +{ + FADE_FROM_BLACK, + FADE_TO_BLACK, + FADE_FROM_WHITE, + FADE_TO_WHITE, +}; + +void FadeScreen(u8, u8); +// ... +void UpdateSpritePaletteWithWeather(u8 tag); +void ApplyWeatherGammaShiftToPal(u8); +// ... +void Weather_SetBlendCoeffs(u8, u8); +// ... +void PlayRainSoundEffect(void); +// ... void SetSav1Weather(u32); u8 GetSav1Weather(void); -void sub_80AEDBC(void); - +void SetSav1WeatherFromCurrMapHeader(void); +// ... void DoCurrentWeather(void); +void sub_8080750(); + +bool8 IsWeatherNotFadingIn(void); +bool8 IsWeatherChangeComplete(void); +void SetWeather(u32); +void UpdateWeatherPerDay(u16); +void PreservePaletteInWeather(u8 index); +void ResetPreservedPalettesInWeather(void); +extern void ResetDroughtWeatherPaletteLoading(void); +void ResetDroughtWeatherPaletteLoading(void); +bool8 LoadDroughtWeatherPalettes(void); +u8 GetCurrentWeather(void); +void LoadCustomWeatherSpritePalette(const u16 *palette); + + +extern struct Weather gWeather; + +extern struct Weather *const gWeatherPtr; #endif // GUARD_WEATHER_H diff --git a/include/overworld.h b/include/overworld.h index 597a160ed..974f8f091 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -70,6 +70,8 @@ void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpNum); void c2_load_new_map(void); void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused); void mapldr_default(void); +u8 get_map_light_from_warp0(void); +bool8 is_light_level_1_2_3_5_or_6(u8 a1); void IncrementGameStat(u8); u32 GetGameStat(u8); diff --git a/include/time_events.h b/include/time_events.h new file mode 100644 index 000000000..fd6d29f39 --- /dev/null +++ b/include/time_events.h @@ -0,0 +1,8 @@ +#ifndef GUARD_TIME_EVENTS_H +#define GUARD_TIME_EVENTS_H + +void UpdateMirageRnd(u16); +u8 IsMirageIslandPresent(void); +void UpdateBirchState(u16); + +#endif // GUARD_TIME_EVENTS_H diff --git a/ld_script.txt b/ld_script.txt index f2a9d8196..d3bf4e845 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -185,7 +185,7 @@ SECTIONS { src/pokeblock.o(.text); asm/fldeff_flash.o(.text); asm/post_battle_event_funcs.o(.text); - asm/time_events.o(.text); + src/time_events.o(.text); asm/birch_pc.o(.text); src/hof_pc.o(.text); asm/field_specials.o(.text); @@ -472,7 +472,7 @@ SECTIONS { src/wallclock.o(.rodata); src/pokeblock.o(.rodata); data/fldeff_flash.o(.rodata); - data/time_events.o(.rodata); + src/time_events.o(.rodata); data/field_specials.o(.rodata); data/battle_records.o(.rodata); data/pokedex_area_screen.o(.rodata); diff --git a/src/time_events.c b/src/time_events.c new file mode 100644 index 000000000..1f169a5c6 --- /dev/null +++ b/src/time_events.c @@ -0,0 +1,118 @@ +#include "global.h" +#include "time_events.h" +#include "event_data.h" +#include "field_weather.h" +#include "pokemon.h" +#include "random.h" +#include "overworld.h" +#include "rtc.h" +#include "script.h" +#include "task.h" + +static u32 GetMirageRnd(void) +{ + u32 hi = VarGet(VAR_MIRAGE_RND_H); + u32 lo = VarGet(VAR_MIRAGE_RND_L); + return (hi << 16) | lo; +} + +static void SetMirageRnd(u32 rnd) +{ + VarSet(VAR_MIRAGE_RND_H, rnd >> 16); + VarSet(VAR_MIRAGE_RND_L, rnd); +} + +// unused +void InitMirageRnd(void) +{ + SetMirageRnd((Random() << 16) | Random()); +} + +void UpdateMirageRnd(u16 days) +{ + s32 rnd = GetMirageRnd(); + while (days) + { + rnd = 1103515245 * rnd + 12345; + days--; + } + SetMirageRnd(rnd); +} + +bool8 IsMirageIslandPresent(void) +{ + u16 rnd = GetMirageRnd() >> 16; + int i; + + for (i = 0; i < PARTY_SIZE; i++) + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && (GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY) & 0xFFFF) == rnd) + return TRUE; + + return FALSE; +} + +void UpdateShoalTideFlag(void) +{ + static const u8 tide[] = + { + 1, // 00 + 1, // 01 + 1, // 02 + 0, // 03 + 0, // 04 + 0, // 05 + 0, // 06 + 0, // 07 + 0, // 08 + 1, // 09 + 1, // 10 + 1, // 11 + 1, // 12 + 1, // 13 + 1, // 14 + 0, // 15 + 0, // 16 + 0, // 17 + 0, // 18 + 0, // 19 + 0, // 20 + 1, // 21 + 1, // 22 + 1, // 23 + }; + + if (is_light_level_1_2_3_5_or_6(get_map_light_from_warp0())) + { + RtcCalcLocalTime(); + if (tide[gLocalTime.hours]) + FlagSet(FLAG_SYS_SHOAL_TIDE); + else + FlagClear(FLAG_SYS_SHOAL_TIDE); + } +} + +static void Task_WaitWeather(u8 taskId) +{ + if (IsWeatherChangeComplete()) + { + EnableBothScriptContexts(); + DestroyTask(taskId); + } +} + +void WaitWeather(void) +{ + CreateTask(Task_WaitWeather, 80); +} + +void InitBirchState(void) +{ + *GetVarPointer(VAR_BIRCH_STATE) = 0; +} + +void UpdateBirchState(u16 days) +{ + u16 *state = GetVarPointer(VAR_BIRCH_STATE); + *state += days; + *state %= 7; +} From 76fc1d1c129fa1aa01bd51d44ba1aa780f69f9cf Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 16:25:09 +0100 Subject: [PATCH 12/15] make time events compile --- asm/cable_club.s | 8 ++++---- asm/easy_chat.s | 2 +- asm/field_screen.s | 28 ++++++++++++++-------------- asm/item_use.s | 2 +- asm/link.s | 2 +- asm/overworld.s | 4 ++-- asm/party_menu.s | 8 ++++---- asm/player_pc.s | 6 +++--- asm/pokemon_storage_system.s | 2 +- asm/pokemon_summary_screen.s | 2 +- asm/pokenav.s | 2 +- asm/shop.s | 4 ++-- asm/start_menu.s | 2 +- include/field_weather.h | 2 +- src/decoration.c | 10 +++++----- src/egg_hatch.c | 4 ++-- src/scrcmd.c | 10 +++++----- src/secret_base.c | 6 +++--- 18 files changed, 52 insertions(+), 52 deletions(-) diff --git a/asm/cable_club.s b/asm/cable_club.s index 611b87eef..64d6088b1 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -1808,7 +1808,7 @@ _080B32E0: _080B32F8: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 @@ -1921,7 +1921,7 @@ _080B33E8: _080B3408: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =gLinkType ldr r2, =0x00002211 adds r1, r2, 0 @@ -2399,7 +2399,7 @@ _080B382E: bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl sub_8009FAC b _080B3864 _080B3840: @@ -2470,7 +2470,7 @@ _080B38C6: bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl Rfu_set_zero b _080B38FC _080B38D8: diff --git a/asm/easy_chat.s b/asm/easy_chat.s index 86c78d2cf..db2ffac14 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -652,7 +652,7 @@ sub_811A7E4: @ 811A7E4 _0811A804: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _0811A840 _0811A80E: ldr r0, =gPaletteFade diff --git a/asm/field_screen.s b/asm/field_screen.s index 1792b9cc8..5e9452d71 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -1625,8 +1625,8 @@ _080ABCBC: .pool thumb_func_end sub_80ABC7C - thumb_func_start fade_screen -fade_screen: @ 80ABCD0 + thumb_func_start FadeScreen +FadeScreen: @ 80ABCD0 push {r4,r5,lr} sub sp, 0x4 lsls r0, 24 @@ -1762,7 +1762,7 @@ _080ABDE4: pop {r0} bx r0 .pool - thumb_func_end fade_screen + thumb_func_end FadeScreen thumb_func_start sub_80ABDFC sub_80ABDFC: @ 80ABDFC @@ -7537,8 +7537,8 @@ GetSav1Weather: @ 80AEDAC .pool thumb_func_end GetSav1Weather - thumb_func_start sub_80AEDBC -sub_80AEDBC: @ 80AEDBC + thumb_func_start SetSav1WeatherFromCurrMapHeader +SetSav1WeatherFromCurrMapHeader: @ 80AEDBC push {r4,r5,lr} ldr r4, =gSaveBlock1Ptr ldr r0, [r4] @@ -7559,7 +7559,7 @@ sub_80AEDBC: @ 80AEDBC pop {r0} bx r0 .pool - thumb_func_end sub_80AEDBC + thumb_func_end SetSav1WeatherFromCurrMapHeader thumb_func_start sub_80AEDF0 sub_80AEDF0: @ 80AEDF0 @@ -7872,13 +7872,13 @@ _080AF06A: bl palette_bg_faded_fill_black movs r0, 0 movs r1, 0 - bl fade_screen + bl FadeScreen b _080AF084 _080AF078: bl palette_bg_faded_fill_white movs r0, 0x2 movs r1, 0 - bl fade_screen + bl FadeScreen _080AF084: pop {r4} pop {r0} @@ -7891,7 +7891,7 @@ sub_80AF08C: @ 80AF08C bl palette_bg_faded_fill_white movs r0, 0x2 movs r1, 0x8 - bl fade_screen + bl FadeScreen pop {r0} bx r0 thumb_func_end sub_80AF08C @@ -7902,7 +7902,7 @@ pal_fill_black: @ 80AF0A0 bl palette_bg_faded_fill_black movs r0, 0 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 thumb_func_end pal_fill_black @@ -7928,12 +7928,12 @@ sub_80AF0B4: @ 80AF0B4 _080AF0DA: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _080AF0EC _080AF0E4: movs r0, 0x3 movs r1, 0 - bl fade_screen + bl FadeScreen _080AF0EC: pop {r4} pop {r0} @@ -8761,7 +8761,7 @@ sub_80AF79C: @ 80AF79C bl music_something movs r0, 0x3 movs r1, 0x8 - bl fade_screen + bl FadeScreen bl play_some_sound ldr r0, =gFieldCallback ldr r1, =sub_80AF3B0 @@ -8990,7 +8990,7 @@ _080AF99A: bl sub_8009FAC movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl music_something movs r0, 0x9 bl PlaySE diff --git a/asm/item_use.s b/asm/item_use.s index 0d9f30ec3..8c9e854c7 100644 --- a/asm/item_use.s +++ b/asm/item_use.s @@ -1482,7 +1482,7 @@ _080FDBC8: str r1, [r0] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_80FDC00 str r0, [r5] _080FDBDA: diff --git a/asm/link.s b/asm/link.s index 1ad160340..76c6521cf 100644 --- a/asm/link.s +++ b/asm/link.s @@ -21684,7 +21684,7 @@ _080148CC: bne _080149B2 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen movs r0, 0x2 strh r0, [r7] b _080149B2 diff --git a/asm/overworld.s b/asm/overworld.s index 2858fb6d3..3e041d25f 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -1383,7 +1383,7 @@ _080850C8: adds r1, r5, 0 bl TryUpdateRandomTrainerRematches bl DoTimeBasedEvents - bl sub_80AEDBC + bl SetSav1WeatherFromCurrMapHeader bl sub_8085B2C bl update_sav1_flash_used_on_map bl Overworld_ClearSavedMusic @@ -1483,7 +1483,7 @@ _080851A2: beq _080851EE bl DoTimeBasedEvents _080851EE: - bl sub_80AEDBC + bl SetSav1WeatherFromCurrMapHeader bl sub_8085B2C cmp r5, 0 beq _08085200 diff --git a/asm/party_menu.s b/asm/party_menu.s index 429b629ea..0dc03a1e2 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -17171,7 +17171,7 @@ sub_81B9404: @ 81B9404 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B9424 movs r1, 0xA bl CreateTask @@ -17247,7 +17247,7 @@ sub_81B94B0: @ 81B94B0 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B94D0 movs r1, 0xA bl CreateTask @@ -17297,7 +17297,7 @@ sub_81B951C: @ 81B951C bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B953C movs r1, 0xA bl CreateTask @@ -17418,7 +17418,7 @@ sub_81B9620: @ 81B9620 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B9640 movs r1, 0xA bl CreateTask diff --git a/asm/player_pc.s b/asm/player_pc.s index 3f08d3f5c..5d9314f80 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -552,7 +552,7 @@ sub_816B2C8: @ 816B2C8 str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 .pool @@ -1221,7 +1221,7 @@ sub_816B878: @ 816B878 lsrs r4, 24 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r1, =gTasks lsls r0, r4, 2 adds r0, r4 @@ -1494,7 +1494,7 @@ sub_816BABC: @ 816BABC _0816BAD4: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =gTasks lsls r1, r4, 2 adds r1, r4 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index c105c7781..8fc10ba29 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -406,7 +406,7 @@ _080C7428: _080C745C: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen movs r0, 0x4 strh r0, [r5, 0x8] b _080C756A diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 2817b55b1..a04939c12 100644 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -2049,7 +2049,7 @@ sub_81C4F24: @ 81C4F24 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81C4F44 movs r1, 0xA bl CreateTask diff --git a/asm/pokenav.s b/asm/pokenav.s index 896d9aae0..52fe65d65 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -44,7 +44,7 @@ sub_81C72A4: @ 81C72A4 bl SetMainCallback2 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 .pool diff --git a/asm/shop.s b/asm/shop.s index eacef5837..70429c7cf 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -188,7 +188,7 @@ HandleShopMenuBuy: @ 80DFBD0 str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r4} pop {r0} bx r0 @@ -216,7 +216,7 @@ HandleShopMenuSell: @ 80DFC0C str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r4} pop {r0} bx r0 diff --git a/asm/start_menu.s b/asm/start_menu.s index 518b46f76..93bef1ef2 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -449,7 +449,7 @@ _0809FB34: beq _0809FBA0 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _0809FBA0 .pool _0809FB98: diff --git a/include/field_weather.h b/include/field_weather.h index 0bdebf747..5d1aa5ac2 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -139,7 +139,7 @@ enum FADE_TO_WHITE, }; -void FadeScreen(u8, u8); +void FadeScreen(u8, s8); // ... void UpdateSpritePaletteWithWeather(u8 tag); void ApplyWeatherGammaShiftToPal(u8); diff --git a/src/decoration.c b/src/decoration.c index a9777c86f..68a455285 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -529,7 +529,7 @@ void SecretBasePC_PutAway(u8 taskId) { sub_8126A58(0); sub_8197434(0, 0); - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_8129ABC; } @@ -1247,7 +1247,7 @@ void sub_8127F68(u8 taskId) { if (sub_8127F38() == TRUE) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_8128060; } @@ -1661,7 +1661,7 @@ void sub_8128BA0(u8 taskId) void sub_8128BBC(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = c1_overworld_prev_quest; } @@ -2635,7 +2635,7 @@ void sub_812A1A0(u8 taskId) void sub_812A1C0(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_81298EC; } @@ -2654,7 +2654,7 @@ void sub_812A210(u8 taskId) void sub_812A22C(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_812A25C; } diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 435886638..e8f22e903 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -61,7 +61,7 @@ extern u8 sav1_map_get_name(void); extern s8 ProcessMenuInputNoWrap_(void); extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8); extern void sub_806A068(u16, u8); -extern void fade_screen(u8, u8); +extern void FadeScreen(u8, u8); extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); extern void AllocateMonSpritesGfx(void); @@ -465,7 +465,7 @@ void EggHatch(void) { ScriptContext2_Enable(); CreateTask(Task_EggHatch, 10); - fade_screen(1, 0); + FadeScreen(1, 0); } static void Task_EggHatch(u8 taskID) diff --git a/src/scrcmd.c b/src/scrcmd.c index 0557cd95e..1768f0d4c 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -638,7 +638,7 @@ static bool8 IsPaletteNotActive(void) bool8 ScrCmd_fadescreen(struct ScriptContext *ctx) { - fade_screen(ScriptReadByte(ctx), 0); + FadeScreen(ScriptReadByte(ctx), 0); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } @@ -648,7 +648,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx) u8 mode = ScriptReadByte(ctx); u8 speed = ScriptReadByte(ctx); - fade_screen(mode, speed); + FadeScreen(mode, speed); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } @@ -662,12 +662,12 @@ bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx) case 1: default: CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(mode, 0); + FadeScreen(mode, 0); break; case 0: case 2: CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(mode, 0); + FadeScreen(mode, 0); break; } @@ -726,7 +726,7 @@ bool8 ScrCmd_setweather(struct ScriptContext *ctx) bool8 ScrCmd_resetweather(struct ScriptContext *ctx) { - sub_80AEDBC(); + SetSav1WeatherFromCurrMapHeader(); return FALSE; } diff --git a/src/secret_base.c b/src/secret_base.c index bf6bec1f8..61c2511b7 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -394,7 +394,7 @@ void sub_80E8FD0(u8 taskId) void sub_80E9068(void) { CreateTask(sub_80E8FD0, 0); - fade_screen(1, 0); + FadeScreen(1, 0); saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); } @@ -451,7 +451,7 @@ void sub_80E916C(u8 taskId) void sub_80E91F8(void) { CreateTask(sub_80E916C, 0); - fade_screen(1, 0); + FadeScreen(1, 0); } bool8 CurrentMapIsSecretBase(void) @@ -651,7 +651,7 @@ void sub_80E96A4(u8 taskId) void sub_80E9728(void) { CreateTask(sub_80E96A4, 0); - fade_screen(1, 0); + FadeScreen(1, 0); } void sub_80E9744(void) From 0995b753458fbc6117e2ca813de258165b1cddc0 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 16:37:42 +0100 Subject: [PATCH 13/15] Delete option_menu.s --- asm/option_menu.s | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 asm/option_menu.s diff --git a/asm/option_menu.s b/asm/option_menu.s deleted file mode 100644 index c3fc4d140..000000000 --- a/asm/option_menu.s +++ /dev/null @@ -1,10 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - .align 2, 0 @ Don't pad with nop. From db3ecf5012612ed08aab55f4a8993afea74a4216 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jan 2018 17:47:12 +0100 Subject: [PATCH 14/15] decompile scanline effect --- asm/battle_anim_80FE840.s | 132 ++++----- asm/battle_anim_815A0D4.s | 24 +- asm/battle_frontier_1.s | 10 +- asm/contest.s | 4 +- asm/contest_link_80F57C4.s | 4 +- asm/field_screen.s | 28 +- asm/intro.s | 10 +- asm/link.s | 14 +- asm/overworld.s | 8 +- asm/pokenav.s | 14 +- asm/rayquaza_scene.s | 10 +- asm/reset_rtc_screen.s | 2 +- asm/start_menu.s | 2 +- asm/title_screen.s | 4 +- asm/trainer_card.s | 20 +- asm/unknown_task.s | 593 ------------------------------------- asm/use_pokeblock.s | 4 +- include/scanline_effect.h | 47 +++ include/unknown_task.h | 22 -- ld_script.txt | 2 +- src/battle_2.c | 45 ++- src/battle_transition.c | 258 ++++++++-------- src/berry_fix_program.c | 2 +- src/diploma.c | 2 +- src/evolution_scene.c | 6 +- src/hall_of_fame.c | 2 +- src/mail.c | 2 +- src/option_menu.c | 2 +- src/pokeblock.c | 2 +- src/reshow_battle_screen.c | 6 +- src/scanline_effect.c | 262 ++++++++++++++++ src/use_pokeblock.c | 4 +- src/wallclock.c | 2 +- sym_ewram.txt | 31 +- 34 files changed, 616 insertions(+), 964 deletions(-) delete mode 100644 asm/unknown_task.s create mode 100644 include/scanline_effect.h delete mode 100644 include/unknown_task.h create mode 100644 src/scanline_effect.c diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 031bf2128..9a8b378ac 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -12802,7 +12802,7 @@ _08104EDC: lsls r0, 16 cmp r2, r0 bgt _08104F1A - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r4, r0 @@ -12839,7 +12839,7 @@ _08104F1A: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_8104F54 str r0, [r5] add sp, 0xC @@ -12919,7 +12919,7 @@ _08104FCC: ldrsh r0, [r3, r1] cmp r0, 0 blt _08104FF0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers lsls r0, 1 adds r0, r2 ldrh r1, [r3, 0x14] @@ -12943,7 +12943,7 @@ _08104FF0: ldrsh r1, [r3, r2] cmp r0, r1 blt _0810500E - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] adds r0, r4, 0 @@ -18518,7 +18518,7 @@ _08107D8C: movs r3, 0 movs r2, 0x10 ldrsh r0, [r4, r2] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers mov r12, r1 cmp r3, r0 bge _08107DCA @@ -18555,7 +18555,7 @@ _08107DCA: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107E04 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -18584,7 +18584,7 @@ _08107E04: asrs r0, r2, 16 cmp r0, 0x9F bgt _08107E3A - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -18652,7 +18652,7 @@ _08107E7A: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -18689,8 +18689,8 @@ _08107ED8: ldrsh r0, [r4, r1] cmp r3, r0 bge _08107F0C - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107EE6: lsls r1, r3, 16 asrs r1, 16 @@ -18719,8 +18719,8 @@ _08107F0C: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107F40 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F1E: asrs r3, r2, 16 lsls r2, r3, 1 @@ -18745,8 +18745,8 @@ _08107F40: asrs r0, r1, 16 cmp r0, 0x9F bgt _08108022 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F4E: asrs r3, r1, 16 lsls r2, r3, 1 @@ -18771,8 +18771,8 @@ _08107F78: ldrsh r0, [r4, r1] cmp r3, r0 bge _08107FAC - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F86: lsls r1, r3, 16 asrs r1, 16 @@ -18801,8 +18801,8 @@ _08107FAC: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107FE0 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107FBE: asrs r3, r2, 16 lsls r2, r3, 1 @@ -18827,8 +18827,8 @@ _08107FE0: asrs r0, r1, 16 cmp r0, 0x9F bgt _0810800C - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107FEE: asrs r3, r1, 16 lsls r2, r3, 1 @@ -34618,7 +34618,7 @@ _0810FEC0: adds r0, 0x40 cmp r1, r0 bgt _0810FEFA - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -34651,7 +34651,7 @@ _0810FEFA: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_810FF34 str r0, [r4] add sp, 0xC @@ -34700,7 +34700,7 @@ _0810FF66: ldr r0, =gSineTable mov r9, r0 movs r7, 0x3 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers mov r12, r1 movs r2, 0xF0 lsls r2, 3 @@ -34775,7 +34775,7 @@ _0810FFFE: ble _08110026 b _08110014 _0811000E: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08110014: @@ -38728,7 +38728,7 @@ _08112054: _0811206C: movs r2, 0x2 movs r3, 0x6 - bl sub_80BA384 + bl ScanlineEffect_InitWave lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1C] @@ -38884,7 +38884,7 @@ _081121A8: beq _081121F0 b _08112258 _081121AE: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] movs r0, 0x1 @@ -41152,7 +41152,7 @@ _0811345A: ldrsh r0, [r4, r1] cmp r3, r0 bgt _08113488 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -41175,7 +41175,7 @@ _08113488: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_81134B8 str r0, [r4] add sp, 0xC @@ -41264,7 +41264,7 @@ _0811354E: bl sub_8113574 b _0811356E _08113556: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] ldrh r0, [r2, 0x8] @@ -41292,11 +41292,11 @@ sub_8113574: @ 8113574 ldrsh r0, [r5, r1] cmp r4, r0 bgt _081135CA - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers mov r12, r7 ldr r0, =gSineTable mov r8, r0 - ldr r6, =gUnknown_02039B28 + ldr r6, =gScanlineEffect _08113592: lsls r2, r4, 1 ldrb r1, [r6, 0x14] @@ -42169,7 +42169,7 @@ _08113CB0: movs r0, 0x3 bl sub_8114374 movs r3, 0 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r4, r0 @@ -42189,7 +42189,7 @@ _08113CDC: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams movs r0, 0x3F eors r7, r0 movs r1, 0xFC @@ -42344,7 +42344,7 @@ _08113E3E: b _08113E5E .pool _08113E58: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08113E5E: @@ -42534,7 +42534,7 @@ _08114002: str r0, [sp, 0x10] movs r3, 0 add r4, sp, 0x10 - ldr r6, =gUnknown_02038C28 + ldr r6, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r7, r6, r0 @@ -42563,7 +42563,7 @@ _08114010: strb r2, [r4, 0x9] ldr r0, [sp, 0x10] ldr r2, [r4, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams _08114044: ldrh r0, [r5, 0x8] adds r0, 0x1 @@ -42772,7 +42772,7 @@ _081141DA: bne _08114232 b _08114204 _081141FE: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08114204: @@ -42827,9 +42827,9 @@ sub_8114244: @ 8114244 movs r4, 0 cmp r0, 0 ble _081142A4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect _08114278: lsls r2, r4, 16 asrs r2, 16 @@ -42861,9 +42861,9 @@ _081142A4: ldrsh r0, [r6, r2] cmp r1, r0 bgt _081142EE - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect _081142B8: asrs r4, r3, 16 cmp r4, 0 @@ -42904,8 +42904,8 @@ _081142EE: ldrsh r0, [r6, r3] cmp r1, r0 bge _08114366 - ldr r7, =gUnknown_02038C28 - ldr r4, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r4, =gScanlineEffect _08114306: asrs r3, r2, 16 cmp r3, 0 @@ -42935,7 +42935,7 @@ _08114338: adds r5, r0, 0 adds r5, 0x9F movs r4, 0 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers movs r2, 0xF0 lsls r2, 3 adds r6, r3, r2 @@ -44235,7 +44235,7 @@ _08114E4E: b _08114E7E .pool _08114E78: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08114E7E: @@ -44510,7 +44510,7 @@ _08115094: ldrsh r0, [r0, r1] cmp r0, 0 bne _081150DA - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _081150C2: @@ -44561,7 +44561,7 @@ _08115114: asrs r4, r0, 16 cmp r2, r0 bge _08115140 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -44584,7 +44584,7 @@ _08115140: asrs r0, r1, 16 cmp r0, 0x9F bgt _0811516E - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers lsls r0, r3, 16 asrs r0, 16 adds r3, r0, 0 @@ -44616,7 +44616,7 @@ _0811516E: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams add sp, 0xC pop {r4-r6} pop {r0} @@ -50740,9 +50740,9 @@ _08118442: strh r0, [r1, 0xC] _0811845A: movs r3, 0 - ldr r5, =gUnknown_02039B28 + ldr r5, =gScanlineEffect mov r9, r5 - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers mov r6, r9 adds r5, r1, 0 _08118466: @@ -50760,8 +50760,8 @@ _08118466: ble _08118466 cmp r3, 0x9F bgt _081184AA - ldr r7, =gUnknown_02038C28 - ldr r6, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r6, =gScanlineEffect ldr r1, =gTasks mov r2, r12 adds r0, r2, r4 @@ -51089,9 +51089,9 @@ _0811873C: strh r0, [r1, 0xC] _08118752: movs r3, 0 - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r8, r0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers mov r12, r2 mov r7, r8 adds r4, r1, 0 @@ -51110,9 +51110,9 @@ _08118760: ble _08118760 cmp r3, 0x9F bgt _081187A4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect ldr r1, =gTasks adds r0, r6, r5 lsls r0, 3 @@ -51378,9 +51378,9 @@ _081189BA: strh r0, [r1, 0xC] _081189D0: movs r3, 0 - ldr r6, =gUnknown_02039B28 + ldr r6, =gScanlineEffect mov r8, r6 - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers adds r4, r1, 0 _081189DA: lsls r2, r3, 1 @@ -51397,8 +51397,8 @@ _081189DA: ble _081189DA cmp r3, 0x9F bgt _08118A1E - ldr r7, =gUnknown_02038C28 - ldr r6, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r6, =gScanlineEffect ldr r1, =gTasks mov r2, r12 adds r0, r2, r5 @@ -51707,9 +51707,9 @@ _08118C90: strh r0, [r1, 0xC] _08118CA6: movs r3, 0 - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r12, r0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers mov r8, r2 mov r7, r12 adds r4, r1, 0 @@ -51728,9 +51728,9 @@ _08118CB4: ble _08118CB4 cmp r3, 0x9F bgt _08118CF8 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r8, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect ldr r1, =gTasks adds r0, r5, r6 lsls r0, 3 @@ -52025,7 +52025,7 @@ _08118F28: lsls r1, 7 movs r0, 0xC bl SetGpuReg - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] ldr r1, =gTasks diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index d583f1e85..f3b72792d 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -1689,7 +1689,7 @@ _0815AE58: ldrsh r0, [r5, r6] cmp r1, r0 bgt _0815AE8E - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r0, r4 @@ -1729,7 +1729,7 @@ _0815AEA2: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_815AED8 str r0, [r5] add sp, 0xC @@ -1820,7 +1820,7 @@ _0815AF5C: ldrsh r0, [r4, r2] cmp r1, r0 bge _0815AF90 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -1848,7 +1848,7 @@ _0815AF90: ldrsh r0, [r4, r2] cmp r1, r0 bgt _0815AFC4 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -1877,7 +1877,7 @@ _0815AFC4: ldrsh r0, [r4, r1] cmp r0, 0 beq _0815AFDA - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0815AFDA: @@ -6151,7 +6151,7 @@ _0815D316: ldrh r3, [r0] movs r7, 0 movs r2, 0 - ldr r6, =gUnknown_02038C28 + ldr r6, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r0, r6 @@ -6192,7 +6192,7 @@ _0815D326: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_815D398 str r0, [r4] add sp, 0xC @@ -6304,7 +6304,7 @@ _0815D40E: ldrsh r0, [r6, r3] cmp r1, r0 ble _0815D52E - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r10, r0 ldr r1, [sp, 0x4] lsls r0, r1, 16 @@ -6325,7 +6325,7 @@ _0815D47E: subs r0, r1 lsls r0, 7 adds r2, r0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers adds r2, r0 lsls r4, 16 asrs r4, 16 @@ -6343,7 +6343,7 @@ _0815D47E: subs r0, r1 lsls r0, 7 adds r3, r0 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r3, r1 lsls r1, r7, 16 asrs r1, 16 @@ -6407,7 +6407,7 @@ _0815D52E: lsls r1, r2, 17 cmp r1, 0 blt _0815D55A - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r7, [sp, 0x4] lsls r0, r7, 16 asrs r0, 16 @@ -6487,7 +6487,7 @@ _0815D5CC: asrs r0, 16 cmp r0, 0xC ble _0815D63C - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] movs r0, 0 diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 91c8215e5..31d5d3fbe 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -11000,8 +11000,8 @@ _0819486C: movs r1, 0 strh r1, [r0, 0x8] _08194878: - bl dp12_8087EA4 - ldr r0, =gUnknown_02038C28 + bl ScanlineEffect_Clear + ldr r0, =gScanlineEffectRegBuffers ldr r2, =0x00001f0a movs r4, 0xF0 lsls r4, 3 @@ -11017,7 +11017,7 @@ _08194888: bge _08194888 movs r5, 0x5B ldr r3, =gUnknown_0860CF44 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers ldr r2, =0x00001f09 ldr r4, =0x00000836 adds r1, r0, r4 @@ -11033,7 +11033,7 @@ _081948A4: ldr r0, [r3] ldr r1, [r3, 0x4] ldr r2, [r3, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams mov r0, r8 bl DestroyTask _081948C2: @@ -11513,7 +11513,7 @@ sub_8194CE4: @ 8194CE4 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/contest.s b/asm/contest.s index 3c34965ad..e81ce8d5c 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -563,7 +563,7 @@ _080D7B4E: bl sub_80D779C bl sub_80D77E4 bl sub_80D7678 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetPaletteFade ldr r2, =gPaletteFade ldrb r0, [r2, 0x8] @@ -1367,7 +1367,7 @@ vblank_cb_battle: @ 80D827C bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 55503fde1..e73c657a9 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -344,7 +344,7 @@ sub_80F5B00: @ 80F5B00 bl SetVBlankCallback bl sub_80F7DF4 bl sub_80F57C4 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetPaletteFade bl ResetSpriteData bl ResetTasks @@ -492,7 +492,7 @@ sub_80F5C24: @ 80F5C24 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/field_screen.s b/asm/field_screen.s index 6b49b9c7c..c02ba6492 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -9572,12 +9572,12 @@ _080AFE30: beq _080AFEBC b _080AFEC6 _080AFE36: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r2, 0x2 ldrsh r1, [r4, r2] @@ -9591,12 +9591,12 @@ _080AFE36: b _080AFEC6 .pool _080AFE64: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r6, 0x2 ldrsh r1, [r4, r6] @@ -9631,7 +9631,7 @@ _080AFEB4: bl DestroyTask b _080AFEC6 _080AFEBC: - bl dp12_8087EA4 + bl ScanlineEffect_Clear adds r0, r5, 0 bl DestroyTask _080AFEC6: @@ -9665,12 +9665,12 @@ _080AFEF4: beq _080AFF80 b _080AFF8A _080AFEFA: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r2, 0x2 ldrsh r1, [r4, r2] @@ -9684,12 +9684,12 @@ _080AFEFA: b _080AFF8A .pool _080AFF28: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r6, 0x2 ldrsh r1, [r4, r6] @@ -9724,7 +9724,7 @@ _080AFF78: bl DestroyTask b _080AFF8A _080AFF80: - bl dp12_8087EA4 + bl ScanlineEffect_Clear adds r0, r5, 0 bl DestroyTask _080AFF8A: @@ -9914,7 +9914,7 @@ sub_80B00E8: @ 80B00E8 lsrs r0, 24 cmp r0, 0 beq _080B0116 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r1, =gUnknown_0854FE64 lsls r0, 1 adds r0, r1 @@ -9940,7 +9940,7 @@ _080B0116: thumb_func_start door_upload_tiles door_upload_tiles: @ 80B0124 push {r4,lr} - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0x00000e68 @@ -10261,7 +10261,7 @@ _080B0368: bl sub_8199C30 movs r0, 0 bl schedule_bg_copy_tilemap_to_vram - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r2, 0x4 ldrsh r1, [r5, r2] movs r0, 0x6 @@ -10280,7 +10280,7 @@ _080B0368: ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams movs r0, 0x1 strh r0, [r5] b _080B052C diff --git a/asm/intro.s b/asm/intro.s index efc36e7d9..3e95c6ec7 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -11,7 +11,7 @@ sub_816CBE8: @ 816CBE8 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_816CBE8 @@ -2124,7 +2124,7 @@ task_intro_17: @ 816DEEC movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave add sp, 0xC pop {r0} bx r0 @@ -2411,7 +2411,7 @@ _0816E156: adds r0, r1 ldr r1, =task_intro_19 str r1, [r0] - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0816E176: @@ -2623,7 +2623,7 @@ task_intro_19: @ 816E2A0 movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave add sp, 0xC pop {r4} pop {r0} @@ -3038,7 +3038,7 @@ _0816E69C: adds r0, r1 ldr r1, =task_intro_21 str r1, [r0] - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0816E6BC: diff --git a/asm/link.s b/asm/link.s index 1ad160340..e05d33974 100644 --- a/asm/link.s +++ b/asm/link.s @@ -39837,7 +39837,7 @@ sub_801DF20: @ 801DF20 bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_801DF20 @@ -42568,7 +42568,7 @@ sub_801F544: @ 801F544 str r0, [r4] _0801F55A: bl FreeAllWindowBuffers - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] pop {r4} @@ -44875,13 +44875,13 @@ sub_8020770: @ 8020770 strh r1, [r0, 0x20] str r1, [sp, 0xC] add r0, sp, 0xC - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r2, =0x010003c0 bl CpuFastSet ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams add sp, 0x10 pop {r0} bx r0 @@ -44896,12 +44896,12 @@ sub_80207C0: @ 80207C0 lsrs r0, 16 mov r1, sp strh r0, [r1] - ldr r5, =gUnknown_02039B28 + ldr r5, =gScanlineEffect ldrb r0, [r5, 0x14] lsls r1, r0, 4 subs r1, r0 lsls r1, 7 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers adds r1, r4 ldr r2, =0x01000090 mov r0, sp @@ -44939,7 +44939,7 @@ sub_8020818: @ 8020818 lsrs r4, 16 mov r0, sp strh r4, [r0] - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers ldr r0, =0x01000090 mov r9, r0 mov r0, sp diff --git a/asm/overworld.s b/asm/overworld.s index 2858fb6d3..d2d389eac 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -3637,7 +3637,7 @@ VBlankCB_Field: @ 8086390 push {lr} bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer bl FieldUpdateBgTilemapScroll bl TransferPlttBuffer bl TransferTilesetAnimsBuffer @@ -3657,7 +3657,7 @@ sub_80863B0: @ 80863B0 ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams b _080863F0 .pool _080863D4: @@ -3671,7 +3671,7 @@ _080863D4: ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams _080863F0: pop {r0} bx r0 @@ -4294,7 +4294,7 @@ sub_8086988: @ 8086988 bl ResetTasks bl ResetSpriteData bl ResetPaletteFade - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl dp13_810BB8C bl ResetCameraUpdateInfo bl InstallCameraPanAheadCallback diff --git a/asm/pokenav.s b/asm/pokenav.s index 896d9aae0..79cfeb75d 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -7068,7 +7068,7 @@ sub_81CA914: @ 81CA914 bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_81CA914 @@ -7101,7 +7101,7 @@ titlescreen_0: @ 81CA92C ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_81CA914 bl c3args_set_0toR1_1to0 ldr r0, =sub_81CA9EC @@ -7220,7 +7220,7 @@ sub_81CAA3C: @ 81CAA3C mov r0, sp movs r6, 0 strh r6, [r0] - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers ldr r0, =0x010000a0 mov r8, r0 mov r0, sp @@ -15647,7 +15647,7 @@ sub_81CEE44: @ 81CEE44 bl TransferPlttBuffer adds r0, r4, 0 bl sub_81D2108 - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r4} pop {r0} bx r0 @@ -22318,7 +22318,7 @@ sub_81D20BC: @ 81D20BC b _081D20FA .pool _081D20D4: - bl dp12_8087EA4 + bl ScanlineEffect_Clear ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -22332,7 +22332,7 @@ _081D20E2: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -22366,7 +22366,7 @@ sub_81D2108: @ 81D2108 adds r0, r6, 0 bl sub_81D2634 movs r7, 0 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers mov r12, r5 movs r0, 0xF0 lsls r0, 3 diff --git a/asm/rayquaza_scene.s b/asm/rayquaza_scene.s index f60b2a252..8832d3942 100644 --- a/asm/rayquaza_scene.s +++ b/asm/rayquaza_scene.s @@ -1058,7 +1058,7 @@ _081D6FC8: sub_81D6FD0: @ 81D6FD0 push {lr} bl sub_81D67EC - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_81D6FD0 @@ -1183,12 +1183,12 @@ sub_81D7134: @ 81D7134 lsls r6, r1, 3 ldr r7, =gTasks + 0x8 adds r5, r6, r7 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl sub_81D6FE0 bl sub_81D706C movs r4, 0 str r4, [sp, 0x4] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r2, =0x010003c0 add r0, sp, 0x4 bl CpuFastSet @@ -1196,7 +1196,7 @@ sub_81D7134: @ 81D7134 ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams strh r4, [r5] ldr r0, =sub_81D7228 movs r1, 0 @@ -1278,7 +1278,7 @@ sub_81D7228: @ 81D7228 adds r3, r1, r0 movs r1, 0x18 ldr r7, =gUnknown_0203CF60 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r5, r4, r0 diff --git a/asm/reset_rtc_screen.s b/asm/reset_rtc_screen.s index ab5e0840c..b314afbf5 100644 --- a/asm/reset_rtc_screen.s +++ b/asm/reset_rtc_screen.s @@ -888,7 +888,7 @@ _0809EFCA: bl ResetOamRange bl LoadOam bl ScanlineEffect_Stop - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetSpriteData bl ResetTasks bl ResetPaletteFade diff --git a/asm/start_menu.s b/asm/start_menu.s index 518b46f76..e4e75b4d2 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1561,7 +1561,7 @@ _080A0490: bl ResetSpriteData bl ResetTasks bl ResetPaletteFade - bl dp12_8087EA4 + bl ScanlineEffect_Clear b _080A04FC _080A04A2: movs r0, 0 diff --git a/asm/title_screen.s b/asm/title_screen.s index 54c1b5353..32594424a 100644 --- a/asm/title_screen.s +++ b/asm/title_screen.s @@ -464,7 +464,7 @@ _080AA766: @ void title_screen_vblank_callback() title_screen_vblank_callback: @ 80AA780 push {lr} - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer @@ -779,7 +779,7 @@ _080AAAF0: movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave ldr r0, =c2_title_screen_2 bl SetMainCallback2 _080AAB1E: diff --git a/asm/trainer_card.s b/asm/trainer_card.s index f1679d04e..fe6133618 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -18,7 +18,7 @@ sub_80C2690: @ 80C2690 cmp r0, 0 beq _080C26C0 ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers str r0, [r1] movs r2, 0xF0 lsls r2, 3 @@ -40,7 +40,7 @@ sub_80C26D4: @ 80C26D4 ldrh r3, [r4] movs r0, 0 strh r0, [r4] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r0, =0x04000006 ldrh r2, [r0] movs r0, 0xFF @@ -3977,9 +3977,9 @@ sub_80C4998: @ 80C4998 movs r0, 0x3 bl HideBg bl ScanlineEffect_Stop - bl dp12_8087EA4 + bl ScanlineEffect_Clear movs r1, 0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers movs r2, 0 movs r3, 0xF0 lsls r3, 3 @@ -4066,7 +4066,7 @@ _080C4A0E: movs r2, 0 cmp r2, r7 bcs _080C4A78 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers _080C4A60: lsls r0, r2, 16 asrs r0, 16 @@ -4091,7 +4091,7 @@ _080C4A78: lsrs r7, r4, 16 cmp r1, r0 bge _080C4AB0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 adds r4, r3, 0 _080C4A92: @@ -4116,7 +4116,7 @@ _080C4AB0: asrs r0, r1, 16 cmp r0, 0x9F bgt _080C4ACE - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers _080C4ABC: asrs r0, r1, 16 lsls r1, r0, 1 @@ -4392,7 +4392,7 @@ _080C4CB6: movs r2, 0 cmp r2, r7 bcs _080C4D20 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers _080C4D08: lsls r0, r2, 16 asrs r0, 16 @@ -4417,7 +4417,7 @@ _080C4D20: lsrs r7, r4, 16 cmp r1, r0 bge _080C4D56 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 adds r4, r3, 0 _080C4D3A: @@ -4441,7 +4441,7 @@ _080C4D56: asrs r0, r1, 16 cmp r0, 0x9F bgt _080C4D74 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers _080C4D62: asrs r0, r1, 16 lsls r1, r0, 1 diff --git a/asm/unknown_task.s b/asm/unknown_task.s deleted file mode 100644 index a8672ac8f..000000000 --- a/asm/unknown_task.s +++ /dev/null @@ -1,593 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start ScanlineEffect_Stop -ScanlineEffect_Stop: @ 80B9FB8 - push {r4,lr} - ldr r4, =gUnknown_02039B28 - movs r0, 0 - strb r0, [r4, 0x15] - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldrb r0, [r4, 0x18] - cmp r0, 0xFF - beq _080B9FE2 - bl DestroyTask - movs r0, 0xFF - strb r0, [r4, 0x18] -_080B9FE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ScanlineEffect_Stop - - thumb_func_start dp12_8087EA4 -dp12_8087EA4: @ 80B9FF8 - push {r4,lr} - sub sp, 0x4 - mov r0, sp - movs r4, 0 - strh r4, [r0] - ldr r1, =gUnknown_02038C28 - ldr r2, =0x01000780 - bl CpuSet - ldr r0, =gUnknown_02039B28 - movs r1, 0 - str r1, [r0] - str r1, [r0, 0x4] - str r1, [r0, 0x8] - str r1, [r0, 0xC] - strb r4, [r0, 0x14] - strb r4, [r0, 0x15] - strb r4, [r0, 0x16] - strb r4, [r0, 0x17] - movs r1, 0xFF - strb r1, [r0, 0x18] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp12_8087EA4 - - thumb_func_start sub_80BA038 -sub_80BA038: @ 80BA038 - push {lr} - sub sp, 0xC - str r0, [sp] - str r1, [sp, 0x4] - str r2, [sp, 0x8] - ldr r0, =0xa2600001 - cmp r1, r0 - bne _080BA06C - ldr r0, =gUnknown_02039B28 - ldr r1, =gUnknown_02038C2A - str r1, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - str r1, [r0, 0x4] - ldr r1, =sub_80BA134 - b _080BA07C - .pool -_080BA06C: - ldr r0, =gUnknown_02039B28 - ldr r1, =gUnknown_02038C2C - str r1, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - str r1, [r0, 0x4] - ldr r1, =sub_80BA154 -_080BA07C: - str r1, [r0, 0x10] - adds r1, r0, 0 - ldr r0, [sp, 0x4] - str r0, [r1, 0xC] - ldr r0, [sp] - str r0, [r1, 0x8] - mov r0, sp - ldrb r0, [r0, 0x8] - strb r0, [r1, 0x15] - mov r0, sp - ldrb r0, [r0, 0x9] - strb r0, [r1, 0x16] - strb r0, [r1, 0x17] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA038 - - thumb_func_start sub_80BA0A8 -sub_80BA0A8: @ 80BA0A8 - push {r4,lr} - ldr r4, =gUnknown_02039B28 - ldrb r0, [r4, 0x15] - cmp r0, 0 - beq _080BA122 - cmp r0, 0x3 - bne _080BA0EC - movs r0, 0 - strb r0, [r4, 0x15] - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldr r1, =gUnknown_02039B44 - movs r0, 0x1 - strb r0, [r1] - b _080BA122 - .pool -_080BA0EC: - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldrb r0, [r4, 0x14] - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - str r0, [r1] - ldr r0, [r4, 0x8] - str r0, [r1, 0x4] - ldr r0, [r4, 0xC] - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r0, [r4, 0x10] - bl _call_via_r0 - ldrb r0, [r4, 0x14] - movs r1, 0x1 - eors r0, r1 - strb r0, [r4, 0x14] -_080BA122: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA0A8 - - thumb_func_start sub_80BA134 -sub_80BA134: @ 80BA134 - ldr r0, =gUnknown_02039B28 - ldr r2, [r0, 0x8] - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - ldr r1, =gUnknown_02038C28 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_80BA134 - - thumb_func_start sub_80BA154 -sub_80BA154: @ 80BA154 - ldr r0, =gUnknown_02039B28 - ldr r2, [r0, 0x8] - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - ldr r1, =gUnknown_02038C28 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - bx lr - .pool - thumb_func_end sub_80BA154 - - thumb_func_start task00_for_dp12 -task00_for_dp12: @ 80BA174 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - movs r6, 0 - ldr r0, =gUnknown_02039B44 - ldrb r0, [r0] - cmp r0, 0 - beq _080BA1A4 - mov r0, r12 - bl DestroyTask - ldr r1, =gUnknown_02039B28 - movs r0, 0xFF - strb r0, [r1, 0x18] - b _080BA324 - .pool -_080BA1A4: - ldr r1, =gTasks - mov r0, r12 - lsls r2, r0, 2 - adds r0, r2, r0 - lsls r0, 3 - adds r3, r0, r1 - movs r4, 0x16 - ldrsh r0, [r3, r4] - mov r10, r1 - mov r9, r2 - cmp r0, 0 - beq _080BA250 - movs r1, 0x14 - ldrsh r0, [r3, r1] - cmp r0, 0xE - bhi _080BA250 - lsls r0, 2 - ldr r1, =_080BA1D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080BA1D8: - .4byte _080BA214 - .4byte _080BA250 - .4byte _080BA21C - .4byte _080BA250 - .4byte _080BA224 - .4byte _080BA250 - .4byte _080BA22C - .4byte _080BA250 - .4byte _080BA234 - .4byte _080BA250 - .4byte _080BA23C - .4byte _080BA250 - .4byte _080BA244 - .4byte _080BA250 - .4byte _080BA24C -_080BA214: - ldr r0, =gBattle_BG0_X - b _080BA24E - .pool -_080BA21C: - ldr r0, =gBattle_BG0_Y - b _080BA24E - .pool -_080BA224: - ldr r0, =gBattle_BG1_X - b _080BA24E - .pool -_080BA22C: - ldr r0, =gBattle_BG1_Y - b _080BA24E - .pool -_080BA234: - ldr r0, =gBattle_BG2_X - b _080BA24E - .pool -_080BA23C: - ldr r0, =gBattle_BG2_Y - b _080BA24E - .pool -_080BA244: - ldr r0, =gBattle_BG3_X - b _080BA24E - .pool -_080BA24C: - ldr r0, =gBattle_BG3_Y -_080BA24E: - ldrh r6, [r0] -_080BA250: - mov r0, r9 - add r0, r12 - lsls r0, 3 - mov r2, r10 - adds r1, r0, r2 - ldrh r2, [r1, 0x10] - movs r3, 0x10 - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _080BA2BC - subs r0, r2, 0x1 - strh r0, [r1, 0x10] - movs r4, 0xE - ldrsh r0, [r1, r4] - movs r3, 0xA0 - lsls r3, 1 - adds r2, r0, r3 - movs r4, 0x8 - ldrsh r3, [r1, r4] - movs r4, 0xA - ldrsh r0, [r1, r4] - cmp r3, r0 - bge _080BA324 - ldr r5, =gUnknown_02038C28 - ldr r0, =gUnknown_02039B28 - mov r8, r0 - adds r7, r1, 0 - lsls r0, r2, 1 - adds r4, r0, r5 -_080BA28A: - lsls r2, r3, 1 - mov r0, r8 - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - adds r2, r0 - adds r2, r5 - ldrh r0, [r4] - adds r0, r6 - strh r0, [r2] - adds r4, 0x2 - adds r3, 0x1 - movs r1, 0xA - ldrsh r0, [r7, r1] - cmp r3, r0 - blt _080BA28A - b _080BA324 - .pool -_080BA2BC: - ldrh r0, [r1, 0x12] - strh r0, [r1, 0x10] - movs r2, 0xE - ldrsh r0, [r1, r2] - movs r3, 0xA0 - lsls r3, 1 - adds r2, r0, r3 - movs r4, 0x8 - ldrsh r3, [r1, r4] - movs r4, 0xA - ldrsh r0, [r1, r4] - cmp r3, r0 - bge _080BA304 - ldr r5, =gUnknown_02038C28 - adds r7, r1, 0 - lsls r0, r2, 1 - adds r4, r0, r5 - ldr r0, =gUnknown_02039B28 - mov r8, r0 -_080BA2E2: - lsls r2, r3, 1 - mov r0, r8 - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - adds r2, r0 - adds r2, r5 - ldrh r0, [r4] - adds r0, r6 - strh r0, [r2] - adds r4, 0x2 - adds r3, 0x1 - movs r1, 0xA - ldrsh r0, [r7, r1] - cmp r3, r0 - blt _080BA2E2 -_080BA304: - mov r0, r9 - add r0, r12 - lsls r0, 3 - mov r3, r10 - adds r2, r0, r3 - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r4, 0xC - ldrsh r1, [r2, r4] - cmp r0, r1 - bne _080BA324 - movs r0, 0 - strh r0, [r2, 0xE] -_080BA324: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task00_for_dp12 - - thumb_func_start sub_80BA33C -sub_80BA33C: @ 80BA33C - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r4, r2, 24 - movs r1, 0 - movs r2, 0 - ldr r0, =gSineTable - mov r12, r0 -_080BA350: - lsls r0, r1, 1 - adds r3, r0, r6 - lsls r0, r2, 1 - add r0, r12 - movs r7, 0 - ldrsh r0, [r0, r7] - muls r0, r4 - cmp r0, 0 - bge _080BA364 - adds r0, 0xFF -_080BA364: - asrs r0, 8 - strh r0, [r3] - adds r0, r2, r5 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xFF - bls _080BA350 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA33C - - thumb_func_start sub_80BA384 -sub_80BA384: @ 80BA384 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - adds r5, r0, 0 - str r1, [sp, 0x10] - ldr r0, [sp, 0x40] - mov r8, r0 - ldr r1, [sp, 0x44] - mov r9, r1 - ldr r0, [sp, 0x48] - mov r10, r0 - lsls r5, 24 - lsrs r5, 24 - ldr r1, [sp, 0x10] - lsls r1, 24 - str r1, [sp, 0x14] - lsrs r0, r1, 24 - str r0, [sp, 0xC] - lsls r1, r2, 24 - lsrs r1, 24 - str r1, [sp, 0x18] - lsls r2, r3, 24 - lsrs r2, 24 - str r2, [sp, 0x1C] - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - mov r3, r9 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - bl dp12_8087EA4 - ldr r0, =0x04000010 - add r0, r9 - str r0, [sp] - ldr r0, =0xa2600001 - str r0, [sp, 0x4] - mov r1, sp - movs r0, 0x1 - strb r0, [r1, 0x8] - mov r0, sp - movs r1, 0 - strb r1, [r0, 0x9] - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl sub_80BA038 - ldr r0, =task00_for_dp12 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r0 - strh r5, [r4, 0x8] - mov r3, sp - ldrh r3, [r3, 0xC] - strh r3, [r4, 0xA] - movs r0, 0x80 - lsls r0, 1 - ldr r1, [sp, 0x18] - bl __divsi3 - strh r0, [r4, 0xC] - movs r0, 0 - strh r0, [r4, 0xE] - mov r1, r8 - strh r1, [r4, 0x10] - strh r1, [r4, 0x12] - mov r3, r9 - strh r3, [r4, 0x14] - mov r0, r10 - strh r0, [r4, 0x16] - ldr r0, =gUnknown_02039B28 - strb r7, [r0, 0x18] - ldr r0, =gUnknown_02039B44 - movs r1, 0 - strb r1, [r0] - ldr r4, =gUnknown_02038EA8 - ldr r3, [sp, 0xC] - subs r6, r3, r5 - lsls r3, r6, 24 - lsrs r3, 24 - adds r0, r4, 0 - ldr r1, [sp, 0x18] - ldr r2, [sp, 0x1C] - bl sub_80BA33C - ldr r0, [sp, 0xC] - cmp r5, r0 - bge _080BA47E - ldr r1, =0xfffffd80 - adds r2, r4, r1 - lsls r1, r5, 1 - movs r3, 0xF0 - lsls r3, 3 - adds r0, r1, r3 - adds r3, r0, r2 - adds r1, r2 - adds r2, r4, 0 - adds r5, r6, 0 -_080BA46A: - ldrh r0, [r2] - strh r0, [r1] - ldrh r0, [r2] - strh r0, [r3] - adds r2, 0x2 - adds r3, 0x2 - adds r1, 0x2 - subs r5, 0x1 - cmp r5, 0 - bne _080BA46A -_080BA47E: - adds r0, r7, 0 - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BA384 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s index 60c11524a..5047ec65e 100644 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -732,10 +732,10 @@ _08166C28: b _08166D18 .pool _08166C40: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer _08166C4A: ldr r1, [r4] adds r1, 0x50 diff --git a/include/scanline_effect.h b/include/scanline_effect.h new file mode 100644 index 000000000..54dfe17bd --- /dev/null +++ b/include/scanline_effect.h @@ -0,0 +1,47 @@ +#ifndef GUARD_SCANLINE_EFFECT_H +#define GUARD_SCANLINE_EFFECT_H + +// DMA control value to ransfer a single 16-bit value at HBlank +#define SCANLINE_EFFECT_DMACNT_16BIT (((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_INC | DMA_16BIT | DMA_DEST_RELOAD) << 16) | 1) + +#define SCANLINE_EFFECT_REG_BG0HOFS (REG_ADDR_BG0HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG0VOFS (REG_ADDR_BG0VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG1HOFS (REG_ADDR_BG1HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG1VOFS (REG_ADDR_BG1VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG2HOFS (REG_ADDR_BG2HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG2VOFS (REG_ADDR_BG2VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG3HOFS (REG_ADDR_BG3HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG3VOFS (REG_ADDR_BG3VOFS - REG_ADDR_BG0HOFS) + +struct ScanlineEffectParams +{ + volatile void *dmaDest; + u32 dmaControl; + u8 initState; + u8 unused9; +}; + +struct ScanlineEffect +{ + void *dmaSrcBuffers[2]; + volatile void *dmaDest; + u32 dmaControl; + void (*setFirstScanlineReg)(void); + u8 srcBuffer; + u8 state; + u8 unused16; + u8 unused17; + u8 waveTaskId; +}; + +extern struct ScanlineEffect gScanlineEffect; + +extern u16 gScanlineEffectRegBuffers[][0x3C0]; + +void ScanlineEffect_Stop(void); +void ScanlineEffect_Clear(void); +void ScanlineEffect_SetParams(struct ScanlineEffectParams); +void ScanlineEffect_InitHBlankDmaTransfer(void); +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 a7); + +#endif // GUARD_SCANLINE_EFFECT_H diff --git a/include/unknown_task.h b/include/unknown_task.h deleted file mode 100644 index 906fed3e0..000000000 --- a/include/unknown_task.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GUARD_unknown_task_H -#define GUARD_unknown_task_H - -// Exported type declarations -struct UnknownTaskStruct -{ - volatile void *dest; - u32 control; - u8 unk8; - u8 unk9; -}; - -extern struct UnknownTaskStruct gUnknown_0831AC70; - -// Exported RAM declarations - -// Exported ROM declarations -void ScanlineEffect_Stop(void); -void sub_80BA038(struct UnknownTaskStruct arg0); -void sub_80BA0A8(void); - -#endif // GUARD_unknown_task_H diff --git a/ld_script.txt b/ld_script.txt index f2a9d8196..bc2504fb0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -126,7 +126,7 @@ SECTIONS { src/trainer_see.o(.text); src/wild_encounter.o(.text); asm/field_effect.o(.text); - asm/unknown_task.o(.text); + src/scanline_effect.o(.text); src/option_menu.o(.text); src/pokedex.o(.text); asm/pokedex.o(.text); diff --git a/src/battle_2.c b/src/battle_2.c index 61e39b39f..4ff2bd19a 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -4,7 +4,7 @@ #include "main.h" #include "load_save.h" #include "gpu_regs.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "battle_setup.h" #include "battle_scripts.h" #include "pokemon.h" @@ -46,13 +46,6 @@ #include "battle_string_ids.h" #include "data2.h" -struct UnknownStruct6 -{ - u16 unk0[0xA0]; - u8 fillerA0[0x640]; - u16 unk780[0xA0]; -}; - struct UnknownPokemonStruct2 { /*0x00*/ u16 species; @@ -90,8 +83,6 @@ extern void (*gBattleMainFunc)(void); extern void (*gCB2_AfterEvolution)(void); extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? -extern u8 gUnknown_02039B28[]; // possibly a struct? -extern struct UnknownStruct6 gUnknown_02038C28; // todo: identify & document extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; extern u8 gDecompressionBuffer[]; @@ -162,6 +153,7 @@ extern const u8 * const gBattlescriptsForBallThrow[]; extern const u8 * const gBattlescriptsForRunningByItem[]; extern const u8 * const gBattlescriptsForUsingItem[]; extern const u8 * const gBattlescriptsForSafariActions[]; +extern const struct ScanlineEffectParams gUnknown_0831AC70; // strings extern const u8 gText_LinkStandby3[]; @@ -180,7 +172,7 @@ extern const u8 gText_Confusion[]; extern const u8 gText_Love[]; // functions -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); extern void sub_80356D0(void); extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower extern void sub_8166188(void); // battle tower, sets link battle mons level but why? @@ -383,24 +375,21 @@ static void CB2_InitBattleInternal(void) else { gBattle_WIN0V = 0x5051; - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 80; i++) { - gUnknown_02038C28.unk0[i] = 0xF0; - gUnknown_02038C28.unk780[i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0xF0; } for (i = 80; i < 160; i++) { - #ifndef NONMATCHING - asm(""::"r"(i)); // needed to match - #endif // NONMATCHING - - gUnknown_02038C28.unk0[i] = 0xFF10; - gUnknown_02038C28.unk780[i] = 0xFF10; + asm(""::"r"(i)); + gScanlineEffectRegBuffers[0][i] = 0xFF10; + gScanlineEffectRegBuffers[1][i] = 0xFF10; } - sub_80BA038(gUnknown_0831AC70); + ScanlineEffect_SetParams(gUnknown_0831AC70); } ResetPaletteFade(); @@ -1596,7 +1585,7 @@ void BattleMainCB2(void) static void FreeRestoreBattleData(void) { gMain.callback1 = gPreBattleCallback1; - gUnknown_02039B28[0x15] = 3; + gScanlineEffect.state = 3; gMain.inBattle = 0; ZeroEnemyPartyMons(); m4aSongNumStop(0x5A); @@ -1814,7 +1803,7 @@ void VBlankCB_Battle(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } void nullsub_17(void) @@ -1952,18 +1941,18 @@ void sub_8038D64(void) SetGpuReg(REG_OFFSET_WINOUT, 0); gBattle_WIN0H = 0xF0; gBattle_WIN0V = 0x5051; - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 80; i++) { - gUnknown_02038C28.unk0[i] = 0xF0; - gUnknown_02038C28.unk780[i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0xF0; } for (i = 80; i < 160; i++) { asm(""::"r"(i)); // Needed to stop the compiler from optimizing out the loop counter - gUnknown_02038C28.unk0[i] = 0xFF10; - gUnknown_02038C28.unk780[i] = 0xFF10; + gScanlineEffectRegBuffers[0][i] = 0xFF10; + gScanlineEffectRegBuffers[1][i] = 0xFF10; } ResetPaletteFade(); diff --git a/src/battle_transition.c b/src/battle_transition.c index e003e0fce..0ff8cd903 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -14,7 +14,7 @@ #include "constants/songs.h" #include "constants/trainers.h" #include "field_camera.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "malloc.h" #include "gpu_regs.h" #include "decompress.h" @@ -56,8 +56,6 @@ struct StructRectangularSpiral typedef bool8 (*TransitionStateFunc)(struct Task *task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); -extern u16 gUnknown_020393A8[]; -extern u16 gUnknown_02038C28[][0x3C0]; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -65,7 +63,7 @@ extern const struct OamData gFieldObjectBaseOam_32x32; extern void c2_exit_to_overworld_2_switch(void); extern void sub_80AC3D0(void); -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); // this file's functions static void LaunchBattleTransitionTask(u8 transitionId); @@ -1110,9 +1108,9 @@ static void Phase2Task_Swirl(u8 taskId) static bool8 Phase2_Swirl_Func1(struct Task *task) { sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); - sub_8149F98(gUnknown_020393A8, sTransitionStructPtr->field_14, 0, 2, 0, 160); + sub_8149F98(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_14, 0, 2, 0, 160); SetVBlankCallback(VBlankCB_Phase2_Swirl); SetHBlankCallback(HBlankCB_Phase2_Swirl); @@ -1129,7 +1127,7 @@ static bool8 Phase2_Swirl_Func2(struct Task *task) task->tData1 += 4; task->tData2 += 8; - sub_8149F98(gUnknown_02038C28[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); if (!gPaletteFade.active) { @@ -1145,12 +1143,12 @@ static void VBlankCB_Phase2_Swirl(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Swirl(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; REG_BG2HOFS = var; REG_BG3HOFS = var; @@ -1164,10 +1162,10 @@ static void Phase2Task_Shuffle(u8 taskId) static bool8 Phase2_Shuffle_Func1(struct Task *task) { sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); - memset(gUnknown_020393A8, sTransitionStructPtr->field_16, 0x140); + memset(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_16, 0x140); SetVBlankCallback(VBlankCB_Phase2_Shuffle); SetHBlankCallback(HBlankCB_Phase2_Shuffle); @@ -1192,7 +1190,7 @@ static bool8 Phase2_Shuffle_Func2(struct Task *task) for (i = 0; i < 160; i++, r4 += 4224) { u16 var = r4 / 256; - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } if (!gPaletteFade.active) @@ -1206,12 +1204,12 @@ static void VBlankCB_Phase2_Shuffle(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Shuffle(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; REG_BG2VOFS = var; REG_BG3VOFS = var; @@ -1257,7 +1255,7 @@ static void sub_814669C(struct Task *task) s32 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); task->tData1 = 16; task->tData2 = 0; @@ -1272,7 +1270,7 @@ static void sub_814669C(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 240; + gScanlineEffectRegBuffers[1][i] = 240; } SetVBlankCallback(VBlankCB0_Phase2_BigPokeball); @@ -1351,7 +1349,7 @@ static bool8 Phase2_BigPokeball_Func2(struct Task *task) dst1[i * 32 + j] = *BigPokeballMap | 0xF000; } } - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return TRUE; @@ -1363,7 +1361,7 @@ static bool8 Phase2_Aqua_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamAqua_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1375,7 +1373,7 @@ static bool8 Phase2_Magma_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamMagma_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1388,7 +1386,7 @@ static bool8 Phase2_Regice_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2B4, 0xF0, 0x20); CpuCopy16(gUnknown_085BC314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1401,7 +1399,7 @@ static bool8 Phase2_Registeel_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2D4, 0xF0, 0x20); CpuCopy16(gUnknown_085BCB14, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1414,7 +1412,7 @@ static bool8 Phase2_Regirock_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2F4, 0xF0, 0x20); CpuCopy16(gUnknown_085BD314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1499,7 +1497,7 @@ static bool8 Phase2_BigPokeball_Func3(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1519,7 +1517,7 @@ static bool8 Phase2_BigPokeball_Func4(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1531,7 +1529,7 @@ static bool8 Phase2_BigPokeball_Func5(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); if (task->tData5 <= 0) { @@ -1577,7 +1575,7 @@ static bool8 Phase2_BigPokeball_Func6(struct Task *task) if (task->tData1 < 0) task->tData1 = 0; } - sub_814A014(gUnknown_02038C28[0], 120, 80, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->tData1); if (task->tData1 == 0) { SetVBlankCallback(NULL); @@ -1604,7 +1602,7 @@ static void Transition_BigPokeball_Vblank(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; @@ -1615,13 +1613,13 @@ static void Transition_BigPokeball_Vblank(void) static void VBlankCB0_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); - DmaSet(0, gUnknown_020393A8, ®_BG0HOFS, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BG0HOFS, 0xA2400001); } static void VBlankCB1_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); - DmaSet(0, gUnknown_020393A8, ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_PokeballsTrail(u8 taskId) @@ -1741,7 +1739,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; @@ -1750,7 +1748,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_020393A8[i] = 0xF3F4; + gScanlineEffectRegBuffers[1][i] = 0xF3F4; } SetVBlankCallback(VBlankCB_Phase2_Clockwise_BlackFade); @@ -1767,7 +1765,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], -1, 1, 1); do { - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); sTransitionStructPtr->data[4] += 16; @@ -1795,7 +1793,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) r1 = 120, r3 = sTransitionStructPtr->data[2] + 1; if (sTransitionStructPtr->data[5] >= 80) r1 = sTransitionStructPtr->data[2], r3 = 240; - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); if (var != 0) break; var = sub_814A228(sTransitionStructPtr->data, 1, 1); @@ -1811,7 +1809,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) { while (sTransitionStructPtr->data[3] < sTransitionStructPtr->data[5]) { - gUnknown_02038C28[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + gScanlineEffectRegBuffers[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); } } @@ -1826,7 +1824,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 160, 1, 1); do { - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); sTransitionStructPtr->data[4] -= 16; @@ -1851,12 +1849,12 @@ static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) while (1) { - r1 = (gUnknown_02038C28[0][sTransitionStructPtr->data[3]]) & 0xFF; + r1 = (gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]]) & 0xFF; r2 = sTransitionStructPtr->data[2]; if (sTransitionStructPtr->data[5] <= 80) r2 = 120, r1 = sTransitionStructPtr->data[2]; var4 = (r1) | (r2 << 8); - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = var4; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = var4; if (var != 0) break; var = sub_814A228(sTransitionStructPtr->data, 1, 1); @@ -1872,7 +1870,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) { while (sTransitionStructPtr->data[3] > sTransitionStructPtr->data[5]) { - gUnknown_02038C28[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); + gScanlineEffectRegBuffers[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); } } @@ -1892,7 +1890,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) r2 = 120, r3 = sTransitionStructPtr->data[2]; if (sTransitionStructPtr->data[2] >= 120) r2 = 0, r3 = 240; - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); @@ -1917,12 +1915,12 @@ static void VBlankCB_Phase2_Clockwise_BlackFade(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - REG_WIN0H = gUnknown_02038C28[1][0]; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + REG_WIN0H = gScanlineEffectRegBuffers[1][0]; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_Ripple(u8 taskId) @@ -1935,11 +1933,11 @@ static bool8 Phase2_Ripple_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 160; i++) { - gUnknown_020393A8[i] = sTransitionStructPtr->field_16; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; } SetVBlankCallback(VBlankCB_Phase2_Ripple); @@ -1971,7 +1969,7 @@ static bool8 Phase2_Ripple_Func2(struct Task *task) // todo: fix the asm s16 var = r4 >> 8; asm(""); - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } if (++task->tData3 == 81) @@ -1991,12 +1989,12 @@ static void VBlankCB_Phase2_Ripple(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Ripple(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; REG_BG2VOFS = var; REG_BG3VOFS = var; @@ -2012,7 +2010,7 @@ static bool8 Phase2_Wave_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; @@ -2021,7 +2019,7 @@ static bool8 Phase2_Wave_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 242; + gScanlineEffectRegBuffers[1][i] = 242; } SetVBlankCallback(VBlankCB_Phase2_Wave); @@ -2037,7 +2035,7 @@ static bool8 Phase2_Wave_Func2(struct Task *task) bool8 nextFunc; sTransitionStructPtr->VBlank_DMA = FALSE; - toStore = gUnknown_02038C28[0]; + toStore = gScanlineEffectRegBuffers[0]; r5 = task->tData2; task->tData2 += 16; task->tData1 += 8; @@ -2073,11 +2071,11 @@ static void VBlankCB_Phase2_Wave(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_Sydney(u8 taskId) @@ -2120,7 +2118,7 @@ static bool8 Phase2_Mugshot_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); Mugshots_CreateOpponentPlayerSprites(task); task->tData1 = 0; @@ -2132,7 +2130,7 @@ static bool8 Phase2_Mugshot_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0xF0F1; + gScanlineEffectRegBuffers[1][i] = 0xF0F1; } SetVBlankCallback(VBlankCB0_Phase2_Mugshots); @@ -2177,7 +2175,7 @@ static bool8 Phase2_Mugshot_Func3(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - toStore = gUnknown_02038C28[0]; + toStore = gScanlineEffectRegBuffers[0]; r5 = task->tData1; task->tData1 += 0x10; @@ -2223,7 +2221,7 @@ static bool8 Phase2_Mugshot_Func4(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - for (i = 0, toStore = gUnknown_02038C28[0]; i < 160; i++, toStore++) + for (i = 0, toStore = gScanlineEffectRegBuffers[0]; i < 160; i++, toStore++) { *toStore = 0xF0; } @@ -2266,8 +2264,8 @@ static bool8 Phase2_Mugshot_Func6(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; SetVBlankCallback(NULL); DmaStop(0); - memset(gUnknown_02038C28[0], 0, 0x140); - memset(gUnknown_02038C28[1], 0, 0x140); + memset(gScanlineEffectRegBuffers[0], 0, 0x140); + memset(gScanlineEffectRegBuffers[1], 0, 0x140); SetGpuReg(REG_OFFSET_WIN0H, 0xF0); SetGpuReg(REG_OFFSET_BLDY, 0); task->tState++; @@ -2300,15 +2298,15 @@ static bool8 Phase2_Mugshot_Func7(struct Task *task) { s16 index1 = 0x50 - i; s16 index2 = 0x50 + i; - if (gUnknown_02038C28[0][index1] <= 15) + if (gScanlineEffectRegBuffers[0][index1] <= 15) { r6 = TRUE; - gUnknown_02038C28[0][index1]++; + gScanlineEffectRegBuffers[0][index1]++; } - if (gUnknown_02038C28[0][index2] <= 15) + if (gScanlineEffectRegBuffers[0][index2] <= 15) { r6 = TRUE; - gUnknown_02038C28[0][index2]++; + gScanlineEffectRegBuffers[0][index2]++; } } } @@ -2336,7 +2334,7 @@ static bool8 Phase2_Mugshot_Func9(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; task->tData3++; - memset(gUnknown_02038C28[0], task->tData3, 0x140); + memset(gScanlineEffectRegBuffers[0], task->tData3, 0x140); if (task->tData3 > 15) task->tState++; @@ -2357,12 +2355,12 @@ static void VBlankCB0_Phase2_Mugshots(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_BG0VOFS = sTransitionStructPtr->BG0VOFS; REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void VBlankCB1_Phase2_Mugshots(void) @@ -2370,9 +2368,9 @@ static void VBlankCB1_Phase2_Mugshots(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_BLDCNT = sTransitionStructPtr->BLDCNT; - DmaSet(0, gUnknown_02038C28[1], ®_BLDY, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BLDY, 0xA2400001); } static void HBlankCB_Phase2_Mugshots(void) @@ -2500,7 +2498,7 @@ static bool8 Phase2_Slice_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); task->tData2 = 256; task->tData3 = 1; @@ -2511,8 +2509,8 @@ static bool8 Phase2_Slice_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[1][160 + i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[1][160 + i] = 0xF0; } EnableInterrupts(INTR_FLAG_HBLANK); @@ -2541,8 +2539,8 @@ static bool8 Phase2_Slice_Func2(struct Task *task) for (i = 0; i < 160; i++) { - u16 *storeLoc1 = &gUnknown_02038C28[0][i]; - u16 *storeLoc2 = &gUnknown_02038C28[0][i + 160]; + u16 *storeLoc1 = &gScanlineEffectRegBuffers[0][i]; + u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + 160]; if (i & 1) { *storeLoc1 = sTransitionStructPtr->field_14 + task->tData1; @@ -2578,15 +2576,15 @@ static void VBlankCB_Phase2_Slice(void) REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); - DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); + DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); } static void HBlankCB_Phase2_Slice(void) { if (REG_VCOUNT < 160) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; REG_BG2HOFS = var; REG_BG3HOFS = var; @@ -2603,7 +2601,7 @@ static bool8 Phase2_ShredSplit_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; @@ -2611,13 +2609,13 @@ static bool8 Phase2_ShredSplit_Func1(struct Task *task) for (i = 0; i < 0xA0; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[1][0xA0 + i] = 0xF0; - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[0][0xA0 + i] = 0xF0; - gUnknown_02038C28[0][0x140 + i] = 0; - gUnknown_02038C28[0][0x1E0 + i] = 0x100; - gUnknown_02038C28[0][0x280 + i] = 1; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[1][0xA0 + i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[0][0xA0 + i] = 0xF0; + gScanlineEffectRegBuffers[0][0x140 + i] = 0; + gScanlineEffectRegBuffers[0][0x1E0 + i] = 0x100; + gScanlineEffectRegBuffers[0][0x280 + i] = 1; } task->tData4 = 0; @@ -2657,9 +2655,9 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) unkVar = (arr1[j]) + (arr2[k] * -(i) * 2); if (unkVar >= 0 && (unkVar != 79 || j != 1)) { - ptr4 = &gUnknown_02038C28[0][unkVar + 320]; - ptr3 = &gUnknown_02038C28[0][unkVar + 480]; - ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; + ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; if (*ptr4 > 0xEF) { *ptr4 = 0xF0; @@ -2673,8 +2671,8 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gUnknown_02038C28[0][unkVar]; - ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; *ptr2 = sTransitionStructPtr->field_14 + *ptr4; *ptr3 = 0xF0 - *ptr4; @@ -2691,9 +2689,9 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) unkVar = (arr1[j] + 1) + (arr2[k] * -(i) * 2); if (unkVar <= 160 && (unkVar != 80 || j != 1)) { - ptr4 = &gUnknown_02038C28[0][unkVar + 320]; - ptr3 = &gUnknown_02038C28[0][unkVar + 480]; - ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; + ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; if (*ptr4 > 0xEF) { *ptr4 = 0xF0; @@ -2707,8 +2705,8 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gUnknown_02038C28[0][unkVar]; - ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; *ptr2 = sTransitionStructPtr->field_14 - *ptr4; *ptr3 = (*ptr4 << 8) | (0xF1); @@ -2732,7 +2730,7 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) // This function never increments the state counter, because the loop condition // is always false, resulting in the game being stuck in an infinite loop. -// It's possible this transition is only partially +// It's possible this transition is only partially // done and the second part was left out. static bool8 Phase2_ShredSplit_Func3(struct Task *task) { @@ -2742,7 +2740,7 @@ static bool8 Phase2_ShredSplit_Func3(struct Task *task) for (i = 0; i < 0xA0; i++) { - if (gUnknown_02038C28[1][i] != 0xF0 && gUnknown_02038C28[1][i] != checkVar2) + if (gScanlineEffectRegBuffers[1][i] != 0xF0 && gScanlineEffectRegBuffers[1][i] != checkVar2) done = FALSE; // a break statement should be put here } @@ -2775,7 +2773,7 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) s32 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; @@ -2784,7 +2782,7 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) for (i = 0; i < 0xA0; i++) { - gUnknown_02038C28[1][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0; } SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); @@ -2814,7 +2812,7 @@ static bool8 Phase2_Blackhole1_Func3(struct Task *task) task->tData1 += (task->tData2 >> 8); if (task->tData1 > 0xA0) task->tData1 = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 == 0xA0) { task->tFuncState = 1; @@ -2840,7 +2838,7 @@ static bool8 Phase2_Blackhole1_Func2(struct Task *task) } task->tData1 += gUnknown_085C8C80[task->tData6]; task->tData6 = (task->tData6 + 1) % 2; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 < 9) { task->tState++; @@ -2866,7 +2864,7 @@ static bool8 Phase2_Blackhole2_Func2(struct Task *task) if (task->tData1 > 0xA0) task->tData1 = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 == 0xA0) { DmaStop(0); @@ -3113,7 +3111,7 @@ static bool8 Phase2_Rayquaza_Func3(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); SetGpuReg(REG_OFFSET_BG0CNT, 0x9A08); sub_8149F58(&dst1, &dst2); @@ -3126,8 +3124,8 @@ static bool8 Phase2_Rayquaza_Func3(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[0][i] = 0; - gUnknown_02038C28[1][i] = 0x100; + gScanlineEffectRegBuffers[0][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0x100; } SetVBlankCallback(VBlankCB_Phase2_Rayquaza); @@ -3212,7 +3210,7 @@ static bool8 Phase2_Rayquaza_Func9(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0; } SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); @@ -3233,11 +3231,11 @@ static void VBlankCB_Phase2_Rayquaza(void) VBlankCB_BattleTransition(); if (sTransitionStructPtr->field_20 == 0) - dmaSrc = gUnknown_02038C28[0]; + dmaSrc = gScanlineEffectRegBuffers[0]; else if (sTransitionStructPtr->field_20 == 1) - dmaSrc = gUnknown_02038C28[1]; + dmaSrc = gScanlineEffectRegBuffers[1]; else - dmaSrc = gUnknown_02038C28[0]; + dmaSrc = gScanlineEffectRegBuffers[0]; DmaSet(0, dmaSrc, ®_BG0VOFS, 0xA2400001); } @@ -3252,7 +3250,7 @@ static bool8 Phase2_WhiteFade_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->BLDCNT = 0xBF; sTransitionStructPtr->BLDY = 0; @@ -3262,8 +3260,8 @@ static bool8 Phase2_WhiteFade_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0; - gUnknown_02038C28[1][i + 160] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0; + gScanlineEffectRegBuffers[1][i + 160] = 0xF0; } EnableInterrupts(INTR_FLAG_HBLANK); @@ -3343,8 +3341,8 @@ static void VBlankCB0_Phase2_WhiteFade(void) REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); - DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); + DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); } static void VBlankCB1_Phase2_WhiteFade(void) @@ -3360,7 +3358,7 @@ static void VBlankCB1_Phase2_WhiteFade(void) static void HBlankCB_Phase2_WhiteFade(void) { - REG_BLDY = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BLDY = gScanlineEffectRegBuffers[1][REG_VCOUNT]; } static void sub_8149864(struct Sprite *sprite) @@ -3374,8 +3372,8 @@ static void sub_8149864(struct Sprite *sprite) else { u16 i; - u16* ptr1 = &gUnknown_02038C28[0][sprite->pos1.y]; - u16* ptr2 = &gUnknown_02038C28[0][sprite->pos1.y + 160]; + u16* ptr1 = &gScanlineEffectRegBuffers[0][sprite->pos1.y]; + u16* ptr2 = &gScanlineEffectRegBuffers[0][sprite->pos1.y + 160]; for (i = 0; i < 20; i++) { ptr1[i] = sprite->data[0] >> 8; @@ -3465,7 +3463,7 @@ static bool8 Phase2_Shards_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0x3F; sTransitionStructPtr->WINOUT = 0; @@ -3473,10 +3471,10 @@ static bool8 Phase2_Shards_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[0][i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; } - CpuSet(gUnknown_02038C28[0], gUnknown_02038C28[1], 0xA0); + CpuSet(gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 0xA0); SetVBlankCallback(VBlankCB_Phase2_Shards); task->tState++; @@ -3505,8 +3503,8 @@ static bool8 Phase2_Shards_Func3(struct Task *task) for (i = 0, nextFunc = FALSE; i < 16; i++) { - s16 r3 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] >> 8; - s16 r4 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] & 0xFF; + s16 r3 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] >> 8; + s16 r4 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] & 0xFF; if (task->tData2 == 0) { if (r3 < sTransitionStructPtr->data[2]) @@ -3521,7 +3519,7 @@ static bool8 Phase2_Shards_Func3(struct Task *task) if (r4 <= r3) r4 = r3; } - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); if (nextFunc) { task->tState++; @@ -3568,12 +3566,12 @@ static void VBlankCB_Phase2_Shards(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - REG_WIN0H = gUnknown_02038C28[1][0]; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + REG_WIN0H = gScanlineEffectRegBuffers[1][0]; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } // sub-task for phase2 @@ -3875,7 +3873,7 @@ static bool8 Phase2_29_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(gUnknown_085C828C, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 0x84, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 0x84, task->tData5, 160); task->tState++; return TRUE; @@ -3896,7 +3894,7 @@ static bool8 Phase2_30_Func1(struct Task *task) u16 *dst1, *dst2; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); task->tData2 = 0x2000; task->tData1 = 0x7FFF; @@ -3934,7 +3932,7 @@ static bool8 Phase2_30_Func3(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_16; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; } SetVBlankCallback(VBlankCB_Phase2_30); @@ -3980,7 +3978,7 @@ static bool8 Phase2_30_Func4(struct Task *task) { s16 index = var6 / 256; asm(""); - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude); } if (++task->tData3 == 101) @@ -4004,12 +4002,12 @@ static void VBlankCB_Phase2_30(void) REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_30(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG0VOFS = var; } diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index f487489d4..7b968a221 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -6,7 +6,7 @@ #include "main.h" #include "sprite.h" #include "task.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "window.h" #include "text.h" #include "menu.h" diff --git a/src/diploma.c b/src/diploma.c index 24e5e9727..89447c5ba 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -3,7 +3,7 @@ #include "palette.h" #include "main.h" #include "gpu_regs.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "task.h" #include "malloc.h" #include "decompress.h" diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 5dfc36cb2..cbd37be52 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -11,7 +11,7 @@ #include "pokemon.h" #include "string_util.h" #include "battle.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "decompress.h" #include "m4a.h" #include "menu.h" @@ -1367,7 +1367,7 @@ static void VBlankCB_EvolutionScene(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } static void VBlankCB_TradeEvolutionScene(void) @@ -1384,7 +1384,7 @@ static void VBlankCB_TradeEvolutionScene(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } static void sub_813FDEC(u8 taskId) diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 5390814eb..62d2b39a4 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -20,7 +20,7 @@ #include "string_util.h" #include "m4a.h" #include "international_string_util.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "trig.h" #include "random.h" #include "event_data.h" diff --git a/src/mail.c b/src/mail.c index c3cbe4a3c..ac263ac67 100644 --- a/src/mail.c +++ b/src/mail.c @@ -4,7 +4,7 @@ #include "main.h" #include "overworld.h" #include "task.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "palette.h" #include "text.h" #include "menu.h" diff --git a/src/option_menu.c b/src/option_menu.c index 7f92756ab..cbbe14b77 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -2,7 +2,7 @@ #include "option_menu.h" #include "main.h" #include "menu.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "palette.h" #include "sprite.h" #include "task.h" diff --git a/src/pokeblock.c b/src/pokeblock.c index 1a4ce3155..472b030e0 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -14,7 +14,7 @@ #include "battle.h" #include "battle_controllers.h" #include "palette.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "list_menu.h" #include "gpu_regs.h" #include "decompress.h" diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 3df2ff151..a4bb4a728 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -3,7 +3,7 @@ #include "battle.h" #include "palette.h" #include "main.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "text.h" #include "gpu_regs.h" #include "bg.h" @@ -34,7 +34,7 @@ extern struct SpriteTemplate gUnknown_0202499C; extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[]; -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); extern void sub_8035658(void); extern bool8 IsDoubleBattle(void); extern u8 GetSubstituteSpriteDefault_Y(u8 bank); @@ -72,7 +72,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) switch (gBattleScripting.reshowMainState) { case 0: - dp12_8087EA4(); + ScanlineEffect_Clear(); sub_8035658(); SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0); SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0); diff --git a/src/scanline_effect.c b/src/scanline_effect.c new file mode 100644 index 000000000..148e053fc --- /dev/null +++ b/src/scanline_effect.c @@ -0,0 +1,262 @@ +#include "global.h" +#include "data2.h" +#include "task.h" +#include "trig.h" +#include "scanline_effect.h" + +static void CopyValue16Bit(void); +static void CopyValue32Bit(void); + +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; + +// EWRAM vars + +// Per-scanline register values. +// This is double buffered so that it can be safely written to at any time +// without overwriting the buffer that the DMA is currently reading +EWRAM_DATA u16 gScanlineEffectRegBuffers[2][0x3C0] = {0}; + +EWRAM_DATA struct ScanlineEffect gScanlineEffect = {0}; +EWRAM_DATA static bool8 sShouldStopWaveTask = FALSE; + +void ScanlineEffect_Stop(void) +{ + gScanlineEffect.state = 0; + DmaStop(0); + if (gScanlineEffect.waveTaskId != 0xFF) + { + DestroyTask(gScanlineEffect.waveTaskId); + gScanlineEffect.waveTaskId = 0xFF; + } +} + +void ScanlineEffect_Clear(void) +{ + CpuFill16(0, gScanlineEffectRegBuffers, sizeof(gScanlineEffectRegBuffers)); + gScanlineEffect.dmaSrcBuffers[0] = NULL; + gScanlineEffect.dmaSrcBuffers[1] = NULL; + gScanlineEffect.dmaDest = NULL; + gScanlineEffect.dmaControl = 0; + gScanlineEffect.srcBuffer = 0; + gScanlineEffect.state = 0; + gScanlineEffect.unused16 = 0; + gScanlineEffect.unused17 = 0; + gScanlineEffect.waveTaskId = 0xFF; +} + +void ScanlineEffect_SetParams(struct ScanlineEffectParams params) +{ + if (params.dmaControl == SCANLINE_EFFECT_DMACNT_16BIT) // 16-bit + { + // Set the DMA src to the value for the second scanline because the + // first DMA transfer occurs in HBlank *after* the first scanline is drawn + gScanlineEffect.dmaSrcBuffers[0] = (u16 *)gScanlineEffectRegBuffers[0] + 1; + gScanlineEffect.dmaSrcBuffers[1] = (u16 *)gScanlineEffectRegBuffers[1] + 1; + gScanlineEffect.setFirstScanlineReg = CopyValue16Bit; + } + else // assume 32-bit + { + // Set the DMA src to the value for the second scanline because the + // first DMA transfer occurs in HBlank *after* the first scanline is drawn + gScanlineEffect.dmaSrcBuffers[0] = (u32 *)gScanlineEffectRegBuffers[0] + 1; + gScanlineEffect.dmaSrcBuffers[1] = (u32 *)gScanlineEffectRegBuffers[1] + 1; + gScanlineEffect.setFirstScanlineReg = CopyValue32Bit; + } + + gScanlineEffect.dmaControl = params.dmaControl; + gScanlineEffect.dmaDest = params.dmaDest; + gScanlineEffect.state = params.initState; + gScanlineEffect.unused16 = params.unused9; + gScanlineEffect.unused17 = params.unused9; +} + +void ScanlineEffect_InitHBlankDmaTransfer(void) +{ + if (gScanlineEffect.state == 0) + { + return; + } + else if (gScanlineEffect.state == 3) + { + gScanlineEffect.state = 0; + DmaStop(0); + sShouldStopWaveTask = TRUE; + } + else + { + DmaStop(0); + // Set DMA to copy to dest register on each HBlank for the next frame. + // The HBlank DMA transfers do not occurr during VBlank, so the transfer + // will begin on the HBlank after the first scanline + DmaSet(0, gScanlineEffect.dmaSrcBuffers[gScanlineEffect.srcBuffer], gScanlineEffect.dmaDest, gScanlineEffect.dmaControl); + // Manually set the reg for the first scanline + gScanlineEffect.setFirstScanlineReg(); + // Swap current buffer + gScanlineEffect.srcBuffer ^= 1; + } +} + +// These two functions are used to copy the register for the first scanline, +// depending whether it is a 16-bit register or a 32-bit register. + +static void CopyValue16Bit(void) +{ + u16 *dest = (u16 *)gScanlineEffect.dmaDest; + u16 *src = (u16 *)&gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer]; + + *dest = *src; +} + +static void CopyValue32Bit(void) +{ + u32 *dest = (u32 *)gScanlineEffect.dmaDest; + u32 *src = (u32 *)&gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer]; + + *dest = *src; +} + +#define tStartLine data[0] +#define tEndLine data[1] +#define tWaveLength data[2] +#define tSrcBufferOffset data[3] +#define tFramesUntilMove data[4] +#define tDelayInterval data[5] +#define tRegOffset data[6] +#define tApplyBattleBgOffsets data[7] + +static void TaskFunc_UpdateWavePerFrame(u8 taskId) +{ + int value = 0; + int i; + int offset; + + if (sShouldStopWaveTask) + { + DestroyTask(taskId); + gScanlineEffect.waveTaskId = 0xFF; + } + else + { + if (gTasks[taskId].tApplyBattleBgOffsets) + { + switch (gTasks[taskId].tRegOffset) + { + case SCANLINE_EFFECT_REG_BG0HOFS: + value = gBattle_BG0_X; + break; + case SCANLINE_EFFECT_REG_BG0VOFS: + value = gBattle_BG0_Y; + break; + case SCANLINE_EFFECT_REG_BG1HOFS: + value = gBattle_BG1_X; + break; + case SCANLINE_EFFECT_REG_BG1VOFS: + value = gBattle_BG1_Y; + break; + case SCANLINE_EFFECT_REG_BG2HOFS: + value = gBattle_BG2_X; + break; + case SCANLINE_EFFECT_REG_BG2VOFS: + value = gBattle_BG2_Y; + break; + case SCANLINE_EFFECT_REG_BG3HOFS: + value = gBattle_BG3_X; + break; + case SCANLINE_EFFECT_REG_BG3VOFS: + value = gBattle_BG3_Y; + break; + } + } + if (gTasks[taskId].tFramesUntilMove != 0) + { + gTasks[taskId].tFramesUntilMove--; + offset = gTasks[taskId].tSrcBufferOffset + 320; + for (i = gTasks[taskId].tStartLine; i < gTasks[taskId].tEndLine; i++) + { + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gScanlineEffectRegBuffers[0][offset] + value; + offset++; + } + } + else + { + gTasks[taskId].tFramesUntilMove = gTasks[taskId].tDelayInterval; + offset = gTasks[taskId].tSrcBufferOffset + 320; + for (i = gTasks[taskId].tStartLine; i < gTasks[taskId].tEndLine; i++) + { + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gScanlineEffectRegBuffers[0][offset] + value; + offset++; + } + + // increment src buffer offset + gTasks[taskId].tSrcBufferOffset++; + if (gTasks[taskId].tSrcBufferOffset == gTasks[taskId].tWaveLength) + gTasks[taskId].tSrcBufferOffset = 0; + } + } +} + +static void GenerateWave(u16 *buffer, u8 frequency, u8 amplitude, u8 unused) +{ + u16 i = 0; + u8 theta = 0; + + while (i < 256) + { + buffer[i] = (gSineTable[theta] * amplitude) / 256; + theta += frequency; + i++; + } +} + +// Initializes a background "wave" effect that affects scanlines startLine (inclusive) to endLine (exclusive). +// 'frequency' and 'amplitude' control the frequency and amplitude of the wave. +// 'delayInterval' controls how fast the wave travels up the screen. The wave will shift upwards one scanline every 'delayInterval'+1 frames. +// 'regOffset' is the offset of the video register to modify. +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 applyBattleBgOffsets) +{ + int i; + int offset; + struct ScanlineEffectParams params; + u8 taskId; + + ScanlineEffect_Clear(); + + params.dmaDest = (void *)(REG_ADDR_BG0HOFS + regOffset); + params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + params.initState = 1; + params.unused9 = 0; + ScanlineEffect_SetParams(params); + + taskId = CreateTask(TaskFunc_UpdateWavePerFrame, 0); + + gTasks[taskId].tStartLine = startLine; + gTasks[taskId].tEndLine = endLine; + gTasks[taskId].tWaveLength = 256 / frequency; + gTasks[taskId].tSrcBufferOffset = 0; + gTasks[taskId].tFramesUntilMove = delayInterval; + gTasks[taskId].tDelayInterval = delayInterval; + gTasks[taskId].tRegOffset = regOffset; + gTasks[taskId].tApplyBattleBgOffsets = applyBattleBgOffsets; + + gScanlineEffect.waveTaskId = taskId; + sShouldStopWaveTask = FALSE; + + GenerateWave(&gScanlineEffectRegBuffers[0][320], frequency, amplitude, endLine - startLine); + + offset = 320; + for (i = startLine; i < endLine; i++) + { + gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[0][offset]; + gScanlineEffectRegBuffers[1][i] = gScanlineEffectRegBuffers[0][offset]; + offset++; + } + + return taskId; +} diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 12f475c93..c8898d08f 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -4,7 +4,7 @@ #include "malloc.h" #include "palette.h" #include "pokenav.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "text.h" #include "bg.h" #include "window.h" @@ -131,7 +131,7 @@ void sub_8166340(void) ProcessSpriteCopyRequests(); TransferPlttBuffer(); sub_81D2108(gUnknown_0203BCAC->field_7C58); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } void sub_816636C(void (*func)(void)) diff --git a/src/wallclock.c b/src/wallclock.c index dbea24b4c..f15bbbc27 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -12,7 +12,7 @@ #include "window.h" #include "text_window.h" #include "menu.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "task.h" #include "strings.h" #include "sound.h" diff --git a/sym_ewram.txt b/sym_ewram.txt index c04f524d8..df3987e68 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -713,36 +713,7 @@ gUnknown_02038BC6: @ 2038BC6 gFieldEffectArguments: @ 2038C08 .space 0x20 -gUnknown_02038C28: @ 2038C28 - .space 0x2 - -gUnknown_02038C2A: @ 2038C2A - .space 0x2 - -gUnknown_02038C2C: @ 2038C2C - .space 0x13C - -gUnknown_02038D68: @ 2038D68 - .space 0x140 - -gUnknown_02038EA8: @ 2038EA8 - .space 0x280 - -gUnknown_02039128: @ 2039128 - .space 0x280 - -gUnknown_020393A8: @ 20393A8 - .space 0x140 - -gUnknown_020394E8: @ 20394E8 - .space 0x640 - -gUnknown_02039B28: @ 2039B28 - .space 0x1C - -gUnknown_02039B44: @ 2039B44 - .space 0x4 - + .include "src/scanline_effect.o" .include "src/option_menu.o" .align 2 From a75c476d57a8ffad9bebc7524c698cc2d5738d2a Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 30 Jan 2018 13:13:07 -0600 Subject: [PATCH 15/15] Get RenderText a bit closer (thanks Egg) --- src/text.c | 553 ++++++++++++++++++++++++++--------------------------- 1 file changed, 274 insertions(+), 279 deletions(-) diff --git a/src/text.c b/src/text.c index 6be46b7b1..936f96798 100644 --- a/src/text.c +++ b/src/text.c @@ -2054,300 +2054,295 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c #ifdef NONMATCHING u16 RenderText(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct* r4 = &textPrinter->sub_union.sub; - int temp; - int r4two; - int jpnvar; - u8* tempTwo; - u16 songId; - int dummy; - u8 dummyTwo; - + struct TextPrinterSubStruct *r4 = &textPrinter->sub_union.sub; + u16 currChar; + s32 width; + switch (textPrinter->state) // _080057C4 { - case 0: // _080057F0 - if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && r4->font_type_upper) + case 0: // _080057F0 + if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && r4->font_type_upper) + textPrinter->delayCounter = 0; + + if (textPrinter->delayCounter && textPrinter->text_speed) //_0800580A + { + textPrinter->delayCounter--; + if (gTextFlags.flag_0 && (gMain.newKeys & (A_BUTTON | B_BUTTON))) + { + r4->font_type_upper = 1; textPrinter->delayCounter = 0; - if (textPrinter->delayCounter && textPrinter->text_speed) //_0800580A - { - textPrinter->delayCounter--; - if (gTextFlags.flag_0 && (gMain.newKeys & (A_BUTTON | B_BUTTON))) - { - r4->font_type_upper = 1; - textPrinter->delayCounter = 0; - } - return 3; } - else // _0800584C - { - if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.flag_2) - textPrinter->delayCounter = 3; - else - textPrinter->delayCounter = textPrinter->text_speed; - temp = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - switch (temp) //_0800588A - { - case 0xF8+6: //_080058B8 - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; - textPrinter->subPrinter.currentY += (gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing); - return 2; - case 0xF8+5: //_080058DC - textPrinter->subPrinter.current_text_offset++; - return 2; - case 0xF8+4: //_080058E0 - temp = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - switch (temp) // _080058F0 - { - - case 1: // _08005960 - textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); - return 2; - case 2: // _08005982 - textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); - return 2; - case 3: // _080059A6 - textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); - return 2; - case 4: // _080059C0 - textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); - return 2; - case 5: // _08005A0E - textPrinter->subPrinter.current_text_offset++; - return 2; - case 6: //_08005A12 - r4->font_type = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - return 2; - case 7: // _08005A0A - return 2; - case 8: // _08005A2A - textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - textPrinter->state = 6; - return 2; - case 9: // _08005A3A - textPrinter->state = 1; - if (gTextFlags.flag_2) - r4->frames_visible_counter = 0; - return 3; - case 10: // _08005A58 - textPrinter->state = 5; - return 3; - case 11: // _08005A5C - songId = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - songId |= *textPrinter->subPrinter.current_text_offset << 8; - textPrinter->subPrinter.current_text_offset++; - PlayBGM(songId); - return 2; - case 16: // _08005A76 - songId = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - songId |= (*textPrinter->subPrinter.current_text_offset << 8); - textPrinter->subPrinter.current_text_offset++; - PlaySE(songId); - return 2; - case 13: // _08005A90 - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - return 2; - case 14: // _08005A98 - textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - return 2; - case 15: // _08005AA4 - FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | textPrinter->subPrinter.bgColor << 4); - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; - textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; - return 2; - case 23: // _08005ABE - m4aMPlayStop(&gMPlayInfo_BGM); - return 2; - case 24: // _08005ACC - m4aMPlayContinue(&gMPlayInfo_BGM); - return 2; - case 17: // _08005AD8 - temp = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - if (temp > 0) - { - ClearTextSpan(textPrinter, temp); - textPrinter->subPrinter.currentX += temp; - return 0; - } - return 2; - case 18: // _08005AF2 - textPrinter->subPrinter.currentX = *textPrinter->subPrinter.current_text_offset + textPrinter->subPrinter.x; - textPrinter->subPrinter.current_text_offset++; - return 2; - case 19: // _08005B02 - temp = *textPrinter->subPrinter.current_text_offset; - temp += textPrinter->subPrinter.x; - textPrinter->subPrinter.current_text_offset++; - r4two = temp - textPrinter->subPrinter.currentX; - if (temp - textPrinter->subPrinter.currentX > 0) - { - ClearTextSpan(textPrinter, r4two); - textPrinter->subPrinter.currentX += r4two; - return 0; - } - return 2; - case 20: // _08005B26 - textPrinter->minLetterSpacing = *textPrinter->subPrinter.current_text_offset++; - return 2; - case 21: // _08005B36 - textPrinter->japanese = 1; - return 2; - case 22: // _08005B3E - textPrinter->japanese = 0; - return 2; - case 12: // _08005B5A - dummyTwo = *textPrinter->subPrinter.current_text_offset; - dummy = 0x100; - temp = dummy | dummyTwo; - textPrinter->subPrinter.current_text_offset++; - break; - } - break; - case 0xF8+3: // _08005B48 - textPrinter->state = 2; - TextPrinterInitDownArrowCounters(textPrinter); - return 3; - case 0xF8+2: // _08005B4C - textPrinter->state = 3; - TextPrinterInitDownArrowCounters(textPrinter); - return 3; - case 0xF8+1: // _08005B5A - dummyTwo = *textPrinter->subPrinter.current_text_offset; - dummy = 0x100; - temp = dummy | dummyTwo; - textPrinter->subPrinter.current_text_offset++; - break; - case 0xF8+0: // _08005B6C - temp = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset++; - gUnknown_03002F90[0x80] = DrawKeypadIcon(textPrinter->subPrinter.windowId, temp, textPrinter->subPrinter.currentX, textPrinter->subPrinter.currentY); - textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing; - return 0; - case 0xF8+7: // _08005D6C - return 1; - } - - } - switch (r4->font_type) // _08005B90 - { - case 0: // _08005BCC - jpnvar = textPrinter->japanese; - DecompressGlyphFont0(temp, jpnvar); - break; - case 1: // _08005BDA - jpnvar = textPrinter->japanese; - DecompressGlyphFont1(temp, jpnvar); - break; - case 2: - case 3: - case 4: - case 5: // _08005BE8 - jpnvar = textPrinter->japanese; - DecompressGlyphFont2(temp, jpnvar); - break; - case 7: // _08005BF6 - jpnvar = textPrinter->japanese; - DecompressGlyphFont7(temp, jpnvar); - break; - case 8: // _08005C04 - jpnvar = textPrinter->japanese; - DecompressGlyphFont8(temp, jpnvar); - break; - case 6: // _08005C10 - break; - } - CopyGlyphToWindow(textPrinter); // _08005C10 - if (textPrinter->minLetterSpacing) - { - textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; - r4two = textPrinter->minLetterSpacing - gUnknown_03002F90[0x80]; - if (r4two > 0) - { - ClearTextSpan(textPrinter, r4two); - textPrinter->subPrinter.currentX += r4two; - } - } - else // _08005C48 - { - if (textPrinter->japanese) - textPrinter->subPrinter.currentX += (gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing); - else - textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; - } - return 0; - case 1: // _08005C78 - if (TextPrinterWait(textPrinter)) - textPrinter->state = 0; return 3; - case 2: // _08005C8C - if (TextPrinterWaitWithDownArrow(textPrinter)) + } + + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.flag_2) + textPrinter->delayCounter = 3; + else + textPrinter->delayCounter = textPrinter->text_speed; + + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + + switch (currChar) //_0800588A + { + case 0xF8+6: //_080058B8 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY += (gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing); + return 2; + case 0xF8+5: //_080058DC + textPrinter->subPrinter.current_text_offset++; + return 2; + case 0xF8+4: //_080058E0 + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + switch (currChar) // _080058F0 { - FillWindowPixelBuffer(textPrinter->subPrinter.windowId, (textPrinter->subPrinter.bgColor << 4) | textPrinter->subPrinter.bgColor); + case 1: // _08005960 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 2: // _08005982 + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 3: // _080059A6 + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 4: // _080059C0 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 5: // _08005A0E + textPrinter->subPrinter.current_text_offset++; + return 2; + case 6: //_08005A12 + r4->font_type = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 7: // _08005A0A + return 2; + case 8: // _08005A2A + textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->state = 6; + return 2; + case 9: // _08005A3A + textPrinter->state = 1; + if (gTextFlags.flag_2) + r4->frames_visible_counter = 0; + return 3; + case 10: // _08005A58 + textPrinter->state = 5; + return 3; + case 11: // _08005A5C + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + currChar |= *textPrinter->subPrinter.current_text_offset << 8; + textPrinter->subPrinter.current_text_offset++; + PlayBGM(currChar); + return 2; + case 16: // _08005A76 + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + currChar |= (*textPrinter->subPrinter.current_text_offset << 8); + textPrinter->subPrinter.current_text_offset++; + PlaySE(currChar); + return 2; + case 13: // _08005A90 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 14: // _08005A98 + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 15: // _08005AA4 + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | textPrinter->subPrinter.bgColor << 4); textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; - textPrinter->state = 0; - } - return 3; - case 3: // _08005CB8 - if (TextPrinterWaitWithDownArrow(textPrinter)) - { - TextPrinterClearDownArrow(textPrinter); - textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; - textPrinter->state = 4; - } - return 3; - case 4: // _08005CF0 - if (textPrinter->scrollDistance) - { - int scrollSpeed = sub_8197964(); - int r4two = gWindowVerticalScrollSpeeds[scrollSpeed]; - if (textPrinter->scrollDistance < r4two) + return 2; + case 23: // _08005ABE + m4aMPlayStop(&gMPlayInfo_BGM); + return 2; + case 24: // _08005ACC + m4aMPlayContinue(&gMPlayInfo_BGM); + return 2; + case 17: // _08005AD8 + width = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + if (width > 0) { - ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); - textPrinter->scrollDistance = 0; + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + return 0; } - else + return 2; + case 18: // _08005AF2 + textPrinter->subPrinter.currentX = *textPrinter->subPrinter.current_text_offset + textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 19: // _08005B02 { - ScrollWindow(textPrinter->subPrinter.windowId, 0, (int)r4two, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); - textPrinter->scrollDistance -= r4two; + s32 widthHelper = *textPrinter->subPrinter.current_text_offset; + widthHelper += textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + width = widthHelper - textPrinter->subPrinter.currentX; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + return 0; + } } - CopyWindowToVram(textPrinter->subPrinter.windowId, 2); + return 2; + case 20: // _08005B26 + textPrinter->minLetterSpacing = *textPrinter->subPrinter.current_text_offset++; + return 2; + case 21: // _08005B36 + textPrinter->japanese = 1; + return 2; + case 22: // _08005B3E + textPrinter->japanese = 0; + return 2; + case 12: // _08005B5A + currChar = *textPrinter->subPrinter.current_text_offset | 0x100; + textPrinter->subPrinter.current_text_offset++; + break; + } + break; + + case 0xF8+3: // _08005B48 + textPrinter->state = 2; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+2: // _08005B4C + textPrinter->state = 3; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+1: // _08005B5A + currChar = *textPrinter->subPrinter.current_text_offset | 0x100; + textPrinter->subPrinter.current_text_offset++; + break; + case 0xF8+0: // _08005B6C + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + gUnknown_03002F90[0x80] = DrawKeypadIcon(textPrinter->subPrinter.windowId, currChar, textPrinter->subPrinter.currentX, textPrinter->subPrinter.currentY); + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing; + return 0; + case 0xF8+7: // _08005D6C + return 1; + } + + switch (r4->font_type) // _08005B90 + { + case 0: // _08005BCC + DecompressGlyphFont0(currChar, textPrinter->japanese); + break; + case 1: // _08005BDA + DecompressGlyphFont1(currChar, textPrinter->japanese); + break; + case 2: + case 3: + case 4: + case 5: // _08005BE8 + DecompressGlyphFont2(currChar, textPrinter->japanese); + break; + case 7: // _08005BF6 + DecompressGlyphFont7(currChar, textPrinter->japanese); + break; + case 8: // _08005C04 + DecompressGlyphFont8(currChar, textPrinter->japanese); + break; + case 6: // _08005C10 + break; + } + + CopyGlyphToWindow(textPrinter); // _08005C10 + + if (textPrinter->minLetterSpacing) + { + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + width = textPrinter->minLetterSpacing - gUnknown_03002F90[0x80]; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + } + } + else // _08005C48 + { + if (textPrinter->japanese) + textPrinter->subPrinter.currentX += (gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing); + else + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + } + + return 0; + case 1: // _08005C78 + if (TextPrinterWait(textPrinter)) + textPrinter->state = 0; + return 3; + case 2: // _08005C8C + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, (textPrinter->subPrinter.bgColor << 4) | textPrinter->subPrinter.bgColor); + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + textPrinter->state = 0; + } + return 3; + case 3: // _08005CB8 + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + TextPrinterClearDownArrow(textPrinter); + textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->state = 4; + } + return 3; + case 4: // _08005CF0 + if (textPrinter->scrollDistance) + { + int scrollSpeed = sub_8197964(); + int speed = gWindowVerticalScrollSpeeds[scrollSpeed]; + if (textPrinter->scrollDistance < speed) + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance = 0; } else - textPrinter->state = 0; - return 3; - case 5: // _08005D48 - if (!IsSEPlaying()) - textPrinter->state = 0; - return 3; - case 6: // _08005D5A - if (textPrinter->delayCounter != 0) - textPrinter->delayCounter--; - else - textPrinter->state = 0; - return 3; + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, speed, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance -= speed; + } + CopyWindowToVram(textPrinter->subPrinter.windowId, 2); + } + else + { + textPrinter->state = 0; + } + return 3; + case 5: // _08005D48 + if (!IsSEPlaying()) + textPrinter->state = 0; + return 3; + case 6: // _08005D5A + if (textPrinter->delayCounter != 0) + textPrinter->delayCounter--; + else + textPrinter->state = 0; + return 3; } + return 1; } #else