diff --git a/asm/field_effect_helpers.s b/asm/field_effect_helpers.s index 9a019f60c..050d6b543 100644 --- a/asm/field_effect_helpers.s +++ b/asm/field_effect_helpers.s @@ -5,1699 +5,6 @@ .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} diff --git a/data/field_effect_helpers.s b/data/field_effect_helpers.s index 63fc1580e..a1edac00c 100644 --- a/data/field_effect_helpers.s +++ b/data/field_effect_helpers.s @@ -2,15 +2,8 @@ .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 + + .align 2 gUnknown_085CDC4C:: @ 85CDC4C .4byte sub_8154C7C diff --git a/include/event_object_movement.h b/include/event_object_movement.h index d43dd78ea..97c41a519 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,8 @@ 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); void MovementType_None(struct Sprite *); void MovementType_LookAround(struct Sprite *); @@ -249,6 +252,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 43a556034..15932d96c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -201,6 +201,7 @@ SECTIONS { src/rom_81520A8.o(.text); src/save.o(.text); src/mystery_event_script.o(.text); + src/field_effect_helpers.o(.text); asm/field_effect_helpers.o(.text); src/contest_ai.o(.text); src/battle_anim_sound_tasks.o(.text); @@ -491,6 +492,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..37ff63258 --- /dev/null +++ b/src/field_effect_helpers.c @@ -0,0 +1,568 @@ +#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" + +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); + +/* +static void FadeFootprintsTireTracks_Step0(struct Sprite *); +static void FadeFootprintsTireTracks_Step1(struct Sprite *); +static void UpdateAshFieldEffect_Step0(struct Sprite *); +static void UpdateAshFieldEffect_Step1(struct Sprite *); +static void UpdateAshFieldEffect_Step2(struct Sprite *); +static void UpdateFeetInFlowingWaterFieldEffect(struct Sprite *); +static void sub_8127FD4(struct EventObject *, struct Sprite *); +static void sub_812800C(struct EventObject *, struct Sprite *); +static void sub_81280A0(struct EventObject *, struct Sprite *, struct Sprite *); +static void sub_8128174(struct Sprite *); +static 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; +}