diff --git a/asm/field_door.s b/asm/field_door.s deleted file mode 100644 index 037c76566..000000000 --- a/asm/field_door.s +++ /dev/null @@ -1,754 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_808A400 -sub_808A400: @ 808A400 - push {lr} - adds r2, r0, 0 - ldrb r0, [r2, 0x3] - cmp r0, 0x2 - bne _0808A420 - ldrh r1, [r1, 0x2] - ldr r0, [r2, 0x4] - adds r0, r1 - ldr r1, =0x06007e00 - movs r2, 0x80 - bl CpuFastSet - b _0808A42E - .pool -_0808A420: - ldrh r1, [r1, 0x2] - ldr r0, [r2, 0x4] - adds r0, r1 - ldr r1, =0x06007f00 - movs r2, 0x40 - bl CpuFastSet -_0808A42E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_808A400 - - thumb_func_start door_build_blockdef -door_build_blockdef: @ 808A438 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - movs r4, 0 - adds r1, r6, 0 -_0808A444: - ldrb r0, [r2] - lsls r0, 28 - lsrs r3, r0, 16 - adds r2, 0x1 - adds r0, r5, r4 - orrs r3, r0 - strh r3, [r1] - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - ble _0808A444 - cmp r4, 0x7 - bgt _0808A472 - lsls r0, r4, 1 - adds r1, r0, r6 -_0808A462: - ldrb r0, [r2] - lsls r3, r0, 12 - adds r2, 0x1 - strh r3, [r1] - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x7 - ble _0808A462 -_0808A472: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end door_build_blockdef - - thumb_func_start door_patch_tilemap -door_patch_tilemap: @ 808A478 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x30 - adds r7, r1, 0 - mov r9, r2 - adds r5, r3, 0 - ldrb r0, [r0, 0x3] - cmp r0, 0x2 - bne _0808A4F4 - add r4, sp, 0x10 - movs r1, 0xFC - lsls r1, 2 - adds r0, r4, 0 - adds r2, r5, 0 - bl door_build_blockdef - mov r6, r9 - subs r6, 0x1 - adds r0, r7, 0 - adds r1, r6, 0 - adds r2, r4, 0 - bl DrawDoorMetatileAt - movs r1, 0xFD - lsls r1, 2 - adds r0, r5, 0x4 - mov r8, r0 - adds r0, r4, 0 - mov r2, r8 - bl door_build_blockdef - adds r0, r7, 0 - mov r1, r9 - adds r2, r4, 0 - bl DrawDoorMetatileAt - movs r1, 0xFE - lsls r1, 2 - adds r0, r4, 0 - adds r2, r5, 0 - bl door_build_blockdef - adds r5, r7, 0x1 - adds r0, r5, 0 - adds r1, r6, 0 - adds r2, r4, 0 - bl DrawDoorMetatileAt - movs r1, 0xFF - lsls r1, 2 - adds r0, r4, 0 - mov r2, r8 - bl door_build_blockdef - adds r0, r5, 0 - mov r1, r9 - adds r2, r4, 0 - bl DrawDoorMetatileAt - b _0808A522 -_0808A4F4: - movs r1, 0xFE - lsls r1, 2 - mov r0, sp - adds r2, r5, 0 - bl door_build_blockdef - mov r1, r9 - subs r1, 0x1 - adds r0, r7, 0 - mov r2, sp - bl DrawDoorMetatileAt - movs r1, 0xFF - lsls r1, 2 - adds r2, r5, 0x4 - mov r0, sp - bl door_build_blockdef - adds r0, r7, 0 - mov r1, r9 - mov r2, sp - bl DrawDoorMetatileAt -_0808A522: - add sp, 0x30 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end door_patch_tilemap - - thumb_func_start sub_808A530 -sub_808A530: @ 808A530 - push {r4-r7,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - subs r7, r6, 0x1 - adds r0, r5, 0 - adds r1, r7, 0 - bl CurrentMapDrawMetatileAt - adds r0, r5, 0 - adds r1, r6, 0 - bl CurrentMapDrawMetatileAt - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - bne _0808A562 - adds r4, r5, 0x1 - adds r0, r4, 0 - adds r1, r7, 0 - bl CurrentMapDrawMetatileAt - adds r0, r4, 0 - adds r1, r6, 0 - bl CurrentMapDrawMetatileAt -_0808A562: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_808A530 - - thumb_func_start sub_808A568 -sub_808A568: @ 808A568 - push {r4-r7,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r7, r3, 0 - ldrh r1, [r5, 0x2] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _0808A5B0 - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r7, 0 - bl sub_808A530 - bl sub_808A964 - lsls r0, 24 - cmp r0, 0 - beq _0808A5E2 - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - adds r1, 0x7 - ldr r0, =gSpecialVar_0x8005 - ldrh r2, [r0] - adds r2, 0x7 - adds r0, r4, 0 - bl sub_808A530 - b _0808A5E2 - .pool -_0808A5B0: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_808A400 - ldr r3, [r4, 0x8] - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r7, 0 - bl door_patch_tilemap - bl sub_808A964 - lsls r0, 24 - cmp r0, 0 - beq _0808A5E2 - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - adds r1, 0x7 - ldr r0, =gSpecialVar_0x8005 - ldrh r2, [r0] - adds r2, 0x7 - ldr r3, [r4, 0x8] - adds r0, r4, 0 - bl door_patch_tilemap -_0808A5E2: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808A568 - - thumb_func_start sub_808A5F0 -sub_808A5F0: @ 808A5F0 - push {r4-r6,lr} - adds r6, r0, 0 - adds r5, r1, 0 - adds r4, r2, 0 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0808A616 - movs r2, 0x8 - ldrsh r1, [r4, r2] - lsls r1, 2 - adds r1, r5, r1 - movs r0, 0xC - ldrsh r2, [r4, r0] - movs r0, 0xE - ldrsh r3, [r4, r0] - adds r0, r6, 0 - bl sub_808A568 -_0808A616: - movs r2, 0xA - ldrsh r1, [r4, r2] - movs r2, 0x8 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0] - cmp r1, r0 - bne _0808A644 - movs r0, 0 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _0808A64A - movs r0, 0 - b _0808A64C -_0808A644: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] -_0808A64A: - movs r0, 0x1 -_0808A64C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_808A5F0 - - thumb_func_start task50_overworld_door -task50_overworld_door: @ 808A654 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - ldr r0, =gTasks + 0x8 - adds r2, r0 - ldrh r1, [r2] - lsls r1, 16 - ldrh r0, [r2, 0x2] - orrs r1, r0 - ldrh r0, [r2, 0x4] - lsls r0, 16 - ldrh r3, [r2, 0x6] - orrs r0, r3 - bl sub_808A5F0 - cmp r0, 0 - bne _0808A682 - adds r0, r4, 0 - bl DestroyTask -_0808A682: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task50_overworld_door - - thumb_func_start door_frame_last -door_frame_last: @ 808A68C - push {lr} - adds r1, r0, 0 - b _0808A694 -_0808A692: - adds r1, 0x4 -_0808A694: - ldrb r0, [r1] - cmp r0, 0 - bne _0808A692 - subs r0, r1, 0x4 - pop {r1} - bx r1 - thumb_func_end door_frame_last - - thumb_func_start door_find -door_find: @ 808A6A0 - push {lr} - adds r2, r0, 0 - lsls r1, 16 - lsrs r1, 16 - b _0808A6B6 -_0808A6AA: - ldrh r0, [r2] - cmp r0, r1 - bne _0808A6B4 - adds r0, r2, 0 - b _0808A6BE -_0808A6B4: - adds r2, 0xC -_0808A6B6: - ldr r0, [r2, 0x4] - cmp r0, 0 - bne _0808A6AA - movs r0, 0 -_0808A6BE: - pop {r1} - bx r1 - thumb_func_end door_find - - thumb_func_start task_overworld_door_add_if_inactive -task_overworld_door_add_if_inactive: @ 808A6C4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - adds r5, r1, 0 - adds r7, r2, 0 - mov r8, r3 - ldr r4, =task50_overworld_door - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0808A718 - adds r0, r4, 0 - movs r1, 0x50 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks + 0x8 - adds r1, r2 - strh r7, [r1, 0xC] - mov r2, r8 - strh r2, [r1, 0xE] - strh r5, [r1, 0x2] - lsrs r2, r5, 16 - strh r2, [r1] - strh r6, [r1, 0x6] - lsrs r2, r6, 16 - strh r2, [r1, 0x4] - lsls r0, 24 - asrs r0, 24 - b _0808A71C - .pool -_0808A718: - movs r0, 0x1 - negs r0, r0 -_0808A71C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end task_overworld_door_add_if_inactive - - thumb_func_start sub_808A728 -sub_808A728: @ 808A728 - push {lr} - bl sub_808A530 - pop {r0} - bx r0 - thumb_func_end sub_808A728 - - thumb_func_start sub_808A734 -sub_808A734: @ 808A734 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r0, r5, 0 - adds r1, r6, 0 - bl MapGridGetMetatileIdAt - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl door_find - adds r4, r0, 0 - cmp r4, 0 - beq _0808A76A - ldr r1, =gUnknown_08496F8C - adds r0, r1, 0 - bl door_frame_last - adds r1, r0, 0 - adds r0, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_808A568 -_0808A76A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808A734 - - thumb_func_start task_overworld_door_add_for_opening_door_at -@ s32 task_overworld_door_add_for_opening_door_at(void *a1, s32 x, s32 y) -task_overworld_door_add_for_opening_door_at: @ 808A774 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r0, r5, 0 - adds r1, r6, 0 - bl MapGridGetMetatileIdAt - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl door_find - adds r2, r0, 0 - adds r4, r2, 0 - cmp r2, 0 - bne _0808A79E - movs r0, 0x1 - negs r0, r0 - b _0808A7C0 -_0808A79E: - ldrb r0, [r2, 0x3] - cmp r0, 0x2 - beq _0808A7B0 - ldr r1, =gUnknown_08496F8C - adds r0, r2, 0 - b _0808A7B4 - .pool -_0808A7B0: - ldr r1, =gUnknown_08496FB4 - adds r0, r4, 0 -_0808A7B4: - adds r2, r5, 0 - adds r3, r6, 0 - bl task_overworld_door_add_if_inactive - lsls r0, 24 - asrs r0, 24 -_0808A7C0: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end task_overworld_door_add_for_opening_door_at - - thumb_func_start sub_808A7CC -sub_808A7CC: @ 808A7CC - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r0, r5, 0 - adds r1, r6, 0 - bl MapGridGetMetatileIdAt - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl door_find - cmp r0, 0 - beq _0808A800 - ldr r1, =gUnknown_08496FA0 - adds r2, r5, 0 - adds r3, r6, 0 - bl task_overworld_door_add_if_inactive - lsls r0, 24 - asrs r0, 24 - b _0808A804 - .pool -_0808A800: - movs r0, 0x1 - negs r0, r0 -_0808A804: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_808A7CC - - thumb_func_start cur_mapdata_get_door_x2_at -cur_mapdata_get_door_x2_at: @ 808A80C - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - adds r1, r2, 0 - bl MapGridGetMetatileIdAt - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl door_find - cmp r0, 0 - beq _0808A830 - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - b _0808A834 -_0808A830: - movs r0, 0x1 - negs r0, r0 -_0808A834: - pop {r4} - pop {r1} - bx r1 - thumb_func_end cur_mapdata_get_door_x2_at - - thumb_func_start sub_808A83C -sub_808A83C: @ 808A83C - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - ldr r0, =gUnknown_08497174 - adds r1, r3, 0 - bl task_overworld_door_add_for_opening_door_at - pop {r0} - bx r0 - .pool - thumb_func_end sub_808A83C - - thumb_func_start FieldSetDoorOpened -FieldSetDoorOpened: @ 808A854 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsDoor - lsls r0, 24 - cmp r0, 0 - beq _0808A876 - ldr r0, =gUnknown_08497174 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_808A734 -_0808A876: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FieldSetDoorOpened - - thumb_func_start FieldSetDoorClosed -FieldSetDoorClosed: @ 808A880 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsDoor - lsls r0, 24 - cmp r0, 0 - beq _0808A8A2 - ldr r0, =gUnknown_08497174 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_808A728 -_0808A8A2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FieldSetDoorClosed - - thumb_func_start FieldAnimateDoorClose -FieldAnimateDoorClose: @ 808A8AC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsDoor - lsls r0, 24 - cmp r0, 0 - beq _0808A8D8 - ldr r0, =gUnknown_08497174 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_808A7CC - lsls r0, 24 - asrs r0, 24 - b _0808A8DC - .pool -_0808A8D8: - movs r0, 0x1 - negs r0, r0 -_0808A8DC: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end FieldAnimateDoorClose - - thumb_func_start FieldAnimateDoorOpen -FieldAnimateDoorOpen: @ 808A8E4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsDoor - lsls r0, 24 - cmp r0, 0 - beq _0808A910 - ldr r0, =gUnknown_08497174 - adds r1, r4, 0 - adds r2, r5, 0 - bl task_overworld_door_add_for_opening_door_at - lsls r0, 24 - asrs r0, 24 - b _0808A914 - .pool -_0808A910: - movs r0, 0x1 - negs r0, r0 -_0808A914: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end FieldAnimateDoorOpen - - thumb_func_start FieldIsDoorAnimationRunning -FieldIsDoorAnimationRunning: @ 808A91C - push {lr} - ldr r0, =task50_overworld_door - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end FieldIsDoorAnimationRunning - - thumb_func_start GetDoorSoundEffect -GetDoorSoundEffect: @ 808A930 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - ldr r0, =gUnknown_08497174 - adds r1, r3, 0 - bl cur_mapdata_get_door_x2_at - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _0808A958 - cmp r0, 0x1 - bne _0808A954 - movs r0, 0x12 - b _0808A95E - .pool -_0808A954: - cmp r0, 0x2 - beq _0808A95C -_0808A958: - movs r0, 0x8 - b _0808A95E -_0808A95C: - movs r0, 0x2F -_0808A95E: - pop {r1} - bx r1 - thumb_func_end GetDoorSoundEffect - - thumb_func_start sub_808A964 -sub_808A964: @ 808A964 - push {lr} - ldr r0, =0x00004002 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0808A990 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x0000101a - cmp r1, r0 - bne _0808A990 - movs r0, 0x1 - b _0808A992 - .pool -_0808A990: - movs r0, 0 -_0808A992: - pop {r1} - bx r1 - thumb_func_end sub_808A964 - - .align 2, 0 @ Don't pad with nop. diff --git a/data/field_door.s b/data/field_door.s deleted file mode 100644 index 85c1ae919..000000000 --- a/data/field_door.s +++ /dev/null @@ -1,614 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -DoorAnimTiles_04:: - .incbin "graphics/door_anims/04/0.4bpp" - .incbin "graphics/door_anims/04/1.4bpp" - .incbin "graphics/door_anims/04/2.4bpp" - - .space 32 - -DoorAnimTiles_05:: - .incbin "graphics/door_anims/05/0.4bpp" - .incbin "graphics/door_anims/05/1.4bpp" - .incbin "graphics/door_anims/05/2.4bpp" - - .space 32 - -DoorAnimTiles_08:: - .incbin "graphics/door_anims/08/0.4bpp" - .incbin "graphics/door_anims/08/1.4bpp" - .incbin "graphics/door_anims/08/2.4bpp" - - .space 32 - -DoorAnimTiles_15:: - .incbin "graphics/door_anims/15/0.4bpp" - .incbin "graphics/door_anims/15/1.4bpp" - .incbin "graphics/door_anims/15/2.4bpp" - - .space 32 - -DoorAnimTiles_16:: - .incbin "graphics/door_anims/16/0.4bpp" - .incbin "graphics/door_anims/16/1.4bpp" - .incbin "graphics/door_anims/16/2.4bpp" - - .space 32 - -DoorAnimTiles_00:: - .incbin "graphics/door_anims/00/0.4bpp" - .incbin "graphics/door_anims/00/1.4bpp" - .incbin "graphics/door_anims/00/2.4bpp" - - .space 32 - -DoorAnimTiles_01:: - .incbin "graphics/door_anims/01/0.4bpp" - .incbin "graphics/door_anims/01/1.4bpp" - .incbin "graphics/door_anims/01/2.4bpp" - -DoorAnimTiles_02:: - .incbin "graphics/door_anims/02/0.4bpp" - .incbin "graphics/door_anims/02/1.4bpp" - .incbin "graphics/door_anims/02/2.4bpp" - -DoorAnimTiles_03:: - .incbin "graphics/door_anims/03/0.4bpp" - .incbin "graphics/door_anims/03/1.4bpp" - .incbin "graphics/door_anims/03/2.4bpp" - -DoorAnimTiles_06:: - .incbin "graphics/door_anims/06/0.4bpp" - .incbin "graphics/door_anims/06/1.4bpp" - .incbin "graphics/door_anims/06/2.4bpp" - - .space 32 - -DoorAnimTiles_07:: - .incbin "graphics/door_anims/07/0.4bpp" - .incbin "graphics/door_anims/07/1.4bpp" - .incbin "graphics/door_anims/07/2.4bpp" - - .space 32 - -DoorAnimTiles_09:: - .incbin "graphics/door_anims/09/0.4bpp" - .incbin "graphics/door_anims/09/1.4bpp" - .incbin "graphics/door_anims/09/2.4bpp" - - .space 0x5900 - - .incbin "graphics/door_anims/unused_848EDEC/0_top.4bpp" - .incbin "graphics/door_anims/unused_848EDEC/1_top.4bpp" - .incbin "graphics/door_anims/unused_848EDEC/2_top.4bpp" - - .space 0x140 - - .incbin "graphics/door_anims/unused_848EDEC/0_bottom.4bpp" - .incbin "graphics/door_anims/unused_848EDEC/1_bottom.4bpp" - .incbin "graphics/door_anims/unused_848EDEC/2_bottom.4bpp" - - .space 32 - -DoorAnimTiles_10:: - .incbin "graphics/door_anims/10/0.4bpp" - .incbin "graphics/door_anims/10/1.4bpp" - .incbin "graphics/door_anims/10/2.4bpp" - - .space 32 - -DoorAnimTiles_11:: - .incbin "graphics/door_anims/11/0.4bpp" - .incbin "graphics/door_anims/11/1.4bpp" - .incbin "graphics/door_anims/11/2.4bpp" - - .space 32 - -DoorAnimTiles_12:: - .incbin "graphics/door_anims/12/0.4bpp" - .incbin "graphics/door_anims/12/1.4bpp" - .incbin "graphics/door_anims/12/2.4bpp" - - .space 32 - -DoorAnimTiles_13:: - .incbin "graphics/door_anims/13/0.4bpp" - .incbin "graphics/door_anims/13/1.4bpp" - .incbin "graphics/door_anims/13/2.4bpp" - - .space 32 - -DoorAnimTiles_14:: - .incbin "graphics/door_anims/14/0.4bpp" - .incbin "graphics/door_anims/14/1.4bpp" - .incbin "graphics/door_anims/14/2.4bpp" - - .space 32 - -DoorAnimTiles_17:: - .incbin "graphics/door_anims/17/0.4bpp" - .incbin "graphics/door_anims/17/1.4bpp" - .incbin "graphics/door_anims/17/2.4bpp" - - .space 32 - -DoorAnimTiles_18:: - .incbin "graphics/door_anims/18/0.4bpp" - .incbin "graphics/door_anims/18/1.4bpp" - .incbin "graphics/door_anims/18/2.4bpp" - - .space 32 - -DoorAnimTiles_19:: - .incbin "graphics/door_anims/19/0.4bpp" - .incbin "graphics/door_anims/19/1.4bpp" - .incbin "graphics/door_anims/19/2.4bpp" - - .space 32 - -DoorAnimTiles_20:: - .incbin "graphics/door_anims/20/0.4bpp" - .incbin "graphics/door_anims/20/1.4bpp" - .incbin "graphics/door_anims/20/2.4bpp" - - .space 32 - -DoorAnimTiles_21:: - .incbin "graphics/door_anims/21/0.4bpp" - .incbin "graphics/door_anims/21/1.4bpp" - .incbin "graphics/door_anims/21/2.4bpp" - - .space 32 - -DoorAnimTiles_22:: - .incbin "graphics/door_anims/22/0.4bpp" - .incbin "graphics/door_anims/22/1.4bpp" - .incbin "graphics/door_anims/22/2.4bpp" - - .space 32 - -DoorAnimTiles_23:: - .incbin "graphics/door_anims/23/0.4bpp" - .incbin "graphics/door_anims/23/1.4bpp" - .incbin "graphics/door_anims/23/2.4bpp" - - .space 32 - -DoorAnimTiles_24:: - .incbin "graphics/door_anims/24/0.4bpp" - .incbin "graphics/door_anims/24/1.4bpp" - .incbin "graphics/door_anims/24/2.4bpp" - - .space 32 - -DoorAnimTiles_25:: - .incbin "graphics/door_anims/25/0.4bpp" - .incbin "graphics/door_anims/25/1.4bpp" - .incbin "graphics/door_anims/25/2.4bpp" - - .space 32 - -DoorAnimTiles_26:: - .incbin "graphics/door_anims/26/0.4bpp" - .incbin "graphics/door_anims/26/1.4bpp" - .incbin "graphics/door_anims/26/2.4bpp" - - .space 32 - -DoorAnimTiles_27:: - .incbin "graphics/door_anims/27/0.4bpp" - .incbin "graphics/door_anims/27/1.4bpp" - .incbin "graphics/door_anims/27/2.4bpp" - - .space 32 - -DoorAnimTiles_28:: - .incbin "graphics/door_anims/28/0.4bpp" - .incbin "graphics/door_anims/28/1.4bpp" - .incbin "graphics/door_anims/28/2.4bpp" - - .space 32 - -DoorAnimTiles_29:: - .incbin "graphics/door_anims/29/0.4bpp" - .incbin "graphics/door_anims/29/1.4bpp" - .incbin "graphics/door_anims/29/2.4bpp" - - .space 32 - -DoorAnimTiles_30:: - .incbin "graphics/door_anims/30/0.4bpp" - .incbin "graphics/door_anims/30/1.4bpp" - .incbin "graphics/door_anims/30/2.4bpp" - - .space 32 - -DoorAnimTiles_31:: - .incbin "graphics/door_anims/31/0.4bpp" - .incbin "graphics/door_anims/31/1.4bpp" - .incbin "graphics/door_anims/31/2.4bpp" - - .space 32 - -DoorAnimTiles_32:: - .incbin "graphics/door_anims/32/0.4bpp" - .incbin "graphics/door_anims/32/1.4bpp" - .incbin "graphics/door_anims/32/2.4bpp" - - .space 32 - -DoorAnimTiles_33:: - .incbin "graphics/door_anims/33/0.4bpp" - .incbin "graphics/door_anims/33/1.4bpp" - .incbin "graphics/door_anims/33/2.4bpp" - - .space 32 - -DoorAnimTiles_34:: - .incbin "graphics/door_anims/34/0.4bpp" - .incbin "graphics/door_anims/34/1.4bpp" - .incbin "graphics/door_anims/34/2.4bpp" - - .space 32 - -DoorAnimTiles_35:: - .incbin "graphics/door_anims/35/0.4bpp" - .incbin "graphics/door_anims/35/1.4bpp" - .incbin "graphics/door_anims/35/2.4bpp" - - .space 32 - -DoorAnimTiles_36:: - .incbin "graphics/door_anims/36/0.4bpp" - .incbin "graphics/door_anims/36/1.4bpp" - .incbin "graphics/door_anims/36/2.4bpp" - - .space 32 - -DoorAnimTiles_37:: - .incbin "graphics/door_anims/37/0.4bpp" - .incbin "graphics/door_anims/37/1.4bpp" - .incbin "graphics/door_anims/37/2.4bpp" - - .space 32 - -DoorAnimTiles_38:: - .incbin "graphics/door_anims/38/0.4bpp" - .incbin "graphics/door_anims/38/1.4bpp" - .incbin "graphics/door_anims/38/2.4bpp" - - .space 32 - -DoorAnimTiles_39:: - .incbin "graphics/door_anims/39/0.4bpp" - .incbin "graphics/door_anims/39/1.4bpp" - .incbin "graphics/door_anims/39/2.4bpp" - - .space 32 - -DoorAnimTiles_40:: - .incbin "graphics/door_anims/40/0.4bpp" - .incbin "graphics/door_anims/40/1.4bpp" - .incbin "graphics/door_anims/40/2.4bpp" - - .space 32 - -DoorAnimTiles_41:: - .incbin "graphics/door_anims/41/0.4bpp" - .incbin "graphics/door_anims/41/1.4bpp" - .incbin "graphics/door_anims/41/2.4bpp" - -DoorAnimTiles_42:: - .incbin "graphics/door_anims/42/0.4bpp" - .incbin "graphics/door_anims/42/1.4bpp" - .incbin "graphics/door_anims/42/2.4bpp" - .incbin "graphics/door_anims/42/3.4bpp" - - .space 32 - -DoorAnimTiles_43:: - .incbin "graphics/door_anims/43/0.4bpp" - .incbin "graphics/door_anims/43/1.4bpp" - .incbin "graphics/door_anims/43/2.4bpp" - - .space 32 - -DoorAnimTiles_44:: - .incbin "graphics/door_anims/44/0_left.4bpp" - .incbin "graphics/door_anims/44/0_right.4bpp" - .incbin "graphics/door_anims/44/1_left.4bpp" - .incbin "graphics/door_anims/44/1_right.4bpp" - .incbin "graphics/door_anims/44/2_left.4bpp" - .incbin "graphics/door_anims/44/2_right.4bpp" - - .space 32 - -DoorAnimTiles_45:: - .incbin "graphics/door_anims/45/0.4bpp" - .incbin "graphics/door_anims/45/1.4bpp" - .incbin "graphics/door_anims/45/2.4bpp" - - .space 32 - -DoorAnimTiles_46:: - .incbin "graphics/door_anims/46/0.4bpp" - .incbin "graphics/door_anims/46/1.4bpp" - .incbin "graphics/door_anims/46/2.4bpp" - - .space 32 - -DoorAnimTiles_47:: - .incbin "graphics/door_anims/47/0.4bpp" - .incbin "graphics/door_anims/47/1.4bpp" - .incbin "graphics/door_anims/47/2.4bpp" - - .space 32 - -DoorAnimTiles_48:: - .incbin "graphics/door_anims/48/0.4bpp" - .incbin "graphics/door_anims/48/1.4bpp" - .incbin "graphics/door_anims/48/2.4bpp" - .incbin "graphics/door_anims/48/3.4bpp" - - .space 32 - -DoorAnimTiles_49:: - .incbin "graphics/door_anims/49/0.4bpp" - .incbin "graphics/door_anims/49/1.4bpp" - .incbin "graphics/door_anims/49/2.4bpp" - - .space 32 - -DoorAnimTiles_50:: - .incbin "graphics/door_anims/50/0.4bpp" - .incbin "graphics/door_anims/50/1.4bpp" - .incbin "graphics/door_anims/50/2.4bpp" - - .space 32 - - .align 2 -gUnknown_08496F8C:: @ 8496F8C - door_anim_frame 4, -1 - door_anim_frame 4, 0 - door_anim_frame 4, 0x100 - door_anim_frame 4, 0x200 - door_anim_frame 0, 0 - - .align 2 -gUnknown_08496FA0:: @ 8496FA0 - door_anim_frame 4, 0x200 - door_anim_frame 4, 0x100 - door_anim_frame 4, 0 - door_anim_frame 4, -1 - door_anim_frame 0, 0 - - .align 2 -gUnknown_08496FB4:: @ 8496FB4 - door_anim_frame 4, -1 - door_anim_frame 4, 0 - door_anim_frame 4, 0x200 - door_anim_frame 4, 0x400 - door_anim_frame 0, 0 - - .align 2 -gUnknown_08496FC8:: @ 8496FB4 - door_anim_frame 4, 0x400 - door_anim_frame 4, 0x200 - door_anim_frame 4, 0 - door_anim_frame 4, -1 - door_anim_frame 0, 0 - -DoorAnimPalettes_8496FDC:: @ 8496FDC - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_8496FE4:: @ 8496FE4 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_8496FEC:: @ 8496FEC - .byte 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_8496FF4:: @ 8496FF4 - .byte 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_8496FFC:: @ 8496FFC - .byte 0x0a, 0x0a, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 - -DoorAnimPalettes_8497004:: @ 8497004 - .byte 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 - -DoorAnimPalettes_849700C:: @ 849700C - .byte 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b - -DoorAnimPalettes_8497014:: @ 8497014 - .byte 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a - -DoorAnimPalettes_849701C:: @ 849701C - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_8497024:: @ 8497024 - .byte 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 - -DoorAnimPalettes_849702C:: @ 849702C - .byte 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_8497034:: @ 8497034 - .byte 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_849703C:: @ 849703C - .byte 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 - -DoorAnimPalettes_8497044:: @ 8497044 - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_849704C:: @ 849704C - .byte 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 - -DoorAnimPalettes_8497054:: @ 8497054 - .byte 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 - -DoorAnimPalettes_849705C:: @ 849705C - .byte 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_8497064:: @ 8497064 - .byte 0x06, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_849706C:: @ 849706C - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_8497074:: @ 8497074 - .byte 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_849707C:: @ 849707C - .byte 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_8497084:: @ 8497084 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_849708C:: @ 849708C - .byte 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 - -DoorAnimPalettes_8497094:: @ 8497094 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849709C:: @ 849709C - .byte 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_84970A4:: @ 84970A4 - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_84970AC:: @ 84970AC - .byte 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 - -DoorAnimPalettes_84970B4:: @ 84970B4 - .byte 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 - -DoorAnimPalettes_84970BC:: @ 84970BC - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_84970C4:: @ 84970C4 - .byte 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_84970CC:: @ 84970CC - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_84970D4:: @ 84970D4 - .byte 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_84970DC:: @ 84970DC - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_84970E4:: @ 84970E4 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_84970EC:: @ 84970EC - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_84970F4:: @ 84970F4 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_84970FC:: @ 84970FC - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_8497104:: @ 8497104 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - -DoorAnimPalettes_849710C:: @ 849710C - .byte 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 - -DoorAnimPalettes_8497114:: @ 8497114 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849711C:: @ 849711C - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_8497124:: @ 8497124 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849712C:: @ 849712C - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_8497134:: @ 8497134 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849713C:: @ 849713C - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_8497144:: @ 8497144 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_849714C:: @ 849714C - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - -DoorAnimPalettes_8497154:: @ 8497154 - .byte 0x09, 0x09, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849715C:: @ 849715C - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 - -DoorAnimPalettes_8497164:: @ 8497164 - .byte 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - -DoorAnimPalettes_849716C:: @ 849716C - .byte 0x09, 0x09, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 - - .align 2 -gUnknown_08497174:: @ 8497174 - door_anim_gfx 0x0021, 0x00, 0x01, DoorAnimTiles_00, DoorAnimPalettes_8496FDC - door_anim_gfx 0x0061, 0x01, 0x01, DoorAnimTiles_01, DoorAnimPalettes_8496FE4 - door_anim_gfx 0x01cd, 0x01, 0x01, DoorAnimTiles_02, DoorAnimPalettes_8496FEC - door_anim_gfx 0x0041, 0x01, 0x01, DoorAnimTiles_03, DoorAnimPalettes_8496FF4 - door_anim_gfx 0x0248, 0x00, 0x01, DoorAnimTiles_04, DoorAnimPalettes_8496FFC - door_anim_gfx 0x0249, 0x00, 0x01, DoorAnimTiles_05, DoorAnimPalettes_8497004 - door_anim_gfx 0x022f, 0x00, 0x01, DoorAnimTiles_06, DoorAnimPalettes_849700C - door_anim_gfx 0x021f, 0x00, 0x01, DoorAnimTiles_07, DoorAnimPalettes_8497014 - door_anim_gfx 0x02a5, 0x00, 0x01, DoorAnimTiles_08, DoorAnimPalettes_849701C - door_anim_gfx 0x0287, 0x00, 0x01, DoorAnimTiles_09, DoorAnimPalettes_849702C - door_anim_gfx 0x02ac, 0x00, 0x01, DoorAnimTiles_10, DoorAnimPalettes_849706C - door_anim_gfx 0x03a1, 0x00, 0x01, DoorAnimTiles_11, DoorAnimPalettes_8497074 - door_anim_gfx 0x02dc, 0x00, 0x01, DoorAnimTiles_12, DoorAnimPalettes_8497064 - door_anim_gfx 0x0225, 0x00, 0x01, DoorAnimTiles_13, DoorAnimPalettes_849705C - door_anim_gfx 0x01db, 0x01, 0x01, DoorAnimTiles_14, DoorAnimPalettes_8497084 - door_anim_gfx 0x0246, 0x00, 0x01, DoorAnimTiles_15, DoorAnimPalettes_8497024 - door_anim_gfx 0x028e, 0x00, 0x01, DoorAnimTiles_16, DoorAnimPalettes_849707C - door_anim_gfx 0x02a1, 0x00, 0x01, DoorAnimTiles_17, DoorAnimPalettes_8497034 - door_anim_gfx 0x021c, 0x00, 0x01, DoorAnimTiles_18, DoorAnimPalettes_849704C - door_anim_gfx 0x021e, 0x00, 0x01, DoorAnimTiles_19, DoorAnimPalettes_8497054 - door_anim_gfx 0x021d, 0x01, 0x01, DoorAnimTiles_20, DoorAnimPalettes_849703C - door_anim_gfx 0x021a, 0x00, 0x01, DoorAnimTiles_21, DoorAnimPalettes_8497044 - door_anim_gfx 0x0224, 0x00, 0x01, DoorAnimTiles_22, DoorAnimPalettes_849708C - door_anim_gfx 0x0289, 0x00, 0x01, DoorAnimTiles_23, DoorAnimPalettes_8497094 - door_anim_gfx 0x030c, 0x01, 0x01, DoorAnimTiles_24, DoorAnimPalettes_849709C - door_anim_gfx 0x032d, 0x01, 0x01, DoorAnimTiles_25, DoorAnimPalettes_84970A4 - door_anim_gfx 0x02ed, 0x01, 0x01, DoorAnimTiles_26, DoorAnimPalettes_84970AC - door_anim_gfx 0x0264, 0x01, 0x01, DoorAnimTiles_27, DoorAnimPalettes_84970B4 - door_anim_gfx 0x022b, 0x00, 0x01, DoorAnimTiles_28, DoorAnimPalettes_84970BC - door_anim_gfx 0x02f7, 0x00, 0x01, DoorAnimTiles_29, DoorAnimPalettes_84970C4 - door_anim_gfx 0x0297, 0x00, 0x01, DoorAnimTiles_30, DoorAnimPalettes_84970CC - door_anim_gfx 0x0285, 0x01, 0x01, DoorAnimTiles_31, DoorAnimPalettes_84970D4 - door_anim_gfx 0x025d, 0x01, 0x01, DoorAnimTiles_32, DoorAnimPalettes_84970DC - door_anim_gfx 0x020e, 0x01, 0x01, DoorAnimTiles_33, DoorAnimPalettes_84970E4 - door_anim_gfx 0x03b0, 0x01, 0x01, DoorAnimTiles_34, DoorAnimPalettes_84970EC - door_anim_gfx 0x028a, 0x01, 0x01, DoorAnimTiles_35, DoorAnimPalettes_84970F4 - door_anim_gfx 0x0263, 0x01, 0x01, DoorAnimTiles_36, DoorAnimPalettes_84970FC - door_anim_gfx 0x0329, 0x01, 0x01, DoorAnimTiles_37, DoorAnimPalettes_8497104 - door_anim_gfx 0x0291, 0x00, 0x01, DoorAnimTiles_38, DoorAnimPalettes_849710C - door_anim_gfx 0x021b, 0x02, 0x01, DoorAnimTiles_39, DoorAnimPalettes_8497114 - door_anim_gfx 0x0209, 0x01, 0x01, DoorAnimTiles_40, DoorAnimPalettes_849711C - door_anim_gfx 0x0219, 0x00, 0x01, DoorAnimTiles_41, DoorAnimPalettes_8497124 - door_anim_gfx 0x0393, 0x01, 0x01, DoorAnimTiles_42, DoorAnimPalettes_849712C - door_anim_gfx 0x03d4, 0x01, 0x01, DoorAnimTiles_42, DoorAnimPalettes_849712C - door_anim_gfx 0x036c, 0x01, 0x01, DoorAnimTiles_42, DoorAnimPalettes_849712C - door_anim_gfx 0x025e, 0x01, 0x01, DoorAnimTiles_43, DoorAnimPalettes_8497134 - door_anim_gfx 0x02ad, 0x01, 0x02, DoorAnimTiles_44, DoorAnimPalettes_849713C - door_anim_gfx 0x03fc, 0x00, 0x01, DoorAnimTiles_45, DoorAnimPalettes_849714C - door_anim_gfx 0x0396, 0x01, 0x01, DoorAnimTiles_46, DoorAnimPalettes_849714C - door_anim_gfx 0x020a, 0x01, 0x01, DoorAnimTiles_47, DoorAnimPalettes_8497154 - door_anim_gfx 0x026b, 0x01, 0x01, DoorAnimTiles_48, DoorAnimPalettes_849715C - door_anim_gfx 0x032c, 0x01, 0x01, DoorAnimTiles_49, DoorAnimPalettes_8497164 - door_anim_gfx 0x0383, 0x01, 0x01, DoorAnimTiles_50, DoorAnimPalettes_849716C - door_anim_gfx 0x0000, 0x00, 0x00, NULL, NULL - diff --git a/include/field_camera.h b/include/field_camera.h index a8559e1c2..f68c67854 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -24,5 +24,6 @@ extern u16 gUnknown_03005DE8; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); +void DrawDoorMetatileAt(int x, int y, u16 *arr); #endif //GUARD_FIELD_CAMERA_H diff --git a/include/field_door.h b/include/field_door.h index f1dfc551d..dd039a5c2 100644 --- a/include/field_door.h +++ b/include/field_door.h @@ -1,11 +1,27 @@ #ifndef GUARD_FIELDDOOR_H #define GUARD_FIELDDOOR_H +struct DoorGraphics +{ + u16 metatileNum; + u8 sound; + u8 size; + const void *tiles; + const void *palette; +}; + +struct DoorAnimFrame +{ + u8 time; + u16 offset; +}; + void FieldSetDoorOpened(u32, u32); void FieldSetDoorClosed(u32, u32); s8 FieldAnimateDoorClose(u32, u32); s8 FieldAnimateDoorOpen(u32, u32); bool8 FieldIsDoorAnimationRunning(void); u32 GetDoorSoundEffect(u32 x, u32 y); +bool8 sub_808A964(void); #endif diff --git a/ld_script.txt b/ld_script.txt index 4a4e41058..e7a8f81f7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -92,7 +92,7 @@ SECTIONS { asm/fieldmap.o(.text); src/metatile_behavior.o(.text); asm/field_camera.o(.text); - asm/field_door.o(.text); + src/field_door.o(.text); asm/field_player_avatar.o(.text); src/field_map_obj.o(.text); asm/field_ground_effect.o(.text); @@ -363,7 +363,7 @@ SECTIONS { data/maps.o(.rodata); data/fieldmap.o(.rodata); src/metatile_behavior.o(.rodata); - data/field_door.o(.rodata); + src/field_door.o(.rodata); data/field_player_avatar.o(.rodata); data/field_map_obj.o(.rodata); data/field_ground_effect.o(.rodata); diff --git a/src/field_door.c b/src/field_door.c new file mode 100644 index 000000000..38c031264 --- /dev/null +++ b/src/field_door.c @@ -0,0 +1,896 @@ +#include "global.h" +#include "field_door.h" +#include "field_camera.h" +#include "fieldmap.h" +#include "metatile_behavior.h" +#include "event_data.h" +#include "constants/songs.h" +#include "constants/flags.h" +#include "constants/maps.h" +#include "task.h" + +const u8 DoorAnimTiles_04[][0x100] = +{ + INCBIN_U8("graphics/door_anims/04/0.4bpp"), + INCBIN_U8("graphics/door_anims/04/1.4bpp"), + INCBIN_U8("graphics/door_anims/04/2.4bpp"), +}; + +// TODO: Make these blank palette includes? +asm(".space 32"); + +const u8 DoorAnimTiles_05[][0x100] = +{ + INCBIN_U8("graphics/door_anims/05/0.4bpp"), + INCBIN_U8("graphics/door_anims/05/1.4bpp"), + INCBIN_U8("graphics/door_anims/05/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_08[][0x100] = +{ + INCBIN_U8("graphics/door_anims/08/0.4bpp"), + INCBIN_U8("graphics/door_anims/08/1.4bpp"), + INCBIN_U8("graphics/door_anims/08/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_15[][0x100] = +{ + INCBIN_U8("graphics/door_anims/15/0.4bpp"), + INCBIN_U8("graphics/door_anims/15/1.4bpp"), + INCBIN_U8("graphics/door_anims/15/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_16[][0x100] = +{ + INCBIN_U8("graphics/door_anims/16/0.4bpp"), + INCBIN_U8("graphics/door_anims/16/1.4bpp"), + INCBIN_U8("graphics/door_anims/16/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_00[][0x100] = +{ + INCBIN_U8("graphics/door_anims/00/0.4bpp"), + INCBIN_U8("graphics/door_anims/00/1.4bpp"), + INCBIN_U8("graphics/door_anims/00/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_01[][0x100] = +{ + INCBIN_U8("graphics/door_anims/01/0.4bpp"), + INCBIN_U8("graphics/door_anims/01/1.4bpp"), + INCBIN_U8("graphics/door_anims/01/2.4bpp"), +}; + +const u8 DoorAnimTiles_02[][0x100] = +{ + INCBIN_U8("graphics/door_anims/02/0.4bpp"), + INCBIN_U8("graphics/door_anims/02/1.4bpp"), + INCBIN_U8("graphics/door_anims/02/2.4bpp"), +}; + +const u8 DoorAnimTiles_03[][0x100] = +{ + INCBIN_U8("graphics/door_anims/03/0.4bpp"), + INCBIN_U8("graphics/door_anims/03/1.4bpp"), + INCBIN_U8("graphics/door_anims/03/2.4bpp"), +}; + +const u8 DoorAnimTiles_06[][0x100] = +{ + INCBIN_U8("graphics/door_anims/06/0.4bpp"), + INCBIN_U8("graphics/door_anims/06/1.4bpp"), + INCBIN_U8("graphics/door_anims/06/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_07[][0x100] = +{ + INCBIN_U8("graphics/door_anims/07/0.4bpp"), + INCBIN_U8("graphics/door_anims/07/1.4bpp"), + INCBIN_U8("graphics/door_anims/07/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_09[][0x100] = +{ + INCBIN_U8("graphics/door_anims/09/0.4bpp"), + INCBIN_U8("graphics/door_anims/09/1.4bpp"), + INCBIN_U8("graphics/door_anims/09/2.4bpp"), +}; + +asm(".space 0x5900"); + +const u8 DoorAnimTiles_UnusedTops[][0x40] = +{ + INCBIN_U8("graphics/door_anims/unused_848EDEC/0_top.4bpp"), + INCBIN_U8("graphics/door_anims/unused_848EDEC/1_top.4bpp"), + INCBIN_U8("graphics/door_anims/unused_848EDEC/2_top.4bpp"), +}; + +asm(".space 0x140"); + +const u8 DoorAnimTiles_UnusedBottoms[][0x40] = +{ + INCBIN_U8("graphics/door_anims/unused_848EDEC/0_bottom.4bpp"), + INCBIN_U8("graphics/door_anims/unused_848EDEC/1_bottom.4bpp"), + INCBIN_U8("graphics/door_anims/unused_848EDEC/2_bottom.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_10[][0x100] = +{ + INCBIN_U8("graphics/door_anims/10/0.4bpp"), + INCBIN_U8("graphics/door_anims/10/1.4bpp"), + INCBIN_U8("graphics/door_anims/10/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_11[][0x100] = +{ + INCBIN_U8("graphics/door_anims/11/0.4bpp"), + INCBIN_U8("graphics/door_anims/11/1.4bpp"), + INCBIN_U8("graphics/door_anims/11/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_12[][0x100] = +{ + INCBIN_U8("graphics/door_anims/12/0.4bpp"), + INCBIN_U8("graphics/door_anims/12/1.4bpp"), + INCBIN_U8("graphics/door_anims/12/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_13[][0x100] = +{ + INCBIN_U8("graphics/door_anims/13/0.4bpp"), + INCBIN_U8("graphics/door_anims/13/1.4bpp"), + INCBIN_U8("graphics/door_anims/13/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_14[][0x100] = +{ + INCBIN_U8("graphics/door_anims/14/0.4bpp"), + INCBIN_U8("graphics/door_anims/14/1.4bpp"), + INCBIN_U8("graphics/door_anims/14/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_17[][0x100] = +{ + INCBIN_U8("graphics/door_anims/17/0.4bpp"), + INCBIN_U8("graphics/door_anims/17/1.4bpp"), + INCBIN_U8("graphics/door_anims/17/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_18[][0x100] = +{ + INCBIN_U8("graphics/door_anims/18/0.4bpp"), + INCBIN_U8("graphics/door_anims/18/1.4bpp"), + INCBIN_U8("graphics/door_anims/18/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_19[][0x100] = +{ + INCBIN_U8("graphics/door_anims/19/0.4bpp"), + INCBIN_U8("graphics/door_anims/19/1.4bpp"), + INCBIN_U8("graphics/door_anims/19/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_20[][0x100] = +{ + INCBIN_U8("graphics/door_anims/20/0.4bpp"), + INCBIN_U8("graphics/door_anims/20/1.4bpp"), + INCBIN_U8("graphics/door_anims/20/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_21[][0x100] = +{ + INCBIN_U8("graphics/door_anims/21/0.4bpp"), + INCBIN_U8("graphics/door_anims/21/1.4bpp"), + INCBIN_U8("graphics/door_anims/21/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_22[][0x100] = +{ + INCBIN_U8("graphics/door_anims/22/0.4bpp"), + INCBIN_U8("graphics/door_anims/22/1.4bpp"), + INCBIN_U8("graphics/door_anims/22/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_23[][0x100] = +{ + INCBIN_U8("graphics/door_anims/23/0.4bpp"), + INCBIN_U8("graphics/door_anims/23/1.4bpp"), + INCBIN_U8("graphics/door_anims/23/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_24[][0x100] = +{ + INCBIN_U8("graphics/door_anims/24/0.4bpp"), + INCBIN_U8("graphics/door_anims/24/1.4bpp"), + INCBIN_U8("graphics/door_anims/24/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_25[][0x100] = +{ + INCBIN_U8("graphics/door_anims/25/0.4bpp"), + INCBIN_U8("graphics/door_anims/25/1.4bpp"), + INCBIN_U8("graphics/door_anims/25/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_26[][0x100] = +{ + INCBIN_U8("graphics/door_anims/26/0.4bpp"), + INCBIN_U8("graphics/door_anims/26/1.4bpp"), + INCBIN_U8("graphics/door_anims/26/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_27[][0x100] = +{ + INCBIN_U8("graphics/door_anims/27/0.4bpp"), + INCBIN_U8("graphics/door_anims/27/1.4bpp"), + INCBIN_U8("graphics/door_anims/27/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_28[][0x100] = +{ + INCBIN_U8("graphics/door_anims/28/0.4bpp"), + INCBIN_U8("graphics/door_anims/28/1.4bpp"), + INCBIN_U8("graphics/door_anims/28/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_29[][0x100] = +{ + INCBIN_U8("graphics/door_anims/29/0.4bpp"), + INCBIN_U8("graphics/door_anims/29/1.4bpp"), + INCBIN_U8("graphics/door_anims/29/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_30[][0x100] = +{ + INCBIN_U8("graphics/door_anims/30/0.4bpp"), + INCBIN_U8("graphics/door_anims/30/1.4bpp"), + INCBIN_U8("graphics/door_anims/30/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_31[][0x100] = +{ + INCBIN_U8("graphics/door_anims/31/0.4bpp"), + INCBIN_U8("graphics/door_anims/31/1.4bpp"), + INCBIN_U8("graphics/door_anims/31/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_32[][0x100] = +{ + INCBIN_U8("graphics/door_anims/32/0.4bpp"), + INCBIN_U8("graphics/door_anims/32/1.4bpp"), + INCBIN_U8("graphics/door_anims/32/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_33[][0x100] = +{ + INCBIN_U8("graphics/door_anims/33/0.4bpp"), + INCBIN_U8("graphics/door_anims/33/1.4bpp"), + INCBIN_U8("graphics/door_anims/33/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_34[][0x100] = +{ + INCBIN_U8("graphics/door_anims/34/0.4bpp"), + INCBIN_U8("graphics/door_anims/34/1.4bpp"), + INCBIN_U8("graphics/door_anims/34/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_35[][0x100] = +{ + INCBIN_U8("graphics/door_anims/35/0.4bpp"), + INCBIN_U8("graphics/door_anims/35/1.4bpp"), + INCBIN_U8("graphics/door_anims/35/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_36[][0x100] = +{ + INCBIN_U8("graphics/door_anims/36/0.4bpp"), + INCBIN_U8("graphics/door_anims/36/1.4bpp"), + INCBIN_U8("graphics/door_anims/36/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_37[][0x100] = +{ + INCBIN_U8("graphics/door_anims/37/0.4bpp"), + INCBIN_U8("graphics/door_anims/37/1.4bpp"), + INCBIN_U8("graphics/door_anims/37/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_38[][0x100] = +{ + INCBIN_U8("graphics/door_anims/38/0.4bpp"), + INCBIN_U8("graphics/door_anims/38/1.4bpp"), + INCBIN_U8("graphics/door_anims/38/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_39[][0x100] = +{ + INCBIN_U8("graphics/door_anims/39/0.4bpp"), + INCBIN_U8("graphics/door_anims/39/1.4bpp"), + INCBIN_U8("graphics/door_anims/39/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_40[][0x100] = +{ + INCBIN_U8("graphics/door_anims/40/0.4bpp"), + INCBIN_U8("graphics/door_anims/40/1.4bpp"), + INCBIN_U8("graphics/door_anims/40/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_41[][0x100] = +{ + INCBIN_U8("graphics/door_anims/41/0.4bpp"), + INCBIN_U8("graphics/door_anims/41/1.4bpp"), + INCBIN_U8("graphics/door_anims/41/2.4bpp"), +}; + +const u8 DoorAnimTiles_42[][0x100] = +{ + INCBIN_U8("graphics/door_anims/42/0.4bpp"), + INCBIN_U8("graphics/door_anims/42/1.4bpp"), + INCBIN_U8("graphics/door_anims/42/2.4bpp"), + INCBIN_U8("graphics/door_anims/42/3.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_43[][0x100] = +{ + INCBIN_U8("graphics/door_anims/43/0.4bpp"), + INCBIN_U8("graphics/door_anims/43/1.4bpp"), + INCBIN_U8("graphics/door_anims/43/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_44[][0x100] = +{ + INCBIN_U8("graphics/door_anims/44/0_left.4bpp"), + INCBIN_U8("graphics/door_anims/44/0_right.4bpp"), + INCBIN_U8("graphics/door_anims/44/1_left.4bpp"), + INCBIN_U8("graphics/door_anims/44/1_right.4bpp"), + INCBIN_U8("graphics/door_anims/44/2_left.4bpp"), + INCBIN_U8("graphics/door_anims/44/2_right.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_45[][0x100] = +{ + INCBIN_U8("graphics/door_anims/45/0.4bpp"), + INCBIN_U8("graphics/door_anims/45/1.4bpp"), + INCBIN_U8("graphics/door_anims/45/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_46[][0x100] = +{ + INCBIN_U8("graphics/door_anims/46/0.4bpp"), + INCBIN_U8("graphics/door_anims/46/1.4bpp"), + INCBIN_U8("graphics/door_anims/46/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_47[][0x100] = +{ + INCBIN_U8("graphics/door_anims/47/0.4bpp"), + INCBIN_U8("graphics/door_anims/47/1.4bpp"), + INCBIN_U8("graphics/door_anims/47/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_48[][0x100] = +{ + INCBIN_U8("graphics/door_anims/48/0.4bpp"), + INCBIN_U8("graphics/door_anims/48/1.4bpp"), + INCBIN_U8("graphics/door_anims/48/2.4bpp"), + INCBIN_U8("graphics/door_anims/48/3.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_49[][0x100] = +{ + INCBIN_U8("graphics/door_anims/49/0.4bpp"), + INCBIN_U8("graphics/door_anims/49/1.4bpp"), + INCBIN_U8("graphics/door_anims/49/2.4bpp"), +}; + +asm(".space 32"); + +const u8 DoorAnimTiles_50[][0x100] = +{ + INCBIN_U8("graphics/door_anims/50/0.4bpp"), + INCBIN_U8("graphics/door_anims/50/1.4bpp"), + INCBIN_U8("graphics/door_anims/50/2.4bpp"), +}; + +asm(".space 32"); + +static const struct DoorAnimFrame gDoorOpenAnimFrames[] = +{ + {4, -1}, + {4, 0}, + {4, 0x100}, + {4, 0x200}, + {0, 0}, +}; + +static const struct DoorAnimFrame gDoorCloseAnimFrames[] = +{ + {4, 0x200}, + {4, 0x100}, + {4, 0}, + {4, -1}, + {0, 0}, +}; + +static const struct DoorAnimFrame gBigDoorOpenAnimFrames[] = +{ + {4, -1}, + {4, 0}, + {4, 0x200}, + {4, 0x400}, + {0, 0}, +}; + +static const struct DoorAnimFrame gBigDoorCloseAnimFrames[] = +{ + {4, 0x400}, + {4, 0x200}, + {4, 0}, + {4, -1}, + {0, 0}, +}; + +const u8 DoorAnimPalettes_8496FDC[] = {1, 1, 1, 1, 1, 1, 1, 1}; // door 00 +const u8 DoorAnimPalettes_8496FE4[] = {1, 1, 1, 1, 1, 1, 1, 1}; // door 01 +const u8 DoorAnimPalettes_8496FEC[] = {5, 5, 5, 5, 5, 5, 5, 5}; // door 02 +const u8 DoorAnimPalettes_8496FF4[] = {0, 0, 1, 1, 1, 1, 1, 1}; // door 03 +const u8 DoorAnimPalettes_8496FFC[] = {10, 10, 6, 6, 6, 6, 6, 6}; // door 04 +const u8 DoorAnimPalettes_8497004[] = {8, 8, 8, 8, 8, 8, 8, 8}; // door 05 +const u8 DoorAnimPalettes_849700C[] = {11, 11, 11, 11, 11, 11, 11, 11}; // door 06 +const u8 DoorAnimPalettes_8497014[] = {10, 10, 10, 10, 10, 10, 10, 10}; // door 07 +const u8 DoorAnimPalettes_849701C[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 08 +const u8 DoorAnimPalettes_8497024[] = {8, 8, 8, 8, 8, 8, 8, 8}; // door 09 +const u8 DoorAnimPalettes_849702C[] = {10, 10, 9, 9, 9, 9, 9, 9}; // door 10 +const u8 DoorAnimPalettes_8497034[] = {9, 9, 1, 1, 1, 1, 1, 1}; // door 11 +const u8 DoorAnimPalettes_849703C[] = {8, 8, 8, 8, 8, 8, 8, 8}; // door 12 +const u8 DoorAnimPalettes_8497044[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 13 +const u8 DoorAnimPalettes_849704C[] = {6, 6, 6, 6, 6, 6, 6, 6}; // door 14 +const u8 DoorAnimPalettes_8497054[] = {6, 6, 6, 6, 6, 6, 6, 6}; // door 15 +const u8 DoorAnimPalettes_849705C[] = {0, 0, 5, 5, 5, 5, 5, 5}; // door 16 +const u8 DoorAnimPalettes_8497064[] = {6, 6, 1, 1, 1, 1, 1, 1}; // door 17 +const u8 DoorAnimPalettes_849706C[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 18 +const u8 DoorAnimPalettes_8497074[] = {6, 6, 5, 5, 5, 5, 5, 5}; // door 19 +const u8 DoorAnimPalettes_849707C[] = {5, 5, 5, 5, 5, 5, 5, 5}; // door 20 +const u8 DoorAnimPalettes_8497084[] = {1, 1, 1, 1, 1, 1, 1, 1}; // door 21 +const u8 DoorAnimPalettes_849708C[] = {6, 6, 6, 6, 6, 6, 6, 6}; // door 22 +const u8 DoorAnimPalettes_8497094[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 23 +const u8 DoorAnimPalettes_849709C[] = {5, 5, 5, 5, 5, 5, 5, 5}; // door 24 +const u8 DoorAnimPalettes_84970A4[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 25 +const u8 DoorAnimPalettes_84970AC[] = {8, 8, 8, 8, 8, 8, 8, 8}; // door 26 +const u8 DoorAnimPalettes_84970B4[] = {6, 6, 6, 6, 6, 6, 6, 6}; // door 27 +const u8 DoorAnimPalettes_84970BC[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 28 +const u8 DoorAnimPalettes_84970C4[] = {11, 11, 7, 7, 7, 7, 7, 7}; // door 29 +const u8 DoorAnimPalettes_84970CC[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 30 +const u8 DoorAnimPalettes_84970D4[] = {6, 6, 7, 7, 7, 7, 7, 7}; // door 31 +const u8 DoorAnimPalettes_84970DC[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 32 +const u8 DoorAnimPalettes_84970E4[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 33 +const u8 DoorAnimPalettes_84970EC[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 34 +const u8 DoorAnimPalettes_84970F4[] = {1, 1, 1, 1, 1, 1, 1, 1}; // door 35 +const u8 DoorAnimPalettes_84970FC[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 36 +const u8 DoorAnimPalettes_8497104[] = {0, 0, 0, 0, 0, 0, 0, 0}; // door 37 +const u8 DoorAnimPalettes_849710C[] = {5, 5, 5, 5, 5, 5, 5, 5}; // door 38 +const u8 DoorAnimPalettes_8497114[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 39 +const u8 DoorAnimPalettes_849711C[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 40 +const u8 DoorAnimPalettes_8497124[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 41 +const u8 DoorAnimPalettes_849712C[] = {1, 1, 1, 1, 1, 1, 1, 1}; // doors 42, 43, and 44 +const u8 DoorAnimPalettes_8497134[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 45 +const u8 DoorAnimPalettes_849713C[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 46 +const u8 DoorAnimPalettes_8497144[] = {1, 1, 1, 1, 1, 1, 1, 1}; // unused +const u8 DoorAnimPalettes_849714C[] = {1, 1, 1, 1, 1, 1, 1, 1}; // doors 47 and 48 +const u8 DoorAnimPalettes_8497154[] = {9, 9, 7, 7, 7, 7, 7, 7}; // door 49 +const u8 DoorAnimPalettes_849715C[] = {9, 9, 9, 9, 9, 9, 9, 9}; // door 50 +const u8 DoorAnimPalettes_8497164[] = {7, 7, 7, 7, 7, 7, 7, 7}; // door 51 +const u8 DoorAnimPalettes_849716C[] = {9, 9, 7, 7, 7, 7, 7, 7}; // door 52 + +static const struct DoorGraphics gDoorAnimGraphicsTable[] = +{ + {0x021, 0, 1, DoorAnimTiles_00, DoorAnimPalettes_8496FDC}, // door 00 + {0x061, 1, 1, DoorAnimTiles_01, DoorAnimPalettes_8496FE4}, // door 01 + {0x1CD, 1, 1, DoorAnimTiles_02, DoorAnimPalettes_8496FEC}, // door 02 + {0x041, 1, 1, DoorAnimTiles_03, DoorAnimPalettes_8496FF4}, // door 03 + {0x248, 0, 1, DoorAnimTiles_04, DoorAnimPalettes_8496FFC}, // door 04 + {0x249, 0, 1, DoorAnimTiles_05, DoorAnimPalettes_8497004}, // door 05 + {0x22F, 0, 1, DoorAnimTiles_06, DoorAnimPalettes_849700C}, // door 06 + {0x21F, 0, 1, DoorAnimTiles_07, DoorAnimPalettes_8497014}, // door 07 + {0x2A5, 0, 1, DoorAnimTiles_08, DoorAnimPalettes_849701C}, // door 08 + {0x287, 0, 1, DoorAnimTiles_09, DoorAnimPalettes_849702C}, // door 09 + {0x2AC, 0, 1, DoorAnimTiles_10, DoorAnimPalettes_849706C}, // door 10 + {0x3A1, 0, 1, DoorAnimTiles_11, DoorAnimPalettes_8497074}, // door 11 + {0x2DC, 0, 1, DoorAnimTiles_12, DoorAnimPalettes_8497064}, // door 12 + {0x225, 0, 1, DoorAnimTiles_13, DoorAnimPalettes_849705C}, // door 13 + {0x1DB, 1, 1, DoorAnimTiles_14, DoorAnimPalettes_8497084}, // door 14 + {0x246, 0, 1, DoorAnimTiles_15, DoorAnimPalettes_8497024}, // door 15 + {0x28E, 0, 1, DoorAnimTiles_16, DoorAnimPalettes_849707C}, // door 16 + {0x2A1, 0, 1, DoorAnimTiles_17, DoorAnimPalettes_8497034}, // door 17 + {0x21C, 0, 1, DoorAnimTiles_18, DoorAnimPalettes_849704C}, // door 18 + {0x21E, 0, 1, DoorAnimTiles_19, DoorAnimPalettes_8497054}, // door 19 + {0x21D, 1, 1, DoorAnimTiles_20, DoorAnimPalettes_849703C}, // door 20 + {0x21A, 0, 1, DoorAnimTiles_21, DoorAnimPalettes_8497044}, // door 21 + {0x224, 0, 1, DoorAnimTiles_22, DoorAnimPalettes_849708C}, // door 22 + {0x289, 0, 1, DoorAnimTiles_23, DoorAnimPalettes_8497094}, // door 23 + {0x30C, 1, 1, DoorAnimTiles_24, DoorAnimPalettes_849709C}, // door 24 + {0x32D, 1, 1, DoorAnimTiles_25, DoorAnimPalettes_84970A4}, // door 25 + {0x2ED, 1, 1, DoorAnimTiles_26, DoorAnimPalettes_84970AC}, // door 26 + {0x264, 1, 1, DoorAnimTiles_27, DoorAnimPalettes_84970B4}, // door 27 + {0x22B, 0, 1, DoorAnimTiles_28, DoorAnimPalettes_84970BC}, // door 28 + {0x2F7, 0, 1, DoorAnimTiles_29, DoorAnimPalettes_84970C4}, // door 29 + {0x297, 0, 1, DoorAnimTiles_30, DoorAnimPalettes_84970CC}, // door 30 + {0x285, 1, 1, DoorAnimTiles_31, DoorAnimPalettes_84970D4}, // door 31 + {0x25D, 1, 1, DoorAnimTiles_32, DoorAnimPalettes_84970DC}, // door 32 + {0x20E, 1, 1, DoorAnimTiles_33, DoorAnimPalettes_84970E4}, // door 33 + {0x3B0, 1, 1, DoorAnimTiles_34, DoorAnimPalettes_84970EC}, // door 34 + {0x28A, 1, 1, DoorAnimTiles_35, DoorAnimPalettes_84970F4}, // door 35 + {0x263, 1, 1, DoorAnimTiles_36, DoorAnimPalettes_84970FC}, // door 36 + {0x329, 1, 1, DoorAnimTiles_37, DoorAnimPalettes_8497104}, // door 37 + {0x291, 0, 1, DoorAnimTiles_38, DoorAnimPalettes_849710C}, // door 38 + {0x21B, 2, 1, DoorAnimTiles_39, DoorAnimPalettes_8497114}, // door 39 + {0x209, 1, 1, DoorAnimTiles_40, DoorAnimPalettes_849711C}, // door 40 + {0x219, 0, 1, DoorAnimTiles_41, DoorAnimPalettes_8497124}, // door 41 + {0x393, 1, 1, DoorAnimTiles_42, DoorAnimPalettes_849712C}, // door 42 + {0x3D4, 1, 1, DoorAnimTiles_42, DoorAnimPalettes_849712C}, // door 43 + {0x36C, 1, 1, DoorAnimTiles_42, DoorAnimPalettes_849712C}, // door 44 + {0x25E, 1, 1, DoorAnimTiles_43, DoorAnimPalettes_8497134}, // door 45 + {0x2AD, 1, 2, DoorAnimTiles_44, DoorAnimPalettes_849713C}, // door 46 + {0x3FC, 0, 1, DoorAnimTiles_45, DoorAnimPalettes_849714C}, // door 47 + {0x396, 1, 1, DoorAnimTiles_46, DoorAnimPalettes_849714C}, // door 48 + {0x20A, 1, 1, DoorAnimTiles_47, DoorAnimPalettes_8497154}, // door 49 + {0x26B, 1, 1, DoorAnimTiles_48, DoorAnimPalettes_849715C}, // door 50 + {0x32C, 1, 1, DoorAnimTiles_49, DoorAnimPalettes_8497164}, // door 51 + {0x383, 1, 1, DoorAnimTiles_50, DoorAnimPalettes_849716C}, // door 52 + {0, 0, 0, NULL, NULL}, +}; + +static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame) +{ + if (gfx->size == 2) + CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7E00), 0x80); + else + CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7F00), 0x40); +} + +static void door_build_blockdef(u16 *a, u16 b, const u8 *c) +{ + int i; + u16 unk; + + for (i = 0; i < 4; i++) + { + unk = *(c++) << 12; + a[i] = unk | (b + i); + } + for (; i < 8; i++) + { + unk = *(c++) << 12; + a[i] = unk; + } +} + +static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *pal) +{ + u16 arr[24]; + + if (gfx->size == 2) + { + door_build_blockdef(&arr[8], 0x3F0, pal); + DrawDoorMetatileAt(x, y - 1, &arr[8]); + door_build_blockdef(&arr[8], 0x3F4, pal + 4); + DrawDoorMetatileAt(x, y, &arr[8]); + door_build_blockdef(&arr[8], 0x3F8, pal); + DrawDoorMetatileAt(x + 1, y - 1, &arr[8]); + door_build_blockdef(&arr[8], 0x3FC, pal + 4); + DrawDoorMetatileAt(x + 1, y, &arr[8]); + } + else + { + door_build_blockdef(&arr[0], 0x3F8, pal); + DrawDoorMetatileAt(x, y - 1, &arr[0]); + door_build_blockdef(&arr[0], 0x3FC, pal + 4); + DrawDoorMetatileAt(x, y, &arr[0]); + } +} + +static void DrawClosedDoorTiles(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + CurrentMapDrawMetatileAt(x, y - 1); + CurrentMapDrawMetatileAt(x, y); + + if (gfx->size == 2) + { + CurrentMapDrawMetatileAt(x + 1, y - 1); + CurrentMapDrawMetatileAt(x + 1, y); + } +} + +static void DrawDoor(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame, u32 x, u32 y) +{ + if (frame->offset == 0xFFFF) + { + DrawClosedDoorTiles(gfx, x, y); + if (sub_808A964()) + DrawClosedDoorTiles(gfx, gSpecialVar_0x8004 + 7, gSpecialVar_0x8005 + 7); + } + else + { + CopyDoorTilesToVram(gfx, frame); + DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palette); + if (sub_808A964()) + DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + 7, gSpecialVar_0x8005 + 7, gfx->palette); + } +} + +enum +{ + TD_FRAMELIST = 0, + TD_GFX = 2, + TD_FRAME = 4, + TD_COUNTER, + TD_X, + TD_Y +}; + +static bool32 sub_808A5F0(struct DoorGraphics *gfx, struct DoorAnimFrame *frames, s16 *taskData) +{ + if (taskData[TD_COUNTER] == 0) + DrawDoor(gfx, &frames[taskData[TD_FRAME]], taskData[TD_X], taskData[TD_Y]); + if (taskData[TD_COUNTER] == frames[taskData[TD_FRAME]].time) + { + taskData[TD_COUNTER] = 0; + taskData[TD_FRAME]++; + if (frames[taskData[TD_FRAME]].time == 0) + return FALSE; + else + return TRUE; + } + taskData[TD_COUNTER]++; + return TRUE; +} + +static void Task_AnimateDoor(u8 taskId) +{ + u16 *taskData = gTasks[taskId].data; + struct DoorAnimFrame *frames = (struct DoorAnimFrame *)(taskData[TD_FRAMELIST] << 16 | taskData[TD_FRAMELIST + 1]); + struct DoorGraphics *gfx = (struct DoorGraphics *)(taskData[TD_GFX] << 16 | taskData[TD_GFX + 1]); + + if (sub_808A5F0(gfx, frames, taskData) == FALSE) + DestroyTask(taskId); +} + +static const struct DoorAnimFrame *GetLastDoorFrame(const struct DoorAnimFrame *frame, const void *unused) +{ + while (frame->time != 0) + frame++; + return frame - 1; +} + +static const struct DoorGraphics *GetDoorGraphics(const struct DoorGraphics *gfx, u16 metatileNum) +{ + while (gfx->tiles != NULL) + { + if (gfx->metatileNum == metatileNum) + return gfx; + gfx++; + } + return NULL; +} + +static s8 StartDoorAnimationTask(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frames, u32 x, u32 y) +{ + if (FuncIsActiveTask(Task_AnimateDoor) == TRUE) + return -1; + else + { + u8 taskId = CreateTask(Task_AnimateDoor, 0x50); + s16 *taskData = gTasks[taskId].data; + + taskData[TD_X] = x; + taskData[TD_Y] = y; + + taskData[TD_FRAMELIST + 1] = (u32)frames; + taskData[TD_FRAMELIST] = (u32)frames >> 16; + + taskData[TD_GFX + 1] = (u32)gfx; + taskData[TD_GFX] = (u32)gfx >> 16; + + return taskId; + } +} + +static void DrawClosedDoor(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + DrawClosedDoorTiles(gfx, x, y); +} + +static void DrawOpenedDoor(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + gfx = GetDoorGraphics(gfx, MapGridGetMetatileIdAt(x, y)); + if (gfx != NULL) + DrawDoor(gfx, GetLastDoorFrame(gDoorOpenAnimFrames, gDoorOpenAnimFrames), x, y); +} + +static s8 StartDoorOpenAnimation(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + gfx = GetDoorGraphics(gfx, MapGridGetMetatileIdAt(x, y)); + if (gfx == NULL) + { + return -1; + } + else + { + if (gfx->size == 2) + return StartDoorAnimationTask(gfx, gBigDoorOpenAnimFrames, x, y); + else + return StartDoorAnimationTask(gfx, gDoorOpenAnimFrames, x, y); + } +} + +static s8 StartDoorCloseAnimation(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + gfx = GetDoorGraphics(gfx, MapGridGetMetatileIdAt(x, y)); + if (gfx == NULL) + return -1; + else + return StartDoorAnimationTask(gfx, gDoorCloseAnimFrames, x, y); +} + +static s8 cur_mapdata_get_door_x2_at(const struct DoorGraphics *gfx, u32 x, u32 y) +{ + gfx = GetDoorGraphics(gfx, MapGridGetMetatileIdAt(x, y)); + if (gfx == NULL) + return -1; + else + return gfx->sound; +} + +void unref_sub_808A83C(u32 x, u32 y) +{ + StartDoorOpenAnimation(gDoorAnimGraphicsTable, x, y); +} + +void FieldSetDoorOpened(u32 x, u32 y) +{ + if (MetatileBehavior_IsDoor(MapGridGetMetatileBehaviorAt(x, y))) + DrawOpenedDoor(gDoorAnimGraphicsTable, x, y); +} + +void FieldSetDoorClosed(u32 x, u32 y) +{ + if (MetatileBehavior_IsDoor(MapGridGetMetatileBehaviorAt(x, y))) + DrawClosedDoor(gDoorAnimGraphicsTable, x, y); +} + +s8 FieldAnimateDoorClose(u32 x, u32 y) +{ + if (!MetatileBehavior_IsDoor(MapGridGetMetatileBehaviorAt(x, y))) + return -1; + else + return StartDoorCloseAnimation(gDoorAnimGraphicsTable, x, y); +} + +s8 FieldAnimateDoorOpen(u32 x, u32 y) +{ + if (!MetatileBehavior_IsDoor(MapGridGetMetatileBehaviorAt(x, y))) + return -1; + else + return StartDoorOpenAnimation(gDoorAnimGraphicsTable, x, y); +} + +bool8 FieldIsDoorAnimationRunning(void) +{ + return FuncIsActiveTask(Task_AnimateDoor); +} + +u32 GetDoorSoundEffect(u32 x, u32 y) +{ + int sound = cur_mapdata_get_door_x2_at(gDoorAnimGraphicsTable, x, y); + + if (sound == 0) + return SE_DOOR; + else if (sound == 1) + return SE_JIDO_DOA; + else if (sound == 2) + return SE_TU_SAA; + else + return SE_DOOR; +} + +bool8 sub_808A964(void) +{ + if (FlagGet(FLAG_SPECIAL_FLAG_0x4002)) + { + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR_2) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR_2)) + { + return TRUE; + } + } + return FALSE; +}