diff --git a/assets/assets.json b/assets/assets.json index 706dcd76..3d8c06e5 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -43050,47 +43050,6 @@ "size": 56, "type": "animation" }, - { - "path": "specialFx/gUnk_0811F960.bin", - "start": 1177952, - "size": 155 - }, - { - "path": "specialFx/gUnk_0811F960_1_EU.bin", - "variants": [ - "EU" - ], - "starts": { - "EU": 1175875 - }, - "size": 197 - }, - { - "path": "specialFx/gUnk_0811F960_2_USA-JP-DEMO_USA-DEMO_JP.bin", - "variants": [ - "USA", - "JP", - "DEMO_USA", - "DEMO_JP" - ], - "start": 1178107, - "size": 197 - }, - { - "path": "specialFx/gUnk_0811FAC8.bin", - "start": 1178312, - "size": 4 - }, - { - "path": "specialFx/gUnk_0811FACC.bin", - "start": 1178316, - "size": 4 - }, - { - "path": "specialFx/gUnk_0811FB08.bin", - "start": 1178376, - "size": 8 - }, { "path": "object10/gUnk_0812056C.bin", "start": 1181036, @@ -51454,4 +51413,4 @@ }, "size": 129 } -] \ No newline at end of file +] diff --git a/data/const/object/specialFx.s b/data/const/object/specialFx.s deleted file mode 100644 index da0c9e6f..00000000 --- a/data/const/object/specialFx.s +++ /dev/null @@ -1,43 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_0811F960:: @ 0811F960 - .incbin "specialFx/gUnk_0811F960.bin" -.ifdef EU - @ TODO only small differences - .incbin "specialFx/gUnk_0811F960_1_EU.bin" -.else - .incbin "specialFx/gUnk_0811F960_2_USA-JP-DEMO_USA-DEMO_JP.bin" -.endif - -gUnk_0811FAC0:: @ 0811FAC0 - .4byte sub_080844E0 - .4byte sub_080845B8 - -gUnk_0811FAC8:: @ 0811FAC8 - .incbin "specialFx/gUnk_0811FAC8.bin" - -gUnk_0811FACC:: @ 0811FACC - .incbin "specialFx/gUnk_0811FACC.bin" - -gUnk_0811FAD0:: @ 0811FAD0 - .4byte sub_080845DC - .4byte sub_080845F8 - .4byte sub_08084630 - .4byte sub_08084694 - .4byte DeleteEntity - .4byte sub_08084680 - .4byte sub_080846B0 - .4byte sub_0808471C - .4byte sub_08084770 - .4byte sub_08084798 - .4byte sub_080847BC - .4byte sub_08084784 - .4byte sub_080847D0 - .4byte sub_080847E0 - -gUnk_0811FB08:: @ 0811FB08 - .incbin "specialFx/gUnk_0811FB08.bin" diff --git a/linker.ld b/linker.ld index 6cf49bb3..49084044 100644 --- a/linker.ld +++ b/linker.ld @@ -1377,7 +1377,7 @@ SECTIONS { data/animations/object/chestSpawner.o(.rodata); data/const/object/objectD.o(.rodata); data/animations/object/objectD.o(.rodata); - data/const/object/specialFx.o(.rodata); + src/object/specialFx.o(.rodata); data/animations/object/specialFx.o(.rodata); data/const/object/object10.o(.rodata); data/const/object/object11.o(.rodata); diff --git a/src/object/specialFx.c b/src/object/specialFx.c index d4abfb9d..dcd3a25a 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -10,19 +10,110 @@ typedef struct { u8 unk_6c[0x1C]; } SpecialFxObject; -extern void (*gUnk_0811FAC0[])(SpecialFxObject*); - -extern u8 gUnk_0811FAC8[]; -extern u8 gUnk_0811FACC[]; - typedef struct { u8 unk_00 : 4; + u8 unk_00_4 : 4; u8 unk_01; u16 unk_02; } struct_0811F960; -extern struct_0811F960 gUnk_0811F960[]; -extern void (*gUnk_0811FAD0[])(SpecialFxObject*); +// way more legible like this than if clang-format were to put multiple elements on each line +// clang-format off +const struct_0811F960 gUnk_0811F960[] = { + {0x1, 0x0, 0x00, 0x12D}, + {0x0, 0x0, 0x00, 0x0FD}, + {0x0, 0x0, 0x00, 0x124}, + {0x0, 0x1, 0x11, 0x123}, + {0x0, 0x1, 0x12, 0x164}, + {0x0, 0x1, 0x13, 0x10D}, + {0x0, 0x0, 0x00, 0x0FF}, + {0x5, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x2, 0x1, 0x00, 0x084}, + {0x2, 0x1, 0x00, 0x084}, + {0x0, 0x0, 0x00, 0x195}, + {0x0, 0x0, 0x00, 0x164}, + {0x0, 0x0, 0x00, 0x10D}, + {0x0, 0x1, 0x00, 0x074}, + {0x0, 0x0, 0x00, 0x10C}, + {0x5, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x10, 0x123}, + {0x5, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x164}, + {0x0, 0x1, 0x14, 0x1A8}, + {0x0, 0x1, 0x10, 0x088}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x3, 0x0, 0x00, 0x197}, + {0x3, 0x0, 0x00, 0x000}, + {0x6, 0x1, 0x00, 0x074}, + {0x3, 0x0, 0x00, 0x074}, + {0x0, 0x0, 0x00, 0x074}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x7, 0x0, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x3, 0x1, 0x00, 0x000}, + {0x8, 0x1, 0x00, 0x000}, + {0x9, 0x1, 0x00, 0x15F}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x2, 0x1, 0x00, 0x084}, + {0x0, 0x0, 0x00, 0x074}, + {0x0, 0x0, 0x00, 0x164}, + {0xA, 0x1, 0x00, 0x000}, + {0xA, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x9, 0x1, 0x00, 0x15F}, + {0x9, 0x1, 0x00, 0x15F}, + {0x9, 0x1, 0x00, 0x15F}, + {0x0, 0x0, 0x00, 0x000}, + {0x2, 0x0, 0x00, 0x17F}, + {0x0, 0x1, 0x11, 0x123}, + {0x0, 0x1, 0x11, 0x123}, + {0x0, 0x1, 0x11, 0x123}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x1B4}, + {0x0, 0x1, 0x13, 0x164}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x10, 0x088}, + {0x0, 0x1, 0x10, 0x088}, + {0x0, 0x1, 0x10, 0x088}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x11D}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x0, 0x00, 0x164}, + {0x0, 0x0, 0x00, 0x0FD}, + {0x0, 0x0, 0x00, 0x0FD}, + {0x0, 0x0, 0x00, 0x0FD}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0xB, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x000}, + {0x0, 0x1, 0x00, 0x0FD}, + {0x2, 0x1, 0x00, 0x084}, +#ifndef EU + {0x0, 0x0, 0x18, 0x124}, +#else + {0x0, 0x0, 0x16, 0x124}, +#endif + {0xC, 0x0, 0x00, 0x124}, + {0x0, 0x0, 0x00, 0x0FD}, + {0xD, 0x1, 0x00, 0x000}, + {0xD, 0x1, 0x00, 0x000}, +}; +// clang-format on void SpecialFx(Entity*); void sub_080844E0(SpecialFxObject*); @@ -42,11 +133,17 @@ void sub_080847D0(SpecialFxObject*); void sub_080847E0(SpecialFxObject*); void SpecialFx(Entity* this) { + static void (*const gUnk_0811FAC0[])(SpecialFxObject*) = { + sub_080844E0, + sub_080845B8, + }; gUnk_0811FAC0[this->action]((SpecialFxObject*)this); } void sub_080844E0(SpecialFxObject* this) { - struct_0811F960* ptr; + static const u8 gUnk_0811FAC8[] = { 0x03, 0x37, 0x38, 0x39 }; + static const u8 gUnk_0811FACC[] = { 0x17, 0x3e, 0x3f, 0x40 }; + const struct_0811F960* ptr; super->action = 1; super->flags &= ~0x80; super->spriteSettings.draw = 1; @@ -80,6 +177,11 @@ void sub_080844E0(SpecialFxObject* this) { } void sub_080845B8(SpecialFxObject* this) { + static void (*const gUnk_0811FAD0[])(SpecialFxObject*) = { + sub_080845DC, sub_080845F8, sub_08084630, sub_08084694, (void (*)(SpecialFxObject*))DeleteEntity, + sub_08084680, sub_080846B0, sub_0808471C, sub_08084770, sub_08084798, + sub_080847BC, sub_08084784, sub_080847D0, sub_080847E0, + }; gUnk_0811FAD0[gUnk_0811F960[super->type].unk_00](this); } @@ -149,16 +251,15 @@ void sub_080846B0(SpecialFxObject* this) { } } -extern s8 gUnk_0811FB08[]; - void sub_0808471C(SpecialFxObject* this) { + static const s8 gUnk_0811FB08[] = { -8, -8, 8, -8, -8, 8, 8, 8 }; GetNextFrame(super); if (super->frame & 0x80) { u32 i; for (i = 0; i < 4; i++) { Entity* fx = CreateFx(super, 0x24, 0); if (fx) { - s8* ptr = &gUnk_0811FB08[2 * i]; + const s8* ptr = &gUnk_0811FB08[2 * i]; fx->x.HALF.HI += ptr[0]; fx->y.HALF.HI += ptr[1]; }