Decompile RIC func_8016E9E4 (#925)

This required an update to maspsx, so that update is also included as
part of this PR.
This commit is contained in:
bismurphy 2023-12-31 10:08:02 -05:00 committed by GitHub
parent bbf8be1e4b
commit 57a99f25a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 206 additions and 4 deletions

View File

@ -51,7 +51,7 @@ segments:
- [0x1A9E8, rodata]
- [0x1AB04, rodata]
- [0x1AB68, .rodata, 32324]
- [0x1AB88, rodata]
- [0x1ABB0, rodata]
- [0x1ABC8, .rodata, 345EC]
- [0x1AC50, rodata]
- [0x1AC60, c, 1AC60]

View File

@ -161,7 +161,6 @@ EntityHolyWaterFlame = 0x801262AC;
EntitySubwpnCrashCross = 0x801267B0;
EntityHellfireHandler = 0x80126ECC;
EntitySummonSpirit = 0x8012A0A4;
EntityStopWatchExpandingCircle = 0x8012A528;
EntityStopWatch = 0x8012A89C;
EntityBatEcho = 0x8012BEF8;
MuteSound = 0x80132760;

View File

@ -644,6 +644,16 @@ typedef struct {
s16 unk82;
} ET_80162870;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s32 unk88;
} ET_8016E9E4;
typedef union {
/* 0x7C */ struct Primitive* prim;
/* 0x7C */ ET_EntFactory factory;
@ -674,6 +684,7 @@ typedef union {
/* 0x7C */ ET_stopwatchCircle et_stopwatchCircle;
/* 0x7C */ ET_80161FF0 et_80161FF0;
/* 0x7C */ ET_80162870 et_80162870;
/* 0x7C */ ET_8016E9E4 et_8016E9E4;
/* 0x7C */ ET_801719A4 et_801719A4;
/* 0x7C */ ET_BibleSubwpn et_BibleSubwpn;
/* 0x7C */ ET_801CF254 et_801CF254;

View File

@ -41,7 +41,196 @@ void func_8016E324(Entity* entity) {
INCLUDE_ASM("asm/us/ric/nonmatchings/32324", func_8016E46C);
INCLUDE_ASM("asm/us/ric/nonmatchings/32324", func_8016E9E4);
void func_8016E9E4(Entity* self) {
Primitive* prim;
s16 temp_a1_3;
s16 temp_v0_6;
s32 temp_s0_2;
s32 temp_s5;
s32 temp_s6;
s32 temp_v0_4;
s32 temp_v0_5;
s32 i;
s16 temp_a0;
s16 temp_a1;
switch (self->step) {
case 0:
self->primIndex = g_api.AllocPrimitives(PRIM_GT4, 7);
if (self->primIndex == -1) {
DestroyEntity(self);
g_Player.unk4E = 1;
return;
}
self->flags = FLAG_UNK_04000000 | FLAG_HAS_PRIMS | FLAG_UNK_20000;
self->posX.val = PLAYER.posX.val;
self->posY.val = PLAYER.posY.val;
self->velocityY = FIX(-4);
if (self->facingLeft) {
self->velocityX = FIX(12);
self->ext.et_8016E9E4.unk88 = FIX(1.5);
self->ext.et_8016E9E4.unk7E = -0x200;
} else {
self->velocityX = FIX(-12);
self->ext.et_8016E9E4.unk88 = FIX(-1.5);
self->ext.et_8016E9E4.unk7E = 0x200;
}
prim = &g_PrimBuf[self->primIndex];
prim->tpage = 0x1E;
prim->clut = 0x17F;
prim->u0 = prim->u2 = 0x98;
prim->v0 = prim->v1 = 0xD8;
prim->u1 = prim->u3 = 0xA8;
prim->v2 = prim->v3 = 0xF0;
prim->priority = 0xC2;
prim->blendMode = 8;
prim = prim->next;
for (i = 0; i < 6; i++) {
prim->tpage = 0x1C;
prim->clut = 0x1AE;
prim->u0 = prim->u2 = 0x20;
prim->u1 = prim->u3 = 0x30;
prim->v0 = prim->v1 = 0;
prim->v2 = prim->v3 = 0x10;
prim->priority = 0xC1;
prim->blendMode = BLEND_VISIBLE;
prim = prim->next;
}
self->ext.et_8016E9E4.unk84 = 0x40;
D_801758AC = 0x60;
self->step++;
break;
case 1:
prim = &g_PrimBuf[self->primIndex];
prim->blendMode &= ~BLEND_VISIBLE;
self->step++;
case 2:
self->posX.val += self->velocityX;
self->posY.val += self->velocityY;
self->velocityX -= self->ext.et_8016E9E4.unk88;
self->velocityY -= FIX(0.5);
if (++self->ext.et_8016E9E4.unk82 >= 8) {
self->ext.et_8016E9E4.unk82 = 0;
self->step++;
}
break;
case 3:
if (++self->ext.et_8016E9E4.unk82 >= 6) {
prim = &g_PrimBuf[self->primIndex];
prim->clut = 0x19F;
prim->blendMode |= 0x35;
prim = prim->next;
for (i = 0; i < 6; i++) {
prim->blendMode &= ~BLEND_VISIBLE;
prim = prim->next;
}
self->ext.et_8016E9E4.unk82 = 0;
self->step++;
}
break;
case 4:
self->ext.et_8016E9E4.unk84 -= 4;
if (self->ext.et_8016E9E4.unk84 <= 0) {
self->step++;
}
break;
case 5:
prim = &g_PrimBuf[self->primIndex];
prim->blendMode |= BLEND_VISIBLE;
self->step++;
case 6:
self->ext.et_8016E9E4.unk7C =
(self->ext.et_8016E9E4.unk7C + 0x80) & 0xFFF;
self->ext.et_8016E9E4.unk80 += 4;
if (self->ext.et_8016E9E4.unk80 >= 0x30) {
self->step++;
}
break;
case 7:
self->ext.et_8016E9E4.unk7C =
(self->ext.et_8016E9E4.unk7C + 0x80) & 0xFFF;
if (++self->ext.et_8016E9E4.unk82 >= 0x1E) {
CreateEntFactoryFromEntity(self, FACTORY(0, 60), 0);
self->ext.et_8016E9E4.unk82 = 0;
self->step++;
}
break;
case 8:
self->ext.et_8016E9E4.unk7C =
(self->ext.et_8016E9E4.unk7C + 0x80) & 0xFFF;
if (++self->ext.et_8016E9E4.unk82 >= 0x60) {
g_Player.unk4E = 1;
self->step++;
}
break;
case 9:
self->ext.et_8016E9E4.unk7C =
(self->ext.et_8016E9E4.unk7C + 0x80) & 0xFFF;
self->ext.et_8016E9E4.unk80 -= 2;
if (self->ext.et_8016E9E4.unk80 <= 0) {
DestroyEntity(self);
return;
}
break;
}
// FAKE, needed for reg match
temp_a1 = self->ext.et_8016E9E4.unk7C;
if ((self->ext.et_8016E9E4.unk7C == 0x100) ||
(self->ext.et_8016E9E4.unk7C == 0x500) ||
(self->ext.et_8016E9E4.unk7C == 0x900) ||
(self->ext.et_8016E9E4.unk7C == 0xD00)) {
if (self->step < 9) {
g_api.func_80134714(0x625, D_801758AC, 0);
if (self->step >= 5) {
D_801758AC -= 4;
}
if (D_801758AC < 0) {
D_801758AC = 0;
}
}
}
temp_a0 = self->posX.i.hi;
temp_a1 = self->posY.i.hi;
prim = &g_PrimBuf[self->primIndex];
prim->x0 = prim->x2 = temp_a0 - 8;
prim->x1 = prim->x3 = temp_a0 + 8;
prim->y0 = prim->y1 = temp_a1 - 12;
prim->y2 = prim->y3 = temp_a1 + 12;
prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = prim->r2 =
prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3 =
self->ext.et_8016E9E4.unk84;
prim = prim->next;
temp_s6 = rsin(self->ext.et_8016E9E4.unk7E);
temp_s5 = rcos(self->ext.et_8016E9E4.unk7E);
for (i = 0; i < 6; i++) {
temp_s0_2 = (rsin(self->ext.et_8016E9E4.unk7C + D_80155EF0[i]) *
self->ext.et_8016E9E4.unk80) >>
0xC;
temp_v0_4 = (rcos(self->ext.et_8016E9E4.unk7C + D_80155EF0[i]) *
self->ext.et_8016E9E4.unk80) >>
0xC;
temp_a1_3 =
self->posX.i.hi + ((((temp_s6 * temp_v0_4) >> 0xC) << 9) /
(((temp_s5 * temp_v0_4) >> 0xC) + 0x200));
temp_v0_6 =
self->posY.i.hi +
((temp_s0_2 << 9) / (((temp_s5 * temp_v0_4) >> 0xC) + 0x200));
temp_v0_5 = ((temp_s5 * temp_v0_4) >> 0xC) + 0x200;
D_80175894[i].unk0 = temp_a1_3;
D_80175894[i].unk2 = temp_v0_6;
prim->x0 = prim->x2 = temp_a1_3 - 0x1000 / temp_v0_5;
prim->x1 = prim->x3 = temp_a1_3 + 0x1000 / temp_v0_5;
// FAKE, needed for reg match
temp_a0 = (prim->y1 = temp_v0_6 - 0x1000 / temp_v0_5);
prim->y0 = temp_a0;
prim->y2 = prim->y3 = temp_v0_6 + 0x1000 / temp_v0_5;
prim = prim->next;
}
}
INCLUDE_ASM("asm/us/ric/nonmatchings/32324", func_8016F198);

View File

@ -177,6 +177,7 @@ extern s16 D_80155D1C[];
extern s16 D_80155D30;
extern s16 D_80155E68[];
extern AnimationFrame* D_80155EA8;
extern s16 D_80155EF0[];
extern SVECTOR* D_8015607C[][4];
extern u8 D_8015635C[][5];
extern s8 D_80156904;
@ -194,6 +195,8 @@ extern u8 D_80174FB8;
extern s16_pair D_80174FBC[];
extern s32 D_80174FFC;
extern s32 D_80175080;
extern s16_pair D_80175894[];
extern s32 D_801758AC;
extern s32 D_801758B0[];
extern Entity* D_801758CC[];
extern u32 D_801758D0;

@ -1 +1 @@
Subproject commit 34bd6f784c37bb0befd6d9d67178a5cdc33814bc
Subproject commit c263a0436517e6aeb5d0fc434527295161838b8b