diff --git a/asm/field_effect_helpers.s b/asm/field_effect_helpers.s deleted file mode 100644 index 9a019f60c..000000000 --- a/asm/field_effect_helpers.s +++ /dev/null @@ -1,4603 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start SetUpReflection -SetUpReflection: @ 8153ED4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - adds r4, r1, 0 - lsls r5, r2, 24 - lsrs r5, 24 - movs r0, 0x20 - ldrsh r1, [r4, r0] - movs r0, 0x22 - ldrsh r2, [r4, r0] - adds r0, r4, 0 - movs r3, 0x98 - bl CreateCopySpriteAt - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r7, r1, r0 - ldr r0, =objc_reflection_maybe - str r0, [r7, 0x1C] - ldrb r1, [r7, 0x5] - movs r0, 0xC - orrs r1, r0 - strb r1, [r7, 0x5] - ldr r2, =gReflectionEffectPaletteMap - lsrs r0, r1, 4 - adds r0, r2 - ldrb r0, [r0] - lsls r0, 4 - movs r2, 0xF - ands r1, r2 - orrs r1, r0 - strb r1, [r7, 0x5] - movs r1, 0x3F - adds r1, r7 - mov r8, r1 - ldrb r0, [r1] - movs r1, 0x40 - orrs r0, r1 - mov r1, r8 - strb r0, [r1] - ldr r0, =gDummySpriteAnimTable - str r0, [r7, 0x8] - adds r0, r7, 0 - movs r1, 0 - bl StartSpriteAnim - ldr r0, =gDummySpriteAffineAnimTable - str r0, [r7, 0x10] - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x8 - orrs r0, r1 - mov r1, r8 - strb r0, [r1] - adds r2, r7, 0 - adds r2, 0x42 - ldrb r1, [r2] - movs r0, 0x3F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x2E] - strh r0, [r7, 0x2E] - ldrb r0, [r6, 0x8] - strh r0, [r7, 0x30] - strh r5, [r7, 0x3C] - adds r0, r6, 0 - adds r1, r7, 0 - bl npc_pal_op - cmp r5, 0 - bne _08153F7A - ldrb r0, [r7, 0x1] - movs r1, 0x4 - negs r1, r1 - ands r1, r0 - movs r0, 0x1 - orrs r1, r0 - strb r1, [r7, 0x1] -_08153F7A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SetUpReflection - - thumb_func_start sub_8153F98 -sub_8153F98: @ 8153F98 - push {lr} - ldrb r0, [r0, 0x5] - bl GetEventObjectGraphicsInfo - ldrh r0, [r0, 0xA] - subs r0, 0x2 - lsls r0, 16 - asrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_8153F98 - - thumb_func_start npc_pal_op -@ void npc_pal_op(struct npc_state *npcState, struct obj *obj) -npc_pal_op: @ 8153FAC - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - adds r4, r1, 0 - ldr r1, =gUnknown_085CDC38 - mov r0, sp - movs r2, 0x6 - bl memcpy - movs r0, 0 - strh r0, [r4, 0x32] - ldrb r0, [r5, 0x5] - bl GetEventObjectGraphicsInfo - ldrb r1, [r0, 0xC] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08154008 - ldrb r0, [r5, 0x1F] - bl MetatileBehavior_GetBridgeSth - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08153FEE - ldrb r0, [r5, 0x1E] - bl MetatileBehavior_GetBridgeSth - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08154008 -_08153FEE: - subs r0, 0x1 - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r4, 0x32] - ldrb r1, [r4, 0x5] - lsrs r1, 4 - adds r0, r5, 0 - bl npc_pal_op_A - b _08154012 - .pool -_08154008: - ldrb r1, [r4, 0x5] - lsrs r1, 4 - adds r0, r5, 0 - bl npc_pal_op_B -_08154012: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end npc_pal_op - - thumb_func_start npc_pal_op_B -@ void npc_pal_op_B(void *a1, u8 slot) -npc_pal_op_B: @ 815401C - push {r4,lr} - lsls r1, 24 - lsrs r4, r1, 24 - ldrb r0, [r0, 0x5] - bl GetEventObjectGraphicsInfo - adds r2, r0, 0 - ldrh r1, [r2, 0x4] - ldr r0, =0x000011ff - cmp r1, r0 - beq _08154070 - ldrb r0, [r2, 0xC] - movs r1, 0xF - ands r1, r0 - cmp r1, 0 - bne _0815404C - ldrh r0, [r2, 0x2] - adds r1, r4, 0 - bl LoadPlayerObjectReflectionPalette - b _0815406A - .pool -_0815404C: - cmp r1, 0xA - bne _0815405A - ldrh r0, [r2, 0x2] - adds r1, r4, 0 - bl LoadSpecialObjectReflectionPalette - b _0815406A -_0815405A: - adds r0, r4, 0 - bl GetObjectPaletteTag - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl PatchObjectPalette -_0815406A: - adds r0, r4, 0 - bl UpdateSpritePaletteWithWeather -_08154070: - pop {r4} - pop {r0} - bx r0 - thumb_func_end npc_pal_op_B - - thumb_func_start npc_pal_op_A -npc_pal_op_A: @ 8154078 - push {r4,lr} - lsls r1, 24 - lsrs r4, r1, 24 - ldrb r0, [r0, 0x5] - bl GetEventObjectGraphicsInfo - adds r2, r0, 0 - ldrh r1, [r2, 0x4] - ldr r0, =0x000011ff - cmp r1, r0 - beq _0815409C - adds r0, r1, 0 - adds r1, r4, 0 - bl PatchObjectPalette - adds r0, r4, 0 - bl UpdateSpritePaletteWithWeather -_0815409C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end npc_pal_op_A - - thumb_func_start objc_reflection_maybe -@ void objc_reflection_maybe(struct obj *object) -objc_reflection_maybe: @ 81540A8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r7, r0, r1 - ldrb r1, [r7, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r5, r0, r1 - ldr r0, [r7] - ldr r1, =0x00020001 - ands r0, r1 - cmp r0, r1 - bne _081540E0 - ldrb r1, [r7, 0x8] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r1, r0 - beq _081540FC -_081540E0: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _08154214 - .pool -_081540FC: - ldr r1, =gReflectionEffectPaletteMap - ldrb r0, [r5, 0x5] - lsrs r0, 4 - adds r0, r1 - ldrb r1, [r0] - lsls r1, 4 - ldrb r2, [r4, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - ldrb r1, [r5, 0x1] - lsrs r1, 6 - lsls r1, 6 - ldrb r2, [r4, 0x1] - movs r3, 0x3F - adds r0, r3, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r5, 0x3] - lsrs r0, 6 - lsls r0, 6 - ldrb r2, [r4, 0x3] - adds r1, r3, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x3] - ldrb r0, [r5, 0x3] - lsls r0, 26 - lsrs r0, 27 - movs r2, 0x10 - orrs r0, r2 - lsls r0, 1 - subs r2, 0x4F - mov r9, r2 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x3] - ldrh r1, [r5, 0x4] - lsls r1, 22 - lsrs r1, 22 - ldrh r2, [r4, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - ldr r0, [r5, 0x18] - str r0, [r4, 0x18] - adds r0, r5, 0 - adds r0, 0x42 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 26 - adds r2, r4, 0 - adds r2, 0x42 - ands r3, r0 - ldrb r1, [r2] - movs r0, 0x40 - negs r0, r0 - ands r0, r1 - orrs r0, r3 - strb r0, [r2] - movs r0, 0x3E - adds r0, r5 - mov r8, r0 - ldrb r0, [r0] - adds r6, r4, 0 - adds r6, 0x3E - movs r1, 0x4 - ands r1, r0 - ldrb r2, [r6] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6] - ldrh r0, [r5, 0x20] - strh r0, [r4, 0x20] - adds r0, r7, 0 - bl sub_8153F98 - ldrh r1, [r5, 0x22] - adds r0, r1 - ldrh r1, [r4, 0x32] - adds r1, r0 - strh r1, [r4, 0x22] - adds r0, r5, 0 - adds r0, 0x28 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x28 - strb r1, [r0] - adds r0, r5, 0 - adds r0, 0x29 - ldrb r0, [r0] - adds r1, r4, 0 - adds r1, 0x29 - strb r0, [r1] - ldrh r0, [r5, 0x24] - strh r0, [r4, 0x24] - ldrh r0, [r5, 0x26] - negs r0, r0 - strh r0, [r4, 0x26] - mov r2, r8 - ldrb r1, [r2] - movs r0, 0x2 - ands r0, r1 - ldrb r1, [r6] - movs r2, 0x3 - negs r2, r2 - ands r2, r1 - orrs r2, r0 - strb r2, [r6] - ldrb r0, [r7, 0x3] - lsls r0, 28 - cmp r0, 0 - bge _081541EE - movs r0, 0x4 - orrs r2, r0 - strb r2, [r6] -_081541EE: - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08154214 - ldrb r0, [r4, 0x3] - mov r2, r9 - ands r2, r0 - strb r2, [r4, 0x3] - ldrb r0, [r5, 0x3] - lsls r0, 26 - lsrs r0, 27 - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08154214 - movs r1, 0x2 - adds r0, r2, 0 - orrs r0, r1 - strb r0, [r4, 0x3] -_08154214: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end objc_reflection_maybe - - thumb_func_start sub_8154228 -sub_8154228: @ 8154228 - push {r4,lr} - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x20] - movs r1, 0 - movs r2, 0 - movs r3, 0x52 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - cmp r0, 0x40 - beq _08154266 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - orrs r0, r3 - strb r0, [r1] -_08154266: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154228 - - thumb_func_start objid_set_invisible -objid_set_invisible: @ 8154278 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end objid_set_invisible - - thumb_func_start sub_8154298 -sub_8154298: @ 8154298 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r6, r3, 16 - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _081542E2 - movs r0, 0x2E - ldrsh r1, [r2, r0] - lsls r0, r7, 16 - asrs r0, 16 - cmp r1, r0 - bne _081542E2 - movs r0, 0x30 - ldrsh r1, [r2, r0] - lsls r0, r6, 16 - asrs r0, 16 - cmp r1, r0 - beq _0815432E -_081542E2: - lsls r0, r7, 16 - asrs r0, 16 - lsls r1, r6, 16 - asrs r1, 16 - mov r4, sp - adds r4, 0x2 - mov r2, sp - adds r3, r4, 0 - bl sub_8093038 - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - mov r0, sp - ldrh r0, [r0] - adds r0, 0x8 - strh r0, [r2, 0x20] - ldrh r0, [r4] - adds r0, 0x8 - strh r0, [r2, 0x22] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - strh r7, [r2, 0x2E] - strh r6, [r2, 0x30] - mov r1, r8 - subs r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r2, 0 - bl StartSpriteAnim -_0815432E: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8154298 - - thumb_func_start oei_shadow -oei_shadow: @ 8154340 - push {r4,r5,lr} - ldr r5, =gFieldEffectArguments - ldrb r0, [r5] - ldrb r1, [r5, 0x4] - ldrb r2, [r5, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gEventObjects - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x5] - bl GetEventObjectGraphicsInfo - adds r4, r0, 0 - ldr r2, =gFieldEffectObjectTemplatePointers - ldr r1, =gUnknown_085CDC3E - ldrb r0, [r4, 0xC] - lsls r0, 26 - lsrs r0, 30 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - movs r1, 0 - movs r2, 0 - movs r3, 0x94 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _081543C4 - ldr r0, =gSprites - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - ldr r0, [r5] - strh r0, [r2, 0x2E] - ldr r0, [r5, 0x4] - strh r0, [r2, 0x30] - ldr r0, [r5, 0x8] - strh r0, [r2, 0x32] - ldrh r1, [r4, 0xA] - lsls r1, 16 - asrs r1, 17 - ldr r3, =gUnknown_085CDC42 - ldrb r0, [r4, 0xC] - lsls r0, 26 - lsrs r0, 30 - lsls r0, 1 - adds r0, r3 - ldrh r0, [r0] - subs r1, r0 - strh r1, [r2, 0x34] -_081543C4: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end oei_shadow - - thumb_func_start oamc_shadow -oamc_shadow: @ 81543E4 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - ldrh r0, [r5, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r5, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - beq _08154412 - adds r0, r5, 0 - movs r1, 0x3 - bl FieldEffectStop - b _08154498 -_08154412: - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - ldrb r0, [r4, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - ldrb r0, [r1, 0x5] - movs r2, 0xC - ands r2, r0 - ldrb r3, [r5, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r5, 0x5] - ldrh r0, [r1, 0x20] - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x34] - ldrh r1, [r1, 0x22] - adds r0, r1 - strh r0, [r5, 0x22] - ldr r0, [r4] - ldr r1, =0x00400001 - ands r0, r1 - cmp r0, r1 - bne _08154490 - ldrb r0, [r4, 0x1E] - bl MetatileBehavior_IsPokeGrass - lsls r0, 24 - cmp r0, 0 - bne _08154490 - ldrb r0, [r4, 0x1E] - bl MetatileBehavior_IsSurfableWaterOrUnderwater - lsls r0, 24 - cmp r0, 0 - bne _08154490 - ldrb r0, [r4, 0x1F] - bl MetatileBehavior_IsSurfableWaterOrUnderwater - lsls r0, 24 - cmp r0, 0 - bne _08154490 - ldrb r0, [r4, 0x1E] - bl MetatileBehavior_IsReflective - lsls r0, 24 - cmp r0, 0 - bne _08154490 - ldrb r0, [r4, 0x1F] - bl MetatileBehavior_IsReflective - lsls r0, 24 - cmp r0, 0 - beq _08154498 -_08154490: - adds r0, r5, 0 - movs r1, 0x3 - bl FieldEffectStop -_08154498: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end oamc_shadow - - thumb_func_start oei_grass_normal -oei_grass_normal: @ 81544AC - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gFieldEffectArguments - ldrh r1, [r5] - mov r0, sp - strh r1, [r0] - ldrh r0, [r5, 0x4] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r0, sp - adds r1, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x10] - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _08154538 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r3, r0, r1 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x3 - ldrb r1, [r5, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r5, 0x8] - strh r0, [r3, 0x2E] - ldr r0, [r5] - strh r0, [r3, 0x30] - ldr r0, [r5, 0x4] - strh r0, [r3, 0x32] - ldr r0, [r5, 0x10] - strh r0, [r3, 0x34] - ldr r0, [r5, 0x14] - strh r0, [r3, 0x36] - ldr r0, [r5, 0x18] - strh r0, [r3, 0x38] - ldr r0, [r5, 0x1C] - cmp r0, 0 - beq _08154538 - adds r0, r3, 0 - movs r1, 0x4 - bl SeekSpriteAnim -_08154538: - movs r0, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end oei_grass_normal - - thumb_func_start unc_grass_normal -unc_grass_normal: @ 8154550 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r5, r0, 0 - ldrh r0, [r5, 0x38] - lsrs r4, r0, 8 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, =gCamera - ldrb r1, [r3] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0815459C - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r0, r4 - bne _08154582 - movs r0, 0x4 - ldrsb r0, [r2, r0] - cmp r0, r7 - beq _0815459C -_08154582: - ldr r1, [r3, 0x4] - ldrh r0, [r5, 0x30] - subs r0, r1 - strh r0, [r5, 0x30] - ldr r1, [r3, 0x8] - ldrh r0, [r5, 0x32] - subs r0, r1 - strh r0, [r5, 0x32] - ldrb r1, [r2, 0x5] - lsls r1, 8 - ldrb r0, [r2, 0x4] - orrs r0, r1 - strh r0, [r5, 0x38] -_0815459C: - ldrh r0, [r5, 0x34] - lsrs r1, r0, 8 - mov r8, r1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrh r0, [r5, 0x36] - lsls r0, 24 - lsrs r7, r0, 24 - movs r2, 0x30 - ldrsh r0, [r5, r2] - movs r2, 0x32 - ldrsh r1, [r5, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r6, r0, 24 - mov r0, r8 - adds r1, r4, 0 - adds r2, r7, 0 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _081545F0 - adds r0, r6, 0 - bl MetatileBehavior_IsTallGrass - lsls r0, 24 - cmp r0, 0 - beq _081545F0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _08154604 - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08154604 -_081545F0: - adds r0, r5, 0 - movs r1, 0x4 - bl FieldEffectStop - b _08154648 - .pool -_08154604: - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r2, r0, r1 - ldr r0, [r2, 0x10] - ldr r1, [r5, 0x30] - cmp r0, r1 - beq _08154624 - ldr r0, [r2, 0x14] - cmp r0, r1 - beq _08154624 - movs r0, 0x1 - strh r0, [r5, 0x3C] -_08154624: - movs r6, 0 - adds r0, r5, 0 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0 - bne _08154632 - movs r6, 0x4 -_08154632: - adds r0, r5, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - ldrh r1, [r5, 0x2E] - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - adds r2, r6, 0 - bl sub_81561FC -_08154648: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end unc_grass_normal - - thumb_func_start sub_8154658 -sub_8154658: @ 8154658 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0xC - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x28] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081546B4 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r2, 0x2E] - movs r0, 0xC - strh r0, [r2, 0x30] -_081546B4: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154658 - - thumb_func_start sub_81546C8 -sub_81546C8: @ 81546C8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, [sp, 0x18] - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - movs r5, 0 - ldr r0, =gSprites - mov r8, r0 - lsls r3, 16 - asrs r3, 16 - lsls r4, 16 - asrs r4, 16 -_081546EC: - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - mov r1, r8 - adds r2, r0, r1 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - beq _08154740 - ldr r1, [r2, 0x1C] - ldr r0, =unc_grass_normal - cmp r1, r0 - bne _08154740 - movs r1, 0x30 - ldrsh r0, [r2, r1] - cmp r3, r0 - bne _08154740 - movs r1, 0x32 - ldrsh r0, [r2, r1] - cmp r4, r0 - bne _08154740 - ldrh r1, [r2, 0x34] - lsrs r0, r1, 8 - cmp r12, r0 - bne _08154740 - movs r0, 0xFF - ands r0, r1 - cmp r7, r0 - bne _08154740 - movs r1, 0x36 - ldrsh r0, [r2, r1] - cmp r6, r0 - bne _08154740 - adds r0, r5, 0 - b _0815474C - .pool -_08154740: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3F - bls _081546EC - movs r0, 0x40 -_0815474C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81546C8 - - thumb_func_start sub_8154758 -sub_8154758: @ 8154758 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gFieldEffectArguments - ldrh r1, [r5] - mov r0, sp - strh r1, [r0] - ldrh r0, [r5, 0x4] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r0, sp - adds r1, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x3C] - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _081547E8 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r5, 0x8] - bl ZCoordToPriority - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - ldr r0, [r5, 0x8] - strh r0, [r4, 0x2E] - ldr r0, [r5] - strh r0, [r4, 0x30] - ldr r0, [r5, 0x4] - strh r0, [r4, 0x32] - ldr r0, [r5, 0x10] - strh r0, [r4, 0x34] - ldr r0, [r5, 0x14] - strh r0, [r4, 0x36] - ldr r0, [r5, 0x18] - strh r0, [r4, 0x38] - ldr r0, [r5, 0x1C] - cmp r0, 0 - beq _081547E8 - adds r0, r4, 0 - movs r1, 0x6 - bl SeekSpriteAnim -_081547E8: - movs r0, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154758 - - thumb_func_start unc_grass_tall -unc_grass_tall: @ 8154800 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r5, r0, 0 - ldrh r0, [r5, 0x38] - lsrs r7, r0, 8 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r3, =gCamera - ldrb r1, [r3] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0815484C - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r0, r7 - bne _08154832 - movs r0, 0x4 - ldrsb r0, [r2, r0] - cmp r0, r6 - beq _0815484C -_08154832: - ldr r1, [r3, 0x4] - ldrh r0, [r5, 0x30] - subs r0, r1 - strh r0, [r5, 0x30] - ldr r1, [r3, 0x8] - ldrh r0, [r5, 0x32] - subs r0, r1 - strh r0, [r5, 0x32] - ldrb r1, [r2, 0x5] - lsls r1, 8 - ldrb r0, [r2, 0x4] - orrs r0, r1 - strh r0, [r5, 0x38] -_0815484C: - ldrh r0, [r5, 0x34] - lsrs r1, r0, 8 - mov r8, r1 - lsls r0, 24 - lsrs r7, r0, 24 - ldrh r0, [r5, 0x36] - lsls r0, 24 - lsrs r6, r0, 24 - movs r2, 0x30 - ldrsh r0, [r5, r2] - movs r2, 0x32 - ldrsh r1, [r5, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - mov r0, r8 - adds r1, r7, 0 - adds r2, r6, 0 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _081548A0 - adds r0, r4, 0 - bl MetatileBehavior_IsLongGrass - lsls r0, 24 - cmp r0, 0 - beq _081548A0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _081548B4 - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081548B4 -_081548A0: - adds r0, r5, 0 - movs r1, 0x11 - bl FieldEffectStop - b _081548EA - .pool -_081548B4: - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r2, r0, r1 - ldr r0, [r2, 0x10] - ldr r1, [r5, 0x30] - cmp r0, r1 - beq _081548D4 - ldr r0, [r2, 0x14] - cmp r0, r1 - beq _081548D4 - movs r0, 0x1 - strh r0, [r5, 0x3C] -_081548D4: - adds r0, r5, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - ldrh r1, [r5, 0x2E] - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - movs r2, 0 - bl sub_81561FC -_081548EA: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end unc_grass_tall - - thumb_func_start sub_81548FC -sub_81548FC: @ 81548FC - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x40] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08154958 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r2, 0x2E] - movs r0, 0x12 - strh r0, [r2, 0x30] -_08154958: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81548FC - - thumb_func_start sub_815496C -sub_815496C: @ 815496C - push {r4-r6,lr} - ldr r6, =gFieldEffectArguments - ldrb r0, [r6] - ldrb r1, [r6, 0x4] - ldrb r2, [r6, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r5, r1, r0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x78] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081549F8 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r4, =gSprites - adds r2, r4 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x5] - movs r1, 0xC - ands r1, r0 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r6] - strh r0, [r2, 0x2E] - ldr r0, [r6, 0x4] - strh r0, [r2, 0x30] - ldr r0, [r6, 0x8] - strh r0, [r2, 0x32] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x20] - strh r0, [r2, 0x34] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x22] - strh r0, [r2, 0x36] -_081549F8: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_815496C - - thumb_func_start sub_8154A10 -sub_8154A10: @ 8154A10 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08154A4E - ldr r5, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1, 0x2] - lsls r0, 29 - cmp r0, 0 - blt _08154A5C -_08154A4E: - adds r0, r4, 0 - movs r1, 0x29 - bl FieldEffectStop - b _08154AF2 - .pool -_08154A5C: - ldrb r0, [r1, 0x5] - bl GetEventObjectGraphicsInfo - mov r8, r0 - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r6, r0, r1 - ldrh r5, [r6, 0x22] - ldrh r7, [r6, 0x20] - movs r0, 0x20 - ldrsh r1, [r6, r0] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08154A98 - lsls r0, r5, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - cmp r0, r1 - beq _08154AB2 -_08154A98: - strh r7, [r4, 0x34] - strh r5, [r4, 0x36] - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08154AB2 - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnim -_08154AB2: - strh r7, [r4, 0x20] - strh r5, [r4, 0x22] - mov r1, r8 - ldrh r0, [r1, 0xA] - lsls r0, 16 - asrs r0, 17 - subs r0, 0x8 - strh r0, [r4, 0x26] - adds r0, r6, 0 - adds r0, 0x43 - ldrb r0, [r0] - subs r0, 0x1 - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrb r0, [r6, 0x5] - movs r1, 0xC - ands r1, r0 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - adds r0, r6, 0 - adds r0, 0x3E - ldrb r1, [r0] - lsls r1, 29 - lsrs r1, 31 - adds r0, r4, 0 - bl UpdateEventObjectSpriteVisibility -_08154AF2: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8154A10 - - thumb_func_start sub_8154B04 -sub_8154B04: @ 8154B04 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x2C] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _08154B62 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r3] - movs r1, 0x3 - ldrb r2, [r4, 0xC] - ands r2, r1 - lsls r2, 2 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0xD - strh r1, [r0, 0x3C] - ldrb r1, [r4, 0x10] - bl StartSpriteAnim -_08154B62: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154B04 - - thumb_func_start sub_8154B78 -sub_8154B78: @ 8154B78 - push {r4,r5,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x5C] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - adds r5, r1, 0 - cmp r1, 0x40 - beq _08154BD8 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r3] - movs r1, 0x3 - ldrb r2, [r4, 0xC] - ands r2, r1 - lsls r2, 2 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x18 - strh r1, [r0, 0x3C] - ldrb r1, [r4, 0x10] - bl StartSpriteAnim -_08154BD8: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154B78 - - thumb_func_start sub_8154BEC -sub_8154BEC: @ 8154BEC - push {r4,r5,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x6C] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r1, r0, 24 - adds r5, r1, 0 - cmp r1, 0x40 - beq _08154C4C - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r3] - movs r1, 0x3 - ldrb r2, [r4, 0xC] - ands r2, r1 - lsls r2, 2 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x23 - strh r1, [r0, 0x3C] - ldrb r1, [r4, 0x10] - bl StartSpriteAnim -_08154C4C: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154BEC - - thumb_func_start sub_8154C60 -sub_8154C60: @ 8154C60 - push {lr} - ldr r2, =gUnknown_085CDC4C - movs r3, 0x2E - ldrsh r1, [r0, r3] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8154C60 - - thumb_func_start sub_8154C7C -sub_8154C7C: @ 8154C7C - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x28 - ble _08154C92 - movs r0, 0x1 - strh r0, [r1, 0x2E] -_08154C92: - adds r0, r1, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - pop {r0} - bx r0 - thumb_func_end sub_8154C7C - - thumb_func_start sub_8154CA0 -sub_8154CA0: @ 8154CA0 - push {r4,lr} - adds r4, r0, 0 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - ldrb r1, [r3] - lsls r1, 29 - lsrs r1, 31 - adds r0, r4, 0 - bl UpdateEventObjectSpriteVisibility - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x38 - ble _08154CE4 - ldrh r1, [r4, 0x3C] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl FieldEffectStop -_08154CE4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8154CA0 - - thumb_func_start sub_8154CEC -sub_8154CEC: @ 8154CEC - push {r4-r6,lr} - ldr r6, =gFieldEffectArguments - ldrb r0, [r6] - ldrb r1, [r6, 0x4] - ldrb r2, [r6, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r5, r1, r0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x34] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _08154D76 - ldrb r0, [r5, 0x5] - bl GetEventObjectGraphicsInfo - lsls r3, r4, 4 - adds r3, r4 - lsls r3, 2 - ldr r4, =gSprites - adds r3, r4 - movs r1, 0x3E - adds r1, r3 - mov r12, r1 - ldrb r1, [r1] - movs r2, 0x2 - orrs r1, r2 - mov r2, r12 - strb r1, [r2] - ldrb r2, [r5, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x5] - movs r2, 0xC - ands r2, r1 - ldrb r4, [r3, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r4 - orrs r1, r2 - strb r1, [r3, 0x5] - ldr r1, [r6] - strh r1, [r3, 0x2E] - ldr r1, [r6, 0x4] - strh r1, [r3, 0x30] - ldr r1, [r6, 0x8] - strh r1, [r3, 0x32] - ldrh r0, [r0, 0xA] - lsls r0, 16 - asrs r0, 17 - subs r0, 0x4 - strh r0, [r3, 0x26] - movs r0, 0x46 - bl PlaySE -_08154D76: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154CEC - - thumb_func_start sub_8154D90 -sub_8154D90: @ 8154D90 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08154DC0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - beq _08154DCA -_08154DC0: - adds r0, r4, 0 - movs r1, 0xF - bl FieldEffectStop - b _08154E0A -_08154DCA: - ldr r3, =gSprites - ldr r2, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r0, [r0, 0x20] - strh r0, [r4, 0x20] - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r0, [r0, 0x22] - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility -_08154E0A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8154D90 - - thumb_func_start sub_8154E1C -sub_8154E1C: @ 8154E1C - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0xC - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x38] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08154E78 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r2, 0x2E] - movs r0, 0x10 - strh r0, [r2, 0x30] -_08154E78: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154E1C - - thumb_func_start oei_water_drop_tall -oei_water_drop_tall: @ 8154E8C - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x30] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08154EE8 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r2, 0x2E] - movs r0, 0xE - strh r0, [r2, 0x30] -_08154EE8: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end oei_water_drop_tall - - thumb_func_start sub_8154EFC -sub_8154EFC: @ 8154EFC - push {r4-r7,lr} - ldr r7, =gFieldEffectArguments - ldrb r0, [r7] - ldrb r1, [r7, 0x4] - ldrb r2, [r7, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r6, r1, r0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x34] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x40 - beq _08154F92 - ldrb r0, [r6, 0x5] - bl GetEventObjectGraphicsInfo - adds r4, r0, 0 - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - ldr r3, =gSprites - adds r0, r3 - ldr r1, =sub_8154FB4 - str r1, [r0, 0x1C] - adds r5, r0, 0 - adds r5, 0x3E - ldrb r1, [r5] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r5] - ldrb r2, [r6, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - ldrb r1, [r1, 0x5] - movs r2, 0xC - ands r2, r1 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r1, [r7] - strh r1, [r0, 0x2E] - ldr r1, [r7, 0x4] - strh r1, [r0, 0x30] - ldr r1, [r7, 0x8] - strh r1, [r0, 0x32] - ldr r1, =0x0000ffff - strh r1, [r0, 0x34] - movs r1, 0x1 - negs r1, r1 - strh r1, [r0, 0x36] - ldrh r1, [r4, 0xA] - lsls r1, 16 - asrs r1, 17 - subs r1, 0x4 - strh r1, [r0, 0x26] - movs r1, 0x1 - bl StartSpriteAnim -_08154F92: - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8154EFC - - thumb_func_start sub_8154FB4 -sub_8154FB4: @ 8154FB4 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08154FEE - ldr r2, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - ldrb r0, [r5, 0x2] - lsls r0, 28 - cmp r0, 0 - blt _08154FFC -_08154FEE: - adds r0, r4, 0 - movs r1, 0x22 - bl FieldEffectStop - b _08155046 - .pool -_08154FFC: - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - ldrh r1, [r0, 0x20] - strh r1, [r4, 0x20] - ldrh r1, [r0, 0x22] - strh r1, [r4, 0x22] - adds r0, 0x43 - ldrb r0, [r0] - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - ldr r1, [r5, 0x10] - ldr r0, [r4, 0x34] - cmp r1, r0 - beq _08155046 - ldrh r0, [r5, 0x10] - strh r0, [r4, 0x34] - ldrh r0, [r5, 0x12] - strh r0, [r4, 0x36] - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08155046 - movs r0, 0x46 - bl PlaySE -_08155046: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8154FB4 - - thumb_func_start oei_ripples -oei_ripples: @ 8155054 - push {r4,lr} - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x14] - ldr r4, =gFieldEffectArguments - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081550A0 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x5 - strh r0, [r2, 0x2E] -_081550A0: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end oei_ripples - - thumb_func_start sub_81550B4 -sub_81550B4: @ 81550B4 - push {r4-r6,lr} - ldr r6, =gFieldEffectArguments - ldrb r0, [r6] - ldrb r1, [r6, 0x4] - ldrb r2, [r6, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r5, r1, r0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x7C] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155140 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r4, =gSprites - adds r2, r4 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x5] - movs r1, 0xC - ands r1, r0 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r6] - strh r0, [r2, 0x2E] - ldr r0, [r6, 0x4] - strh r0, [r2, 0x30] - ldr r0, [r6, 0x8] - strh r0, [r2, 0x32] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x20] - strh r0, [r2, 0x34] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x22] - strh r0, [r2, 0x36] -_08155140: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81550B4 - - thumb_func_start sub_8155158 -sub_8155158: @ 8155158 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08155192 - ldr r5, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1, 0x2] - lsls r0, 26 - cmp r0, 0 - blt _081551A0 -_08155192: - adds r0, r4, 0 - movs r1, 0x2A - bl FieldEffectStop - b _081551E4 - .pool -_081551A0: - ldrb r0, [r1, 0x5] - bl GetEventObjectGraphicsInfo - mov r1, sp - ldrb r2, [r1] - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r1, r2 - ldrh r2, [r1, 0x20] - strh r2, [r4, 0x20] - ldrh r0, [r0, 0xA] - lsls r0, 16 - asrs r0, 17 - ldrh r2, [r1, 0x22] - adds r0, r2 - subs r0, 0x8 - strh r0, [r4, 0x22] - adds r1, 0x43 - ldrb r0, [r1] - subs r0, 0x1 - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility -_081551E4: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155158 - - thumb_func_start sub_81551F0 -sub_81551F0: @ 81551F0 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x44] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155248 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x13 - strh r0, [r2, 0x2E] -_08155248: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81551F0 - - thumb_func_start sub_815525C -sub_815525C: @ 815525C - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x48] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081552B4 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x14 - strh r0, [r2, 0x2E] -_081552B4: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_815525C - - thumb_func_start sub_81552C8 -sub_81552C8: @ 81552C8 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x4C] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155320 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x15 - strh r0, [r2, 0x2E] -_08155320: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81552C8 - - thumb_func_start sub_8155334 -sub_8155334: @ 8155334 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x50] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0815538C - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x16 - strh r0, [r2, 0x2E] -_0815538C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155334 - - thumb_func_start ash -ash: @ 81553A0 - push {r4,lr} - lsls r2, 16 - lsrs r2, 16 - ldr r4, =gFieldEffectArguments - lsls r0, 16 - asrs r0, 16 - str r0, [r4] - lsls r1, 16 - asrs r1, 16 - str r1, [r4, 0x4] - movs r0, 0x52 - str r0, [r4, 0x8] - movs r0, 0x1 - str r0, [r4, 0xC] - str r2, [r4, 0x10] - lsls r3, 16 - asrs r3, 16 - str r3, [r4, 0x14] - movs r0, 0x7 - bl FieldEffectStart - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ash - - thumb_func_start oei_ash -oei_ash: @ 81553D4 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gFieldEffectArguments - ldrh r1, [r5] - mov r0, sp - strh r1, [r0] - ldrh r0, [r5, 0x4] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r0, sp - adds r1, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x18] - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r4, r3] - ldrb r3, [r5, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0815544A - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r5, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r5] - strh r0, [r2, 0x30] - ldr r0, [r5, 0x4] - strh r0, [r2, 0x32] - ldr r0, [r5, 0x10] - strh r0, [r2, 0x34] - ldr r0, [r5, 0x14] - strh r0, [r2, 0x36] -_0815544A: - movs r0, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end oei_ash - - thumb_func_start sub_8155460 -sub_8155460: @ 8155460 - push {lr} - ldr r2, =gUnknown_085CDC54 - movs r3, 0x2E - ldrsh r1, [r0, r3] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155460 - - thumb_func_start sub_815547C -sub_815547C: @ 815547C - push {lr} - adds r3, r0, 0 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - subs r2, 0x12 - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r3, 0x36] - subs r0, 0x1 - strh r0, [r3, 0x36] - lsls r0, 16 - cmp r0, 0 - bne _081554A6 - movs r0, 0x1 - strh r0, [r3, 0x2E] -_081554A6: - pop {r0} - bx r0 - thumb_func_end sub_815547C - - thumb_func_start sub_81554AC -sub_81554AC: @ 81554AC - push {r4,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - subs r2, 0x12 - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r2, 0x32 - ldrsh r1, [r4, r2] - ldrh r2, [r4, 0x34] - bl MapGridSetMetatileIdAt - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r2, 0x32 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - movs r0, 0x2 - strh r0, [r4, 0x2E] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81554AC - - thumb_func_start sub_815550C -sub_815550C: @ 815550C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0815552C - adds r0, r4, 0 - movs r1, 0x7 - bl FieldEffectStop -_0815552C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_815550C - - thumb_func_start sub_8155534 -sub_8155534: @ 8155534 - push {r4,r5,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x1C] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0x96 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - cmp r0, 0x40 - beq _0815558E - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r3] - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r1, 0x32] - ldr r0, =0x0000ffff - strh r0, [r1, 0x34] - movs r0, 0x1 - negs r0, r0 - strh r0, [r1, 0x3A] - strh r0, [r1, 0x3C] -_0815558E: - movs r0, 0x8 - bl FieldEffectActiveListRemove - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155534 - - thumb_func_start sub_81555AC -sub_81555AC: @ 81555AC - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r3, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldrh r0, [r2, 0x2E] - movs r3, 0x10 - negs r3, r3 - ands r3, r0 - movs r0, 0xF0 - lsls r0, 20 - ands r0, r1 - lsrs r0, 24 - orrs r0, r3 - strh r0, [r2, 0x2E] - bx lr - .pool - thumb_func_end sub_81555AC - - thumb_func_start sub_81555D8 -sub_81555D8: @ 81555D8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r3, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldrh r0, [r2, 0x2E] - movs r3, 0xF1 - negs r3, r3 - ands r3, r0 - movs r0, 0xF0 - lsls r0, 20 - ands r0, r1 - lsrs r0, 20 - orrs r3, r0 - strh r3, [r2, 0x2E] - bx lr - .pool - thumb_func_end sub_81555D8 - - thumb_func_start sub_8155604 -sub_8155604: @ 8155604 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r3, r4 - ldrh r0, [r3, 0x2E] - ldr r4, =0xfffff0ff - ands r4, r0 - movs r0, 0xF0 - lsls r0, 20 - ands r0, r1 - lsrs r0, 16 - orrs r4, r0 - strh r4, [r3, 0x2E] - strh r2, [r3, 0x30] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155604 - - thumb_func_start sub_8155638 -sub_8155638: @ 8155638 - ldrh r1, [r0, 0x2E] - movs r0, 0xF - ands r0, r1 - bx lr - thumb_func_end sub_8155638 - - thumb_func_start sub_8155640 -sub_8155640: @ 8155640 - ldrh r1, [r0, 0x2E] - movs r0, 0xF0 - ands r0, r1 - lsrs r0, 4 - bx lr - thumb_func_end sub_8155640 - - thumb_func_start sub_815564C -sub_815564C: @ 815564C - ldrh r1, [r0, 0x2E] - movs r0, 0xF0 - lsls r0, 4 - ands r0, r1 - lsrs r0, 8 - bx lr - thumb_func_end sub_815564C - - thumb_func_start sub_8155658 -sub_8155658: @ 8155658 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - ldrb r0, [r4, 0x4] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r0, =gSprites - adds r5, r0 - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_81556B0 - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_81556E8 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_815577C - ldrb r0, [r5, 0x5] - movs r1, 0xC - ands r1, r0 - ldrb r2, [r6, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6, 0x5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155658 - - thumb_func_start sub_81556B0 -sub_81556B0: @ 81556B0 - push {r4,r5,lr} - sub sp, 0xC - adds r5, r0, 0 - adds r4, r1, 0 - ldr r1, =gUnknown_085CDC60 - mov r0, sp - movs r2, 0x9 - bl memcpy - adds r0, r4, 0 - bl sub_8155640 - lsls r0, 24 - cmp r0, 0 - bne _081556DC - ldrb r0, [r5, 0x18] - lsrs r0, 4 - add r0, sp - ldrb r1, [r0] - adds r0, r4, 0 - bl StartSpriteAnimIfDifferent -_081556DC: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81556B0 - - thumb_func_start sub_81556E8 -sub_81556E8: @ 81556E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r1, 0 - ldrh r2, [r0, 0x10] - mov r1, sp - strh r2, [r1] - ldrh r1, [r0, 0x12] - mov r0, sp - adds r0, 0x2 - strh r1, [r0] - movs r2, 0x26 - ldrsh r3, [r4, r2] - mov r8, r0 - cmp r3, 0 - bne _08155770 - mov r0, sp - movs r5, 0 - ldrsh r2, [r0, r5] - movs r5, 0x3A - ldrsh r0, [r4, r5] - cmp r2, r0 - bne _08155724 - lsls r0, r1, 16 - asrs r0, 16 - movs r5, 0x3C - ldrsh r1, [r4, r5] - cmp r0, r1 - beq _08155770 -_08155724: - strh r3, [r4, 0x38] - strh r2, [r4, 0x3A] - mov r1, r8 - movs r2, 0 - ldrsh r0, [r1, r2] - strh r0, [r4, 0x3C] - movs r5, 0x1 - mov r7, r8 - mov r6, sp -_08155736: - adds r0, r5, 0 - mov r1, sp - adds r2, r7, 0 - bl MoveCoords - movs r1, 0 - ldrsh r0, [r6, r1] - movs r2, 0 - ldrsh r1, [r7, r2] - bl MapGridGetZCoordAt - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0815575C - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - b _08155770 -_0815575C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4, 0x3A] - strh r0, [r6] - ldrh r0, [r4, 0x3C] - mov r1, r8 - strh r0, [r1] - cmp r5, 0x4 - bls _08155736 -_08155770: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81556E8 - - thumb_func_start sub_815577C -sub_815577C: @ 815577C - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r1, 0 - adds r4, r2, 0 - ldr r1, =gUnknown_085CDC6A - mov r0, sp - movs r2, 0x4 - bl memcpy - adds r0, r4, 0 - bl sub_8155638 - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - cmp r2, 0 - beq _081557F6 - ldrh r1, [r4, 0x36] - adds r1, 0x1 - strh r1, [r4, 0x36] - movs r3, 0x38 - ldrsh r0, [r4, r3] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _081557BC - ldrh r0, [r4, 0x34] - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] -_081557BC: - ldrh r1, [r4, 0x36] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _081557CC - ldrh r0, [r4, 0x34] - negs r0, r0 - strh r0, [r4, 0x34] -_081557CC: - cmp r2, 0x2 - beq _081557F6 - adds r0, r4, 0 - bl sub_815564C - lsls r0, 24 - cmp r0, 0 - bne _081557E4 - ldrh r0, [r4, 0x26] - b _081557EA - .pool -_081557E4: - ldrh r0, [r4, 0x26] - ldrh r3, [r4, 0x30] - adds r0, r3 -_081557EA: - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x20] - strh r0, [r4, 0x20] - ldrh r0, [r5, 0x22] - adds r0, 0x8 - strh r0, [r4, 0x22] -_081557F6: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_815577C - - thumb_func_start sub_8155800 -sub_8155800: @ 8155800 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gDummySpriteTemplate - movs r1, 0 - movs r2, 0 - movs r3, 0xFF - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r1, =gSprites - adds r2, r1 - ldr r1, =sub_8155850 - str r1, [r2, 0x1C] - movs r1, 0x3E - adds r1, r2 - mov r12, r1 - ldrb r1, [r1] - movs r3, 0x4 - orrs r1, r3 - mov r3, r12 - strb r1, [r3] - strh r4, [r2, 0x2E] - movs r1, 0x1 - strh r1, [r2, 0x30] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155800 - - thumb_func_start sub_8155850 -sub_8155850: @ 8155850 - push {lr} - adds r2, r0, 0 - movs r0, 0x2E - ldrsh r1, [r2, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r3, r0, r1 - ldrh r1, [r2, 0x32] - adds r0, r1, 0x1 - strh r0, [r2, 0x32] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08155878 - ldrh r0, [r2, 0x30] - ldrh r1, [r3, 0x26] - adds r0, r1 - strh r0, [r3, 0x26] -_08155878: - ldrh r1, [r2, 0x32] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _08155888 - ldrh r0, [r2, 0x30] - negs r0, r0 - strh r0, [r2, 0x30] -_08155888: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155850 - - thumb_func_start sub_8155890 -sub_8155890: @ 8155890 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0xC - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x24] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081558EC - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r4, 0x8] - strh r0, [r2, 0x2E] - movs r0, 0xA - strh r0, [r2, 0x30] -_081558EC: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155890 - - thumb_func_start sub_8155900 -sub_8155900: @ 8155900 - push {r4-r7,lr} - ldr r7, =gFieldEffectArguments - ldrb r0, [r7] - ldrb r1, [r7, 0x4] - ldrb r2, [r7, 0x8] - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r6, r1, r0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x74] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _081559A4 - ldrb r0, [r6, 0x5] - bl GetEventObjectGraphicsInfo - adds r5, r0, 0 - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r3] - ldrb r2, [r6, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x5] - movs r2, 0xC - ands r2, r1 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r1, [r7] - strh r1, [r0, 0x2E] - ldr r1, [r7, 0x4] - strh r1, [r0, 0x30] - ldr r1, [r7, 0x8] - strh r1, [r0, 0x32] - ldrb r2, [r6, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1, 0x20] - strh r1, [r0, 0x34] - ldrb r2, [r6, 0x4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1, 0x22] - strh r1, [r0, 0x36] - ldrh r1, [r5, 0xA] - lsls r1, 16 - asrs r1, 17 - subs r1, 0x2 - strh r1, [r0, 0x26] - movs r1, 0x2 - bl SeekSpriteAnim -_081559A4: - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155900 - - thumb_func_start sub_81559BC -sub_81559BC: @ 81559BC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x32] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _081559F6 - ldr r2, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - ldrb r0, [r1, 0x2] - lsls r0, 27 - cmp r0, 0 - blt _08155A04 -_081559F6: - adds r0, r4, 0 - movs r1, 0x27 - bl FieldEffectStop - b _08155A76 - .pool -_08155A04: - ldr r2, =gSprites - ldrb r1, [r1, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r5, [r0, 0x22] - ldrh r6, [r0, 0x20] - movs r2, 0x20 - ldrsh r1, [r0, r2] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08155A2C - lsls r0, r5, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - cmp r0, r1 - beq _08155A46 -_08155A2C: - strh r6, [r4, 0x34] - strh r5, [r4, 0x36] - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08155A46 - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnim -_08155A46: - strh r6, [r4, 0x20] - strh r5, [r4, 0x22] - ldr r3, =gSprites - ldr r2, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x43 - ldrb r0, [r0] - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility -_08155A76: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81559BC - - thumb_func_start sub_8155A88 -sub_8155A88: @ 8155A88 - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - adds r0, 0x88 - ldr r0, [r0] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0x52 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155AD8 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r3] - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1, 0x5] -_08155AD8: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155A88 - - thumb_func_start sub_8155AEC -sub_8155AEC: @ 8155AEC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x80 - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r4, 0x22] - subs r1, r0 - strh r1, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - ldrh r1, [r4, 0x3E] - ldr r0, =0x00001004 - ands r0, r1 - cmp r0, 0 - beq _08155B20 - adds r0, r4, 0 - movs r1, 0x35 - bl FieldEffectStop -_08155B20: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155AEC - - thumb_func_start sub_8155B2C -sub_8155B2C: @ 8155B2C - push {r4,lr} - ldr r4, =gFieldEffectArguments - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x4 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x58] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0x8] - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155B8C - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x3 - ldrb r1, [r4, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - movs r1, 0xF - ands r0, r1 - movs r1, 0x50 - orrs r0, r1 - strb r0, [r2, 0x5] - movs r0, 0x17 - strh r0, [r2, 0x2E] -_08155B8C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155B2C - - thumb_func_start ShowTreeDisguiseFieldEffect -@ u8 ShowTreeDisguiseFieldEffect() -ShowTreeDisguiseFieldEffect: @ 8155BA0 - push {lr} - movs r0, 0x1C - movs r1, 0x18 - movs r2, 0x4 - bl ShowDisguiseFieldEffect - pop {r1} - bx r1 - thumb_func_end ShowTreeDisguiseFieldEffect - - thumb_func_start ShowMountainDisguiseFieldEffect -@ u8 ShowMountainDisguiseFieldEffect() -ShowMountainDisguiseFieldEffect: @ 8155BB0 - push {lr} - movs r0, 0x1D - movs r1, 0x19 - movs r2, 0x3 - bl ShowDisguiseFieldEffect - pop {r1} - bx r1 - thumb_func_end ShowMountainDisguiseFieldEffect - - thumb_func_start ShowSandDisguiseFieldEffect -@ u8 ShowSandDisguiseFieldEffect() -ShowSandDisguiseFieldEffect: @ 8155BC0 - push {lr} - movs r0, 0x24 - movs r1, 0x1C - movs r2, 0x2 - bl ShowDisguiseFieldEffect - pop {r1} - bx r1 - thumb_func_end ShowSandDisguiseFieldEffect - - thumb_func_start ShowDisguiseFieldEffect -@ u8 ShowDisguiseFieldEffect(u8 fieldEffectId, u8 fieldEffectObjectId, u8 paletteSlot) -ShowDisguiseFieldEffect: @ 8155BD0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - ldr r5, =gFieldEffectArguments - ldrb r0, [r5] - ldrb r1, [r5, 0x4] - ldrb r2, [r5, 0x8] - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - beq _08155C08 - adds r0, r4, 0 - bl FieldEffectActiveListRemove - movs r0, 0x40 - b _08155C74 - .pool -_08155C08: - ldr r1, =gFieldEffectObjectTemplatePointers - lsls r0, r6, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSpriteAtEnd - mov r1, sp - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08155C70 - mov r0, sp - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - ldr r0, =gSprites - adds r2, r0 - movs r0, 0x3E - adds r0, r2 - mov r12, r0 - ldrb r3, [r0] - lsls r1, r3, 30 - lsrs r1, 31 - adds r1, 0x1 - movs r0, 0x1 - ands r1, r0 - lsls r1, 1 - movs r0, 0x3 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - mov r1, r12 - strb r0, [r1] - lsls r3, r7, 4 - ldrb r1, [r2, 0x5] - movs r0, 0xF - ands r0, r1 - orrs r0, r3 - strb r0, [r2, 0x5] - mov r0, r8 - strh r0, [r2, 0x30] - ldr r0, [r5] - strh r0, [r2, 0x32] - ldr r0, [r5, 0x4] - strh r0, [r2, 0x34] - ldr r0, [r5, 0x8] - strh r0, [r2, 0x36] -_08155C70: - mov r0, sp - ldrb r0, [r0] -_08155C74: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end ShowDisguiseFieldEffect - - thumb_func_start sub_8155C88 -sub_8155C88: @ 8155C88 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - ldrh r0, [r5, 0x32] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x34] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r5, 0x36] - lsls r2, 24 - lsrs r2, 24 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - beq _08155CB8 - ldrh r1, [r5, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl FieldEffectStop -_08155CB8: - ldr r4, =gEventObjects - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x5] - bl GetEventObjectGraphicsInfo - mov r1, sp - ldrb r2, [r1] - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - ldr r1, =gSprites - adds r2, r1 - adds r1, r2, 0 - adds r1, 0x3E - ldrb r1, [r1] - movs r3, 0x3E - adds r3, r5 - mov r12, r3 - movs r3, 0x4 - ands r3, r1 - mov r1, r12 - ldrb r4, [r1] - movs r1, 0x5 - negs r1, r1 - ands r1, r4 - orrs r1, r3 - mov r3, r12 - strb r1, [r3] - ldrh r1, [r2, 0x20] - strh r1, [r5, 0x20] - ldrh r0, [r0, 0xA] - lsls r0, 16 - asrs r0, 17 - ldrh r1, [r2, 0x22] - adds r0, r1 - subs r0, 0x10 - strh r0, [r5, 0x22] - adds r2, 0x43 - ldrb r0, [r2] - subs r0, 0x1 - adds r1, r5, 0 - adds r1, 0x43 - strb r0, [r1] - ldrh r1, [r5, 0x2E] - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0x1 - bne _08155D38 - adds r0, r1, 0x1 - strh r0, [r5, 0x2E] - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim -_08155D38: - movs r3, 0x2E - ldrsh r0, [r5, r3] - ldrh r2, [r5, 0x2E] - cmp r0, 0x2 - bne _08155D54 - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08155D54 - movs r0, 0x1 - strh r0, [r5, 0x3C] -_08155D54: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _08155D68 - ldrh r1, [r5, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl FieldEffectStop -_08155D68: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155C88 - - thumb_func_start sub_8155D78 -sub_8155D78: @ 8155D78 - push {lr} - adds r1, r0, 0 - adds r0, 0x21 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08155D96 - ldr r2, =gSprites - ldrb r1, [r1, 0x1A] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x2E] - adds r1, 0x1 - strh r1, [r0, 0x2E] -_08155D96: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155D78 - - thumb_func_start sub_8155DA0 -sub_8155DA0: @ 8155DA0 - push {lr} - adds r2, r0, 0 - adds r2, 0x21 - ldrb r1, [r2] - cmp r1, 0x2 - beq _08155DD6 - cmp r1, 0 - beq _08155DD6 - ldrb r1, [r0, 0x1A] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r1, r0, r1 - movs r3, 0x3C - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _08155DCC - movs r0, 0 - b _08155DD8 - .pool -_08155DCC: - movs r0, 0x2 - strb r0, [r2] - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] -_08155DD6: - movs r0, 0x1 -_08155DD8: - pop {r1} - bx r1 - thumb_func_end sub_8155DA0 - - thumb_func_start sub_8155DDC -sub_8155DDC: @ 8155DDC - push {r4,lr} - ldr r4, =gFieldEffectArguments - ldr r0, [r4] - adds r0, 0x7 - str r0, [r4] - ldr r0, [r4, 0x4] - adds r0, 0x7 - str r0, [r4, 0x4] - adds r1, r4, 0x4 - adds r0, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - adds r0, 0x8C - ldr r0, [r0] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0x4 - ldrsh r2, [r4, r3] - movs r3, 0x52 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _08155E3C - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - movs r0, 0x3 - ldrb r2, [r4, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r1] -_08155E3C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8155DDC - - thumb_func_start sub_8155E50 -sub_8155E50: @ 8155E50 - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _08155E84 - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08155E7C - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] -_08155E7C: - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _08155E9A -_08155E84: - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x22 - ble _08155E9A - adds r0, r2, 0 - movs r1, 0x36 - bl FieldEffectStop -_08155E9A: - pop {r0} - bx r0 - thumb_func_end sub_8155E50 - - thumb_func_start sub_8155EA0 -sub_8155EA0: @ 8155EA0 - movs r1, 0 - strh r1, [r0, 0x3A] - strh r1, [r0, 0x3C] - bx lr - thumb_func_end sub_8155EA0 - - thumb_func_start sub_8155EA8 -sub_8155EA8: @ 8155EA8 - push {r4-r6,lr} - adds r5, r0, 0 - movs r6, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _08155EDE - cmp r0, 0x1 - bgt _08155EC0 - cmp r0, 0 - beq _08155ECA - b _08155F42 -_08155EC0: - cmp r0, 0x2 - beq _08155F06 - cmp r0, 0x3 - beq _08155F1A - b _08155F42 -_08155ECA: - movs r2, 0x3A - ldrsh r0, [r5, r2] - bl sub_809773C - ldrh r1, [r5, 0x24] - adds r0, r1 - strh r0, [r5, 0x24] - movs r2, 0x3A - ldrsh r0, [r5, r2] - b _08155F38 -_08155EDE: - ldrh r0, [r5, 0x3A] - movs r4, 0x47 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - bl sub_809773C - ldrh r1, [r5, 0x24] - subs r1, r0 - strh r1, [r5, 0x24] - ldrh r0, [r5, 0x3A] - subs r4, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - bl sub_8097728 - ldrh r2, [r5, 0x26] - adds r0, r2 - b _08155F40 -_08155F06: - movs r1, 0x3A - ldrsh r0, [r5, r1] - bl sub_809773C - ldrh r1, [r5, 0x24] - subs r1, r0 - strh r1, [r5, 0x24] - movs r2, 0x3A - ldrsh r0, [r5, r2] - b _08155F38 -_08155F1A: - ldrh r0, [r5, 0x3A] - movs r4, 0x47 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - bl sub_809773C - ldrh r2, [r5, 0x24] - adds r0, r2 - strh r0, [r5, 0x24] - ldrh r0, [r5, 0x3A] - subs r4, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 -_08155F38: - bl sub_8097728 - ldrh r1, [r5, 0x26] - adds r0, r1 -_08155F40: - strh r0, [r5, 0x26] -_08155F42: - ldrh r1, [r5, 0x24] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x10 - bl SetGpuReg - ldrh r0, [r5, 0x3A] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0x3A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x48 - bne _08155F68 - strh r1, [r5, 0x3A] - ldrh r0, [r5, 0x3C] - adds r0, 0x1 - strh r0, [r5, 0x3C] -_08155F68: - movs r2, 0x3C - ldrsh r0, [r5, r2] - cmp r0, 0x4 - bne _08155F76 - strh r1, [r5, 0x26] - strh r1, [r5, 0x24] - movs r6, 0x1 -_08155F76: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8155EA8 - - thumb_func_start sub_8155F80 -sub_8155F80: @ 8155F80 - push {r4-r7,lr} - adds r5, r0, 0 - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0x8 - bls _08155F8E - b _08156156 -_08155F8E: - lsls r0, 2 - ldr r1, =_08155F9C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08155F9C: - .4byte _08155FC0 - .4byte _08156034 - .4byte _0815606C - .4byte _08156090 - .4byte _081560C0 - .4byte _081560D4 - .4byte _081560E0 - .4byte _0815610E - .4byte _08156120 -_08155FC0: - movs r2, 0x2E - ldrsh r0, [r5, r2] - movs r1, 0x3 - bl __divsi3 - movs r1, 0x78 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x12 - bl SetGpuReg - movs r3, 0x2E - ldrsh r0, [r5, r3] - cmp r0, 0x60 - bne _08156016 - movs r1, 0 - ldr r4, =0x0600f800 - mov r12, r4 - ldr r0, =0x0000bff4 - adds r7, r0, 0 -_08155FEA: - movs r2, 0xC - lsls r0, r1, 1 - adds r3, r1, 0x1 - lsls r6, r1, 5 - adds r0, r1 - lsls r4, r0, 1 -_08155FF6: - adds r0, r6, r2 - lsls r0, 1 - add r0, r12 - adds r1, r2, r7 - adds r1, r4, r1 - adds r1, 0x1 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x11 - bls _08155FF6 - lsls r0, r3, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _08155FEA -_08156016: - movs r2, 0x2E - ldrsh r1, [r5, r2] - ldr r0, =0x00000137 - cmp r1, r0 - bgt _08156022 - b _08156156 -_08156022: - movs r1, 0 - movs r0, 0x1 - b _0815611A - .pool -_08156034: - ldr r4, =gSineTable - movs r3, 0x2E - ldrsh r0, [r5, r3] - movs r1, 0x3 - bl __divsi3 - lsls r0, 16 - asrs r0, 15 - adds r0, r4 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 18 - ldrh r4, [r5, 0x36] - adds r0, r4 - movs r1, 0 - strh r0, [r5, 0x22] - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0xBD - bne _08156156 - movs r0, 0x2 - strh r0, [r5, 0x32] - strh r1, [r5, 0x38] - strh r1, [r5, 0x2E] - b _08156156 - .pool -_0815606C: - movs r3, 0x2E - ldrsh r0, [r5, r3] - cmp r0, 0x3C - bne _0815607E - ldrh r0, [r5, 0x38] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0x38] - strh r1, [r5, 0x2E] -_0815607E: - movs r4, 0x38 - ldrsh r0, [r5, r4] - cmp r0, 0x7 - bne _08156156 - movs r0, 0 - strh r0, [r5, 0x38] - movs r0, 0x3 - strh r0, [r5, 0x32] - b _08156156 -_08156090: - ldrh r2, [r5, 0x26] - movs r0, 0x26 - ldrsh r1, [r5, r0] - adds r3, r2, 0 - cmp r1, 0 - bne _081560A4 - strh r1, [r5, 0x2E] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] -_081560A4: - movs r4, 0x2E - ldrsh r0, [r5, r4] - cmp r0, 0x5 - bne _08156156 - movs r0, 0 - strh r0, [r5, 0x2E] - cmp r1, 0 - ble _081560BA - subs r0, r3, 0x1 - strh r0, [r5, 0x26] - b _08156156 -_081560BA: - adds r0, r2, 0x1 - strh r0, [r5, 0x26] - b _08156156 -_081560C0: - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x3C - bne _08156156 - movs r1, 0 - movs r0, 0x5 - strh r0, [r5, 0x32] - strh r1, [r5, 0x2E] - strh r1, [r5, 0x38] - b _08156156 -_081560D4: - adds r0, r5, 0 - bl sub_8155EA0 - movs r1, 0 - movs r0, 0x6 - b _0815611A -_081560E0: - adds r0, r5, 0 - bl sub_8155EA8 - lsls r0, 24 - cmp r0, 0 - beq _08156156 - movs r1, 0 - strh r1, [r5, 0x2E] - ldrh r0, [r5, 0x38] - adds r0, 0x1 - strh r0, [r5, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - bgt _08156106 - adds r0, r5, 0 - bl sub_8155EA0 - b _08156156 -_08156106: - strh r1, [r5, 0x38] - movs r0, 0x7 - strh r0, [r5, 0x32] - b _08156156 -_0815610E: - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0x1E - bne _08156156 - movs r1, 0 - movs r0, 0x8 -_0815611A: - strh r0, [r5, 0x32] - strh r1, [r5, 0x2E] - b _08156156 -_08156120: - movs r1, 0 - ldr r6, =0x0600f800 - movs r4, 0 -_08156126: - movs r2, 0xC - adds r3, r1, 0x1 - lsls r1, 5 -_0815612C: - adds r0, r1, r2 - lsls r0, 1 - adds r0, r6 - strh r4, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x11 - bls _0815612C - lsls r0, r3, 24 - lsrs r1, r0, 24 - cmp r1, 0xE - bls _08156126 - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - movs r1, 0x40 - bl FieldEffectStop -_08156156: - movs r3, 0x32 - ldrsh r0, [r5, r3] - cmp r0, 0x1 - bne _08156184 - ldrh r1, [r5, 0x30] - movs r0, 0x7 - ands r0, r1 - adds r2, r1, 0 - cmp r0, 0 - bne _08156172 - ldrh r0, [r5, 0x34] - ldrh r4, [r5, 0x26] - adds r0, r4 - strh r0, [r5, 0x26] -_08156172: - movs r0, 0xF - ands r0, r2 - cmp r0, 0 - bne _08156180 - ldrh r0, [r5, 0x34] - negs r0, r0 - strh r0, [r5, 0x34] -_08156180: - adds r0, r1, 0x1 - strh r0, [r5, 0x30] -_08156184: - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8155F80 - - thumb_func_start sub_8156194 -sub_8156194: @ 8156194 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081561B2 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl FieldEffectStop - b _081561C8 -_081561B2: - adds r0, r4, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - movs r2, 0 - bl SetObjectSubpriorityByZCoord -_081561C8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8156194 - - thumb_func_start sub_81561D0 -sub_81561D0: @ 81561D0 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081561EE - ldrh r1, [r2, 0x2E] - lsls r1, 24 - lsrs r1, 24 - adds r0, r2, 0 - bl FieldEffectStop - b _081561F6 -_081561EE: - adds r0, r2, 0 - movs r1, 0 - bl UpdateEventObjectSpriteVisibility -_081561F6: - pop {r0} - bx r0 - thumb_func_end sub_81561D0 - - thumb_func_start sub_81561FC -sub_81561FC: @ 81561FC - push {r4-r7,lr} - adds r6, r0, 0 - adds r0, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - adds r1, r6, 0 - bl SetObjectSubpriorityByZCoord - movs r7, 0 -_08156212: - lsls r0, r7, 3 - adds r0, r7 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - ldrb r0, [r4] - lsls r0, 31 - cmp r0, 0 - beq _081562B4 - ldrb r0, [r4, 0x5] - bl GetEventObjectGraphicsInfo - ldrb r1, [r4, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r5, r0, r1 - adds r0, r6, 0 - adds r0, 0x28 - movs r2, 0 - ldrsb r2, [r0, r2] - ldrh r0, [r6, 0x20] - adds r1, r0, r2 - subs r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 - lsls r1, 16 - asrs r1, 16 - movs r0, 0x20 - ldrsh r2, [r5, r0] - cmp r1, r2 - bge _081562B4 - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, r2 - ble _081562B4 - adds r0, r5, 0 - adds r0, 0x29 - movs r3, 0 - ldrsb r3, [r0, r3] - ldrh r2, [r5, 0x22] - adds r2, r3 - ldrh r4, [r5, 0x22] - adds r0, r6, 0 - adds r0, 0x29 - movs r1, 0 - ldrsb r1, [r0, r1] - ldrh r0, [r6, 0x22] - subs r0, r1 - lsls r0, 16 - asrs r0, 16 - adds r3, r0, r3 - lsls r2, 16 - asrs r2, 16 - lsls r3, 16 - asrs r3, 16 - cmp r2, r3 - blt _0815628C - cmp r2, r0 - bge _081562B4 -_0815628C: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, r3 - ble _081562B4 - adds r2, r6, 0 - adds r2, 0x43 - adds r0, r5, 0 - adds r0, 0x43 - ldrb r1, [r0] - ldrb r0, [r2] - cmp r0, r1 - bhi _081562B4 - adds r0, r1, 0x2 - strb r0, [r2] - b _081562BE - .pool -_081562B4: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0xF - bls _08156212 -_081562BE: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81561FC - - .align 2, 0 @ Don't pad with nop. diff --git a/data/field_effect_helpers.s b/data/field_effect_helpers.s index 63fc1580e..e49592659 100644 --- a/data/field_effect_helpers.s +++ b/data/field_effect_helpers.s @@ -2,31 +2,10 @@ .include "constants/constants.inc" .section .rodata - -gUnknown_085CDC38:: @ 85CDC38 - .2byte 12, 28, 44 - -gUnknown_085CDC3E:: @ 85CDC3E - .byte 0x00, 0x01, 0x02, 0x03 - -gUnknown_085CDC42:: @ 85CDC42 - .2byte 0x0004, 0x0004, 0x0004, 0x0010, 0x0000 - -gUnknown_085CDC4C:: @ 85CDC4C - .4byte sub_8154C7C - .4byte sub_8154CA0 - -gUnknown_085CDC54:: @ 85CDC54 - .4byte sub_815547C - .4byte sub_81554AC - .4byte sub_815550C - -gUnknown_085CDC60:: @ 85CDC60 - .byte 0, 0, 1, 2, 3, 0, 0, 1, 1 - .byte 0 + + .align 1 -gUnknown_085CDC6A:: @ 85CDC6A - .2byte 3, 7 +gUnknown_085CDC6E:: @ 85CDC6E @the following might be unref, not sure .byte 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00 diff --git a/include/event_object_movement.h b/include/event_object_movement.h index d43dd78ea..80b9f3fc0 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -80,6 +80,7 @@ struct LockedAnimEventObjects }; extern const struct SpriteFrameImage gEventObjectPicTable_PechaBerryTree[]; +extern const u8 gReflectionEffectPaletteMap[]; void sub_808D438(void); u8 GetMoveDirectionAnimNum(u8); @@ -189,6 +190,10 @@ u8 GetMoveDirectionFasterAnimNum(u8); u8 GetMoveDirectionFastestAnimNum(u8); u8 GetLedgeJumpDirection(s16, s16, u8); void CameraObjectSetFollowedObjectId(u8 objectId); +u16 GetObjectPaletteTag(u8 palSlot); +void UpdateEventObjectSpriteVisibility(struct Sprite *sprite, bool8 invisible); +s16 sub_809773C(s16 a1); +s16 sub_8097728(s16 a1); void MovementType_None(struct Sprite *); void MovementType_LookAround(struct Sprite *); @@ -249,6 +254,7 @@ u8 GetSlideMovementAction(u32); u8 GetJumpInPlaceMovementAction(u32); u8 GetJumpMovementAction(u32); u8 GetJump2MovementAction(u32); +u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority); u8 MovementType_WanderAround_Step0(struct EventObject *, struct Sprite *); u8 MovementType_WanderAround_Step1(struct EventObject *, struct Sprite *); diff --git a/ld_script.txt b/ld_script.txt index 779e1853d..cc7c5d968 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -200,7 +200,7 @@ SECTIONS { src/rom_81520A8.o(.text); src/save.o(.text); src/mystery_event_script.o(.text); - asm/field_effect_helpers.o(.text); + src/field_effect_helpers.o(.text); src/contest_ai.o(.text); src/battle_anim_sound_tasks.o(.text); src/battle_controller_safari.o(.text); @@ -490,6 +490,7 @@ SECTIONS { src/battle_message.o(.rodata); data/cable_car.o(.rodata); src/save.o(.rodata); + src/field_effect_helpers.o(.rodata); data/field_effect_helpers.o(.rodata); src/contest_ai.o(.rodata); src/battle_controller_safari.o(.rodata); diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c new file mode 100755 index 000000000..304f7a6f9 --- /dev/null +++ b/src/field_effect_helpers.c @@ -0,0 +1,1774 @@ +#include "global.h" +#include "sprite.h" +#include "fieldmap.h" +#include "metatile_behavior.h" +#include "sound.h" +#include "event_object_movement.h" +#include "field_camera.h" +#include "field_weather.h" +#include "field_effect.h" +#include "field_effect_helpers.h" +#include "constants/songs.h" +#include "gpu_regs.h" +#include "trig.h" + +void objc_reflection_maybe(struct Sprite *); +void npc_pal_op(struct EventObject *eventObject, struct Sprite *sprite); +void npc_pal_op_A(struct EventObject *, u8); +void npc_pal_op_B(struct EventObject *, u8); +void sub_81561FC(struct Sprite *, u8, u8); +void sub_8154C7C(struct Sprite *); +void sub_8154CA0(struct Sprite *); +void sub_8154FB4(struct Sprite *); +void sub_815547C(struct Sprite *); +void sub_81554AC(struct Sprite *); +void sub_815550C(struct Sprite *); +void sub_81556B0(struct EventObject *, struct Sprite *); +void sub_81556E8(struct EventObject *, struct Sprite *); +void sub_815577C(struct EventObject *, struct Sprite *, struct Sprite *); +void sub_8155850(struct Sprite *); +u32 ShowDisguiseFieldEffect(u8, u8, u8); + +void SetUpReflection(struct EventObject *eventObject, struct Sprite *sprite, bool8 stillReflection) +{ + struct Sprite *reflectionSprite; + + reflectionSprite = &gSprites[CreateCopySpriteAt(sprite, sprite->pos1.x, sprite->pos1.y, 0x98)]; + reflectionSprite->callback = objc_reflection_maybe; + reflectionSprite->oam.priority = 3; + reflectionSprite->oam.paletteNum = gReflectionEffectPaletteMap[reflectionSprite->oam.paletteNum]; + reflectionSprite->usingSheet = TRUE; + reflectionSprite->anims = gDummySpriteAnimTable; + StartSpriteAnim(reflectionSprite, 0); + reflectionSprite->affineAnims = gDummySpriteAffineAnimTable; + reflectionSprite->affineAnimBeginning = TRUE; + reflectionSprite->subspriteMode = SUBSPRITES_OFF; + reflectionSprite->data[0] = sprite->data[0]; + reflectionSprite->data[1] = eventObject->localId; + reflectionSprite->data[7] = stillReflection; + npc_pal_op(eventObject, reflectionSprite); + + if (!stillReflection) + reflectionSprite->oam.affineMode = ST_OAM_AFFINE_NORMAL; +} + +s16 sub_8153F98(struct EventObject *eventObject) +{ + return GetEventObjectGraphicsInfo(eventObject->graphicsId)->height - 2; +} + +void npc_pal_op(struct EventObject *eventObject, struct Sprite *sprite) +{ + u8 bridgeType; + u16 bridgeReflectionVerticalOffsets[] = { 12, 28, 44 }; + sprite->data[2] = 0; + if (!GetEventObjectGraphicsInfo(eventObject->graphicsId)->disableReflectionPaletteLoad && ((bridgeType = MetatileBehavior_GetBridgeSth(eventObject->previousMetatileBehavior)) || (bridgeType = MetatileBehavior_GetBridgeSth(eventObject->currentMetatileBehavior)))) + { + sprite->data[2] = bridgeReflectionVerticalOffsets[bridgeType - 1]; + npc_pal_op_A(eventObject, sprite->oam.paletteNum); + } + else + { + npc_pal_op_B(eventObject, sprite->oam.paletteNum); + } +} + +void npc_pal_op_B(struct EventObject *eventObject, u8 paletteIndex) +{ + const struct EventObjectGraphicsInfo *graphicsInfo; + + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + if (graphicsInfo->paletteTag2 != 0x11ff) + { + if (graphicsInfo->paletteSlot == 0) + { + LoadPlayerObjectReflectionPalette(graphicsInfo->paletteTag1, paletteIndex); + } + else if (graphicsInfo->paletteSlot == 10) + { + LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, paletteIndex); + } + else + { + PatchObjectPalette(GetObjectPaletteTag(paletteIndex), paletteIndex); + } + UpdateSpritePaletteWithWeather(paletteIndex); + } +} + +// When walking on a bridge high above water (Route 120), the reflection is a solid dark blue color. +// This is so the sprite blends in with the dark water metatile underneath the bridge. +void npc_pal_op_A(struct EventObject *eventObject, u8 paletteNum) +{ + const struct EventObjectGraphicsInfo *graphicsInfo; + + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + if (graphicsInfo->paletteTag2 != 0x11ff) + { + PatchObjectPalette(graphicsInfo->paletteTag2, paletteNum); + UpdateSpritePaletteWithWeather(paletteNum); + } +} + +void objc_reflection_maybe(struct Sprite *reflectionSprite) +{ + struct EventObject *eventObject; + struct Sprite *mainSprite; + + eventObject = &gEventObjects[reflectionSprite->data[0]]; + mainSprite = &gSprites[eventObject->spriteId]; + if (!eventObject->active || !eventObject->hasReflection || eventObject->localId != reflectionSprite->data[1]) + { + reflectionSprite->inUse = FALSE; + } + else + { + reflectionSprite->oam.paletteNum = gReflectionEffectPaletteMap[mainSprite->oam.paletteNum]; + reflectionSprite->oam.shape = mainSprite->oam.shape; + reflectionSprite->oam.size = mainSprite->oam.size; + reflectionSprite->oam.matrixNum = mainSprite->oam.matrixNum | 0x10; + reflectionSprite->oam.tileNum = mainSprite->oam.tileNum; + reflectionSprite->subspriteTables = mainSprite->subspriteTables; + reflectionSprite->subspriteTableNum = mainSprite->subspriteTableNum; + reflectionSprite->invisible = mainSprite->invisible; + reflectionSprite->pos1.x = mainSprite->pos1.x; + // reflectionSprite->data[2] holds an additional vertical offset, used by the high bridges on Route 120 + reflectionSprite->pos1.y = mainSprite->pos1.y + sub_8153F98(eventObject) + reflectionSprite->data[2]; + reflectionSprite->centerToCornerVecX = mainSprite->centerToCornerVecX; + reflectionSprite->centerToCornerVecY = mainSprite->centerToCornerVecY; + reflectionSprite->pos2.x = mainSprite->pos2.x; + reflectionSprite->pos2.y = -mainSprite->pos2.y; + reflectionSprite->coordOffsetEnabled = mainSprite->coordOffsetEnabled; + + if (eventObject->unk3_3 == TRUE) + reflectionSprite->invisible = TRUE; + + // Check if the reflection is not still. + if (reflectionSprite->data[7] == FALSE) + { + // Sets the reflection sprite's rot/scale matrix to the appropriate + // matrix based on whether or not the main sprite is horizontally flipped. + // If the sprite is facing to the east, then it is flipped, and its matrixNum is 8. + reflectionSprite->oam.matrixNum = 0; + if (mainSprite->oam.matrixNum & 0x8) + reflectionSprite->oam.matrixNum = 1; + } + } +} + +extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; + +u8 sub_8154228(void) +{ + u8 spriteId; + struct Sprite *sprite; + + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[8], 0, 0, 0x52); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->oam.priority = 1; + sprite->coordOffsetEnabled = TRUE; + sprite->invisible = TRUE; + } + return spriteId; +} + +void objid_set_invisible(u8 spriteId) +{ + gSprites[spriteId].invisible = TRUE; +} + +void sub_8154298(u8 spriteId, u8 direction, s16 x, s16 y) +{ + s16 x2; + s16 y2; + struct Sprite *sprite; + + sprite = &gSprites[spriteId]; + if (sprite->invisible || sprite->data[0] != x || sprite->data[1] != y) + { + sub_8093038(x, y, &x2, &y2); + sprite = &gSprites[spriteId]; + sprite->pos1.x = x2 + 8; + sprite->pos1.y = y2 + 8; + sprite->invisible = FALSE; + sprite->data[0] = x; + sprite->data[1] = y; + StartSpriteAnim(sprite, direction - 1); + } +} + +const u8 gShadowEffectTemplateIds[] = { + 0, + 1, + 2, + 3 +}; + +const u16 gShadowVerticalOffsets[] = { + 4, + 4, + 4, + 16 +}; + +u32 oei_shadow(void) +{ + u8 eventObjectId; + const struct EventObjectGraphicsInfo *graphicsInfo; + u8 spriteId; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + graphicsInfo = GetEventObjectGraphicsInfo(gEventObjects[eventObjectId].graphicsId); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[gShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].coordOffsetEnabled = TRUE; + gSprites[spriteId].data[0] = gFieldEffectArguments[0]; + gSprites[spriteId].data[1] = gFieldEffectArguments[1]; + gSprites[spriteId].data[2] = gFieldEffectArguments[2]; + gSprites[spriteId].data[3] = (graphicsInfo->height >> 1) - gShadowVerticalOffsets[graphicsInfo->shadowSize]; + } + return 0; +} + +void oamc_shadow(struct Sprite *sprite) +{ + u8 eventObjectId; + struct EventObject *eventObject; + struct Sprite *linkedSprite; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId)) + { + FieldEffectStop(sprite, FLDEFF_SHADOW); + } + else + { + eventObject = &gEventObjects[eventObjectId]; + linkedSprite = &gSprites[eventObject->spriteId]; + sprite->oam.priority = linkedSprite->oam.priority; + sprite->pos1.x = linkedSprite->pos1.x; + sprite->pos1.y = linkedSprite->pos1.y + sprite->data[3]; + if (!eventObject->active || !eventObject->hasShadow + || MetatileBehavior_IsPokeGrass(eventObject->currentMetatileBehavior) + || MetatileBehavior_IsSurfableWaterOrUnderwater(eventObject->currentMetatileBehavior) + || MetatileBehavior_IsSurfableWaterOrUnderwater(eventObject->previousMetatileBehavior) + || MetatileBehavior_IsReflective(eventObject->currentMetatileBehavior) + || MetatileBehavior_IsReflective(eventObject->previousMetatileBehavior)) + { + FieldEffectStop(sprite, FLDEFF_SHADOW); + } + } +} + +u32 oei_grass_normal(void) +{ + s16 x; + s16 y; + u8 spriteId; + struct Sprite *sprite; + + x = gFieldEffectArguments[0]; + y = gFieldEffectArguments[1]; + sub_80930E0(&x, &y, 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[4], x, y, 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = gFieldEffectArguments[0]; + sprite->data[2] = gFieldEffectArguments[1]; + sprite->data[3] = gFieldEffectArguments[4]; + sprite->data[4] = gFieldEffectArguments[5]; + sprite->data[5] = gFieldEffectArguments[6]; + if (gFieldEffectArguments[7]) + { + SeekSpriteAnim(sprite, 4); + } + } + return 0; +} + +void unc_grass_normal(struct Sprite *sprite) +{ + u8 mapNum; + u8 mapGroup; + u8 metatileBehavior; + u8 localId; + u8 eventObjectId; + struct EventObject *eventObject; + + mapNum = sprite->data[5] >> 8; + mapGroup = sprite->data[5]; + if (gCamera.active && (gSaveBlock1Ptr->location.mapNum != mapNum || gSaveBlock1Ptr->location.mapGroup != mapGroup)) + { + sprite->data[1] -= gCamera.x; + sprite->data[2] -= gCamera.y; + sprite->data[5] = ((u8)gSaveBlock1Ptr->location.mapNum << 8) | (u8)gSaveBlock1Ptr->location.mapGroup; + } + localId = sprite->data[3] >> 8; + mapNum = sprite->data[3]; + mapGroup = sprite->data[4]; + metatileBehavior = MapGridGetMetatileBehaviorAt(sprite->data[1], sprite->data[2]); + if (TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId) || !MetatileBehavior_IsTallGrass(metatileBehavior) || (sprite->data[7] && sprite->animEnded)) + { + FieldEffectStop(sprite, FLDEFF_TALL_GRASS); + } + else + { + eventObject = &gEventObjects[eventObjectId]; + if ((eventObject->currentCoords.x != sprite->data[1] || eventObject->currentCoords.y != sprite->data[2]) && (eventObject->previousCoords.x != sprite->data[1] || eventObject->previousCoords.y != sprite->data[2])) + sprite->data[7] = TRUE; + + metatileBehavior = 0; + if (sprite->animCmdIndex == 0) + metatileBehavior = 4; + + UpdateEventObjectSpriteVisibility(sprite, 0); + sub_81561FC(sprite, sprite->data[0], metatileBehavior); + } +} + +u32 sub_8154658(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[10], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = 12; + } + return 0; +} + +u8 sub_81546C8(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y) +{ + struct Sprite *sprite; + u8 i; + + for (i = 0; i < MAX_SPRITES; i ++) + { + if (gSprites[i].inUse) + { + sprite = &gSprites[i]; + if (sprite->callback == unc_grass_normal && (x == sprite->data[1] && y == sprite->data[2]) && (localId == (u8)(sprite->data[3] >> 8) && mapNum == (sprite->data[3] & 0xFF) && mapGroup == sprite->data[4])) + return i; + } + } + + return MAX_SPRITES; +} + +u32 sub_8154758(void) +{ + s16 x; + s16 y; + u8 spriteId; + struct Sprite *sprite; + + x = gFieldEffectArguments[0]; + y = gFieldEffectArguments[1]; + sub_80930E0(&x, &y, 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = ZCoordToPriority(gFieldEffectArguments[2]); + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = gFieldEffectArguments[0]; + sprite->data[2] = gFieldEffectArguments[1]; + sprite->data[3] = gFieldEffectArguments[4]; + sprite->data[4] = gFieldEffectArguments[5]; + sprite->data[5] = gFieldEffectArguments[6]; + if (gFieldEffectArguments[7]) + { + SeekSpriteAnim(sprite, 6); + } + } + return 0; +} + +void unc_grass_tall(struct Sprite *sprite) +{ + u8 mapNum; + u8 mapGroup; + u8 metatileBehavior; + u8 localId; + u8 eventObjectId; + struct EventObject *eventObject; + + mapNum = sprite->data[5] >> 8; + mapGroup = sprite->data[5]; + if (gCamera.active && (gSaveBlock1Ptr->location.mapNum != mapNum || gSaveBlock1Ptr->location.mapGroup != mapGroup)) + { + sprite->data[1] -= gCamera.x; + sprite->data[2] -= gCamera.y; + sprite->data[5] = ((u8)gSaveBlock1Ptr->location.mapNum << 8) | (u8)gSaveBlock1Ptr->location.mapGroup; + } + localId = sprite->data[3] >> 8; + mapNum = sprite->data[3]; + mapGroup = sprite->data[4]; + metatileBehavior = MapGridGetMetatileBehaviorAt(sprite->data[1], sprite->data[2]); + if (TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId) || !MetatileBehavior_IsLongGrass(metatileBehavior) || (sprite->data[7] && sprite->animEnded)) + { + FieldEffectStop(sprite, FLDEFF_LONG_GRASS); + } + else + { + eventObject = &gEventObjects[eventObjectId]; + if ((eventObject->currentCoords.x != sprite->data[1] || eventObject->currentCoords.y != sprite->data[2]) && (eventObject->previousCoords.x != sprite->data[1] || eventObject->previousCoords.y != sprite->data[2])) + { + sprite->data[7] = TRUE; + } + UpdateEventObjectSpriteVisibility(sprite, 0); + sub_81561FC(sprite, sprite->data[0], 0); + } +} + +u32 sub_81548FC(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[16], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = 18; + } + return 0; +} + +u32 sub_815496C(void) +{ + u8 eventObjectId; + struct EventObject *eventObject; + u8 spriteId; + struct Sprite *sprite; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + eventObject = &gEventObjects[eventObjectId]; + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[30], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + sprite = &(gSprites[spriteId]); + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gSprites[eventObject->spriteId].oam.priority; + sprite->data[0] = gFieldEffectArguments[0]; + sprite->data[1] = gFieldEffectArguments[1]; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->data[3] = gSprites[eventObject->spriteId].pos1.x; + sprite->data[4] = gSprites[eventObject->spriteId].pos1.y; + } + return 0; +} + +void sub_8154A10(struct Sprite *sprite) +{ + u8 eventObjectId; + s16 x; + s16 y; + const struct EventObjectGraphicsInfo *graphicsInfo; + struct Sprite *linkedSprite; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId) || !gEventObjects[eventObjectId].inShortGrass) + { + FieldEffectStop(sprite, FLDEFF_SHORT_GRASS); + } + else + { + graphicsInfo = GetEventObjectGraphicsInfo(gEventObjects[eventObjectId].graphicsId); + linkedSprite = &gSprites[gEventObjects[eventObjectId].spriteId]; + y = linkedSprite->pos1.y; + x = linkedSprite->pos1.x; + if (x != sprite->data[3] || y != sprite->data[4]) + { + sprite->data[3] = x; + sprite->data[4] = y; + if (sprite->animEnded) + { + StartSpriteAnim(sprite, 0); + } + } + sprite->pos1.x = x; + sprite->pos1.y = y; + sprite->pos2.y = (graphicsInfo->height >> 1) - 8; + sprite->subpriority = linkedSprite->subpriority - 1; + sprite->oam.priority = linkedSprite->oam.priority; + UpdateEventObjectSpriteVisibility(sprite, linkedSprite->invisible); + } +} + +u32 sub_8154B04(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[11], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[7] = FLDEFF_SAND_FOOTPRINTS; + StartSpriteAnim(sprite, gFieldEffectArguments[4]); + } + return 0; +} + +u32 sub_8154B78(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[23], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[7] = FLDEFF_DEEP_SAND_FOOTPRINTS; + StartSpriteAnim(sprite, gFieldEffectArguments[4]); + } + return spriteId; +} + +u32 sub_8154BEC(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[27], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[7] = FLDEFF_BIKE_TIRE_TRACKS; + StartSpriteAnim(sprite, gFieldEffectArguments[4]); + } + return spriteId; +} + +void (*const gFadeFootprintsTireTracksFuncs[])(struct Sprite *) = { + sub_8154C7C, + sub_8154CA0 +}; + +void sub_8154C60(struct Sprite *sprite) +{ + gFadeFootprintsTireTracksFuncs[sprite->data[0]](sprite); +} + +void sub_8154C7C(struct Sprite *sprite) +{ + // Wait 40 frames before the flickering starts. + if (++sprite->data[1] > 40) + sprite->data[0] = 1; + + UpdateEventObjectSpriteVisibility(sprite, FALSE); +} + +void sub_8154CA0(struct Sprite *sprite) +{ + sprite->invisible ^= 1; + sprite->data[1]++; + UpdateEventObjectSpriteVisibility(sprite, sprite->invisible); + if (sprite->data[1] > 56) + { + FieldEffectStop(sprite, sprite->data[7]); + } +} + +u32 sub_8154CEC(void) +{ + u8 eventObjectId; + struct EventObject *eventObject; + u8 spriteId; + struct Sprite *sprite; + const struct EventObjectGraphicsInfo *graphicsInfo; + struct Sprite *linkedSprite; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + eventObject = &gEventObjects[eventObjectId]; + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[13], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + linkedSprite = &gSprites[eventObject->spriteId]; + sprite->oam.priority = linkedSprite->oam.priority; + sprite->data[0] = gFieldEffectArguments[0]; + sprite->data[1] = gFieldEffectArguments[1]; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->pos2.y = (graphicsInfo->height >> 1) - 4; + PlaySE(SE_MIZU); + } + return 0; +} + +void sub_8154D90(struct Sprite *sprite) +{ + u8 eventObjectId; + + if (sprite->animEnded || TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId)) + { + FieldEffectStop(sprite, FLDEFF_SPLASH); + } + else + { + sprite->pos1.x = gSprites[gEventObjects[eventObjectId].spriteId].pos1.x; + sprite->pos1.y = gSprites[gEventObjects[eventObjectId].spriteId].pos1.y; + UpdateEventObjectSpriteVisibility(sprite, FALSE); + } +} + +u32 sub_8154E1C(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[14], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = FLDEFF_JUMP_SMALL_SPLASH; + } + return 0; +} + +u32 oei_water_drop_tall(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[12], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = FLDEFF_JUMP_BIG_SPLASH; + } + return 0; +} + +u32 sub_8154EFC(void) +{ + u8 eventObjectId; + struct EventObject *eventObject; + u8 spriteId; + struct Sprite *sprite; + const struct EventObjectGraphicsInfo *graphicsInfo; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + eventObject = &gEventObjects[eventObjectId]; + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[13], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + sprite = &gSprites[spriteId]; + sprite->callback = sub_8154FB4; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gSprites[eventObject->spriteId].oam.priority; + sprite->data[0] = gFieldEffectArguments[0]; + sprite->data[1] = gFieldEffectArguments[1]; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->data[3] = -1; + sprite->data[4] = -1; + sprite->pos2.y = (graphicsInfo->height >> 1) - 4; + StartSpriteAnim(sprite, 1); + } + return 0; +} + +void sub_8154FB4(struct Sprite *sprite) +{ + u8 eventObjectId; + struct Sprite *linkedSprite; + struct EventObject *eventObject; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId) || !gEventObjects[eventObjectId].inShallowFlowingWater) + { + FieldEffectStop(sprite, FLDEFF_FEET_IN_FLOWING_WATER); + } + else + { + eventObject = &gEventObjects[eventObjectId]; + linkedSprite = &gSprites[eventObject->spriteId]; + sprite->pos1.x = linkedSprite->pos1.x; + sprite->pos1.y = linkedSprite->pos1.y; + sprite->subpriority = linkedSprite->subpriority; + UpdateEventObjectSpriteVisibility(sprite, FALSE); + if (eventObject->currentCoords.x != sprite->data[3] || eventObject->currentCoords.y != sprite->data[4]) + { + sprite->data[3] = eventObject->currentCoords.x; + sprite->data[4] = eventObject->currentCoords.y; + if (!sprite->invisible) + { + PlaySE(SE_MIZU); + } + } + } +} + +u32 oei_ripples(void) +{ + u8 spriteId; + struct Sprite *sprite; + + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[5], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = FLDEFF_RIPPLE; + } + return 0; +} + +u32 sub_81550B4(void) +{ + u8 eventObjectId; + struct EventObject *eventObject; + u8 spriteId; + struct Sprite *sprite; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + eventObject = &gEventObjects[eventObjectId]; + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[31], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gSprites[eventObject->spriteId].oam.priority; + sprite->data[0] = gFieldEffectArguments[0]; + sprite->data[1] = gFieldEffectArguments[1]; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->data[3] = gSprites[eventObject->spriteId].pos1.x; + sprite->data[4] = gSprites[eventObject->spriteId].pos1.y; + } + return 0; +} + +void sub_8155158(struct Sprite *sprite) +{ + u8 eventObjectId; + const struct EventObjectGraphicsInfo *graphicsInfo; + struct Sprite *linkedSprite; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId) || !gEventObjects[eventObjectId].inHotSprings) + { + FieldEffectStop(sprite, FLDEFF_HOT_SPRINGS_WATER); + } + else + { + graphicsInfo = GetEventObjectGraphicsInfo(gEventObjects[eventObjectId].graphicsId); + linkedSprite = &gSprites[gEventObjects[eventObjectId].spriteId]; + sprite->pos1.x = linkedSprite->pos1.x; + sprite->pos1.y = (graphicsInfo->height >> 1) + linkedSprite->pos1.y - 8; + sprite->subpriority = linkedSprite->subpriority - 1; + UpdateEventObjectSpriteVisibility(sprite, FALSE); + } +} + +u32 sub_81551F0(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[17], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = FLDEFF_UNKNOWN_19; + } + return 0; +} + +u32 sub_815525C(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[18], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = FLDEFF_UNKNOWN_20; + } + return 0; +} + +u32 sub_81552C8(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[19], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = FLDEFF_UNKNOWN_21; + } + return 0; +} + +u32 sub_8155334(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[20], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = FLDEFF_UNKNOWN_22; + } + return 0; +} + +void ash(s16 x, s16 y, u16 c, s16 d) +{ + gFieldEffectArguments[0] = x; + gFieldEffectArguments[1] = y; + gFieldEffectArguments[2] = 0x52; + gFieldEffectArguments[3] = 1; + gFieldEffectArguments[4] = c; + gFieldEffectArguments[5] = d; + FieldEffectStart(FLDEFF_ASH); +} + +u32 oei_ash(void) +{ + s16 x; + s16 y; + u8 spriteId; + struct Sprite *sprite; + + x = gFieldEffectArguments[0]; + y = gFieldEffectArguments[1]; + sub_80930E0(&x, &y, 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[6], x, y, gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[1] = gFieldEffectArguments[0]; + sprite->data[2] = gFieldEffectArguments[1]; + sprite->data[3] = gFieldEffectArguments[4]; + sprite->data[4] = gFieldEffectArguments[5]; + } + return 0; +} + +void (*const gAshFieldEffectFuncs[])(struct Sprite *) = { + sub_815547C, + sub_81554AC, + sub_815550C +}; + +void sub_8155460(struct Sprite *sprite) +{ + gAshFieldEffectFuncs[sprite->data[0]](sprite); +} + +void sub_815547C(struct Sprite *sprite) +{ + sprite->invisible = TRUE; + sprite->animPaused = TRUE; + if (--sprite->data[4] == 0) + sprite->data[0] = 1; +} + +void sub_81554AC(struct Sprite *sprite) +{ + sprite->invisible = FALSE; + sprite->animPaused = FALSE; + MapGridSetMetatileIdAt(sprite->data[1], sprite->data[2], sprite->data[3]); + CurrentMapDrawMetatileAt(sprite->data[1], sprite->data[2]); + gEventObjects[gPlayerAvatar.eventObjectId].triggerGroundEffectsOnMove = TRUE; + sprite->data[0] = 2; +} + +void sub_815550C(struct Sprite *sprite) +{ + UpdateEventObjectSpriteVisibility(sprite, FALSE); + if (sprite->animEnded) + FieldEffectStop(sprite, FLDEFF_ASH); +} + +u32 sub_8155534(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[7], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x96); + if (spriteId !=MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.paletteNum = 0; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->data[3] = -1; + sprite->data[6] = -1; + sprite->data[7] = -1; + } + FieldEffectActiveListRemove(FLDEFF_SURF_BLOB); + return spriteId; +} + +void sub_81555AC(u8 spriteId, u8 value) +{ + gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF) | (value & 0xF); +} + +void sub_81555D8(u8 spriteId, u8 value) +{ + gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF0) | ((value & 0xF) << 4); +} + +void sub_8155604(u8 spriteId, u8 value, s16 data1) +{ + gSprites[spriteId].data[0] = (gSprites[spriteId].data[0] & ~0xF00) | ((value & 0xF) << 8); + gSprites[spriteId].data[1] = data1; +} + +u8 sub_8155638(struct Sprite *sprite) +{ + return sprite->data[0] & 0xF; +} + +u8 sub_8155640(struct Sprite *sprite) +{ + return (sprite->data[0] & 0xF0) >> 4; +} + +u8 sub_815564C(struct Sprite *sprite) +{ + return (sprite->data[0] & 0xF00) >> 8; +} + +void sub_8155658(struct Sprite *sprite) +{ + struct EventObject *eventObject; + struct Sprite *linkedSprite; + + eventObject = &gEventObjects[sprite->data[2]]; + linkedSprite = &gSprites[eventObject->spriteId]; + sub_81556B0(eventObject, sprite); + sub_81556E8(eventObject, sprite); + sub_815577C(eventObject, linkedSprite, sprite); + sprite->oam.priority = linkedSprite->oam.priority; +} + +void sub_81556B0(struct EventObject *eventObject, struct Sprite *sprite) +{ + u8 surfBlobDirectionAnims[] = { + 0, // DIR_NONE + 0, // DIR_SOUTH + 1, // DIR_NORTH + 2, // DIR_WEST + 3, // DIR_EAST + 0, + 0, + 1, + 1, + }; + + if (sub_8155640(sprite) == 0) + StartSpriteAnimIfDifferent(sprite, surfBlobDirectionAnims[eventObject->movementDirection]); +} + +#ifdef NONMATCHING +void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite) +{ + s16 x; + s16 y; + u8 i; + + x = eventObject->currentCoords.x; + y = eventObject->currentCoords.y; + if (sprite->pos2.y == 0 && (x != sprite->data[6] || y != sprite->data[7])) + { + sprite->data[5] = sprite->pos2.y; + for (sprite->data[6] = x, sprite->data[7] = y, i = DIR_SOUTH; i <= DIR_EAST; i ++, x = sprite->data[6], y = sprite->data[7]) + { + MoveCoords(i, &x, &y); + if (MapGridGetZCoordAt(x, y) == 3) + { + sprite->data[5] ++; + break; + } + } + } +} +#else +NAKED void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x4\n\ + adds r4, r1, 0\n\ + ldrh r2, [r0, 0x10]\n\ + mov r1, sp\n\ + strh r2, [r1]\n\ + ldrh r1, [r0, 0x12]\n\ + mov r0, sp\n\ + adds r0, 0x2\n\ + strh r1, [r0]\n\ + movs r2, 0x26\n\ + ldrsh r3, [r4, r2]\n\ + mov r8, r0\n\ + cmp r3, 0\n\ + bne _08155770\n\ + mov r0, sp\n\ + movs r5, 0\n\ + ldrsh r2, [r0, r5]\n\ + movs r5, 0x3A\n\ + ldrsh r0, [r4, r5]\n\ + cmp r2, r0\n\ + bne _08155724\n\ + lsls r0, r1, 16\n\ + asrs r0, 16\n\ + movs r5, 0x3C\n\ + ldrsh r1, [r4, r5]\n\ + cmp r0, r1\n\ + beq _08155770\n\ +_08155724:\n\ + strh r3, [r4, 0x38]\n\ + strh r2, [r4, 0x3A]\n\ + mov r1, r8\n\ + movs r2, 0\n\ + ldrsh r0, [r1, r2]\n\ + strh r0, [r4, 0x3C]\n\ + movs r5, 0x1\n\ + mov r7, r8\n\ + mov r6, sp\n\ +_08155736:\n\ + adds r0, r5, 0\n\ + mov r1, sp\n\ + adds r2, r7, 0\n\ + bl MoveCoords\n\ + movs r1, 0\n\ + ldrsh r0, [r6, r1]\n\ + movs r2, 0\n\ + ldrsh r1, [r7, r2]\n\ + bl MapGridGetZCoordAt\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x3\n\ + bne _0815575C\n\ + ldrh r0, [r4, 0x38]\n\ + adds r0, 0x1\n\ + strh r0, [r4, 0x38]\n\ + b _08155770\n\ +_0815575C:\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + ldrh r0, [r4, 0x3A]\n\ + strh r0, [r6]\n\ + ldrh r0, [r4, 0x3C]\n\ + mov r1, r8\n\ + strh r0, [r1]\n\ + cmp r5, 0x4\n\ + bls _08155736\n\ +_08155770:\n\ + add sp, 0x4\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} +#endif + +void sub_815577C(struct EventObject *eventObject, struct Sprite *linkedSprite, struct Sprite *sprite) +{ + u16 unk_085CDC6A[] = {3, 7}; + u8 v0 = sub_8155638(sprite); + if (v0 != 0) + { + if (((u16)(++ sprite->data[4]) & unk_085CDC6A[sprite->data[5]]) == 0) + { + sprite->pos2.y += sprite->data[3]; + } + if ((sprite->data[4] & 0x0F) == 0) + { + sprite->data[3] = -sprite->data[3]; + } + if (v0 != 2) + { + if (sub_815564C(sprite) == 0) + linkedSprite->pos2.y = sprite->pos2.y; + else + linkedSprite->pos2.y = sprite->data[1] + sprite->pos2.y; + sprite->pos1.x = linkedSprite->pos1.x; + sprite->pos1.y = linkedSprite->pos1.y + 8; + } + } +} + +u8 sub_8155800(u8 oldSpriteId) +{ + u8 spriteId; + struct Sprite *sprite; + + spriteId = CreateSpriteAtEnd(&gDummySpriteTemplate, 0, 0, -1); + sprite = &gSprites[spriteId]; + sprite->callback = sub_8155850; + sprite->invisible = TRUE; + sprite->data[0] = oldSpriteId; + sprite->data[1] = 1; + return spriteId; +} + +void sub_8155850(struct Sprite *sprite) +{ + struct Sprite *oldSprite; + + oldSprite = &gSprites[sprite->data[0]]; + if (((sprite->data[2]++) & 0x03) == 0) + { + oldSprite->pos2.y += sprite->data[1]; + } + if ((sprite->data[2] & 0x0F) == 0) + { + sprite->data[1] = -sprite->data[1]; + } +} + +u32 sub_8155890(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[9], gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->data[0] = gFieldEffectArguments[2]; + sprite->data[1] = 10; + } + return 0; +} + +u32 sub_8155900(void) +{ + u8 eventObjectId; + struct EventObject *eventObject; + u8 spriteId; + struct Sprite *sprite; + const struct EventObjectGraphicsInfo *graphicsInfo; + + eventObjectId = GetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + eventObject = &gEventObjects[eventObjectId]; + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[29], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gSprites[eventObject->spriteId].oam.priority; + sprite->data[0] = gFieldEffectArguments[0]; + sprite->data[1] = gFieldEffectArguments[1]; + sprite->data[2] = gFieldEffectArguments[2]; + sprite->data[3] = gSprites[eventObject->spriteId].pos1.x; + sprite->data[4] = gSprites[eventObject->spriteId].pos1.y; + sprite->pos2.y = (graphicsInfo->height >> 1) - 2; + SeekSpriteAnim(sprite, 2); + } + return 0; +} + +void sub_81559BC(struct Sprite *sprite) +{ + u8 eventObjectId; + s16 x; + s16 y; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &eventObjectId) || !gEventObjects[eventObjectId].inSandPile) + { + FieldEffectStop(sprite, FLDEFF_SAND_PILE); + } + else + { + y = gSprites[gEventObjects[eventObjectId].spriteId].pos1.y; + x = gSprites[gEventObjects[eventObjectId].spriteId].pos1.x; + if (x != sprite->data[3] || y != sprite->data[4]) + { + sprite->data[3] = x; + sprite->data[4] = y; + if (sprite->animEnded) + { + StartSpriteAnim(sprite, 0); + } + } + sprite->pos1.x = x; + sprite->pos1.y = y; + sprite->subpriority = gSprites[gEventObjects[eventObjectId].spriteId].subpriority; + UpdateEventObjectSpriteVisibility(sprite, FALSE); + } +} + +u32 sub_8155A88(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[34], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = 1; + } + return 0; +} + +void sub_8155AEC(struct Sprite *sprite) +{ + sprite->data[0] += 0x80; + sprite->data[0] &= 0x100; + sprite->pos1.y -= sprite->data[0] >> 8; + UpdateEventObjectSpriteVisibility(sprite, FALSE); + if (sprite->invisible || sprite->animEnded) + { + FieldEffectStop(sprite, FLDEFF_BUBBLES); + } +} + +u32 sub_8155B2C(void) +{ + u8 spriteId; + struct Sprite *sprite; + + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 4); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled = TRUE; + sprite->oam.priority = gFieldEffectArguments[3]; + sprite->oam.paletteNum = 5; + sprite->data[0] = FLDEFF_BERRY_TREE_GROWTH_SPARKLE; + } + return 0; +} + +u32 ShowTreeDisguiseFieldEffect(void) +{ + return ShowDisguiseFieldEffect(FLDEFF_TREE_DISGUISE, 24, 4); +} + + +u32 ShowMountainDisguiseFieldEffect(void) +{ + return ShowDisguiseFieldEffect(FLDEFF_MOUNTAIN_DISGUISE, 25, 3); +} + + +u32 ShowSandDisguiseFieldEffect(void) +{ + return ShowDisguiseFieldEffect(FLDEFF_SAND_DISGUISE, 28, 2); +} + +u32 ShowDisguiseFieldEffect(u8 fldEff, u8 templateIdx, u8 paletteNum) +{ + u8 spriteId; + struct Sprite *sprite; + + if (TryGetEventObjectIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &spriteId)) + { + FieldEffectActiveListRemove(fldEff); + return MAX_SPRITES; + } + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[templateIdx], 0, 0, 0); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->coordOffsetEnabled ++; + sprite->oam.paletteNum = paletteNum; + sprite->data[1] = fldEff; + sprite->data[2] = gFieldEffectArguments[0]; + sprite->data[3] = gFieldEffectArguments[1]; + sprite->data[4] = gFieldEffectArguments[2]; + } + return spriteId; +} + +void sub_8155C88(struct Sprite *sprite) +{ + u8 eventObjectId; + const struct EventObjectGraphicsInfo *graphicsInfo; + struct Sprite *linkedSprite; + + if (TryGetEventObjectIdByLocalIdAndMap(sprite->data[2], sprite->data[3], sprite->data[4], &eventObjectId)) + { + FieldEffectStop(sprite, sprite->data[1]); + } + + graphicsInfo = GetEventObjectGraphicsInfo(gEventObjects[eventObjectId].graphicsId); + linkedSprite = &gSprites[gEventObjects[eventObjectId].spriteId]; + sprite->invisible = linkedSprite->invisible; + sprite->pos1.x = linkedSprite->pos1.x; + sprite->pos1.y = (graphicsInfo->height >> 1) + linkedSprite->pos1.y - 16; + sprite->subpriority = linkedSprite->subpriority - 1; + if (sprite->data[0] == 1) + { + sprite->data[0] ++; + StartSpriteAnim(sprite, 1); + } + if (sprite->data[0] == 2 && sprite->animEnded) + { + sprite->data[7] = 1; + } + if (sprite->data[0] == 3) + { + FieldEffectStop(sprite, sprite->data[1]); + } +} + +void sub_8155D78(struct EventObject *eventObject) +{ + if (eventObject->directionSequenceIndex == 1) + { + gSprites[eventObject->fieldEffectSpriteId].data[0]++; + } +} + +bool8 sub_8155DA0(struct EventObject *eventObject) +{ + struct Sprite *sprite; + + if (eventObject->directionSequenceIndex == 2) + { + return TRUE; + } + if (eventObject->directionSequenceIndex == 0) + { + return TRUE; + } + sprite = &gSprites[eventObject->fieldEffectSpriteId]; + if (sprite->data[7]) + { + eventObject->directionSequenceIndex = 2; + sprite->data[0]++; + return TRUE; + } + return FALSE; +} + +u32 sub_8155DDC(void) +{ + u8 spriteId; + + gFieldEffectArguments[0] += 7; + gFieldEffectArguments[1] += 7; + sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[35], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.priority = gFieldEffectArguments[2]; + gSprites[spriteId].coordOffsetEnabled = TRUE; + } + return 0; +} + +void sub_8155E50(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + if (sprite->animEnded) + { + sprite->invisible = TRUE; + sprite->data[0]++; + } + + if (sprite->data[0] == 0) + return; + } + + if (++sprite->data[1] > 34) + FieldEffectStop(sprite, FLDEFF_SPARKLE); +} + +void sub_8155EA0(struct Sprite *sprite) +{ + sprite->data[6] = 0; + sprite->data[7] = 0; +} + +bool8 sub_8155EA8(struct Sprite *sprite) +{ + bool8 returnBool = FALSE; + + switch (sprite->data[7]) + { + case 0: + sprite->pos2.x += sub_809773C(sprite->data[6]); + sprite->pos2.y += sub_8097728(sprite->data[6]); + break; + case 1: + sprite->pos2.x -= sub_809773C(0x47 - sprite->data[6]); + sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); + break; + case 2: + sprite->pos2.x -= sub_809773C(sprite->data[6]); + sprite->pos2.y += sub_8097728(sprite->data[6]); + break; + case 3: + sprite->pos2.x += sub_809773C(0x47 - sprite->data[6]); + sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); + break; + } + + SetGpuReg(REG_OFFSET_BG0HOFS, -sprite->pos2.x); + if (++sprite->data[6] == 72) + { + sprite->data[6] = 0; + sprite->data[7]++; + } + if (sprite->data[7] == 4) + { + sprite->pos2.y = 0; + sprite->pos2.x = 0; + returnBool = TRUE; + } + + return returnBool; +} + +void sub_8155F80(struct Sprite *sprite) +{ + u8 i, j; + + switch (sprite->data[2]) + { + case 0: + SetGpuReg(REG_OFFSET_BG0VOFS, 0x78 - (sprite->data[0] / 3)); + if (sprite->data[0] == 0x60) + { + for (i = 0; i < 3; i++) + { + for (j = 12; j < 18; j++) + { + ((u16*)(VRAM + 0xF800))[i * 32 + j] = 0xBFF4 + i * 6 + j + 1; + } + } + } + if (sprite->data[0] > 0x137) + { + sprite->data[2] = 1; + sprite->data[0] = 0; + } + break; + case 1: + sprite->pos1.y = (gSineTable[sprite->data[0] / 3] >> 2) + sprite->data[4]; + if (sprite->data[0] == 0xBD) + { + sprite->data[2] = 2; + sprite->data[5] = 0; + sprite->data[0] = 0; + } + break; + case 2: + if (sprite->data[0] == 0x3C) + { + sprite->data[5]++; + sprite->data[0] = 0; + } + if (sprite->data[5] == 7) + { + sprite->data[5] = 0; + sprite->data[2] = 3; + } + break; + case 3: + if (sprite->pos2.y == 0) + { + sprite->data[0] = 0; + sprite->data[2]++; + } + if (sprite->data[0] == 5) + { + sprite->data[0] = 0; + if (sprite->pos2.y > 0) + sprite->pos2.y--; + else + sprite->pos2.y++; + } + break; + case 4: + if (sprite->data[0] == 0x3C) + { + sprite->data[2] = 5; + sprite->data[0] = 0; + sprite->data[5] = 0; + } + break; + case 5: + sub_8155EA0(sprite); + sprite->data[2] = 6; + sprite->data[0] = 0; + break; + case 6: + if (sub_8155EA8(sprite)) + { + sprite->data[0] = 0; + if (++sprite->data[5] <= 2) + { + sub_8155EA0(sprite); + } + else + { + sprite->data[5] = 0; + sprite->data[2] = 7; + } + } + break; + case 7: + if (sprite->data[0] == 0x1E) + { + sprite->data[2] = 8; + sprite->data[0] = 0; + } + break; + case 8: + for (i = 0; i < 15; i++) + { + for (j = 12; j < 18; j++) + { + ((u16*)(VRAM + 0xF800))[i * 32 + j] = 0; + } + } + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + FieldEffectStop(sprite, FLDEFF_64); + break; + } + + if (sprite->data[2] == 1) + { + if ((sprite->data[1] & 7) == 0) + sprite->pos2.y += sprite->data[3]; + if ((sprite->data[1] & 15) == 0) + sprite->data[3] = -sprite->data[3]; + sprite->data[1]++; + } + + sprite->data[0]++; +} + +void sub_8156194(struct Sprite *sprite) +{ + if (sprite->animEnded) + { + FieldEffectStop(sprite, sprite->data[1]); + } + else + { + UpdateEventObjectSpriteVisibility(sprite, FALSE); + SetObjectSubpriorityByZCoord(sprite->data[0], sprite, 0); + } +} + +void sub_81561D0(struct Sprite *sprite) +{ + if (sprite->animEnded) + FieldEffectStop(sprite, sprite->data[0]); + else + UpdateEventObjectSpriteVisibility(sprite, FALSE); +} + +#ifdef NONMATCHING +void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset) +{ + u8 i; + s16 xlo; + s16 xhi; + s16 lx; + s16 lyhi; + s16 ly; + s16 ylo; + s16 yhi; + struct EventObject *eventObject; // r4 + const struct EventObjectGraphicsInfo *graphicsInfo; // destroyed + struct Sprite *linkedSprite; // r5 + + SetObjectSubpriorityByZCoord(z, sprite, offset); + for (i = 0; i < 16; i ++) + { + eventObject = &gEventObjects[i]; + if (eventObject->active) + { + graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); + linkedSprite = &gSprites[eventObject->spriteId]; + xhi = sprite->pos1.x + sprite->centerToCornerVecX; + xlo = sprite->pos1.x - sprite->centerToCornerVecX; + lx = linkedSprite->pos1.x; + if (xhi < lx && xlo > lx) + { + lyhi = linkedSprite->pos1.y + linkedSprite->centerToCornerVecY; + ly = linkedSprite->pos1.y; + ylo = sprite->pos1.y - sprite->centerToCornerVecY; + yhi = ylo + linkedSprite->centerToCornerVecY; + if ((lyhi < yhi || lyhi < ylo) && ly > yhi) + { + if (sprite->subpriority <= linkedSprite->subpriority) + { + sprite->subpriority = linkedSprite->subpriority + 2; + break; + } + } + } + } + } +} +#else +NAKED void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset) +{ + asm_unified("push {r4-r7,lr}\n\ + adds r6, r0, 0\n\ + adds r0, r1, 0\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r1, r6, 0\n\ + bl SetObjectSubpriorityByZCoord\n\ + movs r7, 0\n\ +_08156212:\n\ + lsls r0, r7, 3\n\ + adds r0, r7\n\ + lsls r0, 2\n\ + ldr r1, =gEventObjects\n\ + adds r4, r0, r1\n\ + ldrb r0, [r4]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081562B4\n\ + ldrb r0, [r4, 0x5]\n\ + bl GetEventObjectGraphicsInfo\n\ + ldrb r1, [r4, 0x4]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + ldr r1, =gSprites\n\ + adds r5, r0, r1\n\ + adds r0, r6, 0\n\ + adds r0, 0x28\n\ + movs r2, 0\n\ + ldrsb r2, [r0, r2]\n\ + ldrh r0, [r6, 0x20]\n\ + adds r1, r0, r2\n\ + subs r0, r2\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + lsls r1, 16\n\ + asrs r1, 16\n\ + movs r0, 0x20\n\ + ldrsh r2, [r5, r0]\n\ + cmp r1, r2\n\ + bge _081562B4\n\ + lsls r0, r4, 16\n\ + asrs r0, 16\n\ + cmp r0, r2\n\ + ble _081562B4\n\ + adds r0, r5, 0\n\ + adds r0, 0x29\n\ + movs r3, 0\n\ + ldrsb r3, [r0, r3]\n\ + ldrh r2, [r5, 0x22]\n\ + adds r2, r3\n\ + ldrh r4, [r5, 0x22]\n\ + adds r0, r6, 0\n\ + adds r0, 0x29\n\ + movs r1, 0\n\ + ldrsb r1, [r0, r1]\n\ + ldrh r0, [r6, 0x22]\n\ + subs r0, r1\n\ + lsls r0, 16\n\ + asrs r0, 16\n\ + adds r3, r0, r3\n\ + lsls r2, 16\n\ + asrs r2, 16\n\ + lsls r3, 16\n\ + asrs r3, 16\n\ + cmp r2, r3\n\ + blt _0815628C\n\ + cmp r2, r0\n\ + bge _081562B4\n\ +_0815628C:\n\ + lsls r0, r4, 16\n\ + asrs r0, 16\n\ + cmp r0, r3\n\ + ble _081562B4\n\ + adds r2, r6, 0\n\ + adds r2, 0x43\n\ + adds r0, r5, 0\n\ + adds r0, 0x43\n\ + ldrb r1, [r0]\n\ + ldrb r0, [r2]\n\ + cmp r0, r1\n\ + bhi _081562B4\n\ + adds r0, r1, 0x2\n\ + strb r0, [r2]\n\ + b _081562BE\n\ + .pool\n\ +_081562B4:\n\ + adds r0, r7, 0x1\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + cmp r7, 0xF\n\ + bls _08156212\n\ +_081562BE:\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} +#endif