specialFx.c: extract rodata

This commit is contained in:
Ibot02
2022-02-04 23:03:33 +01:00
parent 0e22759e4d
commit dcf7b2f494
4 changed files with 114 additions and 97 deletions
+112 -11
View File
@@ -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];
}