diff --git a/asm/fldeff_80F9BCC.s b/asm/fldeff_80F9BCC.s deleted file mode 100644 index a361faa32..000000000 --- a/asm/fldeff_80F9BCC.s +++ /dev/null @@ -1,2514 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80F9BCC -sub_80F9BCC: @ 80F9BCC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_80F9C90 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80F9C44 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9BCC - - thumb_func_start sub_80F9BF4 -sub_80F9BF4: @ 80F9BF4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_80F9DFC - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80F9C44 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9BF4 - - thumb_func_start sub_80F9C1C -sub_80F9C1C: @ 80F9C1C - push {lr} - ldr r0, =sub_80F9C90 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F9C1C - - thumb_func_start sub_80F9C30 -sub_80F9C30: @ 80F9C30 - push {lr} - ldr r0, =sub_80F9DFC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F9C30 - - thumb_func_start sub_80F9C44 -sub_80F9C44: @ 80F9C44 - push {r4,r5,lr} - lsls r1, 16 - lsrs r4, r1, 16 - adds r5, r4, 0 - lsls r3, 24 - lsrs r3, 24 - adds r1, r3, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0 - strh r0, [r1, 0x8] - movs r0, 0x10 - cmp r4, 0 - beq _080F9C72 - adds r0, r4, 0 -_080F9C72: - strh r0, [r1, 0xA] - movs r0, 0x14 - cmp r5, 0 - beq _080F9C7C - adds r0, r5, 0 -_080F9C7C: - strh r0, [r1, 0xC] - ldr r1, [r1] - adds r0, r2, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9C44 - - thumb_func_start sub_80F9C90 -sub_80F9C90: @ 80F9C90 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080F9D10 - cmp r0, 0x1 - bgt _080F9CB8 - cmp r0, 0 - beq _080F9CC2 - b _080F9DDE - .pool -_080F9CB8: - cmp r0, 0x2 - beq _080F9D32 - cmp r0, 0x3 - beq _080F9D94 - b _080F9DDE -_080F9CC2: - movs r0, 0x78 - strh r0, [r4, 0xE] - strh r0, [r4, 0x10] - movs r0, 0x50 - strh r0, [r4, 0x12] - movs r0, 0x51 - strh r0, [r4, 0x14] - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0x10] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x40 - bl SetGpuReg - ldrh r1, [r4, 0x12] - lsls r1, 8 - ldrh r0, [r4, 0x14] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - b _080F9DEE -_080F9D10: - movs r0, 0x50 - bl GetGpuReg - strh r0, [r4, 0x16] - movs r0, 0x54 - bl GetGpuReg - strh r0, [r4, 0x18] - movs r0, 0x50 - movs r1, 0xBF - bl SetGpuReg - movs r0, 0x54 - movs r1, 0x10 - bl SetGpuReg - b _080F9DEE -_080F9D32: - ldrh r0, [r4, 0xE] - ldrh r1, [r4, 0xA] - subs r0, r1 - movs r5, 0 - strh r0, [r4, 0xE] - ldrh r2, [r4, 0x10] - adds r1, r2 - strh r1, [r4, 0x10] - lsls r0, 16 - cmp r0, 0 - ble _080F9D50 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xEF - ble _080F9D76 -_080F9D50: - strh r5, [r4, 0xE] - movs r0, 0xF0 - strh r0, [r4, 0x10] - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldrh r1, [r4, 0x16] - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - movs r2, 0 - bl BlendPalettes - ldr r0, =gPlttBufferFaded - strh r5, [r0] -_080F9D76: - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0x10] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x40 - bl SetGpuReg - movs r1, 0xE - ldrsh r0, [r4, r1] - b _080F9DD8 - .pool -_080F9D94: - ldrh r0, [r4, 0x12] - ldrh r1, [r4, 0xC] - subs r0, r1 - strh r0, [r4, 0x12] - ldrh r2, [r4, 0x14] - adds r1, r2 - strh r1, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - ble _080F9DB0 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _080F9DC2 -_080F9DB0: - movs r0, 0 - strh r0, [r4, 0x12] - movs r0, 0xA0 - strh r0, [r4, 0x14] - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl ClearGpuRegBits -_080F9DC2: - ldrh r1, [r4, 0x12] - lsls r1, 8 - ldrh r0, [r4, 0x14] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - movs r1, 0x12 - ldrsh r0, [r4, r1] -_080F9DD8: - cmp r0, 0 - bne _080F9DF4 - b _080F9DEE -_080F9DDE: - ldrh r1, [r4, 0x16] - movs r0, 0x50 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyTask - b _080F9DF4 -_080F9DEE: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080F9DF4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80F9C90 - - thumb_func_start sub_80F9DFC -sub_80F9DFC: @ 80F9DFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0x1 - beq _080F9E38 - cmp r1, 0x1 - bgt _080F9E24 - cmp r1, 0 - beq _080F9E2E - b _080F9F2C - .pool -_080F9E24: - cmp r1, 0x2 - beq _080F9E86 - cmp r1, 0x3 - beq _080F9ED8 - b _080F9F2C -_080F9E2E: - ldr r0, =gPlttBufferFaded - strh r1, [r0] - b _080F9F4E - .pool -_080F9E38: - movs r1, 0 - strh r1, [r4, 0xE] - movs r0, 0xF0 - strh r0, [r4, 0x10] - strh r1, [r4, 0x12] - movs r0, 0xA0 - strh r0, [r4, 0x14] - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0x10] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x40 - bl SetGpuReg - ldrh r1, [r4, 0x12] - lsls r1, 8 - ldrh r0, [r4, 0x14] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - b _080F9F4E -_080F9E86: - ldrh r0, [r4, 0xC] - ldrh r2, [r4, 0x12] - adds r1, r0, r2 - strh r1, [r4, 0x12] - ldrh r2, [r4, 0x14] - subs r0, r2, r0 - strh r0, [r4, 0x14] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x4F - bgt _080F9EA4 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x51 - bgt _080F9EBC -_080F9EA4: - movs r0, 0x50 - strh r0, [r4, 0x12] - movs r0, 0x51 - strh r0, [r4, 0x14] - movs r0, 0x50 - movs r1, 0xBF - bl SetGpuReg - movs r0, 0x54 - movs r1, 0x10 - bl SetGpuReg -_080F9EBC: - ldrh r1, [r4, 0x12] - lsls r1, 8 - ldrh r0, [r4, 0x14] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0x50 - bne _080F9F54 - b _080F9F4E -_080F9ED8: - ldrh r0, [r4, 0xA] - ldrh r2, [r4, 0xE] - adds r1, r0, r2 - strh r1, [r4, 0xE] - ldrh r2, [r4, 0x10] - subs r0, r2, r0 - strh r0, [r4, 0x10] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x77 - bgt _080F9EF6 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x78 - bgt _080F9F0C -_080F9EF6: - movs r0, 0x78 - strh r0, [r4, 0xE] - strh r0, [r4, 0x10] - subs r0, 0x79 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gPlttBufferFaded - movs r0, 0 - strh r0, [r1] -_080F9F0C: - ldrh r1, [r4, 0xE] - lsls r1, 8 - ldrh r0, [r4, 0x10] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x40 - bl SetGpuReg - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0x78 - bne _080F9F54 - b _080F9F4E - .pool -_080F9F2C: - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl ClearGpuRegBits - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyTask - b _080F9F54 -_080F9F4E: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080F9F54: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80F9DFC - - thumb_func_start sub_80F9F5C -sub_80F9F5C: @ 80F9F5C - push {lr} - ldr r0, =gPlayerFacingPosition - ldr r1, =gMapHeader - ldr r1, [r1, 0x4] - bl sub_80E9608 - bl sub_80E8B6C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9F5C - - thumb_func_start sub_80F9F78 -sub_80F9F78: @ 80F9F78 - push {lr} - ldr r0, =gPlayerAvatar - ldrb r1, [r0] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - beq _080F9FC0 - ldr r1, =gFieldEffectArguments - ldr r0, [r1, 0x4] - cmp r0, 0x2 - beq _080F9FAE - cmp r0, 0x2 - bgt _080F9FA0 - cmp r0, 0x1 - beq _080F9FA6 - b _080F9FFE - .pool -_080F9FA0: - cmp r0, 0x3 - beq _080F9FB6 - b _080F9FDC -_080F9FA6: - movs r0, 0x10 - str r0, [r1, 0x14] - movs r0, 0x28 - b _080F9FFC -_080F9FAE: - movs r0, 0x10 - str r0, [r1, 0x14] - movs r0, 0x8 - b _080F9FFC -_080F9FB6: - movs r0, 0x8 - negs r0, r0 - str r0, [r1, 0x14] - movs r0, 0x18 - b _080F9FFC -_080F9FC0: - ldr r1, =gFieldEffectArguments - ldr r0, [r1, 0x4] - cmp r0, 0x2 - beq _080F9FEA - cmp r0, 0x2 - bgt _080F9FD8 - cmp r0, 0x1 - beq _080F9FE2 - b _080F9FFE - .pool -_080F9FD8: - cmp r0, 0x3 - beq _080F9FEE -_080F9FDC: - cmp r0, 0x4 - beq _080F9FF8 - b _080F9FFE -_080F9FE2: - movs r0, 0x8 - str r0, [r1, 0x14] - movs r0, 0x28 - b _080F9FFC -_080F9FEA: - movs r0, 0x8 - b _080F9FFA -_080F9FEE: - movs r0, 0x8 - negs r0, r0 - str r0, [r1, 0x14] - movs r0, 0x18 - b _080F9FFC -_080F9FF8: - movs r0, 0x18 -_080F9FFA: - str r0, [r1, 0x14] -_080F9FFC: - str r0, [r1, 0x18] -_080F9FFE: - pop {r0} - bx r0 - thumb_func_end sub_80F9F78 - - thumb_func_start sub_80FA004 -sub_80FA004: @ 80FA004 - push {r4,lr} - bl sub_80E8BC8 - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x1 - beq _080FA0AE - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _080FA0AE - ldr r4, =gPlayerFacingPosition - adds r1, r4, 0x2 - adds r0, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl MetatileBehavior_IsSecretBaseCave - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FA070 - bl sub_80F9F5C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =sub_80FA0DC - b _080FA0C0 - .pool -_080FA070: - adds r0, r4, 0 - bl MetatileBehavior_IsSecretBaseTree - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FA0A0 - bl sub_80F9F5C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =sub_80FA1E8 - b _080FA0C0 - .pool -_080FA0A0: - adds r0, r4, 0 - bl MetatileBehavior_IsSecretBaseShrub - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FA0B2 -_080FA0AE: - movs r0, 0 - b _080FA0C4 -_080FA0B2: - bl sub_80F9F5C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =sub_80FA34C -_080FA0C0: - str r0, [r1] - movs r0, 0x1 -_080FA0C4: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA004 - - thumb_func_start sub_80FA0DC -sub_80FA0DC: @ 80FA0DC - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - ldr r0, =EventScript_275A86 - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA0DC - - thumb_func_start oei_sweet_scent -oei_sweet_scent: @ 80FA0FC - push {lr} - bl oei_task_add - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r2, =sub_80FA128 - lsrs r0, r2, 16 - strh r0, [r1, 0x18] - strh r2, [r1, 0x1A] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end oei_sweet_scent - - thumb_func_start sub_80FA128 -sub_80FA128: @ 80FA128 - push {lr} - movs r0, 0xB - bl FieldEffectActiveListRemove - movs r0, 0x37 - bl FieldEffectStart - pop {r0} - bx r0 - thumb_func_end sub_80FA128 - - thumb_func_start sub_80FA13C -sub_80FA13C: @ 80FA13C - push {r4,lr} - bl sub_80F9F78 - ldr r0, =gUnknown_0858E600 - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 23 - ldr r4, =gFieldEffectArguments - ldr r3, [r4, 0x14] - adds r1, r3 - lsls r1, 16 - asrs r1, 16 - ldrb r2, [r2] - ldr r3, [r4, 0x18] - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x94 - bl CreateSprite - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA13C - - thumb_func_start sub_80FA18C -sub_80FA18C: @ 80FA18C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x83 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_80FA1A8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA18C - - thumb_func_start sub_80FA1A8 -sub_80FA1A8: @ 80FA1A8 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0x27 - bgt _080FA1C8 - adds r0, r2, 0x1 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bne _080FA1D0 - bl sub_80E8D4C - b _080FA1D0 -_080FA1C8: - movs r0, 0 - strh r0, [r1, 0x2E] - ldr r0, =sub_80FA1D8 - str r0, [r1, 0x1C] -_080FA1D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA1A8 - - thumb_func_start sub_80FA1D8 -sub_80FA1D8: @ 80FA1D8 - push {lr} - movs r1, 0x37 - bl FieldEffectStop - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80FA1D8 - - thumb_func_start sub_80FA1E8 -sub_80FA1E8: @ 80FA1E8 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - ldr r0, =EventScript_275ADF - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA1E8 - - thumb_func_start sub_80FA208 -sub_80FA208: @ 80FA208 - push {lr} - bl oei_task_add - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r2, =sub_80FA234 - lsrs r0, r2, 16 - strh r0, [r1, 0x18] - strh r2, [r1, 0x1A] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA208 - - thumb_func_start sub_80FA234 -sub_80FA234: @ 80FA234 - push {lr} - movs r0, 0x1A - bl FieldEffectActiveListRemove - movs r0, 0x38 - bl FieldEffectStart - pop {r0} - bx r0 - thumb_func_end sub_80FA234 - - thumb_func_start sub_80FA248 -sub_80FA248: @ 80FA248 - push {r4,lr} - ldr r1, =gPlayerFacingPosition - movs r2, 0 - ldrsh r0, [r1, r2] - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl MapGridGetMetatileBehaviorAt - adds r2, r0, 0 - ldr r1, =0x00000fff - adds r0, r1, 0 - ands r2, r0 - cmp r2, 0x96 - bne _080FA26A - ldr r1, =gFieldEffectArguments - movs r0, 0 - str r0, [r1, 0x1C] -_080FA26A: - cmp r2, 0x9C - bne _080FA274 - ldr r1, =gFieldEffectArguments - movs r0, 0x2 - str r0, [r1, 0x1C] -_080FA274: - bl sub_80F9F78 - ldr r0, =gUnknown_0858E618 - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 23 - ldr r4, =gFieldEffectArguments - ldr r3, [r4, 0x14] - adds r1, r3 - lsls r1, 16 - asrs r1, 16 - ldrb r2, [r2] - ldr r3, [r4, 0x18] - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x94 - bl CreateSprite - ldr r0, [r4, 0x1C] - cmp r0, 0x1 - beq _080FA2B2 - cmp r0, 0x3 - bne _080FA2B6 -_080FA2B2: - bl sub_80E8D4C -_080FA2B6: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA248 - - thumb_func_start sub_80FA2D8 -sub_80FA2D8: @ 80FA2D8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x9B - bl PlaySE - ldr r0, =gFieldEffectArguments - ldr r1, [r0, 0x1C] - adds r2, r4, 0 - adds r2, 0x2A - movs r0, 0 - strb r1, [r2] - strh r0, [r4, 0x2E] - ldr r0, =sub_80FA304 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA2D8 - - thumb_func_start sub_80FA304 -sub_80FA304: @ 80FA304 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x27 - ble _080FA32E - ldr r0, =gFieldEffectArguments - ldr r0, [r0, 0x1C] - cmp r0, 0 - beq _080FA322 - cmp r0, 0x2 - bne _080FA326 -_080FA322: - bl sub_80E8D4C -_080FA326: - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_80FA33C - str r0, [r4, 0x1C] -_080FA32E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA304 - - thumb_func_start sub_80FA33C -sub_80FA33C: @ 80FA33C - push {lr} - movs r1, 0x38 - bl FieldEffectStop - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80FA33C - - thumb_func_start sub_80FA34C -sub_80FA34C: @ 80FA34C - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - ldr r0, =EventScript_275B38 - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA34C - - thumb_func_start sub_80FA36C -sub_80FA36C: @ 80FA36C - push {lr} - bl oei_task_add - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r2, =sub_80FA398 - lsrs r0, r2, 16 - strh r0, [r1, 0x18] - strh r2, [r1, 0x1A] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA36C - - thumb_func_start sub_80FA398 -sub_80FA398: @ 80FA398 - push {lr} - movs r0, 0x1B - bl FieldEffectActiveListRemove - movs r0, 0x39 - bl FieldEffectStart - pop {r0} - bx r0 - thumb_func_end sub_80FA398 - - thumb_func_start sub_80FA3AC -sub_80FA3AC: @ 80FA3AC - push {r4,lr} - bl sub_80F9F78 - ldr r0, =gUnknown_0858E630 - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 23 - ldr r4, =gFieldEffectArguments - ldr r3, [r4, 0x14] - adds r1, r3 - lsls r1, 16 - asrs r1, 16 - ldrb r2, [r2] - ldr r3, [r4, 0x18] - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x94 - bl CreateSprite - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA3AC - - thumb_func_start sub_80FA3FC -sub_80FA3FC: @ 80FA3FC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0xA9 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_80FA418 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA3FC - - thumb_func_start sub_80FA418 -sub_80FA418: @ 80FA418 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0x27 - bgt _080FA438 - adds r0, r2, 0x1 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bne _080FA440 - bl sub_80E8D4C - b _080FA440 -_080FA438: - movs r0, 0 - strh r0, [r1, 0x2E] - ldr r0, =sub_80FA448 - str r0, [r1, 0x1C] -_080FA440: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA418 - - thumb_func_start sub_80FA448 -sub_80FA448: @ 80FA448 - push {lr} - movs r1, 0x39 - bl FieldEffectStop - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80FA448 - - thumb_func_start sub_80FA458 -sub_80FA458: @ 80FA458 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - ldr r0, =sub_80FA4A0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - mov r0, sp - ldrh r0, [r0] - movs r2, 0 - strh r0, [r1, 0x8] - ldrh r0, [r4] - strh r0, [r1, 0xA] - strh r2, [r1, 0xC] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FA458 - - thumb_func_start sub_80FA4A0 -sub_80FA4A0: @ 80FA4A0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x4] - subs r0, 0x4 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - bhi _080FA56E - lsls r0, 2 - ldr r1, =_080FA4D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FA4D0: - .4byte _080FA514 - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA522 - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA514 - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA522 - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA56E - .4byte _080FA540 -_080FA514: - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - movs r2, 0x89 - lsls r2, 2 - b _080FA52E -_080FA522: - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - movs r2, 0x88 - lsls r2, 2 -_080FA52E: - bl MapGridSetMetatileIdAt - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - b _080FA56E -_080FA540: - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - movs r2, 0x89 - lsls r2, 2 - bl MapGridSetMetatileIdAt - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - movs r0, 0x3D - bl FieldEffectActiveListRemove - bl EnableBothScriptContexts - adds r0, r5, 0 - bl DestroyTask - b _080FA574 -_080FA56E: - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] -_080FA574: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FA4A0 - - thumb_func_start sub_80FA57C -sub_80FA57C: @ 80FA57C - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - movs r0, 0x3 - bl PlaySE - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - bne _080FA5B8 - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r2, 0xE2 - lsls r2, 4 - bl MapGridSetMetatileIdAt - b _080FA5C8 - .pool -_080FA5B8: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - ldr r2, =0x00000e21 - bl MapGridSetMetatileIdAt -_080FA5C8: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA57C - - thumb_func_start sub_80FA5E4 -sub_80FA5E4: @ 80FA5E4 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - ldr r0, =sub_80FA62C - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r4, [r1, 0x8] - strh r5, [r1, 0xA] - strh r6, [r1, 0xC] - strh r0, [r1, 0xE] - movs r0, 0x1 - strh r0, [r1, 0x10] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA5E4 - - thumb_func_start sub_80FA62C -sub_80FA62C: @ 80FA62C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r1, [r4, 0x6] - movs r2, 0x6 - ldrsh r0, [r4, r2] - cmp r0, 0x6 - bne _080FA650 - movs r0, 0 - b _080FA652 - .pool -_080FA650: - adds r0, r1, 0x1 -_080FA652: - strh r0, [r4, 0x6] - movs r3, 0x6 - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _080FA6A4 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x2 - bne _080FA66C - movs r2, 0 - ldrsh r0, [r4, r2] - bl sub_80FA6AC -_080FA66C: - movs r3, 0x2 - ldrsh r0, [r4, r3] - movs r2, 0x4 - ldrsh r1, [r4, r2] - ldrh r2, [r4, 0x8] - ldrh r3, [r4] - adds r2, r3 - lsls r2, 16 - lsrs r2, 16 - bl MapGridSetMetatileIdAt - movs r1, 0x2 - ldrsh r0, [r4, r1] - movs r2, 0x4 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - ldrh r1, [r4, 0x8] - movs r3, 0x8 - ldrsh r0, [r4, r3] - cmp r0, 0x3 - bne _080FA6A0 - adds r0, r5, 0 - bl DestroyTask - b _080FA6A4 -_080FA6A0: - adds r0, r1, 0x1 - strh r0, [r4, 0x8] -_080FA6A4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FA62C - - thumb_func_start sub_80FA6AC -sub_80FA6AC: @ 80FA6AC - push {lr} - lsls r0, 16 - asrs r1, r0, 16 - movs r0, 0xCE - lsls r0, 2 - cmp r1, r0 - beq _080FA6D8 - cmp r1, r0 - bgt _080FA6C8 - movs r0, 0x8A - lsls r0, 2 - cmp r1, r0 - beq _080FA6F0 - b _080FA6F6 -_080FA6C8: - movs r0, 0xCF - lsls r0, 2 - cmp r1, r0 - beq _080FA6E0 - adds r0, 0x4 - cmp r1, r0 - beq _080FA6E8 - b _080FA6F6 -_080FA6D8: - movs r0, 0x4A - bl PlaySE - b _080FA6F6 -_080FA6E0: - movs r0, 0x4B - bl PlaySE - b _080FA6F6 -_080FA6E8: - movs r0, 0x4C - bl PlaySE - b _080FA6F6 -_080FA6F0: - movs r0, 0x4E - bl PlaySE -_080FA6F6: - pop {r0} - bx r0 - thumb_func_end sub_80FA6AC - - thumb_func_start sub_80FA6FC -sub_80FA6FC: @ 80FA6FC - movs r0, 0 - bx lr - thumb_func_end sub_80FA6FC - - thumb_func_start sub_80FA700 -sub_80FA700: @ 80FA700 - movs r0, 0 - bx lr - thumb_func_end sub_80FA700 - - thumb_func_start sub_80FA704 -sub_80FA704: @ 80FA704 - push {r4-r6,lr} - adds r5, r0, 0 - adds r4, r1, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0x4D - bl PlaySE - lsls r5, 16 - asrs r5, 16 - lsls r4, 16 - asrs r4, 16 - ldr r2, =0x00000276 - adds r0, r5, 0 - adds r1, r4, 0 - bl MapGridSetMetatileIdAt - subs r6, r4, 0x1 - ldr r2, =0x0000026e - adds r0, r5, 0 - adds r1, r6, 0 - bl MapGridSetMetatileIdAt - adds r0, r5, 0 - adds r1, r4, 0 - bl CurrentMapDrawMetatileAt - adds r0, r5, 0 - adds r1, r6, 0 - bl CurrentMapDrawMetatileAt - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA704 - - thumb_func_start sub_80FA754 -sub_80FA754: @ 80FA754 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0x8] - movs r3, 0x8 - ldrsh r0, [r1, r3] - cmp r0, 0x7 - bne _080FA788 - movs r2, 0xA - ldrsh r0, [r1, r2] - movs r3, 0xC - ldrsh r1, [r1, r3] - bl sub_80FA704 - adds r0, r4, 0 - bl DestroyTask - b _080FA78C - .pool -_080FA788: - adds r0, r2, 0x1 - strh r0, [r1, 0x8] -_080FA78C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FA754 - - thumb_func_start sub_80FA794 -sub_80FA794: @ 80FA794 - push {r4-r7,lr} - lsls r0, 16 - lsrs r5, r0, 16 - adds r7, r5, 0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r6, r4, 0 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FA7BC - lsls r0, r5, 16 - asrs r0, 16 - lsls r1, r4, 16 - asrs r1, 16 - bl sub_80FA704 - b _080FA7DE -_080FA7BC: - cmp r0, 0x2 - bne _080FA7DE - ldr r0, =sub_80FA754 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - strh r7, [r1, 0xA] - strh r6, [r1, 0xC] -_080FA7DE: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA794 - - thumb_func_start sub_80FA7EC -sub_80FA7EC: @ 80FA7EC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x7 - beq _080FA808 - b _080FA966 -_080FA808: - ldr r2, =0xfffffd88 - adds r0, r2, 0 - ldrh r1, [r1, 0x8] - adds r0, r1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3B - bls _080FA81A - b _080FA95E -_080FA81A: - lsls r0, 2 - ldr r1, =_080FA830 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FA830: - .4byte _080FA920 - .4byte _080FA928 - .4byte _080FA930 - .4byte _080FA938 - .4byte _080FA940 - .4byte _080FA948 - .4byte _080FA950 - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA95E - .4byte _080FA958 -_080FA920: - movs r0, 0x3E - bl PlaySE - b _080FA95E -_080FA928: - movs r0, 0x3F - bl PlaySE - b _080FA95E -_080FA930: - movs r0, 0x40 - bl PlaySE - b _080FA95E -_080FA938: - movs r0, 0x41 - bl PlaySE - b _080FA95E -_080FA940: - movs r0, 0x42 - bl PlaySE - b _080FA95E -_080FA948: - movs r0, 0x43 - bl PlaySE - b _080FA95E -_080FA950: - movs r0, 0x44 - bl PlaySE - b _080FA95E -_080FA958: - movs r0, 0x45 - bl PlaySE -_080FA95E: - adds r0, r4, 0 - bl DestroyTask - b _080FA96A -_080FA966: - adds r0, r2, 0x1 - strh r0, [r1, 0xA] -_080FA96A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FA7EC - - thumb_func_start sub_80FA970 -sub_80FA970: @ 80FA970 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_80FA7EC - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r4, [r1, 0x8] - strh r0, [r1, 0xA] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA970 - - thumb_func_start sub_80FA9A4 -sub_80FA9A4: @ 80FA9A4 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - bne _080FA9BC - movs r0, 0xC3 - bl PlaySE -_080FA9BC: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1F - ble _080FA9CA - adds r0, r4, 0 - bl DestroySprite -_080FA9CA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FA9A4 - - thumb_func_start sub_80FA9D0 -sub_80FA9D0: @ 80FA9D0 - push {r4,lr} - sub sp, 0x4 - ldr r3, =gEventObjects - ldr r2, =gPlayerAvatar - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x10] - mov r0, sp - strh r1, [r0] - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r0, [r0, 0x12] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r0, sp - adds r1, r4, 0 - movs r2, 0x8 - movs r3, 0x4 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x58] - 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 r0, 24 - cmp r0, 0x40 - beq _080FAA5E - ldr r3, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r4, r2, r3 - movs r0, 0x3E - adds r0, r4 - mov r12, r0 - ldrb r0, [r0] - movs r1, 0x2 - orrs r0, r1 - mov r1, r12 - strb r0, [r1] - ldrb r1, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - movs r1, 0xF - ands r0, r1 - movs r1, 0x50 - orrs r0, r1 - strb r0, [r4, 0x5] - adds r3, 0x1C - adds r2, r3 - ldr r0, =sub_80FA9A4 - str r0, [r2] - movs r0, 0 - strh r0, [r4, 0x2E] -_080FAA5E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FA9D0 - - thumb_func_start sub_80FAA7C -sub_80FAA7C: @ 80FAA7C - push {r4,lr} - sub sp, 0x4 - bl ScriptContext2_Enable - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - ldr r1, =gFieldEffectArguments - mov r0, sp - movs r2, 0 - ldrsh r0, [r0, r2] - str r0, [r1, 0x14] - movs r3, 0 - ldrsh r0, [r4, r3] - str r0, [r1, 0x18] - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _080FAAFC - cmp r0, 0x2 - bgt _080FAABC - cmp r0, 0x1 - beq _080FAAC6 - b _080FAB8C - .pool -_080FAABC: - cmp r0, 0x3 - beq _080FAB2C - cmp r0, 0x4 - beq _080FAB64 - b _080FAB8C -_080FAAC6: - ldr r0, =gUnknown_0858E68C - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 7 - movs r3, 0x80 - lsls r3, 12 - adds r1, r3 - asrs r1, 16 - ldrb r2, [r2] - adds r2, 0x20 - movs r3, 0 - bl CreateSprite - b _080FAB8C - .pool -_080FAAFC: - ldr r0, =gUnknown_0858E68C - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 7 - movs r3, 0x80 - lsls r3, 12 - adds r1, r3 - asrs r1, 16 - ldrb r2, [r2] - b _080FAB4C - .pool -_080FAB2C: - ldr r0, =gUnknown_0858E68C - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 7 - ldr r3, =0xfff80000 - adds r1, r3 - asrs r1, 16 - ldrb r2, [r2] - adds r2, 0x10 -_080FAB4C: - movs r3, 0x94 - bl CreateSprite - b _080FAB8C - .pool -_080FAB64: - ldr r0, =gUnknown_0858E68C - ldr r3, =gSprites - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r2, 0x2] - lsls r1, 23 - lsrs r1, 7 - movs r3, 0xC0 - lsls r3, 13 - adds r1, r3 - asrs r1, 16 - ldrb r2, [r2] - adds r2, 0x10 - movs r3, 0x94 - bl CreateSprite -_080FAB8C: - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FAA7C - - thumb_func_start door_restore_tilemap -door_restore_tilemap: @ 80FABA4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x83 - bl PlaySE - ldr r4, =gFieldEffectArguments - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - subs r1, 0x1 - bl MapGridGetMetatileIdAt - ldr r1, =0x00000286 - cmp r0, r1 - bne _080FABDC - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - subs r1, 0x1 - ldr r2, =0x00000e02 - bl MapGridSetMetatileIdAt - b _080FABEA - .pool -_080FABDC: - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - subs r1, 0x1 - movs r2, 0xA1 - lsls r2, 2 - bl MapGridSetMetatileIdAt -_080FABEA: - ldr r4, =gFieldEffectArguments - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - ldr r2, =0x0000020a - bl MapGridSetMetatileIdAt - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - subs r1, 0x1 - bl CurrentMapDrawMetatileAt - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - bl CurrentMapDrawMetatileAt - movs r0, 0 - strh r0, [r5, 0x2E] - ldr r0, =sub_80FAC24 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end door_restore_tilemap - - thumb_func_start sub_80FAC24 -sub_80FAC24: @ 80FAC24 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r1, [r5, 0x2E] - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0x11 - bgt _080FAC38 - adds r0, r1, 0x1 - strh r0, [r5, 0x2E] - b _080FAC54 -_080FAC38: - ldr r4, =gFieldEffectArguments - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - ldr r2, =0x00000e8c - bl MapGridSetMetatileIdAt - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x18] - bl CurrentMapDrawMetatileAt - movs r0, 0 - strh r0, [r5, 0x2E] - ldr r0, =sub_80FAC68 - str r0, [r5, 0x1C] -_080FAC54: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FAC24 - - thumb_func_start sub_80FAC68 -sub_80FAC68: @ 80FAC68 - push {lr} - movs r1, 0x34 - bl FieldEffectStop - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80FAC68 - - thumb_func_start sub_80FAC78 -sub_80FAC78: @ 80FAC78 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileIdAt - adds r1, r0, 0 - ldr r0, =0x000002f5 - cmp r1, r0 - beq _080FAD6C - cmp r1, r0 - bgt _080FACB4 - subs r0, 0x17 - cmp r1, r0 - beq _080FAD14 - adds r0, 0x16 - cmp r1, r0 - beq _080FAD60 - b _080FADCE - .pool -_080FACB4: - ldr r0, =0x000002f6 - cmp r1, r0 - beq _080FADA4 - adds r0, 0x40 - cmp r1, r0 - beq _080FACC2 - b _080FADCE -_080FACC2: - ldr r0, =gStringVar1 - movs r1, 0x64 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, =gText_Gold - bl StringCopy - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080FADCE - ldr r4, =0x000040ee - adds r0, r4, 0 - bl VarGet - adds r1, r0, 0 - movs r0, 0x10 - b _080FAD8A - .pool -_080FAD14: - ldr r0, =gStringVar1 - movs r1, 0x32 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, =gText_Silver - bl StringCopy - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080FADCE - ldr r4, =0x000040ee - adds r0, r4, 0 - bl VarGet - adds r1, r0, 0 - movs r0, 0x20 - b _080FAD8A - .pool -_080FAD60: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - b _080FAD70 - .pool -_080FAD6C: - ldr r1, =gSpecialVar_Result - movs r0, 0x2 -_080FAD70: - strh r0, [r1] - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080FADCE - ldr r4, =0x000040ee - adds r0, r4, 0 - bl VarGet - adds r1, r0, 0 - movs r0, 0x80 -_080FAD8A: - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl VarSet - b _080FADCE - .pool -_080FADA4: - ldr r1, =gSpecialVar_Result - movs r0, 0x3 - strh r0, [r1] - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080FADCE - ldr r4, =0x000040ee - adds r0, r4, 0 - bl VarGet - adds r1, r0, 0 - movs r0, 0x80 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl VarSet -_080FADCE: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FAC78 - - thumb_func_start sub_80FADE4 -sub_80FADE4: @ 80FADE4 - push {r4-r6,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r6, r4, 0 - lsls r1, 24 - lsrs r5, r1, 24 - bl CurrentMapIsSecretBase - lsls r0, 24 - cmp r0, 0 - beq _080FAE28 - cmp r5, 0 - bne _080FAE1C - ldr r1, =0xfffffd7b - adds r0, r4, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bls _080FAE10 - ldr r0, =0x00000237 - cmp r4, r0 - bne _080FAE28 -_080FAE10: - movs r0, 0x1 - b _080FAE2A - .pool -_080FAE1C: - ldr r0, =0x0000028d - cmp r4, r0 - beq _080FAE10 - ldr r0, =0x0000023f - cmp r6, r0 - beq _080FAE10 -_080FAE28: - movs r0, 0 -_080FAE2A: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80FADE4 - - thumb_func_start task50_overworld_poison_effect -task50_overworld_poison_effect: @ 80FAE38 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r1, r0, r1 - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - beq _080FAE76 - cmp r0, 0x1 - bgt _080FAE60 - cmp r0, 0 - beq _080FAE66 - b _080FAE92 - .pool -_080FAE60: - cmp r0, 0x2 - beq _080FAE8A - b _080FAE92 -_080FAE66: - ldrh r0, [r1, 0x2] - adds r0, 0x2 - strh r0, [r1, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080FAE92 - b _080FAE82 -_080FAE76: - ldrh r0, [r1, 0x2] - subs r0, 0x2 - strh r0, [r1, 0x2] - lsls r0, 16 - cmp r0, 0 - bne _080FAE92 -_080FAE82: - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080FAE92 -_080FAE8A: - adds r0, r2, 0 - bl DestroyTask - b _080FAEA2 -_080FAE92: - ldrh r0, [r1, 0x2] - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x4C - bl SetGpuReg -_080FAEA2: - pop {r0} - bx r0 - thumb_func_end task50_overworld_poison_effect - - thumb_func_start FldeffPoison_Start -FldeffPoison_Start: @ 80FAEA8 - push {lr} - movs r0, 0x4F - bl PlaySE - ldr r0, =task50_overworld_poison_effect - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end FldeffPoison_Start - - thumb_func_start FieldPoisonEffectIsRunning -FieldPoisonEffectIsRunning: @ 80FAEC0 - push {lr} - ldr r0, =task50_overworld_poison_effect - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end FieldPoisonEffectIsRunning - - thumb_func_start sub_80FAED4 -sub_80FAED4: @ 80FAED4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_80FAEF0 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_80FAED4 - - thumb_func_start sub_80FAEF0 -sub_80FAEF0: @ 80FAEF0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl EventObjectIsMovementOverridden - lsls r0, 24 - cmp r0, 0 - beq _080FAF1C - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _080FAF4E -_080FAF1C: - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl sub_808C228 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl GetWalkInPlaceNormalMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetHeldMovement - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80FAF64 - str r1, [r0] -_080FAF4E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FAEF0 - - thumb_func_start sub_80FAF64 -sub_80FAF64: @ 80FAF64 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r5, r0, r1 - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _080FAFC8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - ldrh r0, [r2, 0xA] - adds r1, r0, 0x1 - strh r1, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x9 - bgt _080FAFC4 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl GetWalkInPlaceNormalMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectSetHeldMovement - b _080FAFC8 - .pool -_080FAFC4: - ldr r0, =sub_80FAFD4 - str r0, [r2] -_080FAFC8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FAF64 - - thumb_func_start sub_80FAFD4 -sub_80FAFD4: @ 80FAFD4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_808BCD0 - lsls r0, 24 - lsrs r0, 24 - bl SetPlayerAvatarTransitionFlags - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FAFD4 - - thumb_func_start sub_80FAFF8 -sub_80FAFF8: @ 80FAFF8 - push {lr} - ldr r0, =sub_80FAED4 - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FAFF8 - - thumb_func_start CreateRecordMixingSprite -CreateRecordMixingSprite: @ 80FB00C - push {r4,r5,lr} - ldr r0, =gUnknown_0858E864 - bl LoadSpritePalette - ldr r0, =gUnknown_0858E880 - movs r1, 0 - movs r2, 0 - movs r3, 0x52 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x40 - beq _080FB06C - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r2, r4, 0 - adds r2, 0x20 - adds r3, r4, 0 - adds r3, 0x22 - movs r0, 0x10 - movs r1, 0xD - bl sub_8092FF0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x20] - adds r0, 0x10 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x22] - adds r0, 0x2 - strh r0, [r4, 0x22] - adds r0, r5, 0 - b _080FB06E - .pool -_080FB06C: - movs r0, 0x40 -_080FB06E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end CreateRecordMixingSprite - - thumb_func_start DestroyRecordMixingSprite -DestroyRecordMixingSprite: @ 80FB074 - push {r4-r7,lr} - ldr r4, =gSprites - adds r7, r4, 0 - movs r6, 0 - movs r5, 0x3F -_080FB07E: - adds r0, r7, 0 - adds r0, 0x14 - adds r0, r6, r0 - ldr r1, [r0] - ldr r0, =gUnknown_0858E880 - cmp r1, r0 - bne _080FB098 - adds r0, r4, 0 - bl FreeSpritePalette - adds r0, r4, 0 - bl DestroySprite -_080FB098: - adds r4, 0x44 - adds r6, 0x44 - subs r5, 0x1 - cmp r5, 0 - bge _080FB07E - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DestroyRecordMixingSprite - - .align 2, 0 @ Don't pad with nop. diff --git a/data/event_scripts.s b/data/event_scripts.s index c38b69d8b..557515c70 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -537,7 +537,7 @@ EventScript_23B5F0:: @ 823B5F0 goto_eq EventScript_23B5A1 msgbox Text_2767D1, MSGBOX_SIGN special sub_80E9C2C - special sub_80FA57C + special DoSecretBasePCTurnOffEffect releaseall end @@ -547,13 +547,13 @@ EventScript_23B62F:: @ 823B62F goto_eq EventScript_23B5A1 msgbox Text_2767E9, MSGBOX_SIGN special sub_80E9C2C - special sub_80FA57C + special DoSecretBasePCTurnOffEffect releaseall end EventScript_23B652:: @ 823B652 msgbox Text_27676F, MSGBOX_SIGN - special sub_80FA57C + special DoSecretBasePCTurnOffEffect closemessage releaseall end @@ -564,7 +564,7 @@ EventScript_23B660:: @ 823B660 end EventScript_23B66E:: @ 823B66E - special sub_80FA57C + special DoSecretBasePCTurnOffEffect closemessage releaseall end @@ -592,7 +592,7 @@ EventScript_SecretBaseSandOrnament:: @ 823B684 end EventScript_SecretBaseShieldOrToyTV:: @ 823B68C - special sub_80FAC78 + special GetShieldToyTVDecorationInfo compare VAR_RESULT, 0 goto_eq EventScript_23B6BC compare VAR_RESULT, 1 diff --git a/data/field_effect_misc.s b/data/field_effect_misc.s deleted file mode 100644 index f1b28d906..000000000 --- a/data/field_effect_misc.s +++ /dev/null @@ -1,244 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gSpriteImage_858D978:: @ 858D978 - .incbin "graphics/unknown/858E588/0.4bpp" - - .align 2 -gSpriteImage_858D9F8:: @ 858D9F8 - .incbin "graphics/unknown/858E588/1.4bpp" - - .align 2 -gSpriteImage_858DA78:: @ 858DA78 - .incbin "graphics/unknown/858E588/2.4bpp" - - .align 2 -gSpriteImage_858DAF8:: @ 858DAF8 - .incbin "graphics/unknown/858E588/3.4bpp" - - .align 2 -gSpriteImage_858DB78:: @ 858DB78 - .incbin "graphics/unknown/858E588/4.4bpp" - - .space 32 - - .align 2 -gFieldEffectObjectPalette7:: @ 858DC18 - .incbin "graphics/event_objects/palettes/field_effect_object_palette_07.gbapal" - - .align 2 -gSpriteImage_858DC38:: @ 858DC38 - .incbin "graphics/unknown/858E5D8/0.4bpp" - - .align 2 -gSpriteImage_858DCB8:: @ 858DCB8 - .incbin "graphics/unknown/858E5D8/1.4bpp" - - .align 2 -gSpriteImage_858DD38:: @ 858DD38 - .incbin "graphics/unknown/858E5D8/2.4bpp" - - .align 2 -gSpriteImage_858DDB8:: @ 858DDB8 - .incbin "graphics/unknown/858E5D8/3.4bpp" - - .align 2 -gSpriteImage_858DE38:: @ 858DE38 - .incbin "graphics/unknown/858E5D8/4.4bpp" - - .align 2 -gSpriteImage_858DEB8:: @ 858DEB8 - .incbin "graphics/unknown/858E5B0/0.4bpp" - - .align 2 -gSpriteImage_858DF38:: @ 858DF38 - .incbin "graphics/unknown/858E5B0/1.4bpp" - - .align 2 -gSpriteImage_858DFB8:: @ 858DFB8 - .incbin "graphics/unknown/858E5B0/2.4bpp" - - .align 2 -gSpriteImage_858E038:: @ 858E038 - .incbin "graphics/unknown/858E5B0/3.4bpp" - - .align 2 -gSpriteImage_858E0B8:: @ 858E0B8 - .incbin "graphics/unknown/858E5B0/4.4bpp" - - .align 2 -gSpriteImage_858E138:: @ 858E138 - .incbin "graphics/unknown/858E5B0/5.4bpp" - - .align 2 -gFieldEffectObjectPalette8:: @ 858E1B8 - .incbin "graphics/event_objects/palettes/field_effect_object_palette_08.gbapal" - - .align 2 -gSpriteImage_858E1D8:: @ 858E1D8 - .incbin "graphics/unknown/858E674/0.4bpp" - - .align 2 -gSpriteImage_858E2D8:: @ 858E2D8 - .incbin "graphics/unknown/858E674/1.4bpp" - - .align 2 -gSpriteImage_858E3D8:: @ 858E3D8 - .incbin "graphics/unknown/858E674/2.4bpp" - - .align 2 -gOamData_858E4D8:: @ 858E4D8 - .2byte 0x0000, 0x4000, 0x0800, 0x0000 - - .align 2 -gSpriteAnim_858E4E0:: @ 858E4E0 - .2byte 0x0000, 0x0008, 0x0001, 0x0008, 0x0002, 0x0008, 0x0003, 0x0008, 0x0004, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858E4F8:: @ 858E4F8 - .2byte 0x0000, 0x0008, 0x0001, 0x0008, 0x0002, 0x0008, 0x0003, 0x0008, 0x0004, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858E510:: @ 858E510 - .2byte 0x0004, 0x0008, 0x0003, 0x0008, 0x0002, 0x0008, 0x0001, 0x0008, 0x0000, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858E528:: @ 858E528 - .2byte 0x0000, 0x0048, 0x0001, 0x0048, 0x0002, 0x0048, 0x0003, 0x0048, 0x0004, 0x0048, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858E540:: @ 858E540 - .2byte 0x0004, 0x0048, 0x0003, 0x0048, 0x0002, 0x0048, 0x0001, 0x0048, 0x0000, 0x0048, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858E558:: @ 858E558 - .2byte 0x0000, 0x0008, 0x0001, 0x0008, 0x0002, 0x0008, 0x0003, 0x0008, 0x0004, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_858E570:: @ 858E570 - .4byte gSpriteAnim_858E4E0 - - .align 2 -gSpriteAnimTable_858E574:: @ 858E574 - .4byte gSpriteAnim_858E4F8 - .4byte gSpriteAnim_858E510 - .4byte gSpriteAnim_858E528 - .4byte gSpriteAnim_858E540 - - .align 2 -gSpriteAnimTable_858E584:: @ 858E584 - .4byte gSpriteAnim_858E558 - - .align 2 -gUnknown_858E588:: @ 858E588 - obj_frame_tiles gSpriteImage_858D978, 0x0080 - obj_frame_tiles gSpriteImage_858D9F8, 0x0080 - obj_frame_tiles gSpriteImage_858DA78, 0x0080 - obj_frame_tiles gSpriteImage_858DAF8, 0x0080 - obj_frame_tiles gSpriteImage_858DB78, 0x0080 - - .align 2 -gUnknown_858E5B0:: @ 858E5B0 - obj_frame_tiles gSpriteImage_858DEB8, 0x0080 - obj_frame_tiles gSpriteImage_858DF38, 0x0080 - obj_frame_tiles gSpriteImage_858DFB8, 0x0080 - obj_frame_tiles gSpriteImage_858E038, 0x0080 - obj_frame_tiles gSpriteImage_858E0B8, 0x0080 - - .align 2 -gUnknown_858E5D8:: @ 858E5D8 - obj_frame_tiles gSpriteImage_858DC38, 0x0080 - obj_frame_tiles gSpriteImage_858DCB8, 0x0080 - obj_frame_tiles gSpriteImage_858DD38, 0x0080 - obj_frame_tiles gSpriteImage_858DDB8, 0x0080 - obj_frame_tiles gSpriteImage_858DE38, 0x0080 - - .align 2 -gUnknown_0858E600:: @ 858E600 - spr_template 0xffff, 0x1003, gOamData_858E4D8, gSpriteAnimTable_858E570, gUnknown_858E588, gDummySpriteAffineAnimTable, sub_80FA18C - - .align 2 -gUnknown_0858E618:: @ 858E618 - spr_template 0xffff, 0x1008, gOamData_858E4D8, gSpriteAnimTable_858E574, gUnknown_858E5B0, gDummySpriteAffineAnimTable, sub_80FA2D8 - - .align 2 -gUnknown_0858E630:: @ 858E630 - spr_template 0xffff, 0x1008, gOamData_858E4D8, gSpriteAnimTable_858E584, gUnknown_858E5D8, gDummySpriteAffineAnimTable, sub_80FA3FC - - .align 2 -gFieldEffectObjectPaletteInfo7:: @ 858E648 - obj_pal gFieldEffectObjectPalette7, 0x1003 - - .align 2 -gFieldEffectObjectPaletteInfo8:: @ 858E650 - obj_pal gFieldEffectObjectPalette8, 0x1008 - - .align 2 -gOamData_858E658:: @ 858E658 - .2byte 0x8000, 0x8000, 0x0800, 0x0000 - - .align 2 -gSpriteAnim_858E660:: @ 858E660 - .2byte 0x0000, 0x0006, 0x0001, 0x0006, 0x0002, 0x0006, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_858E670:: @ 858E670 - .4byte gSpriteAnim_858E660 - - .align 2 -gUnknown_0858E674:: @ 858E674 - obj_frame_tiles gSpriteImage_858E1D8, 0x0100 - obj_frame_tiles gSpriteImage_858E2D8, 0x0100 - obj_frame_tiles gSpriteImage_858E3D8, 0x0100 - - .align 2 -gUnknown_0858E68C:: @ 858E68C - spr_template 0xffff, 0x100e, gOamData_858E658, gSpriteAnimTable_858E670, gUnknown_0858E674, gDummySpriteAffineAnimTable, door_restore_tilemap - - .align 2 -@ This uses one of the secret base palettes, so there is no -@ "field_effect_object_palette_09.pal" file. -gFieldEffectObjectPaletteInfo9:: @ 858E6A4 - obj_pal gTilesetPalettes_SecretBase + 5 * 0x20, 0x100E - - .align 2 -gSpriteImage_858E6AC:: @ 858E6AC - .incbin "graphics/unknown/858E84C/0.4bpp" - - .align 2 -gSpriteImage_858E72C:: @ 858E72C - .incbin "graphics/unknown/858E84C/1.4bpp" - - .align 2 -gSpriteImage_858E7AC:: @ 858E7AC - .incbin "graphics/unknown/858E84C/2.4bpp" - - .align 2 -gUnknown_0858E82C:: @ 858E82C - .incbin "graphics/unknown/unknown_58E82C.gbapal" - - .align 2 -gUnknown_0858E84C:: @ 858E84C - obj_frame_tiles gSpriteImage_858E6AC, 0x0080 - obj_frame_tiles gSpriteImage_858E72C, 0x0080 - obj_frame_tiles gSpriteImage_858E7AC, 0x0080 - - .align 2 -gUnknown_0858E864:: @ 858E864 - obj_pal gUnknown_0858E82C, 0x1000 - - .align 2 -gSpriteAnim_858E86C:: @ 858E86C - .2byte 0x0000, 0x001e, 0x0001, 0x001e, 0x0002, 0x001e, 0xfffe, 0x0000 - - .align 2 -gSpriteAnimTable_858E87C:: @ 858E87C - .4byte gSpriteAnim_858E86C - - .align 2 -gUnknown_0858E880:: @ 858E880 - spr_template 0xffff, 0x1000, gEventObjectBaseOam_32x8, gSpriteAnimTable_858E87C, gUnknown_0858E84C, gDummySpriteAffineAnimTable, SpriteCallbackDummy - diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index eab655877..81de41aaa 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -118,7 +118,7 @@ gFieldEffectScript_GroundImpactDust:: @ 82DBB28 field_eff_end gFieldEffectScript_Unknown11:: @ 82DBB32 - field_eff_callnative oei_sweet_scent + field_eff_callnative FldEff_UseSecretPowerCave field_eff_end gFieldEffectScript_BikeHopTallGrass:: @ 82DBB38 @@ -179,11 +179,11 @@ gFieldEffectScript_Unknown25:: @ 82DBBB6 field_eff_end gFieldEffectScript_Unknown26:: @ 82DBBC5 - field_eff_callnative sub_80FA208 + field_eff_callnative FldEff_UseSecretPowerTree field_eff_end gFieldEffectScript_Unknown27:: @ 82DBBCB - field_eff_callnative sub_80FA36C + field_eff_callnative FldEff_UseSecretPowerShrub field_eff_end gFieldEffectScript_TreeDisguise:: @ 82DBBD1 @@ -264,11 +264,11 @@ gFieldEffectScript_HeartIcon:: @ 82DBC56 field_eff_end gFieldEffectScript_Unknown47:: @ 82DBC60 - field_eff_callnative sub_80FA6FC + field_eff_callnative FldEff_NopA6FC field_eff_end gFieldEffectScript_Unknown48:: @ 82DBC66 - field_eff_callnative sub_80FA700 + field_eff_callnative FldEff_NopA700 field_eff_end gFieldEffectScript_JumpOutOfAsh:: @ 82DBC6C @@ -284,7 +284,7 @@ gFieldEffectScript_Unknown51:: @ 82DBC80 field_eff_end gFieldEffectScript_Unknown52:: @ 82DBC86 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, sub_80FAA7C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo9, FldEff_SandPillar field_eff_end gFieldEffectScript_Bubbles:: @ 82DBC90 @@ -296,15 +296,15 @@ gFieldEffectScript_Unknown54:: @ 82DBC9A field_eff_end gFieldEffectScript_Unknown55:: @ 82DBCA4 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, sub_80FA13C + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo7, FldEff_SecretPowerCave field_eff_end gFieldEffectScript_Unknown56:: @ 82DBCAE - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, sub_80FA248 + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerTree field_eff_end gFieldEffectScript_Unknown57:: @ 82DBCB8 - field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, sub_80FA3AC + field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo8, FldEff_SecretPowerShrub field_eff_end gFieldEffectScript_Unknown58:: @ 82DBCC2 @@ -320,7 +320,7 @@ gFieldEffectScript_Unknown60:: @ 82DBCD2 field_eff_end gFieldEffectScript_Unknown61:: @ 82DBCD8 - field_eff_callnative sub_80FA458 + field_eff_callnative FldEff_SecretBasePCTurnOn field_eff_end gFieldEffectScript_Unknown62:: @ 82DBCDE diff --git a/data/maps/BattleFrontier_OutsideEast/scripts.inc b/data/maps/BattleFrontier_OutsideEast/scripts.inc index fe034442e..bc154052d 100644 --- a/data/maps/BattleFrontier_OutsideEast/scripts.inc +++ b/data/maps/BattleFrontier_OutsideEast/scripts.inc @@ -117,7 +117,7 @@ BattleFrontier_OutsideEast_EventScript_242CEA:: @ 8242CEA BattleFrontier_OutsideEast_EventScript_242CFC:: @ 8242CFC lock faceplayer - special sub_80FAFF8 + special DoWateringBerryTreeAnim waitstate waitse playse 269 diff --git a/data/party_menu.s b/data/party_menu.s index 011a73106..fd1bd7948 100644 --- a/data/party_menu.s +++ b/data/party_menu.s @@ -441,7 +441,7 @@ gUnknown_08615D9C:: @ 8615D9C .4byte hm_prepare_waterfall, 0x0000000d .4byte SetUpFieldMove_Teleport, 0x0000000d .4byte SetUpFieldMove_Dig, 0x0000000d - .4byte sub_80FA004, 0x0000000d + .4byte SetUpFieldMove_SecretPower, 0x0000000d .4byte SetUpFieldMove_SoftBoiled, 0x00000010 .4byte SetUpFieldMove_SoftBoiled, 0x00000010 .4byte SetUpFieldMove_SweetScent, 0x0000000d diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index f4208afd0..238541ee6 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -174,7 +174,7 @@ Route102_EventScript_2744C4:: @ 82744C4 message Route102_Text_274710 waitmessage special EventObjectInteractionWaterBerryTree - special sub_80FAFF8 + special DoWateringBerryTreeAnim waitstate message Route102_Text_274723 waitmessage diff --git a/data/specials.inc b/data/specials.inc index 495a5a980..3ae1a14f8 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -34,7 +34,7 @@ gSpecials:: @ 81DBA64 def_special sub_8129708 def_special sub_80E91F8 def_special sub_80EA30C - def_special sub_80FA57C + def_special DoSecretBasePCTurnOffEffect def_special sub_80E6BE8 def_special sub_80B2DA4 def_special sub_80B2E4C @@ -105,7 +105,7 @@ gSpecials:: @ 81DBA64 def_special GiveMonArtistRibbon def_special sub_80B3000 def_special SaveGame - def_special sub_80FAFF8 + def_special DoWateringBerryTreeAnim def_special easy_chat_input_maybe def_special sub_811EECC def_special ScrSpecial_GetCurrentMauvilleMan @@ -317,7 +317,7 @@ gSpecials:: @ 81DBA64 def_special ScriptCheckFreePokemonStorageSpace def_special DoSealedChamberShakingEffect1 def_special sub_8139B60 - def_special sub_80FAC78 + def_special GetShieldToyTVDecorationInfo def_special IsPokerusInParty def_special SetSootopolisGymCrackedIceMetatiles def_special sub_8139560 diff --git a/include/constants/vars.h b/include/constants/vars.h index 9854ec5a2..faffe7c70 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -100,7 +100,7 @@ #define VAR_0x4051 0x4051 #define VAR_0x4052 0x4052 #define VAR_0x4053 0x4053 -#define VAR_0x4054 0x4054 +#define VAR_CURRENT_SECRET_BASE 0x4054 #define VAR_0x4055 0x4055 #define VAR_0x4056 0x4056 #define VAR_0x4057 0x4057 diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index adb51f889..3aedec5de 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -58,5 +58,7 @@ u8 GetJumpSpecialMovementAction(u32); bool8 PartyHasMonWithSurf(void); bool8 IsPlayerFacingSurfableFishableWater(void); bool8 IsPlayerSurfingNorth(void); +void sub_808C228(u8 direction); +u8 sub_808BCD0(void); #endif // GUARD_FIELD_PLAYER_AVATAR_H diff --git a/include/fldeff_80F9BCC.h b/include/fldeff_80F9BCC.h deleted file mode 100644 index 027bb4273..000000000 --- a/include/fldeff_80F9BCC.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef GUARD_FLDEFF_80F9BCC_H -#define GUARD_FLDEFF_80F9BCC_H - -// Exported type declarations - -// Exported RAM declarations - -// Exported ROM declarations - -void sub_80FA5E4(s16 id, s16 x, s16 y); -void sub_80FA794(s16 x, s16 y); -void CreateRecordMixingSprite(void); -void DestroyRecordMixingSprite(void); -void FldeffPoison_Start(void); -void sub_80FA970(s16); -void sub_80FA9D0(void); -bool8 sub_80FADE4(u16, u8); - -#endif //GUARD_FLDEFF_80F9BCC_H diff --git a/include/fldeff_misc.h b/include/fldeff_misc.h new file mode 100644 index 000000000..954ecbb5c --- /dev/null +++ b/include/fldeff_misc.h @@ -0,0 +1,24 @@ +#ifndef GUARD_FLDEFF_MISC_H +#define GUARD_FLDEFF_MISC_H + +void PopSecretBaseBalloon(s16 id, s16 x, s16 y); +void ShatterSecretBaseBreakableDoor(s16 x, s16 y); +u8 CreateRecordMixingSprite(void); +void DestroyRecordMixingSprite(void); +void FldEffPoison_Start(void); +void PlaySecretBaseMusicNoteMatSound(s16 metatileId); +void DoSecretBaseGlitterMatSparkle(void); +bool8 sub_80FADE4(u16, u8); + +extern struct MapPosition gPlayerFacingPosition; +extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; + +extern u8 EventScript_275A86[]; +extern u8 EventScript_275ADF[]; +extern u8 EventScript_275B38[]; + +extern const struct OamData gEventObjectBaseOam_32x8; + +extern const u16 gTilesetPalettes_SecretBase[][16]; + +#endif //GUARD_FLDEFF_MISC_H diff --git a/include/secret_base.h b/include/secret_base.h index 4fa0d0c4a..ac15357e3 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -23,4 +23,12 @@ void sub_80EB9E0(void); void sub_80EBB28(void); void sub_80E9668(const struct MapPosition *position, const struct MapEvents *events); +// SetCurrentSecretBaseFromPosition +void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events); +// SetCurrentSecretBaseVar +void sub_80E8B6C(void); +void sub_80E8BC8(void); +void sub_80E8D4C(void); +void EnableBothScriptContexts(void); + #endif //GUARD_SECRET_BASE_H diff --git a/include/strings.h b/include/strings.h index 5af8b63ff..a6f61f603 100644 --- a/include/strings.h +++ b/include/strings.h @@ -140,6 +140,8 @@ extern const u8 gText_Cancel4[]; extern const u8 gText_IsThisTheCorrectTime[]; extern const u8 gText_PkmnFainted3[]; extern const u8 gText_Coins[]; +extern const u8 gText_Silver[]; +extern const u8 gText_Gold[]; extern const u8 gText_Var1AteTheVar2[]; extern const u8 gText_Var1HappilyAteVar2[]; diff --git a/ld_script.txt b/ld_script.txt index 453c68a65..73fbc76bc 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -151,7 +151,7 @@ SECTIONS { src/script_pokemon_util_80F87D8.o(.text); src/field_poison.o(.text); src/pokemon_size_record.o(.text); - asm/fldeff_80F9BCC.o(.text); + src/fldeff_misc.o(.text); src/field_special_scene.o(.text); src/rotating_gate.o(.text); src/safari_zone.o(.text); @@ -480,7 +480,7 @@ SECTIONS { data/contest_link_80F57C4.o(.rodata); src/script_pokemon_util_80F87D8.o(.rodata); src/pokemon_size_record.o(.rodata) - data/field_effect_misc.o(.rodata); + src/fldeff_misc.o(.rodata); src/field_special_scene.o(.rodata); src/rotating_gate.o(.rodata); src/item_use.o(.rodata); diff --git a/src/battle_setup.c b/src/battle_setup.c index 5377f39b5..83ced1b7c 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -57,7 +57,7 @@ struct TrainerBattleParameter }; extern bool32 InTrainerHill(void); -extern bool32 FieldPoisonEffectIsRunning(void); +extern bool32 FldEffPoison_IsActive(void); extern void RestartWildEncounterImmunitySteps(void); extern void ClearPoisonStepCounter(void); extern void sub_81BE72C(void); @@ -338,7 +338,7 @@ static void Task_BattleStart(u8 taskId) switch (tState) { case 0: - if (!FieldPoisonEffectIsRunning()) // is poison not active? + if (!FldEffPoison_IsActive()) // is poison not active? { BattleTransition_StartOnField(tTransition); sub_81BE72C(); diff --git a/src/battle_util2.c b/src/battle_util2.c index a9891814c..70c722298 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -42,7 +42,7 @@ void AllocateBattleResources(void) if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) { - u16 currSecretBaseId = VarGet(VAR_0x4054); + u16 currSecretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); CreateSecretBaseEnemyParty(&gSaveBlock1Ptr->secretBases[currSecretBaseId]); } } diff --git a/src/data/graphics/berry_fix.h b/src/data/graphics/berry_fix.h index aede748a4..07e2cbf51 100644 --- a/src/data/graphics/berry_fix.h +++ b/src/data/graphics/berry_fix.h @@ -20,4 +20,4 @@ const u32 gBerryFixGbaTransferError_Tilemap[] = INCBIN_U32("graphics/berry_fix/g const u16 gBerryFixWindow_Pal[] = INCBIN_U16("graphics/berry_fix/window.gbapal"); const u32 gBerryFixWindow_Gfx[] = INCBIN_U32("graphics/berry_fix/window.4bpp.lz"); -const u32 gBerryFixWindow_Tilemap[] = INCBIN_U32("graphics/berry_fix/window.bin.lz"); \ No newline at end of file +const u32 gBerryFixWindow_Tilemap[] = INCBIN_U32("graphics/berry_fix/window.bin.lz"); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 829d72c34..3774ef2b3 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -12,7 +12,7 @@ #include "field_poison.h" #include "field_screen_effect.h" #include "field_specials.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "item_menu.h" #include "link.h" #include "metatile_behavior.h" @@ -521,13 +521,13 @@ static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior) } else if (MetatileBehavior_IsSecretBaseGlitterMat(metatileBehavior) == TRUE) { - sub_80FA9D0(); + DoSecretBaseGlitterMatSparkle(); return FALSE; } else if (MetatileBehavior_IsSecretBaseSoundMat(metatileBehavior) == TRUE) { PlayerGetDestCoords(&x, &y); - sub_80FA970(MapGridGetMetatileIdAt(x, y)); + PlaySecretBaseMusicNoteMatSound(MapGridGetMetatileIdAt(x, y)); return FALSE; } return FALSE; diff --git a/src/field_poison.c b/src/field_poison.c index 02f37f69f..7aaab902f 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -4,7 +4,7 @@ #include "event_data.h" #include "field_message_box.h" #include "field_poison.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "frontier_util.h" #include "party_menu.h" #include "pokenav.h" @@ -136,7 +136,7 @@ s32 DoPoisonFieldEffect(void) } if (numFainted != 0 || numPoisoned != 0) { - FldeffPoison_Start(); + FldEffPoison_Start(); } if (numFainted != 0) { diff --git a/src/fieldmap.c b/src/fieldmap.c index 7e1fc03eb..11161b8df 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -1,7 +1,7 @@ #include "global.h" #include "bg.h" #include "fieldmap.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "fldeff_cut.h" #include "fldeff_groundshake.h" #include "frontier_util.h" diff --git a/src/fire.c b/src/fire.c index 2d8a0fbe5..5f501a340 100644 --- a/src/fire.c +++ b/src/fire.c @@ -1318,4 +1318,4 @@ void sub_810A094(u8 taskId) gSprites[spriteId].pos2.y = 0; DestroyAnimVisualTask(taskId); } -} \ No newline at end of file +} diff --git a/src/fldeff_groundshake.c b/src/fldeff_groundshake.c index 866606a06..44ffd60f9 100644 --- a/src/fldeff_groundshake.c +++ b/src/fldeff_groundshake.c @@ -73,7 +73,13 @@ static const struct OamData gUnknown_08617E2C = }; static const struct SpriteTemplate gUnknown_08617E34 = { - 0x0FA0, 0xFFFF, &gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8 + .tileTag = 0x0FA0, + .paletteTag = 0xFFFF, + .oam = &gUnknown_08617E2C, + .anims = gSpriteAnimTable_8617E28, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81BEAD8 }; static const union AnimCmd gSpriteAnim_8617E4C[] = @@ -105,7 +111,13 @@ static const struct OamData gSpriteAnim_8617E58 = }; static const struct SpriteTemplate gUnknown_08617E60 = { - 0x0FA0, 0xFFFF, &gSpriteAnim_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8 + .tileTag = 0x0FA0, + .paletteTag = 0xFFFF, + .oam = &gSpriteAnim_8617E58, + .anims = gSpriteAnim_8617E54, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81BEAD8 }; // ewram diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c new file mode 100644 index 000000000..79f0a8ede --- /dev/null +++ b/src/fldeff_misc.c @@ -0,0 +1,1525 @@ +#include "global.h" +#include "gpu_regs.h" +#include "palette.h" +#include "script.h" +#include "sound.h" +#include "task.h" +#include "rom6.h" +#include "strings.h" +#include "party_menu.h" +#include "fieldmap.h" +#include "field_effect.h" +#include "field_camera.h" +#include "field_player_avatar.h" +#include "secret_base.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "metatile_behavior.h" +#include "string_util.h" +#include "constants/field_effects.h" +#include "constants/metatile_behaviors.h" +#include "constants/songs.h" +#include "constants/vars.h" +#include "fldeff_misc.h" + +void sub_80F9C90(u8); +void sub_80F9DFC(u8); + +void Task_SecretBasePCTurnOn(u8); + +void Task_PopSecretBaseBalloon(u8); +void DoBalloonSoundEffect(s16); + +void Task_WateringBerryTreeAnim_1(u8); +void Task_WateringBerryTreeAnim_2(u8); +void Task_WateringBerryTreeAnim_3(u8); + +void sub_80F9C44(TaskFunc, u16, u16, u8); + +void FieldCallback_SecretBaseCave(void); +static void CaveEntranceSpriteCallback1(struct Sprite *); +static void CaveEntranceSpriteCallback2(struct Sprite *); +static void CaveEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseCaveFieldEffect(void); + +void FieldCallback_SecretBaseTree(void); +static void TreeEntranceSpriteCallback1(struct Sprite *); +static void TreeEntranceSpriteCallback2(struct Sprite *); +static void TreeEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseTreeFieldEffect(void); + +void FieldCallback_SecretBaseShrub(void); +static void ShrubEntranceSpriteCallback1(struct Sprite *); +static void ShrubEntranceSpriteCallback2(struct Sprite *); +static void ShrubEntranceSpriteCallbackEnd(struct Sprite *); +static void StartSecretBaseShrubFieldEffect(void); + +void SpriteCB_SandPillar_0(struct Sprite *); +void SpriteCB_SandPillar_1(struct Sprite *); +void SpriteCB_SandPillar_2(struct Sprite *); + +const u8 gSpriteImage_858D978[] = INCBIN_U8("graphics/unknown/858E588/0.4bpp"); +const u8 gSpriteImage_858D9F8[] = INCBIN_U8("graphics/unknown/858E588/1.4bpp"); +const u8 gSpriteImage_858DA78[] = INCBIN_U8("graphics/unknown/858E588/2.4bpp"); +const u8 gSpriteImage_858DAF8[] = INCBIN_U8("graphics/unknown/858E588/3.4bpp"); +const u8 gSpriteImage_858DB78[] = INCBIN_U8("graphics/unknown/858E588/4.4bpp"); + +const u8 gUnusedEmptySpace_858DBF8[32] = {0}; + +const u16 gFieldEffectObjectPalette7[] = INCBIN_U16("graphics/event_objects/palettes/field_effect_object_palette_07.gbapal"); +const u8 gSpriteImage_858DC38[] = INCBIN_U8("graphics/unknown/858E5D8/0.4bpp"); +const u8 gSpriteImage_858DCB8[] = INCBIN_U8("graphics/unknown/858E5D8/1.4bpp"); +const u8 gSpriteImage_858DD38[] = INCBIN_U8("graphics/unknown/858E5D8/2.4bpp"); +const u8 gSpriteImage_858DDB8[] = INCBIN_U8("graphics/unknown/858E5D8/3.4bpp"); +const u8 gSpriteImage_858DE38[] = INCBIN_U8("graphics/unknown/858E5D8/4.4bpp"); +const u8 gSpriteImage_858DEB8[] = INCBIN_U8("graphics/unknown/858E5B0/0.4bpp"); +const u8 gSpriteImage_858DF38[] = INCBIN_U8("graphics/unknown/858E5B0/1.4bpp"); +const u8 gSpriteImage_858DFB8[] = INCBIN_U8("graphics/unknown/858E5B0/2.4bpp"); +const u8 gSpriteImage_858E038[] = INCBIN_U8("graphics/unknown/858E5B0/3.4bpp"); +const u8 gSpriteImage_858E0B8[] = INCBIN_U8("graphics/unknown/858E5B0/4.4bpp"); +const u8 gSpriteImage_858E138[] = INCBIN_U8("graphics/unknown/858E5B0/5.4bpp"); +const u16 gFieldEffectObjectPalette8[] = INCBIN_U16("graphics/event_objects/palettes/field_effect_object_palette_08.gbapal"); +const u8 gSpriteImage_858E1D8[] = INCBIN_U8("graphics/unknown/858E674/0.4bpp"); +const u8 gSpriteImage_858E2D8[] = INCBIN_U8("graphics/unknown/858E674/1.4bpp"); +const u8 gSpriteImage_858E3D8[] = INCBIN_U8("graphics/unknown/858E674/2.4bpp"); + +const struct OamData gOamData_858E4D8 = +{ + .y = 0, + .x = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 2, +}; + +const union AnimCmd gSpriteAnim_858E4E0[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(1, 8), + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(3, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_858E4F8[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(1, 8), + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(3, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_858E510[] = +{ + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(3, 8), + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(1, 8), + ANIMCMD_FRAME(0, 8), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_858E528[] = +{ + ANIMCMD_FRAME(0, 8, .hFlip = TRUE), + ANIMCMD_FRAME(1, 8, .hFlip = TRUE), + ANIMCMD_FRAME(2, 8, .hFlip = TRUE), + ANIMCMD_FRAME(3, 8, .hFlip = TRUE), + ANIMCMD_FRAME(4, 8, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_858E540[] = +{ + ANIMCMD_FRAME(4, 8, .hFlip = TRUE), + ANIMCMD_FRAME(3, 8, .hFlip = TRUE), + ANIMCMD_FRAME(2, 8, .hFlip = TRUE), + ANIMCMD_FRAME(1, 8, .hFlip = TRUE), + ANIMCMD_FRAME(0, 8, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_858E558[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(1, 8), + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(3, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_858E570[] = +{ + gSpriteAnim_858E4E0, +}; + +const union AnimCmd *const gSpriteAnimTable_858E574[] = +{ + gSpriteAnim_858E4F8, + gSpriteAnim_858E510, + gSpriteAnim_858E528, + gSpriteAnim_858E540, +}; + +const union AnimCmd *const gSpriteAnimTable_858E584[] = +{ + gSpriteAnim_858E558, +}; + +const struct SpriteFrameImage gUnknown_858E588[] = +{ + {gSpriteImage_858D978, 0x80}, + {gSpriteImage_858D9F8, 0x80}, + {gSpriteImage_858DA78, 0x80}, + {gSpriteImage_858DAF8, 0x80}, + {gSpriteImage_858DB78, 0x80}, +}; + +const struct SpriteFrameImage gUnknown_858E5B0[] = +{ + {gSpriteImage_858DEB8, 0x80}, + {gSpriteImage_858DF38, 0x80}, + {gSpriteImage_858DFB8, 0x80}, + {gSpriteImage_858E038, 0x80}, + {gSpriteImage_858E0B8, 0x80}, +}; + +const struct SpriteFrameImage gUnknown_858E5D8[] = +{ + {gSpriteImage_858DC38, 0x80}, + {gSpriteImage_858DCB8, 0x80}, + {gSpriteImage_858DD38, 0x80}, + {gSpriteImage_858DDB8, 0x80}, + {gSpriteImage_858DE38, 0x80}, +}; + +const struct SpriteTemplate gUnknown_0858E600 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x1003, + .oam = &gOamData_858E4D8, + .anims = gSpriteAnimTable_858E570, + .images = gUnknown_858E588, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = CaveEntranceSpriteCallback1, +}; + +const struct SpriteTemplate gUnknown_0858E618 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x1008, + .oam = &gOamData_858E4D8, + .anims = gSpriteAnimTable_858E574, + .images = gUnknown_858E5B0, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = TreeEntranceSpriteCallback1, +}; + +const struct SpriteTemplate gUnknown_0858E630 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x1008, + .oam = &gOamData_858E4D8, + .anims = gSpriteAnimTable_858E584, + .images = gUnknown_858E5D8, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = ShrubEntranceSpriteCallback1, +}; + +const struct SpritePalette gFieldEffectObjectPaletteInfo7 = {gFieldEffectObjectPalette7, 0x1003}; +const struct SpritePalette gFieldEffectObjectPaletteInfo8 = {gFieldEffectObjectPalette8, 0x1008}; + +const struct OamData gOamData_858E658 = +{ + .x = 0, + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, + .shape = ST_OAM_V_RECTANGLE, + .size = 2, + .priority = 2, +}; + +const union AnimCmd gSpriteAnim_858E660[] = +{ + ANIMCMD_FRAME(0, 6), + ANIMCMD_FRAME(1, 6), + ANIMCMD_FRAME(2, 6), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_858E670[] = +{ + gSpriteAnim_858E660, +}; + +const struct SpriteFrameImage gUnknown_0858E674[] = +{ + {gSpriteImage_858E1D8, 0x100}, + {gSpriteImage_858E2D8, 0x100}, + {gSpriteImage_858E3D8, 0x100}, +}; + +const struct SpriteTemplate gUnknown_0858E68C = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x100E, + .oam = &gOamData_858E658, + .anims = gSpriteAnimTable_858E670, + .images = gUnknown_0858E674, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SandPillar_0, +}; + +// This uses one of the secret base palettes, so there is no "field_effect_object_palette_09.pal" file. +const struct SpritePalette gFieldEffectObjectPaletteInfo9 = {gTilesetPalettes_SecretBase[5], 0x100E}; + +static const u8 gSpriteImage_858E6AC[] = INCBIN_U8("graphics/unknown/858E84C/0.4bpp"); +static const u8 gSpriteImage_858E72C[] = INCBIN_U8("graphics/unknown/858E84C/1.4bpp"); +static const u8 gSpriteImage_858E7AC[] = INCBIN_U8("graphics/unknown/858E84C/2.4bpp"); +static const u16 gUnknown_0858E82C[] = INCBIN_U16("graphics/unknown/unknown_58E82C.gbapal"); + +static const struct SpriteFrameImage gUnknown_0858E84C[] = +{ + {gSpriteImage_858E6AC, sizeof(gSpriteImage_858E6AC)}, + {gSpriteImage_858E72C, sizeof(gSpriteImage_858E72C)}, + {gSpriteImage_858E7AC, sizeof(gSpriteImage_858E7AC)}, +}; + +static const struct SpritePalette gUnknown_0858E864 = {gUnknown_0858E82C, 0x1000}; + +static const union AnimCmd gSpriteAnim_858E86C[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_FRAME(1, 30), + ANIMCMD_FRAME(2, 30), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd *const gSpriteAnimTable_858E87C[] = +{ + gSpriteAnim_858E86C, +}; + +static const struct SpriteTemplate gUnknown_0858E880 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x1000, + .oam = &gEventObjectBaseOam_32x8, + .anims = gSpriteAnimTable_858E87C, + .images = gUnknown_0858E84C, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +void sub_80F9BCC(u16 a0, u16 a1, u8 a2) +{ + sub_80F9C44(sub_80F9C90, a0, a1, a2); +} + +void sub_80F9BF4(u16 a0, u16 a1, u8 a2) +{ + sub_80F9C44(sub_80F9DFC, a0, a1, a2); +} + +bool8 sub_80F9C1C(void) +{ + return FuncIsActiveTask(sub_80F9C90); +} + +bool8 sub_80F9C30(void) +{ + return FuncIsActiveTask(sub_80F9DFC); +} + +void sub_80F9C44(void (*taskfunc) (u8), u16 a1, u16 a2, u8 a3) +{ + u8 taskId = CreateTask(taskfunc, a3); + + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = a1 == 0 ? 16 : a1; + gTasks[taskId].data[2] = a1 == 0 ? 20 : a1; + gTasks[taskId].func(taskId); +} + +#ifdef NONMATCHING +void sub_80F9C90(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch(task->data[0]) + { + case 0: + task->data[3] = 0x78; + task->data[4] = 0x78; + task->data[5] = 0x50; + task->data[6] = 0x51; + + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[5], task->data[6])); + SetGpuReg(REG_OFFSET_WININ, 0x3F); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + break; + case 1: + task->data[7] = GetGpuReg(REG_OFFSET_BLDCNT); + task->data[8] = GetGpuReg(REG_OFFSET_BLDY); + + SetGpuReg(REG_OFFSET_BLDCNT, 0xBF); + SetGpuReg(REG_OFFSET_BLDY, 0x10); + + break; + case 2: + task->data[3] -= task->data[1]; + task->data[4] += task->data[1]; + + if (task->data[3] < 1 || task->data[4] > 0xEF) + { + task->data[3] = 0; + task->data[4] = 0xF0; + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]); + BlendPalettes(0xFFFFFFFF, 0, 0); + gPlttBufferFaded[0] = 0; + } + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + + if (task->data[3] != 0) + return; + break; + case 3: + task->data[5] -= task->data[2]; + task->data[6] += task->data[2]; + + if (task->data[5] < 1 || task->data[2] > 0x9F) + { + task->data[5] = 0; + task->data[6] = 0xA0; + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + } + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); + + if (task->data[5] != 0) + return; + break; + default: + SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]); + DestroyTask(taskId); + return; + } + task->data[0] += 1; +} +#else +NAKED +void sub_80F9C90(u8 taskId) +{ + asm_unified("\tpush {r4,r5,lr}\n" + "\tlsls r0, 24\n" + "\tlsrs r5, r0, 24\n" + "\tlsls r0, r5, 2\n" + "\tadds r0, r5\n" + "\tlsls r0, 3\n" + "\tldr r1, =gTasks\n" + "\tadds r4, r0, r1\n" + "\tmovs r1, 0x8\n" + "\tldrsh r0, [r4, r1]\n" + "\tcmp r0, 0x1\n" + "\tbeq _080F9D10\n" + "\tcmp r0, 0x1\n" + "\tbgt _080F9CB8\n" + "\tcmp r0, 0\n" + "\tbeq _080F9CC2\n" + "\tb _080F9DDE\n" + "\t.pool\n" + "_080F9CB8:\n" + "\tcmp r0, 0x2\n" + "\tbeq _080F9D32\n" + "\tcmp r0, 0x3\n" + "\tbeq _080F9D94\n" + "\tb _080F9DDE\n" + "_080F9CC2:\n" + "\tmovs r0, 0x78\n" + "\tstrh r0, [r4, 0xE]\n" + "\tstrh r0, [r4, 0x10]\n" + "\tmovs r0, 0x50\n" + "\tstrh r0, [r4, 0x12]\n" + "\tmovs r0, 0x51\n" + "\tstrh r0, [r4, 0x14]\n" + "\tmovs r1, 0x80\n" + "\tlsls r1, 6\n" + "\tmovs r0, 0\n" + "\tbl SetGpuRegBits\n" + "\tldrh r1, [r4, 0xE]\n" + "\tlsls r1, 8\n" + "\tldrh r0, [r4, 0x10]\n" + "\torrs r1, r0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tmovs r0, 0x40\n" + "\tbl SetGpuReg\n" + "\tldrh r1, [r4, 0x12]\n" + "\tlsls r1, 8\n" + "\tldrh r0, [r4, 0x14]\n" + "\torrs r1, r0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tmovs r0, 0x44\n" + "\tbl SetGpuReg\n" + "\tmovs r0, 0x48\n" + "\tmovs r1, 0x3F\n" + "\tbl SetGpuReg\n" + "\tmovs r0, 0x4A\n" + "\tmovs r1, 0\n" + "\tbl SetGpuReg\n" + "\tb _080F9DEE\n" + "_080F9D10:\n" + "\tmovs r0, 0x50\n" + "\tbl GetGpuReg\n" + "\tstrh r0, [r4, 0x16]\n" + "\tmovs r0, 0x54\n" + "\tbl GetGpuReg\n" + "\tstrh r0, [r4, 0x18]\n" + "\tmovs r0, 0x50\n" + "\tmovs r1, 0xBF\n" + "\tbl SetGpuReg\n" + "\tmovs r0, 0x54\n" + "\tmovs r1, 0x10\n" + "\tbl SetGpuReg\n" + "\tb _080F9DEE\n" + "_080F9D32:\n" + "\tldrh r0, [r4, 0xE]\n" + "\tldrh r1, [r4, 0xA]\n" + "\tsubs r0, r1\n" + "\tmovs r5, 0\n" + "\tstrh r0, [r4, 0xE]\n" + "\tldrh r2, [r4, 0x10]\n" + "\tadds r1, r2\n" + "\tstrh r1, [r4, 0x10]\n" + "\tlsls r0, 16\n" + "\tcmp r0, 0\n" + "\tble _080F9D50\n" + "\tlsls r0, r1, 16\n" + "\tasrs r0, 16\n" + "\tcmp r0, 0xEF\n" + "\tble _080F9D76\n" + "_080F9D50:\n" + "\tstrh r5, [r4, 0xE]\n" + "\tmovs r0, 0xF0\n" + "\tstrh r0, [r4, 0x10]\n" + "\tmovs r0, 0x54\n" + "\tmovs r1, 0\n" + "\tbl SetGpuReg\n" + "\tldrh r1, [r4, 0x16]\n" + "\tmovs r0, 0x50\n" + "\tbl SetGpuReg\n" + "\tmovs r0, 0x1\n" + "\tnegs r0, r0\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0\n" + "\tbl BlendPalettes\n" + "\tldr r0, =gPlttBufferFaded\n" + "\tstrh r5, [r0]\n" + "_080F9D76:\n" + "\tldrh r1, [r4, 0xE]\n" + "\tlsls r1, 8\n" + "\tldrh r0, [r4, 0x10]\n" + "\torrs r1, r0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tmovs r0, 0x40\n" + "\tbl SetGpuReg\n" + "\tmovs r1, 0xE\n" + "\tldrsh r0, [r4, r1]\n" + "\tb _080F9DD8\n" + "\t.pool\n" + "_080F9D94:\n" + "\tldrh r0, [r4, 0x12]\n" + "\tldrh r1, [r4, 0xC]\n" + "\tsubs r0, r1\n" + "\tstrh r0, [r4, 0x12]\n" + "\tldrh r2, [r4, 0x14]\n" + "\tadds r1, r2\n" + "\tstrh r1, [r4, 0x14]\n" + "\tlsls r0, 16\n" + "\tcmp r0, 0\n" + "\tble _080F9DB0\n" + "\tlsls r0, r1, 16\n" + "\tasrs r0, 16\n" + "\tcmp r0, 0x9F\n" + "\tble _080F9DC2\n" + "_080F9DB0:\n" + "\tmovs r0, 0\n" + "\tstrh r0, [r4, 0x12]\n" + "\tmovs r0, 0xA0\n" + "\tstrh r0, [r4, 0x14]\n" + "\tmovs r1, 0x80\n" + "\tlsls r1, 6\n" + "\tmovs r0, 0\n" + "\tbl ClearGpuRegBits\n" + "_080F9DC2:\n" + "\tldrh r1, [r4, 0x12]\n" + "\tlsls r1, 8\n" + "\tldrh r0, [r4, 0x14]\n" + "\torrs r1, r0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tmovs r0, 0x44\n" + "\tbl SetGpuReg\n" + "\tmovs r1, 0x12\n" + "\tldrsh r0, [r4, r1]\n" + "_080F9DD8:\n" + "\tcmp r0, 0\n" + "\tbne _080F9DF4\n" + "\tb _080F9DEE\n" + "_080F9DDE:\n" + "\tldrh r1, [r4, 0x16]\n" + "\tmovs r0, 0x50\n" + "\tbl SetGpuReg\n" + "\tadds r0, r5, 0\n" + "\tbl DestroyTask\n" + "\tb _080F9DF4\n" + "_080F9DEE:\n" + "\tldrh r0, [r4, 0x8]\n" + "\tadds r0, 0x1\n" + "\tstrh r0, [r4, 0x8]\n" + "_080F9DF4:\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif + +void sub_80F9DFC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + int temp = task->data[0]; + + switch (temp) + { + case 0: + gPlttBufferFaded[0] = temp; + break; + case 1: + task->data[3] = 0; + task->data[4] = 0xF0; + task->data[5] = 0; + task->data[6] = 0xA0; + + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); + SetGpuReg(REG_OFFSET_WININ, 0x3F); + SetGpuReg(REG_OFFSET_WINOUT, 0); + break; + case 2: + task->data[5] += task->data[2]; + task->data[6] -= task->data[2]; + + if (task->data[5] > 0x4F || task->data[6] < 0x52) + { + task->data[5] = 0x50; + task->data[6] = 0x51; + SetGpuReg(REG_OFFSET_BLDCNT, 0xBF); + SetGpuReg(REG_OFFSET_BLDY, 0x10); + } + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); + + if (task->data[5] != 0x50) + return; + break; + case 3: + task->data[3] += task->data[1]; + task->data[4] -= task->data[1]; + + if (task->data[3] > 0x77 || task->data[4] < 0x79) + { + task->data[3] = 0x78; + task->data[4] = 0x78; + BlendPalettes(-1, 0x10, 0); + gPlttBufferFaded[0] = 0; + } + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); + + if (task->data[3] != 0x78) + return; + break; + default: + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + DestroyTask(taskId); + return; + } + task->data[0] += 1; +} + +void SetCurrentSecretBase(void) +{ + sub_80E9608(&gPlayerFacingPosition, gMapHeader.events); + sub_80E8B6C(); +} + +void AdjustSecretPowerSpritePixelOffsets(void) +{ + if (gPlayerAvatar.flags & 0x6) + { + switch (gFieldEffectArguments[1]) + { + case DIR_SOUTH: + gFieldEffectArguments[5] = 16; + gFieldEffectArguments[6] = 40; + break; + case DIR_NORTH: + gFieldEffectArguments[5] = 16; + gFieldEffectArguments[6] = 8; + break; + case DIR_WEST: + gFieldEffectArguments[5] = -8; + gFieldEffectArguments[6] = 24; + break; + case DIR_EAST: + gFieldEffectArguments[5] = 24; + gFieldEffectArguments[6] = 24; + break; + } + } + else + { + switch (gFieldEffectArguments[1]) + { + case DIR_SOUTH: + gFieldEffectArguments[5] = 8; + gFieldEffectArguments[6] = 40; + break; + case DIR_NORTH: + gFieldEffectArguments[5] = 8; + gFieldEffectArguments[6] = 8; + break; + case DIR_WEST: + gFieldEffectArguments[5] = -8; + gFieldEffectArguments[6] = 24; + break; + case DIR_EAST: + gFieldEffectArguments[5] = 24; + gFieldEffectArguments[6] = 24; + break; + } + } +} + +bool8 SetUpFieldMove_SecretPower(void) +{ + u8 mb; + + sub_80E8BC8(); + + if (gSpecialVar_Result == 1 || GetPlayerFacingDirection() != DIR_NORTH) + return FALSE; + + GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); + mb = MapGridGetMetatileBehaviorAt(gPlayerFacingPosition.x, gPlayerFacingPosition.y); + + if (MetatileBehavior_IsSecretBaseCave(mb) == TRUE) + { + SetCurrentSecretBase(); + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = FieldCallback_SecretBaseCave; + return TRUE; + } + + if (MetatileBehavior_IsSecretBaseTree(mb) == TRUE) + { + SetCurrentSecretBase(); + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = FieldCallback_SecretBaseTree; + return TRUE; + } + + if (MetatileBehavior_IsSecretBaseShrub(mb) == TRUE) + { + SetCurrentSecretBase(); + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = FieldCallback_SecretBaseShrub; + return TRUE; + } + + return FALSE; +} + +void FieldCallback_SecretBaseCave(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + ScriptContext1_SetupScript(EventScript_275A86); +} + +bool8 FldEff_UseSecretPowerCave(void) +{ + u8 taskId = oei_task_add(); + + gTasks[taskId].data[8] = (u32)StartSecretBaseCaveFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseCaveFieldEffect; + + return FALSE; +} + +static void StartSecretBaseCaveFieldEffect(void) +{ + FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_CAVE); + FieldEffectStart(FLDEFF_SECRET_POWER_CAVE); +} + +bool8 FldEff_SecretPowerCave(void) +{ + AdjustSecretPowerSpritePixelOffsets(); + CreateSprite(&gUnknown_0858E600, + gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], + gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], + 148); + return FALSE; +} + +static void CaveEntranceSpriteCallback1(struct Sprite *sprite) +{ + PlaySE(SE_W088); + + sprite->data[0] = 0; + sprite->callback = CaveEntranceSpriteCallback2; +} + +static void CaveEntranceSpriteCallback2(struct Sprite *sprite) +{ + if (sprite->data[0] < 40) + { + sprite->data[0]++; + + if (sprite->data[0] == 20) + sub_80E8D4C(); + } + else + { + sprite->data[0] = 0; + sprite->callback = CaveEntranceSpriteCallbackEnd; + } +} + +static void CaveEntranceSpriteCallbackEnd(struct Sprite *sprite) +{ + FieldEffectStop(sprite, FLDEFF_SECRET_POWER_CAVE); + EnableBothScriptContexts(); +} + +void FieldCallback_SecretBaseTree(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + ScriptContext1_SetupScript(EventScript_275ADF); +} + +bool8 FldEff_UseSecretPowerTree(void) +{ + u8 taskId = oei_task_add(); + + gTasks[taskId].data[8] = (u32)StartSecretBaseTreeFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseTreeFieldEffect; + + return FALSE; +} + +static void StartSecretBaseTreeFieldEffect(void) +{ + FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_TREE); + FieldEffectStart(FLDEFF_SECRET_POWER_TREE); +} + +bool8 FldEff_SecretPowerTree(void) +{ + s16 mb = MapGridGetMetatileBehaviorAt(gPlayerFacingPosition.x, gPlayerFacingPosition.y) & 0xFFF; + + if (mb == MB_SECRET_BASE_SPOT_TREE_LEFT) + gFieldEffectArguments[7] = 0; + + if (mb == MB_SECRET_BASE_SPOT_TREE_RIGHT) + gFieldEffectArguments[7] = 2; + + AdjustSecretPowerSpritePixelOffsets(); + + CreateSprite(&gUnknown_0858E618, + gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], + gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], + 148); + + if (gFieldEffectArguments[7] == 1 || gFieldEffectArguments[7] == 3) + sub_80E8D4C(); + + return FALSE; +} + +static void TreeEntranceSpriteCallback1(struct Sprite *sprite) +{ + PlaySE(SE_W010); + + sprite->animNum = gFieldEffectArguments[7]; + sprite->data[0] = 0; + sprite->callback = TreeEntranceSpriteCallback2; +} + +static void TreeEntranceSpriteCallback2(struct Sprite *sprite) +{ + sprite->data[0]++; + + if (sprite->data[0] >= 40) + { + if (gFieldEffectArguments[7] == 0 || gFieldEffectArguments[7] == 2) + sub_80E8D4C(); + + sprite->data[0] = 0; + sprite->callback = TreeEntranceSpriteCallbackEnd; + } +} + +static void TreeEntranceSpriteCallbackEnd(struct Sprite *sprite) +{ + FieldEffectStop(sprite, FLDEFF_SECRET_POWER_TREE); + EnableBothScriptContexts(); +} + +void FieldCallback_SecretBaseShrub(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + ScriptContext1_SetupScript(EventScript_275B38); +} + +bool8 FldEff_UseSecretPowerShrub(void) +{ + u8 taskId = oei_task_add(); + + gTasks[taskId].data[8] = (u32)StartSecretBaseShrubFieldEffect >> 16; + gTasks[taskId].data[9] = (u32)StartSecretBaseShrubFieldEffect; + + return FALSE; +} + +static void StartSecretBaseShrubFieldEffect(void) +{ + FieldEffectActiveListRemove(FLDEFF_USE_SECRET_POWER_SHRUB); + FieldEffectStart(FLDEFF_SECRET_POWER_SHRUB); +} + +bool8 FldEff_SecretPowerShrub(void) +{ + AdjustSecretPowerSpritePixelOffsets(); + + CreateSprite(&gUnknown_0858E630, + gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], + gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], + 148); + + return FALSE; +} + +static void ShrubEntranceSpriteCallback1(struct Sprite *sprite) +{ + PlaySE(SE_W077); + + sprite->data[0] = 0; + sprite->callback = ShrubEntranceSpriteCallback2; +} + +static void ShrubEntranceSpriteCallback2(struct Sprite *sprite) +{ + if (sprite->data[0] < 40) + { + sprite->data[0]++; + + if (sprite->data[0] == 20) + sub_80E8D4C(); + } + else + { + sprite->data[0] = 0; + sprite->callback = ShrubEntranceSpriteCallbackEnd; + } +} + +static void ShrubEntranceSpriteCallbackEnd(struct Sprite *sprite) +{ + FieldEffectStop(sprite, FLDEFF_SECRET_POWER_SHRUB); + EnableBothScriptContexts(); +} + +u32 FldEff_SecretBasePCTurnOn(void) +{ + s16 x, y; + u8 taskId; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + + taskId = CreateTask(Task_SecretBasePCTurnOn, 0); + gTasks[taskId].data[0] = x; + gTasks[taskId].data[1] = y; + gTasks[taskId].data[2] = 0; + + return 0; +} + +void Task_SecretBasePCTurnOn(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[2]) + { + case 4: + case 12: + MapGridSetMetatileIdAt(data[0], data[1], 548); + CurrentMapDrawMetatileAt(data[0], data[1]); + break; + case 8: + case 16: + MapGridSetMetatileIdAt(data[0], data[1], 544); + CurrentMapDrawMetatileAt(data[0], data[1]); + break; + case 20: + MapGridSetMetatileIdAt(data[0], data[1], 548); + CurrentMapDrawMetatileAt(data[0], data[1]); + FieldEffectActiveListRemove(FLDEFF_PCTURN_ON); + EnableBothScriptContexts(); + DestroyTask(taskId); + return; + } + + data[2]++; +} + +void DoSecretBasePCTurnOffEffect(void) +{ + s16 x, y; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + PlaySE(SE_PC_OFF); + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + MapGridSetMetatileIdAt(x, y, 3616); + else + MapGridSetMetatileIdAt(x, y, 3617); + + CurrentMapDrawMetatileAt(x, y); +} + +void PopSecretBaseBalloon(s16 metatileId, s16 x, s16 y) +{ + u8 taskId = CreateTask(Task_PopSecretBaseBalloon, 0); + + gTasks[taskId].data[0] = metatileId; + gTasks[taskId].data[1] = x; + gTasks[taskId].data[2] = y; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 1; +} + +void Task_PopSecretBaseBalloon(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[3] == 6) + data[3] = 0; + else + data[3]++; + + if (data[3] == 0) + { + if (data[4] == 2) + DoBalloonSoundEffect(data[0]); + + MapGridSetMetatileIdAt(data[1], data[2], data[0] + data[4]); + CurrentMapDrawMetatileAt(data[1], data[2]); + + if (data[4] == 3) + DestroyTask(taskId); + else + data[4]++; + } +} + +void DoBalloonSoundEffect(s16 metatileId) +{ + switch (metatileId) + { + case 824: + PlaySE(SE_FUUSEN1); + break; + case 828: + PlaySE(SE_FUUSEN2); + break; + case 832: + PlaySE(SE_FUUSEN3); + break; + case 552: + PlaySE(SE_TOY_DANGO); + break; + } +} + +bool8 FldEff_NopA6FC(void) +{ + return FALSE; +} + +bool8 FldEff_NopA700(void) +{ + return FALSE; +} + +void DoSecretBaseBreakableDoorEffect(s16 x, s16 y) +{ + PlaySE(SE_TOY_KABE); + MapGridSetMetatileIdAt(x, y, 630); + MapGridSetMetatileIdAt(x, y - 1, 622); + CurrentMapDrawMetatileAt(x, y); + CurrentMapDrawMetatileAt(x, y - 1); +} + +void Task_ShatterSecretBaseBreakableDoor(u8 taskId) +{ + if (gTasks[taskId].data[0] == 7) + { + DoSecretBaseBreakableDoorEffect(gTasks[taskId].data[1], gTasks[taskId].data[2]); + DestroyTask(taskId); + } + else + { + gTasks[taskId].data[0]++; + } +} + +void ShatterSecretBaseBreakableDoor(s16 x, s16 y) +{ + u8 dir = GetPlayerFacingDirection(); + + if (dir == DIR_SOUTH) + { + DoSecretBaseBreakableDoorEffect(x, y); + } + else if (dir == DIR_NORTH) + { + u8 taskId = CreateTask(Task_ShatterSecretBaseBreakableDoor, 5); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = x; + gTasks[taskId].data[2] = y; + } +} + +#define tMetatileID data[0] +void Task_SecretBaseMusicNoteMatSound(u8 taskId) +{ + if (gTasks[taskId].data[1] == 7) + { + switch (gTasks[taskId].tMetatileID) + { + case 632: + PlaySE(SE_TOY_C); + break; + case 633: + PlaySE(SE_TOY_D); + break; + case 634: + PlaySE(SE_TOY_E); + break; + case 635: + PlaySE(SE_TOY_F); + break; + case 636: + PlaySE(SE_TOY_G); + break; + case 637: + PlaySE(SE_TOY_A); + break; + case 638: + PlaySE(SE_TOY_B); + break; + case 691: + PlaySE(SE_TOY_C1); + break; + } + + DestroyTask(taskId); + } + else + { + gTasks[taskId].data[1]++; + } +} + +void PlaySecretBaseMusicNoteMatSound(s16 metatileId) +{ + u8 taskId = CreateTask(Task_SecretBaseMusicNoteMatSound, 5); + + gTasks[taskId].tMetatileID = metatileId; + gTasks[taskId].data[1] = 0; +} +#undef tMetatileID + +void SpriteCB_GlitterMatSparkle(struct Sprite *sprite) +{ + sprite->data[0]++; + + if (sprite->data[0] == 8) + PlaySE(SE_W215); + + if (sprite->data[0] >= 32) + DestroySprite(sprite); +} + +void DoSecretBaseGlitterMatSparkle(void) +{ + s16 x = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x; + s16 y = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y; + u8 spriteId; + + sub_80930E0(&x, &y, 8, 4); + + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], x, y, 0); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].coordOffsetEnabled = TRUE; + gSprites[spriteId].oam.priority = 1; + gSprites[spriteId].oam.paletteNum = 5; + gSprites[spriteId].callback = SpriteCB_GlitterMatSparkle; + gSprites[spriteId].data[0] = 0; + } +} + +bool8 FldEff_SandPillar(void) +{ + s16 x, y; + + ScriptContext2_Enable(); + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + + gFieldEffectArguments[5] = x; + gFieldEffectArguments[6] = y; + + switch (GetPlayerFacingDirection()) + { + case DIR_SOUTH: + CreateSprite(&gUnknown_0858E68C, + gSprites[gPlayerAvatar.spriteId].oam.x + 8, + gSprites[gPlayerAvatar.spriteId].oam.y + 32, + 0); + + break; + + case DIR_NORTH: + CreateSprite(&gUnknown_0858E68C, + gSprites[gPlayerAvatar.spriteId].oam.x + 8, + gSprites[gPlayerAvatar.spriteId].oam.y, + 148); + + break; + + case DIR_WEST: + CreateSprite(&gUnknown_0858E68C, + gSprites[gPlayerAvatar.spriteId].oam.x - 8, + gSprites[gPlayerAvatar.spriteId].oam.y + 16, + 148); + + break; + + case DIR_EAST: + CreateSprite(&gUnknown_0858E68C, + gSprites[gPlayerAvatar.spriteId].oam.x + 24, + gSprites[gPlayerAvatar.spriteId].oam.y + 16, + 148); + + break; + } + + return FALSE; +} + +void SpriteCB_SandPillar_0(struct Sprite *sprite) +{ + PlaySE(SE_W088); + + if (MapGridGetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1) == 646) + MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, 3586); + else + MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, 644); + + MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], 522); + CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1); + CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); + + sprite->data[0] = 0; + sprite->callback = SpriteCB_SandPillar_1; +} + +void SpriteCB_SandPillar_1(struct Sprite *sprite) +{ + if (sprite->data[0] < 18) + { + sprite->data[0]++; + } + else + { + MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], 3724); + CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]); + sprite->data[0] = 0; + sprite->callback = SpriteCB_SandPillar_2; + } +} + +void SpriteCB_SandPillar_2(struct Sprite *sprite) +{ + FieldEffectStop(sprite, FLDEFF_SAND_PILLAR); + EnableBothScriptContexts(); +} + +void GetShieldToyTVDecorationInfo(void) +{ + s16 x, y; + s32 metatileId; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + + metatileId = MapGridGetMetatileIdAt(x, y); + + switch (metatileId) + { + case 822: + ConvertIntToDecimalStringN(gStringVar1, 100, STR_CONV_MODE_LEFT_ALIGN, 3); + StringCopy(gStringVar2, gText_Gold); + + gSpecialVar_Result = 0; + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + return; + + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x10); + break; + case 734: + ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2); + StringCopy(gStringVar2, gText_Silver); + + gSpecialVar_Result = 0; + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + return; + + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x20); + break; + case 756: + gSpecialVar_Result = 1; + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + return; + + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + break; + case 757: + gSpecialVar_Result = 2; + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + return; + + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + break; + case 758: + gSpecialVar_Result = 3; + + if (!VarGet(VAR_CURRENT_SECRET_BASE)) + return; + + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); + break; + } +} + +#ifdef NONMATCHING +bool8 sub_80FADE4(u16 arg0, u8 arg1) +{ + if (CurrentMapIsSecretBase()) + { + if (arg1 == 0) + { + if ((u16)(arg0 + 0xfffffd7b) <= 1 || (arg0 == 0x237)) + return TRUE; + } + else + { + if (arg0 == 0x28d || arg0 == 0x23f) + return TRUE; + } + } + return FALSE; +} +#else +NAKED +bool8 sub_80FADE4(u16 arg0, u8 arg1) +{ + asm_unified("\tpush {r4-r6,lr}\n" + "\tlsls r0, 16\n" + "\tlsrs r4, r0, 16\n" + "\tadds r6, r4, 0\n" + "\tlsls r1, 24\n" + "\tlsrs r5, r1, 24\n" + "\tbl CurrentMapIsSecretBase\n" + "\tlsls r0, 24\n" + "\tcmp r0, 0\n" + "\tbeq _080FAE28\n" + "\tcmp r5, 0\n" + "\tbne _080FAE1C\n" + "\tldr r1, =0xfffffd7b\n" + "\tadds r0, r4, r1\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tcmp r0, 0x1\n" + "\tbls _080FAE10\n" + "\tldr r0, =0x00000237\n" + "\tcmp r4, r0\n" + "\tbne _080FAE28\n" + "_080FAE10:\n" + "\tmovs r0, 0x1\n" + "\tb _080FAE2A\n" + "\t.pool\n" + "_080FAE1C:\n" + "\tldr r0, =0x0000028d\n" + "\tcmp r4, r0\n" + "\tbeq _080FAE10\n" + "\tldr r0, =0x0000023f\n" + "\tcmp r6, r0\n" + "\tbeq _080FAE10\n" + "_080FAE28:\n" + "\tmovs r0, 0\n" + "_080FAE2A:\n" + "\tpop {r4-r6}\n" + "\tpop {r1}\n" + "\tbx r1\n" + "\t.pool"); +} +#endif + +void Task_FieldPoisonEffect(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + data[1] += 2; + if (data[1] > 8) + data[0]++; + break; + case 1: + data[1] -= 2; + if (data[1] == 0) + data[0]++; + break; + case 2: + DestroyTask(taskId); + return; + } + SetGpuReg(REG_OFFSET_MOSAIC, (data[1] << 4) | data[1]); +} + +void FldEffPoison_Start(void) +{ + PlaySE(SE_DOKU); + CreateTask(Task_FieldPoisonEffect, 80); +} + +bool32 FldEffPoison_IsActive(void) +{ + return FuncIsActiveTask(Task_FieldPoisonEffect); +} + +void Task_WateringBerryTreeAnim_0(u8 taskId) +{ + gTasks[taskId].func = Task_WateringBerryTreeAnim_1; +} + +void Task_WateringBerryTreeAnim_1(u8 taskId) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (!EventObjectIsMovementOverridden(playerEventObj) + || EventObjectClearHeldMovementIfFinished(playerEventObj)) + { + sub_808C228(GetPlayerFacingDirection()); + EventObjectSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); + gTasks[taskId].func = Task_WateringBerryTreeAnim_2; + } +} + +void Task_WateringBerryTreeAnim_2(u8 taskId) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (EventObjectClearHeldMovementIfFinished(playerEventObj)) + { + s16 value = gTasks[taskId].data[1]++; + + if (value < 10) + EventObjectSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); + + else + gTasks[taskId].func = Task_WateringBerryTreeAnim_3; + } +} + +void Task_WateringBerryTreeAnim_3(u8 taskId) +{ + SetPlayerAvatarTransitionFlags(sub_808BCD0()); + DestroyTask(taskId); + EnableBothScriptContexts(); +} + +void DoWateringBerryTreeAnim(void) +{ + CreateTask(Task_WateringBerryTreeAnim_0, 80); +} + +u8 CreateRecordMixingSprite(void) +{ + u8 spriteId; + + LoadSpritePalette(&gUnknown_0858E864); + + spriteId = CreateSprite(&gUnknown_0858E880, 0, 0, 82); + + if (spriteId == MAX_SPRITES) + { + return MAX_SPRITES; + } + else + { + struct Sprite *sprite = &gSprites[spriteId]; + sub_8092FF0(16, 13, &sprite->pos1.x, &sprite->pos1.y); + sprite->coordOffsetEnabled = TRUE; + sprite->pos1.x += 16; + sprite->pos1.y += 2; + } + return spriteId; +} + +void DestroyRecordMixingSprite(void) +{ + int i; + + for (i = 0; i < MAX_SPRITES; i++) + { + if (gSprites[i].template == &gUnknown_0858E880) + { + FreeSpritePalette(&gSprites[i]); + DestroySprite(&gSprites[i]); + } + } +} diff --git a/src/record_mixing.c b/src/record_mixing.c index 6d5d49265..2b497c82b 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -23,7 +23,7 @@ #include "menu.h" #include "overworld.h" #include "field_screen_effect.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "script.h" #include "event_data.h" #include "lilycove_lady.h" diff --git a/src/secret_base.c b/src/secret_base.c index 9b5685d8b..a32186419 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -21,7 +21,7 @@ #include "field_weather.h" #include "event_object_movement.h" #include "field_effect.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "metatile_behavior.h" #include "map_name_popup.h" #include "string_util.h" @@ -188,7 +188,7 @@ void sub_80E8B6C(void) continue; } gSpecialVar_Result = TRUE; - VarSet(VAR_0x4054, i); + VarSet(VAR_CURRENT_SECRET_BASE, i); break; } } @@ -318,7 +318,7 @@ void sub_80E8E18(void) { gSaveBlock1Ptr->secretBases[0].trainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; } - VarSet(VAR_0x4054, 0); + VarSet(VAR_CURRENT_SECRET_BASE, 0); StringCopyN(gSaveBlock1Ptr->secretBases[0].trainerName, gSaveBlock2Ptr->playerName, sub_80E8DF4(gSaveBlock2Ptr->playerName)); gSaveBlock1Ptr->secretBases[0].gender = gSaveBlock2Ptr->playerGender; gSaveBlock1Ptr->secretBases[0].language = GAME_LANGUAGE; @@ -381,7 +381,7 @@ void sub_80E8FD0(u8 taskId) } break; case 1: - secretBaseRecordId = VarGet(VAR_0x4054); + secretBaseRecordId = VarGet(VAR_CURRENT_SECRET_BASE); if (gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_10 < 255) { gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_10 ++; @@ -477,7 +477,7 @@ void sub_80E9238(u8 flagIn) if (CurrentMapIsSecretBase()) { - curBaseId = VarGet(VAR_0x4054); + curBaseId = VarGet(VAR_CURRENT_SECRET_BASE); decorations = gSaveBlock1Ptr->secretBases[curBaseId].decorations; decorPos = gSaveBlock1Ptr->secretBases[curBaseId].decorationPos; for (x = 0; x < 16; x ++) @@ -520,7 +520,7 @@ void sub_80E933C(void) } else { - curBase = VarGet(VAR_0x4054); + curBase = VarGet(VAR_CURRENT_SECRET_BASE); roomDecor = gSaveBlock1Ptr->secretBases[curBase].decorations; roomDecorPos = gSaveBlock1Ptr->secretBases[curBase].decorationPos; nDecor = 16; @@ -556,7 +556,7 @@ void sub_80E933C(void) show_sprite(gSpecialVar_Result, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); sub_808EBA8(gSpecialVar_Result, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); sub_808F254(gSpecialVar_Result, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); - if (CurrentMapIsSecretBase() == TRUE && VarGet(VAR_0x4054) != 0) + if (CurrentMapIsSecretBase() == TRUE && VarGet(VAR_CURRENT_SECRET_BASE) != 0) { if (category == DECORCAT_DOLL) { @@ -592,7 +592,7 @@ void sub_80E9578(void) void sub_80E95D4(void) { - VarSet(VAR_OBJ_GFX_ID_F, gUnknown_0858D060[sub_80EA20C(VarGet(VAR_0x4054))]); + VarSet(VAR_OBJ_GFX_ID_F, gUnknown_0858D060[sub_80EA20C(VarGet(VAR_CURRENT_SECRET_BASE))]); } void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events) @@ -679,7 +679,7 @@ u8 *sub_80E9780(u8 *dest, u8 secretBaseRecordId) u8 *GetSecretBaseMapName(u8 *dest) { - return sub_80E9780(dest, VarGet(VAR_0x4054)); + return sub_80E9780(dest, VarGet(VAR_CURRENT_SECRET_BASE)); } void sub_80E980C(void) @@ -687,7 +687,7 @@ void sub_80E980C(void) u8 secretBaseRecordId; const u8 *src; - secretBaseRecordId = VarGet(VAR_0x4054); + secretBaseRecordId = VarGet(VAR_CURRENT_SECRET_BASE); src = gSaveBlock1Ptr->secretBases[secretBaseRecordId].trainerName; *StringCopyN(gStringVar1, src, sub_80E8DF4(src)) = EOS; ConvertInternationalString(gStringVar1, gSaveBlock1Ptr->secretBases[secretBaseRecordId].language); @@ -827,7 +827,7 @@ u8 sub_80E9BA8(void) void sub_80E9BDC(void) { - if (sub_80E9878(VarGet(VAR_0x4054)) == TRUE) + if (sub_80E9878(VarGet(VAR_CURRENT_SECRET_BASE)) == TRUE) { gSpecialVar_Result = 1; } @@ -843,7 +843,7 @@ void sub_80E9BDC(void) void sub_80E9C2C(void) { - gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].sbr_field_1_6 ^= 1; + gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].sbr_field_1_6 ^= 1; FlagSet(0x10C); } @@ -1079,7 +1079,7 @@ void sub_80EA18C(u8 taskId) void task_pc_turn_off(u8 taskId) { - if (VarGet(VAR_0x4054) == 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) == 0) { ScriptContext1_SetupScript(gUnknown_0823B4E8); } @@ -1099,7 +1099,7 @@ const u8 *GetSecretBaseTrainerLoseText(void) { u8 param; - param = sub_80EA20C(VarGet(VAR_0x4054)); + param = sub_80EA20C(VarGet(VAR_CURRENT_SECRET_BASE)); if (param == 0) { return SecretBase_RedCave1_Text_274966; @@ -1148,7 +1148,7 @@ void sub_80EA2E4(void) void sub_80EA30C(void) { - gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].sbr_field_1_5 = gSpecialVar_Result; + gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].sbr_field_1_5 = gSpecialVar_Result; } void sub_80EA354(void) @@ -1156,7 +1156,7 @@ void sub_80EA354(void) u16 secretBaseRecordId; u8 i; - secretBaseRecordId = VarGet(VAR_0x4054); + secretBaseRecordId = VarGet(VAR_CURRENT_SECRET_BASE); if (!FlagGet(0x922)) { for (i = 0; i < 20; i ++) @@ -1181,7 +1181,7 @@ void sub_80EA3E4(u8 taskId) switch (data[1]) { case 0: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { gUnknown_0203A01D = TRUE; } @@ -1254,7 +1254,7 @@ void sub_80EA3E4(u8 taskId) } else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE) { - sub_80FA5E4(MapGridGetMetatileIdAt(x, y), x, y); + PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y); if (gUnknown_0203A01D == TRUE) { switch ((int)MapGridGetMetatileIdAt(x, y)) @@ -1276,7 +1276,7 @@ void sub_80EA3E4(u8 taskId) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x400); } - sub_80FA794(x, y); + ShatterSecretBaseBreakableDoor(x, y); } else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){ if (gUnknown_0203A01D == TRUE) { @@ -1781,7 +1781,7 @@ void sub_80EB1AC(void) VarSet(VAR_0x40ED, 0); VarSet(VAR_0x40EE, 0); VarSet(VAR_0x40EF, 0); - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40F0, TRUE); } @@ -1809,7 +1809,7 @@ void sub_80EB218(void) void sub_80EB290(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x800); } @@ -1817,7 +1817,7 @@ void sub_80EB290(void) void sub_80EB2C8(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x400); } @@ -1825,7 +1825,7 @@ void sub_80EB2C8(void) void sub_80EB300(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); @@ -1835,7 +1835,7 @@ void sub_80EB300(void) void sub_80EB368(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); @@ -1845,7 +1845,7 @@ void sub_80EB368(void) void sub_80EB3D0(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); @@ -1855,7 +1855,7 @@ void sub_80EB3D0(void) void sub_80EB438(void) { - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800); VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001); @@ -1886,7 +1886,7 @@ void sub_80EB498(void) case 0x332: case 0x333: case 0x334: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x4000); } @@ -1904,7 +1904,7 @@ void sub_80EB56C(void) { case 0x28a: case 0x28b: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x40); } @@ -1927,21 +1927,21 @@ void sub_80EB56C(void) case 0x2f9: case 0x2fa: case 0x2fb: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8); } break; case 0x22c: case 0x233: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x40); } break; case 0x288: case 0x289: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100); } @@ -1949,7 +1949,7 @@ void sub_80EB56C(void) case 0x22d: case 0x22e: case 0x22f: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10); } @@ -1977,7 +1977,7 @@ void sub_80EB56C(void) case 0x2cd: case 0x2ce: case 0x2cf: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); } @@ -2004,7 +2004,7 @@ void sub_80EB9E0(void) case 0x2be: case 0x2c3: case 0x2c6: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); } @@ -2042,14 +2042,14 @@ void sub_80EBB28(void) case 0x2c4: case 0x2c5: case 0x2c7: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8); } break; case 0x280: case 0x281: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100); } @@ -2057,7 +2057,7 @@ void sub_80EBB28(void) case 0x225: case 0x226: case 0x227: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10); } @@ -2075,7 +2075,7 @@ void sub_80EBE7C(void) { case 0x28d: case 0x28e: - if (VarGet(VAR_0x4054) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) { VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4); } diff --git a/src/tv.c b/src/tv.c index 267520095..4e7c46a7e 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2572,13 +2572,13 @@ void sub_80EEA70(void) show->secretBaseSecrets.flags = VarGet(0x40ee) + (VarGet(0x40ef) << 16); tv_store_id_3x(show); show->secretBaseSecrets.language = gGameLanguage; - if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].language == LANGUAGE_JAPANESE) + if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language == LANGUAGE_JAPANESE) { show->secretBaseSecrets.baseOwnersNameLanguage = LANGUAGE_JAPANESE; } else { - show->secretBaseSecrets.baseOwnersNameLanguage = gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].language; + show->secretBaseSecrets.baseOwnersNameLanguage = gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language; } } }