diff --git a/Makefile b/Makefile index ed71b35f..caf5a55e 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s) ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS)) -DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s) +DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s $(DATA_ASM_SUBDIR)/**/*.s) DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS)) SONG_SRCS := $(wildcard $(SONG_SUBDIR)/*.s) diff --git a/asm/beetle.s b/asm/beetle.s deleted file mode 100644 index 9bdbd6d4..00000000 --- a/asm/beetle.s +++ /dev/null @@ -1,812 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start Beetle -Beetle: @ 0x08021758 - push {lr} - ldr r1, _08021764 @ =gUnk_080CB590 - bl EnemyFunctionHandler - pop {pc} - .align 2, 0 -_08021764: .4byte gUnk_080CB590 - - thumb_func_start sub_08021768 -sub_08021768: @ 0x08021768 - push {lr} - ldr r2, _0802177C @ =gUnk_080CB5A8 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_0802177C: .4byte gUnk_080CB5A8 - - thumb_func_start sub_08021780 -sub_08021780: @ 0x08021780 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x41 - ldrb r0, [r0] - cmp r0, #0x80 - beq _08021792 - cmp r0, #0x93 - beq _080217F4 - b _080217FA -_08021792: - ldr r0, _080217A4 @ =gPlayerState - adds r0, #0xa8 - ldrb r0, [r0] - cmp r0, #0x18 - bne _080217A8 - adds r0, r4, #0 - bl sub_08021768 - b _080217FA - .align 2, 0 -_080217A4: .4byte gPlayerState -_080217A8: - movs r1, #0 - movs r0, #5 - strb r0, [r4, #0xc] - movs r0, #0xb4 - strb r0, [r4, #0xe] - strb r1, [r4, #0xf] - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #3 - orrs r0, r1 - strb r0, [r2] - ldr r0, _080217EC @ =gPlayerEntity - adds r1, r4, #0 - bl CopyPositionAndSpriteOffset - ldr r0, _080217F0 @ =0x0000FFFF - strh r0, [r4, #0x36] - adds r1, r4, #0 - adds r1, #0x87 - movs r0, #1 - strb r0, [r1] - adds r0, r4, #0 - movs r1, #6 - bl InitializeAnimation - b _080217FA - .align 2, 0 -_080217EC: .4byte gPlayerEntity -_080217F0: .4byte 0x0000FFFF -_080217F4: - adds r0, r4, #0 - bl sub_08021768 -_080217FA: - adds r0, r4, #0 - adds r0, #0x45 - ldrb r1, [r0] - cmp r1, #0 - bne _08021808 - subs r0, #3 - strb r1, [r0] -_08021808: - ldr r1, _08021814 @ =gUnk_080CB590 - adds r0, r4, #0 - bl sub_0804AA30 - pop {r4, pc} - .align 2, 0 -_08021814: .4byte gUnk_080CB590 - - thumb_func_start sub_08021818 -sub_08021818: @ 0x08021818 - push {lr} - adds r3, r0, #0 - ldrb r0, [r3, #0xa] - cmp r0, #0 - bne _0802182A - adds r0, r3, #0 - bl sub_0804A7D4 - b _08021844 -_0802182A: - ldr r2, [r3, #0x50] - cmp r2, #0 - beq _0802183A - ldrb r0, [r2, #0xf] - subs r0, #1 - movs r1, #0 - strb r0, [r2, #0xf] - str r1, [r3, #0x50] -_0802183A: - adds r0, r3, #0 - movs r1, #0xf0 - movs r2, #0 - bl CreateDeathFx -_08021844: - pop {pc} - .align 2, 0 - - thumb_func_start sub_08021848 -sub_08021848: @ 0x08021848 - push {r4, lr} - adds r4, r0, #0 - bl sub_0806F520 - adds r1, r0, #0 - cmp r1, #0 - beq _0802186C - ldr r0, _08021868 @ =gUnk_080CB5C8 - ldrb r1, [r4, #0xd] - lsls r1, r1, #2 - adds r1, r1, r0 - ldr r1, [r1] - adds r0, r4, #0 - bl _call_via_r1 - b _0802187A - .align 2, 0 -_08021868: .4byte gUnk_080CB5C8 -_0802186C: - movs r0, #3 - strb r0, [r4, #0xc] - strh r1, [r4, #0x36] - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation -_0802187A: - pop {r4, pc} - - thumb_func_start sub_0802187C -sub_0802187C: @ 0x0802187C - movs r1, #2 - strb r1, [r0, #0xd] - bx lr - .align 2, 0 - - thumb_func_start nullsub_130 -nullsub_130: @ 0x08021884 - bx lr - .align 2, 0 - - thumb_func_start sub_08021888 -sub_08021888: @ 0x08021888 - push {r4, lr} - adds r4, r0, #0 - bl sub_0806F3E4 - cmp r0, #0 - beq _0802189A - adds r0, r4, #0 - bl sub_08021818 -_0802189A: - pop {r4, pc} - - thumb_func_start sub_0802189C -sub_0802189C: @ 0x0802189C - push {r4, lr} - adds r4, r0, #0 - bl sub_0804A720 - movs r0, #1 - strb r0, [r4, #0xc] - strb r0, [r4, #0x1c] - adds r0, r4, #0 - movs r1, #3 - bl InitializeAnimation - pop {r4, pc} - - thumb_func_start sub_080218B4 -sub_080218B4: @ 0x080218B4 - push {lr} - ldr r2, _080218C8 @ =gUnk_080CB5D4 - ldrb r1, [r0, #0xb] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_080218C8: .4byte gUnk_080CB5D4 - - thumb_func_start sub_080218CC -sub_080218CC: @ 0x080218CC - push {r4, r5, r6, lr} - adds r5, r0, #0 - ldrb r0, [r5, #0xd] - cmp r0, #0 - bne _08021916 - movs r2, #1 - movs r0, #1 - strb r0, [r5, #0xd] - ldrb r1, [r5, #0x18] - subs r0, #5 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, #0x18] - adds r0, r5, #0 - movs r1, #1 - bl sub_08049F84 - adds r4, r0, #0 - bl Random - movs r1, #0x10 - eors r4, r1 - ldr r2, _08021980 @ =gUnk_080CB5DC - movs r1, #7 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - adds r0, r0, r4 - movs r1, #0x1f - ands r0, r1 - strb r0, [r5, #0x15] - movs r0, #0x80 - lsls r0, r0, #1 - strh r0, [r5, #0x24] - movs r0, #0x90 - lsls r0, r0, #9 - str r0, [r5, #0x20] -_08021916: - adds r0, r5, #0 - bl GetNextFrame - adds r2, r5, #0 - adds r2, #0x5a - ldrb r1, [r2] - movs r6, #1 - adds r0, r6, #0 - ands r0, r1 - adds r4, r2, #0 - cmp r0, #0 - beq _08021948 - adds r0, r5, #0 - bl sub_080AEFE0 - movs r1, #0xe0 - lsls r1, r1, #5 - adds r0, r5, #0 - bl sub_080044EC - cmp r0, #0 - bne _08021948 - adds r0, r5, #0 - adds r0, #0x59 - strb r6, [r0] -_08021948: - ldrb r1, [r4] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0802197C - movs r0, #2 - strb r0, [r5, #0xc] - bl Random - movs r1, #0x38 - ands r0, r1 - adds r0, #8 - strb r0, [r5, #0xe] - movs r0, #1 - strb r0, [r5, #0xf] - ldrb r1, [r5, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r5, #0x10] - movs r0, #0xc0 - lsls r0, r0, #1 - strh r0, [r5, #0x24] - adds r0, r5, #0 - movs r1, #0 - bl InitializeAnimation -_0802197C: - pop {r4, r5, r6, pc} - .align 2, 0 -_08021980: .4byte gUnk_080CB5DC - - thumb_func_start sub_08021984 -sub_08021984: @ 0x08021984 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xd] - cmp r0, #0 - bne _080219C2 - movs r0, #1 - strb r0, [r4, #0xd] - ldrb r1, [r4, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r4, #0x10] - ldrb r0, [r4, #0x18] - movs r1, #3 - orrs r0, r1 - strb r0, [r4, #0x18] - ldr r0, _08021A08 @ =0x0000FF80 - strh r0, [r4, #0x36] - ldrb r2, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r2 - movs r2, #0x40 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r4, #0x1b] - ands r1, r0 - orrs r1, r2 - strb r1, [r4, #0x1b] - ldr r0, _08021A0C @ =0x0000012D - bl sub_08004488 -_080219C2: - movs r1, #0xc0 - lsls r1, r1, #5 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _08021A04 - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x10 - strb r0, [r4, #0xe] - movs r2, #1 - movs r0, #1 - strb r0, [r4, #0xf] - ldrb r1, [r4, #0x18] - subs r0, #5 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, #0x18] - movs r0, #0xc0 - lsls r0, r0, #1 - strh r0, [r4, #0x24] - adds r1, r4, #0 - adds r1, #0x86 - movs r0, #0x3c - strb r0, [r1] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - adds r0, r4, #0 - bl UpdateSpriteForCollisionLayer -_08021A04: - pop {r4, pc} - .align 2, 0 -_08021A08: .4byte 0x0000FF80 -_08021A0C: .4byte 0x0000012D - - thumb_func_start sub_08021A10 -sub_08021A10: @ 0x08021A10 - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - ldr r1, _08021A60 @ =gPlayerEntity - adds r0, r4, #0 - movs r2, #0x78 - movs r3, #0x50 - bl sub_080041A0 - cmp r0, #0 - beq _08021A5E - adds r0, r4, #0 - bl sub_08021D00 - cmp r0, #0 - bne _08021A5E - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08021A5E - movs r0, #3 - strb r0, [r4, #0xc] - bl Random - movs r1, #0x3f - ands r0, r1 - adds r0, #0x1e - strb r0, [r4, #0xe] - ldrb r1, [r4, #0x15] - adds r0, r4, #0 - bl sub_08021D44 - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation -_08021A5E: - pop {r4, pc} - .align 2, 0 -_08021A60: .4byte gPlayerEntity - - thumb_func_start sub_08021A64 -sub_08021A64: @ 0x08021A64 - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_08021D00 - cmp r0, #0 - bne _08021AD4 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - movs r5, #0xff - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08021A96 - movs r0, #2 - strb r0, [r4, #0xc] - bl Random - movs r1, #0x1f - ands r0, r1 - adds r0, #0x1e - strb r0, [r4, #0xe] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_08021A96: - ldrb r0, [r4, #0xf] - subs r0, #1 - strb r0, [r4, #0xf] - ands r0, r5 - cmp r0, #0 - bne _08021AC8 - movs r0, #8 - strb r0, [r4, #0xf] - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - adds r1, r0, #0 - cmp r1, #0xff - bne _08021AC2 - movs r0, #7 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #1 - bl InitializeAnimation - b _08021AD4 -_08021AC2: - adds r0, r4, #0 - bl sub_08021D44 -_08021AC8: - adds r0, r4, #0 - bl sub_080AEF88 - adds r0, r4, #0 - bl GetNextFrame -_08021AD4: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08021AD8 -sub_08021AD8: @ 0x08021AD8 - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08021B3A - ldrb r0, [r4, #0xe] - cmp r0, #0 - beq _08021B1E - movs r0, #0 - strb r0, [r4, #0xe] - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - cmp r0, #0xff - bne _08021B16 - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #8 - strb r0, [r4, #0xe] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - b _08021B60 -_08021B16: - strb r0, [r4, #0x15] - movs r0, #0x7c - bl sub_08004488 -_08021B1E: - adds r0, r4, #0 - bl sub_080AEFE0 - movs r1, #0xc0 - lsls r1, r1, #5 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _08021B3A - adds r1, r4, #0 - adds r1, #0x59 - movs r0, #1 - strb r0, [r1] -_08021B3A: - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08021B60 - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x14 - strb r0, [r4, #0xe] - adds r1, r4, #0 - adds r1, #0x86 - movs r0, #0x3c - strb r0, [r1] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_08021B60: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08021B64 -sub_08021B64: @ 0x08021B64 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, _08021B88 @ =gPlayerState - ldr r1, [r0, #0x30] - movs r2, #4 - ands r1, r2 - adds r6, r0, #0 - cmp r1, #0 - beq _08021B8C - movs r1, #0 - movs r0, #3 - strb r0, [r4, #0xc] - str r1, [r4, #0x34] - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation - b _08021C4E - .align 2, 0 -_08021B88: .4byte gPlayerState -_08021B8C: - movs r5, #1 - adds r0, r6, #0 - adds r0, #0xa8 - ldrb r0, [r0] - cmp r0, #0xb - beq _08021BBA - cmp r0, #0x14 - beq _08021BBA - bl sub_0807953C - cmp r0, #0 - beq _08021BAE - ldrb r1, [r4, #0xa] - lsls r0, r1, #1 - adds r0, r0, r1 - adds r5, r0, #0 - adds r5, #8 -_08021BAE: - ldrb r0, [r4, #0xe] - subs r5, r0, r5 - cmp r5, #0 - bge _08021BB8 - movs r5, #0 -_08021BB8: - strb r5, [r4, #0xe] -_08021BBA: - ldr r0, [r6, #0x30] - movs r1, #0x88 - lsls r1, r1, #1 - ands r0, r1 - cmp r0, #0 - beq _08021BC8 - movs r5, #0 -_08021BC8: - cmp r5, #0 - bne _08021C04 - movs r0, #6 - strb r0, [r4, #0xc] - movs r0, #0x80 - lsls r0, r0, #9 - str r0, [r4, #0x20] - adds r0, r4, #0 - adds r0, #0x87 - strb r5, [r0] - ldr r2, _08021BEC @ =gPlayerEntity - ldrb r1, [r2, #0x15] - adds r0, r1, #0 - cmp r0, #0xff - beq _08021BF0 - movs r0, #0x10 - b _08021BF6 - .align 2, 0 -_08021BEC: .4byte gPlayerEntity -_08021BF0: - ldrb r0, [r2, #0x14] - lsls r0, r0, #2 - movs r1, #0x10 -_08021BF6: - eors r0, r1 - strb r0, [r4, #0x15] - adds r0, r4, #0 - movs r1, #5 - bl InitializeAnimation - b _08021C4E -_08021C04: - ldrb r1, [r6, #0x1a] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r6, #0x1a] - adds r1, r6, #0 - adds r1, #0x80 - ldrh r0, [r1] - subs r0, #0x50 - strh r0, [r1] - adds r1, #0x2a - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] - ldr r0, _08021C50 @ =gPlayerEntity - adds r1, r4, #0 - bl CopyPositionAndSpriteOffset - ldr r2, _08021C54 @ =gUnk_080CB5E4 - ldrb r1, [r4, #0xf] - adds r0, r1, #1 - strb r0, [r4, #0xf] - movs r0, #0xe - ands r0, r1 - lsrs r0, r0, #1 - adds r0, r0, r2 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - ldrh r1, [r4, #0x2e] - adds r0, r0, r1 - strh r0, [r4, #0x2e] - ldrh r0, [r4, #0x36] - subs r0, #1 - strh r0, [r4, #0x36] - adds r0, r4, #0 - bl GetNextFrame -_08021C4E: - pop {r4, r5, r6, pc} - .align 2, 0 -_08021C50: .4byte gPlayerEntity -_08021C54: .4byte gUnk_080CB5E4 - - thumb_func_start sub_08021C58 -sub_08021C58: @ 0x08021C58 - push {r4, r5, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r5, #1 - adds r0, r5, #0 - ands r0, r1 - cmp r0, #0 - beq _08021C8A - adds r0, r4, #0 - bl sub_080AEFE0 - movs r1, #0xc0 - lsls r1, r1, #5 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _08021C8A - adds r0, r4, #0 - adds r0, #0x59 - strb r5, [r0] -_08021C8A: - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08021CCC - movs r0, #2 - strb r0, [r4, #0xc] - movs r2, #0x3c - strb r2, [r4, #0xe] - movs r0, #1 - strb r0, [r4, #0xf] - ldrb r1, [r4, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r4, #0x10] - adds r3, r4, #0 - adds r3, #0x29 - ldrb r1, [r3] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #4 - orrs r0, r1 - strb r0, [r3] - adds r0, r4, #0 - adds r0, #0x86 - strb r2, [r0] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_08021CCC: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08021CD0 -sub_08021CD0: @ 0x08021CD0 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08021CE6 - adds r0, r4, #0 - bl GetNextFrame -_08021CE6: - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - cmp r0, #0xff - beq _08021CFE - movs r0, #3 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation -_08021CFE: - pop {r4, pc} - - thumb_func_start sub_08021D00 -sub_08021D00: @ 0x08021D00 - push {r4, lr} - adds r4, r0, #0 - adds r1, r4, #0 - adds r1, #0x86 - ldrb r0, [r1] - cmp r0, #0 - beq _08021D16 - subs r0, #1 - strb r0, [r1] - movs r0, #0 - b _08021D40 -_08021D16: - adds r0, r4, #0 - movs r1, #1 - movs r2, #0x10 - bl sub_08049F64 - cmp r0, #0 - bne _08021D28 - movs r0, #0 - b _08021D40 -_08021D28: - movs r0, #4 - strb r0, [r4, #0xc] - movs r0, #1 - strb r0, [r4, #0xe] - movs r0, #0xc0 - lsls r0, r0, #9 - str r0, [r4, #0x20] - adds r0, r4, #0 - movs r1, #4 - bl InitializeAnimation - movs r0, #1 -_08021D40: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08021D44 -sub_08021D44: @ 0x08021D44 - push {lr} - adds r2, r0, #0 - adds r1, #4 - movs r0, #0x18 - ands r1, r0 - strb r1, [r2, #0x15] - movs r0, #8 - ands r1, r0 - cmp r1, #0 - beq _08021D5E - movs r0, #0xc0 - lsls r0, r0, #1 - b _08021D60 -_08021D5E: - movs r0, #0xc0 -_08021D60: - strh r0, [r2, #0x24] - pop {pc} diff --git a/asm/cuccoChickAggr.s b/asm/cuccoChickAggr.s deleted file mode 100644 index 458b4346..00000000 --- a/asm/cuccoChickAggr.s +++ /dev/null @@ -1,346 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start CuccoChickAggr -CuccoChickAggr: @ 0x08022918 - push {r4, r5, lr} - adds r5, r0, #0 - ldr r4, _08022930 @ =gUnk_080CBB64 - bl GetNextFunction - lsls r0, r0, #2 - adds r0, r0, r4 - ldr r1, [r0] - adds r0, r5, #0 - bl _call_via_r1 - pop {r4, r5, pc} - .align 2, 0 -_08022930: .4byte gUnk_080CBB64 - - thumb_func_start sub_08022934 -sub_08022934: @ 0x08022934 - push {lr} - ldr r2, _08022948 @ =gUnk_080CBB7C - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022948: .4byte gUnk_080CBB7C - - thumb_func_start sub_0802294C -sub_0802294C: @ 0x0802294C - push {lr} - ldr r1, _08022958 @ =gUnk_080CBB64 - bl sub_0804AA30 - pop {pc} - .align 2, 0 -_08022958: .4byte gUnk_080CBB64 - - thumb_func_start nullsub_132 -nullsub_132: @ 0x0802295C - bx lr - .align 2, 0 - - thumb_func_start sub_08022960 -sub_08022960: @ 0x08022960 - push {r4, lr} - adds r4, r0, #0 - bl sub_0804A720 - adds r0, r4, #0 - bl sub_08022A88 - pop {r4, pc} - - thumb_func_start sub_08022970 -sub_08022970: @ 0x08022970 - push {lr} - adds r1, r0, #0 - ldrb r0, [r1, #0xe] - subs r0, #1 - strb r0, [r1, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08022986 - adds r0, r1, #0 - bl sub_08022AA4 -_08022986: - pop {pc} - - thumb_func_start sub_08022988 -sub_08022988: @ 0x08022988 - push {r4, lr} - adds r4, r0, #0 - movs r1, #0x36 - ldrsh r0, [r4, r1] - cmp r0, #0 - bne _080229A6 - adds r0, r4, #0 - bl sub_08022B20 - cmp r0, #0 - beq _080229A6 - adds r0, r4, #0 - bl sub_08022B0C - b _080229F6 -_080229A6: - ldrb r0, [r4, #0xf] - cmp r0, #0 - beq _080229C6 - subs r0, #1 - strb r0, [r4, #0xf] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _080229F6 - movs r0, #1 - strb r0, [r4, #0x1e] - movs r0, #0x80 - lsls r0, r0, #9 - str r0, [r4, #0x20] - movs r0, #0xd6 - bl sub_08004488 -_080229C6: - adds r0, r4, #0 - bl sub_080AEF88 - movs r1, #0x80 - lsls r1, r1, #6 - adds r0, r4, #0 - bl sub_08003FC4 - adds r1, r0, #0 - cmp r1, #0 - bne _080229F6 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _080229F0 - adds r0, r4, #0 - bl sub_08022A88 - b _080229F6 -_080229F0: - movs r0, #4 - strb r0, [r4, #0xf] - strb r1, [r4, #0x1e] -_080229F6: - pop {r4, pc} - - thumb_func_start sub_080229F8 -sub_080229F8: @ 0x080229F8 - push {r4, lr} - adds r4, r0, #0 - movs r1, #0xa0 - lsls r1, r1, #6 - bl sub_08003FC4 - cmp r0, #0 - bne _08022A3C - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - lsrs r1, r0, #0x18 - cmp r1, #0 - bne _08022A30 - movs r0, #4 - strb r0, [r4, #0xc] - movs r0, #6 - strb r0, [r4, #0xe] - movs r0, #8 - strb r0, [r4, #0xf] - strb r1, [r4, #0x1e] - movs r0, #0xc0 - strh r0, [r4, #0x24] - adds r0, r4, #0 - bl sub_08022B44 - b _08022A3C -_08022A30: - movs r0, #0x80 - lsls r0, r0, #9 - str r0, [r4, #0x20] - movs r0, #0xd6 - bl sub_08004488 -_08022A3C: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08022A40 -sub_08022A40: @ 0x08022A40 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xf] - cmp r0, #0 - beq _08022A58 - subs r0, #1 - strb r0, [r4, #0xf] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08022A86 - movs r0, #1 - strb r0, [r4, #0x1e] -_08022A58: - adds r0, r4, #0 - bl sub_080AEF88 - movs r1, #0x80 - lsls r1, r1, #6 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _08022A86 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08022A80 - adds r0, r4, #0 - bl sub_08022A88 - b _08022A86 -_08022A80: - adds r0, r4, #0 - bl sub_08022B44 -_08022A86: - pop {r4, pc} - - thumb_func_start sub_08022A88 -sub_08022A88: @ 0x08022A88 - push {r4, r5, lr} - adds r4, r0, #0 - movs r5, #0 - movs r0, #1 - strb r0, [r4, #0xc] - bl Random - movs r1, #0xf - ands r0, r1 - adds r0, #8 - strb r0, [r4, #0xe] - strb r5, [r4, #0x1e] - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08022AA4 -sub_08022AA4: @ 0x08022AA4 - push {r4, r5, lr} - adds r4, r0, #0 - bl Random - adds r5, r0, #0 - movs r0, #2 - strb r0, [r4, #0xc] - movs r1, #3 - adds r0, r5, #0 - ands r0, r1 - adds r0, #1 - strb r0, [r4, #0xe] - movs r0, #1 - strb r0, [r4, #0xf] - movs r0, #0x80 - strh r0, [r4, #0x24] - adds r0, r4, #0 - bl sub_08049FA0 - cmp r0, #0 - bne _08022AE0 - lsrs r0, r5, #8 - movs r1, #3 - ands r0, r1 - cmp r0, #0 - beq _08022AE0 - adds r0, r4, #0 - bl sub_08049EE4 - b _08022AE6 -_08022AE0: - lsrs r0, r5, #0x10 - movs r1, #0x1f - ands r0, r1 -_08022AE6: - strb r0, [r4, #0x15] - ldrb r1, [r4, #0x15] - movs r0, #0xf - ands r0, r1 - cmp r0, #0 - beq _08022B08 - lsrs r1, r1, #4 - movs r0, #1 - eors r1, r0 - ands r1, r0 - lsls r1, r1, #6 - ldrb r2, [r4, #0x18] - movs r0, #0x41 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, #0x18] -_08022B08: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08022B0C -sub_08022B0C: @ 0x08022B0C - push {lr} - movs r1, #3 - strb r1, [r0, #0xc] - strb r1, [r0, #0xe] - movs r1, #8 - strb r1, [r0, #0xf] - bl sub_08022B44 - pop {pc} - .align 2, 0 - - thumb_func_start sub_08022B20 -sub_08022B20: @ 0x08022B20 - push {r4, lr} - adds r4, r0, #0 - movs r0, #2 - bl sub_08049DF4 - cmp r0, #0 - beq _08022B40 - ldr r1, _08022B3C @ =gPlayerEntity - adds r0, r4, #0 - movs r2, #0x24 - movs r3, #0x24 - bl sub_080041A0 - b _08022B42 - .align 2, 0 -_08022B3C: .4byte gPlayerEntity -_08022B40: - movs r0, #0 -_08022B42: - pop {r4, pc} - - thumb_func_start sub_08022B44 -sub_08022B44: @ 0x08022B44 - push {r4, lr} - adds r4, r0, #0 - movs r0, #0xc0 - lsls r0, r0, #8 - str r0, [r4, #0x20] - ldr r1, _08022B84 @ =gPlayerEntity - adds r0, r4, #0 - bl GetFacingDirection - adds r1, r0, #0 - strb r1, [r4, #0x15] - movs r0, #0xf - ands r0, r1 - cmp r0, #0 - beq _08022B7A - lsls r1, r1, #0x18 - lsrs r1, r1, #0x1c - movs r0, #1 - eors r1, r0 - ands r1, r0 - lsls r1, r1, #6 - ldrb r2, [r4, #0x18] - movs r0, #0x41 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, #0x18] -_08022B7A: - movs r0, #0xd6 - bl sub_08004488 - pop {r4, pc} - .align 2, 0 -_08022B84: .4byte gPlayerEntity diff --git a/asm/doorMimic.s b/asm/doorMimic.s deleted file mode 100644 index b94c1290..00000000 --- a/asm/doorMimic.s +++ /dev/null @@ -1,343 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start DoorMimic -DoorMimic: @ 0x08021FA8 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r5, _08021FD4 @ =gUnk_080CB734 - bl GetNextFunction - lsls r0, r0, #2 - adds r0, r0, r5 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - ldr r1, _08021FD8 @ =gUnk_080CB8A4 - ldrb r0, [r4, #0xb] - lsls r0, r0, #2 - adds r0, r0, r1 - ldrb r1, [r4, #0x1e] - ldr r0, [r0] - lsls r1, r1, #2 - adds r1, r1, r0 - ldr r0, [r1] - str r0, [r4, #0x48] - pop {r4, r5, pc} - .align 2, 0 -_08021FD4: .4byte gUnk_080CB734 -_08021FD8: .4byte gUnk_080CB8A4 - - thumb_func_start sub_08021FDC -sub_08021FDC: @ 0x08021FDC - push {lr} - ldr r2, _08021FF0 @ =gUnk_080CB74C - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08021FF0: .4byte gUnk_080CB74C - - thumb_func_start sub_08021FF4 -sub_08021FF4: @ 0x08021FF4 - push {lr} - ldr r1, _08022000 @ =gUnk_080CB734 - bl sub_0804AA30 - pop {pc} - .align 2, 0 -_08022000: .4byte gUnk_080CB734 - - thumb_func_start sub_08022004 -sub_08022004: @ 0x08022004 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x7c - ldrh r0, [r0] - adds r1, r4, #0 - adds r1, #0x7e - ldrh r1, [r1] - adds r2, r4, #0 - adds r2, #0x38 - ldrb r2, [r2] - bl SetTile - adds r0, r4, #0 - movs r1, #5 - movs r2, #0 - bl CreateFx - adds r0, r4, #0 - bl sub_08049CF4 - bl DeleteThisEntity - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08022034 -sub_08022034: @ 0x08022034 - push {r4, lr} - adds r4, r0, #0 - movs r0, #1 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0xa] - movs r0, #3 - ands r0, r1 - strb r0, [r4, #0xb] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #5 - orrs r0, r1 - strb r0, [r2] - ldr r2, _08022098 @ =gUnk_080CB764 - ldrb r0, [r4, #0xb] - lsls r0, r0, #1 - adds r0, r0, r2 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - ldrh r1, [r4, #0x2e] - adds r0, r0, r1 - adds r1, r4, #0 - adds r1, #0x78 - strh r0, [r1] - ldrb r0, [r4, #0xb] - lsls r0, r0, #1 - adds r0, #1 - adds r0, r0, r2 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - ldrh r1, [r4, #0x32] - adds r0, r0, r1 - adds r1, r4, #0 - adds r1, #0x7a - strh r0, [r1] - ldrb r1, [r4, #0xb] - adds r0, r4, #0 - bl InitializeAnimation - adds r0, r4, #0 - bl sub_080221C0 - pop {r4, pc} - .align 2, 0 -_08022098: .4byte gUnk_080CB764 - - thumb_func_start sub_0802209C -sub_0802209C: @ 0x0802209C - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xe] - cmp r0, #0 - bne _080220D2 - adds r0, r4, #0 - adds r0, #0x78 - ldrh r0, [r0] - adds r1, r4, #0 - adds r1, #0x7a - ldrh r1, [r1] - movs r2, #0x10 - movs r3, #0x10 - bl sub_0806FBFC - cmp r0, #0 - beq _080220D6 - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x12 - strb r0, [r4, #0xe] - ldrb r1, [r4, #0xb] - adds r1, #4 - adds r0, r4, #0 - bl InitializeAnimation - b _080220D6 -_080220D2: - subs r0, #1 - strb r0, [r4, #0xe] -_080220D6: - pop {r4, pc} - - thumb_func_start sub_080220D8 -sub_080220D8: @ 0x080220D8 - push {lr} - adds r1, r0, #0 - ldrb r0, [r1, #0xe] - subs r0, #1 - strb r0, [r1, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _080220EC - movs r0, #3 - strb r0, [r1, #0xc] -_080220EC: - pop {pc} - .align 2, 0 - - thumb_func_start sub_080220F0 -sub_080220F0: @ 0x080220F0 - push {r4, r5, r6, lr} - adds r5, r0, #0 - bl GetNextFrame - adds r0, r5, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08022160 - movs r1, #0 - movs r0, #4 - strb r0, [r5, #0xc] - movs r0, #0x78 - strb r0, [r5, #0xe] - adds r0, r5, #0 - adds r0, #0x44 - strb r1, [r0] - ldrb r1, [r5, #0xb] - lsls r0, r1, #1 - adds r0, r0, r1 - lsls r0, r0, #2 - ldr r1, _0802215C @ =gUnk_080CB76C - adds r4, r0, r1 - movs r6, #0 -_08022124: - adds r0, r5, #0 - movs r1, #0x11 - movs r2, #0 - bl CreateFx - adds r1, r0, #0 - cmp r1, #0 - beq _08022148 - movs r0, #0 - ldrsb r0, [r4, r0] - ldrh r2, [r1, #0x2e] - adds r0, r0, r2 - strh r0, [r1, #0x2e] - movs r0, #1 - ldrsb r0, [r4, r0] - ldrh r2, [r1, #0x32] - adds r0, r0, r2 - strh r0, [r1, #0x32] -_08022148: - adds r6, #1 - adds r4, #2 - cmp r6, #5 - bls _08022124 - movs r0, #0x82 - lsls r0, r0, #1 - bl sub_08004488 - b _08022170 - .align 2, 0 -_0802215C: .4byte gUnk_080CB76C -_08022160: - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08022170 - adds r1, r5, #0 - adds r1, #0x44 - movs r0, #4 - strb r0, [r1] -_08022170: - pop {r4, r5, r6, pc} - .align 2, 0 - - thumb_func_start sub_08022174 -sub_08022174: @ 0x08022174 - push {r4, lr} - adds r4, r0, #0 - bl sub_0800445C - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08022196 - movs r0, #5 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0xb] - adds r1, #8 - adds r0, r4, #0 - bl InitializeAnimation -_08022196: - pop {r4, pc} - - thumb_func_start sub_08022198 -sub_08022198: @ 0x08022198 - push {r4, lr} - adds r4, r0, #0 - bl sub_0800445C - adds r0, r4, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _080221BC - movs r0, #1 - strb r0, [r4, #0xc] - movs r0, #0x5a - strb r0, [r4, #0xe] -_080221BC: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_080221C0 -sub_080221C0: @ 0x080221C0 - push {r4, r5, r6, lr} - adds r6, r0, #0 - movs r0, #0x2e - ldrsh r4, [r6, r0] - ldr r1, _08022220 @ =gRoomControls - ldrh r0, [r1, #6] - subs r4, r4, r0 - asrs r4, r4, #4 - movs r2, #0x3f - ands r4, r2 - movs r3, #0x32 - ldrsh r0, [r6, r3] - ldrh r1, [r1, #8] - subs r0, r0, r1 - asrs r0, r0, #4 - ands r0, r2 - lsls r0, r0, #6 - orrs r4, r0 - ldr r1, _08022224 @ =gUnk_080B4488 - ldrb r0, [r6, #0xb] - lsls r0, r0, #1 - adds r0, r0, r1 - movs r1, #0 - ldrsh r0, [r0, r1] - adds r4, r4, r0 - adds r0, r6, #0 - adds r0, #0x7e - strh r4, [r0] - adds r5, r6, #0 - adds r5, #0x38 - ldrb r1, [r5] - adds r0, r4, #0 - bl sub_080001DA - adds r1, r6, #0 - adds r1, #0x7c - strh r0, [r1] - ldr r1, _08022228 @ =gUnk_080CB79C - ldrb r0, [r6, #0xb] - lsls r0, r0, #1 - adds r0, r0, r1 - ldrh r0, [r0] - ldrb r2, [r5] - adds r1, r4, #0 - bl SetTile - pop {r4, r5, r6, pc} - .align 2, 0 -_08022220: .4byte gRoomControls -_08022224: .4byte gUnk_080B4488 -_08022228: .4byte gUnk_080CB79C diff --git a/asm/enemyE.s b/asm/enemyE.s deleted file mode 100644 index 3a6d9ac1..00000000 --- a/asm/enemyE.s +++ /dev/null @@ -1,100 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start EnemyE -EnemyE: @ 0x08022FA4 - push {lr} - ldr r1, _08022FB0 @ =gUnk_080CBBC8 - bl EnemyFunctionHandler - pop {pc} - .align 2, 0 -_08022FB0: .4byte gUnk_080CBBC8 - - thumb_func_start sub_08022FB4 -sub_08022FB4: @ 0x08022FB4 - push {lr} - ldr r2, _08022FC8 @ =gUnk_080CBBDC - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022FC8: .4byte gUnk_080CBBDC - - thumb_func_start nullsub_133 -nullsub_133: @ 0x08022FCC - bx lr - .align 2, 0 - - thumb_func_start sub_08022FD0 -sub_08022FD0: @ 0x08022FD0 - push {lr} - movs r3, #1 - movs r1, #1 - strb r1, [r0, #0xc] - ldrb r2, [r0, #0x18] - subs r1, #5 - ands r1, r2 - orrs r1, r3 - strb r1, [r0, #0x18] - movs r1, #0 - bl sub_08023000 - pop {pc} - .align 2, 0 - - thumb_func_start sub_08022FEC -sub_08022FEC: @ 0x08022FEC - push {lr} - movs r1, #0x80 - bl sub_08023000 - pop {pc} - .align 2, 0 - - thumb_func_start sub_08022FF8 -sub_08022FF8: @ 0x08022FF8 - bx lr - .align 2, 0 - - thumb_func_start sub_08022FFC -sub_08022FFC: @ 0x08022FFC - bx lr - .align 2, 0 - - thumb_func_start sub_08023000 -sub_08023000: @ 0x08023000 - push {r4, lr} - adds r4, r0, #0 - cmp r1, #0x80 - bne _0802300E - bl UpdateAnimationSingleFrame - b _08023014 -_0802300E: - adds r0, r4, #0 - bl InitAnimationForceUpdate -_08023014: - movs r2, #0x80 - adds r0, r4, #0 - adds r0, #0x5b - ldrb r0, [r0] - cmp r0, #0x40 - bne _08023022 - rsbs r2, r2, #0 -_08023022: - ldrb r0, [r4, #0x19] - movs r1, #3 - orrs r0, r1 - strb r0, [r4, #0x19] - adds r0, r4, #0 - adds r1, r2, #0 - movs r2, #0x80 - movs r3, #0 - bl sub_0805EC9C - pop {r4, pc} diff --git a/asm/moldorm.s b/asm/moldorm.s deleted file mode 100644 index 24d0838f..00000000 --- a/asm/moldorm.s +++ /dev/null @@ -1,558 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start Moldorm -Moldorm: @ 0x08022B88 - push {lr} - ldr r2, _08022B9C @ =gUnk_080CBB90 - ldrb r1, [r0, #0xa] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022B9C: .4byte gUnk_080CBB90 - - thumb_func_start sub_08022BA0 -sub_08022BA0: @ 0x08022BA0 - push {r4, lr} - adds r4, r0, #0 - adds r1, r4, #0 - adds r1, #0x79 - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] - ldrh r1, [r4, #0x2e] - adds r0, r4, #0 - adds r0, #0x74 - strh r1, [r0] - ldrh r0, [r4, #0x32] - adds r1, r4, #0 - adds r1, #0x76 - strh r0, [r1] - ldr r1, _08022BD0 @ =gUnk_080CBBA0 - adds r0, r4, #0 - bl EnemyFunctionHandler - adds r0, r4, #0 - bl sub_08022EAC - pop {r4, pc} - .align 2, 0 -_08022BD0: .4byte gUnk_080CBBA0 - - thumb_func_start sub_08022BD4 -sub_08022BD4: @ 0x08022BD4 - push {lr} - ldr r2, _08022BE8 @ =gUnk_080CBBB4 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022BE8: .4byte gUnk_080CBBB4 - - thumb_func_start sub_08022BEC -sub_08022BEC: @ 0x08022BEC - push {lr} - adds r2, r0, #0 - movs r0, #0x7a - adds r0, r0, r2 - mov ip, r0 - adds r3, r2, #0 - adds r3, #0x45 - ldrb r0, [r0] - ldrb r1, [r3] - cmp r0, r1 - beq _08022C0A - adds r1, r2, #0 - adds r1, #0x7b - movs r0, #0x1e - strb r0, [r1] -_08022C0A: - ldrb r0, [r3] - mov r1, ip - strb r0, [r1] - movs r0, #1 - strb r0, [r2, #0xe] - adds r0, r2, #0 - adds r0, #0x3e - ldrb r0, [r0] - strb r0, [r2, #0x15] - ldrb r0, [r2, #0x15] - adds r0, #2 - movs r1, #0x1c - ands r0, r1 - asrs r0, r0, #2 - strb r0, [r2, #0x14] - strb r0, [r2, #0x1e] - ldr r0, [r2, #0x54] - adds r3, r2, #0 - adds r3, #0x3d - ldrb r1, [r3] - adds r0, #0x3d - strb r1, [r0] - ldr r0, [r2, #0x7c] - ldrb r1, [r3] - adds r0, #0x3d - strb r1, [r0] - adds r0, r2, #0 - adds r0, #0x80 - ldr r0, [r0] - ldrb r1, [r3] - adds r0, #0x3d - strb r1, [r0] - ldr r1, _08022C54 @ =gUnk_080CBBA0 - adds r0, r2, #0 - bl sub_0804AA30 - pop {pc} - .align 2, 0 -_08022C54: .4byte gUnk_080CBBA0 - - thumb_func_start sub_08022C58 -sub_08022C58: @ 0x08022C58 - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - adds r7, r0, #0 - ldrb r1, [r7, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r7, #0x10] - ldr r0, _08022D3C @ =gEntCount - ldrb r0, [r0] - cmp r0, #0x44 - bhi _08022D34 - movs r0, #0xd - movs r1, #1 - bl CreateEnemy - mov sb, r0 - str r0, [r7, #0x54] - mov r2, sb - adds r2, #0x29 - ldrb r1, [r2] - movs r4, #8 - rsbs r4, r4, #0 - adds r0, r4, #0 - ands r0, r1 - movs r1, #5 - mov r8, r1 - mov r1, r8 - orrs r0, r1 - strb r0, [r2] - mov r0, sb - str r7, [r0, #0x50] - adds r0, r7, #0 - mov r1, sb - bl CopyPosition - movs r0, #0xd - movs r1, #2 - bl CreateEnemy - adds r6, r0, #0 - mov r1, sb - str r6, [r1, #0x54] - adds r2, r6, #0 - adds r2, #0x29 - ldrb r1, [r2] - adds r0, r4, #0 - ands r0, r1 - mov r1, r8 - orrs r0, r1 - strb r0, [r2] - str r7, [r6, #0x50] - adds r0, r7, #0 - adds r1, r6, #0 - bl CopyPosition - movs r0, #0xd - movs r1, #3 - bl CreateEnemy - adds r5, r0, #0 - str r5, [r6, #0x54] - adds r1, r5, #0 - adds r1, #0x29 - ldrb r0, [r1] - ands r4, r0 - mov r0, r8 - orrs r4, r0 - strb r4, [r1] - str r7, [r5, #0x50] - adds r0, r7, #0 - adds r1, r5, #0 - bl CopyPosition - adds r0, r7, #0 - bl sub_0804A720 - movs r0, #1 - strb r0, [r7, #0xc] - strb r0, [r7, #0xe] - strb r0, [r7, #0xf] - ldrb r0, [r7, #0x10] - movs r1, #0x80 - orrs r0, r1 - strb r0, [r7, #0x10] - str r7, [r7, #0x50] - mov r1, sb - str r1, [r7, #0x54] - str r6, [r7, #0x7c] - adds r0, r7, #0 - adds r0, #0x80 - str r5, [r0] - bl Random - movs r1, #0x1f - ands r0, r1 - strb r0, [r7, #0x15] - ldrb r0, [r7, #0x15] - adds r0, #2 - movs r1, #0x1c - ands r0, r1 - asrs r0, r0, #2 - strb r0, [r7, #0x14] - strb r0, [r7, #0x1e] - adds r0, r7, #0 - adds r0, #0x45 - ldrb r1, [r0] - adds r0, #0x35 - strb r1, [r0] -_08022D34: - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08022D3C: .4byte gEntCount - - thumb_func_start sub_08022D40 -sub_08022D40: @ 0x08022D40 - push {r4, lr} - adds r4, r0, #0 - adds r2, r4, #0 - adds r2, #0x7b - ldrb r1, [r2] - cmp r1, #0 - beq _08022D66 - adds r0, r1, #0 - adds r0, #0xff - strb r0, [r2] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08022D8E - ldrb r0, [r4, #0x14] - adds r0, #1 - movs r1, #7 - ands r0, r1 - b _08022D8A -_08022D66: - adds r0, r4, #0 - bl sub_08022F14 - adds r0, r4, #0 - bl sub_080AEF88 - ldrh r0, [r4, #0x2a] - cmp r0, #0 - beq _08022D8E - adds r1, r0, #0 - adds r0, r4, #0 - bl sub_0800417E - ldrb r0, [r4, #0x15] - adds r0, #2 - movs r1, #0x1c - ands r0, r1 - asrs r0, r0, #2 -_08022D8A: - strb r0, [r4, #0x14] - strb r0, [r4, #0x1e] -_08022D8E: - pop {r4, pc} - - thumb_func_start sub_08022D90 -sub_08022D90: @ 0x08022D90 - push {r4, r5, lr} - adds r5, r0, #0 - ldr r0, [r5, #0x50] - ldr r0, [r0, #4] - cmp r0, #0 - beq _08022DE0 - ldr r1, _08022DDC @ =gUnk_080CBBBC - ldrb r0, [r5, #0xc] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r5, #0 - bl _call_via_r1 - ldr r4, [r5, #0x50] - ldrb r2, [r4, #0x1b] - lsrs r2, r2, #6 - lsls r2, r2, #6 - ldrb r3, [r5, #0x1b] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r3 - orrs r0, r2 - strb r0, [r5, #0x1b] - ldrb r0, [r4, #0x19] - lsrs r0, r0, #6 - lsls r0, r0, #6 - ldrb r2, [r5, #0x19] - ands r1, r2 - orrs r1, r0 - strb r1, [r5, #0x19] - adds r4, #0x38 - ldrb r1, [r4] - adds r0, r5, #0 - adds r0, #0x38 - strb r1, [r0] - b _08022DE6 - .align 2, 0 -_08022DDC: .4byte gUnk_080CBBBC -_08022DE0: - adds r0, r5, #0 - bl DeleteEntity -_08022DE6: - pop {r4, r5, pc} - - thumb_func_start sub_08022DE8 -sub_08022DE8: @ 0x08022DE8 - push {lr} - adds r3, r0, #0 - movs r0, #1 - strb r0, [r3, #0xc] - adds r0, r3, #0 - adds r0, #0x7c - movs r1, #0x88 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - adds r0, #1 - strb r1, [r0] - ldr r0, [r3, #0x50] - ldrb r0, [r0, #0x14] - strb r0, [r3, #0x14] - adds r2, r3, #0 - adds r2, #0x84 - ldrb r1, [r3, #0x14] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r1, r0, #8 - adds r0, r0, r1 - lsls r1, r0, #0x10 - adds r0, r0, r1 - str r0, [r2] - ldrb r0, [r3, #0xa] - cmp r0, #3 - beq _08022E38 - adds r0, #7 - b _08022E3C -_08022E38: - ldrb r0, [r3, #0x14] - adds r0, #0xa -_08022E3C: - strb r0, [r3, #0x1e] - pop {pc} - - thumb_func_start sub_08022E40 -sub_08022E40: @ 0x08022E40 - push {r4, r5, lr} - adds r4, r0, #0 - ldrh r1, [r4, #0x2e] - adds r0, #0x74 - strh r1, [r0] - ldrh r0, [r4, #0x32] - adds r1, r4, #0 - adds r1, #0x76 - strh r0, [r1] - ldr r2, [r4, #0x50] - adds r2, #0x79 - ldrb r0, [r2] - adds r0, #1 - movs r3, #7 - ands r0, r3 - adds r0, #0x7c - adds r0, r4, r0 - ldrb r1, [r0] - movs r0, #0xf - ands r0, r1 - subs r0, #8 - lsrs r1, r1, #4 - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - ldrh r5, [r4, #0x2e] - adds r0, r0, r5 - strh r0, [r4, #0x2e] - subs r1, #8 - ldrh r0, [r4, #0x32] - adds r1, r1, r0 - strh r1, [r4, #0x32] - adds r1, r4, #0 - adds r1, #0x84 - ldrb r0, [r2] - adds r0, #1 - ands r0, r3 - lsls r0, r0, #2 - ldr r1, [r1] - lsrs r1, r0 - movs r0, #7 - ands r1, r0 - strb r1, [r4, #0x14] - ldrb r0, [r4, #0xa] - cmp r0, #3 - bne _08022EA2 - adds r0, r1, #0 - adds r0, #0xa - strb r0, [r4, #0x1e] - b _08022EA8 -_08022EA2: - adds r0, r4, #0 - bl sub_08022EAC -_08022EA8: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08022EAC -sub_08022EAC: @ 0x08022EAC - push {r4, r5, lr} - mov ip, r0 - ldr r1, [r0, #0x54] - cmp r1, #0 - beq _08022F12 - ldr r0, [r0, #0x50] - adds r0, #0x79 - ldrb r0, [r0] - movs r4, #7 - adds r3, r4, #0 - ands r3, r0 - adds r3, r3, r1 - adds r3, #0x7c - mov r0, ip - ldrh r1, [r0, #0x2e] - adds r0, #0x74 - ldrb r0, [r0] - subs r1, r1, r0 - adds r1, #8 - movs r5, #0xf - ands r1, r5 - mov r2, ip - ldrh r0, [r2, #0x32] - adds r2, #0x76 - ldrb r2, [r2] - subs r0, r0, r2 - adds r0, #8 - ands r0, r5 - lsls r0, r0, #4 - adds r1, r1, r0 - strb r1, [r3] - mov r1, ip - ldr r0, [r1, #0x50] - adds r0, #0x79 - ldrb r1, [r0] - adds r0, r4, #0 - ands r0, r1 - lsls r0, r0, #2 - mov r2, ip - ldrb r1, [r2, #0x14] - ands r4, r1 - lsls r4, r0 - movs r2, #0xf - lsls r2, r0 - mov r0, ip - ldr r1, [r0, #0x54] - adds r1, #0x84 - ldr r0, [r1] - bics r0, r2 - orrs r4, r0 - str r4, [r1] -_08022F12: - pop {r4, r5, pc} - - thumb_func_start sub_08022F14 -sub_08022F14: @ 0x08022F14 - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_08049FA0 - cmp r0, #0 - bne _08022F4E - adds r0, r4, #0 - bl sub_08049EE4 - ldrb r1, [r4, #0x15] - subs r2, r0, r1 - movs r1, #0x1f - ands r2, r1 - adds r0, r2, #4 - ands r0, r1 - cmp r0, #8 - bls _08022F4E - movs r0, #8 - strb r0, [r4, #0xf] - cmp r2, #0xf - bhi _08022F46 - adds r1, r4, #0 - adds r1, #0x78 - movs r0, #1 - b _08022F4C -_08022F46: - adds r1, r4, #0 - adds r1, #0x78 - movs r0, #0xff -_08022F4C: - strb r0, [r1] -_08022F4E: - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - movs r1, #0xff - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08022F9E - movs r0, #4 - strb r0, [r4, #0xe] - ldrb r0, [r4, #0xf] - subs r0, #1 - strb r0, [r4, #0xf] - ands r0, r1 - adds r5, r4, #0 - adds r5, #0x78 - cmp r0, #0 - bne _08022F84 - movs r0, #8 - strb r0, [r4, #0xf] - bl Random - ldr r2, _08022FA0 @ =gUnk_080CBBC4 - movs r1, #1 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - strb r0, [r5] -_08022F84: - ldrb r0, [r5] - ldrb r1, [r4, #0x15] - adds r0, r0, r1 - movs r1, #0x1f - ands r0, r1 - strb r0, [r4, #0x15] - ldrb r0, [r4, #0x15] - adds r0, #2 - movs r1, #0x1c - ands r0, r1 - asrs r0, r0, #2 - strb r0, [r4, #0x14] - strb r0, [r4, #0x1e] -_08022F9E: - pop {r4, r5, pc} - .align 2, 0 -_08022FA0: .4byte gUnk_080CBBC4 diff --git a/asm/non_matching/moldorm/sub_08022E40.inc b/asm/non_matching/moldorm/sub_08022E40.inc new file mode 100644 index 00000000..a4f2d937 --- /dev/null +++ b/asm/non_matching/moldorm/sub_08022E40.inc @@ -0,0 +1,62 @@ + + .syntax unified + + .text + + push {r4, r5, lr} + adds r4, r0, #0 + ldrh r1, [r4, #0x2e] + adds r0, #0x74 + strh r1, [r0] + ldrh r0, [r4, #0x32] + adds r1, r4, #0 + adds r1, #0x76 + strh r0, [r1] + ldr r2, [r4, #0x50] + adds r2, #0x79 + ldrb r0, [r2] + adds r0, #1 + movs r3, #7 + ands r0, r3 + adds r0, #0x7c + adds r0, r4, r0 + ldrb r1, [r0] + movs r0, #0xf + ands r0, r1 + subs r0, #8 + lsrs r1, r1, #4 + lsls r0, r0, #0x18 + asrs r0, r0, #0x18 + ldrh r5, [r4, #0x2e] + adds r0, r0, r5 + strh r0, [r4, #0x2e] + subs r1, #8 + ldrh r0, [r4, #0x32] + adds r1, r1, r0 + strh r1, [r4, #0x32] + adds r1, r4, #0 + adds r1, #0x84 + ldrb r0, [r2] + adds r0, #1 + ands r0, r3 + lsls r0, r0, #2 + ldr r1, [r1] + lsrs r1, r0 + movs r0, #7 + ands r1, r0 + strb r1, [r4, #0x14] + ldrb r0, [r4, #0xa] + cmp r0, #3 + bne _08022EA2 + adds r0, r1, #0 + adds r0, #0xa + strb r0, [r4, #0x1e] + b _08022EA8 +_08022EA2: + adds r0, r4, #0 + bl sub_08022EAC +_08022EA8: + pop {r4, r5, pc} + .align 2, 0 + + .syntax divided diff --git a/asm/non_matching/moldorm/sub_08022EAC.inc b/asm/non_matching/moldorm/sub_08022EAC.inc new file mode 100644 index 00000000..ca3bce96 --- /dev/null +++ b/asm/non_matching/moldorm/sub_08022EAC.inc @@ -0,0 +1,60 @@ + + .syntax unified + + .text + + push {r4, r5, lr} + mov ip, r0 + ldr r1, [r0, #0x54] + cmp r1, #0 + beq _08022F12 + ldr r0, [r0, #0x50] + adds r0, #0x79 + ldrb r0, [r0] + movs r4, #7 + adds r3, r4, #0 + ands r3, r0 + adds r3, r3, r1 + adds r3, #0x7c + mov r0, ip + ldrh r1, [r0, #0x2e] + adds r0, #0x74 + ldrb r0, [r0] + subs r1, r1, r0 + adds r1, #8 + movs r5, #0xf + ands r1, r5 + mov r2, ip + ldrh r0, [r2, #0x32] + adds r2, #0x76 + ldrb r2, [r2] + subs r0, r0, r2 + adds r0, #8 + ands r0, r5 + lsls r0, r0, #4 + adds r1, r1, r0 + strb r1, [r3] + mov r1, ip + ldr r0, [r1, #0x50] + adds r0, #0x79 + ldrb r1, [r0] + adds r0, r4, #0 + ands r0, r1 + lsls r0, r0, #2 + mov r2, ip + ldrb r1, [r2, #0x14] + ands r4, r1 + lsls r4, r0 + movs r2, #0xf + lsls r2, r0 + mov r0, ip + ldr r1, [r0, #0x54] + adds r1, #0x84 + ldr r0, [r1] + bics r0, r2 + orrs r4, r0 + str r4, [r1] +_08022F12: + pop {r4, r5, pc} + + .syntax divided diff --git a/asm/rockChuchu.s b/asm/rockChuchu.s deleted file mode 100644 index 1d4bcc7b..00000000 --- a/asm/rockChuchu.s +++ /dev/null @@ -1,237 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start RockChuchu -RockChuchu: @ 0x0802222C - push {lr} - ldr r1, _08022238 @ =gUnk_080CB948 - bl EnemyFunctionHandler - pop {pc} - .align 2, 0 -_08022238: .4byte gUnk_080CB948 - - thumb_func_start sub_0802223C -sub_0802223C: @ 0x0802223C - push {lr} - ldr r2, _08022250 @ =gUnk_080CB960 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022250: .4byte gUnk_080CB960 - - thumb_func_start sub_08022254 -sub_08022254: @ 0x08022254 - push {r4, r5, lr} - adds r4, r0, #0 - adds r0, #0x45 - ldrb r0, [r0] - cmp r0, #0 - beq _08022344 - adds r0, r4, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - subs r0, #4 - cmp r0, #0x18 - bhi _08022356 - lsls r0, r0, #2 - ldr r1, _0802227C @ =_08022280 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0802227C: .4byte _08022280 -_08022280: @ jump table - .4byte _080222E4 @ case 0 - .4byte _080222E4 @ case 1 - .4byte _080222E4 @ case 2 - .4byte _08022356 @ case 3 - .4byte _080222E4 @ case 4 - .4byte _080222E4 @ case 5 - .4byte _080222E4 @ case 6 - .4byte _080222E4 @ case 7 - .4byte _080222E4 @ case 8 - .4byte _080222E4 @ case 9 - .4byte _08022356 @ case 10 - .4byte _08022356 @ case 11 - .4byte _080222E4 @ case 12 - .4byte _080222E4 @ case 13 - .4byte _080222E4 @ case 14 - .4byte _08022356 @ case 15 - .4byte _08022356 @ case 16 - .4byte _08022356 @ case 17 - .4byte _080222F2 @ case 18 - .4byte _08022356 @ case 19 - .4byte _080222E4 @ case 20 - .4byte _080222E4 @ case 21 - .4byte _080222E4 @ case 22 - .4byte _08022356 @ case 23 - .4byte _080222F2 @ case 24 -_080222E4: - ldr r0, _08022340 @ =gPlayerState - adds r0, #0xac - ldrh r1, [r0] - movs r0, #8 - ands r0, r1 - cmp r0, #0 - beq _08022356 -_080222F2: - adds r0, r4, #0 - movs r1, #4 - movs r2, #0 - bl CreateFx - movs r0, #1 - movs r1, #1 - bl CreateEnemy - adds r5, r0, #0 - cmp r5, #0 - beq _08022356 - movs r0, #1 - strb r0, [r5, #0xb] - adds r1, r5, #0 - adds r1, #0x3d - movs r0, #0xf8 - strb r0, [r1] - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_0804A4E4 - movs r0, #2 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - ldrb r1, [r4, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r1 - strb r0, [r4, #0x18] - adds r0, r4, #0 - adds r0, #0x3e - ldrb r0, [r0] - strb r0, [r4, #0x15] - str r5, [r4, #0x54] - b _08022356 - .align 2, 0 -_08022340: .4byte gPlayerState -_08022344: - adds r0, r4, #0 - adds r0, #0x3f - ldrb r0, [r0] - cmp r0, #0x94 - beq _08022356 - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation -_08022356: - ldr r1, _08022360 @ =gUnk_080CB948 - adds r0, r4, #0 - bl sub_0804AA30 - pop {r4, r5, pc} - .align 2, 0 -_08022360: .4byte gUnk_080CB948 - - thumb_func_start nullsub_131 -nullsub_131: @ 0x08022364 - bx lr - .align 2, 0 - - thumb_func_start sub_08022368 -sub_08022368: @ 0x08022368 - push {r4, lr} - adds r4, r0, #0 - bl sub_0804A720 - movs r0, #1 - strb r0, [r4, #0xc] - bl Random - strb r0, [r4, #0xe] - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - strb r0, [r4, #0x15] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08022390 -sub_08022390: @ 0x08022390 - push {r4, lr} - adds r4, r0, #0 - movs r1, #1 - bl sub_08049FDC - cmp r0, #0 - beq _080223D4 - ldrb r1, [r4, #0xe] - adds r0, r1, #1 - strb r0, [r4, #0xe] - movs r0, #0xf - ands r0, r1 - cmp r0, #0 - bne _080223C0 - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - strb r0, [r4, #0x15] - bl Random - movs r1, #4 - ands r0, r1 - strb r0, [r4, #0xf] -_080223C0: - ldrb r0, [r4, #0xf] - cmp r0, #0 - bne _080223CE - adds r0, r4, #0 - bl sub_080AEF88 - b _080223DA -_080223CE: - subs r0, #1 - strb r0, [r4, #0xf] - b _080223DA -_080223D4: - bl Random - strb r0, [r4, #0xe] -_080223DA: - adds r0, r4, #0 - bl GetNextFrame - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_080223E4 -sub_080223E4: @ 0x080223E4 - push {lr} - adds r3, r0, #0 - ldr r2, [r3, #0x54] - cmp r2, #0 - beq _0802240A - adds r1, r2, #0 - adds r1, #0x41 - movs r0, #0x94 - strb r0, [r1] - subs r1, #4 - movs r0, #0x10 - strb r0, [r1] - adds r1, #5 - movs r0, #0xc - strb r0, [r1] - ldrb r1, [r3, #0x15] - adds r0, r2, #0 - adds r0, #0x3e - strb r1, [r0] -_0802240A: - adds r0, r3, #0 - bl DeleteEntity - pop {pc} - .align 2, 0 diff --git a/asm/spinyChuchu.s b/asm/spinyChuchu.s deleted file mode 100644 index 8e2b6aba..00000000 --- a/asm/spinyChuchu.s +++ /dev/null @@ -1,646 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start SpinyChuchu -SpinyChuchu: @ 0x08022414 - push {r4, lr} - adds r4, r0, #0 - ldr r1, _08022430 @ =gUnk_080CBA28 - bl EnemyFunctionHandler - movs r3, #0x10 - rsbs r3, r3, #0 - adds r0, r4, #0 - movs r1, #0 - movs r2, #1 - bl SetChildOffset - pop {r4, pc} - .align 2, 0 -_08022430: .4byte gUnk_080CBA28 - - thumb_func_start sub_08022434 -sub_08022434: @ 0x08022434 - push {lr} - ldr r2, _08022448 @ =gUnk_080CBA40 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08022448: .4byte gUnk_080CBA40 - - thumb_func_start sub_0802244C -sub_0802244C: @ 0x0802244C - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r5, r4, #0 - adds r5, #0x45 - ldrb r0, [r5] - cmp r0, #0 - bne _0802245C - b _08022582 -_0802245C: - adds r0, r4, #0 - adds r0, #0x3f - ldrb r1, [r0] - adds r6, r0, #0 - cmp r1, #0x65 - bne _08022522 - adds r0, #2 - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - subs r0, #2 - cmp r0, #0x18 - bhi _08022540 - lsls r0, r0, #2 - ldr r1, _08022480 @ =_08022484 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08022480: .4byte _08022484 -_08022484: @ jump table - .4byte _080224E8 @ case 0 - .4byte _080224E8 @ case 1 - .4byte _08022540 @ case 2 - .4byte _08022540 @ case 3 - .4byte _08022540 @ case 4 - .4byte _08022540 @ case 5 - .4byte _08022508 @ case 6 - .4byte _08022508 @ case 7 - .4byte _08022508 @ case 8 - .4byte _08022508 @ case 9 - .4byte _08022508 @ case 10 - .4byte _08022540 @ case 11 - .4byte _08022540 @ case 12 - .4byte _08022540 @ case 13 - .4byte _08022540 @ case 14 - .4byte _08022540 @ case 15 - .4byte _08022540 @ case 16 - .4byte _08022540 @ case 17 - .4byte _08022540 @ case 18 - .4byte _08022540 @ case 19 - .4byte _08022508 @ case 20 - .4byte _08022540 @ case 21 - .4byte _08022508 @ case 22 - .4byte _08022508 @ case 23 - .4byte _08022508 @ case 24 -_080224E8: - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x3c - strb r0, [r4, #0xf] - movs r0, #0x5c - strb r0, [r6] - ldr r0, _08022504 @ =gUnk_080FD468 - str r0, [r4, #0x48] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - b _08022540 - .align 2, 0 -_08022504: .4byte gUnk_080FD468 -_08022508: - adds r0, r4, #0 - movs r1, #0x1c - bl sub_0804A9FC - movs r0, #5 - strb r0, [r4, #0xc] - movs r0, #0x5c - strb r0, [r6] - adds r0, r4, #0 - movs r1, #1 - bl InitializeAnimation - b _08022540 -_08022522: - adds r0, r4, #0 - adds r0, #0x41 - ldrb r0, [r0] - cmp r0, #0x94 - bne _08022540 - adds r0, r4, #0 - movs r1, #0x1c - bl sub_0804A9FC - movs r0, #5 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #1 - bl InitializeAnimation -_08022540: - adds r0, r4, #0 - adds r0, #0x80 - adds r1, r4, #0 - adds r1, #0x45 - ldrb r2, [r0] - adds r5, r1, #0 - adds r7, r0, #0 - ldrb r0, [r5] - cmp r2, r0 - beq _08022566 - movs r0, #5 - strb r0, [r4, #0xc] - movs r0, #0x5c - strb r0, [r6] - adds r0, r4, #0 - movs r1, #1 - bl InitializeAnimation - b _0802258E -_08022566: - ldrb r0, [r4, #0xc] - cmp r0, #3 - bne _0802258E - movs r0, #4 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #3 - bl InitializeAnimation - movs r0, #0xca - lsls r0, r0, #1 - bl sub_08004488 - b _0802258E -_08022582: - adds r0, r4, #0 - movs r1, #1 - bl InitializeAnimation - adds r7, r4, #0 - adds r7, #0x80 -_0802258E: - ldrb r0, [r5] - strb r0, [r7] - ldr r1, _0802259C @ =gUnk_080CBA28 - adds r0, r4, #0 - bl sub_0804AA30 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_0802259C: .4byte gUnk_080CBA28 - - thumb_func_start sub_080225A0 -sub_080225A0: @ 0x080225A0 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #1 - bne _080225B2 - adds r0, r4, #0 - bl GetNextFrame -_080225B2: - adds r0, r4, #0 - bl sub_08001318 - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_080225BC -sub_080225BC: @ 0x080225BC - push {r4, lr} - adds r4, r0, #0 - movs r1, #0xc0 - lsls r1, r1, #5 - bl sub_08003FC4 - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _080225DE - adds r0, r4, #0 - bl sub_0804A7D4 - b _080225E4 -_080225DE: - adds r0, r4, #0 - bl GetNextFrame -_080225E4: - pop {r4, pc} - .align 2, 0 - - thumb_func_start nullsub_9 -nullsub_9: @ 0x080225E8 - bx lr - .align 2, 0 - - thumb_func_start sub_080225EC -sub_080225EC: @ 0x080225EC - push {r4, lr} - adds r4, r0, #0 - bl sub_0804A720 - adds r0, r4, #0 - adds r0, #0x45 - ldrb r1, [r0] - adds r0, #0x3b - strb r1, [r0] - adds r1, r4, #0 - adds r1, #0x81 - movs r0, #0x5a - strb r0, [r1] - ldrb r0, [r4, #0xe] - cmp r0, #0 - bne _0802261A - movs r0, #2 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - b _0802264C -_0802261A: - movs r0, #1 - strb r0, [r4, #0xc] - movs r0, #0x3c - strb r0, [r4, #0xf] - ldrb r0, [r4, #0x18] - movs r1, #3 - orrs r0, r1 - strb r0, [r4, #0x18] - ldrb r2, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r2 - movs r2, #0x40 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r4, #0x1b] - ands r1, r0 - orrs r1, r2 - strb r1, [r4, #0x1b] - ldr r0, _08022650 @ =0x0000FF80 - strh r0, [r4, #0x36] - adds r0, r4, #0 - movs r1, #6 - bl InitializeAnimation -_0802264C: - pop {r4, pc} - .align 2, 0 -_08022650: .4byte 0x0000FF80 - - thumb_func_start sub_08022654 -sub_08022654: @ 0x08022654 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xd] - cmp r0, #1 - beq _0802268C - cmp r0, #1 - bgt _08022668 - cmp r0, #0 - beq _0802266E - b _080226E4 -_08022668: - cmp r0, #2 - beq _080226BE - b _080226E4 -_0802266E: - ldrb r0, [r4, #0xf] - subs r0, #1 - strb r0, [r4, #0xf] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _080226E4 - movs r0, #1 - strb r0, [r4, #0xd] - ldr r0, _080226E8 @ =0x0000012D - bl PlaySFX - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_0802268C: - movs r1, #0xc0 - lsls r1, r1, #5 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _080226E4 - movs r0, #2 - strb r0, [r4, #0xd] - ldrb r1, [r4, #0x18] - subs r0, #6 - ands r0, r1 - movs r1, #1 - orrs r0, r1 - strb r0, [r4, #0x18] - adds r0, r4, #0 - movs r1, #5 - bl InitializeAnimation - movs r0, #0x7d - bl sub_08004488 - adds r0, r4, #0 - bl UpdateSpriteForCollisionLayer -_080226BE: - adds r0, r4, #0 - bl GetNextFrame - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _080226E4 - movs r0, #3 - strb r0, [r4, #0xc] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x65 - strb r0, [r1] - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation -_080226E4: - pop {r4, pc} - .align 2, 0 -_080226E8: .4byte 0x0000012D - - thumb_func_start sub_080226EC -sub_080226EC: @ 0x080226EC - push {r4, lr} - adds r4, r0, #0 - movs r1, #1 - bl sub_08049FDC - cmp r0, #0 - beq _08022776 - adds r0, r4, #0 - bl sub_080228CC - cmp r0, #0 - beq _0802271A - movs r0, #3 - strb r0, [r4, #0xc] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x65 - strb r0, [r1] - adds r0, r4, #0 - movs r1, #2 - bl InitializeAnimation - b _0802277C -_0802271A: - adds r0, r4, #0 - bl sub_080228F0 - cmp r0, #0 - beq _08022758 - movs r0, #6 - strb r0, [r4, #0xc] - movs r0, #0x90 - lsls r0, r0, #9 - str r0, [r4, #0x20] - movs r0, #0xa0 - lsls r0, r0, #1 - strh r0, [r4, #0x24] - ldr r0, _08022754 @ =gUnk_020000B0 - ldr r1, [r0] - adds r0, r4, #0 - bl GetFacingDirection - strb r0, [r4, #0x15] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x5a - strb r0, [r1] - adds r0, r4, #0 - movs r1, #4 - bl InitializeAnimation - b _0802277C - .align 2, 0 -_08022754: .4byte gUnk_020000B0 -_08022758: - ldrb r1, [r4, #0xe] - adds r0, r1, #1 - strb r0, [r4, #0xe] - movs r0, #7 - ands r0, r1 - cmp r0, #0 - bne _08022770 - adds r0, r4, #0 - movs r1, #1 - bl sub_08049F84 - strb r0, [r4, #0x15] -_08022770: - adds r0, r4, #0 - bl sub_080AEF88 -_08022776: - adds r0, r4, #0 - bl GetNextFrame -_0802277C: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08022780 -sub_08022780: @ 0x08022780 - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _080227AA - movs r0, #4 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #3 - bl InitializeAnimation - movs r0, #0xca - lsls r0, r0, #1 - bl sub_08004488 -_080227AA: - pop {r4, pc} - - thumb_func_start sub_080227AC -sub_080227AC: @ 0x080227AC - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _080227CC - ldr r0, _080227C8 @ =gUnk_080FD470 - b _080227CE - .align 2, 0 -_080227C8: .4byte gUnk_080FD470 -_080227CC: - ldr r0, _08022814 @ =gUnk_080FD468 -_080227CE: - str r0, [r4, #0x48] - adds r2, r4, #0 - adds r2, #0x5a - ldrb r1, [r2] - movs r3, #2 - adds r0, r3, #0 - ands r0, r1 - cmp r0, #0 - beq _080227EE - movs r0, #0xfd - ands r0, r1 - strb r0, [r2] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x5c - strb r0, [r1] -_080227EE: - ldrb r1, [r2] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08022812 - strb r3, [r4, #0xc] - bl Random - ldr r2, _08022818 @ =gUnk_080CBA60 - movs r1, #3 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - strb r0, [r4, #0xf] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_08022812: - pop {r4, pc} - .align 2, 0 -_08022814: .4byte gUnk_080FD468 -_08022818: .4byte gUnk_080CBA60 - - thumb_func_start sub_0802281C -sub_0802281C: @ 0x0802281C - push {r4, lr} - adds r4, r0, #0 - movs r1, #0xc0 - lsls r1, r1, #5 - bl sub_08003FC4 - adds r0, r4, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08022852 - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x20 - strh r0, [r4, #0x24] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - adds r0, r4, #0 - bl sub_0804AA1C -_08022852: - pop {r4, pc} - - thumb_func_start sub_08022854 -sub_08022854: @ 0x08022854 - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08022898 - adds r0, r4, #0 - bl sub_080AEFE0 - movs r1, #0xc0 - lsls r1, r1, #5 - adds r0, r4, #0 - bl sub_08003FC4 - cmp r0, #0 - bne _08022898 - movs r0, #7 - strb r0, [r4, #0xc] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x5c - strb r0, [r1] - adds r0, r4, #0 - movs r1, #5 - bl InitializeAnimation - movs r0, #0x7d - bl sub_08004488 -_08022898: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_0802289C -sub_0802289C: @ 0x0802289C - push {r4, lr} - adds r4, r0, #0 - bl GetNextFrame - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _080228CA - movs r0, #2 - strb r0, [r4, #0xc] - movs r0, #0x20 - strh r0, [r4, #0x24] - adds r1, r4, #0 - adds r1, #0x81 - movs r0, #0x78 - strb r0, [r1] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation -_080228CA: - pop {r4, pc} - - thumb_func_start sub_080228CC -sub_080228CC: @ 0x080228CC - push {lr} - adds r1, r0, #0 - ldrb r0, [r1, #0xf] - cmp r0, #0 - bne _080228E8 - adds r0, r1, #0 - movs r1, #1 - movs r2, #0x28 - bl sub_08049F64 - cmp r0, #0 - beq _080228EC - movs r0, #1 - b _080228EE -_080228E8: - subs r0, #1 - strb r0, [r1, #0xf] -_080228EC: - movs r0, #0 -_080228EE: - pop {pc} - - thumb_func_start sub_080228F0 -sub_080228F0: @ 0x080228F0 - push {lr} - adds r1, r0, #0 - adds r2, r1, #0 - adds r2, #0x81 - ldrb r0, [r2] - cmp r0, #0 - bne _08022910 - adds r0, r1, #0 - movs r1, #1 - movs r2, #0x40 - bl sub_08049F64 - cmp r0, #0 - beq _08022914 - movs r0, #1 - b _08022916 -_08022910: - subs r0, #1 - strb r0, [r2] -_08022914: - movs r0, #0 -_08022916: - pop {pc} diff --git a/data/animations/beetle.s b/data/animations/beetle.s new file mode 100644 index 00000000..e9bdbbf0 --- /dev/null +++ b/data/animations/beetle.s @@ -0,0 +1,28 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CB5EC:: @ 080CB5EC + .incbin "baserom.gba", 0x0CB5EC, 0x0000014 + +gUnk_080CB600:: @ 080CB600 + .incbin "baserom.gba", 0x0CB600, 0x000001C + +gUnk_080CB61C:: @ 080CB61C + .incbin "baserom.gba", 0x0CB61C, 0x0000011 + +gUnk_080CB62D:: @ 080CB62D + .incbin "baserom.gba", 0x0CB62D, 0x0000018 + +gUnk_080CB645:: @ 080CB645 + .incbin "baserom.gba", 0x0CB645, 0x0000018 + +gUnk_080CB65D:: @ 080CB65D + .incbin "baserom.gba", 0x0CB65D, 0x0000014 + +gUnk_080CB671:: @ 080CB671 + .incbin "baserom.gba", 0x0CB671, 0x000000B + +gUnk_080CB67C:: @ 080CB67C + .incbin "baserom.gba", 0x0CB67C, 0x0000020 diff --git a/data/chuchuAnimations.s b/data/animations/chuchu.s similarity index 100% rename from data/chuchuAnimations.s rename to data/animations/chuchu.s diff --git a/data/darkNutAnimations.s b/data/animations/darkNut.s similarity index 100% rename from data/darkNutAnimations.s rename to data/animations/darkNut.s diff --git a/data/animations/doorMimic.s b/data/animations/doorMimic.s new file mode 100644 index 00000000..deaf716b --- /dev/null +++ b/data/animations/doorMimic.s @@ -0,0 +1,25 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CB8B4:: @ 080CB8B4 + .incbin "baserom.gba", 0x0CB8B4, 0x0000005 + +gUnk_080CB8B9:: @ 080CB8B9 + .incbin "baserom.gba", 0x0CB8B9, 0x0000005 + +gUnk_080CB8BE:: @ 080CB8BE + .incbin "baserom.gba", 0x0CB8BE, 0x0000019 + +gUnk_080CB8D7:: @ 080CB8D7 + .incbin "baserom.gba", 0x0CB8D7, 0x0000019 + +gUnk_080CB8F0:: @ 080CB8F0 + .incbin "baserom.gba", 0x0CB8F0, 0x0000011 + +gUnk_080CB901:: @ 080CB901 + .incbin "baserom.gba", 0x0CB901, 0x0000013 + +gUnk_080CB914:: @ 080CB914 + .incbin "baserom.gba", 0x0CB914, 0x0000034 diff --git a/data/animations/enemyE.s b/data/animations/enemyE.s new file mode 100644 index 00000000..d958e227 --- /dev/null +++ b/data/animations/enemyE.s @@ -0,0 +1,7 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CBBEC:: @ 080CBBEC + .incbin "baserom.gba", 0x0CBBEC, 0x000004C diff --git a/data/greatFairyAnimations.s b/data/animations/greatFairy.s similarity index 100% rename from data/greatFairyAnimations.s rename to data/animations/greatFairy.s diff --git a/data/animations/keese.s b/data/animations/keese.s new file mode 100644 index 00000000..3275c2d1 --- /dev/null +++ b/data/animations/keese.s @@ -0,0 +1,13 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CB706:: @ 080CB706 + .incbin "baserom.gba", 0x0CB706, 0x0000018 + +gUnk_080CB71E:: @ 080CB71E + .incbin "baserom.gba", 0x0CB71E, 0x000000A + +gUnk_080CB728:: @ 080CB728 + .incbin "baserom.gba", 0x0CB728, 0x000000C diff --git a/data/leeverAnimations.s b/data/animations/leever.s similarity index 100% rename from data/leeverAnimations.s rename to data/animations/leever.s diff --git a/data/octorokAnimations.s b/data/animations/octorok.s similarity index 100% rename from data/octorokAnimations.s rename to data/animations/octorok.s diff --git a/data/peahatAnimations.s b/data/animations/peahat.s similarity index 100% rename from data/peahatAnimations.s rename to data/animations/peahat.s diff --git a/data/animations/rockChuchu.s b/data/animations/rockChuchu.s new file mode 100644 index 00000000..d28e303f --- /dev/null +++ b/data/animations/rockChuchu.s @@ -0,0 +1,16 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CB96C:: @ 080CB96C + .incbin "baserom.gba", 0x0CB96C, 0x0000029 + +gUnk_080CB995:: @ 080CB995 + .incbin "baserom.gba", 0x0CB995, 0x0000041 + +gUnk_080CB9D6:: @ 080CB9D6 + .incbin "baserom.gba", 0x0CB9D6, 0x0000042 + +gUnk_080CBA18:: @ 080CBA18 + .incbin "baserom.gba", 0x0CBA18, 0x0000010 diff --git a/data/rollobiteAnimations.s b/data/animations/rollobite.s similarity index 100% rename from data/rollobiteAnimations.s rename to data/animations/rollobite.s diff --git a/data/animations/spinyChuchu.s b/data/animations/spinyChuchu.s new file mode 100644 index 00000000..ab88f654 --- /dev/null +++ b/data/animations/spinyChuchu.s @@ -0,0 +1,28 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CBA64:: @ 080CBA64 + .incbin "baserom.gba", 0x0CBA64, 0x0000041 + +gUnk_080CBAA5:: @ 080CBAA5 + .incbin "baserom.gba", 0x0CBAA5, 0x0000040 + +gUnk_080CBAE5:: @ 080CBAE5 + .incbin "baserom.gba", 0x0CBAE5, 0x0000018 + +gUnk_080CBAFD:: @ 080CBAFD + .incbin "baserom.gba", 0x0CBAFD, 0x0000024 + +gUnk_080CBB21:: @ 080CBB21 + .incbin "baserom.gba", 0x0CBB21, 0x0000011 + +gUnk_080CBB32:: @ 080CBB32 + .incbin "baserom.gba", 0x0CBB32, 0x000000D + +gUnk_080CBB3F:: @ 080CBB3F + .incbin "baserom.gba", 0x0CBB3F, 0x0000005 + +gUnk_080CBB44:: @ 080CBB44 + .incbin "baserom.gba", 0x0CBB44, 0x0000020 diff --git a/data/data_080CB570.s b/data/data_080CBC38.s similarity index 95% rename from data/data_080CB570.s rename to data/data_080CBC38.s index ae280443..6c805bb0 100644 --- a/data/data_080CB570.s +++ b/data/data_080CBC38.s @@ -2,268 +2,6 @@ .include "constants/constants.inc" .section .rodata - .align 2 - -gUnk_080CB570:: @ 080CB570 - .incbin "baserom.gba", 0x0CB570, 0x0000018 - -gUnk_080CB588:: @ 080CB588 - .incbin "baserom.gba", 0x0CB588, 0x0000008 - -gUnk_080CB590:: @ 080CB590 - .incbin "baserom.gba", 0x0CB590, 0x0000018 - -gUnk_080CB5A8:: @ 080CB5A8 - .incbin "baserom.gba", 0x0CB5A8, 0x0000020 - -gUnk_080CB5C8:: @ 080CB5C8 - .incbin "baserom.gba", 0x0CB5C8, 0x000000C - -gUnk_080CB5D4:: @ 080CB5D4 - .incbin "baserom.gba", 0x0CB5D4, 0x0000008 - -gUnk_080CB5DC:: @ 080CB5DC - .incbin "baserom.gba", 0x0CB5DC, 0x0000008 - -gUnk_080CB5E4:: @ 080CB5E4 - .incbin "baserom.gba", 0x0CB5E4, 0x0000008 - -gUnk_080CB5EC:: @ 080CB5EC - .incbin "baserom.gba", 0x0CB5EC, 0x0000014 - -gUnk_080CB600:: @ 080CB600 - .incbin "baserom.gba", 0x0CB600, 0x000001C - -gUnk_080CB61C:: @ 080CB61C - .incbin "baserom.gba", 0x0CB61C, 0x0000011 - -gUnk_080CB62D:: @ 080CB62D - .incbin "baserom.gba", 0x0CB62D, 0x0000018 - -gUnk_080CB645:: @ 080CB645 - .incbin "baserom.gba", 0x0CB645, 0x0000018 - -gUnk_080CB65D:: @ 080CB65D - .incbin "baserom.gba", 0x0CB65D, 0x0000014 - -gUnk_080CB671:: @ 080CB671 - .incbin "baserom.gba", 0x0CB671, 0x000000B - -gUnk_080CB67C:: @ 080CB67C - .incbin "baserom.gba", 0x0CB67C, 0x0000020 - -gUnk_080CB69C:: @ 080CB69C - .incbin "baserom.gba", 0x0CB69C, 0x0000018 - -gUnk_080CB6B4:: @ 080CB6B4 - .incbin "baserom.gba", 0x0CB6B4, 0x0000010 - -gUnk_080CB6C4:: @ 080CB6C4 - .incbin "baserom.gba", 0x0CB6C4, 0x000000C - -gUnk_080CB6D0:: @ 080CB6D0 - .incbin "baserom.gba", 0x0CB6D0, 0x0000006 - -gUnk_080CB6D6:: @ 080CB6D6 - .incbin "baserom.gba", 0x0CB6D6, 0x0000020 - -gUnk_080CB6F6:: @ 080CB6F6 - .incbin "baserom.gba", 0x0CB6F6, 0x0000010 - -gUnk_080CB706:: @ 080CB706 - .incbin "baserom.gba", 0x0CB706, 0x0000018 - -gUnk_080CB71E:: @ 080CB71E - .incbin "baserom.gba", 0x0CB71E, 0x000000A - -gUnk_080CB728:: @ 080CB728 - .incbin "baserom.gba", 0x0CB728, 0x000000C - -gUnk_080CB734:: @ 080CB734 - .incbin "baserom.gba", 0x0CB734, 0x0000018 - -gUnk_080CB74C:: @ 080CB74C - .incbin "baserom.gba", 0x0CB74C, 0x0000018 - -gUnk_080CB764:: @ 080CB764 - .incbin "baserom.gba", 0x0CB764, 0x0000008 - -gUnk_080CB76C:: @ 080CB76C - .incbin "baserom.gba", 0x0CB76C, 0x0000030 - -gUnk_080CB79C:: @ 080CB79C - .incbin "baserom.gba", 0x0CB79C, 0x0000008 - -gUnk_080CB7A4:: @ 080CB7A4 - .incbin "baserom.gba", 0x0CB7A4, 0x0000008 - -gUnk_080CB7AC:: @ 080CB7AC - .incbin "baserom.gba", 0x0CB7AC, 0x0000008 - -gUnk_080CB7B4:: @ 080CB7B4 - .incbin "baserom.gba", 0x0CB7B4, 0x0000008 - -gUnk_080CB7BC:: @ 080CB7BC - .incbin "baserom.gba", 0x0CB7BC, 0x0000008 - -gUnk_080CB7C4:: @ 080CB7C4 - .incbin "baserom.gba", 0x0CB7C4, 0x0000008 - -gUnk_080CB7CC:: @ 080CB7CC - .incbin "baserom.gba", 0x0CB7CC, 0x0000008 - -gUnk_080CB7D4:: @ 080CB7D4 - .incbin "baserom.gba", 0x0CB7D4, 0x0000008 - -gUnk_080CB7DC:: @ 080CB7DC - .incbin "baserom.gba", 0x0CB7DC, 0x0000008 - -gUnk_080CB7E4:: @ 080CB7E4 - .incbin "baserom.gba", 0x0CB7E4, 0x0000008 - -gUnk_080CB7EC:: @ 080CB7EC - .incbin "baserom.gba", 0x0CB7EC, 0x0000008 - -gUnk_080CB7F4:: @ 080CB7F4 - .incbin "baserom.gba", 0x0CB7F4, 0x0000030 - -gUnk_080CB824:: @ 080CB824 - .incbin "baserom.gba", 0x0CB824, 0x0000008 - -gUnk_080CB82C:: @ 080CB82C - .incbin "baserom.gba", 0x0CB82C, 0x0000008 - -gUnk_080CB834:: @ 080CB834 - .incbin "baserom.gba", 0x0CB834, 0x0000008 - -gUnk_080CB83C:: @ 080CB83C - .incbin "baserom.gba", 0x0CB83C, 0x0000008 - -gUnk_080CB844:: @ 080CB844 - .incbin "baserom.gba", 0x0CB844, 0x0000008 - -gUnk_080CB84C:: @ 080CB84C - .incbin "baserom.gba", 0x0CB84C, 0x0000008 - -gUnk_080CB854:: @ 080CB854 - .incbin "baserom.gba", 0x0CB854, 0x0000008 - -gUnk_080CB85C:: @ 080CB85C - .incbin "baserom.gba", 0x0CB85C, 0x0000008 - -gUnk_080CB864:: @ 080CB864 - .incbin "baserom.gba", 0x0CB864, 0x0000008 - -gUnk_080CB86C:: @ 080CB86C - .incbin "baserom.gba", 0x0CB86C, 0x0000008 - -gUnk_080CB874:: @ 080CB874 - .incbin "baserom.gba", 0x0CB874, 0x0000030 - -gUnk_080CB8A4:: @ 080CB8A4 - .incbin "baserom.gba", 0x0CB8A4, 0x0000010 - -gUnk_080CB8B4:: @ 080CB8B4 - .incbin "baserom.gba", 0x0CB8B4, 0x0000005 - -gUnk_080CB8B9:: @ 080CB8B9 - .incbin "baserom.gba", 0x0CB8B9, 0x0000005 - -gUnk_080CB8BE:: @ 080CB8BE - .incbin "baserom.gba", 0x0CB8BE, 0x0000019 - -gUnk_080CB8D7:: @ 080CB8D7 - .incbin "baserom.gba", 0x0CB8D7, 0x0000019 - -gUnk_080CB8F0:: @ 080CB8F0 - .incbin "baserom.gba", 0x0CB8F0, 0x0000011 - -gUnk_080CB901:: @ 080CB901 - .incbin "baserom.gba", 0x0CB901, 0x0000013 - -gUnk_080CB914:: @ 080CB914 - .incbin "baserom.gba", 0x0CB914, 0x0000034 - -gUnk_080CB948:: @ 080CB948 - .incbin "baserom.gba", 0x0CB948, 0x0000018 - -gUnk_080CB960:: @ 080CB960 - .incbin "baserom.gba", 0x0CB960, 0x000000C - -gUnk_080CB96C:: @ 080CB96C - .incbin "baserom.gba", 0x0CB96C, 0x0000029 - -gUnk_080CB995:: @ 080CB995 - .incbin "baserom.gba", 0x0CB995, 0x0000041 - -gUnk_080CB9D6:: @ 080CB9D6 - .incbin "baserom.gba", 0x0CB9D6, 0x0000042 - -gUnk_080CBA18:: @ 080CBA18 - .incbin "baserom.gba", 0x0CBA18, 0x0000010 - -gUnk_080CBA28:: @ 080CBA28 - .incbin "baserom.gba", 0x0CBA28, 0x0000018 - -gUnk_080CBA40:: @ 080CBA40 - .incbin "baserom.gba", 0x0CBA40, 0x0000020 - -gUnk_080CBA60:: @ 080CBA60 - .incbin "baserom.gba", 0x0CBA60, 0x0000004 - -gUnk_080CBA64:: @ 080CBA64 - .incbin "baserom.gba", 0x0CBA64, 0x0000041 - -gUnk_080CBAA5:: @ 080CBAA5 - .incbin "baserom.gba", 0x0CBAA5, 0x0000040 - -gUnk_080CBAE5:: @ 080CBAE5 - .incbin "baserom.gba", 0x0CBAE5, 0x0000018 - -gUnk_080CBAFD:: @ 080CBAFD - .incbin "baserom.gba", 0x0CBAFD, 0x0000024 - -gUnk_080CBB21:: @ 080CBB21 - .incbin "baserom.gba", 0x0CBB21, 0x0000011 - -gUnk_080CBB32:: @ 080CBB32 - .incbin "baserom.gba", 0x0CBB32, 0x000000D - -gUnk_080CBB3F:: @ 080CBB3F - .incbin "baserom.gba", 0x0CBB3F, 0x0000005 - -gUnk_080CBB44:: @ 080CBB44 - .incbin "baserom.gba", 0x0CBB44, 0x0000020 - -gUnk_080CBB64:: @ 080CBB64 - .incbin "baserom.gba", 0x0CBB64, 0x0000018 - -gUnk_080CBB7C:: @ 080CBB7C - .incbin "baserom.gba", 0x0CBB7C, 0x0000014 - -gUnk_080CBB90:: @ 080CBB90 - .incbin "baserom.gba", 0x0CBB90, 0x0000010 - -gUnk_080CBBA0:: @ 080CBBA0 - .incbin "baserom.gba", 0x0CBBA0, 0x0000014 - -gUnk_080CBBB4:: @ 080CBBB4 - .incbin "baserom.gba", 0x0CBBB4, 0x0000008 - -gUnk_080CBBBC:: @ 080CBBBC - .incbin "baserom.gba", 0x0CBBBC, 0x0000008 - -gUnk_080CBBC4:: @ 080CBBC4 - .incbin "baserom.gba", 0x0CBBC4, 0x0000004 - -gUnk_080CBBC8:: @ 080CBBC8 - .incbin "baserom.gba", 0x0CBBC8, 0x0000014 - -gUnk_080CBBDC:: @ 080CBBDC - .incbin "baserom.gba", 0x0CBBDC, 0x0000010 - -gUnk_080CBBEC:: @ 080CBBEC - .incbin "baserom.gba", 0x0CBBEC, 0x000004C gUnk_080CBC38:: @ 080CBC38 .incbin "baserom.gba", 0x0CBC38, 0x0000018 diff --git a/include/entity.h b/include/entity.h index 0304f396..fc09651d 100644 --- a/include/entity.h +++ b/include/entity.h @@ -19,10 +19,7 @@ typedef struct { } EntityType; typedef struct { - u8 unknown[6]; - u8 field_0x6; - u8 field_0x7; - u8 unknown2[4]; + u8 unknown[8]; } BoundingBox; typedef struct Entity { diff --git a/include/player.h b/include/player.h index 77f9e59d..488ffba4 100644 --- a/include/player.h +++ b/include/player.h @@ -33,13 +33,15 @@ typedef struct { /*0x30*/ union { /* */ u32 all; /* */ struct { - /* */ u32 filler9 : 3; + /* */ u32 filler9 : 2; + /* */ u32 unk2 : 1; /* */ u32 noMinishCap : 1; /* */ u32 pullingState : 1; /* */ u32 windyState : 1; /* */ u32 filler6 : 1; /* */ u32 unk7 : 1; - /* */ u32 filler8 : 2; + /* */ u32 unk8 : 1; + /* */ u32 unk9 : 1; /* */ u32 slipperyState : 1; /* */ u32 filler11 : 5; /* */ u32 filler11b : 16; @@ -54,7 +56,9 @@ typedef struct { /* */ u8 swordBlueParticle : 1; /* */ u8 filler14 : 6; /*0x3f*/ u8 field_0x3f; - /*0x40*/ u8 field_0x40[75]; + /*0x40*/ u8 field_0x40[64]; + /*0x80*/ u16 field_0x80; + /*0x82*/ u8 field_0x82[9]; /*0x8b*/ u8 field_0x8b; /*0x8c*/ u32 field_0x8c; /*0x90*/ union SplitWord field_0x90; @@ -63,7 +67,8 @@ typedef struct { /*0xa9*/ u8 field_0xa9; /*0xaa*/ u8 field_0xaa; /*0xab*/ u8 field_0xab; - /*0xac*/ u32 field_0xac; + /*0xac*/ u16 field_0xac; + /*0xae*/ u16 field_0xae; } PlayerState; diff --git a/linker.ld b/linker.ld index 962668bc..fb3cd92e 100644 --- a/linker.ld +++ b/linker.ld @@ -332,14 +332,14 @@ SECTIONS { src/enemy/rollobite.o(.text); src/enemy/darkNut.o(.text); src/enemy/hangingSeed.o(.text); - asm/beetle.o(.text); + src/enemy/beetle.o(.text); src/enemy/keese.o(.text); - asm/doorMimic.o(.text); - asm/rockChuchu.o(.text); - asm/spinyChuchu.o(.text); - asm/cuccoChickAggr.o(.text); - asm/moldorm.o(.text); - asm/enemyE.o(.text); + src/enemy/doorMimic.o(.text); + src/enemy/rockChuchu.o(.text); + src/enemy/spinyChuchu.o(.text); + src/enemy/cuccoChickAggr.o(.text); + src/enemy/moldorm.o(.text); + src/enemy/enemyE.o(.text); asm/moldworm.o(.text); asm/sluggula.o(.text); asm/pesto.o(.text); @@ -906,18 +906,33 @@ SECTIONS { src/trig.o(.rodata); data/data_080C93E0.o(.rodata); src/enemy/octorok.o(.rodata); - data/octorokAnimations.o(.rodata); + data/animations/octorok.o(.rodata); src/enemy/chuchu.o(.rodata); - data/chuchuAnimations.o(.rodata); + data/animations/chuchu.o(.rodata); src/enemy/leever.o(.rodata); - data/leeverAnimations.o(.rodata); + data/animations/leever.o(.rodata); src/enemy/peahat.o(.rodata); - data/peahatAnimations.o(.rodata); + data/animations/peahat.o(.rodata); src/enemy/rollobite.o(.rodata); - data/rollobiteAnimations.o(.rodata); + data/animations/rollobite.o(.rodata); src/enemy/darkNut.o(.rodata); - data/darkNutAnimations.o(.rodata); - data/data_080CB570.o(.rodata); + data/animations/darkNut.o(.rodata); + src/enemy/hangingSeed.o(.rodata); + src/enemy/beetle.o(.rodata); + data/animations/beetle.o(.rodata); + src/enemy/keese.o(.rodata); + data/animations/keese.o(.rodata); + src/enemy/doorMimic.o(.rodata); + data/animations/doorMimic.o(.rodata); + src/enemy/rockChuchu.o(.rodata); + data/animations/rockChuchu.o(.rodata); + src/enemy/spinyChuchu.o(.rodata); + data/animations/spinyChuchu.o(.rodata); + src/enemy/cuccoChickAggr.o(.rodata); + src/enemy/moldorm.o(.rodata); + src/enemy/enemyE.o(.rodata); + data/animations/enemyE.o(.rodata); + data/data_080CBC38.o(.rodata); src/enemy.o(.rodata); data/data_080D3D94.o(.rodata); data/areaPropertyLists.o(.rodata); @@ -934,7 +949,7 @@ SECTIONS { data/room_headers.o(.rodata); data/data_0811E454.o(.rodata); src/object/greatFairy.o(.rodata); - data/greatFairyAnimations.o(.rodata); + data/animations/greatFairy.o(.rodata); data/data_081208A0.o(.rodata); src/object/heartContainer.o(.rodata); data/data_08121C58.o(.rodata); diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c new file mode 100644 index 00000000..3bdbfdad --- /dev/null +++ b/src/enemy/beetle.c @@ -0,0 +1,360 @@ +#include "entity.h" +#include "functions.h" +#include "player.h" + +extern u32 sub_08049F64(Entity*, u32, u32); + +u32 sub_08021D00(); +void sub_08021D44(Entity* this, u32 param_2); + +extern void (*const gUnk_080CB590[])(Entity*); +extern void (*const gUnk_080CB5A8[])(Entity*); +extern void (*const gUnk_080CB5C8[])(Entity*); +extern void (*const gUnk_080CB5D4[])(Entity*); + +extern const s8 gUnk_080CB5DC[]; +extern const s8 gUnk_080CB5E4[]; + +void Beetle(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CB590); +} + +void sub_08021768(Entity* this) { + gUnk_080CB5A8[this->action](this); +} + +void sub_08021780(Entity* this) { + switch (this->bitfield) { + case 0x80: + if (gPlayerState.field_0xa8 == 24) { + sub_08021768(this); + } else { + this->action = 5; + this->actionDelay = 0xb4; + this->field_0xf = 0; + this->flags &= ~0x80; + this->spritePriority.b0 = 3; + CopyPositionAndSpriteOffset(&gPlayerEntity, this); + this->height.HALF.HI = -1; + ((u8*)&this->field_0x86)[1] = 1; + InitializeAnimation(this, 6); + } + break; + case 0x93: + sub_08021768(this); + break; + } + + if (this->currentHealth == 0) + this->field_0x42 = 0; + + sub_0804AA30(this, gUnk_080CB590); +} + +void sub_08021818(Entity* this) { + if (this->entityType.form == 0) { + sub_0804A7D4(this); + } else { + Entity* ent = this->parent; + if (ent) { + ent->field_0xf--; + this->parent = NULL; + } + CreateDeathFx(this, 0xf0, 0); + } +} + +void sub_08021848(Entity* this) { + if (sub_0806F520(this)) { + gUnk_080CB5C8[this->previousActionFlag](this); + } else { + this->action = 3; + this->height.HALF.HI = 0; + InitializeAnimation(this, 2); + } +} + +void sub_0802187C(Entity* this) { + this->previousActionFlag = 2; +} + +void nullsub_130(Entity* this) { +} + +void sub_08021888(Entity* this) { + if (sub_0806F3E4(this)) + sub_08021818(this); +} + +void sub_0802189C(Entity* this) { + sub_0804A720(this); + this->action = 1; + this->field_0x1c = 1; + InitializeAnimation(this, 3); +} + +void sub_080218B4(Entity* this) { + gUnk_080CB5D4[this->entityType.parameter](this); +} + +void sub_080218CC(Entity* this) { + if (this->previousActionFlag == 0) { + this->previousActionFlag = 1; + this->spriteSettings.b.draw = 1; + this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + this->nonPlanarMovement = 0x100; + this->field_0x20 = 0x12000; + } + + GetNextFrame(this); + if (this->frames.all & 1) { + sub_080AEFE0(this); + if (sub_080044EC(this, 0x1c00) == 0) + this->frameDuration = 1; + } + + if (this->frames.all & 0x80) { + this->action = 2; + this->actionDelay = (Random() & 0x38) + 8; + this->field_0xf = 1; + this->flags |= 0x80; + this->nonPlanarMovement = 0x180; + InitializeAnimation(this, 0); + } +} + +void sub_08021984(Entity* this) { + if (this->previousActionFlag == 0) { + this->previousActionFlag = 1; + this->flags |= 0x80; + this->spriteSettings.b.draw = 3; + this->height.HALF.HI = -0x80; + this->spriteRendering.b3 = 1; + this->spriteOrientation.flipY = 1; + sub_08004488(0x12d); + } + + if (sub_08003FC4(this, 0x1800) == 0) { + this->action = 2; + this->actionDelay = 16; + this->field_0xf = 1; + this->spriteSettings.b.draw = 1; + this->nonPlanarMovement = 0x180; + ((u8*)&this->field_0x86)[0] = 60; + InitializeAnimation(this, 0); + UpdateSpriteForCollisionLayer(this); + } +} + +void sub_08021A10(Entity* this) { + GetNextFrame(this); + if (sub_080041A0(this, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) { + if (--this->actionDelay == 0) { + this->action = 3; + this->actionDelay = (Random() & 0x3f) + 30; + sub_08021D44(this, this->direction); + InitializeAnimation(this, 2); + } + } +} + +void sub_08021A64(Entity* this) { + if (!sub_08021D00(this)) { + if (--this->actionDelay == 0) { + this->action = 2; + this->actionDelay = (Random() & 0x1f) + 0x1e; + InitializeAnimation(this, 0); + } + + if (--this->field_0xf == 0) { + u32 tmp; + + this->field_0xf = 8; + tmp = sub_08049F84(this, 1); + if (tmp == 0xff) { + this->action = 7; + InitializeAnimation(this, 1); + return; + } + sub_08021D44(this, tmp); + } + sub_080AEF88(this); + GetNextFrame(this); + } +} + +void sub_08021AD8(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 1) { + if (this->actionDelay) { + u32 tmp; + + this->actionDelay = 0; + tmp = sub_08049F84(this, 1); + if (tmp == 0xff) { + this->action = 2; + this->actionDelay = '\b'; + InitializeAnimation(this, 0); + return; + } + this->direction = (u8)tmp; + sub_08004488(0x7c); + } + sub_080AEFE0(this); + if (!sub_08003FC4(this, 0x1800)) + this->frameDuration = 1; + } + + if (this->frames.all & 0x80) { + this->action = 2; + this->actionDelay = 20; + ((u8*)&this->field_0x86)[0] = 60; + InitializeAnimation(this, 0); + } +} + +void sub_08021B64(Entity* this) { + if (gPlayerState.flags.all & 4) { + this->action = 3; + this->height.WORD = 0; + InitializeAnimation(this, 2); + } else { + int iVar4 = 1; + if (gPlayerState.field_0xa8 != 11 && gPlayerState.field_0xa8 != 20) { + if (sub_0807953C()) + iVar4 = this->entityType.form * 3 + 8; + + iVar4 = this->actionDelay - iVar4; + if (iVar4 < 0) + iVar4 = 0; + + this->actionDelay = (u8)iVar4; + } + + if (gPlayerState.flags.all & 0x110) + iVar4 = 0; + + if (iVar4 == 0) { + this->action = 6; + this->field_0x20 = 0x10000; + ((u8*)&this->field_0x86)[1] = 0; + if (gPlayerEntity.direction != 0xff) { + this->direction = 0x10 ^ gPlayerEntity.direction; + } else { + this->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + } + InitializeAnimation(this, 5); + } else { + gPlayerState.field_0x1a[0] |= 0x80; + gPlayerState.field_0x80 -= 0x50; + gPlayerState.field_0xaa++; + CopyPositionAndSpriteOffset(&gPlayerEntity, this); + this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1]; + this->height.HALF.HI--; + GetNextFrame(this); + } + } +} + +void sub_08021C58(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 1) { + sub_080AEFE0(this); + if (sub_08003FC4(this, 0x1800) == 0) + this->frameDuration = 1; + } + + if (this->frames.all & 0x80) { + this->action = 2; + this->actionDelay = 60; + this->field_0xf = 1; + this->flags |= 0x80; + this->spritePriority.b0 = 4; + ((u8*)&this->field_0x86)[0] = 60; + InitializeAnimation(this, 0); + } +} + +void sub_08021CD0(Entity* this) { + if ((this->frames.all & 0x80) == 0) + GetNextFrame(this); + + if (sub_08049F84(this, 1) == 0xff) + return; + + this->action = 3; + InitializeAnimation(this, 2); +} + +u32 sub_08021D00(Entity* this) { + u32 ret; + + if (((u8*)&this->field_0x86)[0]) { + ((u8*)&this->field_0x86)[0]--; + ret = 0; + } else if (sub_08049F64(this, 1, 0x10) == 0) { + ret = 0; + } else { + this->action = 4; + this->actionDelay = 1; + this->field_0x20 = 0x18000; + InitializeAnimation(this, 4); + ret = 1; + } + + return ret; +} + +void sub_08021D44(Entity* this, u32 param_2) { + param_2 += 4; + param_2 &= 0x18; + this->direction = param_2; + if (param_2 & 8) { + this->nonPlanarMovement = 0x180; + } else { + this->nonPlanarMovement = 0xc0; + } +} + + +// clang-format off +void (*const gUnk_080CB590[])(Entity*) = { + sub_08021768, + sub_08021780, + sub_08001324, + sub_08021818, + sub_08001242, + sub_08021848, +}; + +void (*const gUnk_080CB5A8[])(Entity*) = { + sub_0802189C, + sub_080218B4, + sub_08021A10, + sub_08021A64, + sub_08021AD8, + sub_08021B64, + sub_08021C58, + sub_08021CD0, +}; + +void (*const gUnk_080CB5C8[])(Entity*) = { + sub_0802187C, + nullsub_130, + sub_08021888, +}; + +void (*const gUnk_080CB5D4[])(Entity*) = { + sub_080218CC, + sub_08021984, +}; + +const s8 gUnk_080CB5DC[] = { + -1, -2, 1, 2, -3, 3, -4, 4, +}; + +const s8 gUnk_080CB5E4[] = { + -1, -2, -1, 0, 1, 2, 1, 0, +}; +// clang-format on + diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c new file mode 100644 index 00000000..2fcfcc89 --- /dev/null +++ b/src/enemy/cuccoChickAggr.c @@ -0,0 +1,167 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +extern Entity* sub_08049DF4(u32); + +void sub_08022A88(Entity*); +void sub_08022AA4(Entity*); +void sub_08022B0C(Entity*); +u32 sub_08022B20(Entity*); +void sub_08022B44(Entity*); + +extern void (*const gUnk_080CBB64[])(Entity*); +extern void (*const gUnk_080CBB7C[])(Entity*); + +void CuccoChickAggr(Entity* this) { + gUnk_080CBB64[GetNextFunction(this)](this); +} + +void sub_08022934(Entity* this) { + gUnk_080CBB7C[this->action](this); +} + +void sub_0802294C(Entity* this) { + sub_0804AA30(this, gUnk_080CBB64); +} + +void nullsub_132(Entity* this) { +} + +void sub_08022960(Entity* this) { + sub_0804A720(this); + sub_08022A88(this); +} + +void sub_08022970(Entity* this) { + if (--this->actionDelay == 0) { + sub_08022AA4(this); + } +} + +void sub_08022988(Entity* this) { + if (this->height.HALF.HI == 0 && sub_08022B20(this)) { + sub_08022B0C(this); + } else { + if (this->field_0xf) { + if (--this->field_0xf) + return; + + this->frameIndex = 1; + this->field_0x20 = 0x10000; + sub_08004488(0xd6); + } + + sub_080AEF88(this); + if (sub_08003FC4(this, 0x2000) == 0) { + if (--this->actionDelay == 0) { + sub_08022A88(this); + } else { + this->field_0xf = 4; + this->frameIndex = 0; + } + } + } +} + +void sub_080229F8(Entity* this) { + if (sub_08003FC4(this, 0x2800) == 0) { + if (--this->actionDelay == 0) { + this->action = 4; + this->actionDelay = 6; + this->field_0xf = 8; + this->frameIndex = 0; + this->nonPlanarMovement = 0xc0; + sub_08022B44(this); + } else { + this->field_0x20 = 0x10000; + sub_08004488(0xd6); + } + } +} + +void sub_08022A40(Entity* this) { + if (this->field_0xf) { + if (--this->field_0xf) + return; + + this->frameIndex = 1; + } + + sub_080AEF88(this); + if (sub_08003FC4(this, 0x2000) == 0) { + if (--this->actionDelay == 0) { + sub_08022A88(this); + } else { + sub_08022B44(this); + } + } +} + +void sub_08022A88(Entity* this) { + this->action = 1; + this->actionDelay = (Random() & 0xf) + 8; + this->frameIndex = 0; +} + +void sub_08022AA4(Entity* this) { + u32 rand = Random(); + + this->action = 2; + this->actionDelay = (rand & 3) + 1; + this->field_0xf = 1; + this->nonPlanarMovement = 0x80; + + if (!sub_08049FA0(this) && (rand >> 8) & 3) { + this->direction = sub_08049EE4(this); + } else { + this->direction = (rand >> 0x10) & 0x1f; + } + + if (this->direction & 0xf) + this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1; +} + +void sub_08022B0C(Entity* this) { + this->action = 3; + this->actionDelay = 3; + this->field_0xf = 8; + sub_08022B44(this); +} + +u32 sub_08022B20(Entity* this) { + if (!sub_08049DF4(2)) + return 0; + + return sub_080041A0(this, &gPlayerEntity, 0x24, 0x24); +} + +void sub_08022B44(Entity *this){ + this->field_0x20 = 0xc000; + this->direction = GetFacingDirection(this,&gPlayerEntity); + + if (this->direction & 0xf) + this->spriteSettings.b.flipX = (this->direction >> 4)^1; + + sub_08004488(0xd6); +} + + +// clang-format off +void (*const gUnk_080CBB64[])(Entity*) = { + sub_08022934, + sub_0802294C, + sub_08001324, + sub_0804A7D4, + sub_08001242, + nullsub_132, +}; + +void (*const gUnk_080CBB7C[])(Entity*) = { + sub_08022960, + sub_08022970, + sub_08022988, + sub_080229F8, + sub_08022A40, +}; +// clang-format on diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c new file mode 100644 index 00000000..587ce521 --- /dev/null +++ b/src/enemy/doorMimic.c @@ -0,0 +1,271 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +extern s16 sub_080001DA(u32, u32); // ? +extern void sub_08049CF4(); +extern u32 sub_0806FBFC(u32, u32, u32, u32); +void sub_080221C0(); + +typedef struct { + s8 h; + s8 v; +} PACKED PosOffset; + +extern void (*const gUnk_080CB734[])(Entity*); +extern void (*const gUnk_080CB74C[])(Entity*); + +#if NON_MATCHING +extern const PosOffset gUnk_080CB764[]; +#else +extern const s8 gUnk_080CB764[]; +#endif +extern const PosOffset gUnk_080CB76C[4][6]; +extern const u16 gUnk_080CB79C[]; +extern const BoundingBox* const* const gUnk_080CB8A4[]; + +extern s16 gUnk_080B4488[]; + +void DoorMimic(Entity* this) { + gUnk_080CB734[GetNextFunction(this)](this); + this->boundingBox = (BoundingBox*)gUnk_080CB8A4[this->entityType.parameter][this->frameIndex]; +} + +void sub_08021FDC(Entity* this) { + gUnk_080CB74C[this->action](this); +} + +void sub_08021FF4(Entity* this) { + sub_0804AA30(this, gUnk_080CB734); +} + +void sub_08022004(Entity* this) { + SetTile((u16)this->field_0x7c.HALF.LO, (u16)this->field_0x7c.HALF.HI, this->collisionLayer); + CreateFx(this, 5, 0); + sub_08049CF4(this); + DeleteThisEntity(); +} + +#if NON_MATCHING +void sub_08022034(Entity* this) { + this->action = 1; + this->entityType.parameter = this->entityType.form & 3; + this->spritePriority.b0 = 5; + this->field_0x78.HWORD = gUnk_080CB764[this->entityType.parameter].h + this->x.HALF.HI; + this->field_0x7a.HWORD = gUnk_080CB764[this->entityType.parameter].v + this->y.HALF.HI; + InitializeAnimation(this, this->entityType.parameter); + sub_080221C0(this); +} +#else +void sub_08022034(Entity* this) { + this->action = 1; + this->entityType.parameter = this->entityType.form & 3; + this->spritePriority.b0 = 5; + this->field_0x78.HWORD = gUnk_080CB764[this->entityType.parameter * 2] + this->x.HALF.HI; + this->field_0x7a.HWORD = gUnk_080CB764[this->entityType.parameter * 2 + 1] + this->y.HALF.HI; + InitializeAnimation(this, this->entityType.parameter); + sub_080221C0(this); +} +#endif + +void sub_0802209C(Entity* this) { + if (this->actionDelay == 0) { + if (sub_0806FBFC(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) { + this->action = 2; + this->actionDelay = 0x12; + InitializeAnimation(this, this->entityType.parameter + 4); + } + } else { + this->actionDelay = this->actionDelay - 1; + } +} + +void sub_080220D8(Entity* this) { + if (--this->actionDelay == 0) + this->action = 3; +} + +void sub_080220F0(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 0x80) { + const PosOffset* off; + u32 i; + + this->action = 4; + this->actionDelay = 0x78; + this->field_0x44 = 0; + off = gUnk_080CB76C[this->entityType.parameter]; + for (i = 0; i < 6; i++, off++) { + Entity* fx = CreateFx(this, 0x11, 0); + if (fx) { + fx->x.HALF.HI += off->h; + fx->y.HALF.HI += off->v; + } + } + sub_08004488(260); + } else if (this->frames.all & 1) { + this->field_0x44 = 4; + } +} + +void sub_08022174(Entity* this) { + sub_0800445C(this); + if (--this->actionDelay == 0) { + this->action = 5; + InitializeAnimation(this, this->entityType.parameter + 8); + } +} + +void sub_08022198(Entity* this) { + sub_0800445C(this); + GetNextFrame(this); + if (this->frames.all & 0x80) { + this->action = 1; + this->actionDelay = 0x5a; + } +} + +void sub_080221C0(Entity* this) { + u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->entityType.parameter]; + this->field_0x7c.HALF.HI = tile; + this->field_0x7c.HALF.LO = sub_080001DA(tile, this->collisionLayer); + SetTile(gUnk_080CB79C[this->entityType.parameter], tile, this->collisionLayer); +} + +// clang-format off +void (*const gUnk_080CB734[])(Entity*) = { + sub_08021FDC, + sub_08021FF4, + sub_08001324, + sub_08022004, + sub_08001242, + sub_08021FDC, +}; + +void (*const gUnk_080CB74C[])(Entity*) = { + sub_08022034, + sub_0802209C, + sub_080220D8, + sub_080220F0, + sub_08022174, + sub_08022198, +}; + +#if NON_MATCHING +const PosOffset gUnk_080CB764[] = { + {-0x08, 0x00}, + {-0x10, -0x08}, + {-0x08, -0x10}, + { 0x00, -0x08}, +}; +#else +const s8 gUnk_080CB764[] = { + -0x08, 0x00, + -0x10, -0x08, + -0x08, -0x10, + 0x00, -0x08, +}; +#endif + +const PosOffset gUnk_080CB76C[][6] = { + { + {-0x04, 0x1a}, + { 0x04, 0x1a}, + {-0x0c, 0x10}, + { 0x0c, 0x10}, + {-0x0c, 0x08}, + { 0x0c, 0x08}, + }, + { + {-0x1a, -0x04}, + {-0x1a, 0x04}, + {-0x10, -0x0c}, + {-0x10, 0x0c}, + {-0x08, -0x0c}, + {-0x08, 0x0c}, + }, + { + {-0x04, -0x1a}, + { 0x04, -0x1a}, + {-0x0c, -0x10}, + { 0x0c, -0x10}, + {-0x0c, -0x08}, + { 0x0c, -0x08}, + }, + { + { 0x1a, -0x04}, + { 0x1a, 0x04}, + { 0x10, -0x0c}, + { 0x10, 0x0c}, + { 0x08, -0x0c}, + { 0x08, 0x0c}, + }, +}; + +const u16 gUnk_080CB79C[] = { + 0x4023, + 0x4025, + 0x4026, + 0x4024, +}; + + +const BoundingBox gUnk_080CB7A4 = { 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x08, 0x06 }; +const BoundingBox gUnk_080CB7AC = { 0x00, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04 }; +const BoundingBox gUnk_080CB7B4 = { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04 }; +const BoundingBox gUnk_080CB7BC = { 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x08 }; +const BoundingBox gUnk_080CB7C4 = { 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c }; +const BoundingBox gUnk_080CB7CC = { 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB7D4 = { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04 }; +const BoundingBox gUnk_080CB7DC = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04 }; +const BoundingBox gUnk_080CB7E4 = { 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB7EC = { 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c }; + +const BoundingBox *const gUnk_080CB7F4[] = { + &gUnk_080CB7A4, + &gUnk_080CB7AC, + &gUnk_080CB7B4, + &gUnk_080CB7BC, + &gUnk_080CB7C4, + &gUnk_080CB7C4, + &gUnk_080CB7CC, + &gUnk_080CB7D4, + &gUnk_080CB7DC, + &gUnk_080CB7E4, + &gUnk_080CB7EC, + &gUnk_080CB7EC, +}; + +const BoundingBox gUnk_080CB824 = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB82C = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 }; +const BoundingBox gUnk_080CB834 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 }; +const BoundingBox gUnk_080CB83C = { 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB844 = { 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08 }; +const BoundingBox gUnk_080CB84C = { 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB854 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 }; +const BoundingBox gUnk_080CB85C = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 }; +const BoundingBox gUnk_080CB864 = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 }; +const BoundingBox gUnk_080CB86C = { 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08 }; + +const BoundingBox *const gUnk_080CB874[] = { + &gUnk_080CB84C, + &gUnk_080CB854, + &gUnk_080CB85C, + &gUnk_080CB864, + &gUnk_080CB86C, + &gUnk_080CB86C, + &gUnk_080CB824, + &gUnk_080CB82C, + &gUnk_080CB834, + &gUnk_080CB83C, + &gUnk_080CB844, + &gUnk_080CB844, +}; + +const BoundingBox *const *const gUnk_080CB8A4[] = { + gUnk_080CB7F4, + gUnk_080CB874, + gUnk_080CB7F4, + gUnk_080CB874, +}; +// clang-format on diff --git a/src/enemy/enemyE.c b/src/enemy/enemyE.c new file mode 100644 index 00000000..9f6a0b6d --- /dev/null +++ b/src/enemy/enemyE.c @@ -0,0 +1,69 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +void sub_08023000(Entity*, int); + +extern void (*const gUnk_080CBBC8[])(Entity*); +extern void (*const gUnk_080CBBDC[])(Entity*); + +void EnemyE(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CBBC8); +} + +void sub_08022FB4(Entity* this) { + gUnk_080CBBDC[this->action](this); +} + +void nullsub_133(Entity* this) { +} + +void sub_08022FD0(Entity* this) { + this->action = 1; + this->spriteSettings.b.draw = 1; + sub_08023000(this, 0); +} + +void sub_08022FEC(Entity* this) { + sub_08023000(this, 0x80); +} + +void sub_08022FF8(Entity* this) { +} + +void sub_08022FFC(Entity* this) { +} + +void sub_08023000(Entity* this, int frames) { + int tmp; + + if (frames == 0x80) { + UpdateAnimationSingleFrame(this); + } else { + InitAnimationForceUpdate(this, frames); + } + + tmp = 0x80; + if (this->frameSpriteSettings == 0x40) + tmp *= -1; + + this->spriteRendering.b0 = 3; + sub_0805EC9C(this, tmp, 0x80, 0); +} + +// clang-format off +void (*const gUnk_080CBBC8[])(Entity*) = { + sub_08022FB4, + nullsub_133, + sub_08001324, + sub_0804A7D4, + sub_08001242, +}; + +void (*const gUnk_080CBBDC[])(Entity*) = { + sub_08022FD0, + sub_08022FEC, + sub_08022FF8, + sub_08022FFC, +}; +// clang-format on diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 7f0ba1dc..cd204a6e 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -1,39 +1,51 @@ -#include "global.h" #include "entity.h" - -extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*)); -extern void DeleteThisEntity(); +#include "functions.h" extern void (*const gUnk_080CB570[])(Entity*); extern void (*const gUnk_080CB588[])(Entity*); -void HangingSeed(Entity *this) -{ - EnemyFunctionHandler(this, gUnk_080CB570); +void HangingSeed(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CB570); } -void sub_080216E4(Entity *this) -{ - gUnk_080CB588[this->action](this); +void sub_080216E4(Entity* this) { + gUnk_080CB588[this->action](this); } -void sub_080216FC(Entity *this) -{ - if ((this->bitfield & 0x80) != 0) { - CreateFx(this, 3, 0x80); - DeleteThisEntity(); - } +void sub_080216FC(Entity* this) { + if (this->bitfield & 0x80) { + CreateFx(this, 3, 0x80); + DeleteThisEntity(); + } } -void nullsub_7(Entity* this){} - -void sub_08021720(Entity *this) -{ - this->action = 1; - this->spriteSettings.b.draw = 1; - this->frameIndex = (this->entityType).form; - this->spriteRendering.b3 = 1; - this->spritePriority.b0 = 3; +void nullsub_7(Entity* this) { } -void nullsub_08(Entity* this){} \ No newline at end of file +void sub_08021720(Entity* this) { + this->action = 1; + this->spriteSettings.b.draw = 1; + this->frameIndex = this->entityType.form; + this->spriteRendering.b3 = 1; + this->spritePriority.b0 = 3; +} + +void nullsub_08(Entity* this) { +} + +// clang-format off +void (*const gUnk_080CB570[])(Entity*) = { + sub_080216E4, + sub_080216FC, + sub_08001324, + sub_0804A7D4, + sub_08001242, + nullsub_7, +}; + +void (*const gUnk_080CB588[])(Entity*) = { + sub_08021720, + nullsub_08, +}; +// clang-format on + diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 0083bbf3..14f5c520 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -2,14 +2,14 @@ #include "entity.h" #include "enemy.h" #include "player.h" +#include "functions.h" -extern void sub_0804AA30(Entity*, void *); +extern void sub_08001328(Entity*); extern u32 sub_0806F520(Entity*); extern void sub_0806F4E8(Entity*); extern u32 sub_0806F3E4(Entity*); extern void sub_0804A7D4(Entity*); extern void sub_0804A720(Entity*); -extern u32 Random(); extern void sub_08021EF0(Entity*); extern void sub_080AEFB4(Entity*); extern void sub_08021F24(Entity*); @@ -17,102 +17,89 @@ extern u32 sub_0806FCB8(Entity*, s32, s32, u32); extern u32 sub_08049FA0(Entity*); extern u32 sub_08049EE4(Entity*); -extern void (*gUnk_080CB69C[])(Entity*); -extern void (*gUnk_080CB6B4[])(Entity*); -extern void (*gUnk_080CB6C4[])(Entity*); +extern void (*const gUnk_080CB69C[])(Entity*); +extern void (*const gUnk_080CB6B4[])(Entity*); +extern void (*const gUnk_080CB6C4[])(Entity*); -extern u8 gUnk_080CB6D0[]; -extern u16 gUnk_080CB6D6[]; -extern u8 gUnk_080CB6F6[]; +extern const s8 gUnk_080CB6D0[]; +extern const u16 gUnk_080CB6D6[]; +extern const u8 gUnk_080CB6F6[]; -void Keese(Entity *this) -{ +void Keese(Entity* this) { gUnk_080CB69C[GetNextFunction(this)](this); } -void sub_08021D80(Entity *this) -{ +void sub_08021D80(Entity* this) { gUnk_080CB6B4[this->action](this); } -void sub_08021d98(Entity *this) -{ - sub_0804AA30(this, &gUnk_080CB69C); +void sub_08021d98(Entity* this) { + sub_0804AA30(this, gUnk_080CB69C); } -void sub_08021DA8(Entity *this) -{ - if (sub_0806F520(this)) { - gUnk_080CB6C4[this->previousActionFlag](this); - } +void sub_08021DA8(Entity* this) { + if (sub_0806F520(this)) { + gUnk_080CB6C4[this->previousActionFlag](this); + } } -void sub_08021DCC(Entity *this) -{ - this->previousActionFlag = 2; +void sub_08021DCC(Entity* this) { + this->previousActionFlag = 2; } -void sub_08021DD4(Entity *this) -{ - sub_0806F4E8(this); +void sub_08021DD4(Entity* this) { + sub_0806F4E8(this); } -void sub_08021DDC(Entity *this) -{ - if (sub_0806F3E4(this)) { - sub_0804A7D4(this); - } +void sub_08021DDC(Entity* this) { + if (sub_0806F3E4(this)) { + sub_0804A7D4(this); + } } -void sub_08021DF0(Entity *this) -{ - - sub_0804A720(this); - if ((this->entityType).form != 0) { - this->spritePriority.b1 = 1; - this->height.HALF.HI = -0x10; - } - this->direction = Random() & 0x1f; - this->field_0x1c = 1; - this->spritePriority.b0 = 3; - this->collisionLayer = 3; - UpdateSpriteForCollisionLayer(this); - sub_08021EF0(this); -} +void sub_08021DF0(Entity* this) { -void sub_08021E4C(Entity *this) -{ - if (this->field_0x78.HWORD != 0) { - this->field_0x78.HWORD--; - } - if (this->field_0x7a.HWORD != 0) { - (this->field_0x7a.HWORD)--; - } - GetNextFrame(this); - if ((this->frames.b.f3) != 0) { - sub_08021F24(this); - } - else { - sub_080AEFB4(this); - } - this->spriteOffsetY = gUnk_080CB6D0[this->frames.all]; -} - -void sub_08021EA4(Entity *this) -{ - if (--this->actionDelay == 0) { + sub_0804A720(this); + if ((this->entityType).form != 0) { + this->spritePriority.b1 = 1; + this->height.HALF.HI = -0x10; + } + this->direction = Random() & 0x1f; + this->field_0x1c = 1; + this->spritePriority.b0 = 3; + this->collisionLayer = 3; + UpdateSpriteForCollisionLayer(this); sub_08021EF0(this); - } } -void sub_08021EBC(Entity *this) -{ +void sub_08021E4C(Entity* this) { + if (this->field_0x78.HWORD != 0) { + this->field_0x78.HWORD--; + } + if (this->field_0x7a.HWORD != 0) { + (this->field_0x7a.HWORD)--; + } + GetNextFrame(this); + if ((this->frames.b.f3) != 0) { + sub_08021F24(this); + } else { + sub_080AEFB4(this); + } + this->spriteOffsetY = gUnk_080CB6D0[this->frames.all]; +} + +void sub_08021EA4(Entity* this) { + if (--this->actionDelay == 0) { + sub_08021EF0(this); + } +} + +void sub_08021EBC(Entity* this) { s32 iVar1; - + if (this->actionDelay != 0) { this->actionDelay--; - } - else { + } else { iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70); if (iVar1 != 0) { sub_08021EF0(this); @@ -120,37 +107,71 @@ void sub_08021EBC(Entity *this) } } -void sub_08021EF0(Entity *this) -{ - u32 uVar1; - - this->action = 1; - this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf]; - this->field_0x7a.HWORD = 0x3c; - InitializeAnimation(this, 0); +void sub_08021EF0(Entity* this) { + u32 uVar1; + + this->action = 1; + this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf]; + this->field_0x7a.HWORD = 0x3c; + InitializeAnimation(this, 0); } -void sub_08021F24(Entity *this) -{ +void sub_08021F24(Entity* this) { u32 bVar1; - + if (this->field_0x78.HWORD == 0) { this->action = 2; this->actionDelay = gUnk_080CB6F6[Random() & 0xf]; InitializeAnimation(this, 1); - } - else if (!this->field_0x7a.HWORD && !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) { + } else if (!this->field_0x7a.HWORD && + !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) { this->action = 3; this->actionDelay = 0x1e; InitializeAnimation(this, 1); - } - else { + } else { if (sub_08049FA0(this) != 0) { this->direction = Random() & 0x1f; - } - else { + } else { this->direction = sub_08049EE4(this); } InitializeAnimation(this, 0); } -} \ No newline at end of file +} + +// clang-format off +void (*const gUnk_080CB69C[])(Entity*) = { + sub_08021D80, + sub_08021d98, + sub_08001328, + sub_0804A7D4, + sub_08001242, + sub_08021DA8, +}; + +void (*const gUnk_080CB6B4[])(Entity*) = { + sub_08021DF0, + sub_08021E4C, + sub_08021EA4, + sub_08021EBC, +}; + +void (*const gUnk_080CB6C4[])(Entity*) = { + sub_08021DCC, + sub_08021DD4, + sub_08021DDC, +}; + +const s8 gUnk_080CB6D0[] = { + 1, -2, -5, -2, 1, 0, +}; + +const u16 gUnk_080CB6D6[] = { + 180, 180, 300, 300, 300, 300, 300, 300, + 480, 480, 480, 480, 480, 480, 720, 720, +}; + +const u8 gUnk_080CB6F6[] = { + 30, 30, 45, 45, 45, 45, 45, 45, + 60, 60, 60, 60, 60, 60, 75, 75, +}; +// clang-format on diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c new file mode 100644 index 00000000..530eeae1 --- /dev/null +++ b/src/enemy/moldorm.c @@ -0,0 +1,211 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +void sub_08022EAC(Entity*); +void sub_08022F14(Entity*); + +extern void (*const gUnk_080CBB90[])(Entity*); +extern void (*const gUnk_080CBBA0[])(Entity*); +extern void (*const gUnk_080CBBB4[])(Entity*); +extern void (*const gUnk_080CBBBC[])(Entity*); + +extern u8 gEntCount; +extern const s8 gUnk_080CBBC4[]; + +void Moldorm(Entity* this) { + gUnk_080CBB90[this->entityType.form](this); +} + +void sub_08022BA0(Entity* this) { + this->field_0x78.HALF.HI++; + this->field_0x74.HWORD = this->x.HALF.HI; + this->field_0x76.HWORD = this->y.HALF.HI; + EnemyFunctionHandler(this, gUnk_080CBBA0); + sub_08022EAC(this); +} + +void sub_08022BD4(Entity* this) { + gUnk_080CBBB4[this->action](this); +} + +void sub_08022BEC(Entity* this) { + if (this->field_0x7a.HALF.LO != this->currentHealth) + this->field_0x7a.HALF.HI = 30; + + this->field_0x7a.HALF.LO = this->currentHealth; + this->actionDelay = 1; + this->direction = this->field_0x3e; + + this->animationState = ((this->direction + 2) & 0x1c) >> 2; + this->frameIndex = this->animationState; + + this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime; + (*(Entity**)&this->field_0x7c)->hurtBlinkTime = this->hurtBlinkTime; + (*(Entity**)&this->field_0x80)->hurtBlinkTime = this->hurtBlinkTime; + sub_0804AA30(this, gUnk_080CBBA0); +} + +void sub_08022C58(Entity* this) { + Entity *tail0, *tail1, *tail2; + + this->flags &= ~0x80; + + if (gEntCount >= 0x45) + return; + + tail0 = CreateEnemy(0xd, 1); + this->attachedEntity = tail0; + tail0->spritePriority.b0 = 5; + tail0->parent = this; + CopyPosition(this, tail0); + + tail1 = CreateEnemy(0xd, 2); + tail0->attachedEntity = tail1; + tail1->spritePriority.b0 = 5; + tail1->parent = this; + CopyPosition(this, tail1); + + tail2 = CreateEnemy(0xd, 3); + tail1->attachedEntity = tail2; + tail2->spritePriority.b0 = 5; + tail2->parent = this; + CopyPosition(this, tail2); + + sub_0804A720(this); + this->action = 1; + this->actionDelay = 1; + this->field_0xf = 1; + this->flags = this->flags | 0x80; + this->parent = this; + this->attachedEntity = tail0; + *(Entity**)&this->field_0x7c = tail1; + *(Entity**)&this->field_0x80 = tail2; + + this->direction = Random() & 0x1f; + this->animationState = ((this->direction + 2) & 0x1c) >> 2; + this->frameIndex = this->animationState; + this->field_0x7a.HALF.LO = this->currentHealth; +} + +void sub_08022D40(Entity* this) { + if (this->field_0x7a.HALF.HI) { + if (this->field_0x7a.HALF.HI-- & 1) { + this->animationState = (this->animationState + 1) & 7; + this->frameIndex = this->animationState; + } + } else { + sub_08022F14(this); + sub_080AEF88(this); + + if (this->collisions) { + sub_0800417E(this, this->collisions); + this->animationState = ((this->direction + 2) & 0x1c) >> 2; + this->frameIndex = this->animationState; + } + } +} + +void sub_08022D90(Entity* this) { + if (this->parent->next) { + Entity* parent; + + gUnk_080CBBBC[this->action](this); + parent = this->parent; + this->spriteOrientation.flipY = parent->spriteOrientation.flipY; + this->spriteRendering.b3 = parent->spriteRendering.b3; + this->collisionLayer = parent->collisionLayer; + } else { + DeleteEntity(this); + } +} + +void sub_08022DE8(Entity* this) { + this->action = 1; + this->field_0x7c.BYTES.byte0 = 0x88; + this->field_0x7c.BYTES.byte1 = 0x88; + this->field_0x7c.BYTES.byte2 = 0x88; + this->field_0x7c.BYTES.byte3 = 0x88; + this->field_0x80.HALF.LO = 0x88; + this->field_0x80.HALF.HI = 0x88; + this->field_0x82.HALF.LO = 0x88; + this->field_0x82.HALF.HI = 0x88; + this->animationState = this->parent->animationState; + *(u32*)&this->cutsceneBeh = this->animationState * 0x11111111; + + if (this->entityType.form != 3) { + this->frameIndex = this->entityType.form + 7; + } else { + this->frameIndex = this->animationState + 10; + } +} + +NAKED +void sub_08022E40(Entity* this) { + asm(".include \"asm/non_matching/moldorm/sub_08022E40.inc\""); +} + +NAKED +void sub_08022EAC(Entity* this) { + asm(".include \"asm/non_matching/moldorm/sub_08022EAC.inc\""); +} + +void sub_08022F14(Entity* this) { + if (sub_08049FA0(this) == 0) { + u32 bVar6 = (sub_08049EE4(this) - this->direction) & 0x1f; + if (8 < ((bVar6 + 4) & 0x1f)) { + this->field_0xf = 8; + if (bVar6 < 0x10) { + this->field_0x78.HALF.LO = 1; + } else { + this->field_0x78.HALF.LO = -1; + } + } + } + + if (--this->actionDelay == 0) { + this->actionDelay = 4; + + if (--this->field_0xf == 0) { + this->field_0xf = 8; + this->field_0x78.HALF.LO = gUnk_080CBBC4[Random() & 1]; + } + + this->direction += this->field_0x78.HALF.LO; + this->direction &= 0x1f; + + this->animationState = ((this->direction + 2) & 0x1c) >> 2; + this->frameIndex = this->animationState; + } +} + +// clang-format off +void (*const gUnk_080CBB90[])(Entity*) = { + sub_08022BA0, + sub_08022D90, + sub_08022D90, + sub_08022D90, +}; + +void (*const gUnk_080CBBA0[])(Entity*) = { + sub_08022BD4, + sub_08022BEC, + sub_08001324, + sub_0804A7D4, + sub_08001242, +}; + +void (*const gUnk_080CBBB4[])(Entity*) = { + sub_08022C58, + sub_08022D40, +}; + +void (*const gUnk_080CBBBC[])(Entity*) = { + sub_08022DE8, + sub_08022E40, +}; + +const s8 gUnk_080CBBC4[] = { + 1, -1, 0, 0, +}; +// clang-format off diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c new file mode 100644 index 00000000..337e21dc --- /dev/null +++ b/src/enemy/rockChuchu.c @@ -0,0 +1,122 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +extern void sub_0804A4E4(Entity*, Entity*); + +extern void (*const gUnk_080CB948[])(Entity*); +extern void (*const gUnk_080CB960[])(Entity*); + +void RockChuchu(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CB948); +} + +void sub_0802223C(Entity* this) { + gUnk_080CB960[this->action](this); +} + +void sub_08022254(Entity* this) { + Entity* ent; + + if (this->currentHealth) { + switch (this->bitfield & 0x7f) { + case 4: + case 5: + case 6: + case 8: + case 9: + case 10: + case 0xb: + case 0xc: + case 0xd: + case 0x10: + case 0x11: + case 0x12: + case 0x18: + case 0x19: + case 0x1a: + if ((gPlayerState.field_0xac & 8) == 0) + break; + case 0x16: + case 0x1c: + CreateFx(this, 4, 0); + ent = CreateEnemy(1, 1); + if (ent) { + ent->entityType.parameter = 1; + ent->hurtBlinkTime = -8; + sub_0804A4E4(this, ent); + this->action = 2; + this->flags &= ~0x80; + this->spriteSettings.b.draw = 0; + this->direction = this->field_0x3e; + this->attachedEntity = ent; + } + } + } else { + if (this->damageType != 0x94) + InitializeAnimation(this, 2); + } + + sub_0804AA30(this, gUnk_080CB948); +} + +void nullsub_131(Entity* this) { +} + +void sub_08022368(Entity* this) { + sub_0804A720(this); + this->action = 1; + this->actionDelay = Random(); + this->direction = sub_08049F84(this, 1); + InitializeAnimation(this, 0); +} + +void sub_08022390(Entity* this) { + if (sub_08049FDC(this, 1)) { + if ((this->actionDelay++ & 0xf) == 0) { + this->direction = sub_08049F84(this, 1); + this->field_0xf = Random() & 4; + } + + if (this->field_0xf == 0) { + sub_080AEF88(this); + } else { + this->field_0xf = this->field_0xf - 1; + } + } else { + this->actionDelay = Random(); + } + + GetNextFrame(this); +} + +void sub_080223E4(Entity* this) { + Entity* ent; + + ent = this->attachedEntity; + if (ent) { + ent->bitfield = 0x94; + ent->hurtBlinkTime = 0x10; + ent->field_0x42 = 0xc; + ent->field_0x3e = this->direction; + } + + DeleteEntity(this); +} + +// clang-format off +void (*const gUnk_080CB948[])(Entity*) = { + sub_0802223C, + sub_08022254, + sub_08001324, + sub_0804A7D4, + sub_08001242, + nullsub_131, +}; + +void (*const gUnk_080CB960[])(Entity*) = { + sub_08022368, + sub_08022390, + sub_080223E4, +}; +// clang-format on diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c new file mode 100644 index 00000000..a3d41a1b --- /dev/null +++ b/src/enemy/spinyChuchu.c @@ -0,0 +1,285 @@ +#include "enemy.h" +#include "entity.h" +#include "functions.h" + +extern void sub_08001318(Entity*); +extern u32 sub_08049F64(Entity*, u32, u32); +extern void sub_0804A4E4(Entity*, Entity*); +extern void sub_0804AA1C(Entity*); + +u32 sub_080228CC(Entity*); +u32 sub_080228F0(Entity*); + +extern void (*const gUnk_080CBA28[])(Entity*); +extern void (*const gUnk_080CBA40[])(Entity*); + +extern const u8 gUnk_080CBA60[]; + +extern BoundingBox gUnk_080FD468; +extern BoundingBox gUnk_080FD470; + +extern Entity* gUnk_020000B0; + +void SpinyChuchu(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CBA28); + SetChildOffset(this, 0, 1, -0x10); +} + +void sub_08022434(Entity* this) { + gUnk_080CBA40[this->action](this); +} + +void sub_0802244C(Entity* this) { + if (this->currentHealth) { + if (this->damageType == 0x65) { + switch (this->bitfield & 0x7f) { + case 2: + case 3: + this->action = 2; + this->field_0xf = 0x3c; + this->damageType = 0x5c; + this->boundingBox = &gUnk_080FD468; + InitializeAnimation(this, 0); + break; + case 8: + case 9: + case 10: + case 0xb: + case 0xc: + case 0x16: + case 0x18: + case 0x19: + case 0x1a: + sub_0804A9FC(this, 0x1c); + this->action = 5; + this->damageType = 0x5c; + InitializeAnimation(this, 1); + } + } else if (this->bitfield == 0x94) { + sub_0804A9FC(this, 0x1c); + this->action = 5; + InitializeAnimation(this, 1); + } + + if (this->field_0x80.HALF.LO != this->currentHealth) { + this->action = 5; + this->damageType = 0x5c; + InitializeAnimation(this, 1); + } else { + if (this->action == 3) { + this->action = 4; + InitializeAnimation(this, 3); + sub_08004488(0x194); + } + } + } else { + InitializeAnimation(this, 1); + } + + this->field_0x80.HALF.LO = this->currentHealth; + sub_0804AA30(this, gUnk_080CBA28); +} + +void sub_080225A0(Entity* this) { + if (this->animIndex == 1) + GetNextFrame(this); + sub_08001318(this); +} + +void sub_080225BC(Entity* this) { + sub_08003FC4(this, 0x1800); + if (this->frames.all & 1) { + sub_0804A7D4(this); + } else { + GetNextFrame(this); + } +} + +void nullsub_9(Entity* this) { +} + +void sub_080225EC(Entity* this) { + sub_0804A720(this); + this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.HI = 0x5a; + if (this->actionDelay == 0) { + this->action = 2; + InitializeAnimation(this, 0); + } else { + this->action = 1; + this->field_0xf = 0x3c; + this->spriteSettings.b.draw = 3; + this->spriteRendering.b3 = 1; + this->spriteOrientation.flipY = 1; + this->height.HALF.HI = -0x80; + InitializeAnimation(this, 6); + } +} + +void sub_08022654(Entity* this) { + switch (this->previousActionFlag) { + case 0: + if (--this->field_0xf) + return; + this->previousActionFlag = 1; + PlaySFX(0x12d); + InitializeAnimation(this, 0); + /* fallthrough */ + case 1: + if (sub_08003FC4(this, 0x1800)) + return; + + this->previousActionFlag = 2; + this->spriteSettings.b.draw = 1; + InitializeAnimation(this, 5); + sub_08004488(0x7d); + UpdateSpriteForCollisionLayer(this); + /* fallthrough */ + case 2: + GetNextFrame(this); + if (--this->actionDelay == 0) { + this->action = 3; + this->damageType = 0x65; + InitializeAnimation(this, 2); + } + break; + } +} + +void sub_080226EC(Entity* this) { + if (sub_08049FDC(this, 1)) { + if (sub_080228CC(this)) { + this->action = 3; + this->damageType = 0x65; + InitializeAnimation(this, 2); + return; + } + + if (sub_080228F0(this)) { + this->action = 6; + this->field_0x20 = 0x12000; + this->nonPlanarMovement = 0x140; + this->direction = GetFacingDirection(this, gUnk_020000B0); + this->damageType = 0x5a; + InitializeAnimation(this, 4); + return; + } + + if ((this->actionDelay++ & 7) == 0) { + this->direction = sub_08049F84(this, 1); + } + + sub_080AEF88(this); + } + + GetNextFrame(this); +} + +void sub_08022780(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 0x80) { + this->action = 4; + InitializeAnimation(this, 3); + sub_08004488(0x194); + } +} + +void sub_080227AC(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 1) { + this->boundingBox = &gUnk_080FD470; + } else { + this->boundingBox = &gUnk_080FD468; + } + + if (this->frames.all & 2) { + this->frames.all &= ~2; + this->damageType = 0x5c; + } + + if (this->frames.all & 0x80) { + this->action = 2; + this->field_0xf = gUnk_080CBA60[Random() & 3]; + InitializeAnimation(this, 0); + } +} + +void sub_0802281C(Entity* this) { + sub_08003FC4(this, 0x1800); + GetNextFrame(this); + if (this->frames.all & 0x80) { + this->action = 2; + this->nonPlanarMovement = 0x20; + InitializeAnimation(this, 0); + sub_0804AA1C(this); + } +} + +void sub_08022854(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 1) { + sub_080AEFE0(this); + if (sub_08003FC4(this, 0x1800) == 0) { + this->action = 7; + this->damageType = 0x5c; + InitializeAnimation(this, 5); + sub_08004488(0x7d); + } + } +} + +void sub_0802289C(Entity* this) { + GetNextFrame(this); + if (this->frames.all & 0x80) { + this->action = 2; + this->nonPlanarMovement = 0x20; + this->field_0x80.HALF.HI = 0x78; + InitializeAnimation(this, 0); + } +} + +u32 sub_080228CC(Entity* this) { + if (this->field_0xf == 0) { + if (sub_08049F64(this, 1, 0x28)) + return 1; + } else { + this->field_0xf--; + } + return 0; +} + +u32 sub_080228F0(Entity* this) { + if (this->field_0x80.HALF.HI == 0) { + if (sub_08049F64(this, 1, 0x40)) + return 1; + } else { + this->field_0x80.HALF.HI--; + } + return 0; +} + +// clang-format off +void (*const gUnk_080CBA28[])(Entity*) = { + sub_08022434, + sub_0802244C, + sub_080225A0, + sub_080225BC, + sub_08001242, + nullsub_9, +}; + +void (*const gUnk_080CBA40[])(Entity*) = { + sub_080225EC, + sub_08022654, + sub_080226EC, + sub_08022780, + sub_080227AC, + sub_0802281C, + sub_08022854, + sub_0802289C, +}; + +const u8 gUnk_080CBA60[] = { + 10, 20, 30, 20, +}; +// clang-format on diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index c874530b..cc1f45d7 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -30,8 +30,8 @@ void MineralWaterSource_Init(Entity *this) { this->entityType.parameter = unknownParameters->field_0x00; this->field_0x40 = unknownParameters->field_0x03; - this->boundingBox->field_0x6 = unknownParameters->field_0x01; - this->boundingBox->field_0x7 = unknownParameters->field_0x02; + this->boundingBox->unknown[6] = unknownParameters->field_0x01; + this->boundingBox->unknown[7] = unknownParameters->field_0x02; this->flags |= 0x80; diff --git a/src/object/object49.c b/src/object/object49.c index e3fa37dd..0617aad2 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -243,10 +243,10 @@ void sub_0808F498(Entity* this) { this->action = 1; this->actionDelay = 64; var0 = this->entityType.parameter != 0 ? 44 : 43; - this->x.HALF.HI -= this->parent->boundingBox->field_0x6; - this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x6 * 2); - this->y.HALF.HI -= this->parent->boundingBox->field_0x7; - this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x7 * 2); + this->x.HALF.HI -= this->parent->boundingBox->unknown[6]; + this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[6] * 2); + this->y.HALF.HI -= this->parent->boundingBox->unknown[7]; + this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[7] * 2); sub_0801D2B4(this, var0); InitializeAnimation(this, 4); }